diff --git a/badtimesimulator/appmanifest.json b/badtimesimulator/appmanifest.json new file mode 100644 index 00000000..44875ddf --- /dev/null +++ b/badtimesimulator/appmanifest.json @@ -0,0 +1,28 @@ +{ + "name": "Bad Time Simulator (Sans Fight)", + "short_name": "Bad Time Simulator (Sans Fight)", + "start_url": "index.html", + "display": "fullscreen", + "orientation": "any", + "icons": [{ + "src": "icon-16.png", + "sizes": "16x16", + "type": "image/png" + }, { + "src": "icon-32.png", + "sizes": "32x32", + "type": "image/png" + }, { + "src": "icon-128.png", + "sizes": "128x128", + "type": "image/png" + }, { + "src": "icon-256.png", + "sizes": "144x144", + "type": "image/png" + }, { + "src": "icon-256.png", + "sizes": "256x256", + "type": "image/png" + }] +} diff --git a/badtimesimulator/c2runtime.js b/badtimesimulator/c2runtime.js new file mode 100644 index 00000000..e656c65d --- /dev/null +++ b/badtimesimulator/c2runtime.js @@ -0,0 +1,477 @@ +// Generated by Construct 2, the HTML5 game and app creator :: https://www.construct.net +'use strict';var aa,ba,ca,da,fa,ga,ha,ja,z,la,ma,na,pa,qa,sa,ta,ua,va,wa,xa,ya,za,Ba,A,Da,Fa,Ha,Ia,Ja,G,Ka,La,Ma,Na,Oa,Pa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,$b,ac,bc,cc,dc,ec,fc,gc,hc,ic,jc={};"function"!==typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===typeof"test".__proto__?function(h){return h.__proto__}:function(h){return h.constructor.prototype}); +(function(){function h(a,c,e,b){this.set(a,c,e,b)}function r(){this.ab=this.$a=this.cb=this.bb=this.ob=this.nb=this.Ga=this.Fa=0}function p(a,c,b,k){ak?c:k):(e=ab?c:b):bk?a:k):(e=cb?a:b)}function t(){this.items=this.Fd=null;this.Nh=0;E&&(this.Fd=new Set);this.Ug=[];this.ue=!0}function v(a){Ea[oa++]=a}function n(){this.Z=this.Vk=this.y=this.Il=0}function g(a){this.lb=[];this.gj=this.ij=this.jj=this.hj=0;this.oi(a)}function b(a,c){this.Ml= +a;this.Ll=c;this.cells={}}function d(a,c){this.Ml=a;this.Ll=c;this.cells={}}function l(a,c,e){var b;return K.length?(b=K.pop(),b.rm=a,b.x=c,b.y=e,b):new ba(a,c,e)}function c(a,c,e){this.rm=a;this.x=c;this.y=e;this.sb=new ca}function f(a,c,e){var b;return L.length?(b=L.pop(),b.rm=a,b.x=c,b.y=e,b):new da(a,c,e)}function a(a,c,e){this.rm=a;this.x=c;this.y=e;this.sb=[];this.mg=!0;this.Cd=new ca;this.eh=!1}function k(a,c){return a.pd-c.pd}fa=function(a){window.console&&window.console.log&&window.console.log(a)}; +ga=function(a){window.console&&window.console.error&&window.console.error(a)};aa=function(a){return a};ha=function(a){return"undefined"===typeof a};ja=function(a){return"number"===typeof a};z=function(a){return"string"===typeof a};la=function(a){return 0c;c<<=1)a=a|a>>c;return a+1};na=function(a){return 0>a?-a:a};pa=function(a,c){return a>c?a:c};qa=function(a,c){return ad)return!1;cd)return!1;B=k-a+q-e;u=f-c+x-b;a=e-a;c=b-c;k=q-k;f=x-f;x=na(c*k-f*a);return na(k*u-f*B)>x?!1:na(a*u-c*B)<=x};h.prototype.set=function(a,c,e,b){this.left=a;this.top=c;this.right=e;this.bottom=b};h.prototype.Vf=function(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom};h.prototype.width= +function(){return this.right-this.left};h.prototype.height=function(){return this.bottom-this.top};h.prototype.offset=function(a,c){this.left+=a;this.top+=c;this.right+=a;this.bottom+=c;return this};h.prototype.normalize=function(){var a=0;this.left>this.right&&(a=this.left,this.left=this.right,this.right=a);this.top>this.bottom&&(a=this.top,this.top=this.bottom,this.bottom=a)};h.prototype.Xw=function(a){return!(a.rightthis.right||a.top>this.bottom)};h.prototype.Yw= +function(a,c,e){return!(a.right+cthis.right||a.top+e>this.bottom)};h.prototype.Ib=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};h.prototype.oh=function(a){return this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom};wa=h;r.prototype.ni=function(a){this.Fa=a.left;this.Ga=a.top;this.nb=a.right;this.ob=a.top;this.bb=a.right;this.cb=a.bottom;this.$a=a.left;this.ab=a.bottom};r.prototype.Br=function(a, +c){if(0===c)this.ni(a);else{var e=Math.sin(c),b=Math.cos(c),k=a.left*e,f=a.top*e,q=a.right*e,e=a.bottom*e,x=a.left*b,B=a.top*b,u=a.right*b,b=a.bottom*b;this.Fa=x-f;this.Ga=B+k;this.nb=u-f;this.ob=B+q;this.bb=u-e;this.cb=b+q;this.$a=x-e;this.ab=b+k}};r.prototype.offset=function(a,c){this.Fa+=a;this.Ga+=c;this.nb+=a;this.ob+=c;this.bb+=a;this.cb+=c;this.$a+=a;this.ab+=c;return this};var e=0,u=0;r.prototype.To=function(a){p(this.Fa,this.nb,this.bb,this.$a);a.left=e;a.right=u;p(this.Ga,this.ob,this.cb, +this.ab);a.top=e;a.bottom=u};r.prototype.Ib=function(a,c){var e=this.Fa,b=this.Ga,k=this.nb-e,f=this.ob-b,q=this.bb-e,x=this.cb-b,B=a-e,u=c-b,d=k*k+f*f,m=k*q+f*x,f=k*B+f*u,w=q*q+x*x,l=q*B+x*u,h=1/(d*w-m*m),k=(w*f-m*l)*h,d=(d*l-m*f)*h;if(0<=k&&0k+d)return!0;k=this.$a-e;f=this.ab-b;d=k*k+f*f;m=k*q+f*x;f=k*B+f*u;h=1/(d*w-m*m);k=(w*f-m*l)*h;d=(d*l-m*f)*h;return 0<=k&&0k+d};r.prototype.pc=function(a,c){if(c)switch(a){case 0:return this.Fa;case 1:return this.nb;case 2:return this.bb;case 3:return this.$a; +case 4:return this.Fa;default:return this.Fa}else switch(a){case 0:return this.Ga;case 1:return this.ob;case 2:return this.cb;case 3:return this.ab;case 4:return this.Ga;default:return this.Ga}};r.prototype.Cq=function(){return(this.Fa+this.nb+this.bb+this.$a)/4};r.prototype.Dq=function(){return(this.Ga+this.ob+this.cb+this.ab)/4};r.prototype.Kp=function(a){var c=a.Cq(),e=a.Dq();if(this.Ib(c,e))return!0;c=this.Cq();e=this.Dq();if(a.Ib(c,e))return!0;var b,k,f,q,x,B,d,u;for(d=0;4>d;d++)for(u=0;4>u;u++)if(c= +this.pc(d,!0),e=this.pc(d,!1),b=this.pc(d+1,!0),k=this.pc(d+1,!1),f=a.pc(u,!0),q=a.pc(u,!1),x=a.pc(u+1,!0),B=a.pc(u+1,!1),va(c,e,b,k,f,q,x,B))return!0;return!1};xa=r;ya=function(a,c){for(var e in c)c.hasOwnProperty(e)&&(a[e]=c[e]);return a};za=function(a,c){var e,b;c=ta(c);if(!(0>c||c>=a.length)){e=c;for(b=a.length-1;ee?e:a};G=function(a){return a/(180/sa)};Ka=function(a){return 180/sa*a};La=function(a){a%=360;0>a&&(a+=360);return a};Ma=function(a){a%=2*sa;0>a&&(a+=2*sa);return a};Na=function(a){return La(Ka(a))};Oa=function(a){return Ma(G(a))};Pa=function(a,c,e,b){return Math.atan2(b-c,e-a)};Ra=function(a,c){if(a===c)return 0;var e=Math.sin(a), +b=Math.cos(a),k=Math.sin(c),f=Math.cos(c),e=e*k+b*f;return 1<=e?0:-1>=e?sa:Math.acos(e)};Sa=function(a,c,e){var b=Math.sin(a),k=Math.cos(a),f=Math.sin(c),q=Math.cos(c);return Math.acos(b*f+k*q)>e?0=b*k-e*f};Ua=function(a,c,e,b,k,f){if(0===e)return f?a:c;var q=Math.sin(e);e=Math.cos(e);a-=b;c-=k;var x=a*q;a=a*e-c*q;c=c*e+x;return f?a+b:c+k};Va=function(a,c,e,b){a=e-a;c=b-c;return Math.sqrt(a* +a+c*c)};Wa=function(a,c){return!a!==!c};Xa=function(a){for(var c in a)if(a.hasOwnProperty(c))return!0;return!1};Ya=function(a){for(var c in a)a.hasOwnProperty(c)&&delete a[c]};var m=+new Date;Za=function(){if("undefined"!==typeof window.performance){var a=window.performance;if("undefined"!==typeof a.now)return a.now();if("undefined"!==typeof a.webkitNow)return a.webkitNow();if("undefined"!==typeof a.mozNow)return a.mozNow();if("undefined"!==typeof a.msNow)return a.msNow()}return Date.now()-m};var q= +!1,w=q=!1,U=!1;"undefined"!==typeof window&&(q=/chrome/i.test(navigator.userAgent)||/chromium/i.test(navigator.userAgent),q=!q&&/safari/i.test(navigator.userAgent),w=/(iphone|ipod|ipad)/i.test(navigator.userAgent),U=window.c2ejecta);var E=!q&&!U&&!w&&"undefined"!==typeof Set&&"undefined"!==typeof Set.prototype.forEach;t.prototype.contains=function(a){return this.Yd()?!1:E?this.Fd.has(a):this.items&&this.items.hasOwnProperty(a)};t.prototype.add=function(a){if(E)this.Fd.has(a)||(this.Fd.add(a),this.ue= +!1);else{var c=a.toString(),e=this.items;e?e.hasOwnProperty(c)||(e[c]=a,this.Nh++,this.ue=!1):(this.items={},this.items[c]=a,this.Nh=1,this.ue=!1)}};t.prototype.remove=function(a){if(!this.Yd())if(E)this.Fd.has(a)&&(this.Fd["delete"](a),this.ue=!1);else if(this.items){a=a.toString();var c=this.items;c.hasOwnProperty(a)&&(delete c[a],this.Nh--,this.ue=!1)}};t.prototype.clear=function(){this.Yd()||(E?this.Fd.clear():(this.items=null,this.Nh=0),A(this.Ug),this.ue=!0)};t.prototype.Yd=function(){return 0=== +this.count()};t.prototype.count=function(){return E?this.Fd.size:this.Nh};var Ea=null,oa=0;t.prototype.Ny=function(){if(!this.ue){if(E)A(this.Ug),Ea=this.Ug,oa=0,this.Fd.forEach(v),Ea=null,oa=0;else{var a=this.Ug;A(a);var c,e=0,b=this.items;if(b)for(c in b)b.hasOwnProperty(c)&&(a[e++]=b[c])}this.ue=!0}};t.prototype.We=function(){this.Ny();return this.Ug};ca=t;new ca;$a=function(a,c){E?cb(a,c.Fd):db(a,c.We())};cb=function(a,c){var e,b,k,f;b=e=0;for(k=a.length;ee&&(e=f),qk&&(k=q);this.hj=c;this.ij=e;this.jj=b;this.gj=k};g.prototype.ni=function(a,c,e){this.lb.length=8;this.kd=4;var b=this.lb;b[0]=a.left-c;b[1]=a.top-e;b[2]=a.right-c;b[3]=a.top-e;b[4]=a.right-c;b[5]=a.bottom-e;b[6]=a.left-c;b[7]=a.bottom-e;this.mj=a.right-a.left;this.lj=a.bottom-a.top;this.Aa()};g.prototype.Lg=function(a,c,e,b,k){this.lb.length=8;this.kd= +4;var f=this.lb;f[0]=a.Fa-c;f[1]=a.Ga-e;f[2]=a.nb-c;f[3]=a.ob-e;f[4]=a.bb-c;f[5]=a.cb-e;f[6]=a.$a-c;f[7]=a.ab-e;this.mj=b;this.lj=k;this.Aa()};g.prototype.Ar=function(a){this.kd=a.kd;Da(this.lb,a.lb);this.hj=a.hj;this.jj=a.jj;this.ij=a.ij;this.gj=a.gj};g.prototype.Sf=function(a,c,e){if(this.mj!==a||this.lj!==c||this.Wo!==e){this.mj=a;this.lj=c;this.Wo=e;var b,k,f,q,x,d=0,u=1,m=this.hr,w=this.lb;0!==e&&(d=Math.sin(e),u=Math.cos(e));e=0;for(f=this.kd;eK.length&&K.push(x),this.cells[b][f]=null);if(e)for(b=e.left,k=e.right;b<=k;++b)for(f=e.top,q=e.bottom;f<=q;++f)c&&c.Ib(b,f)||this.Ge(b,f,!0).zm(a)};b.prototype.Fk=function(a,c){var e,b,k,f,q,x;e=this.Ub(a.left);k=this.Vb(a.top);b=this.Ub(a.right);for(q=this.Vb(a.bottom);e<=b;++e)for(f=k;f<=q;++f)(x=this.Ge(e,f,!1))&&x.dump(c)};hb=b;d.prototype.Ge=function(a,c,e){var b; +b=this.cells[a];return b?(b=b[c])?b:e?(b=f(this,a,c),this.cells[a][c]=b):null:e?(b=f(this,a,c),this.cells[a]={},this.cells[a][c]=b):null};d.prototype.Ub=function(a){return ta(a/this.Ml)};d.prototype.Vb=function(a){return ta(a/this.Ll)};d.prototype.update=function(a,c,e){var b,k,f,q,x;if(c)for(b=c.left,k=c.right;b<=k;++b)for(f=c.top,q=c.bottom;f<=q;++f)if(!e||!e.Ib(b,f))if(x=this.Ge(b,f,!1))x.remove(a),x.Yd()&&(x.reset(),1E3>L.length&&L.push(x),this.cells[b][f]=null);if(e)for(b=e.left,k=e.right;b<= +k;++b)for(f=e.top,q=e.bottom;f<=q;++f)c&&c.Ib(b,f)||this.Ge(b,f,!0).zm(a)};d.prototype.Fk=function(a,c,e,b,k){var f,q;a=this.Ub(a);c=this.Vb(c);e=this.Ub(e);for(f=this.Vb(b);a<=e;++a)for(b=c;b<=f;++b)(q=this.Ge(a,b,!1))&&q.dump(k)};d.prototype.wx=function(a){var c,e,b,k,f;c=a.left;b=a.top;e=a.right;for(k=a.bottom;c<=e;++c)for(a=b;a<=k;++a)if(f=this.Ge(c,a,!1))f.mg=!1};ib=d;var K=[];c.prototype.Yd=function(){return this.sb.Yd()};c.prototype.zm=function(a){this.sb.add(a)};c.prototype.remove=function(a){this.sb.remove(a)}; +c.prototype.dump=function(a){Fa(a,this.sb.We())};ba=c;var L=[];a.prototype.Yd=function(){if(!this.sb.length)return!0;if(this.sb.length>this.Cd.count())return!1;this.fm();return!0};a.prototype.zm=function(a){this.Cd.contains(a)?(this.Cd.remove(a),this.Cd.Yd()&&(this.eh=!1)):this.sb.length?(this.sb[this.sb.length-1].wd()>a.wd()&&(this.mg=!1),this.sb.push(a)):(this.sb.push(a),this.mg=!0)};a.prototype.remove=function(a){this.Cd.add(a);this.eh=!0;30<=this.Cd.count()&&this.fm()};a.prototype.fm=function(){this.eh&& +(this.Cd.count()===this.sb.length?this.reset():($a(this.sb,this.Cd),this.Cd.clear(),this.eh=!1))};a.prototype.Bv=function(){this.mg||(this.sb.sort(k),this.mg=!0)};a.prototype.reset=function(){A(this.sb);this.mg=!0;this.Cd.clear();this.eh=!1};a.prototype.dump=function(a){this.fm();this.Bv();this.sb.length&&a.push(this.sb)};da=a;var H="lighter xor copy destination-over source-in destination-in source-out destination-out source-atop destination-atop".split(" ");jb=function(a){return 0>=a||11<=a?"source-over": +H[a-1]};kb=function(a,c,e){if(e)switch(a.Pb=e.ONE,a.Jb=e.ONE_MINUS_SRC_ALPHA,c){case 1:a.Pb=e.ONE;a.Jb=e.ONE;break;case 3:a.Pb=e.ONE;a.Jb=e.ZERO;break;case 4:a.Pb=e.ONE_MINUS_DST_ALPHA;a.Jb=e.ONE;break;case 5:a.Pb=e.DST_ALPHA;a.Jb=e.ZERO;break;case 6:a.Pb=e.ZERO;a.Jb=e.SRC_ALPHA;break;case 7:a.Pb=e.ONE_MINUS_DST_ALPHA;a.Jb=e.ZERO;break;case 8:a.Pb=e.ZERO;a.Jb=e.ONE_MINUS_SRC_ALPHA;break;case 9:a.Pb=e.DST_ALPHA;a.Jb=e.ONE_MINUS_SRC_ALPHA;break;case 10:a.Pb=e.ONE_MINUS_DST_ALPHA,a.Jb=e.SRC_ALPHA}}; +lb=function(a){return Math.round(1E6*a)/1E6};mb=function(a,c){return"string"!==typeof a||"string"!==typeof c||a.length!==c.length?!1:a===c?!0:a.toLowerCase()===c.toLowerCase()};pb=function(a){a=a.target;return!a||a===document||a===window||document&&document.body&&a===document.body||mb(a.tagName,"canvas")?!0:!1}})();var kc="undefined"!==typeof Float32Array?Float32Array:Array;function lc(h){var r=new kc(3);h&&(r[0]=h[0],r[1]=h[1],r[2]=h[2]);return r} +function mc(h){var r=new kc(16);h&&(r[0]=h[0],r[1]=h[1],r[2]=h[2],r[3]=h[3],r[4]=h[4],r[5]=h[5],r[6]=h[6],r[7]=h[7],r[8]=h[8],r[9]=h[9],r[10]=h[10],r[11]=h[11],r[12]=h[12],r[13]=h[13],r[14]=h[14],r[15]=h[15]);return r}function nc(h,r){r[0]=h[0];r[1]=h[1];r[2]=h[2];r[3]=h[3];r[4]=h[4];r[5]=h[5];r[6]=h[6];r[7]=h[7];r[8]=h[8];r[9]=h[9];r[10]=h[10];r[11]=h[11];r[12]=h[12];r[13]=h[13];r[14]=h[14];r[15]=h[15]} +function oc(h,r){var p=r[0],t=r[1];r=r[2];h[0]*=p;h[1]*=p;h[2]*=p;h[3]*=p;h[4]*=t;h[5]*=t;h[6]*=t;h[7]*=t;h[8]*=r;h[9]*=r;h[10]*=r;h[11]*=r} +function pc(h,r,p,t){t||(t=mc());var v,n,g,b,d,l,c,f,a=h[0],k=h[1];h=h[2];n=p[0];g=p[1];v=p[2];p=r[1];l=r[2];a===r[0]&&k===p&&h===l?(h=t,h[0]=1,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=1,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=1,h[11]=0,h[12]=0,h[13]=0,h[14]=0,h[15]=1):(p=a-r[0],l=k-r[1],c=h-r[2],f=1/Math.sqrt(p*p+l*l+c*c),p*=f,l*=f,c*=f,r=g*c-v*l,v=v*p-n*c,n=n*l-g*p,(f=Math.sqrt(r*r+v*v+n*n))?(f=1/f,r*=f,v*=f,n*=f):n=v=r=0,g=l*n-c*v,b=c*r-p*n,d=p*v-l*r,(f=Math.sqrt(g*g+b*b+d*d))?(f=1/f,g*=f,b*=f,d*=f):d=b=g=0, +t[0]=r,t[1]=g,t[2]=p,t[3]=0,t[4]=v,t[5]=b,t[6]=l,t[7]=0,t[8]=n,t[9]=d,t[10]=c,t[11]=0,t[12]=-(r*a+v*k+n*h),t[13]=-(g*a+b*k+d*h),t[14]=-(p*a+l*k+c*h),t[15]=1)} +(function(){function h(b,d,l){this.Je=/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent);this.height=this.width=0;this.ya=!!l;this.Yj=this.Eh=!1;this.Ul=0;this.il=1;this.Xn=1E3;this.Vy=(this.Xn-this.il)/32768;this.Jl=lc([0,0,100]);this.kq=lc([0,0,0]);this.Vr=lc([0,1,0]);this.Li=lc([1,1,1]);this.fp=!0;this.ok=mc();this.zc=mc();this.Km=mc();this.Tl=mc();this.u=b;this.version=0===this.u.getParameter(this.u.VERSION).indexOf("WebGL 2")?2:1;this.Gp()}function r(b,d,l){this.u=b;this.pi= +d;this.name=l;this.Nc=b.getAttribLocation(d,"aPos");this.Oe=b.getAttribLocation(d,"aTex");this.iq=b.getUniformLocation(d,"matP");this.kk=b.getUniformLocation(d,"matMV");this.vg=b.getUniformLocation(d,"opacity");this.Qm=b.getUniformLocation(d,"colorFill");this.jq=b.getUniformLocation(d,"samplerFront");this.Th=b.getUniformLocation(d,"samplerBack");this.Bf=b.getUniformLocation(d,"destStart");this.Af=b.getUniformLocation(d,"destEnd");this.Vh=b.getUniformLocation(d,"seconds");this.Sm=b.getUniformLocation(d, +"pixelWidth");this.Rm=b.getUniformLocation(d,"pixelHeight");this.Sh=b.getUniformLocation(d,"layerScale");this.Rh=b.getUniformLocation(d,"layerAngle");this.Wh=b.getUniformLocation(d,"viewOrigin");this.Uh=b.getUniformLocation(d,"scrollPos");this.Rw=!!(this.Sm||this.Rm||this.Vh||this.Th||this.Bf||this.Af||this.Sh||this.Rh||this.Wh||this.Uh);this.sq=this.tq=-999;this.nk=1;this.oq=this.nq=0;this.qq=this.mq=this.lq=1;this.wq=this.vq=this.uq=this.yq=this.xq=this.pq=0;this.Jm=[];this.rq=mc();this.vg&&b.uniform1f(this.vg, +1);this.Qm&&b.uniform4f(this.Qm,1,1,1,1);this.jq&&b.uniform1i(this.jq,0);this.Th&&b.uniform1i(this.Th,1);this.Bf&&b.uniform2f(this.Bf,0,0);this.Af&&b.uniform2f(this.Af,1,1);this.Sh&&b.uniform1f(this.Sh,1);this.Rh&&b.uniform1f(this.Rh,0);this.Wh&&b.uniform2f(this.Wh,0,0);this.Uh&&b.uniform2f(this.Uh,0,0);this.Vh&&b.uniform1f(this.Vh,0);this.pf=!1}function p(b,d){return b[0]===d[0]&&b[1]===d[1]&&b[2]===d[2]&&b[3]===d[3]&&b[4]===d[4]&&b[5]===d[5]&&b[6]===d[6]&&b[7]===d[7]&&b[8]===d[8]&&b[9]===d[9]&& +b[10]===d[10]&&b[11]===d[11]&&b[12]===d[12]&&b[13]===d[13]&&b[14]===d[14]&&b[15]===d[15]}function t(b,d){this.type=b;this.k=d;this.u=d.u;this.xd=this.Tb=this.Tq=0;this.T=this.Vc=null;this.Cr=[]}var v=mc();h.prototype.Gp=function(){var b=this.u,d;this.Yp=1;this.wf=this.vf=null;this.wj=1;b.clearColor(0,0,0,0);b.clear(b.COLOR_BUFFER_BIT);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.disable(b.CULL_FACE);b.disable(b.STENCIL_TEST);b.disable(b.DITHER);this.ya?(b.enable(b.DEPTH_TEST),b.depthFunc(b.LEQUAL)): +b.disable(b.DEPTH_TEST);this.$p=b.ONE;this.Wp=b.ONE_MINUS_SRC_ALPHA;this.fl=new Float32Array(8E3*(this.ya?3:2));this.Xk=new Float32Array(16E3);this.er=new Float32Array(32E3);this.hn=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.hn);b.bufferData(b.ARRAY_BUFFER,this.er.byteLength,b.DYNAMIC_DRAW);this.Gi=Array(4);this.vi=Array(4);for(d=0;4>d;d++)this.Gi[d]=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,this.Gi[d]),b.bufferData(b.ARRAY_BUFFER,this.fl.byteLength,b.DYNAMIC_DRAW),this.vi[d]=b.createBuffer(), +b.bindBuffer(b.ARRAY_BUFFER,this.vi[d]),b.bufferData(b.ARRAY_BUFFER,this.Xk.byteLength,b.DYNAMIC_DRAW);this.Pd=0;this.Uw=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.Uw);for(var l=new Uint16Array(12E3),c=d=0;12E3>d;)l[d++]=c,l[d++]=c+1,l[d++]=c+2,l[d++]=c,l[d++]=c+2,l[d++]=c+3,c+=4;b.bufferData(b.ELEMENT_ARRAY_BUFFER,l,b.STATIC_DRAW);this.jn=this.Pg=this.ne=0;this.La=[];d=this.ya?"attribute highp vec3 aPos;\nattribute mediump vec2 aTex;\nvarying mediump vec2 vTex;\nuniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, aPos.z, 1.0);\n\tvTex = aTex;\n}": +"attribute highp vec2 aPos;\nattribute mediump vec2 aTex;\nvarying mediump vec2 vTex;\nuniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);\n\tvTex = aTex;\n}";l=this.kh({src:"varying mediump vec2 vTex;\nuniform lowp float opacity;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex);\n\tgl_FragColor *= opacity;\n}"},d,"");this.La.push(l);l=this.kh({src:"uniform mediump sampler2D samplerFront;\nvarying lowp float opacity;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, gl_PointCoord);\n\tgl_FragColor *= opacity;\n}"}, +"attribute vec4 aPos;\nvarying float opacity;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);\n\tgl_PointSize = aPos.z;\n\topacity = aPos.w;\n}","");this.La.push(l);l=this.kh({src:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tif (texture2D(samplerFront, vTex).a < 1.0)\n\t\tdiscard;\n}"},d,"");this.La.push(l);l=this.kh({src:"uniform lowp vec4 colorFill;\nvoid main(void) {\n\tgl_FragColor = colorFill;\n}"}, +d,"");this.La.push(l);for(var f in qc)qc.hasOwnProperty(f)&&this.La.push(this.kh(qc[f],d,f));b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,null);this.te=[];this.Od=0;this.Mb=!1;this.bp=this.Oh=-1;this.Xf=null;this.dm=b.createFramebuffer();this.Aj=this.Gk=null;this.Qo=!1;this.ya&&(this.Aj=b.createRenderbuffer());this.Ve=lc([0,0,0]);this.zq=b.getParameter(b.ALIASED_POINT_SIZE_RANGE)[1];2048"===d.name&&b.vertexAttribPointer(d.Nc,4,b.FLOAT,!1,0,0));if(0"!==d.name&& +b.vertexAttribPointer(d.Nc,this.ya?3:2,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vi[this.Pd]);b.bufferSubData(b.ARRAY_BUFFER,0,this.Xk.subarray(0,this.Pg));d&&0<=d.Oe&&""!==d.name&&b.vertexAttribPointer(d.Oe,2,b.FLOAT,!1,0,0)}for(var l,b=0,d=this.Od;bl||0>c)){var f=this.mc();f.type=7;f.Tb=1;f.T||(f.T=mc());f.T[0]=b;f.T[1]=d;f.T[2]=l;f.T[3]=c;this.Mb=!1}};h.prototype.ur=function(b){if(this.ya&&(b=!!b,this.Eh!==b)){var d=this.mc();d.type=14;d.Tb=b?1:0;this.Mb=!1;this.Eh=b;this.Gk=null;this.Eh?this.ec(2): +this.ec(0)}};h.prototype.tr=function(b){if(this.ya){var d=this.mc();d.type=13;d.Tb=b?1:0;this.Mb=!1}};h.prototype.rp=function(){nc(this.Km,v);this.Ed();this.od();var b=this.width/2,d=this.height/2;this.ji(-b,d,b,d,b,-d,-b,-d);nc(v,this.zc);this.od()};h.prototype.sr=function(b,d,l){this.ec(3);var c=this.mc();c.type=12;c.T||(c.T=mc());c.T[0]=b;c.T[1]=d;c.T[2]=l;c.T[3]=1;this.Mb=!1};h.prototype.zy=function(){this.ec(0)};h.prototype.iy=function(){this.ec(2)};h.prototype.$x=function(){this.gf();this.u.flush()}; +var n=[],g={};h.prototype.Qu=function(){A(n);g={}};h.prototype.yc=function(b,d,l,c,f){d=!!d;l=!!l;var a=b.src+","+d+","+l+(d?","+f:""),k=null;if("undefined"!==typeof b.src&&g.hasOwnProperty(a))return k=g[a],k.kj++,k;this.gf();var e=this.u,u=la(b.width)&&la(b.height),k=e.createTexture();e.bindTexture(e.TEXTURE_2D,k);e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);var m=e.RGBA,q=e.RGBA,w=e.UNSIGNED_BYTE;if(c&&!this.Je)switch(c){case 1:q=m=e.RGB;break;case 2:w=e.UNSIGNED_SHORT_4_4_4_4;break;case 3:w= +e.UNSIGNED_SHORT_5_5_5_1;break;case 4:q=m=e.RGB,w=e.UNSIGNED_SHORT_5_6_5}if(1===this.version&&!u&&d){c=document.createElement("canvas");c.width=ma(b.width);c.height=ma(b.height);var h=c.getContext("2d");"undefined"!==typeof h.imageSmoothingEnabled?h.imageSmoothingEnabled=l:(h.webkitImageSmoothingEnabled=l,h.mozImageSmoothingEnabled=l,h.msImageSmoothingEnabled=l);h.drawImage(b,0,0,b.width,b.height,0,0,c.width,c.height);e.texImage2D(e.TEXTURE_2D,0,m,q,w,c)}else e.texImage2D(e.TEXTURE_2D,0,m,q,w,b); +d?"repeat-x"===f?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)):("repeat-y"===f?e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE):e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE));l?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER, +e.LINEAR),(u||2<=this.version)&&this.fp?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(e.TEXTURE_2D)):e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST));e.bindTexture(e.TEXTURE_2D,null);this.vf=null;k.bd=b.width;k.ad=b.height;k.kj=1;k.Vo=a;n.push(k);return g[a]=k};h.prototype.Ic=function(b,d,l){var c;this.gf();var f=this.u; +this.Je&&(c=!1);var a=f.createTexture();f.bindTexture(f.TEXTURE_2D,a);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b,d,0,f.RGBA,c?f.UNSIGNED_SHORT_4_4_4_4:f.UNSIGNED_BYTE,null);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,l?f.LINEAR:f.NEAREST);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,l?f.LINEAR:f.NEAREST);f.bindTexture(f.TEXTURE_2D,null);this.vf=null;a.bd=b;a.ad=d;n.push(a); +return a};h.prototype.deleteTexture=function(b){b&&("undefined"!==typeof b.kj&&1=c?a[3]:256>=c?a[2]:512>=c?a[1]:a[0]}function p(){try{return!!window.indexedDB}catch(a){return!1}}function t(a){a.target.result.createObjectStore("saves",{keyPath:"slot"})}function v(a,c,e,b){try{var k=indexedDB.open("_C2SaveStates");k.onupgradeneeded=t;k.onerror=b;k.onsuccess=function(k){k=k.target.result;k.onerror=b;k.transaction(["saves"],"readwrite").objectStore("saves").put({slot:a,data:c}).onsuccess=e}}catch(f){b(f)}}function n(a, +c,e){try{var b=indexedDB.open("_C2SaveStates");b.onupgradeneeded=t;b.onerror=e;b.onsuccess=function(b){b=b.target.result;b.onerror=e;var k=b.transaction(["saves"]).objectStore("saves").get(a);k.onsuccess=function(){k.result?c(k.result.data):c(null)}}}catch(k){e(k)}}function g(){fa("Reloading for continuous preview");window.c2cocoonjs?CocoonJS.App.reload():-1f?(f*=c,5===d?(q=f*e/this.Wa,1q&&(q=1/Math.ceil(1/q)),f=this.Wa*q/e,q=this.Va*q/e,b=(a-f)/2,k=(c-q)/2,a=f,c=q):(b=(a-f)/2,a=f)):(q=a/f,5===d?(q=q*e/this.Va,1q&&(q=1/Math.ceil(1/q)),f=this.Wa*q/e,q=this.Va*q/e,b=(a-f)/2,k=(c-q)/2,a=f):k=(c-q)/2,c=q)):f&&0===d&&(b=Math.floor((a-this.Wa)/2),k=Math.floor((c-this.Va)/ +2),a=this.Wa,c=this.Va),2>d&&(this.gh=e),this.uj=Math.round(a),this.nh=Math.round(c),this.width=Math.round(a*e),this.height=Math.round(c*e),this.fa=!0,this.ds?(this.G=this.width,this.F=this.height,this.sc=!0):this.widthf&&(this.F=this.G/d)):3===d&&(f=this.Wa/this.Va,d=this.tg/this.sg,d>f?this.G=this.F*d:d< +f&&(this.F=this.G/d))),this.nj&&!this.pa&&(jQuery(this.nj).css({width:Math.round(a)+"px",height:Math.round(c)+"px","margin-left":Math.floor(b)+"px","margin-top":Math.floor(k)+"px"}),"undefined"!==typeof cr_is_preview&&jQuery("#borderwrap").css({width:Math.round(a)+"px",height:Math.round(c)+"px"})),this.canvas&&(this.canvas.width=Math.round(a*e),this.canvas.height=Math.round(c*e),this.gd?(this.canvas.style.left=Math.floor(b)+"px",this.canvas.style.top=Math.floor(k)+"px",this.canvas.style.width=Math.round(a)+ +"px",this.canvas.style.height=Math.round(c)+"px"):this.tf&&!this.pa&&(this.canvas.style.width=Math.round(a)+"px",this.canvas.style.height=Math.round(c)+"px")),this.Db&&(this.Db.width=Math.round(a*e),this.Db.height=Math.round(c*e),this.Db.style.width=this.uj+"px",this.Db.style.height=this.nh+"px"),this.k&&this.k.ge(Math.round(a*e),Math.round(c*e)),this.pb&&this.Ba&&(this.Ba.width=Math.round(a),this.Ba.height=Math.round(c)),this.Ba&&this.Nk(this.Ba,this.qa),this.Sr(),this.Up&&!this.vc&&window.scrollTo(0, +0)}};h.prototype.Sr=function(){if(this.Ju&&0!==this.en){var a="portrait";2===this.en&&(a="landscape");try{screen.orientation&&screen.orientation.lock?screen.orientation.lock(a).catch(function(){}):screen.lockOrientation?screen.lockOrientation(a):screen.webkitLockOrientation?screen.webkitLockOrientation(a):screen.mozLockOrientation?screen.mozLockOrientation(a):screen.msLockOrientation&&screen.msLockOrientation(a)}catch(c){console&&console.warn&&console.warn("Failed to lock orientation: ",c)}}};h.prototype.Cx= +function(){this.k.Qu();this.Im=!0;var a,c,e;a=0;for(c=this.p.length;af;)f++,c=a.shift(),this.wr(c[0],c[1])};h.prototype.gl= +function(a,e){a.cocoonLazyLoad=!0;a.onerror=function(e){c=a.Uo=!0;console&&console.error&&console.error("Error loading image '"+a.src+"': ",e)};this.gd?a.src=e:a.src||("undefined"!==typeof XAPKReader?XAPKReader.get(e,function(c){a.src=c},function(b){c=a.Uo=!0;console&&console.error&&console.error("Error extracting image '"+e+"' from expansion file: ",b)}):(a.crossOrigin="anonymous",this.cy(a,e)));this.Wg.push(a)};h.prototype.hw=function(a){var c,e;c=0;for(e=this.Wg.length;c=m)m=5E4;a+=m;d.src&&(d.complete||d.loaded)&&!d.Uo?c+=m:f=!1}f&&this.Yx&&this.Rf&&(e||(this.Rf.Cy(),e=!0),b=this.Rf.yw(),c+=b,bthis.Ne&&(this.Mc||500<=b&&this.dq!=this.$b)){a.clearRect(0,0,f,q);var b=f/2,q=q/2,f=0===this.Ne&&this.Me.mk.complete,m=40*e,w=0,l=80*e,h;if(f){var g=this.Me.mk,l=g.width*e;h=g.height*e;m=l/2;w=h/2;a.drawImage(g,ta(b-m),ta(q-w),l,h)}1>=this.Ne?(b=ta(b-m)+.5,q=ta(q+(w+(f? +12*e:0)))+.5,a.fillStyle=c?"red":"DodgerBlue",a.fillRect(b,q,Math.floor(l*this.$b),6*e),a.strokeStyle="black",a.strokeRect(b,q,l,6*e),a.strokeStyle="white",a.strokeRect(b-1*e,q-1*e,l+2*e,8*e)):2===this.Ne&&(a.font=this.gd?"12pt ArialMT":"12pt Arial",a.fillStyle=c?"#f00":"#999",a.Lz="middle",e=Math.round(100*this.$b)+"%",f=a.measureText?a.measureText(e):null,a.fillText(e,b-(f?f.width:0)/2,q));this.dq=this.$b}else if(4===this.Ne){this.wv(a);d?d(function(){k.go()}):setTimeout(function(){k.go()},16); +return}}setTimeout(function(){k.go()},this.Mc?10:100)}}};var m=-1,q="undefined"===typeof cr_is_preview?200:0,w=!0,U=!1,E=0,Ea=0,oa="undefined"===typeof cr_is_preview?3E3:0,K=null,L=null,H=0;h.prototype.wv=function(a){if(!u){for(var e=Math.ceil(this.width),b=Math.ceil(this.height),k=this.Me.mk,f=this.Me.Xx,d=this.Me.Ty,l=0;4>l;++l)if(!k[l].complete||!f[l].complete||!d[l].complete)return;0===H&&(m=Date.now());var l=Date.now(),h=!1,g=a,n,t;w||U?(a.clearRect(0,0,e,b),K&&K.width===e&&K.height===b||(K= +document.createElement("canvas"),K.width=e,K.height=b,L=K.getContext("2d")),g=L,h=!0,w&&1===H&&(m=Date.now())):a.globalAlpha=1;g.fillStyle="#333333";g.fillRect(0,0,e,b);256=oa&&!U&&1<=this.$b&&(U=!0,Ea=l);if(U&&l-Ea>=300+q||"undefined"!==typeof cr_is_preview&&1<= +this.$b&&500>Date.now()-m)u=!0,U=w=!1,this.Me=L=K=null;++H}};h.prototype.Pw=function(){this.Db&&(this.canvas.parentNode.removeChild(this.Db),this.Db=this.gn=null);this.Sk=Date.now();this.yf=Za();var a,c,e;if(this.Un)for(a=0,c=this.p.length;aa||2===this.Yb&&cc&&(c=0),this.df=c/=1E3,.51/this.Eq&&(this.df=1/this.Eq));this.dk=a;this.De=this.df*this.Jf;this.Bb.add(this.De);this.oe.add(c);a=(document.mozFullScreen||document.webkitIsFullScreen||document.fullScreen||!!document.msFullscreenElement||this.gg)&& +!this.vc;2<=this.Yb||a&&0c||2===b&&ea++;)this.ep(this.ih);a=0;for(c=this.Ud.length;ac.yj.length&&c.yj.push(a)};h.prototype.Rl=function(a,c,e,b){if(a.B){var k=ta(Math.random()*a.yg.length);return this.Rl(a.yg[k],c,e,b)}return a.Jc?this.Ae(a.Jc,c,!1,e,b,!1):null};var Q=[];h.prototype.Ae=function(a,c,e,b,k,f){var q,d,m,u;if(!a)return null;var w=this.p[a[1]],l=w.X.Le;if(this.Mh&&l&&!w.Fm||l&&!this.k&&11===a[0][11])return null;var h=c;l||(c=null);var g;w.yj.length?(g=w.yj.pop(),g.Bc=!0,w.X.S.call(g,w)):(g=new w.X.S(w),g.Bc=!1);!e||f||this.be.hasOwnProperty(a[2].toString())? +g.uid=this.bi++:g.uid=a[2];this.be[g.uid.toString()]=g;g.ir=this.Hq++;g.rf=w.d.length;q=0;for(d=this.cd.length;qa&&(a=0);a>=this.ba.P.length&& +(a=this.ba.P.length-1);return this.ba.P[a]};h.prototype.wp=function(a){return ja(a)?this.ag(a):this.Sj(a.toString())};h.prototype.Nl=function(a){var c,e;c=0;for(e=a.length;c=this.Tm.length&&this.Tm.push([])};h.prototype.Ux=function(){this.lk--};h.prototype.tp=function(){return this.Tm[this.lk]};h.prototype.Ek=function(a){this.Dj++;this.Dj>=this.am.length&&this.am.push(new Wb);var c=this.Ea();c.reset(a);return c};h.prototype.zk=function(){this.Dj--};h.prototype.Ea=function(){return this.am[this.Dj]};h.prototype.pn=function(a){this.Zh++; +this.Zh>=this.Yh.length&&this.Yh.push(aa({name:a,index:0,ta:!1}));var c=this.up();c.name=a;c.index=0;c.ta=!1;return c};h.prototype.ln=function(){this.Zh--};h.prototype.up=function(){return this.Yh[this.Zh]};h.prototype.vp=function(a,c){for(var e,b,k,f,q,d;c;){e=0;for(b=c.Uc.length;ef||f>=a.hb.length||(q=k[b],null===q&&(q=NaN),a.hb[f]=q));if(m.Le){f=c.w;a.j.Y!==f.l&&(k=a.j,a.j=this.ba.Tj(f.l),a.j?(k.Gg(a,!0),a.j.fh(a,!0),a.za(),a.j.mi(0)):(a.j=k,e||this.Xe(a)));a.x=f.x;a.y=f.y;a.width=f.w;a.height=f.h;a.pd=f.zi;a.m=f.hasOwnProperty("a")?f.a:0;a.opacity=f.hasOwnProperty("o")?f.o:1;a.Nb=f.hasOwnProperty("hX")?f.hX:.5;a.Ob=f.hasOwnProperty("hY")? +f.hY:.5;a.visible=f.hasOwnProperty("v")?f.v:!0;a.$e=f.hasOwnProperty("ce")?f.ce:!0;a.ai=f.hasOwnProperty("mts")?f.mts:-1;a.Hb=f.hasOwnProperty("bm")?f.bm:0;a.jh=jb(a.Hb);this.u&&kb(a,a.Hb,this.u);a.za();if(f.hasOwnProperty("fx"))for(e=0,k=f.fx.length;eq||(a.re[q]=f.fx[e].active,a.Ja[q]=f.fx[e].params);a.nd()}if(d=c.behs)for(b in d)d.hasOwnProperty(b)&&(e=this.ow(a,parseInt(b,10)),0>e||a.L[e].Qb(d[b]));c.data&&a.Qb(c.data)};h.prototype.jp=function(a,c,e){window.resolveLocalFileSystemURL(cordova.file.applicationDirectory+ +"www/"+a,function(a){a.file(c,e)},e)};h.prototype.lp=function(a,c,e){this.jp(a,function(a){var b=new FileReader;b.onload=function(a){c(a.target.result)};b.onerror=e;b.readAsText(a)},e)};var F=[],R=0;h.prototype.Vm=function(){if(F.length&&!(8<=R)){R++;var a=F.shift();this.av(a.filename,a.Ey,a.Cv)}};h.prototype.kp=function(a,c,e){var b=this;F.push({filename:a,Ey:function(a){R--;b.Vm();c(a)},Cv:function(a){R--;b.Vm();e(a)}});this.Vm()};h.prototype.av=function(a,c,e){this.jp(a,function(a){var e=new FileReader; +e.onload=function(a){c(a.target.result)};e.readAsArrayBuffer(a)},e)};h.prototype.gw=function(a,c,e){var b="",k=a.toLowerCase(),f=k.substr(k.length-4),k=k.substr(k.length-5);".mp4"===f?b="video/mp4":".webm"===k?b="video/webm":".m4a"===f?b="audio/mp4":".mp3"===f&&(b="audio/mpeg");this.kp(a,function(a){a=URL.createObjectURL(new Blob([a],{type:b}));c(a)},e)};h.prototype.Lp=function(a){return/^(?:[a-z]+:)?\/\//.test(a)||"data:"===a.substr(0,5)||"blob:"===a.substr(0,5)};h.prototype.wr=function(a,c){this.Jh&& +!this.Lp(c)?this.gw(c,function(c){a.src=c},function(a){alert("Failed to load image: "+a)}):a.src=c};h.prototype.Nk=function(a,c){"undefined"!==typeof a.imageSmoothingEnabled?a.imageSmoothingEnabled=c:(a.webkitImageSmoothingEnabled=c,a.mozImageSmoothingEnabled=c,a.msImageSmoothingEnabled=c)};Yb=function(a){return new h(document.getElementById(a))};Zb=function(a,c){return new h({dc:!0,width:a,height:c})};window.cr_createRuntime=Yb;window.cr_createDCRuntime=Zb;window.createCocoonJSRuntime=function(){window.c2cocoonjs= +!0;var a=document.createElement("screencanvas")||document.createElement("canvas");a.El=!0;document.body.appendChild(a);a=new h(a);window.c2runtime=a;window.addEventListener("orientationchange",function(){window.c2runtime.setSize(window.innerWidth,window.innerHeight)});window.c2runtime.setSize(window.innerWidth,window.innerHeight);return a};window.createEjectaRuntime=function(){var a=new h(document.getElementById("canvas"));window.c2runtime=a;window.c2runtime.setSize(window.innerWidth,window.innerHeight); +return a}})();window.cr_getC2Runtime=function(){var h=document.getElementById("c2canvas");return h?h.c2runtime:window.c2runtime?window.c2runtime:null};window.cr_getSnapshot=function(h,r){var p=window.cr_getC2Runtime();p&&p.Zu(h,r)};window.cr_sizeCanvas=function(h,r){if(0!==h&&0!==r){var p=window.cr_getC2Runtime();p&&p.setSize(h,r)}};window.cr_setSuspended=function(h){var r=window.cr_getC2Runtime();r&&r.setSuspended(h)}; +(function(){function h(c,b){this.b=c;this.hf=null;this.scrollX=this.b.Wa/2;this.scrollY=this.b.Va/2;this.scale=1;this.m=0;this.$f=!0;this.name=b[0];this.Ox=b[1];this.Nx=b[2];this.width=b[1];this.height=b[2];this.Ur=b[3];this.Dr=b[4];this.Y=b[5];var a=b[6],k,e;this.P=[];this.Bh=[];k=0;for(e=a.length;k=this.P.length&&(q=this.P.length-1);d.j=this.P[q];-1===d.j.d.indexOf(d)&&d.j.d.push(d);d.j.Lf=!0}if(!g)for(c=0,a=this.P.length;ca?d.siblings.push(m.d[a]):m.Jc&&(e=this.b.Ae(m.Jc,d.j,!0,d.x,d.y,!0),this.b.Gb(),m.cl(),d.siblings.push(e),n.push(e)));c=0;for(a=this.Ie.length;c< +a;c++)d=this.Ie[c],b=this.b.p[d[1]],b.Ab||this.b.Ae(this.Ie[c],null,!0);this.b.ih=null;this.b.Gb();if(this.b.Ba&&!this.b.pa)for(c=0,a=this.b.p.length;cthis.width-b&&(c=this.width-b);cthis.height-b&&(c=this.height-b);cy&&(y=0);0>C&&(C=0);S>M&&(S=M);P>F&&(P=F);0>N&&(N=0);0>I&&(I=0);Aa>M&&(Aa=M);ia>F&&(ia=F);B.left=y/M;B.top=1-C/F;B.right=S/M;B.bottom=1-P/F}else B.left=D.left=0,B.top=D.top=0,B.right=D.right=1,B.bottom=D.bottom=1;ka=a&&(c.hi(e[0].Za)||0!==r||0!==ka||1!==a.opacity|| +a.type.X.Fq)||b&&!a&&1!==b.opacity;c.rr();if(ka){h[v]||(h[v]=c.Ic(M,F,this.b.qa));if(h[v].bd!==M||h[v].ad!==F)c.deleteTexture(h[v]),h[v]=c.Ic(M,F,this.b.qa);c.ec(0);c.Tc(h[v]);J=ia-I;c.clearRect(N,F-I-J,Aa-N,J);a?a.Kb(c):(c.Rb(this.b.jb),c.Se(b.opacity),c.Ed(),c.translate(-R,-x),c.od(),c.Sc(y,P,S,P,S,C,y,C,B));D.left=D.top=0;D.right=D.bottom=1;a&&(p=B.top,B.top=B.bottom,B.bottom=p);v=1;Q=0}c.Se(1);r=e.length-1;var Ga=c.nn(e[r].Za)||!b&&!a&&!this.b.sc;n=p=0;for(t=e.length;na||(b&&this.Ec&&c.ac&&c.ac.right>=c.ac.left&&(c.Aa(),this.Eb.update(c,c.ac,null),c.ac.set(0,0,-1,-1)),a===this.d.length-1?this.d.pop():(za(this.d,a),this.mi(a)),this.ld=!0)};p.prototype.fh=function(c, +b){c.pd=this.d.length;this.d.push(c);b&&this.Ec&&c.ac&&c.za();this.ld=!0};p.prototype.Zx=function(c){this.d.unshift(c);this.mi(0)};p.prototype.Ax=function(c,b,a){var k=c.wd();b=b.wd();za(this.d,k);kthis.wa||a.top>this.ua||(b.globalCompositeOperation=c.jh,c.ed(b))}};p.prototype.dl=function(){this.Sd=!0;var c=this.ub(0,0,!0,!0),b=this.ub(0,0,!1,!0);this.Sd=!1;this.b.Ac&&(c=Math.round(c),b=Math.round(b)); +this.Hk(c,b,null)};p.prototype.Hk=function(c,b,a){var k=this.Lc();this.ma=c;this.na=b;this.wa=c+1/k*this.b.G;this.ua=b+1/k*this.b.F;this.ma>this.wa&&(c=this.ma,this.ma=this.wa,this.wa=c);this.na>this.ua&&(c=this.na,this.na=this.ua,this.ua=c);c=this.gb();0!==c&&(a&&(a.translate(this.b.G/2,this.b.F/2),a.rotate(-c),a.translate(this.b.G/-2,this.b.F/-2)),this.le.set(this.ma,this.na,this.wa,this.ua),this.le.offset((this.ma+this.wa)/-2,(this.na+this.ua)/-2),this.Or.Br(this.le,c),this.Or.To(this.le),this.le.offset((this.ma+ +this.wa)/2,(this.na+this.ua)/2),this.ma=this.le.left,this.na=this.le.top,this.wa=this.le.right,this.ua=this.le.bottom)};p.prototype.Ce=function(c){if(this.Dd=this.Lj){this.b.jb||(this.b.jb=c.Ic(this.b.G,this.b.F,this.b.qa));if(this.b.jb.bd!==this.b.G||this.b.jb.ad!==this.b.F)c.deleteTexture(this.b.jb),this.b.jb=c.Ic(this.b.G,this.b.F,this.b.qa);c.Tc(this.b.jb)}this.Sd=!0;var b=this.ub(0,0,!0,!0),a=this.ub(0,0,!1,!0);this.Sd=!1;this.b.Ac&&(b=Math.round(b),a=Math.round(a));this.Hk(b,a,null);b=this.Lc(); +c.Ed();c.scale(b,b);c.xn(-this.gb());c.translate((this.ma+this.wa)/-2,(this.na+this.ua)/-2);c.od();this.Ec?(this.wb.left=this.Eb.Ub(this.ma),this.wb.top=this.Eb.Vb(this.na),this.wb.right=this.Eb.Ub(this.wa),this.wb.bottom=this.Eb.Vb(this.ua),this.ld||!this.wb.oh(this.ug)?(v(this.$d),b=this.om(),this.ld=!1,this.ug.Vf(this.wb)):b=this.$d):b=this.d;for(var k,e=null,a=b.length-1;0<=a;--a)k=b[a],k!==e&&(this.uv(b[a],c),e=k);this.Ec&&(this.$d=b);this.Dc||(this.Ol=this.b.ef++,c.Ok(this.Ol),c.sr(1,1,1),c.rp(), +c.iy())};p.prototype.Kb=function(b){var d=0,a=0;if(this.Dd=this.Lj||1!==this.opacity||0this.wa||a.top>this.ua||(d.Ok(b.ef),b.as?this.vv(b,d):(d.ec(0),d.Re(b.Pb,b.Jb),b.Kb(d)))}};p.prototype.uv=function(b,d){if(b.visible&&0!==b.width&&0!==b.height){b.Aa();var a=b.Qa;a.rightthis.wa||a.top>this.ua||(b.ef=this.b.ef++, +0===b.Hb&&1===b.opacity&&b.ie&&b.Ce&&(d.Ok(b.ef),b.Ce(d)))}};p.prototype.vv=function(b,d){var a=b.ea[0].Za,k=b.ea[0].index,e=this.Lc();if(1!==b.ea.length||d.nn(a)||d.ay(a)||(b.m||b.j.gb())&&d.hi(a)||1!==b.opacity||b.type.X.Fq)this.rb.tn(d,this,b,this.Dd?this.b.jb:this.rb.sh()),d.Ed(),d.scale(e,e),d.xn(-this.gb()),d.translate((this.ma+this.wa)/-2,(this.na+this.ua)/-2),d.od();else{d.ec(a);d.Re(b.Pb,b.Jb);d.Dk(a)&&(this.b.fa=!0);var g=0,m=0,q=0,w=0;d.hi(a)&&(w=b.Qa,g=this.ib(w.left,w.top,!0,!0),m=this.ib(w.left, +w.top,!1,!0),q=this.ib(w.right,w.bottom,!0,!0),w=this.ib(w.right,w.bottom,!1,!0),g=g/windowWidth,m=1-m/windowHeight,q=q/windowWidth,w=1-w/windowHeight);var l;b.Sa&&b.Sa.q?(l=b.Sa.q,a=1/l.width,l=1/l.height):(a=1/b.width,l=1/b.height);d.Jg(this.Dd?this.b.jb:this.rb.sh(),a,l,g,m,q,w,e,this.gb(),this.ma,this.na,(this.ma+this.wa)/2,(this.na+this.ua)/2,this.b.Bb.Z,b.Ja[k]);b.Kb(d)}};p.prototype.ub=function(b,d,a,k){var e=this.b.devicePixelRatio;this.b.tf&&(b*=e,d*=e);var e=this.b.$q,g=this.b.br,e=(this.rb.scrollX- +e)*this.Pc+e,g=(this.rb.scrollY-g)*this.Qc+g,m=e,q=g,w=1/this.Lc(!k);k?(m-=this.b.G*w/2,q-=this.b.F*w/2):(m-=this.b.width*w/2,q-=this.b.height*w/2);m+=b*w;q+=d*w;d=this.gb();0!==d&&(m-=e,q-=g,b=Math.cos(d),d=Math.sin(d),k=m*b-q*d,q=q*b+m*d,m=k+e,q+=g);return a?m:q};p.prototype.ib=function(b,d,a,k){var e=this.b.$q,g=this.b.br,m=(this.rb.scrollX-e)*this.Pc+e,q=(this.rb.scrollY-g)*this.Qc+g,g=m,e=q,w=this.gb();if(0!==w){b-=m;d-=q;var l=Math.cos(-w),w=Math.sin(-w),h=b*l-d*w;d=d*l+b*w;b=h+m;d+=q}m=1/this.Lc(!k); +k?(g-=this.b.G*m/2,e-=this.b.F*m/2):(g-=this.b.width*m/2,e-=this.b.height*m/2);g=(b-g)/m;e=(d-e)/m;b=this.b.devicePixelRatio;this.b.tf&&!k&&(g/=b,e/=b);return a?g:e};p.prototype.Fb=function(){var b,d,a,k={s:this.scale,a:this.m,vl:this.ma,vt:this.na,vr:this.wa,vb:this.ua,v:this.visible,bc:this.Zc,t:this.Dc,px:this.Pc,py:this.Qc,o:this.opacity,zr:this.qd,fx:[],cg:this.mh,instances:[]};b=0;for(d=this.M.length;ba[1].index&&(b=a[0],a[0]=a[1],a[1]=b):2=e.length&&(e.length=a.length+1);e[a.length]||(e[a.length]=[]);d=e[a.length];b=0;for(c=d.length;b=b.length&&(b.length=this.Cf+1),b[this.Cf]=a):this.data=a};f.prototype.of=function(){var a=this.b.tp();return!this.parent||this.Lh||!a||this.ak?this.data:this.Cf>=a.length||"undefined"===typeof a[this.Cf]?this.xm:a[this.Cf]};f.prototype.Ya=function(){!this.parent||this.Lh||this.ak||this.he(this.xm)};Xb=f;a.prototype.toString=function(){return"include:"+this.Ah.toString()}; +a.prototype.Pa=function(){this.Ah=this.b.cm[this.Tw];this.sheet.Fp.add(this);this.V=p(this.V);for(var a=this.parent;a;)a.group&&a.sj.push(this),a=a.parent;this.Wr()};a.prototype.Ya=function(){this.parent&&this.b.ii(this.b.p);this.Ah.um||this.Ah.Ya(!0);this.parent&&this.b.jd(this.b.p)};a.prototype.Wr=function(){for(var a=this.parent;a;){if(a.group&&!a.dg){this.nc=!1;return}a=a.parent}this.nc=!0};gc=a;k.prototype.reset=function(a){this.Ia=a;this.Wb=this.Ra=0;A(this.Kr);this.$l=this.xf=!1};k.prototype.Em= +function(){return this.Ia.Fn?!0:this.Ra=this.type&&(this.first=new ec(g, +b[1]),this.second=new ec(g,b[2]));if(d){var l,c;l=0;for(c=d.length;l=b|| +a<=-b)a%=b;0>a&&(a+=b);f.apply(e[a],d)};h.prototype.Jv=function(g){var b=this.ae,d=this.Ka,l=this.O,c=this.fd,f=this.$c,a=this.zb,k=this.Oc.je,e=b.N(),u=e.Zb();if(!u.length)if(e.I.length)u=e.I;else{this.Ig?g.la(""):g.H(0);return}d[0]=g;g.Df=b;g=r();p(l,d,g);c&&(c.get(g),g.qb()&&(k=g.data,u=b.d));--n;l=u.length;if(k>=l||k<=-l)k%=l;0>k&&(k+=l);k=u[k];u=0;b.B&&(u=k.type.Zf[b.Vd]);a.apply(k.L[f+u],d)};h.prototype.Rv=function(g){var b=this.fd,d=this.ae,l=this.bs,c=this.Oc.je,f=d.N(),a=f.Zb();if(!a.length)if(f.I.length)a= +f.I;else{this.Ig?g.la(""):g.H(0);return}if(b){f=r();b.get(f);if(f.qb()){c=f.data;a=d.d;0!==a.length&&(c%=a.length,0>c&&(c+=a.length));c=d.mm(c);d=c.hb[l];z(d)?g.la(d):g.n(d);--n;return}--n}b=a.length;if(c>=b||c<=-b)c%=b;0>c&&(c+=b);c=a[c];a=0;d.B&&(a=c.type.Hj[d.Vd]);d=c.hb[l+a];z(d)?g.la(d):g.n(d)};h.prototype.Sv=function(g){g.type=hc.Nf;g.data=this.value};h.prototype.Ov=function(g){g.type=hc.Mf;g.data=this.value};h.prototype.aw=function(g){g.type=hc.String;g.data=this.value};h.prototype.ew=function(g){this.first.get(g); +g.qb()&&(g.data=-g.data)};h.prototype.Dv=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data+=b.data,b.kg()&&g.wg());--n};h.prototype.bw=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data-=b.data,b.kg()&&g.wg());--n};h.prototype.Wv=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data*=b.data,b.kg()&&g.wg());--n};h.prototype.Lv=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data/= +b.data,g.wg());--n};h.prototype.Vv=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data%=b.data,b.kg()&&g.wg());--n};h.prototype.$v=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data=Math.pow(g.data,b.data),b.kg()&&g.wg());--n};h.prototype.Ev=function(g){this.first.get(g);var b=r();this.second.get(b);b.ng()||g.ng()?this.Gv(g,b):this.Fv(g,b);--n};h.prototype.Gv=function(g,b){g.ng()&&b.ng()?this.Iv(g,b):this.Hv(g,b)};h.prototype.Iv=function(g, +b){g.data+=b.data};h.prototype.Hv=function(g,b){g.ng()?g.data+=(Math.round(1E10*b.data)/1E10).toString():g.la(g.data.toString()+b.data)};h.prototype.Fv=function(g,b){g.H(g.data&&b.data?1:0)};h.prototype.Zv=function(g){this.first.get(g);var b=r();this.second.get(b);g.qb()&&b.qb()&&(g.data||b.data?g.H(1):g.H(0));--n};h.prototype.Kv=function(g){this.first.get(g);g.data?this.second.get(g):this.Zk.get(g)};h.prototype.Mv=function(g){this.first.get(g);var b=r();this.second.get(b);g.H(g.data===b.data?1:0); +--n};h.prototype.Xv=function(g){this.first.get(g);var b=r();this.second.get(b);g.H(g.data!==b.data?1:0);--n};h.prototype.Tv=function(g){this.first.get(g);var b=r();this.second.get(b);g.H(g.datab.data?1:0);--n};h.prototype.Qv=function(g){this.first.get(g);var b=r();this.second.get(b);g.H(g.data>= +b.data?1:0);--n};h.prototype.Nv=function(g){var b=this.jf.of();ja(b)?g.n(b):g.la(b)};ec=h;t.prototype.kg=function(){return this.type===hc.Mf};t.prototype.qb=function(){return this.type===hc.Nf||this.type===hc.Mf};t.prototype.ng=function(){return this.type===hc.String};t.prototype.wg=function(){this.kg()||(this.ng()&&(this.data=parseFloat(this.data)),this.type=hc.Mf)};t.prototype.H=function(g){this.type=hc.Nf;this.data=Math.floor(g)};t.prototype.n=function(g){this.type=hc.Mf;this.data=g};t.prototype.la= +function(g){this.type=hc.String;this.data=g};t.prototype.Kg=function(g){ja(g)?(this.type=hc.Mf,this.data=g):z(g)?(this.type=hc.String,this.data=g.toString()):(this.type=hc.Nf,this.data=0)};dc=t;hc={Nf:0,Mf:1,String:2}})();function T(h){this.b=h;this.fc=[]} +T.prototype.Fb=function(){var h={},r,p,t,v,n,g,b,d;h.waits=[];var l=h.waits,c;r=0;for(p=this.fc.length;r=c&&!a.ta;--b)this.b.Qe(m.V),a.index=b,m.ee(),this.b.jd(m.V);else for(;b>=c&&!a.ta;--b)a.index=b,m.ee();else if(d)for(;b<=c&&!a.ta;++b)this.b.Qe(m.V),a.index=b,m.ee(),this.b.jd(m.V);else for(;b<=c&&!a.ta;++b)a.index=b,m.ee();this.b.ln();return!1};var v=[],n=-1;h.prototype.Hs=function(a){var b=a.N();n++;v.length===n&&v.push([]);var c=v[n];Da(c,b.Zb());var d=this.b.Ea(),m=d.Ia,f=d.Em(),d=this.b.pn(),g,l,h,t,r,p,L=a.Ab;if(f)for(f=0,g=c.length;fb||b>=d.length)return!1;c.Fg(d[b]);a.Gc();return!0};h.prototype.ws=function(a,b,c){return ic(a.of(),b,c)};h.prototype.Rs=function(a){return(a=this.b.wh[a.toLowerCase()])&&a.dg};h.prototype.Xs=function(){return"undefined"!==typeof cr_is_preview};h.prototype.Ht= +function(a){if(!a||!a.d.length)return!1;a.N().R=!0;a.Gc();return!0};h.prototype.Ts=function(){return this.b.sf};h.prototype.ho=function(){var a=this.b.Ea();return a.$l?!1:!a.xf};h.prototype.uo=function(){return!0};h.prototype.kt=function(){return!0};h.prototype.Cs=function(){return!!this.b.k};h.prototype.ql=function(){return!0};h.prototype.zo=function(){return!0};h.prototype.wt=function(){return!0};h.prototype.Vi=function(){return!0};var g=null,b="",d="";h.prototype.Rt=function(a,c,e){g&&c===b&&e=== +d||(g=new RegExp(c,e),b=c,d=e);g.lastIndex=0;return g.test(a)};var l=[];h.prototype.Kt=function(a,b,c){if(!a)return!1;var d=a.N(),m=d.Zb(),f=this.b.Ea().Ia.kc,g=this.b.Qj(),h,n;d.R?(Da(l,m),A(d.I),d.R=!1,A(d.d)):f?(Da(l,d.I),A(d.I)):(Da(l,m),A(d.d));m=0;for(f=l.length;ma&&(a=0);this.b.Jf=a};var c=[],f=[];r.prototype.wu=function(a){if(!(0>a)){var b,e,d,m=this.b.Ea(),g;c.length?g=c.pop():g={Sb:{},V:[]};g.Xl=!1;g.time=this.b.Bb.Z+a;g.Gr="";g.En=!1;g.Yf=m.Ia;g.Wb=m.Wb+1;a=0;for(b=this.b.p.length;am&&(b=m);a.n(b)};p.prototype.De=function(a){a.n(this.b.De)};p.prototype.Jf=function(a){a.n(this.b.Jf)};p.prototype.time=function(a){a.n(this.b.Bb.Z)};p.prototype.Rg= +function(a){a.H(this.b.Rg)};p.prototype.rk=function(a){a.H(this.b.rk)};p.prototype.gm=function(a){a.H(this.b.gm)};p.prototype.vx=function(a,b){var c,d;if(this.b.Yh.length)if(b){for(d=this.b.Zh;0<=d;--d)if(c=this.b.Yh[d],c.name===b){a.H(c.index);return}a.H(0)}else c=this.b.up(),a.H(c?c.index:-1);else a.H(0)};p.prototype.Yu=function(a,b,c,d,m){a.n(Va(b,c,d,m))};p.prototype.m=function(a,b,c,d,m){a.n(Ka(Pa(b,c,d,m)))};p.prototype.Bx=function(a){a.la("\n")};p.prototype.Py=function(a,b){a.la(z(b)?b.toUpperCase(): +"")};p.prototype.qx=function(a){a.H(this.b.ba.width)};p.prototype.ox=function(a){a.H(this.b.ba.height)};p.prototype.left=function(a,b,c){a.la(z(b)?b.substr(0,c):"")};p.prototype.right=function(a,b,c){a.la(z(b)?b.substr(b.length-c):"")};p.prototype.zx=function(a,b,c,d){a.la(z(b)?b.substr(c,d):"")};p.prototype.Ky=function(a,b,c,d){z(b)&&z(d)?(b=b.split(d),c=ta(c),0>c||c>=b.length?a.la(""):a.la(b[c])):a.la("")};p.prototype.Ly=function(a,b,c){z(b)&&b.length?a.H(b.split(c).length):a.H(0)};p.prototype.replace= +function(a,b,c,d){z(b)&&z(c)&&z(d)?a.la(b.replace(new RegExp(fb(c),"gi"),d)):a.la(z(b)?b:"")};p.prototype.trim=function(a,b){a.la(z(b)?b.trim():"")};p.prototype.Sx=function(a){a.n(sa)};p.prototype.Yo=function(a){var b=ta(Math.random()*(arguments.length-1));a.Kg(arguments[b+1])};p.prototype.Wy=function(a,b,c){var d=0>b?"-":"";0>b&&(b=-b);c=c-b.toString().length;for(var m=0;mthis.b.Bb.Z)continue;l.Ia=d.Yf;l.Wb=d.Wb;l.Ra=0;for(b in d.Sb)d.Sb.hasOwnProperty(b)&& +(m=this.b.p[parseInt(b,10)].N(),g=d.Sb[b],m.R=g.Jk,Da(m.d,g.Xd),m=g,A(m.Xd),f.push(m));d.Yf.jy();this.b.Nl(d.V);d.Xl=!0}b=a=0;for(e=this.fc.length;aa.wa||b.top>a.ua)},c.ko=function(){this.Aa();var a=this.Qa,b=this.b.ba;return 0>a.right||0>a.bottom||a.left>b.width||a.top>b.height},c.fz=function(a,b,c){var d=this.N(),f= +d.Zb();if(!f.length)return!1;var g=f[0],l=g,h=Va(g.x,g.y,b,c),n,t,r;n=1;for(t=f.length;nh)h=r,l=g;d.Fg(l);return!0},f.Pf=function(a){this.x!==a&&(this.x=a,this.za())},f.$i=function(a){this.y!==a&&(this.y=a,this.za())},f.gu=function(a,b){if(this.x!==a||this.y!==b)this.x=a,this.y=b,this.za()},f.Eo=function(a,b){var c=a.xw(this);if(c){var d;c.nf?(d=c.nf(b,!0),c=c.nf(b,!1)):(d=c.x,c=c.y);if(this.x!==d||this.y!==c)this.x=d,this.y=c,this.za()}},f.cz= +function(a){0!==a&&(this.x+=Math.cos(this.m)*a,this.y+=Math.sin(this.m)*a,this.za())},f.bz=function(a,b){0!==b&&(this.x+=Math.cos(G(a))*b,this.y+=Math.sin(G(a))*b,this.za())},a.aj=function(a){a.n(this.x)},a.Al=function(a){a.n(this.y)},a.De=function(a){a.n(this.b.Rj(this))});n&&(c.Xy=function(a,b){return ic(this.width,a,b)},c.ss=function(a,b){return ic(this.height,a,b)},f.Zi=function(a){this.width!==a&&(this.width=a,this.za())},f.Xi=function(a){this.height!==a&&(this.height=a,this.za())},f.$g=function(a, +b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.za()},a.bh=function(a){a.n(this.width)},a.Oi=function(a){a.n(this.height)},a.Zn=function(a){this.Aa();a.n(this.Qa.left)},a.ao=function(a){this.Aa();a.n(this.Qa.top)},a.$n=function(a){this.Aa();a.n(this.Qa.right)},a.Yn=function(a){this.Aa();a.n(this.Qa.bottom)});g&&(c.kl=function(a,b){return Ra(this.m,G(b))<=G(a)},c.Qs=function(a){return Ta(this.m,G(a))},c.Os=function(a,b){var c=Oa(a),d=Oa(b),f=Ma(this.m);return Ta(d,c)?Ta(f,c)&& +!Ta(f,d):!(!Ta(f,c)&&Ta(f,d))},f.Co=function(a){a=G(La(a));isNaN(a)||this.m===a||(this.m=a,this.za())},f.iz=function(a){0===a||isNaN(a)||(this.m+=G(a),this.m=Ma(this.m),this.za())},f.jz=function(a){0===a||isNaN(a)||(this.m-=G(a),this.m=Ma(this.m),this.za())},f.kz=function(a,b){var c=Sa(this.m,G(b),G(a));isNaN(c)||this.m===c||(this.m=c,this.za())},f.lz=function(a,b,c){a=Sa(this.m,Math.atan2(c-this.y,b-this.x),G(a));isNaN(a)||this.m===a||(this.m=a,this.za())},f.mz=function(a,b){var c=Math.atan2(b-this.y, +a-this.x);isNaN(c)||this.m===c||(this.m=c,this.za())},a.ls=function(a){a.n(Na(this.m))});t||(c.Mi=function(a,b,c){return ic(this.hb[a],b,c)},c.ml=function(a){return this.hb[a]},c.gz=function(a,b){var c=this.N(),d=c.Zb();if(!d.length)return!1;var f=d[0],g=f,l=f.hb[b],h,n,t;h=1;for(n=d.length;hl)l=t,g=f;c.Fg(g);return!0},c.Bo=function(a){var b,c,d,f,g;if(this.b.Qj().fg){g=this.N();if(g.R)for(g.R=!1,A(g.d),A(g.I),d=this.d,b=0,c=d.length;ba?a=0:1f.j.index||d.j.index===f.j.index&&d.wd()>f.wd())f=d}else if(d.j.indexc)){var d=1===a;this.re[c]!==d&&(this.re[c]=d,this.nd(),this.b.fa=!0)}}},f.wl=function(a,b,c){if(this.b.k){var d=this.type.lm(a);0>d||(a=this.type.M[d],d=this.Ja[d],b=Math.floor(b),0>b||b>=d.length||(1===this.b.k.Bw(a.Za,b)&&(c/=100),d[b]!==c&&(d[b]=c,a.nc&&(this.b.fa=!0))))}})};Ob=function(){this.Kl=this.Fl=!0;this.type.ej=!0;this.b.fa=!0;var h,p,t=this.Gl;h=0;for(p=t.length;h< +p;++h)t[h](this);this.j.Ec&&this.Aa()};Pb=function(h){h&&this.Gl.push(h)};Rb=function(){if(this.Fl){var h=this.Qa,p=this.Xb;h.set(this.x,this.y,this.x+this.width,this.y+this.height);h.offset(-this.Nb*this.width,-this.Ob*this.height);this.m?(h.offset(-this.x,-this.y),p.Br(h,this.m),p.offset(this.x,this.y),p.To(h)):p.ni(h);h.normalize();this.Fl=!1;this.Oy()}};var h=new wa(0,0,0,0);Sb=function(){if(this.j.Ec){var r=this.j.Eb,p=this.Qa;h.set(r.Ub(p.left),r.Vb(p.top),r.Ub(p.right),r.Vb(p.bottom));this.ac.oh(h)|| +(this.ac.rightt;case 5:return h>=t;default:return!1}}})(); +var qc={tint:{src:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float red;\nuniform lowp float green;\nuniform lowp float blue;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\ngl_FragColor = front * vec4(red, green, blue, 1.0);\n}",Ej:0,Fj:0,Sl:!1,Rc:!0,Cl:!1,O:[["red",0,1],["green",0,1],["blue",0,1]]}};function tc(h){this.b=h} +(function(){function h(){}function r(){}function p(){}var t=!1,v=null,n=null,g="",b=tc.prototype;b.W=function(a){this.X=a;this.b=a.b};b.W.prototype.D=function(){};b.S=function(a){this.type=a;this.b=a.b;this.rc=this.zd="";this.$b=0;this.timeout=-1;if(t=this.b.Hh)v=require("path"),n=require("fs"),g=v.dirname((window.process||nw.process).execPath)+"\\"};var d=b.S.prototype,l=null;window.C2_AJAX_DCSide=function(a,b,c){l&&("success"===a?(l.rc=b,l.zd=c,l.b.trigger(tc.prototype.c.Pi,l),l.b.trigger(tc.prototype.c.Zg, +l)):"error"===a?(l.rc=b,l.b.trigger(tc.prototype.c.Qi,l),l.b.trigger(tc.prototype.c.Ti,l)):"progress"===a&&(l.$b=c,l.rc=b,l.b.trigger(tc.prototype.c.yo,l)))};d.D=function(){l=this};d.Fb=function(){return{lastData:this.zd}};d.Qb=function(a){this.zd=a.lastData;this.rc="";this.$b=0};var c={},f="";d.gv=function(a,b){if(this.b.pb)AppMobi.webview.execute('C2_AJAX_WebSide("'+a+'", "'+b+'", "GET", null);');else{var e=this,d=null,m=function(){e.rc=a;e.b.trigger(tc.prototype.c.Qi,e);e.b.trigger(tc.prototype.c.Ti, +e)},h=function(){if(t){var c=g+b;n.existsSync(c)?n.readFile(c,{encoding:"utf8"},function(b,c){b?m():(e.rc=a,e.zd=c.replace(/\r\n/g,"\n"),e.b.trigger(tc.prototype.c.Pi,e),e.b.trigger(tc.prototype.c.Zg,e))}):m()}else m()},l=function(b){b.lengthComputable&&(e.$b=b.loaded/b.total,e.rc=a,e.b.trigger(tc.prototype.c.yo,e))};try{this.b.Ke?d=new ActiveXObject("Microsoft.XMLHTTP"):d=new XMLHttpRequest;d.onreadystatechange=function(){4===d.readyState&&(e.rc=a,d.responseText?e.zd=d.responseText.replace(/\r\n/g, +"\n"):e.zd="",400<=d.status?(e.b.trigger(tc.prototype.c.Qi,e),e.b.trigger(tc.prototype.c.Ti,e)):t&&!e.zd.length||!t&&0===d.status&&!e.zd.length||(e.b.trigger(tc.prototype.c.Pi,e),e.b.trigger(tc.prototype.c.Zg,e)))};this.b.Ke||(d.onerror=h,d.ontimeout=h,d.onabort=h,d.onprogress=l);d.open("GET",b);!this.b.Ke&&0<=this.timeout&&"undefined"!==typeof d.timeout&&(d.timeout=this.timeout);try{d.responseType="text"}catch(p){}if(d.setRequestHeader){for(var v in c)if(c.hasOwnProperty(v))try{d.setRequestHeader(v, +c[v])}catch(r){}c={}}if(f&&d.overrideMimeType){try{d.overrideMimeType(f)}catch(oa){}f=""}d.send()}catch(K){h()}}};h.prototype.Zg=function(a){return mb(a,this.rc)};h.prototype.Pi=function(){return!0};h.prototype.Ti=function(a){return mb(a,this.rc)};h.prototype.Qi=function(){return!0};h.prototype.yo=function(a){return mb(a,this.rc)};b.c=new h;r.prototype.St=function(a,b){var c=this;this.b.Jh&&!this.b.Lp(b)?this.b.lp(b,function(b){c.rc=a;c.zd=b.replace(/\r\n/g,"\n");c.b.trigger(tc.prototype.c.Pi,c); +c.b.trigger(tc.prototype.c.Zg,c)},function(){c.rc=a;c.b.trigger(tc.prototype.c.Qi,c);c.b.trigger(tc.prototype.c.Ti,c)}):this.gv(a,b)};b.e=new r;p.prototype.bt=function(a){a.la(this.zd)};b.g=new p})();function uc(h){this.b=h} +(function(){function h(){return b.length?b.pop():[]}function r(d){var g,c;g=0;for(c=d.length;gb||b>this.ra-1||isNaN(g)||0>g||g>this.Ca-1||isNaN(c)||0>c||c>this.Ma-1?0: +this.oc[b][g][c]};g.set=function(b,g,c,f){b=Math.floor(b);g=Math.floor(g);c=Math.floor(c);isNaN(b)||0>b||b>this.ra-1||isNaN(g)||0>g||g>this.Ca-1||isNaN(c)||0>c||c>this.Ma-1||(this.oc[b][g][c]=f)};g.mw=function(){return JSON.stringify({c2array:!0,size:[this.ra,this.Ca,this.Ma],data:this.oc})};g.Fb=function(){return{size:[this.ra,this.Ca,this.Ma],data:this.oc}};g.Qb=function(b){var g=b.size;this.ra=g[0];this.Ca=g[1];this.Ma=g[2];this.oc=b.data};g.ge=function(b,g,c){0>b&&(b=0);0>g&&(g=0);0>c&&(c=0); +if(this.ra!==b||this.Ca!==g||this.Ma!==c){this.ra=b;this.Ca=g;this.Ma=c;var f,a,k=this.oc;k.length=b;for(b=0;bb))switch(g){case 0:if(b>=this.ra)break;r(a[b]);a.splice(b,1);this.ra--;break;case 1:if(b>=this.Ca)break;for(;c=this.Ma)break;for(;ca&&(a=0);1a&&(a=0);1a&&(a=.01);this.Bk.gain.value=a; +this.Ak.gain.value=Math.pow(1/a,.6)*b};E.prototype.shape=function(a,b,c){var e=1.05*c*b-b;c=0>a?-1:1;a=0>a?-a:a;b=af;++f)d=f/32768,d=this.shape(d,c,e),this.xj[32768+f]=d,this.xj[32768-f-1]=-d};E.prototype.Hc=function(a){this.K.disconnect();this.K.connect(a);this.J.disconnect();this.J.connect(a)};E.prototype.remove=function(){this.aa.disconnect();this.Bk.disconnect(); +this.hl.disconnect();this.Ak.disconnect();this.K.disconnect();this.J.disconnect()};E.prototype.tc=function(){return this.aa};Ea.prototype.Hc=function(a){this.da.disconnect();this.da.connect(a)};Ea.prototype.remove=function(){this.da.disconnect()};Ea.prototype.tc=function(){return this.da};oa.prototype.mb=function(){this.da.getFloatFrequencyData(this.iw);this.da.getByteTimeDomainData(this.Er);for(var a=this.da.fftSize,b=0,c=this.gi=0,e=0;be&&(e=-e),this.gib&&(c=b);return c}; +H.prototype.hg=function(){return!this.ic&&!this.vd&&!this.ta&&!this.qf()};H.prototype.Ay=function(){return!this.vd&&!this.ta&&!this.qf()};H.prototype.My=function(){var a=this.volume*ia;isFinite(a)||(a=0);switch(this.U){case 0:"undefined"!==typeof this.i.volume&&this.i.volume!==a&&(this.i.volume=a);break;case 1:1===this.buffer.U?this.fb.gain.value=a*this.zg:"undefined"!==typeof this.i.volume&&this.i.volume!==a&&(this.i.volume=a)}};H.prototype.Bj=function(a){switch(this.U){case 0:this.i.muted!==!!a&& +(this.i.muted=!!a);break;case 1:1===this.buffer.U?(this.zg=a?0:1,this.fb.gain.value=ia*this.volume*this.zg):this.i.muted!==!!a&&(this.i.muted=!!a)}};H.prototype.vy=function(){this.lg=!0;this.Bj(this.lg||this.Kh)};H.prototype.xr=function(a){this.Kh=!!a;this.Bj(this.lg||this.Kh)};H.prototype.wy=function(a){this.playbackRate=a;this.Bi()};H.prototype.Bi=function(){var a=this.playbackRate;this.ig&&(a*=F.Jf);switch(this.U){case 0:this.i.playbackRate!==a&&(this.i.playbackRate=a);break;case 1:1===this.buffer.U? +this.i.playbackRate.value!==a&&(this.i.playbackRate.value=a):this.i.playbackRate!==a&&(this.i.playbackRate=a)}};H.prototype.yy=function(a){switch(this.U){case 0:a?this.hg()?(this.Cc=!0,this.i.pause()):this.Cc=!1:this.Cc&&(this.i.play(),this.Cc=!1);break;case 1:a?this.hg()?(this.Cc=!0,1===this.buffer.U?(this.cc=this.nm(!0),this.Ad&&(this.cc=this.cc%this.mf()),f(this.i)):this.i.pause()):this.Cc=!1:this.Cc&&(1===this.buffer.U?(this.i=y.createBufferSource(),this.i.buffer=this.buffer.ca,this.i.connect(this.fb), +this.i.onended=this.dn,this.cj=this.i,this.i.loop=this.Ad,this.fb.gain.value=ia*this.volume*this.zg,this.Bi(),this.startTime=(this.ig?F.Bb.Z:F.oe.Z)-this.cc/(this.playbackRate||.001),c(this.i,this.cc,this.mf())):this.i.play(),this.Cc=!1);break;case 2:a?this.hg()?(this.i.pause(),this.Cc=!0):this.Cc=!1:this.Cc&&(this.Cc=!1,this.i.play())}};M.S=function(a){this.type=a;F=this.b=a.b;R=this;this.jc=null;this.Ph=-600;this.b.Jh&&(ob=!0);!(this.b.pg||this.b.Dh&&(this.b.Bm||this.b.Xj))||this.b.Zj||this.b.pa|| +this.b.Mp||ob||(Ec=!0);y=null;"undefined"!==typeof AudioContext?(D=1,y=new AudioContext):"undefined"!==typeof webkitAudioContext&&(D=1,y=new webkitAudioContext);this.b.pg&&y&&(y.close&&y.close(),"undefined"!==typeof AudioContext?y=new AudioContext:"undefined"!==typeof webkitAudioContext&&(y=new webkitAudioContext));1!==D&&(this.b.vc&&"undefined"!==typeof window.Media?D=2:this.b.Np&&(D=3));2===D&&(B=location.href,a=B.lastIndexOf("/"),-1"!==b&&(a.xk=b,a.Um=e,a.Vn=d),null;g=new H(a,b);C.push(g);return g};var ra=[];O.prototype.Si=function(a){return mb(x,a)};O.prototype.Ys=function(a){W(a);var b;a=0;for(b=ra.length;a",b,!1)}};J.prototype.fu=function(a,b){W(a);0>b&&(b=0);var c,e;c=0;for(e=ra.length;cd?null:b[d]}function t(){}function v(){}function n(){}var g=sc.prototype;g.W=function(b){this.X=b;this.b=b.b};g.W.prototype.D=function(){};g.S=function(b){this.type=b;this.b=b.b};var b=[],d=-1;g.S.prototype.D=function(){var b=this;window.c2_callFunction=function(c,f){var a,g,e,h=r();h.name=c.toLowerCase();h.Hg=0;if(f)for(h.Oa.length=f.length,a=0,g=f.length;ab||b>=a.Oa.length?!1:ic(a.Oa[b],c,d)};g.c=new t;v.prototype.CallFunction=function(b,c){var f=r();f.name=b.toLowerCase();f.Hg=0;Da(f.Oa,c);this.b.trigger(sc.prototype.c.Ui,this,f.name);d--};v.prototype.hu=function(b){var c= +p();c&&(c.Hg=b)};g.e=new v;n.prototype.Gt=function(b,c){c=ta(c);var d=p();d?0<=c&&ch;++h)if(this.qg[h]){this.qg[h]=!1;this.me=h;this.b.trigger(xc.prototype.c.no,this);var n=this.b.trigger(xc.prototype.c.ro,this),g=this.b.trigger(xc.prototype.c.qo,this);if(n||g)this.Ci[h]=!0}};p.Fb=function(){return{triggerKey:this.me}};p.Qb=function(h){this.me=h.triggerKey};h.prototype.Ss=function(h){return this.qg[h]};h.prototype.tt=function(h){return h===this.me};h.prototype.it=function(){return!0}; +h.prototype.no=function(){return!0};h.prototype.ro=function(h){return h===this.me};h.prototype.ut=function(h){return h===this.me};h.prototype.qo=function(h){return h===this.me};r.c=new h;r.e=new function(){};r.g=new function(){}})();function Y(h){this.b=h} +(function(){function h(h,p,n,g,b,d,l,c,f,a){h.save();h.fillStyle=p;p=b%n;var k=d%g;0>p&&(p+=n);0>k&&(k+=g);h.translate(p+f,k+a);h.fillRect(b-p-f,d-k-a,l,c);h.restore()}var r=Y.prototype;r.W=function(h){this.X=h;this.b=h.b};var p=r.W.prototype;p.D=function(){this.B||(this.q=new Image,this.q.Ql=this.Yk,this.b.gl(this.q,this.wi),this.Hi=this.Ki=this.Ji=this.Ii=this.Xg=this.r=this.So=this.Pr=this.nr=this.hq=this.em=null)};p.ei=function(){this.B||(this.Hi=this.Ki=this.Ji=this.Ii=this.Xg=this.r=null)}; +p.fi=function(){this.B||!this.d.length||this.r||(this.r=this.b.k.yc(this.q,!0,this.b.qa,this.Ue))};p.Ai=function(){this.B||this.d.length||!this.b.k||(this.b.k.deleteTexture(this.r),this.b.k.deleteTexture(this.Xg),this.b.k.deleteTexture(this.Ii),this.b.k.deleteTexture(this.Ji),this.b.k.deleteTexture(this.Ki),this.b.k.deleteTexture(this.Hi),this.Hi=this.Ki=this.Ji=this.Ii=this.Xg=this.r=null)};p.Gd=function(h,p,n,g){var b=document.createElement("canvas");n=n-h;g=g-p;b.width=n;b.height=g;b.getContext("2d").drawImage(this.q, +h,p,n,g,0,0,n,g);return b};p.Uu=function(h,p,n,g){var b=this.q.width,d=this.q.height,l=b-p,c=d-g;if(this.b.k){if(!this.Xg){var f=this.b.k,a=this.b.qa,k=this.Ue;l>h&&c>n&&(this.Xg=f.yc(this.Gd(h,n,l,c),!0,a,k));0n&&(this.Ii=f.yc(this.Gd(0,n,h,c),!0,a,k,"repeat-y"));0n&&(this.Ji=f.yc(this.Gd(l,n,b,c),!0,a,k,"repeat-y"));0h&&(this.Ki=f.yc(this.Gd(h,0,l,n),!0,a,k,"repeat-x"));0h&&(this.Hi=f.yc(this.Gd(h,c,l,d),!0,a,k,"repeat-x"))}}else this.em||(f=this.b.Ba,l>h&&c>n&&(this.em= +f.createPattern(this.Gd(h,n,l,c),"repeat")),0n&&(this.hq=f.createPattern(this.Gd(0,n,h,c),"repeat")),0n&&(this.nr=f.createPattern(this.Gd(l,n,b,c),"repeat")),0h&&(this.Pr=f.createPattern(this.Gd(h,0,l,n),"repeat")),0h&&(this.So=f.createPattern(this.Gd(h,c,l,d),"repeat")))};r.S=function(h){this.type=h;this.b=h.b};p=r.S.prototype;p.D=function(){this.Om=this.A[0];this.wn=this.A[1];this.Ln=this.A[2];this.Hl=this.A[3];this.Cj=this.A[4];this.fill=this.A[5];this.visible=0===this.A[6]; +this.qr=0!==this.A[8];this.Bc?this.de.set(0,0,0,0):this.de=new wa(0,0,0,0);this.b.k&&!this.type.r&&(this.type.r=this.b.k.yc(this.type.q,!1,this.b.qa,this.type.Ue));this.type.Uu(this.Om,this.wn,this.Ln,this.Hl)};p.ed=function(t){var p=this.type.q,n=this.Om,g=this.wn,b=this.Ln,d=this.Hl,l=p.width,c=p.height,f=l-g,a=c-d;t.globalAlpha=this.opacity;t.save();var k=this.x,e=this.y,u=this.width,m=this.height;this.b.Ac&&(k=Math.round(k),e=Math.round(e));var q=-(this.Nb*this.width),w=-(this.Ob*this.height), +r=q%l,E=w%c;0>r&&(r+=l);0>E&&(E+=c);t.translate(k+r,e+E);l=q-r;w-=E;E=this.qr?1:0;0b&&h(t,this.type.hq,n,a-b,l,w+b,n+E,m-b-d,0,0),0b&&h(t,this.type.nr,g,a-b,l+u-g-E,w+b,g+E,m-b-d,E,0),0n&&h(t,this.type.Pr,f-n,b,l+n,w,u-n-g, +b+E,0,0),0n&&h(t,this.type.So,f-n,d,l+n,w+m-d-E,u-n-g,d+E,0,E)):1===this.Cj&&(0b&&0b&&0n&&0n&&0b&&f>n&&(0===this.fill?h(t,this.type.em,f-n,a-b,l+n,w+b,u-n-g,m-b-d,0,0):1===this.fill&&0g&&this.xi(h,this.type.Ii,f,c+g,p+e,k-g-b,0,0),0g&&this.xi(h,this.type.Ji,f+a-n-e,c+g,n+e,k-g-b,e,0),0p&&this.xi(h,this.type.Ki, +f+p,c,a-p-n,g+e,0,0),0p&&this.xi(h,this.type.Hi,f+p,c+k-b-e,a-p-n,b+e,0,e)):1===this.Cj&&(0g&&this.Td(h,this.type.r,0,g,p,l-g,f,c+g,p,k-g-b),0g&&this.Td(h,this.type.r,d,g,n,l-g,f+a-n,c+g,n,k-g-b),0p&&this.Td(h,this.type.r,p,0,d-p,g,f+p,c,a-p-n,g),0p&&this.Td(h,this.type.r,p,l,d-p,b,f+p,c+k-b,a-p-n,b));l>g&&d>p&&(0===this.fill?this.xi(h,this.type.Xg,f+p,c+g,a-p-n,k-g-b,0,0):1===this.fill&&this.Td(h,this.type.r,p,g,d-p,l-g,f+p,c+g,a-p-n,k-g-b))};r.c=new function(){};r.e= +new function(){};r.g=new function(){}})();function V(h){this.b=h} +(function(){function h(){if(0===this.Vl.length){var a=document.createElement("canvas");a.width=this.width;a.height=this.height;var b=a.getContext("2d");this.Mg?b.drawImage(this.q,this.Ag,this.Bg,this.width,this.height,0,0,this.width,this.height):b.drawImage(this.q,0,0,this.width,this.height);this.Vl=a.toDataURL("image/png")}return this.Vl}function r(){}function p(b,d,g){if(!b)return!1;var h=0!==d||0!==g,n,p,t=!1,r,v=this.b.Qj(),K=v.type,v=v.fg,L=b.N();r=this.b.Ea().Ia.kc;L.R?(this.Aa(),k.Vf(this.Qa), +k.offset(d,g),this.b.pw(this.j,b,k,a),L=a):L=r?this.b.$w()&&!L.I.length&&L.d.length?L.d:L.I:L.d;l=b;f=K!==b&&!v;h&&(n=this.x,p=this.y,this.x+=d,this.y+=g,this.za());d=0;for(g=L.length;dthis.C&&(this.C=0);this.C>=this.xa.frames.length&&(this.C=this.xa.frames.length-1);var a=this.xa.frames[this.C];this.ga.oi(a.yk);this.Nb=a.Nb;this.Ob=a.Ob;this.Wf=this.xa.speed;this.Be=this.xa.vn;1===this.type.gc.length&&1===this.type.gc[0].frames.length||0===this.Wf||(this.b.If(this),this.uf=!0);this.Bc?this.Yc.reset():this.Yc=new eb;this.ud=this.Yc.Z;this.Ld=!0;this.Md=0;this.Ye=!0;this.Tf=this.Oo= +"";this.Xo=0;this.hh=-1;this.type.Pm();var b,c,d,f,g,k,h,a=0;for(b=this.type.gc.length;athis.C&&(this.C=0);this.C>=this.xa.frames.length&&(this.C=this.xa.frames.length-1);this.Wf=a.cas;this.ud=a.fs;this.Md=a.ar;this.Yc.reset();this.Yc.Z=a.at;this.Ld=a.hasOwnProperty("ap")?a.ap:!0;this.Ye=a.hasOwnProperty("af")?a.af:!0;a.hasOwnProperty("rt")?this.Be=a.rt:this.Be=this.xa.vn;this.Sa=this.xa.frames[this.C];this.vj= +this.Sa.r;this.ga.oi(this.Sa.yk);this.Nb=this.Sa.Nb;this.Ob=this.Sa.Ob};d.Dl=function(a){this.C=a?0:this.xa.frames.length-1;this.Ld=!1;this.Oo=this.xa.name;this.zh=!0;this.b.trigger(V.prototype.c.ht,this);this.b.trigger(V.prototype.c.mo,this);this.zh=!1;this.Md=0};d.El=function(){return this.Yc.Z};d.mb=function(){this.Yc.add(this.b.Rj(this));this.Tf.length&&this.dp();0<=this.hh&&this.Zl();var a=this.Yc.Z,b=this.xa,c=b.frames[this.C],d=c.duration/this.Wf;this.Ld&&a>=this.ud+d&&(this.Ye?this.C++:this.C--, +this.ud+=d,this.C>=b.frames.length&&(b.cr?(this.Ye=!1,this.C=b.frames.length-2):b.loop?this.C=this.Be:(this.Md++,this.Md>=b.un?this.Dl(!1):this.C=this.Be)),0>this.C&&(b.cr?(this.C=1,this.Ye=!0,b.loop||(this.Md++,this.Md>=b.un&&this.Dl(!0))):b.loop?this.C=this.Be:(this.Md++,this.Md>=b.un?this.Dl(!0):this.C=this.Be)),0>this.C?this.C=0:this.C>=b.frames.length&&(this.C=b.frames.length-1),a>this.ud+b.frames[this.C].duration/this.Wf&&(this.ud=a),a=b.frames[this.C],this.Of(c,a),this.b.fa=!0)};d.sp=function(a){var b, +c,d;b=0;for(c=this.type.gc.length;bthis.C&&(this.C=0),this.C>=this.xa.frames.length&&(this.C=this.xa.frames.length-1),1===this.Xo&&(this.C=0),this.Ld=!0,this.ud=this.Yc.Z, +this.Ye=!0,this.Of(a,this.xa.frames[this.C]),this.b.fa=!0)};d.Zl=function(){var a=this.xa.frames[this.C],b=this.C;this.C=ta(this.hh);0>this.C&&(this.C=0);this.C>=this.xa.frames.length&&(this.C=this.xa.frames.length-1);b!==this.C&&(this.Of(a,this.xa.frames[this.C]),this.ud=this.Yc.Z,this.b.fa=!0);this.hh=-1};d.Of=function(a,b){var c=a.width,d=a.height,f=b.width,g=b.height;c!=f&&(this.width*=f/c);d!=g&&(this.height*=g/d);this.Nb=b.Nb;this.Ob=b.Ob;this.ga.oi(b.yk);this.za();this.Sa=b;this.vj=b.r;c=0; +for(d=this.L.length;cf||f>=d.length)return b?this.x:this.y;var g=(d[f][1]-c.Nb)*this.width,d=d[f][2],d=(d-c.Ob)*this.height,c=Math.cos(this.m);f=Math.sin(this.m);var k=g*c-d*f,d=d*c+g*f,g=k+this.x,d=d+this.y;return b?g:d};var l=null,c=new ca,f=!1,a=[],k=new wa(0, +0,0,0);g.finish=function(a){if(f){if(a){var b=this.b.Ea().Ia.kc;a=l.N();var d=c.We(),g,k;if(a.R){a.R=!1;A(a.d);g=0;for(k=d.length;gthis.width?-1:1);a=b.height*a*(0>this.height?-1:1);if(this.width!==c||this.height!==a)this.width=c,this.height=a,this.za()};n.e=new t;v.prototype.Ls=function(a,b){a.n(this.nf(b,!0))};v.prototype.Ms=function(a,b){a.n(this.nf(b,!1))};v.prototype.jo=function(a){a.n(this.Sa.width)};v.prototype.io= +function(a){a.n(this.Sa.height)};n.g=new v})();function yc(h){this.b=h} +(function(){function h(a,b){return a.length?a.pop():new b}function r(a,b,c){if(c){var d;c=0;for(d=b.length;c=f.length&&f.push(h(b,Object));c=f[c];c.text=d;c.width=a.Wm(d);a.Qg=pa(a.Qg,c.width)}function t(){}var v=yc.prototype;v.D=function(){};v.W=function(a){this.X=a;this.b=a.b};var n=v.W.prototype;n.D=function(){this.B|| +(this.q=new Image,this.b.gl(this.q,this.wi),this.r=null)};n.ei=function(){this.B||(this.r=null)};n.fi=function(){if(!this.B&&this.d.length){this.r||(this.r=this.b.k.yc(this.q,!1,this.b.qa,this.Ue));var a,b;a=0;for(b=this.d.length;a=b*c);p++){var t=p%b,r=Math.floor(p/b),v=n.charAt(p);if(this.b.k){var K=this.qj,L=t*g,H=r*q,t=(t+1)*g,r=(r+1)*q;void 0===K[v]&&(K[v]=h(l,wa));K[v].left=L;K[v].top=H;K[v].right=t;K[v].bottom=r}else K=this.pj,t=t*a,r=r*f,L=a,H=f,void 0===K[v]&&(K[v]=h(d,Object)),K[v].x=t,K[v].y=r,K[v].cs=L,K[v].Ap=H}};var c= +[];v.uu=function(a){A(c);for(var b="",d,f=0;f=f)r(b,d,!0);else{var g=a.rd,l=a.Uf;if(c.length*(a.oj*g+l)-l<=f&&-1===c.indexOf("\n")&&(l=a.Wm(c),l<=f)){r(b,d,!0);d.push(h(b, +Object));d[0].text=c;d[0].width=l;a.Qg=l;a.Gf=a.we*g+a.lineHeight;return}this.zu(a);a.Gf=d.length*(a.we*g+a.lineHeight)}}else r(b,d,!0)};v.zu=function(a){var d=a.Uy,e=a.text,f=a.zf,h=a.width;d&&(this.uu(e),e=c);var l="",n,t,r,v=0,oa=!1;for(r=0;rh&&(""===n?(p(a,v,l),l="",oa=!0):(p(a,v,n),l=e[r]),v++,d||" "!==l||(l="")));l.replace(/\s\s*$/,"").length&&(p(a,v,l),v++);for(r=v;rthis.width+1E-5)break;void 0!==D&&(M=J,F=O,0===l&&1===p&&(M=Math.round(M),F=Math.round(F)),a.drawImage(this.q,D.x,D.y,D.cs,D.Ap,M,F,D.cs*p,D.Ap*p));J+=W*p+v;if(0===l&&b+J>g)break}}O+=t;if(0===l&&(O+t+r>this.height||c+O>h))break}}a.restore()}};var f=new xa;n.Kb=function(a){a.Rb(this.r);a.Se(this.opacity);if(this.text&&(this.jr(),!(this.heightthis.width+1E-5)break;if(void 0!== +y){var N=this.oj*v,C=this.we*v;x=R;B=r;0===p&&1===v&&(x=Math.round(x),B=Math.round(B));f.Fa=x;f.Ga=B;f.nb=x+N;f.ob=B;f.$a=x;f.ab=B+C;f.bb=x+N;f.cb=B+C;0!==p&&(x=f,B=M,N=F,C=void 0,C=x.Fa*B-x.Ga*N,x.Ga=x.Ga*B+x.Fa*N,x.Fa=C,C=x.nb*B-x.ob*N,x.ob=x.ob*B+x.nb*N,x.nb=C,C=x.$a*B-x.ab*N,x.ab=x.ab*B+x.$a*N,x.$a=C,C=x.bb*B-x.cb*N,x.cb=x.cb*B+x.bb*N,x.bb=C);f.offset(c,b);a.Sc(f.Fa,f.Ga,f.nb,f.ob,f.bb,f.cb,f.$a,f.ab,y)}R+=J*v+W;if(0===p&&c+R>l)break}}r+=L;if(0===p&&(r+L+H>this.height||b+r>n))break}}};v.c=new function(){}; +t.prototype.ju=function(a){ja(a)&&1E9>a&&(a=Math.round(1E10*a)/1E10);a=a.toString();this.text!==a&&(this.text=a,this.Hf=!0,this.b.fa=!0)};t.prototype.yl=function(a){a!==this.rd&&(this.rd=a,this.Hf=!0,this.b.fa=!0)};n.$t=function(a,b){var c=parseInt(b,10);this.xe[a]!==c&&(this.xe[a]=c,this.Hf=!0,this.b.fa=!0)};t.prototype.au=function(a,b){if(""!==a)for(var c=0;cd&&(d+=this.q.width);0>l&&(l+=this.q.height);h.translate(p,n);h.rotate(this.m);h.translate(d,l);h.fillRect(g-d,b-l,this.width,this.height);h.restore()};p.Ce=function(h){this.Kb(h)};p.Kb= +function(h){h.Rb(this.r);h.Se(this.opacity);var p=this.de;p.right=this.width/this.q.width;p.bottom=this.height/this.q.height;var n=this.Xb;if(this.b.Ac){var g=Math.round(this.x)-this.x,b=Math.round(this.y)-this.y;h.Sc(n.Fa+g,n.Ga+b,n.nb+g,n.ob+b,n.bb+g,n.cb+b,n.$a+g,n.ab+b,p)}else h.Sc(n.Fa,n.Ga,n.nb,n.ob,n.bb,n.cb,n.$a,n.ab,p)};r.c=new function(){};r.e=new function(){};h.prototype.jo=function(h){h.n(this.q.width)};h.prototype.io=function(h){h.n(this.q.height)};r.g=new h})(); +function Z(h){this.b=h} +(function(){function h(a){l=a.x;c=a.y;f=a.z}function r(b,c,d,e){var f;f=a.length?a.pop():new p;f.init(b,c,d,e);return f}function p(){this.ri=this.id=this.y=this.x=this.Uk=this.Tk=this.Lm=this.time=this.Hn=0;this.yi=this.al=!1}function t(a){return a.sourceCapabilities&&a.sourceCapabilities.firesTouchEvents||a.originalEvent&&a.originalEvent.sourceCapabilities&&a.originalEvent.sourceCapabilities.firesTouchEvents}function v(){}function n(){}var g=Z.prototype;g.W=function(a){this.X=a;this.b=a.b};g.W.prototype.D= +function(){};g.S=function(a){this.type=a;this.b=a.b;this.touches=[];this.Xm=!1};var b=g.S.prototype,d={left:0,top:0};b.lf=function(a){var b,c;b=0;for(c=this.touches.length;bVa(this.Tk,this.Uk,this.x,this.y)&&(this.al=!0,a.Id=this.ri,a.Kf=this.id,a.bg=b,a.b.trigger(Z.prototype.c.pt,a),a.Qd=this.x,a.Rd=this.y,a.b.trigger(Z.prototype.c.qt,a),a.bg=0)};var k=-1E3,e=-1E3,u=-1E4;p.prototype.Bq=function(a,b){if(!this.al){var c=Za();333>=c-this.Hn&&!this.yi&&15>Va(this.Tk,this.Uk,this.x, +this.y)&&(a.Id=this.ri,a.Kf=this.id,a.bg=b,666>=c-u&&25>Va(k,e,this.x,this.y)?(a.b.trigger(Z.prototype.c.lt,a),a.Qd=this.x,a.Rd=this.y,a.b.trigger(Z.prototype.c.mt,a),e=k=-1E3,u=-1E4):(a.b.trigger(Z.prototype.c.Et,a),a.Qd=this.x,a.Rd=this.y,a.b.trigger(Z.prototype.c.Ft,a),k=this.x,e=this.y,u=c),a.bg=0)}};b.D=function(){this.kx=!("undefined"===typeof window.c2isWindows8||!window.c2isWindows8);this.bg=this.Kf=this.Id=this.Rd=this.Qd=this.Ko=this.Jo=this.Io=this.Du=this.Cu=this.Bu=this.vk=this.uk=this.tk= +0;this.Ry=0!==this.A[0];var a=0c-b.time||b.update(c,a.pageX-e.left,a.pageY-e.top,a.width||0,a.height||0,a.pressure||0)}}};b.Qq=function(a){if(a.pointerType!==a.MSPOINTER_TYPE_MOUSE&&"mouse"!==a.pointerType){a.preventDefault&&pb(a)&&a.preventDefault();var b=this.b.pa?d:jQuery(this.b.canvas).offset(),c=a.pageX-b.left,b=a.pageY-b.top;Za();this.Id=this.touches.length; +this.Kf=a.pointerId;this.touches.push(r(c,b,a.pointerId,this.Id));this.b.xc=!0;this.b.trigger(Z.prototype.c.xo,this);this.b.trigger(Z.prototype.c.tl,this);this.Qd=c;this.Rd=b;this.b.trigger(Z.prototype.c.sl,this);this.b.xc=!1}};b.sk=function(b,c){if(b.pointerType!==b.MSPOINTER_TYPE_MOUSE&&"mouse"!==b.pointerType){b.preventDefault&&pb(b)&&b.preventDefault();var d=this.lf(b.pointerId);this.Id=0<=d?this.touches[d].ri:-1;this.Kf=0<=d?this.touches[d].id:-1;this.b.xc=!0;this.b.trigger(Z.prototype.c.wo, +this);this.b.trigger(Z.prototype.c.rl,this);0<=d&&(c||this.touches[d].Bq(this,d),100>a.length&&a.push(this.touches[d]),this.touches.splice(d,1));this.b.xc=!1}};b.Rq=function(a){a.preventDefault&&a.preventDefault();var b=Za(),c,e,f,g;c=0;for(e=a.changedTouches.length;cb-g.time||g.update(b,f.pageX-h.left,f.pageY-h.top,2*(f.Gz||f.Oz||f.zz||f.Cz||0),2*(f.Hz||f.Pz||f.Az||f.Dz|| +0),f.rz||f.Nz||f.yz||f.Bz||0)}};b.Sq=function(a){a.preventDefault&&pb(a)&&a.preventDefault();var b=this.b.pa?d:jQuery(this.b.canvas).offset();Za();this.b.xc=!0;var c,e,f,g;c=0;for(e=a.changedTouches.length;ca.length&&a.push(this.touches[f]),this.touches.splice(f,1));this.b.xc=!1};b.El=function(){return this.b.vc&&0===this.tk&&0!==f?90*f:this.tk}; +b.Vu=function(){return this.b.vc&&0===this.uk&&0!==c?90*c:this.uk};b.xv=function(){return this.b.vc&&0===this.vk&&0!==l?90*l:this.vk};b.Hx=function(a){t(a)||(this.Sq({changedTouches:[{pageX:a.pageX,pageY:a.pageY,identifier:0}]}),this.Xm=!0)};b.Ix=function(a){this.Xm&&!t(a)&&this.Rq({changedTouches:[{pageX:a.pageX,pageY:a.pageY,identifier:0}]})};b.Jx=function(a){a.preventDefault&&this.b.Bp&&!this.b.sf&&a.preventDefault();this.b.Bp=!0;t(a)||(this.cn({changedTouches:[{pageX:a.pageX,pageY:a.pageY,identifier:0}]}), +this.Xm=!1)};b.Jn=function(){var a,b,c,d=Za();a=0;for(b=this.touches.length;ac||c>=this.touches.length)a.n(0);else{var d,e,f,g,h;ha(b)?(d=this.b.ag(0),e=d.scale,f=d.qd,g=d.Pc,h=d.m,d.scale=1,d.qd=1,d.Pc=1,d.m=0,a.n(d.ub(this.touches[c].x,this.touches[c].y,!0)),d.scale=e,d.qd=f,d.Pc=g,d.m=h): +(d=ja(b)?this.b.ag(b):this.b.Sj(b))?a.n(d.ub(this.touches[c].x,this.touches[c].y,!0)):a.n(0)}};n.prototype.Al=function(a,b){var c=this.bg;if(0>c||c>=this.touches.length)a.n(0);else{var d,e,f,g,h;ha(b)?(d=this.b.ag(0),e=d.scale,f=d.qd,g=d.Qc,h=d.m,d.scale=1,d.qd=1,d.Qc=1,d.m=0,a.n(d.ub(this.touches[c].x,this.touches[c].y,!1)),d.scale=e,d.qd=f,d.Qc=g,d.m=h):(d=ja(b)?this.b.ag(b):this.b.Sj(b))?a.n(d.ub(this.touches[c].x,this.touches[c].y,!1)):a.n(0)}};n.prototype.es=function(a,b){var c=this.lf(b);0> +c?a.n(0):a.n(this.touches[c].x)};n.prototype.gs=function(a,b){var c=this.lf(b);0>c?a.n(0):a.n(this.touches[c].y)};n.prototype.vu=function(a){a.n(this.Kf)};g.g=new n})();function Ac(h){this.b=h} +(function(){function h(){}function r(){}function p(){}var t=Ac.prototype;t.W=function(g){this.X=g;this.b=g.b};t.W.prototype.D=function(){};t.S=function(g){this.type=g;this.b=g.b};var v=t.S.prototype,n=window.URL||window.webkitURL||window.mozURL||window.msURL;v.D=function(){if(this.b.pa)fa("[Construct 2] File Chooser plugin not supported on this platform - the object will not be created");else{this.Lb=document.createElement("input");this.Lb.type="file";this.Lb.setAttribute("accept",this.A[0]);0!== +this.A[1]&&this.Lb.setAttribute("multiple","");this.Lb.id=this.A[3];jQuery(this.Lb).appendTo(this.b.nj?this.b.nj:"body");this.ff=!1;0===this.A[2]&&(jQuery(this.Lb).hide(),this.visible=!1,this.ff=!0);var g=this;this.Lb.onchange=function(){g.b.trigger(Ac.prototype.c.oo,g)};this.bq=this.cq=this.Vp=this.Zp=this.aq=this.Xp=0;this.Zr(!0);this.b.If(this)}};v.Ef=function(){this.b.pa||(jQuery(this.Lb).remove(),this.Lb=null)};v.mb=function(){this.Zr()};v.Zr=function(g){if(!this.b.pa){var b=this.j.ib(this.x, +this.y,!0),d=this.j.ib(this.x,this.y,!1),h=this.j.ib(this.x+this.width,this.y+this.height,!0),c=this.j.ib(this.x+this.width,this.y+this.height,!1),f=this.b.width/this.b.devicePixelRatio,a=this.b.height/this.b.devicePixelRatio;!this.visible||!this.j.visible||0>=h||0>=c||b>=f||d>=a?(this.ff||jQuery(this.Lb).hide(),this.ff=!0):(1>b&&(b=1),1>d&&(d=1),h>=f&&(h=f-1),c>=a&&(c=a-1),f=window.innerWidth,a=window.innerHeight,g||this.Xp!==b||this.aq!==d||this.Zp!==h||this.Vp!==c||this.cq!==f||this.bq!==a?(this.Xp= +b,this.aq=d,this.Zp=h,this.Vp=c,this.cq=f,this.bq=a,this.ff&&(jQuery(this.Lb).show(),this.ff=!1),g=Math.round(b)+jQuery(this.b.canvas).offset().left,f=Math.round(d)+jQuery(this.b.canvas).offset().top,jQuery(this.Lb).css("position","absolute"),jQuery(this.Lb).offset({left:g,top:f}),jQuery(this.Lb).width(Math.round(h-b)),jQuery(this.Lb).height(Math.round(c-d))):this.ff&&(jQuery(this.Lb).show(),this.ff=!1))}};v.ed=function(){};v.Kb=function(){};h.prototype.oo=function(){return!0};t.c=new h;r.prototype.ah= +function(g){this.b.pa||(this.visible=0!==g)};t.e=new r;p.prototype.Fs=function(g,b){var d;if(this.b.pa)d=null;else{d=this.Lb.files;var h=b;d?(h=Math.floor(h),d=0>h||h>=d.length?null:d[h]):d=null}d?d.c2url?g.la(d.c2url):n&&n.createObjectURL?(d.c2url=n.createObjectURL(d),g.la(d.c2url)):g.la(""):g.la("")};t.g=new p})();function Bc(h){this.b=h} +(function(){function h(a){var b;if(!c[a])for(c[a]=Array(20),b=0;20>b;++b)c[a][b]=0;return c[a]}function r(a){var b;if(!f[a])for(f[a]=Array(20),b=0;20>b;++b)f[a][b]=0;return f[a]}function p(a,b){return b?4<=a?-1:a+16:16<=a?-1:a}function t(a){l[a.gamepad.index]=a.gamepad;b.trigger(Bc.prototype.c.nt,d)}function v(a){b.trigger(Bc.prototype.c.ot,d);l[a.gamepad.index]=null}function n(){}var g=Bc.prototype;g.W=function(a){this.X=a;this.b=a.b};g.W.prototype.D=function(){};var b=null,d=null,l=Array(16),c= +Array(16),f=Array(16),a="",k="",e=null,u={windows:{}};u.windows.firefox={};var m=[0,1,2,3,4,5,8,9,10,11],q=[0,1,[7,6],2,3,[14,15],[12,13]];u.windows.firefox.xbox360=function(a,b){return b?a>=q.length?-1:ja(q[a])?q[a]+16:q[a]:a>=m.length?-1:m[a]};var w=[2,0,1,3,4,6,5,7,8,9],U=[0,1,2,3,[14,15],[12,13]];u.windows.firefox.logitechdualaction=function(a,b){return b?a>=U.length?-1:ja(U[a])?U[a]+16:U[a]:a>=w.length?-1:w[a]};g.S=function(a){this.type=a;b=this.b=a.b;d=this};var E=g.S.prototype;E.D=function(){this.Wu= +this.A[0];this.ck=0;var b=navigator.userAgent;a="windows";/mac/i.test(b)&&(a="mac");e=u[a];k="chrome";/firefox/i.test(b)&&(k="firefox");e&&(e=e[k]);window.addEventListener("webkitgamepadconnected",t,!1);window.addEventListener("webkitgamepaddisconnected",v,!1);window.addEventListener("MozGamepadConnected",t,!1);window.addEventListener("MozGamepadDisconnected",v,!1);window.addEventListener("gamepadconnected",t,!1);window.addEventListener("gamepaddisconnected",v,!1);this.b.If(this);this.bj=[]};E.mb= +function(){this.bj.length=0;var a=null,b=!1;navigator.getGamepads?a=navigator.getGamepads():navigator.webkitGetGamepads?a=navigator.webkitGetGamepads():navigator.mozGetGamepads?a=navigator.mozGetGamepads():navigator.msGetGamepads?a=navigator.msGetGamepads():this.b.Sp&&window.cr_getGamepads?(a=window.cr_getGamepads(),b=!0):a=navigator.gamepads||navigator.webkitGamepads||navigator.MozGamepads||l;if(a){var d,g,k,n,m,q,t;d=0;for(g=a.length;dm;++m)n[m]=k[m];b?k=p:e?(k="",n=u.id.toLowerCase(),-1q&&(v[q]=100*t,50<=v[q]&&50>w[q]&&(this.ck=q));k=0;for(n=u.axes.length;kq&&(v[q]=100*t):(v[q[0]]=0,v[q[1]]=0,0>=t?v[q[0]]=Math.abs(100* +t):v[q[1]]=Math.abs(100*t));this.bj.push(u)}else u=d,c[u]=null,f[u]=null}for(;20>d;++d)a=d,c[a]=null,f[a]=null}};E.Fb=function(){return{lastButton:this.ck}};E.Qb=function(a){this.ck=a.lastButton};n.prototype.nt=function(){return!0};n.prototype.ot=function(){return!0};n.prototype.Ps=function(a,b){a=Math.floor(a);if(0>a||a>=this.bj.length)return!1;var c=h(a);if(!c)return!1;if(c=50<=c[b])this.ck=b;return c};n.prototype.rs=function(a,b,c,d){a=Math.floor(a);b=Math.floor(b);if(0>a||a>=this.bj.length)return!1; +if(a=h(a)){var e=a[b+16],f=0,f=0===b%2?a[b+16+1]:a[b+16-1];Math.sqrt(e*e+f*f)<=this.Wu&&(e=0);return ic(e,c,d)}};g.c=new n;g.e=new function(){};g.g=new function(){}})();function Cc(h){this.b=h} +(function(){function h(){}function r(){}function p(){}var t=Cc.prototype;t.W=function(h){this.behavior=h;this.b=h.b};t.W.prototype.D=function(){};t.S=function(h,g){this.type=h;this.behavior=h.behavior;this.Na=g;this.b=h.b;this.ve=this.yb=this.xb=0};var v=t.S.prototype;v.D=function(){this.Og=this.A[0];this.qn=this.A[1];this.enabled=0!==this.A[2]};v.Fb=function(){return{dx:this.xb,dy:this.yb,cancelStep:this.ve,enabled:this.enabled,stepMode:this.Og,pxPerStep:this.qn}};v.Qb=function(h){this.xb=h.dx;this.yb= +h.dy;this.ve=h.cancelStep;this.enabled=h.enabled;this.Og=h.stepMode;this.qn=h.pxPerStep};v.zp=function(){return Math.sqrt(this.xb*this.xb+this.yb*this.yb)};v.gb=function(){return Math.atan2(this.yb,this.xb)};v.step=function(h,g,b){if(0!==h||0!==g){var d=this.Na.x,l=this.Na.y,c,f=Math.round(Math.sqrt(h*h+g*g)/this.qn);0===f&&(f=1);var a;for(a=1;a<=f;a++)if(c=a/f,this.Na.x=d+h*c,this.Na.y=l+g*c,this.Na.za(),this.b.trigger(b,this.Na),1===this.ve){a--;c=a/f;this.Na.x=d+h*c;this.Na.y=l+g*c;this.Na.za(); +break}else if(2===this.ve)break}};v.mb=function(){var h=this.b.Rj(this.Na),g=this.xb*h,h=this.yb*h;0===this.xb&&0===this.yb||!this.enabled||(this.ve=0,0===this.Og?(this.Na.x+=g,this.Na.y+=h):1===this.Og?this.step(g,h,Cc.prototype.c.jt):2===this.Og?(this.step(g,0,Cc.prototype.c.ol),this.ve=0,this.step(0,h,Cc.prototype.c.pl)):3===this.Og&&(this.step(0,h,Cc.prototype.c.pl),this.ve=0,this.step(g,0,Cc.prototype.c.ol)),this.Na.za())};h.prototype.Us=function(){return 0!=this.xb||0!=this.yb};h.prototype.vs= +function(h,g,b){var d;switch(h){case 0:d=this.zp();break;case 1:d=this.xb;break;case 2:d=this.yb}return ic(d,g,b)};h.prototype.jt=function(){return!0};h.prototype.ol=function(){return!0};h.prototype.pl=function(){return!0};t.c=new h;r.prototype.Fo=function(){this.yb=this.xb=0};r.prototype.iu=function(h,g){var b;switch(h){case 0:b=this.gb();this.xb=Math.cos(b)*g;this.yb=Math.sin(b)*g;break;case 1:this.xb=g;break;case 2:this.yb=g}};r.prototype.hs=function(h,g){var b=h*this.b.Rj(this.Na),d=G(g);this.xb+= +Math.cos(d)*b;this.yb+=Math.sin(d)*b};r.prototype.Xt=function(h){h=G(h);var g=this.zp();this.xb=Math.cos(h)*g;this.yb=Math.sin(h)*g};r.prototype.su=function(h){this.ve=h+1};r.prototype.xl=function(h){this.enabled=1===h};t.e=new r;p.prototype.xb=function(h){h.n(this.xb)};p.prototype.yb=function(h){h.n(this.yb)};t.g=new p})();function Ic(h){this.b=h} +(function(){function h(){}var r=Ic.prototype;r.W=function(h){this.behavior=h;this.b=h.b};r.W.prototype.D=function(){};r.S=function(h,p){this.type=h;this.behavior=h.behavior;this.Na=p;this.b=h.b};var p=r.S.prototype;p.D=function(){this.Na.ja.jumpthruEnabled=0!==this.A[0]};p.mb=function(){};r.c=new function(){};h.prototype.xl=function(h){this.Na.ja.jumpthruEnabled=!!h};r.e=new h})();function Jc(h){this.b=h} +(function(){function h(){}var r=Jc.prototype;r.W=function(h){this.behavior=h;this.b=h.b};r.W.prototype.D=function(){};r.S=function(h,p){this.type=h;this.behavior=h.behavior;this.Na=p;this.b=h.b};var p=r.S.prototype;p.D=function(){this.Na.ja.solidEnabled=0!==this.A[0]};p.mb=function(){};r.c=new function(){};h.prototype.xl=function(h){this.Na.ja.solidEnabled=!!h};r.e=new h})(); +function rc(){return[Y,tc,uc,vc,X,wc,Ac,sc,xc,Bc,zc,V,yc,Z,Jc,Ic,Cc,T.prototype.c.to,uc.prototype.e.$g,uc.prototype.e.Pt,sc.prototype.e.CallFunction,T.prototype.e.lu,T.prototype.e.du,V.prototype.e.Yt,yc.prototype.c.Mi,yc.prototype.e.ju,T.prototype.g.Py,T.prototype.c.ws,vc.prototype.e.Ot,vc.prototype.e.Play,V.prototype.e.Yi,T.prototype.e.As,yc.prototype.e.Yi,yc.prototype.e.Zi,yc.prototype.e.Xi,sc.prototype.c.Ui,yc.prototype.e.Yg,T.prototype.c.Ds,sc.prototype.g.Gt,T.prototype.c.qs,wc.prototype.g.$s, +uc.prototype.g.bh,T.prototype.c.Cs,T.prototype.c.ho,V.prototype.c.Mi,T.prototype.e.wu,V.prototype.e.Yg,V.prototype.e.Pf,wc.prototype.g.Is,Cc.prototype.e.xl,Cc.prototype.e.iu,V.prototype.g.zs,V.prototype.e.jl,T.prototype.g.Yo,vc.prototype.e.eu,vc.prototype.e.Fo,Y.prototype.e.Yg,V.prototype.e.ah,Y.prototype.e.Yi,vc.prototype.c.Ys,Y.prototype.g.Zn,Y.prototype.g.ao,Y.prototype.g.$n,Y.prototype.g.Yn,vc.prototype.e.qu,T.prototype.e.Js,vc.prototype.e.Mt,sc.prototype.c.ts,vc.prototype.e.fu,T.prototype.g["float"], +T.prototype.g["int"],Y.prototype.e.ah,T.prototype.c.Rs,yc.prototype.e.$g,yc.prototype.e.yl,T.prototype.c.Hs,V.prototype.g.aj,V.prototype.g.Al,V.prototype.e.ul,uc.prototype.c.Ni,V.prototype.e.gt,T.prototype.g.floor,T.prototype.g.random,V.prototype.e.ru,T.prototype.g.cos,T.prototype.g.De,V.prototype.c.Ni,yc.prototype.e.wl,V.prototype.e.pu,V.prototype.e.yl,V.prototype.e.$i,V.prototype.e.Zi,V.prototype.g.bh,V.prototype.e.Do,V.prototype.g.Opacity,V.prototype.c.eo,V.prototype.c.mo,yc.prototype.e.ul,uc.prototype.c.us, +uc.prototype.e.Nt,T.prototype.c.Gs,T.prototype.g.min,T.prototype.g.vx,uc.prototype.g.ms,uc.prototype.c.xs,T.prototype.e.ks,T.prototype.g.Bx,uc.prototype.e.Bs,uc.prototype.g.ns,T.prototype.c.Ht,V.prototype.e.Eo,Y.prototype.e.Pf,Y.prototype.e.$i,Y.prototype.e.Zi,Y.prototype.e.ul,Cc.prototype.e.Xt,Y.prototype.e.et,Y.prototype.g.bh,Y.prototype.e.Ho,T.prototype.g.sin,Y.prototype.g.aj,Y.prototype.g.Al,Y.prototype.c.ml,Y.prototype.c.Mi,T.prototype.c.It,V.prototype.e.Co,V.prototype.e.wl,V.prototype.g.ls, +sc.prototype.e.hu,V.prototype.c.Ws,V.prototype.c.kl,Y.prototype.c.fo,Cc.prototype.g.yb,V.prototype.g.Yn,V.prototype.g.ao,sc.prototype.g.bo,Cc.prototype.g.xb,Cc.prototype.c.ol,V.prototype.c.ml,T.prototype.g.abs,T.prototype.e.tu,Cc.prototype.c.vs,Cc.prototype.e.su,Cc.prototype.c.pl,Y.prototype.e.Xi,T.prototype.g.Sx,Y.prototype.c.Ni,T.prototype.g.qx,T.prototype.g.ox,Y.prototype.g.Oi,Y.prototype.e.$g,Y.prototype.g.Go,Y.prototype.c.Bo,Y.prototype.e.zl,T.prototype.c.kl,T.prototype.g.m,Y.prototype.c.ko, +zc.prototype.e.Ho,zc.prototype.e.Yi,V.prototype.c.fo,V.prototype.g.jo,V.prototype.e.Xi,V.prototype.g.io,V.prototype.e.zl,zc.prototype.e.ah,V.prototype.c.ss,V.prototype.c.ko,zc.prototype.c.lo,zc.prototype.e.jl,zc.prototype.c.Mi,V.prototype.g.Oi,zc.prototype.e.Do,zc.prototype.c.eo,zc.prototype.e.Xi,zc.prototype.e.Pf,zc.prototype.e.$i,zc.prototype.e.Co,zc.prototype.e.Zi,zc.prototype.g.Opacity,V.prototype.g.$n,V.prototype.g.Zn,V.prototype.c.Vs,T.prototype.c.Jt,zc.prototype.e.gu,zc.prototype.e.$g,V.prototype.c.Ns, +V.prototype.e.Zt,V.prototype.g.Ls,V.prototype.g.Ms,V.prototype.c.lo,V.prototype.g.ct,T.prototype.g.time,Y.prototype.c.Jd,Y.prototype.e.bu,Y.prototype.e.wl,V.prototype.c.Bo,V.prototype.g.Go,V.prototype.g.Lt,Cc.prototype.c.Us,V.prototype.e.ft,zc.prototype.e.Yg,V.prototype.e.nu,Cc.prototype.e.hs,zc.prototype.e.Eo,zc.prototype.g.Oi,zc.prototype.g.bh,T.prototype.g.ceil,zc.prototype.g.aj,T.prototype.g.Wy,T.prototype.g.Qx,T.prototype.g.Px,T.prototype.e.Ut,T.prototype.e.Vt,T.prototype.e.Wt,T.prototype.c.so, +T.prototype.c.Xs,Bc.prototype.c.rs,Bc.prototype.c.Ps,xc.prototype.c.Ss,T.prototype.c.Ts,Z.prototype.c.tl,X.prototype.e.Tt,Z.prototype.g.es,Z.prototype.g.vu,Z.prototype.g.gs,T.prototype.g.Ou,T.prototype.g.Pu,T.prototype.c.Kt,Z.prototype.c.sl,Z.prototype.c.rl,wc.prototype.e.co,wc.prototype.e.js,T.prototype.g.Ly,T.prototype.g.Ky,T.prototype.g.left,T.prototype.g.zx,T.prototype.c.xu,T.prototype.c.Rt,wc.prototype.c.Ks,T.prototype.e.ku,yc.prototype.c.Jd,yc.prototype.e.au,yc.prototype.e.jl,T.prototype.g.rx, +yc.prototype.e.zl,yc.prototype.c.ml,yc.prototype.c.po,yc.prototype.e.Pf,yc.prototype.e.$i,V.prototype.c.Jd,uc.prototype.c.nl,uc.prototype.e.mu,wc.prototype.c.nl,tc.prototype.e.St,tc.prototype.c.Zg,tc.prototype.g.bt,yc.prototype.e.ah,X.prototype.c.Ao,X.prototype.e.ys,X.prototype.c.Wi,yc.prototype.e.cu,Ac.prototype.e.Yg,X.prototype.e.Es,Ac.prototype.c.oo,Ac.prototype.g.Fs,X.prototype.g.Qt,uc.prototype.e.Pf,T.prototype.g.Vw,T.prototype.g.Yu,T.prototype.g.Rg]}; diff --git a/badtimesimulator/data.js b/badtimesimulator/data.js new file mode 100644 index 00000000..a444c596 --- /dev/null +++ b/badtimesimulator/data.js @@ -0,0 +1 @@ +{"project": [null,"MainMenu",[[0,false,true,true,true,false,true,true,true,true],[1,true,false,false,false,false,false,false,false,false],[2,false,false,false,false,false,false,false,false,false],[3,true,false,false,false,false,false,false,false,false],[4,true,false,false,false,false,false,false,false,false],[5,false,false,false,false,false,false,false,false,false],[6,false,true,true,true,false,false,false,false,false],[7,true,false,false,false,false,false,false,false,false],[8,true,false,false,false,false,false,false,false,false],[9,true,false,false,false,false,false,false,false,false],[10,false,true,true,true,true,true,true,true,true],[11,false,true,true,true,true,true,true,true,false],[12,false,true,true,true,true,true,true,true,true],[13,true,false,false,false,false,false,false,false,false]],[["t0",9,false,[],0,0,null,null,[],false,false,2737066360312475,[],null,[25]],["t1",8,false,[],0,0,null,null,[],false,false,7004831969366137,[],null,[]],["t2",11,false,[5138796745891601,8231789435471491,1260937868110365,6641724638316461,5899272596289875,4616881591755484,2168213636508799,1622459949020876,3653498277383987,1053485227981488,1751951803115606,3632648287625289,1077614757894582,9025045177578852],0,0,null,[["Default",5,false,1,0,false,6541956784524688,[["images/vpad-sheet0.png",1473,0,0,32,32,1,0,0,[],[],0]]]],[],false,false,9768267065126338,[],null],["t3",7,false,[],0,0,null,null,[],false,false,7786981344801906,[],null,[]],["t4",1,false,[],0,0,null,null,[],false,false,1871150019731238,[],null,[]],["t5",3,false,[],0,0,null,null,[],false,false,130305442643432,[],null,[0,0,0,1,1,600,600,10000,1]],["t6",13,false,[],0,0,null,null,[],false,false,833371787328053,[],null,[1]],["t7",10,false,[],0,0,["images/hpbackground.png",92,1],null,[],false,false,8009642851719156,[],null],["t8",10,false,[],0,0,["images/hpbar.png",92,4],null,[],false,false,5315983389834433,[],null],["t9",10,false,[],0,0,["images/krbar.png",92,4],null,[],false,false,8840599197819951,[],null],["t10",11,false,[3161584809306413,5414051533652294],0,0,null,[["Default",5,false,1,0,false,7839461660390996,[["images/uiact-sheet0.png",339,1,1,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]],["Highlight",5,false,1,0,false,5181432374441549,[["images/uiact-sheet0.png",339,1,45,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]]],[],false,false,9683599283524679,[],null],["t11",11,false,[3161584809306413,5414051533652294],0,0,null,[["Default",5,false,1,0,false,2415236592226629,[["images/uifight-sheet0.png",394,1,1,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]],["Highlight",5,false,1,0,false,5506998997872373,[["images/uifight-sheet0.png",394,1,45,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]]],[],false,false,9343233059165768,[],null],["t12",11,false,[3161584809306413,5414051533652294],0,0,null,[["Default",5,false,1,0,false,4560456212490265,[["images/uiitem-sheet0.png",398,1,1,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]],["Highlight",5,false,1,0,false,7286896709592169,[["images/uiitem-sheet0.png",398,1,45,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]]],[],false,false,9790445263738264,[],null],["t13",11,false,[3161584809306413,5414051533652294],0,0,null,[["Default",5,false,1,0,false,5127942938396299,[["images/uimercy-sheet0.png",463,1,1,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]],["Highlight",5,false,1,0,false,4270938902148832,[["images/uimercy-sheet0.png",463,1,45,110,42,1,0,0,[["Heart",0.145454540848732,0.5]],[],0]]]],[],false,false,3900276529955833,[],null],["t14",0,false,[6021697186517032,7358547809624895,1387227575863189,9275911755738286,9266371524172021],0,0,["images/combatzone.png",117,3],null,[],false,false,141231765387603,[],null],["t15",10,false,[],1,0,["images/combatzoneborder.png",92,4],null,[["Solid",14,986637488598136]],false,false,6657741784745805,[],null],["t16",10,false,[],0,0,["images/combatzoneclipper.png",105,3],null,[],false,false,2903163662070948,[],null],["t17",11,false,[5475329447475825],0,0,null,[["Default",5,false,1,0,false,698907272053593,[["images/target-sheet0.png",1871,0,0,548,117,1,0.5,0.504273533821106,[],[-0.430656909942627,-0.1794875264167786,0,-0.4957265257835388,0.4306570291519165,-0.1794875264167786,0.4981750249862671,-0.008547544479370117,0.4288319945335388,0.1623934507369995,0,0.4786324501037598,-0.4288321137428284,0.1623934507369995,-0.498175173997879,-0.008547544479370117],0]]]],[],false,false,4243712716812677,[],null],["t18",11,false,[],0,0,null,[["Default",5,false,1,0,false,8343756916975768,[["images/hp-sheet0.png",126,0,0,23,10,1,0,1,[],[0,-1,0.9565219879150391,-0.8999999761581421,0.9565219879150391,-0.5,0.8260869979858398,-0.3999999761581421,0,0],3]]]],[],false,false,1931015301211759,[],null],["t19",11,false,[],0,0,null,[["Default",5,false,1,0,false,4658499880468184,[["images/kr-sheet0.png",117,0,0,23,10,1,1,1,[],[],4]]]],[],false,false,2609083740733856,[],null],["t20",11,false,[6124536967285148],0,0,null,[["Default",30,true,1,0,false,6300494068884098,[["images/targetchoice-sheet0.png",388,1,1,14,128,3,0.5,0.5,[],[],0],["images/targetchoice-sheet0.png",388,17,1,14,128,2,0.5,0.5,[],[],0]]]],[],false,false,260070398441684,[],null],["t21",11,false,[],0,0,null,[["Default",10,false,1,0,false,942583768887371,[["images/strike-sheet0.png",249,57,1,4,6,1,-1,5.666666507720947,[],[1.5,-5.666666507720947,2,-5.666666507720947,1.5,-5.166666507720947,1.5,-4.999999523162842,1.5,-5.333333492279053,1,-4.666666507720947,1,-5.166666507720947],0],["images/strike-sheet0.png",249,51,1,4,22,1,-0.5,1.363636374473572,[],[],0],["images/strike-sheet0.png",249,27,1,6,42,1,0,0.4285714328289032,[],[],0],["images/strike-sheet0.png",249,1,1,8,64,1,0,0.15625,[],[],0],["images/strike-sheet0.png",249,11,1,14,32,1,0,-0.75,[],[],0],["images/strike-sheet0.png",249,35,1,14,12,1,-0.1428571492433548,-4,[],[],0]]]],[],false,false,1284677255483501,[],null],["t22",10,false,[],0,0,["images/combatzoneunclipper.png",92,4],null,[],false,false,2731133994133496,[],null],["t23",11,false,[1558614189746918,4074126684641977,8283317758694072],0,0,null,[["Default",5,false,1,0,false,2276838282479599,[["images/sanshead-sheet0.png",537,1,1,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["LookLeft",5,false,1,0,false,4388466239935075,[["images/sanshead-sheet0.png",537,35,1,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["Wink",5,false,1,0,false,6457042623121455,[["images/sanshead-sheet0.png",537,69,1,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["ClosedEyes",5,false,1,0,false,8089043188246127,[["images/sanshead-sheet0.png",537,1,33,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["NoEyes",5,false,1,0,false,2373656401037775,[["images/sanshead-sheet0.png",537,35,33,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["BlueEye",5,false,1,0,false,4492125680738175,[["images/sanshead-sheet0.png",537,69,33,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0],["images/sanshead-sheet0.png",537,1,65,32,30,1,0.5,1,[["Sweat",0.5,0]],[],0]]],["Tired1",5,false,1,0,false,9055351961421601,[["images/sanshead-sheet0.png",537,35,65,32,30,1,0.5,1,[["Sweat",0.5,0]],[-0.375,-0.8666670322418213,0,-1,0.375,-0.8666670322418213,0.46875,-0.5,0.375,-0.1333330273628235,0,0,-0.375,-0.1333330273628235,-0.46875,-0.5],0]]],["Tired2",5,false,1,0,false,3836599280297155,[["images/sanshead-sheet0.png",537,69,65,32,30,1,0.5,1,[["Sweat",0.5,0]],[-0.375,-0.8666670322418213,0,-1,0.375,-0.8666670322418213,0.46875,-0.5,0.375,-0.1333330273628235,0,0,-0.375,-0.1333330273628235,-0.46875,-0.5],0]]]],[],false,false,2086066613273419,[],null],["t24",11,false,[],0,0,null,[["HandDown",15,false,1,0,false,6043785673298376,[["images/sansbody-sheet0.png",1952,99,101,64,70,1,0.46875,1,[["Head",0.46875,0.4000000059604645]],[],3],["images/sansbody-sheet0.png",1952,165,101,64,70,1,0.46875,1,[["Head",0.46875,0.3857142925262451]],[],3],["images/sansbody-sheet0.png",1952,1,151,64,70,1,0.46875,1,[["Head",0.46875,0.4285714328289032]],[-0.46875,-1,0.515625,-1,0.515625,0,-0.46875,0],3],["images/sansbody-sheet0.png",1952,67,173,64,70,1,0.46875,1,[["Head",0.46875,0.4428571462631226]],[],3]]],["HandUp",15,false,1,0,false,6693843986666905,[["images/sansbody-sheet0.png",1952,133,173,64,70,1,0.46875,1,[["Head",0.46875,0.4285714328289032]],[],3],["images/sansbody-sheet0.png",1952,67,173,64,70,1,0.46875,1,[["Head",0.46875,0.4428571462631226]],[],3],["images/sansbody-sheet1.png",446,0,0,64,70,1,0.46875,1,[["Head",0.46875,0.4000000059604645]],[],3],["images/sansbody-sheet0.png",1952,165,101,64,70,1,0.46875,1,[["Head",0.46875,0.3857142925262451]],[],3],["images/sansbody-sheet0.png",1952,99,101,64,70,1,0.46875,1,[["Head",0.46875,0.4000000059604645]],[],3]]],["HandRight",15,false,1,0,false,2519219101455278,[["images/sansbody-sheet0.png",1952,1,1,96,48,1,0.34375,1,[["Head",0.34375,0.125]],[],3],["images/sansbody-sheet0.png",1952,99,1,96,48,1,0.34375,1,[["Head",0.3229166567325592,0.125]],[],3],["images/sansbody-sheet0.png",1952,1,51,96,48,1,0.34375,1,[["Head",0.3125,0.125]],[],3],["images/sansbody-sheet0.png",1952,99,51,96,48,1,0.34375,1,[["Head",0.375,0.125]],[],3],["images/sansbody-sheet0.png",1952,1,101,96,48,1,0.34375,1,[["Head",0.3541666567325592,0.125]],[],3]]],["HandLeft",15,false,1,0,false,1931647922176485,[["images/sansbody-sheet0.png",1952,1,101,96,48,1,0.34375,1,[["Head",0.3541666567325592,0.125]],[],3],["images/sansbody-sheet0.png",1952,99,51,96,48,1,0.34375,1,[["Head",0.375,0.125]],[],3],["images/sansbody-sheet0.png",1952,1,51,96,48,1,0.34375,1,[["Head",0.3125,0.125]],[],3],["images/sansbody-sheet0.png",1952,99,1,96,48,1,0.34375,1,[["Head",0.3229166567325592,0.125]],[],3],["images/sansbody-sheet0.png",1952,1,1,96,48,1,0.34375,1,[["Head",0.34375,0.125]],[],3]]]],[],false,false,6007327897630886,[],null],["t25",11,false,[2281878023018379,900119164280441,5098251647105319,3509506029893432,7696753463127348,4058871107931012],0,0,null,[["Standing",5,false,1,0,false,5481948914165362,[["images/sanslegs-sheet0.png",343,1,1,44,23,1,0.4772727191448212,1,[["Torso",0.4772727191448212,0]],[],3]]],["Sitting",5,false,1,0,false,6382436399145165,[["images/sanslegs-sheet0.png",343,1,26,52,17,1,0.4807692170143127,0.8823529481887817,[["Torso",0.4807692170143127,0.05882352963089943]],[],3]]]],[],false,false,9590658027348857,[],null],["t26",11,false,[],0,0,null,[["Sweat1",5,false,1,0,false,7107173151154428,[["images/sanssweat-sheet0.png",189,1,1,32,9,1,0.5,0,[],[],3]]],["Sweat2",5,false,1,0,false,2389381723178476,[["images/sanssweat-sheet0.png",189,1,12,32,9,1,0.5,0,[],[],3]]],["Sweat3",5,false,1,0,false,2164871598142847,[["images/sanssweat-sheet0.png",189,1,23,32,9,1,0.5,0,[],[],3]]]],[],false,false,4934231145646729,[],null],["t27",11,false,[3683915590450527,7388070819070914,6179632542687228],0,0,null,[["Default",5,false,1,0,false,1874766620274337,[["images/sanstorso-sheet0.png",521,1,27,54,25,1,0.5,1,[["Head",0.5,0.239999994635582]],[],3]]],["Shrug",5,false,1,0,false,1031353307450106,[["images/sanstorso-sheet0.png",521,1,1,72,24,1,0.5,1,[["Head",0.5,0.2083333283662796]],[-0.5,-1,0,-0.8333330154418945,0.5,-1,0.4861109852790833,-0.04166698455810547,-0.4861111044883728,-0.04166698455810547],3]]]],[],false,false,6308750117528714,[],null],["t28",11,false,[],0,0,null,[["Default",5,false,1,0,false,4563758704400881,[["images/speechbubble-sheet0.png",612,1,1,237,104,1,0,0,[],[0.1054849997162819,0.2403849959373474,0.4978899955749512,0,0.9704639911651611,0.06730770319700241,1,0.5,0.9746840000152588,0.9423080086708069,0.4978899955749512,1,0.1054849997162819,0.7596150040626526],3]]],["NoEffects",5,false,1,0,false,4566612407065255,[["images/speechbubble-sheet0.png",612,1,107,237,104,1,0,0,[],[0.1054849997162819,0.2403849959373474,0.4978899955749512,0,0.9704639911651611,0.06730770319700241,1,0.5,0.9746840000152588,0.9423080086708069,0.4978899955749512,1,0.1054849997162819,0.7596150040626526],3]]]],[],false,false,4418147656760408,[],null],["t29",0,false,[2353520185577067,8541710245044527,6677681737098705,6030229564139285,821640292253391],0,0,["images/boneh.png",129,3],null,[],false,false,3019589746608161,[],null],["t30",0,false,[2353520185577067,8541710245044527,6677681737098705,6030229564139285,821640292253391],0,0,["images/bonev.png",130,3],null,[],false,false,3868174782291034,[],null],["t31",10,false,[9838422767648153,3111458825166214,4499117244240895,3652599263413905],0,0,["images/combatzoneunclipper.png",92,4],null,[],false,false,9836012384209519,[],null],["t32",11,false,[1009715326578042,1305040970412396,3339694860544266,5496271542375511,6947181727264729,9692461505937431,8667025344021268,4004809633270347,1374973730100997],0,0,null,[["Default",5,false,1,0,false,140797437682819,[["images/gasterblaster-sheet0.png",635,1,1,57,44,1,0.4912280738353729,0.5,[],[-0.4912280738353729,0.4772729873657227,-0.4912280738353729,-0.4772726893424988,0.5087718963623047,-0.4772726893424988,0.5087718963623047,0.4772729873657227],3]]],["Fire",30,true,1,3,false,4589316365590618,[["images/gasterblaster-sheet0.png",635,60,1,57,44,1,0.5087719559669495,0.5,[],[-0.5087719559669495,0.5,-0.5087719559669495,-0.4090909063816071,0.4912280440330505,-0.4090909063816071,0.4912280440330505,0.5],3],["images/gasterblaster-sheet0.png",635,1,47,57,44,1,0.5087719559669495,0.5,[],[-0.5087719559669495,0.5,-0.5087719559669495,-0.4090909063816071,0.4912280440330505,-0.4090909063816071,0.4912280440330505,0.5],3],["images/gasterblaster-sheet0.png",635,60,47,57,44,1,0.5087719559669495,0.5,[],[-0.5087719559669495,0.5,-0.5087719559669495,-0.4772726893424988,0.4912280440330505,-0.4772726893424988,0.4912280440330505,0.5],3],["images/gasterblaster-sheet1.png",457,1,1,57,44,1,0.5087719559669495,0.5,[],[-0.5087719559669495,0.5,-0.5087719559669495,-0.5,0.4912280440330505,-0.5,0.4912280440330505,0.5],3],["images/gasterblaster-sheet1.png",457,60,1,57,44,1,0.5087719559669495,0.5,[],[-0.5087719559669495,0.5,-0.5087719559669495,-0.5,0.4912280440330505,-0.5,0.4912280440330505,0.5],3]]]],[],false,false,7974524067202295,[],null],["t33",0,false,[6677681737098705,6030229564139285,821640292253391,4182532409429375,9338468636982498,1757310495919901],2,0,["images/platform1.png",114,3],null,[["Jumpthru",15,2517055594929798],["CustomMovement",16,8396425350937595]],false,false,1226268899238104,[],null],["t34",0,false,[6677681737098705,6030229564139285,821640292253391],0,0,["images/platform2.png",114,0],null,[],false,false,6981383464931416,[],null],["t35",0,false,[9712410343672045,1340413306933887,7626491151499593,4662037835176925,4383237448031349,510004270528703,6677681737098705,6030229564139285,821640292253391],0,0,["images/bonestabv.png",134,3],null,[],false,false,8140934880742138,[],null],["t36",0,false,[9712410343672045,1340413306933887,7626491151499593,4662037835176925,4383237448031349,510004270528703,6677681737098705,6030229564139285,821640292253391],0,0,["images/bonestabh.png",131,3],null,[],false,false,6503092777075739,[],null],["t37",0,false,[6677681737098705,6030229564139285,821640292253391,1708321725631724,1065051569636671,4829472285865959,8313946059993536],0,0,["images/bonestabwarn.png",113,3],null,[],false,false,4163262150020477,[],null],["t38",11,false,[1009715326578042,1305040970412396,992680048340304,5567578753522818],0,0,null,[["Default",5,false,1,0,false,4025981469830428,[["images/menubonebottom-sheet0.png",159,0,0,14,44,1,0,0,[],[0.1428570002317429,0.04545449838042259,0.857142984867096,0.04545449838042259,0.857142984867096,0.9545450210571289,0.1428570002317429,0.9545450210571289],3]]]],[],false,false,761861833921609,[],null],["t39",11,false,[1009715326578042,1305040970412396,7519107776133302,6433670307252687],0,0,null,[["Default",5,false,1,0,false,1189648859175843,[["images/menubonebottom-sheet0.png",159,0,0,14,44,1,0,0,[],[0.1428570002317429,0.04545449838042259,0.857142984867096,0.04545449838042259,0.857142984867096,0.9545450210571289,0.1428570002317429,0.9545450210571289],3]]]],[],false,false,5246535965326995,[],null],["t40",10,false,[],0,0,["images/combatzoneunclipper.png",92,4],null,[],false,false,336730486351203,[],null],["t41",10,false,[],0,0,["images/combatzoneunclipper.png",92,4],null,[],false,false,508841962091807,[],null],["t42",10,false,[5846064141855004,4419610502870706],0,0,["images/gasterblasthit.png",92,4],null,[],false,false,165116925986465,[],null],["t43",2,false,[],0,0,null,null,[],true,false,456555951765879,[],null],["t44",2,false,[],0,0,null,null,[],true,false,3081225054711249,[],null],["t45",5,false,[],0,0,null,null,[],true,false,7317040439391986,[],null],["t46",5,false,[],0,0,null,null,[],true,false,281757033099861,[],null],["t47",12,false,[8126938230629388,7739643538975967,4090187800761089,8768540262486332,2703717793020135,8429195992300595,9067313364631326,4487571781562274],0,0,["images/battlefont.png",351,3],null,[],false,false,6163397057824361,[],null],["t48",12,false,[8126938230629388,7739643538975967,4090187800761089,8768540262486332,2703717793020135,8429195992300595,9067313364631326,4487571781562274],0,0,["images/sansfont.png",1141,3],null,[],false,false,5575857119740264,[],null],["t49",12,false,[8126938230629388,7739643538975967,4090187800761089,8768540262486332,2703717793020135,8429195992300595,9067313364631326,4487571781562274],0,0,["images/defaultfont.png",782,3],null,[],false,false,1422059525027614,[],null],["t50",12,false,[8126938230629388,7739643538975967,4090187800761089,8768540262486332,2703717793020135,8429195992300595,9067313364631326,4487571781562274],0,0,["images/damagefont.png",1594,3],null,[],false,false,501546311307215,[],null],["t51",11,false,[636958093485166,875789127674825],0,0,null,[["Default",5,false,1,0,false,688431823067020,[["images/toucha-sheet0.png",237,0,0,48,48,1,0.5,0.5,[],[],0]]],["Pressed",5,false,1,0,false,174733332464142,[["images/toucha-sheet1.png",237,0,0,48,48,1,0.5,0.5,[],[],0]]]],[],false,false,117524411669736,[],null],["t52",11,false,[636958093485166,875789127674825],0,0,null,[["Default",5,false,1,0,false,873294262795378,[["images/touchb-sheet0.png",241,0,0,48,48,1,0.5,0.5,[],[],0]]],["Pressed",5,false,1,0,false,642935057171834,[["images/touchb-sheet1.png",241,0,0,48,48,1,0.5,0.5,[],[],0]]]],[],false,false,428292736598660,[],null],["t53",11,false,[310120484498810],0,0,null,[["Default",5,false,1,0,false,539337012850933,[["images/touchdpad-sheet0.png",210,0,0,48,48,1,0.5,0.5,[],[],0]]]],[],false,false,293725615020106,[],null],["t54",11,false,[6313592074891908,4448468745440906,122041775148508],1,1,null,[["Default",5,false,1,0,false,3948179004351251,[["images/playerheart-sheet1.png",132,0,0,16,16,1,0.5,0.5,[],[-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5],3]]],["Split",5,false,1,0,false,9412816471889478,[["images/playerheart-sheet0.png",141,0,0,16,20,1,0.5,0.5,[],[0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5],3]]]],[["CustomMovement",16,8958058217944609]],false,false,5960708907117077,[["tint","Tint"]],null],["t55",5,false,[],0,0,null,null,[],true,false,7966075756587832,[],null],["t56",11,false,[3974683574216717,9053166434256353,8424291498582479,3202944525291714,1711039613963512],0,0,null,[["Default",5,false,1,0,false,155770205370032,[["images/menuitem-sheet0.png",530,0,0,16,16,1,0,0,[],[],0]]]],[],false,false,1630849692866887,[],null],["t57",2,false,[],0,0,null,null,[],true,false,2840436798779952,[],null],["t58",2,false,[],0,0,null,null,[],true,false,799284438884525,[],null],["t59",11,false,[],1,0,null,[["Default",15,true,1,0,false,1279672314658953,[["images/heartshard-sheet0.png",125,0,0,16,16,1,0.5,0.5,[],[-0.1875,-0.1875,0,-0.125,0.125,-0.0625,0.1874999403953552,0,0.25,0.1874999403953552,0,0.125,-0.125,0],3],["images/heartshard-sheet1.png",123,0,0,16,16,1,0.5,0.5,[],[-0.125,-0.0625,0,-0.125,0.125,-0.0625,0.1874999403953552,0,0.125,0.125,0,0.1874999403953552,-0.125,0.125,-0.1875,0],3],["images/heartshard-sheet2.png",128,0,0,16,16,1,0.5,0.5,[],[-0.1875,-0.25,0.25,-0.25,0.25,0.25,-0.1875,0.25],3],["images/heartshard-sheet1.png",123,0,0,16,16,1,0.5,0.5,[],[-0.1875,-0.125,0.1874999403953552,-0.125,0.1874999403953552,0.1874999403953552,-0.1875,0.1874999403953552],3]]]],[["CustomMovement",16,7822586923915929]],false,false,4095409948730649,[],null],["t60",2,false,[],0,0,null,null,[],true,false,6354874427432412,[],null],["t61",2,false,[],0,0,null,null,[],true,false,1417790766954608,[],null],["t62",6,false,[],0,0,null,null,[],false,false,8898820624476746,[],null],["t63",4,false,[],0,0,null,null,[],false,false,4029960250195912,[],null,[]],["t64",11,false,[],0,0,null,[["Default",5,false,1,0,false,405047860068601,[["images/playerhitbox-sheet0.png",92,0,0,4,4,1,0.5,0.5,[],[],4]]]],[],false,false,728293317807613,[],null],["t65",0,true,[9712410343672045,1340413306933887,7626491151499593,4662037835176925,4383237448031349,510004270528703],0,0,null,null,[],false,false,9321183475132962,[],null],["t66",0,true,[2353520185577067,8541710245044527],0,0,null,null,[],false,false,2013892859044994,[],null],["t67",12,true,[8126938230629388,7739643538975967,4090187800761089,8768540262486332,2703717793020135,8429195992300595,9067313364631326,4487571781562274],0,1,null,null,[],false,false,8627438680975019,[["tint","Tint"]],null],["t68",11,true,[3161584809306413,5414051533652294],0,0,null,null,[],false,false,9802428034038081,[],null],["t69",0,true,[6677681737098705,6030229564139285,821640292253391],0,1,null,null,[],false,false,9590353435551898,[["tint","Tint"]],null],["t70",11,true,[1009715326578042,1305040970412396],0,0,null,null,[],false,false,6631597198329078,[],null],["t71",10,true,[5846064141855004,4419610502870706],0,0,null,null,[],false,false,9784977049754561,[],null],["t72",11,true,[636958093485166,875789127674825],0,0,null,null,[],false,false,902272746554209,[],null]],[[65,36,35],[66,29,30],[67,47,50,49,48],[68,10,11,12,13],[69,29,36,35,37,30,33,34],[70,32,38,39],[71,42],[72,51,52]],[["BattleScreen",640,480,true,"Battle",8667945925241823,[["Background",0,8122988939693705,true,[0,0,0],false,1,1,1,false,false,1,0,0,[[[416,400,0,128,20,0,0,1,0,0,0,0,[[1,1,1]]],47,28,[["HP"],[""],[""],[""],[0],[0],[0],[0]],[],[6,6," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_","92 / 92",3,0,0,0,0,0,0,0]],[[32,402,0,192,20,0,0,1,0,0,0,0,[[1,1,1]]],47,6,[["PlayerName"],[""],[""],[""],[0],[0],[0],[0]],[],[6,6," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_","CHARA LV19",3,0,0,0,0,0,0,0]],[[256,400,0,110,21,0,0,1,0,0,0,0,[]],7,18,[],[],[0,0]],[[304,496,0,16,16,0,0,1,0,0,0,0,[]],8,19,[],[],[0,0]],[[320,496,0,16,16,0,0,1,0,0,0,0,[]],9,20,[],[],[0,0]],[[224,416,0,23,10,0,0,1,0,1,0,0,[]],18,46,[],[],[0,"Default",0,1]],[[400,416,0,23,10,0,0,1,1,1,0,0,[]],19,48,[],[],[0,"Default",0,1]]],[]],["Enemies",1,3734623272241002,true,[0,0,0],true,1,1,1,false,false,1,0,0,[[[320,224,0,88,46,0,0,1,0.4772727191448212,1,0,0,[]],25,1,[[0],[0],[0],[0],[0],[0]],[],[0,"Standing",0,0]],[[320,176,0,108,50,0,0,1,0.5,1,0,0,[]],27,13,[[0],[0],[0]],[],[0,"Default",0,0]],[[320,-16,0,128,140,0,0,1,0.46875,1,0,0,[]],24,15,[],[],[1,"Default",0,1]],[[320,128,0,64,60,0,0,1,0.5,1,0,0,[]],23,14,[[0],[0],[0]],[],[0,"Default",0,0]],[[320,-176,0,64,18,0,0,1,0.5,0,0,0,[]],26,21,[],[],[1,"Default",0,0]]],[]],["Buttons",2,3319279837636476,true,[0,0,0],true,1,1,1,false,false,1,0,0,[[[32,432,0,110,42,0,0,1,0,0,0,0,[]],11,2,[[0],["MenuFight"]],[],[0,"Default",0,1]],[[184,432,0,110,42,0,0,1,0,0,0,0,[]],10,3,[[1],["MenuAct"]],[],[0,"Default",0,1]],[[344,432,0,110,42,0,0,1,0,0,0,0,[]],12,4,[[2],["MenuItem"]],[],[0,"Default",0,1]],[[496,432,0,110,42,0,0,1,0,0,0,0,[]],13,5,[[3],["MenuMercy"]],[],[0,"Default",0,1]]],[]],["CombatZone",3,4548784921319786,true,[0,0,0],true,1,1,1,false,false,1,0,0,[[[320,320,0,16,16,0,1.570796370506287,1,0.5,0.5,0,0,[[1,0,0]]],54,0,[[0],[0],[0]],[[2,1,1]],[1,"Default",0,1]]],[]],["CombatZoneClipped",4,771510408651287,true,[0,0,0],true,1,1,1,true,false,1,0,0,[],[]],["Overlay",5,5028165789814174,true,[0,0,0],true,1,1,1,false,false,1,0,0,[[[32,240,0,576,144,0,0,1,0,0,0,0,[]],14,7,[[33],[251],[608],[391],[""]],[],[5,5,5,5,1,2,1,0,1]]],[]],["Touch",6,632984773778133,true,[0,0,0],true,0,0,1,false,false,1,0,0,[],[]]],[],[]],["System",640,480,false,"Fonts",8353295139437749,[["Layer 0",0,9304097847271213,true,[0,0,0],false,1,1,1,false,false,1,0,0,[[[0,0,0,32,32,0,0,1,0,0,0,0,[]],2,9,[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[1,"Default",0,0]],[[48,64,0,57,44,0,0,1,0.4912280738353729,0.5,0,0,[]],32,24,[[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[112,64,0,112,32,0,0,1,0,0.5,0,0,[]],31,16,[[0],[0],[0],[0]],[],[1,3]],[[96,64,0,16,24,0,0,1,0,0.5,0,0,[]],40,63,[],[],[1,3]],[[80,64,0,16,16,0,0,1,0,0.5,0,0,[]],41,64,[],[],[1,3]],[[112,64,0,112,16,0,0,1,0,0.5,0,0,[]],42,62,[[0],[0]],[],[1,3]],[[16,112,0,61,7,0,0,1,0,0,0,0,[[1,1,1]]],33,22,[[0],[0],[0],[0],[0],[0]],[[1],[0,5,1]],[4,4,2,2,1,1,0,0,1]],[[16,96,0,61,7,0,0,1,0,0,0,0,[[1,1,1]]],34,23,[[0],[0],[0]],[],[4,4,2,2,1,1,0,0,1]],[[112,96,0,48,10,0,0,1,0,0,0,0,[[1,1,1]]],29,11,[[0],[0],[0],[0],[0]],[],[6,6,0,0,0,0,0,0,1]],[[96,96,0,10,48,0,0,1,0,0,0,0,[[1,1,1]]],30,12,[[0],[0],[0],[0],[0]],[],[0,0,6,6,0,0,0,0,1]],[[0,144,0,16,16,0,0,1,0,0,0,0,[]],15,27,[],[[1]],[1,0]],[[16,144,0,16,16,0,0,1,0,0,6,0,[]],16,29,[],[],[0,0]],[[128,128,0,16,16,0,0,1,0,0,0,0,[[1,1,1]]],37,32,[[0],[0],[0],[0],[0],[0],[0]],[],[4,4,4,4,1,1,0,0,1]],[[144,112,0,12,48,0,0,1,0,0,0,0,[[1,1,1]]],35,34,[[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,0,6,6,0,0,0,0,1]],[[96,144,0,48,12,0,0,1,0,0,0,0,[[1,1,1]]],36,35,[[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[6,6,0,0,0,0,0,0,1]],[[16,192,0,160,16,0,0,1,0,0,0,0,[[1,1,1]]],48,26,[[""],["SansSpeak"],[""],[""],[0],[0],[0],[0]],[],[16,16," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~","Comic Sans",1,0,0,0,0,0,0,0]],[[16,224,0,237,104,0,0,1,0,0,0,0,[]],28,25,[],[],[0,"Default",0,1]],[[16,176,0,208,16,0,0,1,0,0,0,0,[[1,1,1]]],49,36,[[""],["BattleText"],[""],[""],[0],[0],[0],[0]],[],[10,16," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~","Informational Text",1,0,0,0,0,0,0,0]],[[320,416,0,548,117,0,0,1,0.5,0.504273533821106,0,0,[]],17,39,[[0]],[],[0,"Default",0,1]],[[0,176,0,16,16,0,0,1,0,0,0,0,[]],56,40,[[0],[""],[""],[""],[0]],[],[1,"Default",0,1]],[[192,128,0,16,16,0,0,1,0.5,0.5,0,0,[]],59,43,[],[[0,5,1]],[0,"Default",0,1]],[[320,352,0,4,6,0,0,1,-1,5.666666507720947,0,0,[]],21,44,[],[],[0,"Default",0,1]],[[320,416,0,14,128,0,0,1,0.5,0.5,0,0,[]],20,45,[[0]],[],[0,"Default",0,1]],[[224,176,0,176,32,0,0,1,0,0,0,0,[[1,1,1]]],50,50,[[""],[""],[""],[""],[0],[0],[0],[0]],[],[33,32," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~","99999",1,0,0,0,0,0,0,0]],[[272,224,0,200,25,0,0,1,0,0,0,0,[]],62,52,[],[],[".csv",0,1,"filechooser"]],[[32,144,0,16,16,0,0,1,0,0,6,0,[]],22,53,[],[],[0,0]],[[592,32,0,14,44,0,0,1,0,0,0,0,[]],39,55,[[0],[0],[0],[0]],[],[0,"Default",0,1]],[[608,32,0,14,44,0,0,1,0,0,0,0,[]],38,56,[[0],[0],[0],[0]],[],[0,"Default",0,1]],[[272,32,0,4,4,0,0,1,0.5,0.5,0,0,[]],64,57,[],[],[1,"Default",0,1]],[[288,48,0,96,96,0,0,0.5,0.5,0.5,0,0,[]],53,59,[[-1]],[],[0,"Default",0,1]],[[528,48,0,96,96,0,0,0.5,0.5,0.5,0,0,[]],51,60,[[-1],[0]],[],[0,"Default",0,1]],[[416,48,0,96,96,0,0,0.5,0.5,0.5,0,0,[]],52,61,[[-1],[0]],[],[0,"Default",0,1]]],[]]],[[null,55,31,[],[],[]],[null,43,37,[],[],[10,1,1]],[null,44,38,[],[],[10,1,1]],[null,57,41,[],[],[0,1,1]],[null,58,42,[],[],[0,4,1]],[null,45,47,[],[],[]],[null,60,49,[],[],[0,1,1]],[null,61,51,[],[],[1,2,1]],[null,46,65,[],[],[]]],[]],["MainMenu",640,1280,false,"MainMenu",4489433801173846,[["Menu",0,1385025260711742,true,[0,0,0],false,1,1,1,false,false,1,0,0,[],[]],["Touch",1,352649659867774,true,[0,0,0],true,0,0,1,false,false,1,0,0,[],[]]],[],[]]],[["Battle",[[2,"InputManagement",false],[2,"Fonts",false],[2,"Items",false],[2,"Timeline",false],[2,"AttackLoader",false],[2,"RPGText",false],[2,"Menus",false],[0,null,false,null,6997419290205712,[[-1,17,null,1,false,false,false,2981337075960627,false]],[[57,18,null,3223444452095259,false,[[0,[0,0]],[0,[0,1]],[0,[0,1]]]],[57,19,null,9273050131957424,false,[[3,0],[7,[0,0]],[3,0]]],[57,19,null,7288109683993914,false,[[3,0],[7,[0,1]],[3,0]]],[57,19,null,4578436985688055,false,[[3,0],[7,[0,2]],[3,0]]],[57,19,null,3889781542724411,false,[[3,0],[7,[0,3]],[3,0]]],[57,19,null,4711405679659032,false,[[3,0],[7,[0,3]],[3,0]]],[57,19,null,3882860326812116,false,[[3,0],[7,[0,3]],[3,0]]],[57,19,null,6875653235496314,false,[[3,0],[7,[0,3]],[3,0]]],[57,19,null,9651685953078992,false,[[3,0],[7,[0,3]],[3,0]]],[3,20,null,8840925379318578,false,[[1,[2,"TLPanic"]],[13,[7,[2,"BattlePanic"]]]]],[-1,21,null,9346442597586431,false,[[11,"KR"],[7,[0,0]]]],[-1,21,null,6658486200945065,false,[[11,"KR_T"],[7,[0,0]]]],[-1,22,null,7626879817092081,false,[[5,[2,"Overlay"]],[3,1]]],[3,20,null,1932170171524681,false,[[1,[2,"SansAnimation"]],[13,[7,[2,""]]]]],[23,23,null,1205667824253445,false,[[1,[2,"ClosedEyes"]],[3,1]]]],[[0,null,false,null,5660586456921061,[[67,24,null,0,false,false,false,7073583585924294,false,[[10,0],[8,0],[7,[2,"PlayerName"]]]]],[[67,25,null,9190566972510164,false,[[7,[10,[19,26,[[23,"Name"]]],[2," LV 19"]]]]]]],[0,null,false,null,6375254474144596,[[-1,27,null,0,false,false,false,6299242200629592,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_NORMAL"]]]]],[[5,28,null,1634811247740819,false,[[2,["mus_zz_megalovania",true]]]]]],[0,null,false,null,4308489914797654,[[-1,27,null,0,false,false,false,5946392661334711,false,[[11,"SimulatorMode"],[8,1],[7,[23,"MODE_NORMAL"]]]]],[[5,29,null,4080759880781125,false,[[2,["mus_zz_megalovania",true]],[3,1],[0,[0,0]],[1,[2,"Music"]]]]]],[0,null,false,null,7396551310172032,[[-1,27,null,0,false,false,false,9038493889609212,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_ENDLESS"]]]]],[],[[0,null,false,null,9739637546675257,[[-1,27,null,0,false,false,false,2193043457865295,false,[[11,"EndlessStage"],[8,0],[7,[0,1]]]]],[[25,30,null,2744947721000227,false,[[10,1],[7,[0,15]]]],[3,20,null,931292737815473,false,[[1,[2,"SansHead"]],[13,[7,[2,"Default"]]]]],[3,20,null,600556706130093,false,[[1,[2,"SansAnimation"]],[13,[7,[2,"Idle"]]]]]]]]],[0,null,false,null,3806239479586918,[[-1,27,null,0,false,false,false,5074908598565894,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_SINGLE"]]]]],[[-1,31,null,2032624068708095,false,[[4,47],[5,[2,"Background"]],[0,[0,0]],[0,[0,32]]]],[47,32,null,3299219764233642,false,[[10,0],[7,[2,"QuitMessage"]]]],[47,33,null,8884452742690575,false,[[0,[0,640]]]],[47,34,null,5249638380891287,false,[[0,[0,32]]]],[47,25,null,8939946990053354,false,[[7,[2,"PRESS 'X' TO QUIT"]]]]]]]],[0,null,false,null,8304459325253301,[[3,35,null,2,false,false,false,720164576451332,false,[[1,[2,"BattlePanic"]]]]],[],[[0,null,false,null,400460885232819,[[67,24,null,0,false,false,false,617307408619556,false,[[10,0],[8,0],[7,[2,"Error"]]]]],[[67,36,null,783310158775891,false]]],[0,null,false,null,966582283938964,[[-1,37,null,0,false,false,false,774706709433379,false]],[[-1,31,null,4381738516254251,false,[[4,47],[5,[2,"Overlay"]],[0,[0,0]],[0,[0,0]]]],[47,32,null,7846674212420365,false,[[10,0],[7,[2,"Error"]]]],[47,32,null,523605850548551,false,[[10,7],[7,[0,3]]]],[47,33,null,7371100064444184,false,[[0,[0,640]]]],[47,25,null,4589855453196791,false,[[7,[19,26,[[20,3,38,false,null,[[0,0]]]]]]]],[3,20,null,9917848270539777,false,[[1,[2,"EndAttack"]],[13]]]]]]],[0,null,true,null,7354628487307059,[[-1,17,null,1,false,false,false,39515319479772,false],[3,35,null,2,false,false,false,5918335681986968,false,[[1,[2,"AttackLoadFinished"]]]]],[],[[0,null,false,null,2196839888414716,[[-1,39,null,0,false,false,false,4794342677626487,false,[[7,[20,55,40,false,null]],[8,5],[7,[20,60,41,false,null]]]]],[],[[1,"WebGLSpeech",0,0,true,false,9099907247292479,false],[0,null,false,null,3321073104879445,[[-1,42,null,0,false,true,false,8676357399287389,false],[-1,27,null,0,false,false,false,2962072843432443,false,[[11,"WebGLSpeech"],[8,0],[7,[0,0]]]]],[[23,23,null,2404753514933931,false,[[1,[2,"Default"]],[3,1]]],[3,20,null,2552257414134285,false,[[1,[2,"SansText"]],[13,[7,[2,"so, uh, your browser\ndoesn't seem to support\nwebGL."]],[7,[2,"NoEffects1"]]]]],[-1,21,null,9069972295144216,false,[[11,"WebGLSpeech"],[7,[0,1]]]]]],[0,null,false,null,5978360404062814,[[-1,43,null,0,false,false,false,775077855155941,false]],[],[[0,null,true,null,5397041653044339,[[-1,27,null,0,false,false,false,545108570469385,false,[[11,"SimulatorMode"],[8,1],[7,[23,"MODE_NORMAL"]]]],[25,44,null,0,false,false,false,4926164433409186,false,[[10,0],[8,0],[7,[0,0]]]]],[[3,20,null,3935465308395408,false,[[1,[2,"StartAttack"]],[13]]]]],[0,null,false,null,4577185238024095,[[-1,43,null,0,false,false,false,6666873587019407,false]],[[-1,45,null,641945763674282,false,[[0,[0,0]]]],[3,20,null,1184803353579677,false,[[1,[2,"EndAttack"]],[13]]],[5,29,null,687530192848918,false,[[2,["mus_zz_megalovania",true]],[3,1],[0,[0,0]],[1,[2,"Music"]]]]]]]]]]]],[0,null,false,null,8226549966780508,[[3,35,null,2,false,false,false,2663868423768256,false,[[1,[2,"NoEffects1"]]]]],[[28,46,null,80140630355217,false],[23,23,null,1266186448284215,false,[[1,[2,"LookLeft"]],[3,1]]],[3,20,null,9564903039530182,false,[[1,[2,"SansText"]],[13,[7,[2,"thats kind of a problem."]],[7,[2,"NoEffects2"]]]]]]],[0,null,false,null,1013452918260168,[[3,35,null,2,false,false,false,907394125956675,false,[[1,[2,"NoEffects2"]]]]],[[28,46,null,5184984371153454,false],[23,23,null,5291306138511684,false,[[1,[2,"Default"]],[3,1]]],[3,20,null,6160373462858134,false,[[1,[2,"SansText"]],[13,[7,[2,"some effects aren't going\nto work."]],[7,[2,"NoEffects3"]]]]]]],[0,null,false,null,3849064852892823,[[3,35,null,2,false,false,false,6198122169927445,false,[[1,[2,"NoEffects3"]]]]],[[28,46,null,4077843787701976,false],[23,23,null,6263510020998762,false,[[1,[2,"Wink"]],[3,1]]],[3,20,null,8938939640487405,false,[[1,[2,"SansText"]],[13,[7,[2,"i had to make my speech\nbubble inverted just so\nyou can see what i'm\nsaying."]],[7,[2,"NoEffects4"]]]]]]],[0,null,false,null,8063055597507141,[[3,35,null,2,false,false,false,2112139998922969,false,[[1,[2,"NoEffects4"]]]]],[[28,46,null,2584035881780578,false],[23,23,null,8362377340837748,false,[[1,[2,"ClosedEyes"]],[3,1]]],[3,20,null,2694031369129686,false,[[1,[2,"SansText"]],[13,[7,[2,"most importantly, my blue\nattacks will look like\nnormal attacks."]],[7,[2,"NoEffects5"]]]]]]],[0,null,false,null,5786683413174243,[[3,35,null,2,false,false,false,2005501994527497,false,[[1,[2,"NoEffects5"]]]]],[[28,46,null,3244047799302167,false],[23,23,null,5232358365858677,false,[[1,[2,"NoEyes"]],[3,1]]],[3,20,null,2552241740051866,false,[[1,[2,"SansText"]],[13,[7,[2,"continue if you dare."]],[7,[2,"NoEffects6"]]]]]]],[0,null,false,null,4017356252387848,[[3,35,null,2,false,false,false,7815790488384539,false,[[1,[2,"NoEffects6"]]]]],[[28,46,null,140165793045117,false],[3,20,null,2510490404829929,false,[[1,[2,"StartAttack"]],[13]]]]],[0,null,false,null,4396816808128349,[[3,35,null,2,false,false,false,981816954741706,false,[[1,[2,"ResetVars"]]]]],[[3,20,null,8371414677327365,false,[[1,[2,"CombatZoneSpeed"]],[13,[7,[0,480]]]]],[3,20,null,5058649787402254,false,[[1,[2,"HeartMode"]],[13,[7,[21,54,false,null,0]]]]],[3,20,null,4494466368439508,false,[[1,[2,"HeartMaxFallSpeed"]],[13,[7,[0,750]]]]],[3,20,null,956878677840635,false,[[1,[2,"SansSlamDamage"]],[13,[7,[0,0]]]]],[25,30,null,560355816614418,false,[[10,5],[7,[0,0]]]],[25,47,null,4654644882717769,false,[[0,[0,320]]]]]],[0,null,false,null,7064476073200022,[[3,35,null,2,false,false,false,3057928606341339,false,[[1,[2,"RunAttack"]]]]],[[3,20,null,7919062239160802,false,[[1,[2,"TLPlay"]],[13,[7,[20,55,48,false,null,[[20,3,38,false,null,[[0,0]]]]]]]]]]],[0,null,false,null,9557576745718824,[[3,35,null,2,false,false,false,863282196169015,false,[[1,[2,"StartAttack"]]]]],[[54,49,"CustomMovement",9685765655189372,false,[[3,1]]],[54,50,"CustomMovement",5758516650697975,false,[[3,0],[0,[0,0]]]],[3,20,null,5783355126868734,false,[[1,[2,"ResetVars"]],[13]]],[3,20,null,1585471824567264,false,[[1,[2,"MenuBonesOff"]],[13]]]],[[0,null,false,null,886270670661183,[[-1,27,null,0,false,false,false,4939879522821507,false,[[11,"SimulatorMode"],[8,1],[7,[23,"MODE_SINGLE"]]]],[-1,39,null,0,false,false,false,5847484776567597,false,[[7,[20,25,51,false,null]],[8,4],[7,[0,0]]]]],[],[[0,null,false,null,9731873364113948,[[25,44,null,0,false,false,false,6518347568049467,false,[[10,1],[8,2],[7,[0,13]]]]],[],[[0,null,false,null,8629455995839382,[[25,44,null,0,false,false,false,7426969151937487,false,[[10,0],[8,0],[7,[0,0]]]]],[[3,20,null,3030336529009913,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_intro"]]]]],[25,52,null,8542394061486128,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,212320154273775,[[-1,43,null,0,false,false,false,1585900830703396,false],[25,44,null,0,false,false,false,783735597743473,false,[[10,0],[8,0],[7,[0,1]]]]],[[3,20,null,5022431412441468,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonegap1"]]]]],[25,52,null,892328920562479,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,8000724834746328,[[-1,43,null,0,false,false,false,9136060492638931,false],[25,44,null,0,false,false,false,9228948525108032,false,[[10,0],[8,0],[7,[0,2]]]]],[[3,20,null,2117610159043014,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bluebone"]]]]],[25,52,null,2335323764650383,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,1681076560839624,[[-1,43,null,0,false,false,false,8895318616103296,false],[25,44,null,0,false,false,false,7348407784548393,false,[[10,0],[8,0],[7,[0,3]]]]],[[3,20,null,9509660814562553,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonegap2"]]]]],[25,52,null,2011632458044627,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,5436403546652937,[[-1,43,null,0,false,false,false,1674725307893866,false],[25,44,null,0,false,false,false,2874376670707494,false,[[10,0],[8,0],[7,[0,4]]]]],[[3,20,null,578770692281859,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platforms1"]]]]],[25,52,null,2920387661146958,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,6441488507728702,[[-1,43,null,0,false,false,false,2812608560504938,false],[25,44,null,0,false,false,false,8707901552330256,false,[[10,0],[8,0],[7,[0,5]]]]],[[3,20,null,3225480518545867,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platforms2"]]]]],[25,52,null,6300490246912156,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,4704060976000434,[[-1,43,null,0,false,false,false,8442437579135018,false],[25,44,null,0,false,false,false,2328231806356348,false,[[10,0],[8,0],[7,[0,6]]]]],[[3,20,null,4860275815214738,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platforms3"]]]]],[25,52,null,3598830035157635,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,1726985579812186,[[-1,43,null,0,false,false,false,5182345724007085,false],[25,44,null,0,false,false,false,3765598155206209,false,[[10,0],[8,0],[7,[0,7]]]]],[[3,20,null,3776540688562493,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platforms4"]]]]],[25,52,null,3531329946577688,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,6573893860478493,[[-1,43,null,0,false,false,false,4156307613050846,false],[25,44,null,0,false,false,false,171132599029675,false,[[10,0],[8,0],[7,[0,8]]]]],[[3,20,null,4235681118143808,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platformblaster"]]]]],[25,52,null,4624674001538727,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,4221104934125561,[[-1,43,null,0,false,false,false,8946943701687768,false],[25,44,null,0,false,false,false,7503374467817326,false,[[10,0],[8,0],[7,[0,9]]]]],[[3,20,null,6659356367854469,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platforms4hard"]]]]],[25,52,null,9078073712209508,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,5549977034345581,[[-1,43,null,0,false,false,false,2651731049674128,false],[25,44,null,0,false,false,false,1424798773260015,false,[[10,0],[8,0],[7,[0,10]]]]],[[3,20,null,442266243902752,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonegap1fast"]]]]],[25,52,null,5532933273974015,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,3813099165618475,[[-1,43,null,0,false,false,false,7405079817651705,false],[25,44,null,0,false,false,false,4146204412772374,false,[[10,0],[8,0],[7,[0,11]]]]],[[3,20,null,7007070327931486,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_boneslideh"]]]]],[25,52,null,4360530943380891,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,8842005916892284,[[-1,43,null,0,false,false,false,8793139420188864,false],[25,44,null,0,false,false,false,2372355982566757,false,[[10,0],[8,0],[7,[0,12]]]]],[[3,20,null,505250338900195,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonegap2"]]]]],[25,52,null,3480072015931767,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,2311596626155625,[[-1,43,null,0,false,false,false,4656108655839037,false],[25,44,null,0,false,false,false,8037182718456863,false,[[10,0],[8,0],[7,[0,13]]]]],[[3,20,null,3377623375632616,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_platformblasterfast"]]]]],[25,52,null,8071696133224881,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,1793501354868495,[[-1,43,null,0,false,false,false,9776044120816472,false],[25,44,null,0,false,false,false,9530962753947138,false,[[10,0],[8,0],[7,[0,14]]]]],[[3,20,null,2033871596463807,false,[[1,[2,"RunAttack"]],[13,[7,[19,53,[[2,"sans_bonegap1fast"],[2,"sans_bonegap2"],[2,"sans_boneslideh"],[2,"sans_platformblasterfast"]]]]]]]]]]],[0,null,false,null,6654481296984306,[[25,44,null,0,false,false,false,3378806070575378,false,[[10,1],[8,0],[7,[0,13]]]]],[[3,20,null,9399469216033539,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_spare"]]]]],[3,20,null,5515463891495731,false,[[1,[2,"SansSweat"]],[13,[7,[0,2]]]]],[25,30,null,1727518062444883,false,[[10,0],[7,[0,0]]]],[5,54,null,8771478807556077,false,[[1,[2,"Music"]],[3,0]]]]],[0,null,false,null,3015245139062123,[[25,44,null,0,false,false,false,5300821395413129,false,[[10,1],[8,4],[7,[0,13]]]],[25,44,null,0,false,false,false,6977219072124486,false,[[10,1],[8,3],[7,[0,22]]]]],[[5,55,null,1623888928729483,false,[[1,[2,"Music2"]]]]],[[0,null,false,null,7715275955687633,[[25,44,null,0,false,false,false,351317826634032,false,[[10,0],[8,0],[7,[0,0]]]]],[[3,20,null,2933220910940145,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_multi1"]]]]],[25,52,null,9574311237492765,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,5568209421583627,[[-1,43,null,0,false,false,false,7822300499168327,false],[25,44,null,0,false,false,false,3126069260073146,false,[[10,0],[8,0],[7,[0,1]]]]],[[3,20,null,7027814147493428,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_randomblaster1"]]]]],[25,52,null,6324337389092798,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,691115240638098,[[-1,43,null,0,false,false,false,3415084169674192,false],[25,44,null,0,false,false,false,2795689287256812,false,[[10,0],[8,0],[7,[0,2]]]]],[[3,20,null,3411657046177695,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_multi2"]]]]],[25,52,null,1180382113194056,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,828868584688814,[[-1,43,null,0,false,false,false,7709767913750324,false],[25,44,null,0,false,false,false,7065801942648855,false,[[10,0],[8,0],[7,[0,3]]]]],[[3,20,null,5825165936692492,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonestab1"]]]]],[25,52,null,5994071180108625,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,9056275101794638,[[-1,43,null,0,false,false,false,5469799002496135,false],[25,44,null,0,false,false,false,8441062095821318,false,[[10,0],[8,0],[7,[0,4]]]]],[[3,20,null,2327886148151195,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonestab2"]]]]],[25,52,null,3622911059814079,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,9540245988539483,[[-1,43,null,0,false,false,false,3434449269898476,false],[25,44,null,0,false,false,false,407455164485083,false,[[10,0],[8,0],[7,[0,5]]]]],[[3,20,null,7233295315670256,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_randomblaster2"]]]]],[25,52,null,1742474565978232,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,7812691507460822,[[-1,43,null,0,false,false,false,8867034730512359,false],[25,44,null,0,false,false,false,6347488318755366,false,[[10,0],[8,0],[7,[0,6]]]]],[[3,20,null,8787608162432438,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_boneslidev"]]]]],[25,52,null,59212355233205,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,9135645744013892,[[-1,43,null,0,false,false,false,9805194318525196,false],[25,44,null,0,false,false,false,7210623507238512,false,[[10,0],[8,0],[7,[0,7]]]]],[[3,20,null,9640365747436876,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_multi3"]]]]],[25,52,null,7122609178334212,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,9424195690663828,[[-1,43,null,0,false,false,false,4057427156413563,false],[25,44,null,0,false,false,false,6565461529508315,false,[[10,0],[8,0],[7,[0,8]]]]],[[3,20,null,2076941376602817,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_bonestab3"]]]]],[25,52,null,7809365906146129,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,8487120098318867,[[-1,43,null,0,false,false,false,458850349413445,false],[25,44,null,0,false,false,false,8948725424246985,false,[[10,0],[8,0],[7,[0,9]]]]],[[3,20,null,9735140471243084,false,[[1,[2,"RunAttack"]],[13,[7,[19,53,[[2,"sans_bonestab3"],[2,"sans_multi3"],[2,"sans_randomblaster2"]]]]]]]]]]],[0,null,false,null,1977102404310263,[[25,44,null,0,false,false,false,4420458786776833,false,[[10,1],[8,4],[7,[0,22]]]]],[[3,20,null,8963694409463822,false,[[1,[2,"RunAttack"]],[13,[7,[2,"sans_final"]]]]]]]]],[0,null,false,null,4821019561596071,[[-1,27,null,0,false,false,false,7167432667591113,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_SINGLE"]]]]],[[3,20,null,1428595586195898,false,[[1,[2,"SansAnimation"]],[13,[7,[2,"Idle"]]]]],[23,23,null,3930775077926091,false,[[1,[2,"Default"]],[3,1]]],[3,20,null,5168157618580866,false,[[1,[2,"RunAttack"]],[13,[7,[23,"SingleAttack"]]]]]]]]],[0,null,false,null,3280109314632482,[[3,35,null,2,false,false,false,8439448875550945,false,[[1,[2,"EndAttack"]]]]],[[69,56,null,9658524973294492,false],[70,46,null,4402908661248295,false],[3,20,null,6746334392069733,false,[[1,[2,"BattleMenuEnable"]],[13,[7,[0,1]]]]],[54,57,null,2669179350626391,false,[[3,1]]],[54,49,"CustomMovement",1125385717516735,false,[[3,0]]],[3,20,null,2313392696797699,false,[[1,[2,"ResetVars"]],[13]]],[-1,22,null,678532394187058,false,[[5,[2,"Overlay"]],[3,1]]]],[[0,null,false,null,2362615410620619,[[-1,39,null,0,false,false,false,7235506852041415,false,[[7,[20,25,51,false,null]],[8,4],[7,[0,0]]]]],[[3,20,null,5507357687425963,false,[[1,[2,"SansAnimation"]],[13,[7,[2,"Idle"]]]]],[23,23,null,9942459972984748,false,[[1,[2,"Default"]],[3,1]]],[27,23,null,4921399809178322,false,[[1,[2,"Default"]],[3,1]]]],[[0,null,false,null,7653489424215733,[[-1,27,null,0,false,false,false,1896193851997421,false,[[11,"KR"],[8,5],[7,[0,0]]]]],[[14,58,null,4925109422702469,false,[[10,4],[7,[2,"* You felt your sins crawling\n on your back."]]]]]],[0,null,false,null,8793208741086474,[[25,44,null,0,false,false,false,1174001643764288,false,[[10,1],[8,2],[7,[0,13]]]],[25,44,null,0,false,false,false,793544717574826,false,[[10,0],[8,0],[7,[0,1]]]]],[[14,58,null,5244377573294855,false,[[10,4],[7,[2,"* You feel like you're going to\n have a bad time."]]]]],[[0,null,false,null,1908806475702584,[[5,59,null,0,false,true,false,3373887249691799,false,[[1,[2,"Music"]]]]],[[5,29,null,3571287415179704,false,[[2,["mus_zz_megalovania",true]],[3,1],[0,[0,0]],[1,[2,"Music"]]]]]]]],[0,null,false,null,103739778308313,[[25,44,null,0,false,false,false,552144905778336,false,[[10,1],[8,1],[7,[0,13]]]]],[[5,54,null,856226024375401,false,[[1,[2,"Music"]],[3,1]]]]],[0,null,false,null,3246169237782454,[[25,44,null,0,false,false,false,1274587453256673,false,[[10,1],[8,0],[7,[0,13]]]]],[[14,58,null,2670032810893258,false,[[10,4],[7,[2,"* Sans is taking a break."]]]]]],[0,null,false,null,3644008187143449,[[25,44,null,0,false,false,false,682062533172973,false,[[10,1],[8,0],[7,[0,15]]]]],[[14,58,null,3736070576317147,false,[[10,4],[7,[2,"* The REAL battle finally begins."]]]]]],[0,null,false,null,1538235747792909,[[25,44,null,0,false,false,false,1024124910185591,false,[[10,1],[8,0],[7,[0,19]]]]],[[14,58,null,6589808686267995,false,[[10,4],[7,[2,"* Reading this doesn't seem\n like the best use of time."]]]]]],[0,null,false,null,2812257064436168,[[25,44,null,0,false,false,false,2926912538456532,false,[[10,1],[8,0],[7,[0,20]]]]],[[14,58,null,5769331507923777,false,[[10,4],[7,[2,"* Sans is starting to look\n really tired."]]]]]],[0,null,false,null,5099706116970166,[[25,44,null,0,false,false,false,4981641262757057,false,[[10,1],[8,0],[7,[0,21]]]]],[[14,58,null,6593676851472784,false,[[10,4],[7,[2,"* Sans is preparing something."]]]]]],[0,null,false,null,2714631613990104,[[25,44,null,0,false,false,false,8080039389275643,false,[[10,1],[8,0],[7,[0,22]]]]],[[14,58,null,9963026487239779,false,[[10,4],[7,[2,"* Sans is getting ready to\n use his special attack."]]]]]],[0,null,false,null,2661596577719519,[[25,44,null,0,false,false,false,8428201830043671,false,[[10,1],[8,4],[7,[0,22]]]]],[[3,20,null,1127498986826935,false,[[1,[2,"BattleMenuEnable"]],[13,[7,[0,0]]]]],[3,20,null,5017116085592514,false,[[1,[2,"CombatZoneResize"]],[13,[7,[20,14,60,false,null]],[7,[20,14,61,false,null]],[7,[20,14,62,false,null]],[7,[20,14,63,false,null]]]]],[3,20,null,4551826621279671,false,[[1,[2,"SansAnimation"]],[13,[7,[2,"Tired"]]]]],[23,23,null,5653485612350006,false,[[1,[2,"Tired2"]],[3,1]]],[5,64,null,5229506436586432,false],[3,20,null,1463949281462211,false,[[1,[2,"SansText"]],[13,[7,[2,"huff... puff..."]],[7,[2,"Win1"]]]]]]],[0,null,false,null,8194250317691436,[[25,44,null,0,false,false,false,516178945305094,false,[[10,1],[8,4],[7,[0,13]]]],[25,44,null,0,false,false,false,3911861650604649,false,[[10,1],[8,1],[7,[0,16]]]],[25,44,null,0,false,false,false,4354504672713893,false,[[10,1],[8,1],[7,[0,17]]]],[25,44,null,0,false,false,false,3738460067809331,false,[[10,1],[8,3],[7,[0,22]]]]],[[3,20,null,6047132919634249,false,[[1,[2,"MenuBoneLeft"]],[13]]]]],[0,null,false,null,174994798942467,[[25,44,null,0,false,false,false,7058507285453225,false,[[10,1],[8,4],[7,[0,15]]]],[25,44,null,0,false,false,false,2711064562360288,false,[[10,1],[8,3],[7,[0,22]]]]],[[3,20,null,1708587769967988,false,[[1,[2,"MenuBoneBottom"]],[13]]]]]]]]],[0,null,false,null,9880305470005524,[[3,35,null,2,false,false,false,35700371171699,false,[[1,[2,"Win1"]]]]],[[3,20,null,522788098430892,false,[[1,[2,"SansText"]],[13,[7,[2,"alright, i guess\nyou win."]],[7,[2,"Win2"]]]]]]],[0,null,false,null,6230643792485007,[[3,35,null,2,false,false,false,9520819468320272,false,[[1,[2,"Win2"]]]]],[[-1,65,null,4143671674600644,false,[[6,"MainMenu"]]]]],[0,null,false,null,6096733224286633,[[3,35,null,2,false,false,false,3153370142839506,false,[[1,[2,"Sound"]]]]],[[5,66,null,3990447337869471,false,[[3,0],[1,[20,3,38,false,null,[[0,0]]]],[3,0],[0,[0,0]],[1,[2,""]]]]],[[0,null,false,null,3932998756502551,[[3,67,null,0,false,false,false,2106028122650942,false,[[0,[0,1]],[8,1],[7,[2,""]]]]],[[5,68,null,3971380284517386,false,[[1,[2,""]],[0,[19,69,[[20,3,38,false,null,[[0,1]]]]]]]]]]]],[0,null,false,null,5100353164401107,[[3,35,null,2,false,false,false,2254145649323064,false,[[1,[2,"Music"]]]]],[[5,66,null,2486037694762911,false,[[3,1],[1,[20,3,38,false,null,[[0,0]]]],[3,1],[0,[0,0]],[1,[2,"Music"]]]]]],[0,null,false,null,7627015178653555,[[3,35,null,2,false,false,false,5634795570105372,false,[[1,[2,"BlackScreen"]]]]],[],[[0,null,false,null,6365917659112127,[[-1,39,null,0,false,false,false,6874273059842171,false,[[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]],[8,0],[7,[0,1]]]]],[[-1,22,null,5038008396250246,false,[[5,[2,"Overlay"]],[3,0]]],[14,71,null,8136111626762263,false,[[3,0]]],[5,54,null,5377099166332818,false,[[1,[2,"Music"]],[3,0]]],[70,46,null,582195085709399,false],[69,56,null,6987923762829085,false]]],[0,null,false,null,4971409179101634,[[-1,39,null,0,false,false,false,8029030081754374,false,[[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]],[8,0],[7,[0,0]]]]],[[-1,22,null,3321890262135359,false,[[5,[2,"Overlay"]],[3,1]]],[5,54,null,4902882870910245,false,[[1,[2,"Music"]],[3,1]]],[14,71,null,2552793412841006,false,[[3,1]]]]]]],[0,null,false,null,9206346910846115,[[-1,27,null,0,false,false,false,6065731015496369,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_SINGLE"]]]],[2,44,null,0,false,false,false,218244971315972,false,[[10,5],[8,4],[7,[21,2,false,null,12]]]]],[[3,20,null,6813644129604146,false,[[1,[2,"TLStop"]],[13]]],[5,64,null,3856935287032514,false],[-1,65,null,4218464974531404,false,[[6,"MainMenu"]]]]],[0,[true,"BattleMenu"],false,null,5873472645475589,[[-1,72,null,0,false,false,false,5873472645475589,false,[[1,[2,"BattleMenu"]]]]],[],[[1,"MenuState",0,0,true,false,5359025861573384,false],[0,null,false,null,7182427324329722,[[-1,17,null,1,false,false,false,361340507812521,false]],[[-1,21,null,5096780698065255,false,[[11,"MenuState"],[7,[0,0]]]]]],[0,null,false,null,4186926804514802,[[3,35,null,2,false,false,false,6752106173081569,false,[[1,[2,"BattleMenuEnable"]]]]],[],[[0,null,false,null,1560986828180257,[[3,67,null,0,false,false,false,3986831371634877,false,[[0,[0,0]],[8,1],[7,[0,0]]]]],[[61,18,null,3006041280836744,false,[[0,[0,1]],[0,[0,2]],[0,[0,1]]]],[-1,21,null,3600010592724275,false,[[11,"MenuState"],[7,[0,1]]]],[3,20,null,1207065133818899,false,[[1,[2,"CombatZoneResize"]],[13,[7,[0,33]],[7,[0,251]],[7,[0,608]],[7,[0,391]],[7,[2,"MenuBattle"]]]]]]],[0,null,false,null,3642347311329106,[[-1,43,null,0,false,false,false,605955981650091,false]],[[-1,21,null,92741174628441,false,[[11,"MenuState"],[7,[0,0]]]]]]]],[0,null,false,null,8844157297355681,[[3,35,null,2,false,false,false,9742524896977299,false,[[1,[2,"MenuBattle"]]]]],[],[[0,null,false,null,1786471186627736,[[-1,27,null,0,false,false,false,9481340293326211,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_NORMAL"]]]]],[[56,46,null,4871016202786797,false],[49,36,null,3501512135482582,false],[3,20,null,2013543461201569,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,""]]]]],[-1,21,null,8849853127334058,false,[[11,"MenuState"],[7,[0,2]]]],[-1,31,null,5066171669311235,false,[[4,49],[5,[2,"CombatZone"]],[0,[0,48]],[0,[0,272]]]],[49,73,null,7869898738280204,false,[[0,[0,544]],[0,[0,96]]]],[49,74,null,6733110494252138,false,[[0,[0,2]]]],[49,25,null,6965892442098992,false,[[7,[2,""]]]],[49,32,null,5835545420556264,false,[[10,2],[7,[21,14,true,null,4]]]],[49,32,null,555423261791026,false,[[10,0],[7,[2,"InfoText"]]]]],[[0,null,false,null,1461895685265955,[[-1,75,null,0,true,false,false,9440759469979751,false,[[4,68]]]],[[-1,31,null,5005523335662871,false,[[4,56],[5,[2,"Buttons"]],[0,[20,68,76,false,null]],[0,[20,68,77,false,null]]]],[56,30,null,1375066954930784,false,[[10,0],[7,[21,68,false,null,0]]]],[56,30,null,7450766351009123,false,[[10,2],[7,[21,68,true,null,1]]]],[56,78,null,3681338764453256,false,[[10,4],[3,1]]]]]]],[0,null,false,null,3239465904068132,[[-1,43,null,0,false,false,false,8736082174501314,false]],[[-1,45,null,570964253948250,false,[[0,[0,0]]]],[-1,21,null,6812349676219753,false,[[11,"MenuState"],[7,[0,0]]]],[3,20,null,9760941104477434,false,[[1,[2,"StartAttack"]],[13]]]]]]],[0,null,false,null,201482591279491,[[3,35,null,2,false,false,false,2280650165377016,false,[[1,[2,"MenuEnemyList"]]]]],[],[[1,"Action",1,"",false,false,238050275334109,false],[0,null,false,null,3703493294161426,[[61,79,null,0,false,false,false,5160012966306435,false,[[0,[0,0]],[8,0],[7,[21,11,false,null,0]]]]],[[-1,21,null,897009482070971,false,[[11,"Action"],[7,[2,"MenuFightEnemy"]]]]]],[0,null,false,null,3268391952200651,[[61,79,null,0,false,false,false,6672921142832583,false,[[0,[0,0]],[8,0],[7,[21,10,false,null,0]]]]],[[-1,21,null,524167510604667,false,[[11,"Action"],[7,[2,"MenuActEnemy"]]]]]],[0,null,false,null,7444677021855717,[[-1,37,null,0,false,false,false,7312213966211142,false]],[[3,20,null,818540111613540,false,[[1,[2,"CreateMenuItem"]],[13,[7,[2,"CombatZone"]],[7,[0,64]],[7,[0,272]],[7,[0,0]],[7,[2,"* Sans"]],[7,[23,"Action"]]]]]]]]],[0,null,false,null,8164552317445905,[[3,35,null,2,false,false,false,9282316242166212,false,[[1,[2,"MenuFight"]]]]],[[56,46,null,6880014801936653,false],[49,36,null,7180918704272833,false],[3,20,null,8697772466055087,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuBattle"]]]]],[-1,21,null,1405292331676066,false,[[11,"MenuState"],[7,[0,3]]]],[3,20,null,6607246602107232,false,[[1,[2,"MenuEnemyList"]],[13]]]]],[0,null,false,null,7950566497686138,[[3,35,null,2,false,false,false,2008325799079652,false,[[1,[2,"MenuFightEnemy"]]]]],[[56,46,null,2505710701175432,false],[49,36,null,2495747864607295,false],[-1,21,null,1227979589177662,false,[[11,"MenuState"],[7,[0,0]]]],[54,57,null,7657581620941345,false,[[3,0]]],[-1,31,null,3316594948575533,false,[[4,17],[5,[2,"CombatZone"]],[0,[0,320]],[0,[0,320]]]],[39,80,null,3250334883889174,false]],[[0,null,false,null,754988948996322,[[-1,39,null,0,false,false,false,6183074325203731,false,[[7,[19,81,[[19,82,[[0,2]]]]]],[8,0],[7,[0,0]]]]],[[-1,31,null,7512067984290795,false,[[4,20],[5,[2,"CombatZone"]],[0,[20,14,60,false,null]],[0,[0,320]]]],[20,30,null,9169170292594498,false,[[10,0],[7,[0,0]]]],[20,83,null,5323693829514045,false]]],[0,null,false,null,47160922787582,[[-1,43,null,0,false,false,false,7218500820545577,false]],[[-1,31,null,2140753046910981,false,[[4,20],[5,[2,"CombatZone"]],[0,[20,14,62,false,null]],[0,[0,320]]]],[20,30,null,7524257726896618,false,[[10,0],[7,[0,2]]]],[20,83,null,1710816100879708,false]]]]],[0,null,false,null,3725343884561161,[[17,44,null,0,false,false,false,201332726797952,false,[[10,0],[8,0],[7,[0,0]]]]],[[20,47,null,1755423660926816,false,[[0,[4,[20,20,76,false,null],[6,[6,[19,84,[[6,[21,20,false,null,0],[0,90]]]],[19,85]],[0,360]]]]]]],[[0,null,false,null,7051818317091061,[[20,44,null,0,false,false,false,3781874006009849,false,[[10,0],[8,0],[7,[0,0]]]],[20,86,null,0,false,false,false,2727812874846617,false,[[8,4],[0,[20,14,62,false,null]]]]],[[20,46,null,7132492899965348,false],[17,30,null,5070626853507707,false,[[10,0],[7,[0,2]]]],[-1,31,null,4333049570660826,false,[[4,50],[5,[2,"Enemies"]],[0,[0,272]],[0,[0,76]]]],[50,25,null,8054308759858593,false,[[7,[2,"MISS"]]]],[50,32,null,3849853044523412,false,[[10,7],[7,[0,1]]]],[50,87,null,5385909024181278,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,75]]]],[50,87,null,8988484607743672,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,75]]]],[50,87,null,5259100110167526,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,75]]]],[3,20,null,9564045043535074,false,[[1,[2,"StartAttack"]],[13]]]]],[0,null,false,null,9441420734207613,[[-1,43,null,0,false,false,false,780970255271250,false],[20,44,null,0,false,false,false,287623577799614,false,[[10,0],[8,0],[7,[0,2]]]],[20,86,null,0,false,false,false,7259131711117052,false,[[8,2],[0,[20,14,60,false,null]]]]],[[20,46,null,9706703264785084,false],[17,30,null,8497970520091358,false,[[10,0],[7,[0,2]]]],[-1,31,null,2334877850460002,false,[[4,50],[5,[2,"Enemies"]],[0,[0,272]],[0,[0,76]]]],[50,25,null,7042778576973567,false,[[7,[2,"MISS"]]]],[50,32,null,6137173581093592,false,[[10,7],[7,[0,1]]]],[50,87,null,6206359133040834,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,75]]]],[50,87,null,1233054758990541,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,75]]]],[50,87,null,6220368380105728,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,75]]]],[3,20,null,645567994106001,false,[[1,[2,"StartAttack"]],[13]]]]],[0,null,false,null,4112656876844759,[[-1,43,null,0,false,false,false,254183015047013,false],[2,44,null,0,false,false,false,3949978678550207,false,[[10,4],[8,4],[7,[21,2,false,null,11]]]]],[[17,30,null,3462362621041137,false,[[10,0],[7,[0,1]]]],[20,88,null,6122618086121465,false,[[3,0]]],[-1,31,null,1168342453551187,false,[[4,21],[5,[2,"Enemies"]],[0,[0,0]],[0,[0,0]]]],[21,89,null,4084799552402932,false,[[0,[1,1.5]]]],[21,47,null,7250406197002293,false,[[0,[20,25,76,false,null]]]],[21,90,null,7182343775218483,false,[[0,[5,[20,25,77,false,null],[0,96]]]]],[5,29,null,5050089995289068,false,[[2,["playerfight",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[25,30,null,4688554665763953,false,[[10,2],[7,[0,1]]]]]]]],[0,null,false,null,3342789435537529,[[17,44,null,0,false,false,false,5022607280351217,false,[[10,0],[8,0],[7,[0,2]]]]],[[17,91,null,2679718477923082,false,[[0,[5,[20,17,92,false,null],[6,[19,85],[0,960]]]]]],[17,93,null,6362149838514267,false,[[0,[5,[20,17,94,false,null],[6,[19,85],[0,240]]]]]]],[[0,null,false,null,9448273322944295,[[17,95,null,0,false,false,false,8229197367535508,false,[[8,3],[0,[0,0]]]]],[[17,46,null,1123107187879709,false]]]]],[0,null,false,null,9396032906556436,[[21,96,null,1,false,false,false,8347742866765497,false,[[1,[2,"Default"]]]]],[[21,46,null,1115858108333321,false]]],[0,null,false,null,5745093407184255,[[3,35,null,2,false,false,false,2354149708905511,false,[[1,[2,"MenuAct"]]]]],[[56,46,null,7055489516107744,false],[49,36,null,5911009930611075,false],[3,20,null,6408759864074876,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuBattle"]]]]],[-1,21,null,8405735541208392,false,[[11,"MenuState"],[7,[0,3]]]],[3,20,null,1816510242271139,false,[[1,[2,"MenuEnemyList"]],[13]]]]],[0,null,false,null,7804753675638632,[[3,35,null,2,false,false,false,372784626825399,false,[[1,[2,"MenuActEnemy"]]]]],[[56,46,null,3469618219357269,false],[49,36,null,6879063204349359,false],[3,20,null,9898822667382134,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuAct"]]]]],[-1,21,null,2139165468364985,false,[[11,"MenuState"],[7,[0,3]]]],[3,20,null,250405060356076,false,[[1,[2,"CreateMenuItem"]],[13,[7,[2,"CombatZone"]],[7,[0,64]],[7,[0,272]],[7,[0,0]],[7,[2,"* Check"]],[7,[2,"MenuCheckSans"]]]]]]],[0,null,false,null,1692605911933929,[[3,35,null,2,false,false,false,9701130642461183,false,[[1,[2,"MenuCheckSans"]]]]],[[56,46,null,9655043778862738,false],[49,36,null,9438899527612639,false],[-1,21,null,2620726080634939,false,[[11,"MenuState"],[7,[0,0]]]],[-1,31,null,2662309208083313,false,[[4,49],[5,[2,"CombatZone"]],[0,[0,48]],[0,[0,272]]]],[49,73,null,7750985060116913,false,[[0,[0,544]],[0,[0,96]]]],[49,74,null,114711987025923,false,[[0,[0,2]]]],[49,25,null,4205585603188199,false,[[7,[2,""]]]],[49,32,null,8302002307835332,false,[[10,2],[7,[2,"* SANS 1 ATK 1 DEF\n* The easiest enemy.\n* Can only deal 1 damage."]]]],[49,32,null,7783602027376122,false,[[10,0],[7,[2,"InfoText"]]]],[49,32,null,7245588627868631,false,[[10,3],[7,[2,"StartAttack"]]]],[49,97,null,695507833767016,false,[[10,4],[3,1]]],[54,57,null,9524031638952571,false,[[3,0]]]],[[0,null,false,null,6194424643602372,[[25,44,null,0,false,false,false,9421943027712113,false,[[10,1],[8,4],[7,[0,0]]]]],[[49,32,null,3340722237681074,false,[[10,3],[7,[2,"MenuCheckSans2"]]]]]]]],[0,null,false,null,7340450766097089,[[3,35,null,2,false,false,false,4258958947274744,false,[[1,[2,"MenuCheckSans2"]]]]],[[-1,31,null,9921004734970456,false,[[4,49],[5,[2,"CombatZone"]],[0,[0,48]],[0,[0,272]]]],[49,73,null,1852508439781489,false,[[0,[0,544]],[0,[0,96]]]],[49,74,null,4438216182801967,false,[[0,[0,2]]]],[49,25,null,9414362141358894,false,[[7,[2,""]]]],[49,32,null,7697488528991464,false,[[10,2],[7,[2,"* Can't keep dodging forever.\n* Keep attacking."]]]],[49,32,null,1065982881486434,false,[[10,0],[7,[2,"InfoText"]]]],[49,32,null,7370334323802911,false,[[10,3],[7,[2,"StartAttack"]]]],[49,97,null,1593059177039637,false,[[10,4],[3,1]]]]],[0,null,false,null,7862764277777504,[[3,35,null,2,false,false,false,1093655594575745,false,[[1,[2,"MenuItem"]]]]],[],[[1,"X",0,0,false,false,831689070335536,false],[1,"Y",0,0,false,false,243059583337533,false],[1,"Text",1,"",false,false,785327950664429,false],[0,null,false,null,742535640295667,[[57,98,null,0,false,false,false,615881203655612,false,[[3,0],[8,0],[0,[0,0]]]]],[[61,99,null,273281429820039,false,[[3,0],[3,0]]]]],[0,null,false,null,691393088852222,[[57,98,null,0,false,false,false,514578272185741,false,[[3,0],[8,4],[0,[0,0]]]]],[[56,46,null,458686589538686,false],[49,36,null,3019807917076695,false],[3,20,null,5861341751558878,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuBattle"]]]]],[-1,21,null,8246474885727713,false,[[11,"MenuState"],[7,[0,3]]]],[-1,31,null,6617115073471764,false,[[4,49],[5,[2,"CombatZone"]],[0,[0,384]],[0,[0,336]]]],[49,73,null,2708739099675103,false,[[0,[0,256]],[0,[0,32]]]],[49,74,null,2397875778075625,false,[[0,[0,2]]]],[49,25,null,8274116410221162,false,[[7,[2,"PAGE 1"]]]],[49,32,null,6081845998597264,false,[[10,0],[7,[2,"Page"]]]]]],[0,null,false,null,3620767596368567,[[57,98,null,0,false,false,false,8268883817649351,false,[[3,0],[8,4],[0,[0,0]]]],[-1,100,null,0,true,false,false,7807218187680878,false,[[1,[2,""]],[0,[0,0]],[0,[19,101,[[0,3],[5,[20,57,41,false,null],[0,1]]]]]]]],[[-1,21,null,457263215673719,false,[[11,"X"],[7,[4,[0,64],[6,[8,[19,102],[0,2]],[0,256]]]]]],[-1,21,null,235055641832448,false,[[11,"Y"],[7,[4,[0,272],[6,[19,81,[[7,[19,102],[0,2]]]],[0,32]]]]]],[-1,21,null,986254003597480,false,[[11,"Text"],[7,[10,[2,"* "],[20,58,103,false,null,[[20,57,103,false,null,[[19,102]]],[0,3]]]]]]],[3,20,null,123728439530942,false,[[1,[2,"CreateMenuItem"]],[13,[7,[2,"CombatZone"]],[7,[23,"X"]],[7,[23,"Y"]],[7,[19,102]],[7,[23,"Text"]],[7,[2,"MenuUseItem"]]]]]]],[0,null,false,null,4842958941051859,[[57,98,null,0,false,false,false,5638827142756409,false,[[3,0],[8,4],[0,[0,4]]]],[-1,100,null,0,true,false,false,657575987580296,false,[[1,[2,""]],[0,[0,0]],[0,[5,[5,[20,57,41,false,null],[0,4]],[0,1]]]]]],[[-1,21,null,799596495344293,false,[[11,"X"],[7,[4,[0,704],[6,[8,[19,102],[0,2]],[0,256]]]]]],[-1,21,null,707227502595257,false,[[11,"Y"],[7,[4,[0,272],[6,[19,81,[[7,[19,102],[0,2]]]],[0,32]]]]]],[-1,21,null,792974765153701,false,[[11,"Text"],[7,[10,[2,"* "],[20,58,103,false,null,[[20,57,103,false,null,[[4,[19,102],[0,4]]]],[0,3]]]]]]],[3,20,null,888139108766780,false,[[1,[2,"CreateMenuItem"]],[13,[7,[2,"CombatZone"]],[7,[23,"X"]],[7,[23,"Y"]],[7,[4,[19,102],[0,4]]],[7,[23,"Text"]],[7,[2,"MenuUseItem"]]]]]]]]],[0,null,false,null,6227047937506172,[[3,35,null,2,false,false,false,2129594459313304,false,[[1,[2,"MenuUseItem"]]]]],[[56,46,null,4707307213438234,false],[49,36,null,6142302341098431,false],[54,57,null,9465328367494064,false,[[3,0]]]],[[1,"ItemSlot",0,0,true,false,7619863468526407,false],[1,"ItemID",0,0,true,false,2148666786435995,false],[0,null,false,null,1007861767193437,[[-1,37,null,0,false,false,false,2053222228262061,false]],[[-1,21,null,789338294568401,false,[[11,"MenuState"],[7,[0,0]]]],[-1,21,null,3944512256438253,false,[[11,"ItemSlot"],[7,[20,61,103,false,null,[[5,[20,61,41,false,null],[0,2]]]]]]],[-1,21,null,7331208373698826,false,[[11,"ItemID"],[7,[20,57,103,false,null,[[23,"ItemSlot"]]]]]]],[[0,null,false,null,2662165339991944,[[58,104,null,0,false,false,false,2360499825543442,false,[[0,[23,"ItemID"]],[0,[0,0]],[8,0],[7,[0,0]]]]],[[-1,105,null,1900272840803563,false,[[11,"HP"],[7,[20,58,103,false,null,[[23,"ItemID"],[0,1]]]]]],[5,29,null,2915182819935039,false,[[2,["playerheal",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[-1,31,null,6714699484739134,false,[[4,49],[5,[2,"CombatZone"]],[0,[0,48]],[0,[0,272]]]],[49,73,null,4176880778301639,false,[[0,[0,544]],[0,[0,96]]]],[49,74,null,8300686202119284,false,[[0,[0,2]]]],[49,25,null,2783668341228197,false,[[7,[2,""]]]],[49,32,null,8525105579362746,false,[[10,2],[7,[10,[10,[10,[10,[10,[10,[2,"* You eat the "],[20,58,103,false,null,[[23,"ItemID"],[0,2]]]],[2,"."]],[19,106]],[2,"* You recovered "]],[20,58,103,false,null,[[23,"ItemID"],[0,1]]]],[2," HP!"]]]]],[49,32,null,4979570658458923,false,[[10,0],[7,[2,"InfoText"]]]],[49,32,null,8843743648355896,false,[[10,3],[7,[2,"StartAttack"]]]],[49,97,null,9149347642381097,false,[[10,4],[3,1]]],[57,107,null,2830073791898047,false,[[0,[23,"ItemSlot"]],[3,0]]]]]]]]],[0,null,false,null,8345038226955278,[[3,35,null,2,false,false,false,2185414344056239,false,[[1,[2,"MenuMercy"]]]]],[[56,46,null,8782380560236155,false],[49,36,null,4537259580924028,false],[3,20,null,9517532625372192,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuBattle"]]]]],[-1,21,null,4117540312022349,false,[[11,"MenuState"],[7,[0,3]]]],[3,20,null,986631449476559,false,[[1,[2,"CreateMenuItem"]],[13,[7,[2,"CombatZone"]],[7,[0,64]],[7,[0,272]],[7,[0,0]],[7,[2,"* Spare"]],[7,[2,"MenuSpare"]]]]]]],[0,null,false,null,9387295331607676,[[3,35,null,2,false,false,false,2261434248788803,false,[[1,[2,"MenuSpare"]]]]],[[56,46,null,6614875834860559,false],[49,36,null,9250353767696502,false],[-1,21,null,3259281702960783,false,[[11,"MenuState"],[7,[0,0]]]],[54,57,null,3039766785703016,false,[[3,0]]],[3,20,null,9941547115107519,false,[[1,[2,"StartAttack"]],[13]]]]],[0,null,false,null,7393186591573135,[[-1,27,null,0,false,false,false,5888937219670024,false,[[11,"MenuState"],[8,5],[7,[0,2]]]]],[[3,20,null,6120825575624965,false,[[1,[2,"RunMenu"]],[13]]]]],[0,null,false,null,4473679509989835,[[-1,27,null,0,false,false,false,4851714474982156,false,[[11,"MenuState"],[8,0],[7,[0,3]]]],[61,79,null,0,false,false,false,6520947288284373,false,[[0,[0,0]],[8,0],[7,[21,12,false,null,0]]]]],[],[[0,null,false,null,7089953694302271,[[56,44,null,0,false,false,false,2713197222232229,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[],[[0,null,false,null,5359232889938205,[[56,86,null,0,false,false,false,3898197670243461,false,[[8,4],[0,[0,640]]]],[-1,109,null,0,false,false,false,8910617830524817,false,[[4,56]]]],[[56,47,null,4715810166993641,false,[[0,[5,[20,56,76,false,null],[0,640]]]]]]],[0,null,false,null,4014295535968194,[[56,86,null,0,false,false,false,9805456830202698,false,[[8,2],[0,[0,0]]]],[-1,109,null,0,false,false,false,6868798629412406,false,[[4,56]]]],[[56,47,null,411136203222039,false,[[0,[4,[20,56,76,false,null],[0,640]]]]]]]]],[0,null,false,null,3605994392407135,[[49,24,null,0,false,false,false,2160425951955605,false,[[10,0],[8,0],[7,[2,"Page"]]]]],[[49,25,null,3088408406826475,false,[[7,[10,[2,"PAGE "],[4,[19,81,[[7,[20,61,108,false,null],[0,4]]]],[0,1]]]]]]]]]],[0,null,false,null,2790404048819955,[[-1,27,null,0,false,false,false,8052797835042288,false,[[11,"MenuState"],[8,0],[7,[0,0]]]]],[[68,23,null,7380528160669397,false,[[1,[2,"Default"]],[3,1]]]]],[0,null,false,null,486188455166491,[[-1,27,null,0,false,false,false,3054894846741044,false,[[11,"MenuState"],[8,0],[7,[0,1]]]],[68,44,null,0,false,false,false,3483228208004455,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[[54,110,null,5758182527997727,false,[[4,68],[7,[2,"Heart"]]]]]],[0,null,false,null,8459416245762627,[[-1,27,null,0,false,false,false,5061366700001748,false,[[11,"MenuState"],[8,0],[7,[0,2]]]]],[[68,23,null,9206404532822444,false,[[1,[2,"Default"]],[3,1]]]],[[0,null,false,null,5642268728313976,[[68,44,null,0,false,false,false,4349589048501137,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[[54,110,null,9048953204878883,false,[[4,68],[7,[2,"Heart"]]]],[68,23,null,1387051618545893,false,[[1,[2,"Highlight"]],[3,1]]]]]]],[0,null,false,null,1146144715011846,[[-1,27,null,0,false,false,false,7573118994746288,false,[[11,"MenuState"],[8,0],[7,[0,3]]]],[56,44,null,0,false,false,false,6287385376497079,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[[54,47,null,8449958131977987,false,[[0,[4,[20,56,76,false,null],[0,8]]]]],[54,90,null,7869414747907165,false,[[0,[4,[20,56,77,false,null],[0,12]]]]]]]]],[0,[true,"Platforms"],false,null,3247046059526553,[[-1,72,null,0,false,false,false,3247046059526553,false,[[1,[2,"Platforms"]]]]],[],[[0,null,false,null,9631639012807366,[[3,35,null,2,false,false,false,2815987978145858,false,[[1,[2,"Platform"]]]]],[[-1,31,null,369058720961412,false,[[4,33],[5,[2,"CombatZone"]],[0,[0,0]],[0,[0,0]]]],[33,111,null,212742105943149,false,[[0,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[33,112,null,9274746489804411,false,[[0,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[33,113,null,2511279037063441,false,[[0,[19,70,[[20,3,38,false,null,[[0,2]]]]]]]],[33,58,null,6876936158790014,false,[[10,3],[7,[19,70,[[20,3,38,false,null,[[0,3]]]]]]]],[33,58,null,9199261823635591,false,[[10,4],[7,[19,70,[[20,3,38,false,null,[[0,4]]]]]]]],[33,114,null,2494174793803164,false,[[10,5],[3,0]]],[33,115,"CustomMovement",6405075619004544,false,[[0,[6,[21,33,false,null,3],[0,90]]]]],[33,50,"CustomMovement",5092772345420677,false,[[3,0],[0,[21,33,false,null,4]]]],[33,116,null,9768457756577862,false],[34,113,null,2966521472588935,false,[[0,[20,33,117,false,null]]]],[34,118,null,7282752314224728,false,[[3,0],[4,33]]]],[[0,null,false,null,9126553085993209,[[-1,39,null,0,false,false,false,6881932833609794,false,[[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]],[8,4],[7,[0,0]]]]],[[33,114,null,6198566400341324,false,[[10,5],[3,1]]]]]]],[0,null,false,null,5309655196018656,[[3,35,null,2,false,false,false,9655670484418262,false,[[1,[2,"PlatformRepeat"]]]]],[],[[1,"StartX",0,0,false,false,1803210070491253,false],[1,"StartY",0,0,false,false,7433021567839822,false],[1,"Width",0,0,false,false,5990115615969101,false],[1,"Direction",0,0,false,false,4562635435713475,false],[1,"Speed",0,0,false,false,5682376711498838,false],[1,"Count",0,0,false,false,6922656479090199,false],[1,"Spacing",0,0,false,false,7942428391785151,false],[0,null,false,null,6584434875354622,[[-1,37,null,0,false,false,false,9002277791436293,false]],[[-1,21,null,4447440590180383,false,[[11,"StartX"],[7,[20,3,38,false,null,[[0,0]]]]]],[-1,21,null,4230248564781192,false,[[11,"StartY"],[7,[20,3,38,false,null,[[0,1]]]]]],[-1,21,null,3727847365239543,false,[[11,"Width"],[7,[20,3,38,false,null,[[0,2]]]]]],[-1,21,null,8282350448283509,false,[[11,"Direction"],[7,[20,3,38,false,null,[[0,3]]]]]],[-1,21,null,6559452504720742,false,[[11,"Speed"],[7,[20,3,38,false,null,[[0,4]]]]]],[-1,21,null,9712986363413548,false,[[11,"Count"],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[-1,21,null,3386246294220744,false,[[11,"Spacing"],[7,[19,70,[[20,3,38,false,null,[[0,6]]]]]]]]]],[0,null,false,null,8586929881106777,[[-1,100,null,0,true,false,false,807367888064395,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[],[[1,"X",0,0,false,false,3503273987452801,false],[1,"Y",0,0,false,false,9763780033714756,false],[0,null,false,null,2788703311074668,[[-1,37,null,0,false,false,false,1999533144466509,false]],[[-1,21,null,1828654989942464,false,[[11,"X"],[7,[5,[23,"StartX"],[6,[6,[19,84,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]],[-1,21,null,2038389354805268,false,[[11,"Y"],[7,[5,[23,"StartY"],[6,[6,[19,119,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]]]],[0,null,false,null,9008813809750026,[[-1,37,null,0,false,false,false,6195194129482142,false]],[[3,20,null,221431597071468,false,[[1,[2,"Platform"]],[13,[7,[23,"X"]],[7,[23,"Y"]],[7,[23,"Width"]],[7,[23,"Direction"]],[7,[23,"Speed"]]]]]]]]]]],[0,null,false,null,4757729242745173,[[-1,37,null,0,false,false,false,2640456051693999,false]],[[34,111,null,5059001767838304,false,[[0,[20,33,120,false,null]]]],[34,112,null,6897288849931354,false,[[0,[5,[20,33,121,false,null],[0,4]]]]]]],[0,null,false,null,6407609754005953,[[33,122,null,0,false,false,false,9074172379265509,false,[[10,5]]]],[],[[0,null,false,null,2014286796063766,[[33,123,null,0,false,false,false,767613607792889,false,[[10,3],[8,0],[7,[0,0]]]],[-1,124,null,0,false,false,false,9899297299217124,false,[[4,33],[7,[20,33,62,false,null]],[8,5],[7,[20,14,62,false,null]]]]],[[33,58,null,4525564594470038,false,[[10,3],[7,[0,2]]]],[33,115,"CustomMovement",4308779877126231,false,[[0,[6,[21,33,false,null,3],[0,90]]]]]]],[0,null,false,null,2326197642451197,[[33,123,null,0,false,false,false,7183128184944282,false,[[10,3],[8,0],[7,[0,1]]]],[-1,124,null,0,false,false,false,7316371743005739,false,[[4,33],[7,[20,33,63,false,null]],[8,5],[7,[20,14,63,false,null]]]]],[[33,58,null,7806869360727937,false,[[10,3],[7,[0,3]]]],[33,115,"CustomMovement",2181431407075157,false,[[0,[6,[21,33,false,null,3],[0,90]]]]]]],[0,null,false,null,6288233911435695,[[33,123,null,0,false,false,false,1395600633782715,false,[[10,3],[8,0],[7,[0,2]]]],[-1,124,null,0,false,false,false,9504140701547307,false,[[4,33],[7,[20,33,60,false,null]],[8,3],[7,[20,14,60,false,null]]]]],[[33,58,null,1154995810962161,false,[[10,3],[7,[0,0]]]],[33,115,"CustomMovement",8823289322663806,false,[[0,[6,[21,33,false,null,3],[0,90]]]]]]],[0,null,false,null,7601970929441263,[[33,123,null,0,false,false,false,1628575942205801,false,[[10,3],[8,0],[7,[0,3]]]],[-1,124,null,0,false,false,false,1651098811705133,false,[[4,33],[7,[20,33,61,false,null]],[8,3],[7,[20,14,61,false,null]]]]],[[33,58,null,7659002453561227,false,[[10,3],[7,[0,1]]]],[33,115,"CustomMovement",6116066042343552,false,[[0,[6,[21,33,false,null,3],[0,90]]]]]]]]]]],[0,[true,"PlayerMovement"],false,null,6451037740410459,[[-1,72,null,0,false,false,false,6451037740410459,false,[[1,[2,"PlayerMovement"]]]]],[],[[1,"HEART_JUMP_STRENGTH",0,180,false,true,9477825447959367,false],[1,"HEART_JUMPHOLD_CUTOFF",0,30,false,true,7658838381136613,false],[1,"HeartSpeed",0,150,false,false,1915279441809349,false],[1,"MaxFallSpeed",0,750,true,false,963626393445968,false],[0,null,false,null,4519603591679642,[[3,35,null,2,false,false,false,7145929990283956,false,[[1,[2,"HeartMode"]]]]],[],[[1,"Mode",0,0,false,false,7089854117994423,false],[0,null,false,null,9102284570401864,[[-1,37,null,0,false,false,false,3752492890442119,false]],[[-1,21,null,7910859746355213,false,[[11,"Mode"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]]]],[0,null,false,null,6976183917828049,[[-1,27,null,0,false,false,false,7373749224982496,false,[[11,"Mode"],[8,0],[7,[23,"HEARTMODE_RED"]]]]],[[54,30,null,6774895388370725,false,[[10,0],[7,[23,"HEARTMODE_RED"]]]],[54,125,null,2521070381509853,false,[[0,[0,90]]]],[54,126,null,5116171442106528,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,100]]]],[54,126,null,423629751144969,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]],[54,126,null,4676225309275375,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]]]],[0,null,false,null,7048647250825967,[[-1,27,null,0,false,false,false,4077061299943921,false,[[11,"Mode"],[8,0],[7,[23,"HEARTMODE_BLUE"]]]]],[[54,30,null,6029411188612417,false,[[10,0],[7,[23,"HEARTMODE_BLUE"]]]],[54,125,null,4497408270605832,false,[[0,[0,90]]]],[54,126,null,8525159300148916,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,0]]]],[54,126,null,1224258952403967,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[1,23.53]]]],[54,126,null,9069255816298874,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,100]]]]]]]],[0,null,false,null,3596627014458317,[[3,35,null,2,false,false,false,4882487186418314,false,[[1,[2,"HeartTeleport"]]]]],[[54,47,null,6349151504541232,false,[[0,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[54,90,null,2212084430791989,false,[[0,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[54,57,null,884393851269895,false,[[3,1]]]]],[0,null,false,null,9256317655122656,[[3,35,null,2,false,false,false,3455019398261593,false,[[1,[2,"HeartMaxFallSpeed"]]]]],[[-1,21,null,4787080644187856,false,[[11,"MaxFallSpeed"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]]]],[0,null,false,null,440749620573975,[[3,35,null,2,false,false,false,4147856299931327,false,[[1,[2,"SansSlam"]]]],[3,67,null,0,false,false,false,1993983720533496,false,[[0,[0,0]],[8,5],[7,[0,0]]]],[3,67,null,0,false,false,false,8933267425025017,false,[[0,[0,0]],[8,3],[7,[0,3]]]]],[[3,20,null,4848380437314209,false,[[1,[2,"HeartMode"]],[13,[7,[23,"HEARTMODE_BLUE"]]]]],[54,78,null,8020750525248225,false,[[10,1],[3,1]]],[54,125,null,5493186742726137,false,[[0,[6,[19,81,[[20,3,38,false,null,[[0,0]]]]],[0,90]]]]],[54,50,"CustomMovement",2206155500121323,false,[[3,1],[0,[6,[19,84,[[20,54,127,false,null]]],[23,"MaxFallSpeed"]]]]],[54,50,"CustomMovement",2679913281423387,false,[[3,2],[0,[6,[19,119,[[20,54,127,false,null]]],[23,"MaxFallSpeed"]]]]]]],[0,null,false,null,867688751715118,[[3,35,null,2,false,false,false,924414114947164,false,[[1,[2,"SansSlamDamage"]]]]],[],[[0,null,false,null,699954202075289,[[-1,39,null,0,false,false,false,161060850720440,false,[[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]],[8,0],[7,[0,0]]]]],[[54,78,null,876120573600244,false,[[10,2],[3,0]]]]],[0,null,false,null,133881813683825,[[-1,43,null,0,false,false,false,659499284193163,false]],[[54,78,null,446579325661908,false,[[10,2],[3,1]]]]]]],[0,null,false,null,8364383427250982,[[3,35,null,2,false,false,false,2541051313696924,false,[[1,[2,"HeartCheckSolid"]]]]],[[3,128,null,6052053167423699,false,[[7,[0,0]]]]],[[0,null,false,null,707209406588903,[[54,129,null,0,false,false,false,1229473919073112,false,[[4,15],[0,[20,3,38,false,null,[[0,0]]]],[0,[20,3,38,false,null,[[0,1]]]]]]],[[3,128,null,2227687214039996,false,[[7,[0,1]]]]]],[0,null,false,null,2947768587641552,[[54,129,null,0,false,false,false,5546487676890059,false,[[4,33],[0,[20,3,38,false,null,[[0,0]]]],[0,[20,3,38,false,null,[[0,1]]]]]]],[],[[0,null,false,null,4274121673613992,[[54,130,null,0,false,false,false,4253006755465429,false,[[0,[1,0.5]],[0,[0,90]]]],[33,131,null,0,false,false,false,432417104473420,false,[[8,4],[0,[20,54,77,false,null]]]],[-1,39,null,0,false,false,false,5079046125486197,false,[[7,[22,54,"CustomMovement",132,false,null]],[8,5],[7,[22,33,"CustomMovement",132,false,null]]]],[-1,39,null,0,false,false,false,3397586812559742,false,[[7,[20,54,133,false,null]],[8,3],[7,[4,[20,33,61,false,null],[0,2]]]]]],[[3,128,null,388784234645409,false,[[7,[0,1]]]]]],[0,null,false,null,2332670214936478,[[54,130,null,0,false,false,false,3079885609166868,false,[[0,[1,0.5]],[0,[0,270]]]],[33,131,null,0,false,false,false,973394053811111,false,[[8,2],[0,[20,54,77,false,null]]]],[-1,39,null,0,false,false,false,7110746590958389,false,[[7,[22,54,"CustomMovement",132,false,null]],[8,3],[7,[22,33,"CustomMovement",132,false,null]]]],[-1,39,null,0,false,false,false,5875812123797508,false,[[7,[20,54,134,false,null]],[8,5],[7,[5,[20,33,63,false,null],[0,2]]]]]],[[3,128,null,8296904830120599,false,[[7,[0,1]]]]]]]]]],[0,null,false,null,1545949766797731,[[3,35,null,2,false,false,false,2820381329491134,false,[[1,[2,"HeartJump"]]]],[54,44,null,0,false,false,false,3865492436687704,false,[[10,0],[8,0],[7,[23,"HEARTMODE_BLUE"]]]]],[],[[1,"X",0,0,false,false,9891244296404026,false],[1,"Y",0,0,false,false,2750610103410172,false],[0,null,false,null,5411474083482959,[[-1,37,null,0,false,false,false,4284174451323535,false]],[[-1,21,null,1918021057149808,false,[[11,"X"],[7,[19,84,[[20,54,127,false,null]]]]]],[-1,21,null,5220269439886397,false,[[11,"Y"],[7,[19,119,[[20,54,127,false,null]]]]]]]],[0,null,false,null,6429296102525741,[[-1,39,null,0,false,false,false,218998649350138,false,[[7,[20,3,135,false,null,[[2,"HeartCheckSolid"],[23,"X"],[23,"Y"]]]],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",1777168825379534,false,[[3,1],[0,[5,[22,54,"CustomMovement",136,false,null],[6,[23,"X"],[23,"HEART_JUMP_STRENGTH"]]]]]],[54,50,"CustomMovement",1682132183939421,false,[[3,2],[0,[5,[22,54,"CustomMovement",132,false,null],[6,[23,"Y"],[23,"HEART_JUMP_STRENGTH"]]]]]]]]]],[0,null,false,null,9436415480372662,[[54,137,"CustomMovement",1,false,false,false,5902516485872742,false],[-1,39,null,0,false,false,false,7934777497570382,false,[[7,[20,3,135,false,null,[[2,"HeartCheckSolid"],[0,0],[0,0]]]],[8,0],[7,[0,1]]]]],[],[[0,null,false,null,3807124152882196,[[54,138,null,0,false,false,false,5973563670849574,false,[[10,1]]]],[[54,78,null,7631874611043924,false,[[10,1],[3,0]]]],[[0,null,false,null,2665936604921169,[[-1,39,null,0,false,false,false,7963791802984367,false,[[7,[19,139,[[22,54,"CustomMovement",136,false,null]]]],[8,5],[7,[0,330]]]]],[[5,29,null,275756947417676,false,[[2,["playerdamaged",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[5,29,null,7693770790135112,false,[[2,["slam",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[3,20,null,130122766339402,false,[[1,[2,"SansShake"]],[13,[7,[19,81,[[7,[7,[19,139,[[22,54,"CustomMovement",136,false,null]]],[0,30]],[0,3]]]]]]]]],[[0,null,false,null,891272882330464,[[54,138,null,0,false,false,false,181156588252501,false,[[10,2]]],[-1,27,null,0,false,false,false,769416621923664,false,[[11,"HP"],[8,4],[7,[0,1]]]]],[[-1,140,null,596088198518508,false,[[11,"HP"],[7,[0,1]]]]]]]]]],[0,null,false,null,8142884415598524,[[54,141,"CustomMovement",0,false,false,false,9907373652531428,false,[[3,1],[8,2],[0,[0,0]]]]],[[54,50,"CustomMovement",3090920913979554,false,[[3,1],[0,[0,0]]]],[54,142,"CustomMovement",9306395882468301,false,[[3,0]]]]],[0,null,false,null,767846514853668,[[54,141,"CustomMovement",0,false,false,false,4435219863333672,false,[[3,1],[8,4],[0,[0,0]]]]],[[54,50,"CustomMovement",6777843723899162,false,[[3,1],[0,[0,0]]]],[54,142,"CustomMovement",4277007151946594,false,[[3,0]]]]]]],[0,null,false,null,3410576752030205,[[54,143,"CustomMovement",1,false,false,false,832277284864332,false],[-1,39,null,0,false,false,false,1141057660984274,false,[[7,[20,3,135,false,null,[[2,"HeartCheckSolid"],[0,0],[0,0]]]],[8,0],[7,[0,1]]]]],[],[[0,null,false,null,2030014392184938,[[54,138,null,0,false,false,false,1674327236374029,false,[[10,1]]]],[[54,78,null,1640786673435733,false,[[10,1],[3,0]]]],[[0,null,false,null,8205860557418577,[[-1,39,null,0,false,false,false,4816472441962145,false,[[7,[19,139,[[22,54,"CustomMovement",132,false,null]]]],[8,5],[7,[0,330]]]]],[[5,29,null,928541963036935,false,[[2,["playerdamaged",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[5,29,null,8703354903927214,false,[[2,["slam",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[3,20,null,942345758924194,false,[[1,[2,"SansShake"]],[13,[7,[19,81,[[7,[7,[19,139,[[22,54,"CustomMovement",132,false,null]]],[0,30]],[0,3]]]]]]]]],[[0,null,false,null,918143544940180,[[54,138,null,0,false,false,false,819431812410868,false,[[10,2]]],[-1,27,null,0,false,false,false,144498256752854,false,[[11,"HP"],[8,4],[7,[0,1]]]]],[[-1,140,null,147709354093065,false,[[11,"HP"],[7,[0,1]]]]]]]]]],[0,null,false,null,9108500818525514,[[54,141,"CustomMovement",0,false,false,false,6244415694329169,false,[[3,2],[8,2],[0,[0,0]]]]],[[54,50,"CustomMovement",5295234871093177,false,[[3,2],[0,[0,0]]]],[54,142,"CustomMovement",4035045668592311,false,[[3,0]]]]],[0,null,false,null,829221856931277,[[54,141,"CustomMovement",0,false,false,false,7812509782239455,false,[[3,2],[8,4],[0,[0,0]]]]],[[54,50,"CustomMovement",1653743906039325,false,[[3,2],[0,[0,0]]]],[54,142,"CustomMovement",5517555590572974,false,[[3,0]]]]]]],[0,null,false,null,1229121055144974,[[2,44,null,0,false,false,false,5258290644733366,false,[[10,5],[8,0],[7,[0,0]]]]],[[-1,21,null,2978380243308504,false,[[11,"HeartSpeed"],[7,[0,150]]]]]],[0,null,false,null,1526006386750515,[[2,44,null,0,false,false,false,6400750740507076,false,[[10,5],[8,0],[7,[0,1]]]]],[[-1,21,null,1978759350826462,false,[[11,"HeartSpeed"],[7,[0,75]]]]]],[0,null,false,null,701617408993545,[[54,44,null,0,false,false,false,8118502814546265,false,[[10,0],[8,0],[7,[23,"HEARTMODE_RED"]]]]],[],[[0,null,false,null,7819277048241078,[[2,44,null,0,false,false,false,4676100201590035,false,[[10,0],[8,0],[7,[21,2,false,null,1]]]]],[[54,50,"CustomMovement",9332402154489727,false,[[3,2],[0,[0,0]]]]]],[0,null,false,null,5440316066525873,[[2,44,null,0,false,false,false,346174852955978,false,[[10,0],[8,1],[7,[21,2,false,null,1]]]]],[],[[0,null,false,null,2169842393242289,[[2,44,null,0,false,false,false,2030855357202795,false,[[10,0],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",464440241329487,false,[[3,2],[0,[3,[23,"HeartSpeed"]]]]]]],[0,null,false,null,166601876942033,[[2,44,null,0,false,false,false,7175979820759471,false,[[10,1],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",6158313719839607,false,[[3,2],[0,[23,"HeartSpeed"]]]]]]]],[0,null,false,null,8450861581300916,[[2,44,null,0,false,false,false,5330825535789479,false,[[10,2],[8,0],[7,[21,2,false,null,3]]]]],[[54,50,"CustomMovement",3339092452323598,false,[[3,1],[0,[0,0]]]]]],[0,null,false,null,7840755801501252,[[2,44,null,0,false,false,false,5913742682899929,false,[[10,2],[8,1],[7,[21,2,false,null,3]]]]],[],[[0,null,false,null,82654574843299,[[2,44,null,0,false,false,false,3372505977109605,false,[[10,2],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",8992959987159648,false,[[3,1],[0,[3,[23,"HeartSpeed"]]]]]]],[0,null,false,null,6838256879645256,[[2,44,null,0,false,false,false,7590908534073493,false,[[10,3],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",4942206811190521,false,[[3,1],[0,[23,"HeartSpeed"]]]]]]]]]],[0,null,false,null,4272043091444084,[[54,44,null,0,false,false,false,2247573656404247,false,[[10,0],[8,0],[7,[23,"HEARTMODE_BLUE"]]]]],[],[[1,"DownSpeed",0,0,false,false,542820942674276,false],[1,"Gravity",0,0,false,false,5736367099838918,false],[0,null,false,null,7834292363010873,[[54,130,null,0,false,false,false,5760920225358032,false,[[0,[1,0.5]],[0,[0,0]]]]],[],[[0,null,false,null,5566320554485508,[[2,44,null,0,false,false,false,8170634150133423,false,[[10,2],[8,4],[7,[21,2,false,null,9]]]]],[[3,20,null,1704679581256191,false,[[1,[2,"HeartJump"]],[13]]]]],[0,null,false,null,5965161198429997,[[2,44,null,0,false,false,false,3555706857014998,false,[[10,2],[8,2],[7,[21,2,false,null,9]]]],[54,141,"CustomMovement",0,false,false,false,638353723962329,false,[[3,1],[8,2],[0,[3,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]],[[54,50,"CustomMovement",321658193371436,false,[[3,1],[0,[3,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]]],[0,null,false,null,639484880784249,[[-1,37,null,0,false,false,false,340913804520019,false]],[[-1,21,null,386600400644187,false,[[11,"DownSpeed"],[7,[22,54,"CustomMovement",136,false,null]]]]]]]],[0,null,false,null,6776293954885638,[[54,130,null,0,false,false,false,6871575678330835,false,[[0,[1,0.5]],[0,[0,90]]]]],[],[[0,null,false,null,1432182632489061,[[2,44,null,0,false,false,false,2645461980121637,false,[[10,0],[8,4],[7,[21,2,false,null,7]]]]],[[3,20,null,8860456215561423,false,[[1,[2,"HeartJump"]],[13]]]]],[0,null,false,null,5049423388907501,[[2,44,null,0,false,false,false,5302205804747884,false,[[10,0],[8,2],[7,[21,2,false,null,7]]]],[54,141,"CustomMovement",0,false,false,false,247672766563090,false,[[3,2],[8,2],[0,[3,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]],[[54,50,"CustomMovement",358632230415739,false,[[3,2],[0,[3,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]]],[0,null,false,null,315017151817044,[[-1,37,null,0,false,false,false,973951699742513,false]],[[-1,21,null,604020893917843,false,[[11,"DownSpeed"],[7,[22,54,"CustomMovement",132,false,null]]]]]]]],[0,null,false,null,3278462062307887,[[54,130,null,0,false,false,false,7875782387880278,false,[[0,[1,0.5]],[0,[0,180]]]]],[],[[0,null,false,null,5104074868909384,[[2,44,null,0,false,false,false,9161041147980361,false,[[10,3],[8,4],[7,[21,2,false,null,10]]]]],[[3,20,null,5334565939210874,false,[[1,[2,"HeartJump"]],[13]]]]],[0,null,false,null,9734544860785736,[[2,44,null,0,false,false,false,9271326846317249,false,[[10,3],[8,2],[7,[21,2,false,null,10]]]],[54,141,"CustomMovement",0,false,false,false,699157627407729,false,[[3,1],[8,4],[0,[23,"HEART_JUMPHOLD_CUTOFF"]]]]],[[54,50,"CustomMovement",957928847534464,false,[[3,1],[0,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]],[0,null,false,null,252905306373820,[[-1,37,null,0,false,false,false,525452164412622,false]],[[-1,21,null,779860466627566,false,[[11,"DownSpeed"],[7,[3,[22,54,"CustomMovement",136,false,null]]]]]]]]],[0,null,false,null,569231508417743,[[54,130,null,0,false,false,false,6054468166755179,false,[[0,[1,0.5]],[0,[0,270]]]]],[],[[0,null,false,null,8668660709019562,[[2,44,null,0,false,false,false,1860315858968747,false,[[10,1],[8,4],[7,[21,2,false,null,8]]]]],[[3,20,null,1693410721667865,false,[[1,[2,"HeartJump"]],[13]]]]],[0,null,false,null,2902168592647932,[[2,44,null,0,false,false,false,183014636456794,false,[[10,1],[8,2],[7,[21,2,false,null,8]]]],[54,141,"CustomMovement",0,false,false,false,457200900638089,false,[[3,2],[8,4],[0,[23,"HEART_JUMPHOLD_CUTOFF"]]]]],[[54,50,"CustomMovement",109870714779246,false,[[3,2],[0,[23,"HEART_JUMPHOLD_CUTOFF"]]]]]],[0,null,false,null,216833888869266,[[-1,37,null,0,false,false,false,455437883844523,false]],[[-1,21,null,429988020478622,false,[[11,"DownSpeed"],[7,[3,[22,54,"CustomMovement",132,false,null]]]]]]]]],[0,null,false,null,917979822609806,[[-1,27,null,0,false,false,false,661245762472294,false,[[11,"DownSpeed"],[8,2],[7,[0,240]]]],[-1,27,null,0,false,false,false,134935846491737,false,[[11,"DownSpeed"],[8,4],[7,[0,15]]]]],[[-1,21,null,283168184338934,false,[[11,"Gravity"],[7,[0,540]]]]]],[0,null,false,null,135149629739481,[[-1,27,null,0,false,false,false,788343186255406,false,[[11,"DownSpeed"],[8,3],[7,[0,15]]]],[-1,27,null,0,false,false,false,621530337876883,false,[[11,"DownSpeed"],[8,4],[7,[0,-30]]]]],[[-1,21,null,338089297036133,false,[[11,"Gravity"],[7,[0,180]]]]]],[0,null,false,null,613198143791947,[[-1,27,null,0,false,false,false,962836060221351,false,[[11,"DownSpeed"],[8,3],[7,[0,-30]]]],[-1,27,null,0,false,false,false,747452516447481,false,[[11,"DownSpeed"],[8,4],[7,[0,-120]]]]],[[-1,21,null,776733702689768,false,[[11,"Gravity"],[7,[0,450]]]]]],[0,null,false,null,846307393036921,[[-1,27,null,0,false,false,false,656839150940424,false,[[11,"DownSpeed"],[8,3],[7,[0,-120]]]]],[[-1,21,null,872727136379418,false,[[11,"Gravity"],[7,[0,180]]]]]],[1,"X",0,0,false,false,5491853016764061,false],[1,"Y",0,0,false,false,3036505105048854,false],[0,null,false,null,2752210042070685,[[-1,37,null,0,false,false,false,6751050082466736,false]],[[-1,21,null,7205619536334176,false,[[11,"X"],[7,[19,84,[[20,54,127,false,null]]]]]],[-1,21,null,857896257174484,false,[[11,"Y"],[7,[19,119,[[20,54,127,false,null]]]]]]]],[0,null,false,null,2889909639663593,[[-1,39,null,0,false,false,false,1006797283101212,false,[[7,[20,3,135,false,null,[[2,"HeartCheckSolid"],[6,[23,"X"],[1,0.2]],[6,[23,"Y"],[1,0.2]]]]],[8,0],[7,[0,0]]]]],[[54,50,"CustomMovement",8183574702029611,false,[[3,1],[0,[4,[22,54,"CustomMovement",136,false,null],[6,[6,[23,"X"],[23,"Gravity"]],[19,85]]]]]],[54,50,"CustomMovement",8354982216422387,false,[[3,2],[0,[4,[22,54,"CustomMovement",132,false,null],[6,[6,[23,"Y"],[23,"Gravity"]],[19,85]]]]]]],[[0,null,false,null,7042864617732394,[[54,130,null,0,false,false,false,9068686466909625,false,[[0,[1,0.5]],[0,[0,0]]]],[54,141,"CustomMovement",0,false,false,false,4365895149711683,false,[[3,1],[8,4],[0,[23,"MaxFallSpeed"]]]]],[[54,50,"CustomMovement",193490226177194,false,[[3,1],[0,[23,"MaxFallSpeed"]]]]]],[0,null,false,null,1283565924752298,[[54,130,null,0,false,false,false,980393640049783,false,[[0,[1,0.5]],[0,[0,90]]]],[54,141,"CustomMovement",0,false,false,false,9079093150922397,false,[[3,2],[8,4],[0,[23,"MaxFallSpeed"]]]]],[[54,50,"CustomMovement",3312679066105649,false,[[3,2],[0,[23,"MaxFallSpeed"]]]]]],[0,null,false,null,1854889381832168,[[54,130,null,0,false,false,false,4545108149171356,false,[[0,[1,0.5]],[0,[0,180]]]],[54,141,"CustomMovement",0,false,false,false,1760488165106459,false,[[3,1],[8,2],[0,[3,[23,"MaxFallSpeed"]]]]]],[[54,50,"CustomMovement",3315412542859899,false,[[3,1],[0,[3,[23,"MaxFallSpeed"]]]]]]],[0,null,false,null,5289701580243636,[[54,130,null,0,false,false,false,2356492219698942,false,[[0,[1,0.5]],[0,[0,270]]]],[54,141,"CustomMovement",0,false,false,false,2327748867641218,false,[[3,2],[8,2],[0,[3,[23,"MaxFallSpeed"]]]]]],[[54,50,"CustomMovement",1222091811139472,false,[[3,2],[0,[3,[23,"MaxFallSpeed"]]]]]]]]],[0,null,true,null,5501495930111006,[[54,130,null,0,false,false,false,4779713263158662,false,[[0,[1,0.5]],[0,[0,0]]]],[54,130,null,0,false,false,false,2545042841264074,false,[[0,[1,0.5]],[0,[0,180]]]]],[],[[0,null,false,null,9232010070302832,[[-1,37,null,0,false,false,false,1220066627448464,false]],[[54,50,"CustomMovement",9831439999687661,false,[[3,2],[0,[0,0]]]]]],[0,null,false,null,7532191741336616,[[2,44,null,0,false,false,false,1067432302351496,false,[[10,0],[8,1],[7,[21,2,false,null,1]]]]],[],[[0,null,false,null,4110442250652859,[[2,44,null,0,false,false,false,9224737314380219,false,[[10,0],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",5736971532976749,false,[[3,2],[0,[5,[22,54,"CustomMovement",132,false,null],[23,"HeartSpeed"]]]]]]],[0,null,false,null,9352480350443857,[[2,44,null,0,false,false,false,8267226548895268,false,[[10,1],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",6158255050406937,false,[[3,2],[0,[4,[22,54,"CustomMovement",132,false,null],[23,"HeartSpeed"]]]]]]]]]]],[0,null,true,null,381865873108478,[[54,130,null,0,false,false,false,6299557429759355,false,[[0,[1,0.5]],[0,[0,90]]]],[54,130,null,0,false,false,false,8251741737623924,false,[[0,[1,0.5]],[0,[0,270]]]]],[],[[0,null,false,null,3647594051341909,[[-1,37,null,0,false,false,false,1903228498503528,false]],[[54,50,"CustomMovement",4383527768039812,false,[[3,1],[0,[0,0]]]]]],[0,null,false,null,1662587883360066,[[54,129,null,0,false,false,false,9645474015641874,false,[[4,33],[0,[6,[23,"X"],[1,0.5]]],[0,[6,[23,"Y"],[1,0.5]]]]]],[],[[0,null,false,null,3892772820421064,[[54,130,null,0,false,false,false,7211764302714302,false,[[0,[1,0.5]],[0,[0,90]]]],[33,131,null,0,false,false,false,255143494575164,false,[[8,4],[0,[20,54,77,false,null]]]],[-1,39,null,0,false,false,false,2135165409665577,false,[[7,[22,54,"CustomMovement",132,false,null]],[8,5],[7,[22,33,"CustomMovement",132,false,null]]]],[-1,39,null,0,false,false,false,7091412795608504,false,[[7,[20,54,133,false,null]],[8,3],[7,[4,[20,33,61,false,null],[0,2]]]]]],[[54,50,"CustomMovement",9486694656468953,false,[[3,1],[0,[22,33,"CustomMovement",136,false,null]]]],[54,50,"CustomMovement",1962233800568643,false,[[3,2],[0,[22,33,"CustomMovement",132,false,null]]]],[54,90,null,678296909214494,false,[[0,[5,[20,33,61,false,null],[1,8.050000000000001]]]]]]],[0,null,false,null,6626973457028389,[[54,130,null,0,false,false,false,7161194949054743,false,[[0,[1,0.5]],[0,[0,270]]]],[33,131,null,0,false,false,false,299847363515336,false,[[8,2],[0,[20,54,77,false,null]]]],[-1,39,null,0,false,false,false,7133537478811266,false,[[7,[22,54,"CustomMovement",132,false,null]],[8,3],[7,[22,33,"CustomMovement",132,false,null]]]],[-1,39,null,0,false,false,false,1339551683445056,false,[[7,[20,54,134,false,null]],[8,5],[7,[5,[20,33,63,false,null],[0,2]]]]]],[[54,50,"CustomMovement",5752170370573244,false,[[3,1],[0,[22,33,"CustomMovement",136,false,null]]]],[54,50,"CustomMovement",2367640717819199,false,[[3,2],[0,[22,33,"CustomMovement",132,false,null]]]],[54,90,null,6922361484113858,false,[[0,[4,[20,33,63,false,null],[1,8.050000000000001]]]]]]]]],[0,null,false,null,7646075515960284,[[2,44,null,0,false,false,false,6005284532717279,false,[[10,2],[8,1],[7,[21,2,false,null,3]]]]],[],[[0,null,false,null,2580320878621136,[[2,44,null,0,false,false,false,6130218000240892,false,[[10,2],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",9627335578014524,false,[[3,1],[0,[5,[22,54,"CustomMovement",136,false,null],[23,"HeartSpeed"]]]]]]],[0,null,false,null,1478689516656008,[[2,44,null,0,false,false,false,8142046913599606,false,[[10,3],[8,0],[7,[0,1]]]]],[[54,50,"CustomMovement",2508461606821695,false,[[3,1],[0,[4,[22,54,"CustomMovement",136,false,null],[23,"HeartSpeed"]]]]]]]]]]]]]]],[0,[true,"Bones"],false,null,6115443361825044,[[-1,72,null,0,false,false,false,6115443361825044,false,[[1,[2,"Bones"]]]]],[],[[0,null,false,null,4695619220070591,[[3,35,null,2,false,false,false,8201177076704072,false,[[1,[2,"BoneH"]]]]],[[-1,31,null,6335808152843094,false,[[4,29],[5,[2,"CombatZone"]],[0,[0,0]],[0,[0,0]]]],[29,111,null,8796307238509984,false,[[0,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[29,112,null,9545838823100619,false,[[0,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[29,113,null,5499308793493502,false,[[0,[19,70,[[20,3,38,false,null,[[0,2]]]]]]]],[29,58,null,7683257816766734,false,[[10,0],[7,[19,70,[[20,3,38,false,null,[[0,3]]]]]]]],[29,58,null,2194861959166207,false,[[10,1],[7,[19,70,[[20,3,38,false,null,[[0,4]]]]]]]],[29,58,null,1858582448053237,false,[[10,4],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[29,58,null,5000565429672398,false,[[10,2],[7,[0,1]]]],[29,58,null,4114719680038067,false,[[10,3],[7,[0,6]]]]]],[0,null,false,null,4945953763224302,[[3,35,null,2,false,false,false,6688792887696073,false,[[1,[2,"BoneV"]]]]],[[-1,31,null,1921768329956219,false,[[4,30],[5,[2,"CombatZoneClipped"]],[0,[0,0]],[0,[0,0]]]],[30,111,null,2138972822860598,false,[[0,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[30,112,null,4944328469401855,false,[[0,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[30,144,null,218884723663614,false,[[0,[19,70,[[20,3,38,false,null,[[0,2]]]]]]]],[30,58,null,3222848869092038,false,[[10,0],[7,[19,70,[[20,3,38,false,null,[[0,3]]]]]]]],[30,58,null,1327016000237775,false,[[10,1],[7,[19,70,[[20,3,38,false,null,[[0,4]]]]]]]],[30,58,null,5267652587554797,false,[[10,4],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[30,58,null,4893010288676622,false,[[10,2],[7,[0,1]]]],[30,58,null,7645334274462566,false,[[10,3],[7,[0,6]]]],[30,116,null,295436311347752,false]]],[0,null,false,null,9491539560377136,[[3,35,null,2,false,false,false,6729546754790066,false,[[1,[2,"BoneHRepeat"]]]]],[],[[1,"StartX",0,0,false,false,3304952373868209,false],[1,"StartY",0,0,false,false,9149086149868565,false],[1,"Width",0,0,false,false,2838447776680498,false],[1,"Direction",0,0,false,false,2352640290308548,false],[1,"Speed",0,0,false,false,4792585857775303,false],[1,"Count",0,0,false,false,1081667424259682,false],[1,"Spacing",0,0,false,false,1587810333211859,false],[0,null,false,null,1042698013163945,[[-1,37,null,0,false,false,false,7287066659382528,false]],[[-1,21,null,5450737576039175,false,[[11,"StartX"],[7,[20,3,38,false,null,[[0,0]]]]]],[-1,21,null,4407325032795532,false,[[11,"StartY"],[7,[20,3,38,false,null,[[0,1]]]]]],[-1,21,null,3773883337002549,false,[[11,"Width"],[7,[20,3,38,false,null,[[0,2]]]]]],[-1,21,null,4686508511622666,false,[[11,"Direction"],[7,[20,3,38,false,null,[[0,3]]]]]],[-1,21,null,6197666896974997,false,[[11,"Speed"],[7,[20,3,38,false,null,[[0,4]]]]]],[-1,21,null,1949722830043049,false,[[11,"Count"],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[-1,21,null,8150848669929785,false,[[11,"Spacing"],[7,[19,70,[[20,3,38,false,null,[[0,6]]]]]]]]]],[0,null,false,null,171114345638357,[[-1,100,null,0,true,false,false,1362267358103699,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[],[[1,"X",0,0,false,false,4572993387764503,false],[1,"Y",0,0,false,false,3349095911907562,false],[0,null,false,null,2289925937317547,[[-1,37,null,0,false,false,false,8508500484319964,false]],[[-1,21,null,6772459455919256,false,[[11,"X"],[7,[5,[23,"StartX"],[6,[6,[19,84,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]],[-1,21,null,9368239678436128,false,[[11,"Y"],[7,[5,[23,"StartY"],[6,[6,[19,119,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]]]],[0,null,false,null,7326405877994397,[[-1,37,null,0,false,false,false,5288452416989206,false]],[[3,20,null,8498550293565633,false,[[1,[2,"BoneH"]],[13,[7,[23,"X"]],[7,[23,"Y"]],[7,[23,"Width"]],[7,[23,"Direction"]],[7,[23,"Speed"]]]]]]]]]]],[0,null,false,null,2005883927831399,[[3,35,null,2,false,false,false,4145745745981837,false,[[1,[2,"BoneVRepeat"]]]]],[],[[1,"StartX",0,0,false,false,4704803304322796,false],[1,"StartY",0,0,false,false,2027104602557222,false],[1,"Height",0,0,false,false,8315555280246232,false],[1,"Direction",0,0,false,false,3612437059538729,false],[1,"Speed",0,0,false,false,9630688813330854,false],[1,"Count",0,0,false,false,701480189046421,false],[1,"Spacing",0,0,false,false,8250130011123294,false],[0,null,false,null,2472030495346477,[[-1,37,null,0,false,false,false,511186914115708,false]],[[-1,21,null,1921417768379967,false,[[11,"StartX"],[7,[20,3,38,false,null,[[0,0]]]]]],[-1,21,null,4771960923466789,false,[[11,"StartY"],[7,[20,3,38,false,null,[[0,1]]]]]],[-1,21,null,271274961029462,false,[[11,"Height"],[7,[20,3,38,false,null,[[0,2]]]]]],[-1,21,null,705094514779531,false,[[11,"Direction"],[7,[20,3,38,false,null,[[0,3]]]]]],[-1,21,null,5404003746326457,false,[[11,"Speed"],[7,[20,3,38,false,null,[[0,4]]]]]],[-1,21,null,9872068619262539,false,[[11,"Count"],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[-1,21,null,1610581451054986,false,[[11,"Spacing"],[7,[19,70,[[20,3,38,false,null,[[0,6]]]]]]]]]],[0,null,false,null,5730075193726498,[[-1,100,null,0,true,false,false,7059627040753894,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[],[[1,"X",0,0,false,false,8995826170165568,false],[1,"Y",0,0,false,false,189405798698284,false],[0,null,false,null,6006720074805655,[[-1,37,null,0,false,false,false,604141026195968,false]],[[-1,21,null,8270178689385789,false,[[11,"X"],[7,[5,[23,"StartX"],[6,[6,[19,84,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]],[-1,21,null,5795819707185205,false,[[11,"Y"],[7,[5,[23,"StartY"],[6,[6,[19,119,[[6,[23,"Direction"],[0,90]]]],[23,"Spacing"]],[19,102]]]]]]]],[0,null,false,null,4470889229613242,[[-1,37,null,0,false,false,false,7427359563618654,false]],[[3,20,null,9908391695264444,false,[[1,[2,"BoneV"]],[13,[7,[23,"X"]],[7,[23,"Y"]],[7,[23,"Height"]],[7,[23,"Direction"]],[7,[23,"Speed"]]]]]]]]]]],[0,null,false,null,7874407939864629,[[3,35,null,2,false,false,false,5557304153597458,false,[[1,[2,"SineBones"]]]]],[],[[1,"Count",0,0,false,false,2328026726959393,false],[1,"Spacing",0,0,false,false,9735310759473924,false],[1,"Speed",0,0,false,false,4831016603122993,false],[1,"Height",0,0,false,false,4608988122798101,false],[0,null,false,null,4012993930524634,[[-1,37,null,0,false,false,false,3493738959224243,false]],[[-1,21,null,5576798655162853,false,[[11,"Count"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[-1,21,null,832417911064067,false,[[11,"Spacing"],[7,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[-1,21,null,4651965303427173,false,[[11,"Speed"],[7,[19,70,[[20,3,38,false,null,[[0,2]]]]]]]],[-1,21,null,6574288431208801,false,[[11,"Height"],[7,[19,70,[[20,3,38,false,null,[[0,3]]]]]]]]]],[0,null,false,null,1177008195547408,[[-1,100,null,0,true,false,false,4534401441306291,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[],[[1,"X",0,0,false,false,2167785410610456,false],[1,"Y",0,0,false,false,247018075250087,false],[1,"Direction",0,0,false,false,6611868805806476,false],[1,"Sine",0,0,false,false,877995795042172,false],[0,null,false,null,8170761720430026,[[-1,27,null,0,false,false,false,7771481189151521,false,[[11,"Spacing"],[8,4],[7,[0,0]]]]],[[-1,21,null,1964815491343233,false,[[11,"X"],[7,[4,[20,14,62,false,null],[6,[23,"Spacing"],[19,102]]]]]],[-1,21,null,1793100871313959,false,[[11,"Direction"],[7,[0,2]]]]]],[0,null,false,null,5785822853023925,[[-1,27,null,0,false,false,false,5700786534432352,false,[[11,"Spacing"],[8,2],[7,[0,0]]]]],[[-1,21,null,6703391063132332,false,[[11,"X"],[7,[4,[20,14,60,false,null],[6,[23,"Spacing"],[19,102]]]]]],[-1,21,null,5323392230412856,false,[[11,"Direction"],[7,[0,0]]]]]],[0,null,false,null,2324542676270603,[[-1,37,null,0,false,false,false,3793010371971784,false]],[[-1,21,null,5295110270066888,false,[[11,"Sine"],[7,[19,81,[[6,[19,119,[[6,[7,[19,102],[0,3]],[7,[0,180],[19,145]]]]],[0,28]]]]]]],[-1,21,null,8874018022337032,false,[[11,"Y"],[7,[4,[20,14,61,false,null],[0,6]]]]],[3,20,null,5474577295388418,false,[[1,[2,"BoneV"]],[13,[7,[23,"X"]],[7,[23,"Y"]],[7,[4,[23,"Height"],[23,"Sine"]]],[7,[23,"Direction"]],[7,[23,"Speed"]]]]],[-1,21,null,5850534579460353,false,[[11,"Y"],[7,[4,[4,[4,[4,[20,14,61,false,null],[0,6]],[23,"Height"]],[23,"Sine"]],[0,39]]]]],[3,20,null,6690824928379348,false,[[1,[2,"BoneV"]],[13,[7,[23,"X"]],[7,[23,"Y"]],[7,[5,[5,[20,14,63,false,null],[0,5]],[23,"Y"]]],[7,[23,"Direction"]],[7,[23,"Speed"]]]]]]]]]]],[0,null,false,null,7242887601740154,[[-1,37,null,0,false,false,false,3339253616376555,false]],[[66,111,null,4819181239399137,false,[[0,[4,[20,66,120,false,null],[6,[6,[19,84,[[6,[21,66,false,null,0],[0,90]]]],[19,85]],[21,66,false,null,1]]]]]],[66,112,null,9511004865351975,false,[[0,[4,[20,66,121,false,null],[6,[6,[19,119,[[6,[21,66,false,null,0],[0,90]]]],[19,85]],[21,66,false,null,1]]]]]]]],[0,null,false,null,9346276530620288,[[66,123,null,0,false,false,false,6371831305785946,false,[[10,0],[8,0],[7,[0,0]]]],[66,146,null,0,false,false,false,8385053853285411,false,[[8,4],[0,[19,147]]]]],[[66,56,null,8143634483334599,false]]],[0,null,false,null,2921467206626509,[[66,123,null,0,false,false,false,1652415523519459,false,[[10,0],[8,0],[7,[0,1]]]],[66,131,null,0,false,false,false,4642540456013245,false,[[8,4],[0,[19,148]]]]],[[66,56,null,2307588444060088,false]]],[0,null,false,null,7827747784341243,[[66,123,null,0,false,false,false,2964616211683889,false,[[10,0],[8,0],[7,[0,2]]]],[66,146,null,0,false,false,false,5561741352048132,false,[[8,2],[0,[3,[20,66,117,false,null]]]]]],[[66,56,null,2725143340197782,false]]],[0,null,false,null,4047963762474039,[[66,123,null,0,false,false,false,193450742983817,false,[[10,0],[8,0],[7,[0,3]]]],[66,131,null,0,false,false,false,7782475219212968,false,[[8,2],[0,[3,[20,66,149,false,null]]]]]],[[66,56,null,4669589797262984,false]]]]],[0,[true,"BoneStab"],false,null,4452238531787863,[[-1,72,null,0,false,false,false,4452238531787863,false,[[1,[2,"BoneStab"]]]]],[],[[0,null,false,null,1340338318293687,[[3,35,null,2,false,false,false,5161608648624166,false,[[1,[2,"BoneStab"]]]],[3,67,null,0,false,false,false,8623393264624121,false,[[0,[0,0]],[8,5],[7,[0,0]]]],[3,67,null,0,false,false,false,2757101445182581,false,[[0,[0,0]],[8,3],[7,[0,3]]]]],[[-1,31,null,2107935248255651,false,[[4,37],[5,[2,"CombatZone"]],[0,[0,0]],[0,[0,0]]]],[37,58,null,9490272931115954,false,[[10,3],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[37,58,null,8002164738401968,false,[[10,4],[7,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[37,58,null,8721150784582342,false,[[10,5],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]],[37,58,null,9991357837883326,false,[[10,6],[7,[19,69,[[20,3,38,false,null,[[0,3]]]]]]]],[5,29,null,2724812214603569,false,[[2,["warning",false]],[3,0],[0,[0,0]],[1,[2,""]]]]],[[0,null,false,null,9348642362281845,[[37,123,null,0,false,false,false,205588146040937,false,[[10,3],[8,0],[7,[0,0]]]]],[[37,150,null,2513578292720741,false,[[0,[5,[21,37,false,null,4],[0,3]]],[0,[5,[20,14,149,false,null],[0,16]]]]],[37,111,null,2397766455560709,false,[[0,[5,[5,[20,14,62,false,null],[20,37,117,false,null]],[0,8]]]]],[37,112,null,8720648752702355,false,[[0,[4,[20,14,61,false,null],[0,8]]]]]]],[0,null,false,null,1561914356770358,[[37,123,null,0,false,false,false,7304507528536564,false,[[10,3],[8,0],[7,[0,1]]]]],[[37,150,null,8626020738513608,false,[[0,[5,[20,14,117,false,null],[0,16]]],[0,[5,[21,37,false,null,4],[0,3]]]]],[37,111,null,7558301742950217,false,[[0,[4,[20,14,60,false,null],[0,8]]]]],[37,112,null,7297696114230697,false,[[0,[5,[5,[20,14,63,false,null],[20,37,149,false,null]],[0,8]]]]]]],[0,null,false,null,1899453948577846,[[37,123,null,0,false,false,false,8819407007330675,false,[[10,3],[8,0],[7,[0,2]]]]],[[37,150,null,5269357307969557,false,[[0,[5,[21,37,false,null,4],[0,3]]],[0,[5,[20,14,149,false,null],[0,16]]]]],[37,111,null,2735724526760587,false,[[0,[4,[20,14,60,false,null],[0,8]]]]],[37,112,null,2994932871330008,false,[[0,[4,[20,14,61,false,null],[0,8]]]]]]],[0,null,false,null,3076444330393388,[[37,123,null,0,false,false,false,9598925365877061,false,[[10,3],[8,0],[7,[0,3]]]]],[[37,150,null,4172203071817315,false,[[0,[5,[20,14,117,false,null],[0,16]]],[0,[5,[21,37,false,null,4],[0,3]]]]],[37,111,null,8581573932938081,false,[[0,[4,[20,14,60,false,null],[0,8]]]]],[37,112,null,6296508984861089,false,[[0,[4,[20,14,61,false,null],[0,8]]]]]]]]],[0,null,false,null,179366366815195,[[37,123,null,0,false,false,false,1646402712491064,false,[[10,5],[8,0],[7,[0,0]]]],[-1,75,null,0,true,false,false,8568633134616531,false,[[4,37]]]],[[5,29,null,8766038470293481,false,[[2,["bonestab",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[37,56,null,5051201238736224,false]],[[1,"UID",0,0,false,false,7051213049009635,false],[0,null,true,null,9882414836398687,[[37,123,null,0,false,false,false,2338831003140246,false,[[10,3],[8,0],[7,[0,1]]]],[37,123,null,0,false,false,false,294891378654081,false,[[10,3],[8,0],[7,[0,3]]]]],[[-1,31,null,2220649710892782,false,[[4,35],[5,[2,"CombatZoneClipped"]],[0,[0,0]],[0,[0,0]]]],[-1,21,null,1301750889277443,false,[[11,"UID"],[7,[20,35,151,false,null]]]],[35,111,null,6455594120384907,false,[[0,[20,14,120,false,null]]]],[35,150,null,165315616023782,false,[[0,[20,14,117,false,null]],[0,[4,[21,37,false,null,4],[0,8]]]]],[35,58,null,9109896907121545,false,[[10,2],[7,[20,35,120,false,null]]]],[35,58,null,586952918594669,false,[[10,6],[7,[0,1]]]],[35,58,null,2432076473351,false,[[10,7],[7,[0,6]]]]],[[0,null,false,null,8805919178036764,[[37,123,null,0,false,false,false,556271473765041,false,[[10,3],[8,0],[7,[0,1]]]]],[[35,112,null,5623795346493465,false,[[0,[5,[20,14,63,false,null],[0,5]]]]],[35,58,null,81376050637213,false,[[10,3],[7,[5,[5,[20,14,63,false,null],[0,5]],[21,37,false,null,4]]]]]]],[0,null,false,null,1489400481910891,[[37,123,null,0,false,false,false,9845818906215123,false,[[10,3],[8,0],[7,[0,3]]]]],[[35,112,null,4097127110598233,false,[[0,[5,[4,[20,14,121,false,null],[0,5]],[20,35,149,false,null]]]]],[35,58,null,4938813587389536,false,[[10,3],[7,[4,[5,[4,[20,14,121,false,null],[0,5]],[20,35,149,false,null]],[21,37,false,null,4]]]]]]]]],[0,null,true,null,1314749273324808,[[37,123,null,0,false,false,false,5029918560574852,false,[[10,3],[8,0],[7,[0,0]]]],[37,123,null,0,false,false,false,8938763101967713,false,[[10,3],[8,0],[7,[0,2]]]]],[[-1,31,null,320505711595604,false,[[4,36],[5,[2,"CombatZoneClipped"]],[0,[0,0]],[0,[0,0]]]],[-1,21,null,5620759173718257,false,[[11,"UID"],[7,[20,36,151,false,null]]]],[36,112,null,5358450598431938,false,[[0,[20,14,121,false,null]]]],[36,150,null,7223957262692911,false,[[0,[4,[21,37,false,null,4],[0,8]]],[0,[20,14,149,false,null]]]],[36,58,null,8926402622256336,false,[[10,3],[7,[20,36,121,false,null]]]],[36,58,null,5938073132448245,false,[[10,6],[7,[0,1]]]],[36,58,null,2563513741162476,false,[[10,7],[7,[0,6]]]]],[[0,null,false,null,7412910331525125,[[37,123,null,0,false,false,false,3482668440570089,false,[[10,3],[8,0],[7,[0,0]]]]],[[36,111,null,6020046384037341,false,[[0,[5,[20,14,62,false,null],[0,5]]]]],[36,58,null,2579663874535773,false,[[10,2],[7,[5,[5,[20,14,62,false,null],[0,5]],[21,37,false,null,4]]]]]]],[0,null,false,null,7869160999451764,[[37,123,null,0,false,false,false,3451033497761795,false,[[10,3],[8,0],[7,[0,2]]]]],[[36,111,null,5198036474947823,false,[[0,[5,[4,[20,14,120,false,null],[0,5]],[20,36,117,false,null]]]]],[36,58,null,6768008717003056,false,[[10,2],[7,[4,[5,[4,[20,14,120,false,null],[0,5]],[20,36,117,false,null]],[21,37,false,null,4]]]]]]]]],[0,null,false,null,1884891807682965,[[65,152,null,0,false,false,true,6805783523358998,false,[[0,[23,"UID"]]]]],[[65,58,null,60007658659544,false,[[10,0],[7,[21,37,false,null,3]]]],[65,58,null,3351255747541614,false,[[10,1],[7,[21,37,false,null,4]]]],[65,58,null,4099091628366011,false,[[10,4],[7,[21,37,false,null,6]]]],[65,116,null,4923772995666917,false]]]]],[0,null,false,null,2753177728307644,[[37,123,null,0,false,false,false,7201213319062762,false,[[10,5],[8,4],[7,[0,0]]]]],[[37,153,null,7933810031926785,false,[[10,5],[7,[19,101,[[19,85],[21,37,false,null,5]]]]]]]],[0,null,false,null,7272801516837756,[[-1,75,null,0,true,false,false,5059500036946687,false,[[4,65]]]],[],[[1,"Speed",0,0,false,false,9937279706392961,false],[0,null,false,null,8726638545503583,[[-1,37,null,0,false,false,false,6807700169267526,false]],[[-1,21,null,5642713146071244,false,[[11,"Speed"],[7,[6,[21,65,false,null,1],[0,10]]]]]]],[0,null,false,null,994987823670902,[[65,122,null,0,false,false,false,3273505563228002,false,[[10,5]]]],[[65,111,null,1747664872374846,false,[[0,[4,[20,65,120,false,null],[6,[6,[19,84,[[6,[21,65,false,null,0],[0,90]]]],[19,85]],[23,"Speed"]]]]]],[65,112,null,2367333379553796,false,[[0,[4,[20,65,121,false,null],[6,[6,[19,119,[[6,[21,65,false,null,0],[0,90]]]],[19,85]],[23,"Speed"]]]]]]]],[0,null,false,null,2217368260165624,[[65,122,null,0,false,true,false,6617418402064323,false,[[10,5]]]],[[65,111,null,9573514436273826,false,[[0,[5,[20,65,120,false,null],[6,[6,[19,84,[[6,[21,65,false,null,0],[0,90]]]],[19,85]],[23,"Speed"]]]]]],[65,112,null,3154741230882895,false,[[0,[5,[20,65,121,false,null],[6,[6,[19,119,[[6,[21,65,false,null,0],[0,90]]]],[19,85]],[23,"Speed"]]]]]]],[[0,null,false,null,2991008598773225,[[-1,154,null,0,false,false,false,9761775752300883,false,[[0,[6,[21,65,false,null,0],[0,90]]],[0,[1,0.5]],[0,[19,155,[[20,65,120,false,null],[20,65,121,false,null],[21,65,false,null,2],[21,65,false,null,3]]]]]]],[[65,111,null,6164838157393738,false,[[0,[21,65,false,null,2]]]],[65,112,null,868226897298936,false,[[0,[21,65,false,null,3]]]]]],[0,null,false,null,8580988082190855,[[65,146,null,0,false,false,false,9474437911007055,false,[[8,0],[0,[21,65,false,null,2]]]],[65,131,null,0,false,false,false,2383952081665929,false,[[8,0],[0,[21,65,false,null,3]]]]],[[65,153,null,5636678873133447,false,[[10,4],[7,[19,101,[[19,85],[21,65,false,null,4]]]]]]],[[0,null,false,null,3363534254198478,[[65,123,null,0,false,false,false,1783950449660463,false,[[10,4],[8,0],[7,[0,0]]]]],[[65,114,null,5987922517835066,false,[[10,5],[3,1]]]]]]]]],[0,null,false,null,4429792160523137,[[65,156,null,0,false,false,false,3894645370565744,false]],[[65,56,null,6639380671927361,false]]]]]]],[0,[true,"GasterBlasters"],false,null,5367209213685925,[[-1,72,null,0,false,false,false,5367209213685925,false,[[1,[2,"GasterBlasters"]]]]],[],[[1,"STATE_ENTER",0,0,false,true,6025819211814532,false],[1,"STATE_WAIT",0,1,false,true,1444854150869288,false],[1,"STATE_FIRE",0,2,false,true,6109100335991361,false],[1,"STATE_LEAVE",0,3,false,true,3232882216312546,false],[0,null,false,null,2658564671799936,[[3,35,null,2,false,false,false,1406315163400518,false,[[1,[2,"GasterBlaster"]]]]],[[-1,31,null,4850230570626132,false,[[4,32],[5,[2,"CombatZone"]],[0,[0,0]],[0,[0,0]]]],[32,89,null,657117304239559,false,[[0,[0,1]]]],[32,30,null,1149088466060506,false,[[10,2],[7,[0,90]]]],[32,30,null,5221785884330876,false,[[10,6],[7,[23,"STATE_ENTER"]]]],[32,125,null,3264361790729957,false,[[0,[21,32,false,null,2]]]],[5,55,null,4465756482301942,false,[[1,[2,"GasterBlaster"]]]],[5,29,null,9831362822163861,false,[[2,["gasterblaster",false]],[3,0],[0,[0,0]],[1,[2,"GasterBlaster"]]]],[5,68,null,6330413995695288,false,[[1,[2,""]],[0,[1,1.2]]]],[31,157,null,194140213150549,false,[[3,0],[4,32]]],[40,157,null,493863240508335,false,[[3,0],[4,31]]],[41,157,null,350803109602527,false,[[3,0],[4,40]]],[42,157,null,135938976474316,false,[[3,0],[4,41]]]],[[1,"Size",0,0,false,false,8132531473101679,false],[0,null,false,null,8024151431122815,[[-1,37,null,0,false,false,false,6127507536994582,false]],[[-1,21,null,5744141922209516,false,[[11,"Size"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[32,47,null,7245128507129891,false,[[0,[19,70,[[20,3,38,false,null,[[0,1]]]]]]]],[32,90,null,6554849276418642,false,[[0,[19,70,[[20,3,38,false,null,[[0,2]]]]]]]],[32,30,null,5613305025619084,false,[[10,3],[7,[19,70,[[20,3,38,false,null,[[0,3]]]]]]]],[32,30,null,2624847864983611,false,[[10,4],[7,[19,70,[[20,3,38,false,null,[[0,4]]]]]]]],[32,30,null,3271771390667652,false,[[10,5],[7,[19,70,[[20,3,38,false,null,[[0,5]]]]]]]],[32,30,null,3994398512260249,false,[[10,7],[7,[20,3,38,false,null,[[0,6]]]]]],[31,158,null,2117638882385145,false,[[10,0],[7,[20,3,38,false,null,[[0,7]]]]]]]],[0,null,false,null,9720000584590003,[[32,86,null,0,false,false,false,8225847651561501,false,[[8,0],[0,[21,32,false,null,3]]]],[32,159,null,0,false,false,false,7504639193013916,false,[[8,0],[0,[21,32,false,null,4]]]]],[[32,30,null,9226155637607007,false,[[10,2],[7,[21,32,false,null,5]]]],[32,125,null,5646759059698645,false,[[0,[21,32,false,null,2]]]]]],[0,null,false,null,781274357941241,[[-1,27,null,0,false,false,false,2431142631325608,false,[[11,"Size"],[8,0],[7,[0,0]]]]],[[32,91,null,1962048039868494,false,[[0,[6,[20,32,160,false,null],[0,2]]]]]]],[0,null,false,null,2472663152537064,[[-1,27,null,0,false,false,false,9997861449127766,false,[[11,"Size"],[8,0],[7,[0,1]]]]],[[32,91,null,1708307028367507,false,[[0,[6,[20,32,160,false,null],[0,2]]]]],[32,161,null,1941162365233034,false,[[0,[6,[20,32,162,false,null],[0,2]]]]]]],[0,null,false,null,3566245028259716,[[-1,27,null,0,false,false,false,856760887640775,false,[[11,"Size"],[8,0],[7,[0,2]]]]],[[32,91,null,8589103973669968,false,[[0,[6,[20,32,160,false,null],[0,3]]]]],[32,161,null,1941185310990107,false,[[0,[6,[20,32,162,false,null],[0,3]]]]]]]]],[0,null,false,null,4750901613192945,[[32,44,null,0,false,false,false,5394163651654076,false,[[10,7],[8,4],[7,[0,0]]]]],[],[[0,null,true,null,5282306456505121,[[32,44,null,0,false,false,false,507270873646482,false,[[10,6],[8,0],[7,[23,"STATE_WAIT"]]]],[32,44,null,0,false,false,false,6147662749583684,false,[[10,6],[8,0],[7,[23,"STATE_FIRE"]]]]],[[32,163,null,8874714389461553,false,[[10,7],[7,[19,101,[[19,85],[21,32,false,null,7]]]]]]]]]],[0,null,false,null,32683587507531,[[32,44,null,0,false,false,false,936008692522378,false,[[10,6],[8,0],[7,[23,"STATE_ENTER"]]]]],[],[[0,null,false,null,2257182194428982,[[-1,124,null,0,false,false,false,8486442877099754,false,[[4,32],[7,[19,139,[[5,[20,32,76,false,null],[21,32,false,null,3]]]]],[8,5],[7,[0,3]]]]],[[32,47,null,824199236057777,false,[[0,[4,[20,32,76,false,null],[6,[6,[5,[21,32,false,null,3],[20,32,76,false,null]],[19,85]],[0,10]]]]]]]],[0,null,false,null,7939844409306387,[[-1,124,null,0,false,false,false,4967001454692661,false,[[4,32],[7,[19,139,[[5,[20,32,76,false,null],[21,32,false,null,3]]]]],[8,2],[7,[0,3]]]]],[[32,47,null,9397830425996823,false,[[0,[21,32,false,null,3]]]]]],[0,null,false,null,3648564676972542,[[-1,124,null,0,false,false,false,8590376688958131,false,[[4,32],[7,[19,139,[[5,[20,32,77,false,null],[21,32,false,null,4]]]]],[8,5],[7,[0,3]]]]],[[32,90,null,9277784136575257,false,[[0,[4,[20,32,77,false,null],[6,[6,[5,[21,32,false,null,4],[20,32,77,false,null]],[19,85]],[0,10]]]]]]]],[0,null,false,null,3176353281903474,[[-1,124,null,0,false,false,false,5298549015731435,false,[[4,32],[7,[19,139,[[5,[20,32,77,false,null],[21,32,false,null,4]]]]],[8,2],[7,[0,3]]]]],[[32,90,null,5269847953738641,false,[[0,[21,32,false,null,4]]]]]],[0,null,false,null,1758728454490341,[[-1,124,null,0,false,false,false,4330060530324832,false,[[4,32],[7,[19,139,[[5,[21,32,false,null,2],[21,32,false,null,5]]]]],[8,5],[7,[0,3]]]]],[[32,30,null,1078810318702649,false,[[10,2],[7,[4,[21,32,false,null,2],[6,[6,[5,[21,32,false,null,5],[21,32,false,null,2]],[19,85]],[0,10]]]]]],[32,125,null,8980896246237487,false,[[0,[21,32,false,null,2]]]]]],[0,null,false,null,8259410896561525,[[-1,124,null,0,false,false,false,707213778872806,false,[[4,32],[7,[19,139,[[5,[21,32,false,null,2],[21,32,false,null,5]]]]],[8,2],[7,[0,3]]]]],[[32,30,null,3011355039136081,false,[[10,2],[7,[21,32,false,null,5]]]],[32,125,null,4472261125321684,false,[[0,[21,32,false,null,2]]]]]],[0,null,false,null,7624115147232561,[[32,86,null,0,false,false,false,840112621534296,false,[[8,0],[0,[21,32,false,null,3]]]],[32,159,null,0,false,false,false,7757798153307168,false,[[8,0],[0,[21,32,false,null,4]]]],[32,44,null,0,false,false,false,259998853047641,false,[[10,2],[8,0],[7,[21,32,false,null,5]]]]],[[32,30,null,9712397301553563,false,[[10,6],[7,[23,"STATE_WAIT"]]]]]]]],[0,null,false,null,3609104702798818,[[32,44,null,0,false,false,false,8255400006483448,false,[[10,6],[8,0],[7,[23,"STATE_WAIT"]]]]],[],[[0,null,false,null,6494083736718617,[[32,44,null,0,false,false,false,4741042098127282,false,[[10,7],[8,0],[7,[0,0]]]]],[[32,23,null,5795387787404132,false,[[1,[2,"Fire"]],[3,1]]],[32,30,null,6194080520768276,false,[[10,6],[7,[23,"STATE_FIRE"]]]],[32,30,null,9974399310278428,false,[[10,7],[7,[1,0.1]]]]]]]],[0,null,false,null,1508476191314488,[[32,44,null,0,false,false,false,1594257125313681,false,[[10,6],[8,0],[7,[23,"STATE_FIRE"]]]]],[],[[0,null,false,null,5128645906828253,[[32,44,null,0,false,false,false,538782629091691,false,[[10,7],[8,0],[7,[0,0]]]]],[[32,30,null,9908544497508108,false,[[10,6],[7,[23,"STATE_LEAVE"]]]],[31,164,null,3030736890258935,false,[[3,1]]],[40,164,null,334795134963692,false,[[3,1]]],[41,164,null,534528986737835,false,[[3,1]]],[42,158,null,2600151717672333,false,[[10,0],[7,[0,1]]]],[42,158,null,9378633162546508,false,[[10,1],[7,[0,10]]]],[5,55,null,6080608424724769,false,[[1,[2,"GasterBlast"]]]],[5,55,null,862009595167511,false,[[1,[2,"GasterBlast2"]]]],[5,29,null,3009617997729409,false,[[2,["gasterblast",false]],[3,0],[0,[0,0]],[1,[2,"GasterBlast"]]]],[5,68,null,6759438315639086,false,[[1,[2,""]],[0,[1,1.2]]]],[5,29,null,9817974725864405,false,[[2,["gasterblast2",false]],[3,0],[0,[0,0]],[1,[2,"GasterBlast2"]]]],[5,68,null,2703179175507274,false,[[1,[2,""]],[0,[1,1.2]]]]],[[0,null,false,null,886159456465880,[[32,165,null,0,false,false,false,506984972378850,false,[[8,4],[0,[20,32,162,false,null]]]]],[[3,20,null,149265419648710,false,[[1,[2,"SansShake"]],[13,[7,[0,5]]]]]]]]]]],[0,null,false,null,1674420422637861,[[32,44,null,0,false,false,false,9574400673383393,false,[[10,6],[8,0],[7,[23,"STATE_LEAVE"]]]]],[[32,52,null,1907195994494986,false,[[10,8],[7,[0,30]]]]],[[0,null,false,null,2819522012857443,[[32,166,null,0,false,false,false,3339067526755888,false]],[[32,30,null,9675638484738389,false,[[10,8],[7,[0,0]]]]]],[0,null,false,null,9700910487445297,[[-1,37,null,0,false,false,false,9951129075547659,false]],[[32,47,null,2174661474750014,false,[[0,[5,[20,32,76,false,null],[6,[6,[19,84,[[20,32,127,false,null]]],[19,85]],[21,32,false,null,8]]]]]],[32,90,null,4794895644351898,false,[[0,[5,[20,32,77,false,null],[6,[6,[19,119,[[20,32,127,false,null]]],[19,85]],[21,32,false,null,8]]]]]]]]]],[0,null,false,null,9849569799604486,[[31,167,null,0,false,false,false,3068783491998972,false]],[[31,168,null,8584458927014005,false,[[10,1],[7,[19,85]]]]],[[0,null,false,null,1069996621873694,[[31,169,null,0,false,false,false,3660630967937648,false,[[10,1],[8,2],[7,[1,0.1333333333333333]]]]],[[31,168,null,8224636756538163,false,[[10,2],[7,[6,[6,[19,81,[[6,[0,35],[7,[7,[20,32,170,false,null],[20,32,162,false,null]],[0,4]]]]],[19,85]],[0,30]]]]]]],[0,null,false,null,5344464273138173,[[31,169,null,0,false,false,false,9882464044940844,false,[[10,1],[8,5],[7,[1,0.1333333333333333]]]],[31,169,null,0,false,false,false,294755662274402,false,[[10,1],[8,2],[7,[4,[1,0.1333333333333333],[19,85]]]]]],[[31,158,null,1972737510883382,false,[[10,2],[7,[6,[0,35],[7,[20,32,170,false,null],[20,32,162,false,null]]]]]]]],[0,null,false,null,7754391366361445,[[31,169,null,0,false,false,false,9668690311636743,false,[[10,1],[8,4],[7,[4,[1,0.1666666666666667],[21,31,false,null,0]]]]]],[[31,158,null,2737882451125881,false,[[10,2],[7,[6,[21,31,false,null,2],[9,[1,0.8],[6,[19,85],[0,30]]]]]]],[31,171,null,7232055394715955,false,[[0,[5,[0,100],[6,[5,[6,[5,[21,31,false,null,1],[21,31,false,null,0]],[0,30]],[0,5]],[0,10]]]]]]],[[0,null,false,null,3458741314551572,[[31,169,null,0,false,false,false,385484557272392,false,[[10,2],[8,3],[7,[0,2]]]]],[[32,46,null,7099705968390514,false]]]]],[0,null,false,null,448060430861031,[[31,172,null,0,false,false,false,7139969211329192,false,[[8,3],[0,[0,80]]]]],[[42,158,null,4837433704481348,false,[[10,0],[7,[0,0]]]],[42,164,null,168322436237805,false,[[3,0]]]]],[0,null,false,null,7225642069126172,[[-1,37,null,0,false,false,false,1923266302409765,false]],[[31,158,null,5295908500638102,false,[[10,3],[7,[6,[19,119,[[6,[6,[21,31,false,null,1],[1,20]],[7,[0,180],[19,145]]]]],[7,[21,31,false,null,2],[0,4]]]]]],[31,173,null,2351205795153705,false,[[0,[4,[21,31,false,null,2],[21,31,false,null,3]]]]],[40,173,null,986795216070762,false,[[0,[4,[7,[21,31,false,null,2],[1,1.25]],[21,31,false,null,3]]]]],[41,173,null,663633254672557,false,[[0,[4,[7,[21,31,false,null,2],[0,2]],[21,31,false,null,3]]]]],[42,173,null,305993147012933,false,[[0,[6,[21,31,false,null,2],[1,0.75]]]]]]]]],[0,null,false,null,66841022965886,[[-1,75,null,0,true,false,false,1645014954474109,false,[[4,32]]]],[],[[1,"Scale",0,0,false,false,438648770353117,false],[0,null,false,null,472476662332690,[[-1,37,null,0,false,false,false,415140715668028,false]],[[-1,21,null,410817023556141,false,[[11,"Scale"],[7,[7,[7,[20,32,170,false,null],[20,32,162,false,null]],[0,2]]]]],[31,174,null,964270930542363,false,[[0,[4,[20,32,76,false,null],[6,[6,[19,84,[[20,32,127,false,null]]],[0,70]],[23,"Scale"]]]]]],[31,175,null,220887220223385,false,[[0,[4,[20,32,77,false,null],[6,[6,[19,119,[[20,32,127,false,null]]],[0,70]],[23,"Scale"]]]]]],[31,176,null,7586561644070464,false,[[0,[20,32,127,false,null]]]],[31,177,null,3595740796843345,false,[[0,[0,1000]]]],[40,174,null,470891254885413,false,[[0,[4,[20,32,76,false,null],[6,[6,[19,84,[[20,32,127,false,null]]],[0,60]],[23,"Scale"]]]]]],[40,175,null,839006218212202,false,[[0,[4,[20,32,77,false,null],[6,[6,[19,119,[[20,32,127,false,null]]],[0,60]],[23,"Scale"]]]]]],[40,176,null,869769952645532,false,[[0,[20,32,127,false,null]]]],[40,177,null,138064161277121,false,[[0,[6,[0,10],[23,"Scale"]]]]],[40,171,null,394920566669603,false,[[0,[20,31,178,false,null]]]],[41,174,null,537745316046277,false,[[0,[4,[20,32,76,false,null],[6,[6,[19,84,[[20,32,127,false,null]]],[0,50]],[23,"Scale"]]]]]],[41,175,null,695779907480235,false,[[0,[4,[20,32,77,false,null],[6,[6,[19,119,[[20,32,127,false,null]]],[0,50]],[23,"Scale"]]]]]],[41,176,null,392444011482823,false,[[0,[20,32,127,false,null]]]],[41,177,null,503010633724381,false,[[0,[6,[0,20],[23,"Scale"]]]]],[41,171,null,457710453788763,false,[[0,[20,31,178,false,null]]]],[42,174,null,247211766602194,false,[[0,[4,[20,32,76,false,null],[6,[6,[19,84,[[20,32,127,false,null]]],[0,70]],[23,"Scale"]]]]]],[42,175,null,749030365749420,false,[[0,[4,[20,32,77,false,null],[6,[6,[19,119,[[20,32,127,false,null]]],[0,70]],[23,"Scale"]]]]]],[42,176,null,996717214578906,false,[[0,[20,32,127,false,null]]]],[42,177,null,503004939969375,false,[[0,[0,1000]]]]]]]]]],[0,[true,"MenuBones"],false,null,6787425766297465,[[-1,72,null,0,false,false,false,6787425766297465,false,[[1,[2,"MenuBones"]]]]],[],[[1,"BottomBones",0,0,true,false,9909730646709937,false],[1,"BottomBoneTimer",0,0,true,false,2101703704976127,false],[1,"BottomBoneAlternate",0,0,true,false,9606556173175612,false],[0,null,false,null,1524699358515961,[[3,35,null,2,false,false,false,3260428070072786,false,[[1,[2,"MenuBonesOff"]]]]],[[39,78,null,2547283341792006,false,[[10,3],[3,1]]],[-1,21,null,8296348287965188,false,[[11,"BottomBones"],[7,[0,0]]]]]],[0,null,false,null,6027212922507375,[[3,35,null,2,false,false,false,8648115497030825,false,[[1,[2,"MenuBoneLeft"]]]]],[[-1,31,null,7983893881520992,false,[[4,39],[5,[2,"CombatZone"]],[0,[0,-10]],[0,[0,270]]]],[39,30,null,8224056418517312,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,1304563435875326,[[3,35,null,2,false,false,false,6966543157008351,false,[[1,[2,"MenuBoneBottom"]]]]],[[-1,21,null,6336215758346847,false,[[11,"BottomBones"],[7,[0,1]]]],[-1,21,null,5704799274625452,false,[[11,"BottomBoneTimer"],[7,[0,0]]]],[-1,21,null,9549479429566423,false,[[11,"BottomBoneAlternate"],[7,[0,0]]]]]],[0,null,false,null,1244150053346782,[[-1,37,null,0,false,false,false,7327507191190074,false]],[[39,52,null,1590731161524127,false,[[10,2],[7,[19,85]]]],[39,47,null,9611831941945107,false,[[0,[4,[0,-30],[6,[19,139,[[19,119,[[6,[0,600],[7,[21,39,false,null,2],[19,145]]]]]]],[0,105]]]]]]]],[0,null,false,null,6959282898600845,[[39,86,null,0,false,false,false,8388229330867978,false,[[8,4],[0,[0,64]]]]],[[39,163,null,7798573221366565,false,[[10,2],[7,[6,[19,85],[1,0.72]]]]]]],[0,null,false,null,761203234264403,[[39,138,null,0,false,false,false,6926810728277473,false,[[10,3]]],[39,86,null,0,false,false,false,4201701422842248,false,[[8,3],[0,[0,-8]]]]],[[39,46,null,8146145082314541,false]]],[0,null,false,null,2631191724952368,[[-1,27,null,0,false,false,false,4327013774613964,false,[[11,"BottomBones"],[8,0],[7,[0,1]]]]],[[-1,105,null,6800674342035073,false,[[11,"BottomBoneTimer"],[7,[19,85]]]]],[[0,null,false,null,8862033881827157,[[-1,27,null,0,false,false,false,1693510165502654,false,[[11,"BottomBoneTimer"],[8,5],[7,[1,0.6]]]]],[[-1,140,null,6131406413898467,false,[[11,"BottomBoneTimer"],[7,[1,0.6]]]]],[[0,null,false,null,2965630122074297,[[-1,37,null,0,false,false,false,9146411182654963,false]],[[-1,31,null,8053414733988241,false,[[4,38],[5,[2,"CombatZone"]],[0,[0,0]],[0,[19,148]]]],[38,30,null,3030307659837008,false,[[10,0],[7,[0,1]]]],[38,30,null,8068044741609472,false,[[10,3],[7,[4,[0,0],[23,"BottomBoneAlternate"]]]]]],[[0,null,false,null,3836254460286833,[[68,44,null,0,false,false,false,3500418704679505,false,[[10,0],[8,0],[7,[21,38,false,null,3]]]]],[[38,47,null,9978692944789917,false,[[0,[20,68,179,false,null]]]]]]]],[0,null,false,null,9545819741242389,[[-1,37,null,0,false,false,false,2837241879327366,false]],[[-1,31,null,1085992507948589,false,[[4,38],[5,[2,"CombatZone"]],[0,[0,0]],[0,[19,148]]]],[38,30,null,9051686628527372,false,[[10,0],[7,[0,1]]]],[38,30,null,8674600451055565,false,[[10,3],[7,[4,[0,2],[23,"BottomBoneAlternate"]]]]]],[[0,null,false,null,9425231169514075,[[68,44,null,0,false,false,false,7780501400170002,false,[[10,0],[8,0],[7,[21,38,false,null,3]]]]],[[38,47,null,2208617704789096,false,[[0,[20,68,179,false,null]]]]]]]],[0,null,false,null,4671189475830525,[[-1,27,null,0,false,false,false,8975478842129828,false,[[11,"BottomBoneAlternate"],[8,0],[7,[0,0]]]]],[[-1,21,null,5043129334982446,false,[[11,"BottomBoneAlternate"],[7,[0,1]]]]]],[0,null,false,null,8477233208553018,[[-1,43,null,0,false,false,false,5492714767170548,false]],[[-1,21,null,7817792214383908,false,[[11,"BottomBoneAlternate"],[7,[0,0]]]]]]]]]],[0,null,false,null,5896323666357314,[[38,44,null,0,false,false,false,9421352968463758,false,[[10,2],[8,0],[7,[0,0]]]]],[[38,90,null,3245990873972808,false,[[0,[5,[20,38,77,false,null],[6,[0,300],[19,85]]]]]]],[[0,null,false,null,309608023603553,[[38,159,null,0,false,false,false,1795937577468815,false,[[8,3],[0,[0,440]]]]],[[38,90,null,9348746876111773,false,[[0,[0,440]]]],[38,30,null,8891407594263872,false,[[10,2],[7,[0,1]]]]]]]],[0,null,false,null,8627521089641379,[[38,44,null,0,false,false,false,7656432745895088,false,[[10,2],[8,0],[7,[0,1]]]]],[[38,47,null,6530105182171334,false,[[0,[5,[20,38,76,false,null],[6,[0,150],[19,85]]]]]]],[[0,null,false,null,2273708934010512,[[-1,75,null,0,true,false,false,1352140000598205,false,[[4,38]]],[68,44,null,0,false,false,false,2187750820510814,false,[[10,0],[8,0],[7,[21,38,false,null,3]]]],[38,86,null,0,false,false,false,845382217823097,false,[[8,3],[0,[5,[20,68,180,false,null],[0,14]]]]]],[[38,47,null,8178191939738451,false,[[0,[5,[20,68,180,false,null],[0,14]]]]],[38,30,null,6142133452533904,false,[[10,2],[7,[0,2]]]]]]]],[0,null,false,null,3108236516319589,[[38,44,null,0,false,false,false,5682528329720289,false,[[10,2],[8,0],[7,[0,2]]]]],[[38,90,null,6952969021128685,false,[[0,[4,[20,38,77,false,null],[6,[0,300],[19,85]]]]]]]],[0,null,false,null,4542016451242249,[[38,159,null,0,false,false,false,3332742192396933,false,[[8,4],[0,[19,148]]]]],[[38,46,null,2131072312897306,false]]]]],[0,[true,"CombatZone"],false,null,5205752066196878,[[-1,72,null,0,false,false,false,5205752066196878,false,[[1,[2,"CombatZone"]]]]],[],[[1,"ResizeSpeed",0,480,true,false,3111584688851152,false],[1,"EndResize",1,"",true,false,1052618449272991,false],[0,null,false,null,1994005836547195,[[-1,17,null,1,false,false,false,1807642351770676,false]],[[-1,21,null,804361015836670,false,[[11,"ResizeSpeed"],[7,[0,480]]]],[-1,21,null,534585765566689,false,[[11,"EndResize"],[7,[2,""]]]],[-1,31,null,9749115502510345,false,[[4,22],[5,[2,"CombatZoneClipped"]],[0,[0,0]],[0,[0,0]]]]],[[0,null,false,null,9173818709145874,[[-1,100,null,0,true,false,false,1421302886201406,false,[[1,[2,""]],[0,[0,1]],[0,[0,4]]]]],[[-1,31,null,7044419168812326,false,[[4,15],[5,[2,"Overlay"]],[0,[0,0]],[0,[0,0]]]]]],[0,null,false,null,7531691835210184,[[-1,42,null,0,false,false,false,8225951422591187,false],[-1,100,null,0,true,false,false,7463668100104028,false,[[1,[2,""]],[0,[0,1]],[0,[0,4]]]]],[[-1,31,null,5374771152406007,false,[[4,16],[5,[2,"CombatZoneClipped"]],[0,[0,0]],[0,[0,0]]]]]]]],[0,null,false,null,1220229971017148,[[3,35,null,2,false,false,false,2428964465357012,false,[[1,[2,"CombatZoneSpeed"]]]]],[[-1,21,null,3604372948766954,false,[[11,"ResizeSpeed"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]]]],[0,null,false,null,8446668151117507,[[3,35,null,2,false,false,false,2082778929781038,false,[[1,[2,"CombatZoneResize"]]]]],[[14,58,null,8495548187329399,false,[[10,0],[7,[20,3,38,false,null,[[0,0]]]]]],[14,58,null,7291919029681907,false,[[10,1],[7,[20,3,38,false,null,[[0,1]]]]]],[14,58,null,5931810798706615,false,[[10,2],[7,[20,3,38,false,null,[[0,2]]]]]],[14,58,null,9884464551460068,false,[[10,3],[7,[20,3,38,false,null,[[0,3]]]]]],[-1,21,null,2548616998699604,false,[[11,"EndResize"],[7,[20,3,38,false,null,[[0,4]]]]]],[14,71,null,281252981976426,false,[[3,1]]]]],[0,null,false,null,278515304984462,[[3,35,null,2,false,false,false,6527128447718451,false,[[1,[2,"CombatZoneResizeInstant"]]]]],[[14,58,null,8987229946428039,false,[[10,0],[7,[20,3,38,false,null,[[0,0]]]]]],[14,58,null,8839178400636274,false,[[10,1],[7,[20,3,38,false,null,[[0,1]]]]]],[14,58,null,3168334016544474,false,[[10,2],[7,[20,3,38,false,null,[[0,2]]]]]],[14,58,null,51179399044296,false,[[10,3],[7,[20,3,38,false,null,[[0,3]]]]]],[14,111,null,4671240898637096,false,[[0,[21,14,false,null,0]]]],[14,112,null,13026246800948,false,[[0,[21,14,false,null,1]]]],[14,113,null,9301120396405725,false,[[0,[5,[21,14,false,null,2],[21,14,false,null,0]]]]],[14,144,null,3833498593527551,false,[[0,[5,[21,14,false,null,3],[21,14,false,null,1]]]]],[3,20,null,7621577053245351,false,[[1,[2,"CombatZoneTick"]],[13]]],[14,71,null,9393039340572411,false,[[3,1]]]]],[0,null,false,null,108488896335629,[[3,35,null,2,false,false,false,6144407888875221,false,[[1,[2,"CombatZoneTick"]]]]],[],[[1,"X1",0,0,false,false,2938465910360831,false],[1,"Y1",0,0,false,false,3827975978748361,false],[1,"X2",0,0,false,false,9771410858338166,false],[1,"Y2",0,0,false,false,9263445035945821,false],[0,null,false,null,5855940988484335,[[-1,37,null,0,false,false,false,6186186893494962,false]],[[-1,21,null,35045500759905,false,[[11,"X1"],[7,[19,101,[[6,[23,"ResizeSpeed"],[19,85]],[19,139,[[5,[20,14,60,false,null],[21,14,false,null,0]]]]]]]]],[-1,21,null,6495776330673365,false,[[11,"Y1"],[7,[19,101,[[6,[23,"ResizeSpeed"],[19,85]],[19,139,[[5,[20,14,61,false,null],[21,14,false,null,1]]]]]]]]],[-1,21,null,2959779381600239,false,[[11,"X2"],[7,[19,101,[[6,[23,"ResizeSpeed"],[19,85]],[19,139,[[5,[20,14,62,false,null],[21,14,false,null,2]]]]]]]]],[-1,21,null,4088474984147814,false,[[11,"Y2"],[7,[19,101,[[6,[23,"ResizeSpeed"],[19,85]],[19,139,[[5,[20,14,63,false,null],[21,14,false,null,3]]]]]]]]]]],[0,null,false,null,7760368312590458,[[-1,39,null,0,false,false,false,7207409652410026,false,[[7,[20,14,60,false,null]],[8,4],[7,[21,14,false,null,0]]]]],[[14,111,null,8220687750217417,false,[[0,[5,[20,14,120,false,null],[23,"X1"]]]]],[14,113,null,271594738778407,false,[[0,[4,[20,14,117,false,null],[23,"X1"]]]]]]],[0,null,false,null,8901987820704116,[[-1,43,null,0,false,false,false,6439852866112236,false],[-1,39,null,0,false,false,false,3220808996941911,false,[[7,[20,14,60,false,null]],[8,2],[7,[21,14,false,null,0]]]]],[[14,111,null,5807872207067235,false,[[0,[4,[20,14,120,false,null],[23,"X1"]]]]],[14,113,null,8871025685542229,false,[[0,[5,[20,14,117,false,null],[23,"X1"]]]]]]],[0,null,false,null,656629618095646,[[-1,39,null,0,false,false,false,5282987595093271,false,[[7,[20,14,61,false,null]],[8,4],[7,[21,14,false,null,1]]]]],[[14,112,null,3826150096455575,false,[[0,[5,[20,14,121,false,null],[23,"Y1"]]]]],[14,144,null,2677413949151219,false,[[0,[4,[20,14,149,false,null],[23,"Y1"]]]]]]],[0,null,false,null,9355418970259266,[[-1,43,null,0,false,false,false,9275344954709335,false],[-1,39,null,0,false,false,false,5285468813848319,false,[[7,[20,14,61,false,null]],[8,2],[7,[21,14,false,null,1]]]]],[[14,112,null,4687946248565084,false,[[0,[4,[20,14,121,false,null],[23,"Y1"]]]]],[14,144,null,4524886027039653,false,[[0,[5,[20,14,149,false,null],[23,"Y1"]]]]]]],[0,null,false,null,8650167969454938,[[-1,39,null,0,false,false,false,6050035651538039,false,[[7,[20,14,62,false,null]],[8,4],[7,[21,14,false,null,2]]]]],[[14,113,null,7628234606683478,false,[[0,[5,[20,14,117,false,null],[23,"X2"]]]]]]],[0,null,false,null,9243747850037916,[[-1,43,null,0,false,false,false,6630675222316867,false],[-1,39,null,0,false,false,false,508409965402881,false,[[7,[20,14,62,false,null]],[8,2],[7,[21,14,false,null,2]]]]],[[14,113,null,1384492856414919,false,[[0,[4,[20,14,117,false,null],[23,"X2"]]]]]]],[0,null,false,null,1992894307590505,[[-1,39,null,0,false,false,false,2306893374431757,false,[[7,[20,14,63,false,null]],[8,4],[7,[21,14,false,null,3]]]]],[[14,144,null,7850997430489457,false,[[0,[5,[20,14,149,false,null],[23,"Y2"]]]]]]],[0,null,false,null,8690479195708294,[[-1,43,null,0,false,false,false,5421404983117561,false],[-1,39,null,0,false,false,false,550474874420052,false,[[7,[20,14,63,false,null]],[8,2],[7,[21,14,false,null,3]]]]],[[14,144,null,1346583983675074,false,[[0,[4,[20,14,149,false,null],[23,"Y2"]]]]]]],[0,null,false,null,1905483007746806,[[-1,27,null,0,false,false,false,5653823601330992,false,[[11,"EndResize"],[8,1],[7,[2,""]]]],[-1,39,null,0,false,false,false,9559072711976137,false,[[7,[20,14,60,false,null]],[8,0],[7,[21,14,false,null,0]]]],[-1,39,null,0,false,false,false,851701238880458,false,[[7,[20,14,61,false,null]],[8,0],[7,[21,14,false,null,1]]]],[-1,39,null,0,false,false,false,9861730464352597,false,[[7,[20,14,62,false,null]],[8,0],[7,[21,14,false,null,2]]]],[-1,39,null,0,false,false,false,7985652870359221,false,[[7,[20,14,63,false,null]],[8,0],[7,[21,14,false,null,3]]]]],[[3,20,null,5290699014327327,false,[[1,[23,"EndResize"]],[13]]],[-1,21,null,9833938841775409,false,[[11,"EndResize"],[7,[2,""]]]]]],[0,null,false,null,7763788308380828,[[-1,37,null,0,false,false,false,3746950844454993,false]],[[22,174,null,7568166276676368,false,[[0,[20,14,120,false,null]]]],[22,175,null,7062695625036972,false,[[0,[20,14,121,false,null]]]],[22,177,null,8689748366162143,false,[[0,[20,14,117,false,null]]]],[22,173,null,5118532448001116,false,[[0,[20,14,149,false,null]]]]]],[0,null,false,null,1591886703018009,[[54,181,null,0,false,false,false,3289409286967428,false,[[4,14]]]],[],[[0,null,false,null,874700197874991,[[-1,39,null,0,false,false,false,5179414439768188,false,[[7,[4,[20,14,60,false,null],[0,5]]],[8,4],[7,[20,54,180,false,null]]]]],[[54,47,null,7875380352262934,false,[[0,[4,[4,[20,14,60,false,null],[0,5]],[0,8]]]]]]],[0,null,false,null,6186777231882107,[[-1,39,null,0,false,false,false,2373050614378407,false,[[7,[4,[20,14,61,false,null],[0,5]]],[8,4],[7,[20,54,134,false,null]]]]],[[54,90,null,1739906892390651,false,[[0,[4,[4,[20,14,61,false,null],[0,5]],[0,8]]]]]]],[0,null,false,null,4424963726114035,[[-1,39,null,0,false,false,false,6760662438072817,false,[[7,[5,[20,14,62,false,null],[0,5]]],[8,2],[7,[20,54,179,false,null]]]]],[[54,47,null,4125195426723162,false,[[0,[5,[5,[20,14,62,false,null],[0,5]],[0,8]]]]]]],[0,null,false,null,4087696873870203,[[-1,39,null,0,false,false,false,9189244145578556,false,[[7,[5,[20,14,63,false,null],[0,5]]],[8,2],[7,[20,54,133,false,null]]]]],[[54,90,null,311851535379431,false,[[0,[5,[5,[20,14,63,false,null],[0,5]],[0,8]]]]]]]]],[0,null,false,null,2578087736257739,[[-1,182,null,0,false,false,false,5206802692455107,false,[[4,15],[0,[0,0]]]]],[[15,183,null,1754442185510717,false,[[0,[20,14,120,false,null]],[0,[20,14,121,false,null]]]],[15,184,null,4452078008397923,false,[[0,[20,14,117,false,null]],[0,[0,5]]]]]],[0,null,false,null,5616652684736666,[[-1,182,null,0,false,false,false,6372857020007958,false,[[4,15],[0,[0,1]]]]],[[15,183,null,4365553449529506,false,[[0,[20,14,120,false,null]],[0,[20,14,121,false,null]]]],[15,184,null,4721852324255891,false,[[0,[0,5]],[0,[20,14,149,false,null]]]]]],[0,null,false,null,2120113872606711,[[-1,182,null,0,false,false,false,2296049580165351,false,[[4,15],[0,[0,2]]]]],[[15,183,null,4930653830052161,false,[[0,[20,14,120,false,null]],[0,[5,[4,[20,14,121,false,null],[20,14,149,false,null]],[0,5]]]]],[15,184,null,6680562832196711,false,[[0,[20,14,117,false,null]],[0,[0,5]]]]]],[0,null,false,null,8595482620170241,[[-1,182,null,0,false,false,false,6862569065308248,false,[[4,15],[0,[0,3]]]]],[[15,183,null,1582017181131723,false,[[0,[5,[4,[20,14,120,false,null],[20,14,117,false,null]],[0,5]]],[0,[20,14,121,false,null]]]],[15,184,null,4758501533189676,false,[[0,[0,5]],[0,[20,14,149,false,null]]]]]],[0,null,false,null,3878831687018302,[[-1,182,null,0,false,false,false,51248620235013,false,[[4,16],[0,[0,0]]]]],[[16,183,null,9390222647315846,false,[[0,[0,-10]],[0,[0,-10]]]],[16,184,null,2074228143520844,false,[[0,[4,[19,147],[0,20]]],[0,[4,[20,14,121,false,null],[0,10]]]]]]],[0,null,false,null,7466538965613226,[[-1,182,null,0,false,false,false,4704482053258192,false,[[4,16],[0,[0,1]]]]],[[16,183,null,2813224499152925,false,[[0,[0,-10]],[0,[20,14,121,false,null]]]],[16,184,null,4466845077103075,false,[[0,[4,[20,14,120,false,null],[0,10]]],[0,[20,14,149,false,null]]]]]],[0,null,false,null,6916839432130197,[[-1,182,null,0,false,false,false,820397752813011,false,[[4,16],[0,[0,2]]]]],[[16,183,null,1238886320974273,false,[[0,[4,[20,14,120,false,null],[20,14,117,false,null]]],[0,[20,14,121,false,null]]]],[16,184,null,6131487219099248,false,[[0,[4,[5,[5,[19,147],[20,14,120,false,null]],[20,14,117,false,null]],[0,10]]],[0,[20,14,149,false,null]]]]]],[0,null,false,null,9279677575517959,[[-1,182,null,0,false,false,false,5584331357916084,false,[[4,16],[0,[0,3]]]]],[[16,183,null,4704488797536488,false,[[0,[0,-10]],[0,[4,[20,14,121,false,null],[20,14,149,false,null]]]]],[16,184,null,2010056193356945,false,[[0,[4,[19,147],[0,20]]],[0,[4,[5,[5,[19,148],[20,14,121,false,null]],[20,14,149,false,null]],[0,10]]]]]]]]],[0,null,false,null,9463027995562386,[[-1,37,null,0,false,false,false,3224660080212576,false]],[[3,20,null,8159841916084528,false,[[1,[2,"CombatZoneTick"]],[13]]]]]]],[0,[true,"SansAnimation"],false,null,7849474356685905,[[-1,72,null,0,false,false,false,7849474356685905,false,[[1,[2,"SansAnimation"]]]]],[],[[1,"SansAnimation",1,"",true,false,7991719124201338,false],[0,null,false,null,1101390295237313,[[3,35,null,2,false,false,false,8752020194768763,false,[[1,[2,"SansAnimation"]]]]],[[24,57,null,8613414512859144,false,[[3,0]]],[25,57,null,374390602059171,false,[[3,1]]],[27,57,null,8017876731148895,false,[[3,1]]],[-1,21,null,1878501702853955,false,[[11,"SansAnimation"],[7,[20,3,38,false,null,[[0,0]]]]]]]],[0,null,false,null,5330867414805245,[[3,35,null,2,false,false,false,5546346513571971,false,[[1,[2,"SansBody"]]]]],[[-1,21,null,7921424256797614,false,[[11,"SansAnimation"],[7,[2,""]]]],[24,57,null,6969033535271063,false,[[3,1]]],[25,57,null,6599648142270536,false,[[3,0]]],[27,57,null,3357939840090344,false,[[3,0]]],[24,23,null,2074275228452812,false,[[1,[20,3,38,false,null,[[0,0]]]],[3,1]]]]],[0,null,false,null,7685623666367153,[[3,35,null,2,false,false,false,6834858316169599,false,[[1,[2,"SansTorso"]]]]],[[24,57,null,8439659472243491,false,[[3,0]]],[25,57,null,7078757681371643,false,[[3,1]]],[27,57,null,2201245950866941,false,[[3,1]]],[27,23,null,4285988285192986,false,[[1,[20,3,38,false,null,[[0,0]]]],[3,1]]]]],[0,null,false,null,4010205377286061,[[3,35,null,2,false,false,false,278655648228976,false,[[1,[2,"SansHead"]]]]],[[23,23,null,449277202075253,false,[[1,[20,3,38,false,null,[[0,0]]]],[3,1]]]]],[0,null,false,null,7722442491544848,[[3,35,null,2,false,false,false,1384224312146477,false,[[1,[2,"SansSweat"]]]]],[],[[0,null,false,null,704806671336275,[[-1,39,null,0,false,false,false,2159438717679249,false,[[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]],[8,0],[7,[0,0]]]]],[[26,57,null,3778528214576921,false,[[3,0]]]]],[0,null,false,null,257046816479786,[[-1,39,null,0,false,false,false,7489738546579401,false,[[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]],[8,4],[7,[0,0]]]]],[[26,57,null,8449097310722054,false,[[3,1]]],[26,23,null,7904586214557196,false,[[1,[10,[2,"Sweat"],[20,3,38,false,null,[[0,0]]]]],[3,1]]]]]]],[0,null,false,null,4135904091256923,[[3,35,null,2,false,false,false,3344910171642884,false,[[1,[2,"SansX"]]]]],[[25,47,null,430919275757472,false,[[0,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]]]],[0,null,false,null,8701535136878177,[[3,35,null,2,false,false,false,9713151354868877,false,[[1,[2,"SansRepeat"]]]]],[[25,30,null,5188519670613183,false,[[10,5],[7,[0,-900]]]]]],[0,null,false,null,7284207752322889,[[3,35,null,2,false,false,false,9023380353680652,false,[[1,[2,"SansEndRepeat"]]]]],[[25,30,null,8242267714282234,false,[[10,5],[7,[0,0]]]]]],[0,null,false,null,6455973996387237,[[25,44,null,0,false,false,false,8621252523757674,false,[[10,5],[8,1],[7,[0,0]]]]],[[25,90,null,5774018796480299,false,[[0,[5,[20,14,61,false,null],[0,16]]]]],[25,47,null,1611247167854349,false,[[0,[4,[20,25,76,false,null],[6,[21,25,false,null,5],[19,85]]]]]],[25,163,null,8128390878391567,false,[[10,5],[7,[6,[0,45],[19,85]]]]]],[[0,null,false,null,970767306827771,[[25,86,null,0,false,false,false,3867514313385627,false,[[8,2],[0,[0,-100]]]]],[[25,47,null,8794353621150437,false,[[0,[0,740]]]],[23,23,null,4319035646717656,false,[[1,[19,53,[[2,"Default"],[2,"LookLeft"],[2,"Wink"],[2,"ClosedEyes"],[2,"NoEyes"]]]],[3,1]]],[27,23,null,3665618895546711,false,[[1,[19,53,[[2,"Default"],[2,"Default"],[2,"Default"],[2,"Shrug"]]]],[3,1]]]]]]],[0,null,false,null,9404514032655554,[[-1,43,null,0,false,false,false,8528600168708502,false]],[[25,90,null,8280947980757887,false,[[0,[5,[21,14,false,null,1],[0,16]]]]]]],[0,null,false,null,9123876431058954,[[25,44,null,0,false,false,false,2995307715163944,false,[[10,2],[8,1],[7,[0,0]]]]],[[25,52,null,9963544857140343,false,[[10,3],[7,[19,85]]]]]],[0,null,false,null,159606854644262,[[25,44,null,0,false,false,false,5634226456349333,false,[[10,2],[8,0],[7,[0,1]]]]],[[25,47,null,645637146194496,false,[[0,[5,[0,320],[6,[19,119,[[6,[21,25,false,null,3],[0,225]]]],[0,100]]]]]]],[[0,null,false,null,7185270834812533,[[25,44,null,0,false,false,false,1791671511470734,false,[[10,3],[8,5],[7,[1,0.4]]]]],[[25,47,null,601091087436735,false,[[0,[0,220]]]],[25,30,null,5993273962634471,false,[[10,2],[7,[0,2]]]],[25,30,null,5381010199169351,false,[[10,3],[7,[0,0]]]],[-1,45,null,6865508873045757,false,[[0,[1,0.6]]]],[-1,31,null,4400119478275877,false,[[4,50],[5,[2,"Enemies"]],[0,[0,272]],[0,[0,50]]]],[50,25,null,5738766536258974,false,[[7,[2,"MISS"]]]],[50,32,null,7601106470658233,false,[[10,7],[7,[1,1.5]]]],[50,87,null,4732363059797661,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,75]]]],[50,87,null,2695739000555553,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,75]]]],[50,87,null,3893163972513071,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,75]]]]]]]],[0,null,false,null,1809679563636315,[[25,44,null,0,false,false,false,5448089823345665,false,[[10,2],[8,0],[7,[0,2]]]]],[],[[0,null,false,null,8819847059214338,[[25,44,null,0,false,false,false,4252807116162713,false,[[10,3],[8,5],[7,[1,1.1]]]]],[[25,30,null,4096514457981511,false,[[10,2],[7,[0,3]]]],[25,30,null,1466841401027784,false,[[10,3],[7,[0,0]]]]]]]],[0,null,false,null,7176434489062908,[[25,44,null,0,false,false,false,3671377552137581,false,[[10,2],[8,0],[7,[0,3]]]]],[[25,47,null,615694957493994,false,[[0,[5,[0,320],[6,[19,84,[[6,[21,25,false,null,3],[0,225]]]],[0,100]]]]]]],[[0,null,false,null,1378632099899061,[[25,44,null,0,false,false,false,6254573314573755,false,[[10,3],[8,5],[7,[1,0.4]]]]],[[25,47,null,4281191975672167,false,[[0,[0,320]]]],[25,30,null,777498200450079,false,[[10,2],[7,[0,0]]]],[25,30,null,7346548433244253,false,[[10,3],[7,[0,0]]]],[25,52,null,2787628370272392,false,[[10,1],[7,[0,1]]]],[25,78,null,6575202250839281,false,[[10,4],[3,1]]],[20,46,null,4700416217010713,false],[17,30,null,9357729356844489,false,[[10,0],[7,[0,2]]]],[3,20,null,9980739500108171,false,[[1,[2,"StartAttack"]],[13]]]]]]],[0,null,false,null,9425554297379259,[[-1,27,null,0,false,false,false,5879080662845433,false,[[11,"SansAnimation"],[8,1],[7,[2,""]]]]],[[27,52,null,1285065763689705,false,[[10,0],[7,[19,85]]]],[23,52,null,2851942063970722,false,[[10,0],[7,[19,85]]]]]],[0,null,false,null,6768416817698473,[[-1,27,null,0,false,false,false,2486277728362958,false,[[11,"SansAnimation"],[8,0],[7,[2,"Idle"]]]]],[],[[0,null,false,null,9833345752618593,[[27,44,null,0,false,false,false,4121901806599437,false,[[10,0],[8,4],[7,[1,1.2]]]]],[[27,163,null,7588369545806161,false,[[10,0],[7,[1,1.2]]]]]],[0,null,false,null,2897742861154241,[[23,44,null,0,false,false,false,6031705542279637,false,[[10,0],[8,4],[7,[1,1.2]]]]],[[23,163,null,180131503971844,false,[[10,0],[7,[1,1.2]]]]]],[0,null,false,null,422661617226664,[[-1,37,null,0,false,false,false,6884970335254994,false]],[[27,30,null,3066819403009204,false,[[10,1],[7,[19,119,[[6,[0,360],[7,[21,27,false,null,0],[1,1.2]]]]]]]],[27,30,null,207833805975499,false,[[10,2],[7,[19,119,[[6,[0,720],[7,[21,27,false,null,0],[1,1.2]]]]]]]],[23,30,null,8334525037545989,false,[[10,2],[7,[6,[3,[19,119,[[6,[0,720],[7,[21,23,false,null,0],[1,1.2]]]]]],[1,0.4]]]]]]]]],[0,null,false,null,789619701147026,[[-1,27,null,0,false,false,false,5286097322546972,false,[[11,"SansAnimation"],[8,0],[7,[2,"HeadBob"]]]]],[],[[0,null,false,null,341622975786218,[[23,44,null,0,false,false,false,3156705705745235,false,[[10,0],[8,4],[7,[1,1.1]]]]],[[23,163,null,7059030601907315,false,[[10,0],[7,[1,1.1]]]]]],[0,null,false,null,5417550658248435,[[-1,37,null,0,false,false,false,121123178078343,false]],[[23,30,null,2468856873844738,false,[[10,1],[7,[19,119,[[6,[0,360],[7,[21,23,false,null,0],[1,1.1]]]]]]]],[23,30,null,4506271606700868,false,[[10,2],[7,[19,119,[[6,[0,720],[7,[21,23,false,null,0],[1,1.1]]]]]]]]]]]],[0,null,false,null,7318755130489573,[[-1,27,null,0,false,false,false,7615385157121584,false,[[11,"SansAnimation"],[8,0],[7,[2,"Tired"]]]]],[],[[0,null,false,null,5259181673957198,[[27,44,null,0,false,false,false,987122182714774,false,[[10,0],[8,4],[7,[1,3.8]]]]],[[27,163,null,4394562403147867,false,[[10,0],[7,[1,3.8]]]]]],[0,null,false,null,1556007649864518,[[23,44,null,0,false,false,false,2261526172741199,false,[[10,0],[8,4],[7,[1,3.8]]]]],[[23,163,null,4897453954417372,false,[[10,0],[7,[1,3.8]]]]]],[0,null,false,null,8759808653512085,[[-1,37,null,0,false,false,false,8047795972857524,false]],[[27,30,null,1795519733392314,false,[[10,2],[7,[19,119,[[6,[0,360],[7,[21,27,false,null,0],[1,3.8]]]]]]]],[23,30,null,3770458388429609,false,[[10,2],[7,[19,119,[[6,[0,360],[7,[21,23,false,null,0],[1,3.8]]]]]]]]]]]],[0,null,false,null,8109652345472421,[[-1,27,null,0,false,false,false,7788103841668532,false,[[11,"SansAnimation"],[8,0],[7,[2,""]]]]],[[27,30,null,4472999747667123,false,[[10,0],[7,[0,0]]]],[27,30,null,362276419509186,false,[[10,1],[7,[0,0]]]],[27,30,null,3091467113051065,false,[[10,2],[7,[0,0]]]],[23,30,null,5700986202837433,false,[[10,0],[7,[0,0]]]],[23,30,null,9789970462930788,false,[[10,1],[7,[0,0]]]],[23,30,null,5374220354404653,false,[[10,2],[7,[0,0]]]]]],[0,null,false,null,7173198106602578,[[23,185,null,0,false,false,false,161883942822972,false,[[1,[2,"BlueEye"]]]]],[[23,83,null,3406173047554672,false],[23,186,null,7033184958983622,false,[[0,[19,81,[[19,82,[[0,2]]]]]]]]]],[0,null,false,null,7288411895393404,[[-1,37,null,0,false,false,false,5385421716260042,false]],[[27,47,null,689734964884583,false,[[0,[4,[20,25,187,false,null,[[2,"Torso"]]],[21,27,false,null,1]]]]],[27,90,null,2083915764284723,false,[[0,[4,[20,25,188,false,null,[[2,"Torso"]]],[21,27,false,null,2]]]]],[24,47,null,9442485482185746,false,[[0,[20,25,76,false,null]]]],[24,90,null,7739806729374475,false,[[0,[20,25,77,false,null]]]]]],[0,null,false,null,40234939767203,[[24,189,null,0,false,false,false,5780053730334626,false]],[[23,47,null,7555412367504317,false,[[0,[20,24,187,false,null,[[2,"Head"]]]]]],[23,90,null,5535399862639044,false,[[0,[20,24,188,false,null,[[2,"Head"]]]]]]]],[0,null,false,null,1491824254613754,[[27,189,null,0,false,false,false,7092178200445471,false]],[[23,47,null,6652191450949259,false,[[0,[4,[20,27,187,false,null,[[2,"Head"]]],[21,23,false,null,1]]]]],[23,90,null,2340868991293632,false,[[0,[4,[20,27,188,false,null,[[2,"Head"]]],[21,23,false,null,2]]]]]]],[0,null,false,null,2865823843854622,[[-1,37,null,0,false,false,false,3184921651699469,false]],[[26,110,null,4676063338412403,false,[[4,23],[7,[2,"Sweat"]]]]]]]],[0,[true,"PlayerDamage"],false,null,643035177198997,[[-1,72,null,0,false,false,false,643035177198997,false,[[1,[2,"PlayerDamage"]]]]],[],[[1,"LastDamageTime",0,0,true,false,9910897188057685,false],[0,null,false,null,811574540272408,[[-1,17,null,1,false,false,false,541726700868927,false]],[[-1,31,null,183397290363283,false,[[4,64],[5,[20,54,190,false,null]],[0,[20,54,76,false,null]],[0,[20,54,77,false,null]]]]]],[0,null,false,null,848774965814453,[[-1,37,null,0,false,false,false,116666939261729,false]],[[64,110,null,601136598806736,false,[[4,54],[7,[0,0]]]]]],[0,null,false,null,6538539831904817,[[3,35,null,2,false,false,false,1793763511666456,false,[[1,[2,"DamagePlayer"]]]]],[[-1,21,null,5386619728165059,false,[[11,"LastDamageTime"],[7,[19,191]]]],[-1,140,null,5063548360071409,false,[[11,"HP"],[7,[20,3,38,false,null,[[0,0]]]]]],[-1,105,null,622917796290428,false,[[11,"KR"],[7,[20,3,38,false,null,[[0,1]]]]]],[5,29,null,2718447344361586,false,[[2,["playerdamaged",false]],[3,0],[0,[0,0]],[1,[2,""]]]]]],[0,null,false,null,9017895024442913,[[69,192,null,1,false,false,false,6757501434751207,false]],[[69,193,null,2921850629727803,false,[[3,0],[1,[2,"Tint"]]]]]],[0,null,false,null,5274775785416851,[[69,123,null,0,false,false,false,7401794146414845,false,[[10,2],[8,0],[7,[0,1]]]]],[[69,193,null,8792784699812288,false,[[3,1],[1,[2,"Tint"]]]],[69,194,null,1671610681247615,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[1,7.84]]]],[69,194,null,2655109807164018,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[1,66.27]]]],[69,194,null,1797174504372617,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,100]]]]]],[0,null,false,null,530186312537819,[[69,123,null,0,false,false,false,779467253681919,false,[[10,2],[8,0],[7,[0,2]]]]],[[69,193,null,184561813924332,false,[[3,1],[1,[2,"Tint"]]]],[69,194,null,840899819392304,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,100]]]],[69,194,null,282277725820753,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[1,62.74]]]],[69,194,null,466145817530926,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[1,25.09]]]]]],[0,null,false,null,6954706747497658,[[-1,27,null,0,false,false,false,4220182392469211,false,[[11,"LastDamageTime"],[8,2],[7,[5,[19,191],[1,0.033]]]]]],[],[[0,null,false,null,5726679394208632,[[64,181,null,0,false,false,false,688643898473769,false,[[4,70]]],[70,44,null,0,false,false,false,6689891578961013,false,[[10,0],[8,4],[7,[0,0]]]],[54,189,null,0,false,false,false,4006224713849922,false]],[[3,20,null,6403201443095863,false,[[1,[2,"DamagePlayer"]],[13,[7,[21,70,false,null,0]],[7,[21,70,false,null,1]]]]]],[[0,null,false,null,2589765181695327,[[70,44,null,0,false,false,false,7299891480861778,false,[[10,1],[8,5],[7,[0,3]]]]],[[70,30,null,1609846567063642,false,[[10,1],[7,[0,2]]]]]],[0,null,false,null,1504611877828037,[[39,195,null,0,false,false,true,8089634938713708,false,[[0,[20,70,196,false,null]]]],[-1,39,null,0,false,false,false,5603520751565233,false,[[7,[20,39,197,false,null]],[8,4],[7,[0,0]]]],[-1,27,null,0,false,false,false,6723234037979145,false,[[11,"HP"],[8,3],[7,[0,0]]]]],[[-1,21,null,8545346840609998,false,[[11,"HP"],[7,[0,1]]]]]],[0,null,false,null,9373988253349059,[[38,195,null,0,false,false,true,9137885818318459,false,[[0,[20,70,196,false,null]]]],[-1,39,null,0,false,false,false,1502832072534555,false,[[7,[20,38,197,false,null]],[8,4],[7,[0,0]]]],[-1,27,null,0,false,false,false,4835213302049233,false,[[11,"HP"],[8,3],[7,[0,0]]]]],[[-1,21,null,1647115571304168,false,[[11,"HP"],[7,[0,1]]]]]]]],[0,null,false,null,3489532580732596,[[64,181,null,0,false,false,false,162901615373973,false,[[4,71]]],[71,169,null,0,false,false,false,6203955502490003,false,[[10,0],[8,4],[7,[0,0]]]]],[[3,20,null,2116083812394235,false,[[1,[2,"DamagePlayer"]],[13,[7,[21,71,false,null,0]],[7,[21,71,false,null,1]]]]]],[[0,null,false,null,4957784289678921,[[71,169,null,0,false,false,false,897270890338422,false,[[10,1],[8,5],[7,[0,3]]]]],[[71,158,null,4953072553391094,false,[[10,1],[7,[0,2]]]]]]]],[0,null,false,null,3041692031166179,[[64,181,null,0,false,false,false,216628994048020,false,[[4,69]]],[69,123,null,0,false,false,false,1580583761025439,false,[[10,0],[8,4],[7,[0,0]]]]],[],[[0,null,false,null,1850131199572992,[[69,123,null,0,false,false,false,2608099428163218,false,[[10,2],[8,0],[7,[0,0]]]]],[[3,20,null,5799543445818925,false,[[1,[2,"DamagePlayer"]],[13,[7,[21,69,false,null,0]],[7,[21,69,false,null,1]]]]]],[[0,null,false,null,3998073536534141,[[69,123,null,0,false,false,false,2574977534115715,false,[[10,1],[8,5],[7,[0,3]]]]],[[69,58,null,5420918501247682,false,[[10,1],[7,[0,2]]]]]]]],[0,null,false,null,2061583751641791,[[69,123,null,0,false,false,false,9210133633176591,false,[[10,2],[8,0],[7,[0,1]]]],[54,198,"CustomMovement",0,false,false,false,6103957758494519,false]],[[3,20,null,8633223858835726,false,[[1,[2,"DamagePlayer"]],[13,[7,[21,69,false,null,0]],[7,[21,69,false,null,1]]]]]],[[0,null,false,null,8954905130120966,[[69,123,null,0,false,false,false,7151374962053246,false,[[10,1],[8,5],[7,[0,3]]]]],[[69,58,null,1239968244827995,false,[[10,1],[7,[0,2]]]]]]]],[0,null,false,null,336622092866585,[[69,123,null,0,false,false,false,789061967124882,false,[[10,2],[8,0],[7,[0,2]]]],[54,198,"CustomMovement",0,false,true,false,112155524614588,false]],[[3,20,null,523205573026744,false,[[1,[2,"DamagePlayer"]],[13,[7,[21,69,false,null,0]],[7,[21,69,false,null,1]]]]]],[[0,null,false,null,346193478372130,[[69,123,null,0,false,false,false,125447283288677,false,[[10,1],[8,5],[7,[0,3]]]]],[[69,58,null,422680399601325,false,[[10,1],[7,[0,2]]]]]]]]]]]],[0,null,false,null,9201836221228847,[[-1,27,null,0,false,false,false,3110233585653248,false,[[11,"KR"],[8,4],[7,[0,40]]]]],[[-1,21,null,6410931243152171,false,[[11,"KR"],[7,[0,40]]]]]],[0,null,false,null,4525906811311446,[[-1,27,null,0,false,false,false,1601080523701734,false,[[11,"KR"],[8,5],[7,[23,"HP"]]]]],[[-1,21,null,3058735257082932,false,[[11,"KR"],[7,[5,[23,"HP"],[0,1]]]]]]],[0,null,false,null,488891102143227,[[-1,27,null,0,false,false,false,8792785209263541,false,[[11,"KR"],[8,4],[7,[0,0]]]],[-1,27,null,0,false,false,false,1356515131988488,false,[[11,"HP"],[8,4],[7,[0,1]]]]],[[-1,105,null,6589598027678854,false,[[11,"KR_T"],[7,[19,85]]]]],[[0,null,false,null,7131367989472943,[[-1,27,null,0,false,false,false,9768579479073599,false,[[11,"KR"],[8,5],[7,[0,40]]]],[-1,27,null,0,false,false,false,9693502421105398,false,[[11,"KR_T"],[8,5],[7,[1,0.033]]]]],[[-1,140,null,367994759311799,false,[[11,"KR"],[7,[0,1]]]],[-1,140,null,7145972870133036,false,[[11,"HP"],[7,[0,1]]]],[-1,21,null,3354172617694137,false,[[11,"KR_T"],[7,[0,0]]]]]],[0,null,false,null,4380515582651841,[[-1,27,null,0,false,false,false,5101253248934914,false,[[11,"KR"],[8,5],[7,[0,30]]]],[-1,27,null,0,false,false,false,2572679223796843,false,[[11,"KR_T"],[8,5],[7,[1,0.066]]]]],[[-1,140,null,4007812791047903,false,[[11,"KR"],[7,[0,1]]]],[-1,140,null,8509973852713055,false,[[11,"HP"],[7,[0,1]]]],[-1,21,null,1575178129545446,false,[[11,"KR_T"],[7,[0,0]]]]]],[0,null,false,null,1100481895677381,[[-1,27,null,0,false,false,false,7221970136007799,false,[[11,"KR"],[8,5],[7,[0,20]]]],[-1,27,null,0,false,false,false,53699228245828,false,[[11,"KR_T"],[8,5],[7,[1,0.166]]]]],[[-1,140,null,8502592643458527,false,[[11,"KR"],[7,[0,1]]]],[-1,140,null,6158261558974326,false,[[11,"HP"],[7,[0,1]]]],[-1,21,null,6002050402712816,false,[[11,"KR_T"],[7,[0,0]]]]]],[0,null,false,null,1269236454416825,[[-1,27,null,0,false,false,false,3649156993241928,false,[[11,"KR"],[8,5],[7,[0,10]]]],[-1,27,null,0,false,false,false,1405192372573455,false,[[11,"KR_T"],[8,5],[7,[1,0.5]]]]],[[-1,140,null,988951855727097,false,[[11,"KR"],[7,[0,1]]]],[-1,140,null,5614098109596639,false,[[11,"HP"],[7,[0,1]]]],[-1,21,null,6741928042799543,false,[[11,"KR_T"],[7,[0,0]]]]]],[0,null,false,null,9128291001170046,[[-1,27,null,0,false,false,false,4259586574900733,false,[[11,"KR_T"],[8,5],[7,[0,1]]]]],[[-1,140,null,6431584617366178,false,[[11,"KR"],[7,[0,1]]]],[-1,140,null,5219165492250095,false,[[11,"HP"],[7,[0,1]]]],[-1,21,null,8473310431549791,false,[[11,"KR_T"],[7,[0,0]]]]]]]],[0,null,false,null,1285625438719188,[[-1,27,null,0,false,false,false,7207129492542717,false,[[11,"HP"],[8,4],[7,[23,"MaxHP"]]]]],[[-1,21,null,4482893522173698,false,[[11,"HP"],[7,[23,"MaxHP"]]]]]],[0,null,false,null,3326750211042875,[[-1,27,null,0,false,false,false,7338451756091677,false,[[11,"HP"],[8,3],[7,[0,0]]]],[54,44,null,0,false,false,false,6476514813146421,false,[[10,0],[8,5],[7,[0,0]]]]],[[54,30,null,3459561075160849,false,[[10,0],[7,[0,-1]]]],[54,49,"CustomMovement",9082846895447337,false,[[3,0]]],[54,125,null,2488884281163158,false,[[0,[0,90]]]],[54,126,null,5964618853624794,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,100]]]],[54,126,null,1869931179172857,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]],[54,126,null,8131879753061854,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]],[54,199,null,7610402866104371,false,[[5,[2,"Overlay"]]]],[3,20,null,4043494841081672,false,[[1,[2,"TLStop"]],[13]]],[3,20,null,2624561638301844,false,[[1,[2,"BlackScreen"]],[13,[7,[0,1]]]]],[5,64,null,4017743714762154,false],[70,46,null,4460034074455441,false],[71,200,null,2110238212603641,false],[69,56,null,646720577179653,false],[-1,45,null,4941265421462373,false,[[0,[1,0.6666666666666666]]]],[54,23,null,2329274279480105,false,[[1,[2,"Split"]],[3,1]]],[5,29,null,2075669190576832,false,[[2,["heartsplit",false]],[3,0],[0,[0,0]],[1,[2,""]]]],[-1,45,null,796514820377959,false,[[0,[1,1.333333333333333]]]],[54,57,null,6017268762912521,false,[[3,0]]],[5,29,null,643194526854293,false,[[2,["heartshatter",false]],[3,0],[0,[0,0]],[1,[2,""]]]]],[[0,null,false,null,1744575437219986,[[-1,100,null,0,true,false,false,5912298763917202,false,[[1,[2,""]],[0,[0,1]],[0,[0,6]]]]],[[54,201,null,8037231263339132,false,[[4,59],[5,[2,"Overlay"]],[7,[0,0]]]],[59,50,"CustomMovement",3649263896360635,false,[[3,0],[0,[0,180]]]],[59,115,"CustomMovement",7708027392416301,false,[[0,[19,82,[[0,360]]]]]]]],[0,null,false,null,3027270988880191,[[-1,37,null,0,false,false,false,4684906947286066,false]],[[-1,45,null,8379836125687821,false,[[0,[0,2]]]],[-1,65,null,1592998377097122,false,[[6,"MainMenu"]]]]]]],[0,null,false,null,6581687018117839,[[-1,37,null,0,false,false,false,6443457778675429,false]],[[59,202,"CustomMovement",4484584523447556,false,[[0,[0,300]],[0,[0,90]]]]]]]],[0,[true,"HPBar"],false,null,7412549161674362,[[-1,72,null,0,false,false,false,7412549161674362,false,[[1,[2,"HPBar"]]]]],[],[[0,null,false,null,9694776683239226,[[-1,17,null,1,false,false,false,9144483854578006,false]],[[8,203,null,4172743817139278,false,[[4,7],[7,[0,0]]]],[9,203,null,87943119435334,false,[[4,7],[7,[0,0]]]],[8,173,null,8321288635984878,false,[[0,[20,7,204,false,null]]]],[9,173,null,361760754801612,false,[[0,[20,7,204,false,null]]]]]],[0,null,false,null,2503038608280179,[[-1,37,null,0,false,false,false,7893323834519069,false]],[[7,177,null,5702588972840914,false,[[0,[19,81,[[6,[23,"MaxHP"],[1,1.2]]]]]]],[8,177,null,1737747704672853,false,[[0,[6,[20,7,205,false,null],[7,[23,"HP"],[23,"MaxHP"]]]]]],[9,177,null,4842625253977254,false,[[0,[19,206,[[6,[20,7,205,false,null],[7,[23,"KR"],[23,"MaxHP"]]]]]]]],[9,174,null,1913854097773742,false,[[0,[4,[20,7,207,false,null],[6,[20,7,205,false,null],[7,[5,[23,"HP"],[23,"KR"]],[23,"MaxHP"]]]]]]]]],[0,null,false,null,1588929814642503,[[47,24,null,0,false,false,false,7718710013617666,false,[[10,0],[8,0],[7,[2,"HP"]]]]],[[47,25,null,1551462691539896,false,[[7,[10,[10,[19,208,[[23,"HP"],[0,2]]],[2," / "]],[23,"MaxHP"]]]]]],[[0,null,false,null,1743032416704721,[[-1,27,null,0,false,false,false,1649108818121315,false,[[11,"KR"],[8,0],[7,[0,0]]]]],[[47,87,null,9456539620268645,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,100]]]]]],[0,null,false,null,5679692326565587,[[-1,27,null,0,false,false,false,5062509765207555,false,[[11,"KR"],[8,4],[7,[0,0]]]]],[[47,87,null,9571160412477923,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]]]]]]]],[0,[true,"SansShake"],false,null,793266676008591,[[-1,72,null,0,false,false,false,793266676008591,false,[[1,[2,"SansShake"]]]]],[],[[1,"CenterX",0,0,true,false,964429951288562,false],[1,"CenterY",0,0,true,false,804165102414245,false],[1,"Intensity",0,0,true,false,275892975769751,false],[1,"Timer",0,0,true,false,725952919004055,false],[0,null,false,null,690867833349772,[[-1,17,null,1,false,false,false,620473805504506,false]],[[-1,21,null,264028447300593,false,[[11,"CenterX"],[7,[7,[19,209],[0,2]]]]],[-1,21,null,789582073713788,false,[[11,"CenterY"],[7,[7,[19,210],[0,2]]]]]]],[0,null,false,null,581065268755846,[[3,35,null,2,false,false,false,844926222919352,false,[[1,[2,"SansShake"]]]]],[[-1,21,null,227913606193228,false,[[11,"Intensity"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]],[-1,21,null,911122063378629,false,[[11,"Timer"],[7,[0,0]]]]]],[0,null,false,null,766781248948690,[[-1,27,null,0,false,false,false,974614138036332,false,[[11,"Intensity"],[8,4],[7,[0,0]]]]],[[-1,105,null,188059573201193,false,[[11,"Timer"],[7,[19,85]]]]]],[0,null,false,null,730322048839997,[[-1,43,null,0,false,false,false,164669985605282,false]],[[-1,211,null,893789459116953,false,[[0,[23,"CenterX"]],[0,[23,"CenterY"]]]]]],[0,null,false,null,313868565445860,[[-1,27,null,0,false,false,false,259546788093898,false,[[11,"Timer"],[8,5],[7,[1,0.03333333333333333]]]]],[[-1,140,null,193041292027305,false,[[11,"Timer"],[7,[1,0.03333333333333333]]]],[-1,140,null,453029557440805,false,[[11,"Intensity"],[7,[0,1]]]],[-1,212,null,906414024255952,false,[[0,[4,[23,"CenterX"],[6,[23,"Intensity"],[19,53,[[0,1],[0,-1]]]]]]]],[-1,213,null,452821615897390,false,[[0,[4,[23,"CenterY"],[6,[23,"Intensity"],[19,53,[[0,1],[0,-1]]]]]]]]]]]],[0,[true,"PracticeMode"],false,null,495560915448475,[[-1,72,null,0,false,false,false,495560915448475,false,[[1,[2,"PracticeMode"]]]]],[],[[1,"PracticeAttack",0,0,true,false,269328620281569,false],[1,"Failed",0,0,true,false,240828477291614,false],[0,null,false,null,136582083461685,[[-1,214,null,1,false,false,false,467416343489765,false]],[[-1,21,null,527019556160114,false,[[11,"PracticeAttack"],[7,[0,0]]]]]],[0,null,false,null,332659347405280,[[3,35,null,2,false,false,false,898957624830376,false,[[1,[2,"SetPracticeAttack"]]]],[-1,215,null,0,false,false,false,946417863214528,false]],[[-1,21,null,592617553054849,false,[[11,"PracticeAttack"],[7,[19,70,[[20,3,38,false,null,[[0,0]]]]]]]]]],[0,null,false,null,987148592699869,[[-1,27,null,0,false,false,false,739880776800068,false,[[11,"SimulatorMode"],[8,0],[7,[23,"MODE_PRACTICE"]]]]],[[25,30,null,457672197639173,false,[[10,0],[7,[23,"PracticeAttack"]]]]],[[0,null,false,null,283596206551521,[[3,35,null,2,false,false,false,205227642094877,false,[[1,[2,"StartAttack"]]]]],[[-1,21,null,550560695441705,false,[[11,"HP"],[7,[23,"MaxHP"]]]],[-1,21,null,140649389753177,false,[[11,"KR"],[7,[0,0]]]],[-1,21,null,338571672395262,false,[[11,"Failed"],[7,[0,0]]]]]],[0,null,false,null,344554124359375,[[3,35,null,2,false,false,false,301945784893307,false,[[1,[2,"EndAttack"]]]]],[],[[0,null,false,null,995447048705872,[[-1,27,null,0,false,false,false,534471371208032,false,[[11,"Failed"],[8,0],[7,[0,0]]]]],[[-1,105,null,881745530468964,false,[[11,"PracticeAttack"],[7,[0,1]]]],[-1,31,null,479817542647507,false,[[4,50],[5,[0,0]],[0,[0,16]],[0,[0,16]]]],[50,25,null,134424053483791,false,[[7,[2,"SUCCESS"]]]],[50,73,null,380591048875847,false,[[0,[0,256]],[0,[0,32]]]],[50,32,null,821747686948053,false,[[10,7],[7,[0,1]]]],[50,87,null,819649176613760,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,0]]]],[50,87,null,856084709168820,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,100]]]],[50,87,null,675965563926450,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]]],[[0,null,false,null,650110406754044,[[25,44,null,0,false,false,false,196723402698757,false,[[10,1],[8,2],[7,[0,13]]]],[-1,27,null,0,false,false,false,529322749066441,false,[[11,"PracticeAttack"],[8,0],[7,[0,14]]]]],[[25,30,null,976393462683652,false,[[10,1],[7,[0,14]]]],[-1,21,null,599424083330358,false,[[11,"PracticeAttack"],[7,[0,0]]]]]],[0,null,false,null,560991448539643,[[25,44,null,0,false,false,false,736006944728803,false,[[10,1],[8,4],[7,[0,13]]]],[-1,27,null,0,false,false,false,693018060570776,false,[[11,"PracticeAttack"],[8,4],[7,[0,9]]]]],[[-1,21,null,153387310587038,false,[[11,"PracticeAttack"],[7,[0,9]]]]]]]],[0,null,false,null,226066774179952,[[-1,43,null,0,false,false,false,650527504183614,false]],[[-1,31,null,777921638261195,false,[[4,50],[5,[0,0]],[0,[0,16]],[0,[0,16]]]],[50,25,null,664980966081108,false,[[7,[2,"FAILURE"]]]],[50,73,null,919358951880040,false,[[0,[0,256]],[0,[0,32]]]],[50,32,null,143812776820792,false,[[10,7],[7,[0,1]]]],[50,87,null,209147796693642,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,100]]]],[50,87,null,393804673495108,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]],[50,87,null,350664351602061,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]]]],[0,null,false,null,580793282266031,[[25,44,null,0,false,false,false,124979388580869,false,[[10,1],[8,4],[7,[0,13]]]],[-1,27,null,0,false,false,false,907220538905454,false,[[11,"PracticeAttack"],[8,0],[7,[0,9]]]]],[[25,30,null,590985587115177,false,[[10,1],[7,[0,23]]]]]]]],[0,null,false,null,831017196623551,[[54,138,null,0,false,true,false,703852682122811,false,[[10,2]]],[-1,39,null,0,false,false,false,865318151737216,false,[[7,[20,3,135,false,null,[[2,"TLIsRunning"]]]],[8,4],[7,[0,0]]]]],[],[[1,"PracticeTargetTest",0,0,false,false,839803078953727,false],[0,null,false,null,650663713813036,[[-1,37,null,0,false,false,false,605810820112301,false]],[[-1,21,null,987288965235691,false,[[11,"PracticeTargetTest"],[7,[23,"PracticeTarget"]]]]]],[0,null,false,null,925466277471302,[[25,44,null,0,false,false,false,770494302783437,false,[[10,1],[8,4],[7,[0,22]]]]],[[-1,21,null,240037854357498,false,[[11,"PracticeTargetTest"],[7,[0,2]]]]]],[0,null,false,null,724967201428597,[[-1,39,null,0,false,false,false,908913099483133,false,[[7,[5,[23,"HP"],[23,"KR"]]],[8,2],[7,[23,"PracticeTargetTest"]]]]],[],[[0,null,false,null,385599985398910,[[25,44,null,0,false,false,false,524581322234996,false,[[10,1],[8,4],[7,[0,22]]]]],[[25,30,null,325676678809995,false,[[10,1],[7,[0,22]]]]]],[0,null,false,null,189038966594761,[[-1,37,null,0,false,false,false,198629089899494,false]],[[-1,21,null,726604368094586,false,[[11,"Failed"],[7,[0,1]]]],[3,20,null,616579381246618,false,[[1,[2,"EndAttack"]],[13]]]]]]]]]]]]]]],["InputManagement",[[0,[true,"InputManagement"],false,null,6386108857925641,[[-1,72,null,0,false,false,false,6386108857925641,false,[[1,[2,"InputManagement"]]]]],[],[[0,null,false,null,4609263787067704,[[-1,17,null,1,false,false,false,7507557338589613,false]],[[-1,31,null,4806822689158794,false,[[4,2],[5,[0,0]],[0,[0,0]],[0,[0,0]]]],[2,30,null,6090395844709057,false,[[10,0],[7,[0,1]]]],[2,30,null,4334685297111526,false,[[10,1],[7,[0,1]]]],[2,30,null,3576673885715529,false,[[10,2],[7,[0,1]]]],[2,30,null,9131145069339217,false,[[10,3],[7,[0,1]]]],[2,30,null,1416485332530768,false,[[10,4],[7,[0,1]]]],[2,30,null,1654398118388641,false,[[10,5],[7,[0,1]]]],[2,30,null,6912276595859616,false,[[10,6],[7,[0,1]]]]]],[0,null,false,null,8840813666946258,[[-1,37,null,0,false,false,false,6426605950705829,false]],[[2,30,null,6631016432276171,false,[[10,7],[7,[21,2,false,null,0]]]],[2,30,null,8133791214538277,false,[[10,8],[7,[21,2,false,null,1]]]],[2,30,null,6270572336755742,false,[[10,9],[7,[21,2,false,null,2]]]],[2,30,null,127816423584293,false,[[10,10],[7,[21,2,false,null,3]]]],[2,30,null,1661304699295616,false,[[10,11],[7,[21,2,false,null,4]]]],[2,30,null,397418474622189,false,[[10,12],[7,[21,2,false,null,5]]]],[2,30,null,2919921392010335,false,[[10,13],[7,[21,2,false,null,6]]]]]],[0,null,false,null,4294682545513989,[[-1,37,null,0,false,false,false,452053121247752,false]],[[2,30,null,4308477622289035,false,[[10,0],[7,[0,0]]]],[2,30,null,5796860298845933,false,[[10,1],[7,[0,0]]]],[2,30,null,4746065936575897,false,[[10,2],[7,[0,0]]]],[2,30,null,4970901921691344,false,[[10,3],[7,[0,0]]]],[2,30,null,9875790490592977,false,[[10,4],[7,[0,0]]]],[2,30,null,9807625275496326,false,[[10,5],[7,[0,0]]]],[2,30,null,9590202895053035,false,[[10,6],[7,[0,0]]]]]],[0,[true,"Gamepad"],false,null,2568520299010306,[[-1,72,null,0,false,false,false,2568520299010306,false,[[1,[2,"Gamepad"]]]]],[],[[1,"DEADZONE",0,25,false,true,347815105392105,false],[1,"ID",0,0,true,false,2136621245663251,false],[0,null,true,null,4176538350632391,[[0,216,null,0,false,false,false,9741879000525306,false,[[0,[23,"ID"]],[3,1],[8,2],[0,[3,[23,"DEADZONE"]]]]],[0,217,null,0,false,false,false,4368358773508708,false,[[0,[23,"ID"]],[3,12]]]],[[2,30,null,3823286924588628,false,[[10,0],[7,[0,1]]]]]],[0,null,true,null,4512975135500185,[[0,216,null,0,false,false,false,88363034135683,false,[[0,[23,"ID"]],[3,1],[8,4],[0,[23,"DEADZONE"]]]],[0,217,null,0,false,false,false,2124029133398757,false,[[0,[23,"ID"]],[3,13]]]],[[2,30,null,5782082524190614,false,[[10,1],[7,[0,1]]]]]],[0,null,true,null,1926108309430191,[[0,216,null,0,false,false,false,8926947896828816,false,[[0,[23,"ID"]],[3,0],[8,2],[0,[3,[23,"DEADZONE"]]]]],[0,217,null,0,false,false,false,8456102855754586,false,[[0,[23,"ID"]],[3,14]]]],[[2,30,null,5991560591094707,false,[[10,2],[7,[0,1]]]]]],[0,null,true,null,344060131127289,[[0,216,null,0,false,false,false,8233388208284703,false,[[0,[23,"ID"]],[3,0],[8,4],[0,[23,"DEADZONE"]]]],[0,217,null,0,false,false,false,5630637615353887,false,[[0,[23,"ID"]],[3,15]]]],[[2,30,null,2707172931762973,false,[[10,3],[7,[0,1]]]]]],[0,null,false,null,7561975166971555,[[0,217,null,0,false,false,false,4140440688929401,false,[[0,[23,"ID"]],[3,0]]]],[[2,30,null,4460183267387267,false,[[10,4],[7,[0,1]]]]]],[0,null,false,null,3430992126100434,[[0,217,null,0,false,false,false,8796805238976963,false,[[0,[23,"ID"]],[3,2]]]],[[2,30,null,3124488412088355,false,[[10,5],[7,[0,1]]]]]],[0,null,false,null,4634220243252997,[[0,217,null,0,false,false,false,5442644202940229,false,[[0,[23,"ID"]],[3,9]]]],[[2,30,null,3912917353377025,false,[[10,6],[7,[0,1]]]]]]]],[0,[true,"Keyboard"],false,null,4884121587429975,[[-1,72,null,0,false,false,false,4884121587429975,false,[[1,[2,"Keyboard"]]]]],[],[[0,null,true,null,1936143924239781,[[1,218,null,0,false,false,false,3552193861153495,false,[[9,38]]],[1,218,null,0,false,false,false,4868003248484891,false,[[9,87]]]],[[2,30,null,5408598788897175,false,[[10,0],[7,[0,1]]]]]],[0,null,true,null,5325358493886754,[[1,218,null,0,false,false,false,594305958852773,false,[[9,40]]],[1,218,null,0,false,false,false,1628045043863816,false,[[9,83]]]],[[2,30,null,2778876906348653,false,[[10,1],[7,[0,1]]]]]],[0,null,true,null,7872809225198566,[[1,218,null,0,false,false,false,1299449188102976,false,[[9,37]]],[1,218,null,0,false,false,false,6476670649189529,false,[[9,65]]]],[[2,30,null,6936900522333045,false,[[10,2],[7,[0,1]]]]]],[0,null,true,null,2614740999858778,[[1,218,null,0,false,false,false,7423979685350929,false,[[9,39]]],[1,218,null,0,false,false,false,6992990226848274,false,[[9,68]]]],[[2,30,null,2987165759825812,false,[[10,3],[7,[0,1]]]]]],[0,null,true,null,1497366882496331,[[1,218,null,0,false,false,false,1186023697088874,false,[[9,90]]],[1,218,null,0,false,false,false,5599487570691262,false,[[9,13]]]],[[2,30,null,6612361141996722,false,[[10,4],[7,[0,1]]]]]],[0,null,true,null,4623232669904996,[[1,218,null,0,false,false,false,5021788616537434,false,[[9,88]]],[1,218,null,0,false,false,false,1588947091940208,false,[[9,16]]]],[[2,30,null,4252777994439934,false,[[10,5],[7,[0,1]]]]]],[0,null,true,null,1556078509265339,[[1,218,null,0,false,false,false,1509728579883262,false,[[9,67]]],[1,218,null,0,false,false,false,596894329683083,false,[[9,17]]]],[[2,30,null,4792830248470232,false,[[10,6],[7,[0,1]]]]]]]],[0,[true,"Touch"],false,null,726194741738483,[[-1,72,null,0,false,false,false,726194741738483,false,[[1,[2,"Touch"]]]]],[],[[0,null,false,null,795051598369363,[[-1,219,null,0,false,false,false,804541384717717,false]],[],[[1,"MobileWarned",0,0,true,false,567741314908991,false],[0,null,false,null,236920128668373,[[-1,17,null,1,false,false,false,380082553913865,false]],[[-1,31,null,370913479255376,false,[[4,51],[5,[2,"Touch"]],[0,[0,592]],[0,[0,48]]]],[-1,31,null,530825832723344,false,[[4,52],[5,[2,"Touch"]],[0,[0,480]],[0,[0,48]]]]],[[0,null,false,null,667540765836737,[[-1,27,null,0,false,false,false,505437346533428,false,[[11,"MobileWarned"],[8,0],[7,[0,0]]]]],[[-1,31,null,375818885423135,false,[[4,49],[5,[2,"Touch"]],[0,[0,16]],[0,[0,400]]]],[49,32,null,222893444387848,false,[[10,0],[7,[2,"MobileWarn"]]]],[49,32,null,312368363882614,false,[[10,7],[7,[0,3]]]],[49,73,null,327090629639428,false,[[0,[0,512]],[0,[0,80]]]],[49,74,null,946531600717532,false,[[0,[0,2]]]],[49,25,null,989636852540768,false,[[7,[2,"Don't play on mobile!\nYou have been warned!"]]]],[-1,21,null,713870393895474,false,[[11,"MobileWarned"],[7,[0,1]]]]]]]],[0,null,false,null,280603110395217,[[6,220,null,1,false,false,false,453502036546672,false]],[[63,221,null,904088374612251,false,[[3,4]]]]],[0,null,false,null,745134333750571,[[6,220,null,1,false,false,false,862379527794763,false],[-1,39,null,0,false,false,false,651137451437577,false,[[7,[20,53,51,false,null]],[8,0],[7,[0,0]]]]],[],[[1,"CanvasX",0,0,false,false,200913029347146,false],[1,"CanvasY",0,0,false,false,278201514538128,false],[1,"X",0,0,false,false,556897614785245,false],[1,"Y",0,0,false,false,478425805027930,false],[1,"StartDPad",0,1,false,false,959706783019112,false],[0,null,false,null,937309899299078,[[-1,37,null,0,false,false,false,839198326880009,false]],[[-1,21,null,469766991599153,false,[[11,"CanvasX"],[7,[20,6,222,false,null,[[20,6,223,false,null]]]]]],[-1,21,null,663637905290338,false,[[11,"CanvasY"],[7,[20,6,224,false,null,[[20,6,223,false,null]]]]]],[-1,21,null,268494791391574,false,[[11,"X"],[7,[19,225,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]],[-1,21,null,579266858650583,false,[[11,"Y"],[7,[19,226,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]],[-1,21,null,893842085849600,false,[[11,"StartDPad"],[7,[0,1]]]]]],[0,null,false,null,856032958932707,[[-1,227,null,0,false,false,false,372409729378271,false,[[4,51],[0,[23,"X"]],[0,[23,"Y"]]]]],[[-1,21,null,903377270620000,false,[[11,"StartDPad"],[7,[0,0]]]]]],[0,null,false,null,231552480403004,[[-1,227,null,0,false,false,false,955997019374758,false,[[4,52],[0,[23,"X"]],[0,[23,"Y"]]]]],[[-1,21,null,643312090155452,false,[[11,"StartDPad"],[7,[0,0]]]]]],[0,null,false,null,786327277455568,[[-1,27,null,0,false,false,false,444245094889309,false,[[11,"StartDPad"],[8,0],[7,[0,1]]]]],[[-1,31,null,555072147695984,false,[[4,53],[5,[2,"Touch"]],[0,[23,"X"]],[0,[23,"Y"]]]],[53,30,null,797711746427196,false,[[10,0],[7,[20,6,223,false,null]]]]]]]],[0,null,false,null,156611426026105,[[6,228,null,1,false,false,false,131505258518113,false,[[4,51]]],[51,44,null,0,false,false,false,600728178781912,false,[[10,0],[8,0],[7,[0,-1]]]]],[[51,30,null,447619448018485,false,[[10,0],[7,[20,6,223,false,null]]]]]],[0,null,false,null,262160649453265,[[6,228,null,1,false,false,false,209901264075008,false,[[4,52]]],[52,44,null,0,false,false,false,397624656428695,false,[[10,0],[8,0],[7,[0,-1]]]]],[[52,30,null,408389051827014,false,[[10,0],[7,[20,6,223,false,null]]]]]],[0,null,false,null,510145506237579,[[6,229,null,1,false,false,false,743999052926286,false],[51,44,null,0,false,false,false,671198875808570,false,[[10,0],[8,0],[7,[20,6,223,false,null]]]]],[[51,30,null,565112206990156,false,[[10,0],[7,[0,-1]]]]]],[0,null,false,null,854691349928665,[[6,229,null,1,false,false,false,651209601277116,false],[52,44,null,0,false,false,false,442375252565031,false,[[10,0],[8,0],[7,[20,6,223,false,null]]]]],[[52,30,null,603323091113707,false,[[10,0],[7,[0,-1]]]]]],[0,null,false,null,455910532065050,[[6,229,null,1,false,false,false,654408151890593,false],[53,44,null,0,false,false,false,958165339942242,false,[[10,0],[8,0],[7,[20,6,223,false,null]]]]],[[53,46,null,930891711947960,false]]],[0,null,false,null,618513189653011,[[-1,39,null,0,false,false,false,347847542826581,false,[[7,[20,53,51,false,null]],[8,4],[7,[0,0]]]]],[],[[1,"CanvasX",0,0,false,false,677585580385193,false],[1,"CanvasY",0,0,false,false,921640891091010,false],[1,"X",0,0,false,false,759293089368178,false],[1,"Y",0,0,false,false,891678533493877,false],[1,"TOUCH_ZONE",0,24,false,true,845876408649566,false],[0,null,false,null,610269434621506,[[-1,37,null,0,false,false,false,682704827463364,false]],[[-1,21,null,241295947317404,false,[[11,"CanvasX"],[7,[20,6,222,false,null,[[21,53,false,null,0]]]]]],[-1,21,null,603206603122152,false,[[11,"CanvasY"],[7,[20,6,224,false,null,[[21,53,false,null,0]]]]]],[-1,21,null,431857125261668,false,[[11,"X"],[7,[19,225,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]],[-1,21,null,112872418539731,false,[[11,"Y"],[7,[19,226,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]]]],[0,null,false,null,849498678331174,[[-1,39,null,0,false,false,false,149136532260509,false,[[7,[23,"Y"]],[8,3],[7,[5,[20,53,77,false,null],[23,"TOUCH_ZONE"]]]]]],[[2,30,null,773694582267750,false,[[10,0],[7,[0,1]]]]]],[0,null,false,null,809499936534555,[[-1,39,null,0,false,false,false,830947680209022,false,[[7,[23,"Y"]],[8,5],[7,[4,[20,53,77,false,null],[23,"TOUCH_ZONE"]]]]]],[[2,30,null,860432365548781,false,[[10,1],[7,[0,1]]]]]],[0,null,false,null,833954426944866,[[-1,39,null,0,false,false,false,233135193669790,false,[[7,[23,"X"]],[8,3],[7,[5,[20,53,76,false,null],[23,"TOUCH_ZONE"]]]]]],[[2,30,null,556463825592813,false,[[10,2],[7,[0,1]]]]]],[0,null,false,null,590163719983862,[[-1,39,null,0,false,false,false,167704999073270,false,[[7,[23,"X"]],[8,5],[7,[4,[20,53,76,false,null],[23,"TOUCH_ZONE"]]]]]],[[2,30,null,883303417801571,false,[[10,3],[7,[0,1]]]]]]]],[0,null,false,null,137791190479244,[[-1,75,null,0,true,false,false,569721919845758,false,[[4,72]]]],[],[[1,"CanvasX",0,0,false,false,225156230173404,false],[1,"CanvasY",0,0,false,false,246582234589773,false],[1,"X",0,0,false,false,926381871953278,false],[1,"Y",0,0,false,false,870371977719287,false],[0,null,false,null,557329239365404,[[-1,37,null,0,false,false,false,173663799341533,false]],[[-1,21,null,126163555432130,false,[[11,"CanvasX"],[7,[20,6,222,false,null,[[21,72,false,null,0]]]]]],[-1,21,null,730704860160591,false,[[11,"CanvasY"],[7,[20,6,224,false,null,[[21,72,false,null,0]]]]]],[-1,21,null,667242117862749,false,[[11,"X"],[7,[19,225,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]],[-1,21,null,984069909766498,false,[[11,"Y"],[7,[19,226,[[2,"Touch"],[23,"CanvasX"],[23,"CanvasY"]]]]]],[72,78,null,931511050509179,false,[[10,1],[3,0]]]]],[0,null,false,null,160251371255659,[[-1,227,null,0,false,false,false,625346223352958,false,[[4,72],[0,[23,"X"]],[0,[23,"Y"]]]]],[[72,78,null,962182570938899,false,[[10,1],[3,1]]]]],[0,null,false,null,139855616301050,[[72,138,null,0,false,false,false,961696175702950,false,[[10,1]]]],[[72,23,null,338639669239050,false,[[1,[2,"Pressed"]],[3,1]]]]],[0,null,false,null,716865146817964,[[72,138,null,0,false,true,false,358330221063880,false,[[10,1]]]],[[72,23,null,895539042729724,false,[[1,[2,"Default"]],[3,1]]]]]]],[0,null,false,null,161667019401513,[[51,138,null,0,false,false,false,785150688927401,false,[[10,1]]]],[[2,30,null,711878732618324,false,[[10,4],[7,[0,1]]]]]],[0,null,false,null,866109962891615,[[52,138,null,0,false,false,false,119729908214219,false,[[10,1]]]],[[2,30,null,461683378764747,false,[[10,5],[7,[0,1]]]]]]]]]]]]]],["Globals",[[1,"HEARTMODE_RED",0,0,false,true,2975789364452609,false],[1,"HEARTMODE_BLUE",0,1,false,true,6376919357343526,false],[1,"MODE_NORMAL",0,0,false,true,7136545053781815,false],[1,"MODE_ENDLESS",0,1,false,true,2256941513066222,false],[1,"MODE_SINGLE",0,2,false,true,7019692061495417,false],[1,"MODE_PRACTICE",0,3,false,true,631186454787328,false],[1,"SimulatorMode",0,0,false,false,2567313271818781,false],[1,"EndlessStage",0,0,false,false,1966297049622465,false],[1,"PracticeTarget",0,60,false,false,824857649224256,false],[1,"SingleAttack",1,"",false,false,9637412728316299,false],[1,"Name",1,"Chara",false,false,8522084662131715,false],[1,"HP",0,92,false,false,4067313995094888,false],[1,"MaxHP",0,92,false,false,2742940924955148,false],[1,"KR",0,0,false,false,2189987320058474,false],[1,"KR_T",0,0,false,false,8948293770944489,false]]],["Timeline",[[0,[true,"Timeline"],false,null,3189756176150723,[[-1,72,null,0,false,false,false,3189756176150723,false,[[1,[2,"Timeline"]]]]],[],[[1,"Running",0,0,true,false,164016619418963,false],[1,"Line",0,0,true,false,2569112556112449,false],[1,"T",0,0,true,false,3521916820909801,false],[1,"PanicFunc",1,"",true,false,7791783949732154,false],[1,"RunCount",0,0,false,false,9944525930039961,false],[0,null,false,null,2254039641608936,[[-1,17,null,1,false,false,false,7018896547668825,false]],[]],[0,null,false,null,8609616850347147,[[3,35,null,2,false,false,false,5647024754506644,false,[[1,[2,"TLPanic"]]]]],[[-1,21,null,6724933633439941,false,[[11,"PanicFunc"],[7,[20,3,38,false,null,[[0,0]]]]]]]],[0,null,false,null,6456238910233819,[[3,35,null,2,false,false,false,8413950224106735,false,[[1,[2,"TLPlay"]]]]],[[43,18,null,4043880612596707,false,[[0,[0,0]],[0,[0,1]],[0,[0,1]]]],[46,230,null,199035075897143,false],[45,230,null,9540461888756735,false],[45,231,null,9571541292875454,false,[[1,[2,"pi"]],[7,[19,145]]]]],[[1,"Text",1,"",false,false,4675986273184942,false],[1,"Count",0,0,false,false,5833990337455875,false],[1,"LineText",1,"",false,false,994152063316607,false],[0,null,false,null,8237544998541837,[[-1,37,null,0,false,false,false,1308534977382981,false]],[[-1,21,null,3353486201389278,false,[[11,"Text"],[7,[20,3,38,false,null,[[0,0]]]]]],[-1,21,null,581698294316397,false,[[11,"Count"],[7,[19,232,[[23,"Text"],[19,106]]]]]]]],[0,null,false,null,5303835360610502,[[-1,100,null,0,true,false,false,342445993445707,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[[-1,21,null,627796758368551,false,[[11,"LineText"],[7,[19,233,[[23,"Text"],[19,102],[19,106]]]]]],[43,19,null,8505514264829205,false,[[3,0],[7,[23,"LineText"]],[3,0]]]],[[1,"Token",1,"",false,false,490445942954178,false],[0,null,false,null,920552072362848,[[-1,37,null,0,false,false,false,210208386153629,false]],[[-1,21,null,875039200175526,false,[[11,"Token"],[7,[19,233,[[23,"LineText"],[0,1],[2,","]]]]]]]],[0,null,false,null,141218749991008,[[-1,39,null,0,false,false,false,101209715078707,false,[[7,[19,234,[[23,"Token"],[0,1]]]],[8,0],[7,[2,":"]]]]],[[-1,21,null,177618613552890,false,[[11,"Token"],[7,[19,235,[[23,"Token"],[0,1],[0,1000]]]]]],[46,231,null,708069663300634,false,[[1,[23,"Token"]],[7,[4,[19,102],[0,1]]]]]]]]],[0,null,false,null,566533122103247,[[-1,37,null,0,false,false,false,7597718902243015,false]],[[-1,21,null,7659055333811825,false,[[11,"T"],[7,[0,0]]]],[-1,21,null,392873617682362,false,[[11,"Line"],[7,[0,1]]]],[3,20,null,5891169844501463,false,[[1,[2,"TLLoadLine"]],[13]]],[-1,21,null,8568195893869202,false,[[11,"Running"],[7,[0,1]]]]]]]],[0,null,false,null,3523753034106027,[[3,35,null,2,false,false,false,789131437661894,false,[[1,[2,"TLLoadLine"]]]]],[[44,18,null,4717811273555051,false,[[0,[0,0]],[0,[0,1]],[0,[0,1]]]]],[[1,"Text",1,"",false,false,525151313925726,false],[1,"Count",0,0,false,false,6896941287466014,false],[0,null,false,null,1732369188360185,[[-1,37,null,0,false,false,false,9447548029177046,false]],[[-1,21,null,4180730130887175,false,[[11,"Text"],[7,[20,43,103,false,null,[[5,[23,"Line"],[0,1]]]]]]],[-1,21,null,5178414055926216,false,[[11,"Count"],[7,[19,232,[[23,"Text"],[2,","]]]]]]]],[0,null,false,null,5176567245084968,[[-1,100,null,0,true,false,false,7258904636189051,false,[[1,[2,""]],[0,[0,0]],[0,[5,[23,"Count"],[0,1]]]]]],[],[[1,"Token",1,"",false,false,5813134866841335,false],[0,null,false,null,3303537346185456,[[-1,37,null,0,false,false,false,2813182794519742,false]],[[-1,21,null,7009258822567905,false,[[11,"Token"],[7,[19,233,[[23,"Text"],[19,102],[2,","]]]]]]]],[0,null,false,null,3366040942905244,[[-1,39,null,0,false,false,false,731509088534453,false,[[7,[19,234,[[23,"Token"],[0,1]]]],[8,0],[7,[2,"$"]]]]],[[44,19,null,4921302976365007,false,[[3,0],[7,[20,45,48,false,null,[[19,235,[[23,"Token"],[0,1],[0,1000]]]]]],[3,0]]]]],[0,null,false,null,5086362468176923,[[-1,43,null,0,false,false,false,3752437806329105,false]],[[44,19,null,8196613844095984,false,[[3,0],[7,[23,"Token"]],[3,0]]]]]]]]],[0,null,false,null,5917404993248573,[[3,35,null,2,false,false,false,1920981737032333,false,[[1,[2,"TLPause"]]]]],[[-1,21,null,5619763145283595,false,[[11,"Running"],[7,[0,0]]]]]],[0,null,false,null,783604814312328,[[3,35,null,2,false,false,false,9495610461070333,false,[[1,[2,"TLResume"]]]]],[[-1,21,null,2699570299241564,false,[[11,"Running"],[7,[0,1]]]]]],[0,null,false,null,942646080486819,[[3,35,null,2,false,false,false,585510407956809,false,[[1,[2,"TLIsRunning"]]]]],[[3,128,null,794982817895681,false,[[7,[23,"Running"]]]]]],[0,null,false,null,6217520153021708,[[3,35,null,2,false,false,false,2682162514664712,false,[[1,[2,"TLStop"]]]]],[[43,18,null,2265398004123804,false,[[0,[0,0]],[0,[0,1]],[0,[0,1]]]],[44,18,null,505000165545568,false,[[0,[0,0]],[0,[0,1]],[0,[0,1]]]],[-1,21,null,8343785129325345,false,[[11,"Running"],[7,[0,0]]]]]],[0,null,false,null,1428685093995084,[[-1,236,null,0,true,false,false,8812571371401865,false],[-1,27,null,0,false,false,false,1551985432453049,false,[[11,"Running"],[8,4],[7,[0,0]]]],[-1,27,null,0,false,false,false,9197285358786317,false,[[11,"Line"],[8,4],[7,[0,0]]]],[-1,27,null,0,false,false,false,2555453304329215,false,[[11,"Line"],[8,3],[7,[20,43,41,false,null]]]],[-1,27,null,0,false,false,false,5768264411078266,false,[[11,"T"],[8,5],[7,[19,69,[[20,44,103,false,null,[[0,0]]]]]]]]],[],[[0,null,false,null,441595194418922,[[-1,39,null,0,false,false,false,392973970922509,false,[[7,[19,234,[[20,44,103,false,null,[[0,1]]],[0,1]]]],[8,1],[7,[2,":"]]]]],[[3,20,null,9188948149072351,false,[[1,[20,44,103,false,null,[[0,1]]]],[13,[7,[20,44,103,false,null,[[0,2]]]],[7,[20,44,103,false,null,[[0,3]]]],[7,[20,44,103,false,null,[[0,4]]]],[7,[20,44,103,false,null,[[0,5]]]],[7,[20,44,103,false,null,[[0,6]]]],[7,[20,44,103,false,null,[[0,7]]]],[7,[20,44,103,false,null,[[0,8]]]],[7,[20,44,103,false,null,[[0,9]]]],[7,[20,44,103,false,null,[[0,10]]]]]]]]],[0,null,false,null,581606449152757,[[-1,37,null,0,false,false,false,741242382187124,false]],[[-1,140,null,98827945093618,false,[[11,"T"],[7,[19,69,[[20,44,103,false,null,[[0,0]]]]]]]],[-1,105,null,4809426407326967,false,[[11,"Line"],[7,[0,1]]]],[3,20,null,5150327441178377,false,[[1,[2,"TLLoadLine"]],[13]]],[-1,105,null,446047117817566,false,[[11,"RunCount"],[7,[0,1]]]]]],[0,null,false,null,6180992534581793,[[-1,27,null,0,false,false,false,351977259641541,false,[[11,"RunCount"],[8,5],[7,[0,1000]]]]],[[-1,21,null,6141834556483224,false,[[11,"Running"],[7,[0,0]]]],[3,20,null,2179763921201474,false,[[1,[23,"PanicFunc"]],[13,[7,[10,[2,"Infinite loop detected line "],[23,"Line"]]]]]]]]]],[0,null,false,null,2435027366513959,[[-1,27,null,0,false,false,false,5334997326638602,false,[[11,"Running"],[8,4],[7,[0,0]]]]],[[-1,105,null,4105200815127006,false,[[11,"T"],[7,[19,85]]]]]],[0,[true,"TimelineCPU"],false,null,7183042865477134,[[-1,72,null,0,false,false,false,7183042865477134,false,[[1,[2,"TimelineCPU"]]]]],[],[[0,null,false,null,266949920645755,[[3,35,null,2,false,false,false,3436886268557925,false,[[1,[2,"SET"]]]]],[[45,231,null,8766818980534129,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[20,3,38,false,null,[[0,1]]]]]]]],[0,null,false,null,5350830767297056,[[3,35,null,2,false,false,false,2413251680775193,false,[[1,[2,"ADD"]]]]],[[45,231,null,7875601331515015,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[4,[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]]]],[0,null,false,null,1164229148863982,[[3,35,null,2,false,false,false,7364701848474987,false,[[1,[2,"SUB"]]]]],[[45,231,null,1957899635483661,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[5,[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]]]],[0,null,false,null,2308474968892975,[[3,35,null,2,false,false,false,8887433681583728,false,[[1,[2,"MUL"]]]]],[[45,231,null,3277391867699549,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[6,[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]]]],[0,null,false,null,465790358768043,[[3,35,null,2,false,false,false,1774415044019791,false,[[1,[2,"DIV"]]]]],[[45,231,null,5446894142994962,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[7,[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]]]],[0,null,false,null,6095177301241438,[[3,35,null,2,false,false,false,3233484220405322,false,[[1,[2,"MOD"]]]]],[[45,231,null,6089001166973198,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[8,[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]]]],[0,null,false,null,1779623599752288,[[3,35,null,2,false,false,false,1469288683393753,false,[[1,[2,"FLOOR"]]]]],[[45,231,null,5737481239798575,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[19,81,[[19,69,[[20,3,38,false,null,[[0,1]]]]]]]]]]]],[0,null,false,null,461956018655108,[[3,35,null,2,false,false,false,472071713789678,false,[[1,[2,"DEG"]]]]],[[45,231,null,572383935453768,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[6,[19,69,[[20,3,38,false,null,[[0,1]]]]],[7,[0,180],[19,145]]]]]]]],[0,null,false,null,518291267810079,[[3,35,null,2,false,false,false,921608665456748,false,[[1,[2,"RAD"]]]]],[[45,231,null,356311286512912,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[6,[19,69,[[20,3,38,false,null,[[0,1]]]]],[7,[19,145],[0,180]]]]]]]],[0,null,false,null,625151839497675,[[3,35,null,2,false,false,false,3110418144506367,false,[[1,[2,"SIN"]]]]],[[45,231,null,4444870976433902,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[19,119,[[19,69,[[20,3,38,false,null,[[0,1]]]]]]]]]]]],[0,null,false,null,9910861118370166,[[3,35,null,2,false,false,false,3430735964125911,false,[[1,[2,"COS"]]]]],[[45,231,null,9574363713335624,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[19,84,[[19,69,[[20,3,38,false,null,[[0,1]]]]]]]]]]]],[0,null,false,null,7596662594055444,[[3,35,null,2,false,false,false,8737168204879962,false,[[1,[2,"ANGLE"]]]]],[[45,231,null,1980261879643212,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[19,155,[[19,69,[[20,3,38,false,null,[[0,1]]]]],[19,69,[[20,3,38,false,null,[[0,2]]]]],[19,69,[[20,3,38,false,null,[[0,3]]]]],[19,69,[[20,3,38,false,null,[[0,4]]]]]]]]]]]],[0,null,false,null,921128455823276,[[3,35,null,2,false,false,false,462564387678964,false,[[1,[2,"RND"]]]]],[[45,231,null,2334452469751044,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[19,81,[[19,82,[[19,70,[[20,3,38,false,null,[[0,1]]]]]]]]]]]]]],[0,null,false,null,1505341681673986,[[3,35,null,2,false,false,false,8265611369593627,false,[[1,[2,"JMPABS"]]]]],[],[[0,null,false,null,632703046616584,[[-1,237,null,0,false,false,false,727952773385178,false,[[1,[20,3,38,false,null,[[0,0]]]],[1,[2,"^[0-9]+$"]],[1,[2,"gi"]]]]],[[-1,21,null,4227031243396213,false,[[11,"Line"],[7,[5,[19,70,[[20,3,38,false,null,[[0,0]]]]],[0,1]]]]]]],[0,null,false,null,175601219748085,[[-1,43,null,0,false,false,false,557884925923938,false]],[],[[0,null,false,null,983635767237469,[[46,238,null,0,false,false,false,793486507696018,false,[[1,[20,3,38,false,null,[[0,0]]]]]]],[[-1,21,null,515402477822357,false,[[11,"Line"],[7,[5,[20,46,48,false,null,[[20,3,38,false,null,[[0,0]]]]],[0,1]]]]]]],[0,null,false,null,639083586808475,[[-1,43,null,0,false,false,false,986808906046058,false]],[[-1,21,null,270131618947330,false,[[11,"Running"],[7,[0,0]]]],[3,20,null,472332076284352,false,[[1,[23,"PanicFunc"]],[13,[7,[10,[10,[10,[2,"Label "],[20,3,38,false,null,[[0,0]]]],[2," does not exist line "]],[23,"Line"]]]]]]]]]]]],[0,null,false,null,4014767211032331,[[3,35,null,2,false,false,false,6109570006296308,false,[[1,[2,"JMPREL"]]]]],[[-1,105,null,3955915391566944,false,[[11,"Line"],[7,[5,[19,70,[[20,3,38,false,null,[[0,0]]]]],[0,1]]]]]]],[0,null,false,null,7201967174029413,[[3,35,null,2,false,false,false,2047844915623503,false,[[1,[2,"JMPZ"]]]],[-1,39,null,0,false,false,false,4447860030973891,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,0],[7,[0,0]]]]],[[3,20,null,4226110563300093,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,9974024709417797,[[3,35,null,2,false,false,false,4563954751366779,false,[[1,[2,"JMPNZ"]]]],[-1,39,null,0,false,false,false,3050211695780313,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,1],[7,[0,0]]]]],[[3,20,null,5699575059813375,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,8934113823755194,[[3,35,null,2,false,false,false,4632073619815941,false,[[1,[2,"JMPE"]]]],[-1,39,null,0,false,false,false,3850453389824172,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,0],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,5832168023989509,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,5349398049630858,[[3,35,null,2,false,false,false,2139865637899805,false,[[1,[2,"JMPNE"]]]],[-1,39,null,0,false,false,false,7714395306822125,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,1],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,7407948973674005,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,7951014499243409,[[3,35,null,2,false,false,false,711832442314621,false,[[1,[2,"JMPL"]]]],[-1,39,null,0,false,false,false,9423464799685922,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,2],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,1440182503988373,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,7087000104953698,[[3,35,null,2,false,false,false,6210693960595906,false,[[1,[2,"JMPNL"]]]],[-1,39,null,0,false,false,false,3718302609951598,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,5],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,1351129984995238,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,1577270632637774,[[3,35,null,2,false,false,false,3035642841260604,false,[[1,[2,"JMPG"]]]],[-1,39,null,0,false,false,false,6708059692386552,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,4],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,1936754171538239,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,8954243981476684,[[3,35,null,2,false,false,false,1208286276518827,false,[[1,[2,"JMPNG"]]]],[-1,39,null,0,false,false,false,5998329245109735,false,[[7,[19,69,[[20,3,38,false,null,[[0,1]]]]]],[8,3],[7,[19,69,[[20,3,38,false,null,[[0,2]]]]]]]]],[[3,20,null,8446339782744578,false,[[1,[2,"JMPABS"]],[13,[7,[20,3,38,false,null,[[0,0]]]]]]]]],[0,null,false,null,799570867765886,[[3,35,null,2,false,false,false,5614606405612878,false,[[1,[2,"GetHeartPos"]]]]],[[45,231,null,9469857669760047,false,[[1,[20,3,38,false,null,[[0,0]]]],[7,[20,54,76,false,null]]]],[45,231,null,3562077084961203,false,[[1,[20,3,38,false,null,[[0,1]]]],[7,[20,54,77,false,null]]]]]],[0,null,false,null,3886775182699761,[[3,35,null,2,false,false,false,3760024388772141,false,[[1,[2,"Debug"]]]]],[[-1,239,null,9575176028302209,false,[[0,[0,0]]]]]]]]]]]],["Fonts",[[0,null,true,null,5834412354404267,[[-1,17,null,1,false,false,false,5276123136482903,false],[47,240,null,1,false,false,false,5603647828736235,false]],[[47,241,null,8299797374752195,false,[[1,[2,"!\"#%-/0123456789<=>?ABCDEFGHIJKLNOPQRSTUVXYZ[\\]_"]],[0,[0,5]]]],[47,241,null,2197363519653944,false,[[1,[2,"\"()<>[]"]],[0,[0,4]]]],[47,241,null,1864998382634315,false,[[1,[2," -"]],[0,[0,3]]]],[47,241,null,6203890301199909,false,[[1,[2,"',.:;"]],[0,[0,2]]]]]],[0,null,true,null,4795387788698696,[[-1,17,null,1,false,false,false,4998938932169473,false],[50,240,null,1,false,false,false,7426065134553322,false]],[[50,241,null,9650715589090074,false,[[1,[2,"~"]],[0,[0,29]]]],[50,241,null,3767000439903289,false,[[1,[2,"\"/<>I^j{}"]],[0,[0,25]]]],[50,241,null,105238651514754,false,[[1,[2,"(),1[]`"]],[0,[0,21]]]],[50,241,null,9166024949406787,false,[[1,[2,"!'.:;il|"]],[0,[0,17]]]]]],[0,null,true,null,7395104558464525,[[-1,17,null,1,false,false,false,8764317874175859,false],[49,240,null,1,false,false,false,1283049899128077,false]],[[49,241,null,9426305873629291,false,[[1,[2,"#%&MWmw~"]],[0,[0,9]]]],[49,241,null,8743203490419181,false,[[1,[2," $*+-./0123456789=?@ABCDEFGHIJKLNOPQRSTUVXYZ\\^abcdefghijklnopqrstuvxyz"]],[0,[0,8]]]],[49,241,null,9617802801173315,false,[[1,[2,"\"<>{}"]],[0,[0,7]]]],[49,241,null,9647746414002747,false,[[1,[2,"!()[]_"]],[0,[0,6]]]],[49,241,null,8426537828249007,false,[[1,[2,"`"]],[0,[0,5]]]],[49,241,null,2731391145283345,false,[[1,[2,"',:;|"]],[0,[0,4]]]]]],[0,null,true,null,8349268623442844,[[-1,17,null,1,false,false,false,1716146488598677,false],[48,240,null,1,false,false,false,6977574469408484,false]],[[48,241,null,6497336779066987,false,[[1,[2,"W"]],[0,[0,15]]]],[48,241,null,3373494692421263,false,[[1,[2,"@"]],[0,[0,14]]]],[48,241,null,9752090473860994,false,[[1,[2,"%Q"]],[0,[0,13]]]],[48,241,null,5812915078730087,false,[[1,[2,"MO"]],[0,[0,12]]]],[48,241,null,9963111089279847,false,[[1,[2,"#&GNVX_"]],[0,[0,11]]]],[48,241,null,9767175346927641,false,[[1,[2," $ACHJSTUYZmw"]],[0,[0,10]]]],[48,241,null,8362350019761206,false,[[1,[2,"247?BDEKdxy~"]],[0,[0,9]]]],[48,241,null,7377273570835338,false,[[1,[2,"*+/0135689FILR\\^abcefghknopqrtuvz"]],[0,[0,8]]]],[48,241,null,7008362902129512,false,[[1,[2,"-=Pjs{}"]],[0,[0,7]]]],[48,241,null,2734689924066968,false,[[1,[2,"()<>[]"]],[0,[0,6]]]],[48,241,null,7950590090426261,false,[[1,[2,"\";`"]],[0,[0,5]]]],[48,241,null,3742913991759232,false,[[1,[2,"!',.:il|"]],[0,[0,4]]]]]]]],["RPGText",[[0,[true,"RPGText"],false,null,8296376404468187,[[-1,72,null,0,false,false,false,8296376404468187,false,[[1,[2,"RPGText"]]]]],[],[[0,null,false,null,696621310651237,[[-1,37,null,0,false,false,false,8469163216815554,false]],[[67,242,null,9960523751992423,false,[[10,6],[7,[19,85]]]]]],[0,null,false,null,4314056516822189,[[67,24,null,0,false,false,false,2634417579601394,false,[[10,5],[8,2],[7,[19,243,[[21,67,true,null,2]]]]]],[67,24,null,0,false,false,false,2022022212601419,false,[[10,6],[8,5],[7,[1,0.03333333333333333]]]]],[[67,244,null,408524020471193,false,[[10,6],[7,[1,0.03333333333333333]]]],[67,242,null,8362167824849778,false,[[10,5],[7,[0,1]]]],[67,25,null,7518104924206699,false,[[7,[19,234,[[21,67,true,null,2],[21,67,false,null,5]]]]]]],[[0,null,false,null,9250345795727429,[[67,24,null,0,false,false,false,6705263475186715,false,[[10,1],[8,1],[7,[2,""]]]]],[[5,66,null,7355169452177231,false,[[3,0],[1,[21,67,true,null,1]],[3,0],[0,[0,0]],[1,[2,""]]]]]]]],[0,null,false,null,6126635417784157,[[67,245,null,0,false,false,false,968785782013304,false,[[10,4]]]],[],[[0,null,false,null,5240008180931907,[[2,44,null,0,false,false,false,73458705002315,false,[[10,4],[8,4],[7,[21,2,false,null,11]]]],[67,24,null,0,false,false,false,4918447702662735,false,[[10,5],[8,0],[7,[19,243,[[21,67,true,null,2]]]]]]],[[67,36,null,7256536697104731,false]]],[0,null,false,null,5817292140589924,[[2,44,null,0,false,false,false,5236349884176463,false,[[10,5],[8,4],[7,[21,2,false,null,12]]]]],[[67,32,null,3103315003842606,false,[[10,5],[7,[19,243,[[21,67,true,null,2]]]]]],[67,25,null,2760218144974743,false,[[7,[21,67,true,null,2]]]],[67,32,null,8328202362150768,false,[[10,6],[7,[0,0]]]]]]]],[0,null,false,null,3806788914992198,[[67,245,null,0,false,true,false,3382842543446457,false,[[10,4]]],[67,24,null,0,false,false,false,5381345791344315,false,[[10,5],[8,0],[7,[19,243,[[21,67,true,null,2]]]]]],[67,24,null,0,false,false,false,1451065962773302,false,[[10,7],[8,4],[7,[0,0]]]]],[[67,244,null,9660525180283579,false,[[10,7],[7,[19,101,[[19,85],[21,67,false,null,7]]]]]]],[[0,null,false,null,9591886275089397,[[67,24,null,0,false,false,false,5494837275376142,false,[[10,7],[8,0],[7,[0,0]]]]],[[67,36,null,4066830284556114,false]]]]],[0,null,false,null,8218860668555562,[[67,246,null,1,false,false,false,8366693311345256,false],[67,24,null,0,false,false,false,3443053290518538,false,[[10,3],[8,1],[7,[2,""]]]]],[[3,20,null,6795146118420306,false,[[1,[21,67,true,null,3]],[13]]]]],[0,null,false,null,9966046875707704,[[3,35,null,2,false,false,false,9245863583993517,false,[[1,[2,"SansText"]]]]],[[-1,31,null,5140099445205868,false,[[4,28],[5,[2,"Enemies"]],[0,[0,0]],[0,[0,0]]]],[28,47,null,5215295811409118,false,[[0,[4,[20,25,76,false,null],[0,64]]]]],[28,90,null,521153523069346,false,[[0,[5,[20,25,77,false,null],[0,128]]]]],[-1,31,null,4187210746447719,false,[[4,48],[5,[2,"Enemies"]],[0,[0,0]],[0,[0,0]]]],[48,247,null,532799251136149,false,[[0,[4,[20,28,76,false,null],[0,32]]]]],[48,248,null,2099097229921674,false,[[0,[4,[20,28,77,false,null],[0,16]]]]],[48,33,null,7720130521571646,false,[[0,[0,256]]]],[48,34,null,146134970176092,false,[[0,[0,64]]]],[48,87,null,4200735038146086,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,0]]]],[48,87,null,942322139526429,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]],[48,87,null,17559158360722,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]],[48,25,null,4926322472318186,false,[[7,[2,""]]]],[48,32,null,9297394273649139,false,[[10,1],[7,[2,"SansSpeak"]]]],[48,32,null,3579480278776148,false,[[10,2],[7,[20,3,38,false,null,[[0,0]]]]]],[48,97,null,8663644470251375,false,[[10,4],[3,1]]],[3,20,null,2408878459908325,false,[[1,[2,"TLPause"]],[13]]]],[[0,null,false,null,7450123142226868,[[3,67,null,0,false,false,false,2650531886532879,false,[[0,[0,1]],[8,0],[7,[2,""]]]]],[[48,32,null,8413461453554266,false,[[10,3],[7,[2,"EndSansText"]]]]]],[0,null,false,null,3101331065007093,[[3,67,null,0,false,false,false,7676177512362368,false,[[0,[0,1]],[8,1],[7,[2,""]]]]],[[48,32,null,2772521790304481,false,[[10,3],[7,[20,3,38,false,null,[[0,1]]]]]]]]]],[0,null,false,null,9808369736759165,[[28,249,null,1,false,false,false,6643684039535598,false],[-1,42,null,0,false,true,false,4962568159748828,false]],[[28,23,null,6110128284087691,false,[[1,[2,"NoEffects"]],[3,1]]]]],[0,null,false,null,6860576825530436,[[3,35,null,2,false,false,false,5697007384212404,false,[[1,[2,"EndSansText"]]]]],[[28,46,null,1037245862595152,false],[3,20,null,786833740848337,false,[[1,[2,"TLResume"]],[13]]]]]]]]],["Items",[[0,null,false,null,2752143210391959,[[-1,17,null,1,false,false,false,8787826234108106,false],[58,250,null,0,false,false,false,1911880163537183,false]],[[3,20,null,3943517466350452,false,[[1,[2,"RegisterItem"]],[13,[7,[0,0]],[7,[0,99]],[7,[2,"Butterscotch Pie"]],[7,[2,"Pie"]]]]],[3,20,null,2866502868054797,false,[[1,[2,"RegisterItem"]],[13,[7,[0,0]],[7,[0,90]],[7,[2,"Instant Noodles"]],[7,[2,"I.Noodles"]]]]],[3,20,null,2972695806626813,false,[[1,[2,"RegisterItem"]],[13,[7,[0,0]],[7,[0,60]],[7,[2,"Face Steak"]],[7,[2,"Steak"]]]]],[3,20,null,8628336839377844,false,[[1,[2,"RegisterItem"]],[13,[7,[0,0]],[7,[0,40]],[7,[2,"Legendary Hero"]],[7,[2,"L. Hero"]]]]]]],[0,null,false,null,3233093914736004,[[3,35,null,2,false,false,false,363661523986421,false,[[1,[2,"RegisterItem"]]]]],[[58,19,null,5239690354155186,false,[[3,0],[7,[0,0]],[3,0]]],[58,251,null,2395370485202404,false,[[0,[5,[20,58,41,false,null],[0,1]]],[0,[0,0]],[7,[20,3,38,false,null,[[0,0]]]]]],[58,251,null,2495033935705209,false,[[0,[5,[20,58,41,false,null],[0,1]]],[0,[0,1]],[7,[20,3,38,false,null,[[0,1]]]]]],[58,251,null,7774260971611081,false,[[0,[5,[20,58,41,false,null],[0,1]]],[0,[0,2]],[7,[20,3,38,false,null,[[0,2]]]]]],[58,251,null,1305926164034302,false,[[0,[5,[20,58,41,false,null],[0,1]]],[0,[0,3]],[7,[20,3,38,false,null,[[0,3]]]]]]]]]],["AttackLoader",[[0,[true,"AttackLoader"],false,null,5235824354903566,[[-1,72,null,0,false,false,false,5235824354903566,false,[[1,[2,"AttackLoader"]]]]],[],[[1,"FileIndex",0,0,true,false,8842408703534389,false],[0,null,false,null,3323177073111975,[[-1,17,null,1,false,false,false,392980208717934,false],[55,252,null,0,false,false,false,6716366940052336,false]],[[60,19,null,4455327624016498,false,[[3,0],[7,[2,"sans_bluebone"]],[3,0]]],[60,19,null,9396866984468434,false,[[3,0],[7,[2,"sans_bonegap1"]],[3,0]]],[60,19,null,8811065622972931,false,[[3,0],[7,[2,"sans_bonegap1fast"]],[3,0]]],[60,19,null,3210289417785432,false,[[3,0],[7,[2,"sans_bonegap2"]],[3,0]]],[60,19,null,2069748953422304,false,[[3,0],[7,[2,"sans_boneslideh"]],[3,0]]],[60,19,null,5059129090672449,false,[[3,0],[7,[2,"sans_boneslidev"]],[3,0]]],[60,19,null,375272527352408,false,[[3,0],[7,[2,"sans_bonestab1"]],[3,0]]],[60,19,null,4170005015431915,false,[[3,0],[7,[2,"sans_bonestab2"]],[3,0]]],[60,19,null,1011321954321543,false,[[3,0],[7,[2,"sans_bonestab3"]],[3,0]]],[60,19,null,9768700699396818,false,[[3,0],[7,[2,"sans_final"]],[3,0]]],[60,19,null,4534521751290753,false,[[3,0],[7,[2,"sans_intro"]],[3,0]]],[60,19,null,3391111219319787,false,[[3,0],[7,[2,"sans_multi1"]],[3,0]]],[60,19,null,8132783675693353,false,[[3,0],[7,[2,"sans_multi2"]],[3,0]]],[60,19,null,8935044343984921,false,[[3,0],[7,[2,"sans_multi3"]],[3,0]]],[60,19,null,9455036665125524,false,[[3,0],[7,[2,"sans_platformblaster"]],[3,0]]],[60,19,null,6647189041973594,false,[[3,0],[7,[2,"sans_platformblasterfast"]],[3,0]]],[60,19,null,1362197829392964,false,[[3,0],[7,[2,"sans_platforms1"]],[3,0]]],[60,19,null,7745298823847402,false,[[3,0],[7,[2,"sans_platforms2"]],[3,0]]],[60,19,null,1260174120863198,false,[[3,0],[7,[2,"sans_platforms3"]],[3,0]]],[60,19,null,8766372860492814,false,[[3,0],[7,[2,"sans_platforms4"]],[3,0]]],[60,19,null,9777307155362394,false,[[3,0],[7,[2,"sans_platforms4hard"]],[3,0]]],[60,19,null,904902605703142,false,[[3,0],[7,[2,"sans_randomblaster1"]],[3,0]]],[60,19,null,2951841823605826,false,[[3,0],[7,[2,"sans_randomblaster2"]],[3,0]]],[60,19,null,7956789796541343,false,[[3,0],[7,[2,"sans_spare"]],[3,0]]],[4,253,null,5737873904560182,false,[[1,[20,60,103,false,null,[[23,"FileIndex"]]]],[1,[10,[20,60,103,false,null,[[23,"FileIndex"]]],[2,".csv"]]]]],[-1,31,null,3506252319395745,false,[[4,47],[5,[0,0]],[0,[0,8]],[0,[0,8]]]],[47,32,null,7557481260664586,false,[[10,0],[7,[2,"Loading"]]]],[47,33,null,6311234250436831,false,[[0,[0,640]]]],[47,34,null,6768412320433234,false,[[0,[0,32]]]],[47,25,null,866871016798015,false,[[7,[10,[10,[10,[2,"LOADING ATTACKS "],[23,"FileIndex"]],[2," / "]],[20,60,41,false,null]]]]]]],[0,null,false,null,5892996856959474,[[4,254,null,1,false,false,false,3267467515272994,false,[[1,[20,60,103,false,null,[[23,"FileIndex"]]]]]]],[[55,231,null,2331652607708607,false,[[1,[20,60,103,false,null,[[23,"FileIndex"]]]],[7,[20,4,255,true,null]]]],[-1,105,null,8186921132855462,false,[[11,"FileIndex"],[7,[0,1]]]]],[[0,null,false,null,560021537350723,[[67,24,null,0,false,false,false,9550501475992979,false,[[10,0],[8,0],[7,[2,"Loading"]]]]],[[67,25,null,3276516335364258,false,[[7,[10,[10,[10,[2,"LOADING ATTACKS "],[23,"FileIndex"]],[2," / "]],[20,60,41,false,null]]]]]]],[0,null,false,null,2426976993845788,[[-1,27,null,0,false,false,false,8862272643220147,false,[[11,"FileIndex"],[8,2],[7,[20,60,41,false,null]]]]],[[4,253,null,9464992944166132,false,[[1,[20,60,103,false,null,[[23,"FileIndex"]]]],[1,[10,[20,60,103,false,null,[[23,"FileIndex"]]],[2,".csv"]]]]]]],[0,null,false,null,804857358706105,[[-1,43,null,0,false,false,false,6220244528545929,false]],[[3,20,null,9375701136055283,false,[[1,[2,"AttackLoadFinished"]],[13]]]],[[0,null,false,null,9037476199038736,[[67,24,null,0,false,false,false,7126214591371814,false,[[10,0],[8,0],[7,[2,"Loading"]]]]],[[67,32,null,2908252134021302,false,[[10,7],[7,[0,1]]]]]]]]]]]]]],["MainMenu",[[2,"InputManagement",false],[2,"Fonts",false],[2,"RPGText",false],[2,"AttackLoader",false],[2,"Menus",false],[0,null,false,null,194677073697328,[[-1,17,null,1,false,false,false,301026708660067,false]],[[-1,31,null,493187173332363,false,[[4,47],[5,[0,0]],[0,[0,8]],[0,[0,416]]]],[47,32,null,605342153352148,false,[[10,0],[7,[2,"Update"]]]],[47,33,null,511018501210371,false,[[0,[0,640]]]],[47,34,null,834519197109982,false,[[0,[0,64]]]],[47,25,null,997228410907339,false,[[7,[2,"UPDATE TEXT"]]]],[47,256,null,633456208298692,false,[[3,0]]]]],[0,null,false,null,566182451496929,[[63,257,null,1,false,false,false,271470835549957,false]],[[63,258,null,186182218521078,false,[[3,0],[7,[2,"[DEBUG] Update found"]]]],[-1,45,null,871492164898327,false,[[0,[0,0]]]]],[[0,null,false,null,735021892660141,[[67,24,null,0,false,false,false,408005518521694,false,[[10,0],[8,0],[7,[2,"Update"]]]]],[[47,25,null,234881402244069,false,[[7,[2,"UPDATE AVAILABLE.\nDOWNLOADING..."]]]],[67,256,null,642147750921346,false,[[3,1]]]]]]],[0,null,false,null,368479293880174,[[63,259,null,1,false,false,false,903434434188712,false]],[[63,258,null,591757470747617,false,[[3,0],[7,[2,"[DEBUG] Update ready"]]]],[-1,45,null,791675166837046,false,[[0,[0,0]]]]],[[0,null,false,null,590699814747872,[[67,24,null,0,false,false,false,890284827607274,false,[[10,0],[8,0],[7,[2,"Update"]]]]],[[67,256,null,989726922429813,false,[[3,1]]],[67,25,null,773819482594290,false,[[7,[2,"UPDATE AVAILABLE.\nPLEASE REFRESH THE PAGE."]]]]]]]],[0,[true,"MainMenu"],false,null,7618724697415427,[[-1,72,null,0,false,false,false,7618724697415427,false,[[1,[2,"MainMenu"]]]]],[],[[0,null,false,null,485041284869353,[[3,35,null,2,false,false,false,6312807226621018,false,[[1,[2,"MenuMain"]]]]],[[56,46,null,8029955601129796,false],[49,36,null,2667792126594554,false],[3,20,null,7882418674263834,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,""]]]]],[-1,31,null,5097830643532841,false,[[4,49],[5,[0,0]],[0,[0,0]],[0,[0,32]]]],[49,73,null,9572232690273981,false,[[0,[0,640]],[0,[0,32]]]],[49,74,null,2377617122476924,false,[[0,[0,2]]]],[49,25,null,6017732506802038,false,[[7,[2,"Select your bad time"]]]],[49,260,null,6681899051898119,false,[[3,1]]],[3,20,null,121948490218354,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,96]],[7,[0,0]],[7,[2,"Normal"]],[7,[2,"MenuModeNormal"]]]]],[3,20,null,574106720171711,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,128]],[7,[0,1]],[7,[2,"Practice"]],[7,[2,"MenuModePractice"]]]]],[3,20,null,304790185942551,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,160]],[7,[0,2]],[7,[2,"Endless"]],[7,[2,"MenuModeEndless"]]]]],[3,20,null,326311762535984,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,192]],[7,[0,3]],[7,[2,"Single attack"]],[7,[2,"MenuModeSingle"]]]]],[3,20,null,516406951993025,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,224]],[7,[0,4]],[7,[2,"Custom attack"]],[7,[2,"MenuModeCustom"]]]]]]],[0,null,false,null,1934787540782705,[[3,35,null,2,false,false,false,5152785738951064,false,[[1,[2,"MenuModeNormal"]]]]],[[-1,21,null,8492232441859258,false,[[11,"SimulatorMode"],[7,[23,"MODE_NORMAL"]]]],[-1,65,null,6921132940594369,false,[[6,"BattleScreen"]]]]],[0,null,false,null,732992713640422,[[3,35,null,2,false,false,false,630588370956338,false,[[1,[2,"MenuModePractice"]]]]],[[-1,21,null,430576558749824,false,[[11,"SimulatorMode"],[7,[23,"MODE_PRACTICE"]]]],[-1,65,null,198624542462292,false,[[6,"BattleScreen"]]]]],[0,null,false,null,8566872012264114,[[3,35,null,2,false,false,false,6357036453760765,false,[[1,[2,"MenuModeEndless"]]]]],[[56,46,null,4876547611972064,false],[49,36,null,9716864372445079,false],[3,20,null,3898774398935571,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuMain"]]]]],[-1,21,null,652672334406652,false,[[11,"SimulatorMode"],[7,[23,"MODE_ENDLESS"]]]]],[[0,null,false,null,1993663655527849,[[-1,100,null,0,true,false,false,7340921845684781,false,[[1,[2,""]],[0,[0,0]],[0,[0,1]]]]],[[3,20,null,158277619791938,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[4,[0,96],[6,[19,102],[0,32]]]],[7,[19,102]],[7,[10,[2,"Phase "],[4,[19,102],[0,1]]]],[7,[2,"MenuEndless"]]]]]]]]],[0,null,false,null,3480766274282799,[[3,35,null,2,false,false,false,891253885861754,false,[[1,[2,"MenuEndless"]]]]],[[-1,21,null,958333354220335,false,[[11,"EndlessStage"],[7,[20,61,103,false,null,[[5,[20,61,41,false,null],[0,2]]]]]]],[-1,65,null,5426232936612767,false,[[6,"BattleScreen"]]]]],[0,null,false,null,8440787368101829,[[3,35,null,2,false,false,false,3488534236377242,false,[[1,[2,"MenuModeSingle"]]]]],[[56,46,null,2007414306464213,false],[49,36,null,8210127351655443,false],[3,20,null,4849523377919098,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuMain"]]]]],[-1,21,null,1371758894200221,false,[[11,"SimulatorMode"],[7,[23,"MODE_SINGLE"]]]],[-1,31,null,4719384433315021,false,[[4,49],[5,[0,0]],[0,[0,0]],[0,[0,32]]]],[49,73,null,9218861551471155,false,[[0,[0,640]],[0,[0,32]]]],[49,74,null,9096353482776745,false,[[0,[0,2]]]],[49,25,null,4129082167688271,false,[[7,[2,"Choose an attack"]]]],[49,260,null,812164509132716,false,[[3,1]]]],[[0,null,false,null,2551204829762468,[[-1,100,null,0,true,false,false,4888335628692321,false,[[1,[2,""]],[0,[0,0]],[0,[5,[20,60,41,false,null],[0,1]]]]]],[[3,20,null,307989349234234,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[4,[0,96],[6,[19,102],[0,32]]]],[7,[19,102]],[7,[20,60,103,false,null,[[19,102]]]],[7,[2,"MenuSingleAttack"]]]]]]]]],[0,null,false,null,2192146727750086,[[3,35,null,2,false,false,false,4024702740002228,false,[[1,[2,"MenuSingleAttack"]]]]],[[-1,21,null,418412347711597,false,[[11,"SingleAttack"],[7,[20,60,103,false,null,[[20,61,103,false,null,[[5,[20,61,41,false,null],[0,2]]]]]]]]],[-1,65,null,9595352188215692,false,[[6,"BattleScreen"]]]]],[0,null,false,null,963583744925542,[[3,35,null,2,false,false,false,6849994863830874,false,[[1,[2,"MenuModeCustom"]]]]],[[56,46,null,5653190402635955,false],[49,36,null,9147357918666116,false],[62,261,null,7873626107978393,false],[3,20,null,1302946453882055,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuMain"]]]]],[-1,31,null,8289907011469804,false,[[4,49],[5,[0,0]],[0,[0,0]],[0,[0,32]]]],[49,73,null,6270522023803733,false,[[0,[0,640]],[0,[0,32]]]],[49,74,null,9060833632224235,false,[[0,[0,2]]]],[49,25,null,63601467630781,false,[[7,[2,"Custom attack"]]]],[49,260,null,641170030262494,false,[[3,1]]],[-1,21,null,9409175181526048,false,[[11,"SimulatorMode"],[7,[23,"MODE_SINGLE"]]]],[3,20,null,131065348070977,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,96]],[7,[0,0]],[7,[2,"Documentation"]],[7,[2,""]]]]],[3,20,null,363254892081796,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,128]],[7,[0,1]],[7,[2,"Load file"]],[7,[2,"MenuCustomSelect"]]]]]],[[1,"Action",1,"",false,false,750606889767726,false],[0,null,false,null,5556763763617329,[[55,238,null,0,false,false,false,3443274778672137,false,[[1,[2,"custom"]]]]],[[-1,21,null,679614942751458,false,[[11,"Action"],[7,[2,"MenuCustomRun"]]]]]],[0,null,false,null,933808084676421,[[-1,37,null,0,false,false,false,678880668806750,false]],[[3,20,null,133977934621254,false,[[1,[2,"CreateMenuItem"]],[13,[7,[0,0]],[7,[0,192]],[7,[0,160]],[7,[0,2]],[7,[2,"Run attack"]],[7,[23,"Action"]]]]]]]]],[0,null,false,null,9054944955083307,[[3,35,null,2,false,false,false,1137774981259011,false,[[1,[2,"MenuCustomSelect"]]]]],[[56,46,null,8400962482911318,false],[49,36,null,4432629290632502,false],[3,20,null,3348489213393067,false,[[1,[2,"MenuBackAction"]],[13,[7,[2,"MenuModeCustom"]]]]],[-1,31,null,7277637630369302,false,[[4,56],[5,[0,0]],[0,[0,192]],[0,[0,96]]]],[56,78,null,2159555875386753,false,[[10,4],[3,1]]],[-1,31,null,1755543219714336,false,[[4,62],[5,[0,0]],[0,[0,224]],[0,[0,96]]]],[63,262,null,633282825002353,false,[[1,[2,"document.getElementById('filechooser').focus();"]]]]]],[0,null,false,null,7985503632529348,[[3,35,null,2,false,false,false,6709395051738056,false,[[1,[2,"MenuCustomRun"]]]]],[[-1,21,null,5872857608887822,false,[[11,"SingleAttack"],[7,[2,"custom"]]]],[-1,65,null,3586928206039241,false,[[6,"BattleScreen"]]]]],[0,null,false,null,4647217044743368,[[62,263,null,1,false,false,false,9102398507502319,false]],[[4,253,null,2309179160700937,false,[[1,[2,"custom"]],[1,[20,62,264,true,null,[[0,0]]]]]]]],[0,null,false,null,3298027994454229,[[4,254,null,1,false,false,false,8558685013424337,false,[[1,[2,"custom"]]]]],[[55,231,null,3047116548548368,false,[[1,[2,"custom"]],[7,[20,4,255,true,null]]]],[-1,31,null,9490153154596489,false,[[4,47],[5,[0,0]],[0,[0,8]],[0,[0,8]]]],[47,25,null,1740537707642743,false,[[7,[2,"CUSTOM ATTACK LOADED"]]]],[47,33,null,5325527041498359,false,[[0,[0,640]]]],[47,34,null,5211929348730813,false,[[0,[0,32]]]],[47,32,null,9241165621789806,false,[[10,7],[7,[0,1]]]]]],[0,null,false,null,2930222903867678,[[-1,17,null,1,false,false,false,8676844751034461,false]],[[-1,21,null,7389657786042543,false,[[11,"HP"],[7,[23,"MaxHP"]]]]]],[0,null,true,null,3934138391911,[[-1,17,null,1,false,false,false,1041146530268575,false],[3,35,null,2,false,false,false,7258591913794977,false,[[1,[2,"AttackLoadFinished"]]]]],[],[[0,null,false,null,9761831204163876,[[-1,39,null,0,false,false,false,5831726787230615,false,[[7,[20,55,40,false,null]],[8,5],[7,[20,60,41,false,null]]]]],[[-1,31,null,1543908224383827,false,[[4,54],[5,[0,0]],[0,[0,0]],[0,[0,0]]]],[54,125,null,2501214630109601,false,[[0,[0,90]]]],[54,126,null,5348712262903138,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,100]]]],[54,126,null,3100769631086494,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,0]]]],[54,126,null,1761116705025522,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,0]]]],[54,57,null,7722436274433268,false,[[3,1]]],[3,20,null,9637040683959957,false,[[1,[2,"MenuMain"]],[13]]]],[[1,"FirstStart",0,1,true,false,9570519099240379,false],[0,null,false,null,6664513252215855,[[-1,27,null,0,false,false,false,4646122072848713,false,[[11,"FirstStart"],[8,0],[7,[0,1]]]]],[[-1,21,null,2686144668273752,false,[[11,"FirstStart"],[7,[0,0]]]]],[[0,null,false,null,1419878553554108,[[-1,39,null,0,false,false,false,9775557357179387,false,[[7,[20,63,265,true,null,[[2,"mode"]]]],[8,0],[7,[2,"normal"]]]]],[[-1,21,null,7856715718170849,false,[[11,"SimulatorMode"],[7,[23,"MODE_NORMAL"]]]],[-1,65,null,2250937489427595,false,[[6,"BattleScreen"]]]]],[0,null,false,null,4698512175436133,[[-1,39,null,0,false,false,false,7503384418264523,false,[[7,[20,63,265,true,null,[[2,"mode"]]]],[8,0],[7,[2,"endless1"]]]]],[[-1,21,null,2615427988409121,false,[[11,"SimulatorMode"],[7,[23,"MODE_ENDLESS"]]]],[-1,21,null,3348766332315247,false,[[11,"EndlessStage"],[7,[0,0]]]],[-1,65,null,7000769931317483,false,[[6,"BattleScreen"]]]]],[0,null,false,null,9073934813284889,[[-1,39,null,0,false,false,false,484871644179359,false,[[7,[20,63,265,true,null,[[2,"mode"]]]],[8,0],[7,[2,"endless2"]]]]],[[-1,21,null,6999416949166913,false,[[11,"SimulatorMode"],[7,[23,"MODE_ENDLESS"]]]],[-1,21,null,474366002640576,false,[[11,"EndlessStage"],[7,[0,1]]]],[-1,65,null,8062297581304893,false,[[6,"BattleScreen"]]]]],[0,null,false,null,2476943766740757,[[-1,39,null,0,false,false,false,8615747155016074,false,[[7,[20,63,265,true,null,[[2,"mode"]]]],[8,0],[7,[2,"single"]]]],[55,238,null,0,false,false,false,3953270010473576,false,[[1,[20,63,265,true,null,[[2,"attack"]]]]]]],[[-1,21,null,2855488460274073,false,[[11,"SimulatorMode"],[7,[23,"MODE_SINGLE"]]]],[-1,21,null,5672583306802497,false,[[11,"SingleAttack"],[7,[20,63,265,true,null,[[2,"attack"]]]]]],[-1,65,null,9484533986639156,false,[[6,"BattleScreen"]]]]]]]]]]],[0,null,false,null,8117646656898948,[[-1,37,null,0,false,false,false,8804230401905531,false]],[[3,20,null,4814368117172139,false,[[1,[2,"RunMenu"]],[13]]]]],[0,null,false,null,1750963108900187,[[56,44,null,0,false,false,false,9954261844587415,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[[54,47,null,5597482814778178,false,[[0,[4,[20,56,76,false,null],[0,8]]]]],[54,90,null,5742475648674647,false,[[0,[4,[20,56,77,false,null],[0,12]]]]],[-1,213,null,8533637664891725,false,[[0,[5,[20,56,77,false,null],[0,16]]]]]]]]]]],["Menus",[[0,[true,"Menus"],false,null,9544187866392408,[[-1,72,null,0,false,false,false,9544187866392408,false,[[1,[2,"Menus"]]]]],[],[[0,null,false,null,8695406175781546,[[-1,17,null,1,false,false,false,2536306279577205,false]],[[61,18,null,6521126164740445,false,[[0,[0,1]],[0,[0,2]],[0,[0,1]]]],[61,266,null,2237702793427054,false,[[0,[0,0]],[7,[0,0]]]],[61,251,null,716159479864057,false,[[0,[0,0]],[0,[0,1]],[7,[2,""]]]]]],[0,null,false,null,4828060419500584,[[3,35,null,2,false,false,false,2564267408156807,false,[[1,[2,"MenuBackAction"]]]]],[[61,251,null,9110991041588691,false,[[0,[5,[20,61,41,false,null],[0,1]]],[0,[0,1]],[7,[20,3,38,false,null,[[0,0]]]]]]]],[0,null,false,null,6812480347916221,[[3,35,null,2,false,false,false,6093544036389522,false,[[1,[2,"MenuSelect"]]]],[56,44,null,0,false,false,false,8318217981666953,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]]],[],[[1,"ID",0,0,false,false,2815912854738037,false],[1,"X",0,0,false,false,8524770482276571,false],[1,"Y",0,0,false,false,9238547187654585,false],[1,"TargetID",0,0,false,false,233166752012437,false],[1,"TargetDist",0,0,false,false,2410064365196961,false],[0,null,false,null,1594152053817437,[[-1,37,null,0,false,false,false,4272555456716721,false]],[[-1,21,null,4594994607758385,false,[[11,"ID"],[7,[21,56,false,null,0]]]],[-1,21,null,696878987565706,false,[[11,"X"],[7,[20,56,76,false,null]]]],[-1,21,null,8293651089226726,false,[[11,"Y"],[7,[20,56,77,false,null]]]],[-1,21,null,9776927128359744,false,[[11,"TargetID"],[7,[0,-1]]]],[-1,21,null,1609227162741931,false,[[11,"TargetDist"],[7,[19,267]]]]]],[0,null,false,null,8905070602913116,[[-1,109,null,0,false,false,false,1653500525400594,false,[[4,56]]],[56,44,null,0,false,false,false,6364681126252615,false,[[10,0],[8,1],[7,[23,"ID"]]]],[-1,75,null,0,true,false,false,5387478993854357,false,[[4,56]]]],[],[[1,"Ang",0,0,false,false,7217441111294608,false],[1,"Dist",0,0,false,false,1707862956084376,false],[0,null,false,null,4024397130339288,[[-1,37,null,0,false,false,false,8217736276366752,false]],[[-1,21,null,8249840543647935,false,[[11,"Ang"],[7,[19,155,[[23,"X"],[23,"Y"],[20,56,76,false,null],[20,56,77,false,null]]]]]]]],[0,null,false,null,3221251959880023,[[-1,154,null,0,false,false,false,4670233778268817,false,[[0,[23,"Ang"]],[0,[1,0.5]],[0,[6,[20,3,38,false,null,[[0,0]]],[0,90]]]]]],[[-1,21,null,2878356591442433,false,[[11,"Dist"],[7,[19,268,[[23,"X"],[23,"Y"],[20,56,76,false,null],[20,56,77,false,null]]]]]]],[[0,null,false,null,8763702995733969,[[-1,27,null,0,false,false,false,7408325317196445,false,[[11,"Dist"],[8,2],[7,[23,"TargetDist"]]]]],[[-1,21,null,6677787101670142,false,[[11,"TargetDist"],[7,[23,"Dist"]]]],[-1,21,null,7672361800870457,false,[[11,"TargetID"],[7,[21,56,false,null,0]]]]]]]]]],[0,null,false,null,6829704236924412,[[-1,27,null,0,false,false,false,6840381072597691,false,[[11,"TargetID"],[8,0],[7,[0,-1]]]]],[[-1,21,null,9719461567624534,false,[[11,"TargetDist"],[7,[3,[19,267]]]]]]],[0,null,false,null,7205705008682332,[[-1,27,null,0,false,false,false,1946523089989991,false,[[11,"TargetID"],[8,0],[7,[0,-1]]]],[-1,109,null,0,false,false,false,5495910486778289,false,[[4,56]]],[56,44,null,0,false,false,false,1200038864830058,false,[[10,0],[8,1],[7,[23,"ID"]]]],[-1,75,null,0,true,false,false,1002550783929431,false,[[4,56]]]],[],[[1,"Ang",0,0,false,false,1649473131817865,false],[1,"Dist",0,0,false,false,6161590805861242,false],[0,null,false,null,3288759695950013,[[-1,37,null,0,false,false,false,6644303941234649,false]],[[-1,21,null,8469540403391451,false,[[11,"Ang"],[7,[19,155,[[23,"X"],[23,"Y"],[20,56,76,false,null],[20,56,77,false,null]]]]]]]],[0,null,false,null,2101686034581306,[[-1,154,null,0,false,false,false,3642588278070715,false,[[0,[23,"Ang"]],[0,[1,0.5]],[0,[5,[6,[20,3,38,false,null,[[0,0]]],[0,90]],[0,180]]]]]],[[-1,21,null,6365109525161081,false,[[11,"Dist"],[7,[19,268,[[23,"X"],[23,"Y"],[20,56,76,false,null],[20,56,77,false,null]]]]]]],[[0,null,false,null,4105919903643933,[[-1,27,null,0,false,false,false,8685340577799612,false,[[11,"Dist"],[8,4],[7,[23,"TargetDist"]]]]],[[-1,21,null,282073525690326,false,[[11,"TargetDist"],[7,[23,"Dist"]]]],[-1,21,null,1729884442476336,false,[[11,"TargetID"],[7,[21,56,false,null,0]]]]]]]]]],[0,null,false,null,9469077732291459,[[-1,27,null,0,false,false,false,7794111895385165,false,[[11,"TargetID"],[8,1],[7,[0,-1]]]]],[[61,266,null,8260832488824598,false,[[0,[5,[20,61,41,false,null],[0,1]]],[7,[23,"TargetID"]]]],[5,29,null,8688491376371888,false,[[2,["menucursor",false]],[3,0],[0,[0,0]],[1,[2,""]]]]]]]],[0,null,false,null,6223600297693287,[[3,35,null,2,false,false,false,8551949843133107,false,[[1,[2,"RunMenu"]]]]],[],[[0,null,false,null,6930416785468451,[[2,44,null,0,false,false,false,3614830499205843,false,[[10,4],[8,4],[7,[21,2,false,null,11]]]],[56,44,null,0,false,false,false,2942145973121762,false,[[10,0],[8,0],[7,[20,61,108,false,null]]]],[56,44,null,0,false,false,false,3593834327907471,false,[[10,2],[8,1],[7,[2,""]]]]],[[63,258,null,435889489248309,false,[[3,0],[7,[10,[2,"MenuConfirm on tick "],[19,269]]]]],[61,19,null,1536698611713637,false,[[3,0],[7,[0,0]],[3,0]]],[3,20,null,4344933988603167,false,[[1,[21,56,true,null,2]],[13]]],[5,29,null,2924208778412062,false,[[2,["menuselect",false]],[3,0],[0,[0,0]],[1,[2,""]]]]]],[0,null,false,null,4734399919399368,[[-1,43,null,0,false,false,false,308674648687820,false],[2,44,null,0,false,false,false,4808674276307461,false,[[10,5],[8,4],[7,[21,2,false,null,12]]]],[61,104,null,0,false,false,false,3783945059357823,false,[[0,[5,[20,61,41,false,null],[0,1]]],[0,[0,1]],[8,1],[7,[2,""]]]]],[[63,258,null,154371849874513,false,[[3,0],[7,[10,[2,"MenuBack on tick "],[19,269]]]]]],[[1,"FuncName",1,"",false,false,7156101104530386,false],[0,null,false,null,8656451840730673,[[-1,37,null,0,false,false,false,122651102211695,false]],[[-1,21,null,1553611434833798,false,[[11,"FuncName"],[7,[20,61,103,false,null,[[5,[20,61,41,false,null],[0,1]],[0,1]]]]]],[61,99,null,7479290068950634,false,[[3,0],[3,0]]],[3,20,null,6459164775285865,false,[[1,[23,"FuncName"]],[13]]],[5,29,null,57483967232436,false,[[2,["menuselect",false]],[3,0],[0,[0,0]],[1,[2,""]]]]]]]],[0,null,false,null,3623176702869784,[[-1,43,null,0,false,false,false,287766461887018,false],[2,44,null,0,false,false,false,898589353683862,false,[[10,3],[8,4],[7,[21,2,false,null,10]]]]],[[3,20,null,4772068308290439,false,[[1,[2,"MenuSelect"]],[13,[7,[0,0]]]]]]],[0,null,false,null,6779122092723648,[[-1,43,null,0,false,false,false,794848382564229,false],[2,44,null,0,false,false,false,3125005000489827,false,[[10,1],[8,4],[7,[21,2,false,null,8]]]]],[[3,20,null,7640007335314225,false,[[1,[2,"MenuSelect"]],[13,[7,[0,1]]]]]]],[0,null,false,null,660878264850284,[[-1,43,null,0,false,false,false,951370061259571,false],[2,44,null,0,false,false,false,4503769246353106,false,[[10,2],[8,4],[7,[21,2,false,null,9]]]]],[[3,20,null,4837707612071206,false,[[1,[2,"MenuSelect"]],[13,[7,[0,2]]]]]]],[0,null,false,null,241784578323823,[[-1,43,null,0,false,false,false,115749243633628,false],[2,44,null,0,false,false,false,4912713479807678,false,[[10,0],[8,4],[7,[21,2,false,null,7]]]]],[[3,20,null,42579712605309,false,[[1,[2,"MenuSelect"]],[13,[7,[0,3]]]]]]],[0,null,false,null,2235330471124206,[[-1,75,null,0,true,false,false,8221596592820572,false,[[4,56]]],[49,24,null,0,false,false,false,8846094253967087,false,[[10,0],[8,0],[7,[10,[2,"Menu"],[21,56,false,null,0]]]]]],[[49,247,null,8960724429087305,false,[[0,[4,[20,56,76,false,null],[0,32]]]]],[49,248,null,9751887006413896,false,[[0,[20,56,77,false,null]]]]]]]],[0,null,false,null,198398755542197,[[3,35,null,2,false,false,false,766090744744271,false,[[1,[2,"CreateMenuItem"]]]]],[[-1,31,null,248654370483502,false,[[4,56],[5,[20,3,38,false,null,[[0,0]]]],[0,[20,3,38,false,null,[[0,1]]]],[0,[20,3,38,false,null,[[0,2]]]]]],[56,30,null,295255653641432,false,[[10,0],[7,[20,3,38,false,null,[[0,3]]]]]],[56,30,null,266107689626120,false,[[10,1],[7,[20,3,38,false,null,[[0,4]]]]]],[56,30,null,596023311969026,false,[[10,2],[7,[20,3,38,false,null,[[0,5]]]]]],[3,128,null,511741908287164,false,[[7,[20,56,196,false,null]]]],[-1,31,null,593416691206548,false,[[4,49],[5,[0,0]],[0,[4,[20,56,76,false,null],[0,32]]],[0,[20,56,77,false,null]]]],[49,73,null,405916427729181,false,[[0,[0,512]],[0,[0,96]]]],[49,74,null,161240728466197,false,[[0,[0,2]]]],[49,25,null,300716580761740,false,[[7,[21,56,true,null,1]]]],[49,32,null,994902184646253,false,[[10,0],[7,[10,[2,"Menu"],[21,56,false,null,0]]]]]],[[0,null,false,null,4459952550089159,[[56,44,null,0,false,false,false,6476568399148247,false,[[10,2],[8,0],[7,[2,""]]]]],[[49,87,null,6030058075119234,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[0,50]]]],[49,87,null,5748182833587719,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[0,50]]]],[49,87,null,5671655371911134,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[0,50]]]]]]]]]]]]],[["ding.ogg",8750],["playerfight.ogg",10322],["playerdamaged.ogg",8387],["sansspeak.ogg",5979],["gasterblaster.ogg",16703],["bonestab.ogg",8912],["warning.ogg",8624],["heartshatter.ogg",12879],["gasterblast.ogg",22975],["flash.ogg",4925],["slam.ogg",9796],["menuselect.ogg",7949],["heartsplit.ogg",5946],["menucursor.ogg",4616],["battletext.ogg",7507],["playerheal.ogg",8887],["gasterblast2.ogg",27218]],"media/",true,640,480,5,true,false,true,"1.0.0.0",true,false,0,0,66,false,false,0,true,"Bad Time Simulator (Sans Fight)",0,[[32,40,31,42,41],[34,33]]]} \ No newline at end of file diff --git a/badtimesimulator/icon-114.png b/badtimesimulator/icon-114.png new file mode 100644 index 00000000..ba99ee59 Binary files /dev/null and b/badtimesimulator/icon-114.png differ diff --git a/badtimesimulator/icon-128.png b/badtimesimulator/icon-128.png new file mode 100644 index 00000000..954c3a6b Binary files /dev/null and b/badtimesimulator/icon-128.png differ diff --git a/badtimesimulator/icon-16.png b/badtimesimulator/icon-16.png new file mode 100644 index 00000000..8a14aca8 Binary files /dev/null and b/badtimesimulator/icon-16.png differ diff --git a/badtimesimulator/icon-256.png b/badtimesimulator/icon-256.png new file mode 100644 index 00000000..324f16fc Binary files /dev/null and b/badtimesimulator/icon-256.png differ diff --git a/badtimesimulator/icon-32.png b/badtimesimulator/icon-32.png new file mode 100644 index 00000000..ab858050 Binary files /dev/null and b/badtimesimulator/icon-32.png differ diff --git a/badtimesimulator/images/battlefont.png b/badtimesimulator/images/battlefont.png new file mode 100644 index 00000000..60383d63 Binary files /dev/null and b/badtimesimulator/images/battlefont.png differ diff --git a/badtimesimulator/images/boneh.png b/badtimesimulator/images/boneh.png new file mode 100644 index 00000000..3ddd6397 Binary files /dev/null and b/badtimesimulator/images/boneh.png differ diff --git a/badtimesimulator/images/bonestabh.png b/badtimesimulator/images/bonestabh.png new file mode 100644 index 00000000..fe7b9a59 Binary files /dev/null and b/badtimesimulator/images/bonestabh.png differ diff --git a/badtimesimulator/images/bonestabv.png b/badtimesimulator/images/bonestabv.png new file mode 100644 index 00000000..0b3741f1 Binary files /dev/null and b/badtimesimulator/images/bonestabv.png differ diff --git a/badtimesimulator/images/bonestabwarn.png b/badtimesimulator/images/bonestabwarn.png new file mode 100644 index 00000000..b4364884 Binary files /dev/null and b/badtimesimulator/images/bonestabwarn.png differ diff --git a/badtimesimulator/images/bonev.png b/badtimesimulator/images/bonev.png new file mode 100644 index 00000000..6af84803 Binary files /dev/null and b/badtimesimulator/images/bonev.png differ diff --git a/badtimesimulator/images/combatzone.png b/badtimesimulator/images/combatzone.png new file mode 100644 index 00000000..a97e1f63 Binary files /dev/null and b/badtimesimulator/images/combatzone.png differ diff --git a/badtimesimulator/images/combatzoneborder.png b/badtimesimulator/images/combatzoneborder.png new file mode 100644 index 00000000..da45bc68 Binary files /dev/null and b/badtimesimulator/images/combatzoneborder.png differ diff --git a/badtimesimulator/images/combatzoneclipper.png b/badtimesimulator/images/combatzoneclipper.png new file mode 100644 index 00000000..e0eac4e5 Binary files /dev/null and b/badtimesimulator/images/combatzoneclipper.png differ diff --git a/badtimesimulator/images/combatzoneunclipper.png b/badtimesimulator/images/combatzoneunclipper.png new file mode 100644 index 00000000..36d2ceb4 Binary files /dev/null and b/badtimesimulator/images/combatzoneunclipper.png differ diff --git a/badtimesimulator/images/damagefont.png b/badtimesimulator/images/damagefont.png new file mode 100644 index 00000000..abebf6fc Binary files /dev/null and b/badtimesimulator/images/damagefont.png differ diff --git a/badtimesimulator/images/defaultfont.png b/badtimesimulator/images/defaultfont.png new file mode 100644 index 00000000..7a998cb7 Binary files /dev/null and b/badtimesimulator/images/defaultfont.png differ diff --git a/badtimesimulator/images/gasterblast.png b/badtimesimulator/images/gasterblast.png new file mode 100644 index 00000000..36d2ceb4 Binary files /dev/null and b/badtimesimulator/images/gasterblast.png differ diff --git a/badtimesimulator/images/gasterblaster-sheet0.png b/badtimesimulator/images/gasterblaster-sheet0.png new file mode 100644 index 00000000..2bd340d0 Binary files /dev/null and b/badtimesimulator/images/gasterblaster-sheet0.png differ diff --git a/badtimesimulator/images/gasterblaster-sheet1.png b/badtimesimulator/images/gasterblaster-sheet1.png new file mode 100644 index 00000000..82b1fa1c Binary files /dev/null and b/badtimesimulator/images/gasterblaster-sheet1.png differ diff --git a/badtimesimulator/images/gasterblasthit.png b/badtimesimulator/images/gasterblasthit.png new file mode 100644 index 00000000..2277ccec Binary files /dev/null and b/badtimesimulator/images/gasterblasthit.png differ diff --git a/badtimesimulator/images/heartshard-sheet0.png b/badtimesimulator/images/heartshard-sheet0.png new file mode 100644 index 00000000..9e7a2a50 Binary files /dev/null and b/badtimesimulator/images/heartshard-sheet0.png differ diff --git a/badtimesimulator/images/heartshard-sheet1.png b/badtimesimulator/images/heartshard-sheet1.png new file mode 100644 index 00000000..799a7a11 Binary files /dev/null and b/badtimesimulator/images/heartshard-sheet1.png differ diff --git a/badtimesimulator/images/heartshard-sheet2.png b/badtimesimulator/images/heartshard-sheet2.png new file mode 100644 index 00000000..a72c79d6 Binary files /dev/null and b/badtimesimulator/images/heartshard-sheet2.png differ diff --git a/badtimesimulator/images/hp-sheet0.png b/badtimesimulator/images/hp-sheet0.png new file mode 100644 index 00000000..5314890f Binary files /dev/null and b/badtimesimulator/images/hp-sheet0.png differ diff --git a/badtimesimulator/images/hpbackground.png b/badtimesimulator/images/hpbackground.png new file mode 100644 index 00000000..f0f65495 Binary files /dev/null and b/badtimesimulator/images/hpbackground.png differ diff --git a/badtimesimulator/images/hpbar.png b/badtimesimulator/images/hpbar.png new file mode 100644 index 00000000..b7184a0d Binary files /dev/null and b/badtimesimulator/images/hpbar.png differ diff --git a/badtimesimulator/images/kr-sheet0.png b/badtimesimulator/images/kr-sheet0.png new file mode 100644 index 00000000..0c2cd946 Binary files /dev/null and b/badtimesimulator/images/kr-sheet0.png differ diff --git a/badtimesimulator/images/krbar.png b/badtimesimulator/images/krbar.png new file mode 100644 index 00000000..9601afef Binary files /dev/null and b/badtimesimulator/images/krbar.png differ diff --git a/badtimesimulator/images/menubonebottom-sheet0.png b/badtimesimulator/images/menubonebottom-sheet0.png new file mode 100644 index 00000000..1f45722d Binary files /dev/null and b/badtimesimulator/images/menubonebottom-sheet0.png differ diff --git a/badtimesimulator/images/menuitem-sheet0.png b/badtimesimulator/images/menuitem-sheet0.png new file mode 100644 index 00000000..f2c0abec Binary files /dev/null and b/badtimesimulator/images/menuitem-sheet0.png differ diff --git a/badtimesimulator/images/platform1.png b/badtimesimulator/images/platform1.png new file mode 100644 index 00000000..590daf7c Binary files /dev/null and b/badtimesimulator/images/platform1.png differ diff --git a/badtimesimulator/images/platform2.png b/badtimesimulator/images/platform2.png new file mode 100644 index 00000000..bcae443e Binary files /dev/null and b/badtimesimulator/images/platform2.png differ diff --git a/badtimesimulator/images/playerheart-sheet0.png b/badtimesimulator/images/playerheart-sheet0.png new file mode 100644 index 00000000..3a615b36 Binary files /dev/null and b/badtimesimulator/images/playerheart-sheet0.png differ diff --git a/badtimesimulator/images/playerheart-sheet1.png b/badtimesimulator/images/playerheart-sheet1.png new file mode 100644 index 00000000..0e4a0d39 Binary files /dev/null and b/badtimesimulator/images/playerheart-sheet1.png differ diff --git a/badtimesimulator/images/playerhitbox-sheet0.png b/badtimesimulator/images/playerhitbox-sheet0.png new file mode 100644 index 00000000..da45bc68 Binary files /dev/null and b/badtimesimulator/images/playerhitbox-sheet0.png differ diff --git a/badtimesimulator/images/sansbody-sheet0.png b/badtimesimulator/images/sansbody-sheet0.png new file mode 100644 index 00000000..d677996c Binary files /dev/null and b/badtimesimulator/images/sansbody-sheet0.png differ diff --git a/badtimesimulator/images/sansbody-sheet1.png b/badtimesimulator/images/sansbody-sheet1.png new file mode 100644 index 00000000..d7117c1f Binary files /dev/null and b/badtimesimulator/images/sansbody-sheet1.png differ diff --git a/badtimesimulator/images/sansfont.png b/badtimesimulator/images/sansfont.png new file mode 100644 index 00000000..995a8e34 Binary files /dev/null and b/badtimesimulator/images/sansfont.png differ diff --git a/badtimesimulator/images/sanshead-sheet0.png b/badtimesimulator/images/sanshead-sheet0.png new file mode 100644 index 00000000..ddb54875 Binary files /dev/null and b/badtimesimulator/images/sanshead-sheet0.png differ diff --git a/badtimesimulator/images/sanslegs-sheet0.png b/badtimesimulator/images/sanslegs-sheet0.png new file mode 100644 index 00000000..0174d208 Binary files /dev/null and b/badtimesimulator/images/sanslegs-sheet0.png differ diff --git a/badtimesimulator/images/sanssweat-sheet0.png b/badtimesimulator/images/sanssweat-sheet0.png new file mode 100644 index 00000000..bd71625b Binary files /dev/null and b/badtimesimulator/images/sanssweat-sheet0.png differ diff --git a/badtimesimulator/images/sanstorso-sheet0.png b/badtimesimulator/images/sanstorso-sheet0.png new file mode 100644 index 00000000..289428d4 Binary files /dev/null and b/badtimesimulator/images/sanstorso-sheet0.png differ diff --git a/badtimesimulator/images/speechbubble-sheet0.png b/badtimesimulator/images/speechbubble-sheet0.png new file mode 100644 index 00000000..f2cf50f2 Binary files /dev/null and b/badtimesimulator/images/speechbubble-sheet0.png differ diff --git a/badtimesimulator/images/strike-sheet0.png b/badtimesimulator/images/strike-sheet0.png new file mode 100644 index 00000000..debb039a Binary files /dev/null and b/badtimesimulator/images/strike-sheet0.png differ diff --git a/badtimesimulator/images/target-sheet0.png b/badtimesimulator/images/target-sheet0.png new file mode 100644 index 00000000..a242f362 Binary files /dev/null and b/badtimesimulator/images/target-sheet0.png differ diff --git a/badtimesimulator/images/targetchoice-sheet0.png b/badtimesimulator/images/targetchoice-sheet0.png new file mode 100644 index 00000000..402c4a42 Binary files /dev/null and b/badtimesimulator/images/targetchoice-sheet0.png differ diff --git a/badtimesimulator/images/toucha-sheet0.png b/badtimesimulator/images/toucha-sheet0.png new file mode 100644 index 00000000..2d165cb4 Binary files /dev/null and b/badtimesimulator/images/toucha-sheet0.png differ diff --git a/badtimesimulator/images/toucha-sheet1.png b/badtimesimulator/images/toucha-sheet1.png new file mode 100644 index 00000000..f509a876 Binary files /dev/null and b/badtimesimulator/images/toucha-sheet1.png differ diff --git a/badtimesimulator/images/touchb-sheet0.png b/badtimesimulator/images/touchb-sheet0.png new file mode 100644 index 00000000..d710e62d Binary files /dev/null and b/badtimesimulator/images/touchb-sheet0.png differ diff --git a/badtimesimulator/images/touchb-sheet1.png b/badtimesimulator/images/touchb-sheet1.png new file mode 100644 index 00000000..7fbfb129 Binary files /dev/null and b/badtimesimulator/images/touchb-sheet1.png differ diff --git a/badtimesimulator/images/touchdpad-sheet0.png b/badtimesimulator/images/touchdpad-sheet0.png new file mode 100644 index 00000000..60c76cac Binary files /dev/null and b/badtimesimulator/images/touchdpad-sheet0.png differ diff --git a/badtimesimulator/images/uiact-sheet0.png b/badtimesimulator/images/uiact-sheet0.png new file mode 100644 index 00000000..a93f11f3 Binary files /dev/null and b/badtimesimulator/images/uiact-sheet0.png differ diff --git a/badtimesimulator/images/uifight-sheet0.png b/badtimesimulator/images/uifight-sheet0.png new file mode 100644 index 00000000..49fde361 Binary files /dev/null and b/badtimesimulator/images/uifight-sheet0.png differ diff --git a/badtimesimulator/images/uiitem-sheet0.png b/badtimesimulator/images/uiitem-sheet0.png new file mode 100644 index 00000000..a7868ba2 Binary files /dev/null and b/badtimesimulator/images/uiitem-sheet0.png differ diff --git a/badtimesimulator/images/uimercy-sheet0.png b/badtimesimulator/images/uimercy-sheet0.png new file mode 100644 index 00000000..73e46103 Binary files /dev/null and b/badtimesimulator/images/uimercy-sheet0.png differ diff --git a/badtimesimulator/images/vpad-sheet0.png b/badtimesimulator/images/vpad-sheet0.png new file mode 100644 index 00000000..c5a91add Binary files /dev/null and b/badtimesimulator/images/vpad-sheet0.png differ diff --git a/badtimesimulator/index.html b/badtimesimulator/index.html new file mode 100644 index 00000000..1169c2ae --- /dev/null +++ b/badtimesimulator/index.html @@ -0,0 +1,138 @@ + + + + + + Bad Time Simulator (Sans Fight) + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +

Your browser does not appear to support HTML5. Try upgrading your browser to the latest version. What is a browser? +

Microsoft Internet Explorer
+ Mozilla Firefox
+ Google Chrome
+ Apple Safari

+
+ +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/badtimesimulator/jquery-3.4.1.min.js b/badtimesimulator/jquery-3.4.1.min.js new file mode 100644 index 00000000..a1c07fd8 --- /dev/null +++ b/badtimesimulator/jquery-3.4.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0 this._OnBroadcastChannelMessage(e)); + } + + _OnBroadcastChannelMessage(e) + { + // Have a message callback set: just forward the call. + if (this._onMessageCallback) + { + this._onMessageCallback(e); + return; + } + + // Otherwise the app hasn't loaded far enough to set a message callback. + // Buffer the incoming messages to replay when the app sets a callback. + this._queuedMessages.push(e); + } + + SetMessageCallback(f) + { + this._onMessageCallback = f; + + // Replay any queued messages through the handler, then clear the queue. + for (let e of this._queuedMessages) + this._onMessageCallback(e); + + this._queuedMessages.length = 0; + } + }; + + // Create the offline client ASAP so we receive and start queueing any messages the SW broadcasts. + window.OfflineClientInfo = new OfflineClient(); + +}()); + diff --git a/badtimesimulator/sans_bluebone.csv b/badtimesimulator/sans_bluebone.csv new file mode 100644 index 00000000..4025e1e4 --- /dev/null +++ b/badtimesimulator/sans_bluebone.csv @@ -0,0 +1,17 @@ +0,CombatZoneResize,133,251,508,391,TLResume, +0,HeartTeleport,320,376,,,, +0,HeartMode,1,,,,, +0,TLPause,,,,,, +0.2,BoneV,503,286,100,2,300,1 +0.23333,BoneV,503,366,20,2,300,0 +0.5,BoneV,503,286,100,2,300,1 +0.23333,BoneV,503,366,20,2,300,0 +0.5,BoneV,503,286,100,2,300,1 +0.23333,BoneV,503,366,20,2,300,0 +0.93333,BoneV,128,366,20,0,300,0 +0.4,BoneV,128,286,100,0,300,1 +0.33333,BoneV,128,366,20,0,300,0 +0.4,BoneV,128,286,100,0,300,1 +0.33333,BoneV,128,366,20,0,300,0 +0.4,BoneV,128,286,100,0,300,1 +1.66666,EndAttack,,,,,, diff --git a/badtimesimulator/sans_bonegap1.csv b/badtimesimulator/sans_bonegap1.csv new file mode 100644 index 00000000..ae2a8bc4 --- /dev/null +++ b/badtimesimulator/sans_bonegap1.csv @@ -0,0 +1,9 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0.2,BoneVRepeat,128,257,95,0,180,8,120 +0,BoneVRepeat,128,366,20,0,180,8,120 +0,BoneVRepeat,503,257,95,2,180,8,120 +0,BoneVRepeat,503,366,20,2,180,8,120 +6.4,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_bonegap1fast.csv b/badtimesimulator/sans_bonegap1fast.csv new file mode 100644 index 00000000..6f453075 --- /dev/null +++ b/badtimesimulator/sans_bonegap1fast.csv @@ -0,0 +1,9 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0.4,BoneVRepeat,128,257,95,0,210,8,133 +0,BoneVRepeat,128,366,20,0,210,8,133 +0,BoneVRepeat,503,257,95,2,210,8,133 +0,BoneVRepeat,503,366,20,2,210,8,133 +6,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_bonegap2.csv b/badtimesimulator/sans_bonegap2.csv new file mode 100644 index 00000000..6321b083 --- /dev/null +++ b/badtimesimulator/sans_bonegap2.csv @@ -0,0 +1,62 @@ +0,CombatZoneResize,133,251,508,391,TLResume +0,HeartTeleport,320,376,,, +0,HeartMode,1,,,, +0,TLPause,,,,, +0,SET,Total,0,,, +0,:Begin,,,,, +0,JMPNL,End,$Total,150,, +0,RND,Choice,4,,, +0,MUL,Jump,$Choice,3,, +0,ADD,Jump,$Jump,1,, +0,JMPREL,$Jump,,,, +0,SET,HeightB,20,,, +0,ADD,Total,$Total,9,, +0,JMPREL,9,,,, +0,SET,HeightB,30,,, +0,ADD,Total,$Total,11,, +0,JMPREL,6,,,, +0,SET,HeightB,40,,, +0,ADD,Total,$Total,19,, +0,JMPREL,3,,,, +0,SET,HeightB,60,,, +0,ADD,Total,$Total,25,, +0,RND,RndSpeed,3,,, +0,SUB,RndSpeed,$RndSpeed,1,, +0,MUL,RndSpeed,$RndSpeed,2,, +0,JMPNE,SkipZeroSpeed,$HeightB,40,, +0,SET,RndSpeed,0,,, +0,:SkipZeroSpeed,,,,, +0,SUB,HeightT,111,$HeightB,, +0,SUB,YB,386,$HeightB,, +0,ADD,X,$Total,32,, +0,JMPNE,BoneL,$HeightB,60,, +0,SET,RndSpeed,-1,,, +0,:BoneL,,,,, +0,ADD,SpeedL,8,$RndSpeed,, +0,MUL,XL,$X,$SpeedL,, +0,SUB,XL,320,$XL,, +0,MUL,SpeedL,$SpeedL,30,, +0,JMPE,BoneR,$HeightB,60,, +0,MUL,RndSpeed,$RndSpeed,-1,, +0,:BoneR,,,,, +0,ADD,SpeedR,8,$RndSpeed,, +0,MUL,XR,$X,$SpeedR,, +0,ADD,XR,320,$XR,, +0,MUL,SpeedR,$SpeedR,30,, +0,BoneV,$XL,257,$HeightT,0,$SpeedL +0,BoneV,$XL,$YB,$HeightB,0,$SpeedL +0,BoneV,$XR,257,$HeightT,2,$SpeedR +0,BoneV,$XR,$YB,$HeightB,2,$SpeedR +0,MUL,Jump,$Choice,2,, +0,ADD,Jump,$Jump,1,, +0,JMPREL,$Jump,,,, +0,ADD,Total,$Total,15,, +0,JMPREL,6,,,, +0,ADD,Total,$Total,17,, +0,JMPREL,4,,,, +0,ADD,Total,$Total,19,, +0,JMPREL,2,,,, +0,ADD,Total,$Total,25,, +0,JMPABS,Begin,,,, +0,:End,,,,, +7,EndAttack,,,,, diff --git a/badtimesimulator/sans_boneslideh.csv b/badtimesimulator/sans_boneslideh.csv new file mode 100644 index 00000000..a0bfc4d3 --- /dev/null +++ b/badtimesimulator/sans_boneslideh.csv @@ -0,0 +1,7 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0.5,BoneVRepeat,128,366,20,0,120,8,76 +0,BoneVRepeat,513,257,107,2,120,8,76 +7.2,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_boneslidev.csv b/badtimesimulator/sans_boneslidev.csv new file mode 100644 index 00000000..3afe9f32 --- /dev/null +++ b/badtimesimulator/sans_boneslidev.csv @@ -0,0 +1,7 @@ +0,CombatZoneResize,241,226,406,391,TLResume,, +0,HeartTeleport,320,304,,,,, +0,HeartMode,0,,,,,, +0,TLPause,,,,,,, +0.2,BoneHRepeat,130,-10,200,1,300,7,183 +0,BoneHRepeat,330,650,200,3,300,7,183 +5.76666,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_bonestab1.csv b/badtimesimulator/sans_bonestab1.csv new file mode 100644 index 00000000..c87e8362 --- /dev/null +++ b/badtimesimulator/sans_bonestab1.csv @@ -0,0 +1,26 @@ +0,CombatZoneResize,241,226,406,391,TLResume +0,HeartTeleport,320,304,,, +0,HeartMode,0,,,, +0,TLPause,,,,, +0,SET,Loop,9,,, +0,JMPZ,26,$Loop,,, +0,SUB,Loop,$Loop,1,, +0,RND,Direction,4,,, +0,ADD,Jump,$Direction,1,, +0,JMPREL,$Jump,,,, +0,JMPREL,4,,,, +0,JMPREL,5,,,, +0,JMPREL,6,,,, +0,JMPREL,7,,,, +0,SansBody,HandRight,,,, +0,JMPREL,7,,,, +0,SansBody,HandDown,,,, +0,JMPREL,5,,,, +0,SansBody,HandLeft,,,, +0,JMPREL,3,,,, +0,SansBody,HandUp,,,, +0,JMPREL,1,,,, +0.26666,SansSlam,$Direction,,,, +0.2,BoneStab,$Direction,25,0.4,0.33333, +0.6,JMPABS,6,,,, +0,EndAttack,,,,, diff --git a/badtimesimulator/sans_bonestab2.csv b/badtimesimulator/sans_bonestab2.csv new file mode 100644 index 00000000..1da05895 --- /dev/null +++ b/badtimesimulator/sans_bonestab2.csv @@ -0,0 +1,26 @@ +0,CombatZoneResize,241,226,406,391,TLResume +0,HeartTeleport,320,304,,, +0,HeartMode,0,,,, +0,TLPause,,,,, +0,SET,Loop,9,,, +0,JMPZ,26,$Loop,,, +0,SUB,Loop,$Loop,1,, +0,RND,Direction,4,,, +0,ADD,Jump,$Direction,1,, +0,JMPREL,$Jump,,,, +0,JMPREL,4,,,, +0,JMPREL,5,,,, +0,JMPREL,6,,,, +0,JMPREL,7,,,, +0,SansBody,HandRight,,,, +0,JMPREL,7,,,, +0,SansBody,HandDown,,,, +0,JMPREL,5,,,, +0,SansBody,HandLeft,,,, +0,JMPREL,3,,,, +0,SansBody,HandUp,,,, +0,JMPREL,1,,,, +0.26666,SansSlam,$Direction,,,, +0.2,BoneStab,$Direction,25,0.3,0.2, +0.43333,JMPABS,6,,,, +0,EndAttack,,,,, diff --git a/badtimesimulator/sans_bonestab3.csv b/badtimesimulator/sans_bonestab3.csv new file mode 100644 index 00000000..2677fae0 --- /dev/null +++ b/badtimesimulator/sans_bonestab3.csv @@ -0,0 +1,26 @@ +0,CombatZoneResize,241,226,406,391,TLResume +0,HeartTeleport,320,304,,, +0,HeartMode,0,,,, +0,TLPause,,,,, +0,SET,Loop,9,,, +0,JMPZ,26,$Loop,,, +0,SUB,Loop,$Loop,1,, +0,RND,Direction,4,,, +0,ADD,Jump,$Direction,1,, +0,JMPREL,$Jump,,,, +0,JMPREL,4,,,, +0,JMPREL,5,,,, +0,JMPREL,6,,,, +0,JMPREL,7,,,, +0,SansBody,HandRight,,,, +0,JMPREL,7,,,, +0,SansBody,HandDown,,,, +0,JMPREL,5,,,, +0,SansBody,HandLeft,,,, +0,JMPREL,3,,,, +0,SansBody,HandUp,,,, +0,JMPREL,1,,,, +0.26666,SansSlam,$Direction,,,, +0.2,BoneStab,$Direction,29,0.4,0, +0.23333,JMPABS,6,,,, +0,EndAttack,,,,, diff --git a/badtimesimulator/sans_final.csv b/badtimesimulator/sans_final.csv new file mode 100644 index 00000000..f3993209 --- /dev/null +++ b/badtimesimulator/sans_final.csv @@ -0,0 +1,213 @@ +0,CombatZoneResize,241,226,406,391,TLResume,,, +0,HeartTeleport,320,304,,,,,, +0,HeartMode,0,,,,,,, +0,TLPause,,,,,,,, +0,SansSweat,0,,,,,,, +0,SET,I,0,,,,,, +0.3,RND,Direction,4,,,,,, +0,ADD,Jump,$Direction,1,,,,, +0,JMPREL,$Jump,,,,,,, +0,JMPREL,4,,,,,,, +0,JMPREL,5,,,,,,, +0,JMPREL,6,,,,,,, +0,JMPREL,7,,,,,,, +0,SansBody,HandRight,,,,,,, +0,JMPREL,7,,,,,,, +0,SansBody,HandDown,,,,,,, +0,JMPREL,5,,,,,,, +0,SansBody,HandLeft,,,,,,, +0,JMPREL,3,,,,,,, +0,SansBody,HandUp,,,,,,, +0,JMPREL,1,,,,,,, +0.26666,SansSlam,$Direction,,,,,,, +0.2,BoneStab,$Direction,29,0.4,0,,,, +0,ADD,I,$I,1,,,,, +0,JMPL,7,$I,4,,,,, +0,BoneHRepeat,130,-10,200,1,300,3,183, +0,BoneHRepeat,330,650,200,3,300,3,183, +0.5,HeartMode,0,,,,,,, +2,SansBody,HandLeft,,,,,,, +0.2,SansSlam,2,,,,,,, +0.3,SansBody,HandRight,,,,,,, +0.2,HeartMaxFallSpeed,450,,,,,,, +0,SansSlam,0,,,,,,, +0,CombatZoneResizeInstant,241,226,449,391,,,, +0,CombatZoneSpeed,900,,,,,,, +0,CombatZoneResize,241,226,650,391,,,, +0.33333,HeartMaxFallSpeed,-300,,,,,,, +0,SansAnimation,Idle,,,,,,, +0,SansRepeat,,,,,,,, +0,CombatZoneResize,-10,226,650,391,,,, +0.3,CombatZoneSpeed,30,,,,,,, +0,CombatZoneResize,-10,264,650,369,,,, +0.9,GetHeartPos,HeartX,HeartY,,,,,, +0,HeartTeleport,40,$HeartY,,,,,, +0,HeartMaxFallSpeed,0,,,,,,, +0,SansSlam,0,,,,,,, +0,DIV,Deg,180,$pi,,,,, +0,SET,I,0,,,,,, +0,DIV,Ang,$I,2,,,,, +0,MUL,Ang,$Ang,$Deg,,,,, +0,SIN,Sine,$Ang,,,,,, +0,MUL,Sine,$Sine,25,,,,, +0,FLOOR,Sine,$Sine,,,,,, +0,MUL,X,$I,60,,,,, +0,ADD,X,$X,634,,,,, +0,SET,Y,270,,,,,, +0,ADD,H,30,$Sine,,,,, +0,BoneV,$X,$Y,$H,2,900,,, +0,ADD,Y,$Y,$H,,,,, +0,ADD,Y,$Y,34,,,,, +0,SUB,H,364,$Y,,,,, +0,BoneV,$X,$Y,$H,2,900,,, +0,ADD,I,$I,1,,,,, +0,JMPL,49,$I,44,,,,, +0,ADD,X,$X,360,,,,, +0,BoneVRepeat,$X,270,50,2,900,3,15, +0,ADD,X,$X,330,,,,, +0,BoneVRepeat,$X,314,50,2,900,3,15, +0,ADD,X,$X,300,,,,, +0,BoneVRepeat,$X,270,50,2,900,3,15, +0,ADD,X,$X,300,,,,, +0,BoneVRepeat,$X,314,50,2,900,3,15, +0,ADD,X,$X,270,,,,, +0,BoneVRepeat,$X,270,50,2,900,3,15, +0,ADD,X,$X,270,,,,, +0,BoneVRepeat,$X,314,50,2,900,3,15, +0,ADD,X,$X,240,,,,, +0,BoneVRepeat,$X,270,50,2,900,3,15, +0,ADD,X,$X,330,,,,, +0,BoneVRepeat,$X,314,50,2,900,3,15, +0,ADD,X,$X,270,,,,, +0,BoneVRepeat,$X,270,50,2,900,3,15, +0,ADD,X,$X,390,,,,, +0,SET,I,0,,,,,, +0,MUL,X2,$I,30,,,,, +0,ADD,X2,$X2,$X,,,,, +0,ADD,H,10,$I,,,,, +0,BoneV,$X2,270,$H,2,900,,, +0,SUB,Y,365,$H,,,,, +0,BoneV,$X2,$Y,$H,2,900,,, +0,ADD,I,$I,1,,,,, +0,JMPL,85,$I,24,,,,, +0,SET,I,0,,,,,, +8,HeartMaxFallSpeed,330,,,,,,, +0,SansSlam,0,,,,,,, +0,CombatZoneSpeed,540,,,,,,, +0,CombatZoneResize,-10,264,410,369,,,, +0.9,SansEndRepeat,,,,,,,, +0,SansHead,Default,,,,,,, +0,SansTorso,Default,,,,,,, +0,SansBody,HandLeft,,,,,,, +0.2,BoneStab,0,50,0.4,1,,,, +0.9,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.4,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,CombatZoneResizeInstant,239,226,404,391,,,, +0,HeartTeleport,320,376,,,,,, +0,HeartMode,1,,,,,,, +0,SansAnimation,HeadBob,,,,,,, +0.03333,BoneStab,1,48,0.6,1,,,, +0,BoneStab,3,48,0.6,1,,,, +0.9,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.1,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,HeartTeleport,262,240,,,,,, +0,SansSlam,3,,,,,,, +0.03333,BoneStab,2,48,0.6,1,,,, +0,BoneStab,3,48,0.6,1,,,, +0.9,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.1,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,HeartTeleport,391,376,,,,,, +0,SansSlam,0,,,,,,, +0.03333,BoneStab,0,48,0.6,1,,,, +0,BoneStab,1,48,0.6,1,,,, +0.9,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.1,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,HeartTeleport,262,240,,,,,, +0,SansSlam,2,,,,,,, +0,SansX,320,,,,,,, +0.03333,BoneStab,2,48,0.6,1,,,, +0.7,HeartMode,0,,,,,,, +0,SET,gt,0,,,,,, +0,SET,gin,1,,,,,, +0,MUL,Ang,$gt,-10,,,,, +0,COS,X,$Ang,,,,,, +0,SIN,Y,$Ang,,,,,, +0,MUL,EndX,$X,150,,,,, +0,MUL,EndY,$Y,150,,,,, +0,MUL,X,$EndX,3,,,,, +0,MUL,Y,$EndY,3,,,,, +0,ADD,X,$X,320,,,,, +0,ADD,Y,$Y,306,,,,, +0,ADD,EndX,$EndX,320,,,,, +0,ADD,EndY,$EndY,306,,,,, +0,ADD,Ang,$Ang,180,,,,, +0,GasterBlaster,0,$X,$Y,$EndX,$EndY,$Ang,0.5,0 +0,ADD,gt,$gt,$gin,,,,, +0,JMPNL,156,$gin,1.7,,,,, +0,ADD,gin,$gin,0.015,,,,, +0.06666,JMPL,140,$gt,190,,,,, +1,SansHead,BlueEye,,,,,,, +0,HeartMaxFallSpeed,750,,,,,,, +0,SansBody,HandRight,,,,,,, +0,SansSlamDamage,1,,,,,,, +0,SET,I,0,,,,,, +0,SET,Direction,0,,,,,, +0,SET,LastDir,2,,,,,, +0,SET,Wait1,0.13333,,,,,, +0,SET,Wait2,0.13333,,,,,, +0,JMPNE,168,$Direction,$LastDir,,,,, +0,SUB,Direction,$Direction,2,,,,, +0,JMPNL,170,$Direction,0,,,,, +0,ADD,Direction,$Direction,4,,,,, +0,JMPL,172,$Direction,4,,,,, +0,SUB,Direction,$Direction,4,,,,, +0,MUL,Jump,$Direction,2,,,,, +0,ADD,Jump,$Jump,1,,,,, +0,JMPREL,$Jump,,,,,,, +0,SansBody,HandRight,,,,,,, +0,JMPREL,6,,,,,,, +0,SansBody,HandDown,,,,,,, +0,JMPREL,4,,,,,,, +0,SansBody,HandLeft,,,,,,, +0,JMPREL,2,,,,,,, +0,SansBody,HandUp,,,,,,, +$Wait1,SansSlam,$Direction,,,,,,, +$Wait2,SET,LastDir,$Direction,,,,,, +0,MOD,Odd,$I,2,,,,, +0,JMPZ,187,$Odd,,,,,, +0,RND,Direction,4,,,,,, +0,JMPNE,191,$I,21,,,,, +0,HeartMaxFallSpeed,480,,,,,,, +0,SET,Wait1,0.2,,,,,, +0,SET,Wait2,0.2,,,,,, +0,JMPNE,194,$I,25,,,,, +0,SansHead,Default,,,,,,, +0,SansSweat,1,,,,,,, +0,JMPNE,200,$I,33,,,,, +0,SansHead,Tired1,,,,,,, +0,SansSweat,2,,,,,,, +0,HeartMaxFallSpeed,330,,,,,,, +0,SET,Wait1,0.5,,,,,, +0,SET,Wait2,1.1,,,,,, +0,JMPNE,203,$I,33,,,,, +0,JMPE,186,$Direction,1,,,,, +0,JMPE,186,$Direction,$LastDir,,,,, +0,JMPNE,206,$I,35,,,,, +0,HeartMaxFallSpeed,240,,,,,,, +0,SET,Direction,3,,,,,, +0,JMPNE,210,$I,36,,,,, +0,SansHead,Tired2,,,,,,, +0,SansSweat,3,,,,,,, +0,HeartMaxFallSpeed,60,,,,,,, +0,ADD,I,$I,1,,,,, +0,JMPL,166,$I,38,,,,, +1.5,SansAnimation,Tired,,,,,,, +2.4,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_intro.csv b/badtimesimulator/sans_intro.csv new file mode 100644 index 00000000..10ad59c7 --- /dev/null +++ b/badtimesimulator/sans_intro.csv @@ -0,0 +1,40 @@ +0,SansAnimation,,,,,,,, +0,SansHead,ClosedEyes,,,,,,, +0,SansText,ready?,,,,,,, +0,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.06666,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,CombatZoneResizeInstant,239,226,404,391,,,, +0,HeartTeleport,320,304,,,,,, +0,HeartMode,0,,,,,,, +0,SansBody,HandDown,,,,,,, +0,SansHead,BlueEye,,,,,,, +0,Sound,GasterBlaster,1.4,,,,,, +0.26666,SansSlam,1,,,,,,, +0.5,SansBody,HandUp,,,,,,, +0,SansHead,NoEyes,,,,,,, +0,BoneStab,1,54,0.16666,1,,,, +0.7,HeartMode,0,,,,,,, +0,SansBody,HandRight,,,,,,, +0,Sound,Ding,,,,,,, +0.4,Sound,GasterBlaster,1.4,,,,,, +0.4,SineBones,20,-24,360,25,,,, +1.1,SansAnimation,,,,,,,, +0,GasterBlaster,1,0,0,189,246,0,0.333,0.26666 +0,GasterBlaster,1,0,0,259,166,90,0.333,0.26666 +0,GasterBlaster,1,640,480,449,366,180,0.333,0.26666 +0,GasterBlaster,1,640,480,379,446,270,0.333,0.26666 +0.9,GasterBlaster,1,0,0,189,176,45,0.333,0.26666 +0,GasterBlaster,1,640,0,449,176,135,0.333,0.26666 +0,GasterBlaster,1,640,480,449,436,225,0.333,0.26666 +0,GasterBlaster,1,0,480,189,436,315,0.333,0.26666 +0.9,GasterBlaster,1,0,0,189,246,0,0.333,0.26666 +0,GasterBlaster,1,0,0,259,166,90,0.333,0.26666 +0,GasterBlaster,1,640,480,449,366,180,0.333,0.26666 +0,GasterBlaster,1,640,480,379,446,270,0.333,0.26666 +0.7,GasterBlaster,2,0,240,139,306,0,0.666,0.5 +0,GasterBlaster,2,640,240,499,306,180,0.666,0.5 +3,SansHead,Default,,,,,,, +0,SansText,here we go.,,,,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_multi1.csv b/badtimesimulator/sans_multi1.csv new file mode 100644 index 00000000..48034f7e --- /dev/null +++ b/badtimesimulator/sans_multi1.csv @@ -0,0 +1,105 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,304,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,SET,Loop,5,,,,, +0,:RndAttack,,,,,,, +0,BlackScreen,1,,,,,, +0,Sound,Flash,,,,,, +0.4,BlackScreen,0,,,,,, +0,Sound,Flash,,,,,, +0,JMPZ,End,$Loop,,,,, +0,SUB,Loop,$Loop,1,,,, +0,RND,Jump,5,,,,, +0,ADD,Jump,$Jump,1,,,, +0,JMPREL,$Jump,,,,,, +0,JMPABS,Attack0,,,,,, +0,JMPABS,Attack1,,,,,, +0,JMPABS,Attack2,,,,,, +0,JMPABS,Attack3,,,,,, +0,JMPABS,Attack4,,,,,, +0,:Attack0,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,, +0,HeartMode,1,,,,,, +0,HeartTeleport,320,376,,,,, +0,BoneVRepeat,128,341,45,0,240,4,16 +0,BoneV,64,286,100,0,240,, +0,BoneVRepeat,512,341,45,2,240,4,16 +0,BoneV,576,286,100,2,240,, +0.9,JMPABS,RndAttack,,,,,, +0,:Attack1,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,, +0,HeartMode,1,,,,,, +0,HeartTeleport,320,376,,,,, +0,BoneV,128,286,100,0,240,1, +0,BoneV,56,366,20,0,240,0, +0,BoneV,24,286,100,0,240,0, +0,BoneV,512,286,100,2,240,1, +0,BoneV,584,366,20,2,240,0, +0,BoneV,616,286,100,2,240,0, +1.1,JMPABS,RndAttack,,,,,, +0,:Attack2,,,,,,, +0,CombatZoneResizeInstant,171,276,476,391,,, +0,HeartMode,1,,,,,, +0,HeartTeleport,320,376,,,,, +0,SET,Total,0,,,,, +0,SET,Loop2,0,,,,, +0,:Attack2Begin,,,,,,, +0,RND,Choice,3,,,,, +0,ADD,HeightB,$Choice,2,,,, +0,MUL,HeightB,$HeightB,10,,,, +0,SET,RndSpeed,0,,,,, +0,JMPZ,SkipRndSpeed,$Loop2,,,,, +0,RND,RndSpeed,3,,,,, +0,SUB,RndSpeed,$RndSpeed,1,,,, +0,MUL,RndSpeed,$RndSpeed,2,,,, +0,:SkipRndSpeed,,,,,,, +0,SUB,HeightT,86,$HeightB,,,, +0,SUB,YB,386,$HeightB,,,, +0,MUL,X,$Loop2,22,,,, +0,ADD,X,$X,25,,,, +0,ADD,X,$X,$Total,,,, +0,ADD,SpeedL,6,$RndSpeed,,,, +0,MUL,XL,$X,$SpeedL,,,, +0,SUB,XL,320,$XL,,,, +0,MUL,SpeedL,$SpeedL,30,,,, +0,MUL,RndSpeed,$RndSpeed,-1,,,, +0,ADD,SpeedR,6,$RndSpeed,,,, +0,MUL,XR,$X,$SpeedR,,,, +0,ADD,XR,320,$XR,,,, +0,MUL,SpeedR,$SpeedR,30,,,, +0,BoneV,$XL,282,$HeightT,0,$SpeedL,, +0,BoneV,$XL,$YB,$HeightB,0,$SpeedL,, +0,BoneV,$XR,282,$HeightT,2,$SpeedR,, +0,BoneV,$XR,$YB,$HeightB,2,$SpeedR,, +0,MUL,TotalInc,$Choice,5,,,, +0,ADD,Total,$Total,$TotalInc,,,, +0,ADD,Loop2,$Loop2,1,,,, +0,JMPL,Attack2Begin,$Loop2,4,,,, +1.9,JMPABS,RndAttack,,,,,, +0,:Attack3,,,,,,, +0,CombatZoneResizeInstant,171,276,476,391,,, +0,HeartMode,1,,,,,, +0,HeartTeleport,320,376,,,,, +0,BoneVRepeat,200,282,70,0,150,3,125 +0,BoneVRepeat,200,371,15,0,150,3,125 +0,BoneVRepeat,440,282,70,2,150,3,125 +0,BoneVRepeat,440,371,15,2,150,3,125 +1.7,JMPABS,RndAttack,,,,,, +0,:Attack4,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,, +0,HeartMode,1,,,,,, +0,RND,Side,2,,,,, +0,JMPZ,Attack4Other,$Side,,,,, +0,HeartTeleport,506,376,,,,, +0,BoneVRepeat,200,331,55,0,360,11,24 +0,BoneVRepeat,-64,371,15,0,360,10,24 +1.5,JMPABS,RndAttack,,,,,, +0,:Attack4Other,,,,,,, +0,HeartTeleport,149,376,,,,, +0,BoneVRepeat,440,331,55,2,360,11,24 +0,BoneVRepeat,704,371,15,2,360,10,24 +1.5,JMPABS,RndAttack,,,,,, +0,:End,,,,,,, +0,CombatZoneResizeInstant,33,251,608,391,,, +0,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_multi2.csv b/badtimesimulator/sans_multi2.csv new file mode 100644 index 00000000..b892aa9c --- /dev/null +++ b/badtimesimulator/sans_multi2.csv @@ -0,0 +1,78 @@ +0,HeartTeleport,320,304,,,,,, +0,SET,Loop,5,,,,,, +0,:RndAttack,,,,,,,, +0,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.4,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,JMPZ,End,$Loop,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Jump,4,,,,,, +0,ADD,Jump,$Jump,1,,,,, +0,JMPREL,$Jump,,,,,,, +0,JMPABS,Attack5,,,,,,, +0,JMPABS,Attack6,,,,,,, +0,JMPABS,Attack7,,,,,,, +0,JMPABS,Attack8,,,,,,, +0,:Attack5,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,330,304,,,,,, +0,Platform,309,314,41,0,0,,, +0,Platform,309,354,41,0,0,,, +0,BoneVRepeat,121,364,30,2,0,25,16, +0,RND,Side,2,,,,,, +0,JMPZ,Attack5Other,$Side,,,,,, +0,BoneV,521,280,35,2,240,,, +0,BoneV,1,319,65,0,240,,, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack5Other,,,,,,,, +0,BoneV,119,280,35,0,240,,, +0,BoneV,639,319,65,2,240,,, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack6,,,,,,,, +0,CombatZoneResizeInstant,241,226,406,391,,,, +0,HeartMode,0,,,,,,, +0,HeartTeleport,320,304,,,,,, +0,RND,Rot,2,,,,,, +0,JMPZ,Attack6Other,$Rot,,,,,, +0,GasterBlaster,1,191,306,191,306,0,0.6,0.26666 +0,GasterBlaster,1,321,166,321,166,90,0.6,0.26666 +0,GasterBlaster,1,449,306,449,306,180,0.6,0.26666 +0,GasterBlaster,1,321,446,321,446,270,0.6,0.26666 +1.2,JMPABS,RndAttack,,,,,,, +0,:Attack6Other,,,,,,,, +0,GasterBlaster,1,191,176,191,176,45,0.66666,0.26666 +0,GasterBlaster,1,451,176,451,176,135,0.66666,0.26666 +0,GasterBlaster,1,451,436,451,436,225,0.66666,0.26666 +0,GasterBlaster,1,191,436,191,436,315,0.66666,0.26666 +1.2,JMPABS,RndAttack,,,,,,, +0,:Attack7,,,,,,,, +0,CombatZoneResizeInstant,179,226,404,391,,,, +0,HeartMode,0,,,,,,, +0,RND,Side,2,,,,,, +0,JMPZ,Attack7Other,$Side,,,,,, +0,HeartTeleport,382,304,,,,,, +0,SineBones,16,-20,300,55,,,, +1.7,JMPABS,RndAttack,,,,,,, +0,:Attack7Other,,,,,,,, +0,HeartTeleport,267,304,,,,,, +0,SineBones,16,20,300,55,,,, +1.7,JMPABS,RndAttack,,,,,,, +0,:Attack8,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,RND,Side,2,,,,,, +0,JMPZ,Attack8Other,$Side,,,,,, +0,HeartTeleport,489,376,,,,,, +0,BoneVRepeat,345,364,20,0,120,6,76, +0,BoneVRepeat,297,280,82,2,120,6,76, +1.9,JMPABS,RndAttack,,,,,,, +0,:Attack8Other,,,,,,,, +0,HeartTeleport,168,376,,,,,, +0,BoneVRepeat,297,364,20,2,120,6,76, +0,BoneVRepeat,345,280,82,0,120,6,76, +1.9,JMPABS,RndAttack,,,,,,, +0,:End,,,,,,,, +0,CombatZoneResizeInstant,33,251,608,391,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_multi3.csv b/badtimesimulator/sans_multi3.csv new file mode 100644 index 00000000..3aa6b5d9 --- /dev/null +++ b/badtimesimulator/sans_multi3.csv @@ -0,0 +1,168 @@ +0,CombatZoneResize,239,226,404,391,TLResume,,, +0,HeartTeleport,320,304,,,,,, +0,HeartMode,0,,,,,,, +0,TLPause,,,,,,,, +0,SET,Loop,5,,,,,, +0,:RndAttack,,,,,,,, +0,BlackScreen,1,,,,,,, +0,Sound,Flash,,,,,,, +0.13333,BlackScreen,0,,,,,,, +0,Sound,Flash,,,,,,, +0,JMPZ,End,$Loop,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Jump,9,,,,,, +0,ADD,Jump,$Jump,1,,,,, +0,JMPREL,$Jump,,,,,,, +0,JMPABS,Attack0,,,,,,, +0,JMPABS,Attack1,,,,,,, +0,JMPABS,Attack2,,,,,,, +0,JMPABS,Attack3,,,,,,, +0,JMPABS,Attack4,,,,,,, +0,JMPABS,Attack5,,,,,,, +0,JMPABS,Attack6,,,,,,, +0,JMPABS,Attack7,,,,,,, +0,JMPABS,Attack8,,,,,,, +0,:Attack0,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,320,376,,,,,, +0,BoneVRepeat,128,341,45,0,240,4,16, +0,BoneV,64,286,100,0,240,,, +0,BoneVRepeat,512,341,45,2,240,4,16, +0,BoneV,576,286,100,2,240,,, +0.9,JMPABS,RndAttack,,,,,,, +0,:Attack1,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,320,376,,,,,, +0,BoneV,128,286,100,0,240,1,, +0,BoneV,56,366,20,0,240,0,, +0,BoneV,24,286,100,0,240,0,, +0,BoneV,512,286,100,2,240,1,, +0,BoneV,584,366,20,2,240,0,, +0,BoneV,616,286,100,2,240,0,, +1.1,JMPABS,RndAttack,,,,,,, +0,:Attack2,,,,,,,, +0,CombatZoneResizeInstant,171,276,476,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,320,376,,,,,, +0,SET,Total,0,,,,,, +0,SET,Loop2,0,,,,,, +0,:Attack2Begin,,,,,,,, +0,RND,Choice,3,,,,,, +0,ADD,HeightB,$Choice,2,,,,, +0,MUL,HeightB,$HeightB,10,,,,, +0,SET,RndSpeed,0,,,,,, +0,JMPZ,SkipRndSpeed,$Loop2,,,,,, +0,RND,RndSpeed,3,,,,,, +0,SUB,RndSpeed,$RndSpeed,1,,,,, +0,MUL,RndSpeed,$RndSpeed,2,,,,, +0,:SkipRndSpeed,,,,,,,, +0,SUB,HeightT,86,$HeightB,,,,, +0,SUB,YB,386,$HeightB,,,,, +0,MUL,X,$Loop2,22,,,,, +0,ADD,X,$X,25,,,,, +0,ADD,X,$X,$Total,,,,, +0,ADD,SpeedL,6,$RndSpeed,,,,, +0,MUL,XL,$X,$SpeedL,,,,, +0,SUB,XL,320,$XL,,,,, +0,MUL,SpeedL,$SpeedL,30,,,,, +0,MUL,RndSpeed,$RndSpeed,-1,,,,, +0,ADD,SpeedR,6,$RndSpeed,,,,, +0,MUL,XR,$X,$SpeedR,,,,, +0,ADD,XR,320,$XR,,,,, +0,MUL,SpeedR,$SpeedR,30,,,,, +0,BoneV,$XL,282,$HeightT,0,$SpeedL,,, +0,BoneV,$XL,$YB,$HeightB,0,$SpeedL,,, +0,BoneV,$XR,282,$HeightT,2,$SpeedR,,, +0,BoneV,$XR,$YB,$HeightB,2,$SpeedR,,, +0,MUL,TotalInc,$Choice,5,,,,, +0,ADD,Total,$Total,$TotalInc,,,,, +0,ADD,Loop2,$Loop2,1,,,,, +0,JMPL,Attack2Begin,$Loop2,4,,,,, +1.9,JMPABS,RndAttack,,,,,,, +0,:Attack3,,,,,,,, +0,CombatZoneResizeInstant,171,276,476,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,320,376,,,,,, +0,BoneVRepeat,200,282,70,0,150,3,125, +0,BoneVRepeat,200,371,15,0,150,3,125, +0,BoneVRepeat,440,282,70,2,150,3,125, +0,BoneVRepeat,440,371,15,2,150,3,125, +1.7,JMPABS,RndAttack,,,,,,, +0,:Attack4,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,RND,Side,2,,,,,, +0,JMPZ,Attack4Other,$Side,,,,,, +0,HeartTeleport,506,376,,,,,, +0,BoneVRepeat,200,331,55,0,360,11,24, +0,BoneVRepeat,-64,371,15,0,360,10,24, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack4Other,,,,,,,, +0,HeartTeleport,149,376,,,,,, +0,BoneVRepeat,440,331,55,2,360,11,24, +0,BoneVRepeat,704,371,15,2,360,10,24, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack5,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,HeartTeleport,330,304,,,,,, +0,Platform,309,314,41,0,0,,, +0,Platform,309,354,41,0,0,,, +0,BoneVRepeat,121,364,30,2,0,25,16, +0,RND,Side,2,,,,,, +0,JMPZ,Attack5Other,$Side,,,,,, +0,BoneV,521,280,35,2,240,,, +0,BoneV,1,319,65,0,240,,, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack5Other,,,,,,,, +0,BoneV,119,280,35,0,240,,, +0,BoneV,639,319,65,2,240,,, +1.5,JMPABS,RndAttack,,,,,,, +0,:Attack6,,,,,,,, +0,CombatZoneResizeInstant,241,226,406,391,,,, +0,HeartMode,0,,,,,,, +0,HeartTeleport,320,304,,,,,, +0,RND,Rot,2,,,,,, +0,JMPZ,Attack6Other,$Rot,,,,,, +0,GasterBlaster,1,191,306,191,306,0,0.6,0.26666 +0,GasterBlaster,1,321,166,321,166,90,0.6,0.26666 +0,GasterBlaster,1,449,306,449,306,180,0.6,0.26666 +0,GasterBlaster,1,321,446,321,446,270,0.6,0.26666 +1.2,JMPABS,RndAttack,,,,,,, +0,:Attack6Other,,,,,,,, +0,GasterBlaster,1,191,176,191,176,45,0.66666,0.26666 +0,GasterBlaster,1,451,176,451,176,135,0.66666,0.26666 +0,GasterBlaster,1,451,436,451,436,225,0.66666,0.26666 +0,GasterBlaster,1,191,436,191,436,315,0.66666,0.26666 +1.2,JMPABS,RndAttack,,,,,,, +0,:Attack7,,,,,,,, +0,CombatZoneResizeInstant,179,226,404,391,,,, +0,HeartMode,0,,,,,,, +0,RND,Side,2,,,,,, +0,JMPZ,Attack7Other,$Side,,,,,, +0,HeartTeleport,382,304,,,,,, +0,SineBones,16,-20,300,55,,,, +1.7,JMPABS,RndAttack,,,,,,, +0,:Attack7Other,,,,,,,, +0,HeartTeleport,267,304,,,,,, +0,SineBones,16,20,300,55,,,, +1.7,JMPABS,RndAttack,,,,,,, +0,:Attack8,,,,,,,, +0,CombatZoneResizeInstant,121,276,526,391,,,, +0,HeartMode,1,,,,,,, +0,RND,Side,2,,,,,, +0,JMPZ,Attack8Other,$Side,,,,,, +0,HeartTeleport,489,376,,,,,, +0,BoneVRepeat,345,364,20,0,120,6,76, +0,BoneVRepeat,297,280,82,2,120,6,76, +1.9,JMPABS,RndAttack,,,,,,, +0,:Attack8Other,,,,,,,, +0,HeartTeleport,168,376,,,,,, +0,BoneVRepeat,297,364,20,2,120,6,76, +0,BoneVRepeat,345,280,82,0,120,6,76, +1.9,JMPABS,RndAttack,,,,,,, +0,:End,,,,,,,, +0,CombatZoneResizeInstant,33,251,608,391,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_platformblaster.csv b/badtimesimulator/sans_platformblaster.csv new file mode 100644 index 00000000..a8fbca63 --- /dev/null +++ b/badtimesimulator/sans_platformblaster.csv @@ -0,0 +1,18 @@ +0,CombatZoneResize,133,251,508,391,TLResume,,, +0,HeartTeleport,320,376,,,,,, +0,HeartMode,1,,,,,,, +0,TLPause,,,,,,,, +0,PlatformRepeat,552,346,51,2,120,8,140, +0,PlatformRepeat,-20,306,51,0,120,8,160, +0,SET,Loop,5,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Y,3,,,,,, +0,MUL,Y,$Y,40,,,,, +0,ADD,Y,$Y,285,,,,, +0,GasterBlaster,0,0,0,73,$Y,0,0.56666,0.1 +0.9,RND,Y,3,,,,,, +0,MUL,Y,$Y,40,,,,, +0,ADD,Y,$Y,285,,,,, +0,GasterBlaster,0,640,0,563,$Y,180,0.56666,0.1 +0.9,JMPNZ,8,$Loop,,,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_platformblasterfast.csv b/badtimesimulator/sans_platformblasterfast.csv new file mode 100644 index 00000000..23b02318 --- /dev/null +++ b/badtimesimulator/sans_platformblasterfast.csv @@ -0,0 +1,18 @@ +0,CombatZoneResize,133,251,508,391,TLResume,,, +0,HeartTeleport,320,376,,,,,, +0,HeartMode,1,,,,,,, +0,TLPause,,,,,,,, +0,PlatformRepeat,552,346,51,2,120,8,140, +0,PlatformRepeat,-20,306,51,0,120,8,160, +0,SET,Loop,6,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Y,3,,,,,, +0,MUL,Y,$Y,40,,,,, +0,ADD,Y,$Y,285,,,,, +0,GasterBlaster,0,0,0,73,$Y,0,0.56666,0.1 +0.7,RND,Y,3,,,,,, +0,MUL,Y,$Y,40,,,,, +0,ADD,Y,$Y,285,,,,, +0,GasterBlaster,0,640,0,563,$Y,180,0.56666,0.1 +0.7,JMPNZ,8,$Loop,,,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_platforms1.csv b/badtimesimulator/sans_platforms1.csv new file mode 100644 index 00000000..7d9dea76 --- /dev/null +++ b/badtimesimulator/sans_platforms1.csv @@ -0,0 +1,13 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,Platform,15,346,61,0,120,, +0.4,BoneVRepeat,133,356,40,0,120,41,15 +1.2,Platform,-61,346,61,0,150,, +1.7,Platform,-61,346,61,0,180,, +1,BoneV,133,257,45,0,210,, +0,BoneV,119,257,45,0,210,, +0,BoneV,105,257,45,0,210,, +2.3,BoneV,133,257,95,0,270,, +1.7,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_platforms2.csv b/badtimesimulator/sans_platforms2.csv new file mode 100644 index 00000000..77ef66d4 --- /dev/null +++ b/badtimesimulator/sans_platforms2.csv @@ -0,0 +1,19 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,Platform,640,346,51,2,150,, +0.4,BoneVRepeat,508,356,40,2,120,58,15 +0.4,Platform,640,296,51,2,150,, +0.5,Platform,640,346,51,2,150,, +0.4,BoneV,508,316,70,2,150,, +0.4,Platform,640,296,31,2,60,, +0.6,Platform,640,326,51,2,150,, +0.7,Platform,640,336,51,2,150,, +0.3,BoneV,508,257,45,2,150,, +0.4,Platform,640,316,51,2,150,, +0.3,BoneV,508,257,55,2,150,, +0.7,BoneV,508,257,35,2,150,, +1.5,BoneV,133,257,95,0,90,, +0.7,BoneV,508,276,110,2,240,, +2.5,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_platforms3.csv b/badtimesimulator/sans_platforms3.csv new file mode 100644 index 00000000..2e6dd114 --- /dev/null +++ b/badtimesimulator/sans_platforms3.csv @@ -0,0 +1,22 @@ +0,CombatZoneResize,133,251,508,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,PlatformRepeat,513,346,121,2,120,5,220 +0,PlatformRepeat,-71,306,161,0,120,4,280 +0,SET,Loop,16,,,,, +0,JMPZ,22,$Loop,,,,, +0,SUB,Loop,$Loop,1,,,, +0,RND,Jump,3,,,,, +0,ADD,Jump,$Jump,1,,,, +0,JMPREL,$Jump,,,,,, +0,JMPREL,3,,,,,, +0,JMPREL,4,,,,,, +0,JMPREL,5,,,,,, +0,BoneV,517,257,45,2,120,, +0.5,JMPABS,8,,,,,, +0,BoneV,125,306,40,0,120,, +0.5,JMPABS,8,,,,,, +0,BoneV,517,349,35,2,120,, +0.5,JMPABS,8,,,,,, +0,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_platforms4.csv b/badtimesimulator/sans_platforms4.csv new file mode 100644 index 00000000..f8ad431a --- /dev/null +++ b/badtimesimulator/sans_platforms4.csv @@ -0,0 +1,11 @@ +0,CombatZoneResize,113,231,548,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,Platform,151,336,41,0,90,1, +0,HeartTeleport,175,327,,,,, +0,BoneVRepeat,528,366,40,0,60,60,15 +0,BoneVRepeat,283,267,40,3,90,11,85 +0,BoneVRepeat,363,331,40,1,120,13,95 +0,BoneVRepeat,443,248,40,3,90,11,85 +7.3,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_platforms4hard.csv b/badtimesimulator/sans_platforms4hard.csv new file mode 100644 index 00000000..29210fec --- /dev/null +++ b/badtimesimulator/sans_platforms4hard.csv @@ -0,0 +1,11 @@ +0,CombatZoneResize,113,231,548,391,TLResume,, +0,HeartTeleport,320,376,,,,, +0,HeartMode,1,,,,,, +0,TLPause,,,,,,, +0,Platform,151,336,31,0,90,1, +0,HeartTeleport,175,327,,,,, +0,BoneVRepeat,528,366,40,0,60,60,15 +0,BoneVRepeat,283,268,40,3,90,12,65 +0,BoneVRepeat,363,325,40,1,120,11,90 +0,BoneVRepeat,443,268,40,3,90,12,65 +7.3,EndAttack,,,,,,, diff --git a/badtimesimulator/sans_randomblaster1.csv b/badtimesimulator/sans_randomblaster1.csv new file mode 100644 index 00000000..190792e8 --- /dev/null +++ b/badtimesimulator/sans_randomblaster1.csv @@ -0,0 +1,30 @@ +0,CombatZoneResize,121,186,526,391,TLResume,,, +0,HeartTeleport,320,304,,,,,, +0,HeartMode,0,,,,,,, +0,TLPause,,,,,,,, +0.5,SET,Loop,15,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Ang,360,,,,,, +0,COS,X,$Ang,,,,,, +0,SIN,Y,$Ang,,,,,, +0,MUL,EndX,$X,200,,,,, +0,MUL,EndY,$Y,200,,,,, +0,MUL,X,$X,400,,,,, +0,MUL,Y,$Y,300,,,,, +0,GetHeartPos,HeartX,HeartY,,,,,, +0,ADD,EndX,$EndX,$HeartX,,,,, +0,ADD,EndY,$EndY,$HeartY,,,,, +0,ADD,X,$X,$HeartX,,,,, +0,ADD,Y,$Y,$HeartY,,,,, +0,JMPNL,21,$EndX,50,,,,, +0,SET,EndX,50,,,,,, +0,JMPNG,23,$EndX,590,,,,, +0,SET,EndX,590,,,,,, +0,JMPNL,25,$EndY,40,,,,, +0,SET,EndY,40,,,,,, +0,JMPNG,27,$EndY,440,,,,, +0,SET,EndY,440,,,,,, +0,ANGLE,Ang,$EndX,$EndY,$HeartX,$HeartY,,, +0,GasterBlaster,0,$X,$Y,$EndX,$EndY,$Ang,0.46666,0.03333 +0.53333,JMPNZ,6,$Loop,,,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_randomblaster2.csv b/badtimesimulator/sans_randomblaster2.csv new file mode 100644 index 00000000..8741512d --- /dev/null +++ b/badtimesimulator/sans_randomblaster2.csv @@ -0,0 +1,30 @@ +0,CombatZoneResize,121,186,526,391,TLResume,,, +0,HeartTeleport,320,304,,,,,, +0,HeartMode,0,,,,,,, +0,TLPause,,,,,,,, +0.4,SET,Loop,12,,,,,, +0,SUB,Loop,$Loop,1,,,,, +0,RND,Ang,360,,,,,, +0,COS,X,$Ang,,,,,, +0,SIN,Y,$Ang,,,,,, +0,MUL,EndX,$X,200,,,,, +0,MUL,EndY,$Y,200,,,,, +0,MUL,X,$X,400,,,,, +0,MUL,Y,$Y,300,,,,, +0,GetHeartPos,HeartX,HeartY,,,,,, +0,ADD,EndX,$EndX,$HeartX,,,,, +0,ADD,EndY,$EndY,$HeartY,,,,, +0,ADD,X,$X,$HeartX,,,,, +0,ADD,Y,$Y,$HeartY,,,,, +0,JMPNL,21,$EndX,50,,,,, +0,SET,EndX,50,,,,,, +0,JMPNG,23,$EndX,590,,,,, +0,SET,EndX,590,,,,,, +0,JMPNL,25,$EndY,40,,,,, +0,SET,EndY,40,,,,,, +0,JMPNG,27,$EndY,440,,,,, +0,SET,EndY,440,,,,,, +0,ANGLE,Ang,$EndX,$EndY,$HeartX,$HeartY,,, +0,GasterBlaster,1,$X,$Y,$EndX,$EndY,$Ang,0.66666,0.03333 +0.66666,JMPNZ,6,$Loop,,,,,, +0,EndAttack,,,,,,,, diff --git a/badtimesimulator/sans_spare.csv b/badtimesimulator/sans_spare.csv new file mode 100644 index 00000000..e48f0de0 --- /dev/null +++ b/badtimesimulator/sans_spare.csv @@ -0,0 +1,5 @@ +0,CombatZoneResize,133,251,508,391,TLResume +0,HeartTeleport,320,376,,, +0,HeartMode,1,,,, +0,TLPause,,,,, +0.3,EndAttack,,,,, diff --git a/badtimesimulator/sw.js b/badtimesimulator/sw.js new file mode 100644 index 00000000..dfe699a5 --- /dev/null +++ b/badtimesimulator/sw.js @@ -0,0 +1,403 @@ +"use strict"; + +const OFFLINE_DATA_FILE = "offline.js"; +const CACHE_NAME_PREFIX = "c2offline"; +const BROADCASTCHANNEL_NAME = "offline"; +const CONSOLE_PREFIX = "[SW] "; +const LAZYLOAD_KEYNAME = ""; + +// Create a BroadcastChannel if supported. +const broadcastChannel = (typeof BroadcastChannel === "undefined" ? null : new BroadcastChannel(BROADCASTCHANNEL_NAME)); + +////////////////////////////////////// +// Utility methods +function PostBroadcastMessage(o) +{ + if (!broadcastChannel) + return; // not supported + + // Impose artificial (and arbitrary!) delay of 3 seconds to make sure client is listening by the time the message is sent. + // Note we could remove the delay on some messages, but then we create a race condition where sometimes messages can arrive + // in the wrong order (e.g. "update ready" arrives before "started downloading update"). So to keep the consistent ordering, + // delay all messages by the same amount. + setTimeout(() => broadcastChannel.postMessage(o), 3000); +}; + +function Broadcast(type) +{ + PostBroadcastMessage({ + "type": type + }); +}; + +function BroadcastDownloadingUpdate(version) +{ + PostBroadcastMessage({ + "type": "downloading-update", + "version": version + }); +} + +function BroadcastUpdateReady(version) +{ + PostBroadcastMessage({ + "type": "update-ready", + "version": version + }); +} + +function IsUrlInLazyLoadList(url, lazyLoadList) +{ + if (!lazyLoadList) + return false; // presumably lazy load list failed to load + + try { + for (const lazyLoadRegex of lazyLoadList) + { + if (new RegExp(lazyLoadRegex).test(url)) + return true; + } + } + catch (err) + { + console.error(CONSOLE_PREFIX + "Error matching in lazy-load list: ", err); + } + + return false; +}; + +function WriteLazyLoadListToStorage(lazyLoadList) +{ + if (typeof localforage === "undefined") + return Promise.resolve(); // bypass if localforage not imported + else + return localforage.setItem(LAZYLOAD_KEYNAME, lazyLoadList) +}; + +function ReadLazyLoadListFromStorage() +{ + if (typeof localforage === "undefined") + return Promise.resolve([]); // bypass if localforage not imported + else + return localforage.getItem(LAZYLOAD_KEYNAME); +}; + +function GetCacheBaseName() +{ + // Include the scope to avoid name collisions with any other SWs on the same origin. + // e.g. "c2offline-https://example.com/foo/" (won't collide with anything under bar/) + return CACHE_NAME_PREFIX + "-" + self.registration.scope; +}; + +function GetCacheVersionName(version) +{ + // Append the version number to the cache name. + // e.g. "c2offline-https://example.com/foo/-v2" + return GetCacheBaseName() + "-v" + version; +}; + +// Return caches.keys() filtered down to just caches we're interested in (with the right base name). +// This filters out caches from unrelated scopes. +async function GetAvailableCacheNames() +{ + const cacheNames = await caches.keys(); + const cacheBaseName = GetCacheBaseName(); + return cacheNames.filter(n => n.startsWith(cacheBaseName)); +}; + +// Identify if an update is pending, which is the case when we have 2 or more available caches. +// One must be an update that is waiting, since the next navigate that does an upgrade will +// delete all the old caches leaving just one currently-in-use cache. +async function IsUpdatePending() +{ + const availableCacheNames = await GetAvailableCacheNames(); + return (availableCacheNames.length >= 2); +}; + +// Automatically deduce the main page URL (e.g. index.html or main.aspx) from the available browser windows. +// This prevents having to hard-code an index page in the file list, implicitly caching it like AppCache did. +async function GetMainPageUrl() +{ + const allClients = await clients.matchAll({ + includeUncontrolled: true, + type: "window" + }); + + for (const c of allClients) + { + // Parse off the scope from the full client URL, e.g. https://example.com/index.html -> index.html + let url = c.url; + if (url.startsWith(self.registration.scope)) + url = url.substring(self.registration.scope.length); + + if (url && url !== "/") // ./ is also implicitly cached so don't bother returning that + { + // If the URL is solely a search string, prefix it with / to ensure it caches correctly. + // e.g. https://example.com/?foo=bar needs to cache as /?foo=bar, not just ?foo=bar. + if (url.startsWith("?")) + url = "/" + url; + + return url; + } + } + + return ""; // no main page URL could be identified +}; + +// Hack to fetch optionally bypassing HTTP cache until fetch cache options are supported in Chrome (crbug.com/453190) +function fetchWithBypass(request, bypassCache) +{ + if (typeof request === "string") + request = new Request(request); + + if (bypassCache) + { + // bypass enabled: add a random search parameter to avoid getting a stale HTTP cache result + const url = new URL(request.url); + url.search += Math.floor(Math.random() * 1000000); + + return fetch(url, { + headers: request.headers, + mode: request.mode, + credentials: request.credentials, + redirect: request.redirect, + cache: "no-store" + }); + } + else + { + // bypass disabled: perform normal fetch which is allowed to return from HTTP cache + return fetch(request); + } +}; + +// Effectively a cache.addAll() that only creates the cache on all requests being successful (as a weak attempt at making it atomic) +// and can optionally cache-bypass with fetchWithBypass in every request +async function CreateCacheFromFileList(cacheName, fileList, bypassCache) +{ + // Kick off all requests and wait for them all to complete + const responses = await Promise.all(fileList.map(url => fetchWithBypass(url, bypassCache))); + + // Check if any request failed. If so don't move on to opening the cache. + // This makes sure we only open a cache if all requests succeeded. + let allOk = true; + + for (const response of responses) + { + if (!response.ok) + { + allOk = false; + console.error(CONSOLE_PREFIX + "Error fetching '" + response.url + "' (" + response.status + " " + response.statusText + ")"); + } + } + + if (!allOk) + throw new Error("not all resources were fetched successfully"); + + // Can now assume all responses are OK. Open a cache and write all responses there. + // TODO: ideally we can do this transactionally to ensure a complete cache is written as one atomic operation. + // This needs either new transactional features in the spec, or at the very least a way to rename a cache + // (so we can write to a temporary name that won't be returned by GetAvailableCacheNames() and then rename it when ready). + const cache = await caches.open(cacheName); + + try { + return await Promise.all(responses.map( + (response, i) => cache.put(fileList[i], response) + )); + } + catch (err) + { + // Not sure why cache.put() would fail (maybe if storage quota exceeded?) but in case it does, + // clean up the cache to try to avoid leaving behind an incomplete cache. + console.error(CONSOLE_PREFIX + "Error writing cache entries: ", err); + caches.delete(cacheName); + throw err; + } +}; + +async function UpdateCheck(isFirst) +{ + try { + // Always bypass cache when requesting offline.js to make sure we find out about new versions. + const response = await fetchWithBypass(OFFLINE_DATA_FILE, true); + + if (!response.ok) + throw new Error(OFFLINE_DATA_FILE + " responded with " + response.status + " " + response.statusText); + + const data = await response.json(); + + const version = data.version; + const fileList = data.fileList; + const lazyLoadList = data.lazyLoad; + const currentCacheName = GetCacheVersionName(version); + + const cacheExists = await caches.has(currentCacheName); + + // Don't recache if there is already a cache that exists for this version. Assume it is complete. + if (cacheExists) + { + // Log whether we are up-to-date or pending an update. + const isUpdatePending = await IsUpdatePending(); + if (isUpdatePending) + { + console.log(CONSOLE_PREFIX + "Update pending"); + Broadcast("update-pending"); + } + else + { + console.log(CONSOLE_PREFIX + "Up to date"); + Broadcast("up-to-date"); + } + return; + } + + // Implicitly add the main page URL to the file list, e.g. "index.html", so we don't have to assume a specific name. + const mainPageUrl = await GetMainPageUrl(); + + // Prepend the main page URL to the file list if we found one and it is not already in the list. + // Also make sure we request the base / which should serve the main page. + fileList.unshift("./"); + + if (mainPageUrl && fileList.indexOf(mainPageUrl) === -1) + fileList.unshift(mainPageUrl); + + console.log(CONSOLE_PREFIX + "Caching " + fileList.length + " files for offline use"); + + if (isFirst) + Broadcast("downloading"); + else + BroadcastDownloadingUpdate(version); + + // Note we don't bypass the cache on the first update check. This is because SW installation and the following + // update check caching will race with the normal page load requests. For any normal loading fetches that have already + // completed or are in-flight, it is pointless and wasteful to cache-bust the request for offline caching, since that + // forces a second network request to be issued when a response from the browser HTTP cache would be fine. + if (lazyLoadList) + await WriteLazyLoadListToStorage(lazyLoadList); // dump lazy load list to local storage# + + await CreateCacheFromFileList(currentCacheName, fileList, !isFirst); + const isUpdatePending = await IsUpdatePending(); + + if (isUpdatePending) + { + console.log(CONSOLE_PREFIX + "All resources saved, update ready"); + BroadcastUpdateReady(version); + } + else + { + console.log(CONSOLE_PREFIX + "All resources saved, offline support ready"); + Broadcast("offline-ready"); + } + } + catch (err) + { + // Update check fetches fail when we're offline, but in case there's any other kind of problem with it, log a warning. + console.warn(CONSOLE_PREFIX + "Update check failed: ", err); + } +}; + +self.addEventListener("install", event => +{ + // On install kick off an update check to cache files on first use. + // If it fails we can still complete the install event and leave the SW running, we'll just + // retry on the next navigate. + event.waitUntil( + UpdateCheck(true) // first update + .catch(() => null) + ); +}); + +async function GetCacheNameToUse(availableCacheNames, doUpdateCheck) +{ + // Prefer the oldest cache available. This avoids mixed-version responses by ensuring that if a new cache + // is created and filled due to an update check while the page is running, we keep returning resources + // from the original (oldest) cache only. + if (availableCacheNames.length === 1 || !doUpdateCheck) + return availableCacheNames[0]; + + // We are making a navigate request with more than one cache available. Check if we can expire any old ones. + const allClients = await clients.matchAll(); + + // If there are other clients open, don't expire anything yet. We don't want to delete any caches they + // might be using, which could cause mixed-version responses. + if (allClients.length > 1) + return availableCacheNames[0]; + + // Identify newest cache to use. Delete all the others. + const latestCacheName = availableCacheNames[availableCacheNames.length - 1]; + console.log(CONSOLE_PREFIX + "Updating to new version"); + + await Promise.all( + availableCacheNames.slice(0, -1) + .map(c => caches.delete(c)) + ); + + return latestCacheName; +}; + +async function HandleFetch(event, doUpdateCheck) +{ + const availableCacheNames = await GetAvailableCacheNames(); + + // No caches available: go to network + if (!availableCacheNames.length) + return fetch(event.request); + + const useCacheName = await GetCacheNameToUse(availableCacheNames, doUpdateCheck); + const cache = await caches.open(useCacheName); + const cachedResponse = await cache.match(event.request); + + if (cachedResponse) + return cachedResponse; // use cached response + + // We need to check if this request is to be lazy-cached. Send the request and load the lazy-load list + // from storage simultaneously. + const result = await Promise.all([fetch(event.request), ReadLazyLoadListFromStorage()]); + const fetchResponse = result[0]; + const lazyLoadList = result[1]; + + if (IsUrlInLazyLoadList(event.request.url, lazyLoadList)) + { + // Handle failure writing to the cache. This can happen if the storage quota is exceeded, which is particularly + // likely in Safari 11.1, which appears to have very tight storage limits. Make sure even in the event of an error + // we continue to return the response from the fetch. + try { + // Note clone response since we also respond with it + await cache.put(event.request, fetchResponse.clone()); + } + catch (err) + { + console.warn(CONSOLE_PREFIX + "Error caching '" + event.request.url + "': ", err); + } + } + + return fetchResponse; +}; + +self.addEventListener("fetch", event => +{ + /** NOTE (iain) + * This check is to prevent a bug with XMLHttpRequest where if its + * proxied with "FetchEvent.prototype.respondWith" no upload progress + * events are triggered. By returning we allow the default action to + * occur instead. Currently all cross-origin requests fall back to default. + */ + if (new URL(event.request.url).origin !== location.origin) + return; + + // Check for an update on navigate requests + const doUpdateCheck = (event.request.mode === "navigate"); + + const responsePromise = HandleFetch(event, doUpdateCheck); + + if (doUpdateCheck) + { + // allow the main request to complete, then check for updates + event.waitUntil( + responsePromise + .then(() => UpdateCheck(false)) // not first check + ); + } + + event.respondWith(responsePromise); +}); \ No newline at end of file diff --git a/basketbros/BasketBros.js b/basketbros/BasketBros.js new file mode 100644 index 00000000..41c1c3aa --- /dev/null +++ b/basketbros/BasketBros.js @@ -0,0 +1 @@ +var $jscomp=$jscomp||{};$jscomp.scope={},$jscomp.arrayIteratorImpl=function(i){var e=0;return function(){return et||1114111=t?e+=String.fromCharCode(t):(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),e+=String.fromCharCode(1023&t|56320))}return e}}),"es6","es3"),$jscomp.checkStringArgs=function(i,e,I){if(null==i)throw new TypeError("The 'this' value for String.prototype."+I+" must not be null or undefined");if(e instanceof RegExp)throw new TypeError("First argument to String.prototype."+I+" must not be a regular expression");return i+""},$jscomp.polyfill("String.prototype.startsWith",(function(i){return i||function(i,e){var I=$jscomp.checkStringArgs(this,i,"startsWith");i+="";var t=I.length,C=i.length;e=Math.max(0,Math.min(0|e,I.length));for(var o=0;o=C}}),"es6","es3"),$jscomp.polyfill("String.prototype.endsWith",(function(i){return i||function(i,e){var I=$jscomp.checkStringArgs(this,i,"endsWith");i+="",void 0===e&&(e=I.length),e=Math.max(0,Math.min(0|e,I.length));for(var t=i.length;0=t}}),"es6","es3"),$jscomp.polyfill("Array.prototype.fill",(function(i){return i||function(i,e,I){var t=this.length||0;for(0>e&&(e=Math.max(0,t+e)),(null==I||I>t)&&(I=t),0>(I=Number(I))&&(I=Math.max(0,t+I)),e=Number(e||0);ee;){var I=e++;y.tileMaps[I]=new tg(m.SCREENWIDTH,m.SCREENHEIGHT,i,!1),y.tileMaps[I].set_shader(y.myShader2)}for(e=0;250>e;){e++,(i=new y).fromPool=!0,i.holder=null,i.localCoords=!0,null!=i.local_loc?i.local_loc.x=i.local_loc.y=0:i.local_loc=new N(0,0),i.local_rot=0,i.set_local_alp(1),i.set_local_xScale(1),i.set_local_yScale(1),i.set_local_r(1),i.set_local_g(1),i.set_local_b(1);var t=i.holder;if(null!=t){var C=t.rot;I=t.xScale;var o=t.yScale,s=i.local_loc.x+t.handle.x,l=i.local_loc.y+t.handle.y,n=t.loc.x;t=t.loc.y;var a=i.xScale*i.yScale;if(i.rot=C+(0a?-1:0)*i.local_rot,0==C)i.loc.x=n+I*s,i.loc.y=t+o*l;else{for(a=C;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;for(a=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a;C<-Math.PI;)C+=2*Math.PI;for(;C>Math.PI;)C-=2*Math.PI;3.14159265<(C+=1.57079632)&&(C-=6.28318531),C=0>C?1.27323954*C+.405284735*C*C:1.27323954*C-.405284735*C*C,i.loc.x=n+I*s*C-o*l*a,i.loc.y=t+I*s*a+o*l*C}}y.objectPool.push(i)}for(e=0;1500>e;)e++,y.filterPool.push(new z)},y.ResizeTilemaps=function(){for(var i=0,e=y.tileMaps;il?-1:0)*this.local_rot,0==I)this.loc.x=s+e*C,this.loc.y=i+t*o;else{for(var n=I;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;for(l=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,n=I;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;3.14159265<(n+=1.57079632)&&(n-=6.28318531),I=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,this.loc.x=s+e*C*I-t*o*l,this.loc.y=i+e*C*l+t*o*I}}},GetMovement:function(i){for(var e=null,I=this.movements.h;null!=I;){var t=I.item;if(I=I.next,t.attrib==i){e=t;break}}return e},Init:function(i){this.img=i,this.rect=G.GetRect(),null!=this.tile&&null!=this.tileSet&&(this.tileSet=this.tile=null)},LoadFromURL:function(i){var e=this,I=new Qe;I.contentLoaderInfo.addEventListener("complete",(function(i){e.Init(qa.__cast(I.content,Nd).get_bitmapData()),i=I.content.get_width();var t=I.content.get_height();e.rect=new A(0,0,i,t)})),I.load(new Od(i))},UpdateChildren:function(){for(var i=0,e=this.children;in?-1:0)*this.local_rot,0==C)this.loc.x=l+e*o,this.loc.y=t+I*s;else{for(var a=C;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;for(n=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,a=C;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;3.14159265<(a+=1.57079632)&&(a-=6.28318531),C=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,this.loc.x=l+e*o*C-I*s*n,this.loc.y=t+e*o*n+I*s*C}}}for(e=0,I=this.children;ey.filterPool.length&&y.filterPool.push(e)}for(;0y.filterPool.length&&y.filterPool.push(e);this.movements.remove(i)}},KillAllMovements:function(){for(;0l?-1:0)*this.local_rot,0==C)this.loc.x=s+i*I,this.loc.y=t+e*o;else{for(var n=C;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;for(l=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,n=C;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;3.14159265<(n+=1.57079632)&&(n-=6.28318531),C=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,this.loc.x=s+i*I*C-e*o*l,this.loc.y=t+i*I*l+e*o*C}}}},DrawShadow:function(i){if(1m.thisMain.getChildIndex(y.gTileMap)&&m.thisMain.addChild(y.gTileMap),m.thisMain.setChildIndex(y.gTileMap,y.tileMapsIndex),y.gTileMap.set_visible(!0),y.tileMapsIndex++),null==this.tile&&(e=this.tileSet.addRect(this.rect),this.tile=new Pd(e),this.tile.set_colorTransform(new Ea),this.color=this.tile.get_colorTransform(),this.tile.set_matrix(this.matrix)),(e=this.color).redMultiplier=this.r,e.greenMultiplier=this.g,e.blueMultiplier=this.b,e.alphaMultiplier=this.alp,(e=this.tile).set_alpha(this.alp),e.set_blendMode(this.blendMode),y.gTileMap.addTile(e)}this.didLogic=!1},DrawChildren:function(i){for(var e=0,I=this.children;ethis.loc.x-this.rect.width/2*e+e*this.handle.x&&m.mXthis.loc.y-this.rect.height/2*I+I*this.handle.y&&m.mYm.SCREENWIDTH||this.rect.height*this.yScale>m.SCREENHEIGHT)))},TestBoxCol:function(i){return null!=this.rect&&null!=i.rect&&I.testBoxCol2(this.loc,i.loc,this.rect,i.rect,this.xScale,i.xScale)},FaceCoords:function(i){this.rot=Math.atan2(this.loc.y-i.y,this.loc.x-i.x)},FaceAnotherObject:function(){var i=this.loc;this.rot=Math.atan2(this.loc.y-i.y,this.loc.x-i.x)},Advance:function(i){},KillChildren:function(){for(var i;null!=(i=this.children.pop())&&i.PreRemove(),null!=i;);},AddMovement:function(i,e,I,t,C,o,s){null==o&&(o=0),null==C&&(C=!1),null==t&&(t=0);var l=null;if(null==l&&(l=new Lc),null==o&&(o=0),null==t&&(t=0),null!=l.holder&&l.holder instanceof Ja&&4==l.attrib&&(l.attrib=4),l.holder=null,l.holderMovement=null,l.start=e,l.end=I,l.dontLoop=!1,0==t?l.tickGoal=Lc.lastTickGoal:(l.tickGoal=60*t/1e3,Lc.lastTickGoal=l.tickGoal),null==l.ratioFilters?l.ratioFilters=[]:l.ratioFilters.splice(0,l.ratioFilters.length),null==l.movementFilters?l.movementFilters=[]:l.movementFilters.splice(0,l.movementFilters.length),l.loopStart=l.loopEnd=!1,l.tickCounter=0-Math.floor(60*o/1e3),l.current=0,l.ratio=0,l.killFlag=!1,l.eventFunction=null,l.eventArg=null,l.name=null,l.child=null,l.attrib=i,l.name=s,l.holder=this,l.InitSetterGetter(),this.lastMovement=l,l.loopStart=l.loopEnd=C,null==(i=this.GetMovement(i)))this.movements.push(l),-999999!=l.start&&(l.current=l.start,this.AssignAttribute(l.attrib,l));else{for(;null!=i.child;)i=i.child;i.child=l,l.holderMovement=i}return null==l.holder&&(l.holder=null),this.lastMovement},AddMovementFilter:function(i,e,I,t){null==t&&(t=0),null==I&&(I=0);var C=this.fromPool?y.filterPool.pop():null;return null==C&&(C=new z),C.type=i,C.amplitude=e,C.period=I,C.offset=t,C.splineArr=null,C.curves=null,this.lastMovement.movementFilters.push(C),C},AddRatioFilter:function(i,e,I,t){null==t&&(t=0),null==I&&(I=0);var C=this.fromPool?y.filterPool.pop():null;return null==C&&(C=new z),C.type=i,C.amplitude=e,C.period=I,C.offset=t,C.splineArr=null,C.curves=null,this.lastMovement.ratioFilters.push(C),C},AddEvent:function(i,e,I){null==I&&(I=!1),null==this.lastMovement.eventFunction&&(this.lastMovement.eventFunction=[]),null==this.lastMovement.eventArg&&(this.lastMovement.eventArg=[]),this.lastMovement.eventAtStart=I,null==i?this.lastMovement.eventFunction.push(u(this,this.DoEvent)):(this.lastMovement.eventFunction.push(i),this.lastMovement.eventArg.push(e))},AddFrameSheet:function(i,e,I){var t=G.GetRect(),C=t.width/e,o=t.height/I;this.img=i;for(var s=0;sl?-1:0)*this.local_rot,0==e)this.loc.x=s+I*C,this.loc.y=i+t*o;else{for(var n=e;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;for(l=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,n=e;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;3.14159265<(n+=1.57079632)&&(n-=6.28318531),e=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,this.loc.x=s+I*C*e-t*o*l,this.loc.y=i+I*C*l+t*o*e}}},GetGlobalX:function(i,e){if(null==this.holder)return 0;var I=this.holder.rot;return(i=this.holder.xScale*(i+this.holder.handle.x)*Math.cos(I)-this.holder.yScale*(e+this.holder.handle.y)*Math.sin(I))+this.holder.loc.x},GetGlobalY:function(i,e){if(null==this.holder)return 0;var I=this.holder.rot;return(e=this.holder.xScale*(i+this.holder.handle.x)*Math.sin(I)+this.holder.yScale*(e+this.holder.handle.y)*Math.cos(I))+this.holder.loc.y},GetGlobalRotation:function(i){if(null==this.holder)return 0;var e=this.xScale,I=this.yScale;return(0e?-1:0)*(0I?-1:0)*i+this.holder.rot},GetGlobalAlpha:function(i){return null==this.holder?0:i*this.holder.alp},GetGlobalXScale:function(i){return null==this.holder?0:i*this.holder.xScale},GetGlobalYScale:function(i){return null==this.holder?0:i*this.holder.yScale},SortZRecursive:function(){this.children.sort(I.compareZ);for(var i=0,e=this.children;iS?-1:0)*c.local_rot,0==d)c.loc.x=Q+_*A,c.loc.y=h+k*u;else{for(S=d;S<-Math.PI;)S+=2*Math.PI;for(;S>Math.PI;)S-=2*Math.PI;for(S=0>S?1.27323954*S+.405284735*S*S:1.27323954*S-.405284735*S*S;d<-Math.PI;)d+=2*Math.PI;for(;d>Math.PI;)d-=2*Math.PI;3.14159265<(d+=1.57079632)&&(d-=6.28318531),1,d=0>d?1.27323954*d+.405284735*d*d:1.27323954*d-.405284735*d*d,c.loc.x=Q+_*A*d-k*u*S,c.loc.y=h+_*A*S+k*u*d}}c.name=a[J].name,i.children.push(c);var w=a[J];Object.prototype.hasOwnProperty.call(w,"parent")&&(c.parentText=w.parent),Object.prototype.hasOwnProperty.call(w,"rotation")&&(c.local_rot=-w.rotation*Math.PI/180),Object.prototype.hasOwnProperty.call(w,"x")&&(c.local_loc.x=w.x),Object.prototype.hasOwnProperty.call(w,"y")&&(c.local_loc.y=-w.y),Object.prototype.hasOwnProperty.call(w,"scaleY")&&c.set_local_yScale(w.scaleY),Object.prototype.hasOwnProperty.call(w,"scaleX")&&c.set_local_xScale(w.scaleX)}a=[],w=[];var b=ta.field(C,"slots");for(g=0,r=b.length;gS?-1:0)*c.local_rot,0==d)c.loc.x=Q+_*A,c.loc.y=h+k*u;else{for(S=d;S<-Math.PI;)S+=2*Math.PI;for(;S>Math.PI;)S-=2*Math.PI;for(0,S=0>S?1.27323954*S+.405284735*S*S:1.27323954*S-.405284735*S*S;d<-Math.PI;)d+=2*Math.PI;for(;d>Math.PI;)d-=2*Math.PI;3.14159265<(d+=1.57079632)&&(d-=6.28318531),1,d=0>d?1.27323954*d+.405284735*d*d:1.27323954*d-.405284735*d*d,c.loc.x=Q+_*A*d-k*u*S,c.loc.y=h+_*A*S+k*u*d}c.zOrder=l.indexOf(j,n),c.name=Z,c.smoothing=s,e.children.push(c),i.skinImages.push(c),0Z?-1:0)*(0<_?1:0>_?-1:0)*L.rotation*Math.PI/180)}++J}}for(t=null,g=0,r=i.children;gc?-1:0)*o.local_rot,0==l)o.loc.x=J+n*g,o.loc.y=s+a*r;else{for(c=l;c<-Math.PI;)c+=2*Math.PI;for(;c>Math.PI;)c-=2*Math.PI;for(c=0>c?1.27323954*c+.405284735*c*c:1.27323954*c-.405284735*c*c;l<-Math.PI;)l+=2*Math.PI;for(;l>Math.PI;)l-=2*Math.PI;3.14159265<(l+=1.57079632)&&(l-=6.28318531),l=0>l?1.27323954*l+.405284735*l*l:1.27323954*l-.405284735*l*l,o.loc.x=J+n*g*l-a*r*c,o.loc.y=s+n*g*c+a*r*l}}o.local_loc.x=this.local_loc.x,o.local_loc.y=this.local_loc.y,o.img=this.img,o.rect=this.rect.clone(),o.set_local_r(this.local_r),o.set_local_g(this.local_g),o.set_local_b(this.local_b)}else o.zOrder=1.05,o.loc.x=this.loc.x,o.loc.y=this.loc.y,o.img=this.img,o.rect=this.rect.clone(),o.r=this.r,o.g=this.g,o.b=this.b;o.onlyTintGreyPixels=this.onlyTintGreyPixels,50I?-1:0)*Math.min(i,e)),I=this.local_yScale,this.set_local_yScale((0I?-1:0)*Math.min(i,e))}else i/=this.rect.width,e/=this.rect.height,I=this.xScale,this.set_xScale((0I?-1:0)*Math.min(i,e)),I=this.yScale,this.set_yScale((0I?-1:0)*Math.min(i,e))},BrightenRecursive:function(i){this.r*=i,this.g*=i,this.b*=i;for(var e=0,I=this.children;e>16&255;var I=i>>8&255;i&=255,this.localCoords?(this.set_local_r(e/255),this.set_local_g(I/255),this.set_local_b(i/255)):(this.r=e/255,this.g=I/255,this.b=i/255)},RoundRecursive:function(){this.loc.x=Math.round(10*this.loc.x)/10,this.loc.y=Math.round(10*this.loc.y)/10,this.localCoords&&(this.local_loc.x=Math.round(10*this.local_loc.x)/10,this.local_loc.y=Math.round(10*this.local_loc.y)/10);for(var i=0,e=this.children;ie.boneName?1:i.boneNamee.attributeType?1:i.attributeTypee.timeStamp?1:i.timeStampl?-1:0)*this.local_rot,0==e)this.loc.x=s+I*C,this.loc.y=i+t*o;else{for(var n=e;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;for(l=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,n=e;n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;3.14159265<(n+=1.57079632)&&(n-=6.28318531),e=0>n?1.27323954*n+.405284735*n*n:1.27323954*n-.405284735*n*n,this.loc.x=s+I*C*e-t*o*l,this.loc.y=i+I*C*l+t*o*e}}this.animations=[],this.skinImages=[]};p.Skeleton=W,W.__name__="Skeleton",W.__super__=y,W.prototype=B(y.prototype,{GetAnimation:function(i){for(var e=0,I=this.animations;ei&&(i=t.timeStamp)}return i},SetPlaybackSpeed:function(i){for(var e=0,I=this.children;ethis.maxTimeStamp&&(this.maxTimeStamp=l.timeStamp),0==l.timeStamp&&0J?-1:0)*t.local_rot,0==s)t.loc.x=r+l*a,t.loc.y=o+n*g;else{for(var c=s;c<-Math.PI;)c+=2*Math.PI;for(;c>Math.PI;)c-=2*Math.PI;for(J=0>c?1.27323954*c+.405284735*c*c:1.27323954*c-.405284735*c*c,c=s;c<-Math.PI;)c+=2*Math.PI;for(;c>Math.PI;)c-=2*Math.PI;3.14159265<(c+=1.57079632)&&(c-=6.28318531),s=0>c?1.27323954*c+.405284735*c*c:1.27323954*c-.405284735*c*c,t.loc.x=r+l*a*s-n*g*J,t.loc.y=o+l*a*J+n*g*s}}this.dummy.smoothing=!1,this.children.push(this.dummy),this.announcerY=this.dummy.rect.height/2,this.AddMovement(1,-this.announcerY*this.yScale,this.announcerY*this.yScale,600,!1,1e3),this.loc.x=m.CENTERX,null==(t=this.fromPool?y.filterPool.pop():null)&&(t=new z),t.type=0,t.amplitude=1,t.period=0,t.offset=0,t.splineArr=null,t.curves=null,this.lastMovement.ratioFilters.push(t),this.AddMovement(4,0,1,1e3),this.holder=i,this.holder.CycleLights(),e?(this.AddEvent(u(this,this.DoneEntrancePostGame)),m.GetChildByTypeRecursive(Cb).SlideOutScoreboard(),I.PlaySound(zc.Get())):m.player.practiceMode?(this.isVisible=!1,this.KillAllMovements(),this.DoneSixthChat()):(this.AddEvent(u(this,this.DoneEntrance)),this.AddLights()),C?(this.movements=new ca,this.isVisible=!1,this.DoneSixthChat()):this.doSkip||I.PlaySound(ke.Get())};p.Announcer=ea,ea.__name__="Announcer",ea.__super__=y,ea.prototype=B(y.prototype,{DoneEntrance:function(){var i=new Q("We have a spectacular matchup tonight! First to 15 points wins!",0,this);this.children.push(i),this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneFirstChat))},DoneFirstChat:function(){var i=new Q("On this side, we have...",0,this);this.children.push(i),this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneSecondChat)),this.rightLights.isVisible=!0},DoneSecondChat:function(){if(!H.onlineGame){var i=this.AddHumanGuy();""!=H.onlineName&&"Your Name"!=H.onlineName&&(i.name=H.onlineName),i=new Q(T.replace(i.name,"2P","")+"!",0,this),this.children.push(i)}this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneThirdChat))},AddHumanGuy:function(){return this.holder.AddHumanGuy()},DoneThirdChat:function(){var i=new Q("And on this side, we have...",0,this);this.children.push(i),this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneFourthChat)),this.rightLights.isVisible=!1,this.leftLights.isVisible=!0},DoneFourthChat:function(){if(!H.onlineGame){var i=m.player.twoPlayerMode?this.AddHumanGuy():this.AddCPUGuy();i=new Q(T.replace(i.name,"2P","")+"!",0,this),this.children.push(i)}this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoCPUBubble))},AddCPUGuy:function(){if(m.player.practiceMode)return null;var i=new Ja(this.holder,.75);return this.holder.children.push(i),i.update(),I.PlaySound(zc.Get()),i},DoCPUBubble:function(){this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneFifthChat))},DoneFifthChat:function(){var i=new Q("Are you ready? LET'S RUMBLE!",0,this);this.children.push(i),this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneSixthChat)),this.leftLights.isVisible=!1},DoneSixthChat:function(){this.clickable=!1,this.AddMovement(1,this.announcerY*this.yScale,-m.SCREENHEIGHT/2-70,800,!1,1e3),this.AddEvent(u(this,this.SlideInScoreboard));var i=this.fromPool?y.filterPool.pop():null;null==i&&(i=new z),i.type=0,i.amplitude=1,i.period=0,i.offset=0,i.splineArr=null,i.curves=null,this.lastMovement.ratioFilters.push(i);var e=.5;null==e&&(e=0),null==(i=this.fromPool?y.filterPool.pop():null)&&(i=new z),i.type=1,i.amplitude=-250,i.period=e,i.offset=0,i.splineArr=null,i.curves=null,this.lastMovement.movementFilters.push(i),this.AddMovement(4,1,1,1e3),this.AddMovement(4,1,0,800),this.die=1,(i=this.holder).AddBall(),H.onlineGame||(0==this.holder.CountChildrenByType(ha)&&this.AddHumanGuy(),1==this.holder.CountChildrenByType(ha)&&(m.player.twoPlayerMode?this.AddHumanGuy():this.AddCPUGuy())),e=i.GetChildByType(Ka),V.remove(i.children,e),i.children.push(e),i.AddNets()},SlideInScoreboard:function(){this.holder.GetChildByType(Cb).SlideInScoreboard()},DoneEntrancePostGame:function(){var i=new Q(this.guy.name+" Wins!",0,this);this.children.push(i),I.PlaySound(zc.Get()),this.AddMovement(4,1,1,2e3),this.AddEvent(u(this,this.DoneFirstPostChat))},DoneFirstPostChat:function(){switch(I.PlaySound(zc.Get()),this.RndInt(0,3)){case 1:I.PlayVoiceSound(Re.Get());break;case 2:I.PlayVoiceSound(Se.Get());break;default:I.PlayVoiceSound(Te.Get())}this.AddMovement(4,1,1,1e3),this.AddEvent(u(this,this.DoThirdPostChat)),null!=this.guy&&this.guy.bones.PlayAnimation(this.guy.celebrateAnimName,!0,100)},DoThirdPostChat:function(){this.AddMovement(13,0,0,2500),this.AddMovement(1,this.announcerY*this.yScale,-m.SCREENHEIGHT/2-80,800,!1,1e3);var i=this.fromPool?y.filterPool.pop():null;null==i&&(i=new z),i.type=0,i.amplitude=1,i.period=0,i.offset=0,i.splineArr=null,i.curves=null,this.lastMovement.ratioFilters.push(i);var e=.5;null==e&&(e=0),null==(i=this.fromPool?y.filterPool.pop():null)&&(i=new z),i.type=1,i.amplitude=-250,i.period=e,i.offset=0,i.splineArr=null,i.curves=null,this.lastMovement.movementFilters.push(i),this.AddMovement(4,1,1,1e3),this.AddMovement(4,1,0,800),this.AddEvent(u(this,this.PopPostDialog))},PopPostDialog:function(){if(1!=this.die){if(this.die=1,null!=this.holder.GetChildByType(Ja))if(this.guy instanceof Mc){SendEvent("event","win");var i=new Nc(!0,!1,this.guy);I.PlaySound(zc.Get())}else SendEvent("event","lose"),i=new Nc(!1,!0,this.guy),I.PlaySound(Ue.Get());else{i=null;for(var e=0,t=this.holder.children;en?-1:0)*i.local_rot,0==I)i.loc.x=l+t*o,i.loc.y=e+C*s;else{for(var a=I;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;for(n=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,a=I;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;3.14159265<(a+=1.57079632)&&(a-=6.28318531),I=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,i.loc.x=l+t*o*I-C*s*n,i.loc.y=e+t*o*n+C*s*I}}if(this.children.splice(0,0,this.rightLights),this.rightLights.children.push(this.AddLight(47,-2,1.2*Math.PI/4,.5,.5,.5)),this.rightLights.children.push(this.AddLight(70,-40,Math.PI/4,.5,.5,1)),this.rightLights.children.push(this.AddLight(68,-87,.7*Math.PI/4,.5,.5,.5)),(i=this.leftLights=y.AddGameObject()).holder=this,i.localCoords=!0,null!=i.local_loc?i.local_loc.x=i.local_loc.y=0:i.local_loc=new N(0,0),i.local_rot=0,i.set_local_alp(1),i.set_local_xScale(1),i.set_local_yScale(1),i.set_local_r(1),i.set_local_g(1),i.set_local_b(1),null!=(e=i.holder))if(I=e.rot,t=e.xScale,C=e.yScale,o=i.local_loc.x+e.handle.x,s=i.local_loc.y+e.handle.y,l=e.loc.x,e=e.loc.y,n=i.xScale*i.yScale,i.rot=I+(0n?-1:0)*i.local_rot,0==I)i.loc.x=l+t*o,i.loc.y=e+C*s;else{for(a=I;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;for(n=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,a=I;a<-Math.PI;)a+=2*Math.PI;for(;a>Math.PI;)a-=2*Math.PI;3.14159265<(a+=1.57079632)&&(a-=6.28318531),I=0>a?1.27323954*a+.405284735*a*a:1.27323954*a-.405284735*a*a,i.loc.x=l+t*o*I-C*s*n,i.loc.y=e+t*o*n+C*s*I}this.children.splice(0,0,this.leftLights),this.leftLights.children.push(this.AddLight(-64,-81,-Math.PI-.7*Math.PI/4,.5,.5,.5)),this.leftLights.children.push(this.AddLight(-64,-32,-Math.PI-Math.PI/4,.5,.5,1)),this.leftLights.children.push(this.AddLight(-36,1,-Math.PI-1.2*Math.PI/4,.5,.5,.5)),this.leftLights.isVisible=!1,this.rightLights.isVisible=!1},AddLight:function(i,e,I,t,C,o,s,l){null==l&&(l=!0),null==s&&(s=.15);var n=y.AddGameObject();n.Init(q.RAY_PNG()),n.holder=this.dummy,n.localCoords=!0,null!=n.local_loc?n.local_loc.x=n.local_loc.y=0:n.local_loc=new N(0,0),n.local_rot=0,n.set_local_alp(1),n.set_local_xScale(1),n.set_local_yScale(1),n.set_local_r(1),n.set_local_g(1),n.set_local_b(1);var a=n.holder;if(null!=a){var g=a.rot,r=a.xScale,J=a.yScale,c=n.local_loc.x+a.handle.x,h=n.local_loc.y+a.handle.y,d=a.loc.x;a=a.loc.y;var _=n.xScale*n.yScale;if(n.rot=g+(0<_?1:0>_?-1:0)*n.local_rot,0==g)n.loc.x=d+r*c,n.loc.y=a+J*h;else{for(var k=g;k<-Math.PI;)k+=2*Math.PI;for(;k>Math.PI;)k-=2*Math.PI;for(_=0>k?1.27323954*k+.405284735*k*k:1.27323954*k-.405284735*k*k,k=g;k<-Math.PI;)k+=2*Math.PI;for(;k>Math.PI;)k-=2*Math.PI;3.14159265<(k+=1.57079632)&&(k-=6.28318531),g=0>k?1.27323954*k+.405284735*k*k:1.27323954*k-.405284735*k*k,n.loc.x=d+r*c*g-J*h*_,n.loc.y=a+r*c*_+J*h*g}}return n.set_local_r(t),n.set_local_g(C),n.set_local_b(o),n.AddMovement(4,s,s,1e3+this.RndInt(0,200),!0,this.RndInt(0,200)),l&&(null==(t=1)&&(t=0),null==(C=n.fromPool?y.filterPool.pop():null)&&(C=new z),C.type=1,C.amplitude=s,C.period=t,C.offset=0,C.splineArr=null,C.curves=null,n.lastMovement.movementFilters.push(C)),n.local_rot=I,n.handle.x=n.rect.width/2,n.local_loc.x=i,n.local_loc.y=e,n.set_local_xScale(n.set_local_yScale(2)),n.blendMode=0,n},update:function(){var i=y.prototype.update.call(this);return this.clickable&&m.mClicked&&(this.movements=new ca,this.DoneSixthChat()),i},__class__:ea});var cb=function(){};p["lime.app.IModule"]=cb,cb.__name__="lime.app.IModule",cb.__isInterface__=!0,cb.prototype={__class__:cb};var Ga=function(){this.onExit=new Qd};p["lime.app.Module"]=Ga,Ga.__name__="lime.app.Module",Ga.__interfaces__=[cb],Ga.prototype={__registerLimeModule:function(i){},__class__:Ga};var Na=function(i){this.gameDeviceCache=new Db,this.parent=i,this.nextUpdate=this.lastUpdate=this.currentUpdate=0,this.framePeriod=-1,le.init(),this.accelerometer=id.registerSensor(aj.ACCELEROMETER,0)};p["lime._internal.backend.html5.HTML5Application"]=Na,Na.__name__="lime._internal.backend.html5.HTML5Application",Na.prototype={convertKeyCode:function(i){if(65<=i&&90>=i)return i+32;switch(i){case 12:return 1073741980;case 16:return 1073742049;case 17:return 1073742048;case 18:return 1073742050;case 19:return 1073741896;case 20:return 1073741881;case 33:return 1073741899;case 34:return 1073741902;case 35:return 1073741901;case 36:case 172:return 1073741898;case 37:return 1073741904;case 38:return 1073741906;case 39:return 1073741903;case 40:return 1073741905;case 41:return 1073741943;case 43:return 1073741940;case 44:return 1073741894;case 45:return 1073741897;case 46:return 127;case 91:case 224:return 1073742051;case 92:case 93:return 1073742055;case 95:return 1073742106;case 96:return 1073741922;case 97:return 1073741913;case 98:return 1073741914;case 99:return 1073741915;case 100:return 1073741916;case 101:return 1073741917;case 102:return 1073741918;case 103:return 1073741919;case 104:return 1073741920;case 105:return 1073741921;case 106:return 1073741909;case 107:return 1073741911;case 108:case 110:case 194:return 1073741923;case 109:return 1073741910;case 111:return 1073741908;case 112:return 1073741882;case 113:return 1073741883;case 114:return 1073741884;case 115:return 1073741885;case 116:return 1073741886;case 117:return 1073741887;case 118:return 1073741888;case 119:return 1073741889;case 120:return 1073741890;case 121:return 1073741891;case 122:return 1073741892;case 123:return 1073741893;case 124:return 1073741928;case 125:return 1073741929;case 126:return 1073741930;case 127:return 1073741931;case 128:return 1073741932;case 129:return 1073741933;case 130:return 1073741934;case 131:return 1073741935;case 132:return 1073741936;case 133:return 1073741937;case 134:return 1073741938;case 135:return 1073741939;case 144:return 1073741907;case 145:return 1073741895;case 160:return 94;case 161:return 33;case 163:return 35;case 164:return 36;case 166:return 1073742094;case 167:return 1073742095;case 168:return 1073742097;case 169:return 41;case 170:return 42;case 171:case 192:case 223:return 96;case 173:case 189:return 45;case 174:case 182:return 1073741953;case 175:case 183:return 1073741952;case 176:return 1073742082;case 177:return 1073742083;case 178:return 1073742084;case 179:return 1073742085;case 180:return 1073742089;case 181:return 1073742086;case 186:return 59;case 187:return 61;case 188:return 44;case 190:return 46;case 191:return 47;case 193:return 63;case 219:return 91;case 220:case 226:return 92;case 221:return 93;case 222:return 39}return i},exec:function(){if(window.addEventListener("keydown",u(this,this.handleKeyEvent),!1),window.addEventListener("keyup",u(this,this.handleKeyEvent),!1),window.addEventListener("focus",u(this,this.handleWindowEvent),!1),window.addEventListener("blur",u(this,this.handleWindowEvent),!1),window.addEventListener("resize",u(this,this.handleWindowEvent),!1),window.addEventListener("beforeunload",u(this,this.handleWindowEvent),!1),Object.prototype.hasOwnProperty.call(window,"Accelerometer")&&window.addEventListener("devicemotion",u(this,this.handleSensorEvent),!1),CanvasRenderingContext2D.prototype.isPointInStroke||(CanvasRenderingContext2D.prototype.isPointInStroke=function(i,e,I){return!1}),CanvasRenderingContext2D.prototype.isPointInPath||(CanvasRenderingContext2D.prototype.isPointInPath=function(i,e,I){return!1}),0=="performance"in window&&(window.performance={}),0=="now"in window.performance){var i=Date.now();performance.timing&&performance.timing.navigationStart&&(i=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-i}}for(var e=0,I=["ms","moz","webkit","o"],t=0;t=this.nextUpdate){for(this.deltaTime=this.currentUpdate-this.lastUpdate,i=0,e=this.parent.__windows;ithis.framePeriod?this.currentUpdate:this.currentUpdate-this.currentUpdate%this.framePeriod+this.framePeriod,this.lastUpdate=this.currentUpdate}window.requestAnimationFrame(u(this,this.handleApplicationEvent))},handleKeyEvent:function(i){if(null!=this.parent.__window){var e=this.convertKeyCode(null!=i.keyCode?i.keyCode:i.which),I=(i.shiftKey?3:0)|(i.ctrlKey?192:0)|(i.altKey?768:0)|(i.metaKey?3072:0);"keydown"==i.type?(this.parent.__window.onKeyDown.dispatch(e,I),this.parent.__window.onKeyDown.canceled&&i.cancelable&&i.preventDefault()):(this.parent.__window.onKeyUp.dispatch(e,I),this.parent.__window.onKeyUp.canceled&&i.cancelable&&i.preventDefault())}},handleSensorEvent:function(i){this.accelerometer.onUpdate.dispatch(i.accelerationIncludingGravity.x,i.accelerationIncludingGravity.y,i.accelerationIncludingGravity.z)},handleWindowEvent:function(i){if(null!=this.parent.__window)switch(i.type){case"blur":this.hidden||(this.parent.__window.onFocusOut.dispatch(),this.parent.__window.onDeactivate.dispatch(),this.hidden=!0);break;case"focus":this.hidden&&(this.parent.__window.onFocusIn.dispatch(),this.parent.__window.onActivate.dispatch(),this.hidden=!1);break;case"resize":this.parent.__window.__backend.handleResizeEvent(i);break;case"visibilitychange":window.document.hidden?this.hidden||(this.parent.__window.onFocusOut.dispatch(),this.parent.__window.onDeactivate.dispatch(),this.hidden=!0):this.hidden&&(this.parent.__window.onFocusIn.dispatch(),this.parent.__window.onActivate.dispatch(),this.hidden=!1)}},updateGameDevices:function(){var i=Ab.__getDeviceData();if(null!=i)for(var e,I,t,C,o,s=0,l=i.length;s=Object.keys(this.__eventMap.h).length&&(this.__iterators=this.__eventMap=null)}}},__dispatchEvent:function(i){if(null==this.__eventMap||null==i)return!0;var e=i.type,I=this.__eventMap.h[e];if(null==I)return!0;null==i.target&&(i.target=null!=this.__targetDispatcher?this.__targetDispatcher:this),i.currentTarget=this;var t=1==i.eventPhase,C=(e=this.__iterators.h[e])[0];C.active&&(C=new Xe(I),e.push(C)),C.start();for(var o=C;o.hasNext();){var s=o.next();if(null!=s&&s.useCapture==t&&(s.callback(i),i.__isCanceledNow))break}return C.stop(),C!=e[0]?V.remove(e,C):C.reset(I),!i.isDefaultPrevented()},__addListenerByPriority:function(i,e){for(var I=i.length,t=I,C=0;C=i||0==this.inactiveObjects)&&(null!=this.__inactiveObject0&&(this.__pool.remove(this.__inactiveObject0),this.__inactiveObject0=null,this.inactiveObjects--,--i),0!=i&&0!=this.inactiveObjects&&(null!=this.__inactiveObject1&&(this.__pool.remove(this.__inactiveObject1),this.__inactiveObject1=null,this.inactiveObjects--,--i),0!=i&&0!=this.inactiveObjects)))for(var e=this.__inactiveObjectList.h;null!=e;){var I=e.item;if(e=e.next,this.__pool.remove(I),this.__inactiveObjectList.remove(I),this.inactiveObjects--,0==--i||0==this.inactiveObjects)break}},set_size:function(i){if(null==i)this.__size=null;else{var e=this.inactiveObjects+this.activeObjects;if(this.__size=i,e>i)this.__removeInactive(e-i);else if(i>e)for(var I=0,t=i-e;Ii&&(i=0),i==this.__alpha||this.get_cacheAsBitmap()||this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty()),this.__alpha=i},set_blendMode:function(i){return null==i&&(i=10),i==this.__blendMode||this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty()),this.__blendMode=i},get_cacheAsBitmap:function(){return null!=this.__filters||this.__cacheAsBitmap},get_height:function(){var i=A.__pool.get();this.__getLocalBounds(i);var e=i.height;return A.__pool.release(i),e},set_height:function(i){var e=A.__pool.get(),I=na.__pool.get();return I.identity(),this.__getBounds(e,I),i!=e.height?this.set_scaleY(i/e.height):this.set_scaleY(1),A.__pool.release(e),na.__pool.release(I),i},get_loaderInfo:function(){return null!=this.stage?hc.current.__loaderInfo:null},get_mask:function(){return this.__mask},set_mask:function(i){if(i==this.__mask)return i;if(i!=this.__mask&&(this.__setTransformDirty(),this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty())),null!=this.__mask){this.__mask.__isMask=!1,this.__mask.__maskTarget=null,this.__mask.__setTransformDirty();var e=this.__mask;e.__renderDirty||(e.__renderDirty=!0,e.__setParentRenderDirty())}return null!=i&&(i.__isMask=!0,i.__maskTarget=this,i.__setWorldTransformInvalid()),null!=this.__cacheBitmap&&this.__cacheBitmap.get_mask()!=i&&this.__cacheBitmap.set_mask(i),this.__mask=i},get_mouseX:function(){var i=null!=this.stage?this.stage.__mouseX:hc.current.stage.__mouseX,e=null!=this.stage?this.stage.__mouseY:hc.current.stage.__mouseY,I=this.__getRenderTransform(),t=I.a*I.d-I.b*I.c;return 0==t?-I.tx:1/t*(I.c*(I.ty-e)+I.d*(i-I.tx))},get_mouseY:function(){var i=null!=this.stage?this.stage.__mouseX:hc.current.stage.__mouseX,e=null!=this.stage?this.stage.__mouseY:hc.current.stage.__mouseY,I=this.__getRenderTransform(),t=I.a*I.d-I.b*I.c;return 0==t?-I.ty:1/t*(I.a*(e-I.ty)+I.b*(I.tx-i))},get_name:function(){return this.__name},set_name:function(i){return this.__name=i},get_rotation:function(){return this.__rotation},set_rotation:function(i){if(i!=this.__rotation){this.__rotation=i;var e=Math.PI/180*this.__rotation;this.__rotationSine=Math.sin(e),this.__rotationCosine=Math.cos(e),this.__transform.a=this.__rotationCosine*this.__scaleX,this.__transform.b=this.__rotationSine*this.__scaleX,this.__transform.c=-this.__rotationSine*this.__scaleY,this.__transform.d=this.__rotationCosine*this.__scaleY,this.__setTransformDirty()}return i},get_scaleX:function(){return this.__scaleX},set_scaleX:function(i){if(i!=this.__scaleX)if(this.__scaleX=i,0==this.__transform.b)i!=this.__transform.a&&this.__setTransformDirty(),this.__transform.a=i;else{var e=this.__rotationCosine*i,I=this.__rotationSine*i;this.__transform.a==e&&this.__transform.b==I||this.__setTransformDirty(),this.__transform.a=e,this.__transform.b=I}return i},get_scaleY:function(){return this.__scaleY},set_scaleY:function(i){if(i!=this.__scaleY)if(this.__scaleY=i,0==this.__transform.c)i!=this.__transform.d&&this.__setTransformDirty(),this.__transform.d=i;else{var e=-this.__rotationSine*i,I=this.__rotationCosine*i;this.__transform.d==I&&this.__transform.c==e||this.__setTransformDirty(),this.__transform.c=e,this.__transform.d=I}return i},set_scrollRect:function(i){return null==i&&null==this.__scrollRect||null!=i&&null!=this.__scrollRect&&this.__scrollRect.equals(i)||(null!=i?(null==this.__scrollRect&&(this.__scrollRect=new A),this.__scrollRect.copyFrom(i)):this.__scrollRect=null,this.__setTransformDirty(),oa.__supportDOM&&!this.__renderDirty&&(this.__renderDirty=!0,this.__setParentRenderDirty())),i},set_shader:function(i){return this.__shader=i,this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty()),i},get_transform:function(){return null==this.__objectTransform&&(this.__objectTransform=new zg(this)),this.__objectTransform},set_transform:function(i){if(null==i)throw new Ze("Parameter transform must be non-null.");return null==this.__objectTransform&&(this.__objectTransform=new zg(this)),this.__setTransformDirty(),this.__objectTransform.set_matrix(i.get_matrix()),this.__objectTransform.__colorTransform.__equals(i.__colorTransform,!0)&&(this.get_cacheAsBitmap()||this.__objectTransform.__colorTransform.alphaMultiplier==i.__colorTransform.alphaMultiplier)||(this.__objectTransform.__colorTransform.__copyFrom(i.get_colorTransform()),this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty())),this.__objectTransform},get_visible:function(){return this.__visible},set_visible:function(i){return i==this.__visible||this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty()),this.__visible=i},get_width:function(){var i=A.__pool.get();this.__getLocalBounds(i);var e=i.width;return A.__pool.release(i),e},set_width:function(i){var e=A.__pool.get(),I=na.__pool.get();return I.identity(),this.__getBounds(e,I),i!=e.width?this.set_scaleX(i/e.width):this.set_scaleX(1),A.__pool.release(e),na.__pool.release(I),i},get_x:function(){return this.__transform.tx},set_x:function(i){return i!=this.__transform.tx&&this.__setTransformDirty(),this.__transform.tx=i},get_y:function(){return this.__transform.ty},set_y:function(i){return i!=this.__transform.ty&&this.__setTransformDirty(),this.__transform.ty=i},__class__:oa,__properties__:{set_shader:"set_shader",set_scrollRect:"set_scrollRect",set_blendMode:"set_blendMode",set_y:"set_y",get_y:"get_y",set_x:"set_x",get_x:"get_x",set_width:"set_width",get_width:"get_width",set_visible:"set_visible",get_visible:"get_visible",set_transform:"set_transform",get_transform:"get_transform",set_scaleY:"set_scaleY",get_scaleY:"get_scaleY",set_scaleX:"set_scaleX",get_scaleX:"get_scaleX",set_rotation:"set_rotation",get_rotation:"get_rotation",set_name:"set_name",get_name:"get_name",get_mouseY:"get_mouseY",get_mouseX:"get_mouseX",set_mask:"set_mask",get_mask:"get_mask",get_loaderInfo:"get_loaderInfo",set_height:"set_height",get_height:"get_height",get_cacheAsBitmap:"get_cacheAsBitmap",set_alpha:"set_alpha",get_alpha:"get_alpha"}});var Da=function(){oa.call(this),this.doubleClickEnabled=!1,this.mouseEnabled=!0,this.needsSoftKeyboard=!1,this.__tabEnabled=null,this.__tabIndex=-1};p["openfl.display.InteractiveObject"]=Da,Da.__name__="openfl.display.InteractiveObject",Da.__super__=oa,Da.prototype=B(oa.prototype,{__allowMouseFocus:function(){return!!this.mouseEnabled&&this.get_tabEnabled()},__getInteractive:function(i){return null!=i&&(i.push(this),null!=this.parent&&this.parent.__getInteractive(i)),!0},__hitTest:function(i,e,I,t,C,o){return!(!o.get_visible()||this.__isMask||C&&!this.mouseEnabled)&&oa.prototype.__hitTest.call(this,i,e,I,t,C,o)},__tabTest:function(i){this.get_tabEnabled()&&i.push(this)},get_tabEnabled:function(){return 1==this.__tabEnabled},get_tabIndex:function(){return this.__tabIndex},__class__:Da,__properties__:B(oa.prototype.__properties__,{get_tabIndex:"get_tabIndex",get_tabEnabled:"get_tabEnabled"})});var fb=function(){Da.call(this),this.__tabChildren=this.mouseChildren=!0,this.__children=[],this.__removedChildren=Ha.toObjectVector(null)};p["openfl.display.DisplayObjectContainer"]=fb,fb.__name__="openfl.display.DisplayObjectContainer",fb.__super__=Da,fb.prototype=B(Da.prototype,{addChild:function(i){return this.addChildAt(i,this.get_numChildren())},addChildAt:function(i,e){if(null==i)throw(i=new Ze("Error #2007: Parameter child must be non-null.")).errorID=2007,i;if(i.stage==i)throw(i=new Ag("Error #3783: A Stage object cannot be added as the child of another object.")).errorID=3783,i;if(e>this.__children.length||0>e)throw R.thrown("Invalid index position "+e);if(i.parent==this)this.__children[e]!=i&&(V.remove(this.__children,i),this.__children.splice(e,0,i),this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty()));else{null!=i.parent&&i.parent.removeChild(i),this.__children.splice(e,0,i),i.parent=this,(e=null!=this.stage&&null==i.stage)&&i.__setStageReference(this.stage),i.__setTransformDirty(),i.__renderDirty||(i.__renderDirty=!0,i.__setParentRenderDirty()),this.__renderDirty||(this.__renderDirty=!0,this.__setParentRenderDirty());var I=new sa("added");I.bubbles=!0,I.target=i,i.__dispatchWithCapture(I),e&&(I=new sa("addedToStage",!1,!1),i.__dispatchWithCapture(I),i.__dispatchChildren(I))}return i},getChildAt:function(i){return 0<=i&&iC)););if(n)return t.splice(C,0,o),!0}}else for(;0<=--s;)if(this.__children[s].__hitTest(i,e,I,null,!0,this.__children[s]))return null!=t&&t.push(o),!0;return!1},__hitTestMask:function(i,e){for(var I=this.__children.length;0<=--I;)if(this.__children[I].__hitTestMask(i,e))return!0;return!1},__setStageReference:function(i){if(Da.prototype.__setStageReference.call(this,i),null!=this.__children)for(var e=0,I=this.__children;e>>0,2);return i+=T.hex(255&this.mData0>>>8,2),i+=T.hex(255&this.mData0>>>16,2),i+=T.hex(255&this.mData0>>>24,2),i+=T.hex(255&this.mData1>>>0,2),i+=T.hex(255&this.mData1>>>8,2),i+=T.hex(255&this.mData1>>>16,2),i+=T.hex(255&this.mData1>>>24,2),i+=T.hex(255&this.mData2>>>0,2),i+=T.hex(255&this.mData2>>>8,2),i+=T.hex(255&this.mData2>>>16,2),i+=T.hex(255&this.mData2>>>24,2),i+=T.hex(255&this.mData3>>>0,2),i+=T.hex(255&this.mData3>>>8,2),(i+=T.hex(255&this.mData3>>>16,2))+T.hex(255&this.mData3>>>24,2)},__class__:xb};var da=function(){this.callEvent=null,this.tier=0};p.Perk=da,da.__name__="Perk",da.prototype={__class__:da};var q=function(){};p.INGAME_PNG=q,q.__name__="INGAME_PNG",q.Get=function(){return q.bmd},q.ARROWS_PNG=function(){return G.rect=new A(0,61,167,82),q.Get()},q.ARROW_DOWN_PNG=function(){return G.rect=new A(220,4,65,38),q.Get()},q.AVATAR_PNG=function(){return G.rect=new A(0,144,117,245),q.Get()},q.AVATAR2_PNG=function(){return G.rect=new A(0,390,76,170),q.Get()},q.BACK_SHOE_PNG=function(){return G.rect=new A(286,32,51,27),q.Get()},q.BACK_SHOELACES_PNG=function(){return G.rect=new A(338,4,51,27),q.Get()},q.BACK_SOCK_PNG=function(){return G.rect=new A(390,4,33,45),q.Get()},q.BACK_UPPERLEG_PNG=function(){return G.rect=new A(424,4,21,42),q.Get()},q.BALL_WHITE_PNG=function(){return G.rect=new A(168,61,82,81),q.Get()},q.BBROS_BIG_PNG=function(){return G.rect=new A(118,144,435,434),q.Get()},q.BRO10_HEAD_PNG=function(){return G.rect=new A(118,579,120,141),q.Get()},q.BRO10_HEAD_S_PNG=function(){return G.rect=new A(239,579,120,141),q.Get()},q.BRO11_HEAD_PNG=function(){return G.rect=new A(118,721,120,159),q.Get()},q.BRO11_HEAD_S_PNG=function(){return G.rect=new A(239,721,120,159),q.Get()},q.BRO12_HEAD_PNG=function(){return G.rect=new A(118,881,192,168),q.Get()},q.BRO12_HEAD_S_PNG=function(){return G.rect=new A(311,881,192,168),q.Get()},q.BRO13_HEAD_PNG=function(){return G.rect=new A(118,1050,135,161),q.Get()},q.BRO13_HEAD_S_PNG=function(){return G.rect=new A(254,1050,135,161),q.Get()},q.BRO14_HEAD_PNG=function(){return G.rect=new A(0,561,112,143),q.Get()},q.BRO14_HEAD_S_PNG=function(){return G.rect=new A(118,1212,140,164),q.Get()},q.BRO15_HEAD_PNG=function(){return G.rect=new A(0,705,113,152),q.Get()},q.BRO15_HEAD_S_PNG=function(){return G.rect=new A(0,858,113,152),q.Get()},q.BRO16_HEAD_PNG=function(){return G.rect=new A(360,721,129,152),q.Get()},q.BRO16_HEAD_S_PNG=function(){return G.rect=new A(390,1050,129,152),q.Get()},q.BRO17_HEAD_PNG=function(){return G.rect=new A(259,1212,122,160),q.Get()},q.BRO17_HEAD_S_PNG=function(){return G.rect=new A(382,1212,122,160),q.Get()},q.BRO18_HEAD_PNG=function(){return G.rect=new A(0,1011,109,139),q.Get()},q.BRO18_HEAD_S_PNG=function(){return G.rect=new A(0,1151,109,139),q.Get()},q.BRO19_HEAD_PNG=function(){return G.rect=new A(0,1291,103,152),q.Get()},q.BRO19_HEAD_S_PNG=function(){return G.rect=new A(0,1444,103,152),q.Get()},q.BRO1_HEAD_PNG=function(){return G.rect=new A(0,1597,108,141),q.Get()},q.BRO1_HEAD_S_PNG=function(){return G.rect=new A(0,1739,108,141),q.Get()},q.BRO20_HEAD_PNG=function(){return G.rect=new A(118,1377,124,155),q.Get()},q.BRO20_HEAD_S_PNG=function(){return G.rect=new A(243,1377,124,155),q.Get()},q.BRO21_HEAD_PNG=function(){return G.rect=new A(0,1881,117,150),q.Get()},q.BRO21_HEAD_S_PNG=function(){return G.rect=new A(368,1377,117,150),q.Get()},q.BRO22_HEAD_PNG=function(){return G.rect=new A(118,1533,145,152),q.Get()},q.BRO22_HEAD_S_PNG=function(){return G.rect=new A(264,1533,145,152),q.Get()},q.BRO23_HEAD_PNG=function(){return G.rect=new A(118,1686,136,174),q.Get()},q.BRO23_HEAD_S_PNG=function(){return G.rect=new A(118,1861,136,174),q.Get()},q.BRO24_HEAD_PNG=function(){return G.rect=new A(255,1686,124,157),q.Get()},q.BRO24_HEAD_S_PNG=function(){return G.rect=new A(380,1686,124,157),q.Get()},q.BRO25_HEAD_PNG=function(){return G.rect=new A(255,1844,113,168),q.Get()},q.BRO25_HEAD_S_PNG=function(){return G.rect=new A(369,1844,113,168),q.Get()},q.BRO26_HEAD_PNG=function(){return G.rect=new A(554,144,113,168),q.Get()},q.BRO26_HEAD_S_PNG=function(){return G.rect=new A(668,144,113,168),q.Get()},q.BRO27_HEAD_PNG=function(){return G.rect=new A(782,144,112,156),q.Get()},q.BRO27_HEAD_S_PNG=function(){return G.rect=new A(895,144,112,156),q.Get()},q.BRO2_HEAD_PNG=function(){return G.rect=new A(410,1533,120,144),q.Get()},q.BRO2_HEAD_S_PNG=function(){return G.rect=new A(1008,144,120,144),q.Get()},q.BRO3_HEAD_PNG=function(){return G.rect=new A(360,579,114,141),q.Get()},q.BRO3_HEAD_S_PNG=function(){return G.rect=new A(1129,144,114,141),q.Get()},q.BRO4_HEAD_PNG=function(){return G.rect=new A(1244,144,108,138),q.Get()},q.BRO4_HEAD_S_PNG=function(){return G.rect=new A(1353,144,108,138),q.Get()},q.BRO5_HEAD_PNG=function(){return G.rect=new A(1462,144,117,162),q.Get()},q.BRO5_HEAD_S_PNG=function(){return G.rect=new A(1580,144,117,162),q.Get()},q.BRO6_HEAD_PNG=function(){return G.rect=new A(1698,144,111,141),q.Get()},q.BRO6_HEAD_S_PNG=function(){return G.rect=new A(1810,144,111,141),q.Get()},q.BRO7_HEAD_PNG=function(){return G.rect=new A(1922,144,117,147),q.Get()},q.BRO7_HEAD_S_PNG=function(){return G.rect=new A(554,313,117,147),q.Get()},q.BRO8_HEAD_PNG=function(){return G.rect=new A(672,313,114,147),q.Get()},q.BRO8_HEAD_S_PNG=function(){return G.rect=new A(787,313,114,147),q.Get()},q.BRO9_HEAD_PNG=function(){return G.rect=new A(554,461,105,156),q.Get()},q.BRO9_HEAD_S_PNG=function(){return G.rect=new A(660,461,105,156),q.Get()},q.BUBBLE_PNG=function(){return G.rect=new A(554,618,327,223),q.Get()},q.BU_2PLAYER_HOVER_PNG=function(){return G.rect=new A(479,4,342,54),q.Get()},q.BU_2PLAYER_UP_PNG=function(){return G.rect=new A(822,4,342,54),q.Get()},q.BU_AUDIO_DOWN2_PNG=function(){return G.rect=new A(294,61,62,62),q.Get()},q.BU_AUDIO_UP2_PNG=function(){return G.rect=new A(521,61,62,62),q.Get()},q.BU_CUSTOMIZATION_JERSEY_PNG=function(){return G.rect=new A(584,61,42,71),q.Get()},q.BU_CUSTOMIZATION_PANTS_PNG=function(){return G.rect=new A(1165,4,41,47),q.Get()},q.BU_CUSTOMIZATION_SELECTED_PNG=function(){return G.rect=new A(475,579,75,90),q.Get()},q.BU_CUSTOMIZATION_SHOES_PNG=function(){return G.rect=new A(1207,4,62,40),q.Get()},q.BU_CUSTOMIZATION_SOCKS_PNG=function(){return G.rect=new A(1270,4,38,56),q.Get()},q.BU_CUSTOMIZATION_STATS_SELECTED_PNG=function(){return G.rect=new A(902,313,75,90),q.Get()},q.BU_CUSTOMIZATION_STATS_UNSELECTED_PNG=function(){return G.rect=new A(978,313,75,90),q.Get()},q.BU_CUSTOMIZATION_UNSELECTED_PNG=function(){return G.rect=new A(1054,313,75,90),q.Get()},q.BU_DISCORD_HOVER_PNG=function(){return G.rect=new A(627,61,81,81),q.Get()},q.BU_DISCORD_SPEECH_PNG=function(){return G.rect=new A(709,61,295,70),q.Get()},q.BU_DISCORD_UP_PNG=function(){return G.rect=new A(1005,61,81,81),q.Get()},q.BU_FULLSCREEN_DOWN2_PNG=function(){return G.rect=new A(1213,61,62,62),q.Get()},q.BU_FULLSCREEN_UP2_PNG=function(){return G.rect=new A(1440,61,62,62),q.Get()},q.BU_PLAY_HOVER_PNG=function(){return G.rect=new A(1130,313,342,102),q.Get()},q.BU_PLAY_UP_PNG=function(){return G.rect=new A(1473,313,342,102),q.Get()},q.BU_PRIVATE_HOVER_PNG=function(){return G.rect=new A(1309,4,174,54),q.Get()},q.BU_PRIVATE_UP_PNG=function(){return G.rect=new A(1484,4,174,54),q.Get()},q.BU_SETTINGS_DOWN_PNG=function(){return G.rect=new A(1846,61,62,62),q.Get()},q.BU_SETTINGS_UP_PNG=function(){return G.rect=new A(490,721,62,62),q.Get()},q.BU_SINGLEPLAYER_HOVER_PNG=function(){return G.rect=new A(766,461,342,54),q.Get()},q.BU_SINGLEPLAYER_UP_PNG=function(){return G.rect=new A(766,516,342,54),q.Get()},q.CHAT_PNG=function(){return G.rect=new A(882,618,512,174),q.Get()},q.CHAT2_PNG=function(){return G.rect=new A(554,842,512,256),q.Get()},q.DARK_BACK_ARM_PNG=function(){return G.rect=new A(2002,4,27,42),q.Get()},q.DARK_BACK_HAND_PNG=function(){return G.rect=new A(1991,61,36,30),q.Get()},q.DARK_BACK_LOWERLEG_PNG=function(){return G.rect=new A(1991,92,33,45),q.Get()},q.DARK_BACK_SHOULDER_PNG=function(){return G.rect=new A(77,390,27,42),q.Get()},q.DARK_BACK_UPPERLEG_PNG=function(){return G.rect=new A(2025,92,21,42),q.Get()},q.DARK_FRONT_ARM_PNG=function(){return G.rect=new A(2030,4,15,39),q.Get()},q.DARK_FRONT_HAND_PNG=function(){return G.rect=new A(77,433,30,33),q.Get()},q.DARK_FRONT_HAND2_PNG=function(){return G.rect=new A(77,467,30,33),q.Get()},q.DARK_FRONT_LOWERLEG_PNG=function(){return G.rect=new A(77,501,33,45),q.Get()},q.DARK_FRONT_SHOULDER_PNG=function(){return G.rect=new A(475,670,36,36),q.Get()},q.DARK_FRONT_UPPERLEG_PNG=function(){return G.rect=new A(512,670,24,42),q.Get()},q.DARK_STOMACH_PNG=function(){return G.rect=new A(490,784,39,69),q.Get()},q.FLASH_PNG=function(){return G.rect=new A(1395,618,162,162),q.Get()},q.FRONT_SHOE_PNG=function(){return G.rect=new A(1503,116,51,27),q.Get()},q.FRONT_SHOELACES_PNG=function(){return G.rect=new A(1555,116,51,27),q.Get()},q.FRONT_SOCK_PNG=function(){return G.rect=new A(504,881,33,45),q.Get()},q.FRONT_UPPERLEG_PNG=function(){return G.rect=new A(504,927,24,42),q.Get()},q.HIPS_PNG=function(){return G.rect=new A(1607,116,39,27),q.Get()},q.INPUTFIELD_NAME_PNG=function(){return G.rect=new A(1497,461,342,60),q.Get()},q.ITALIC_PNG=function(){return G.rect=new A(554,1099,485,482),q.Get()},q.JERSEY_LOGO01_PNG=function(){return G.rect=new A(505,1212,39,69),q.Get()},q.JERSEY_LOGO02_PNG=function(){return G.rect=new A(505,1282,39,69),q.Get()},q.JERSEY_LOGO03_PNG=function(){return G.rect=new A(486,1377,39,69),q.Get()},q.JERSEY_LOGO04_PNG=function(){return G.rect=new A(486,1447,39,69),q.Get()},q.JERSEY_LOGO05_PNG=function(){return G.rect=new A(505,1686,39,69),q.Get()},q.JERSEY_LOGO06_PNG=function(){return G.rect=new A(505,1756,39,69),q.Get()},q.JERSEY_LOGO07_PNG=function(){return G.rect=new A(483,1844,39,69),q.Get()},q.JERSEY_LOGO08_PNG=function(){return G.rect=new A(483,1914,39,69),q.Get()},q.JERSEY_LOGO09_PNG=function(){return G.rect=new A(1816,371,39,69),q.Get()},q.JERSEY_LOGO10_PNG=function(){return G.rect=new A(1856,371,39,69),q.Get()},q.JERSEY_LOGO11_PNG=function(){return G.rect=new A(1896,371,39,69),q.Get()},q.JERSEY_LOGO12_PNG=function(){return G.rect=new A(1936,371,39,69),q.Get()},q.JERSEY_LOGO13_PNG=function(){return G.rect=new A(1976,371,39,69),q.Get()},q.JERSEY_LOGO14_PNG=function(){return G.rect=new A(1109,531,39,69),q.Get()},q.JERSEY_LOGO15_PNG=function(){return G.rect=new A(1149,531,39,69),q.Get()},q.JERSEY_LOGO16_PNG=function(){return G.rect=new A(1189,531,39,69),q.Get()},q.JERSEY_LOGO17_PNG=function(){return G.rect=new A(1229,531,39,69),q.Get()},q.JERSEY_LOGO18_PNG=function(){return G.rect=new A(1269,531,39,69),q.Get()},q.JERSEY_LOGO19_PNG=function(){return G.rect=new A(1309,531,39,69),q.Get()},q.JERSEY_LOGO20_PNG=function(){return G.rect=new A(1497,522,39,69),q.Get()},q.JERSEY_LOGO21_PNG=function(){return G.rect=new A(1537,522,39,69),q.Get()},q.JERSEY_LOGO_MENU01_PNG=function(){return G.rect=new A(504,1002,32,32),q.Get()},q.JERSEY_LOGO_MENU02_PNG=function(){return G.rect=new A(520,1050,32,32),q.Get()},q.JERSEY_LOGO_MENU03_PNG=function(){return G.rect=new A(520,1083,32,32),q.Get()},q.JERSEY_LOGO_MENU04_PNG=function(){return G.rect=new A(520,1116,32,32),q.Get()},q.JERSEY_LOGO_MENU05_PNG=function(){return G.rect=new A(520,1149,32,32),q.Get()},q.JERSEY_LOGO_MENU06_PNG=function(){return G.rect=new A(255,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU07_PNG=function(){return G.rect=new A(288,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU08_PNG=function(){return G.rect=new A(321,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU09_PNG=function(){return G.rect=new A(369,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU10_PNG=function(){return G.rect=new A(402,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU11_PNG=function(){return G.rect=new A(435,2013,32,32),q.Get()},q.JERSEY_LOGO_MENU12_PNG=function(){return G.rect=new A(483,1984,32,32),q.Get()},q.JERSEY_LOGO_MENU13_PNG=function(){return G.rect=new A(516,1984,32,32),q.Get()},q.JERSEY_LOGO_MENU14_PNG=function(){return G.rect=new A(902,404,32,32),q.Get()},q.JERSEY_LOGO_MENU15_PNG=function(){return G.rect=new A(935,404,32,32),q.Get()},q.JERSEY_LOGO_MENU16_PNG=function(){return G.rect=new A(978,404,32,32),q.Get()},q.JERSEY_LOGO_MENU17_PNG=function(){return G.rect=new A(1011,404,32,32),q.Get()},q.JERSEY_LOGO_MENU18_PNG=function(){return G.rect=new A(1054,404,32,32),q.Get()},q.JERSEY_LOGO_MENU19_PNG=function(){return G.rect=new A(1087,404,32,32),q.Get()},q.JERSEY_LOGO_MENU20_PNG=function(){return G.rect=new A(1130,416,32,32),q.Get()},q.JERSEY_LOGO_MENU21_PNG=function(){return G.rect=new A(1163,416,32,32),q.Get()},q.JERSEY_WHITE_PNG=function(){return G.rect=new A(1577,522,39,69),q.Get()},q.LEFTRIGHT_PNG=function(){return G.rect=new A(1196,416,64,32),q.Get()},q.LIGHT_BACK_ARM_PNG=function(){return G.rect=new A(526,1377,27,42),q.Get()},q.LIGHT_BACK_HAND_PNG=function(){return G.rect=new A(516,2017,36,30),q.Get()},q.LIGHT_BACK_LOWERLEG_PNG=function(){return G.rect=new A(2004,313,33,45),q.Get()},q.LIGHT_BACK_SHOULDER_PNG=function(){return G.rect=new A(526,1447,27,42),q.Get()},q.LIGHT_BACK_UPPERLEG_PNG=function(){return G.rect=new A(529,927,21,42),q.Get()},q.LIGHT_FRONT_ARM_PNG=function(){return G.rect=new A(537,670,15,39),q.Get()},q.LIGHT_FRONT_HAND_PNG=function(){return G.rect=new A(523,1844,30,33),q.Get()},q.LIGHT_FRONT_HAND2_PNG=function(){return G.rect=new A(523,1878,30,33),q.Get()},q.LIGHT_FRONT_LOWERLEG_PNG=function(){return G.rect=new A(766,571,33,45),q.Get()},q.LIGHT_FRONT_SHOULDER_PNG=function(){return G.rect=new A(1261,416,36,36),q.Get()},q.LIGHT_FRONT_UPPERLEG_PNG=function(){return G.rect=new A(526,1490,24,42),q.Get()},q.LIGHT_STOMACH_PNG=function(){return G.rect=new A(1617,522,39,69),q.Get()},q.LOSE_PNG=function(){return G.rect=new A(1647,116,175,25),q.Get()},q.MEDIUM_BACK_ARM_PNG=function(){return G.rect=new A(523,1914,27,42),q.Get()},q.MEDIUM_BACK_HAND_PNG=function(){return G.rect=new A(1298,416,36,30),q.Get()},q.MEDIUM_BACK_LOWERLEG_PNG=function(){return G.rect=new A(800,571,33,45),q.Get()},q.MEDIUM_BACK_SHOULDER_PNG=function(){return G.rect=new A(1335,416,27,42),q.Get()},q.MEDIUM_BACK_UPPERLEG_PNG=function(){return G.rect=new A(531,1533,21,42),q.Get()},q.MEDIUM_FRONT_ARM_PNG=function(){return G.rect=new A(538,881,15,39),q.Get()},q.MEDIUM_FRONT_HAND_PNG=function(){return G.rect=new A(1363,416,30,33),q.Get()},q.MEDIUM_FRONT_HAND2_PNG=function(){return G.rect=new A(1394,416,30,33),q.Get()},q.MEDIUM_FRONT_LOWERLEG_PNG=function(){return G.rect=new A(834,571,33,45),q.Get()},q.MEDIUM_FRONT_SHOULDER_PNG=function(){return G.rect=new A(1425,416,36,36),q.Get()},q.MEDIUM_FRONT_UPPERLEG_PNG=function(){return G.rect=new A(1473,416,24,42),q.Get()},q.MEDIUM_STOMACH_PNG=function(){return G.rect=new A(1657,522,39,69),q.Get()},q.NET_PNG=function(){return G.rect=new A(709,132,92,10),q.Get()},q.NET1_PNG=function(){return G.rect=new A(1697,522,88,80),q.Get()},q.PLACKARD_PNG=function(){return G.rect=new A(1558,618,278,54),q.Get()},q.PUNCH_PNG=function(){return G.rect=new A(1541,416,32,32),q.Get()},q.RAY_PNG=function(){return G.rect=new A(554,1582,414,100),q.Get()},q.SCOREBOARD_PNG=function(){return G.rect=new A(554,1683,335,170),q.Get()},q.SELECTION_COLOR_PNG=function(){return G.rect=new A(1574,416,39,38),q.Get()},q.SELECTION_LOGO_PNG=function(){return G.rect=new A(1786,522,48,48),q.Get()},q.SHADING_PNG=function(){return G.rect=new A(1615,417,32,32),q.Get()},q.SHADOW_PNG=function(){return G.rect=new A(802,132,75,7),q.Get()},q.SHOE_LOGO01_PNG=function(){return G.rect=new A(1244,283,51,27),q.Get()},q.SHOE_LOGO02_PNG=function(){return G.rect=new A(1296,283,51,27),q.Get()},q.SHOE_LOGO03_PNG=function(){return G.rect=new A(1353,283,51,27),q.Get()},q.SHOE_LOGO04_PNG=function(){return G.rect=new A(1405,283,51,27),q.Get()},q.SHOE_LOGO05_PNG=function(){return G.rect=new A(1649,416,51,27),q.Get()},q.SHOE_LOGO06_PNG=function(){return G.rect=new A(1701,416,51,27),q.Get()},q.SHOE_LOGO07_PNG=function(){return G.rect=new A(1753,416,51,27),q.Get()},q.SHOE_LOGO08_PNG=function(){return G.rect=new A(868,571,51,27),q.Get()},q.SHOE_LOGO09_PNG=function(){return G.rect=new A(920,571,51,27),q.Get()},q.SHOE_LOGO10_PNG=function(){return G.rect=new A(972,571,51,27),q.Get()},q.SHOE_LOGO11_PNG=function(){return G.rect=new A(1024,571,51,27),q.Get()},q.SHOE_LOGO12_PNG=function(){return G.rect=new A(1368,590,51,27),q.Get()},q.SHOE_LOGO13_PNG=function(){return G.rect=new A(1420,590,51,27),q.Get()},q.SHOE_LOGO14_PNG=function(){return G.rect=new A(1786,571,51,27),q.Get()},q.SHOE_LOGO15_PNG=function(){return G.rect=new A(1840,461,51,27),q.Get()},q.SHOE_LOGO16_PNG=function(){return G.rect=new A(1840,489,51,27),q.Get()},q.SHOE_LOGO17_PNG=function(){return G.rect=new A(1840,517,51,27),q.Get()},q.SHOE_LOGO18_PNG=function(){return G.rect=new A(1840,545,51,27),q.Get()},q.SHOE_LOGO19_PNG=function(){return G.rect=new A(1840,573,51,27),q.Get()},q.SHOE_LOGO20_PNG=function(){return G.rect=new A(1892,461,51,27),q.Get()},q.SHOE_LOGO21_PNG=function(){return G.rect=new A(1944,461,51,27),q.Get()},q.SHOE_LOGO22_PNG=function(){return G.rect=new A(1996,461,51,27),q.Get()},q.SHOE_LOGO23_PNG=function(){return G.rect=new A(1892,489,51,27),q.Get()},q.SHOE_LOGO_MENU01_PNG=function(){return G.rect=new A(1076,571,32,32),q.Get()},q.SHOE_LOGO_MENU02_PNG=function(){return G.rect=new A(1892,517,32,32),q.Get()},q.SHOE_LOGO_MENU03_PNG=function(){return G.rect=new A(1892,550,32,32),q.Get()},q.SHOE_LOGO_MENU04_PNG=function(){return G.rect=new A(1892,583,32,32),q.Get()},q.SHOE_LOGO_MENU05_PNG=function(){return G.rect=new A(1944,489,32,32),q.Get()},q.SHOE_LOGO_MENU06_PNG=function(){return G.rect=new A(1977,489,32,32),q.Get()},q.SHOE_LOGO_MENU07_PNG=function(){return G.rect=new A(2010,489,32,32),q.Get()},q.SHOE_LOGO_MENU08_PNG=function(){return G.rect=new A(1944,522,32,32),q.Get()},q.SHOE_LOGO_MENU09_PNG=function(){return G.rect=new A(1944,555,32,32),q.Get()},q.SHOE_LOGO_MENU10_PNG=function(){return G.rect=new A(1977,522,32,32),q.Get()},q.SHOE_LOGO_MENU11_PNG=function(){return G.rect=new A(2010,522,32,32),q.Get()},q.SHOE_LOGO_MENU12_PNG=function(){return G.rect=new A(1977,555,32,32),q.Get()},q.SHOE_LOGO_MENU13_PNG=function(){return G.rect=new A(2010,555,32,32),q.Get()},q.SHOE_LOGO_MENU14_PNG=function(){return G.rect=new A(882,793,32,32),q.Get()},q.SHOE_LOGO_MENU15_PNG=function(){return G.rect=new A(915,793,32,32),q.Get()},q.SHOE_LOGO_MENU16_PNG=function(){return G.rect=new A(948,793,32,32),q.Get()},q.SHOE_LOGO_MENU17_PNG=function(){return G.rect=new A(981,793,32,32),q.Get()},q.SHOE_LOGO_MENU18_PNG=function(){return G.rect=new A(1014,793,32,32),q.Get()},q.SHOE_LOGO_MENU19_PNG=function(){return G.rect=new A(1047,793,32,32),q.Get()},q.SHOE_LOGO_MENU20_PNG=function(){return G.rect=new A(1080,793,32,32),q.Get()},q.SHOE_LOGO_MENU21_PNG=function(){return G.rect=new A(1113,793,32,32),q.Get()},q.SHOE_LOGO_MENU22_PNG=function(){return G.rect=new A(1146,793,32,32),q.Get()},q.SHOE_LOGO_MENU23_PNG=function(){return G.rect=new A(1179,793,32,32),q.Get()},q.SPARKLE01_PNG=function(){return G.rect=new A(1395,781,59,59),q.Get()},q.SPARKLE02_PNG=function(){return G.rect=new A(1723,673,84,84),q.Get()},q.SPARKLE03_PNG=function(){return G.rect=new A(1837,618,119,119),q.Get()},q.SPARK_PNG=function(){return G.rect=new A(187,55,2,2),q.Get()},q.STAR_PNG=function(){return G.rect=new A(1455,781,60,57),q.Get()},q.STATBAR_PNG=function(){return G.rect=new A(0,2032,105,15),q.Get()},q.TRAIL_PNG=function(){return G.rect=new A(1764,758,63,63),q.Get()},q.UBUNTU_REG_PNG=function(){return G.rect=new A(1067,1062,418,418),q.Get()},q.UI_BKND_PNG=function(){return G.rect=new A(1411,843,256,204),q.Get()},q.UP_PNG=function(){return G.rect=new A(1245,793,32,32),q.Get()},q.WASD_PNG=function(){return G.rect=new A(1837,738,192,72),q.Get()},q.WHITE_PARTICLE_PNG=function(){return G.rect=new A(1278,793,32,32),q.Get()},q.WIN_PNG=function(){return G.rect=new A(1837,811,166,25),q.Get()};var G=function(){};p.BundlerData=G,G.__name__="BundlerData",G.GetRect=function(){return new A(G.rect.get_left(),G.rect.get_top(),G.rect.width,G.rect.height)};var A=function(i,e,I,t){null==t&&(t=0),null==I&&(I=0),null==e&&(e=0),null==i&&(i=0),this.x=i,this.y=e,this.width=I,this.height=t};p["openfl.geom.Rectangle"]=A,A.__name__="openfl.geom.Rectangle",A.prototype={clone:function(){return new A(this.x,this.y,this.width,this.height)},contains:function(i,e){return i>=this.x&&e>=this.y&&ii+I&&(s=i+I-this.get_right()),this.get_bottom()>e+t&&(l=e+t-this.get_bottom()),this.x+=C,this.y+=o,this.width+=s-C,this.height+=l-o}},__expand:function(i,e,I,t){if(0==this.width&&0==this.height)this.x=i,this.y=e,this.width=I,this.height=t;else{var C=this.get_right(),o=this.get_bottom();this.x>i&&(this.x=i,this.width=C-i),this.y>e&&(this.y=e,this.height=o-e),Ct&&(t=s),l>o&&(o=l),(s=e.a*(this.x+this.width)+e.c*(this.y+this.height))t&&(t=s),l>o&&(o=l),(s=e.a*this.x+e.c*(this.y+this.height))t&&(t=s),l>o&&(o=l),i.setTo(I+e.tx,C+e.ty,t-I,o-C)},get_bottom:function(){return this.y+this.height},get_left:function(){return this.x},set_left:function(i){return this.width-=i-this.x,this.x=i},get_right:function(){return this.x+this.width},get_top:function(){return this.y},set_top:function(i){return this.height-=i-this.y,this.y=i},__class__:A,__properties__:{set_top:"set_top",get_top:"get_top",get_right:"get_right",set_left:"set_left",get_left:"get_left",get_bottom:"get_bottom"}};var m=function(){this.doOnce=!0,this.lastInnerHeight=this.lastRenderTime=0,this.afterResizeFunction=null,m.thisMain=this,nb.call(this),la.NewSeed(Fa.getTimer()),Fa.get_current().addChild(this),m.mX=m.CENTERX,m.mY=m.CENTERY,m.touches=new Db,this.AddEvents(),m.hostName=E.location.hostname,(0<=m.hostName.indexOf("localhost")||0<=m.hostName.indexOf("127.")||0<=m.hostName.indexOf("192."))&&(m.hostName="basketbros.io"),m.hostNameFull=m.hostName,0<=m.hostName.indexOf("www.")&&(m.hostName=T.replace(m.hostName,"www.","")),m.crazyGames=null!=window.CrazyGames};p.Main=m,m.__name__="Main",m.main=function(){new m},m.HideAd=function(i,e){null==e&&(e=!1),null!=(i=window.document.getElementById(i))&&(e||(i.style.display="none",i.style.visibility="hidden"),i.innerHTML=" . ")},m.HideAllAds=function(i){null==i&&(i=!0),m.HideAd("loading");var e=window.document.getElementById("preroll");null!=e&&(e.style.display="none",e.style.visibility="hidden"),i&&(m.HideAd("basketbros-io_160x600",!0),m.HideAd("basketbros-io_160x600_2",!0)),m.HideAd("basketbros-io_300x250"),m.HideAd("basketbros-io_300x250_2"),m.HideAd("basketbros-io_728x90"),m.HideAd("basketbros-io_player_300x600"),m.HideAd("basketbros-io_300x600_m"),m.HideAd("loading"),"undefined"!=typeof gCrazySDK&&gCrazySDK.clearAllBanners()},m.ShowAd=function(i,e,t,C,o){if("interstitial"==i)I.SoundVolume(0),I.MusicVolume(0),ShowAdBreak();else{var s=window.document.getElementById(i);if(null!=s){null==m.divLastRefreshed&&(m.divLastRefreshed=new Qa);var l=Fa.getTimer();switch(i){case"basketbros-io_160x600":var n=window.document.getElementById(i);return n.innerHTML=" + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+ +
+ + +
+ +
+ + + + + +
+
+
+
+
+

About BasketBros

+

Alt link: www.lookinthe.net. Fun, fast-paced 1 on 1 basketball game with lots of action. Pick from a variety of characters and let the play begin. Go for crazy dunks, hit the stepback 3, or maybe even punch out your opponent!

+

The controls are very simple: Use either the arrow keys or wasd to control your baller. Jump by pressing the up arrow, and jump again to shoot. Enter/Space will attack if you are on defense.

+

Be sure to allow notifications so you will know when fun new basketball characters are added to the game!

+
+
+

FAQ

+ Why isn't the game loading? +

You should check your internet connection and make sure our site isn't blocked. Also, disable all ad blockers.

+ How do I play? +

Just hop in and go dunk on some fools!

+ Which browser should I use? +

You should use chrome. It is the only browser guaranteed to work. BasketBros has also been tested to work on FireFox and Safari, but not guaranteed.

+
+
+
+
+
+ +
+
+
+
  Would you like to be a partner too? Contact: echo-the-coder@tuta.io
+
+
+ + + + + + \ No newline at end of file diff --git a/basketbros/thumb.jpg b/basketbros/thumb.jpg new file mode 100644 index 00000000..666fb291 Binary files /dev/null and b/basketbros/thumb.jpg differ diff --git a/basketrandom/box2d.wasm b/basketrandom/box2d.wasm new file mode 100644 index 00000000..106566ad Binary files /dev/null and b/basketrandom/box2d.wasm differ diff --git a/basketrandom/box2d.wasm.js b/basketrandom/box2d.wasm.js new file mode 100644 index 00000000..630d78b3 --- /dev/null +++ b/basketrandom/box2d.wasm.js @@ -0,0 +1,577 @@ +self.Box2DWasmModule = function(Box2D) { + Box2D = Box2D || {}; + var Module = Box2D; + +var b;b||(b=eval("(function() { try { return Box2D || {} } catch(e) { return {} } })()"));var aa={},ba;for(ba in b)b.hasOwnProperty(ba)&&(aa[ba]=b[ba]);var ca=!1,da=!1,ea=!1,fa=!1; +if(b.ENVIRONMENT)if("WEB"===b.ENVIRONMENT)ca=!0;else if("WORKER"===b.ENVIRONMENT)da=!0;else if("NODE"===b.ENVIRONMENT)ea=!0;else if("SHELL"===b.ENVIRONMENT)fa=!0;else throw Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ca="object"===typeof window,da="function"===typeof importScripts,ea="object"===typeof process&&"function"===typeof require&&!ca&&!da,fa=!ca&&!ea&&!da; +if(ea){b.print||(b.print=console.log);b.printErr||(b.printErr=console.warn);var ga,ha;b.read=function(a,c){ga||(ga=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);var d=ga.readFileSync(a);return c?d:d.toString()};b.readBinary=function(a){a=b.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};b.load=function(a){ia(read(a))};b.thisProgram||(b.thisProgram=1 0) var gc = undefined");else if(ca||da)b.read=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},da&&(b.readBinary=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}), +b.readAsync=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)},"undefined"!=typeof arguments&&(b.arguments=arguments),"undefined"!==typeof console?(b.print||(b.print=function(a){console.log(a)}),b.printErr||(b.printErr=function(a){console.warn(a)})):b.print||(b.print=function(){}),da&&(b.load=importScripts),"undefined"===typeof b.setWindowTitle&&(b.setWindowTitle= +function(a){document.title=a});else throw"Unknown runtime environment. Where are we?";function ia(a){eval.call(null,a)}!b.load&&b.read&&(b.load=function(a){ia(b.read(a))});b.print||(b.print=function(){});b.printErr||(b.printErr=b.print);b.arguments||(b.arguments=[]);b.thisProgram||(b.thisProgram="./this.program");b.quit||(b.quit=function(a,c){throw c;});b.print=b.print;b.h=b.printErr;b.preRun=[];b.postRun=[];for(ba in aa)aa.hasOwnProperty(ba)&&(b[ba]=aa[ba]); +var aa=void 0,f={f:function(a){return tempRet0=a},H:function(){return tempRet0},L:function(){return ka},K:function(a){ka=a},s:function(a){switch(a){case "i1":case "i8":return 1;case "i16":return 2;case "i32":return 4;case "i64":return 8;case "float":return 4;case "double":return 8;default:return"*"===a[a.length-1]?f.j:"i"===a[0]?(a=parseInt(a.substr(1)),assert(0===a%8),a/8):0}},F:function(a){return Math.max(f.s(a),f.j)},M:16,aa:function(a,c){"double"===c||"i64"===c?a&7&&(assert(4===(a&7)),a+=4):assert(0=== +(a&3));return a},U:function(a,c,d){return d||"i64"!=a&&"double"!=a?a?Math.min(c||(a?f.F(a):0),f.j):Math.min(c,8):8},l:function(a,c,d){return d&&d.length?b["dynCall_"+a].apply(null,[c].concat(d)):b["dynCall_"+a].call(null,c)},d:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],v:function(a){for(var c=0;c>2];a=(c+a+15|0)&-16;ma[oa>>2]=a;return a>=pa&&!qa()?(ma[oa>>2]=c,0):c},p:function(a,c){return Math.ceil(a/(c?c:16))*(c?c:16)},$:function(a,c,d){return d?+(a>>>0)+4294967296*+(c>>>0):+(a>>>0)+4294967296*+(c|0)},i:1024,j:4,N:0};f.addFunction=f.v;f.removeFunction=f.J;var ra=0;function assert(a,c){a||ta("Assertion failed: "+c)} +function ua(a){var c;c="i32";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return va[a>>0];case "i8":return va[a>>0];case "i16":return ya[a>>1];case "i32":return ma[a>>2];case "i64":return ma[a>>2];case "float":return za[a>>2];case "double":return Aa[a>>3];default:ta("invalid type for setValue: "+c)}return null} +function Ba(a,c,d){var e,g,l;"number"===typeof a?(g=!0,l=a):(g=!1,l=a.length);var m="string"===typeof c?c:null,D;4==d?D=e:D=["function"===typeof Ca?Ca:f.u,f.t,f.u,f.D][void 0===d?2:d](Math.max(l,m?1:c.length));if(g){e=D;assert(0==(D&3));for(a=D+(l&-4);e>2]=0;for(a=D+l;e>0]=0;return D}if("i8"===m)return a.subarray||a.slice?Da.set(a,D):Da.set(new Uint8Array(a),D),D;e=0;for(var na,wa;e>0]=G;break;case "i8":va[g>>0]=G;break;case "i16":ya[g>>1]=G;break;case "i32":ma[g>>2]=G;break;case "i64":tempI64=[G>>>0,(tempDouble=G,1<=+Ea(tempDouble)?0>>0:~~+Ia((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)];ma[g>>2]=tempI64[0];ma[g+4>>2]=tempI64[1];break;case "float":za[g>>2]=G;break;case "double":Aa[g>>3]=G;break;default:ta("invalid type for setValue: "+ +Ga)}wa!==d&&(na=f.s(d),wa=d);e+=na}}return D}function Ja(a){var c;if(0===c||!a)return"";for(var d=0,e,g=0;;){e=Da[a+g>>0];d|=e;if(0==e&&!c)break;g++;if(c&&g==c)break}c||(c=g);e="";if(128>d){for(;0=l&&(l=65536+((l&1023)<<10)|a.charCodeAt(++g)&1023);if(127>=l){if(d>=e)break;c[d++]=l}else{if(2047>=l){if(d+1>=e)break;c[d++]=192|l>>6}else{if(65535>=l){if(d+2>=e)break;c[d++]=224|l>>12}else{if(2097151>=l){if(d+3>=e)break;c[d++]=240|l>>18}else{if(67108863>=l){if(d+4>=e)break;c[d++]=248|l>>24}else{if(d+5>=e)break;c[d++]=252|l>>30;c[d++]=128|l>>24&63}c[d++]=128|l>>18&63}c[d++]=128|l>>12&63}c[d++]= +128|l>>6&63}c[d++]=128|l&63}}c[d]=0}}function Oa(a){for(var c=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le"); +function Pa(a){return a.replace(/__Z[\w\d_]+/g,function(a){var d;a:{var e=b.___cxa_demangle||b.__cxa_demangle;if(e)try{var g=a.substr(1),l=Oa(g)+1,m=Ca(l);La(g,Da,m,l);var D=Ca(4),na=e(m,0,0,D);if(0===ua(D)&&na){d=Ja(na);break a}}catch(wa){}finally{m&&Qa(m),D&&Qa(D),na&&Qa(na)}else f.g("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");d=a}return a===d?a:a+" ["+d+"]"})} +function Ra(){var a;a:{a=Error();if(!a.stack){try{throw Error(0);}catch(c){a=c}if(!a.stack){a="(no stack trace available)";break a}}a=a.stack.toString()}b.extraStackTrace&&(a+="\n"+b.extraStackTrace());return Pa(a)}var Sa=65536,Ua=16777216,Va=16777216;function Wa(a,c){0>2]>c)return!1;var d=pa;for(pa=Math.max(pa,Va);pa>2];)536870912>=pa?pa=Wa(2*pa,a):pa=Math.min(Wa((3*pa+2147483648)/4,a),c);a=b.reallocBuffer(pa);if(!a||a.byteLength!=pa)return pa=d,!1;b.buffer=buffer=a;Za();return!0}var eb; +try{eb=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),eb(new ArrayBuffer(4))}catch(fb){eb=function(a){return a.byteLength}}var gb=b.TOTAL_STACK||5242880,pa=b.TOTAL_MEMORY||16777216;pa>>16)*e+d*(c>>>16)<<16)|0});Math.Y=Math.imul; +if(!Math.fround){var sb=new Float32Array(1);Math.fround=function(a){sb[0]=a;return sb[0]}}Math.S=Math.fround;Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var c=0;32>c;c++)if(a&1<<31-c)return c;return 32});Math.P=Math.clz32;Math.trunc||(Math.trunc=function(a){return 0>a?Math.ceil(a):Math.floor(a)});Math.trunc=Math.trunc;var Ea=Math.abs,Ia=Math.ceil,Ha=Math.floor,Fa=Math.min,tb=0,vb=null,wb=null;function xb(){tb++;b.monitorRunDependencies&&b.monitorRunDependencies(tb)} +function yb(){tb--;b.monitorRunDependencies&&b.monitorRunDependencies(tb);if(0==tb&&(null!==vb&&(clearInterval(vb),vb=null),wb)){var a=wb;wb=null;a()}}b.preloadedImages={};b.preloadedAudios={};var zb=null; +(function(a){function c(c){c=Wa(c,a.usingWasm?Sa:Ua);var d=a.buffer,e=d.byteLength;if(a.usingWasm)try{return-1!==a.wasmMemory.grow((c-e)/65536)?a.buffer=a.wasmMemory.buffer:null}catch(g){return null}else return lb.__growWasmMemory((c-e)/65536),a.buffer!==d?a.buffer:null}function d(a,c){var d=Ta;if(0>a.indexOf("."))d=(d||{})[a];else var e=a.split("."),d=(d||{})[e[0]],d=(d||{})[e[1]];c&&(d=(d||{})[c]);void 0===d&&ta("bad lookupImport to ("+a+")."+c);return d}function e(c){var d=a.buffer;c.byteLength< +d.byteLength&&a.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var d=new Int8Array(d),e=new Int8Array(c);zb||d.set(e.subarray(a.STATIC_BASE,a.STATIC_BASE+a.STATIC_BUMP),a.STATIC_BASE);e.set(d);b.buffer=buffer=c;Za()}function g(){try{var c;if(a.wasmBinary)c=a.wasmBinary,c=new Uint8Array(c);else if(a.readBinary)c=a.readBinary(G);else throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"; +return c}catch(d){ta(d)}}function l(){return a.wasmBinary||"function"!==typeof fetch?new Promise(function(a){a(g())}):fetch(G,{Q:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()})}function m(c,d,e){if("function"!==typeof a.asm||a.asm===Ma)a.asmPreload?a.asm=a.asmPreload:eval(a.read(Ga));return"function"!==typeof a.asm?(a.printErr("asm evalling did not set the module properly"),!1):a.asm(c,d,e)}function D(c,d){function g(c){lb=c.exports; +lb.memory&&e(lb.memory);a.asm=lb;a.usingWasm=!0;yb()}if("object"!==typeof WebAssembly)return a.printErr("no native wasm support detected"),!1;if(!(a.wasmMemory instanceof WebAssembly.Memory))return a.printErr("no native wasm Memory in use"),!1;d.memory=a.wasmMemory;Ta.global={NaN:NaN,Infinity:Infinity};Ta["global.Math"]=c.Math;Ta.env=d;xb();if(a.instantiateWasm)try{return a.instantiateWasm(Ta,g)}catch(m){return a.printErr("Module.instantiateWasm callback failed with error: "+m),!1}l().then(function(a){return WebAssembly.instantiate(a, +Ta)}).then(function(a){g(a.instance)}).catch(function(c){a.printErr("failed to asynchronously prepare wasm: "+c);ta(c)});return{}}var na=a.wasmJSMethod||"native-wasm";a.wasmJSMethod=na;var wa=a.wasmTextFile||"Box2D_v2.3.1_min.wasm.wast",G=a.wasmBinaryFile||"Box2D_v2.3.1_min.wasm.wasm",Ga=a.asmjsCodeFile||"Box2D_v2.3.1_min.wasm.temp.asm.js";"function"===typeof a.locateFile&&(wa=a.locateFile(wa),G=a.locateFile(G),Ga=a.locateFile(Ga));var Ta={global:null,env:null,asm2wasm:{"f64-rem":function(a,c){return a% +c},"f64-to-int":function(a){return a|0},"i32s-div":function(a,c){return(a|0)/(c|0)|0},"i32u-div":function(a,c){return(a>>>0)/(c>>>0)>>>0},"i32s-rem":function(a,c){return(a|0)%(c|0)|0},"i32u-rem":function(a,c){return(a>>>0)%(c>>>0)>>>0},"debugger":function(){debugger}},parent:a},lb=null;a.asmPreload=a.asm;var ub=a.reallocBuffer;a.reallocBuffer=function(a){return"asmjs"===qc?ub(a):c(a)};var qc="";a.asm=function(c,l,G){if(!l.table){var Ma=a.wasmTableSize;void 0===Ma&&(Ma=1024);var mb=a.wasmMaxTableSize; +l.table="object"===typeof WebAssembly&&"function"===typeof WebAssembly.Table?void 0!==mb?new WebAssembly.Table({initial:Ma,maximum:mb,element:"anyfunc"}):new WebAssembly.Table({initial:Ma,element:"anyfunc"}):Array(Ma);a.wasmTable=l.table}l.memoryBase||(l.memoryBase=a.STATIC_BASE);l.tableBase||(l.tableBase=0);for(var V,Ma=na.split(","),mb=0;mb>2]}var Lb={},Mb={};b._sbrk=Nb;var Ob=1; +function Pb(){var a=Eb;if(!a)return(f.f(0),0)|0;var c=Gb[a],d=c.type;if(!d)return(f.f(0),a)|0;var e=Array.prototype.slice.call(arguments);b.___cxa_is_pointer_type(d);Pb.buffer||(Pb.buffer=Ca(4));ma[Pb.buffer>>2]=a;for(var a=Pb.buffer,g=0;g>2],c.w=a,(f.f(e[g]),a)|0;a=ma[a>>2];return(f.f(d),a)|0}b._llvm_bswap_i32=Qb; +function Rb(a,c){Jb=c;try{var d=Kb(),e=Kb(),g=Kb(),l=0;Rb.buffer||(Rb.e=[null,[],[]],Rb.q=function(a,c){var d=Rb.e[a];assert(d);if(0===c||10===c){var e=1===a?b.print:b.printErr,g;a:{for(var l=g=0;d[l];)++l;if(16m?l+=String.fromCharCode(m):(m-=65536,l+=String.fromCharCode(55296|m>>10,56320|m&1023)))):l+=String.fromCharCode(m)}}e(g);d.length=0}else d.push(c)});for(var m=0;m>2],na=ma[e+(8*m+4)>>2],wa=0;wa>2]=cb;b.wasmTableSize=1152;b.wasmMaxTableSize=1152;b.A={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:Infinity,byteLength:eb}; +b.B={abort:ta,assert:assert,enlargeMemory:qa,getTotalMemory:function(){return pa},abortOnCannotGrowMemory:function(){ta("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+pa+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},invoke_iiii:function(a,c,d,e){try{return b.dynCall_iiii(a,c,d,e)}catch(g){if("number"!== +typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_iiii:function(a,c,d,e){return f.d[a](c,d,e)},invoke_viifii:function(a,c,d,e,g,l){try{b.dynCall_viifii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viifii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_viiiii:function(a,c,d,e,g,l){try{b.dynCall_viiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viiiii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_vi:function(a, +c){try{b.dynCall_vi(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_vi:function(a,c){f.d[a](c)},invoke_vii:function(a,c,d){try{b.dynCall_vii(a,c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_vii:function(a,c,d){f.d[a](c,d)},invoke_ii:function(a,c){try{return b.dynCall_ii(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_ii:function(a,c){return f.d[a](c)},invoke_fif:function(a,c,d){try{return b.dynCall_fif(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_fif:function(a,c,d){return f.d[a](c,d)},invoke_viii:function(a,c,d,e){try{b.dynCall_viii(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viii:function(a,c,d,e){f.d[a](c,d,e)},invoke_viifi:function(a,c,d,e,g){try{b.dynCall_viifi(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viifi:function(a,c,d,e,g){f.d[a](c,d,e,g)},invoke_v:function(a){try{b.dynCall_v(a)}catch(c){if("number"!== +typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},jsCall_v:function(a){f.d[a]()},invoke_viif:function(a,c,d,e){try{b.dynCall_viif(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viif:function(a,c,d,e){f.d[a](c,d,e)},invoke_viiiiii:function(a,c,d,e,g,l,m){try{b.dynCall_viiiiii(a,c,d,e,g,l,m)}catch(D){if("number"!==typeof D&&"longjmp"!==D)throw D;b.setThrew(1,0)}},jsCall_viiiiii:function(a,c,d,e,g,l,m){f.d[a](c,d,e,g,l,m)},invoke_iii:function(a,c,d){try{return b.dynCall_iii(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_iii:function(a,c,d){return f.d[a](c,d)},invoke_iiiiii:function(a,c,d,e,g,l){try{return b.dynCall_iiiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_iiiiii:function(a,c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_fiiiif:function(a,c,d,e,g,l){try{return b.dynCall_fiiiif(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_fiiiif:function(a, +c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_viiii:function(a,c,d,e,g){try{b.dynCall_viiii(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viiii:function(a,c,d,e,g){f.d[a](c,d,e,g)},_emscripten_asm_const_iiiii:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_emscripten_asm_const_diiiid:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},_pthread_key_create:function(a){if(0==a)return 22;ma[a>>2]=Ob;Mb[Ob]=0;Ob++;return 0},_abort:function(){b.abort()},___gxx_personality_v0:function(){}, +_emscripten_asm_const_iiidii:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},___assert_fail:function(a,c,d,e){ra=!0;throw"Assertion failed: "+Ja(a)+", at: "+[c?Ja(c):"unknown filename",d,e?Ja(e):"unknown function"]+" at "+Ra();},__ZSt18uncaught_exceptionv:Db,___setErrNo:function(a){b.___errno_location&&(ma[b.___errno_location()>>2]=a);return a},___cxa_begin_catch:function(a){var c=Gb[a];c&&!c.C&&(c.C=!0,Db.e--);c&&(c.da=!1);Fb.push(a);a:{if(a&&!Gb[a])for(var d in Gb)if(Gb[d].w===a){c=d;break a}c=a}c&& +Gb[c].ba++;return a},_emscripten_memcpy_big:function(a,c,d){Da.set(Da.subarray(c,c+d),a);return a},___resumeException:function(a){Eb||(Eb=a);throw a+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";},___cxa_find_matching_catch:Pb,_pthread_getspecific:function(a){return Mb[a]||0},_pthread_once:Hb,___syscall54:function(a,c){Jb=c;return 0},_emscripten_asm_const_iii:function(a,c,d){return Ab[a](c, +d)},_emscripten_asm_const_iiidi:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_pthread_setspecific:function(a,c){if(!(a in Mb))return 22;Mb[a]=c;return 0},_emscripten_asm_const_iiii:function(a,c,d,e){return Ab[a](c,d,e)},___syscall6:function(a,c){Jb=c;try{var d=Lb.G();FS.close(d);return 0}catch(e){return"undefined"!==typeof FS&&e instanceof FS.o||ta(e),-e.r}},___syscall140:function(a,c){Jb=c;try{var d=Lb.G();Kb();var e=Kb(),g=Kb(),l=Kb();FS.Z(d,e,l);ma[g>>2]=d.position;d.I&&0===e&&0===l&&(d.I=null); +return 0}catch(m){return"undefined"!==typeof FS&&m instanceof FS.o||ta(m),-m.r}},___cxa_pure_virtual:function(){ra=!0;throw"Pure virtual function called!";},___syscall146:Rb,DYNAMICTOP_PTR:oa,tempDoublePtr:Bb,ABORT:ra,STACKTOP:ka,STACK_MAX:bb};var Sb=b.asm(b.A,b.B,buffer);b.asm=Sb; +var Tb=b._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0.apply(null,arguments)},Ub=b._emscripten_bind_b2ContactEdge_set_next_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_next_1.apply(null,arguments)},Vb=b._emscripten_bind_b2ChainShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_count_0.apply(null,arguments)},Wb=b._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0.apply(null, +arguments)},Xb=b._emscripten_bind_b2PulleyJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_SetUserData_1.apply(null,arguments)},Yb=b._emscripten_bind_b2Shape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2Shape_ComputeAABB_3.apply(null,arguments)},Zb=b._emscripten_bind_b2FrictionJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_userData_1.apply(null,arguments)},$b=b._emscripten_bind_b2MouseJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MouseJoint_IsActive_0.apply(null, +arguments)},ac=b._emscripten_bind_b2World_IsLocked_0=function(){return b.asm._emscripten_bind_b2World_IsLocked_0.apply(null,arguments)},bc=b._emscripten_bind_b2Draw_GetFlags_0=function(){return b.asm._emscripten_bind_b2Draw_GetFlags_0.apply(null,arguments)},cc=b._emscripten_bind_b2FrictionJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_IsActive_0.apply(null,arguments)},dc=b._emscripten_bind_b2Color_set_g_1=function(){return b.asm._emscripten_bind_b2Color_set_g_1.apply(null, +arguments)},ec=b._emscripten_bind_b2PolygonShape_RayCast_4=function(){return b.asm._emscripten_bind_b2PolygonShape_RayCast_4.apply(null,arguments)},fc=b._emscripten_bind_b2World_GetTreeBalance_0=function(){return b.asm._emscripten_bind_b2World_GetTreeBalance_0.apply(null,arguments)},gc=b._emscripten_bind_b2ChainShape_get_m_vertices_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_vertices_0.apply(null,arguments)},hc=b._emscripten_bind_JSDraw_DrawSolidCircle_4=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidCircle_4.apply(null, +arguments)},ic=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0.apply(null,arguments)},jc=b._emscripten_bind_b2FixtureDef_get_filter_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_filter_0.apply(null,arguments)},kc=b._emscripten_bind_b2FrictionJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_type_0.apply(null,arguments)},lc=b._emscripten_bind_b2MotorJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_type_1.apply(null, +arguments)},mc=b._emscripten_bind_b2FixtureDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_userData_1.apply(null,arguments)},nc=b._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1.apply(null,arguments)},oc=b._emscripten_bind_b2JointEdge_set_joint_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_joint_1.apply(null,arguments)},pc=b._emscripten_bind_b2Fixture___destroy___0=function(){return b.asm._emscripten_bind_b2Fixture___destroy___0.apply(null, +arguments)},rc=b._emscripten_bind_b2World_SetWarmStarting_1=function(){return b.asm._emscripten_bind_b2World_SetWarmStarting_1.apply(null,arguments)},sc=b._emscripten_bind_JSDraw_DrawCircle_3=function(){return b.asm._emscripten_bind_JSDraw_DrawCircle_3.apply(null,arguments)},tc=b._emscripten_bind_b2WeldJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WeldJoint_IsActive_0.apply(null,arguments)},uc=b._emscripten_bind_b2DestructionListener___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListener___destroy___0.apply(null, +arguments)},vc=b._emscripten_bind_b2BodyDef_set_type_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_type_1.apply(null,arguments)},wc=b._emscripten_bind_b2ChainShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeAABB_3.apply(null,arguments)},xc=b._emscripten_bind_b2PulleyJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetUserData_0.apply(null,arguments)},yc=b._emscripten_bind_b2WeldJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionTorque_1.apply(null, +arguments)},zc=b._emscripten_bind_b2MotorJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxForce_0.apply(null,arguments)},Ac=b._emscripten_bind_b2DistanceJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_userData_0.apply(null,arguments)},Bc=b._emscripten_bind_b2BodyDef_get_position_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_position_0.apply(null,arguments)},Cc=b._emscripten_bind_b2RevoluteJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_userData_1.apply(null,arguments)},Dc=b._emscripten_bind_b2WorldManifold_b2WorldManifold_0=function(){return b.asm._emscripten_bind_b2WorldManifold_b2WorldManifold_0.apply(null,arguments)},Ec=b._emscripten_bind_b2WheelJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_collideConnected_0.apply(null,arguments)},Fc=b._emscripten_bind_b2MouseJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_userData_1.apply(null, +arguments)};b.stackSave=function(){return b.asm.stackSave.apply(null,arguments)}; +var Gc=b._emscripten_bind_b2FixtureDef_set_restitution_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_restitution_1.apply(null,arguments)},Hc=b._emscripten_bind_b2RevoluteJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUserData_0.apply(null,arguments)},Ic=b._emscripten_bind_b2Mat33_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ey_0.apply(null,arguments)},Jc=b._emscripten_bind_b2MouseJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetCollideConnected_0.apply(null, +arguments)},Kc=b._emscripten_bind_b2World_GetGravity_0=function(){return b.asm._emscripten_bind_b2World_GetGravity_0.apply(null,arguments)},Lc=b._emscripten_bind_b2Mat33_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ey_1.apply(null,arguments)},Mc=b._emscripten_bind_b2Profile_get_broadphase_0=function(){return b.asm._emscripten_bind_b2Profile_get_broadphase_0.apply(null,arguments)},Nc=b._emscripten_bind_b2PulleyJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyA_0.apply(null, +arguments)},Oc=b._emscripten_bind_b2PrismaticJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetLimits_2.apply(null,arguments)},Pc=b._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0.apply(null,arguments)},Qc=b._emscripten_bind_b2DistanceJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorA_0.apply(null,arguments)},Rc=b._emscripten_bind_b2DistanceJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_userData_1.apply(null,arguments)},Sc=b._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1.apply(null,arguments)},Tc=b._emscripten_bind_b2RopeJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_collideConnected_1.apply(null,arguments)},Uc=b._emscripten_bind_b2ChainShape_set_m_nextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_nextVertex_1.apply(null, +arguments)},Vc=b._emscripten_bind_JSContactListener_EndContact_1=function(){return b.asm._emscripten_bind_JSContactListener_EndContact_1.apply(null,arguments)},Wc=b._emscripten_bind_b2MassData_set_mass_1=function(){return b.asm._emscripten_bind_b2MassData_set_mass_1.apply(null,arguments)},Xc=b._emscripten_bind_b2Vec3_get_x_0=function(){return b.asm._emscripten_bind_b2Vec3_get_x_0.apply(null,arguments)},Yc=b._emscripten_bind_b2ChainShape_CreateChain_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateChain_2.apply(null, +arguments)},Zc=b._emscripten_bind_b2RopeJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetUserData_0.apply(null,arguments)},$c=b._emscripten_bind_b2World_DestroyBody_1=function(){return b.asm._emscripten_bind_b2World_DestroyBody_1.apply(null,arguments)},ad=b._emscripten_bind_b2Profile_get_solvePosition_0=function(){return b.asm._emscripten_bind_b2Profile_get_solvePosition_0.apply(null,arguments)},bd=b._emscripten_bind_b2Shape_RayCast_4=function(){return b.asm._emscripten_bind_b2Shape_RayCast_4.apply(null, +arguments)},cd=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0.apply(null,arguments)},dd=b._emscripten_bind_b2Mat33___destroy___0=function(){return b.asm._emscripten_bind_b2Mat33___destroy___0.apply(null,arguments)},ed=b._emscripten_bind_b2GearJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionTorque_1.apply(null,arguments)},fd=b._emscripten_bind_b2WeldJointDef_set_collideConnected_1= +function(){return b.asm._emscripten_bind_b2WeldJointDef_set_collideConnected_1.apply(null,arguments)},gd=b._emscripten_bind_b2JointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2JointDef_get_collideConnected_0.apply(null,arguments)};b.getTempRet0=function(){return b.asm.getTempRet0.apply(null,arguments)}; +var hd=b._emscripten_bind_b2FrictionJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxTorque_0.apply(null,arguments)},id=b._emscripten_bind_JSQueryCallback_JSQueryCallback_0=function(){return b.asm._emscripten_bind_JSQueryCallback_JSQueryCallback_0.apply(null,arguments)},jd=b._emscripten_bind_b2World_SetAutoClearForces_1=function(){return b.asm._emscripten_bind_b2World_SetAutoClearForces_1.apply(null,arguments)},kd=b._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1= +function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1.apply(null,arguments)},ld=b._emscripten_bind_b2Contact_GetTangentSpeed_0=function(){return b.asm._emscripten_bind_b2Contact_GetTangentSpeed_0.apply(null,arguments)},md=b._emscripten_bind_b2BodyDef_set_position_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_position_1.apply(null,arguments)},nd=b._emscripten_bind_b2Transform_get_q_0=function(){return b.asm._emscripten_bind_b2Transform_get_q_0.apply(null,arguments)}, +od=b._emscripten_bind_b2PolygonShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_count_1.apply(null,arguments)},pd=b._emscripten_bind_b2Contact_GetNext_0=function(){return b.asm._emscripten_bind_b2Contact_GetNext_0.apply(null,arguments)},qd=b._emscripten_bind_b2MotorJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_userData_1.apply(null,arguments)},rd=b._emscripten_bind_b2GearJoint_GetJoint1_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint1_0.apply(null, +arguments)},sd=b._emscripten_bind_b2World_GetProxyCount_0=function(){return b.asm._emscripten_bind_b2World_GetProxyCount_0.apply(null,arguments)},td=b._emscripten_bind_b2MotorJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxTorque_1.apply(null,arguments)},ud=b._emscripten_bind_b2GearJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorA_0.apply(null,arguments)},vd=b._emscripten_bind_b2MouseJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyA_1.apply(null, +arguments)},wd=b._emscripten_bind_b2World_SetContactListener_1=function(){return b.asm._emscripten_bind_b2World_SetContactListener_1.apply(null,arguments)},xd=b._emscripten_bind_b2Body_IsAwake_0=function(){return b.asm._emscripten_bind_b2Body_IsAwake_0.apply(null,arguments)},yd=b._emscripten_bind_b2JointEdge_set_other_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_other_1.apply(null,arguments)},zd=b._emscripten_bind_b2MouseJointDef_set_target_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_target_1.apply(null, +arguments)},db=b._emscripten_replace_memory=function(){return b.asm._emscripten_replace_memory.apply(null,arguments)},Ad=b._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1.apply(null,arguments)},Bd=b._emscripten_bind_b2FixtureDef_get_density_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_density_0.apply(null,arguments)},Cd=b._emscripten_bind_b2GearJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetRatio_0.apply(null, +arguments)},Dd=b._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0.apply(null,arguments)},Ed=b._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0.apply(null,arguments)},Fd=b._emscripten_bind_b2MotorJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_collideConnected_0.apply(null,arguments)}, +Gd=b._emscripten_enum_b2ManifoldType_e_circles=function(){return b.asm._emscripten_enum_b2ManifoldType_e_circles.apply(null,arguments)},Hd=b._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1.apply(null,arguments)},Id=b._emscripten_bind_b2RevoluteJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_Initialize_3.apply(null,arguments)},Jd=b._emscripten_bind_b2FixtureDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_userData_0.apply(null, +arguments)},Kd=b._emscripten_bind_b2DistanceJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetUserData_0.apply(null,arguments)},Ld=b._emscripten_bind_b2FrictionJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_collideConnected_1.apply(null,arguments)},Md=b._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0.apply(null,arguments)},Nd= +b._emscripten_bind_b2GearJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetCollideConnected_0.apply(null,arguments)},Od=b._emscripten_bind_b2Filter_b2Filter_0=function(){return b.asm._emscripten_bind_b2Filter_b2Filter_0.apply(null,arguments)},Pd=b._emscripten_bind_b2MouseJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_type_1.apply(null,arguments)},Qd=b._emscripten_bind_b2Body_ApplyAngularImpulse_2=function(){return b.asm._emscripten_bind_b2Body_ApplyAngularImpulse_2.apply(null, +arguments)},Rd=b._emscripten_enum_b2JointType_e_frictionJoint=function(){return b.asm._emscripten_enum_b2JointType_e_frictionJoint.apply(null,arguments)},Sd=b._emscripten_bind_b2RayCastOutput_set_fraction_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_fraction_1.apply(null,arguments)},Td=b._emscripten_bind_b2Color_set_r_1=function(){return b.asm._emscripten_bind_b2Color_set_r_1.apply(null,arguments)},Ud=b._emscripten_bind_b2DistanceJointDef_get_length_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_length_0.apply(null, +arguments)},Vd=b._emscripten_bind_b2PulleyJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyB_0.apply(null,arguments)},Wd=b._emscripten_bind_b2WheelJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_type_1.apply(null,arguments)},Xd=b._emscripten_bind_b2World_GetTreeQuality_0=function(){return b.asm._emscripten_bind_b2World_GetTreeQuality_0.apply(null,arguments)},Yd=b._emscripten_bind_b2BodyDef_set_gravityScale_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_gravityScale_1.apply(null, +arguments)},Zd=b._emscripten_bind_b2RopeJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyB_1.apply(null,arguments)},$d=b._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0.apply(null,arguments)},ae=b._emscripten_bind_b2AABB_get_lowerBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_lowerBound_0.apply(null,arguments)},be=b._emscripten_bind_b2WheelJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMotorSpeed_1.apply(null, +arguments)},ce=b._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0.apply(null,arguments)},de=b._emscripten_bind_b2Body_SetMassData_1=function(){return b.asm._emscripten_bind_b2Body_SetMassData_1.apply(null,arguments)},ee=b._emscripten_bind_b2BodyDef_get_angularVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularVelocity_0.apply(null,arguments)},fe=b._emscripten_bind_b2WeldJoint_SetDampingRatio_1= +function(){return b.asm._emscripten_bind_b2WeldJoint_SetDampingRatio_1.apply(null,arguments)},ge=b._emscripten_bind_b2PrismaticJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef___destroy___0.apply(null,arguments)},he=b._emscripten_bind_b2Contact_IsTouching_0=function(){return b.asm._emscripten_bind_b2Contact_IsTouching_0.apply(null,arguments)},ie=b._emscripten_bind_b2Draw_SetFlags_1=function(){return b.asm._emscripten_bind_b2Draw_SetFlags_1.apply(null,arguments)}, +je=b._emscripten_bind_b2AABB_Contains_1=function(){return b.asm._emscripten_bind_b2AABB_Contains_1.apply(null,arguments)},ke=b._emscripten_bind_b2DistanceJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetNext_0.apply(null,arguments)},le=b._emscripten_bind_b2EdgeShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_radius_1.apply(null,arguments)},me=b._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0.apply(null, +arguments)},ne=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0.apply(null,arguments)},oe=b._emscripten_bind_b2PrismaticJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetType_0.apply(null,arguments)},pe=b._emscripten_bind_b2Fixture_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Fixture_GetRestitution_0.apply(null,arguments)},qe=b._emscripten_bind_b2Transform_set_q_1=function(){return b.asm._emscripten_bind_b2Transform_set_q_1.apply(null, +arguments)},re=b._emscripten_bind_b2PolygonShape___destroy___0=function(){return b.asm._emscripten_bind_b2PolygonShape___destroy___0.apply(null,arguments)},se=b._emscripten_bind_b2AABB_get_upperBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_upperBound_0.apply(null,arguments)},te=b._emscripten_bind_b2Transform___destroy___0=function(){return b.asm._emscripten_bind_b2Transform___destroy___0.apply(null,arguments)},ue=b._emscripten_bind_b2Body_GetLinearVelocity_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocity_0.apply(null, +arguments)},ve=b._emscripten_bind_b2CircleShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_radius_1.apply(null,arguments)},we=b._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1.apply(null,arguments)},xe=b._emscripten_bind_b2Contact_GetWorldManifold_1=function(){return b.asm._emscripten_bind_b2Contact_GetWorldManifold_1.apply(null,arguments)},ye=b._emscripten_bind_b2RopeJoint_GetMaxLength_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetMaxLength_0.apply(null, +arguments)},ze=b._emscripten_bind_b2GearJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetUserData_0.apply(null,arguments)},Ae=b._emscripten_bind_b2MotorJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCollideConnected_0.apply(null,arguments)},Be=b._emscripten_bind_b2GearJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_type_1.apply(null,arguments)},Ce=b._emscripten_bind_b2DistanceJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetDampingRatio_1.apply(null, +arguments)},De=b._emscripten_bind_b2Contact_GetFixtureA_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureA_0.apply(null,arguments)},Ee=b._emscripten_bind_b2PulleyJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_ratio_0.apply(null,arguments)},Fe=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0.apply(null,arguments)},Ge=b._emscripten_bind_b2CircleShape_set_m_type_1= +function(){return b.asm._emscripten_bind_b2CircleShape_set_m_type_1.apply(null,arguments)},He=b._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1.apply(null,arguments)},Ie=b._emscripten_bind_b2RopeJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorB_0.apply(null,arguments)},Je=b._emscripten_bind_b2AABB_set_upperBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_upperBound_1.apply(null, +arguments)},Ke=b._emscripten_bind_JSRayCastCallback_ReportFixture_4=function(){return b.asm._emscripten_bind_JSRayCastCallback_ReportFixture_4.apply(null,arguments)},Le=b._emscripten_bind_b2ContactImpulse___destroy___0=function(){return b.asm._emscripten_bind_b2ContactImpulse___destroy___0.apply(null,arguments)},Me=b._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0.apply(null,arguments)},Ne=b._emscripten_bind_b2PulleyJointDef_set_lengthB_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthB_1.apply(null,arguments)},Oe=b._emscripten_bind_b2RayCastInput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastInput___destroy___0.apply(null,arguments)},Pe=b._emscripten_bind_b2Body_ApplyForceToCenter_2=function(){return b.asm._emscripten_bind_b2Body_ApplyForceToCenter_2.apply(null,arguments)},Qe=b._emscripten_bind_JSDestructionListener_JSDestructionListener_0=function(){return b.asm._emscripten_bind_JSDestructionListener_JSDestructionListener_0.apply(null, +arguments)},Re=b._emscripten_bind_b2WheelJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorA_1.apply(null,arguments)},Se=b._emscripten_bind_b2FrictionJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyB_0.apply(null,arguments)},Te=b._emscripten_bind_b2WeldJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyA_1.apply(null,arguments)},Ue=b._emscripten_bind_b2DistanceJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyB_0.apply(null, +arguments)},Ve=b._emscripten_enum_b2JointType_e_wheelJoint=function(){return b.asm._emscripten_enum_b2JointType_e_wheelJoint.apply(null,arguments)},We=b._emscripten_bind_b2JointDef___destroy___0=function(){return b.asm._emscripten_bind_b2JointDef___destroy___0.apply(null,arguments)},Xe=b._emscripten_bind_b2ContactEdge___destroy___0=function(){return b.asm._emscripten_bind_b2ContactEdge___destroy___0.apply(null,arguments)},Ye=b._emscripten_bind_b2Filter_get_groupIndex_0=function(){return b.asm._emscripten_bind_b2Filter_get_groupIndex_0.apply(null, +arguments)},Ze=b._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0.apply(null,arguments)},$e=b._emscripten_bind_b2CircleShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetChildCount_0.apply(null,arguments)},af=b._emscripten_bind_b2BodyDef_get_bullet_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_bullet_0.apply(null,arguments)},bf=b._emscripten_bind_b2Color_set_b_1=function(){return b.asm._emscripten_bind_b2Color_set_b_1.apply(null, +arguments)},cf=b._emscripten_bind_b2Mat33_get_ez_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ez_0.apply(null,arguments)},df=b._emscripten_bind_b2MassData_get_center_0=function(){return b.asm._emscripten_bind_b2MassData_get_center_0.apply(null,arguments)},ef=b._emscripten_bind_b2WeldJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyB_0.apply(null,arguments)},ff=b._emscripten_bind_b2WheelJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionForce_1.apply(null, +arguments)},gf=b._emscripten_bind_b2World_SetSubStepping_1=function(){return b.asm._emscripten_bind_b2World_SetSubStepping_1.apply(null,arguments)},hf=b._emscripten_bind_b2Vec2_op_add_1=function(){return b.asm._emscripten_bind_b2Vec2_op_add_1.apply(null,arguments)},jf=b._emscripten_bind_JSDraw_DrawSegment_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSegment_3.apply(null,arguments)},kf=b._emscripten_bind_b2Joint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2Joint_GetCollideConnected_0.apply(null, +arguments)},lf=b._emscripten_bind_b2MotorJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionTorque_1.apply(null,arguments)},mf=b._emscripten_bind_b2FrictionJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyB_0.apply(null,arguments)},nf=b._emscripten_bind_b2WheelJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJointDef___destroy___0.apply(null,arguments)},of=b._emscripten_bind_b2BodyDef_get_gravityScale_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_gravityScale_0.apply(null,arguments)},pf=b._emscripten_bind_b2Vec3_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec3_SetZero_0.apply(null,arguments)},qf=b._emscripten_enum_b2JointType_e_pulleyJoint=function(){return b.asm._emscripten_enum_b2JointType_e_pulleyJoint.apply(null,arguments)},rf=b._emscripten_bind_b2ChainShape_get_m_nextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_nextVertex_0.apply(null,arguments)}, +sf=b._emscripten_bind_b2Contact_SetEnabled_1=function(){return b.asm._emscripten_bind_b2Contact_SetEnabled_1.apply(null,arguments)},tf=b._emscripten_bind_b2Shape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_radius_1.apply(null,arguments)},uf=b._emscripten_bind_b2World_SetDebugDraw_1=function(){return b.asm._emscripten_bind_b2World_SetDebugDraw_1.apply(null,arguments)},vf=b._emscripten_bind_b2ContactID_set_key_1=function(){return b.asm._emscripten_bind_b2ContactID_set_key_1.apply(null, +arguments)},Ca=b._malloc=function(){return b.asm._malloc.apply(null,arguments)},wf=b._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0.apply(null,arguments)},xf=b._emscripten_bind_b2Vec2_Normalize_0=function(){return b.asm._emscripten_bind_b2Vec2_Normalize_0.apply(null,arguments)},yf=b._emscripten_bind_b2WheelJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointSpeed_0.apply(null,arguments)},zf= +b._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1.apply(null,arguments)},Af=b._emscripten_bind_b2ChainShape_set_m_vertices_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_vertices_1.apply(null,arguments)},Bf=b._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0=function(){return b.asm._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0.apply(null,arguments)},Cf=b._emscripten_bind_b2RayCastInput_set_p2_1= +function(){return b.asm._emscripten_bind_b2RayCastInput_set_p2_1.apply(null,arguments)},Df=b._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0.apply(null,arguments)},Ef=b._emscripten_bind_b2Manifold_get_pointCount_0=function(){return b.asm._emscripten_bind_b2Manifold_get_pointCount_0.apply(null,arguments)},Ff=b._emscripten_bind_b2RayCastOutput_get_normal_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_normal_0.apply(null, +arguments)},Gf=b._emscripten_bind_b2WeldJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyA_0.apply(null,arguments)},Hf=b._emscripten_enum_b2DrawFlag_e_jointBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_jointBit.apply(null,arguments)},If=b._emscripten_bind_b2FixtureDef_get_isSensor_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_isSensor_0.apply(null,arguments)},Jf=b._emscripten_bind_b2PrismaticJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_Initialize_4.apply(null, +arguments)},Kf=b._emscripten_bind_b2PulleyJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyB_1.apply(null,arguments)},Lf=b._emscripten_bind_b2WheelJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJoint_EnableMotor_1.apply(null,arguments)},Mf=b._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0.apply(null,arguments)},Nf=b._emscripten_bind_JSDraw_DrawSolidPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidPolygon_3.apply(null, +arguments)},Of=b._emscripten_bind_b2Rot_Set_1=function(){return b.asm._emscripten_bind_b2Rot_Set_1.apply(null,arguments)},Pf=b._emscripten_bind_b2RevoluteJoint_GetJointAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointAngle_0.apply(null,arguments)},Qf=b._emscripten_bind_JSDraw___destroy___0=function(){return b.asm._emscripten_bind_JSDraw___destroy___0.apply(null,arguments)},Rf=b._emscripten_bind_b2MouseJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJointDef___destroy___0.apply(null, +arguments)},Sf=b._emscripten_bind_b2Mat33_Solve22_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve22_1.apply(null,arguments)},Tf=b._emscripten_bind_b2Profile_set_solvePosition_1=function(){return b.asm._emscripten_bind_b2Profile_set_solvePosition_1.apply(null,arguments)},Uf=b._emscripten_bind_b2ContactFilter___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFilter___destroy___0.apply(null,arguments)},Vf=b._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0.apply(null, +arguments)},Wf=b._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1.apply(null,arguments)},Xf=b._emscripten_bind_b2Joint_SetUserData_1=function(){return b.asm._emscripten_bind_b2Joint_SetUserData_1.apply(null,arguments)},Yf=b._emscripten_bind_b2DistanceJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetUserData_1.apply(null,arguments)},Zf=b._emscripten_bind_b2PrismaticJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJoint___destroy___0.apply(null, +arguments)},$f=b._emscripten_bind_b2RopeJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyA_1.apply(null,arguments)},ag=b._emscripten_bind_b2GearJoint___destroy___0=function(){return b.asm._emscripten_bind_b2GearJoint___destroy___0.apply(null,arguments)},bg=b._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0.apply(null,arguments)},cg=b._emscripten_bind_b2ManifoldPoint_get_id_0= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_id_0.apply(null,arguments)},dg=b._emscripten_bind_b2CircleShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_radius_0.apply(null,arguments)},eg=b._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0.apply(null,arguments)},fg=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0.apply(null, +arguments)},gg=b._emscripten_bind_b2Vec3_op_add_1=function(){return b.asm._emscripten_bind_b2Vec3_op_add_1.apply(null,arguments)},hg=b._emscripten_bind_b2FrictionJoint_GetType_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetType_0.apply(null,arguments)},ig=b._emscripten_bind_b2MouseJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetMaxForce_0.apply(null,arguments)},jg=b._emscripten_bind_b2MouseJoint_SetTarget_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetTarget_1.apply(null, +arguments)},kg=b._emscripten_bind_b2MouseJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_dampingRatio_0.apply(null,arguments)},lg=b._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0.apply(null,arguments)},mg=b._emscripten_bind_b2ChainShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_type_1.apply(null,arguments)},ng=b._emscripten_bind_b2RevoluteJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyB_1.apply(null,arguments)},og=b._emscripten_bind_b2Rot_GetXAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetXAxis_0.apply(null,arguments)},pg=b._emscripten_bind_b2Mat33_b2Mat33_0=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_0.apply(null,arguments)},qg=b._emscripten_bind_b2MouseJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyB_0.apply(null,arguments)},rg=b._emscripten_bind_b2Body_GetWorldVector_1= +function(){return b.asm._emscripten_bind_b2Body_GetWorldVector_1.apply(null,arguments)},sg=b._emscripten_bind_b2WeldJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_frequencyHz_0.apply(null,arguments)},tg=b._emscripten_bind_b2GearJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_ratio_1.apply(null,arguments)},ug=b._emscripten_bind_b2Manifold___destroy___0=function(){return b.asm._emscripten_bind_b2Manifold___destroy___0.apply(null, +arguments)},vg=b._emscripten_bind_b2PulleyJointDef_set_lengthA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthA_1.apply(null,arguments)},wg=b._emscripten_bind_b2Contact_IsEnabled_0=function(){return b.asm._emscripten_bind_b2Contact_IsEnabled_0.apply(null,arguments)};b.stackRestore=function(){return b.asm.stackRestore.apply(null,arguments)}; +var xg=b._emscripten_bind_b2World_CreateJoint_1=function(){return b.asm._emscripten_bind_b2World_CreateJoint_1.apply(null,arguments)},yg=b._emscripten_bind_b2PulleyJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_ratio_1.apply(null,arguments)},zg=b._emscripten_bind_b2JointEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_prev_1.apply(null,arguments)},Ag=b._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1.apply(null, +arguments)},Bg=b._emscripten_bind_b2Body_GetLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalPoint_1.apply(null,arguments)},Cg=b._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0.apply(null,arguments)},Dg=b._emscripten_bind_b2DistanceJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_IsActive_0.apply(null,arguments)},Eg=b._emscripten_bind_b2RopeJoint_GetLimitState_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLimitState_0.apply(null, +arguments)},Fg=b._emscripten_bind_b2Profile_get_solveTOI_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveTOI_0.apply(null,arguments)},Gg=b._emscripten_bind_b2Vec2_b2Vec2_0=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_0.apply(null,arguments)},Hg=b._emscripten_bind_b2DistanceJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorB_0.apply(null,arguments)},Ig=b._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0.apply(null, +arguments)},Jg=b._emscripten_bind_b2Vec2_op_sub_1=function(){return b.asm._emscripten_bind_b2Vec2_op_sub_1.apply(null,arguments)},Kg=b._emscripten_bind_b2CircleShape_get_m_p_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_p_0.apply(null,arguments)},Lg=b._emscripten_bind_b2ContactFeature_get_indexA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexA_0.apply(null,arguments)},Mg=b._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0.apply(null, +arguments)},Ng=b._emscripten_bind_b2RevoluteJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableLimit_1.apply(null,arguments)},Og=b._emscripten_bind_b2ContactEdge_get_next_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_next_0.apply(null,arguments)},Pg=b._emscripten_bind_b2AABB_GetPerimeter_0=function(){return b.asm._emscripten_bind_b2AABB_GetPerimeter_0.apply(null,arguments)},Qg=b._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0.apply(null, +arguments)},Rg=b._emscripten_bind_b2Mat33_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ex_0.apply(null,arguments)},Sg=b._emscripten_bind_b2Body_GetPosition_0=function(){return b.asm._emscripten_bind_b2Body_GetPosition_0.apply(null,arguments)},Tg=b._emscripten_bind_b2Profile___destroy___0=function(){return b.asm._emscripten_bind_b2Profile___destroy___0.apply(null,arguments)},Ug=b._emscripten_bind_b2ContactEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_prev_0.apply(null, +arguments)},Vg=b._emscripten_bind_b2DistanceJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetFrequency_1.apply(null,arguments)},Wg=b._emscripten_bind_b2Fixture_GetBody_0=function(){return b.asm._emscripten_bind_b2Fixture_GetBody_0.apply(null,arguments)},Xg=b._emscripten_bind_b2ContactImpulse_set_count_1=function(){return b.asm._emscripten_bind_b2ContactImpulse_set_count_1.apply(null,arguments)},Yg=b._emscripten_bind_b2FixtureDef_set_shape_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_shape_1.apply(null, +arguments)},Zg=b._emscripten_bind_b2PulleyJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyB_0.apply(null,arguments)},$g=b._emscripten_bind_b2ChainShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildCount_0.apply(null,arguments)},ah=b._emscripten_bind_b2CircleShape_b2CircleShape_0=function(){return b.asm._emscripten_bind_b2CircleShape_b2CircleShape_0.apply(null,arguments)},bh=b._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1.apply(null,arguments)},ch=b._emscripten_bind_b2Fixture_SetDensity_1=function(){return b.asm._emscripten_bind_b2Fixture_SetDensity_1.apply(null,arguments)},dh=b._emscripten_bind_b2ChainShape_get_m_prevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_prevVertex_0.apply(null,arguments)},eh=b._emscripten_bind_b2AABB_GetExtents_0=function(){return b.asm._emscripten_bind_b2AABB_GetExtents_0.apply(null,arguments)}, +fh=b._emscripten_bind_b2World_ClearForces_0=function(){return b.asm._emscripten_bind_b2World_ClearForces_0.apply(null,arguments)},gh=b._emscripten_bind_b2Vec3___destroy___0=function(){return b.asm._emscripten_bind_b2Vec3___destroy___0.apply(null,arguments)},hh=b._emscripten_bind_b2WheelJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_userData_1.apply(null,arguments)},ih=b._emscripten_bind_b2WeldJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetFrequency_1.apply(null, +arguments)},jh=b._emscripten_bind_JSContactListener_PreSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PreSolve_2.apply(null,arguments)},kh=b._emscripten_bind_b2Body_SetFixedRotation_1=function(){return b.asm._emscripten_bind_b2Body_SetFixedRotation_1.apply(null,arguments)},lh=b._emscripten_bind_b2RayCastOutput_set_normal_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_normal_1.apply(null,arguments)},mh=b._emscripten_bind_b2DistanceJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetDampingRatio_0.apply(null, +arguments)},nh=b._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1.apply(null,arguments)},oh=b._emscripten_bind_b2RevoluteJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableMotor_1.apply(null,arguments)},ph=b._emscripten_bind_b2Contact_GetChildIndexB_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexB_0.apply(null,arguments)},qh=b._emscripten_bind_b2MouseJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyB_1.apply(null,arguments)},rh=b._emscripten_bind_b2CircleShape_GetType_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetType_0.apply(null,arguments)},sh=b._emscripten_bind_b2PolygonShape_GetType_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetType_0.apply(null,arguments)},th=b._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1.apply(null, +arguments)},uh=b._emscripten_bind_b2RopeJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_collideConnected_0.apply(null,arguments)},vh=b._emscripten_bind_b2FixtureDef_set_filter_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_filter_1.apply(null,arguments)},wh=b._emscripten_bind_b2Body_ApplyTorque_2=function(){return b.asm._emscripten_bind_b2Body_ApplyTorque_2.apply(null,arguments)},xh=b._emscripten_bind_b2RevoluteJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJoint___destroy___0.apply(null, +arguments)},yh=b._emscripten_bind_b2FrictionJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_userData_0.apply(null,arguments)},zh=b._emscripten_bind_b2RayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastCallback___destroy___0.apply(null,arguments)},Ah=b._emscripten_bind_b2RevoluteJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyA_1.apply(null,arguments)},Bh=b._emscripten_bind_b2MotorJoint_SetUserData_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetUserData_1.apply(null,arguments)},Ch=b._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0.apply(null,arguments)},Dh=b._emscripten_bind_b2MotorJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyB_0.apply(null,arguments)},Eh=b._emscripten_bind_b2Transform_Set_2=function(){return b.asm._emscripten_bind_b2Transform_Set_2.apply(null,arguments)},Fh= +b._emscripten_bind_b2MotorJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyA_0.apply(null,arguments)};b.stackAlloc=function(){return b.asm.stackAlloc.apply(null,arguments)}; +var Gh=b._emscripten_bind_b2Draw_AppendFlags_1=function(){return b.asm._emscripten_bind_b2Draw_AppendFlags_1.apply(null,arguments)},Hh=b._emscripten_bind_b2EdgeShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetChildCount_0.apply(null,arguments)},Ih=b._emscripten_bind_b2Contact_ResetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_ResetFriction_0.apply(null,arguments)},Jh=b._emscripten_bind_b2Profile_set_solveTOI_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveTOI_1.apply(null, +arguments)},Kh=b._emscripten_bind_b2PrismaticJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_type_1.apply(null,arguments)},Lh=b._emscripten_bind_b2AABB_GetCenter_0=function(){return b.asm._emscripten_bind_b2AABB_GetCenter_0.apply(null,arguments)},Mh=b._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1.apply(null,arguments)},Nh=b._emscripten_bind_b2FrictionJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJointDef___destroy___0.apply(null, +arguments)},Oh=b._emscripten_bind_b2PrismaticJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionForce_1.apply(null,arguments)},Ph=b._emscripten_bind_b2Transform_b2Transform_0=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_0.apply(null,arguments)},Qh=b._emscripten_enum_b2LimitState_e_equalLimits=function(){return b.asm._emscripten_enum_b2LimitState_e_equalLimits.apply(null,arguments)},Rh=b._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1.apply(null,arguments)},Sh=b._emscripten_bind_b2Body_IsFixedRotation_0=function(){return b.asm._emscripten_bind_b2Body_IsFixedRotation_0.apply(null,arguments)},Th=b._emscripten_enum_b2DrawFlag_e_shapeBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_shapeBit.apply(null,arguments)},Uh=b._emscripten_bind_b2Contact_GetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_GetFriction_0.apply(null,arguments)},Vh= +b._emscripten_bind_b2Body_GetContactList_0=function(){return b.asm._emscripten_bind_b2Body_GetContactList_0.apply(null,arguments)},Wh=b._emscripten_bind_b2DistanceJointDef_set_length_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_length_1.apply(null,arguments)},Xh=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0.apply(null,arguments)},Yh=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0.apply(null, +arguments)},Zh=b._emscripten_bind_b2World_b2World_1=function(){return b.asm._emscripten_bind_b2World_b2World_1.apply(null,arguments)},$h=b._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0.apply(null,arguments)},ai=b._emscripten_bind_b2DistanceJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_type_0.apply(null,arguments)},bi=b._emscripten_bind_b2Draw_ClearFlags_1=function(){return b.asm._emscripten_bind_b2Draw_ClearFlags_1.apply(null, +arguments)},ci=b._emscripten_bind_b2Body_SetAngularDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularDamping_1.apply(null,arguments)},di=b._emscripten_bind_b2Body_IsActive_0=function(){return b.asm._emscripten_bind_b2Body_IsActive_0.apply(null,arguments)},ei=b._emscripten_bind_b2Contact_ResetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_ResetRestitution_0.apply(null,arguments)},fi=b._emscripten_bind_b2World_GetAllowSleeping_0=function(){return b.asm._emscripten_bind_b2World_GetAllowSleeping_0.apply(null, +arguments)},gi=b._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0.apply(null,arguments)},hi=b._emscripten_bind_b2EdgeShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_type_1.apply(null,arguments)},ii=b._emscripten_enum_b2JointType_e_unknownJoint=function(){return b.asm._emscripten_enum_b2JointType_e_unknownJoint.apply(null,arguments)},ji=b._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1.apply(null,arguments)},ki=b._emscripten_bind_b2PulleyJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_IsActive_0.apply(null,arguments)},li=b._emscripten_bind_b2MouseJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetNext_0.apply(null,arguments)},mi=b._emscripten_bind_b2RevoluteJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetUserData_1.apply(null, +arguments)},ni=b._emscripten_bind_b2Manifold_get_localPoint_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localPoint_0.apply(null,arguments)},oi=b._emscripten_bind_b2PulleyJointDef_get_lengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthB_0.apply(null,arguments)},pi=b._emscripten_bind_b2WeldJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetUserData_1.apply(null,arguments)},qi=b._emscripten_bind_b2ChainShape_CreateLoop_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateLoop_2.apply(null, +arguments)},ri=b._emscripten_bind_b2GearJointDef_get_joint1_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint1_0.apply(null,arguments)},si=b._emscripten_bind_b2PrismaticJoint_GetMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorForce_1.apply(null,arguments)},ti=b._emscripten_bind_b2Body_SetUserData_1=function(){return b.asm._emscripten_bind_b2Body_SetUserData_1.apply(null,arguments)},ui=b._emscripten_bind_b2GearJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2GearJoint_IsActive_0.apply(null, +arguments)},vi=b._emscripten_bind_b2EdgeShape_get_m_vertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex0_0.apply(null,arguments)},wi=b._emscripten_enum_b2JointType_e_revoluteJoint=function(){return b.asm._emscripten_enum_b2JointType_e_revoluteJoint.apply(null,arguments)},xi=b._emscripten_bind_b2Vec2_get_x_0=function(){return b.asm._emscripten_bind_b2Vec2_get_x_0.apply(null,arguments)},yi=b._emscripten_bind_b2WeldJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_collideConnected_0.apply(null, +arguments)},zi=b._emscripten_bind_b2FrictionJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxTorque_0.apply(null,arguments)},Ai=b._emscripten_bind_b2EdgeShape_RayCast_4=function(){return b.asm._emscripten_bind_b2EdgeShape_RayCast_4.apply(null,arguments)},Bi=b._emscripten_bind_b2BodyDef_set_allowSleep_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_allowSleep_1.apply(null,arguments)},Ci=b._emscripten_bind_b2PulleyJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetType_0.apply(null, +arguments)},Di=b._emscripten_bind_b2WeldJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorA_1.apply(null,arguments)},Ei=b._emscripten_bind_b2Profile_set_step_1=function(){return b.asm._emscripten_bind_b2Profile_set_step_1.apply(null,arguments)},Fi=b._emscripten_bind_b2ContactEdge_set_other_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_other_1.apply(null,arguments)},Gi=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0.apply(null, +arguments)},Hi=b._emscripten_bind_b2Vec2_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec2_op_mul_1.apply(null,arguments)},Ii=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0.apply(null,arguments)},Ji=b._emscripten_bind_b2EdgeShape___destroy___0=function(){return b.asm._emscripten_bind_b2EdgeShape___destroy___0.apply(null,arguments)},Ki=b._emscripten_bind_b2PolygonShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_count_0.apply(null, +arguments)},Li=b._emscripten_bind_b2RopeJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorA_0.apply(null,arguments)},Mi=b._emscripten_bind_b2DistanceJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyA_0.apply(null,arguments)},Ni=b._emscripten_bind_b2AABB_Combine_2=function(){return b.asm._emscripten_bind_b2AABB_Combine_2.apply(null,arguments)},Oi=b._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1.apply(null, +arguments)},Pi=b._emscripten_bind_b2BodyDef_get_allowSleep_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_allowSleep_0.apply(null,arguments)},Qi=b._emscripten_bind_b2ContactEdge_get_other_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_other_0.apply(null,arguments)},Ri=b._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0.apply(null,arguments)},Si=b._emscripten_bind_b2PulleyJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJointDef___destroy___0.apply(null, +arguments)},Ti=b._emscripten_bind_b2MouseJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyB_0.apply(null,arguments)},Ui=b._emscripten_bind_b2PolygonShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2PolygonShape_TestPoint_2.apply(null,arguments)},Vi=b._emscripten_bind_b2JointEdge_get_other_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_other_0.apply(null,arguments)},Wi=b._emscripten_bind_b2PolygonShape_b2PolygonShape_0=function(){return b.asm._emscripten_bind_b2PolygonShape_b2PolygonShape_0.apply(null, +arguments)},Xi=b._emscripten_bind_b2PolygonShape_Set_2=function(){return b.asm._emscripten_bind_b2PolygonShape_Set_2.apply(null,arguments)},Yi=b._emscripten_bind_b2GearJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionForce_1.apply(null,arguments)},Zi=b._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0.apply(null,arguments)},$i=b._emscripten_bind_b2Fixture_SetUserData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetUserData_1.apply(null, +arguments)},aj=b._emscripten_bind_b2Contact_SetTangentSpeed_1=function(){return b.asm._emscripten_bind_b2Contact_SetTangentSpeed_1.apply(null,arguments)},bj=b._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0.apply(null,arguments)},cj=b._emscripten_bind_b2BodyDef_get_active_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_active_0.apply(null,arguments)},dj=b._emscripten_bind_b2Body_GetAngularVelocity_0= +function(){return b.asm._emscripten_bind_b2Body_GetAngularVelocity_0.apply(null,arguments)},ej=b._emscripten_bind_b2CircleShape_set_m_p_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_p_1.apply(null,arguments)},fj=b._emscripten_bind_b2Draw___destroy___0=function(){return b.asm._emscripten_bind_b2Draw___destroy___0.apply(null,arguments)},gj=b._emscripten_bind_b2WheelJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2WheelJointDef_Initialize_4.apply(null,arguments)},hj= +b._emscripten_bind_b2WeldJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_dampingRatio_1.apply(null,arguments)},ij=b._emscripten_bind_b2ChainShape_b2ChainShape_0=function(){return b.asm._emscripten_bind_b2ChainShape_b2ChainShape_0.apply(null,arguments)},jj=b._emscripten_bind_b2Joint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorB_0.apply(null,arguments)},kj=b._emscripten_bind_b2PrismaticJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_userData_0.apply(null, +arguments)},lj=b._emscripten_bind_b2MotorJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxForce_0.apply(null,arguments)},mj=b._emscripten_bind_b2RevoluteJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyA_0.apply(null,arguments)},nj=b._emscripten_bind_b2ContactID_set_cf_1=function(){return b.asm._emscripten_bind_b2ContactID_set_cf_1.apply(null,arguments)},oj=b._emscripten_bind_b2Body_GetGravityScale_0=function(){return b.asm._emscripten_bind_b2Body_GetGravityScale_0.apply(null, +arguments)},pj=b._emscripten_bind_b2Vec3_Set_3=function(){return b.asm._emscripten_bind_b2Vec3_Set_3.apply(null,arguments)},qj=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1.apply(null,arguments)},rj=b._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1.apply(null,arguments)},sj=b._emscripten_bind_b2PulleyJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetNext_0.apply(null, +arguments)},tj=b._emscripten_bind_b2ChainShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_type_0.apply(null,arguments)},uj=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0.apply(null,arguments)},vj=b._emscripten_bind_JSDraw_DrawTransform_1=function(){return b.asm._emscripten_bind_JSDraw_DrawTransform_1.apply(null,arguments)},wj=b._emscripten_bind_b2GearJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyA_0.apply(null, +arguments)},xj=b._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1.apply(null,arguments)},yj=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0.apply(null,arguments)},zj=b._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0.apply(null,arguments)},Aj= +b._emscripten_bind_JSContactFilter___destroy___0=function(){return b.asm._emscripten_bind_JSContactFilter___destroy___0.apply(null,arguments)},Bj=b._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0.apply(null,arguments)},Cb=b._memset=function(){return b.asm._memset.apply(null,arguments)},Cj=b._emscripten_bind_b2PolygonShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_radius_0.apply(null, +arguments)},Dj=b._emscripten_enum_b2BodyType_b2_kinematicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_kinematicBody.apply(null,arguments)},Ej=b._emscripten_bind_b2Rot_set_s_1=function(){return b.asm._emscripten_bind_b2Rot_set_s_1.apply(null,arguments)},Fj=b._emscripten_enum_b2ManifoldType_e_faceA=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceA.apply(null,arguments)},Gj=b._emscripten_enum_b2ManifoldType_e_faceB=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceB.apply(null, +arguments)},Hj=b._emscripten_bind_b2RevoluteJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyB_0.apply(null,arguments)},Ij=b._emscripten_bind_b2FixtureDef_b2FixtureDef_0=function(){return b.asm._emscripten_bind_b2FixtureDef_b2FixtureDef_0.apply(null,arguments)},Jj=b._emscripten_bind_b2PrismaticJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetUserData_1.apply(null,arguments)},Kj=b._emscripten_bind_b2WorldManifold_set_points_2= +function(){return b.asm._emscripten_bind_b2WorldManifold_set_points_2.apply(null,arguments)},Lj=b._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0.apply(null,arguments)},Mj=b._emscripten_enum_b2ShapeType_e_edge=function(){return b.asm._emscripten_enum_b2ShapeType_e_edge.apply(null,arguments)},Nj=b._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0.apply(null, +arguments)},Oj=b._emscripten_bind_b2BodyDef_set_active_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_active_1.apply(null,arguments)},Pj=b._emscripten_bind_b2EdgeShape_Set_2=function(){return b.asm._emscripten_bind_b2EdgeShape_Set_2.apply(null,arguments)},Qj=b._emscripten_bind_b2FixtureDef_set_isSensor_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_isSensor_1.apply(null,arguments)},Rj=b._emscripten_bind_b2Body_GetWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetWorldPoint_1.apply(null, +arguments)},Sj=b._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0.apply(null,arguments)},Tj=b._emscripten_bind_JSContactFilter_ShouldCollide_2=function(){return b.asm._emscripten_bind_JSContactFilter_ShouldCollide_2.apply(null,arguments)},Uj=b._emscripten_bind_b2Joint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionTorque_1.apply(null,arguments)},Vj=b._emscripten_bind_b2RevoluteJointDef_set_type_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_type_1.apply(null,arguments)},Wj=b._emscripten_bind_b2RayCastInput_set_p1_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_p1_1.apply(null,arguments)},Xj=b._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0.apply(null,arguments)},Yj=b._emscripten_bind_b2BodyDef_get_linearDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearDamping_0.apply(null, +arguments)},Zj=b._emscripten_bind_b2World_Step_3=function(){return b.asm._emscripten_bind_b2World_Step_3.apply(null,arguments)},ak=b._emscripten_bind_b2CircleShape_RayCast_4=function(){return b.asm._emscripten_bind_b2CircleShape_RayCast_4.apply(null,arguments)},bk=b._emscripten_bind_b2Profile_get_step_0=function(){return b.asm._emscripten_bind_b2Profile_get_step_0.apply(null,arguments)},ck=b._emscripten_bind_b2AABB_RayCast_2=function(){return b.asm._emscripten_bind_b2AABB_RayCast_2.apply(null,arguments)}, +dk=b._emscripten_bind_b2Mat22_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat22_SetZero_0.apply(null,arguments)};b.setTempRet0=function(){return b.asm.setTempRet0.apply(null,arguments)}; +var ek=b._emscripten_bind_b2DistanceJoint_GetLength_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLength_0.apply(null,arguments)},fk=b._emscripten_bind_b2PulleyJoint_GetLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthB_0.apply(null,arguments)},gk=b._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0.apply(null,arguments)},hk=b._emscripten_bind_b2WorldManifold_set_separations_2=function(){return b.asm._emscripten_bind_b2WorldManifold_set_separations_2.apply(null, +arguments)},ik=b._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1.apply(null,arguments)},jk=b._emscripten_bind_b2MotorJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetUserData_0.apply(null,arguments)},kk=b._emscripten_bind_b2FrictionJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionTorque_1.apply(null,arguments)},lk=b._emscripten_bind_b2Shape_get_m_type_0= +function(){return b.asm._emscripten_bind_b2Shape_get_m_type_0.apply(null,arguments)},mk=b._emscripten_bind_b2MouseJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetDampingRatio_1.apply(null,arguments)},nk=b._emscripten_bind_b2World_GetAutoClearForces_0=function(){return b.asm._emscripten_bind_b2World_GetAutoClearForces_0.apply(null,arguments)},ok=b._emscripten_bind_b2WorldManifold_set_normal_1=function(){return b.asm._emscripten_bind_b2WorldManifold_set_normal_1.apply(null, +arguments)},pk=b._emscripten_enum_b2ShapeType_e_circle=function(){return b.asm._emscripten_enum_b2ShapeType_e_circle.apply(null,arguments)},qk=b._emscripten_bind_b2BodyDef_set_fixedRotation_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_fixedRotation_1.apply(null,arguments)},rk=b._emscripten_bind_b2Vec2_b2Vec2_2=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_2.apply(null,arguments)},sk=b._emscripten_bind_b2Manifold_get_type_0=function(){return b.asm._emscripten_bind_b2Manifold_get_type_0.apply(null, +arguments)},tk=b._emscripten_bind_b2Body_Dump_0=function(){return b.asm._emscripten_bind_b2Body_Dump_0.apply(null,arguments)},uk=b._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0.apply(null,arguments)},vk=b._emscripten_bind_b2Body_GetWorldCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetWorldCenter_0.apply(null,arguments)},wk=b._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1.apply(null, +arguments)},xk=b._emscripten_bind_b2BodyDef_set_linearVelocity_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearVelocity_1.apply(null,arguments)},yk=b._emscripten_bind_b2JointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2JointDef_set_collideConnected_1.apply(null,arguments)},zk=b._emscripten_bind_b2MotorJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJoint___destroy___0.apply(null,arguments)},Ak=b._emscripten_bind_b2Body_GetUserData_0=function(){return b.asm._emscripten_bind_b2Body_GetUserData_0.apply(null, +arguments)},Bk=b._emscripten_bind_b2Body_GetAngularDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetAngularDamping_0.apply(null,arguments)},Ck=b._emscripten_bind_b2Fixture_RayCast_3=function(){return b.asm._emscripten_bind_b2Fixture_RayCast_3.apply(null,arguments)},Dk=b._emscripten_bind_b2JointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyA_1.apply(null,arguments)},Ek=b._emscripten_bind_b2GearJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_collideConnected_0.apply(null, +arguments)},Fk=b._emscripten_bind_b2RopeJointDef_get_maxLength_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_maxLength_0.apply(null,arguments)},Gk=b._emscripten_bind_b2MouseJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyA_0.apply(null,arguments)},Hk=b._emscripten_bind_b2Body_SetBullet_1=function(){return b.asm._emscripten_bind_b2Body_SetBullet_1.apply(null,arguments)},Ik=b._emscripten_bind_b2DistanceJoint_GetType_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetType_0.apply(null, +arguments)},Jk=b._emscripten_bind_b2FixtureDef_get_restitution_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_restitution_0.apply(null,arguments)},Kk=b._emscripten_bind_b2Fixture_GetType_0=function(){return b.asm._emscripten_bind_b2Fixture_GetType_0.apply(null,arguments)},Lk=b._emscripten_bind_b2WheelJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_enableMotor_1.apply(null,arguments)},Mk=b._emscripten_bind_b2RevoluteJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyB_0.apply(null, +arguments)},Nk=b._emscripten_bind_b2Profile_set_solveInit_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveInit_1.apply(null,arguments)},Ok=b._emscripten_bind_b2RopeJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_type_1.apply(null,arguments)},Pk=b._emscripten_bind_b2PrismaticJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyB_0.apply(null,arguments)},Qk=b._emscripten_bind_b2GearJoint_GetJoint2_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint2_0.apply(null, +arguments)},Rk=b._emscripten_bind_b2PulleyJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_userData_0.apply(null,arguments)},Sk=b._emscripten_bind_b2PrismaticJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyB_1.apply(null,arguments)},Tk=b._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0.apply(null,arguments)},Uk=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0= +function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0.apply(null,arguments)},Vk=b._emscripten_bind_b2Manifold_get_localNormal_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localNormal_0.apply(null,arguments)},Wk=b._emscripten_bind_b2Vec3_b2Vec3_0=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_0.apply(null,arguments)},Xk=b._emscripten_bind_b2Body_SetSleepingAllowed_1=function(){return b.asm._emscripten_bind_b2Body_SetSleepingAllowed_1.apply(null,arguments)}, +Yk=b._emscripten_bind_b2DistanceJoint___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJoint___destroy___0.apply(null,arguments)},Zk=b._emscripten_bind_b2PrismaticJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorA_0.apply(null,arguments)},$k=b._emscripten_bind_b2Manifold_set_pointCount_1=function(){return b.asm._emscripten_bind_b2Manifold_set_pointCount_1.apply(null,arguments)},al=b._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0.apply(null, +arguments)},bl=b._emscripten_bind_b2WeldJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetFrequency_0.apply(null,arguments)},cl=b._emscripten_bind_b2Joint_GetUserData_0=function(){return b.asm._emscripten_bind_b2Joint_GetUserData_0.apply(null,arguments)},dl=b._emscripten_bind_b2WorldManifold_get_points_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_points_1.apply(null,arguments)},el=b._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0.apply(null, +arguments)},fl=b._emscripten_bind_b2Manifold_set_type_1=function(){return b.asm._emscripten_bind_b2Manifold_set_type_1.apply(null,arguments)},gl=b._emscripten_bind_b2Vec3_b2Vec3_3=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_3.apply(null,arguments)},hl=b._emscripten_bind_b2RopeJointDef_set_maxLength_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_maxLength_1.apply(null,arguments)},il=b._emscripten_bind_b2ChainShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2ChainShape_TestPoint_2.apply(null, +arguments)},jl=b._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0.apply(null,arguments)},kl=b._emscripten_bind_b2RayCastInput_get_p2_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p2_0.apply(null,arguments)},ll=b._emscripten_bind_b2BodyDef_set_angle_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angle_1.apply(null,arguments)},ml=b._emscripten_bind_b2WeldJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetUserData_0.apply(null, +arguments)},nl=b._emscripten_bind_b2WheelJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorA_0.apply(null,arguments)},ol=b._emscripten_bind_b2PulleyJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_type_1.apply(null,arguments)},pl=b._emscripten_bind_b2Body_IsBullet_0=function(){return b.asm._emscripten_bind_b2Body_IsBullet_0.apply(null,arguments)},ql=b._emscripten_bind_b2MotorJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyA_1.apply(null, +arguments)},rl=b._emscripten_bind_b2Fixture_TestPoint_1=function(){return b.asm._emscripten_bind_b2Fixture_TestPoint_1.apply(null,arguments)},sl=b._emscripten_bind_b2Mat33_GetSymInverse33_1=function(){return b.asm._emscripten_bind_b2Mat33_GetSymInverse33_1.apply(null,arguments)},tl=b._emscripten_bind_JSDraw_DrawPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawPolygon_3.apply(null,arguments)},ul=b._emscripten_bind_b2PolygonShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeMass_2.apply(null, +arguments)},vl=b._emscripten_bind_b2PrismaticJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableMotor_1.apply(null,arguments)},wl=b._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1.apply(null,arguments)},xl=b._emscripten_bind_b2MouseJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetFrequency_1.apply(null,arguments)},yl=b._emscripten_bind_b2EdgeShape_get_m_vertex1_0= +function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex1_0.apply(null,arguments)},zl=b._emscripten_bind_b2BodyDef_set_awake_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_awake_1.apply(null,arguments)},Al=b._emscripten_bind_b2Vec2_get_y_0=function(){return b.asm._emscripten_bind_b2Vec2_get_y_0.apply(null,arguments)},Bl=b._emscripten_bind_b2Filter_set_categoryBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_categoryBits_1.apply(null,arguments)},Cl=b._emscripten_bind_b2Body_CreateFixture_2= +function(){return b.asm._emscripten_bind_b2Body_CreateFixture_2.apply(null,arguments)},Dl=b._emscripten_bind_b2Body_SetActive_1=function(){return b.asm._emscripten_bind_b2Body_SetActive_1.apply(null,arguments)},El=b._emscripten_bind_b2ContactFeature_get_indexB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexB_0.apply(null,arguments)},Fl=b._emscripten_bind_b2Fixture_GetUserData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetUserData_0.apply(null,arguments)},Gl=b._emscripten_bind_b2PolygonShape_ComputeAABB_3= +function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeAABB_3.apply(null,arguments)},Hl=b._emscripten_bind_b2ContactFeature_get_typeA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeA_0.apply(null,arguments)},Il=b._emscripten_bind_b2MouseJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_maxForce_1.apply(null,arguments)},Jl=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0.apply(null, +arguments)},Kl=b._emscripten_bind_b2EdgeShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2EdgeShape_TestPoint_2.apply(null,arguments)},Ll=b._emscripten_bind_b2WorldManifold_Initialize_5=function(){return b.asm._emscripten_bind_b2WorldManifold_Initialize_5.apply(null,arguments)},Ml=b._emscripten_bind_b2PolygonShape_get_m_centroid_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_centroid_0.apply(null,arguments)},Nl=b._emscripten_bind_b2ChainShape___destroy___0=function(){return b.asm._emscripten_bind_b2ChainShape___destroy___0.apply(null, +arguments)},Ol=b._emscripten_bind_b2GearJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetUserData_1.apply(null,arguments)},Pl=b._emscripten_bind_b2Vec3_set_z_1=function(){return b.asm._emscripten_bind_b2Vec3_set_z_1.apply(null,arguments)},Ql=b._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1.apply(null,arguments)},Rl=b._emscripten_bind_b2DistanceJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetFrequency_0.apply(null, +arguments)},Sl=b._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0.apply(null,arguments)},Tl=b._emscripten_bind_b2Body_SetGravityScale_1=function(){return b.asm._emscripten_bind_b2Body_SetGravityScale_1.apply(null,arguments)},Ul=b._emscripten_enum_b2ContactFeatureType_e_face=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_face.apply(null,arguments)},Vl=b._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0.apply(null,arguments)},Wl=b._emscripten_bind_b2PulleyJointDef_get_lengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthA_0.apply(null,arguments)},Xl=b._emscripten_bind_b2Vec3_set_x_1=function(){return b.asm._emscripten_bind_b2Vec3_set_x_1.apply(null,arguments)},Yl=b._emscripten_bind_b2PulleyJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_type_0.apply(null,arguments)}, +Zl=b._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1.apply(null,arguments)},$l=b._emscripten_bind_b2Shape___destroy___0=function(){return b.asm._emscripten_bind_b2Shape___destroy___0.apply(null,arguments)},am=b._emscripten_bind_b2Joint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionForce_1.apply(null,arguments)},bm=b._emscripten_bind_b2FixtureDef_set_friction_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_friction_1.apply(null, +arguments)},cm=b._emscripten_bind_b2ContactID___destroy___0=function(){return b.asm._emscripten_bind_b2ContactID___destroy___0.apply(null,arguments)},dm=b._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0.apply(null,arguments)},em=b._emscripten_bind_b2World_GetBodyCount_0=function(){return b.asm._emscripten_bind_b2World_GetBodyCount_0.apply(null,arguments)},fm=b._emscripten_bind_b2JointEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_prev_0.apply(null, +arguments)},gm=b._emscripten_bind_b2MotorJointDef_get_linearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_linearOffset_0.apply(null,arguments)},hm=b._emscripten_bind_b2MotorJointDef_Initialize_2=function(){return b.asm._emscripten_bind_b2MotorJointDef_Initialize_2.apply(null,arguments)},im=b._emscripten_bind_b2PrismaticJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorB_0.apply(null,arguments)},jm=b._emscripten_bind_b2Body_SetLinearVelocity_1= +function(){return b.asm._emscripten_bind_b2Body_SetLinearVelocity_1.apply(null,arguments)},km=b._emscripten_enum_b2BodyType_b2_staticBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_staticBody.apply(null,arguments)},lm=b._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1.apply(null,arguments)},mm=b._emscripten_bind_b2RevoluteJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_type_0.apply(null, +arguments)},nm=b._emscripten_bind_b2GearJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_type_0.apply(null,arguments)},om=b._emscripten_bind_b2ChainShape_GetType_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetType_0.apply(null,arguments)},pm=b._emscripten_bind_b2RayCastInput_get_maxFraction_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_maxFraction_0.apply(null,arguments)},qm=b._emscripten_bind_b2GearJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyA_0.apply(null, +arguments)},rm=b._emscripten_bind_b2Body_GetLocalVector_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalVector_1.apply(null,arguments)},sm=b._emscripten_bind_b2PrismaticJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableLimit_1.apply(null,arguments)},tm=b._emscripten_bind_b2FrictionJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxForce_0.apply(null,arguments)},um=b._emscripten_bind_b2BodyDef_set_angularVelocity_1= +function(){return b.asm._emscripten_bind_b2BodyDef_set_angularVelocity_1.apply(null,arguments)},wm=b._emscripten_bind_b2Body_SetLinearDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetLinearDamping_1.apply(null,arguments)},xm=b._emscripten_bind_b2WheelJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyB_0.apply(null,arguments)},ym=b._emscripten_bind_b2GearJointDef_get_joint2_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint2_0.apply(null,arguments)}, +zm=b._emscripten_bind_b2PrismaticJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsActive_0.apply(null,arguments)},Am=b._emscripten_bind_b2Vec3_get_z_0=function(){return b.asm._emscripten_bind_b2Vec3_get_z_0.apply(null,arguments)},Bm=b._emscripten_bind_b2Filter_get_categoryBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_categoryBits_0.apply(null,arguments)},Cm=b._emscripten_bind_b2Color_get_r_0=function(){return b.asm._emscripten_bind_b2Color_get_r_0.apply(null, +arguments)},Dm=b._emscripten_enum_b2JointType_e_weldJoint=function(){return b.asm._emscripten_enum_b2JointType_e_weldJoint.apply(null,arguments)},Em=b._emscripten_bind_b2World_SetContinuousPhysics_1=function(){return b.asm._emscripten_bind_b2World_SetContinuousPhysics_1.apply(null,arguments)},Fm=b._emscripten_bind_b2MouseJointDef_get_target_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_target_0.apply(null,arguments)},Gm=b._emscripten_bind_b2Body_SetTransform_2=function(){return b.asm._emscripten_bind_b2Body_SetTransform_2.apply(null, +arguments)},Hm=b._emscripten_bind_b2PulleyJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_userData_1.apply(null,arguments)},Im=b._emscripten_bind_b2FrictionJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxForce_1.apply(null,arguments)},Jm=b._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0.apply(null,arguments)},Km=b._emscripten_bind_b2BodyDef_get_type_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_type_0.apply(null,arguments)},Lm=b._emscripten_bind_b2Mat33_GetInverse22_1=function(){return b.asm._emscripten_bind_b2Mat33_GetInverse22_1.apply(null,arguments)},Mm=b._emscripten_bind_b2PulleyJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorB_0.apply(null,arguments)},Nm=b._emscripten_bind_b2WheelJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionTorque_1.apply(null,arguments)}, +Om=b._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0.apply(null,arguments)},Pm=b._emscripten_bind_b2ContactFeature_set_typeA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeA_1.apply(null,arguments)},Qm=b._emscripten_bind_b2Fixture_Dump_1=function(){return b.asm._emscripten_bind_b2Fixture_Dump_1.apply(null,arguments)},Rm=b._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0.apply(null, +arguments)},Sm=b._emscripten_bind_b2Manifold_set_localPoint_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localPoint_1.apply(null,arguments)},Tm=b._emscripten_bind_b2JointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2JointDef_get_userData_0.apply(null,arguments)},Um=b._emscripten_bind_b2BodyDef_set_bullet_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_bullet_1.apply(null,arguments)},Vm=b._emscripten_bind_b2WorldManifold___destroy___0=function(){return b.asm._emscripten_bind_b2WorldManifold___destroy___0.apply(null, +arguments)},Wm=b._emscripten_bind_b2RayCastOutput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastOutput___destroy___0.apply(null,arguments)},Xm=b._emscripten_bind_JSContactListener___destroy___0=function(){return b.asm._emscripten_bind_JSContactListener___destroy___0.apply(null,arguments)},Ym=b._emscripten_bind_b2World_DrawDebugData_0=function(){return b.asm._emscripten_bind_b2World_DrawDebugData_0.apply(null,arguments)}; +b.___cxa_can_catch=function(){return b.asm.___cxa_can_catch.apply(null,arguments)}; +var Zm=b._emscripten_bind_b2RopeJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorA_0.apply(null,arguments)},$m=b._emscripten_bind_b2Profile_set_solveVelocity_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveVelocity_1.apply(null,arguments)},an=b._emscripten_bind_b2GearJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_userData_0.apply(null,arguments)},bn=b._emscripten_bind_b2Filter_set_groupIndex_1=function(){return b.asm._emscripten_bind_b2Filter_set_groupIndex_1.apply(null, +arguments)},cn=b._emscripten_bind_b2JointDef_b2JointDef_0=function(){return b.asm._emscripten_bind_b2JointDef_b2JointDef_0.apply(null,arguments)},dn=b._emscripten_bind_b2Rot_set_c_1=function(){return b.asm._emscripten_bind_b2Rot_set_c_1.apply(null,arguments)},en=b._emscripten_bind_b2GearJointDef_b2GearJointDef_0=function(){return b.asm._emscripten_bind_b2GearJointDef_b2GearJointDef_0.apply(null,arguments)},fn=b._emscripten_bind_b2JointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyB_0.apply(null, +arguments)},gn=b._emscripten_bind_b2DistanceJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionForce_1.apply(null,arguments)},hn=b._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0.apply(null,arguments)},jn=b._emscripten_bind_b2MouseJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_frequencyHz_1.apply(null,arguments)},kn=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0.apply(null,arguments)},ln=b._emscripten_bind_b2Joint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorA_0.apply(null,arguments)},mn=b._emscripten_bind_b2Contact_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_GetRestitution_0.apply(null,arguments)},nn=b._emscripten_bind_b2ContactEdge_get_contact_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_contact_0.apply(null,arguments)}, +on=b._emscripten_bind_b2RevoluteJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_userData_0.apply(null,arguments)},pn=b._emscripten_bind_b2Body_ResetMassData_0=function(){return b.asm._emscripten_bind_b2Body_ResetMassData_0.apply(null,arguments)},qn=b._emscripten_bind_b2Fixture_GetAABB_1=function(){return b.asm._emscripten_bind_b2Fixture_GetAABB_1.apply(null,arguments)},rn=b._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1.apply(null, +arguments)},sn=b._emscripten_bind_b2Body_GetMassData_1=function(){return b.asm._emscripten_bind_b2Body_GetMassData_1.apply(null,arguments)},tn=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0.apply(null,arguments)},un=b._emscripten_bind_b2EdgeShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeMass_2.apply(null,arguments)},vn=b._emscripten_bind_b2GearJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyB_0.apply(null, +arguments)},wn=b._emscripten_enum_b2LimitState_e_atLowerLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atLowerLimit.apply(null,arguments)},xn=b._emscripten_bind_b2ManifoldPoint_set_id_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_id_1.apply(null,arguments)},yn=b._emscripten_bind_b2WheelJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyB_0.apply(null,arguments)},zn=b._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0.apply(null, +arguments)},An=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1.apply(null,arguments)},Bn=b._emscripten_bind_b2Body_DestroyFixture_1=function(){return b.asm._emscripten_bind_b2Body_DestroyFixture_1.apply(null,arguments)},Cn=b._emscripten_bind_b2Profile_set_broadphase_1=function(){return b.asm._emscripten_bind_b2Profile_set_broadphase_1.apply(null,arguments)},Dn=b._emscripten_bind_b2WheelJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorB_0.apply(null,arguments)},En=b._emscripten_bind_b2ContactImpulse_get_count_0=function(){return b.asm._emscripten_bind_b2ContactImpulse_get_count_0.apply(null,arguments)},Fn=b._emscripten_bind_b2World_GetJointCount_0=function(){return b.asm._emscripten_bind_b2World_GetJointCount_0.apply(null,arguments)},Gn=b._emscripten_bind_b2WheelJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorSpeed_0.apply(null, +arguments)},Hn=b._emscripten_bind_b2WheelJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_dampingRatio_0.apply(null,arguments)},In=b._emscripten_bind_b2RayCastOutput_get_fraction_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_fraction_0.apply(null,arguments)},Jn=b._emscripten_bind_b2AABB___destroy___0=function(){return b.asm._emscripten_bind_b2AABB___destroy___0.apply(null,arguments)},Kn=b._emscripten_bind_b2GearJoint_SetRatio_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetRatio_1.apply(null, +arguments)},Ln=b._emscripten_bind_b2Body_ApplyLinearImpulse_3=function(){return b.asm._emscripten_bind_b2Body_ApplyLinearImpulse_3.apply(null,arguments)},Mn=b._emscripten_bind_b2Filter___destroy___0=function(){return b.asm._emscripten_bind_b2Filter___destroy___0.apply(null,arguments)},Nn=b._emscripten_bind_b2RopeJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_userData_0.apply(null,arguments)}; +b.___cxa_is_pointer_type=function(){return b.asm.___cxa_is_pointer_type.apply(null,arguments)}; +var On=b._emscripten_bind_b2BodyDef_get_fixedRotation_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_fixedRotation_0.apply(null,arguments)},Pn=b._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1.apply(null,arguments)},Qn=b._emscripten_bind_b2ChainShape_SetPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetPrevVertex_1.apply(null,arguments)},Rn=b._emscripten_bind_b2MotorJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MotorJoint_IsActive_0.apply(null, +arguments)},Sn=b._emscripten_bind_b2MouseJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionTorque_1.apply(null,arguments)},Tn=b._emscripten_bind_b2DistanceJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_collideConnected_1.apply(null,arguments)},Un=b._emscripten_bind_b2WheelJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetUserData_0.apply(null,arguments)},Vn=b._emscripten_bind_b2Vec3_op_sub_1= +function(){return b.asm._emscripten_bind_b2Vec3_op_sub_1.apply(null,arguments)},Wn=b._emscripten_bind_b2WheelJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetNext_0.apply(null,arguments)},Xn=b._emscripten_bind_b2Shape_GetType_0=function(){return b.asm._emscripten_bind_b2Shape_GetType_0.apply(null,arguments)},Yn=b._emscripten_bind_b2AABB_IsValid_0=function(){return b.asm._emscripten_bind_b2AABB_IsValid_0.apply(null,arguments)},Zn=b._emscripten_bind_b2WheelJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyA_0.apply(null, +arguments)},$n=b._emscripten_enum_b2ShapeType_e_chain=function(){return b.asm._emscripten_enum_b2ShapeType_e_chain.apply(null,arguments)},ao=b._emscripten_bind_b2PulleyJoint_GetLengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthA_0.apply(null,arguments)},bo=b._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0.apply(null,arguments)},co=b._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1.apply(null, +arguments)},eo=b._emscripten_bind_b2World___destroy___0=function(){return b.asm._emscripten_bind_b2World___destroy___0.apply(null,arguments)},fo=b._emscripten_bind_b2ChainShape_set_m_prevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_prevVertex_1.apply(null,arguments)},go=b._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0.apply(null,arguments)},ho=b._emscripten_bind_b2ChainShape_SetNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetNextVertex_1.apply(null, +arguments)},io=b._emscripten_bind_b2Body_SetType_1=function(){return b.asm._emscripten_bind_b2Body_SetType_1.apply(null,arguments)},jo=b._emscripten_bind_b2Body_GetMass_0=function(){return b.asm._emscripten_bind_b2Body_GetMass_0.apply(null,arguments)},ko=b._emscripten_bind_b2Rot_b2Rot_0=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_0.apply(null,arguments)},lo=b._emscripten_bind_b2Rot_b2Rot_1=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_1.apply(null,arguments)},mo=b._emscripten_enum_b2JointType_e_distanceJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_distanceJoint.apply(null,arguments)},no=b._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1.apply(null,arguments)},oo=b._emscripten_bind_b2MouseJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetType_0.apply(null,arguments)},po=b._emscripten_bind_b2MouseJoint_GetTarget_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetTarget_0.apply(null, +arguments)},qo=b._emscripten_bind_JSQueryCallback___destroy___0=function(){return b.asm._emscripten_bind_JSQueryCallback___destroy___0.apply(null,arguments)},ro=b._emscripten_bind_b2Fixture_Refilter_0=function(){return b.asm._emscripten_bind_b2Fixture_Refilter_0.apply(null,arguments)},so=b._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1.apply(null,arguments)},to=b._emscripten_bind_b2JointEdge___destroy___0=function(){return b.asm._emscripten_bind_b2JointEdge___destroy___0.apply(null, +arguments)},uo=b._emscripten_bind_b2PulleyJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetRatio_0.apply(null,arguments)},vo=b._emscripten_bind_JSContactListener_BeginContact_1=function(){return b.asm._emscripten_bind_JSContactListener_BeginContact_1.apply(null,arguments)},wo=b._emscripten_bind_b2MotorJointDef_set_linearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_linearOffset_1.apply(null,arguments)},xo=b._emscripten_enum_b2JointType_e_motorJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_motorJoint.apply(null,arguments)},yo=b._emscripten_bind_b2EdgeShape_get_m_vertex2_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex2_0.apply(null,arguments)},zo=b._emscripten_bind_b2JointEdge_get_next_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_next_0.apply(null,arguments)},Ao=b._emscripten_bind_b2RayCastInput_set_maxFraction_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_maxFraction_1.apply(null, +arguments)},Bo=b._emscripten_bind_b2MouseJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyA_0.apply(null,arguments)},Co=b._emscripten_bind_b2BodyDef_get_awake_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_awake_0.apply(null,arguments)},Do=b._emscripten_bind_b2AABB_b2AABB_0=function(){return b.asm._emscripten_bind_b2AABB_b2AABB_0.apply(null,arguments)},Eo=b._emscripten_bind_b2Fixture_SetFriction_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFriction_1.apply(null, +arguments)},Fo=b._emscripten_enum_b2DrawFlag_e_centerOfMassBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_centerOfMassBit.apply(null,arguments)},Go=b._emscripten_bind_b2World_CreateBody_1=function(){return b.asm._emscripten_bind_b2World_CreateBody_1.apply(null,arguments)},Ho=b._emscripten_bind_b2RopeJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_userData_1.apply(null,arguments)},Io=b._emscripten_bind_b2WeldJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetNext_0.apply(null, +arguments)},Jo=b._emscripten_bind_b2WeldJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetType_0.apply(null,arguments)},Ko=b._emscripten_enum_b2ContactFeatureType_e_vertex=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_vertex.apply(null,arguments)},Lo=b._emscripten_bind_b2Rot___destroy___0=function(){return b.asm._emscripten_bind_b2Rot___destroy___0.apply(null,arguments)},Mo=b._emscripten_bind_b2Filter_get_maskBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_maskBits_0.apply(null, +arguments)},No=b._emscripten_bind_b2Mat22_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ex_0.apply(null,arguments)},Oo=b._emscripten_bind_b2Body_GetFixtureList_0=function(){return b.asm._emscripten_bind_b2Body_GetFixtureList_0.apply(null,arguments)},Po=b._emscripten_bind_b2PulleyJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJoint___destroy___0.apply(null,arguments)},Qo=b._emscripten_bind_b2MouseJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_dampingRatio_1.apply(null, +arguments)},Ro=b._emscripten_bind_JSRayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_JSRayCastCallback___destroy___0.apply(null,arguments)},So=b._emscripten_bind_b2ContactListener___destroy___0=function(){return b.asm._emscripten_bind_b2ContactListener___destroy___0.apply(null,arguments)},To=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1.apply(null,arguments)}; +b.establishStackSpace=function(){return b.asm.establishStackSpace.apply(null,arguments)}; +var Uo=b._emscripten_bind_b2FrictionJoint___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJoint___destroy___0.apply(null,arguments)},Vo=b._emscripten_bind_b2WeldJoint_Dump_0=function(){return b.asm._emscripten_bind_b2WeldJoint_Dump_0.apply(null,arguments)},Wo=b._emscripten_bind_b2MotorJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxForce_1.apply(null,arguments)},Xo=b._emscripten_bind_b2MouseJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetFrequency_0.apply(null, +arguments)},Yo=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0.apply(null,arguments)},Zo=b._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1.apply(null,arguments)},$o=b._emscripten_bind_b2GearJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_collideConnected_1.apply(null,arguments)},ap= +b._emscripten_bind_b2Vec2_IsValid_0=function(){return b.asm._emscripten_bind_b2Vec2_IsValid_0.apply(null,arguments)},bp=b._emscripten_bind_b2PrismaticJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyA_1.apply(null,arguments)},cp=b._emscripten_bind_b2World_GetWarmStarting_0=function(){return b.asm._emscripten_bind_b2World_GetWarmStarting_0.apply(null,arguments)},dp=b._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1.apply(null, +arguments)},ep=b._emscripten_bind_b2WeldJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJointDef___destroy___0.apply(null,arguments)},fp=b._emscripten_bind_b2Mat22_Solve_1=function(){return b.asm._emscripten_bind_b2Mat22_Solve_1.apply(null,arguments)},gp=b._emscripten_bind_b2Color_get_g_0=function(){return b.asm._emscripten_bind_b2Color_get_g_0.apply(null,arguments)},hp=b._emscripten_bind_VoidPtr___destroy___0=function(){return b.asm._emscripten_bind_VoidPtr___destroy___0.apply(null, +arguments)},ip=b._emscripten_bind_b2RopeJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetNext_0.apply(null,arguments)},jp=b._emscripten_bind_b2EdgeShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_type_0.apply(null,arguments)},kp=b._emscripten_bind_b2PolygonShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetChildCount_0.apply(null,arguments)},lp=b._emscripten_bind_b2GearJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_ratio_0.apply(null, +arguments)},mp=b._emscripten_bind_b2Mat33_Solve33_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve33_1.apply(null,arguments)},np=b._emscripten_bind_b2WeldJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_userData_1.apply(null,arguments)},op=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0.apply(null,arguments)},pp=b._emscripten_bind_b2RevoluteJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef___destroy___0.apply(null, +arguments)},qp=b._emscripten_bind_b2MotorJointDef_get_correctionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_correctionFactor_0.apply(null,arguments)},rp=b._emscripten_bind_b2ContactFeature_get_typeB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeB_0.apply(null,arguments)},sp=b._emscripten_bind_b2ContactID_get_key_0=function(){return b.asm._emscripten_bind_b2ContactID_get_key_0.apply(null,arguments)},tp=b._emscripten_bind_b2MotorJoint_GetReactionForce_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionForce_1.apply(null,arguments)},up=b._emscripten_bind_b2Rot_GetAngle_0=function(){return b.asm._emscripten_bind_b2Rot_GetAngle_0.apply(null,arguments)},vp=b._emscripten_bind_b2World_SetAllowSleeping_1=function(){return b.asm._emscripten_bind_b2World_SetAllowSleeping_1.apply(null,arguments)},wp=b._emscripten_bind_b2RopeJoint_GetType_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetType_0.apply(null,arguments)},xp=b._emscripten_bind_b2MotorJoint_SetAngularOffset_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetAngularOffset_1.apply(null,arguments)},yp=b._emscripten_bind_b2MotorJoint_GetLinearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetLinearOffset_0.apply(null,arguments)},zp=b._emscripten_bind_b2FrictionJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetCollideConnected_0.apply(null,arguments)},Ap=b._emscripten_bind_b2WheelJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_motorSpeed_1.apply(null, +arguments)},Bp=b._emscripten_bind_b2MotorJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorA_0.apply(null,arguments)},Cp=b._emscripten_bind_b2Fixture_GetDensity_0=function(){return b.asm._emscripten_bind_b2Fixture_GetDensity_0.apply(null,arguments)},Dp=b._emscripten_bind_b2MouseJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_type_0.apply(null,arguments)},Ep=b._emscripten_bind_b2Vec2_Set_2=function(){return b.asm._emscripten_bind_b2Vec2_Set_2.apply(null, +arguments)},Fp=b._emscripten_bind_b2WeldJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_type_0.apply(null,arguments)},Gp=b._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0.apply(null,arguments)},Hp=b._emscripten_bind_b2Rot_get_s_0=function(){return b.asm._emscripten_bind_b2Rot_get_s_0.apply(null,arguments)},Ip=b._emscripten_bind_b2FrictionJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxTorque_1.apply(null, +arguments)},Jp=b._emscripten_bind_b2MouseJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_frequencyHz_0.apply(null,arguments)},Kp=b._emscripten_bind_b2FrictionJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetUserData_1.apply(null,arguments)},Lp=b._emscripten_bind_b2RayCastInput_get_p1_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p1_0.apply(null,arguments)},Mp=b._emscripten_bind_b2DistanceJointDef_get_collideConnected_0= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_collideConnected_0.apply(null,arguments)},Np=b._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1.apply(null,arguments)},Op=b._emscripten_bind_b2ContactFeature___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFeature___destroy___0.apply(null,arguments)},Pp=b._emscripten_bind_b2Color___destroy___0=function(){return b.asm._emscripten_bind_b2Color___destroy___0.apply(null, +arguments)},Qp=b._emscripten_bind_b2DistanceJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyB_1.apply(null,arguments)},Rp=b._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0.apply(null,arguments)},Sp=b._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0.apply(null,arguments)},Tp=b._emscripten_bind_b2RevoluteJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetType_0.apply(null,arguments)},Up=b._emscripten_bind_b2MassData_b2MassData_0=function(){return b.asm._emscripten_bind_b2MassData_b2MassData_0.apply(null,arguments)},Vp=b._emscripten_bind_b2Vec3_set_y_1=function(){return b.asm._emscripten_bind_b2Vec3_set_y_1.apply(null,arguments)},Wp=b._emscripten_bind_b2BodyDef_set_angularDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angularDamping_1.apply(null,arguments)},Xp=b._emscripten_bind_b2AABB_Combine_1= +function(){return b.asm._emscripten_bind_b2AABB_Combine_1.apply(null,arguments)},Yp=b._emscripten_bind_b2WheelJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyB_1.apply(null,arguments)},Zp=b._emscripten_bind_b2PrismaticJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyA_0.apply(null,arguments)},$p=b._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0.apply(null, +arguments)},aq=b._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0.apply(null,arguments)},bq=b._emscripten_bind_b2Body_IsSleepingAllowed_0=function(){return b.asm._emscripten_bind_b2Body_IsSleepingAllowed_0.apply(null,arguments)},cq=b._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0.apply(null,arguments)},dq=b._emscripten_bind_b2Profile_get_solve_0= +function(){return b.asm._emscripten_bind_b2Profile_get_solve_0.apply(null,arguments)},eq=b._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1.apply(null,arguments)},fq=b._emscripten_bind_b2PolygonShape_GetVertexCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertexCount_0.apply(null,arguments)},gq=b._emscripten_bind_b2Rot_get_c_0=function(){return b.asm._emscripten_bind_b2Rot_get_c_0.apply(null, +arguments)},hq=b._emscripten_bind_b2AABB_set_lowerBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_lowerBound_1.apply(null,arguments)},iq=b._emscripten_bind_b2Fixture_SetFilterData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFilterData_1.apply(null,arguments)},jq=b._emscripten_bind_b2MouseJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetMaxForce_1.apply(null,arguments)},kq=b._emscripten_bind_b2WheelJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsMotorEnabled_0.apply(null, +arguments)},lq=b._emscripten_bind_b2JointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2JointDef_set_userData_1.apply(null,arguments)},mq=b._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0.apply(null,arguments)},nq=b._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0.apply(null,arguments)},oq=b._emscripten_bind_b2WeldJointDef_get_dampingRatio_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_get_dampingRatio_0.apply(null,arguments)},pq=b._emscripten_bind_b2Rot_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Rot_SetIdentity_0.apply(null,arguments)},qq=b._emscripten_bind_b2EdgeShape_b2EdgeShape_0=function(){return b.asm._emscripten_bind_b2EdgeShape_b2EdgeShape_0.apply(null,arguments)},rq=b._emscripten_bind_b2FrictionJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionForce_1.apply(null, +arguments)},sq=b._emscripten_bind_b2MouseJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetUserData_0.apply(null,arguments)},tq=b._emscripten_bind_b2DistanceJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_type_1.apply(null,arguments)},uq=b._emscripten_bind_b2WeldJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorA_0.apply(null,arguments)},vq=b._emscripten_bind_b2WeldJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJoint___destroy___0.apply(null, +arguments)},wq=b._emscripten_bind_b2Manifold_b2Manifold_0=function(){return b.asm._emscripten_bind_b2Manifold_b2Manifold_0.apply(null,arguments)},xq=b._emscripten_bind_JSContactListener_PostSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PostSolve_2.apply(null,arguments)},yq=b._emscripten_bind_b2PulleyJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyA_0.apply(null,arguments)},zq=b._emscripten_bind_b2RopeJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_type_0.apply(null, +arguments)},Aq=b._emscripten_bind_b2CircleShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeMass_2.apply(null,arguments)},Bq=b._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0.apply(null,arguments)},Cq=b._emscripten_bind_b2GearJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2GearJointDef___destroy___0.apply(null,arguments)},Dq=b._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1.apply(null,arguments)},Eq=b._emscripten_enum_b2BodyType_b2_dynamicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_dynamicBody.apply(null,arguments)},Fq=b._emscripten_bind_b2CircleShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2CircleShape_TestPoint_2.apply(null,arguments)},Gq=b._emscripten_bind_b2MotorJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxTorque_0.apply(null, +arguments)},Hq=b._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1.apply(null,arguments)},Iq=b._emscripten_bind_b2FrictionJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyB_1.apply(null,arguments)},Jq=b._emscripten_bind_b2MouseJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorB_0.apply(null,arguments)},Kq=b._emscripten_bind_b2RopeJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorB_0.apply(null,arguments)},Lq=b._emscripten_bind_b2GearJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyB_0.apply(null,arguments)},Mq=b._emscripten_bind_b2ChainShape_Clear_0=function(){return b.asm._emscripten_bind_b2ChainShape_Clear_0.apply(null,arguments)},Nq=b._emscripten_bind_b2CircleShape___destroy___0=function(){return b.asm._emscripten_bind_b2CircleShape___destroy___0.apply(null,arguments)},Oq= +b._emscripten_bind_b2MotorJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetType_0.apply(null,arguments)},Pq=b._emscripten_bind_b2World_GetContactCount_0=function(){return b.asm._emscripten_bind_b2World_GetContactCount_0.apply(null,arguments)},Qq=b._emscripten_bind_b2Contact_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Contact_SetRestitution_1.apply(null,arguments)},Rq=b._emscripten_bind_b2BodyDef_get_angularDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularDamping_0.apply(null, +arguments)},Sq=b._emscripten_bind_b2EdgeShape_get_m_vertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex3_0.apply(null,arguments)},Tq=b._emscripten_bind_b2MassData_set_center_1=function(){return b.asm._emscripten_bind_b2MassData_set_center_1.apply(null,arguments)},Uq=b._emscripten_bind_b2Transform_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Transform_SetIdentity_0.apply(null,arguments)},Vq=b._emscripten_bind_b2GearJointDef_set_joint1_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint1_1.apply(null, +arguments)},Wq=b._emscripten_bind_b2EdgeShape_set_m_vertex2_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex2_1.apply(null,arguments)},Xq=b._emscripten_bind_b2Contact_SetFriction_1=function(){return b.asm._emscripten_bind_b2Contact_SetFriction_1.apply(null,arguments)},Yq=b._emscripten_bind_b2MouseJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_collideConnected_1.apply(null,arguments)},Zq=b._emscripten_bind_b2ContactFeature_set_indexB_1= +function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexB_1.apply(null,arguments)},$q=b._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1.apply(null,arguments)},ar=b._emscripten_bind_b2WeldJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetCollideConnected_0.apply(null,arguments)},br=b._emscripten_bind_b2Mat22_GetInverse_0=function(){return b.asm._emscripten_bind_b2Mat22_GetInverse_0.apply(null, +arguments)},cr=b._emscripten_bind_b2WheelJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_frequencyHz_1.apply(null,arguments)},dr=b._emscripten_bind_b2World_GetSubStepping_0=function(){return b.asm._emscripten_bind_b2World_GetSubStepping_0.apply(null,arguments)},er=b._emscripten_bind_b2Rot_GetYAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetYAxis_0.apply(null,arguments)}; +b._emscripten_get_global_libc=function(){return b.asm._emscripten_get_global_libc.apply(null,arguments)}; +var fr=b._emscripten_bind_b2WheelJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAxisA_0.apply(null,arguments)},gr=b._emscripten_bind_b2RopeJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyB_0.apply(null,arguments)},hr=b._emscripten_bind_b2EdgeShape_GetType_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetType_0.apply(null,arguments)},ir=b._emscripten_bind_b2Mat22_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ex_1.apply(null, +arguments)},jr=b._emscripten_bind_b2ManifoldPoint___destroy___0=function(){return b.asm._emscripten_bind_b2ManifoldPoint___destroy___0.apply(null,arguments)},kr=b._emscripten_enum_b2JointType_e_prismaticJoint=function(){return b.asm._emscripten_enum_b2JointType_e_prismaticJoint.apply(null,arguments)},lr=b._emscripten_bind_b2WeldJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_referenceAngle_0.apply(null,arguments)},mr=b._emscripten_bind_b2Vec2_Length_0=function(){return b.asm._emscripten_bind_b2Vec2_Length_0.apply(null, +arguments)},nr=b._emscripten_bind_b2Vec2_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec2_SetZero_0.apply(null,arguments)},or=b._emscripten_bind_b2RopeJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJoint___destroy___0.apply(null,arguments)},pr=b._emscripten_bind_b2World_DestroyJoint_1=function(){return b.asm._emscripten_bind_b2World_DestroyJoint_1.apply(null,arguments)},qr=b._emscripten_bind_b2JointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyB_1.apply(null, +arguments)},rr=b._emscripten_bind_b2Mat22_Set_2=function(){return b.asm._emscripten_bind_b2Mat22_Set_2.apply(null,arguments)},sr=b._emscripten_bind_b2JointEdge_set_next_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_next_1.apply(null,arguments)},tr=b._emscripten_bind_b2WeldJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorB_0.apply(null,arguments)},ur=b._emscripten_enum_b2DrawFlag_e_aabbBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_aabbBit.apply(null, +arguments)},vr=b._emscripten_bind_b2EdgeShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeAABB_3.apply(null,arguments)},wr=b._emscripten_bind_b2PolygonShape_set_m_centroid_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_centroid_1.apply(null,arguments)},xr=b._emscripten_bind_b2WheelJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_collideConnected_1.apply(null,arguments)},yr=b._emscripten_bind_b2World_GetJointList_0= +function(){return b.asm._emscripten_bind_b2World_GetJointList_0.apply(null,arguments)},zr=b._emscripten_bind_b2MotorJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_type_0.apply(null,arguments)},Ar=b._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0.apply(null,arguments)},Br=b._emscripten_bind_b2BodyDef_set_linearDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearDamping_1.apply(null, +arguments)},Cr=b._emscripten_bind_b2FrictionJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetUserData_0.apply(null,arguments)},Dr=b._emscripten_bind_b2Shape_TestPoint_2=function(){return b.asm._emscripten_bind_b2Shape_TestPoint_2.apply(null,arguments)},Er=b._emscripten_bind_b2Manifold_set_localNormal_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localNormal_1.apply(null,arguments)},Fr=b._emscripten_bind_b2JointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyA_0.apply(null, +arguments)},Gr=b._emscripten_bind_b2Body_GetLinearDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearDamping_0.apply(null,arguments)},Hr=b._emscripten_bind_b2WeldJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_frequencyHz_1.apply(null,arguments)},Ir=b._emscripten_bind_b2BodyDef_set_userData_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_userData_1.apply(null,arguments)},Jr=b._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1.apply(null, +arguments)},Kr=b._emscripten_bind_b2Vec2_Skew_0=function(){return b.asm._emscripten_bind_b2Vec2_Skew_0.apply(null,arguments)},Lr=b._emscripten_bind_b2MouseJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetDampingRatio_0.apply(null,arguments)},Mr=b._emscripten_bind_b2RevoluteJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorA_0.apply(null,arguments)},Nr=b._emscripten_bind_b2ContactFeature_set_typeB_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeB_1.apply(null, +arguments)},Or=b._emscripten_bind_b2WheelJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorA_0.apply(null,arguments)},Pr=b._emscripten_bind_b2MotorJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxTorque_0.apply(null,arguments)};b.setThrew=function(){return b.asm.setThrew.apply(null,arguments)}; +var Qr=b._emscripten_bind_b2PrismaticJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_userData_1.apply(null,arguments)},Rr=b._emscripten_bind_b2FrictionJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_type_1.apply(null,arguments)},Sr=b._emscripten_bind_b2FrictionJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2FrictionJointDef_Initialize_3.apply(null,arguments)},Nb=b._sbrk=function(){return b.asm._sbrk.apply(null, +arguments)},Tr=b._emscripten_bind_b2FrictionJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_collideConnected_0.apply(null,arguments)},Ib=b._memcpy=function(){return b.asm._memcpy.apply(null,arguments)},Ur=b._emscripten_bind_b2FrictionJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorA_0.apply(null,arguments)},Vr=b._emscripten_enum_b2DrawFlag_e_pairBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_pairBit.apply(null, +arguments)},Wr=b._emscripten_bind_b2MassData_get_I_0=function(){return b.asm._emscripten_bind_b2MassData_get_I_0.apply(null,arguments)},Xr=b._emscripten_bind_b2WheelJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_motorSpeed_0.apply(null,arguments)},Yr=b._emscripten_bind_b2Filter_set_maskBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_maskBits_1.apply(null,arguments)},Zr=b._emscripten_bind_b2WheelJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetCollideConnected_0.apply(null, +arguments)},$r=b._emscripten_bind_b2EdgeShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_radius_0.apply(null,arguments)},as=b._emscripten_bind_b2World_GetTreeHeight_0=function(){return b.asm._emscripten_bind_b2World_GetTreeHeight_0.apply(null,arguments)},bs=b._emscripten_bind_b2Mat22_b2Mat22_2=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_2.apply(null,arguments)},cs=b._emscripten_bind_b2PrismaticJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetNext_0.apply(null, +arguments)},ds=b._emscripten_bind_b2Mat22_b2Mat22_0=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_0.apply(null,arguments)},es=b._emscripten_bind_b2PrismaticJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyA_0.apply(null,arguments)},gs=b._emscripten_bind_b2RopeJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorA_1.apply(null,arguments)},hs=b._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1.apply(null, +arguments)},is=b._emscripten_bind_b2Mat22_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ey_1.apply(null,arguments)},js=b._emscripten_bind_b2MotorJointDef_set_angularOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_angularOffset_1.apply(null,arguments)},ks=b._emscripten_bind_b2CircleShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_type_0.apply(null,arguments)},ls=b._emscripten_bind_b2Body_GetType_0=function(){return b.asm._emscripten_bind_b2Body_GetType_0.apply(null, +arguments)},ms=b._emscripten_bind_b2ContactEdge_b2ContactEdge_0=function(){return b.asm._emscripten_bind_b2ContactEdge_b2ContactEdge_0.apply(null,arguments)},ns=b._emscripten_bind_b2BodyDef___destroy___0=function(){return b.asm._emscripten_bind_b2BodyDef___destroy___0.apply(null,arguments)},ps=b._emscripten_bind_b2FrictionJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxTorque_1.apply(null,arguments)},Qa=b._free=function(){return b.asm._free.apply(null,arguments)}, +qs=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1.apply(null,arguments)},rs=b._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0.apply(null,arguments)},ss=b._emscripten_bind_b2DistanceJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyA_1.apply(null,arguments)}; +b.runPostSets=function(){return b.asm.runPostSets.apply(null,arguments)}; +var ts=b._emscripten_bind_b2RevoluteJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetLimits_2.apply(null,arguments)},us=b._emscripten_bind_b2WeldJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_type_1.apply(null,arguments)},vs=b._emscripten_bind_b2MotorJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJointDef___destroy___0.apply(null,arguments)},xs=b._emscripten_bind_b2FrictionJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetNext_0.apply(null, +arguments)},ys=b._emscripten_bind_b2Shape_set_m_type_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_type_1.apply(null,arguments)},zs=b._emscripten_bind_b2WheelJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointTranslation_0.apply(null,arguments)},As=b._emscripten_bind_b2WheelJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorTorque_1.apply(null,arguments)},Bs=b._emscripten_bind_b2RopeJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetUserData_1.apply(null, +arguments)},Cs=b._emscripten_bind_b2RopeJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJointDef___destroy___0.apply(null,arguments)},Ds=b._emscripten_bind_b2WheelJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsActive_0.apply(null,arguments)},Es=b._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0.apply(null,arguments)},Fs=b._emscripten_bind_b2MotorJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyB_1.apply(null,arguments)},Gs=b._emscripten_bind_JSDestructionListener___destroy___0=function(){return b.asm._emscripten_bind_JSDestructionListener___destroy___0.apply(null,arguments)},Hs=b._emscripten_bind_b2Transform_b2Transform_2=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_2.apply(null,arguments)},Is=b._emscripten_bind_b2WeldJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionForce_1.apply(null, +arguments)},Js=b._emscripten_bind_b2ChainShape_RayCast_4=function(){return b.asm._emscripten_bind_b2ChainShape_RayCast_4.apply(null,arguments)},Ks=b._emscripten_bind_b2Vec2_set_y_1=function(){return b.asm._emscripten_bind_b2Vec2_set_y_1.apply(null,arguments)},Ls=b._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1.apply(null,arguments)},Ms=b._emscripten_bind_b2ContactID_get_cf_0=function(){return b.asm._emscripten_bind_b2ContactID_get_cf_0.apply(null, +arguments)},Ns=b._emscripten_bind_b2DistanceJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2DistanceJointDef_Initialize_4.apply(null,arguments)},Os=b._emscripten_bind_b2ChainShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_radius_0.apply(null,arguments)},Ps=b._emscripten_bind_b2WeldJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorB_1.apply(null,arguments)},Qs=b._emscripten_bind_b2ChainShape_set_m_radius_1= +function(){return b.asm._emscripten_bind_b2ChainShape_set_m_radius_1.apply(null,arguments)},Rs=b._emscripten_bind_b2DistanceJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionTorque_1.apply(null,arguments)},Ss=b._emscripten_bind_b2World_Dump_0=function(){return b.asm._emscripten_bind_b2World_Dump_0.apply(null,arguments)},Ts=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0.apply(null, +arguments)},Us=b._emscripten_bind_JSContactFilter_JSContactFilter_0=function(){return b.asm._emscripten_bind_JSContactFilter_JSContactFilter_0.apply(null,arguments)},Vs=b._emscripten_bind_b2Profile_set_solve_1=function(){return b.asm._emscripten_bind_b2Profile_set_solve_1.apply(null,arguments)},Ws=b._emscripten_bind_b2FixtureDef_set_density_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_density_1.apply(null,arguments)},Xs=b._emscripten_bind_b2WeldJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetDampingRatio_0.apply(null, +arguments)},Ys=b._emscripten_bind_b2Color_get_b_0=function(){return b.asm._emscripten_bind_b2Color_get_b_0.apply(null,arguments)},Zs=b._emscripten_bind_b2MouseJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_userData_0.apply(null,arguments)},$s=b._emscripten_bind_b2CircleShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeAABB_3.apply(null,arguments)},at=b._emscripten_bind_b2RopeJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionForce_1.apply(null, +arguments)},bt=b._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0.apply(null,arguments)},ct=b._emscripten_bind_b2ManifoldPoint_set_localPoint_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_localPoint_1.apply(null,arguments)},dt=b._emscripten_bind_b2Fixture_GetFilterData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFilterData_0.apply(null,arguments)},et=b._emscripten_bind_b2World_GetBodyList_0= +function(){return b.asm._emscripten_bind_b2World_GetBodyList_0.apply(null,arguments)},ft=b._emscripten_bind_b2Body_GetJointList_0=function(){return b.asm._emscripten_bind_b2Body_GetJointList_0.apply(null,arguments)},gt=b._emscripten_bind_b2Joint_GetNext_0=function(){return b.asm._emscripten_bind_b2Joint_GetNext_0.apply(null,arguments)},ht=b._emscripten_bind_b2Joint_GetType_0=function(){return b.asm._emscripten_bind_b2Joint_GetType_0.apply(null,arguments)},it=b._emscripten_bind_b2World_RayCast_3=function(){return b.asm._emscripten_bind_b2World_RayCast_3.apply(null, +arguments)},jt=b._emscripten_bind_b2MassData_set_I_1=function(){return b.asm._emscripten_bind_b2MassData_set_I_1.apply(null,arguments)},kt=b._emscripten_bind_b2MassData___destroy___0=function(){return b.asm._emscripten_bind_b2MassData___destroy___0.apply(null,arguments)},lt=b._emscripten_bind_b2Profile_get_collide_0=function(){return b.asm._emscripten_bind_b2Profile_get_collide_0.apply(null,arguments)},mt=b._emscripten_bind_b2Color_b2Color_3=function(){return b.asm._emscripten_bind_b2Color_b2Color_3.apply(null, +arguments)},nt=b._emscripten_bind_b2Color_b2Color_0=function(){return b.asm._emscripten_bind_b2Color_b2Color_0.apply(null,arguments)},ot=b._emscripten_bind_b2WheelJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_frequencyHz_0.apply(null,arguments)},pt=b._emscripten_bind_b2WeldJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2WeldJointDef_Initialize_3.apply(null,arguments)},qt=b._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1.apply(null, +arguments)},rt=b._emscripten_enum_b2JointType_e_gearJoint=function(){return b.asm._emscripten_enum_b2JointType_e_gearJoint.apply(null,arguments)},st=b._emscripten_bind_b2FixtureDef_get_friction_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_friction_0.apply(null,arguments)},tt=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1.apply(null,arguments)},ut=b._emscripten_bind_b2Contact_GetManifold_0=function(){return b.asm._emscripten_bind_b2Contact_GetManifold_0.apply(null, +arguments)},vt=b._emscripten_bind_b2QueryCallback___destroy___0=function(){return b.asm._emscripten_bind_b2QueryCallback___destroy___0.apply(null,arguments)},wt=b._emscripten_bind_b2WeldJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorA_0.apply(null,arguments)},xt=b._emscripten_bind_b2MouseJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetUserData_1.apply(null,arguments)},yt=b._emscripten_bind_b2MotorJointDef_set_correctionFactor_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_correctionFactor_1.apply(null,arguments)},zt=b._emscripten_bind_b2ChainShape_GetChildEdge_2=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildEdge_2.apply(null,arguments)},At=b._emscripten_enum_b2JointType_e_mouseJoint=function(){return b.asm._emscripten_enum_b2JointType_e_mouseJoint.apply(null,arguments)},Bt=b._emscripten_bind_b2MotorJointDef_get_angularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_angularOffset_0.apply(null, +arguments)},Ct=b._emscripten_bind_b2WheelJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetUserData_1.apply(null,arguments)},Dt=b._emscripten_bind_b2Body_ApplyForce_3=function(){return b.asm._emscripten_bind_b2Body_ApplyForce_3.apply(null,arguments)},Et=b._emscripten_bind_b2ChainShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_count_1.apply(null,arguments)},Ft=b._emscripten_bind_b2DistanceJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetCollideConnected_0.apply(null, +arguments)},Gt=b._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0.apply(null,arguments)},Ht=b._emscripten_bind_b2PolygonShape_GetVertex_1=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertex_1.apply(null,arguments)},It=b._emscripten_bind_b2World_SetGravity_1=function(){return b.asm._emscripten_bind_b2World_SetGravity_1.apply(null,arguments)},Jt=b._emscripten_bind_b2MouseJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_collideConnected_0.apply(null, +arguments)},Qb=b._llvm_bswap_i32=function(){return b.asm._llvm_bswap_i32.apply(null,arguments)},Kt=b._emscripten_bind_b2Fixture_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Fixture_SetRestitution_1.apply(null,arguments)},Lt=b._emscripten_bind_b2Body_GetTransform_0=function(){return b.asm._emscripten_bind_b2Body_GetTransform_0.apply(null,arguments)},Mt=b._emscripten_enum_b2ShapeType_e_typeCount=function(){return b.asm._emscripten_enum_b2ShapeType_e_typeCount.apply(null,arguments)},Nt= +b._emscripten_bind_b2Mat33_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ex_1.apply(null,arguments)},Ot=b._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0.apply(null,arguments)},Pt=b._emscripten_bind_b2RevoluteJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyA_0.apply(null,arguments)},Qt=b._emscripten_bind_b2PrismaticJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyB_0.apply(null, +arguments)},Rt=b._emscripten_bind_b2WheelJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyA_1.apply(null,arguments)},St=b._emscripten_bind_b2MotorJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxForce_1.apply(null,arguments)},Tt=b._emscripten_bind_b2BodyDef_get_angle_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angle_0.apply(null,arguments)},Ut=b._emscripten_bind_b2FixtureDef_get_shape_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_shape_0.apply(null, +arguments)},Vt=b._emscripten_bind_b2Body_SetAngularVelocity_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularVelocity_1.apply(null,arguments)},Wt=b._emscripten_bind_b2WeldJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_userData_0.apply(null,arguments)},Xt=b._emscripten_bind_b2FrictionJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxForce_1.apply(null,arguments)},Yt=b._emscripten_bind_b2Mat33_b2Mat33_3=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_3.apply(null, +arguments)},Zt=b._emscripten_bind_b2Vec3_get_y_0=function(){return b.asm._emscripten_bind_b2Vec3_get_y_0.apply(null,arguments)},$t=b._emscripten_bind_b2JointDef_get_type_0=function(){return b.asm._emscripten_bind_b2JointDef_get_type_0.apply(null,arguments)},au=b._emscripten_bind_JSQueryCallback_ReportFixture_1=function(){return b.asm._emscripten_bind_JSQueryCallback_ReportFixture_1.apply(null,arguments)},bu=b._emscripten_bind_b2PulleyJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCollideConnected_0.apply(null, +arguments)},cu=b._emscripten_bind_b2Body_CreateFixture_1=function(){return b.asm._emscripten_bind_b2Body_CreateFixture_1.apply(null,arguments)},du=b._emscripten_bind_JSDraw_JSDraw_0=function(){return b.asm._emscripten_bind_JSDraw_JSDraw_0.apply(null,arguments)},eu=b._emscripten_bind_b2MouseJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorA_0.apply(null,arguments)},fu=b._emscripten_bind_b2Transform_get_p_0=function(){return b.asm._emscripten_bind_b2Transform_get_p_0.apply(null, +arguments)},gu=b._emscripten_bind_b2WorldManifold_get_normal_0=function(){return b.asm._emscripten_bind_b2WorldManifold_get_normal_0.apply(null,arguments)},hu=b._emscripten_bind_b2World_GetProfile_0=function(){return b.asm._emscripten_bind_b2World_GetProfile_0.apply(null,arguments)},iu=b._emscripten_bind_b2DistanceJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJointDef___destroy___0.apply(null,arguments)},ju=b._emscripten_bind_b2GearJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyA_1.apply(null, +arguments)},ku=b._emscripten_bind_b2JointDef_set_type_1=function(){return b.asm._emscripten_bind_b2JointDef_set_type_1.apply(null,arguments)},lu=b._emscripten_bind_b2ContactEdge_set_contact_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_contact_1.apply(null,arguments)},mu=b._emscripten_bind_b2MotorJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_userData_0.apply(null,arguments)},nu=b._emscripten_bind_b2World_GetContactList_0=function(){return b.asm._emscripten_bind_b2World_GetContactList_0.apply(null, +arguments)},ou=b._emscripten_bind_b2Mat33_set_ez_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ez_1.apply(null,arguments)},pu=b._emscripten_bind_b2JointEdge_b2JointEdge_0=function(){return b.asm._emscripten_bind_b2JointEdge_b2JointEdge_0.apply(null,arguments)},qu=b._emscripten_bind_b2FrictionJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyA_0.apply(null,arguments)},ru=b._emscripten_bind_b2WheelJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_type_0.apply(null, +arguments)},su=b._emscripten_bind_b2RevoluteJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionForce_1.apply(null,arguments)},tu=b._emscripten_bind_b2PulleyJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_collideConnected_1.apply(null,arguments)},uu=b._emscripten_bind_b2RopeJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetCollideConnected_0.apply(null,arguments)},vu=b._emscripten_bind_b2GearJointDef_set_joint2_1= +function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint2_1.apply(null,arguments)},wu=b._emscripten_bind_b2EdgeShape_set_m_vertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex3_1.apply(null,arguments)},xu=b._emscripten_bind_b2GearJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorB_0.apply(null,arguments)},yu=b._emscripten_bind_b2RopeJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RopeJoint_IsActive_0.apply(null,arguments)}, +zu=b._emscripten_bind_b2Fixture_GetFriction_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFriction_0.apply(null,arguments)},Au=b._emscripten_bind_b2Fixture_GetNext_0=function(){return b.asm._emscripten_bind_b2Fixture_GetNext_0.apply(null,arguments)},Bu=b._emscripten_bind_b2RopeJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyA_0.apply(null,arguments)},Cu=b._emscripten_bind_b2WeldJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorB_0.apply(null, +arguments)},Du=b._emscripten_bind_b2WeldJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_referenceAngle_1.apply(null,arguments)},Eu=b._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1.apply(null,arguments)},Fu=b._emscripten_bind_b2Mat33_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat33_SetZero_0.apply(null,arguments)},Gu=b._emscripten_bind_b2MotorJointDef_get_bodyB_0= +function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyB_0.apply(null,arguments)},Hu=b._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0.apply(null,arguments)},Iu=b._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0.apply(null,arguments)},Ju=b._emscripten_bind_b2Mat22_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ey_0.apply(null, +arguments)},Ku=b._emscripten_bind_b2Mat22_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Mat22_SetIdentity_0.apply(null,arguments)},Lu=b._emscripten_bind_b2Joint_IsActive_0=function(){return b.asm._emscripten_bind_b2Joint_IsActive_0.apply(null,arguments)},Mu=b._emscripten_bind_b2PulleyJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionForce_1.apply(null,arguments)},Nu=b._emscripten_bind_b2Shape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2Shape_get_m_radius_0.apply(null, +arguments)},Ou=b._emscripten_bind_b2Mat22_b2Mat22_4=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_4.apply(null,arguments)},Pu=b._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1.apply(null,arguments)},Qu=b._emscripten_bind_b2PolygonShape_SetAsBox_4=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_4.apply(null,arguments)},Ru=b._emscripten_bind_b2EdgeShape_set_m_vertex1_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex1_1.apply(null, +arguments)},Su=b._emscripten_bind_b2Body_GetWorld_0=function(){return b.asm._emscripten_bind_b2Body_GetWorld_0.apply(null,arguments)},Tu=b._emscripten_enum_b2LimitState_e_inactiveLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_inactiveLimit.apply(null,arguments)},Uu=b._emscripten_bind_b2Vec2_set_x_1=function(){return b.asm._emscripten_bind_b2Vec2_set_x_1.apply(null,arguments)},Vu=b._emscripten_bind_b2Body_SetAwake_1=function(){return b.asm._emscripten_bind_b2Body_SetAwake_1.apply(null, +arguments)},Wu=b._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0.apply(null,arguments)},Xu=b._emscripten_bind_b2Vec2___destroy___0=function(){return b.asm._emscripten_bind_b2Vec2___destroy___0.apply(null,arguments)},Yu=b._emscripten_enum_b2ShapeType_e_polygon=function(){return b.asm._emscripten_enum_b2ShapeType_e_polygon.apply(null,arguments)},Zu=b._emscripten_bind_b2Body_GetInertia_0=function(){return b.asm._emscripten_bind_b2Body_GetInertia_0.apply(null, +arguments)},$u=b._emscripten_bind_b2PulleyJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorA_0.apply(null,arguments)},av=b._emscripten_bind_b2BodyDef_get_linearVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearVelocity_0.apply(null,arguments)},bv=b._emscripten_bind_b2DistanceJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyB_0.apply(null,arguments)},cv=b._emscripten_bind_b2Mat22___destroy___0=function(){return b.asm._emscripten_bind_b2Mat22___destroy___0.apply(null, +arguments)},dv=b._emscripten_bind_b2RevoluteJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetNext_0.apply(null,arguments)},ev=b._emscripten_bind_b2WeldJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyA_0.apply(null,arguments)},fv=b._emscripten_bind_b2MotorJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorB_0.apply(null,arguments)},gv=b._emscripten_bind_b2Fixture_GetShape_0=function(){return b.asm._emscripten_bind_b2Fixture_GetShape_0.apply(null, +arguments)},hv=b._emscripten_bind_b2PulleyJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionTorque_1.apply(null,arguments)},iv=b._emscripten_bind_b2Vec3_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec3_op_mul_1.apply(null,arguments)},jv=b._emscripten_bind_b2PolygonShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_type_1.apply(null,arguments)},kv=b._emscripten_bind_b2WheelJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetType_0.apply(null, +arguments)},lv=b._emscripten_bind_b2MotorJoint_GetAngularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAngularOffset_0.apply(null,arguments)},mv=b._emscripten_bind_b2RevoluteJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsActive_0.apply(null,arguments)},nv=b._emscripten_bind_b2GearJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetNext_0.apply(null,arguments)},ov=b._emscripten_bind_b2MouseJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_maxForce_0.apply(null, +arguments)},pv=b._emscripten_bind_b2DestructionListenerWrapper___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListenerWrapper___destroy___0.apply(null,arguments)},qv=b._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1.apply(null,arguments)},rv=b._emscripten_bind_b2WheelJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAxisA_0.apply(null,arguments)},sv=b._emscripten_bind_b2Body_GetNext_0= +function(){return b.asm._emscripten_bind_b2Body_GetNext_0.apply(null,arguments)},tv=b._emscripten_bind_b2MouseJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionForce_1.apply(null,arguments)},uv=b._emscripten_bind_b2RopeJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyA_0.apply(null,arguments)},vv=b._emscripten_bind_b2ContactFeature_set_indexA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexA_1.apply(null,arguments)}, +wv=b._emscripten_bind_b2Profile_get_solveInit_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveInit_0.apply(null,arguments)},xv=b._emscripten_bind_b2Fixture_IsSensor_0=function(){return b.asm._emscripten_bind_b2Fixture_IsSensor_0.apply(null,arguments)},yv=b._emscripten_bind_b2FrictionJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorB_0.apply(null,arguments)},zv=b._emscripten_bind_b2World_QueryAABB_2=function(){return b.asm._emscripten_bind_b2World_QueryAABB_2.apply(null, +arguments)},Av=b._emscripten_bind_b2Profile_set_collide_1=function(){return b.asm._emscripten_bind_b2Profile_set_collide_1.apply(null,arguments)},Bv=b._emscripten_bind_b2BodyDef_get_userData_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_userData_0.apply(null,arguments)},Cv=b._emscripten_bind_b2MotorJoint_SetLinearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetLinearOffset_1.apply(null,arguments)},Dv=b._emscripten_bind_b2FrictionJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxForce_0.apply(null, +arguments)},Ev=b._emscripten_bind_b2WheelJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_userData_0.apply(null,arguments)},Fv=b._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0.apply(null,arguments)},Gv=b._emscripten_bind_b2World_SetDestructionListener_1=function(){return b.asm._emscripten_bind_b2World_SetDestructionListener_1.apply(null,arguments)},Hv=b._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1.apply(null,arguments)},Iv=b._emscripten_bind_b2WeldJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyB_1.apply(null,arguments)},Jv=b._emscripten_bind_b2Transform_set_p_1=function(){return b.asm._emscripten_bind_b2Transform_set_p_1.apply(null,arguments)},Kv=b._emscripten_bind_b2DistanceJoint_SetLength_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetLength_1.apply(null,arguments)}, +Lv=b._emscripten_bind_b2ManifoldPoint_get_localPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_localPoint_0.apply(null,arguments)},Mv=b._emscripten_bind_b2JointEdge_get_joint_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_joint_0.apply(null,arguments)},Nv=b._emscripten_bind_b2Body_GetLocalCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetLocalCenter_0.apply(null,arguments)},Ov=b._emscripten_bind_b2FixtureDef___destroy___0=function(){return b.asm._emscripten_bind_b2FixtureDef___destroy___0.apply(null, +arguments)},Pv=b._emscripten_bind_b2MouseJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJoint___destroy___0.apply(null,arguments)},Qv=b._emscripten_enum_b2JointType_e_ropeJoint=function(){return b.asm._emscripten_enum_b2JointType_e_ropeJoint.apply(null,arguments)},Rv=b._emscripten_bind_b2Profile_get_solveVelocity_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveVelocity_0.apply(null,arguments)},Sv=b._emscripten_bind_b2WeldJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyB_0.apply(null, +arguments)},Tv=b._emscripten_bind_b2World_GetContinuousPhysics_0=function(){return b.asm._emscripten_bind_b2World_GetContinuousPhysics_0.apply(null,arguments)},Uv=b._emscripten_bind_b2Joint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyA_0.apply(null,arguments)},Vv=b._emscripten_bind_b2MotorJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxTorque_1.apply(null,arguments)},Wv=b._emscripten_bind_b2PulleyJointDef_Initialize_7=function(){return b.asm._emscripten_bind_b2PulleyJointDef_Initialize_7.apply(null, +arguments)},Xv=b._emscripten_bind_b2GearJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyB_1.apply(null,arguments)},Yv=b._emscripten_bind_b2RopeJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionTorque_1.apply(null,arguments)},Zv=b._emscripten_bind_b2WheelJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_dampingRatio_1.apply(null,arguments)},$v=b._emscripten_bind_b2GearJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2GearJoint_GetType_0.apply(null,arguments)},aw=b._emscripten_bind_b2MotorJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetNext_0.apply(null,arguments)},bw=b._emscripten_bind_b2EdgeShape_set_m_vertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex0_1.apply(null,arguments)},cw=b._emscripten_bind_b2RevoluteJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorB_0.apply(null,arguments)}, +dw=b._emscripten_bind_b2RopeJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorB_1.apply(null,arguments)},ew=b._emscripten_bind_b2PrismaticJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUserData_0.apply(null,arguments)},fw=b._emscripten_bind_b2GearJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_userData_1.apply(null,arguments)},gw=b._emscripten_bind_b2Fixture_SetSensor_1=function(){return b.asm._emscripten_bind_b2Fixture_SetSensor_1.apply(null, +arguments)},hw=b._emscripten_bind_b2MotorJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_collideConnected_1.apply(null,arguments)},iw=b._emscripten_bind_b2Contact_GetFixtureB_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureB_0.apply(null,arguments)},jw=b._emscripten_bind_b2ChainShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeMass_2.apply(null,arguments)},kw=b._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0.apply(null,arguments)},lw=b._emscripten_bind_b2Contact_GetChildIndexA_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexA_0.apply(null,arguments)},mw=b._emscripten_bind_b2RopeJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyB_0.apply(null,arguments)},nw=b._emscripten_bind_b2BodyDef_b2BodyDef_0=function(){return b.asm._emscripten_bind_b2BodyDef_b2BodyDef_0.apply(null,arguments)}, +ow=b._emscripten_bind_b2MassData_get_mass_0=function(){return b.asm._emscripten_bind_b2MassData_get_mass_0.apply(null,arguments)},pw=b._emscripten_bind_b2WorldManifold_get_separations_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_separations_1.apply(null,arguments)},qw=b._emscripten_bind_b2Joint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyB_0.apply(null,arguments)},rw=b._emscripten_bind_b2Shape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2Shape_GetChildCount_0.apply(null, +arguments)},sw=b._emscripten_bind_b2WheelJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAxisA_1.apply(null,arguments)},tw=b._emscripten_bind_b2Joint_Dump_0=function(){return b.asm._emscripten_bind_b2Joint_Dump_0.apply(null,arguments)},uw=b._emscripten_bind_b2World_SetContactFilter_1=function(){return b.asm._emscripten_bind_b2World_SetContactFilter_1.apply(null,arguments)},vw=b._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1.apply(null, +arguments)},ww=b._emscripten_bind_b2MotorJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyA_0.apply(null,arguments)},xw=b._emscripten_bind_b2WheelJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_enableMotor_0.apply(null,arguments)},yw=b._emscripten_bind_b2Vec2_LengthSquared_0=function(){return b.asm._emscripten_bind_b2Vec2_LengthSquared_0.apply(null,arguments)},zw=b._emscripten_bind_b2FrictionJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyA_1.apply(null, +arguments)},Aw=b._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0.apply(null,arguments)},Bw=b._emscripten_bind_b2ContactEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_prev_1.apply(null,arguments)},Cw=b._emscripten_bind_b2Shape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2Shape_ComputeMass_2.apply(null,arguments)},Dw=b._emscripten_bind_b2FrictionJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyA_0.apply(null, +arguments)},Ew=b._emscripten_bind_b2WheelJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorB_1.apply(null,arguments)},Fw=b._emscripten_bind_b2Body_GetAngle_0=function(){return b.asm._emscripten_bind_b2Body_GetAngle_0.apply(null,arguments)},Gw=b._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0.apply(null,arguments)},Hw=b._emscripten_bind_b2DistanceJoint_GetBodyA_0= +function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyA_0.apply(null,arguments)},Iw=b._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0.apply(null,arguments)},Jw=b._emscripten_bind_b2PulleyJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyA_1.apply(null,arguments)},Kw=b._emscripten_bind_b2WheelJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorB_0.apply(null, +arguments)},Lw=b._emscripten_bind_b2PolygonShape_SetAsBox_2=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_2.apply(null,arguments)},Mw=b._emscripten_bind_b2PrismaticJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_type_0.apply(null,arguments)},Nw=b._emscripten_bind_b2Color_Set_3=function(){return b.asm._emscripten_bind_b2Color_Set_3.apply(null,arguments)},Ow=b._emscripten_bind_b2WheelJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyA_0.apply(null, +arguments)},Pw=b._emscripten_enum_b2LimitState_e_atUpperLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atUpperLimit.apply(null,arguments)},Qw=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1.apply(null,arguments)},Rw=b._emscripten_bind_b2PolygonShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_type_0.apply(null,arguments)},Sw=b._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1= +function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1.apply(null,arguments)},Tw=b._emscripten_bind_b2PulleyJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_collideConnected_0.apply(null,arguments)},Uw=b._emscripten_bind_JSContactListener_JSContactListener_0=function(){return b.asm._emscripten_bind_JSContactListener_JSContactListener_0.apply(null,arguments)},Vw=b._emscripten_bind_b2WheelJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJoint___destroy___0.apply(null, +arguments)},Ww=b._emscripten_bind_b2PolygonShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_radius_1.apply(null,arguments)},Xw=b._emscripten_bind_b2Fixture_GetMassData_1=function(){return b.asm._emscripten_bind_b2Fixture_GetMassData_1.apply(null,arguments)},Yw=b._emscripten_bind_b2RopeJoint_SetMaxLength_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetMaxLength_1.apply(null,arguments)};b.dynCall_iiii=function(){return b.asm.dynCall_iiii.apply(null,arguments)}; +b.dynCall_viifii=function(){return b.asm.dynCall_viifii.apply(null,arguments)};b.dynCall_viiiii=function(){return b.asm.dynCall_viiiii.apply(null,arguments)};b.dynCall_vi=function(){return b.asm.dynCall_vi.apply(null,arguments)};b.dynCall_vii=function(){return b.asm.dynCall_vii.apply(null,arguments)};b.dynCall_ii=function(){return b.asm.dynCall_ii.apply(null,arguments)};b.dynCall_fif=function(){return b.asm.dynCall_fif.apply(null,arguments)}; +b.dynCall_viii=function(){return b.asm.dynCall_viii.apply(null,arguments)};b.dynCall_viifi=function(){return b.asm.dynCall_viifi.apply(null,arguments)};b.dynCall_v=function(){return b.asm.dynCall_v.apply(null,arguments)};b.dynCall_viif=function(){return b.asm.dynCall_viif.apply(null,arguments)};b.dynCall_viiiiii=function(){return b.asm.dynCall_viiiiii.apply(null,arguments)};b.dynCall_iii=function(){return b.asm.dynCall_iii.apply(null,arguments)}; +b.dynCall_iiiiii=function(){return b.asm.dynCall_iiiiii.apply(null,arguments)};b.dynCall_fiiiif=function(){return b.asm.dynCall_fiiiif.apply(null,arguments)};b.dynCall_viiii=function(){return b.asm.dynCall_viiii.apply(null,arguments)};f.t=b.stackAlloc;f.L=b.stackSave;f.K=b.stackRestore;f.R=b.establishStackSpace;f.f=b.setTempRet0;f.H=b.getTempRet0;b.asm=Sb; +if(zb)if("function"===typeof b.locateFile?zb=b.locateFile(zb):b.memoryInitializerPrefixURL&&(zb=b.memoryInitializerPrefixURL+zb),ea||fa){var Zw=b.readBinary(zb);Da.set(Zw,f.i)}else{var ax=function(){b.readAsync(zb,$w,function(){throw"could not load memory initializer "+zb;})};xb();var $w=function(a){a.byteLength&&(a=new Uint8Array(a));Da.set(a,f.i);b.memoryInitializerRequest&&delete b.memoryInitializerRequest.response;yb()};if(b.memoryInitializerRequest){var bx=function(){var a=b.memoryInitializerRequest; +200!==a.status&&0!==a.status?(console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+a.status+", retrying "+zb),ax()):$w(a.response)};b.memoryInitializerRequest.response?setTimeout(bx,0):b.memoryInitializerRequest.addEventListener("load",bx)}else ax()}b.then=function(a){if(b.calledRun)a(b);else{var c=b.onRuntimeInitialized;b.onRuntimeInitialized=function(){c&&c();a(b)}}return b}; +function ja(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}ja.prototype=Error();ja.prototype.constructor=ja;var cx=null,wb=function dx(){b.calledRun||ex();b.calledRun||(wb=dx)}; +b.callMain=b.O=function(a){function c(){for(var a=0;3>a;a++)e.push(0)}a=a||[];pb||(pb=!0,hb(jb));var d=a.length+1,e=[Ba(rb(b.thisProgram),"i8",0)];c();for(var g=0;g%","[[6,\" \"],[4,\"il.;:!'|\"],[6,\"j1,()[]`\"],[8,\"CEFILTZcfrtx-\\\"°+=*<>\"],[10,\"ABDGHJKNOPQRSUVXYabdeghknopqsuvyz023456789?_~£€\"],[12,\"MWmw#&\\/@%$\"]]",0.8,0,-5,1,0,0,true,1,false]],[[-128,130,0,16,10,0,0,[1,1,1,0.1],0.5,0.5,0,0,[],null,null,null,["",""]],15,110,[0],[],[true,"Animation 1",0,true]],[[-85,132,0,8,41,0,0,[1,1,1,0.55],0.5,0.5,0,0,[],null,null,null,["",""]],33,111,[],[[false]],[false,"Animation 1",0,true]],[[-106,145,0,12,33,0,0,[1,1,1,1],0.5833333333333334,0.48484848484848486,0,0,[],null,null,null,["",""]],3,112,[0],[[false]],[true,"Animation 1",0,true]],[[-59,121,0,9,12,0,0,[1,1,1,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],5,113,[0],[[false]],[true,"Animation 1",0,true]],[[-74,121,0,9,12,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],4,114,[0,-1],[[false,2,false,1,0,0,0,0.01,false,true]],[true,"Animation 1",0,true]],[[-72,164,0,14,33,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,1,0,0,[],null,null,null,["",""]],1,115,[0,-1,0,1,0],[[false,0,true,0,1,0,0,0,false,true],[]],[true,"Animation 1",0,true]],[[-107,124,0,8,9,0,0,[1,1,1,1],0.625,0.4444444444444444,0,0,[],null,null,null,["",""]],12,116,[0],[[false]],[true,"Animation 1",0,true]],[[-96,109,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],13,117,[0],[[false]],[true,"Animation 1",0,true]],[[-108,108,0,10,10,0,0,[1,1,1,1],0.7,0.5,0,0,[],null,null,null,["",""]],10,118,[0],[[false]],[true,"Animation 1",0,true]],[[-67,106,0,11,9,0,0,[1,1,1,1],0.7272727272727273,0.6666666666666666,0,0,[],null,null,null,["",""]],11,120,[0],[[false]],[true,"Animation 1",1,true]],[[28,31,0,7,22,0,0,[1,1,1,1],0.5,0.13636363636363635,0,0,[],null,null,null,["",""]],70,122,[0,0],[[true]],[true,"Animation 1",0,true]],[[-27,107,0,7,22,0,0,[1,1,1,1],0.5,0.13636363636363635,0,0,[],null,null,null,["",""]],95,127,[0,0],[[false]],[true,"Animation 1",0,true]]],[],0,true,false,[]]],[],[]],["intro",290,190,true,false,0.5,0.5,"introEvent",368582379828410,[["Layer 0",0,537390446862752,true,[94,94,94],false,1,1,1,false,false,1,0,true,[],[],0,true,false,[]],["Top",1,407097048176507,true,[94,94,94],true,1,1,1,false,false,1,0,true,[[[145.00000758716743,94.45773315429688,0,429,265,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],58,136,[],[],[true,"Default",0,true]],[[145.00000758716743,94.45773315429688,0,16,16,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],59,137,[],[],[true,"Default",0,true]],[[145.00000758716743,94.45773315429688,0,63,21,0,0,[1,1,1,1],0.504,0.512195,0,0,[],null,null,null,["",""]],60,139,[],[[5,0,1,0,0,0,1,0,true]],[false,"Default",0,true]],[[145.1565640998085,95.00000000000003,0,290,190,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],109,146,[],[[0,0,1,1,true]],[true,"Animation 1",0,true]],[[145.09172589868294,95.3135089578463,0,60.25944796887612,11.520188582285144,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],108,147,[],[],[true,"Animation 1",0,true]]],[],0,true,false,[]]],[],[]]],[["player1Event",[[2,"ResfreshRate",false],[3,[true,"P1"],false,null,358572348294868,1,[[-1,20,null,0,false,false,false,0,false,[[1,[0]]]]],[],[[0,0,false,null,593242181083741,2,[[-1,21,null,1,false,false,false,876331500105820,null]],[[1,22,"Physics",720016080382001,0,null,[[7,[1]],[4,4],[0,[2]],[0,[3]]]],[1,23,"Physics",495097236752853,0,null,[[3,1]]],[33,24,"Pin",198612293472283,0,null,[[4,1],[3,0]]]],[[0,0,false,null,934715757434220,3,[[3,25,null,0,false,false,false,568852100026373,null,[[10,0],[8,0],[7,[4]]]]],[[3,24,"Pin",674756769711161,0,null,[[4,1],[3,0]]]]],[0,0,false,null,413422421011319,4,[[5,25,null,0,false,false,false,715155388126363,null,[[10,0],[8,0],[7,[4]]]]],[[5,24,"Pin",458879077254011,0,null,[[4,4],[3,0]]]]]]],[0,0,false,null,310986542063623,5,[[-1,26,null,0,false,false,false,535869808332924,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,true,null,942268121220674,6,[[1,27,null,0,false,false,false,359129687405720,null,[[4,8]]]],[],[[0,0,false,null,305147711732010,7,[[-1,28,null,0,false,false,false,586190033743681,null]],[],[[0,0,false,null,206375801539629,8,[[16,25,null,0,false,false,false,166025710802051,null,[[10,0],[8,0],[7,[5]]]]],[[1,29,"Physics",832718650829502,0,null,[[0,[6,[0,1,"Physics",30,false],[4,31]]],[0,[4]],[7,[4]]]]]],[0,0,false,null,151171419681710,9,[[1,32,null,0,false,false,false,450700339422295,null,[[8,5],[0,[7,[1,1,33,false]]]]]],[[1,34,null,923501162274283,0,null,[[10,2],[7,[8,[4,35],[3,455877582027442],[3,262420649510634]]]]]]],[0,0,false,null,178109828076252,10,[[1,32,null,0,false,false,false,103331473935911,null,[[8,2],[0,[7,[1,1,33,false]]]]]],[[1,34,null,777457578607581,0,null,[[10,2],[7,[9,[4,35],[3,455877582027442],[3,262420649510634]]]]]]]]],[0,0,false,null,165254138397271,11,[[1,25,null,0,false,false,false,649011108133010,null,[[10,3],[8,0],[7,[5]]]]],[[1,34,null,254087149024058,0,null,[[10,3],[7,[4]]]],[1,34,null,158780388755314,0,null,[[10,4],[7,[4]]]]]],[0,0,true,null,590053134686673,12,[[1,36,null,0,false,false,false,792593073511633,null,[[8,2],[0,[7,[1,1,37,false]]]]]],[],[[0,0,false,null,188956435583799,13,[[1,32,null,0,false,false,false,849793453035647,null,[[8,4],[0,[7,[1,1,33,false]]]]]],[[1,34,null,228024798866965,0,null,[[10,2],[7,[10,[3,412696536558178]]]]]]],[0,0,false,null,911891623733351,14,[[1,32,null,0,false,false,false,883364628927467,null,[[8,2],[0,[7,[1,1,33,false]]]]]],[[1,34,null,529045151781458,0,null,[[10,2],[7,[11,[3,412696536558178]]]]]]]]],[0,0,false,null,923406388592222,15,[],[[1,38,"Physics",421078003187160,0,null,[[0,[12,[2,1,false,2],[4,31],[3,867747672923081]]]]],[1,34,null,644486815551421,0,null,[[10,2],[7,[13,[2,1,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,785167247567145,16,[[1,39,null,0,false,false,false,372677961569963,null,[[0,[14]],[0,[15]]]]],[[1,34,null,794764119218815,0,null,[[10,2],[7,[16,[2,1,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,211203400027743,17,[[-1,40,null,0,false,false,false,978191480065098,null]],[],[[0,0,false,null,992431531742961,18,[[1,32,null,0,false,false,false,358155049455613,null,[[8,4],[0,[7,[1,1,33,false]]]]]],[[1,41,null,229380835046682,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]],[0,0,false,null,184912169702021,19,[[1,32,null,0,false,false,false,859435501462090,null,[[8,2],[0,[7,[1,1,33,false]]]]]],[[1,42,null,388436321658740,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]]]]]]]]]],[3,[true,"Control P1"],false,null,773979917705646,20,[[-1,20,null,0,false,false,false,0,false,[[1,[18]]]]],[],[[1,"upArrow",0,0,true,false,711563083397915,false,144],[1,"speed",0,10,false,false,257659733919073,false,145],[0,0,false,null,552828642316883,21,[[-1,26,null,0,false,false,false,625222148475293,null,[[11,308680730337585],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,993112425181474,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,588005299947371,null]],[],[[0,0,false,null,416910238897218,22,[[70,25,null,0,false,false,false,938623608840545,null,[[10,1],[8,0],[7,[4]]]],[70,25,null,0,false,false,false,456398126002521,null,[[10,0],[8,0],[7,[5]]]]],[[70,34,null,343986069156247,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,725864200615173,23,[[-1,26,null,0,false,false,false,566727334670668,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,false,null,946030165402141,24,[[-1,26,null,0,false,false,false,820066421753963,null,[[11,308680730337585],[8,0],[7,[5]]]]],[],[[0,0,false,null,899981654250281,25,[[114,25,null,0,false,true,false,497326274285660,null,[[10,4],[8,0],[7,[19]]]]],[],[[0,0,false,null,699546004154399,26,[[1,25,null,0,false,false,false,964421288177689,null,[[10,4],[8,2],[7,[3]]]]],[[1,43,"Physics",794691175796397,0,null,[[0,[20,[3,929772105325521],[4,31]]],[0,[7,[1,1,33,false]]],[0,[7,[1,1,37,false]]],[7,[4]]]],[1,41,null,496599192852085,0,null,[[10,4],[7,[20,[3,207852114368060],[4,31]]]]]]],[0,0,false,null,476016184282325,27,[[-1,44,null,0,false,false,false,801612159035751,null,[[7,[21,[1,70,45,false]]],[8,2],[7,[22]]]]],[[70,46,null,751907587215040,0,null,[[0,[23,[1,70,45,false],[3,324338522464560]]]]]]],[0,0,false,null,366724600043126,28,[[-1,40,null,0,false,false,false,434132272047745,null]],[[70,46,null,144320453848282,0,null,[[0,[22]]]]]]]]]],[0,0,false,null,244741237681839,29,[[-1,40,null,0,false,false,false,110959927832715,null]],[[-1,47,null,358265183925160,0,null,[[11,711563083397915],[7,[4]]]]],[[0,0,false,null,222212373381606,30,[[-1,44,null,0,false,false,false,186819858179724,null,[[7,[21,[1,70,45,false]]],[8,4],[7,[5]]]]],[[70,46,null,285672553350918,0,null,[[0,[24,[1,70,45,false],[3,324338522464560]]]]]]],[0,0,false,null,637981023839651,31,[[-1,40,null,0,false,false,false,259449078817219,null]],[[70,46,null,509011275119185,0,null,[[0,[4]]]]]],[0,0,false,null,698375956293112,32,[[-1,28,null,0,false,false,false,790461122024784,null]],[],[[0,0,false,null,126757185240966,33,[[70,25,null,0,false,false,false,988026308086131,null,[[10,1],[8,0],[7,[5]]]]],[],[[0,0,false,null,540052809311281,34,[[114,25,null,0,false,false,false,350783469060061,null,[[10,4],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,770129760769719,null,[[10,2],[8,0],[7,[5]]]]],[[114,34,null,424474178445018,0,null,[[10,2],[7,[4]]]],[114,34,null,579320114076581,0,null,[[10,3],[7,[4]]]],[114,34,null,268370789274682,0,null,[[10,4],[7,[25]]]],[70,34,null,304840646695695,0,null,[[10,1],[7,[4]]]],[70,34,null,737954840892961,0,null,[[10,0],[7,[4]]]],[114,48,"Physics",860647131988832,0,null,[[3,1]]],[114,49,"Physics",748969112445451,0,null,[[0,[25]],[0,[4]]]],[73,50,"Physics",162684030326862,0,null,[[4,114],[3,0]]],[114,51,"Timer",455545033234776,0,null,[[0,[26]],[3,0],[1,[27]]]],[114,52,"Physics",628393639569722,0,null,[[0,[28,[1,114,53,false],[1,70,45,false],[4,35],[4,31],[3,290347554392499]]],[0,[29,[1,114,54,false],[1,70,45,false],[4,35],[4,31],[3,290347554392499]]]]]]]]]]]]],[0,0,false,null,702678280556386,35,[[-1,26,null,0,false,false,false,687349995019924,null,[[11,308680730337585],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,173279213606157,null,[[11,711563083397915],[8,0],[7,[4]]]],[1,55,"Timer",0,false,true,false,781695763663376,null,[[1,[30]]]],[1,25,null,0,false,false,false,342407757546356,null,[[10,3],[8,0],[7,[4]]]],[114,25,null,0,false,true,false,153392122801074,null,[[10,4],[8,0],[7,[19]]]]],[[-1,47,null,818248304575681,0,null,[[11,711563083397915],[7,[5]]]]],[[0,0,false,null,959178106646176,36,[[-1,28,null,0,false,false,false,564470550971583,null]],[[1,34,null,271900900734864,0,null,[[10,2],[7,[4]]]],[1,34,null,649749676458283,0,null,[[10,3],[7,[5]]]],[1,51,"Timer",225983661996222,0,null,[[0,[31]],[3,0],[1,[30]]]]],[[0,0,false,null,157299684838858,37,[[1,27,null,0,false,false,false,345424722146389,null,[[4,8]]]],[[1,43,"Physics",155094221482008,0,null,[[0,[32]],[0,[7,[1,1,33,false]]],[0,[7,[1,1,37,false]]],[7,[4]]]],[1,52,"Physics",310998775689231,0,null,[[0,[4]],[0,[4]]]],[1,38,"Physics",387692832752883,0,null,[[0,[4]]]]]],[0,0,false,null,181977044853871,38,[[1,32,null,0,false,false,false,103803022414921,null,[[8,5],[0,[7,[1,1,33,false]]]]]],[[1,34,null,781851152151209,0,null,[[10,2],[7,[33,[1,1,53,false],[1,1,33,false]]]]]]],[0,0,false,null,849925058426814,39,[[1,32,null,0,false,false,false,726362170667594,null,[[8,2],[0,[7,[1,1,33,false]]]]]],[[1,34,null,495187505646712,0,null,[[10,2],[7,[33,[1,1,53,false],[1,1,33,false]]]]]]]]]]]]]]],[3,[true,"Skin P1"],false,null,151747921381704,40,[[-1,20,null,0,false,false,false,0,false,[[1,[34]]]]],[],[[0,0,false,null,127523010153940,41,[[-1,21,null,1,false,false,false,667353918404782,null]],[],[[0,0,false,null,771370272525417,42,[[11,25,null,0,false,false,false,362793171225709,null,[[10,0],[8,0],[7,[4]]]]],[[11,24,"Pin",310106108068067,0,null,[[4,4],[3,0]]]]],[0,0,false,null,157410180999361,43,[[10,25,null,0,false,false,false,569695464761998,null,[[10,0],[8,0],[7,[4]]]]],[[10,24,"Pin",631853399834632,0,null,[[4,1],[3,0]]]]],[0,0,false,null,449022685470371,44,[[12,25,null,0,false,false,false,253848280777568,null,[[10,0],[8,0],[7,[4]]]]],[[12,24,"Pin",603104718238034,0,null,[[4,1],[3,0]]]]],[0,0,false,null,314429908935790,45,[[13,25,null,0,false,false,false,492487144313120,null,[[10,0],[8,0],[7,[4]]]]],[[13,24,"Pin",687142109383193,0,null,[[4,1],[3,0]]]]]]],[0,0,false,null,827856178654243,46,[[15,25,null,0,false,false,false,767973367645181,null,[[10,0],[8,0],[7,[4]]]]],[[15,56,null,818111186263286,0,null,[[0,[35,[1,1,33,false]]]]],[15,57,null,139248267781031,0,null,[[0,[36,[4,58],[4,59],[1,15,54,false],[1,1,54,false]]]]]]]]],[3,[true,"Arm P1"],false,null,331386137542249,47,[[-1,20,null,0,false,false,false,0,false,[[1,[37]]]]],[],[[0,0,false,null,244364735059107,48,[],[[70,60,null,859827393848003,0,null,[[0,[38,[1,1,33,false]]],[0,[38,[1,1,37,false]]]]]]],[0,0,false,null,824947074579142,49,[],[[72,60,null,979014102818189,0,null,[[0,[7,[1,70,33,false]]],[0,[7,[1,70,37,false]]]]]]],[0,0,false,null,566945510704311,50,[[-1,26,null,0,false,false,false,216936724142084,null,[[11,727009003176844],[8,0],[7,[4]]]]],[],[[0,0,false,null,608609434004608,51,[[114,61,null,0,false,false,true,445444768562506,null,[[4,72]]],[114,36,null,0,false,false,false,558487793936839,null,[[8,5],[0,[39]]]],[114,25,null,0,false,false,false,383299320133560,null,[[10,3],[8,0],[7,[4]]]]],[[9,62,null,824871863120842,0,null,[[3,1],[4,70]]],[114,48,"Physics",506458898654824,0,null,[[3,0]]],[114,34,null,718870571754616,0,null,[[10,3],[7,[5]]]],[114,34,null,669807522279261,0,null,[[10,4],[7,[4]]]]]],[0,0,false,null,885981560619190,52,[[114,25,null,0,false,false,false,694392440941609,null,[[10,3],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,591152669184461,null,[[10,4],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,528000253512320,null,[[10,2],[8,0],[7,[4]]]]],[[114,60,null,419027740670923,0,null,[[0,[40,[1,114,53,false],[1,70,33,false],[4,31]]],[0,[40,[1,114,54,false],[1,70,37,false],[4,31]]]]]]],[0,0,false,null,606516460338740,53,[[114,25,null,0,false,false,false,640301020375675,null,[[10,2],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,614188342817215,null,[[10,4],[8,0],[7,[4]]]]],[[114,60,null,299151434114822,0,null,[[0,[7,[1,70,33,false]]],[0,[7,[1,70,37,false]]]]],[9,60,null,288647770106390,0,null,[[0,[7,[1,70,33,false]]],[0,[7,[1,70,37,false]]]]]]],[0,0,false,null,527325493904652,54,[[70,61,null,0,false,false,true,338945328294829,null,[[4,114]]],[114,25,null,0,false,false,false,636998986120047,null,[[10,4],[8,1],[7,[19]]]]],[[-2,"createBallFX2",null,996395151710084,0,null],[114,34,null,808024084369922,0,null,[[10,2],[7,[5]]]],[114,34,null,136090403883421,0,null,[[10,4],[7,[4]]]],[9,62,null,756101454638470,0,null,[[3,1],[4,70]]],[114,48,"Physics",216582909048591,0,null,[[3,0]]],[70,34,null,856285406077911,0,null,[[10,0],[7,[5]]]]]]]]]]]],["player2Event",[[2,"ResfreshRate",false],[3,[true,"P2"],false,null,896634254671890,1,[[-1,20,null,0,false,false,false,0,false,[[1,[41]]]]],[],[[0,0,false,null,512811263754309,2,[[-1,21,null,1,false,false,false,411972389090384,null]],[[35,22,"Physics",631493216900950,0,null,[[7,[1]],[4,34],[0,[2]],[0,[3]]]],[35,23,"Physics",541551067380339,0,null,[[3,1]]],[36,24,"Pin",319792672615968,0,null,[[4,35],[3,0]]]],[[0,0,false,null,239200076620084,3,[[3,25,null,0,false,false,false,877339222966090,null,[[10,0],[8,0],[7,[19]]]]],[[3,24,"Pin",400101417523117,0,null,[[4,35],[3,0]]]]],[0,0,false,null,537953268985936,4,[[5,25,null,0,false,false,false,590821952865849,null,[[10,0],[8,0],[7,[19]]]]],[[5,24,"Pin",681424255194672,0,null,[[4,34],[3,0]]]]]]],[0,0,false,null,238783277314030,5,[[-1,26,null,0,false,false,false,544855072116241,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,true,null,534354160535886,6,[[35,27,null,0,false,false,false,311518982445855,null,[[4,8]]]],[],[[0,0,false,null,342994014825293,7,[[-1,28,null,0,false,false,false,294199675710454,null]],[],[[0,0,false,null,112629231020164,8,[[16,25,null,0,false,false,false,189819815374955,null,[[10,0],[8,0],[7,[5]]]]],[[35,29,"Physics",820948532508231,0,null,[[0,[6,[0,35,"Physics",30,false],[4,31]]],[0,[4]],[7,[4]]]]]],[0,0,false,null,660019001959412,9,[[35,32,null,0,false,false,false,797407699357552,null,[[8,5],[0,[7,[1,35,33,false]]]]]],[[35,34,null,781603939088672,0,null,[[10,2],[7,[8,[4,35],[3,455877582027442],[3,262420649510634]]]]]]],[0,0,false,null,528600789421696,10,[[35,32,null,0,false,false,false,576279211560421,null,[[8,2],[0,[7,[1,35,33,false]]]]]],[[35,34,null,301059651802142,0,null,[[10,2],[7,[9,[4,35],[3,455877582027442],[3,262420649510634]]]]]]]]],[0,0,false,null,705825555079318,11,[[35,25,null,0,false,false,false,311665551288700,null,[[10,3],[8,0],[7,[5]]]]],[[35,34,null,241118272886853,0,null,[[10,3],[7,[4]]]],[35,34,null,951228062678946,0,null,[[10,4],[7,[4]]]]]],[0,0,true,null,390225270213239,12,[[35,36,null,0,false,false,false,855129736926910,null,[[8,2],[0,[7,[1,35,37,false]]]]]],[],[[0,0,false,null,365334633207281,13,[[35,32,null,0,false,false,false,128873044694607,null,[[8,4],[0,[7,[1,35,33,false]]]]]],[[35,34,null,602011095200415,0,null,[[10,2],[7,[10,[3,412696536558178]]]]]]],[0,0,false,null,334044447391593,14,[[35,32,null,0,false,false,false,248604885335862,null,[[8,2],[0,[7,[1,35,33,false]]]]]],[[35,34,null,206408304263411,0,null,[[10,2],[7,[11,[3,412696536558178]]]]]]]]],[0,0,false,null,573553129778265,15,[],[[35,38,"Physics",433548999614456,0,null,[[0,[12,[2,35,false,2],[4,31],[3,867747672923081]]]]],[35,34,null,487890600613508,0,null,[[10,2],[7,[13,[2,35,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,876543525777075,16,[[35,39,null,0,false,false,false,891975922863380,null,[[0,[14]],[0,[15]]]]],[[35,34,null,453390597533107,0,null,[[10,2],[7,[16,[2,35,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,251447515767127,17,[[-1,40,null,0,false,false,false,502090644484524,null]],[],[[0,0,false,null,321348445265055,18,[[35,32,null,0,false,false,false,609994326198657,null,[[8,4],[0,[7,[1,35,33,false]]]]]],[[35,41,null,428206454381421,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]],[0,0,false,null,389244103180077,19,[[35,32,null,0,false,false,false,854482220419897,null,[[8,2],[0,[7,[1,35,33,false]]]]]],[[35,42,null,810947230766209,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]]]]]]]]]],[3,[true,"Control P2"],false,null,245733731544468,20,[[-1,20,null,0,false,false,false,0,false,[[1,[42]]]]],[],[[1,"upArrow",0,0,true,false,590489090194202,false,144],[1,"speed",0,10,false,false,927675595273087,false,145],[0,0,false,null,814806773700711,21,[[-1,26,null,0,false,false,false,316888844087322,null,[[11,308680730337585],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,400203032188409,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,827745828226835,null]],[],[[0,0,false,null,402189739575292,22,[[77,25,null,0,false,false,false,859447110050121,null,[[10,1],[8,0],[7,[4]]]],[77,25,null,0,false,false,false,990691255126142,null,[[10,0],[8,0],[7,[5]]]]],[[77,34,null,721818407966026,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,505156824463730,23,[[-1,26,null,0,false,false,false,446095170211297,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,false,null,215370243112877,24,[[-1,26,null,0,false,false,false,248625076631821,null,[[11,308680730337585],[8,0],[7,[5]]]]],[],[[0,0,false,null,726520838634829,25,[[114,25,null,0,false,true,false,965319924352234,null,[[10,4],[8,0],[7,[4]]]]],[],[[0,0,false,null,407389824715472,26,[[35,25,null,0,false,false,false,890602085666595,null,[[10,4],[8,2],[7,[3]]]]],[[35,43,"Physics",294813442993718,0,null,[[0,[20,[3,929772105325521],[4,31]]],[0,[7,[1,35,33,false]]],[0,[7,[1,35,37,false]]],[7,[4]]]],[35,41,null,397418712154814,0,null,[[10,4],[7,[20,[3,207852114368060],[4,31]]]]]]],[0,0,false,null,432236192874141,27,[[-1,44,null,0,false,false,false,250573861537864,null,[[7,[21,[1,77,45,false]]],[8,2],[7,[22]]]]],[[77,46,null,383104207796254,0,null,[[0,[23,[1,77,45,false],[3,324338522464560]]]]]]],[0,0,false,null,635377763487932,28,[[-1,40,null,0,false,false,false,264613839996183,null]],[[77,46,null,377804293567135,0,null,[[0,[22]]]]]]]]]],[0,0,false,null,684950945399562,29,[[-1,40,null,0,false,false,false,956737540586373,null]],[[-1,47,null,352895211063821,0,null,[[11,590489090194202],[7,[4]]]]],[[0,0,false,null,556037113895032,30,[[-1,44,null,0,false,false,false,740386884752570,null,[[7,[21,[1,77,45,false]]],[8,4],[7,[5]]]]],[[77,46,null,720188160947747,0,null,[[0,[24,[1,77,45,false],[3,324338522464560]]]]]]],[0,0,false,null,518640631432555,31,[[-1,40,null,0,false,false,false,640153404631440,null]],[[77,46,null,666612892071790,0,null,[[0,[4]]]]]],[0,0,false,null,648261011665779,32,[[-1,28,null,0,false,false,false,954782657597247,null]],[],[[0,0,false,null,939299236634509,33,[[77,25,null,0,false,false,false,339454981468828,null,[[10,1],[8,0],[7,[5]]]]],[],[[0,0,false,null,557125470496345,34,[[114,25,null,0,false,false,false,632981993276414,null,[[10,4],[8,0],[7,[19]]]],[114,25,null,0,false,false,false,581987610468529,null,[[10,2],[8,0],[7,[5]]]]],[[114,34,null,628040187892727,0,null,[[10,2],[7,[4]]]],[77,34,null,702914687832068,0,null,[[10,1],[7,[4]]]],[77,34,null,175527426595799,0,null,[[10,0],[7,[4]]]],[114,34,null,572137664247287,0,null,[[10,4],[7,[25]]]],[114,48,"Physics",966338701045987,0,null,[[3,1]]],[114,34,null,632287520117741,0,null,[[10,3],[7,[4]]]],[114,49,"Physics",991775107574732,0,null,[[0,[25]],[0,[4]]]],[73,50,"Physics",738653719466911,0,null,[[4,114],[3,0]]],[114,51,"Timer",926862856101145,0,null,[[0,[26]],[3,0],[1,[27]]]],[114,52,"Physics",639083824168804,0,null,[[0,[28,[1,114,53,false],[1,77,45,false],[4,35],[4,31],[3,290347554392499]]],[0,[29,[1,114,54,false],[1,77,45,false],[4,35],[4,31],[3,290347554392499]]]]]]]]]]]]],[0,0,false,null,616908348390767,35,[[-1,26,null,0,false,false,false,669724380988829,null,[[11,308680730337585],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,382381163460512,null,[[11,590489090194202],[8,0],[7,[4]]]],[35,55,"Timer",0,false,true,false,648985787960226,null,[[1,[30]]]],[35,25,null,0,false,false,false,109890889448089,null,[[10,3],[8,0],[7,[4]]]],[114,25,null,0,false,true,false,791472912811160,null,[[10,4],[8,0],[7,[4]]]]],[[-1,47,null,697267730353986,0,null,[[11,590489090194202],[7,[5]]]]],[[0,0,false,null,613432754696780,36,[[-1,28,null,0,false,false,false,438405668872728,null]],[[35,34,null,665807643862225,0,null,[[10,2],[7,[4]]]],[35,34,null,957153843481735,0,null,[[10,3],[7,[5]]]],[35,51,"Timer",664868530532041,0,null,[[0,[31]],[3,0],[1,[30]]]]],[[0,0,false,null,874208867659848,37,[[35,27,null,0,false,false,false,738853261323931,null,[[4,8]]]],[[35,43,"Physics",506139320970948,0,null,[[0,[32]],[0,[7,[1,35,33,false]]],[0,[7,[1,35,37,false]]],[7,[4]]]],[35,52,"Physics",287494865638416,0,null,[[0,[4]],[0,[4]]]],[35,38,"Physics",973233553548550,0,null,[[0,[4]]]]]],[0,0,false,null,751560040463591,38,[[35,32,null,0,false,false,false,112671360590332,null,[[8,5],[0,[7,[1,35,33,false]]]]]],[[35,34,null,600049787022092,0,null,[[10,2],[7,[33,[1,35,53,false],[1,35,33,false]]]]]]],[0,0,false,null,259167491917570,39,[[35,32,null,0,false,false,false,765466087036517,null,[[8,2],[0,[7,[1,35,33,false]]]]]],[[35,34,null,148768171420280,0,null,[[10,2],[7,[33,[1,35,53,false],[1,35,33,false]]]]]]]]]]]]]]],[3,[true,"Skin P2"],false,null,128404258333510,40,[[-1,20,null,0,false,false,false,0,false,[[1,[43]]]]],[],[[0,0,false,null,591837796125362,41,[[-1,21,null,1,false,false,false,238877609676214,null]],[],[[0,0,false,null,614540511751931,42,[[11,25,null,0,false,false,false,519348469460962,null,[[10,0],[8,0],[7,[19]]]]],[[11,24,"Pin",303926236419256,0,null,[[4,34],[3,0]]]]],[0,0,false,null,141536081437670,43,[[10,25,null,0,false,false,false,394426183762051,null,[[10,0],[8,0],[7,[19]]]]],[[10,24,"Pin",986254334827111,0,null,[[4,35],[3,0]]]]],[0,0,false,null,676055081340688,44,[[12,25,null,0,false,false,false,701233058489297,null,[[10,0],[8,0],[7,[19]]]]],[[12,24,"Pin",243632957322074,0,null,[[4,35],[3,0]]]]],[0,0,false,null,895485936138289,45,[[13,25,null,0,false,false,false,764875140561735,null,[[10,0],[8,0],[7,[19]]]]],[[13,24,"Pin",817650586474518,0,null,[[4,35],[3,0]]]]]]],[0,0,false,null,487002227161357,46,[[15,25,null,0,false,false,false,908849471205933,null,[[10,0],[8,0],[7,[19]]]]],[[15,56,null,227090868381008,0,null,[[0,[35,[1,35,33,false]]]]],[15,57,null,822302980882280,0,null,[[0,[36,[4,58],[4,59],[1,15,54,false],[1,35,54,false]]]]]]]]],[3,[true,"Arm P2"],false,null,762782988296775,47,[[-1,20,null,0,false,false,false,0,false,[[1,[44]]]]],[],[[0,0,false,null,386629780104495,48,[],[[77,60,null,781819198793230,0,null,[[0,[38,[1,35,33,false]]],[0,[38,[1,35,37,false]]]]]]],[0,0,false,null,938857600938378,49,[],[[80,60,null,379906525226908,0,null,[[0,[7,[1,77,33,false]]],[0,[7,[1,77,37,false]]]]]]],[0,0,false,null,367868440528332,50,[[-1,26,null,0,false,false,false,422140019735445,null,[[11,727009003176844],[8,0],[7,[4]]]]],[],[[0,0,false,null,938299090838197,51,[[114,61,null,0,false,false,true,488739205264261,null,[[4,80]]],[114,36,null,0,false,false,false,203076552141335,null,[[8,5],[0,[39]]]],[114,25,null,0,false,false,false,643335018981502,null,[[10,3],[8,0],[7,[4]]]]],[[9,62,null,233546873141707,0,null,[[3,1],[4,77]]],[114,34,null,654007456270349,0,null,[[10,4],[7,[19]]]],[114,48,"Physics",822221422169706,0,null,[[3,0]]],[114,34,null,408705758478378,0,null,[[10,3],[7,[5]]]]]],[0,0,false,null,199974876125198,52,[[114,25,null,0,false,false,false,698785503610947,null,[[10,3],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,103585912514824,null,[[10,4],[8,0],[7,[19]]]],[114,25,null,0,false,false,false,278823729298252,null,[[10,2],[8,0],[7,[4]]]]],[[114,60,null,863119186323297,0,null,[[0,[40,[1,114,53,false],[1,77,33,false],[4,31]]],[0,[40,[1,114,54,false],[1,77,37,false],[4,31]]]]]]],[0,0,false,null,603210034122569,53,[[114,25,null,0,false,false,false,948575964015892,null,[[10,2],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,919663696784687,null,[[10,4],[8,0],[7,[19]]]]],[[114,60,null,412038971427577,0,null,[[0,[7,[1,77,33,false]]],[0,[7,[1,77,37,false]]]]],[9,60,null,504613425875611,0,null,[[0,[7,[1,77,33,false]]],[0,[7,[1,77,37,false]]]]]],[[0,0,false,null,235388138741847,54,[[-1,28,null,0,false,false,false,243762513011615,null]],[[-2,"createBallFX",null,954421111616884,0,null]]]]],[0,0,false,null,562275679529556,55,[[77,61,null,0,false,false,true,913286584477878,null,[[4,114]]],[114,25,null,0,false,false,false,406826044130612,null,[[10,4],[8,1],[7,[4]]]]],[[-2,"createBallFX2",null,417837845777917,0,null],[114,34,null,285492343280015,0,null,[[10,2],[7,[5]]]],[9,62,null,886783872712883,0,null,[[3,1],[4,77]]],[114,34,null,547959236494778,0,null,[[10,4],[7,[19]]]],[114,48,"Physics",772749574680982,0,null,[[3,0]]],[77,34,null,280210565162702,0,null,[[10,0],[7,[5]]]]]]]]]]]],["player3Event",[[2,"ResfreshRate",false],[3,[true,"P3"],false,null,382494310240054,1,[[-1,20,null,0,false,false,false,0,false,[[1,[45]]]]],[],[[0,0,false,null,750940904585247,2,[[-1,21,null,1,false,false,false,960198116291388,null]],[[30,22,"Physics",953465016652394,0,null,[[7,[1]],[4,29],[0,[2]],[0,[3]]]],[30,23,"Physics",822311801173131,0,null,[[3,1]]],[32,24,"Pin",596237907613739,0,null,[[4,30],[3,0]]]],[[0,0,false,null,406554981337087,3,[[3,25,null,0,false,false,false,953351399566515,null,[[10,0],[8,0],[7,[46]]]]],[[3,24,"Pin",875322160757097,0,null,[[4,30],[3,0]]]]],[0,0,false,null,230304047653791,4,[[5,25,null,0,false,false,false,721497225146556,null,[[10,0],[8,0],[7,[46]]]]],[[5,24,"Pin",206261383806501,0,null,[[4,29],[3,0]]]]]]],[0,0,false,null,495465135205289,5,[[-1,26,null,0,false,false,false,436570882246859,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,true,null,162831961513535,6,[[30,27,null,0,false,false,false,688914432562100,null,[[4,8]]]],[],[[0,0,false,null,391179812726916,7,[[-1,28,null,0,false,false,false,286870797895315,null]],[],[[0,0,false,null,642074166115191,8,[[16,25,null,0,false,false,false,612913020114458,null,[[10,0],[8,0],[7,[5]]]]],[[30,29,"Physics",304594275123495,0,null,[[0,[6,[0,30,"Physics",30,false],[4,31]]],[0,[4]],[7,[4]]]]]],[0,0,false,null,452498062896228,9,[[30,32,null,0,false,false,false,359754945225867,null,[[8,5],[0,[7,[1,30,33,false]]]]]],[[30,34,null,669819915661034,0,null,[[10,2],[7,[47,[4,35],[3,455877582027442],[3,262420649510634],[2,30,false,1]]]]]]],[0,0,false,null,624334190989661,10,[[30,32,null,0,false,false,false,398042214327226,null,[[8,2],[0,[7,[1,30,33,false]]]]]],[[30,34,null,284855281285836,0,null,[[10,2],[7,[48,[4,35],[3,455877582027442],[3,262420649510634],[2,30,false,1]]]]]]],[0,0,false,null,726912204335243,11,[],[[30,34,null,171015972048121,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,660856117128697,12,[[30,25,null,0,false,false,false,669915714811043,null,[[10,3],[8,0],[7,[5]]]]],[[30,34,null,230532593851399,0,null,[[10,3],[7,[4]]]],[30,34,null,474116906570215,0,null,[[10,4],[7,[4]]]]]],[0,0,true,null,775070453295281,13,[[30,36,null,0,false,false,false,990666682436560,null,[[8,2],[0,[7,[1,30,37,false]]]]]],[],[[0,0,false,null,469878728707629,14,[[30,32,null,0,false,false,false,902604571855623,null,[[8,4],[0,[7,[1,30,33,false]]]]]],[[30,34,null,204810005300736,0,null,[[10,2],[7,[10,[3,412696536558178]]]]]]],[0,0,false,null,527961531609936,15,[[30,32,null,0,false,false,false,843435028112462,null,[[8,2],[0,[7,[1,30,33,false]]]]]],[[30,34,null,233146996535263,0,null,[[10,2],[7,[11,[3,412696536558178]]]]]]]]],[0,0,false,null,355005122068944,16,[],[[30,38,"Physics",595758362400361,0,null,[[0,[12,[2,30,false,2],[4,31],[3,867747672923081]]]]],[30,34,null,305879438556223,0,null,[[10,2],[7,[13,[2,30,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,413112317691649,17,[[30,39,null,0,false,false,false,907231807965960,null,[[0,[14]],[0,[15]]]]],[[30,34,null,612400978160175,0,null,[[10,2],[7,[16,[2,30,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,168904531703449,18,[[-1,40,null,0,false,false,false,946799459563348,null]],[],[[0,0,false,null,539764860680307,19,[[30,32,null,0,false,false,false,444250712297719,null,[[8,4],[0,[7,[1,30,33,false]]]]]],[[30,41,null,942300176400026,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]],[0,0,false,null,338316626035163,20,[[30,32,null,0,false,false,false,893459074143325,null,[[8,2],[0,[7,[1,30,33,false]]]]]],[[30,42,null,771882398397381,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]]]]]]]]]],[3,[true,"Control P3"],false,null,965517901142642,21,[[-1,20,null,0,false,false,false,0,false,[[1,[49]]]]],[],[[1,"upArrow",0,0,true,false,267837901477967,false,144],[1,"speed",0,-10,false,false,681621315302548,false,145],[0,0,false,null,959982859373032,22,[[-1,26,null,0,false,false,false,355341747701641,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,588645784775553,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,440308707093738,null]],[],[[0,0,false,null,776863589070610,23,[[78,25,null,0,false,false,false,420594838579290,null,[[10,1],[8,0],[7,[4]]]],[78,25,null,0,false,false,false,773277187268136,null,[[10,0],[8,0],[7,[5]]]]],[[78,34,null,113382576599862,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,614108099515919,24,[[-1,26,null,0,false,false,false,121901276770429,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,false,null,708787583945531,25,[[-1,26,null,0,false,false,false,944623729759648,null,[[11,284675396607854],[8,0],[7,[5]]]]],[],[[0,0,false,null,938692439628333,26,[[114,25,null,0,false,true,false,585533481272226,null,[[10,4],[8,0],[7,[50]]]]],[],[[0,0,false,null,686639762964698,27,[[30,25,null,0,false,false,false,874769129709949,null,[[10,4],[8,2],[7,[3]]]]],[[30,43,"Physics",943570483630003,0,null,[[0,[20,[3,929772105325521],[4,31]]],[0,[7,[1,30,33,false]]],[0,[7,[1,30,37,false]]],[7,[4]]]],[30,41,null,607386093274049,0,null,[[10,4],[7,[20,[3,207852114368060],[4,31]]]]]]],[0,0,false,null,845085860845074,28,[[-1,44,null,0,false,false,false,666441162784853,null,[[7,[51,[4,63],[1,78,45,false]]],[8,4],[7,[4]]]]],[[78,46,null,513715050109166,0,null,[[0,[52,[1,78,45,false],[3,324338522464560]]]]]]],[0,0,false,null,347270919383244,29,[[-1,40,null,0,false,false,false,230449727598999,null]],[[78,46,null,529009324150274,0,null,[[0,[22]]]]]]]]]],[0,0,false,null,444358040598881,30,[[-1,40,null,0,false,false,false,190745137620572,null]],[[-1,47,null,280986605905812,0,null,[[11,267837901477967],[7,[4]]]]],[[0,0,false,null,901743096349906,31,[[-1,44,null,0,false,false,false,972440935541931,null,[[7,[21,[1,78,45,false]]],[8,4],[7,[5]]]]],[[78,46,null,244111314483164,0,null,[[0,[53,[1,78,45,false],[3,324338522464560]]]]]]],[0,0,false,null,874298186925040,32,[[-1,40,null,0,false,false,false,756981585212016,null]],[[78,46,null,506663439531300,0,null,[[0,[4]]]]]],[0,0,false,null,955404500653853,33,[[-1,28,null,0,false,false,false,903790730841603,null]],[],[[0,0,false,null,607054488240373,34,[[78,25,null,0,false,false,false,441599822056034,null,[[10,1],[8,0],[7,[5]]]]],[],[[0,0,false,null,606011255588960,35,[[114,25,null,0,false,false,false,316845845258517,null,[[10,4],[8,0],[7,[46]]]],[114,25,null,0,false,false,false,316250698295896,null,[[10,2],[8,0],[7,[5]]]]],[[114,34,null,148066819742764,0,null,[[10,2],[7,[4]]]],[78,34,null,974367702035979,0,null,[[10,1],[7,[4]]]],[78,34,null,120198909751088,0,null,[[10,0],[7,[4]]]],[114,34,null,627040990025436,0,null,[[10,4],[7,[25]]]],[114,48,"Physics",148795715372760,0,null,[[3,1]]],[114,34,null,327774446121542,0,null,[[10,3],[7,[4]]]],[114,49,"Physics",183301059335320,0,null,[[0,[25]],[0,[4]]]],[71,50,"Physics",285226175639733,0,null,[[4,114],[3,0]]],[114,51,"Timer",811041189041269,0,null,[[0,[26]],[3,0],[1,[27]]]],[114,52,"Physics",853255521275479,0,null,[[0,[54,[1,114,53,false],[4,63],[1,78,45,false],[4,35],[4,31],[3,290347554392499]]],[0,[55,[1,114,54,false],[4,63],[1,78,45,false],[4,35],[4,31],[3,290347554392499]]]]]]]]]]]]],[0,0,false,null,711176531458092,36,[[-1,26,null,0,false,false,false,878585482645329,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,159256985765861,null,[[11,267837901477967],[8,0],[7,[4]]]],[30,55,"Timer",0,false,true,false,633393014221717,null,[[1,[30]]]],[30,25,null,0,false,false,false,183872880779724,null,[[10,3],[8,0],[7,[4]]]],[114,25,null,0,false,true,false,767332008668482,null,[[10,4],[8,0],[7,[50]]]]],[[-1,47,null,337681442884394,0,null,[[11,267837901477967],[7,[5]]]]],[[0,0,false,null,261883133179083,37,[[-1,28,null,0,false,false,false,283076242058296,null]],[[30,34,null,545069087730385,0,null,[[10,2],[7,[4]]]],[30,34,null,432362978513289,0,null,[[10,3],[7,[5]]]],[30,51,"Timer",583332434199312,0,null,[[0,[31]],[3,0],[1,[30]]]]],[[0,0,false,null,957415264246228,38,[[30,27,null,0,false,false,false,803886958644461,null,[[4,8]]]],[[30,43,"Physics",235745116468038,0,null,[[0,[32]],[0,[7,[1,30,33,false]]],[0,[7,[1,30,37,false]]],[7,[4]]]],[30,52,"Physics",567435188932319,0,null,[[0,[4]],[0,[4]]]],[30,38,"Physics",872530368881234,0,null,[[0,[4]]]]]],[0,0,false,null,976573415600737,39,[[30,32,null,0,false,false,false,717989386211116,null,[[8,5],[0,[7,[1,30,33,false]]]]]],[[30,34,null,382906512822869,0,null,[[10,2],[7,[33,[1,30,53,false],[1,30,33,false]]]]]]],[0,0,false,null,552479425602948,40,[[30,32,null,0,false,false,false,525172195341378,null,[[8,2],[0,[7,[1,30,33,false]]]]]],[[30,34,null,296328330506953,0,null,[[10,2],[7,[33,[1,30,53,false],[1,30,33,false]]]]]]]]]]]]]]],[3,[true,"Skin P3"],false,null,168717394599589,41,[[-1,20,null,0,false,false,false,0,false,[[1,[56]]]]],[],[[0,0,false,null,292576625897886,42,[[-1,21,null,1,false,false,false,339028710976708,null]],[],[[0,0,false,null,843181496733442,43,[[11,25,null,0,false,false,false,895817254682155,null,[[10,0],[8,0],[7,[46]]]]],[[11,24,"Pin",918071152875969,0,null,[[4,29],[3,0]]]]],[0,0,false,null,152800731014898,44,[[10,25,null,0,false,false,false,561775432605314,null,[[10,0],[8,0],[7,[46]]]]],[[10,24,"Pin",441309693245052,0,null,[[4,30],[3,0]]]]],[0,0,false,null,324650356231595,45,[[12,25,null,0,false,false,false,415673189605104,null,[[10,0],[8,0],[7,[46]]]]],[[12,24,"Pin",841002527945159,0,null,[[4,30],[3,0]]]]],[0,0,false,null,372794028518337,46,[[13,25,null,0,false,false,false,166078580131082,null,[[10,0],[8,0],[7,[46]]]]],[[13,24,"Pin",587423019540421,0,null,[[4,30],[3,0]]]]]]],[0,0,false,null,249597469668388,47,[[15,25,null,0,false,false,false,914181172660330,null,[[10,0],[8,0],[7,[46]]]]],[[15,56,null,104320334916004,0,null,[[0,[35,[1,30,33,false]]]]],[15,57,null,233830842879330,0,null,[[0,[36,[4,58],[4,59],[1,15,54,false],[1,30,54,false]]]]]]]]],[3,[true,"Arm P3"],false,null,161671481474845,48,[[-1,20,null,0,false,false,false,0,false,[[1,[57]]]]],[],[[0,0,false,null,281081181704851,49,[],[[78,60,null,674254543802347,0,null,[[0,[38,[1,30,33,false]]],[0,[38,[1,30,37,false]]]]]]],[0,0,false,null,878395293571307,50,[],[[81,60,null,293995943155926,0,null,[[0,[7,[1,78,33,false]]],[0,[7,[1,78,37,false]]]]]]],[0,0,false,null,421934924615076,51,[[-1,26,null,0,false,false,false,279466280364396,null,[[11,727009003176844],[8,0],[7,[4]]]]],[],[[0,0,false,null,331829015607001,52,[[114,61,null,0,false,false,true,186312653464189,null,[[4,81]]],[114,36,null,0,false,false,false,607891218751380,null,[[8,5],[0,[39]]]],[114,25,null,0,false,false,false,157763983825333,null,[[10,3],[8,0],[7,[4]]]]],[[9,62,null,728431331339843,0,null,[[3,1],[4,78]]],[114,34,null,771810212373293,0,null,[[10,4],[7,[46]]]],[114,48,"Physics",525565664840656,0,null,[[3,0]]],[114,34,null,381563481664290,0,null,[[10,3],[7,[5]]]]]],[0,0,false,null,195488097128689,53,[[114,25,null,0,false,false,false,770243744968052,null,[[10,3],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,609051724160881,null,[[10,4],[8,0],[7,[46]]]],[114,25,null,0,false,false,false,914571054591676,null,[[10,2],[8,0],[7,[4]]]]],[[114,60,null,143764749590261,0,null,[[0,[40,[1,114,53,false],[1,78,33,false],[4,31]]],[0,[40,[1,114,54,false],[1,78,37,false],[4,31]]]]]]],[0,0,false,null,516970325463967,54,[[114,25,null,0,false,false,false,593506551203960,null,[[10,2],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,829623238208075,null,[[10,4],[8,0],[7,[46]]]]],[[114,60,null,119626934885700,0,null,[[0,[7,[1,78,33,false]]],[0,[7,[1,78,37,false]]]]],[9,60,null,348693988501994,0,null,[[0,[7,[1,78,33,false]]],[0,[7,[1,78,37,false]]]]]],[[0,0,false,null,491747086550335,55,[[-1,28,null,0,false,false,false,588903185419725,null]],[[-2,"createBallFX",null,900491484654707,0,null]]]]],[0,0,false,null,297649759483332,56,[[78,61,null,0,false,false,true,787984796704368,null,[[4,114]]],[114,25,null,0,false,false,false,357482818502548,null,[[10,4],[8,1],[7,[50]]]]],[[-2,"createBallFX2",null,559317400784783,0,null],[114,34,null,900802734673389,0,null,[[10,2],[7,[5]]]],[9,62,null,662750955682754,0,null,[[3,1],[4,78]]],[114,34,null,254612438082581,0,null,[[10,4],[7,[46]]]],[114,48,"Physics",127368410224155,0,null,[[3,0]]],[78,34,null,171338426099320,0,null,[[10,0],[7,[5]]]]]]]]]]]],["player4Event",[[3,[true,"P4"],false,null,239777695973482,1,[[-1,20,null,0,false,false,false,0,false,[[1,[58]]]]],[],[[0,0,false,null,879559369591710,2,[[-1,21,null,1,false,false,false,101859967894693,null]],[[38,22,"Physics",897273608420801,0,null,[[7,[1]],[4,37],[0,[2]],[0,[3]]]],[38,23,"Physics",105240093093827,0,null,[[3,1]]],[39,24,"Pin",260866249492630,0,null,[[4,38],[3,0]]]],[[0,0,false,null,799694803628145,3,[[3,25,null,0,false,false,false,186836710195965,null,[[10,0],[8,0],[7,[50]]]]],[[3,24,"Pin",225521508513722,0,null,[[4,38],[3,0]]]]],[0,0,false,null,741884321547409,4,[[5,25,null,0,false,false,false,427644447047929,null,[[10,0],[8,0],[7,[50]]]]],[[5,24,"Pin",561791388047577,0,null,[[4,37],[3,0]]]]]]],[0,0,false,null,906844690462855,5,[[-1,26,null,0,false,false,false,283907284543056,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,true,null,150630219451562,6,[[38,27,null,0,false,false,false,177320621937602,null,[[4,8]]]],[],[[0,0,false,null,976630736613048,7,[[-1,28,null,0,false,false,false,238599270962967,null]],[],[[0,0,false,null,913040240772507,8,[[16,25,null,0,false,false,false,146958891991263,null,[[10,0],[8,0],[7,[5]]]]],[[38,29,"Physics",736562149554663,0,null,[[0,[6,[0,38,"Physics",30,false],[4,31]]],[0,[4]],[7,[4]]]]]],[0,0,false,null,417276569859176,9,[[38,32,null,0,false,false,false,850589808583195,null,[[8,5],[0,[7,[1,38,33,false]]]]]],[[38,34,null,835107657904450,0,null,[[10,2],[7,[47,[4,35],[3,455877582027442],[3,262420649510634],[2,38,false,1]]]]]]],[0,0,false,null,347072213290423,10,[[38,32,null,0,false,false,false,397125928039462,null,[[8,2],[0,[7,[1,38,33,false]]]]]],[[38,34,null,478632986676811,0,null,[[10,2],[7,[48,[4,35],[3,455877582027442],[3,262420649510634],[2,38,false,1]]]]]]],[0,0,false,null,648129386987789,11,[],[[38,34,null,212996325180503,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,773796023167544,12,[[38,25,null,0,false,false,false,546832178992482,null,[[10,3],[8,0],[7,[5]]]]],[[38,34,null,487610729100705,0,null,[[10,3],[7,[4]]]],[38,34,null,358415700372591,0,null,[[10,4],[7,[4]]]]]],[0,0,true,null,515912915733720,13,[[38,36,null,0,false,false,false,601676452844063,null,[[8,2],[0,[7,[1,38,37,false]]]]]],[],[[0,0,false,null,508861859708014,14,[[38,32,null,0,false,false,false,238434715945509,null,[[8,4],[0,[7,[1,38,33,false]]]]]],[[38,34,null,121857332304986,0,null,[[10,2],[7,[10,[3,412696536558178]]]]]]],[0,0,false,null,878806325642029,15,[[38,32,null,0,false,false,false,839161038808354,null,[[8,2],[0,[7,[1,38,33,false]]]]]],[[38,34,null,735297011388906,0,null,[[10,2],[7,[11,[3,412696536558178]]]]]]]]],[0,0,false,null,643441596738263,16,[],[[38,38,"Physics",343485130236386,0,null,[[0,[12,[2,38,false,2],[4,31],[3,867747672923081]]]]],[38,34,null,350530679411494,0,null,[[10,2],[7,[13,[2,38,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,189516664794677,17,[[38,39,null,0,false,false,false,476801850459408,null,[[0,[14]],[0,[15]]]]],[[38,34,null,717809534354416,0,null,[[10,2],[7,[16,[2,38,false,2],[4,31],[3,588745698818005]]]]]]],[0,0,false,null,548899500801930,18,[[-1,40,null,0,false,false,false,115796838551491,null]],[],[[0,0,false,null,948440167087030,19,[[38,32,null,0,false,false,false,250822933362035,null,[[8,4],[0,[7,[1,38,33,false]]]]]],[[38,41,null,850011972466825,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]],[0,0,false,null,478169044845165,20,[[38,32,null,0,false,false,false,374715790541493,null,[[8,2],[0,[7,[1,38,33,false]]]]]],[[38,42,null,508470846938691,0,null,[[10,2],[7,[17,[3,730424728310926],[4,31],[3,579415250310640]]]]]]]]]]]]]]],[3,[true,"Control P4"],false,null,328088111874852,21,[[-1,20,null,0,false,false,false,0,false,[[1,[59]]]]],[],[[1,"upArrow",0,0,true,false,258897098053194,false,144],[1,"speed",0,-10,false,false,169106176535049,false,145],[0,0,false,null,250080673082900,22,[[-1,26,null,0,false,false,false,695323223995465,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,188094360638018,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,137866235502188,null]],[],[[0,0,false,null,995465907177837,23,[[79,25,null,0,false,false,false,264098500573844,null,[[10,1],[8,0],[7,[4]]]],[79,25,null,0,false,false,false,182298204320926,null,[[10,0],[8,0],[7,[5]]]]],[[79,34,null,284626668038055,0,null,[[10,1],[7,[5]]]]]]]],[0,0,false,null,808409224722684,24,[[-1,26,null,0,false,false,false,155632119156977,null,[[11,895506763348983],[8,0],[7,[4]]]]],[],[[0,0,false,null,587646821595645,25,[[-1,26,null,0,false,false,false,483917021481334,null,[[11,284675396607854],[8,0],[7,[5]]]]],[],[[0,0,false,null,163969178336164,26,[[114,25,null,0,false,true,false,268484034340549,null,[[10,4],[8,0],[7,[46]]]]],[],[[0,0,false,null,925439094113492,27,[[38,25,null,0,false,false,false,228827596455487,null,[[10,4],[8,2],[7,[3]]]]],[[38,43,"Physics",399225518681837,0,null,[[0,[20,[3,929772105325521],[4,31]]],[0,[7,[1,38,33,false]]],[0,[7,[1,38,37,false]]],[7,[4]]]],[38,41,null,243147776549310,0,null,[[10,4],[7,[20,[3,207852114368060],[4,31]]]]]]],[0,0,false,null,836218211623437,28,[[-1,44,null,0,false,false,false,666305713279154,null,[[7,[51,[4,63],[1,79,45,false]]],[8,4],[7,[4]]]]],[[79,46,null,766355840934569,0,null,[[0,[52,[1,79,45,false],[3,324338522464560]]]]]]],[0,0,false,null,644514711852543,29,[[-1,40,null,0,false,false,false,401359909829253,null]],[[79,46,null,869730102293730,0,null,[[0,[22]]]]]]]]]],[0,0,false,null,168263169358592,30,[[-1,40,null,0,false,false,false,147641127091934,null]],[[-1,47,null,844721372806337,0,null,[[11,258897098053194],[7,[4]]]]],[[0,0,false,null,677554092047226,31,[[-1,44,null,0,false,false,false,664426319526063,null,[[7,[21,[1,79,45,false]]],[8,4],[7,[5]]]]],[[79,46,null,537955340751491,0,null,[[0,[53,[1,79,45,false],[3,324338522464560]]]]]]],[0,0,false,null,874131077407717,32,[[-1,40,null,0,false,false,false,647189675264743,null]],[[79,46,null,644514201596914,0,null,[[0,[4]]]]]],[0,0,false,null,723290187441472,33,[[-1,28,null,0,false,false,false,587557524643422,null]],[],[[0,0,false,null,749220383786875,34,[[79,25,null,0,false,false,false,733806245329139,null,[[10,1],[8,0],[7,[5]]]]],[],[[0,0,false,null,165302202249581,35,[[114,25,null,0,false,false,false,261741633434578,null,[[10,4],[8,0],[7,[50]]]],[114,25,null,0,false,false,false,657158803807354,null,[[10,2],[8,0],[7,[5]]]]],[[114,34,null,513710268825085,0,null,[[10,2],[7,[4]]]],[79,34,null,431171233604446,0,null,[[10,1],[7,[4]]]],[79,34,null,314863842592923,0,null,[[10,0],[7,[4]]]],[114,34,null,288058630485889,0,null,[[10,4],[7,[25]]]],[114,48,"Physics",412223636349202,0,null,[[3,1]]],[114,34,null,785549596471069,0,null,[[10,3],[7,[4]]]],[114,49,"Physics",571894877470736,0,null,[[0,[25]],[0,[4]]]],[71,50,"Physics",785707783074877,0,null,[[4,114],[3,0]]],[114,51,"Timer",895139487371066,0,null,[[0,[26]],[3,0],[1,[27]]]],[114,52,"Physics",374619010627315,0,null,[[0,[54,[1,114,53,false],[4,63],[1,79,45,false],[4,35],[4,31],[3,290347554392499]]],[0,[55,[1,114,54,false],[4,63],[1,79,45,false],[4,35],[4,31],[3,290347554392499]]]]]]]]]]]]],[0,0,false,null,136111146499575,36,[[-1,26,null,0,false,false,false,502637240139132,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,168593485998426,null,[[11,258897098053194],[8,0],[7,[4]]]],[114,25,null,0,false,true,false,122503884817482,null,[[10,4],[8,0],[7,[46]]]],[38,55,"Timer",0,false,true,false,267476610283787,null,[[1,[30]]]],[38,25,null,0,false,false,false,153107668432680,null,[[10,3],[8,0],[7,[4]]]]],[[-1,47,null,266289409562875,0,null,[[11,258897098053194],[7,[5]]]]],[[0,0,false,null,815483346185756,37,[[-1,28,null,0,false,false,false,371606452883782,null]],[[38,34,null,849033673828187,0,null,[[10,2],[7,[4]]]],[38,34,null,271504965740080,0,null,[[10,3],[7,[5]]]],[38,51,"Timer",946844064214185,0,null,[[0,[31]],[3,0],[1,[30]]]]],[[0,0,false,null,821112444575981,38,[[38,27,null,0,false,false,false,456500779545655,null,[[4,8]]]],[[38,43,"Physics",428493617417385,0,null,[[0,[32]],[0,[7,[1,38,33,false]]],[0,[7,[1,38,37,false]]],[7,[4]]]],[38,52,"Physics",859656404092811,0,null,[[0,[4]],[0,[4]]]],[38,38,"Physics",766593886683293,0,null,[[0,[4]]]]]],[0,0,false,null,673186932767106,39,[[38,32,null,0,false,false,false,542492939839200,null,[[8,5],[0,[7,[1,38,33,false]]]]]],[[38,34,null,950014336119947,0,null,[[10,2],[7,[33,[1,38,53,false],[1,38,33,false]]]]]]],[0,0,false,null,609833291200174,40,[[38,32,null,0,false,false,false,136608254466957,null,[[8,2],[0,[7,[1,38,33,false]]]]]],[[38,34,null,955629970133300,0,null,[[10,2],[7,[33,[1,38,53,false],[1,38,33,false]]]]]]]]]]]]]]],[3,[true,"Skin P4"],false,null,106983606142062,41,[[-1,20,null,0,false,false,false,0,false,[[1,[60]]]]],[],[[0,0,false,null,546688611264073,42,[[-1,21,null,1,false,false,false,512926383441161,null]],[],[[0,0,false,null,504912679665596,43,[[11,25,null,0,false,false,false,504820798335188,null,[[10,0],[8,0],[7,[50]]]]],[[11,24,"Pin",343540302384529,0,null,[[4,37],[3,0]]]]],[0,0,false,null,378592349055349,44,[[10,25,null,0,false,false,false,656390461676614,null,[[10,0],[8,0],[7,[50]]]]],[[10,24,"Pin",670363323558435,0,null,[[4,38],[3,0]]]]],[0,0,false,null,406616723193121,45,[[12,25,null,0,false,false,false,458496925526637,null,[[10,0],[8,0],[7,[50]]]]],[[12,24,"Pin",748427813934983,0,null,[[4,38],[3,0]]]]],[0,0,false,null,196099769209473,46,[[13,25,null,0,false,false,false,922370432959467,null,[[10,0],[8,0],[7,[50]]]]],[[13,24,"Pin",207846058647956,0,null,[[4,38],[3,0]]]]]]],[0,0,false,null,796610601175795,47,[[15,25,null,0,false,false,false,597255414032559,null,[[10,0],[8,0],[7,[50]]]]],[[15,56,null,560776763280978,0,null,[[0,[35,[1,38,33,false]]]]],[15,57,null,368465241902002,0,null,[[0,[36,[4,58],[4,59],[1,15,54,false],[1,38,54,false]]]]]]]]],[3,[true,"Arm P4"],false,null,952809326130602,48,[[-1,20,null,0,false,false,false,0,false,[[1,[61]]]]],[],[[0,0,false,null,556492734561968,49,[],[[79,60,null,675360705782224,0,null,[[0,[38,[1,38,33,false]]],[0,[38,[1,38,37,false]]]]]]],[0,0,false,null,733456178878363,50,[],[[82,60,null,353959590790470,0,null,[[0,[7,[1,79,33,false]]],[0,[7,[1,79,37,false]]]]]]],[0,0,false,null,790239307998432,51,[[-1,26,null,0,false,false,false,979760722590088,null,[[11,727009003176844],[8,0],[7,[4]]]]],[],[[0,0,false,null,896176965076810,52,[[114,61,null,0,false,false,true,202857020708835,null,[[4,82]]],[114,36,null,0,false,false,false,792930355030916,null,[[8,5],[0,[39]]]],[114,25,null,0,false,false,false,207174833468275,null,[[10,3],[8,0],[7,[4]]]]],[[9,62,null,918286108949089,0,null,[[3,1],[4,79]]],[114,34,null,660143972673708,0,null,[[10,4],[7,[50]]]],[114,48,"Physics",437923124741685,0,null,[[3,0]]],[114,34,null,626931742778200,0,null,[[10,3],[7,[5]]]]]],[0,0,false,null,646285874160606,53,[[114,25,null,0,false,false,false,443437205469246,null,[[10,3],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,460938032470003,null,[[10,4],[8,0],[7,[50]]]],[114,25,null,0,false,false,false,898424965811047,null,[[10,2],[8,0],[7,[4]]]]],[[114,60,null,134748000147460,0,null,[[0,[40,[1,114,53,false],[1,79,33,false],[4,31]]],[0,[40,[1,114,54,false],[1,79,37,false],[4,31]]]]]]],[0,0,false,null,118153654464955,54,[[114,25,null,0,false,false,false,379667643660713,null,[[10,2],[8,0],[7,[5]]]],[114,25,null,0,false,false,false,491993518180629,null,[[10,4],[8,0],[7,[50]]]]],[[114,60,null,663680320095574,0,null,[[0,[7,[1,79,33,false]]],[0,[7,[1,79,37,false]]]]],[9,60,null,728678530164018,0,null,[[0,[7,[1,79,33,false]]],[0,[7,[1,79,37,false]]]]]]],[0,0,false,null,535928598088695,55,[[79,61,null,0,false,false,true,589756773796649,null,[[4,114]]],[114,25,null,0,false,false,false,606675499182120,null,[[10,4],[8,1],[7,[46]]]]],[[-2,"createBallFX2",null,883827029562694,0,null],[114,34,null,549675350823332,0,null,[[10,2],[7,[5]]]],[9,62,null,661580449450826,0,null,[[3,1],[4,79]]],[114,34,null,382519514038516,0,null,[[10,4],[7,[50]]]],[114,48,"Physics",762986344062711,0,null,[[3,0]]],[79,34,null,744141565659570,0,null,[[10,0],[7,[5]]]]]]]]]],[2,"ResfreshRate",false]]],["gameEvent",[[1,"angularMaxRND",0,150,false,false,262420649510634,false,146],[1,"angularMinRND",0,100,false,false,455877582027442,false,147],[1,"wooble",0,200,false,false,412696536558178,false,148],[1,"angularSub",0,8,false,false,730424728310926,false,149],[1,"snowSlip",0,2,false,true,385934528122174,false,150],[1,"P1Control",0,0,false,false,308680730337585,false,151],[1,"P2Control",0,0,false,false,284675396607854,false,152],[1,"p1Score",0,0,false,false,870248114194364,false,153],[1,"p2Score",0,0,false,false,336820796057693,false,154],[1,"goal",0,0,true,false,727009003176844,false,155],[1,"CPU",0,0,false,false,174118167449135,false,156],[1,"biz",0,0,false,false,462466925293457,false,157],[2,"menuEvent",false],[2,"bonusEvent",false],[2,"tailEvent",false],[2,"player1Event",false],[2,"pauseEvent",false],[2,"player2Event",false],[2,"player3Event",false],[2,"player4Event",false],[2,"MoreGamesButtons",false],[2,"ResfreshRate",false],[2,"RHM_ADS",false],[3,[true,"Ball"],false,null,454542165934448,1,[[-1,20,null,0,false,false,false,0,false,[[1,[62]]]]],[],[[0,0,false,null,748965599500532,2,[[114,64,null,1,false,false,false,358638147359249,null]],[[114,34,null,804969139367524,0,null,[[10,4],[7,[25]]]],[114,65,"Physics",819823983412470,0,null,[[3,1]]]]],[0,0,false,null,769237520676871,3,[[-1,21,null,1,false,false,false,988077025203488,null]],[[-1,66,null,571782578790304,0,null,[[0,[63]]]],[71,50,"Physics",879836956180413,0,null,[[4,110],[3,0]]],[73,50,"Physics",170308509430797,0,null,[[4,110],[3,0]]],[28,67,null,123662435707766,0,null,[[0,[4]],[0,[46]],[0,[5]]]],[28,68,null,604025613043937,0,null,[[0,[4]]]],[94,50,"Physics",920607546042681,0,null,[[4,110],[3,0]]]]],[0,0,false,null,927581621229089,4,[],[[114,38,"Physics",810979785219304,0,null,[[0,[64,[0,114,"Physics",30,false]]]]],[114,52,"Physics",184456955852271,0,null,[[0,[65,[0,114,"Physics",30,false],[3,800713363325886],[3,800713363325886]]],[0,[65,[0,114,"Physics",69,false],[3,800713363325886],[3,800713363325886]]]]],[14,56,null,596792705290264,0,null,[[0,[21,[1,114,53,false]]]]],[14,57,null,356070430853228,0,null,[[0,[66,[4,59],[2,114,false,0],[1,14,54,false],[1,114,54,false]]]]],[9,70,null,359572097829569,0,null,[[0,[67,[4,58],[0,114,"Physics",30,false],[1,9,71,false]]]]]]],[0,0,true,null,243584165705535,5,[[9,32,null,0,false,false,false,117985175102009,null,[[8,3],[0,[68]]]],[9,32,null,0,false,false,false,958475869700102,null,[[8,5],[0,[69]]]]],[],[[0,0,false,null,891457319550746,6,[[-1,26,null,0,false,false,false,130359234477555,null,[[11,727009003176844],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,316749480334906,null]],[[-1,47,null,326073771972682,0,null,[[11,308680730337585],[7,[4]]]],[-1,47,null,346581081803920,0,null,[[11,284675396607854],[7,[4]]]],[16,72,null,872302010874392,0,null,[[3,0]]],[-1,47,null,145188303819663,0,null,[[11,727009003176844],[7,[5]]]],[-1,73,null,612588819927489,0,null,[[0,[26]]]],[6,74,null,481608076868751,0,null,[[2,["wrong",false]],[3,0],[0,[2]],[0,[4]],[1,[70]]]],[-1,75,null,971518732912488,2,null,[[0,[26]]]],[-1,76,null,316532482990155,0,null]]]]],[0,0,false,null,638899801020166,7,[],[[9,60,null,270838109396173,0,null,[[0,[21,[1,114,53,false]]],[0,[21,[1,114,54,false]]]]],[9,46,null,953535482032517,0,null,[[0,[21,[1,114,45,false]]]]]]],[0,0,false,null,620143578555223,8,[[114,77,"Timer",0,false,false,false,387593505891564,null,[[1,[27]]]]],[[71,50,"Physics",823327589754912,0,null,[[4,114],[3,1]]],[73,50,"Physics",469453256163084,0,null,[[4,114],[3,1]]]]],[0,0,false,null,147235815529802,9,[[114,61,null,0,false,false,true,192604190711435,null,[[4,83]]],[114,25,null,0,false,false,false,923312611904160,null,[[10,2],[8,0],[7,[4]]]]],[[9,62,null,485826222007993,0,null,[[3,1],[4,86]]]]],[0,0,false,null,442781429105129,10,[[114,64,null,1,false,false,false,965218194654100,null]],[[87,60,null,666593784352349,0,null,[[0,[21,[1,114,53,false]]],[0,[21,[1,114,54,false]]]]],[87,78,"Pin",283289265884823,0,null,[[4,114],[16,true],[16,true],[16,false],[3,0],[3,0],[16,false]]],[87,79,null,111084661962837,0,null,[[0,[71,[1,114,80,false]]],[0,[71,[1,114,81,false]]]]]]],[0,0,false,null,767087364179981,11,[[7,61,null,0,false,false,true,938156651784956,null,[[4,8]]],[7,32,null,0,false,false,false,818551495792368,null,[[8,4],[0,[72]]]],[7,32,null,0,false,false,false,214833666395041,null,[[8,2],[0,[73]]]],[7,25,null,0,false,false,false,286183233879412,null,[[10,5],[8,0],[7,[4]]]]],[[7,34,null,982507160401818,0,null,[[10,5],[7,[5]]]],[6,74,null,563551713421482,0,null,[[2,["metal",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]]]],[0,0,false,null,159822232518893,12,[[98,64,null,1,false,false,false,221252932351162,null]],[[98,82,"Bullet",828646149482646,0,null,[[0,[75,[2,98,false,0],[0,98,"Bullet",83,false]]]]]]]]],[3,[true,"Players"],false,null,139851924359325,13,[[-1,20,null,0,false,false,false,0,false,[[1,[76]]]]],[],[[1,"velX",0,50,false,false,489145114841833,false,158],[1,"velAng",0,150,false,false,589534603444800,false,159],[0,0,false,null,546341842361063,14,[],[[1,52,"Physics",749691576179614,0,null,[[0,[77,[0,1,"Physics",30,false],[3,489145114841833],[3,489145114841833]]],[0,[78,[0,1,"Physics",69,false]]]]],[1,38,"Physics",757988408341402,0,null,[[0,[77,[0,1,"Physics",84,false],[3,589534603444800],[3,589534603444800]]]]],[30,52,"Physics",588006708744000,0,null,[[0,[77,[0,30,"Physics",30,false],[3,489145114841833],[3,489145114841833]]],[0,[78,[0,30,"Physics",69,false]]]]],[30,38,"Physics",361498413256843,0,null,[[0,[77,[0,30,"Physics",84,false],[3,589534603444800],[3,589534603444800]]]]],[35,52,"Physics",788065960933346,0,null,[[0,[77,[0,35,"Physics",30,false],[3,489145114841833],[3,489145114841833]]],[0,[78,[0,35,"Physics",69,false]]]]],[35,38,"Physics",227618663280438,0,null,[[0,[77,[0,35,"Physics",84,false],[3,589534603444800],[3,589534603444800]]]]],[38,52,"Physics",621443015591542,0,null,[[0,[77,[0,38,"Physics",30,false],[3,489145114841833],[3,489145114841833]]],[0,[78,[0,38,"Physics",69,false]]]]],[38,38,"Physics",566129870658906,0,null,[[0,[77,[0,38,"Physics",84,false],[3,589534603444800],[3,589534603444800]]]]]]],[0,0,false,null,764559672536153,15,[],[],[[0,0,false,null,649165148488414,16,[[33,61,null,0,false,false,true,669378000286177,null,[[4,32]]]],[],[[1,"ang",0,0,false,false,290626903247623,false,160],[0,0,false,null,792380901369929,17,[],[[-1,47,null,477444876768768,0,null,[[11,290626903247623],[7,[79,[0,1,"Physics",84,false]]]]],[1,41,null,521894922733557,0,null,[[10,2],[7,[80,[0,30,"Physics",30,false],[0,30,"Physics",84,false]]]]],[30,41,null,494000365314138,0,null,[[10,2],[7,[81,[0,1,"Physics",30,false],[3,290626903247623]]]]],[1,52,"Physics",708586049088608,0,null,[[0,[82,[0,1,"Physics",30,false]]],[0,[82,[0,1,"Physics",69,false]]]]],[30,52,"Physics",228023395905618,0,null,[[0,[82,[0,30,"Physics",30,false]]],[0,[82,[0,30,"Physics",69,false]]]]]]]]],[0,0,false,null,359736984035386,18,[[33,61,null,0,false,false,true,544008618561654,null,[[4,36]]]],[],[[1,"ang",0,0,false,false,193875416518660,false,160],[0,0,false,null,896025223566591,19,[],[[-1,47,null,691864268654356,0,null,[[11,193875416518660],[7,[79,[0,1,"Physics",84,false]]]]],[1,41,null,471855662647100,0,null,[[10,2],[7,[80,[0,35,"Physics",30,false],[0,35,"Physics",84,false]]]]],[35,41,null,147075110454356,0,null,[[10,2],[7,[81,[0,1,"Physics",30,false],[3,193875416518660]]]]],[1,52,"Physics",251375527364492,0,null,[[0,[82,[0,1,"Physics",30,false]]],[0,[82,[0,1,"Physics",69,false]]]]],[35,52,"Physics",117116141210400,0,null,[[0,[82,[0,35,"Physics",30,false]]],[0,[82,[0,35,"Physics",69,false]]]]]]]]],[0,0,false,null,118008491218958,20,[[33,61,null,0,false,false,true,463255797017807,null,[[4,39]]]],[],[[1,"ang",0,0,false,false,231170202127439,false,160],[0,0,false,null,230766485872433,21,[],[[-1,47,null,323138329905948,0,null,[[11,231170202127439],[7,[79,[0,1,"Physics",84,false]]]]],[1,41,null,807758633062506,0,null,[[10,2],[7,[80,[0,38,"Physics",30,false],[0,38,"Physics",84,false]]]]],[38,41,null,604970296252191,0,null,[[10,2],[7,[81,[0,1,"Physics",30,false],[3,231170202127439]]]]],[1,52,"Physics",724982096277108,0,null,[[0,[82,[0,1,"Physics",30,false]]],[0,[82,[0,1,"Physics",69,false]]]]],[38,52,"Physics",769547343347752,0,null,[[0,[82,[0,38,"Physics",30,false]]],[0,[82,[0,38,"Physics",69,false]]]]]]]]]]],[0,0,false,null,593021529484234,22,[],[],[[0,0,false,null,784980221885662,23,[[36,61,null,0,false,false,true,352941293931319,null,[[4,32]]]],[],[[1,"ang",0,0,false,false,913875994158992,false,160],[0,0,false,null,724464603753115,24,[],[[-1,47,null,849987530717353,0,null,[[11,913875994158992],[7,[79,[0,35,"Physics",84,false]]]]],[35,41,null,195032420197021,0,null,[[10,2],[7,[80,[0,30,"Physics",30,false],[0,30,"Physics",84,false]]]]],[30,41,null,306840286070956,0,null,[[10,2],[7,[81,[0,35,"Physics",30,false],[3,913875994158992]]]]],[30,52,"Physics",360984386558787,0,null,[[0,[82,[0,30,"Physics",30,false]]],[0,[82,[0,30,"Physics",69,false]]]]],[35,52,"Physics",102180975409218,0,null,[[0,[82,[0,35,"Physics",30,false]]],[0,[82,[0,35,"Physics",69,false]]]]]]]]],[0,0,false,null,250125150285679,25,[[36,61,null,0,false,false,true,101688001442265,null,[[4,39]]]],[],[[1,"ang",0,0,false,false,604495911950215,false,160],[0,0,false,null,322567800238941,26,[],[[-1,47,null,741959291459376,0,null,[[11,604495911950215],[7,[79,[0,35,"Physics",84,false]]]]],[35,41,null,159100724914609,0,null,[[10,2],[7,[80,[0,38,"Physics",30,false],[0,38,"Physics",84,false]]]]],[38,41,null,414363731738686,0,null,[[10,2],[7,[81,[0,35,"Physics",30,false],[3,604495911950215]]]]],[38,52,"Physics",453572884687045,0,null,[[0,[82,[0,38,"Physics",30,false]]],[0,[82,[0,38,"Physics",69,false]]]]],[35,52,"Physics",589389602696581,0,null,[[0,[82,[0,35,"Physics",30,false]]],[0,[82,[0,35,"Physics",69,false]]]]]]]]]]],[0,0,false,null,367826469323220,27,[],[],[[0,0,false,null,481706574538012,28,[[39,61,null,0,false,false,true,670287400420005,null,[[4,32]]]],[],[[1,"ang",0,0,false,false,238298718108021,false,160],[0,0,false,null,318038229537712,29,[],[[-1,47,null,170133198177953,0,null,[[11,238298718108021],[7,[79,[0,38,"Physics",84,false]]]]],[38,41,null,350545842241996,0,null,[[10,2],[7,[80,[0,30,"Physics",30,false],[0,30,"Physics",84,false]]]]],[30,41,null,660312882184017,0,null,[[10,2],[7,[81,[0,38,"Physics",30,false],[3,238298718108021]]]]],[30,52,"Physics",621455381407302,0,null,[[0,[82,[0,30,"Physics",30,false]]],[0,[82,[0,30,"Physics",69,false]]]]],[38,52,"Physics",926942943544434,0,null,[[0,[82,[0,38,"Physics",30,false]]],[0,[82,[0,38,"Physics",69,false]]]]]]]]]]]]],[3,[true,"General"],false,null,210125335228410,30,[[-1,20,null,0,false,false,false,0,false,[[1,[83]]]]],[],[[1,"team1",0,0,false,false,516198035145613,false,161],[1,"team2",0,0,false,false,542089088464799,false,162],[1,"screenWidth",0,0,false,false,711866737370731,false,163],[1,"screenHeight",0,0,false,false,909866977618611,false,164],[0,0,true,null,788476075180245,31,[[49,85,null,1,false,false,false,201631641605024,null],[-1,21,null,1,false,false,false,341041810547514,null]],[[-1,75,null,600034509341516,2,null,[[0,[4]]]],[93,86,null,978753164665906,0,null,[[0,[84,[4,87]]]]],[112,88,null,341162035703439,0,null,[[0,[85,[4,89],[4,90]]]]],[116,91,null,158912024253947,0,null,[[0,[86,[4,92],[1,116,93,false]]]]],[112,94,null,440498146771015,0,null,[[0,[87,[4,90]]]]]]],[0,0,false,null,529420948329690,32,[[-1,21,null,1,false,false,false,403875869662032,null]],[[-1,47,null,267504263994473,0,null,[[11,516198035145613],[7,[88,[4,95],[4,35]]]]],[-1,47,null,882751390000455,0,null,[[11,542089088464799],[7,[88,[4,95],[4,35]]]]]],[[0,0,false,null,912962769871285,33,[[-1,96,null,0,true,false,false,722582042205454,null],[-1,26,null,0,false,false,false,682045028167169,null,[[11,516198035145613],[8,0],[7,[10,[3,542089088464799]]]]]],[[-1,47,null,316879927256889,0,null,[[11,542089088464799],[7,[88,[4,95],[4,35]]]]]]],[1,"rnd",0,0,false,false,464435176656702,false,165],[0,0,false,null,231112843273018,34,[],[[-1,47,null,635377093209032,0,null,[[11,464435176656702],[7,[89,[4,97]]]]]],[[0,0,false,null,580513779308491,35,[[-1,26,null,0,false,false,false,980301614345268,null,[[11,464435176656702],[8,0],[7,[4]]]]],[[40,98,null,296410794503021,0,null],[-1,99,null,878344867521203,0,null,[[5,[4]],[0,[90,[4,100]]]]],[63,98,null,848364740443481,0,null],[62,98,null,731622032677704,0,null]]],[0,0,false,null,955047513643834,36,[[-1,40,null,0,false,false,false,946699177740951,null],[-1,26,null,0,false,false,false,786365889268630,null,[[11,464435176656702],[8,0],[7,[5]]]]],[[40,98,null,223470663864745,0,null],[-1,99,null,952520272830999,0,null,[[5,[4]],[0,[91,[4,100]]]]],[25,101,null,104209187906026,0,null,[[0,[92,[4,100]]]]],[26,98,null,163639990473802,0,null],[63,98,null,830885932810320,0,null]]],[0,0,false,null,709771032190233,37,[[-1,40,null,0,false,false,false,541475382571466,null],[-1,26,null,0,false,false,false,445975665466062,null,[[11,464435176656702],[8,0],[7,[19]]]]],[[-1,99,null,186740683282781,0,null,[[5,[4]],[0,[93,[4,100]]]]],[25,101,null,872252338845771,0,null,[[0,[94,[4,100]]]]],[26,102,null,287947906305330,0,null,[[1,[95]],[0,[5]],[0,[96,[4,100]]]]],[26,102,null,695535065081101,0,null,[[1,[97]],[0,[5]],[0,[98,[4,100]]]]],[26,102,null,602067886442732,0,null,[[1,[99]],[0,[5]],[0,[100,[4,100]]]]],[26,98,null,381499398049750,0,null],[62,98,null,545890487636486,0,null]]]]],[0,0,false,null,553110365429368,38,[[-1,26,null,0,false,false,false,825712127505369,null,[[11,462466925293457],[8,0],[7,[4]]]]],[],[[0,0,true,null,831763469712396,39,[[10,25,null,0,false,false,false,594368707533559,null,[[10,0],[8,0],[7,[4]]]],[10,25,null,0,false,false,false,845085794513843,null,[[10,0],[8,0],[7,[19]]]]],[[10,103,null,470517965035684,0,null,[[0,[10,[3,516198035145613]]]]]]],[0,0,true,null,428784197359940,40,[[13,25,null,0,false,false,false,890906130239663,null,[[10,0],[8,0],[7,[4]]]],[13,25,null,0,false,false,false,553756553051616,null,[[10,0],[8,0],[7,[19]]]]],[[13,103,null,882430712531337,0,null,[[0,[10,[3,516198035145613]]]]]]],[0,0,true,null,319592273196655,50,[[12,25,null,0,false,false,false,541283289782525,null,[[10,0],[8,0],[7,[19]]]],[12,25,null,0,false,false,false,356620232717748,null,[[10,0],[8,0],[7,[4]]]]],[],[[0,0,false,null,411866599301605,51,[[-1,26,null,0,false,false,false,318190652528500,null,[[11,516198035145613],[8,0],[7,[4]]]]],[[12,103,null,405915686295805,0,null,[[0,[5]]]]]],[0,0,false,null,136210122486850,52,[[-1,26,null,0,false,false,false,583838662683149,null,[[11,516198035145613],[8,0],[7,[5]]]]],[[12,103,null,557132665909974,0,null,[[0,[19]]]]]],[0,0,false,null,930969624091244,53,[[-1,26,null,0,false,false,false,795271708866108,null,[[11,516198035145613],[8,0],[7,[19]]]]],[[12,103,null,497727545727952,0,null,[[0,[50]]]]]],[0,0,false,null,463160854633191,54,[[-1,26,null,0,false,false,false,606283628764114,null,[[11,516198035145613],[8,0],[7,[46]]]]],[[12,103,null,988935502490885,0,null,[[0,[101]]]]]],[0,0,false,null,780308030114040,55,[[-1,26,null,0,false,false,false,130314812740311,null,[[11,516198035145613],[8,0],[7,[50]]]]],[[12,103,null,196737590706503,0,null,[[0,[102]]]]]],[0,0,false,null,223317386223650,56,[[-1,26,null,0,false,false,false,128147358063216,null,[[11,516198035145613],[8,0],[7,[101]]]]],[[12,103,null,734681433567317,0,null,[[0,[4]]]]]],[0,0,false,null,626929282785905,57,[[-1,26,null,0,false,false,false,990940044678117,null,[[11,516198035145613],[8,0],[7,[102]]]]],[[12,103,null,791496183115894,0,null,[[0,[103]]]]]],[0,0,false,null,589375847487807,58,[[-1,26,null,0,false,false,false,133420620370960,null,[[11,516198035145613],[8,0],[7,[103]]]]],[[12,103,null,586752907365270,0,null,[[0,[15]]]]]]]],[0,0,true,null,609033571170522,59,[[10,25,null,0,false,false,false,331357695739915,null,[[10,0],[8,0],[7,[46]]]],[10,25,null,0,false,false,false,477891128296360,null,[[10,0],[8,0],[7,[50]]]]],[[10,103,null,151614678700374,0,null,[[0,[10,[3,542089088464799]]]]]]],[0,0,true,null,103668502655185,60,[[13,25,null,0,false,false,false,998315102756329,null,[[10,0],[8,0],[7,[46]]]],[13,25,null,0,false,false,false,374654730362780,null,[[10,0],[8,0],[7,[50]]]]],[[13,103,null,231442507441300,0,null,[[0,[10,[3,542089088464799]]]]]]],[0,0,true,null,315386225390318,70,[[12,25,null,0,false,false,false,136349145897731,null,[[10,0],[8,0],[7,[50]]]],[12,25,null,0,false,false,false,683439599317584,null,[[10,0],[8,0],[7,[46]]]]],[],[[0,0,false,null,265590880696004,71,[[-1,26,null,0,false,false,false,235650796444891,null,[[11,542089088464799],[8,0],[7,[4]]]]],[[12,103,null,359571094953382,0,null,[[0,[5]]]]]],[0,0,false,null,497797290260455,72,[[-1,26,null,0,false,false,false,284078544198891,null,[[11,542089088464799],[8,0],[7,[5]]]]],[[12,103,null,281196644505626,0,null,[[0,[19]]]]]],[0,0,false,null,233994169512650,73,[[-1,26,null,0,false,false,false,474576499324391,null,[[11,542089088464799],[8,0],[7,[19]]]]],[[12,103,null,103843241090972,0,null,[[0,[50]]]]]],[0,0,false,null,240655387705465,74,[[-1,26,null,0,false,false,false,334158112272847,null,[[11,542089088464799],[8,0],[7,[46]]]]],[[12,103,null,247297442893385,0,null,[[0,[101]]]]]],[0,0,false,null,345407887041898,75,[[-1,26,null,0,false,false,false,991403454523110,null,[[11,542089088464799],[8,0],[7,[50]]]]],[[12,103,null,579462398236929,0,null,[[0,[102]]]]]],[0,0,false,null,603000538697228,76,[[-1,26,null,0,false,false,false,136446205126130,null,[[11,542089088464799],[8,0],[7,[101]]]]],[[12,103,null,218045237422645,0,null,[[0,[4]]]]]],[0,0,false,null,645461628703794,77,[[-1,26,null,0,false,false,false,587197792116126,null,[[11,542089088464799],[8,0],[7,[102]]]]],[[12,103,null,518184156623672,0,null,[[0,[103]]]]]],[0,0,false,null,843603241640463,78,[[-1,26,null,0,false,false,false,649680741713618,null,[[11,542089088464799],[8,0],[7,[103]]]]],[[12,103,null,168269997046333,0,null,[[0,[15]]]]]]]]]]]],[0,0,false,null,673026883730784,79,[[11,64,null,1,false,false,false,271018021458428,null]],[[11,103,null,940515544392752,0,null,[[0,[104,[4,95],[4,35],[1,11,71,false]]]]],[11,104,null,825642864295838,0,null,[[0,[105,[4,97],[4,100],[4,100],[4,100]]]]]]],[0,0,false,null,893807174520322,80,[[1,64,null,1,false,false,false,490548617627951,null]],[[1,104,null,534713819651313,0,null,[[0,[106,[4,97],[4,100],[4,100],[4,100],[4,100]]]]],[4,104,null,872224941930741,0,null,[[0,[21,[1,1,105,false]]]]],[70,104,null,122733912583099,0,null,[[0,[21,[1,1,105,false]]]]]]],[0,0,false,null,771922096649551,81,[[30,64,null,1,false,false,false,743944978823483,null]],[[30,104,null,694380901779266,0,null,[[0,[106,[4,97],[4,100],[4,100],[4,100],[4,100]]]]],[29,104,null,880332889090414,0,null,[[0,[21,[1,30,105,false]]]]],[78,104,null,757518503223850,0,null,[[0,[21,[1,30,105,false]]]]]]],[0,0,false,null,554145190363898,82,[[35,64,null,1,false,false,false,181918131789725,null]],[[35,104,null,872767412878718,0,null,[[0,[106,[4,97],[4,100],[4,100],[4,100],[4,100]]]]],[34,104,null,475316077150158,0,null,[[0,[21,[1,35,105,false]]]]],[77,104,null,593278400422935,0,null,[[0,[21,[1,35,105,false]]]]]]],[0,0,false,null,929222060760567,83,[[38,64,null,1,false,false,false,504400372619915,null]],[[38,104,null,926820011093388,0,null,[[0,[106,[4,97],[4,100],[4,100],[4,100],[4,100]]]]],[37,104,null,982184268834595,0,null,[[0,[21,[1,38,105,false]]]]],[79,104,null,746168399500014,0,null,[[0,[21,[1,38,105,false]]]]]]]]],[3,[true,"Control"],false,null,842099959132424,84,[[-1,20,null,0,false,false,false,0,false,[[1,[107]]]]],[],[[0,0,false,null,173335466987062,85,[[-1,26,null,0,false,false,false,948330382363446,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,26,null,0,false,false,false,694601271738028,null,[[11,727009003176844],[8,0],[7,[4]]]],[44,106,null,0,false,true,false,756383039129751,null,[[4,16]]],[44,106,null,0,false,true,false,241374763717448,null,[[4,48]]]],[],[[0,0,true,null,470532884080689,86,[[2,107,null,0,false,false,false,256508001095888,null,[[9,38]]],[44,106,null,0,false,false,false,634962282654510,null,[[4,45]]]],[[-1,47,null,913472897786272,0,null,[[11,308680730337585],[7,[5]]]]]],[0,0,false,null,120299978614252,87,[[-1,40,null,0,false,false,false,684989146382366,null]],[[-1,47,null,704790289254199,0,null,[[11,308680730337585],[7,[4]]]]]],[0,0,false,null,285707079002661,88,[[-1,26,null,0,false,false,false,837990715631497,null,[[11,174118167449135],[8,0],[7,[4]]]]],[],[[0,0,true,null,836703864715875,89,[[2,107,null,0,false,false,false,189990841296349,null,[[9,87]]],[44,106,null,0,false,false,false,449068964632145,null,[[4,46]]]],[[-1,47,null,764763383810956,0,null,[[11,284675396607854],[7,[5]]]]]],[0,0,false,null,958335728983498,90,[[-1,40,null,0,false,false,false,496523005061858,null]],[[-1,47,null,280719676992593,0,null,[[11,284675396607854],[7,[4]]]]]]]]]],[0,0,false,null,320181907294440,91,[],[[46,79,null,270141325135944,0,null,[[0,[108,[1,46,53,false],[4,90]]],[0,[109,[4,92],[4,87]]]]],[45,79,null,351562602720816,0,null,[[0,[108,[1,45,53,false],[4,90]]],[0,[109,[4,92],[4,87]]]]]]],[0,0,false,null,727638185708018,92,[[-1,26,null,0,false,false,false,969992042893753,null,[[11,308680730337585],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,640929714478855,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,26,null,0,false,false,false,698968423416552,null,[[11,727009003176844],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,756444767045056,null]],[[6,74,null,359438467533594,0,null,[[2,["press",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]]],[[0,0,false,null,355266461111034,93,[[47,25,null,0,false,false,false,466598772165391,null,[[10,0],[8,0],[7,[5]]]]],[[47,108,null,268242998096516,0,null]]],[0,0,false,null,469342562241231,94,[[21,25,null,0,false,false,false,637354301953421,null,[[10,0],[8,0],[7,[5]]]]],[[21,72,null,716857375065431,0,null,[[3,1]]]]],[0,0,false,null,784813909379771,95,[[22,109,null,0,false,false,false,666606572681135,null,[[10,0],[8,0],[7,[5]]]]],[[22,110,null,859741060853535,0,null,[[3,1]]]]]]],[0,0,false,null,262390943356076,96,[[-1,26,null,0,false,false,false,362899568316528,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,26,null,0,false,false,false,287295772809048,null,[[11,895506763348983],[8,0],[7,[4]]]],[-1,26,null,0,false,false,false,312772188623943,null,[[11,727009003176844],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,775274980620365,null]],[[6,74,null,903752619056962,0,null,[[2,["press",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]]],[[0,0,false,null,427259355230543,97,[[47,25,null,0,false,false,false,970395837571696,null,[[10,0],[8,0],[7,[4]]]]],[[47,108,null,268643362545007,0,null]]],[0,0,false,null,440773771277828,98,[[21,25,null,0,false,false,false,376566196762638,null,[[10,0],[8,0],[7,[4]]]]],[[21,72,null,750145750729070,0,null,[[3,1]]]]],[0,0,false,null,927346900137432,99,[[22,109,null,0,false,false,false,872330308511307,null,[[10,0],[8,0],[7,[4]]]]],[[22,110,null,136747046534893,0,null,[[3,1]]]]]]],[0,0,false,null,248678847168057,100,[[-1,26,null,0,false,false,false,731857797570818,null,[[11,308680730337585],[8,0],[7,[5]]]]],[],[[0,0,false,null,601984124282181,101,[[-1,28,null,0,false,false,false,396948737248683,null]],[],[[0,0,true,null,453978799111102,102,[[1,27,null,0,false,false,false,209484578529087,null,[[4,8]]],[35,27,null,0,false,false,false,425475079753371,null,[[4,8]]]],[],[[0,0,false,null,138297631160512,103,[[6,111,null,0,false,true,false,297876525178751,null,[[1,[110]]]]],[[6,74,null,888139742535966,0,null,[[2,["jump",false]],[3,0],[0,[2]],[0,[4]],[1,[110]]]]]]]]]]]],[0,0,false,null,428784621584431,104,[[-1,26,null,0,false,false,false,471557605524524,null,[[11,284675396607854],[8,0],[7,[5]]]]],[],[[0,0,false,null,665713215263798,105,[[-1,28,null,0,false,false,false,341820529213512,null]],[],[[0,0,true,null,949407305767272,106,[[30,27,null,0,false,false,false,856231849171180,null,[[4,8]]],[38,27,null,0,false,false,false,255855317748182,null,[[4,8]]]],[],[[0,0,false,null,757919200008736,107,[[6,111,null,0,false,true,false,892473005880953,null,[[1,[111]]]]],[[6,74,null,876499794431660,0,null,[[2,["jump",false]],[3,0],[0,[2]],[0,[4]],[1,[111]]]]]]]]]]]]]],[3,[true,"Goal"],false,null,566459596397978,108,[[-1,20,null,0,false,false,false,0,false,[[1,[112]]]]],[],[[0,0,false,null,958755318800767,109,[[-1,21,null,1,false,false,false,872999501671074,null]],[],[[0,0,false,null,852520426676739,110,[[-1,44,null,0,false,false,false,618436788182471,null,[[7,[113,[3,870248114194364],[3,336820796057693]]],[8,4],[7,[4]]]]],[[22,110,null,107176796908878,0,null,[[3,1]]],[47,108,null,208898183166590,0,null],[21,72,null,424250939340329,0,null,[[3,1]]]]],[0,0,false,null,543602788605946,111,[[22,109,null,0,false,false,false,128491634168916,null,[[10,0],[8,0],[7,[5]]]]],[[22,112,null,991939536362283,0,null,[[7,[10,[3,870248114194364]]]]]]],[0,0,false,null,670566705464451,112,[[22,109,null,0,false,false,false,309309498517815,null,[[10,0],[8,0],[7,[4]]]]],[[22,112,null,924972354332958,0,null,[[7,[10,[3,336820796057693]]]]]]]]],[0,0,false,null,219804282033176,113,[[-1,113,null,0,false,false,false,256053330610273,null,[[4,76],[0,[21,[1,9,53,false]]],[0,[21,[1,9,54,false]]]]],[114,25,null,0,false,false,false,426167876308401,null,[[10,2],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,728779415677016,null,[[10,3],[8,0],[7,[4]]]],[114,114,"Physics",0,false,false,false,953980091112315,null,[[3,1],[8,4],[0,[4]]]],[9,36,null,0,false,false,false,652915467228624,null,[[8,2],[0,[21,[1,76,54,false]]]]],[-1,26,null,0,false,false,false,319330374242915,null,[[11,727009003176844],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,334019588002211,null]],[[6,74,null,950474614759985,0,null,[[2,["file",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]],[-1,47,null,326123253763972,0,null,[[11,308680730337585],[7,[4]]]],[-1,47,null,894405781359528,0,null,[[11,284675396607854],[7,[4]]]],[16,72,null,538291056928430,0,null,[[3,0]]],[-1,47,null,103086064408705,0,null,[[11,727009003176844],[7,[5]]]],[-1,73,null,302005576689619,0,null,[[0,[26]]]],[-1,115,null,460034554735321,0,null,[[4,22],[0,[5]]]],[47,108,null,912610414169033,0,null],[22,110,null,343536408347481,0,null,[[3,1]]],[21,72,null,121195959202032,0,null,[[3,1]]]],[[0,0,false,null,890382735953284,114,[[-1,116,null,0,true,false,false,130478807741774,null,[[4,86]]],[76,25,null,0,false,false,false,270917782816362,null,[[10,0],[8,0],[7,[114,[2,86,false,0]]]]]],[[86,117,null,594607410044362,0,null,[[0,[115,[1,86,80,false]]]]],[86,118,null,106466198300445,0,null,[[0,[116,[1,86,81,false]]]]],[-1,75,null,968127763414420,2,null,[[0,[117]]]],[86,57,null,201054996667476,0,null,[[0,[5]]]]]],[0,0,false,null,232067892445288,115,[[76,25,null,0,false,false,false,339740788244506,null,[[10,0],[8,0],[7,[4]]]]],[[-1,119,null,224030693364873,0,null,[[11,870248114194364],[7,[118,[1,9,120,true]]]]],[-2,"goalText",null,357374918851866,0,null,[[0,[5]]]]],[[0,0,false,null,302934131099967,116,[[22,109,null,0,false,false,false,969620497348809,null,[[10,0],[8,0],[7,[5]]]]],[[22,112,null,432529751690371,0,null,[[7,[10,[3,870248114194364]]]]],[22,51,"Timer",925413833204297,0,null,[[0,[26]],[3,0],[1,[119]]]]]]]],[0,0,false,null,110355254108765,117,[[76,25,null,0,false,false,false,466956516950250,null,[[10,0],[8,0],[7,[5]]]]],[[-2,"goalText",null,383638392481407,0,null,[[0,[4]]]],[-1,119,null,277293249300798,0,null,[[11,336820796057693],[7,[118,[1,9,120,true]]]]]],[[0,0,false,null,713517519493058,118,[[22,109,null,0,false,false,false,808815588316343,null,[[10,0],[8,0],[7,[4]]]]],[[22,112,null,975493128028125,0,null,[[7,[10,[3,336820796057693]]]]],[22,51,"Timer",809665852926848,0,null,[[0,[26]],[3,0],[1,[119]]]]]]]],[0,0,false,null,708963458766174,119,[],[[-1,75,null,469748725232927,2,null,[[0,[120]]]],[-1,73,null,427700892329082,0,null,[[0,[5]]]],[-1,75,null,190644658472580,2,null,[[0,[121]]]],[-1,47,null,366026089897477,0,null,[[11,727009003176844],[7,[19]]]]],[[0,0,false,null,523916697039557,120,[[-1,26,null,0,false,false,false,774217858575220,null,[[11,870248114194364],[8,2],[7,[101]]]],[-1,26,null,0,false,false,false,936881399069341,null,[[11,336820796057693],[8,2],[7,[101]]]]],[[-1,121,null,885017546761039,0,null],[-1,76,null,885684961338667,0,null]]],[0,0,false,null,385326869674219,121,[[-1,40,null,0,false,false,false,373053060333779,null]],[],[[0,0,false,null,605550283910238,122,[[-1,26,null,0,false,false,false,318517585337147,null,[[11,870248114194364],[8,5],[7,[101]]]]],[[-2,"gameOver",null,999942894942948,0,null,[[1,[122]]]]]],[0,0,false,null,470832160460214,123,[[-1,40,null,0,false,false,false,953461121725139,null]],[[-2,"gameOver",null,205103088191470,0,null,[[1,[123]]]]]]]]]]]],[0,0,false,null,820567048447002,124,[[-1,26,null,0,false,false,false,183099311061566,null,[[11,727009003176844],[8,0],[7,[5]]]]],[[-1,122,null,152700717861418,0,null,[[0,[124,[4,123],[1,9,53,false],[4,31]]],[0,[125,[4,124]]]]],[-1,125,null,533963281087562,0,null,[[0,[126,[4,126],[4,31]]]]]]],[0,0,false,null,211333034083388,125,[[22,77,"Timer",0,false,false,false,246281522109945,null,[[1,[119]]]]],[[22,127,null,223083540402947,0,null,[[0,[127]]]],[22,128,null,490727383165699,0,null,[[0,[128,[4,100]]]]],[22,51,"Timer",541675785350289,0,null,[[0,[26]],[3,0],[1,[129]]]]]],[0,0,false,null,231011438389849,126,[[22,77,"Timer",0,false,false,false,134636312957892,null,[[1,[129]]]]],[[22,127,null,550870160672192,0,null,[[0,[5]]]],[22,128,null,702910927209570,0,null,[[0,[130,[4,100]]]]],[22,51,"Timer",292397011245738,0,null,[[0,[26]],[3,0],[1,[119]]]]]]]],[3,[true,"End"],false,null,739620096340547,127,[[-1,20,null,0,false,false,false,0,false,[[1,[131]]]]],[],[[0,0,false,null,164370333053836,128,[[16,129,"Tween",0,false,false,false,873375018224241,null,[[1,[132]]]]],[[-1,130,null,784965340374361,0,null,[[5,[133]],[0,[134,[0,16,"Tween",131,false]]]]]]],[0,0,false,null,966802454675834,129,[[16,132,"Tween",1,false,false,false,640512727380186,null,[[1,[132]]]]],[[-1,130,null,456882907562642,0,null,[[5,[133]],[0,[63]]]]]],[4,["gameOver",0,[[1,"who",1,"",false,false,585962555298105,false,20]],true,false,false],false,null,565963435492618,130,[],[[6,74,null,596082241022385,0,null,[[2,["menu",false]],[3,1],[0,[2]],[0,[4]],[1,[135]]]],[6,133,null,905581813377383,0,null,[[1,[136]]]],[6,74,null,840898379653452,0,null,[[2,["win",false]],[3,0],[0,[74]],[0,[4]],[1,[137]]]],[47,108,null,370256423758114,0,null],[16,134,"Tween",497724149145609,1,null,[[1,[132]],[0,[4]],[0,[63]],[0,[31]],[18,1],[3,0],[3,0],[3,0],[0,[5]]]],[-1,130,null,977968489710498,0,null,[[5,[133]],[0,[4]]]],[-1,135,null,683360837405343,0,null,[[5,[138]],[3,1]]],[21,136,null,542958537233625,0,null,[[5,[139]]]],[22,137,null,673080752122027,0,null,[[5,[139]]]],[-1,75,null,421677819623936,2,null,[[0,[120]]]],[-1,138,null,999981598537614,256,null,[[4,51],[5,[139]],[0,[4]],[0,[140]],[16,false],[20,[70]]]],[51,139,null,723069309609422,0,null,[[0,[141]],[0,[142]]]],[-1,138,null,868484130857558,256,null,[[4,51],[5,[139]],[0,[4]],[0,[143]],[16,false],[20,[70]]]],[51,139,null,414999656874426,0,null,[[0,[141]],[0,[46]]]],[-1,138,null,329503698124844,256,null,[[4,51],[5,[139]],[0,[4]],[0,[144]],[16,false],[20,[70]]]],[51,139,null,942429315045689,0,null,[[0,[141]],[0,[46]]]],[-1,138,null,300544945198360,256,null,[[4,52],[5,[139]],[0,[145]],[0,[146]],[16,false],[20,[70]]]],[52,140,"Tween",856127507174776,1,null,[[1,[147]],[3,0],[0,[148]],[0,[31]],[18,9],[3,0],[3,0],[3,0],[0,[5]]]],[-1,138,null,452521185418771,256,null,[[4,53],[5,[139]],[0,[149]],[0,[150]],[16,false],[20,[70]]]],[53,34,null,470195214178491,0,null,[[10,0],[7,[5]]]],[-1,138,null,825323435705915,256,null,[[4,55],[5,[139]],[0,[22]],[0,[150]],[16,false],[20,[70]]]],[55,34,null,257211661486965,0,null,[[10,0],[7,[5]]]],[-2,"ActivateMoreGamesButtonsWithStore",null,844293198220657,0,null]],[[0,0,false,null,833797330398783,131,[[-1,26,null,0,false,false,false,481539189826273,null,[[11,585962555298105],[8,0],[7,[123]]]]],[],[[0,0,false,null,963453263147041,132,[[-1,26,null,0,false,false,false,108885782533715,null,[[11,174118167449135],[8,0],[7,[4]]]]],[[52,103,null,679349033173424,0,null,[[0,[5]]]]]],[0,0,false,null,390730169655330,133,[[-1,40,null,0,false,false,false,142155781110973,null]],[[52,103,null,556803202447673,0,null,[[0,[46]]]]]]]],[0,0,false,null,243855942448118,134,[[-1,40,null,0,false,false,false,704202642432436,null],[-1,26,null,0,false,false,false,859368397804082,null,[[11,585962555298105],[8,0],[7,[122]]]]],[[52,103,null,228472030731829,0,null,[[0,[19]]]]]]]]]],[3,[true,"CPU"],false,null,530508175565659,135,[[-1,20,null,0,false,false,false,0,false,[[1,[151]]]]],[],[[0,0,false,null,408793053540788,136,[[-1,26,null,0,false,false,false,250231309108445,null,[[11,174118167449135],[8,0],[7,[5]]]]],[],[[0,0,false,null,482556755597582,137,[[-1,26,null,0,false,false,false,989470972554443,null,[[11,174118167449135],[8,0],[7,[5]]]]],[],[[0,0,false,null,997530245140168,138,[[-1,26,null,0,false,false,false,142516873431146,null,[[11,174118167449135],[8,0],[7,[5]]]]],[],[[0,0,false,null,292415332246634,139,[[47,25,null,0,false,false,false,504509416361132,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,451572381708894,null]],[[47,108,null,269751192029812,0,null]]]]]]],[0,0,false,null,806918216172751,140,[[16,77,"Timer",0,false,false,false,340340881775848,null,[[1,[152]]]]],[[-1,47,null,533879769954879,0,null,[[11,284675396607854],[7,[4]]]]]],[0,0,false,null,468820182232805,141,[[16,77,"Timer",0,false,false,false,675515830393747,null,[[1,[153]]]]],[[16,51,"Timer",427623600829609,0,null,[[0,[154]],[3,0],[1,[30]]]],[-1,47,null,642035895295518,0,null,[[11,284675396607854],[7,[4]]]]]],[0,0,false,null,892957990358619,142,[[-1,26,null,0,false,false,false,395179290917759,null,[[11,727009003176844],[8,0],[7,[4]]]],[-1,26,null,0,false,false,false,683188260748038,null,[[11,284675396607854],[8,0],[7,[4]]]],[-1,26,null,0,false,false,false,506541204950026,null,[[11,895506763348983],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,505315086577013,null,[[10,4],[8,2],[7,[46]]]],[117,27,null,0,false,false,false,687780174690439,null,[[4,8]]]],[],[[0,0,false,null,463928757492844,143,[[117,141,null,0,false,false,true,355602103350833,null,[[3,0],[0,[21,[1,114,53,false]]],[0,[21,[1,114,54,false]]]]]],[],[[0,0,false,null,954931956341378,144,[[117,32,null,0,false,false,false,557571971793234,null,[[8,3],[0,[21,[1,114,53,false]]]]]],[],[[0,0,false,null,535415545625265,145,[[117,39,null,0,false,false,false,477166367625271,null,[[0,[101]],[0,[155]]]],[-1,28,null,0,false,false,false,454566786663108,null]],[[-1,47,null,392670220947253,0,null,[[11,284675396607854],[7,[5]]]],[16,51,"Timer",661088776140208,0,null,[[0,[156,[4,35]]],[3,0],[1,[152]]]]]]]],[0,0,false,null,936176933883637,146,[[-1,40,null,0,false,false,false,484572808234082,null]],[],[[0,0,false,null,221900439522994,147,[[117,39,null,0,false,false,false,556416578665487,null,[[0,[69]],[0,[157]]]],[-1,28,null,0,false,false,false,323208598442344,null]],[[-1,47,null,391131913829100,0,null,[[11,284675396607854],[7,[5]]]],[16,51,"Timer",762174715597164,0,null,[[0,[156,[4,35]]],[3,0],[1,[152]]]]]]]]]]]],[0,0,false,null,922773035969608,148,[[-1,26,null,0,false,false,false,505053744885120,null,[[11,727009003176844],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,383052381409152,null,[[10,4],[8,5],[7,[46]]]],[117,27,null,0,false,false,false,900444354354298,null,[[4,8]]],[16,55,"Timer",0,false,true,false,448912755928819,null,[[1,[153]]]],[16,55,"Timer",0,false,true,false,482932658450919,null,[[1,[30]]]],[-1,28,null,0,false,false,false,263927729257917,null]],[[16,142,"Timer",846988007265563,0,null,[[1,[152]]]],[-1,47,null,920024547454560,0,null,[[11,284675396607854],[7,[5]]]],[16,51,"Timer",501265408441663,0,null,[[0,[158]],[3,0],[1,[153]]]]]],[0,0,false,null,674765364580881,149,[[-1,26,null,0,false,false,false,837828228185955,null,[[11,174118167449135],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,906788826777930,null]],[],[[0,0,false,null,819840177361060,150,[[73,25,null,0,false,false,false,804477321003303,null,[[10,3],[8,0],[7,[5]]]]],[[73,117,null,875839444899328,0,null,[[0,[5]]]]]],[0,0,false,null,599419131571002,151,[[73,25,null,0,false,false,false,572814140010839,null,[[10,3],[8,0],[7,[19]]]]],[[73,117,null,222822134777027,0,null,[[0,[19]]]],[73,56,null,817745008719671,0,null,[[0,[159,[1,73,53,false]]]]]]],[0,0,false,null,274866127039953,152,[[73,25,null,0,false,false,false,879724563576082,null,[[10,3],[8,0],[7,[46]]]]],[[73,46,null,395614218810555,0,null,[[0,[160]]]]]]]]]]]]]],["tailEvent",[[3,[true,"Trail"],false,null,257286037967047,1,[[-1,20,null,0,false,false,false,0,false,[[1,[161]]]]],[],[[0,0,false,null,114652227592561,2,[[-1,143,null,0,false,false,false,395316124724531,null,[[0,[121]]]]],[[28,144,null,546610506957521,0,null,[[3,0],[7,[162,[1,114,53,false]]],[3,0]]],[28,145,null,295624453473955,0,null,[[0,[163,[1,28,146,false]]],[0,[5]],[7,[21,[1,114,54,false]]]]],[27,147,null,158456162916997,0,null,[[0,[164,[4,148]]]]]]],[0,0,false,null,763934725885159,3,[[28,149,null,0,false,false,false,880291736088064,null,[[3,0],[8,4],[0,[68]]]]],[[28,150,null,231005797831656,0,null,[[3,1],[3,0]]]]],[1,"op",0,30,false,false,843020092725876,false,166],[1,"i",0,0,false,false,174319663190866,false,167],[1,"x0",0,0,false,false,715445963225628,false,168],[1,"y0",0,0,false,false,302578370038738,false,169],[1,"a0",0,0,false,false,427487805537182,false,170],[1,"x1",0,0,false,false,182216236209474,false,171],[1,"y1",0,0,false,false,507124621418132,false,172],[1,"a1",0,0,false,false,263265423652571,false,173],[0,0,false,null,911257026357328,4,[[-1,151,null,0,true,false,false,546848836570800,null,[[0,[165,[1,28,146,false]]]]],[114,25,null,0,false,false,false,461721981279997,null,[[10,2],[8,0],[7,[4]]]]],[[-1,47,null,204685133855541,0,null,[[11,174319663190866],[7,[166,[4,152]]]]],[-1,47,null,910424285571717,0,null,[[11,715445963225628],[7,[167,[1,28,153,false],[3,174319663190866]]]]],[-1,47,null,963006473893448,0,null,[[11,302578370038738],[7,[168,[1,28,153,false],[3,174319663190866]]]]],[-1,47,null,882220856902344,0,null,[[11,427487805537182],[7,[169,[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866]]]]],[-1,47,null,320473395944015,0,null,[[11,182216236209474],[7,[170,[1,28,153,false],[3,174319663190866]]]]],[-1,47,null,417211034263251,0,null,[[11,507124621418132],[7,[171,[1,28,153,false],[3,174319663190866]]]]],[-1,47,null,431114005130968,0,null,[[11,263265423652571],[7,[172,[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866],[1,28,153,false],[3,174319663190866]]]]]],[[0,0,false,null,637263225269377,5,[],[[27,154,null,494574799019905,0,null],[27,155,null,729436824539902,0,null,[[0,[173,[3,715445963225628],[2,114,false,1],[3,427487805537182],[3,174319663190866]]],[0,[174,[3,302578370038738],[2,114,false,1],[3,427487805537182],[3,174319663190866]]]]],[27,155,null,754384758143555,0,null,[[0,[173,[3,182216236209474],[2,114,false,1],[3,263265423652571],[3,174319663190866]]],[0,[174,[3,507124621418132],[2,114,false,1],[3,263265423652571],[3,174319663190866]]]]],[27,155,null,262332115378593,0,null,[[0,[175,[3,182216236209474],[2,114,false,1],[3,263265423652571],[3,174319663190866]]],[0,[176,[3,507124621418132],[2,114,false,1],[3,263265423652571],[3,174319663190866]]]]],[27,155,null,806475285182729,0,null,[[0,[175,[3,715445963225628],[2,114,false,1],[3,427487805537182],[3,174319663190866]]],[0,[176,[3,302578370038738],[2,114,false,1],[3,427487805537182],[3,174319663190866]]]]],[27,156,null,199183519851327,0,null,[[0,[177,[4,148],[2,114,false,1],[3,174319663190866],[3,843020092725876]]]]]]]]],[0,0,false,null,688674112379168,6,[[9,157,null,0,false,false,false,416822722074651,null,[[1,[178]]]]],[],[[1,"speed",0,0.1,false,false,395604681028587,false,145],[0,0,false,null,206947808690108,7,[[27,132,"Tween",1,false,false,false,746878450388408,null,[[1,[179]]]]],[[27,140,"Tween",152040760617761,1,null,[[1,[180]],[3,6],[0,[181,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,359827542629079,8,[[27,132,"Tween",1,false,false,false,874231135491614,null,[[1,[180]]]]],[[27,140,"Tween",685929146886561,1,null,[[1,[182]],[3,6],[0,[183,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,852893446494524,9,[[27,132,"Tween",1,false,false,false,568714194249812,null,[[1,[182]]]]],[[27,140,"Tween",353235814367062,1,null,[[1,[184]],[3,6],[0,[185,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,485824114198035,10,[[27,132,"Tween",1,false,false,false,352615990571451,null,[[1,[184]]]]],[[27,140,"Tween",221127984922617,1,null,[[1,[186]],[3,6],[0,[187,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,397224435442816,11,[[27,132,"Tween",1,false,false,false,922232060102947,null,[[1,[186]]]]],[[27,140,"Tween",835780872394795,1,null,[[1,[188]],[3,6],[0,[189,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,130464026679155,12,[[27,132,"Tween",1,false,false,false,420593664922555,null,[[1,[188]]]]],[[27,140,"Tween",818281186329480,1,null,[[1,[190]],[3,6],[0,[191,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,469891185657079,13,[[27,132,"Tween",1,false,false,false,182478997297001,null,[[1,[190]]]]],[[27,140,"Tween",193857561814062,1,null,[[1,[179]],[3,6],[0,[192,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,874537592541057,14,[[-1,28,null,0,false,false,false,618752200904904,null]],[[27,140,"Tween",576555390058148,1,null,[[1,[180]],[3,6],[0,[181,[4,100]]],[0,[10,[3,395604681028587]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]]]]]]]],["bonusEvent",[[3,[true,"Bonus"],false,null,956453493758386,1,[[-1,20,null,0,false,false,false,0,false,[[1,[193]]]]],[],[[1,"rndChar",0,-1,false,false,742416866043478,false,174],[1,"rndBall",0,-1,false,false,849531964858953,false,175],[1,"rndGoal",0,-1,false,false,347139371839372,false,176],[1,"rndPlace",0,0,false,false,274951061636774,false,177],[1,"rndArm",0,0,false,false,174776722011300,false,178],[1,"startText",1,"",true,false,622506128811027,false,179],[1,"waitText",0,0,true,false,565732277731813,false,180],[0,0,false,null,540770498405480,2,[[-1,21,null,1,false,false,false,359764889336009,null]],[[-1,47,null,276926334299341,0,null,[[11,462466925293457],[7,[4]]]],[-1,47,null,199175216613942,0,null,[[11,565732277731813],[7,[4]]]],[-1,47,null,632663787920614,0,null,[[11,622506128811027],[7,[70]]]],[-1,47,null,769877089534004,0,null,[[11,308680730337585],[7,[4]]]],[-1,47,null,714826707419554,0,null,[[11,284675396607854],[7,[4]]]],[-1,47,null,162994352768924,0,null,[[11,727009003176844],[7,[19]]]],[-1,73,null,511969153524805,0,null,[[0,[5]]]],[-1,125,null,406341147910603,0,null,[[0,[5]]]],[-1,122,null,857274338095309,0,null,[[0,[148]],[0,[194]]]],[50,79,null,705290066214414,0,null,[[0,[195,[4,89],[4,90]]],[0,[195,[4,92],[4,87]]]]],[50,60,null,794744499737912,0,null,[[0,[148]],[0,[194]]]],[50,158,null,539260649965305,0,null]],[[0,0,false,null,433098845719659,3,[[-1,44,null,0,false,false,false,319494658650602,null,[[7,[113,[3,870248114194364],[3,336820796057693]]],[8,0],[7,[4]]]]],[[-1,47,null,338612316711468,0,null,[[11,742416866043478],[7,[25]]]],[-1,47,null,519926140008140,0,null,[[11,849531964858953],[7,[25]]]],[-1,47,null,348584287341001,0,null,[[11,347139371839372],[7,[25]]]],[-1,47,null,898201030504401,0,null,[[11,274951061636774],[7,[4]]]],[-1,47,null,447866254839180,0,null,[[11,174776722011300],[7,[4]]]]]],[0,0,false,null,550218774964454,4,[[-1,40,null,0,false,false,false,581786005262591,null]],[[-1,47,null,756403539399700,0,null,[[11,742416866043478],[7,[196,[4,97],[4,95],[4,97]]]]],[-1,47,null,324180225076448,0,null,[[11,849531964858953],[7,[197,[4,97],[4,95],[4,35]]]]],[-1,47,null,301739695132046,0,null,[[11,347139371839372],[7,[198,[3,849531964858953],[4,97],[4,97],[4,97],[4,95],[4,35]]]]],[-1,47,null,323324992585309,0,null,[[11,174776722011300],[7,[199,[4,97],[4,95],[4,35]]]]],[-1,47,null,137159986773889,0,null,[[11,274951061636774],[7,[200,[4,97]]]]]]],[0,0,false,null,730592326514494,5,[[-1,116,null,0,true,false,false,804397799785687,null,[[4,84]]]],[],[[0,0,false,null,580261258922446,6,[[74,25,null,0,false,false,false,179665556052633,null,[[10,0],[8,0],[7,[114,[2,84,false,0]]]]]],[[84,78,"Pin",878562757243756,0,null,[[4,74],[16,true],[16,true],[16,true],[3,0],[3,0],[16,false]]]]]]],[0,0,false,null,885981868895236,7,[[-1,116,null,0,true,false,false,843046400515064,null,[[4,86]]]],[],[[0,0,false,null,240478161813757,8,[[-1,26,null,0,false,false,false,131075951075554,null,[[11,347139371839372],[8,0],[7,[19]]]]],[[86,56,null,135989481866635,0,null,[[0,[201,[1,86,53,false],[2,86,false,0]]]]]]],[0,0,false,null,304752559086373,9,[[74,25,null,0,false,false,false,769128056032344,null,[[10,0],[8,0],[7,[114,[2,86,false,0]]]]]],[[86,78,"Pin",951941254419502,0,null,[[4,74],[16,true],[16,true],[16,false],[3,0],[3,0],[16,false]]]]]]],[0,0,false,null,165890832831200,10,[],[[70,103,null,204966429813468,0,null,[[0,[10,[3,174776722011300]]]]],[77,103,null,254066171379944,0,null,[[0,[10,[3,174776722011300]]]]],[78,103,null,980036158208258,0,null,[[0,[10,[3,174776722011300]]]]],[79,103,null,905165777345535,0,null,[[0,[10,[3,174776722011300]]]]]],[[0,0,false,null,105199123200601,11,[[-1,26,null,0,false,false,false,928763252126508,null,[[11,174776722011300],[8,0],[7,[5]]]]],[[-1,47,null,620185249622621,0,null,[[11,622506128811027],[7,[202,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,881289202374713,0,null,[[11,565732277731813],[7,[5]]]]]],[0,0,false,null,547318712222429,12,[[-1,40,null,0,false,false,false,510723082983548,null],[-1,26,null,0,false,false,false,117392659516172,null,[[11,174776722011300],[8,0],[7,[19]]]]],[[-1,47,null,775911987662707,0,null,[[11,622506128811027],[7,[203,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,176118281034990,0,null,[[11,565732277731813],[7,[5]]]]]]]],[0,0,false,null,610278463514342,13,[[-1,26,null,0,false,false,false,113997363114174,null,[[11,274951061636774],[8,0],[7,[4]]]]],[[43,160,null,869311593017902,0,null],[61,98,null,465237530561644,0,null],[-1,47,null,973899054070621,0,null,[[11,412696536558178],[7,[204]]]],[-1,47,null,842424014611554,0,null,[[11,262420649510634],[7,[205]]]],[-1,47,null,781580439597365,0,null,[[11,730424728310926],[7,[15]]]],[66,98,null,463017219273664,0,null],[93,98,null,687357006462483,0,null],[69,108,null,459327855434658,0,null],[67,98,null,220960315743669,0,null],[68,108,null,473087239237610,0,null],[89,98,null,128956447273169,0,null],[96,108,null,734588097097763,0,null],[90,98,null,510785169293731,0,null],[91,98,null,399057068531659,0,null],[97,98,null,547588567723071,0,null],[98,108,null,467845328041054,0,null]]],[0,0,false,null,801187896773351,14,[[-1,40,null,0,false,false,false,626959118332555,null],[-1,26,null,0,false,false,false,490417162986825,null,[[11,274951061636774],[8,0],[7,[5]]]]],[[-1,47,null,235752225689298,0,null,[[11,622506128811027],[7,[206,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,701463472694720,0,null,[[11,565732277731813],[7,[5]]]],[88,101,null,748249925031414,0,null,[[0,[207,[4,100]]]]],[-1,47,null,153164966450044,0,null,[[11,849531964858953],[7,[25]]]],[66,98,null,625582797570642,0,null],[93,98,null,748492446383842,0,null],[17,98,null,498795795627104,0,null],[24,101,null,559135859190582,0,null,[[0,[208]]]],[18,104,null,201145002037929,0,null,[[0,[209,[4,100]]]]],[16,34,null,203609212277004,0,null,[[10,0],[7,[5]]]],[19,104,null,329396605550907,0,null,[[0,[209,[4,100]]]]],[-1,47,null,255290451261448,0,null,[[11,412696536558178],[7,[210]]]],[-1,47,null,400960807838100,0,null,[[11,262420649510634],[7,[211]]]],[-1,47,null,788340281206741,0,null,[[11,455877582027442],[7,[205]]]],[-1,47,null,836097743210310,0,null,[[11,730424728310926],[7,[50]]]],[89,98,null,921079151438397,0,null],[96,108,null,755954602790306,0,null],[-1,47,null,719771706136832,0,null,[[11,274951061636774],[7,[4]]]],[90,98,null,520635472650029,0,null],[91,98,null,579881668432349,0,null],[69,108,null,499474153395507,0,null],[67,98,null,432912405143221,0,null],[68,108,null,675357664437065,0,null],[26,98,null,324833817869931,0,null],[62,98,null,737672411149966,0,null],[63,98,null,234232817494037,0,null],[98,108,null,272241853851582,0,null],[40,98,null,993356859531007,0,null],[25,98,null,690727501517834,0,null],[-1,75,null,394063510943361,2,null,[[0,[4]]]],[-1,99,null,614997342162917,0,null,[[5,[4]],[0,[212,[4,100]]]]]],[[0,0,false,null,580168408267646,15,[[0,25,null,0,false,false,false,999939404143822,null,[[10,1],[8,0],[7,[4]]]],[0,25,null,0,false,false,false,746321653657940,null,[[10,0],[8,0],[7,[4]]]]],[[0,161,"Physics",975133352146679,0,null,[[0,[10,[3,483064547053985]]]]]]]]],[0,0,false,null,820179838908346,16,[[-1,40,null,0,false,false,false,819440457440282,null],[-1,26,null,0,false,false,false,516175671610466,null,[[11,274951061636774],[8,0],[7,[19]]]]],[[97,98,null,421842013598440,0,null],[-1,119,null,430804160990001,0,null,[[11,565732277731813],[7,[5]]]],[88,98,null,910468859047740,0,null],[90,98,null,821534519893009,0,null],[91,98,null,369048765465504,0,null],[93,98,null,821182906598460,0,null],[43,160,null,257559951875506,0,null],[61,98,null,944910735962622,0,null],[17,98,null,779152263258759,0,null],[-1,47,null,491020490145121,0,null,[[11,412696536558178],[7,[204]]]],[-1,47,null,405889529842202,0,null,[[11,262420649510634],[7,[205]]]],[-1,47,null,770668402894029,0,null,[[11,730424728310926],[7,[15]]]],[18,104,null,274538101787611,0,null,[[0,[130,[4,100]]]]],[19,104,null,239550021095243,0,null,[[0,[130,[4,100]]]]],[23,98,null,486798682792909,0,null],[24,98,null,328731027567305,0,null],[26,98,null,234188068107298,0,null],[62,98,null,133316122787588,0,null],[63,98,null,605946069994689,0,null],[40,98,null,817830493547274,0,null],[89,98,null,775844640952882,0,null],[96,108,null,869450888315389,0,null],[-1,47,null,630627717822145,0,null,[[11,274951061636774],[7,[4]]]],[-1,75,null,116977229920918,2,null,[[0,[4]]]],[-1,99,null,736391687143603,0,null,[[5,[4]],[0,[213,[4,100]]]]],[25,101,null,600043185088949,0,null,[[0,[214,[4,100]]]]]]],[0,0,false,null,401917153264415,17,[[-1,40,null,0,false,false,false,694237648029613,null],[-1,26,null,0,false,false,false,287467878081469,null,[[11,274951061636774],[8,0],[7,[46]]]]],[[97,98,null,202649800334005,0,null],[-1,119,null,992755025052616,0,null,[[11,565732277731813],[7,[5]]]],[88,101,null,504033199309204,0,null,[[0,[215,[4,100]]]]],[-1,47,null,612362874436062,0,null,[[11,412696536558178],[7,[204]]]],[-1,47,null,121037438137912,0,null,[[11,262420649510634],[7,[205]]]],[-1,47,null,106940773073673,0,null,[[11,730424728310926],[7,[15]]]],[18,104,null,145268499697248,0,null,[[0,[216,[4,100]]]]],[19,104,null,779870569501190,0,null,[[0,[216,[4,100]]]]],[43,160,null,835796121592613,0,null],[61,98,null,651246211761111,0,null],[66,98,null,885659242589557,0,null],[69,108,null,725464659479107,0,null],[67,98,null,746568674398138,0,null],[68,108,null,170830588738578,0,null],[25,98,null,702512170664544,0,null],[23,98,null,841066071318437,0,null],[24,98,null,569894797761798,0,null],[98,108,null,139227200556767,0,null],[26,98,null,794326757731007,0,null],[62,98,null,194997545509963,0,null],[63,98,null,349642237169909,0,null],[40,98,null,586017990825770,0,null],[17,98,null,724358229291689,0,null],[-1,75,null,735851544950046,2,null,[[0,[4]]]],[-1,99,null,818238932388417,0,null,[[5,[4]],[0,[217,[4,100]]]]]]],[0,0,false,null,676048785017342,18,[[-1,26,null,0,false,false,false,925036354271151,null,[[11,742416866043478],[8,0],[7,[4]]]]],[[-1,47,null,524525645176153,0,null,[[11,622506128811027],[7,[218,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,503844909213121,0,null,[[11,565732277731813],[7,[5]]]],[4,57,null,625702497044122,0,null,[[0,[219]]]],[29,57,null,119003149932102,0,null,[[0,[219]]]],[34,57,null,464484053459446,0,null,[[0,[219]]]],[37,57,null,894596713742362,0,null,[[0,[219]]]],[5,57,null,712217590415207,0,null,[[0,[219]]]],[11,57,null,711749850779713,0,null,[[0,[219]]]],[11,162,null,941127370919313,0,null,[[0,[165,[1,11,54,false]]]]],[4,162,null,992899747798489,0,null,[[0,[220,[1,4,54,false]]]]],[29,162,null,308375387031561,0,null,[[0,[220,[1,29,54,false]]]]],[34,162,null,556658908925162,0,null,[[0,[220,[1,34,54,false]]]]],[37,162,null,823449525989656,0,null,[[0,[220,[1,37,54,false]]]]]]],[0,0,false,null,753052014454803,19,[[-1,26,null,0,false,false,false,275166225044997,null,[[11,742416866043478],[8,0],[7,[5]]]]],[[-1,47,null,347987035010631,0,null,[[11,622506128811027],[7,[221,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,146695307033164,0,null,[[11,565732277731813],[7,[5]]]],[4,57,null,727947295824800,0,null,[[0,[222]]]],[29,57,null,301157664277063,0,null,[[0,[222]]]],[34,57,null,921253750723455,0,null,[[0,[222]]]],[37,57,null,712266402568996,0,null,[[0,[222]]]],[5,57,null,112759451561093,0,null,[[0,[222]]]],[4,162,null,585212491631444,0,null,[[0,[220,[1,4,54,false]]]]],[29,162,null,648925716202209,0,null,[[0,[220,[1,29,54,false]]]]],[34,162,null,889234924061189,0,null,[[0,[220,[1,34,54,false]]]]],[37,162,null,269180280787142,0,null,[[0,[220,[1,37,54,false]]]]],[11,108,null,394700474775040,0,null]]],[0,0,false,null,277447076693249,20,[[-1,26,null,0,false,false,false,977030542399950,null,[[11,742416866043478],[8,0],[7,[19]]]]],[[-1,47,null,208671509893440,0,null,[[11,462466925293457],[7,[5]]]],[-1,47,null,264790651365950,0,null,[[11,622506128811027],[7,[223,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,834965001910235,0,null,[[11,565732277731813],[7,[5]]]],[10,163,null,664271703404648,0,null,[[1,[224]],[3,1]]],[13,163,null,862107633385672,0,null,[[1,[224]],[3,1]]],[-1,75,null,883728421200957,2,null,[[0,[4]]]],[12,163,null,378686042214339,0,null,[[1,[224]],[3,1]]],[70,164,null,947595778221297,259,null,[[4,95],[5,[21,[1,70,165,true]]],[7,[4]],[16,false]]],[95,163,null,300791806494612,0,null,[[1,[224]],[3,0]]],[95,62,null,808754593881174,0,null,[[3,0],[4,70]]],[95,166,"Pin",975883694598828,0,null,[[4,70],[7,[4]],[16,true],[3,0],[3,0],[16,false]]],[77,164,null,686848263291856,259,null,[[4,95],[5,[21,[1,77,165,true]]],[7,[4]],[16,false]]],[95,163,null,171119481023345,0,null,[[1,[224]],[3,0]]],[95,62,null,485346984677417,0,null,[[3,0],[4,77]]],[95,166,"Pin",275548074510873,0,null,[[4,77],[7,[4]],[16,true],[3,0],[3,0],[16,false]]],[78,164,null,690901481093239,259,null,[[4,95],[5,[21,[1,78,165,true]]],[7,[4]],[16,false]]],[95,62,null,296031300747462,0,null,[[3,0],[4,78]]],[95,166,"Pin",948849651020216,0,null,[[4,78],[7,[4]],[16,true],[3,0],[3,0],[16,false]]],[79,164,null,170176746291188,259,null,[[4,95],[5,[21,[1,79,165,true]]],[7,[4]],[16,false]]],[95,62,null,729508387103569,0,null,[[3,0],[4,79]]],[95,166,"Pin",564871297892573,0,null,[[4,79],[7,[4]],[16,true],[3,0],[3,0],[16,false]]]],[[0,0,true,null,466866317677561,21,[[10,25,null,0,false,false,false,180153307361798,null,[[10,0],[8,0],[7,[4]]]],[10,25,null,0,false,false,false,996134523192531,null,[[10,0],[8,0],[7,[19]]]]],[[10,103,null,377916354296207,0,null,[[0,[5]]]]]],[0,0,true,null,406309735939516,22,[[13,25,null,0,false,false,false,595314326984963,null,[[10,0],[8,0],[7,[4]]]],[13,25,null,0,false,false,false,489446837100036,null,[[10,0],[8,0],[7,[19]]]]],[[13,103,null,940695329394003,0,null,[[0,[5]]]]]],[0,0,true,null,691865629383638,23,[[12,25,null,0,false,false,false,855082950130788,null,[[10,0],[8,0],[7,[19]]]],[12,25,null,0,false,false,false,440555310472783,null,[[10,0],[8,0],[7,[4]]]]],[[12,103,null,871550118455714,0,null,[[0,[5]]]]]]]],[0,0,false,null,111255187952742,24,[[-1,26,null,0,false,false,false,762104550422903,null,[[11,849531964858953],[8,0],[7,[4]]]]],[[-1,47,null,628968896388976,0,null,[[11,622506128811027],[7,[225,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,711598098531202,0,null,[[11,565732277731813],[7,[5]]]],[41,108,null,784920317365595,0,null],[-1,138,null,405854021041303,256,null,[[4,7],[5,[226]],[0,[21,[1,9,53,false]]],[0,[21,[1,9,54,false]]],[16,false],[20,[70]]]],[9,163,null,896137997982239,0,null,[[1,[227]],[3,1]]],[7,34,null,656121864857855,0,null,[[10,0],[7,[158]]]]],[[0,0,false,null,349325030060294,25,[[-1,26,null,0,false,false,false,470086366803930,null,[[11,755872340856296],[8,3],[7,[228]]]]],[[-1,119,null,923618761192686,0,null,[[11,290347554392499],[7,[3]]]]]],[0,0,false,null,470156534899510,26,[[-1,26,null,0,false,false,false,507466087467852,null,[[11,755872340856296],[8,2],[7,[229]]]],[-1,26,null,0,false,false,false,949437719382382,null,[[11,755872340856296],[8,4],[7,[228]]]]],[[-1,119,null,654270323153039,0,null,[[11,290347554392499],[7,[230]]]]]],[0,0,false,null,926253790303305,27,[[-1,26,null,0,false,false,false,155983391944430,null,[[11,755872340856296],[8,5],[7,[231]]]],[-1,26,null,0,false,false,false,900174354632742,null,[[11,755872340856296],[8,2],[7,[232]]]]],[[-1,119,null,779841028523068,0,null,[[11,290347554392499],[7,[233]]]]]],[0,0,false,null,941059676062129,28,[[-1,26,null,0,false,false,false,235873042184606,null,[[11,755872340856296],[8,5],[7,[232]]]],[-1,26,null,0,false,false,false,834233220529560,null,[[11,755872340856296],[8,2],[7,[234]]]]],[[-1,119,null,418251957342742,0,null,[[11,290347554392499],[7,[235]]]]]],[0,0,false,null,946747829494481,29,[[-1,26,null,0,false,false,false,300234063834836,null,[[11,755872340856296],[8,5],[7,[234]]]],[-1,26,null,0,false,false,false,177919530688998,null,[[11,755872340856296],[8,2],[7,[236]]]]],[[-1,119,null,558228038451491,0,null,[[11,290347554392499],[7,[237]]]]]],[0,0,false,null,540068064493279,30,[[-1,26,null,0,false,false,false,207041052495420,null,[[11,755872340856296],[8,5],[7,[236]]]],[-1,26,null,0,false,false,false,254905518005737,null,[[11,755872340856296],[8,2],[7,[205]]]]],[[-1,119,null,171946193618048,0,null,[[11,290347554392499],[7,[238]]]]]],[0,0,false,null,961368130227995,31,[[-1,26,null,0,false,false,false,266742579807212,null,[[11,755872340856296],[8,5],[7,[205]]]],[-1,26,null,0,false,false,false,942466500250977,null,[[11,755872340856296],[8,2],[7,[239]]]]],[[-1,119,null,590323292017819,0,null,[[11,290347554392499],[7,[240]]]]]],[0,0,false,null,945068451852898,32,[[-1,26,null,0,false,false,false,746316520414555,null,[[11,755872340856296],[8,5],[7,[241]]]],[-1,26,null,0,false,false,false,358880248009576,null,[[11,755872340856296],[8,2],[7,[242]]]]],[[-1,119,null,588933620940140,0,null,[[11,290347554392499],[7,[243]]]]]],[0,0,false,null,631256284872625,33,[[-1,26,null,0,false,false,false,130408406000218,null,[[11,755872340856296],[8,5],[7,[244]]]],[-1,26,null,0,false,false,false,833757168118661,null,[[11,755872340856296],[8,2],[7,[245]]]]],[[-1,119,null,350348320367907,0,null,[[11,290347554392499],[7,[238]]]]]]]],[0,0,false,null,227474149604159,34,[[-1,26,null,0,false,false,false,467125086104365,null,[[11,849531964858953],[8,0],[7,[5]]]]],[[-1,47,null,864179958651255,0,null,[[11,622506128811027],[7,[246,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,344353408458647,0,null,[[11,565732277731813],[7,[5]]]],[41,108,null,742578190935405,0,null],[9,163,null,688144202161213,0,null,[[1,[247]],[3,1]]],[-1,138,null,965175176707421,256,null,[[4,42],[5,[226]],[0,[21,[1,9,53,false]]],[0,[21,[1,9,54,false]]],[16,false],[20,[70]]]],[42,34,null,152513216566318,0,null,[[10,0],[7,[158]]]]],[[0,0,false,null,557428499457443,35,[[-1,26,null,0,false,false,false,460048675801834,null,[[11,290347554392499],[8,1],[7,[10,[3,418073226185083]]]]]],[[-1,47,null,952827027727505,0,null,[[11,290347554392499],[7,[10,[3,418073226185083]]]]]]]]],[0,0,false,null,220010309108852,37,[[-1,26,null,0,false,false,false,338925348409582,null,[[11,849531964858953],[8,0],[7,[19]]]]],[[-1,47,null,801364855315298,0,null,[[11,622506128811027],[7,[248,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,111170159082196,0,null,[[11,565732277731813],[7,[5]]]],[9,163,null,111429410350803,0,null,[[1,[178]],[3,1]]]],[[0,0,false,null,281858910039988,38,[[-1,26,null,0,false,false,false,282318974341420,null,[[11,290347554392499],[8,1],[7,[10,[3,418073226185083]]]]]],[[-1,47,null,229446287339108,0,null,[[11,290347554392499],[7,[10,[3,418073226185083]]]]]]]]],[0,0,false,null,410523815627138,39,[],[[114,167,"Physics",733649625930674,0,null,[[0,[50]]]],[-1,75,null,397615449069035,2,null,[[0,[4]]]]]],[1,"meter",0,15,false,true,255200327312553,false,181],[0,0,false,null,691735268532665,40,[[-1,26,null,0,false,false,false,887178699993683,null,[[11,347139371839372],[8,0],[7,[4]]]]],[[-1,47,null,798972382778254,0,null,[[11,622506128811027],[7,[249,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,868009508535434,0,null,[[11,565732277731813],[7,[5]]]],[74,162,null,627466278779278,0,null,[[0,[250,[1,74,54,false]]]]],[71,162,null,247015777401306,0,null,[[0,[250,[1,71,54,false]]]]],[73,162,null,614463234246323,0,null,[[0,[250,[1,73,54,false]]]]],[83,162,null,765343119894067,0,null,[[0,[250,[1,83,54,false]]]]],[76,162,null,240978623655886,0,null,[[0,[250,[1,76,54,false]]]]],[75,88,null,208100737623040,0,null,[[0,[251,[1,75,168,false]]]]]],[[0,0,false,null,469033997734397,41,[[0,25,null,0,false,false,false,974090695793787,null,[[10,1],[8,0],[7,[5]]]]],[[0,117,null,288973104491660,0,null,[[0,[251,[1,0,80,false]]]]],[0,162,null,208629192748105,0,null,[[0,[252]]]]]]]],[0,0,false,null,330211381761711,42,[[-1,26,null,0,false,false,false,994465731403768,null,[[11,347139371839372],[8,0],[7,[5]]]]],[[-1,47,null,475206035772677,0,null,[[11,622506128811027],[7,[253,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,492858672534089,0,null,[[11,565732277731813],[7,[5]]]],[74,162,null,475275884506071,0,null,[[0,[251,[1,74,54,false]]]]],[71,162,null,816813646542402,0,null,[[0,[251,[1,71,54,false]]]]],[73,162,null,138964788281964,0,null,[[0,[251,[1,73,54,false]]]]],[76,162,null,872337489277065,0,null,[[0,[251,[1,76,54,false]]]]],[83,162,null,918876177398062,0,null,[[0,[251,[1,83,54,false]]]]],[75,88,null,483578087975844,0,null,[[0,[250,[1,75,168,false]]]]]],[[0,0,false,null,108621759237385,43,[[0,25,null,0,false,false,false,273465843615562,null,[[10,1],[8,0],[7,[5]]]]],[]]]],[0,0,false,null,426549301453789,44,[[-1,26,null,0,false,false,false,663387583052302,null,[[11,347139371839372],[8,0],[7,[19]]]]],[[-1,47,null,448498822996657,0,null,[[11,622506128811027],[7,[254,[3,622506128811027],[4,159],[3,622506128811027]]]]],[-1,119,null,384198501348003,0,null,[[11,565732277731813],[7,[5]]]],[74,103,null,394314636748335,0,null,[[0,[5]]]],[84,103,null,171721355600662,0,null,[[0,[5]]]],[86,103,null,203439012382970,0,null,[[0,[5]]]],[83,117,null,708896950812174,0,null,[[0,[255,[1,83,80,false]]]]],[76,117,null,925647844923284,0,null,[[0,[255,[1,76,80,false]]]]],[83,56,null,602545242075102,0,null,[[0,[256,[1,83,53,false],[2,83,false,0]]]]],[76,56,null,414671078691120,0,null,[[0,[256,[1,76,53,false],[2,76,false,0]]]]]],[[0,0,false,null,829187604828566,45,[[71,25,null,0,false,false,false,355905412696272,null,[[10,2],[8,0],[7,[4]]]]],[[71,56,null,225398354656105,0,null,[[0,[255,[1,71,53,false]]]]]]],[0,0,false,null,816916539585986,46,[[73,25,null,0,false,false,false,195276882644114,null,[[10,2],[8,0],[7,[4]]]]],[[73,56,null,935060445095423,0,null,[[0,[257,[1,73,53,false]]]]]]]]],[0,0,false,null,152153459918955,47,[[-1,26,null,0,false,false,false,551914789168748,null,[[11,622506128811027],[8,1],[7,[70]]]]],[[-1,138,null,977385319945597,256,null,[[4,92],[5,[258]],[0,[148]],[0,[101]],[16,false],[20,[70]]]],[92,112,null,600554436128466,0,null,[[7,[10,[3,622506128811027]]]]]]],[0,0,false,null,551544465649956,48,[[-1,26,null,0,false,false,false,324356660714727,null,[[11,552810473595513],[8,0],[7,[5]]]]],[[-1,75,null,724746800937903,2,null,[[0,[259,[3,565732277731813]]]]],[6,74,null,128438944562315,0,null,[[2,["refsoc",false]],[3,0],[0,[260]],[0,[4]],[1,[261]]]],[6,169,null,914240102930417,0,null,[[1,[261]],[0,[127]]]],[8,170,null,105263869679804,0,null,[[3,1]]],[114,65,"Physics",134375473853963,0,null,[[3,0]]],[-1,47,null,364741305349859,0,null,[[11,727009003176844],[7,[4]]]],[16,72,null,837868947476110,0,null,[[3,1]]],[92,140,"Tween",293579834375961,1,null,[[1,[262]],[3,1],[0,[263]],[0,[31]],[18,8],[3,1],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,241282302068457,49,[[-1,26,null,0,false,false,false,938341336240258,null,[[11,849531964858953],[8,0],[7,[19]]]]],[[6,169,null,733366355021478,0,null,[[1,[136]],[0,[127]]]]]],[0,0,false,null,528456956032953,50,[[-1,40,null,0,false,false,false,744454137683367,null]],[[6,169,null,388186154840179,0,null,[[1,[136]],[0,[5]]]]]]]],[0,0,false,null,219441910842912,51,[[95,64,null,1,false,false,false,316929297670279,null]],[[95,103,null,367963848985724,0,null,[[0,[21,[1,70,171,false]]]]]]]]],[3,[true,"Effect"],false,null,688861007028982,52,[[-1,20,null,0,false,false,false,0,false,[[1,[264]]]]],[],[[1,"speed",0,0.3,false,false,259611595560641,false,145],[4,["goalText",0,[[1,"who",0,0,false,false,594720735489185,false,20]],true,false,false],false,null,845855455676986,53,[],[[6,74,null,686136460054945,0,null,[[2,["goasoc",false]],[3,0],[0,[74]],[0,[4]],[1,[265]]]],[-1,138,null,298619922161464,256,null,[[4,57],[5,[139]],[0,[145]],[0,[146]],[16,false],[20,[70]]]],[57,103,null,740270993497229,0,null,[[0,[10,[3,594720735489185]]]]],[-1,115,null,712961830861123,0,null,[[4,57],[0,[5]]]],[57,79,null,541993555348503,0,null,[[0,[4]],[0,[4]]]],[57,172,"Tween",430167112413146,1,null,[[1,[70]],[3,1],[0,[266]],[0,[267]],[0,[10,[3,259611595560641]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]],[57,140,"Tween",935141459233500,1,null,[[1,[268]],[3,0],[0,[148]],[0,[10,[3,259611595560641]]],[18,3],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,187614231745097,54,[[57,132,"Tween",1,false,false,false,396853894477169,null,[[1,[268]]]]],[[57,173,"Sine",725440088800119,0,null,[[3,1]]],[-1,75,null,137148110381740,2,null,[[0,[26]]]],[57,173,"Sine",181702715984786,0,null,[[3,0]]],[57,46,null,331676496334688,0,null,[[0,[4]]]],[57,140,"Tween",234445692007799,1,null,[[1,[269]],[3,0],[0,[270]],[0,[10,[3,259611595560641]]],[18,2],[3,1],[3,0],[3,0],[0,[5]]]],[57,172,"Tween",282909168492014,1,null,[[1,[70]],[3,1],[0,[4]],[0,[4]],[0,[10,[3,259611595560641]]],[18,0],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,514268410054362,55,[[9,61,null,0,false,false,true,698679129175387,null,[[4,110]]]],[[-2,"createBallFX",null,595057604903871,0,null]]],[0,0,false,null,966440633984446,56,[[9,61,null,0,false,false,true,365630041672096,null,[[4,0]]],[0,25,null,0,false,false,false,618240542488949,null,[[10,0],[8,1],[7,[4]]]]],[[-2,"createBallFX",null,615629378505574,0,null]]],[0,0,true,null,879010276950115,57,[[87,61,null,0,false,false,true,990294621276013,null,[[4,71]]],[87,61,null,0,false,false,true,666219640099099,null,[[4,73]]]],[],[[0,0,false,null,635000742528837,58,[[114,55,"Timer",0,false,true,false,745925838450169,null,[[1,[27]]]]],[[-2,"createBallFX",null,752468407816151,0,null]]]]],[4,["createBallFX",0,[],true,false,false],false,null,112949983451340,59,[],[],[[0,0,true,null,159134165807914,60,[[114,25,null,0,false,false,false,808980549935449,null,[[10,2],[8,0],[7,[4]]]]],[[9,164,null,684622738080150,259,null,[[4,56],[5,[226]],[7,[4]],[16,false]]],[56,46,null,760445920708961,0,null,[[0,[4]]]],[56,172,"Tween",461511688568950,1,null,[[1,[271]],[3,1],[0,[4]],[0,[4]],[0,[31]],[18,3],[3,1],[3,0],[3,0],[0,[5]]]],[56,62,null,646581273676987,0,null,[[3,1],[4,9]]]],[[0,0,false,null,126920213807355,61,[[-1,26,null,0,false,false,false,241628024925266,null,[[11,727009003176844],[8,0],[7,[4]]]],[16,55,"Timer",0,false,true,false,978238846308932,null,[[1,[272]]]]],[[6,74,null,321083613663726,0,null,[[2,["bup",false]],[3,0],[0,[273]],[0,[4]],[1,[272]]]],[16,51,"Timer",116958714438109,0,null,[[0,[117]],[3,0],[1,[272]]]]]]]]]],[4,["createBallFX2",0,[],true,false,false],false,null,512039896767293,62,[],[],[[0,0,true,null,127066374242057,63,[],[[9,164,null,588875882893243,259,null,[[4,56],[5,[226]],[7,[4]],[16,false]]],[56,46,null,944826087584122,0,null,[[0,[4]]]],[56,172,"Tween",733244549267496,1,null,[[1,[271]],[3,1],[0,[4]],[0,[4]],[0,[31]],[18,3],[3,1],[3,0],[3,0],[0,[5]]]],[56,62,null,306027333159187,0,null,[[3,1],[4,9]]]],[[0,0,false,null,993603675431242,64,[[-1,26,null,0,false,false,false,978250809018426,null,[[11,727009003176844],[8,0],[7,[4]]]],[16,55,"Timer",0,false,true,false,294365323106198,null,[[1,[272]]]]],[[6,74,null,428288332826457,0,null,[[2,["bup",false]],[3,0],[0,[273]],[0,[4]],[1,[272]]]],[16,51,"Timer",810982819084219,0,null,[[0,[117]],[3,0],[1,[272]]]]]]]]]],[0,0,false,null,963184685794547,65,[[86,77,"Timer",0,false,false,false,925967068817368,null,[[1,[274]]]]],[[86,173,"Sine",857600996135653,0,null,[[3,0]]]]],[0,0,false,null,901720087330142,66,[[86,174,"Sine",0,false,true,false,274543033215317,null],[86,39,null,0,false,true,false,401976057630655,null,[[0,[4]],[0,[5]]]]],[[86,46,null,972879642002590,0,null,[[0,[275,[4,175],[1,86,45,false],[4,31]]]]]]],[0,0,false,null,282547623789874,67,[[87,27,null,0,false,false,false,306500663920672,null,[[4,71]]],[114,55,"Timer",0,false,true,false,380997929828173,null,[[1,[27]]]],[-1,26,null,0,false,false,false,517910138444068,null,[[11,727009003176844],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,730424041065727,null,[[10,2],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,188278287195816,null]],[],[[0,0,false,null,197655769158254,68,[[9,157,null,0,false,false,false,368474998942922,null,[[1,[227]]]]],[[6,74,null,464724296578389,0,null,[[2,["metal",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]]]],[0,0,false,null,949392864404886,69,[[-1,40,null,0,false,false,false,713825269748526,null]],[[6,74,null,534742661822076,0,null,[[2,["bellsoc",false]],[3,0],[0,[2]],[0,[4]],[1,[70]]]]]],[0,0,false,null,920524990606353,70,[[74,25,null,0,false,false,false,878512038146260,null,[[10,0],[8,0],[7,[4]]]]],[[74,46,null,116674834158755,0,null,[[0,[46]]]],[-1,75,null,933147252112693,2,null,[[0,[26]]]],[74,46,null,692891803217193,0,null,[[0,[4]]]]]],[0,0,false,null,317471614492092,71,[[86,25,null,0,false,false,false,278167953271126,null,[[10,0],[8,0],[7,[4]]]]],[[86,173,"Sine",798902718509979,0,null,[[3,1]]],[86,51,"Timer",589848492575796,0,null,[[0,[46]],[3,0],[1,[274]]]]]]]],[0,0,false,null,659019359090277,72,[[87,27,null,0,false,false,false,927550335789027,null,[[4,73]]],[114,55,"Timer",0,false,true,false,945386994317747,null,[[1,[27]]]],[-1,26,null,0,false,false,false,365617313405153,null,[[11,727009003176844],[8,0],[7,[4]]]],[114,25,null,0,false,false,false,131782662840566,null,[[10,2],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,401971581257106,null]],[],[[0,0,false,null,151751982724731,73,[[9,157,null,0,false,false,false,213600802232338,null,[[1,[227]]]]],[[6,74,null,935438893041667,0,null,[[2,["metal",false]],[3,0],[0,[74]],[0,[4]],[1,[70]]]]]],[0,0,false,null,366508876755095,74,[[-1,40,null,0,false,false,false,923118057769389,null]],[[6,74,null,526858020577375,0,null,[[2,["bellsoc",false]],[3,0],[0,[2]],[0,[4]],[1,[70]]]]]],[0,0,false,null,267063248768907,75,[[74,25,null,0,false,false,false,469826953060564,null,[[10,0],[8,0],[7,[5]]]]],[[74,46,null,222686498429610,0,null,[[0,[276]]]],[-1,75,null,639464377075377,2,null,[[0,[26]]]],[74,46,null,199707033550828,0,null,[[0,[4]]]]]],[0,0,false,null,407901664088255,76,[[86,25,null,0,false,false,false,550189907167358,null,[[10,0],[8,0],[7,[5]]]]],[[86,173,"Sine",174652883950452,0,null,[[3,1]]],[86,51,"Timer",150728390622076,0,null,[[0,[46]],[3,0],[1,[274]]]]]]]]]]]],["pauseEvent",[[2,"MoreGamesButtons",false],[2,"RHM_ADS",false],[1,"pause",0,0,false,false,895506763348983,false,34],[0,0,false,null,825090527993167,1,[[44,176,null,1,false,false,false,659059519260433,null,[[4,20]]]],[[6,74,null,173731787408582,0,null,[[2,["buttonx",false]],[3,0],[0,[74]],[0,[4]],[1,[137]]]],[49,177,null,589893877690458,0,null,[[1,[277]],[1,[278]]]]]],[0,0,false,null,104936265089412,2,[[44,176,null,1,false,false,false,850778254561887,null,[[4,16]]],[-1,26,null,0,false,false,false,340355566469653,null,[[11,895506763348983],[8,0],[7,[4]]]],[16,178,null,0,false,false,false,701580087498232,null],[-1,26,null,0,false,false,false,412923529791305,null,[[11,727009003176844],[8,0],[7,[4]]]]],[[-1,47,null,636030774850120,0,null,[[11,895506763348983],[7,[5]]]],[-1,135,null,966652434682216,0,null,[[5,[138]],[3,1]]],[-1,130,null,314835388166640,0,null,[[5,[133]],[0,[279]]]],[-1,73,null,372408713399458,0,null,[[0,[4]]]],[-1,138,null,779965531274991,256,null,[[4,48],[5,[139]],[0,[234]],[0,[194]],[16,false],[20,[70]]]],[-1,138,null,221733162126015,256,null,[[4,48],[5,[139]],[0,[22]],[0,[194]],[16,false],[20,[70]]]],[48,103,null,299379731995145,0,null,[[0,[5]]]],[6,179,null,786508752233035,0,null,[[3,0]]],[-2,"ActivateMoreGamesButtons",null,296458487653378,0,null]]],[0,0,false,null,380752203964988,3,[[44,180,null,1,false,false,false,143057716904910,null],[44,106,null,0,false,false,false,928877045704012,null,[[4,48]]],[48,25,null,0,false,false,false,200808475829643,null,[[10,0],[8,0],[7,[4]]]]],[],[[0,0,false,null,421532680566161,4,[[48,181,null,0,false,false,false,352683704942487,null,[[8,0],[0,[4]]]]],[[6,179,null,456781807972748,0,null,[[3,1]]],[-1,135,null,809652937660021,0,null,[[5,[138]],[3,0]]],[-1,47,null,854057059129383,0,null,[[11,895506763348983],[7,[4]]]],[20,72,null,130804770750645,0,null,[[3,1]]]],[[0,0,false,null,907273234062272,5,[[-1,182,null,0,false,false,false,158445655676582,null,[[4,48]]]],[[48,108,null,363259760452518,0,null],[-2,"DeActivateMoreGamesButtons",null,972073337511423,0,null],[-1,73,null,167992988193975,0,null,[[0,[5]]]]]]]],[0,0,false,null,512289786308736,6,[[-1,40,null,0,false,false,false,108412349524451,null],[48,181,null,0,false,false,false,895628152841931,null,[[8,0],[0,[5]]]]],[[6,179,null,217297452779535,0,null,[[3,1]]],[6,183,null,774846416127975,0,null],[-1,184,null,845125447194050,0,null],[-1,76,null,987914159531714,0,null]]],[0,0,false,null,207121579631934,7,[[-1,40,null,0,false,false,false,759691866309721,null],[48,181,null,0,false,false,false,545179275048067,null,[[8,0],[0,[19]]]]],[[49,177,null,256821211327176,0,null,[[1,[277]],[1,[278]]]]]],[0,0,false,null,883798968650037,8,[],[[6,74,null,977759798927656,0,null,[[2,["buttonx",false]],[3,0],[0,[74]],[0,[4]],[1,[137]]]]]]]]]],["menuEvent",[[2,"MoreGamesButtons",false],[2,"RHM_ADS",false],[1,"menu",0,0,false,false,552810473595513,false,182],[1,"isRestartLayoutCalled",2,false,false,false,953669623157105,false,183],[3,[true,"Menu"],false,null,250689675360837,1,[[-1,20,null,0,false,false,false,0,false,[[1,[280]]]]],[],[[0,0,false,null,385574708920391,2,[[-1,21,null,1,false,false,false,505578862372840,null]],[[-1,66,null,868892441269373,0,null,[[0,[63]]]],[8,170,null,350655939620105,0,null,[[3,0]]]],[[0,0,false,null,328425080771235,3,[],[[65,34,null,385950107749256,0,null,[[10,0],[7,[281,[1,65,53,false],[1,52,53,false]]]]]]],[0,0,false,null,241480286152321,4,[[-1,26,null,0,false,false,false,652382698245950,null,[[11,552810473595513],[8,0],[7,[4]]]]],[[6,74,null,175027897965173,0,null,[[2,["menu",false]],[3,1],[0,[2]],[0,[4]],[1,[135]]]],[6,133,null,499887973918403,0,null,[[1,[136]]]],[-1,75,null,322215829073993,2,null,[[0,[120]]]],[52,140,"Tween",382456410818317,1,null,[[1,[147]],[3,0],[0,[148]],[0,[31]],[18,9],[3,0],[3,0],[3,0],[0,[5]]]],[6,74,null,991045166414713,0,null,[[2,["start",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]]]],[0,0,false,null,810102759188452,5,[[-1,40,null,0,false,false,false,852419433470608,null]],[[-1,135,null,208060148991117,0,null,[[5,[133]],[3,0]]],[52,108,null,793534791641230,0,null],[51,98,null,502896963729282,0,null],[53,108,null,925845965113145,0,null],[55,108,null,172430297314068,0,null],[54,108,null,421120934833515,0,null],[47,72,null,985845086157123,0,null,[[3,1]]],[-2,"DeActivateMoreGamesButtonsWithStore",null,787358046323371,0,null]],[[0,0,false,null,733238425302951,6,[[-1,185,null,0,false,false,false,564524755263941,null,[[11,953669623157105]]]],[[-1,75,null,481200425251357,2,null,[[0,[154]]]],[-2,"ShowAd",null,642339934658321,0,null],[-1,186,null,111440423385499,0,null,[[11,953669623157105],[3,0]]]]]]]]],[0,0,false,null,518625068017289,7,[[52,132,"Tween",1,false,false,false,190305828392346,null,[[1,[147]]]]],[[53,172,"Tween",995268526522716,1,null,[[1,[282]],[3,1],[0,[63]],[0,[63]],[0,[31]],[18,9],[3,0],[3,0],[3,0],[0,[5]]]],[-1,75,null,658485621008789,2,null,[[0,[26]]]],[55,172,"Tween",114560151193827,1,null,[[1,[282]],[3,1],[0,[63]],[0,[63]],[0,[31]],[18,9],[3,0],[3,0],[3,0],[0,[5]]]]]],[0,0,false,null,220509110097831,8,[[44,176,null,1,false,false,false,645740547566525,null,[[4,115]]],[53,187,"Tween",0,false,true,false,301030362709757,null]],[[53,34,null,397347164498523,0,null,[[10,2],[7,[4]]]],[54,34,null,553226961212552,0,null,[[10,0],[7,[4]]]],[55,34,null,608552645968727,0,null,[[10,2],[7,[4]]]],[6,133,null,569406237054321,0,null,[[1,[135]]]],[6,74,null,801321072643581,0,null,[[2,["music",false]],[3,1],[0,[283]],[0,[4]],[1,[136]]]],[6,188,null,177400152091586,0,null,[[1,[136]],[0,[284,[4,35]]]]],[6,74,null,804549528257727,0,null,[[2,["buttonx",false]],[3,0],[0,[74]],[0,[4]],[1,[137]]]],[53,172,"Tween",747554248458229,1,null,[[1,[271]],[3,1],[0,[4]],[0,[4]],[0,[31]],[18,8],[3,1],[3,0],[3,0],[0,[5]]]],[55,172,"Tween",805881890677231,1,null,[[1,[271]],[3,1],[0,[4]],[0,[4]],[0,[31]],[18,8],[3,1],[3,0],[3,0],[0,[5]]]],[52,140,"Tween",317052082426668,1,null,[[1,[285]],[3,0],[0,[145]],[0,[31]],[18,8],[3,1],[3,0],[3,0],[0,[5]]]],[51,189,"Fade",623528240146081,0,null],[-1,47,null,701690715891419,0,null,[[11,552810473595513],[7,[5]]]],[16,134,"Tween",481708193505084,1,null,[[1,[286]],[0,[63]],[0,[4]],[0,[31]],[18,1],[3,0],[3,0],[3,0],[0,[5]]]],[-1,47,null,455514286987757,0,null,[[11,174118167449135],[7,[287,[2,115,false,1]]]]],[-2,"DeActivateMoreGamesButtonsWithStore",null,688672876743997,0,null]],[[0,0,false,null,416813908708458,9,[[115,25,null,0,false,false,false,517173878703751,null,[[10,0],[8,0],[7,[4]]]]],[[-1,75,null,620913483551537,2,null,[[0,[154]]]],[6,74,null,971517192627160,0,null,[[2,["refsoc",false]],[3,0],[0,[260]],[0,[4]],[1,[261]]]],[6,169,null,737179471870983,0,null,[[1,[261]],[0,[127]]]],[16,72,null,667980947733684,0,null,[[3,1]]],[8,170,null,181626304721179,0,null,[[3,1]]],[114,65,"Physics",271320600831843,0,null,[[3,0]]],[-1,47,null,243692792625215,0,null,[[11,727009003176844],[7,[4]]]],[47,72,null,200482707283861,0,null,[[3,1]]]]],[0,0,false,null,628620436164260,10,[[-1,40,null,0,false,false,false,578384599124295,null]],[[-1,75,null,582045429916430,2,null,[[0,[31]]]],[-1,76,null,181035226174185,0,null],[-1,47,null,596955461069876,0,null,[[11,727009003176844],[7,[4]]]],[-1,47,null,316184816610911,0,null,[[11,870248114194364],[7,[4]]]],[-1,47,null,245486689923637,0,null,[[11,336820796057693],[7,[4]]]],[-1,47,null,122377043936756,0,null,[[11,308680730337585],[7,[4]]]],[-1,47,null,369294083768305,0,null,[[11,284675396607854],[7,[4]]]]]],[0,0,false,null,368504955492175,11,[],[[-1,75,null,660668401935782,2,null,[[0,[154]]]],[-2,"ShowAd",null,796154536793410,0,null]]]]],[0,0,false,null,850824268737758,12,[[16,129,"Tween",0,false,false,false,879645646628815,null,[[1,[286]]]]],[[-1,130,null,447663746736666,0,null,[[5,[133]],[0,[288,[0,16,"Tween",131,false]]]]]]],[0,0,false,null,577092143400223,13,[[16,132,"Tween",1,false,false,false,352101396796876,null,[[1,[286]]]]],[[-1,130,null,126445194739049,0,null,[[5,[133]],[0,[4]]]],[-1,135,null,407975923533417,0,null,[[5,[133]],[3,0]]]]],[0,0,false,null,709866254290034,14,[[53,190,"Tween",1,false,false,false,260246317247305,null]],[[53,34,null,342819126594452,0,null,[[10,2],[7,[5]]]]]],[0,0,false,null,441376995004059,15,[[53,25,null,0,false,false,false,453613041886680,null,[[10,2],[8,0],[7,[5]]]]],[],[[0,0,false,null,421012283256538,16,[[31,191,null,0,false,false,false,235656255141556,null,[[4,53]]]],[[53,57,null,859239617718351,0,null,[[0,[289]]]]]],[0,0,false,null,157663606018438,17,[[-1,40,null,0,false,false,false,119648225565424,null]],[[53,57,null,554118252606210,0,null,[[0,[5]]]]]]]],[0,0,false,null,814934606788951,18,[[55,190,"Tween",1,false,false,false,891488023581390,null]],[[55,34,null,993643474234676,0,null,[[10,2],[7,[5]]]]]],[0,0,false,null,235656310340649,19,[[55,25,null,0,false,false,false,404348056595807,null,[[10,2],[8,0],[7,[5]]]]],[],[[0,0,false,null,726911164845993,20,[[31,191,null,0,false,false,false,551329344948066,null,[[4,55]]]],[[55,57,null,468729716795801,0,null,[[0,[289]]]]]],[0,0,false,null,515422872420718,21,[[-1,40,null,0,false,false,false,174893846482520,null]],[[55,57,null,530428509176708,0,null,[[0,[5]]]]]]]],[0,0,false,null,474393175838554,22,[[54,190,"Tween",1,false,false,false,779238575630928,null]],[[54,34,null,757770830222606,0,null,[[10,0],[7,[5]]]]]],[0,0,false,null,486345870663350,23,[[54,25,null,0,false,false,false,665235926087549,null,[[10,0],[8,0],[7,[5]]]]],[],[[0,0,false,null,477463783581383,24,[[31,191,null,0,false,false,false,134952775826759,null,[[4,54]]]],[[54,57,null,596603935640830,0,null,[[0,[289]]]]]],[0,0,false,null,754677656171732,25,[[-1,40,null,0,false,false,false,550245179264101,null]],[[54,57,null,815481943588434,0,null,[[0,[5]]]]]]]],[0,0,false,null,322874037935790,26,[],[[65,56,null,297839950539074,0,null,[[0,[290,[1,52,53,false],[2,65,false,0]]]]]]],[0,0,false,null,322760807047531,27,[[52,192,null,1,false,false,false,168856014680437,null]],[[65,108,null,308115303477679,0,null]]]]]]],["introEvent",[[2,"RHM_ADS",false],[0,0,false,null,346247756960199,1,[[-1,193,null,0,false,false,false,265468763459034,null]],[[58,79,null,354410976872395,0,null,[[0,[291,[4,89],[4,90]]],[0,[291,[4,92],[4,87]]]]]]],[0,0,false,null,492121851298793,2,[[-1,21,null,1,false,false,false,424094924037203,null]],[[-3,194,[false,false,0]],[58,195,null,274539732188858,0,null],[59,195,null,259184612716955,0,null],[58,103,null,802117241305894,0,null,[[0,[292,[4,35]]]]]]],[0,0,false,null,584057492079902,3,[[31,191,null,0,false,false,false,845556858115060,null,[[4,60]]],[60,178,null,0,false,false,false,474498151753550,null]],[[60,79,null,143924544584679,0,null,[[0,[293,[1,60,80,false]]],[0,[293,[1,60,81,false]]]]],[31,196,null,510276781424125,0,null,[[3,1]]],[-1,75,null,814816743583510,2,null,[[0,[26]]]],[31,196,null,338899493468722,0,null,[[3,0]]],[60,79,null,701235899718651,0,null,[[0,[21,[1,60,80,false]]],[0,[21,[1,60,81,false]]]]]]],[0,0,false,null,362469715106794,4,[[44,176,null,1,false,false,false,362223091945974,null,[[4,60]]],[60,178,null,0,false,false,false,832750092868602,null]],[[60,108,null,975752723067499,0,null],[-1,75,null,756331828752624,2,null,[[0,[120]]]],[59,103,null,961303825377221,0,null,[[0,[5]]]],[6,74,null,645172956494324,0,null,[[2,["intro-button",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]],[58,103,null,454793205076671,0,null,[[0,[292,[4,35]]]]],[-1,75,null,238228313369072,2,null,[[0,[294]]]],[59,103,null,696407266347165,0,null,[[0,[19]]]],[6,74,null,328188494334347,0,null,[[2,["intro-button",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]],[58,103,null,777073237578362,0,null,[[0,[292,[4,35]]]]],[-1,75,null,200726561075842,2,null,[[0,[294]]]],[59,103,null,738990018141163,0,null,[[0,[46]]]],[6,74,null,672630255724217,0,null,[[2,["intro-button",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]],[58,103,null,221625125424781,0,null,[[0,[292,[4,35]]]]],[-1,75,null,944080777946149,2,null,[[0,[294]]]],[59,103,null,512971301459209,0,null,[[0,[50]]]],[6,74,null,593130758144155,0,null,[[2,["intro-button",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]],[58,103,null,629557000893955,0,null,[[0,[292,[4,35]]]]],[-1,75,null,508010130946814,2,null,[[0,[294]]]],[6,74,null,484333188656577,0,null,[[2,["intro-sound",false]],[3,0],[0,[4]],[0,[4]],[1,[137]]]],[-1,75,null,573110697974654,2,null,[[0,[46]]]],[-1,197,null,219247050524251,0,null,[[6,"game"]]]]]]],["MoreGamesButtons",[[1,"hover",0,0,false,false,236308476084915,false,75],[1,"refURL",1,"?utm_source=Html5Game&utm_medium=",false,false,320708484883769,false,184],[1,"webSite",1,"",false,false,633161850588961,false,185],[1,"gameName",1,"BasketRandom",false,false,691161950627891,false,186],[1,"scaleStartValue",0,0.13,false,false,466977614602432,false,187],[1,"scaleEndValue",0,0.135,false,false,774853549395956,false,188],[1,"buttonHoverValue",0,0.14,false,false,778537425481329,false,189],[1,"TweenTime",0,1,false,false,926864202597357,false,190],[1,"OverME",2,false,false,false,799956268911725,false,191],[3,[true,"Functions"],false,null,147322731629398,1,[[-1,20,null,0,false,false,false,0,false,[[1,[295]]]]],[],[[3,[true,"MoreGamesButtons"],false,null,130799102508234,2,[[-1,20,null,0,false,false,false,0,false,[[1,[296]]]]],[],[[4,["ActivateMoreGamesButtons",0,[],true,false,false],false,null,425353784025569,3,[],[[20,162,null,523470476122356,0,null,[[0,[233]]]],[104,72,null,983040426829304,0,null,[[3,1]]],[-1,198,null,393041496544629,2,null],[105,72,null,682837633034753,0,null,[[3,1]]],[-1,198,null,447128375378071,2,null],[106,72,null,677755462570143,0,null,[[3,1]]],[-1,198,null,704109399412677,2,null],[104,172,"Tween",248233579425271,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[105,172,"Tween",323802363066030,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[106,172,"Tween",755524754459339,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]]]],[4,["DeActivateMoreGamesButtons",0,[],true,false,false],false,null,651454990241349,4,[],[[104,199,"Tween",585983229806635,0,null],[105,199,"Tween",860617666473008,0,null],[106,199,"Tween",120179833005322,0,null],[104,72,null,201017281260365,0,null,[[3,0]]],[105,72,null,943107541129092,0,null,[[3,0]]],[106,72,null,956531114808479,0,null,[[3,0]]],[104,57,null,344558758774224,0,null,[[0,[298]]]],[105,57,null,143213100289315,0,null,[[0,[298]]]],[106,57,null,371000700340406,0,null,[[0,[298]]]],[20,162,null,495816281310309,0,null,[[0,[22]]]]]],[4,["ActivateMoreGamesButtonsWithStore",0,[],true,false,false],false,null,631126415035266,5,[],[[20,162,null,774365974098958,0,null,[[0,[233]]]],[103,72,null,127260705842757,0,null,[[3,1]]],[-1,75,null,275230422967648,2,null,[[0,[26]]]],[104,72,null,361295942864932,0,null,[[3,1]]],[-1,75,null,954022872974778,2,null,[[0,[26]]]],[105,72,null,219321477093852,0,null,[[3,1]]],[-1,75,null,684178318591475,2,null,[[0,[26]]]],[106,72,null,789034101030177,0,null,[[3,1]]],[-1,75,null,203899763266325,2,null,[[0,[26]]]],[102,72,null,552319218721495,0,null,[[3,1]]],[-1,75,null,558337974732021,2,null,[[0,[26]]]],[103,172,"Tween",134884829261731,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[104,172,"Tween",680850767337667,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[105,172,"Tween",850456920083770,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[106,172,"Tween",507945733148763,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[102,172,"Tween",917797714878071,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]]]],[4,["DeActivateMoreGamesButtonsWithStore",0,[],true,false,false],false,null,417984589315360,6,[],[[104,199,"Tween",612061810161664,0,null],[105,199,"Tween",113122555187833,0,null],[106,199,"Tween",859246354547721,0,null],[102,72,null,812381523176207,0,null,[[3,0]]],[104,72,null,399521294046748,0,null,[[3,0]]],[105,72,null,691506158648201,0,null,[[3,0]]],[106,72,null,408354079115784,0,null,[[3,0]]],[103,72,null,245608583411249,0,null,[[3,0]]],[20,162,null,662233135532554,0,null,[[0,[22]]]]]]]],[3,[true,"MoreGamesFunctions"],false,null,204655453948633,7,[[-1,20,null,0,false,false,false,0,false,[[1,[299]]]]],[],[[4,["MoreGamesButton",0,[],true,false,false],false,null,411195845299821,8,[],[[49,177,null,990091765662809,0,null,[[1,[300,[3,320708484883769],[3,691161950627891],[3,633161850588961]]],[1,[278]]]]]],[4,["SponsorButton",0,[],true,false,false],false,null,303072618743195,9,[],[[49,177,null,387859144091338,0,null,[[1,[301,[3,320708484883769],[3,691161950627891],[3,633161850588961]]],[1,[278]]]]]]]]]],[3,[true,"Game_1"],false,null,464853865890017,10,[[-1,20,null,0,false,false,false,0,false,[[1,[302]]]]],[],[[0,0,false,null,298776931006226,11,[[31,191,null,0,false,false,false,756313321087209,null,[[4,104]]],[104,178,null,0,false,false,false,548324850817600,null]],[[104,34,null,647415353252201,0,null,[[10,0],[7,[5]]]]],[[0,0,false,null,565546083516393,12,[[104,25,null,0,false,false,false,171224131376293,null,[[10,0],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,600823806152687,null]],[[104,199,"Tween",458054799820141,0,null],[-1,75,null,284492587881346,2,null,[[0,[26]]]],[104,172,"Tween",868727747265397,1,null,[[1,[297]],[3,2],[0,[10,[3,778537425481329]]],[0,[10,[3,778537425481329]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[104,103,null,616149062309283,0,null,[[0,[5]]]],[-1,186,null,556910609777409,0,null,[[11,799956268911725],[3,1]]]]]]],[0,0,false,null,190385938866992,13,[[31,191,null,0,false,true,false,894378495010015,null,[[4,104]]],[104,178,null,0,false,false,false,908160236469541,null]],[[104,34,null,182599385348224,0,null,[[10,0],[7,[4]]]]],[[0,0,false,null,218162465672518,14,[[104,25,null,0,false,false,false,430187843427911,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,266572303712743,null]],[[104,172,"Tween",345518832299980,1,null,[[1,[297]],[3,2],[0,[10,[3,466977614602432]]],[0,[10,[3,466977614602432]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[-1,75,null,521799738742566,2,null,[[0,[26]]]],[104,172,"Tween",338363359969862,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[104,103,null,204789091953606,0,null,[[0,[4]]]],[-1,186,null,279443943337298,0,null,[[11,799956268911725],[3,0]]]]]]],[0,0,false,null,395773302653213,15,[[44,176,null,1,false,false,false,490635202506472,null,[[4,104]]],[104,178,null,0,false,false,false,639814955512312,null]],[[49,177,null,946595056286890,0,null,[[1,[303,[3,320708484883769],[3,691161950627891],[3,633161850588961]]],[1,[278]]]]]]]],[3,[true,"Game_2"],false,null,762056911832794,16,[[-1,20,null,0,false,false,false,0,false,[[1,[304]]]]],[],[[0,0,false,null,235785495850157,17,[[31,191,null,0,false,false,false,658583485484103,null,[[4,105]]],[105,178,null,0,false,false,false,125117318107501,null]],[[105,34,null,981836821634332,0,null,[[10,0],[7,[5]]]]],[[0,0,false,null,217893227306224,18,[[105,25,null,0,false,false,false,805735989706899,null,[[10,0],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,251749292246431,null]],[[105,199,"Tween",523580904239556,0,null],[105,172,"Tween",385812521275961,1,null,[[1,[297]],[3,2],[0,[10,[3,778537425481329]]],[0,[10,[3,778537425481329]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[105,103,null,518737982462257,0,null,[[0,[5]]]]]]]],[0,0,false,null,841695968938028,19,[[31,191,null,0,false,true,false,848177225185821,null,[[4,105]]],[105,178,null,0,false,false,false,649236084665664,null]],[[105,34,null,221979378123446,0,null,[[10,0],[7,[4]]]]],[[0,0,false,null,174400537235710,20,[[105,25,null,0,false,false,false,660008320185152,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,744643732343203,null]],[[105,172,"Tween",118108479069513,1,null,[[1,[297]],[3,2],[0,[10,[3,466977614602432]]],[0,[10,[3,466977614602432]]],[0,[26]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[-1,75,null,666878797268193,2,null,[[0,[26]]]],[105,172,"Tween",544726222715658,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[105,103,null,976386016595457,0,null,[[0,[4]]]]]]]],[0,0,false,null,304914609143361,21,[[44,176,null,1,false,false,false,751952291411254,null,[[4,105]]],[105,178,null,0,false,false,false,760347582341198,null]],[[49,177,null,111108834951091,0,null,[[1,[305,[3,320708484883769],[3,691161950627891],[3,633161850588961]]],[1,[278]]]]]]]],[3,[true,"Game_3"],false,null,146461488247877,22,[[-1,20,null,0,false,false,false,0,false,[[1,[306]]]]],[],[[0,0,false,null,636133541190579,23,[[31,191,null,0,false,false,false,578869643168987,null,[[4,106]]],[106,178,null,0,false,false,false,438293850711286,null]],[[106,34,null,334194339901034,0,null,[[10,0],[7,[5]]]]],[[0,0,false,null,318853159460127,24,[[106,25,null,0,false,false,false,845457934754752,null,[[10,0],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,361731868639574,null]],[[106,199,"Tween",697749602780556,0,null],[106,172,"Tween",885381386329390,1,null,[[1,[297]],[3,2],[0,[10,[3,778537425481329]]],[0,[10,[3,778537425481329]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[106,103,null,604195974694893,0,null,[[0,[5]]]]]]]],[0,0,false,null,867373327485472,25,[[31,191,null,0,false,true,false,279730523219609,null,[[4,106]]],[106,178,null,0,false,false,false,897584018257163,null]],[[106,34,null,583491459807201,0,null,[[10,0],[7,[4]]]]],[[0,0,false,null,625910533911055,26,[[106,25,null,0,false,false,false,390282639823744,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,332335340250005,null]],[[106,172,"Tween",755855042805634,1,null,[[1,[297]],[3,2],[0,[10,[3,466977614602432]]],[0,[10,[3,466977614602432]]],[0,[26]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[-1,75,null,364175761857220,2,null,[[0,[26]]]],[106,172,"Tween",176303046966761,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[106,103,null,509131316130685,0,null,[[0,[4]]]]]]]],[0,0,false,null,851373796045996,27,[[44,176,null,1,false,false,false,497091735198109,null,[[4,106]]],[106,178,null,0,false,false,false,608682247703584,null]],[[49,177,null,575219581313160,0,null,[[1,[307,[3,320708484883769],[3,691161950627891],[3,633161850588961]]],[1,[278]]]]]]]],[3,[true,"Google Play"],false,null,265247493290119,28,[[-1,20,null,0,false,false,false,0,false,[[1,[308]]]]],[],[[0,0,false,null,301112920090059,29,[[31,191,null,0,false,false,false,457943391422888,null,[[4,102]]],[102,178,null,0,false,false,false,127214100255278,null]],[[102,34,null,465837827833468,0,null,[[10,0],[7,[5]]]]]],[0,0,false,null,597072892197005,30,[[31,191,null,0,false,true,false,633801710837500,null,[[4,102]]],[102,178,null,0,false,false,false,977080496793472,null]],[[102,34,null,459141485320409,0,null,[[10,0],[7,[4]]]]]],[0,0,false,null,225482272751835,31,[[102,25,null,0,false,false,false,339505539189596,null,[[10,0],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,581294946149043,null]],[[102,199,"Tween",419586138651701,0,null],[102,172,"Tween",130788524732247,1,null,[[1,[297]],[3,2],[0,[10,[3,778537425481329]]],[0,[10,[3,778537425481329]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[102,103,null,101529296669582,0,null,[[0,[5]]]]]],[0,0,false,null,846110919967431,32,[[102,25,null,0,false,false,false,422464591079839,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,609004005801961,null]],[[102,172,"Tween",972996650152561,1,null,[[1,[297]],[3,2],[0,[10,[3,466977614602432]]],[0,[10,[3,466977614602432]]],[0,[26]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[-1,75,null,610691292121843,2,null,[[0,[26]]]],[102,172,"Tween",108936652571392,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[102,103,null,669705981043778,0,null,[[0,[4]]]]]],[0,0,false,null,181981850686381,33,[[44,176,null,1,false,false,false,716217935539821,null,[[4,102]]],[102,178,null,0,false,false,false,982169800776600,null]],[[49,177,null,691097463483720,0,null,[[1,[309]],[1,[278]]]]]]]],[3,[true,"Apple Store"],false,null,302170827863979,34,[[-1,20,null,0,false,false,false,0,false,[[1,[310]]]]],[],[[0,0,false,null,492754503115187,35,[[31,191,null,0,false,false,false,378129469274322,null,[[4,103]]],[103,178,null,0,false,false,false,485469163982092,null]],[[103,34,null,677818171048717,0,null,[[10,0],[7,[5]]]]]],[0,0,false,null,221742130508415,36,[[31,191,null,0,false,true,false,403457230284911,null,[[4,103]]],[103,178,null,0,false,false,false,931066300568657,null]],[[103,34,null,704546103711766,0,null,[[10,0],[7,[4]]]]]],[0,0,false,null,743745547816224,37,[[103,25,null,0,false,false,false,972439831302696,null,[[10,0],[8,0],[7,[5]]]],[-1,28,null,0,false,false,false,882033283319224,null]],[[103,199,"Tween",478996205112030,0,null],[103,172,"Tween",307952725285578,1,null,[[1,[297]],[3,2],[0,[10,[3,778537425481329]]],[0,[10,[3,778537425481329]]],[0,[26]],[18,19],[3,0],[3,0],[3,0],[0,[5]]]],[103,103,null,572861395336845,0,null,[[0,[5]]]]]],[0,0,false,null,992289687012827,38,[[103,25,null,0,false,false,false,677952208419580,null,[[10,0],[8,0],[7,[4]]]],[-1,28,null,0,false,false,false,338668432457444,null]],[[103,172,"Tween",518524756633116,1,null,[[1,[297]],[3,2],[0,[10,[3,466977614602432]]],[0,[10,[3,466977614602432]]],[0,[26]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[-1,75,null,177185363638203,2,null,[[0,[26]]]],[103,172,"Tween",516406679744889,1,null,[[1,[297]],[3,2],[0,[10,[3,774853549395956]]],[0,[10,[3,774853549395956]]],[0,[10,[3,926864202597357]]],[18,19],[3,0],[3,1],[3,1],[0,[5]]]],[103,103,null,132527143692798,0,null,[[0,[4]]]]]],[0,0,false,null,746624550373652,39,[[44,176,null,1,false,false,false,737713834673384,null,[[4,103]]],[103,178,null,0,false,false,false,411558071009156,null]],[[49,177,null,627686446204785,0,null,[[1,[311]],[1,[278]]]]]]]]]],["ResfreshRate",[[1,"RefreshRateForce",0,500,false,false,801919566769646,false,192],[1,"ScnRefreshRate",0,0,false,false,755872340856296,false,193],[1,"divideSmooth_Hz",0,1.1,false,false,588745698818005,false,194],[1,"angularOffset_Hz",0,60,false,false,579415250310640,false,195],[1,"jumpPower_Hz",0,130,false,false,207852114368060,false,196],[1,"jumpAddForce_Hz",0,4000,false,false,929772105325521,false,197],[1,"angularForce_Hz",0,60,false,false,867747672923081,false,198],[1,"armAngleSpeed_Hz",0,10,false,false,324338522464560,false,199],[1,"ballSpeed_Hz",0,100,false,false,290347554392499,false,200],[1,"ballSpeedDefaultVal_Hz",0,0,false,false,418073226185083,false,201],[1,"snowFrictionValue_Hz",0,1,false,false,483064547053985,false,202],[1,"ballMaxHeight_Hz",0,180,false,false,800713363325886,false,203],[0,0,false,null,361642608246384,1,[[-1,21,null,1,false,false,false,669906634396634,null]],[[-1,47,null,347476268739010,0,null,[[11,418073226185083],[7,[10,[3,290347554392499]]]]]]],[0,0,false,null,503667174665877,2,[[-1,143,null,0,false,false,false,499973395598033,null,[[0,[46]]]]],[],[[0,0,false,null,693552421126409,3,[[-1,26,null,0,false,false,false,273527232822723,null,[[11,755872340856296],[8,4],[7,[240]]]],[-1,26,null,0,false,false,false,182454643755371,null,[[11,755872340856296],[8,3],[7,[267]]]]],[[-1,47,null,179780217945998,0,null,[[11,290347554392499],[7,[312]]]],[-1,47,null,496367774691799,0,null,[[11,588745698818005],[7,[222]]]],[-1,47,null,866548299951493,0,null,[[11,579415250310640],[7,[312]]]],[-1,47,null,558338469422556,0,null,[[11,867747672923081],[7,[313]]]],[-1,47,null,494869639122527,0,null,[[11,207852114368060],[7,[314]]]],[-1,47,null,830930182493727,0,null,[[11,929772105325521],[7,[315]]]],[-1,47,null,331013136390811,0,null,[[11,483064547053985],[7,[316]]]],[-1,47,null,268788271958673,0,null,[[11,324338522464560],[7,[68]]]]]],[0,0,false,null,438592931109302,4,[[-1,26,null,0,false,false,false,544087037621760,null,[[11,755872340856296],[8,4],[7,[240]]]],[-1,26,null,0,false,false,false,773025331119682,null,[[11,755872340856296],[8,3],[7,[267]]]]],[[-1,47,null,798741905777730,0,null,[[11,290347554392499],[7,[313]]]],[-1,47,null,225661098894550,0,null,[[11,588745698818005],[7,[317]]]],[-1,47,null,840852978711573,0,null,[[11,579415250310640],[7,[313]]]],[-1,47,null,256011226037910,0,null,[[11,867747672923081],[7,[318]]]],[-1,47,null,812419883462738,0,null,[[11,207852114368060],[7,[319]]]],[-1,47,null,630793393301111,0,null,[[11,929772105325521],[7,[320]]]],[-1,47,null,950492598105240,0,null,[[11,483064547053985],[7,[316]]]],[-1,47,null,459848874479274,0,null,[[11,324338522464560],[7,[68]]]]]],[0,0,false,null,933392048037266,5,[[-1,26,null,0,false,false,false,248818020768659,null,[[11,755872340856296],[8,4],[7,[267]]]],[-1,26,null,0,false,false,false,856397048213102,null,[[11,755872340856296],[8,3],[7,[313]]]]],[[-1,47,null,403941405360725,0,null,[[11,290347554392499],[7,[321]]]],[-1,47,null,236492769548051,0,null,[[11,588745698818005],[7,[158]]]],[-1,47,null,864702711453348,0,null,[[11,579415250310640],[7,[318]]]],[-1,47,null,562505039285066,0,null,[[11,867747672923081],[7,[228]]]],[-1,47,null,355559670355898,0,null,[[11,207852114368060],[7,[322]]]],[-1,47,null,302789873755353,0,null,[[11,929772105325521],[7,[323]]]],[-1,47,null,720316606144687,0,null,[[11,483064547053985],[7,[316]]]],[-1,47,null,483723477142210,0,null,[[11,324338522464560],[7,[68]]]]]],[0,0,false,null,122989284485316,6,[[-1,26,null,0,false,false,false,558056979543690,null,[[11,755872340856296],[8,4],[7,[313]]]],[-1,26,null,0,false,false,false,846879313728042,null,[[11,755872340856296],[8,3],[7,[228]]]]],[[-1,47,null,975056794877906,0,null,[[11,290347554392499],[7,[324]]]],[-1,47,null,797040886778214,0,null,[[11,588745698818005],[7,[325]]]],[-1,47,null,272820324155624,0,null,[[11,579415250310640],[7,[228]]]],[-1,47,null,455795748759205,0,null,[[11,867747672923081],[7,[63]]]],[-1,47,null,969071743449369,0,null,[[11,207852114368060],[7,[205]]]],[-1,47,null,658649634026586,0,null,[[11,929772105325521],[7,[326]]]],[-1,47,null,755211367875723,0,null,[[11,483064547053985],[7,[316]]]],[-1,47,null,291447458585596,0,null,[[11,324338522464560],[7,[233]]]]]],[0,0,false,null,141607722445314,7,[[-1,26,null,0,false,false,false,477526501356188,null,[[11,755872340856296],[8,2],[7,[231]]]],[-1,26,null,0,false,false,false,207341236673472,null,[[11,755872340856296],[8,4],[7,[228]]]]],[[-1,47,null,304450641782833,0,null,[[11,588745698818005],[7,[327]]]],[-1,47,null,666437325213591,0,null,[[11,579415250310640],[7,[313]]]],[-1,47,null,320000500981362,0,null,[[11,867747672923081],[7,[228]]]],[-1,47,null,878815229812212,0,null,[[11,207852114368060],[7,[149]]]],[-1,47,null,109416943369613,0,null,[[11,929772105325521],[7,[328]]]],[-1,47,null,352378558857289,0,null,[[11,290347554392499],[7,[229]]]],[-1,47,null,442224827982561,0,null,[[11,483064547053985],[7,[316]]]],[-1,47,null,521542460826614,0,null,[[11,324338522464560],[7,[3]]]],[-1,47,null,411922183660311,0,null,[[11,800713363325886],[7,[22]]]]]],[0,0,false,null,510160653305446,8,[[-1,26,null,0,false,false,false,600113665522163,null,[[11,755872340856296],[8,5],[7,[231]]]],[-1,26,null,0,false,false,false,708289157004186,null,[[11,755872340856296],[8,2],[7,[155]]]]],[[-1,47,null,323010633314160,0,null,[[11,588745698818005],[7,[5]]]],[-1,47,null,483473929198298,0,null,[[11,579415250310640],[7,[228]]]],[-1,47,null,662052224078205,0,null,[[11,867747672923081],[7,[279]]]],[-1,47,null,763900472532280,0,null,[[11,207852114368060],[7,[329]]]],[-1,47,null,429332900083284,0,null,[[11,929772105325521],[7,[330]]]],[-1,47,null,331780442571482,0,null,[[11,290347554392499],[7,[331]]]],[-1,47,null,831032960741218,0,null,[[11,324338522464560],[7,[332]]]],[-1,47,null,374137869559341,0,null,[[11,483064547053985],[7,[333]]]],[-1,47,null,466591139781196,0,null,[[11,800713363325886],[7,[22]]]]]],[0,0,false,null,213493754393111,9,[[-1,26,null,0,false,false,false,921860465281504,null,[[11,755872340856296],[8,5],[7,[155]]]],[-1,26,null,0,false,false,false,387903807080419,null,[[11,755872340856296],[8,2],[7,[234]]]]],[[-1,47,null,108241423661667,0,null,[[11,588745698818005],[7,[334]]]],[-1,47,null,532495432980208,0,null,[[11,579415250310640],[7,[313]]]],[-1,47,null,120116174930453,0,null,[[11,867747672923081],[7,[279]]]],[-1,47,null,116812864280368,0,null,[[11,207852114368060],[7,[329]]]],[-1,47,null,915621708316807,0,null,[[11,929772105325521],[7,[330]]]],[-1,47,null,673275188241726,0,null,[[11,290347554392499],[7,[32]]]],[-1,47,null,924489368098975,0,null,[[11,324338522464560],[7,[335]]]],[-1,47,null,789084559533412,0,null,[[11,483064547053985],[7,[4]]]],[-1,47,null,678523891571102,0,null,[[11,800713363325886],[7,[22]]]]]],[0,0,false,null,685616602584380,10,[[-1,26,null,0,false,false,false,549744421650452,null,[[11,755872340856296],[8,5],[7,[234]]]],[-1,26,null,0,false,false,false,688638595653935,null,[[11,755872340856296],[8,2],[7,[236]]]]],[[-1,47,null,486398496061307,0,null,[[11,588745698818005],[7,[289]]]],[-1,47,null,362171052660554,0,null,[[11,579415250310640],[7,[313]]]],[-1,47,null,246214239108511,0,null,[[11,867747672923081],[7,[155]]]],[-1,47,null,623828438692976,0,null,[[11,207852114368060],[7,[329]]]],[-1,47,null,780937172026855,0,null,[[11,929772105325521],[7,[330]]]],[-1,47,null,207467124332865,0,null,[[11,290347554392499],[7,[336]]]],[-1,47,null,630280676378415,0,null,[[11,324338522464560],[7,[102]]]],[-1,47,null,599926444579745,0,null,[[11,483064547053985],[7,[4]]]],[-1,47,null,874280447138163,0,null,[[11,800713363325886],[7,[22]]]]]],[0,0,false,null,187695962961234,11,[[-1,26,null,0,false,false,false,214361276346203,null,[[11,755872340856296],[8,5],[7,[236]]]],[-1,26,null,0,false,false,false,456931180648729,null,[[11,755872340856296],[8,2],[7,[205]]]]],[[-1,47,null,835305140216381,0,null,[[11,588745698818005],[7,[334]]]],[-1,47,null,852457510656211,0,null,[[11,579415250310640],[7,[228]]]],[-1,47,null,236144099513221,0,null,[[11,867747672923081],[7,[32]]]],[-1,47,null,820446560985346,0,null,[[11,207852114368060],[7,[279]]]],[-1,47,null,717645428005237,0,null,[[11,929772105325521],[7,[326]]]],[-1,47,null,695823865711082,0,null,[[11,290347554392499],[7,[148]]]],[-1,47,null,928845807846154,0,null,[[11,324338522464560],[7,[102]]]],[-1,47,null,990454314716814,0,null,[[11,483064547053985],[7,[4]]]],[-1,47,null,351204435018347,0,null,[[11,800713363325886],[7,[337]]]]]],[0,0,false,null,210240479971845,12,[[-1,26,null,0,false,false,false,379480860403319,null,[[11,755872340856296],[8,5],[7,[205]]]],[-1,26,null,0,false,false,false,523959720930260,null,[[11,755872340856296],[8,2],[7,[239]]]]],[[-1,47,null,447641426042658,0,null,[[11,588745698818005],[7,[338]]]],[-1,47,null,727311225246524,0,null,[[11,579415250310640],[7,[228]]]],[-1,47,null,997015246496703,0,null,[[11,867747672923081],[7,[234]]]],[-1,47,null,622317884755920,0,null,[[11,207852114368060],[7,[329]]]],[-1,47,null,120941630630815,0,null,[[11,929772105325521],[7,[330]]]],[-1,47,null,822984850021093,0,null,[[11,290347554392499],[7,[252]]]],[-1,47,null,379058112860041,0,null,[[11,324338522464560],[7,[102]]]],[-1,47,null,330060490777291,0,null,[[11,483064547053985],[7,[4]]]]]],[0,0,false,null,673436821458393,13,[[-1,26,null,0,false,false,false,314215356843499,null,[[11,755872340856296],[8,5],[7,[239]]]],[-1,26,null,0,false,false,false,178340818904773,null,[[11,755872340856296],[8,2],[7,[241]]]]],[[-1,47,null,134610694831981,0,null,[[11,588745698818005],[7,[339]]]],[-1,47,null,230816101543163,0,null,[[11,579415250310640],[7,[318]]]],[-1,47,null,922109765451423,0,null,[[11,867747672923081],[7,[340]]]],[-1,47,null,550165355380012,0,null,[[11,207852114368060],[7,[341]]]],[-1,47,null,163450144190425,0,null,[[11,929772105325521],[7,[342]]]],[-1,47,null,472665496166419,0,null,[[11,290347554392499],[7,[343]]]],[-1,47,null,805491681540887,0,null,[[11,324338522464560],[7,[101]]]],[-1,47,null,285106268937950,0,null,[[11,483064547053985],[7,[4]]]]]],[0,0,false,null,585009084220874,14,[[-1,26,null,0,false,false,false,375181316286188,null,[[11,755872340856296],[8,5],[7,[241]]]],[-1,26,null,0,false,false,false,308236808356806,null,[[11,755872340856296],[8,2],[7,[242]]]]],[[-1,47,null,698787553045772,0,null,[[11,588745698818005],[7,[344]]]],[-1,47,null,368449657607297,0,null,[[11,579415250310640],[7,[321]]]],[-1,47,null,492741099408046,0,null,[[11,867747672923081],[7,[345]]]],[-1,47,null,103622492426869,0,null,[[11,207852114368060],[7,[279]]]],[-1,47,null,844026662793925,0,null,[[11,929772105325521],[7,[346]]]],[-1,47,null,368848199703967,0,null,[[11,290347554392499],[7,[347]]]],[-1,47,null,913949317020907,0,null,[[11,324338522464560],[7,[46]]]],[-1,47,null,523997789469183,0,null,[[11,483064547053985],[7,[4]]]],[-1,47,null,508179423172376,0,null,[[11,800713363325886],[7,[348]]]]]],[0,0,false,null,902330714781648,15,[[-1,26,null,0,false,false,false,903223876379170,null,[[11,755872340856296],[8,5],[7,[242]]]],[-1,26,null,0,false,false,false,530714949969678,null,[[11,755872340856296],[8,2],[7,[245]]]]],[[-1,47,null,696524596147357,0,null,[[11,588745698818005],[7,[19]]]],[-1,47,null,764640092696180,0,null,[[11,579415250310640],[7,[313]]]],[-1,47,null,593351845894711,0,null,[[11,867747672923081],[7,[322]]]],[-1,47,null,192805641266431,0,null,[[11,207852114368060],[7,[63]]]],[-1,47,null,514705547262487,0,null,[[11,929772105325521],[7,[349]]]],[-1,47,null,419891135316932,0,null,[[11,290347554392499],[7,[350]]]],[-1,47,null,911852209918842,0,null,[[11,324338522464560],[7,[46]]]],[-1,47,null,616866131333975,0,null,[[11,483064547053985],[7,[4]]]],[-1,47,null,844130403983857,0,null,[[11,800713363325886],[7,[22]]]]]]]]]],["RHM_ADS",[[1,"isRewardedLoaded",2,false,false,false,992349298444787,false,204],[4,["ShowAd",0,[],true,false,false],false,null,303180408975652,1,[],[[-3,200,[false,false,0]]]],[4,["CallRewardedAd",0,[],true,false,false],false,null,593912889675759,2,[],[[-3,201,[false,false,0]]]],[4,["adStarted",0,[],true,false,false],false,null,267489420552017,3,[],[[6,179,null,231912260474438,0,null,[[3,0]]],[-1,73,null,310163619039328,0,null,[[0,[4]]]],[49,202,null,834682984108077,0,null,[[3,0],[7,[351]]]]]],[4,["onClose",0,[],true,false,false],false,null,860123831178203,4,[],[[-1,73,null,100816554826988,0,null,[[0,[5]]]],[6,179,null,198462374705173,0,null,[[3,1]]],[49,202,null,135075510980092,0,null,[[3,0],[7,[352]]]],[49,203,null,970524853935773,0,null]]],[4,["onError",0,[],true,false,false],false,null,983935549858073,5,[],[[-1,73,null,733970580952669,0,null,[[0,[5]]]],[6,179,null,532430479294537,0,null,[[3,1]]],[49,202,null,393446550326793,0,null,[[3,0],[7,[353]]]],[49,203,null,295612005644521,0,null]]],[4,["rewardedLoaded",0,[],true,false,false],false,null,244689733429791,6,[],[[-1,186,null,421159762850856,0,null,[[11,992349298444787],[3,1]]]]],[4,["rewardedNotLoaded",0,[],true,false,false],false,null,344448824983656,7,[],[[-1,186,null,512763233310163,0,null,[[11,992349298444787],[3,0]]]]],[4,["rewardSuccessful",0,[],true,false,false],false,null,208565339022343,8,[],[]],[4,["rewardedFailed",0,[],true,false,false],false,null,754884294365021,9,[],[]],[4,["startGame",0,[],true,false,false],false,null,270547747683312,10,[],[[109,108,null,535157778663285,0,null],[108,108,null,129827977419436,0,null],[60,72,null,649713750306265,0,null,[[3,1]]]]]]]],[["buttonx",[["audio/webm; codecs=opus",".webm",1594]],false],["start",[["audio/webm; codecs=opus",".webm",21451]],false],["win",[["audio/webm; codecs=opus",".webm",29710]],false],["jump",[["audio/webm; codecs=opus",".webm",1873]],false],["intro-button",[["audio/webm; codecs=opus",".webm",12499]],false],["intro-sound",[["audio/webm; codecs=opus",".webm",38492]],false],["bup",[["audio/webm; codecs=opus",".webm",3362]],false],["bellsoc",[["audio/webm; codecs=opus",".webm",1875]],false],["goasoc",[["audio/webm; codecs=opus",".webm",22282]],false],["refsoc",[["audio/webm; codecs=opus",".webm",6254]],false],["file",[["audio/webm; codecs=opus",".webm",5268]],false],["wrong",[["audio/webm; codecs=opus",".webm",5314]],false],["menu",[["audio/webm; codecs=opus",".webm",41953]],false],["press",[["audio/webm; codecs=opus",".webm",3216]],false],["music",[["audio/webm; codecs=opus",".webm",290354]],false],["metal",[["audio/webm; codecs=opus",".webm",3958]],false]],"media/",false,290,190,3,false,"nearest",false,"1.0.4",false,false,2,2,385,true,true,1,true,0.7853981633974483,[],"icons/",[],"normalized","025bjaucvn0","fonts/",[],"default",[],"standard","vsync","com.twoplayergames.basketrandom","loading-logo.png",false,4,false,null,[],"flat",1,10000,false]} \ No newline at end of file diff --git a/basketrandom/images/ballline-sheet0.png b/basketrandom/images/ballline-sheet0.png new file mode 100644 index 00000000..770d14b8 Binary files /dev/null and b/basketrandom/images/ballline-sheet0.png differ diff --git a/basketrandom/images/buildingtile-sheet0.png b/basketrandom/images/buildingtile-sheet0.png new file mode 100644 index 00000000..c9475931 Binary files /dev/null and b/basketrandom/images/buildingtile-sheet0.png differ diff --git a/basketrandom/images/buildingtile2-sheet0.png b/basketrandom/images/buildingtile2-sheet0.png new file mode 100644 index 00000000..4458fa88 Binary files /dev/null and b/basketrandom/images/buildingtile2-sheet0.png differ diff --git a/basketrandom/images/buildingtile3-sheet0.png b/basketrandom/images/buildingtile3-sheet0.png new file mode 100644 index 00000000..2713b5d9 Binary files /dev/null and b/basketrandom/images/buildingtile3-sheet0.png differ diff --git a/basketrandom/images/cloudtile-sheet0.png b/basketrandom/images/cloudtile-sheet0.png new file mode 100644 index 00000000..5c3586c9 Binary files /dev/null and b/basketrandom/images/cloudtile-sheet0.png differ diff --git a/basketrandom/images/fencetile-sheet0.png b/basketrandom/images/fencetile-sheet0.png new file mode 100644 index 00000000..7ee78d89 Binary files /dev/null and b/basketrandom/images/fencetile-sheet0.png differ diff --git a/basketrandom/images/game_bg-sheet0.png b/basketrandom/images/game_bg-sheet0.png new file mode 100644 index 00000000..63918e62 Binary files /dev/null and b/basketrandom/images/game_bg-sheet0.png differ diff --git a/basketrandom/images/grasslinetile-sheet0.png b/basketrandom/images/grasslinetile-sheet0.png new file mode 100644 index 00000000..c1033290 Binary files /dev/null and b/basketrandom/images/grasslinetile-sheet0.png differ diff --git a/basketrandom/images/grasstile-sheet0.png b/basketrandom/images/grasstile-sheet0.png new file mode 100644 index 00000000..0191cea4 Binary files /dev/null and b/basketrandom/images/grasstile-sheet0.png differ diff --git a/basketrandom/images/groundtile-sheet0.png b/basketrandom/images/groundtile-sheet0.png new file mode 100644 index 00000000..6da4019c Binary files /dev/null and b/basketrandom/images/groundtile-sheet0.png differ diff --git a/basketrandom/images/groundtileindoor-sheet0.png b/basketrandom/images/groundtileindoor-sheet0.png new file mode 100644 index 00000000..e7b6dca4 Binary files /dev/null and b/basketrandom/images/groundtileindoor-sheet0.png differ diff --git a/basketrandom/images/groundtileplaj-sheet0.png b/basketrandom/images/groundtileplaj-sheet0.png new file mode 100644 index 00000000..eabe6dd1 Binary files /dev/null and b/basketrandom/images/groundtileplaj-sheet0.png differ diff --git a/basketrandom/images/groundtilesnow-sheet0.png b/basketrandom/images/groundtilesnow-sheet0.png new file mode 100644 index 00000000..66eb3d53 Binary files /dev/null and b/basketrandom/images/groundtilesnow-sheet0.png differ diff --git a/basketrandom/images/hair-sheet0.png b/basketrandom/images/hair-sheet0.png new file mode 100644 index 00000000..536ba3a3 Binary files /dev/null and b/basketrandom/images/hair-sheet0.png differ diff --git a/basketrandom/images/indoorbgtile-sheet0.png b/basketrandom/images/indoorbgtile-sheet0.png new file mode 100644 index 00000000..8c9f03fa Binary files /dev/null and b/basketrandom/images/indoorbgtile-sheet0.png differ diff --git a/basketrandom/images/indoorbgtile2-sheet0.png b/basketrandom/images/indoorbgtile2-sheet0.png new file mode 100644 index 00000000..204386f1 Binary files /dev/null and b/basketrandom/images/indoorbgtile2-sheet0.png differ diff --git a/basketrandom/images/indoorbgtile3-sheet0.png b/basketrandom/images/indoorbgtile3-sheet0.png new file mode 100644 index 00000000..e3752d89 Binary files /dev/null and b/basketrandom/images/indoorbgtile3-sheet0.png differ diff --git a/basketrandom/images/potatiled-sheet0.png b/basketrandom/images/potatiled-sheet0.png new file mode 100644 index 00000000..9a91ac20 Binary files /dev/null and b/basketrandom/images/potatiled-sheet0.png differ diff --git a/basketrandom/images/rightshoe-sheet0.png b/basketrandom/images/rightshoe-sheet0.png new file mode 100644 index 00000000..81481681 Binary files /dev/null and b/basketrandom/images/rightshoe-sheet0.png differ diff --git a/basketrandom/images/rightshort-sheet0.png b/basketrandom/images/rightshort-sheet0.png new file mode 100644 index 00000000..f164f066 Binary files /dev/null and b/basketrandom/images/rightshort-sheet0.png differ diff --git a/basketrandom/images/seatile-sheet0.png b/basketrandom/images/seatile-sheet0.png new file mode 100644 index 00000000..8b3a1723 Binary files /dev/null and b/basketrandom/images/seatile-sheet0.png differ diff --git a/basketrandom/images/shared-0-sheet0.png b/basketrandom/images/shared-0-sheet0.png new file mode 100644 index 00000000..fa3dbcc3 Binary files /dev/null and b/basketrandom/images/shared-0-sheet0.png differ diff --git a/basketrandom/images/shared-0-sheet1.png b/basketrandom/images/shared-0-sheet1.png new file mode 100644 index 00000000..5b679f03 Binary files /dev/null and b/basketrandom/images/shared-0-sheet1.png differ diff --git a/basketrandom/images/shared-0-sheet2.png b/basketrandom/images/shared-0-sheet2.png new file mode 100644 index 00000000..4b339c31 Binary files /dev/null and b/basketrandom/images/shared-0-sheet2.png differ diff --git a/basketrandom/images/shared-0-sheet3.png b/basketrandom/images/shared-0-sheet3.png new file mode 100644 index 00000000..a734f611 Binary files /dev/null and b/basketrandom/images/shared-0-sheet3.png differ diff --git a/basketrandom/images/shared-1-sheet0.png b/basketrandom/images/shared-1-sheet0.png new file mode 100644 index 00000000..539febb9 Binary files /dev/null and b/basketrandom/images/shared-1-sheet0.png differ diff --git a/basketrandom/images/shared-1-sheet1.png b/basketrandom/images/shared-1-sheet1.png new file mode 100644 index 00000000..68e51cad Binary files /dev/null and b/basketrandom/images/shared-1-sheet1.png differ diff --git a/basketrandom/images/shared-1-sheet2.png b/basketrandom/images/shared-1-sheet2.png new file mode 100644 index 00000000..22202a31 Binary files /dev/null and b/basketrandom/images/shared-1-sheet2.png differ diff --git a/basketrandom/images/snowtile-sheet0.png b/basketrandom/images/snowtile-sheet0.png new file mode 100644 index 00000000..96b3b806 Binary files /dev/null and b/basketrandom/images/snowtile-sheet0.png differ diff --git a/basketrandom/images/startile-sheet0.png b/basketrandom/images/startile-sheet0.png new file mode 100644 index 00000000..db01d9a4 Binary files /dev/null and b/basketrandom/images/startile-sheet0.png differ diff --git a/basketrandom/images/titlebg-sheet0.png b/basketrandom/images/titlebg-sheet0.png new file mode 100644 index 00000000..5b1ab85c Binary files /dev/null and b/basketrandom/images/titlebg-sheet0.png differ diff --git a/basketrandom/images/titlechars-sheet0.png b/basketrandom/images/titlechars-sheet0.png new file mode 100644 index 00000000..2f166db5 Binary files /dev/null and b/basketrandom/images/titlechars-sheet0.png differ diff --git a/basketrandom/images/tshirt-sheet0.png b/basketrandom/images/tshirt-sheet0.png new file mode 100644 index 00000000..5cf2e8b2 Binary files /dev/null and b/basketrandom/images/tshirt-sheet0.png differ diff --git a/basketrandom/index.html b/basketrandom/index.html new file mode 100644 index 00000000..47172817 --- /dev/null +++ b/basketrandom/index.html @@ -0,0 +1,145 @@ + + + + +Basket Random + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/basketrandom/media/bellsoc.webm b/basketrandom/media/bellsoc.webm new file mode 100644 index 00000000..b34c70d5 Binary files /dev/null and b/basketrandom/media/bellsoc.webm differ diff --git a/basketrandom/media/bup.webm b/basketrandom/media/bup.webm new file mode 100644 index 00000000..ffb6b2d5 Binary files /dev/null and b/basketrandom/media/bup.webm differ diff --git a/basketrandom/media/buttonx.webm b/basketrandom/media/buttonx.webm new file mode 100644 index 00000000..7b08f377 Binary files /dev/null and b/basketrandom/media/buttonx.webm differ diff --git a/basketrandom/media/file.webm b/basketrandom/media/file.webm new file mode 100644 index 00000000..ae6a1983 Binary files /dev/null and b/basketrandom/media/file.webm differ diff --git a/basketrandom/media/goasoc.webm b/basketrandom/media/goasoc.webm new file mode 100644 index 00000000..260ed294 Binary files /dev/null and b/basketrandom/media/goasoc.webm differ diff --git a/basketrandom/media/intro-button.webm b/basketrandom/media/intro-button.webm new file mode 100644 index 00000000..cb19fa83 Binary files /dev/null and b/basketrandom/media/intro-button.webm differ diff --git a/basketrandom/media/intro-sound.webm b/basketrandom/media/intro-sound.webm new file mode 100644 index 00000000..deab50cb Binary files /dev/null and b/basketrandom/media/intro-sound.webm differ diff --git a/basketrandom/media/jump.webm b/basketrandom/media/jump.webm new file mode 100644 index 00000000..4df5fee5 Binary files /dev/null and b/basketrandom/media/jump.webm differ diff --git a/basketrandom/media/menu.webm b/basketrandom/media/menu.webm new file mode 100644 index 00000000..9a23c142 Binary files /dev/null and b/basketrandom/media/menu.webm differ diff --git a/basketrandom/media/metal.webm b/basketrandom/media/metal.webm new file mode 100644 index 00000000..ed36c182 Binary files /dev/null and b/basketrandom/media/metal.webm differ diff --git a/basketrandom/media/music.webm b/basketrandom/media/music.webm new file mode 100644 index 00000000..c4728916 Binary files /dev/null and b/basketrandom/media/music.webm differ diff --git a/basketrandom/media/press.webm b/basketrandom/media/press.webm new file mode 100644 index 00000000..c15c9e30 Binary files /dev/null and b/basketrandom/media/press.webm differ diff --git a/basketrandom/media/refsoc.webm b/basketrandom/media/refsoc.webm new file mode 100644 index 00000000..db1a9e10 Binary files /dev/null and b/basketrandom/media/refsoc.webm differ diff --git a/basketrandom/media/start.webm b/basketrandom/media/start.webm new file mode 100644 index 00000000..e45b653c Binary files /dev/null and b/basketrandom/media/start.webm differ diff --git a/basketrandom/media/win.webm b/basketrandom/media/win.webm new file mode 100644 index 00000000..a7bcf22a Binary files /dev/null and b/basketrandom/media/win.webm differ diff --git a/basketrandom/media/wrong.webm b/basketrandom/media/wrong.webm new file mode 100644 index 00000000..b7c81bbd Binary files /dev/null and b/basketrandom/media/wrong.webm differ diff --git a/basketrandom/scripts/c3runtime.js b/basketrandom/scripts/c3runtime.js new file mode 100644 index 00000000..1c542710 --- /dev/null +++ b/basketrandom/scripts/c3runtime.js @@ -0,0 +1,6347 @@ +// Generated by Construct, the game and app creator :: https://www.construct.net +// ../3rdparty/glmatrix.js +{ +/* + @fileoverview gl-matrix - High performance matrix and vector operations +@author Brandon Jones +@author Colin MacKenzie IV +@version 3.4.1 + +Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +'use strict';(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.glMatrix={}))})(this,function(exports){var EPSILON=1E-6;var ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array;var RANDOM=Math.random;var ANGLE_ORDER="zyx";function setMatrixArrayType(type){ARRAY_TYPE=type}var degree=Math.PI/180;function toRadian(a){return a* +degree}function equals$9(a,b){return Math.abs(a-b)<=EPSILON*Math.max(1,Math.abs(a),Math.abs(b))}if(!Math.hypot)Math.hypot=function(){var y=0,i=arguments.length;while(i--)y+=arguments[i]*arguments[i];return Math.sqrt(y)};var common=Object.freeze({__proto__:null,EPSILON:EPSILON,get ARRAY_TYPE(){return ARRAY_TYPE},RANDOM:RANDOM,ANGLE_ORDER:ANGLE_ORDER,setMatrixArrayType:setMatrixArrayType,toRadian:toRadian,equals:equals$9});function create$8(){var out=new ARRAY_TYPE(4);if(ARRAY_TYPE!=Float32Array){out[1]= +0;out[2]=0}out[0]=1;out[3]=1;return out}function clone$8(a){var out=new ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function copy$8(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function identity$5(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out}function fromValues$8(m00,m01,m10,m11){var out=new ARRAY_TYPE(4);out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out}function set$8(out,m00,m01,m10,m11){out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out} +function transpose$2(out,a){if(out===a){var a1=a[1];out[1]=a[2];out[2]=a1}else{out[0]=a[0];out[1]=a[2];out[2]=a[1];out[3]=a[3]}return out}function invert$5(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var det=a0*a3-a2*a1;if(!det)return null;det=1/det;out[0]=a3*det;out[1]=-a1*det;out[2]=-a2*det;out[3]=a0*det;return out}function adjoint$2(out,a){var a0=a[0];out[0]=a[3];out[1]=-a[1];out[2]=-a[2];out[3]=a0;return out}function determinant$3(a){return a[0]*a[3]-a[2]*a[1]}function multiply$8(out,a,b){var a0= +a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;return out}function rotate$4(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;return out}function scale$8(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;return out}function fromRotation$4(out, +rad){var s=Math.sin(rad);var c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;return out}function fromScaling$3(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];return out}function str$8(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function frob$3(a){return Math.hypot(a[0],a[1],a[2],a[3])}function LDU(L,D,U,a){L[2]=a[2]/a[0];U[0]=a[0];U[1]=a[1];U[3]=a[3]-L[2]*U[1];return[L,D,U]}function add$8(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out}function subtract$6(out, +a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out}function exactEquals$8(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$8(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3), +Math.abs(b3))}function multiplyScalar$3(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out}function multiplyScalarAndAdd$3(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;return out}var mul$8=multiply$8;var sub$6=subtract$6;var mat2=Object.freeze({__proto__:null,create:create$8,clone:clone$8,copy:copy$8,identity:identity$5,fromValues:fromValues$8,set:set$8,transpose:transpose$2,invert:invert$5,adjoint:adjoint$2,determinant:determinant$3, +multiply:multiply$8,rotate:rotate$4,scale:scale$8,fromRotation:fromRotation$4,fromScaling:fromScaling$3,str:str$8,frob:frob$3,LDU:LDU,add:add$8,subtract:subtract$6,exactEquals:exactEquals$8,equals:equals$8,multiplyScalar:multiplyScalar$3,multiplyScalarAndAdd:multiplyScalarAndAdd$3,mul:mul$8,sub:sub$6});function create$7(){var out=new ARRAY_TYPE(6);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[4]=0;out[5]=0}out[0]=1;out[3]=1;return out}function clone$7(a){var out=new ARRAY_TYPE(6);out[0]=a[0]; +out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function copy$7(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function identity$4(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out}function fromValues$7(a,b,c,d,tx,ty){var out=new ARRAY_TYPE(6);out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function set$7(out,a,b,c,d,tx,ty){out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function invert$4(out, +a){var aa=a[0],ab=a[1],ac=a[2],ad=a[3];var atx=a[4],aty=a[5];var det=aa*ad-ab*ac;if(!det)return null;det=1/det;out[0]=ad*det;out[1]=-ab*det;out[2]=-ac*det;out[3]=aa*det;out[4]=(ac*aty-ad*atx)*det;out[5]=(ab*atx-aa*aty)*det;return out}function determinant$2(a){return a[0]*a[3]-a[1]*a[2]}function multiply$7(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;out[4]= +a0*b4+a2*b5+a4;out[5]=a1*b4+a3*b5+a5;return out}function rotate$3(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;out[4]=a4;out[5]=a5;return out}function scale$7(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;out[4]=a4;out[5]=a5;return out}function translate$3(out,a,v){var a0=a[0],a1=a[1], +a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=a0*v0+a2*v1+a4;out[5]=a1*v0+a3*v1+a5;return out}function fromRotation$3(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;out[4]=0;out[5]=0;return out}function fromScaling$2(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];out[4]=0;out[5]=0;return out}function fromTranslation$3(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=v[0];out[5]=v[1];return out}function str$7(a){return"mat2d("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"}function frob$2(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],1)}function add$7(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];return out}function subtract$5(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];return out}function multiplyScalar$2(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]= +a[4]*b;out[5]=a[5]*b;return out}function multiplyScalarAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;return out}function exactEquals$7(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]}function equals$7(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];return Math.abs(a0-b0)<=EPSILON*Math.max(1, +Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))}var mul$7=multiply$7;var sub$5=subtract$5;var mat2d=Object.freeze({__proto__:null,create:create$7,clone:clone$7,copy:copy$7,identity:identity$4,fromValues:fromValues$7, +set:set$7,invert:invert$4,determinant:determinant$2,multiply:multiply$7,rotate:rotate$3,scale:scale$7,translate:translate$3,fromRotation:fromRotation$3,fromScaling:fromScaling$2,fromTranslation:fromTranslation$3,str:str$7,frob:frob$2,add:add$7,subtract:subtract$5,multiplyScalar:multiplyScalar$2,multiplyScalarAndAdd:multiplyScalarAndAdd$2,exactEquals:exactEquals$7,equals:equals$7,mul:mul$7,sub:sub$5});function create$6(){var out=new ARRAY_TYPE(9);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]= +0;out[5]=0;out[6]=0;out[7]=0}out[0]=1;out[4]=1;out[8]=1;return out}function fromMat4$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[4];out[4]=a[5];out[5]=a[6];out[6]=a[8];out[7]=a[9];out[8]=a[10];return out}function clone$6(a){var out=new ARRAY_TYPE(9);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out}function copy$6(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]= +a[8];return out}function fromValues$6(m00,m01,m02,m10,m11,m12,m20,m21,m22){var out=new ARRAY_TYPE(9);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function set$6(out,m00,m01,m02,m10,m11,m12,m20,m21,m22){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function identity$3(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function transpose$1(out, +a){if(out===a){var a01=a[1],a02=a[2],a12=a[5];out[1]=a[3];out[2]=a[6];out[3]=a01;out[5]=a[7];out[6]=a02;out[7]=a12}else{out[0]=a[0];out[1]=a[3];out[2]=a[6];out[3]=a[1];out[4]=a[4];out[5]=a[7];out[6]=a[2];out[7]=a[5];out[8]=a[8]}return out}function invert$3(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b01=a22*a11-a12*a21;var b11=-a22*a10+a12*a20;var b21=a21*a10-a11*a20;var det=a00*b01+a01*b11+a02*b21;if(!det)return null;det=1/det;out[0]=b01* +det;out[1]=(-a22*a01+a02*a21)*det;out[2]=(a12*a01-a02*a11)*det;out[3]=b11*det;out[4]=(a22*a00-a02*a20)*det;out[5]=(-a12*a00+a02*a10)*det;out[6]=b21*det;out[7]=(-a21*a00+a01*a20)*det;out[8]=(a11*a00-a01*a10)*det;return out}function adjoint$1(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];out[0]=a11*a22-a12*a21;out[1]=a02*a21-a01*a22;out[2]=a01*a12-a02*a11;out[3]=a12*a20-a10*a22;out[4]=a00*a22-a02*a20;out[5]=a02*a10-a00*a12;out[6]=a10*a21-a11*a20; +out[7]=a01*a20-a00*a21;out[8]=a00*a11-a01*a10;return out}function determinant$1(a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];return a00*(a22*a11-a12*a21)+a01*(-a22*a10+a12*a20)+a02*(a21*a10-a11*a20)}function multiply$6(out,a,b){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b00=b[0],b01=b[1],b02=b[2];var b10=b[3],b11=b[4],b12=b[5];var b20=b[6],b21=b[7],b22=b[8];out[0]=b00*a00+b01*a10+b02*a20;out[1]= +b00*a01+b01*a11+b02*a21;out[2]=b00*a02+b01*a12+b02*a22;out[3]=b10*a00+b11*a10+b12*a20;out[4]=b10*a01+b11*a11+b12*a21;out[5]=b10*a02+b11*a12+b12*a22;out[6]=b20*a00+b21*a10+b22*a20;out[7]=b20*a01+b21*a11+b22*a21;out[8]=b20*a02+b21*a12+b22*a22;return out}function translate$2(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x=v[0],y=v[1];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a10;out[4]=a11;out[5]=a12;out[6]=x*a00+y*a10+a20;out[7]=x*a01+y*a11+a21;out[8]=x* +a02+y*a12+a22;return out}function rotate$2(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);out[0]=c*a00+s*a10;out[1]=c*a01+s*a11;out[2]=c*a02+s*a12;out[3]=c*a10-s*a00;out[4]=c*a11-s*a01;out[5]=c*a12-s*a02;out[6]=a20;out[7]=a21;out[8]=a22;return out}function scale$6(out,a,v){var x=v[0],y=v[1];out[0]=x*a[0];out[1]=x*a[1];out[2]=x*a[2];out[3]=y*a[3];out[4]=y*a[4];out[5]=y*a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out} +function fromTranslation$2(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=v[0];out[7]=v[1];out[8]=1;return out}function fromRotation$2(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=0;out[3]=-s;out[4]=c;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromScaling$1(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=0;out[4]=v[1];out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromMat2d(out,a){out[0]=a[0];out[1]=a[1];out[2]=0;out[3]=a[2];out[4]=a[3]; +out[5]=0;out[6]=a[4];out[7]=a[5];out[8]=1;return out}function fromQuat$1(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out}function normalFromMat4(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20= +a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a12* +b08-a10*b11-a13*b07)*det;out[2]=(a10*b10-a11*b08+a13*b06)*det;out[3]=(a02*b10-a01*b11-a03*b09)*det;out[4]=(a00*b11-a02*b08+a03*b07)*det;out[5]=(a01*b08-a00*b10-a03*b06)*det;out[6]=(a31*b05-a32*b04+a33*b03)*det;out[7]=(a32*b02-a30*b05-a33*b01)*det;out[8]=(a30*b04-a31*b02+a33*b00)*det;return out}function projection(out,width,height){out[0]=2/width;out[1]=0;out[2]=0;out[3]=0;out[4]=-2/height;out[5]=0;out[6]=-1;out[7]=1;out[8]=1;return out}function str$6(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+ +a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"}function frob$1(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}function add$6(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];return out}function subtract$4(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]= +a[8]-b[8];return out}function multiplyScalar$1(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;return out}function multiplyScalarAndAdd$1(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;return out}function exactEquals$6(a,b){return a[0]===b[0]&& +a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]}function equals$6(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7],a8=a[8];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON* +Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))}var mul$6=multiply$6;var sub$4=subtract$4;var mat3=Object.freeze({__proto__:null,create:create$6,fromMat4:fromMat4$1,clone:clone$6,copy:copy$6, +fromValues:fromValues$6,set:set$6,identity:identity$3,transpose:transpose$1,invert:invert$3,adjoint:adjoint$1,determinant:determinant$1,multiply:multiply$6,translate:translate$2,rotate:rotate$2,scale:scale$6,fromTranslation:fromTranslation$2,fromRotation:fromRotation$2,fromScaling:fromScaling$1,fromMat2d:fromMat2d,fromQuat:fromQuat$1,normalFromMat4:normalFromMat4,projection:projection,str:str$6,frob:frob$1,add:add$6,subtract:subtract$4,multiplyScalar:multiplyScalar$1,multiplyScalarAndAdd:multiplyScalarAndAdd$1, +exactEquals:exactEquals$6,equals:equals$6,mul:mul$6,sub:sub$4});function create$5(){var out=new ARRAY_TYPE(16);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=0;out[12]=0;out[13]=0;out[14]=0}out[0]=1;out[5]=1;out[10]=1;out[15]=1;return out}function clone$5(a){var out=new ARRAY_TYPE(16);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]= +a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function copy$5(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function fromValues$5(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){var out=new ARRAY_TYPE(16);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]= +m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function set$5(out,m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]=m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function identity$2(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]= +0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function transpose(out,a){if(out===a){var a01=a[1],a02=a[2],a03=a[3];var a12=a[6],a13=a[7];var a23=a[11];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a01;out[6]=a[9];out[7]=a[13];out[8]=a02;out[9]=a12;out[11]=a[14];out[12]=a03;out[13]=a13;out[14]=a23}else{out[0]=a[0];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a[1];out[5]=a[5];out[6]=a[9];out[7]=a[13];out[8]=a[2];out[9]=a[6];out[10]=a[10];out[11]=a[14];out[12]=a[3];out[13]=a[7];out[14]=a[11];out[15]= +a[15]}return out}function invert$2(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det= +b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a02*b10-a01*b11-a03*b09)*det;out[2]=(a31*b05-a32*b04+a33*b03)*det;out[3]=(a22*b04-a21*b05-a23*b03)*det;out[4]=(a12*b08-a10*b11-a13*b07)*det;out[5]=(a00*b11-a02*b08+a03*b07)*det;out[6]=(a32*b02-a30*b05-a33*b01)*det;out[7]=(a20*b05-a22*b02+a23*b01)*det;out[8]=(a10*b10-a11*b08+a13*b06)*det;out[9]=(a01*b08-a00*b10-a03*b06)*det;out[10]=(a30*b04-a31*b02+a33*b00)*det;out[11]=(a21*b02- +a20*b04-a23*b00)*det;out[12]=(a11*b07-a10*b09-a12*b06)*det;out[13]=(a00*b09-a01*b07+a02*b06)*det;out[14]=(a31*b01-a30*b03-a32*b00)*det;out[15]=(a20*b03-a21*b01+a22*b00)*det;return out}function adjoint(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05= +a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;out[0]=a11*b11-a12*b10+a13*b09;out[1]=a02*b10-a01*b11-a03*b09;out[2]=a31*b05-a32*b04+a33*b03;out[3]=a22*b04-a21*b05-a23*b03;out[4]=a12*b08-a10*b11-a13*b07;out[5]=a00*b11-a02*b08+a03*b07;out[6]=a32*b02-a30*b05-a33*b01;out[7]=a20*b05-a22*b02+a23*b01;out[8]=a10*b10-a11*b08+a13*b06;out[9]=a01*b08-a00*b10-a03*b06;out[10]=a30*b04-a31*b02+a33*b00; +out[11]=a21*b02-a20*b04-a23*b00;out[12]=a11*b07-a10*b09-a12*b06;out[13]=a00*b09-a01*b07+a02*b06;out[14]=a31*b01-a30*b03-a32*b00;out[15]=a20*b03-a21*b01+a22*b00;return out}function determinant(a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=a00*a11-a01*a10;var b1=a00*a12-a02*a10;var b2=a01*a12-a02*a11;var b3=a20*a31-a21*a30;var b4=a20*a32-a22*a30;var b5=a21*a32-a22*a31;var b6= +a00*b5-a01*b4+a02*b3;var b7=a10*b5-a11*b4+a12*b3;var b8=a20*b2-a21*b1+a22*b0;var b9=a30*b2-a31*b1+a32*b0;return a13*b6-a03*b7+a33*b8-a23*b9}function multiply$5(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=b0*a00+b1*a10+b2*a20+b3*a30;out[1]=b0*a01+b1*a11+b2*a21+b3*a31;out[2]=b0*a02+b1*a12+b2*a22+b3*a32;out[3]=b0*a03+b1*a13+b2*a23+ +b3*a33;b0=b[4];b1=b[5];b2=b[6];b3=b[7];out[4]=b0*a00+b1*a10+b2*a20+b3*a30;out[5]=b0*a01+b1*a11+b2*a21+b3*a31;out[6]=b0*a02+b1*a12+b2*a22+b3*a32;out[7]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[8];b1=b[9];b2=b[10];b3=b[11];out[8]=b0*a00+b1*a10+b2*a20+b3*a30;out[9]=b0*a01+b1*a11+b2*a21+b3*a31;out[10]=b0*a02+b1*a12+b2*a22+b3*a32;out[11]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[12];b1=b[13];b2=b[14];b3=b[15];out[12]=b0*a00+b1*a10+b2*a20+b3*a30;out[13]=b0*a01+b1*a11+b2*a21+b3*a31;out[14]=b0*a02+b1*a12+b2*a22+b3*a32;out[15]= +b0*a03+b1*a13+b2*a23+b3*a33;return out}function translate$1(out,a,v){var x=v[0],y=v[1],z=v[2];var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]= +a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out}function scale$5(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function rotate$1(out, +a,rad,axis){var x=axis[0],y=axis[1],z=axis[2];var len=Math.hypot(x,y,z);var s,c,t;var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;var b00,b01,b02;var b10,b11,b12;var b20,b21,b22;if(len0){translation[0]=(ax*bw+aw*bx+ay*bz- +az*by)*2/magnitude;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2/magnitude;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2/magnitude}else{translation[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2}fromRotationTranslation$1(out,a,translation);return out}function getTranslation$1(out,mat){out[0]=mat[12];out[1]=mat[13];out[2]=mat[14];return out}function getScaling(out,mat){var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22= +mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out[0]=Math.hypot(m11,m12,m13);out[1]=Math.hypot(m21,m22,m23);out[2]=Math.hypot(m31,m32,m33);return out}function getRotation(out,mat){var scaling=new ARRAY_TYPE(3);getScaling(scaling,mat);var is1=1/scaling[0];var is2=1/scaling[1];var is3=1/scaling[2];var sm11=mat[0]*is1;var sm12=mat[1]*is2;var sm13=mat[2]*is3;var sm21=mat[4]*is1;var sm22=mat[5]*is2;var sm23=mat[6]*is3;var sm31=mat[8]*is1;var sm32=mat[9]*is2;var sm33=mat[10]*is3;var trace= +sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out[3]=.25*S;out[0]=(sm23-sm32)/S;out[1]=(sm31-sm13)/S;out[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out[3]=(sm23-sm32)/S;out[0]=.25*S;out[1]=(sm12+sm21)/S;out[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out[3]=(sm31-sm13)/S;out[0]=(sm12+sm21)/S;out[1]=.25*S;out[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+sm33-sm11-sm22)*2;out[3]=(sm12-sm21)/S;out[0]=(sm31+sm13)/S;out[1]=(sm23+sm32)/S;out[2]= +.25*S}return out}function decompose(out_r,out_t,out_s,mat){out_t[0]=mat[12];out_t[1]=mat[13];out_t[2]=mat[14];var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22=mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out_s[0]=Math.hypot(m11,m12,m13);out_s[1]=Math.hypot(m21,m22,m23);out_s[2]=Math.hypot(m31,m32,m33);var is1=1/out_s[0];var is2=1/out_s[1];var is3=1/out_s[2];var sm11=m11*is1;var sm12=m12*is2;var sm13=m13*is3;var sm21=m21*is1;var sm22=m22*is2;var sm23=m23*is3; +var sm31=m31*is1;var sm32=m32*is2;var sm33=m33*is3;var trace=sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out_r[3]=.25*S;out_r[0]=(sm23-sm32)/S;out_r[1]=(sm31-sm13)/S;out_r[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out_r[3]=(sm23-sm32)/S;out_r[0]=.25*S;out_r[1]=(sm12+sm21)/S;out_r[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out_r[3]=(sm31-sm13)/S;out_r[0]=(sm12+sm21)/S;out_r[1]=.25*S;out_r[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+ +sm33-sm11-sm22)*2;out_r[3]=(sm12-sm21)/S;out_r[0]=(sm31+sm13)/S;out_r[1]=(sm23+sm32)/S;out_r[2]=.25*S}return out_r}function fromRotationTranslationScale(out,q,v,s){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];out[0]=(1-(yy+zz))*sx;out[1]=(xy+wz)*sx;out[2]=(xz-wy)*sx;out[3]=0;out[4]=(xy-wz)*sy;out[5]=(1-(xx+zz))*sy;out[6]=(yz+wx)*sy;out[7]= +0;out[8]=(xz+wy)*sz;out[9]=(yz-wx)*sz;out[10]=(1-(xx+yy))*sz;out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out}function fromRotationTranslationScaleOrigin(out,q,v,s,o){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];var ox=o[0];var oy=o[1];var oz=o[2];var out0=(1-(yy+zz))*sx;var out1=(xy+wz)*sx;var out2=(xz-wy)*sx;var out4= +(xy-wz)*sy;var out5=(1-(xx+zz))*sy;var out6=(yz+wx)*sy;var out8=(xz+wy)*sz;var out9=(yz-wx)*sz;var out10=(1-(xx+yy))*sz;out[0]=out0;out[1]=out1;out[2]=out2;out[3]=0;out[4]=out4;out[5]=out5;out[6]=out6;out[7]=0;out[8]=out8;out[9]=out9;out[10]=out10;out[11]=0;out[12]=v[0]+ox-(out0*ox+out4*oy+out8*oz);out[13]=v[1]+oy-(out1*ox+out5*oy+out9*oz);out[14]=v[2]+oz-(out2*ox+out6*oy+out10*oz);out[15]=1;return out}function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx= +x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[1]=yx+wz;out[2]=zx-wy;out[3]=0;out[4]=yx-wz;out[5]=1-xx-zz;out[6]=zy+wx;out[7]=0;out[8]=zx+wy;out[9]=zy-wx;out[10]=1-xx-yy;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function frustum(out,left,right,bottom,top,near,far){var rl=1/(right-left);var tb=1/(top-bottom);var nf=1/(near-far);out[0]=near*2*rl;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=near*2*tb;out[6]=0;out[7]= +0;out[8]=(right+left)*rl;out[9]=(top+bottom)*tb;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near*2*nf;out[15]=0;return out}function perspectiveNO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=(far+near)*nf;out[14]=2*far*near*nf}else{out[10]=-1;out[14]=-2*near}return out}var perspective= +perspectiveNO;function perspectiveZO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=far*nf;out[14]=far*near*nf}else{out[10]=-1;out[14]=-near}return out}function perspectiveFromFieldOfView(out,fov,near,far){var upTan=Math.tan(fov.upDegrees*Math.PI/180);var downTan=Math.tan(fov.downDegrees*Math.PI/180); +var leftTan=Math.tan(fov.leftDegrees*Math.PI/180);var rightTan=Math.tan(fov.rightDegrees*Math.PI/180);var xScale=2/(leftTan+rightTan);var yScale=2/(upTan+downTan);out[0]=xScale;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=yScale;out[6]=0;out[7]=0;out[8]=-((leftTan-rightTan)*xScale*.5);out[9]=(upTan-downTan)*yScale*.5;out[10]=far/(near-far);out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near/(near-far);out[15]=0;return out}function orthoNO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt= +1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=2*nf;out[11]=0;out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=(far+near)*nf;out[15]=1;return out}var ortho=orthoNO;function orthoZO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt=1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=nf;out[11]=0; +out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=near*nf;out[15]=1;return out}function lookAt(out,eye,center,up){var x0,x1,x2,y0,y1,y2,z0,z1,z2,len;var eyex=eye[0];var eyey=eye[1];var eyez=eye[2];var upx=up[0];var upy=up[1];var upz=up[2];var centerx=center[0];var centery=center[1];var centerz=center[2];if(Math.abs(eyex-centerx)0){len=1/Math.sqrt(len);z0*=len;z1*=len;z2*=len}var x0=upy*z2-upz*z1,x1=upz*z0-upx*z2,x2=upx*z1-upy*z0;len=x0*x0+x1*x1+x2*x2;if(len>0){len=1/Math.sqrt(len);x0*=len;x1*=len;x2*=len}out[0]=x0;out[1]=x1;out[2]=x2;out[3]=0;out[4]=z1*x2-z2*x1;out[5]=z2*x0-z0*x2;out[6]= +z0*x1-z1*x0;out[7]=0;out[8]=z0;out[9]=z1;out[10]=z2;out[11]=0;out[12]=eyex;out[13]=eyey;out[14]=eyez;out[15]=1;return out}function str$5(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"}function frob(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function add$5(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]= +a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];out[9]=a[9]+b[9];out[10]=a[10]+b[10];out[11]=a[11]+b[11];out[12]=a[12]+b[12];out[13]=a[13]+b[13];out[14]=a[14]+b[14];out[15]=a[15]+b[15];return out}function subtract$3(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]=a[8]-b[8];out[9]=a[9]-b[9];out[10]=a[10]-b[10];out[11]=a[11]-b[11];out[12]= +a[12]-b[12];out[13]=a[13]-b[13];out[14]=a[14]-b[14];out[15]=a[15]-b[15];return out}function multiplyScalar(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;out[9]=a[9]*b;out[10]=a[10]*b;out[11]=a[11]*b;out[12]=a[12]*b;out[13]=a[13]*b;out[14]=a[14]*b;out[15]=a[15]*b;return out}function multiplyScalarAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]= +a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;out[9]=a[9]+b[9]*scale;out[10]=a[10]+b[10]*scale;out[11]=a[11]+b[11]*scale;out[12]=a[12]+b[12]*scale;out[13]=a[13]+b[13]*scale;out[14]=a[14]+b[14]*scale;out[15]=a[15]+b[15]*scale;return out}function exactEquals$5(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]=== +b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]}function equals$5(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var a4=a[4],a5=a[5],a6=a[6],a7=a[7];var a8=a[8],a9=a[9],a10=a[10],a11=a[11];var a12=a[12],a13=a[13],a14=a[14],a15=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];var b4=b[4],b5=b[5],b6=b[6],b7=b[7];var b8=b[8],b9=b[9],b10=b[10],b11=b[11];var b12=b[12],b13=b[13],b14=b[14],b15=b[15];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1), +Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))&&Math.abs(a9-b9)<=EPSILON*Math.max(1,Math.abs(a9), +Math.abs(b9))&&Math.abs(a10-b10)<=EPSILON*Math.max(1,Math.abs(a10),Math.abs(b10))&&Math.abs(a11-b11)<=EPSILON*Math.max(1,Math.abs(a11),Math.abs(b11))&&Math.abs(a12-b12)<=EPSILON*Math.max(1,Math.abs(a12),Math.abs(b12))&&Math.abs(a13-b13)<=EPSILON*Math.max(1,Math.abs(a13),Math.abs(b13))&&Math.abs(a14-b14)<=EPSILON*Math.max(1,Math.abs(a14),Math.abs(b14))&&Math.abs(a15-b15)<=EPSILON*Math.max(1,Math.abs(a15),Math.abs(b15))}var mul$5=multiply$5;var sub$3=subtract$3;var mat4=Object.freeze({__proto__:null, +create:create$5,clone:clone$5,copy:copy$5,fromValues:fromValues$5,set:set$5,identity:identity$2,transpose:transpose,invert:invert$2,adjoint:adjoint,determinant:determinant,multiply:multiply$5,translate:translate$1,scale:scale$5,rotate:rotate$1,rotateX:rotateX$3,rotateY:rotateY$3,rotateZ:rotateZ$3,fromTranslation:fromTranslation$1,fromScaling:fromScaling,fromRotation:fromRotation$1,fromXRotation:fromXRotation,fromYRotation:fromYRotation,fromZRotation:fromZRotation,fromRotationTranslation:fromRotationTranslation$1, +fromQuat2:fromQuat2,getTranslation:getTranslation$1,getScaling:getScaling,getRotation:getRotation,decompose:decompose,fromRotationTranslationScale:fromRotationTranslationScale,fromRotationTranslationScaleOrigin:fromRotationTranslationScaleOrigin,fromQuat:fromQuat,frustum:frustum,perspectiveNO:perspectiveNO,perspective:perspective,perspectiveZO:perspectiveZO,perspectiveFromFieldOfView:perspectiveFromFieldOfView,orthoNO:orthoNO,ortho:ortho,orthoZO:orthoZO,lookAt:lookAt,targetTo:targetTo,str:str$5,frob:frob, +add:add$5,subtract:subtract$3,multiplyScalar:multiplyScalar,multiplyScalarAndAdd:multiplyScalarAndAdd,exactEquals:exactEquals$5,equals:equals$5,mul:mul$5,sub:sub$3});function create$4(){var out=new ARRAY_TYPE(3);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0;out[2]=0}return out}function clone$4(a){var out=new ARRAY_TYPE(3);out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function length$4(a){var x=a[0];var y=a[1];var z=a[2];return Math.hypot(x,y,z)}function fromValues$4(x,y,z){var out=new ARRAY_TYPE(3); +out[0]=x;out[1]=y;out[2]=z;return out}function copy$4(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function set$4(out,x,y,z){out[0]=x;out[1]=y;out[2]=z;return out}function add$4(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];return out}function subtract$2(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];return out}function multiply$4(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];return out}function divide$2(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1]; +out[2]=a[2]/b[2];return out}function ceil$2(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);out[2]=Math.ceil(a[2]);return out}function floor$2(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);out[2]=Math.floor(a[2]);return out}function min$2(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);return out}function max$2(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);return out}function round$2(out,a){out[0]= +Math.round(a[0]);out[1]=Math.round(a[1]);out[2]=Math.round(a[2]);return out}function scale$4(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;return out}function scaleAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;return out}function distance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return Math.hypot(x,y,z)}function squaredDistance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return x*x+y*y+z*z}function squaredLength$4(a){var x= +a[0];var y=a[1];var z=a[2];return x*x+y*y+z*z}function negate$2(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];return out}function inverse$2(out,a){out[0]=1/a[0];out[1]=1/a[1];out[2]=1/a[2];return out}function normalize$4(out,a){var x=a[0];var y=a[1];var z=a[2];var len=x*x+y*y+z*z;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len;return out}function dot$4(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function cross$2(out,a,b){var ax=a[0],ay=a[1],az=a[2];var bx=b[0],by=b[1], +bz=b[2];out[0]=ay*bz-az*by;out[1]=az*bx-ax*bz;out[2]=ax*by-ay*bx;return out}function lerp$4(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);return out}function slerp$1(out,a,b,t){var angle=Math.acos(Math.min(Math.max(dot$4(a,b),-1),1));var sinTotal=Math.sin(angle);var ratioA=Math.sin((1-t)*angle)/sinTotal;var ratioB=Math.sin(t*angle)/sinTotal;out[0]=ratioA*a[0]+ratioB*b[0];out[1]=ratioA*a[1]+ratioB*b[1];out[2]=ratioA*a[2]+ratioB*b[2]; +return out}function hermite(out,a,b,c,d,t){var factorTimes2=t*t;var factor1=factorTimes2*(2*t-3)+1;var factor2=factorTimes2*(t-2)+t;var factor3=factorTimes2*(t-1);var factor4=factorTimes2*(3-2*t);out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function bezier(out,a,b,c,d,t){var inverseFactor=1-t;var inverseFactorTimesTwo=inverseFactor*inverseFactor;var factorTimes2= +t*t;var factor1=inverseFactorTimesTwo*inverseFactor;var factor2=3*t*inverseFactorTimesTwo;var factor3=3*factorTimes2*inverseFactor;var factor4=factorTimes2*t;out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function random$3(out,scale){scale=scale||1;var r=RANDOM()*2*Math.PI;var z=RANDOM()*2-1;var zScale=Math.sqrt(1-z*z)*scale;out[0]=Math.cos(r)*zScale;out[1]= +Math.sin(r)*zScale;out[2]=z*scale;return out}function transformMat4$2(out,a,m){var x=a[0],y=a[1],z=a[2];var w=m[3]*x+m[7]*y+m[11]*z+m[15];w=w||1;out[0]=(m[0]*x+m[4]*y+m[8]*z+m[12])/w;out[1]=(m[1]*x+m[5]*y+m[9]*z+m[13])/w;out[2]=(m[2]*x+m[6]*y+m[10]*z+m[14])/w;return out}function transformMat3$1(out,a,m){var x=a[0],y=a[1],z=a[2];out[0]=x*m[0]+y*m[3]+z*m[6];out[1]=x*m[1]+y*m[4]+z*m[7];out[2]=x*m[2]+y*m[5]+z*m[8];return out}function transformQuat$1(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var x= +a[0],y=a[1],z=a[2];var uvx=qy*z-qz*y,uvy=qz*x-qx*z,uvz=qx*y-qy*x;var uuvx=qy*uvz-qz*uvy,uuvy=qz*uvx-qx*uvz,uuvz=qx*uvy-qy*uvx;var w2=qw*2;uvx*=w2;uvy*=w2;uvz*=w2;uuvx*=2;uuvy*=2;uuvz*=2;out[0]=x+uvx+uuvx;out[1]=y+uvy+uuvy;out[2]=z+uvz+uuvz;return out}function rotateX$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0];r[1]=p[1]*Math.cos(rad)-p[2]*Math.sin(rad);r[2]=p[1]*Math.sin(rad)+p[2]*Math.cos(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateY$2(out, +a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[2]*Math.sin(rad)+p[0]*Math.cos(rad);r[1]=p[1];r[2]=p[2]*Math.cos(rad)-p[0]*Math.sin(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateZ$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0]*Math.cos(rad)-p[1]*Math.sin(rad);r[1]=p[0]*Math.sin(rad)+p[1]*Math.cos(rad);r[2]=p[2];out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function angle$1(a,b){var ax= +a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2],mag=Math.sqrt((ax*ax+ay*ay+az*az)*(bx*bx+by*by+bz*bz)),cosine=mag&&dot$4(a,b)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero$2(out){out[0]=0;out[1]=0;out[2]=0;return out}function str$4(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"}function exactEquals$4(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]}function equals$4(a,b){var a0=a[0],a1=a[1],a2=a[2];var b0=b[0],b1=b[1],b2=b[2];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0), +Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))}var sub$2=subtract$2;var mul$4=multiply$4;var div$2=divide$2;var dist$2=distance$2;var sqrDist$2=squaredDistance$2;var len$4=length$4;var sqrLen$4=squaredLength$4;var forEach$2=function(){var vec=create$4();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=3;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length; +for(i=offset;i0)len=1/Math.sqrt(len);out[0]= +x*len;out[1]=y*len;out[2]=z*len;out[3]=w*len;return out}function dot$3(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cross$1(out,u,v,w){var A=v[0]*w[1]-v[1]*w[0],B=v[0]*w[2]-v[2]*w[0],C=v[0]*w[3]-v[3]*w[0],D=v[1]*w[2]-v[2]*w[1],E=v[1]*w[3]-v[3]*w[1],F=v[2]*w[3]-v[3]*w[2];var G=u[0];var H=u[1];var I=u[2];var J=u[3];out[0]=H*F-I*E+J*D;out[1]=-(G*F)+I*C-J*B;out[2]=G*E-H*C+J*A;out[3]=-(G*D)+H*B-I*A;return out}function lerp$3(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];var aw=a[3];out[0]= +ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);out[3]=aw+t*(b[3]-aw);return out}function random$2(out,scale){scale=scale||1;var v1,v2,v3,v4;var s1,s2;do{v1=RANDOM()*2-1;v2=RANDOM()*2-1;s1=v1*v1+v2*v2}while(s1>=1);do{v3=RANDOM()*2-1;v4=RANDOM()*2-1;s2=v3*v3+v4*v4}while(s2>=1);var d=Math.sqrt((1-s1)/s2);out[0]=scale*v1;out[1]=scale*v2;out[2]=scale*v3*d;out[3]=scale*v4*d;return out}function transformMat4$1(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w;out[1]= +m[1]*x+m[5]*y+m[9]*z+m[13]*w;out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w;out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w;return out}function transformQuat(out,a,q){var x=a[0],y=a[1],z=a[2];var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;out[3]=a[3];return out}function zero$1(out){out[0]=0;out[1]=0;out[2]=0;out[3]=0;return out}function str$3(a){return"vec4("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function exactEquals$3(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$3(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))}var sub$1=subtract$1; +var mul$3=multiply$3;var div$1=divide$1;var dist$1=distance$1;var sqrDist$1=squaredDistance$1;var len$3=length$3;var sqrLen$3=squaredLength$3;var forEach$1=function(){var vec=create$3();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=4;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length;for(i=offset;iEPSILON){out_axis[0]=q[0]/s;out_axis[1]=q[1]/s;out_axis[2]=q[2]/s}else{out_axis[0]=1;out_axis[1]=0;out_axis[2]=0}return rad}function getAngle(a,b){var dotproduct=dot$2(a,b);return Math.acos(2*dotproduct*dotproduct-1)}function multiply$2(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];out[0]=ax*bw+aw*bx+ay*bz-az*by;out[1]=ay*bw+aw*by+az*bx- +ax*bz;out[2]=az*bw+aw*bz+ax*by-ay*bx;out[3]=aw*bw-ax*bx-ay*by-az*bz;return out}function rotateX$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+aw*bx;out[1]=ay*bw+az*bx;out[2]=az*bw-ay*bx;out[3]=aw*bw-ax*bx;return out}function rotateY$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var by=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw-az*by;out[1]=ay*bw+aw*by;out[2]=az*bw+ax*by;out[3]=aw*bw-ay*by;return out}function rotateZ$1(out,a, +rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bz=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+ay*bz;out[1]=ay*bw-ax*bz;out[2]=az*bw+aw*bz;out[3]=aw*bw-az*bz;return out}function calculateW(out,a){var x=a[0],y=a[1],z=a[2];out[0]=x;out[1]=y;out[2]=z;out[3]=Math.sqrt(Math.abs(1-x*x-y*y-z*z));return out}function exp(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var et=Math.exp(w);var s=r>0?et*Math.sin(r)/r:0;out[0]=x*s;out[1]=y*s;out[2]=z*s;out[3]=et*Math.cos(r);return out} +function ln(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var t=r>0?Math.atan2(r,w)/r:0;out[0]=x*t;out[1]=y*t;out[2]=z*t;out[3]=.5*Math.log(x*x+y*y+z*z+w*w);return out}function pow(out,a,b){ln(out,a);scale$2(out,out,b);exp(out,out);return out}function slerp(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];var omega,cosom,sinom,scale0,scale1;cosom=ax*bx+ay*by+az*bz+aw*bw;if(cosom<0){cosom=-cosom;bx=-bx;by=-by;bz=-bz;bw=-bw}if(1-cosom>EPSILON){omega= +Math.acos(cosom);sinom=Math.sin(omega);scale0=Math.sin((1-t)*omega)/sinom;scale1=Math.sin(t*omega)/sinom}else{scale0=1-t;scale1=t}out[0]=scale0*ax+scale1*bx;out[1]=scale0*ay+scale1*by;out[2]=scale0*az+scale1*bz;out[3]=scale0*aw+scale1*bw;return out}function random$1(out){var u1=RANDOM();var u2=RANDOM();var u3=RANDOM();var sqrt1MinusU1=Math.sqrt(1-u1);var sqrtU1=Math.sqrt(u1);out[0]=sqrt1MinusU1*Math.sin(2*Math.PI*u2);out[1]=sqrt1MinusU1*Math.cos(2*Math.PI*u2);out[2]=sqrtU1*Math.sin(2*Math.PI*u3); +out[3]=sqrtU1*Math.cos(2*Math.PI*u3);return out}function invert$1(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var dot=a0*a0+a1*a1+a2*a2+a3*a3;var invDot=dot?1/dot:0;out[0]=-a0*invDot;out[1]=-a1*invDot;out[2]=-a2*invDot;out[3]=a3*invDot;return out}function conjugate$1(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=a[3];return out}function fromMat3(out,m){var fTrace=m[0]+m[4]+m[8];var fRoot;if(fTrace>0){fRoot=Math.sqrt(fTrace+1);out[3]=.5*fRoot;fRoot=.5/fRoot;out[0]=(m[5]-m[7])*fRoot;out[1]=(m[6]- +m[2])*fRoot;out[2]=(m[1]-m[3])*fRoot}else{var i=0;if(m[4]>m[0])i=1;if(m[8]>m[i*3+i])i=2;var j=(i+1)%3;var k=(i+2)%3;fRoot=Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k]+1);out[i]=.5*fRoot;fRoot=.5/fRoot;out[3]=(m[j*3+k]-m[k*3+j])*fRoot;out[j]=(m[j*3+i]+m[i*3+j])*fRoot;out[k]=(m[k*3+i]+m[i*3+k])*fRoot}return out}function fromEuler(out,x,y,z){var order=arguments.length>4&&arguments[4]!==undefined?arguments[4]:ANGLE_ORDER;var halfToRad=Math.PI/360;x*=halfToRad;z*=halfToRad;y*=halfToRad;var sx=Math.sin(x);var cx= +Math.cos(x);var sy=Math.sin(y);var cy=Math.cos(y);var sz=Math.sin(z);var cz=Math.cos(z);switch(order){case "xyz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "xzy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yxz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yzx":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy* +cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zxy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zyx":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;default:throw new Error("Unknown angle order "+order);}return out}function str$2(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}var clone$2=clone$3;var fromValues$2=fromValues$3;var copy$2=copy$3; +var set$2=set$3;var add$2=add$3;var mul$2=multiply$2;var scale$2=scale$3;var dot$2=dot$3;var lerp$2=lerp$3;var length$2=length$3;var len$2=length$2;var squaredLength$2=squaredLength$3;var sqrLen$2=squaredLength$2;var normalize$2=normalize$3;var exactEquals$2=exactEquals$3;function equals$2(a,b){return Math.abs(dot$3(a,b))>=1-EPSILON}var rotationTo=function(){var tmpvec3=create$4();var xUnitVec3=fromValues$4(1,0,0);var yUnitVec3=fromValues$4(0,1,0);return function(out,a,b){var dot=dot$4(a,b);if(dot< +-.999999){cross$2(tmpvec3,xUnitVec3,a);if(len$4(tmpvec3)<1E-6)cross$2(tmpvec3,yUnitVec3,a);normalize$4(tmpvec3,tmpvec3);setAxisAngle(out,tmpvec3,Math.PI);return out}else if(dot>.999999){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out}else{cross$2(tmpvec3,a,b);out[0]=tmpvec3[0];out[1]=tmpvec3[1];out[2]=tmpvec3[2];out[3]=1+dot;return normalize$2(out,out)}}}();var sqlerp=function(){var temp1=create$2();var temp2=create$2();return function(out,a,b,c,d,t){slerp(temp1,a,d,t);slerp(temp2,b,c,t);slerp(out, +temp1,temp2,2*t*(1-t));return out}}();var setAxes=function(){var matr=create$6();return function(out,view,right,up){matr[0]=right[0];matr[3]=right[1];matr[6]=right[2];matr[1]=up[0];matr[4]=up[1];matr[7]=up[2];matr[2]=-view[0];matr[5]=-view[1];matr[8]=-view[2];return normalize$2(out,fromMat3(out,matr))}}();var quat=Object.freeze({__proto__:null,create:create$2,identity:identity$1,setAxisAngle:setAxisAngle,getAxisAngle:getAxisAngle,getAngle:getAngle,multiply:multiply$2,rotateX:rotateX$1,rotateY:rotateY$1, +rotateZ:rotateZ$1,calculateW:calculateW,exp:exp,ln:ln,pow:pow,slerp:slerp,random:random$1,invert:invert$1,conjugate:conjugate$1,fromMat3:fromMat3,fromEuler:fromEuler,str:str$2,clone:clone$2,fromValues:fromValues$2,copy:copy$2,set:set$2,add:add$2,mul:mul$2,scale:scale$2,dot:dot$2,lerp:lerp$2,length:length$2,len:len$2,squaredLength:squaredLength$2,sqrLen:sqrLen$2,normalize:normalize$2,exactEquals:exactEquals$2,equals:equals$2,rotationTo:rotationTo,sqlerp:sqlerp,setAxes:setAxes});function create$1(){var dq= +new ARRAY_TYPE(8);if(ARRAY_TYPE!=Float32Array){dq[0]=0;dq[1]=0;dq[2]=0;dq[4]=0;dq[5]=0;dq[6]=0;dq[7]=0}dq[3]=1;return dq}function clone$1(a){var dq=new ARRAY_TYPE(8);dq[0]=a[0];dq[1]=a[1];dq[2]=a[2];dq[3]=a[3];dq[4]=a[4];dq[5]=a[5];dq[6]=a[6];dq[7]=a[7];return dq}function fromValues$1(x1,y1,z1,w1,x2,y2,z2,w2){var dq=new ARRAY_TYPE(8);dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;dq[4]=x2;dq[5]=y2;dq[6]=z2;dq[7]=w2;return dq}function fromRotationTranslationValues(x1,y1,z1,w1,x2,y2,z2){var dq=new ARRAY_TYPE(8); +dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;var ax=x2*.5,ay=y2*.5,az=z2*.5;dq[4]=ax*w1+ay*z1-az*y1;dq[5]=ay*w1+az*x1-ax*z1;dq[6]=az*w1+ax*y1-ay*x1;dq[7]=-ax*x1-ay*y1-az*z1;return dq}function fromRotationTranslation(out,q,t){var ax=t[0]*.5,ay=t[1]*.5,az=t[2]*.5,bx=q[0],by=q[1],bz=q[2],bw=q[3];out[0]=bx;out[1]=by;out[2]=bz;out[3]=bw;out[4]=ax*bw+ay*bz-az*by;out[5]=ay*bw+az*bx-ax*bz;out[6]=az*bw+ax*by-ay*bx;out[7]=-ax*bx-ay*by-az*bz;return out}function fromTranslation(out,t){out[0]=0;out[1]=0;out[2]=0;out[3]= +1;out[4]=t[0]*.5;out[5]=t[1]*.5;out[6]=t[2]*.5;out[7]=0;return out}function fromRotation(out,q){out[0]=q[0];out[1]=q[1];out[2]=q[2];out[3]=q[3];out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function fromMat4(out,a){var outer=create$2();getRotation(outer,a);var t=new ARRAY_TYPE(3);getTranslation$1(t,a);fromRotationTranslation(out,outer,t);return out}function copy$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];return out}function identity(out){out[0]= +0;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function set$1(out,x1,y1,z1,w1,x2,y2,z2,w2){out[0]=x1;out[1]=y1;out[2]=z1;out[3]=w1;out[4]=x2;out[5]=y2;out[6]=z2;out[7]=w2;return out}var getReal=copy$2;function getDual(out,a){out[0]=a[4];out[1]=a[5];out[2]=a[6];out[3]=a[7];return out}var setReal=copy$2;function setDual(out,q){out[4]=q[0];out[5]=q[1];out[6]=q[2];out[7]=q[3];return out}function getTranslation(out,a){var ax=a[4],ay=a[5],az=a[6],aw=a[7],bx=-a[0],by=-a[1],bz= +-a[2],bw=a[3];out[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;out[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;out[2]=(az*bw+aw*bz+ax*by-ay*bx)*2;return out}function translate(out,a,v){var ax1=a[0],ay1=a[1],az1=a[2],aw1=a[3],bx1=v[0]*.5,by1=v[1]*.5,bz1=v[2]*.5,ax2=a[4],ay2=a[5],az2=a[6],aw2=a[7];out[0]=ax1;out[1]=ay1;out[2]=az1;out[3]=aw1;out[4]=aw1*bx1+ay1*bz1-az1*by1+ax2;out[5]=aw1*by1+az1*bx1-ax1*bz1+ay2;out[6]=aw1*bz1+ax1*by1-ay1*bx1+az2;out[7]=-ax1*bx1-ay1*by1-az1*bz1+aw2;return out}function rotateX(out,a,rad){var bx= +-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateX$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateY(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ +ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateY$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateZ(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw- +ax*bx-ay*by-az*bz;rotateZ$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateByQuatAppend(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],ax=a[0],ay=a[1],az=a[2],aw=a[3];out[0]=ax*qw+aw*qx+ay*qz-az*qy;out[1]=ay*qw+aw*qy+az*qx-ax*qz;out[2]=az*qw+aw*qz+ax*qy-ay*qx;out[3]=aw*qw-ax*qx-ay*qy-az*qz;ax=a[4];ay=a[5];az=a[6];aw=a[7];out[4]=ax* +qw+aw*qx+ay*qz-az*qy;out[5]=ay*qw+aw*qy+az*qx-ax*qz;out[6]=az*qw+aw*qz+ax*qy-ay*qx;out[7]=aw*qw-ax*qx-ay*qy-az*qz;return out}function rotateByQuatPrepend(out,q,a){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],bx=a[0],by=a[1],bz=a[2],bw=a[3];out[0]=qx*bw+qw*bx+qy*bz-qz*by;out[1]=qy*bw+qw*by+qz*bx-qx*bz;out[2]=qz*bw+qw*bz+qx*by-qy*bx;out[3]=qw*bw-qx*bx-qy*by-qz*bz;bx=a[4];by=a[5];bz=a[6];bw=a[7];out[4]=qx*bw+qw*bx+qy*bz-qz*by;out[5]=qy*bw+qw*by+qz*bx-qx*bz;out[6]=qz*bw+qw*bz+qx*by-qy*bx;out[7]=qw*bw-qx*bx-qy* +by-qz*bz;return out}function rotateAroundAxis(out,a,axis,rad){if(Math.abs(rad)0){magnitude=Math.sqrt(magnitude);var a0=a[0]/magnitude;var a1=a[1]/magnitude;var a2=a[2]/magnitude;var a3= +a[3]/magnitude;var b0=a[4];var b1=a[5];var b2=a[6];var b3=a[7];var a_dot_b=a0*b0+a1*b1+a2*b2+a3*b3;out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=(b0-a0*a_dot_b)/magnitude;out[5]=(b1-a1*a_dot_b)/magnitude;out[6]=(b2-a2*a_dot_b)/magnitude;out[7]=(b3-a3*a_dot_b)/magnitude}return out}function str$1(a){return"quat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+")"}function exactEquals$1(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]=== +b[5]&&a[6]===b[6]&&a[7]===b[7]}function equals$1(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4), +Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))}var quat2=Object.freeze({__proto__:null,create:create$1,clone:clone$1,fromValues:fromValues$1,fromRotationTranslationValues:fromRotationTranslationValues,fromRotationTranslation:fromRotationTranslation,fromTranslation:fromTranslation,fromRotation:fromRotation,fromMat4:fromMat4,copy:copy$1,identity:identity, +set:set$1,getReal:getReal,getDual:getDual,setReal:setReal,setDual:setDual,getTranslation:getTranslation,translate:translate,rotateX:rotateX,rotateY:rotateY,rotateZ:rotateZ,rotateByQuatAppend:rotateByQuatAppend,rotateByQuatPrepend:rotateByQuatPrepend,rotateAroundAxis:rotateAroundAxis,add:add$1,multiply:multiply$1,mul:mul$1,scale:scale$1,dot:dot$1,lerp:lerp$1,invert:invert,conjugate:conjugate,length:length$1,len:len$1,squaredLength:squaredLength$1,sqrLen:sqrLen$1,normalize:normalize$1,str:str$1,exactEquals:exactEquals$1, +equals:equals$1});function create(){var out=new ARRAY_TYPE(2);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0}return out}function clone(a){var out=new ARRAY_TYPE(2);out[0]=a[0];out[1]=a[1];return out}function fromValues(x,y){var out=new ARRAY_TYPE(2);out[0]=x;out[1]=y;return out}function copy(out,a){out[0]=a[0];out[1]=a[1];return out}function set(out,x,y){out[0]=x;out[1]=y;return out}function add(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];return out}function subtract(out,a,b){out[0]=a[0]-b[0];out[1]= +a[1]-b[1];return out}function multiply(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];return out}function divide(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];return out}function ceil(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);return out}function floor(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);return out}function min(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);return out}function max(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);return out}function round(out, +a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);return out}function scale(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;return out}function scaleAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;return out}function distance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.hypot(x,y)}function squaredDistance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y}function length(a){var x=a[0],y=a[1];return Math.hypot(x,y)}function squaredLength(a){var x=a[0],y=a[1];return x*x+y*y}function negate(out, +a){out[0]=-a[0];out[1]=-a[1];return out}function inverse(out,a){out[0]=1/a[0];out[1]=1/a[1];return out}function normalize(out,a){var x=a[0],y=a[1];var len=x*x+y*y;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;return out}function dot(a,b){return a[0]*b[0]+a[1]*b[1]}function cross(out,a,b){var z=a[0]*b[1]-a[1]*b[0];out[0]=out[1]=0;out[2]=z;return out}function lerp(out,a,b,t){var ax=a[0],ay=a[1];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);return out}function random(out,scale){scale=scale|| +1;var r=RANDOM()*2*Math.PI;out[0]=Math.cos(r)*scale;out[1]=Math.sin(r)*scale;return out}function transformMat2(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y;out[1]=m[1]*x+m[3]*y;return out}function transformMat2d(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y+m[4];out[1]=m[1]*x+m[3]*y+m[5];return out}function transformMat3(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[3]*y+m[6];out[1]=m[1]*x+m[4]*y+m[7];return out}function transformMat4(out,a,m){var x=a[0];var y=a[1];out[0]=m[0]*x+m[4]*y+m[12];out[1]= +m[1]*x+m[5]*y+m[13];return out}function rotate(out,a,b,rad){var p0=a[0]-b[0],p1=a[1]-b[1],sinC=Math.sin(rad),cosC=Math.cos(rad);out[0]=p0*cosC-p1*sinC+b[0];out[1]=p0*sinC+p1*cosC+b[1];return out}function angle(a,b){var x1=a[0],y1=a[1],x2=b[0],y2=b[1],mag=Math.sqrt((x1*x1+y1*y1)*(x2*x2+y2*y2)),cosine=mag&&(x1*x2+y1*y2)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero(out){out[0]=0;out[1]=0;return out}function str(a){return"vec2("+a[0]+", "+a[1]+")"}function exactEquals(a,b){return a[0]=== +b[0]&&a[1]===b[1]}function equals(a,b){var a0=a[0],a1=a[1];var b0=b[0],b1=b[1];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))}var len=length;var sub=subtract;var mul=multiply;var div=divide;var dist=distance;var sqrDist=squaredDistance;var sqrLen=squaredLength;var forEach=function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=2;if(!offset)offset=0;if(count)l=Math.min(count* +stride+offset,a.length);else l=a.length;for(i=offset;i=b&&c=a?1024*(d-55296)+(a-56320)+65536:d}return 56320<=b&&57343>=b&&1<=c?(d=a.charCodeAt(c-1),a=b,55296<=d&&56319>=d?1024*(d-55296)+(a-56320)+65536:a):b}function l(a,c,b){var d=[a].concat(c).concat([b]),e=d[d.length-2],g=d.lastIndexOf(14);if(1=a||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&70083>=a||72250==a||72326<=a&&72329>=a||73030==a?12:13==a?0:10==a?1:0<=a&&9>=a||11<=a&&12>=a||14<=a&&31>=a||127<=a&&159>=a||173==a||1564==a||6158==a||8203==a||8206<=a&&8207>=a||8232==a||8233==a||8234<=a&&8238>=a||8288<=a&&8292>=a||8293==a||8294<=a&&8303>=a||55296<=a&&57343>=a||65279==a||65520<= +a&&65528>=a||65529<=a&&65531>=a||113824<=a&&113827>=a||119155<=a&&119162>=a||917504==a||917505==a||917506<=a&&917535>=a||917632<=a&&917759>=a||918E3<=a&&921599>=a?2:768<=a&&879>=a||1155<=a&&1159>=a||1160<=a&&1161>=a||1425<=a&&1469>=a||1471==a||1473<=a&&1474>=a||1476<=a&&1477>=a||1479==a||1552<=a&&1562>=a||1611<=a&&1631>=a||1648==a||1750<=a&&1756>=a||1759<=a&&1764>=a||1767<=a&&1768>=a||1770<=a&&1773>=a||1809==a||1840<=a&&1866>=a||1958<=a&&1968>=a||2027<=a&&2035>=a||2070<=a&&2073>=a||2075<=a&&2083>= +a||2085<=a&&2087>=a||2089<=a&&2093>=a||2137<=a&&2139>=a||2260<=a&&2273>=a||2275<=a&&2306>=a||2362==a||2364==a||2369<=a&&2376>=a||2381==a||2385<=a&&2391>=a||2402<=a&&2403>=a||2433==a||2492==a||2494==a||2497<=a&&2500>=a||2509==a||2519==a||2530<=a&&2531>=a||2561<=a&&2562>=a||2620==a||2625<=a&&2626>=a||2631<=a&&2632>=a||2635<=a&&2637>=a||2641==a||2672<=a&&2673>=a||2677==a||2689<=a&&2690>=a||2748==a||2753<=a&&2757>=a||2759<=a&&2760>=a||2765==a||2786<=a&&2787>=a||2810<=a&&2815>=a||2817==a||2876==a||2878== +a||2879==a||2881<=a&&2884>=a||2893==a||2902==a||2903==a||2914<=a&&2915>=a||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&3136>=a||3142<=a&&3144>=a||3146<=a&&3149>=a||3157<=a&&3158>=a||3170<=a&&3171>=a||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&3277>=a||3285<=a&&3286>=a||3298<=a&&3299>=a||3328<=a&&3329>=a||3387<=a&&3388>=a||3390==a||3393<=a&&3396>=a||3405==a||3415==a||3426<=a&&3427>=a||3530==a||3535==a||3538<=a&&3540>=a||3542==a||3551==a||3633==a||3636<=a&&3642>=a||3655<= +a&&3662>=a||3761==a||3764<=a&&3769>=a||3771<=a&&3772>=a||3784<=a&&3789>=a||3864<=a&&3865>=a||3893==a||3895==a||3897==a||3953<=a&&3966>=a||3968<=a&&3972>=a||3974<=a&&3975>=a||3981<=a&&3991>=a||3993<=a&&4028>=a||4038==a||4141<=a&&4144>=a||4146<=a&&4151>=a||4153<=a&&4154>=a||4157<=a&&4158>=a||4184<=a&&4185>=a||4190<=a&&4192>=a||4209<=a&&4212>=a||4226==a||4229<=a&&4230>=a||4237==a||4253==a||4957<=a&&4959>=a||5906<=a&&5908>=a||5938<=a&&5940>=a||5970<=a&&5971>=a||6002<=a&&6003>=a||6068<=a&&6069>=a||6071<= +a&&6077>=a||6086==a||6089<=a&&6099>=a||6109==a||6155<=a&&6157>=a||6277<=a&&6278>=a||6313==a||6432<=a&&6434>=a||6439<=a&&6440>=a||6450==a||6457<=a&&6459>=a||6679<=a&&6680>=a||6683==a||6742==a||6744<=a&&6750>=a||6752==a||6754==a||6757<=a&&6764>=a||6771<=a&&6780>=a||6783==a||6832<=a&&6845>=a||6846==a||6912<=a&&6915>=a||6964==a||6966<=a&&6970>=a||6972==a||6978==a||7019<=a&&7027>=a||7040<=a&&7041>=a||7074<=a&&7077>=a||7080<=a&&7081>=a||7083<=a&&7085>=a||7142==a||7144<=a&&7145>=a||7149==a||7151<=a&&7153>= +a||7212<=a&&7219>=a||7222<=a&&7223>=a||7376<=a&&7378>=a||7380<=a&&7392>=a||7394<=a&&7400>=a||7405==a||7412==a||7416<=a&&7417>=a||7616<=a&&7673>=a||7675<=a&&7679>=a||8204==a||8400<=a&&8412>=a||8413<=a&&8416>=a||8417==a||8418<=a&&8420>=a||8421<=a&&8432>=a||11503<=a&&11505>=a||11647==a||11744<=a&&11775>=a||12330<=a&&12333>=a||12334<=a&&12335>=a||12441<=a&&12442>=a||42607==a||42608<=a&&42610>=a||42612<=a&&42621>=a||42654<=a&&42655>=a||42736<=a&&42737>=a||43010==a||43014==a||43019==a||43045<=a&&43046>= +a||43204<=a&&43205>=a||43232<=a&&43249>=a||43302<=a&&43309>=a||43335<=a&&43345>=a||43392<=a&&43394>=a||43443==a||43446<=a&&43449>=a||43452==a||43493==a||43561<=a&&43566>=a||43569<=a&&43570>=a||43573<=a&&43574>=a||43587==a||43596==a||43644==a||43696==a||43698<=a&&43700>=a||43703<=a&&43704>=a||43710<=a&&43711>=a||43713==a||43756<=a&&43757>=a||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&65039>=a||65056<=a&&65071>=a||65438<=a&&65439>=a||66045==a||66272==a||66422<=a&&66426>=a||68097<=a&& +68099>=a||68101<=a&&68102>=a||68108<=a&&68111>=a||68152<=a&&68154>=a||68159==a||68325<=a&&68326>=a||69633==a||69688<=a&&69702>=a||69759<=a&&69761>=a||69811<=a&&69814>=a||69817<=a&&69818>=a||69888<=a&&69890>=a||69927<=a&&69931>=a||69933<=a&&69940>=a||70003==a||70016<=a&&70017>=a||70070<=a&&70078>=a||70090<=a&&70092>=a||70191<=a&&70193>=a||70196==a||70198<=a&&70199>=a||70206==a||70367==a||70371<=a&&70378>=a||70400<=a&&70401>=a||70460==a||70462==a||70464==a||70487==a||70502<=a&&70508>=a||70512<=a&&70516>= +a||70712<=a&&70719>=a||70722<=a&&70724>=a||70726==a||70832==a||70835<=a&&70840>=a||70842==a||70845==a||70847<=a&&70848>=a||70850<=a&&70851>=a||71087==a||71090<=a&&71093>=a||71100<=a&&71101>=a||71103<=a&&71104>=a||71132<=a&&71133>=a||71219<=a&&71226>=a||71229==a||71231<=a&&71232>=a||71339==a||71341==a||71344<=a&&71349>=a||71351==a||71453<=a&&71455>=a||71458<=a&&71461>=a||71463<=a&&71467>=a||72193<=a&&72198>=a||72201<=a&&72202>=a||72243<=a&&72248>=a||72251<=a&&72254>=a||72263==a||72273<=a&&72278>=a|| +72281<=a&&72283>=a||72330<=a&&72342>=a||72344<=a&&72345>=a||72752<=a&&72758>=a||72760<=a&&72765>=a||72767==a||72850<=a&&72871>=a||72874<=a&&72880>=a||72882<=a&&72883>=a||72885<=a&&72886>=a||73009<=a&&73014>=a||73018==a||73020<=a&&73021>=a||73023<=a&&73029>=a||73031==a||92912<=a&&92916>=a||92976<=a&&92982>=a||94095<=a&&94098>=a||113821<=a&&113822>=a||119141==a||119143<=a&&119145>=a||119150<=a&&119154>=a||119163<=a&&119170>=a||119173<=a&&119179>=a||119210<=a&&119213>=a||119362<=a&&119364>=a||121344<= +a&&121398>=a||121403<=a&&121452>=a||121461==a||121476==a||121499<=a&&121503>=a||121505<=a&&121519>=a||122880<=a&&122886>=a||122888<=a&&122904>=a||122907<=a&&122913>=a||122915<=a&&122916>=a||122918<=a&&122922>=a||125136<=a&&125142>=a||125252<=a&&125258>=a||917536<=a&&917631>=a||917760<=a&&917999>=a?3:127462<=a&&127487>=a?4:2307==a||2363==a||2366<=a&&2368>=a||2377<=a&&2380>=a||2382<=a&&2383>=a||2434<=a&&2435>=a||2495<=a&&2496>=a||2503<=a&&2504>=a||2507<=a&&2508>=a||2563==a||2622<=a&&2624>=a||2691== +a||2750<=a&&2752>=a||2761==a||2763<=a&&2764>=a||2818<=a&&2819>=a||2880==a||2887<=a&&2888>=a||2891<=a&&2892>=a||3007==a||3009<=a&&3010>=a||3014<=a&&3016>=a||3018<=a&&3020>=a||3073<=a&&3075>=a||3137<=a&&3140>=a||3202<=a&&3203>=a||3262==a||3264<=a&&3265>=a||3267<=a&&3268>=a||3271<=a&&3272>=a||3274<=a&&3275>=a||3330<=a&&3331>=a||3391<=a&&3392>=a||3398<=a&&3400>=a||3402<=a&&3404>=a||3458<=a&&3459>=a||3536<=a&&3537>=a||3544<=a&&3550>=a||3570<=a&&3571>=a||3635==a||3763==a||3902<=a&&3903>=a||3967==a||4145== +a||4155<=a&&4156>=a||4182<=a&&4183>=a||4228==a||6070==a||6078<=a&&6085>=a||6087<=a&&6088>=a||6435<=a&&6438>=a||6441<=a&&6443>=a||6448<=a&&6449>=a||6451<=a&&6456>=a||6681<=a&&6682>=a||6741==a||6743==a||6765<=a&&6770>=a||6916==a||6965==a||6971==a||6973<=a&&6977>=a||6979<=a&&6980>=a||7042==a||7073==a||7078<=a&&7079>=a||7082==a||7143==a||7146<=a&&7148>=a||7150==a||7154<=a&&7155>=a||7204<=a&&7211>=a||7220<=a&&7221>=a||7393==a||7410<=a&&7411>=a||7415==a||43043<=a&&43044>=a||43047==a||43136<=a&&43137>=a|| +43188<=a&&43203>=a||43346<=a&&43347>=a||43395==a||43444<=a&&43445>=a||43450<=a&&43451>=a||43453<=a&&43456>=a||43567<=a&&43568>=a||43571<=a&&43572>=a||43597==a||43755==a||43758<=a&&43759>=a||43765==a||44003<=a&&44004>=a||44006<=a&&44007>=a||44009<=a&&44010>=a||44012==a||69632==a||69634==a||69762==a||69808<=a&&69810>=a||69815<=a&&69816>=a||69932==a||70018==a||70067<=a&&70069>=a||70079<=a&&70080>=a||70188<=a&&70190>=a||70194<=a&&70195>=a||70197==a||70368<=a&&70370>=a||70402<=a&&70403>=a||70463==a||70465<= +a&&70468>=a||70471<=a&&70472>=a||70475<=a&&70477>=a||70498<=a&&70499>=a||70709<=a&&70711>=a||70720<=a&&70721>=a||70725==a||70833<=a&&70834>=a||70841==a||70843<=a&&70844>=a||70846==a||70849==a||71088<=a&&71089>=a||71096<=a&&71099>=a||71102==a||71216<=a&&71218>=a||71227<=a&&71228>=a||71230==a||71340==a||71342<=a&&71343>=a||71350==a||71456<=a&&71457>=a||71462==a||72199<=a&&72200>=a||72249==a||72279<=a&&72280>=a||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&94078>=a||119142== +a||119149==a?5:4352<=a&&4447>=a||43360<=a&&43388>=a?6:4448<=a&&4519>=a||55216<=a&&55238>=a?7:4520<=a&&4607>=a||55243<=a&&55291>=a?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a|| +45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468== +a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47E3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a|| +47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296== +a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a|| +50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124== +a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a|| +53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54E3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952== +a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&44059>=a||44061<=a&&44087>=a||44089<=a&&44115>=a||44117<=a&&44143>=a||44145<=a&&44171>=a||44173<=a&&44199>=a||44201<=a&&44227>=a||44229<=a&&44255>=a||44257<=a&&44283>=a||44285<=a&&44311>=a||44313<=a&&44339>=a||44341<=a&&44367>=a||44369<=a&&44395>=a||44397<=a&&44423>=a||44425<=a&&44451>=a||44453<=a&&44479>=a||44481<=a&&44507>=a||44509<=a&&44535>=a||44537<=a&&44563>=a||44565<=a&&44591>=a||44593<=a&&44619>= +a||44621<=a&&44647>=a||44649<=a&&44675>=a||44677<=a&&44703>=a||44705<=a&&44731>=a||44733<=a&&44759>=a||44761<=a&&44787>=a||44789<=a&&44815>=a||44817<=a&&44843>=a||44845<=a&&44871>=a||44873<=a&&44899>=a||44901<=a&&44927>=a||44929<=a&&44955>=a||44957<=a&&44983>=a||44985<=a&&45011>=a||45013<=a&&45039>=a||45041<=a&&45067>=a||45069<=a&&45095>=a||45097<=a&&45123>=a||45125<=a&&45151>=a||45153<=a&&45179>=a||45181<=a&&45207>=a||45209<=a&&45235>=a||45237<=a&&45263>=a||45265<=a&&45291>=a||45293<=a&&45319>=a|| +45321<=a&&45347>=a||45349<=a&&45375>=a||45377<=a&&45403>=a||45405<=a&&45431>=a||45433<=a&&45459>=a||45461<=a&&45487>=a||45489<=a&&45515>=a||45517<=a&&45543>=a||45545<=a&&45571>=a||45573<=a&&45599>=a||45601<=a&&45627>=a||45629<=a&&45655>=a||45657<=a&&45683>=a||45685<=a&&45711>=a||45713<=a&&45739>=a||45741<=a&&45767>=a||45769<=a&&45795>=a||45797<=a&&45823>=a||45825<=a&&45851>=a||45853<=a&&45879>=a||45881<=a&&45907>=a||45909<=a&&45935>=a||45937<=a&&45963>=a||45965<=a&&45991>=a||45993<=a&&46019>=a||46021<= +a&&46047>=a||46049<=a&&46075>=a||46077<=a&&46103>=a||46105<=a&&46131>=a||46133<=a&&46159>=a||46161<=a&&46187>=a||46189<=a&&46215>=a||46217<=a&&46243>=a||46245<=a&&46271>=a||46273<=a&&46299>=a||46301<=a&&46327>=a||46329<=a&&46355>=a||46357<=a&&46383>=a||46385<=a&&46411>=a||46413<=a&&46439>=a||46441<=a&&46467>=a||46469<=a&&46495>=a||46497<=a&&46523>=a||46525<=a&&46551>=a||46553<=a&&46579>=a||46581<=a&&46607>=a||46609<=a&&46635>=a||46637<=a&&46663>=a||46665<=a&&46691>=a||46693<=a&&46719>=a||46721<=a&& +46747>=a||46749<=a&&46775>=a||46777<=a&&46803>=a||46805<=a&&46831>=a||46833<=a&&46859>=a||46861<=a&&46887>=a||46889<=a&&46915>=a||46917<=a&&46943>=a||46945<=a&&46971>=a||46973<=a&&46999>=a||47001<=a&&47027>=a||47029<=a&&47055>=a||47057<=a&&47083>=a||47085<=a&&47111>=a||47113<=a&&47139>=a||47141<=a&&47167>=a||47169<=a&&47195>=a||47197<=a&&47223>=a||47225<=a&&47251>=a||47253<=a&&47279>=a||47281<=a&&47307>=a||47309<=a&&47335>=a||47337<=a&&47363>=a||47365<=a&&47391>=a||47393<=a&&47419>=a||47421<=a&&47447>= +a||47449<=a&&47475>=a||47477<=a&&47503>=a||47505<=a&&47531>=a||47533<=a&&47559>=a||47561<=a&&47587>=a||47589<=a&&47615>=a||47617<=a&&47643>=a||47645<=a&&47671>=a||47673<=a&&47699>=a||47701<=a&&47727>=a||47729<=a&&47755>=a||47757<=a&&47783>=a||47785<=a&&47811>=a||47813<=a&&47839>=a||47841<=a&&47867>=a||47869<=a&&47895>=a||47897<=a&&47923>=a||47925<=a&&47951>=a||47953<=a&&47979>=a||47981<=a&&48007>=a||48009<=a&&48035>=a||48037<=a&&48063>=a||48065<=a&&48091>=a||48093<=a&&48119>=a||48121<=a&&48147>=a|| +48149<=a&&48175>=a||48177<=a&&48203>=a||48205<=a&&48231>=a||48233<=a&&48259>=a||48261<=a&&48287>=a||48289<=a&&48315>=a||48317<=a&&48343>=a||48345<=a&&48371>=a||48373<=a&&48399>=a||48401<=a&&48427>=a||48429<=a&&48455>=a||48457<=a&&48483>=a||48485<=a&&48511>=a||48513<=a&&48539>=a||48541<=a&&48567>=a||48569<=a&&48595>=a||48597<=a&&48623>=a||48625<=a&&48651>=a||48653<=a&&48679>=a||48681<=a&&48707>=a||48709<=a&&48735>=a||48737<=a&&48763>=a||48765<=a&&48791>=a||48793<=a&&48819>=a||48821<=a&&48847>=a||48849<= +a&&48875>=a||48877<=a&&48903>=a||48905<=a&&48931>=a||48933<=a&&48959>=a||48961<=a&&48987>=a||48989<=a&&49015>=a||49017<=a&&49043>=a||49045<=a&&49071>=a||49073<=a&&49099>=a||49101<=a&&49127>=a||49129<=a&&49155>=a||49157<=a&&49183>=a||49185<=a&&49211>=a||49213<=a&&49239>=a||49241<=a&&49267>=a||49269<=a&&49295>=a||49297<=a&&49323>=a||49325<=a&&49351>=a||49353<=a&&49379>=a||49381<=a&&49407>=a||49409<=a&&49435>=a||49437<=a&&49463>=a||49465<=a&&49491>=a||49493<=a&&49519>=a||49521<=a&&49547>=a||49549<=a&& +49575>=a||49577<=a&&49603>=a||49605<=a&&49631>=a||49633<=a&&49659>=a||49661<=a&&49687>=a||49689<=a&&49715>=a||49717<=a&&49743>=a||49745<=a&&49771>=a||49773<=a&&49799>=a||49801<=a&&49827>=a||49829<=a&&49855>=a||49857<=a&&49883>=a||49885<=a&&49911>=a||49913<=a&&49939>=a||49941<=a&&49967>=a||49969<=a&&49995>=a||49997<=a&&50023>=a||50025<=a&&50051>=a||50053<=a&&50079>=a||50081<=a&&50107>=a||50109<=a&&50135>=a||50137<=a&&50163>=a||50165<=a&&50191>=a||50193<=a&&50219>=a||50221<=a&&50247>=a||50249<=a&&50275>= +a||50277<=a&&50303>=a||50305<=a&&50331>=a||50333<=a&&50359>=a||50361<=a&&50387>=a||50389<=a&&50415>=a||50417<=a&&50443>=a||50445<=a&&50471>=a||50473<=a&&50499>=a||50501<=a&&50527>=a||50529<=a&&50555>=a||50557<=a&&50583>=a||50585<=a&&50611>=a||50613<=a&&50639>=a||50641<=a&&50667>=a||50669<=a&&50695>=a||50697<=a&&50723>=a||50725<=a&&50751>=a||50753<=a&&50779>=a||50781<=a&&50807>=a||50809<=a&&50835>=a||50837<=a&&50863>=a||50865<=a&&50891>=a||50893<=a&&50919>=a||50921<=a&&50947>=a||50949<=a&&50975>=a|| +50977<=a&&51003>=a||51005<=a&&51031>=a||51033<=a&&51059>=a||51061<=a&&51087>=a||51089<=a&&51115>=a||51117<=a&&51143>=a||51145<=a&&51171>=a||51173<=a&&51199>=a||51201<=a&&51227>=a||51229<=a&&51255>=a||51257<=a&&51283>=a||51285<=a&&51311>=a||51313<=a&&51339>=a||51341<=a&&51367>=a||51369<=a&&51395>=a||51397<=a&&51423>=a||51425<=a&&51451>=a||51453<=a&&51479>=a||51481<=a&&51507>=a||51509<=a&&51535>=a||51537<=a&&51563>=a||51565<=a&&51591>=a||51593<=a&&51619>=a||51621<=a&&51647>=a||51649<=a&&51675>=a||51677<= +a&&51703>=a||51705<=a&&51731>=a||51733<=a&&51759>=a||51761<=a&&51787>=a||51789<=a&&51815>=a||51817<=a&&51843>=a||51845<=a&&51871>=a||51873<=a&&51899>=a||51901<=a&&51927>=a||51929<=a&&51955>=a||51957<=a&&51983>=a||51985<=a&&52011>=a||52013<=a&&52039>=a||52041<=a&&52067>=a||52069<=a&&52095>=a||52097<=a&&52123>=a||52125<=a&&52151>=a||52153<=a&&52179>=a||52181<=a&&52207>=a||52209<=a&&52235>=a||52237<=a&&52263>=a||52265<=a&&52291>=a||52293<=a&&52319>=a||52321<=a&&52347>=a||52349<=a&&52375>=a||52377<=a&& +52403>=a||52405<=a&&52431>=a||52433<=a&&52459>=a||52461<=a&&52487>=a||52489<=a&&52515>=a||52517<=a&&52543>=a||52545<=a&&52571>=a||52573<=a&&52599>=a||52601<=a&&52627>=a||52629<=a&&52655>=a||52657<=a&&52683>=a||52685<=a&&52711>=a||52713<=a&&52739>=a||52741<=a&&52767>=a||52769<=a&&52795>=a||52797<=a&&52823>=a||52825<=a&&52851>=a||52853<=a&&52879>=a||52881<=a&&52907>=a||52909<=a&&52935>=a||52937<=a&&52963>=a||52965<=a&&52991>=a||52993<=a&&53019>=a||53021<=a&&53047>=a||53049<=a&&53075>=a||53077<=a&&53103>= +a||53105<=a&&53131>=a||53133<=a&&53159>=a||53161<=a&&53187>=a||53189<=a&&53215>=a||53217<=a&&53243>=a||53245<=a&&53271>=a||53273<=a&&53299>=a||53301<=a&&53327>=a||53329<=a&&53355>=a||53357<=a&&53383>=a||53385<=a&&53411>=a||53413<=a&&53439>=a||53441<=a&&53467>=a||53469<=a&&53495>=a||53497<=a&&53523>=a||53525<=a&&53551>=a||53553<=a&&53579>=a||53581<=a&&53607>=a||53609<=a&&53635>=a||53637<=a&&53663>=a||53665<=a&&53691>=a||53693<=a&&53719>=a||53721<=a&&53747>=a||53749<=a&&53775>=a||53777<=a&&53803>=a|| +53805<=a&&53831>=a||53833<=a&&53859>=a||53861<=a&&53887>=a||53889<=a&&53915>=a||53917<=a&&53943>=a||53945<=a&&53971>=a||53973<=a&&53999>=a||54001<=a&&54027>=a||54029<=a&&54055>=a||54057<=a&&54083>=a||54085<=a&&54111>=a||54113<=a&&54139>=a||54141<=a&&54167>=a||54169<=a&&54195>=a||54197<=a&&54223>=a||54225<=a&&54251>=a||54253<=a&&54279>=a||54281<=a&&54307>=a||54309<=a&&54335>=a||54337<=a&&54363>=a||54365<=a&&54391>=a||54393<=a&&54419>=a||54421<=a&&54447>=a||54449<=a&&54475>=a||54477<=a&&54503>=a||54505<= +a&&54531>=a||54533<=a&&54559>=a||54561<=a&&54587>=a||54589<=a&&54615>=a||54617<=a&&54643>=a||54645<=a&&54671>=a||54673<=a&&54699>=a||54701<=a&&54727>=a||54729<=a&&54755>=a||54757<=a&&54783>=a||54785<=a&&54811>=a||54813<=a&&54839>=a||54841<=a&&54867>=a||54869<=a&&54895>=a||54897<=a&&54923>=a||54925<=a&&54951>=a||54953<=a&&54979>=a||54981<=a&&55007>=a||55009<=a&&55035>=a||55037<=a&&55063>=a||55065<=a&&55091>=a||55093<=a&&55119>=a||55121<=a&&55147>=a||55149<=a&&55175>=a||55177<=a&&55203>=a?10:9757== +a||9977==a||9994<=a&&9997>=a||127877==a||127938<=a&&127940>=a||127943==a||127946<=a&&127948>=a||128066<=a&&128067>=a||128070<=a&&128080>=a||128110==a||128112<=a&&128120>=a||128124==a||128129<=a&&128131>=a||128133<=a&&128135>=a||128170==a||128372<=a&&128373>=a||128378==a||128400==a||128405<=a&&128406>=a||128581<=a&&128583>=a||128587<=a&&128591>=a||128675==a||128692<=a&&128694>=a||128704==a||128716==a||129304<=a&&129308>=a||129310<=a&&129311>=a||129318==a||129328<=a&&129337>=a||129341<=a&&129342>=a|| +129489<=a&&129501>=a?13:127995<=a&&127999>=a?14:8205==a?15:9792==a||9794==a||9877<=a&&9878>=a||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&128188>=a||128295==a||128300==a||128488==a||128640==a||128658==a?16:128102<=a&&128105>=a?17:11}this.nextBreak=function(a,c){void 0===c&&(c=0);if(0>c)return 0;if(c>=a.length-1)return a.length;var b=k(h(a,c)),d=[];for(c+=1;c=e.charCodeAt(g)&&56320<=e.charCodeAt(g+1)&&57343>=e.charCodeAt(g+1))){e=k(h(a,c));if(l(b,d,e))return c;d.push(e)}}return a.length};this.splitGraphemes=function(a){for(var c=[],b=0,d;(d=this.nextBreak(a,b))=0&&s<=1&&t>=0&&t<=1}function triangleArea(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function isLeft(a,b,c){return triangleArea(a,b,c)>0}function isLeftOn(a,b,c){return triangleArea(a,b,c)>=0} +function isRight(a,b,c){return triangleArea(a,b,c)<0}function isRightOn(a,b,c){return triangleArea(a,b,c)<=0}var tmpPoint1=[],tmpPoint2=[]; +function collinear(a,b,c,thresholdAngle){if(!thresholdAngle)return triangleArea(a,b,c)===0;else{var ab=tmpPoint1,bc=tmpPoint2;ab[0]=b[0]-a[0];ab[1]=b[1]-a[1];bc[0]=c[0]-b[0];bc[1]=c[1]-b[1];var dot=ab[0]*bc[0]+ab[1]*bc[1],magA=Math.sqrt(ab[0]*ab[0]+ab[1]*ab[1]),magB=Math.sqrt(bc[0]*bc[0]+bc[1]*bc[1]),angle=Math.acos(dot/(magA*magB));return anglev[br][0])br=i;if(!isLeft(polygonAt(polygon,br-1),polygonAt(polygon,br),polygonAt(polygon,br+1))){polygonReverse(polygon);return true}else return false}function polygonReverse(polygon){var tmp=[];var N=polygon.length;for(var i=0;i!==N;i++)tmp.push(polygon.pop());for(var i=0;i!==N;i++)polygon[i]=tmp[i]} +function polygonIsReflex(polygon,i){return isRight(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1))}var tmpLine1=[],tmpLine2=[]; +function polygonCanSee(polygon,a,b){var p,dist,l1=tmpLine1,l2=tmpLine2;if(isLeftOn(polygonAt(polygon,a+1),polygonAt(polygon,a),polygonAt(polygon,b))&&isRightOn(polygonAt(polygon,a-1),polygonAt(polygon,a),polygonAt(polygon,b)))return false;dist=sqdist(polygonAt(polygon,a),polygonAt(polygon,b));for(var i=0;i!==polygon.length;++i){if((i+1)%polygon.length===a||i===a)continue;if(isLeftOn(polygonAt(polygon,a),polygonAt(polygon,b),polygonAt(polygon,i+1))&&isRightOn(polygonAt(polygon,a),polygonAt(polygon, +b),polygonAt(polygon,i))){l1[0]=polygonAt(polygon,a);l1[1]=polygonAt(polygon,b);l2[0]=polygonAt(polygon,i);l2[1]=polygonAt(polygon,i+1);p=lineInt(l1,l2);if(sqdist(polygonAt(polygon,a),p)0)return polygonSlice(polygon,edges);else return[polygon]} +function polygonSlice(polygon,cutEdges){if(cutEdges.length===0)return[polygon];if(cutEdges instanceof Array&&cutEdges.length&&cutEdges[0]instanceof Array&&cutEdges[0].length===2&&cutEdges[0][0]instanceof Array){var polys=[polygon];for(var i=0;imaxlevel){console.warn("quickDecomp: max level ("+ +maxlevel+") reached.");return result}for(var i=0;iupperIndex)upperIndex+=polygon.length; +closestDist=Number.MAX_VALUE;if(upperIndex3&&i>=0;--i)if(collinear(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1),precision)){polygon.splice(i%polygon.length,1);num++}return num} +function polygonRemoveDuplicatePoints(polygon,precision){for(var i=polygon.length-1;i>=1;--i){var pi=polygon[i];for(var j=i-1;j>=0;--j)if(points_eq(pi,polygon[j],precision)){polygon.splice(i,1);continue}}}function scalar_eq(a,b,precision){precision=precision||0;return Math.abs(a-b)<=precision}function points_eq(a,b,precision){return scalar_eq(a[0],b[0],precision)&&scalar_eq(a[1],b[1],precision)} +self.polyDecomp={decomp:polygonDecomp,quickDecomp:polygonQuickDecomp,isSimple:polygonIsSimple,removeCollinearPoints:polygonRemoveCollinearPoints,removeDuplicatePoints:polygonRemoveDuplicatePoints,makeCCW:polygonMakeCCW}; + +} + +// lib/c3.js +{ +'use strict';let isReady=false;let hasAppStarted=false;let buildMode="dev";const C3=self.C3=class C3{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){isReady=true}static IsReady(){return isReady}static SetAppStarted(){hasAppStarted=true}static HasAppStarted(){return hasAppStarted}static SetBuildMode(m){buildMode=m}static GetBuildMode(){return buildMode}static IsReleaseBuild(){return buildMode==="final"}};C3.isDebug=false;C3.isDebugDefend=false; +C3.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}; + +} + +// ../lib/queryParser.js +{ +'use strict';const C3=self.C3; +C3.QueryParser=class QueryParser{constructor(queryString){this._queryString=queryString;this._parameters=new Map;this._Parse()}_Parse(){let str=this._queryString;if(str.startsWith("?")||str.startsWith("#"))str=str.substr(1);const arr=str.split("&");for(const p of arr)this._ParseParameter(p)}_ParseParameter(p){if(!p)return;if(!p.includes("=")){this._parameters.set(p,null);return}const i=p.indexOf("=");const parameterName=decodeURIComponent(p.substring(0,i));const parameterValue=decodeURIComponent(p.substring(i+ +1));this._parameters.set(parameterName,parameterValue)}LogAll(){for(const e of this._parameters)console.log("[QueryParser] Parameter '"+e[0]+"' = "+(e[1]===null?"null":"'"+e[1]+"'"))}Has(name){return this._parameters.has(name)}Get(name){const ret=this._parameters.get(name);if(typeof ret==="undefined")return null;else return ret}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(str){this._queryString=str;this._parameters.clear();this._Parse()}}; +C3.QueryString=new C3.QueryParser(location.search);C3.LocationHashString=new C3.QueryParser(location.hash);if(C3.QueryString.Has("perf"))C3.isPerformanceProfiling=true;if(C3.QueryString.Get("mode")!=="dev")C3.SetBuildMode("final"); + +} + +// ../lib/detect/detect.js +{ +'use strict';const C3=self.C3;const UNKNOWN="(unknown)";C3.Platform={OS:UNKNOWN,OSVersion:UNKNOWN,Browser:UNKNOWN,BrowserVersion:UNKNOWN,BrowserVersionNumber:NaN,BrowserEngine:UNKNOWN,Context:"browser",IsDesktop:true,IsMobile:false,IsAppleOS:false,IsIpadOS:false,GetDetailedInfo:async()=>{}};const windowsNTVerMap=new Map([[5,"2000"],[5.1,"XP"],[5.2,"XP"],[6,"Vista"],[6.1,"7"],[6.2,"8"],[6.3,"8.1"],[10,"10"]]); +function GetWindowsNTVersionName(ntVer){const num=parseFloat(ntVer);const ret=windowsNTVerMap.get(num);if(ret)return ret;if(num>=13)return"11";return"NT "+ntVer}const uaStr=navigator.userAgent;const uaData=navigator["userAgentData"]; +if(uaData&&uaData["brands"].length>0){C3.Platform.OS=uaData["platform"];C3.Platform.IsMobile=uaData["mobile"];C3.Platform.IsDesktop=!C3.Platform.IsMobile;const RECOGNIZED_BROWSERS=new Map([["Google Chrome","Chrome"],["Microsoft Edge","Edge"],["Opera","Opera"],["Opera GX","Opera GX"],["Mozilla Firefox","Firefox"],["Apple Safari","Safari"],["NW.js","NW.js"]]);const RECOGNIZED_ENGINES=new Map([["Chromium","Chromium"],["Gecko","Gecko"],["WebKit","WebKit"]]);function ReadBrandList(brands){let browser= +"";let browser_version="";let engine="";let engine_version="";for(const o of brands){const recognizedBrowser=RECOGNIZED_BROWSERS.get(o["brand"]);if(!browser&&recognizedBrowser){browser=recognizedBrowser;browser_version=o["version"]}const recognizedEngine=RECOGNIZED_ENGINES.get(o["brand"]);if(!engine&&recognizedEngine){engine=recognizedEngine;engine_version=o["version"]}}if(!browser&&engine==="Chromium"){C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=engine_version}C3.Platform.Browser=browser|| +UNKNOWN;C3.Platform.BrowserVersion=browser_version||UNKNOWN;C3.Platform.BrowserEngine=engine||UNKNOWN}ReadBrandList(uaData["brands"]);let didGetDetailedInfo=false;C3.Platform.GetDetailedInfo=async()=>{if(didGetDetailedInfo)return;try{const details=await navigator["userAgentData"]["getHighEntropyValues"](["platformVersion","fullVersionList"]);ReadBrandList(details["fullVersionList"]);if(C3.Platform.OS==="Windows")C3.Platform.OSVersion=GetWindowsNTVersionName(details["platformVersion"]);else C3.Platform.OSVersion= +details["platformVersion"];didGetDetailedInfo=true}catch(err){console.warn("Failed to get detailed user agent information: ",err)}}}else{function RunTest(regex_or_arr,handler){const arr=Array.isArray(regex_or_arr)?regex_or_arr:[regex_or_arr];for(const regex of arr){const result=regex.exec(uaStr);if(result){handler(result);break}}}RunTest(/windows\s+nt\s+([\d\.]+)/i,result=>{C3.Platform.OS="Windows";const ntVer=result[1];C3.Platform.OSVersion=GetWindowsNTVersionName(ntVer)});RunTest(/mac\s+os\s+x\s+([\d\._]+)/i, +result=>{C3.Platform.OS="macOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")});RunTest(/CrOS/,()=>{C3.Platform.OS="Chrome OS"});RunTest(/linux|openbsd|freebsd|netbsd/i,()=>{C3.Platform.OS="Linux"});RunTest(/android/i,()=>{C3.Platform.OS="Android"});RunTest(/android\s+([\d\.]+)/i,result=>{C3.Platform.OS="Android";C3.Platform.OSVersion=result[1]});if(C3.Platform.OS===UNKNOWN){RunTest(/(iphone|ipod|ipad)/i,result=>{C3.Platform.OS="iOS"});RunTest([/iphone\s+os\s+([\d\._]+)/i,/ipad[^)]*os\s+([\d\._]+)/i], +result=>{C3.Platform.OS="iOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")})}const hasChrome=/chrome\//i.test(uaStr);const hasChromium=/chromium\//i.test(uaStr);const hasEdge=/edg\//i.test(uaStr);const hasOpera=/OPR\//.test(uaStr);const hasNWjs=/nwjs/i.test(uaStr);const hasSafari=/safari\//i.test(uaStr);const hasWebKit=/webkit/i.test(uaStr);if(!hasEdge&&!hasOpera)RunTest(/chrome\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine= +"Chromium"});RunTest(/edg\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/OPR\/([\d\.]+)/,result=>{C3.Platform.Browser="Opera";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/chromium\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/nwjs\/[0-9.]+/i,result=>{C3.Platform.Browser="NW.js";C3.Platform.BrowserVersion= +result[1];C3.Platform.BrowserEngine="Chromium";C3.Platform.Context="nwjs"});RunTest(/firefox\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Gecko"});if(hasSafari&&!hasChrome&&!hasChromium&&!hasEdge&&!hasOpera&&!hasNWjs){C3.Platform.Browser="Safari";C3.Platform.BrowserEngine="WebKit";RunTest(/version\/([\d\.]+)/i,result=>{C3.Platform.BrowserVersion=result[1]});RunTest(/crios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome for iOS"; +C3.Platform.BrowserVersion=result[1]});RunTest(/fxios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox for iOS";C3.Platform.BrowserVersion=result[1]});RunTest(/edgios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge for iOS";C3.Platform.BrowserVersion=result[1]})}if(C3.Platform.BrowserEngine===UNKNOWN&&hasWebKit)C3.Platform.BrowserEngine="WebKit";if(C3.Platform.OS==="Android"&&C3.Platform.Browser==="Safari")C3.Platform.Browser="Stock";const desktopOSs=new Set(["Windows","macOS","Linux","Chrome OS"]); +const isDesktop=desktopOSs.has(C3.Platform.OS)||C3.Platform.Context==="nwjs";C3.Platform.IsDesktop=isDesktop;C3.Platform.IsMobile=!isDesktop}if(C3.Platform.Browser==="Chrome"&&C3.Platform.Context==="browser"&&/wv\)/.test(uaStr))C3.Platform.Context="webview";if(C3.Platform.Context!=="nwjs"&&typeof window!=="undefined"&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator["standalone"]))C3.Platform.Context="webapp";C3.Platform.BrowserVersionNumber=parseFloat(C3.Platform.BrowserVersion); +const looksLikeIPadOS=C3.Platform.OS==="macOS"&&navigator["maxTouchPoints"]&&navigator["maxTouchPoints"]>2;if(looksLikeIPadOS){C3.Platform.OS="iOS";C3.Platform.OSVersion=C3.Platform.BrowserVersion;C3.Platform.IsDesktop=false;C3.Platform.IsMobile=true;C3.Platform.IsIpadOS=true}C3.Platform.IsAppleOS=C3.Platform.OS==="macOS"||C3.Platform.OS==="iOS"; + +} + +// ../lib/storage/kvStorage.js +{ +'use strict';{const VERSION=2;const STORE_NAME="keyvaluepairs";const DATABASE_PROMISE_MAP=new Map;const SUPPORTS_GETALL=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAll==="function";const SUPPORTS_GETALLKEYS=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAllKeys==="function";function asyncifyRequest(request){return new Promise((res,rej)=>{request.onsuccess=()=>res(request.result);request.onerror=()=>rej(request.error)})}function asyncifyTransaction(tx){return new Promise((res, +rej)=>{tx.oncomplete=()=>res();tx.onerror=()=>rej(tx.error);tx.onabort=()=>rej(tx.error)})}function openReadOnlyTransaction(name,method){return openTransaction(name,method)}function openWriteTransaction(name,method){return openTransaction(name,method,true)}async function openTransaction(name,method,write=false,allowRetry=true){const db=await lazyOpenDatabase(name);try{const tx=db.transaction([STORE_NAME],write?"readwrite":"readonly");return method(tx)}catch(err){if(allowRetry&&err["name"]==="InvalidStateError"){DATABASE_PROMISE_MAP.delete(name); +return openTransaction(name,method,write,false)}else throw err;}}function lazyOpenDatabase(name){RequireString(name);let dbPromise=DATABASE_PROMISE_MAP.get(name);if(!(dbPromise instanceof Promise)){dbPromise=openDatabase(name);DATABASE_PROMISE_MAP.set(name,dbPromise);dbPromise.catch(err=>DATABASE_PROMISE_MAP.delete(name))}return dbPromise}async function openDatabase(name){RequireString(name);const openRequest=indexedDB.open(name,VERSION);openRequest.addEventListener("upgradeneeded",e=>{try{const db= +e.target.result;db.createObjectStore(STORE_NAME)}catch(err){console.error(`Failed to create objectstore for database ${name}`,err)}});return asyncifyRequest(openRequest)}function RequireString(x){if(typeof x!=="string")throw new TypeError("expected string");}function getEntriesFromCursor(tx,type){const request=tx.objectStore(STORE_NAME).openCursor();return new Promise(resolve=>{const results=[];request.onsuccess=event=>{const cursor=event.target.result;if(cursor){switch(type){case "entries":results.push([cursor.key, +cursor.value]);break;case "keys":results.push(cursor.key);break;case "values":results.push(cursor.value);break}cursor.continue()}else resolve(results)}})}class KVStorageContainer{constructor(name){RequireString(name);this.name=name}async ready(){await lazyOpenDatabase(this.name)}set(key,value){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).put(value,key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx); +await Promise.all([txPromise,requestPromise])})}get(key){RequireString(key);return openReadOnlyTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).get(key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}delete(key){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).delete(key);const requestPromise=asyncifyRequest(request); +const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}clear(){return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).clear();const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}keys(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALLKEYS){const request=tx.objectStore(STORE_NAME).getAllKeys();requestPromise=asyncifyRequest(request)}else requestPromise= +getEntriesFromCursor(tx,"keys");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}values(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALL){const request=tx.objectStore(STORE_NAME).getAll();requestPromise=asyncifyRequest(request)}else requestPromise=getEntriesFromCursor(tx,"values");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}entries(){return openReadOnlyTransaction(this.name, +async tx=>{const requestPromise=getEntriesFromCursor(tx,"entries");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}}self.KVStorageContainer=KVStorageContainer}; + +} + +// ../lib/storage/localForageAdaptor.js +{ +'use strict';{const KVStorageContainer=self.KVStorageContainer;const CRITICAL_ERRORS=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i];const memoryStorage=new WeakMap;let isInMemory=false;if(typeof indexedDB==="undefined"){isInMemory=true; +console.warn("Unable to use local storage because indexedDB is not defined")}function NOT_IMPLEMENTED(name){throw new Error(`"${name}" is not implemented`);}function DISALLOW_CALLBACK(fn){if(typeof fn==="function")throw new Error(`localforage callback API is not implemented; please use the promise API instead`);}function StructuredClone(value){if(typeof value==="object")return new Promise(resolve=>{const {port1,port2}=new MessageChannel;port2.onmessage=ev=>resolve(ev.data);port1.postMessage(value)}); +else return Promise.resolve(value)}class ForageAdaptor{constructor(inst){this._inst=inst;memoryStorage.set(this,new Map)}_MaybeSwitchToMemoryFallback(err){if(isInMemory)return;for(const regex of CRITICAL_ERRORS)if(err&®ex.test(err.message)){console.error("Unable to use local storage, reverting to in-memory store: ",err,err.message);isInMemory=true;break}}async _getItemFallback(name){const value=memoryStorage.get(this).get(name);const ret=await StructuredClone(value);return typeof ret==="undefined"? +null:ret}async _setItemFallback(name,value){value=await StructuredClone(value);memoryStorage.get(this).set(name,value)}_removeItemFallback(name){memoryStorage.get(this).delete(name)}_clearFallback(){memoryStorage.get(this).clear()}_keysFallback(){return Array.from(memoryStorage.get(this).keys())}IsUsingFallback(){return isInMemory}async getItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return await this._getItemFallback(key);let result;try{result=await this._inst.get(key)}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)return await this._getItemFallback(key);else{console.error(`Error reading '${key}' from storage, returning null: `,err);return null}}return typeof result==="undefined"?null:result}async setItem(key,value,successCallback){DISALLOW_CALLBACK(successCallback);if(typeof value==="undefined")value=null;if(isInMemory){await this._setItemFallback(key,value);return}try{await this._inst.set(key,value)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)await this._setItemFallback(key, +value);else throw err;}}async removeItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._removeItemFallback(key);return}try{await this._inst.delete(key)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)this._removeItemFallback(key);else console.error(`Error removing '${key}' from storage: `,err)}}async clear(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._clearFallback();return}try{await this._inst.clear()}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)this._clearFallback();else console.error(`Error clearing storage: `,err)}}async keys(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return this._keysFallback();let result=[];try{result=await this._inst.keys()}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)return this._keysFallback();else console.error(`Error getting storage keys: `,err)}return result}ready(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return Promise.resolve(true); +else return this._inst.ready()}createInstance(options){if(typeof options!=="object")throw new TypeError("invalid options object");const name=options["name"];if(typeof name!=="string")throw new TypeError("invalid store name");const inst=new KVStorageContainer(name);return new ForageAdaptor(inst)}length(successCallback){NOT_IMPLEMENTED("localforage.length()")}key(index,successCallback){NOT_IMPLEMENTED("localforage.key()")}iterate(iteratorCallback,successCallback){NOT_IMPLEMENTED("localforage.iterate()")}setDriver(driverName){NOT_IMPLEMENTED("localforage.setDriver()")}config(options){NOT_IMPLEMENTED("localforage.config()")}defineDriver(customDriver){NOT_IMPLEMENTED("localforage.defineDriver()")}driver(){NOT_IMPLEMENTED("localforage.driver()")}supports(driverName){NOT_IMPLEMENTED("localforage.supports()")}dropInstance(){NOT_IMPLEMENTED("localforage.dropInstance()")}disableMemoryMode(){isInMemory= +false}}self["localforage"]=new ForageAdaptor(new KVStorageContainer("localforage"))}; + +} + +// ../lib/misc/supports.js +{ +'use strict';const C3=self.C3;C3.Supports={};C3.Supports.WebAnimations=(()=>{try{if(C3.Platform.Browser==="Safari")return false;if(typeof document==="undefined")return false;const e=document.createElement("div");if(typeof e.animate==="undefined")return false;const player=e.animate([{opacity:"0"},{opacity:"1"}],1E3);return typeof player.reverse!=="undefined"}catch(e){return false}})();C3.Supports.DialogElement=typeof HTMLDialogElement!=="undefined";C3.Supports.RequestIdleCallback=!!self.requestIdleCallback; +C3.Supports.ImageBitmap=!!self.createImageBitmap;C3.Supports.ImageBitmapOptions=false;C3.Supports.ImageBitmapOptionsResize=false; +if(C3.Supports.ImageBitmap){try{self.createImageBitmap(new ImageData(32,32),{"premultiplyAlpha":"none"}).then(()=>{C3.Supports.ImageBitmapOptions=true}).catch(()=>{C3.Supports.ImageBitmapOptions=false})}catch(err){C3.Supports.ImageBitmapOptions=false}try{self.createImageBitmap(new ImageData(32,32),{"resizeWidth":10,"resizeHeight":10}).then(imageBitmap=>{C3.Supports.ImageBitmapOptionsResize=imageBitmap.width===10&&imageBitmap.height===10}).catch(()=>{C3.Supports.ImageBitmapOptionsResize=false})}catch(err){C3.Supports.ImageBitmapOptionsResize= +false}}C3.Supports.ClipboardReadText=!!(navigator["clipboard"]&&navigator["clipboard"]["readText"]&&C3.Platform.Browser!=="Firefox");C3.Supports.PermissionsQuery=!!(navigator["permissions"]&&navigator["permissions"]["query"]);C3.Supports.ClipboardPermissionsQuery=false;if(C3.Supports.PermissionsQuery){const permission={"name":"clipboard-read"};navigator["permissions"]["query"](permission).then(()=>{C3.Supports.ClipboardPermissionsQuery=true}).catch(()=>{C3.Supports.ClipboardPermissionsQuery=false})} +C3.Supports.AsyncClipboardApi=!!(navigator["permissions"]&&navigator["clipboard"]&&self["ClipboardItem"]);C3.Supports.Proxies=typeof Proxy!=="undefined";C3.Supports.DownloadAttribute=(()=>{if(typeof document==="undefined")return false;const a=document.createElement("a");return typeof a.download!=="undefined"})();C3.Supports.Fetch=typeof fetch==="function";C3.Supports.PersistentStorage=!!(self.isSecureContext&&C3.Platform.Browser!=="Opera"&&(navigator["storage"]&&navigator["storage"]["persist"])); +C3.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&(navigator["storage"]&&navigator["storage"]["estimate"]));C3.Supports.Fullscreen=(()=>{if(typeof document==="undefined")return false;if(C3.Platform.OS==="iOS")return false;const elem=document.documentElement;return!!(elem.requestFullscreen||elem.msRequestFullscreen||elem.mozRequestFullScreen||elem.webkitRequestFullscreen)})();C3.Supports.ImageDecoder=typeof self["ImageDecoder"]!=="undefined";C3.Supports.WebCodecs=!!self["VideoEncoder"]; +C3.Supports.NativeFileSystemAPI=!!self["showOpenFilePicker"];C3.Supports.QueryLocalFonts=!!self["queryLocalFonts"];C3.Supports.UserActivation=!!navigator["userActivation"];C3.Supports.CanvasToBlobWebP=false; +(async()=>{let canvas;if(typeof document==="undefined")canvas=new OffscreenCanvas(32,32);else{canvas=document.createElement("canvas");canvas.width=32;canvas.height=32}const ctx=canvas.getContext("2d");ctx.fillStyle="blue";ctx.fillRect(0,0,32,32);let blob=null;try{if(canvas.toBlob)blob=await new Promise(resolve=>canvas.toBlob(resolve,"image/webp",1));else if(canvas["convertToBlob"])blob=await canvas["convertToBlob"]({"type":"image/webp","quality":1});C3.Supports.CanvasToBlobWebP=blob&&blob.type=== +"image/webp"}catch(err){C3.Supports.CanvasToBlobWebP=false}})(); + +} + +// ../lib/misc/polyfills.js +{ +'use strict';const C3=self.C3;if(!String.prototype.trimStart){const startWhitespace=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function trimStart(){return this.replace(startWhitespace,"")}} +if(!String.prototype.trimEnd){const endWhitespace=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function trimEnd(){return this.replace(endWhitespace,"")}}if(!String.prototype.replaceAll)String.prototype.replaceAll=function replaceAll(find,replace){return this.replace(new RegExp(C3.EscapeRegex(find),"g"),replace)};if(!Array.prototype.values)Array.prototype.values=function*(){for(const i of this)yield i}; +if(!Array.prototype.flat){function arrayFlat(arr,depth){return arr.reduce((acc,val)=>{if(depth>0&&Array.isArray(val)){Array.prototype.push.apply(acc,arrayFlat(val,depth-1));return acc}else{acc.push(val);return acc}},[])}Array.prototype.flat=function(depth=1){return arrayFlat(this,depth)}}if(!Array.prototype.at)Array.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]}; +if(!String.prototype.at)String.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]};if(!RegExp.escape)RegExp.escape=function(s){return String(s).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}; +if(navigator["storage"]&&!navigator["storage"]["estimate"]&&navigator["webkitTemporaryStorage"]&&navigator["webkitTemporaryStorage"]["queryUsageAndQuota"])navigator["storage"]["estimate"]=function(){return new Promise((resolve,reject)=>{return navigator["webkitTemporaryStorage"]["queryUsageAndQuota"]((usage,quota)=>resolve({"usage":usage,"quota":quota}),reject)})};if(typeof self.isSecureContext==="undefined")self.isSecureContext=location.protocol==="https:"; +if(typeof self["globalThis"]==="undefined")self["globalThis"]=self; + +} + +// lib/misc/assert.js +{ +'use strict';const C3=self.C3;function assertFail(msg_){let stack=C3.GetCallStack();let msg="Assertion failure: "+msg_+"\n\nStack trace:\n"+stack;console.error(msg)}self.assert=function assert(cnd_,msg_){if(!cnd_)assertFail(msg_)}; + +} + +// ../lib/misc/typeChecks.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;C3.IsNumber=function IsNumber(x){return typeof x==="number"};C3.IsFiniteNumber=function IsFiniteNumber(x){return C3.IsNumber(x)&&isFinite(x)};C3.RequireNumber=function RequireNumber(x){if(!C3.IsNumber(x))throw new TypeError("expected number");};C3.RequireOptionalNumber=function RequireOptionalNumber(x){if(C3.IsNullOrUndefined(x))return}; +C3.RequireNumberInRange=function RequireNumberInRange(x,low,high){if(!C3.IsNumber(x)||isNaN(x)||low>x||high{console.log(`%c${name}`,"font-weight: bold",...args);logRafIds.set(name,-1)}))};let measures; +C3.StartMeasure=function StartMeasure(name){performance.mark(name);if(!measures)measures=new Map;if(!measures.has(name))measures.set(name,{current:0,total:0,average:0,calls:1,toString:function(){return`${name} :: current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})}; +C3.EndMeasure=function EndMeasure(name){performance.measure(`measure-${name}`,name);const entry=performance.getEntriesByName(`measure-${name}`)[0];const m=measures.get(name);m.current=entry.duration;m.total+=m.current;m.average=m.total/m.calls;console.log(m.toString());m.calls++;performance.clearMarks(name);performance.clearMeasures(`measure-${name}`)};C3.GetCallStack=function GetCallStack(){return(new Error).stack};C3.Debugger=function Debugger(){debugger}; +C3.cast=function cast(o,T){if(o&&o instanceof T)return o;else return null}; +C3.getName=function getName(o){if(typeof o==="undefined")return"undefined";if(o===null)return"null";if(typeof o==="boolean")return"";if(C3.IsNumber(o))return"";if(C3.IsString(o))return"";if(C3.IsArray(o))return"";if(typeof o==="symbol")return"<"+o.toString()+">";if(C3.IsFunction(o)){if(o.name&&o.name!=="Function")return o.name;return""}if(typeof o==="object"){if(o.constructor&&o.constructor.name&&o.constructor.name!=="Object")return o.constructor.name; +return""}return""};C3.getType=function getType(o){if(o===null)return"null";if(Array.isArray(o))return"array";return typeof o};C3.range=function*range(a,b){if(!isFinite(Math.abs(a-b)))throw new Error("Invalid parameters");if(a>b)for(let i=a-1;i>=b;i--)yield i;else for(let i=a;i0||ctorProxyToObject.size>0){let uniqueNames=new Set([...ctorObjectToProxy.keys()].map(o=>C3.getName(o)));let leftoverNames=[...uniqueNames].join(",");console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${leftoverNames}`);ctorObjectToProxy.clear();ctorProxyToObject.clear()}} +C3.DefendedBase=class DefendedBase{constructor(){if(!C3.isDebugDefend||!C3.Supports.Proxies)return;let newTarget=new.target;let realObject=Object.create(newTarget.prototype);let proxy=new Proxy(realObject,C3.DefendHandler);ctorObjectToProxy.set(realObject,proxy);ctorProxyToObject.set(proxy,realObject);proxyToObject.set(proxy,realObject);if(checkRafId===-1)checkRafId=requestAnimationFrame(CheckDefendedObjectsUsedCorrectly);return proxy}}; +C3.debugDefend=function debugDefend(o){if(C3.isDebugDefend&&C3.Supports.Proxies&&o instanceof C3.DefendedBase){if(!ctorProxyToObject.has(o))return o;let realObject=ctorProxyToObject.get(o);ctorProxyToObject.delete(o);ctorObjectToProxy.delete(realObject);return o}else if(C3.isDebug)return Object.seal(o);else return o}; +C3.New=function New(Type,...args){let o;try{o=new Type(...args)}catch(e){ctorProxyToObject.clear();ctorObjectToProxy.clear();throw e;}if(C3.isDebugDefend)VerifyObjectPropertiesConsistent(Type,o);return C3.debugDefend(o)};C3.Release=function Release(o){let realObject=proxyToObject.get(o);if(realObject)releasedObjects.set(realObject,C3.GetCallStack())};C3.WasReleased=function(o){let realObject=proxyToObject.get(o);if(!realObject)return false;return!!releasedObjects.get(realObject)}; +let typeProperties=new Map;function getObjectPropertySet(o){let ret=new Set;for(let k in o)ret.add(k);return ret} +function VerifyObjectPropertiesConsistent(Type,o){let properties=getObjectPropertySet(o);let existingProperties=typeProperties.get(Type);if(existingProperties){let inconsistentProperties=[];for(let k of existingProperties.values())if(properties.has(k))properties.delete(k);else inconsistentProperties.push(k);C3.appendArray(inconsistentProperties,[...properties]);if(inconsistentProperties.length)console.warn(`[Defence] '${C3.getName(Type)}' constructor creates inconsistent properties: ${inconsistentProperties.join(", ")}`)}else typeProperties.set(Type,properties)} +C3.PerfMark=class PerfMark{constructor(name){this._name="";if(name)this.start(name)}start(name){if(!C3.isPerformanceProfiling)return;this._name=name;performance.mark(this._name+"-Start")}end(){if(!C3.isPerformanceProfiling)return;performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(name){if(!C3.isPerformanceProfiling)return;this.end();this._name=name;performance.mark(this._name+"-Start")}}; + +} + +// ../lib/misc/mathutil.js +{ +'use strict';const C3=self.C3;const TWO_PI=Math.PI*2;const D_TO_R=Math.PI/180;const R_TO_D=180/Math.PI;C3.wrap=function wrap(x,min,max){x=Math.floor(x);min=Math.floor(min);max=Math.floor(max);const diff=max-min;if(diff===0)return max;if(xb)return b;else return x};C3.clampAngle=function clampAngle(a){a%=TWO_PI;if(a<0)a+=TWO_PI;return a};C3.toRadians=function toRadians(x){return x*D_TO_R};C3.toDegrees=function toDegrees(x){return x*R_TO_D};C3.distanceTo=function distanceTo(x1,y1,x2,y2){return Math.hypot(x2-x1,y2-y1)}; +C3.distanceSquared=function distanceSquared(x1,y1,x2,y2){const dx=x2-x1;const dy=y2-y1;return dx*dx+dy*dy};C3.angleTo=function angleTo(x1,y1,x2,y2){return Math.atan2(y2-y1,x2-x1)};C3.angleDiff=function angleDiff(a1,a2){if(a1===a2)return 0;let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);let n=s1*s2+c1*c2;if(n>=1)return 0;if(n<=-1)return Math.PI;return Math.acos(n)}; +C3.angleRotate=function angleRotate(start,end,step){let ss=Math.sin(start);let cs=Math.cos(start);let se=Math.sin(end);let ce=Math.cos(end);if(Math.acos(ss*se+cs*ce)>step)if(cs*se-ss*ce>0)return C3.clampAngle(start+step);else return C3.clampAngle(start-step);else return C3.clampAngle(end)};C3.angleClockwise=function angleClockwise(a1,a2){let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);return c1*s2-s1*c2<=0}; +C3.angleLerp=function angleLerp(a,b,x,r=0){let diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);else return C3.clampAngle(a-(diff+revs)*x)};C3.angleLerpClockwise=function angleLerpClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);return C3.clampAngle(a+(TWO_PI-diff+revs)*x)}; +C3.angleLerpAntiClockwise=function angleLerpAntiClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a-(-TWO_PI+diff-revs)*x);return C3.clampAngle(a-(diff+revs)*x)};C3.angleReflect=function angleReflect(a,b){const diff=C3.angleDiff(a,b);if(C3.angleClockwise(a,b))return C3.clampAngle(b-diff);else return C3.clampAngle(b+diff)};C3.lerp=function lerp(a,b,x){return a+x*(b-a)}; +C3.unlerp=function unlerp(a,b,x){if(a===b)return 0;return(x-a)/(b-a)};C3.relerp=function relerp(a,b,x,c,d){return C3.lerp(c,d,C3.unlerp(a,b,x))};C3.qarp=function qarp(a,b,c,x){return C3.lerp(C3.lerp(a,b,x),C3.lerp(b,c,x),x)};C3.cubic=function cubic(a,b,c,d,x){return C3.lerp(C3.qarp(a,b,c,x),C3.qarp(b,c,d,x),x)};C3.cosp=function cosp(a,b,x){return(a+b+(a-b)*Math.cos(x*Math.PI))/2};C3.isPOT=function isPOT(x){return x>0&&(x-1&x)===0}; +C3.nextHighestPowerOfTwo=function nextHighestPowerOfTwo(x){--x;for(let i=1;i<32;i<<=1)x=x|x>>i;return x+1};C3.roundToNearestFraction=function roundToNearestFraction(x,n){return Math.round(x*n)/n};C3.floorToNearestFraction=function floorToNearestFraction(x,n){return Math.floor(x*n)/n};C3.roundToDp=function roundToDp(x,dp){dp=Math.max(Math.floor(dp),0);const m=Math.pow(10,dp);return Math.round(x*m)/m}; +C3.countDecimals=function countDecimals(value){if(Math.floor(value)!==value)return value.toString().split(".")[1].length||0;return 0};C3.toFixed=function toFixed(n,dp){let ret=n.toFixed(dp);let last=ret.length-1;for(;last>=0&&ret.charAt(last)==="0";--last);if(last>=0&&ret.charAt(last)===".")--last;if(last<0)return ret;return ret.substr(0,last+1)};C3.PackRGB=function PackRGB(red,green,blue){return C3.clamp(red,0,255)|C3.clamp(green,0,255)<<8|C3.clamp(blue,0,255)<<16};const ALPHAEX_SHIFT=1024; +const ALPHAEX_MAX=1023;const RGBEX_SHIFT=16384;const RGBEX_MAX=8191;const RGBEX_MIN=-8192; +C3.PackRGBAEx=function PackRGBAEx(red,green,blue,alpha){red=C3.clamp(Math.floor(red*1024),RGBEX_MIN,RGBEX_MAX);green=C3.clamp(Math.floor(green*1024),RGBEX_MIN,RGBEX_MAX);blue=C3.clamp(Math.floor(blue*1024),RGBEX_MIN,RGBEX_MAX);alpha=C3.clamp(Math.floor(alpha*ALPHAEX_MAX),0,ALPHAEX_MAX);if(red<0)red+=RGBEX_SHIFT;if(green<0)green+=RGBEX_SHIFT;if(blue<0)blue+=RGBEX_SHIFT;return-(red*RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT+green*RGBEX_SHIFT*ALPHAEX_SHIFT+blue*ALPHAEX_SHIFT+alpha)}; +C3.PackRGBEx=function PackRGBEx(red,green,blue){return C3.PackRGBAEx(red,green,blue,1)};function isNegativeZero(x){return x===0&&1/x<0}C3.GetRValue=function GetRValue(rgb){if(rgb>=0)return(rgb&255)/255;else{let v=Math.floor(-rgb/(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetGValue=function GetGValue(rgb){if(rgb>=0)return((rgb&65280)>>8)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT)/(RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}};C3.GetBValue=function GetBValue(rgb){if(rgb>=0)return((rgb&16711680)>>16)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*ALPHAEX_SHIFT)/ALPHAEX_SHIFT);if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetAValue=function GetAValue(rgb){if(isNegativeZero(rgb))return 0;else if(rgb>=0)return 1;else{const v=Math.floor(-rgb%ALPHAEX_SHIFT);return v/ALPHAEX_MAX}};C3.greatestCommonDivisor=function greatestCommonDivisor(a,b){a=Math.floor(a);b=Math.floor(b);while(b!==0){let t=b;b=a%b;a=t}return a};const COMMON_ASPECT_RATIOS=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]]; +C3.getAspectRatio=function getAspectRatio(w,h){w=Math.floor(w);h=Math.floor(h);if(w===h)return[1,1];for(let aspect of COMMON_ASPECT_RATIOS){let approxH=w/aspect[0]*aspect[1];if(Math.abs(h-approxH)<1)return aspect.slice(0);approxH=w/aspect[1]*aspect[0];if(Math.abs(h-approxH)<1)return[aspect[1],aspect[0]]}let gcd=C3.greatestCommonDivisor(w,h);return[w/gcd,h/gcd]}; +C3.segmentsIntersect=function segmentsIntersect(a1x,a1y,a2x,a2y,b1x,b1y,b2x,b2y){const min_ax=Math.min(a1x,a2x);const max_ax=Math.max(a1x,a2x);const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_ay=Math.min(a1y,a2y);const max_ay=Math.max(a1y,a2y);const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y- +a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la=qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentsIntersectPreCalc=function segmentsIntersectPreCalc(a1x,a1y,a2x,a2y,min_ax,max_ax,min_ay,max_ay,b1x,b1y,b2x,b2y){const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y-a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la= +qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentIntersectsQuad=function segmentIntersectsQuad(x1,y1,x2,y2,q){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);const tlx=q.getTlx(),tly=q.getTly(),trx=q.getTrx(),try_=q.getTry(),brx=q.getBrx(),bry=q.getBry(),blx=q.getBlx(),bly=q.getBly();return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,tlx,tly,trx,try_)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,trx,try_,brx,bry)||C3.segmentsIntersectPreCalc(x1, +y1,x2,y2,min_x,max_x,min_y,max_y,brx,bry,blx,bly)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,blx,bly,tlx,tly)}; +C3.segmentIntersectsAnyN=function segmentIntersectsAnyN(x1,y1,x2,y2,points){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);let i=0;for(let last=points.length-4;i<=last;i+=2)if(C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[i+2],points[i+3]))return true;return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[0],points[1])};const NO_HIT=2; +const PADDING=1E-6;C3.rayIntersect=function rayIntersect(rx1,ry1,rx2,ry2,sx1,sy1,sx2,sy2){const rdx=rx2-rx1;const rdy=ry2-ry1;const sdx=sx2-sx1;const sdy=sy2-sy1;const det=rdx*sdy-rdy*sdx;if(det===0)return NO_HIT;const gamma=((ry1-ry2)*(sx2-rx1)+rdx*(sy2-ry1))/det;if(0=0&&v>=0&&u+v<=1}; +C3.triangleCartesianToBarycentric=function triangleCartesianToBarycentric(px,py,tx1,ty1,tx2,ty2,tx3,ty3){const v0x=tx2-tx1;const v0y=ty2-ty1;const v1x=tx3-tx1;const v1y=ty3-ty1;const v2x=px-tx1;const v2y=py-ty1;const dot00=v0x*v0x+v0y*v0y;const dot01=v0x*v1x+v0y*v1y;const dot11=v1x*v1x+v1y*v1y;const dot20=v2x*v0x+v2y*v0y;const dot21=v2x*v1x+v2y*v1y;const denom=dot00*dot11-dot01*dot01;const v=(dot11*dot20-dot01*dot21)/denom;const w=(dot00*dot21-dot01*dot20)/denom;const u=1-v-w;return[u,v,w]}; +C3.triangleBarycentricToCartesian3d=function triangleBarycentricToCartesian3d(u,v,w,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3){return[u*tx1+v*tx2+w*tx3,u*ty1+v*ty2+w*ty3,u*tz1+v*tz2+w*tz3]}; + +} + +// ../lib/misc/miscutil.js +{ +'use strict';const C3=self.C3;let mainDocument=null;let baseHref="";if(typeof document!=="undefined"){mainDocument=document;const baseElem=document.querySelector("base");baseHref=baseElem&&baseElem.hasAttribute("href")?baseElem.getAttribute("href"):"";if(baseHref){if(baseHref.startsWith("/"))baseHref=baseHref.substr(1);if(!baseHref.endsWith("/"))baseHref+="/"}}C3.GetBaseHref=function GetBaseHref(){return baseHref}; +C3.GetBaseURL=function GetBaseURL(){if(!mainDocument)return"";const loc=mainDocument.location;return C3.GetPathFromURL(loc.origin+loc.pathname)+baseHref};C3.GetPathFromURL=function GetPathFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return url;const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return"";return url.substr(0,lastSlash+1)}; +C3.GetFilenameFromURL=function GetFilenameFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return"";const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return url;return url.substr(lastSlash+1)};C3.GetFileExtension=function GetFileExtension(filename){let i=filename.lastIndexOf(".");if(i<1)return"";else return filename.substr(i)}; +C3.SetFileExtension=function SetFileExtension(filename,newExt){const i=filename.lastIndexOf(".");if(i===-1)return filename+"."+newExt;else return filename.substr(0,i+1)+newExt};C3.GetFileNamePart=function GetFileNamePart(filename){let i=filename.lastIndexOf(".");if(i<1)return filename;else return filename.substr(0,i)};C3.NormalizeFileSeparator=function NormalizeFileSeparator(path){return path.replace(/\\/g,"/")}; +C3.IsFileExtension=function IsFileExtension(filename,extension){const ext=filename?C3.GetFileExtension(filename).slice(1):"";return extension===ext}; +C3.FileNameEquals=function FileNameEquals(file_or_filename,other_file_or_filename){let firstName;let secondName;if(C3.IsFileLike(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename["name"]);if(C3.IsString(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename);if(C3.IsFileLike(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename["name"]);if(C3.IsString(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename);return firstName===secondName}; +C3.ParseFilePath=function ParseFilePath(path){path=C3.NormalizeFileSeparator(path);let root=/^\w:\//.exec(path);if(root){root=root[0];path=path.slice(3);if(path[0]!=="/")path="/"+path}else root="";path=path.replace(/\/{2,}/g,"/");if(path.length>1&&path.slice(-1)==="/")path=path.slice(0,-1);const start=path.lastIndexOf("/")+1;let dir="",base=path,name,ext="";if(start>0){dir=path.slice(0,start);base=path.slice(start)}name=base;const end=base.lastIndexOf(".");if(end>0){ext=base.slice(end);name=base.slice(0, +-ext.length)}const full=root+dir+base;return{dir,base,name,root,ext,full}};C3.Wait=function Wait(delay,argument){return new Promise((resolve,reject)=>{self.setTimeout(resolve,delay,argument)})};C3.swallowException=function swallowException(f){try{f()}catch(e){if(C3.isDebug)console.warn("Swallowed exception: ",e)}};C3.noop=function noop(){};C3.equalsNoCase=function equalsNoCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;return a===b||a.normalize().toLowerCase()===b.normalize().toLowerCase()}; +C3.equalsCase=function equalsCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;if(a===b)return true;return a.normalize()===b.normalize()};C3.typedArraySet16=function typedArraySet16(dest,src,i){dest[i++]=src[0];dest[i++]=src[1];dest[i++]=src[2];dest[i++]=src[3];dest[i++]=src[4];dest[i++]=src[5];dest[i++]=src[6];dest[i++]=src[7];dest[i++]=src[8];dest[i++]=src[9];dest[i++]=src[10];dest[i++]=src[11];dest[i++]=src[12];dest[i++]=src[13];dest[i++]=src[14];dest[i]=src[15]}; +C3.truncateArray=function truncateArray(arr,index){arr.length=index};C3.clearArray=function clearArray(arr){if(!arr)return;if(arr.length===0)return;C3.truncateArray(arr,0)};C3.clear2DArray=function clear2DArray(arr){if(!arr)return;for(let i=0;iarrayLength)C3.extendArray(arr,len,filler)};C3.shallowAssignArray=function shallowAssignArray(dest,src){C3.clearArray(dest);C3.appendArray(dest,src)};C3.appendArray=function appendArray(a,b){if(b.length<1E4)a.push(...b);else for(let i=0,len=b.length;i=arr.length)return;let len=arr.length-1;for(let i=index;i=0)a.splice(i,1)};C3.arraysEqual=function arraysEqual(a,b){let len=a.length;if(b.length!==len)return false;for(let i=0;i=0&&indexy;case 5:return x>=y;default:return false}}; +C3.hasAnyOwnProperty=function hasAnyOwnProperty(o){for(let p in o)if(o.hasOwnProperty(p))return true;return false}; +C3.PromiseAllWithProgress=function PromiseAllWithProgress(arr,progressCallback){if(!arr.length)return Promise.resolve([]);return new Promise((resolve,reject)=>{const results=[];let numberCompleted=0;let cancelled=false;for(let i=0,len=arr.length;i{if(cancelled)return;results[i]=result;++numberCompleted;if(numberCompleted===arr.length)resolve(results);else progressCallback(numberCompleted,arr.length)}).catch(err=>{cancelled=true;reject(err)})}})}; +let memoryCallbacks=[];C3.AddLibraryMemoryCallback=function AddLibraryMemoryCallback(f){memoryCallbacks.push(f)};C3.GetEstimatedLibraryMemoryUsage=function GetEstimatedLibraryMemoryUsage(){let ret=0;for(let f of memoryCallbacks){let m=f();ret+=m}return Math.floor(ret)};let nextTaskId=1;const activeTaskIds=new Map;const taskMessageChannel=new MessageChannel;taskMessageChannel.port2.onmessage=function OnTask(e){const id=e.data;const callback=activeTaskIds.get(id);activeTaskIds.delete(id);if(callback)callback(performance.now())}; +C3.RequestUnlimitedAnimationFrame=function RequestUnlimitedAnimationFrame(callback){const id=nextTaskId++;activeTaskIds.set(id,callback);taskMessageChannel.port1.postMessage(id);return id};C3.CancelUnlimitedAnimationFrame=function CancelUnlimitedAnimationFrame(id){activeTaskIds.delete(id)};C3.PostTask=C3.RequestUnlimitedAnimationFrame;C3.WaitForNextTask=function WaitForNextTask(){return new Promise(resolve=>C3.PostTask(resolve))};const activeRPAFids=new Set; +C3.RequestPostAnimationFrame=function RequestPostAnimationFrame(callback){const id=self.requestAnimationFrame(async timestamp=>{await C3.WaitForNextTask();if(!activeRPAFids.has(id))return;activeRPAFids.delete(id);callback(timestamp)});activeRPAFids.add(id);return id};C3.CancelPostAnimationFrame=function CancelPostAnimationFrame(id){if(!activeRPAFids.has(id))return;self.cancelAnimationFrame(id);activeRPAFids.delete(id)}; + +} + +// lib/misc/runtimeutil.js +{ +'use strict';const C3=self.C3;C3.IsAbsoluteURL=function IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"};C3.IsRelativeURL=function IsRelativeURL(url){return!C3.IsAbsoluteURL(url)};C3.ThrowIfNotOk=function ThrowIfNotOk(response){if(!response.ok)throw new Error(`fetch '${response.url}' response returned ${response.status} ${response.statusText}`);}; +C3.FetchOk=function FetchOk(url,init){return fetch(url,init).then(response=>{C3.ThrowIfNotOk(response);return response})};C3.FetchText=function FetchText(url){return C3.FetchOk(url).then(response=>response.text())};C3.FetchJson=function FetchJson(url){return C3.FetchOk(url).then(response=>response.json())};C3.FetchBlob=function FetchBlob(url){return C3.FetchOk(url).then(response=>response.blob())};C3.FetchArrayBuffer=function FetchArrayBuffer(url){return C3.FetchOk(url).then(response=>response.arrayBuffer())}; +C3.FetchImage=function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})};C3.BlobToArrayBuffer=function BlobToArrayBuffer(blob){if(typeof blob["arrayBuffer"]==="function")return blob["arrayBuffer"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsArrayBuffer(blob)})}; +C3.BlobToString=function BlobToString(blob){if(typeof blob["text"]==="function")return blob["text"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsText(blob)})};C3.BlobToJson=function BlobToJson(blob){return C3.BlobToString(blob).then(text=>JSON.parse(text))}; +C3.BlobToImage=async function BlobToImage(blob,decodeImage){let blobUrl=URL.createObjectURL(blob);try{const img=await C3.FetchImage(blobUrl);URL.revokeObjectURL(blobUrl);blobUrl="";if(decodeImage&&typeof img["decode"]==="function")await img["decode"]();return img}finally{if(blobUrl)URL.revokeObjectURL(blobUrl)}}; +C3.CreateCanvas=function CreateCanvas(width,height){if(typeof document!=="undefined"&&typeof document.createElement==="function"){const canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;return canvas}else return new OffscreenCanvas(width,height)}; +C3.CanvasToBlob=function CanvasToBlob(canvas,type,quality){if(typeof quality!=="number")quality=1;type=type||"image/png";quality=C3.clamp(quality,0,1);if(canvas.toBlob)return new Promise(resolve=>canvas.toBlob(resolve,type,quality));else if(canvas["convertToBlob"])return canvas["convertToBlob"]({"type":type,"quality":quality});else throw new Error("could not convert canvas to blob");}; +C3.DrawableToBlob=function DrawableToBlob(drawable,type,quality){const canvas=C3.CreateCanvas(drawable.width,drawable.height);const ctx=canvas.getContext("2d");ctx.drawImage(drawable,0,0);return C3.CanvasToBlob(canvas,type,quality)}; +C3.ImageDataToBlob=function ImageDataToBlob(imageData,type,quality){if(C3.Supports.ImageBitmapOptions)return createImageBitmap(imageData,{"premultiplyAlpha":"none"}).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else if(C3.Supports.ImageBitmap)return createImageBitmap(imageData).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else{const canvas=C3.CreateCanvas(imageData.width,imageData.height);const ctx=canvas.getContext("2d");ctx.putImageData(imageData,0,0);return C3.CanvasToBlob(canvas, +type,quality)}};C3.CopySet=function CopySet(dest,src){dest.clear();for(const x of src)dest.add(x)};C3.MapToObject=function MapToObject(map){const ret=Object.create(null);for(const [k,v]of map.entries())ret[k]=v;return ret};C3.ObjectToMap=function ObjectToMap(o,map){map.clear();for(const [k,v]of Object.entries(o))map.set(k,v)}; +C3.ToSuperJSON=function ToSuperJSON(v){if(typeof v==="object"&&v!==null)if(v instanceof Set)return{"_c3type_":"set","data":[...v].map(o=>ToSuperJSON(o))};else if(v instanceof Map)return{"_c3type_":"map","data":[...v].map(pair=>[pair[0],ToSuperJSON(pair[1])])};else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=ToSuperJSON(value);return ret}return v}; +C3.FromSuperJSON=function FromSuperJSON(v){if(typeof v==="object"&v!==null)if(v["_c3type_"]==="set")return new Set(v["data"].map(o=>FromSuperJSON(o)));else if(v["_c3type_"]==="map")return new Map(v["data"].map(pair=>[pair[0],FromSuperJSON(pair[1])]));else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=FromSuperJSON(value);return ret}return v}; +C3.CSSToCamelCase=function(str){if(str.startsWith("--"))return str;let ret="";let isAfterHyphen=false;for(const ch of str)if(ch==="-")isAfterHyphen=true;else if(isAfterHyphen){ret+=ch.toUpperCase();isAfterHyphen=false}else ret+=ch;return ret};C3.IsIterator=function(o){return typeof o==="object"&&typeof o.next==="function"}; +C3.MakeFilledArray=function MakeFilledArray(len,data){const ret=[];if(typeof data==="function")for(let i=0;i1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p} +C3.Color=class Color{constructor(r,g,b,a){this._r=NaN;this._g=NaN;this._b=NaN;this._a=NaN;this._r=0;this._g=0;this._b=0;this._a=0;if(r instanceof C3.Color)this.set(r);else this.setRgba(r||0,g||0,b||0,a||0)}setRgb(r,g,b){this._r=+r;this._g=+g;this._b=+b;this.clamp();return this}setRgba(r,g,b,a){this._r=+r;this._g=+g;this._b=+b;this._a=+a;this.clamp();return this}set(c){this._r=c._r;this._g=c._g;this._b=c._b;this._a=c._a;return this}copy(c){return this.set(c)}add(c){this._r+=c._r;this._g+=c._g;this._b+= +c._b;this._a+=c._a;this.clamp()}addRgb(r,g,b,a=0){this._r+=+r;this._g+=+g;this._b+=+b;this._a+=+a;this.clamp()}diff(c){this.setR(Math.max(this._r,c._r)-Math.min(this._r,c._r));this.setG(Math.max(this._g,c._g)-Math.min(this._g,c._g));this.setB(Math.max(this._b,c._b)-Math.min(this._b,c._b));this.setA(Math.max(this._a,c._a)-Math.min(this._a,c._a));this.clamp()}copyRgb(c){this._r=c._r;this._g=c._g;this._b=c._b}setR(r){this._r=C3.clamp(+r,0,1)}getR(){return this._r}setG(g){this._g=C3.clamp(+g,0,1)}getG(){return this._g}setB(b){this._b= +C3.clamp(+b,0,1)}getB(){return this._b}setA(a){this._a=C3.clamp(+a,0,1)}getA(){return this._a}clone(){return C3.New(C3.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i++]=this._b;ta[i]=this._a}writeRGBToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i]=this._b}equals(c){return this._r===c._r&&this._g===c._g&&this._b===c._b&&this._a===c._a}equalsIgnoringAlpha(c){return this._r=== +c._r&&this._g===c._g&&this._b===c._b}equalsRgb(r,g,b){return this._r===r&&this._g===g&&this._b===b}equalsRgba(r,g,b,a){return this._r===r&&this._g===g&&this._b===b&&this._a===a}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)&&arr[offset+3]===Math.fround(this._a)}equalsRGBF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)}multiply(c){this._r*= +c._r;this._g*=c._g;this._b*=c._b;this._a*=c._a}multiplyAlpha(a){this._r*=a;this._g*=a;this._b*=a;this._a*=a}premultiply(){this._r*=this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=C3.clamp(this._r,0,1);this._g=C3.clamp(this._g,0,1);this._b=C3.clamp(this._b,0,1);this._a=C3.clamp(this._a,0,1);return this}setFromRgbValue(rgb){this._r=C3.GetRValue(rgb);this._g=C3.GetGValue(rgb);this._b=C3.GetBValue(rgb); +this._a=C3.GetAValue(rgb)}getCssRgb(_r,_g,_b){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();return`rgb(${r*100}%, ${g*100}%, ${b*100}%)`}getCssRgba(_r,_g,_b,_a){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();const a=C3.IsFiniteNumber(_a)?_a:this.getA();return`rgba(${r*100}%, ${g*100}%, ${b*100}%, ${a})`}toHexString(){const rh= +Math.round(this.getR()*255);const gh=Math.round(this.getG()*255);const bh=Math.round(this.getB()*255);return"#"+padTwoDigits(rh.toString(16))+padTwoDigits(gh.toString(16))+padTwoDigits(bh.toString(16))}parseHexString(str){if(typeof str!=="string")return false;str=str.trim();if(str.charAt(0)==="#")str=str.substr(1);let rv;let gv;let bv;if(str.length===3){rv=parseInt(str[0],16)/15;gv=parseInt(str[1],16)/15;bv=parseInt(str[2],16)/15}else if(str.length===6){rv=parseInt(str.substr(0,2),16)/255;gv=parseInt(str.substr(2, +2),16)/255;bv=parseInt(str.substr(4,2),16)/255}else return false;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}toCommaSeparatedRgb(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return`${rv}, ${gv}, ${bv}`}toRgbArray(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return[rv,gv,bv]}parseCommaSeparatedRgb(str){if(typeof str!== +"string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(),10)/255;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedPercentageRgb(str){if(typeof str!=="string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false; +const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(), +10)/255;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseCommaSeparatedPercentageRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv); +if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseString(str){if(typeof str!=="string")return false;str=str.replace(/\s+/,"");if(str.includes(","))if(str.startsWith("rgb("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgb(str);else return this.parseCommaSeparatedRgb(str);else if(str.startsWith("rgba("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgba(str);else return this.parseCommaSeparatedRgba(str);else if(str.startsWith("hsl(")|| +str.startsWith("hsla("))return this.parseHSLString(str);else{const components=str.split(",");if(str.includes("%")){if(components.length===3)return this.parseCommaSeparatedPercentageRgb(str);else if(components.length===4)return this.parseCommaSeparatedPercentageRgba(str);return false}else{if(components.length===3)return this.parseCommaSeparatedRgb(str);else if(components.length===4)return this.parseCommaSeparatedRgba(str);return false}}else return this.parseHexString(str)}toJSON(){return[this._r,this._g, +this._b,this._a]}setFromHSLA(h,s,l,a){let r;let g;let b;h%=360;s=C3.clamp(s,0,100);l=C3.clamp(l,0,100);a=C3.clamp(a,0,1);h/=360;s/=100;l/=100;if(s===0)r=g=b=l;else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=hueToRGB(p,q,h+1/3);g=hueToRGB(p,q,h);b=hueToRGB(p,q,h-1/3)}this.setR(r);this.setG(g);this.setB(b);this.setA(a);return this}parseHSLString(str){const cleanString=str.replace(/ |hsl|hsla|\(|\)|;/gi,"");const hsl=HSL_TEST.exec(cleanString);const hsla=HSLA_TEST.exec(cleanString);if(hsl&&hsl.length=== +4){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],1);return true}else if(hsla&&hsla.length===5){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],+hsl[4]);return true}return false}toHSLAString(){const r=this._r;const g=this._g;const b=this._b;const a=this._a;const h=C3.Color.GetHue(r,g,b);const s=C3.Color.GetSaturation(r,g,b);const l=C3.Color.GetLuminosity(r,g,b);return`hsla(${h}, ${s}%, ${l}%, ${a})`}toHSLAArray(){const r=this._r;const g=this._g;const b=this._b;return[C3.Color.GetHue(r,g,b),C3.Color.GetSaturation(r, +g,b),C3.Color.GetLuminosity(r,g,b),this._a]}setFromJSON(arr){if(!Array.isArray(arr))return;if(arr.length<3)return;this._r=arr[0];this._g=arr[1];this._b=arr[2];if(arr.length>=4)this._a=arr[3];else this._a=1}set r(r){this.setR(r)}get r(){return this.getR()}set g(g){this.setG(g)}get g(){return this.getG()}set b(b){this.setB(b)}get b(){return this.getB()}set a(a){this.setA(a)}get a(){return this.getA()}setAtIndex(i,v){switch(i){case 0:this.setR(v);break;case 1:this.setG(v);break;case 2:this.setB(v);break; +case 3:this.setA(v);break;default:throw new RangeError("invalid color index");}}getAtIndex(i){switch(i){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(color_or_json_1,color_or_json_2){let c1;let c2;if(Array.isArray(color_or_json_1)){c1=new C3.Color;c1.setFromJSON(color_or_json_1)}else if(color_or_json_1 instanceof C3.Color)c1=color_or_json_1;else throw new Error("unexpected type"); +if(Array.isArray(color_or_json_2)){c2=new C3.Color;c2.setFromJSON(color_or_json_2)}else if(color_or_json_2 instanceof C3.Color)c2=color_or_json_2;else throw new Error("unexpected type");return c1.equals(c2)}static DiffChannel(channel1,channel2){return C3.clamp(Math.max(channel1,channel2)-Math.min(channel1,channel2),0,1)}static Diff(c1,c2){const ret=new C3.Color;ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)- +Math.min(c1._b,c2._b));ret.setA(Math.max(c1._a,c2._a)-Math.min(c1._a,c2._a));return ret}static DiffNoAlpha(c1,c2){const ret=new C3.Color(0,0,0,1);ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)-Math.min(c1._b,c2._b));return ret}static GetHue(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);if(max===min)return 0;let h=0;switch(max){case r:h=(g-b)/(max-min)+(g.5?d/(2-max-min):d/(max+min);return Math.round(s*100)}static GetLuminosity(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);const l=(max+min)/2;if(!max)return 0;return Math.round(l*100)}};C3.Color.White=Object.freeze(C3.New(C3.Color,1,1,1,1)); +C3.Color.Black=Object.freeze(C3.New(C3.Color,0,0,0,1));C3.Color.TransparentBlack=Object.freeze(C3.New(C3.Color,0,0,0,0)); + +} + +// ../lib/misc/vector2.js +{ +'use strict';const C3=self.C3; +C3.Vector2=class Vector2{constructor(x,y){this._x=0;this._y=0;if(x instanceof C3.Vector2)this.copy(x);else this.set(x||0,y||0)}set(x,y){this._x=+x;this._y=+y}copy(v){this._x=v._x;this._y=v._y}equals(v){return this._x===v._x&&this._y===v._y}equalsValues(x,y){return this._x===x&&this._y===y}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._x)&&arr[offset+1]===Math.fround(this._y)}setX(x){this._x=+x}getX(){return this._x}setY(y){this._y=+y}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta, +i){ta[i++]=this._x;ta[i]=this._y}offset(x,y){this._x+=+x;this._y+=+y}scale(x,y){this._x*=x;this._y*=y}divide(x,y){this._x/=x;this._y/=y}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return C3.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.hypot(this._x,this._y)}rotatePrecalc(sin_a,cos_a){const temp= +this._x*cos_a-this._y*sin_a;this._y=this._y*cos_a+this._x*sin_a;this._x=temp}rotate(a){if(a===0)return;this.rotatePrecalc(Math.sin(a),Math.cos(a))}rotateAbout(a,x,y){if(a===0||x===this._x&&y===this._y)return;this._x-=x;this._y-=y;this.rotatePrecalc(Math.sin(a),Math.cos(a));this._x+=+x;this._y+=+y}move(a,dist){if(dist===0)return;this._x+=Math.cos(a)*dist;this._y+=Math.sin(a)*dist}normalize(){const m=this.length();if(m!==0&&m!==1){this._x/=m;this._y/=m}}clamp(lower,upper){this._x=C3.clamp(this._x,lower, +upper);this._y=C3.clamp(this._y,lower,upper)}}; + +} + +// ../lib/misc/rect.js +{ +'use strict';const C3=self.C3; +C3.Rect=class Rect{constructor(left,top,right,bottom){this._left=NaN;this._top=NaN;this._right=NaN;this._bottom=NaN;this._left=0;this._top=0;this._right=0;this._bottom=0;if(left instanceof C3.Rect)this.copy(left);else this.set(left||0,top||0,right||0,bottom||0)}set(left,top,right,bottom){this._left=+left;this._top=+top;this._right=+right;this._bottom=+bottom}setWH(left,top,width,height){left=+left;top=+top;this._left=left;this._top=top;this._right=left+ +width;this._bottom=top+ +height}copy(rect){this._left= ++rect._left;this._top=+rect._top;this._right=+rect._right;this._bottom=+rect._bottom}clone(){return new C3.Rect(this._left,this._top,this._right,this._bottom)}static Merge(first,second){const ret=new C3.Rect;ret.setLeft(Math.min(first._left,second._left));ret.setTop(Math.min(first._top,second._top));ret.setRight(Math.max(first._right,second._right));ret.setBottom(Math.max(first._bottom,second._bottom));return ret}static FromObject(o){return new C3.Rect(o.left,o.top,o.right,o.bottom)}equals(rect){return this._left=== +rect._left&&this._top===rect._top&&this._right===rect._right&&this._bottom===rect._bottom}equalsWH(x,y,w,h){return this._left===x&&this._top===y&&this.width()===w&&this.height()===h}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._left)&&arr[offset+1]===Math.fround(this._top)&&arr[offset+2]===Math.fround(this._right)&&arr[offset+3]===Math.fround(this._bottom)}setLeft(l){this._left=+l}getLeft(){return this._left}setTop(t){this._top=+t}getTop(){return this._top}setRight(r){this._right= ++r}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i]=this._bottom}writeAsQuadToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i++]=this._top;ta[i++]= +this._right;ta[i++]=this._bottom;ta[i++]=this._left;ta[i]=this._bottom}writeAsQuadToTypedArray3D(ta,i,z){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._bottom;ta[i++]=z;ta[i++]=this._left;ta[i++]=this._bottom;ta[i]=z}width(){return this._right-this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(x,y){x=+x;y=+y;this._left+=x;this._top+= +y;this._right+=x;this._bottom+=y}offsetLeft(x){this._left+=+x}offsetTop(y){this._top+=+y}offsetRight(x){this._right+=+x}offsetBottom(y){this._bottom+=+y}toSquare(axis){if(axis!=="x")throw new Error("invalid axis, only 'x' supported");if(this._topthis._right)this.swapLeftRight(); +if(this._top>this._bottom)this.swapTopBottom()}intersectsRect(rect){return!(rect._rightthis._right||rect._top>this._bottom)}intersectsRectOffset(rect,x,y){return!(rect._right+xthis._right||rect._top+y>this._bottom)}containsPoint(x,y){return x>=this._left&&x<=this._right&&y>=this._top&&y<=this._bottom}containsRect(rect){return rect._left>=this._left&&rect._top>=this._top&&rect._right<=this._right&&rect._bottom<= +this._bottom}expandToContain(rect){if(rect._leftthis._right)this._right=+rect._right;if(rect._bottom>this._bottom)this._bottom=+rect._bottom}lerpInto(rect){this._left=C3.lerp(rect._left,rect._right,this._left);this._top=C3.lerp(rect._top,rect._bottom,this._top);this._right=C3.lerp(rect._left,rect._right,this._right);this._bottom=C3.lerp(rect._top,rect._bottom,this._bottom)}}; + +} + +// ../lib/misc/quad.js +{ +'use strict';const C3=self.C3; +C3.Quad=class Quad{constructor(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=NaN;this._tly=NaN;this._trx=NaN;this._try=NaN;this._brx=NaN;this._bry=NaN;this._blx=NaN;this._bly=NaN;this._tlx=0;this._tly=0;this._trx=0;this._try=0;this._brx=0;this._bry=0;this._blx=0;this._bly=0;if(tlx instanceof C3.Quad)this.copy(tlx);else this.set(tlx||0,tly||0,trx||0,try_||0,brx||0,bry||0,blx||0,bly||0)}set(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=+tlx;this._tly=+tly;this._trx=+trx;this._try=+try_;this._brx=+brx;this._bry= ++bry;this._blx=+blx;this._bly=+bly}setRect(left,top,right,bottom){this.set(left,top,right,top,right,bottom,left,bottom)}copy(q){this._tlx=q._tlx;this._tly=q._tly;this._trx=q._trx;this._try=q._try;this._brx=q._brx;this._bry=q._bry;this._blx=q._blx;this._bly=q._bly}equals(q){return this._tlx===q._tlx&&this._tly===q._tly&&this._trx===q._trx&&this._try===q._try&&this._brx===q._brx&&this._bry===q._bry&&this._blx===q._blx&&this._bly===q._bly}setTlx(v){this._tlx=+v}getTlx(){return this._tlx}setTly(v){this._tly= ++v}getTly(){return this._tly}setTrx(v){this._trx=+v}getTrx(){return this._trx}setTry(v){this._try=+v}getTry(){return this._try}setBrx(v){this._brx=+v}getBrx(){return this._brx}setBry(v){this._bry=+v}getBry(){return this._bry}setBlx(v){this._blx=+v}getBlx(){return this._blx}setBly(v){this._bly=+v}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx, +this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=this._blx;ta[i]=this._bly}writeToTypedArray3D(ta,i,z){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=z;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=z;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=z;ta[i++]=this._blx;ta[i++]=this._bly;ta[i]=z}offset(x, +y){x=+x;y=+y;this._tlx+=x;this._tly+=y;this._trx+=x;this._try+=y;this._brx+=x;this._bry+=y;this._blx+=x;this._bly+=y}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try); +this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(rect){this._tlx=rect._left;this._tly=rect._top;this._trx=rect._right;this._try=rect._top;this._brx=rect._right; +this._bry=rect._bottom;this._blx=rect._left;this._bly=rect._bottom}setFromRotatedRect(rect,a){if(a===0)this.setFromRect(rect);else this.setFromRotatedRectPrecalc(rect,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(rect,sin_a,cos_a){const left_sin_a=rect._left*sin_a;const top_sin_a=rect._top*sin_a;const right_sin_a=rect._right*sin_a;const bottom_sin_a=rect._bottom*sin_a;const left_cos_a=rect._left*cos_a;const top_cos_a=rect._top*cos_a;const right_cos_a=rect._right*cos_a;const bottom_cos_a=rect._bottom* +cos_a;this._tlx=left_cos_a-top_sin_a;this._tly=top_cos_a+left_sin_a;this._trx=right_cos_a-top_sin_a;this._try=top_cos_a+right_sin_a;this._brx=right_cos_a-bottom_sin_a;this._bry=bottom_cos_a+right_sin_a;this._blx=left_cos_a-bottom_sin_a;this._bly=bottom_cos_a+left_sin_a}getBoundingBox(rect){rect.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(x, +y){let v0x=this._trx-this._tlx;let v0y=this._try-this._tly;const v1x=this._brx-this._tlx;const v1y=this._bry-this._tly;const v2x=x-this._tlx;const v2y=y-this._tly;let dot00=v0x*v0x+v0y*v0y;let dot01=v0x*v1x+v0y*v1y;let dot02=v0x*v2x+v0y*v2y;const dot11=v1x*v1x+v1y*v1y;const dot12=v1x*v2x+v1y*v2y;let invDenom=1/(dot00*dot11-dot01*dot01);let u=(dot11*dot02-dot01*dot12)*invDenom;let v=(dot00*dot12-dot01*dot02)*invDenom;if(u>=0&&v>0&&u+v<1)return true;v0x=this._blx-this._tlx;v0y=this._bly-this._tly;dot00= +v0x*v0x+v0y*v0y;dot01=v0x*v1x+v0y*v1y;dot02=v0x*v2x+v0y*v2y;invDenom=1/(dot00*dot11-dot01*dot01);u=(dot11*dot02-dot01*dot12)*invDenom;v=(dot00*dot12-dot01*dot02)*invDenom;return u>=0&&v>0&&u+v<1}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(x1,y1,x2,y2){if(this.containsPoint(x1,y1)||this.containsPoint(x2,y2))return true;return C3.segmentIntersectsQuad(x1,y1,x2,y2,this)}intersectsQuad(rhs){let midX=rhs.midX();let midY= +rhs.midY();if(this.containsPoint(midX,midY))return true;midX=this.midX();midY=this.midY();if(rhs.containsPoint(midX,midY))return true;const tlx=this._tlx,tly=this._tly,trx=this._trx,try_=this._try,brx=this._brx,bry=this._bry,blx=this._blx,bly=this._bly;return C3.segmentIntersectsQuad(tlx,tly,trx,try_,rhs)||C3.segmentIntersectsQuad(trx,try_,brx,bry,rhs)||C3.segmentIntersectsQuad(brx,bry,blx,bly,rhs)||C3.segmentIntersectsQuad(blx,bly,tlx,tly,rhs)}rotatePointsAnticlockwise(){const tlx=this._tlx;const tly= +this._tly;this._tlx=this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=tlx;this._bly=tly}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(i,j){const tmp=this._getAtIndex(i);this._setAtIndex(i,this._getAtIndex(j));this._setAtIndex(j,tmp)}_getAtIndex(i){switch(i){case 0:return this._tlx;case 1:return this._tly; +case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(i,v){v=+v;switch(i){case 0:this._tlx=v;break;case 1:this._tly=v;break;case 2:this._trx=v;break;case 3:this._try=v;break;case 4:this._brx=v;break;case 5:this._bry=v;break;case 6:this._blx=v;break;case 7:this._bly=v;break;default:throw new RangeError("invalid quad point index");}}}; + +} + +// lib/misc/collisionPoly.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const DEFAULT_POLY_POINTS=[0,0,1,0,1,1,0,1];const tempQuad=C3.New(C3.Quad); +C3.CollisionPoly=class CollisionPoly extends C3.DefendedBase{constructor(pointsArr,enabled=true){super();if(!pointsArr)pointsArr=DEFAULT_POLY_POINTS;this._ptsArr=Float64Array.from(pointsArr);this._bbox=new C3.Rect;this._isBboxChanged=true;this._enabled=enabled}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(pointsArr){if(this._ptsArr.length===pointsArr.length)this._ptsArr.set(pointsArr);else this._ptsArr=Float64Array.from(pointsArr);this._isBboxChanged= +true}setDefaultPoints(){this.setPoints(DEFAULT_POLY_POINTS)}copy(poly){this.setPoints(poly._ptsArr)}setBboxChanged(){this._isBboxChanged=true}_updateBbox(){if(!this._isBboxChanged)return;const ptsArr=this._ptsArr;let left=ptsArr[0];let top=ptsArr[1];let right=left;let bottom=top;for(let i=0,len=ptsArr.length;iright)right=x;if(ybottom)bottom=y}this._bbox.set(left,top,right,bottom);this._isBboxChanged=false}setFromRect(rc, +offX,offY){let ptsArr=this._ptsArr;if(ptsArr.length!==8){ptsArr=new Float64Array(8);this._ptsArr=ptsArr}ptsArr[0]=rc.getLeft()-offX;ptsArr[1]=rc.getTop()-offY;ptsArr[2]=rc.getRight()-offX;ptsArr[3]=rc.getTop()-offY;ptsArr[4]=rc.getRight()-offX;ptsArr[5]=rc.getBottom()-offY;ptsArr[6]=rc.getLeft()-offX;ptsArr[7]=rc.getBottom()-offY;this._bbox.copy(rc);if(offX!==0||offY!==0)this._bbox.offset(-offX,-offY);this._isBboxChanged=false}setFromQuad(q,offX,offY){tempQuad.copy(q);tempQuad.offset(offX,offY);this.setPoints(tempQuad.toArray()); +this._isBboxChanged=true}transform(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}this.transformPrecalc(w,h,sina,cosa)}transformPrecalc(w,h,sina,cosa){const ptsArr=this._ptsArr;for(let i=0,len=ptsArr.length;i!filter.includes(ease))}static GetRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return[...PREDEFINED_EASE_MAP.keys()].concat(sortedCustomEases)}static GetCustomRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return sortedCustomEases}static IsPredefinedTranslatedName(easeName){for(const k of EASE_TRANSLATION_KEYS){const translatedName= +self.lang(`ui.bars.timeline.eases.${k}`);if(translatedName===easeName)return true}for(const k of SHORT_EASE_TRANSLATION_KEYS){const translatedName=self.lang(`ui.bars.timeline.short-eases.${k}`);if(translatedName===easeName)return true}}static IsNamePredefined(easeName){this._CreateEaseMap();return[...PREDEFINED_EASE_MAP.keys()].includes(easeName)}static _GetEase(easeName){const realEaseName=ALIAS_MAP.get(easeName);if(realEaseName)return EASE_MAP.get(realEaseName);if(Ease.IsNamePredefined(easeName))return EASE_MAP.get(easeName); +if(PRIVATE_EASE_MAP.has(easeName))return PRIVATE_EASE_MAP.get(easeName)}static GetBuiltInTransition(builtInTransitionName){this._CreateEaseMap();return BUILT_IN_TRANSITION_MAP.get(builtInTransitionName)}static GetEditorEase(easeName,project){this._CreateEaseMap();const ease=Ease._GetEase(easeName);if(ease)return ease;if(!project)throw new Error("missing ease function");return CUSTOM_EASE_EDITOR_MAP.get(project).get(easeName)}static HasEditorEase(easeName,project){this._CreateEaseMap();const ease= +Ease._GetEase(easeName);if(ease)return true;return!!CUSTOM_EASE_EDITOR_MAP.get(project).get(easeName)}static GetRuntimeEase(easeName){this._CreateEaseMap();const ease=Ease._GetEase(easeName);if(ease)return ease;return CUSTOM_EASE_RUNTIME_MAP.get(easeName)}static GetEaseFromIndex(index){this._CreateEaseMap();const names=this.GetRuntimeEaseNames();return names[index]}static GetIndexForEase(name,project){this._CreateEaseMap();const names=this.GetEditorEaseNames(project);return names.indexOf(name)}static GetIndexForEaseAtRuntime(name){return this.GetIndexForEase(name)}static _CreateEaseMap(){if(EASE_MAP.size!== +0)return;this._AddPredifinedEase("default",()=>{});this._AddPredifinedEase("noease",[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}],true);this._AddPredifinedEase("easeinsine",[{"x":0,"y":0,"sax":.485,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutsine",[{"x":0,"y":0,"sax":.038,"say":0,"eax":0,"eay":0, +"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.485,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutsine",[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinelastic",[{"x":0,"y":0,"sax":.018,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.116,"y":.002,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.266,"y":-.005,"sax":.024,"say":0, +"eax":-.021,"eay":0,"se":true,"ee":true},{"x":.416,"y":.016,"sax":.024,"say":0,"eax":-.026,"eay":0,"se":true,"ee":true},{"x":.566,"y":-.045,"sax":.061,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.716,"y":.132,"sax":.072,"say":-.004,"eax":-.045,"eay":0,"se":true,"ee":true},{"x":.866,"y":-.373,"sax":.06,"say":0,"eax":-.049,"eay":-.002,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":-.263,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutelastic",[{"x":0,"y":0,"sax":.038, +"say":.263,"eax":0,"eay":0,"se":true,"ee":false},{"x":.136,"y":1.373,"sax":.049,"say":.002,"eax":-.06,"eay":0,"se":true,"ee":true},{"x":.286,"y":.868,"sax":.045,"say":0,"eax":-.072,"eay":.004,"se":true,"ee":true},{"x":.436,"y":1.045,"sax":.025,"say":0,"eax":-.061,"eay":0,"se":true,"ee":true},{"x":.586,"y":.984,"sax":.026,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.736,"y":1.005,"sax":.021,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.886,"y":.998,"sax":.025,"say":0,"eax":-.025, +"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.018,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutelastic",[{"x":0,"y":0,"sax":.025,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.067,"y":.001,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.18,"y":-.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.292,"y":.025,"sax":.053,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.405,"y":-.118,"sax":.069,"say":0,"eax":-.027, +"eay":0,"se":true,"ee":true},{"x":.597,"y":1.118,"sax":.027,"say":0,"eax":-.069,"eay":0,"se":true,"ee":true},{"x":.71,"y":.975,"sax":.025,"say":0,"eax":-.053,"eay":0,"se":true,"ee":true},{"x":.822,"y":1.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.935,"y":.999,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.025,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinback",[{"x":0,"y":0,"sax":.35,"say":0,"eax":0,"eay":0, +"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.34,"eay":-1.579,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutback",[{"x":0,"y":0,"sax":.34,"say":1.579,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.35,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutback",[{"x":0,"y":0,"sax":.035,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.242,"y":-.1,"sax":.258,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.76,"y":1.1,"sax":.025,"say":0, +"eax":-.26,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.035,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinbounce",[{"x":0,"y":0,"sax":.033,"say":.025,"eax":0,"eay":0,"se":true,"ee":false},{"x":.092,"y":0,"sax":.026,"say":.078,"eax":-.033,"eay":.025,"se":true,"ee":true},{"x":.274,"y":0,"sax":.097,"say":.319,"eax":-.026,"eay":.078,"se":true,"ee":true},{"x":.637,"y":0,"sax":.105,"say":.625,"eax":-.097,"eay":.319,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0, +"eax":-.125,"eay":-.004,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutbounce",[{"x":0,"y":0,"sax":.125,"say":.004,"eax":0,"eay":0,"se":true,"ee":false},{"x":.365,"y":1,"sax":.097,"say":-.319,"eax":-.105,"eay":-.625,"se":true,"ee":true},{"x":.728,"y":1,"sax":.026,"say":-.078,"eax":-.097,"eay":-.319,"se":true,"ee":true},{"x":.91,"y":1,"sax":.033,"say":-.025,"eax":-.026,"eay":-.078,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.033,"eay":-.025,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutbounce", +[{"x":0,"y":0,"sax":.01,"say":.006,"eax":0,"eay":0,"se":true,"ee":false},{"x":.046,"y":0,"sax":.021,"say":.038,"eax":-.01,"eay":.006,"se":true,"ee":true},{"x":.137,"y":0,"sax":.059,"say":.158,"eax":-.021,"eay":.038,"se":true,"ee":true},{"x":.319,"y":0,"sax":.117,"say":.744,"eax":-.059,"eay":.158,"se":true,"ee":true},{"x":.683,"y":1,"sax":.059,"say":-.158,"eax":-.117,"eay":-.744,"se":true,"ee":true},{"x":.865,"y":1,"sax":.021,"say":-.038,"eax":-.059,"eay":-.158,"se":true,"ee":true},{"x":.956,"y":1, +"sax":.01,"say":-.006,"eax":-.021,"eay":-.038,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.01,"eay":-.006,"se":false,"ee":true}]);this._AddPredifinedEase("easeincubic",[{"x":0,"y":0,"sax":.75,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.138,"eay":-.321,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutcubic",[{"x":0,"y":0,"sax":.138,"say":.321,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.75,"eay":0,"se":false,"ee":true}]); +this._AddPredifinedEase("easeinoutcubic",[{"x":0,"y":0,"sax":.285,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.081,"say":.272,"eax":-.081,"eay":-.272,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.285,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquad",[{"x":0,"y":0,"sax":.4,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.178,"eay":-.392,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquad",[{"x":0,"y":0, +"sax":.178,"say":.392,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.4,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquad",[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.03,"say":.065,"eax":-.03,"eay":-.065,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquart",[{"x":0,"y":0,"sax":.25,"say":1,"eax":0,"eay":0,"se":true,"ee":false}, +{"x":1,"y":1,"sax":0,"say":0,"eax":-.5,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquart",[{"x":0,"y":0,"sax":.5,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquart",[{"x":0,"y":0,"sax":.765,"say":.03,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.765,"eay":-.03,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquint",[{"x":0,"y":0,"sax":.6, +"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.2,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquint",[{"x":0,"y":0,"sax":.2,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.6,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquint",[{"eax":0,"eay":0,"ee":false,"sax":.84,"say":0,"se":true,"x":0,"y":0},{"eax":-.84,"eay":0,"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPredifinedEase("easeincirc", +[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.024,"eay":-.808,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutcirc",[{"x":0,"y":0,"sax":.024,"say":.808,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutcirc",[{"x":0,"y":0,"sax":.125,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.02,"say":.428,"eax":-.02,"eay":-.428, +"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.125,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinexpo",[{"x":0,"y":0,"sax":.66,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.14,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutexpo",[{"x":0,"y":0,"sax":.14,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.66,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutexpo",[{"eax":0, +"eay":0,"ee":false,"sax":.345,"say":0,"se":true,"x":0,"y":0},{"eax":-.06,"eay":-.5,"ee":true,"sax":.06,"say":.5,"se":true,"x":.5,"y":.5},{"eax":-.335,"eay":0,"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier);this._AddPrivateCustomEase("spline",this.EaseSpline)}static _AddPredifinedEase(name,dataArray_or_function,linear=false){if(typeof dataArray_or_function==="function")Ease._AddEase(name,dataArray_or_function,"predefined");else if(C3.IsArray(dataArray_or_function))if(self.BuiltInTransition){const builtInTransition= +C3.New(self.BuiltInTransition,name,linear);builtInTransition.SetFromJson(dataArray_or_function);Ease._AddEase(name,(t,sv,dv,tt)=>builtInTransition.Interpolate(t,sv,dv,tt),"predefined");BUILT_IN_TRANSITION_MAP.set(name,builtInTransition)}else{const builtInTransition=C3.New(C3.Transition,[name,dataArray_or_function.map(data=>{return[data["x"],data["y"],data["sax"],data["say"],data["eax"],data["eay"],data["se"],data["ee"]]})],false);builtInTransition.MakeLinear(linear);Ease._AddEase(name,(t,sv,dv,tt)=> +builtInTransition.Interpolate(t,sv,dv,tt),"predefined")}else throw new Error("unexpected arguments");}static _AddPrivateCustomEase(name,func){Ease._AddEase(name,func,"private")}static AddCustomEase(name,func,project){this._CreateEaseMap();Ease._AddEase(name,func,"custom",project)}static RemoveCustomEase(name,project){if(this.IsNamePredefined(name))return;if([...PRIVATE_EASE_MAP.keys()].includes(name))return;const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);if(customEaseMap)customEaseMap.delete(name)}static _AddEase(name, +func,mode,project){switch(mode){case "predefined":{EASE_MAP.set(name,func);PREDEFINED_EASE_MAP.set(name,func);break}case "custom":{if(project){if(!CUSTOM_EASE_EDITOR_MAP.has(project))CUSTOM_EASE_EDITOR_MAP.set(project,new Map);const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);customEaseMap.set(name,func)}else CUSTOM_EASE_RUNTIME_MAP.set(name,func);break}case "private":{EASE_MAP.set(name,func);PRIVATE_EASE_MAP.set(name,func);break}default:throw new Error("unexpected ease mode");}}static NoEase(t, +b,c,d){return c*t/d+b}static EaseInQuad(t,b,c,d){return c*(t/=d)*t+b}static EaseOutQuad(t,b,c,d){return-c*(t/=d)*(t-2)+b}static EaseInOutQuad(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b}static EaseInCubic(t,b,c,d){return c*(t/=d)*t*t+b}static EaseOutCubic(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b}static EaseInOutCubic(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b}static EaseInQuart(t,b,c,d){return c*(t/=d)*t*t*t+b}static EaseOutQuart(t,b,c,d){return-c*((t= +t/d-1)*t*t*t-1)+b}static EaseInOutQuart(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b}static EaseInQuint(t,b,c,d){return c*(t/=d)*t*t*t*t+b}static EaseOutQuint(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b}static EaseInOutQuint(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b}static EaseInSine(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b}static EaseOutSine(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b}static EaseInOutSine(t,b,c,d){return-c/2* +(Math.cos(Math.PI*t/d)-1)+b}static EaseInExpo(t,b,c,d){return t===0?b:c*Math.pow(2,10*(t/d-1))+b}static EaseOutExpo(t,b,c,d){return t===d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b}static EaseInOutExpo(t,b,c,d){if(t===0)return b;if(t===d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b}static EaseInCirc(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b}static EaseOutCirc(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b}static EaseInOutCirc(t,b,c,d){if((t/=d/2)<1)return-c/ +2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b}static EaseInElastic(t,b,c,d){let s=1.70158;let p=0;let a=c;if(t===0)return b;if((t/=d)===1)return b+c;if(!p)p=d*.3;if(a{return p3-3*p2+3*p1-p0};const b=(p0,p1,p2,p3)=>{return 3*p2-6*p1+3*p0};const c=(p0,p1,p2,p3)=>{return 3*(p1-p0)};const calc_bezier=(aT,a,b,c)=>{return((a*aT+b)*aT+c)*aT};const get_slope=(aT,a,b,c)=>{return 3*a*aT*aT+2*b*aT+c}; +const get_t_for_x=(aX,p0,p1,p2,p3,samples)=>{if(aX==1)return 1;let intervalStart=0;let currentSampleIndex=1;let currentSampleValue=samples[currentSampleIndex];let lastSampleIndex=SAMPLE_COUNT-1;let lastSampleValue=samples[SAMPLE_COUNT-1];while(currentSampleIndex!=lastSampleIndex&¤tSampleValue<=aX){currentSampleIndex++;currentSampleValue=samples[currentSampleIndex];intervalStart+=SAMPLE_STEP}currentSampleIndex--;currentSampleValue=samples[currentSampleIndex];const dist=(aX-currentSampleValue)/ +(samples[currentSampleIndex+1]-currentSampleValue);let guess=intervalStart+dist*SAMPLE_STEP;const va=a(p0,p1,p2,p3);const vb=b(p0,p1,p2,p3);const vc=c(p0,p1,p2,p3);const initSlope=get_slope(guess,va,vb,vc);if(initSlope===0)return guess;else if(initSlope>=NEWTON_RAPHSON_MIN_SLOPE){for(let i=0;i0)aB=guess;else aA=guess;precissionLimit=Math.abs(x)>SUBDIVISION_PRECISION;maxIterations=++i0)return;C3.clearArray(this._captureListeners);this._captureListenersSet.clear();C3.clearArray(this._listeners);this._listenersSet.clear();C3.clearArray(this._queueModifyListeners);C3.Release(this)}_AddListener(func, +capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"add",func,capture});return}if(capture){if(this._captureListenersSet.has(func))return;this._captureListeners.push(func);this._captureListenersSet.add(func)}else{if(this._listenersSet.has(func))return;this._listeners.push(func);this._listenersSet.add(func)}}_RemoveListener(func,capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"remove",func,capture});return}if(capture){if(this._captureListenersSet.has(func)){this._captureListenersSet.delete(func); +C3.arrayFindRemove(this._captureListeners,func)}}else if(this._listenersSet.has(func)){this._listenersSet.delete(func);C3.arrayFindRemove(this._listeners,func)}}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return this._fireDepth>0}_ProcessQueuedListeners(){const removeListenersSet=new Set;const removeCaptureListenersSet=new Set;for(const q of this._queueModifyListeners)if(q.op==="add"){this._AddListener(q.func,q.capture);if(q.capture)removeCaptureListenersSet.delete(q.func); +else removeListenersSet.delete(q.func)}else if(q.op==="remove")if(q.capture){this._captureListenersSet.delete(q.func);removeCaptureListenersSet.add(q.func)}else{this._listenersSet.delete(q.func);removeListenersSet.add(q.func)}else throw new Error("invalid op");C3.arrayRemoveAllInSet(this._listeners,removeListenersSet);C3.arrayRemoveAllInSet(this._captureListeners,removeCaptureListenersSet);C3.clearArray(this._queueModifyListeners)}_FireCancellable(event){this._IncreaseFireDepth();let isStopped=false; +for(let i=0,len=this._captureListeners.length;i0)this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(e){if(e)this._IncreaseFireDepth();else this._DecreaseFireDepth()}_FireAsync(event){let callbackPromises=[];for(let i=0,len=this._captureListeners.length;i +func(event)))}for(let i=0,len=this._listeners.length;ifunc(event)))}return Promise.all(callbackPromises).then(()=>!event.defaultPrevented)}_FireAndWait_AsyncOptional(event){const results=[];this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i!event.defaultPrevented);else return!event.defaultPrevented}async _FireAndWaitAsync(event){return await this._FireAndWait_AsyncOptional(event)}async _FireAndWaitAsyncSequential(event){this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i0?1:timerTimeout)} +function DoAsyncifiedWork(deadline){callbackId=-1;if(!workQueue.length)return;let startTime=performance.now();let curTime=startTime;let jobCount=0;let estimatedNextJobDuration=0;do{DoNextAsyncifiedJob(workQueue.shift());curTime=performance.now();++jobCount;estimatedNextJobDuration=(curTime-startTime)/jobCount*1.1}while(workQueue.length&&(SUPPORTS_RIC&&highThroughputMode===0&&typeof deadline!=="undefined"?estimatedNextJobDuration{workQueue.push({func:func,resolve:resolve,reject:reject,stack:stack});if(asyncifyDisabled){DoNextAsyncifiedJob(workQueue.pop());return}if(callbackId===-1)SetNewCallback(SETTIMEOUT_INTERVAL)})}; +C3.Asyncify.SetHighThroughputMode=function SetHighThroughputMode(m){if(m)++highThroughputMode;else{--highThroughputMode;if(highThroughputMode<0)throw new Error("already turned off high throughput mode");}}; + +} + +// ../lib/util/idleTimeout.js +{ +'use strict';const C3=self.C3;const IDLE_CHECK_MIN_INTERVAL=1E3;const IDLE_CHECK_TIMER_OVERSHOOT=100;let cachedNowTime=-1;function ClearTimeCache(){cachedNowTime=-1}C3.FastGetDateNow=function FastGetDateNow(){if(cachedNowTime===-1){cachedNowTime=Date.now();self.setTimeout(ClearTimeCache,16)}return cachedNowTime};let timerId=-1;let nextDeadline=-1;let activeIdleTimeouts=new Set; +function CheckActiveIdleTimeouts(){timerId=-1;nextDeadline=-1;let nowTime=Date.now();for(let i of activeIdleTimeouts)if(i._CheckTimeout(nowTime)){let deadline=i._GetDeadline();if(nextDeadline===-1||deadlinenowTime+ +IDLE_CHECK_MIN_INTERVAL){self.clearTimeout(timerId);nextDeadline=this._deadline;timerId=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+IDLE_CHECK_TIMER_OVERSHOOT)}}_CheckTimeout(nowTime){if(nowTime>=this._deadline){if(this._callback()){this._deadline=nowTime+this._timeout;return true}this._isActive=false;return false}return true}_GetDeadline(){return this._deadline}Cancel(){if(this._isActive){activeIdleTimeouts.delete(this);this._isActive=false;if(activeIdleTimeouts.size===0&&timerId!==-1){self.clearTimeout(timerId); +timerId=-1;nextDeadline=-1}}}Release(){this.Cancel();this._callback=null}}; + +} + +// ../lib/util/disposable.js +{ +'use strict';const C3=self.C3; +C3.Disposable=class Disposable{constructor(disposeAction){this._disposed=false;this._disposeAction=disposeAction}Dispose(){if(this._disposed)return;this._disposed=true;if(this._disposeAction){this._disposeAction();this._disposeAction=null}}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(instance){return new Disposable(()=>instance.Release())}static From(eventDispatcher,eventNames,eventHandler,opts,scope){if(typeof opts==="undefined"||opts===null)opts=false;else if(typeof opts!== +"boolean"&&typeof opts!=="object")throw new TypeError("invalid event listener options");if(scope)eventHandler=eventHandler.bind(scope);if(eventNames.includes(" ")){eventNames=eventNames.split(" ");const disposable=new C3.CompositeDisposable;for(let eventName of eventNames){eventDispatcher.addEventListener(eventName,eventHandler,opts);disposable.Add(C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventName,eventHandler,opts)))}return disposable}else{eventDispatcher.addEventListener(eventNames, +eventHandler,opts);return C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventNames,eventHandler,opts))}}};C3.StubDisposable=class StubDisposable extends C3.Disposable{SetAction(disposeAction){this._disposeAction=disposeAction}}; +C3.CompositeDisposable=class CompositeDisposable extends C3.Disposable{constructor(...disposables){super();this._disposables=new Set;for(let disposable of disposables)this.Add(disposable)}Add(...disposables){if(this._disposed)throw new Error("already disposed");for(let disposable of disposables)this._disposables.add(disposable)}Remove(disposable){if(this._disposed)throw new Error("already disposed");this._disposables.delete(disposable)}RemoveAll(){if(this._disposed)throw new Error("already disposed"); +if(!this._disposables)return;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear()}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw new Error("already disposed");this._disposed=true;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}; + +} + +// lib/util/kahanSum.js +{ +'use strict';const C3=self.C3;C3.KahanSum=class KahanSum extends C3.DefendedBase{constructor(){super();this._c=0;this._y=0;this._t=0;this._sum=0}Add(v){v=+v;this._y=v-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(v){this._sum-=+v}Get(){return this._sum}Reset(){this._c=0;this._y=0;this._t=0;this._sum=0}Set(s){this._c=0;this._y=0;this._t=0;this._sum=+s}Copy(ks){this._c=ks._c;this._y=ks._y;this._t=ks._t;this._sum=ks._sum}Release(){}}; + +} + +// lib/util/redblackset.js +{ +'use strict';const C3=self.C3;const js_cols={};const RED=true;const BLACK=false;js_cols.RBnode=function(tree){this.tree=tree;this.right=this.tree.sentinel;this.left=this.tree.sentinel;this.parent=null;this.color=false;this.key=null};js_cols.RedBlackSet=function(compare_func){this.size=0;this.sentinel=new js_cols.RBnode(this);this.sentinel.color=BLACK;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=compare_func||this.default_compare}; +js_cols.RedBlackSet.prototype.default_compare=function(a,b){if(a0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.right!=this.sentinel)return this.min(x.right).key;var y=x.parent;while(y!=this.sentinel&&x==y.right){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null}; +js_cols.RedBlackSet.prototype.predecessor=function(key){if(this.size>0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.left!=this.sentinel)return this.max(x.left).key;var y=x.parent;while(y!=this.sentinel&&x==y.left){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null};js_cols.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};js_cols.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key}; +js_cols.RedBlackSet.prototype.get_=function(key){var x=this.root;while(x!=this.sentinel&&this.compare(x.key,key)!=0)if(this.compare(key,x.key)<0)x=x.left;else x=x.right;return x};js_cols.RedBlackSet.prototype.contains=function(key){return this.get_(key).key!=null};js_cols.RedBlackSet.prototype.getValues=function(){var ret=[];this.forEach(function(x){ret.push(x)});return ret}; +js_cols.RedBlackSet.prototype.insertAll=function(col){if(js_cols.typeOf(col)=="array")for(var i=0;icolCount)return false;var i=0;if(this.isEmpty())return true;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(js_cols.contains.call(col,col,n.key))i++;return i==this.getCount()}; +js_cols.RedBlackSet.prototype.intersection=function(col){var result=new js_cols.RedBlackSet(this.compare);if(this.isEmpty())return result;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(col.contains.call(col,n.key,n.key,this))result.insert(n.key);return result}; +C3.RedBlackSet=class RedBlackSet extends C3.DefendedBase{constructor(sortFunc){super();this._rbSet=new js_cols.RedBlackSet(sortFunc);this._enableQueue=false;this._queueInsert=new Set;this._queueRemove=new Set}Add(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.delete(item);else this._queueInsert.add(item);else this._rbSet.insert(item)}Remove(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.add(item);else this._queueInsert.delete(item);else this._rbSet.remove(item)}Has(item){if(this._enableQueue){if(this._queueInsert.has(item))return true; +return!this._queueRemove.has(item)&&this._rbSet.contains(item)}else return this._rbSet.contains(item)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw new Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return this.GetSize()===0}Front(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode"); +const rbSet=this._rbSet;const n=rbSet.min(rbSet.root);return n.key}Shift(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode");const item=this.Front();this.Remove(item);return item}SetQueueingEnabled(q){q=!!q;if(this._enableQueue===q)return;this._enableQueue=q;if(!q){for(const item of this._queueRemove)this._rbSet.remove(item);this._queueRemove.clear();for(const item of this._queueInsert)this._rbSet.insert(item);this._queueInsert.clear()}}ForEach(func){this._rbSet.forEach(func)}*values(){if(this.IsEmpty())return; +const rbSet=this._rbSet;for(let n=rbSet.min(rbSet.root);n!=rbSet.sentinel;n=rbSet.successor_(n))yield n.key}[Symbol.iterator](){return this.values()}}; + +} + +// ../lib/util/promiseThrottle.js +{ +'use strict';const C3=self.C3; +C3.PromiseThrottle=class PromiseThrottle{constructor(maxParallel=C3.hardwareConcurrency){this._maxParallel=maxParallel;this._queue=[];this._activeCount=0}Add(func){return new Promise((resolve,reject)=>{this._queue.push({func,resolve,reject});this._MaybeStartNext()})}_FindInQueue(func){for(let i=0,len=this._queue.length;i=this._maxParallel)return;this._activeCount++;const job=this._queue.shift();try{const result=await job.func();job.resolve(result)}catch(err){job.reject(err)}this._activeCount--;this._MaybeStartNext()}static async Batch(concurrency, +methods){const results=[];let failed=false;const execute=async _=>{let fn;while(fn=methods.pop()){if(failed)return;try{results.push(await fn())}catch(e){failed=true;throw e;}}};const promises=[];while(concurrency--)promises.push(execute());await Promise.all(promises);return results}}; + +} + +// ../lib/util/rateLimiter.js +{ +'use strict';const C3=self.C3; +C3.RateLimiter=class RateLimiter{constructor(callback,interval,intervalOnBattery){this._callback=callback;this._interval=interval;this._intervalOnBattery=intervalOnBattery||interval*2;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false;this._callbackArguments=null}SetCanRunImmediate(c){this._canRunImmediate=!!c}_GetInterval(){if(typeof C3.Battery!=="undefined"&&C3.Battery.IsOnBatteryPower())return this._intervalOnBattery;else return this._interval}Call(...args){if(this._timerId!== +-1)return;this._callbackArguments=args;let nowTime=C3.FastGetDateNow();let timeSinceLastCall=nowTime-this._lastCallTime;let interval=this._GetInterval();if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc,Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;const args=this._callbackArguments;this._callbackArguments=null;if(args)this._callback(...args);else this._callback(); +this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._callbackArguments=null;this._lastCallTime=C3.FastGetDateNow()}_OnTimer(){this._timerId=-1;this._lastCallTime=C3.FastGetDateNow();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._callbackArguments=null;this._timerCallFunc=null}}; + +} + +// ../lib/util/svgRaster/svgRasterManager.js +{ +'use strict';const C3=self.C3; +C3.SVGRasterManager=class SVGRasterManager{constructor(){this._images=new Map;this._allowNpotSurfaces=false;this._getBaseSizeCallback=null;this._rasterAtSizeCallback=null;this._releaseResultCallback=null;this._redrawCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(f){this._getBaseSizeCallback=f}GetBaseSize(dataSource){if(!this._getBaseSizeCallback)throw new Error("no get base size callback set");return this._getBaseSizeCallback(dataSource)}SetRasterAtSizeCallback(f){this._rasterAtSizeCallback= +f}RasterAtSize(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight){if(!this._rasterAtSizeCallback)throw new Error("no raster at size callback set");return this._rasterAtSizeCallback(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight)}SetReleaseResultCallback(f){this._releaseResultCallback=f}ReleaseResult(rasterizedResult){if(!this._releaseResultCallback)throw new Error("no release result callback set");this._releaseResultCallback(rasterizedResult)}SetRedrawCallback(f){this._redrawCallback= +f}Redraw(){if(!this._redrawCallback)throw new Error("no redraw callback set");this._redrawCallback()}AddImage(dataSource){let ret=this._images.get(dataSource);if(!ret){ret=C3.New(C3.SVGRasterImage,this,dataSource);this._images.set(dataSource,ret)}ret.IncReference();return ret}_RemoveImage(ri){this._images.delete(ri.GetDataSource())}OnTexturesChanged(){for(const ri of this._images.values()){ri.ReleaseRasterizedResult();ri.ForceRasterAgain()}}}; + +} + +// ../lib/util/svgRaster/svgRasterImage.js +{ +'use strict';const C3=self.C3;const MAX_SURFACE_SIZE=4096; +C3.SVGRasterImage=class SVGRasterImage{constructor(manager,dataSource){this._manager=manager;this._dataSource=dataSource;this._refCount=0;this._baseWidth=0;this._baseHeight=0;this._getBaseSizePromise=this._manager.GetBaseSize(dataSource).then(baseSize=>{if(!this._manager)return;this._baseWidth=baseSize[0];this._baseHeight=baseSize[1];this._manager.Redraw()}).catch(err=>{console.error("[SVG] Error loading SVG: ",err);this._hadError=true;if(this._manager)this._manager.Redraw()});this._rasterSurfaceWidth= +0;this._rasterSurfaceHeight=0;this._rasterImageWidth=0;this._rasterImageHeight=0;this._isRasterizing=false;this._rasterizedResult=null;this._forceRaster=false;this._hadError=false}Release(){if(this._refCount<=0)throw new Error("already released");this._refCount--;if(this._refCount===0)this._Release()}ReleaseRasterizedResult(){if(this._rasterizedResult){this._manager.ReleaseResult(this._rasterizedResult);this._rasterizedResult=null}}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this); +this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return this._refCount>0}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=true}async StartRasterForSize(context,width,height){if(width===0||height===0||this._hadError)return;if(this._isRasterizing)return;let rasterSurfaceWidth=C3.nextHighestPowerOfTwo(Math.ceil(width));let rasterSurfaceHeight=C3.nextHighestPowerOfTwo(Math.ceil(height));const maxDim=Math.max(rasterSurfaceWidth, +rasterSurfaceHeight);if(maxDim>MAX_SURFACE_SIZE){const scale=MAX_SURFACE_SIZE/maxDim;width*=scale;height*=scale;rasterSurfaceWidth=Math.min(Math.ceil(rasterSurfaceWidth*scale),MAX_SURFACE_SIZE);rasterSurfaceHeight=Math.min(Math.ceil(rasterSurfaceHeight*scale),MAX_SURFACE_SIZE)}if(widthimageAspectRatio){width=rasterSurfaceHeight* +imageAspectRatio;height=rasterSurfaceHeight}else{width=rasterSurfaceWidth;height=rasterSurfaceWidth/imageAspectRatio}}if(this._manager.IsNpotSurfaceAllowed()){rasterSurfaceWidth=Math.ceil(width);rasterSurfaceHeight=Math.ceil(height)}if(rasterSurfaceWidth<=this._rasterSurfaceWidth&&rasterSurfaceHeight<=this._rasterSurfaceHeight&&!this._forceRaster)return;this._isRasterizing=true;this._rasterSurfaceWidth=rasterSurfaceWidth;this._rasterSurfaceHeight=rasterSurfaceHeight;const newRasterizedResult=await this._manager.RasterAtSize(this._dataSource, +context,this._rasterSurfaceWidth,this._rasterSurfaceHeight,width,height);if(!this._manager)return;this.ReleaseRasterizedResult();this._rasterizedResult=newRasterizedResult;this._rasterImageWidth=width;this._rasterImageHeight=height;this._isRasterizing=false;this._forceRaster=false;this._manager.Redraw()}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}; + +} + +// ../lib/str/str.js +{ +'use strict';const C3=self.C3;C3.UTF8_BOM="\ufeff";const NUMERIC_CHARS=new Set([..."0123456789"]);C3.IsNumericChar=function IsNumericChar(c){return NUMERIC_CHARS.has(c)};const WHITESPACE_CHARS=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);C3.IsWhitespaceChar=function IsWhitespaceChar(c){return WHITESPACE_CHARS.has(c)};C3.FilterWhitespace=function FilterWhitespace(str){return[...str].filter(ch=>!C3.IsWhitespaceChar(ch)).join("")}; +C3.IsStringAllWhitespace=function IsStringAllWhitespace(str){for(const ch of str)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsCharArrayAllWhitespace=function IsStringAllWhitespace(chArr){for(const ch of chArr)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsUnprintableChar=function IsUnprintableChar(c){return c.length===1&&c.charCodeAt(0)<32};C3.FilterUnprintableChars=function FilterUnprintableChars(str){return[...str].filter(ch=>!C3.IsUnprintableChar(ch)).join("")}; +const NUMERIC_STRING_CHARS=new Set([..."0123456789.+-e"]);C3.IsStringNumber=function IsStringNumber(str){str=str.trim();if(!str.length)return false;let firstChar=str.charAt(0);if(firstChar!=="-"&&!NUMERIC_CHARS.has(firstChar))return false;for(let ch of str)if(!NUMERIC_STRING_CHARS.has(ch))return false;return true};C3.RemoveTrailingDigits=function RemoveTrailingDigits(str){let i=str.length;while(i>0){let prev_ch=str.charAt(i-1);if(!C3.IsNumericChar(prev_ch))break;--i}return str.substr(0,i)}; +C3.IncrementNumberAtEndOf=function IncrementNumberAtEndOf(str){let baseStr=C3.RemoveTrailingDigits(str);let numberStr=str.substr(baseStr.length);if(numberStr)numberStr=(parseInt(numberStr,10)+1).toString();else numberStr="2";return baseStr+numberStr};const HTML_ENTITY_MAP=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function lookupHtmlEntity(s){return HTML_ENTITY_MAP.get(s)}const HTML_ENTITY_REGEX=/[&<>"']/g; +C3.EscapeHTML=function EscapeHTML(str){return str.replace(HTML_ENTITY_REGEX,lookupHtmlEntity)};C3.EscapeJS=function EscapeJS(str){let ret=C3.ReplaceAll(str,"\\","\\\\");ret=C3.ReplaceAll(ret,'"','\\"');ret=C3.ReplaceAll(ret,"\t","\\t");ret=C3.ReplaceAll(ret,"\r","");return C3.ReplaceAll(ret,"\n","\\n")};C3.EscapeXML=function EscapeXML(str){let ret=C3.ReplaceAll(str,"&","&");ret=C3.ReplaceAll(ret,"<","<");ret=C3.ReplaceAll(ret,">",">");return C3.ReplaceAll(ret,'"',""")}; +const ESCAPE_REGEX=/[-[\]{}()*+?.,\\^$|#\s]/g;C3.EscapeRegex=function EscapeRegex(str){return str.replace(ESCAPE_REGEX,"\\$&")};C3.CountCharsInString=function CountCharsInString(str,ch){let count=0;for(const c of str)if(c===ch)++count;return count}; +C3.FindAll=function FindAll(str,find,matchCase=false){if(!find)return[];if(!matchCase){str=str.toLowerCase();find=find.toLowerCase()}const findLen=find.length;let startIndex=0;let index=0;let ret=[];while((index=str.indexOf(find,startIndex))>-1){ret.push(index);startIndex=index+findLen}return ret};C3.ReplaceAll=function ReplaceAll(str,find,replace){return str.replaceAll(find,()=>replace)}; +C3.ReplaceAllCaseInsensitive=function ReplaceAll(str,find,replace){return str.replace(new RegExp(C3.EscapeRegex(find),"gi"),()=>replace)};C3.SetElementContent=function SetElementContent(elem,stringlike){if(typeof stringlike==="string")elem.textContent=stringlike;else if(stringlike.isPlainText())elem.textContent=stringlike.toString();else{elem.innerHTML=stringlike.toHTML();if(stringlike instanceof C3.BBString)stringlike.attachLinkHandlers(elem)}}; +C3.StringLikeEquals=function StringLikeEquals(a,b){if(a instanceof C3.HtmlString||a instanceof C3.BBString)return a.equals(b);else if(b instanceof C3.HtmlString||b instanceof C3.BBString)return b.equals(a);else return a===b};C3.StringSubstitute=function StringSubstitute(str,...arr){let ret=str;for(let i=0,len=arr.length;i=0&&highestUsedIndex>=0&&lowestMissingIndexb)return 1;else if(alowerB)return 1;else if(lowerA0){secondsTotal-=days*24*3600;parts.push(langPluralSub(".days",null,days))}}if(opts.hours){const hours=Math.floor(secondsTotal/3600);if(hours>0||parts.length){secondsTotal-=hours*3600;parts.push(langPluralSub(".hours", +null,hours))}}if(opts.minutes){const minutes=Math.floor(secondsTotal/60);if(minutes>0||parts.length||!opts.seconds){secondsTotal-=minutes*60;parts.push(langPluralSub(".minutes",null,minutes))}}if(opts.seconds){const seconds=Math.floor(secondsTotal%60);parts.push(langPluralSub(".seconds",null,seconds))}const ret=(opts.approximate?lang(".approx-prefix"):"")+parts.join(lang(".separator"));C3.Lang.PopContext();return ret}; +C3.ZeroPad=function(n,d){let s=n<0?"-":"";n=Math.abs(n);let nStr=n.toString();let zeroes=d-nStr.length;for(let i=0;it.toUpperCase())}; +C3.CompareVersionStrings=function CompareVersionStrings(v1,v2){let a1=v1.split(".").map(s=>s.trim());let a2=v2.split(".").map(s=>s.trim());C3.resizeArray(a1,4,"0");C3.resizeArray(a2,4,"0");a1=a1.map(s=>parseInt(s,10));a2=a2.map(s=>parseInt(s,10));for(let i=0;i<4;++i){const diff=a1[i]-a2[i];if(diff!==0)return diff<0?-1:1}return 0};C3.CreateGUID=function CreateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{const r=Math.floor(Math.random()*16);const v=c==="x"?r:r&3|8;return v.toString(16)})}; +C3.StringHammingDistance=function StringHammingDistance(a,b){if(a.length!==b.length)throw new Error("strings must be same length");let ret=0;for(let i=0,len=a.length;ib.length){tmp=a;a=b;b=tmp}row=Array(a.length+1);for(i=0;i<=a.length;i++)row[i]=i;for(i=1;i<=b.length;i++){prev=i;for(j=1;j<=a.length;j++){if(b[i-1]===a[j-1])val=row[j-1];else val=Math.min(row[j-1]+1,Math.min(prev+1,row[j]+1));row[j-1]=prev;prev=val}row[a.length]=prev}return row[a.length]}; + +} + +// ../lib/str/bbstring.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +const BB_CODE_MAP=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["code","code"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["tip1","abbr"],["tip2","abbr"],["tip3","abbr"],["tip4","abbr"],["tip5","abbr"],["tip6","abbr"],["tip7","abbr"],["tip8","abbr"],["tip9","abbr"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]], +["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]);const SELF_CLOSING_TAGS=new Set(["icon"]);const BBREGEX=/\[(\/?)([a-zA-Z0-9]+)\]/g;const CUSTOM_BBREGEX=/\[(\/?)([^\[\n]*?)\]/g;let linkActions=null;let tipList=null;let classIndex=0; +function bbToHtmlReplacerFunc(match,closeSlash,tagName){const entry=BB_CODE_MAP.get(tagName);if(entry)if(typeof entry==="string"){if(entry==="a"&&linkActions.length===0||entry==="abbr"&&tipList.length===0)return match;if(entry==="a"&&!closeSlash){const index=parseInt(tagName.substring(1),10)-1;if(index<0||index>=linkActions.length)throw new Error("invalid bbcode link substitution");const linkAction=linkActions[index];if(typeof linkAction==="string")return``;else if(typeof linkAction=== +"function")return``;else throw new TypeError("invalid bbcode link action");}else if(entry==="abbr"&&!closeSlash){const index=parseInt(tagName.substring(3),10)-1;if(index<0||index>=tipList.length)throw new Error("invalid bbcode tip substitution");const tip=tipList[index];let tipStr="";if(typeof tip==="string")tipStr=tip;else if(typeof tip==="function")tipStr=tip();if(typeof tipStr!=="string")throw new TypeError("invalid bbcode tip");return``}else return"<"+closeSlash+entry+">"}else if(Array.isArray(entry)){let tag=entry[0];let className=entry[1];if(closeSlash)return"";else return`<${tag} class="${className}">`}else;else if(tagName==="class")if(closeSlash)return"";else return``;else return match}const LINEBREAK_REGEX=/\n/g; +C3.BBString=class BBString{constructor(str,opts){this._bbstr=opts&&opts.noEscape?str:C3.EscapeHTML(str);this._htmlstr="";this._convertLineBreaks=false;this._linkActions=[];this._tipList=[];if(opts){this._convertLineBreaks=!!opts.convertLineBreaks;if(opts.links){if(opts.links.length>9)throw new Error("too many links");this._linkActions=opts.links}if(opts.tips){if(opts.tips.length>9)throw new Error("too many tips");this._tipList=opts.tips}}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion= +this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=false;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){if(this._hasAnyBBtags)return this._bbstr.replace(BBREGEX,"");else return this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let str=this._bbstr;if(this._hasAnyBBtags){classIndex= +0;linkActions=this._linkActions;tipList=this._tipList;str=str.replace(BBREGEX,bbToHtmlReplacerFunc);linkActions=null;tipList=null}if(this._needsLineBreakConversion)str=str.replace(LINEBREAK_REGEX,"
");this._htmlstr=str}return this._htmlstr}attachLinkHandlers(parentElem){if(!this._linkActions.length)return;for(let i=0,len=this._linkActions.length;i0&&bbStr.charAt(index-1)==="\\")continue; +const matchStr=result[0];const closeSlash=result[1];const tagName=result[2];const strFrag=bbStr.substring(prevIndex,index);prevIndex=index+matchStr.length;if(strFrag)fragments.push({text:strFrag,styles:styleStack.slice(0)});if(!tagName)continue;if(closeSlash){const lowerTagName=tagName.toLowerCase();for(let i=styleStack.length-1;i>=0;--i)if(styleStack[i].tag===lowerTagName){styleStack.splice(i,1);break}}else{let tag=tagName;let param=null;const eq=tagName.indexOf("=");if(eq!==-1){tag=tagName.substring(0, +eq).toLowerCase();param=tagName.substring(eq+1)}else tag=tag.toLowerCase();if(SELF_CLOSING_TAGS.has(tag))if(tag==="icon")fragments.push({icon:param,styles:styleStack.slice(0)});else throw new Error(`unknown self-closing tag ${tag}`);else styleStack.push({tag,param})}}if(prevIndex +{if(frag.icon)return C3.New(C3.IconFragment,{icon:frag.icon,styles:frag.styles});else return C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(frag.text),styles:frag.styles})});this._hasParsedFragments=true;return this._fragments}_ProcessBBCodeEscapeSequences(text){text=C3.ReplaceAll(text,"\\[","[");return C3.ReplaceAll(text,"\\\\","\\")}static StripTags(str){return C3.New(C3.BBString,str,{noEscape:true}).toPlainText()}static StripAnyTags(str){return str.replace(CUSTOM_BBREGEX,"")}}; + +} + +// ../lib/str/textLayout/wordWrap.js +{ +'use strict';const C3=self.C3;function IsWordBreakWhiteSpace(ch){if(ch==="\u00a0"||ch==="\u202f")return false;else return C3.IsWhitespaceChar(ch)}function WordBreakTrimEnd(chArr){while(chArr.length>0&&IsWordBreakWhiteSpace(chArr.at(-1)))chArr.pop()}function IsNewline(ch){return ch==="\n"||ch==="\r\n"} +C3.WordWrap=class WordWrap{constructor(){this._lines=[];this._iconSet=null}GetLines(){return this._lines}GetLineCount(){return this._lines.length}SetIconSet(iconSet){this._iconSet=iconSet}_MeasureLine(line,measureFunc){let width=0;let height=0;let fbbAscent=0;let fbbDescent=0;let topToAlphabeticDistance=0;for(const frag of line){if(frag.GetWidth()===-1){const m=measureFunc(frag);frag.SetHeight(m.height);frag.SetFontBoundingBoxAscent(m.fontBoundingBoxAscent||0);frag.SetFontBoundingBoxDescent(m.fontBoundingBoxDescent|| +0);frag.SetTopToAlphabeticDistance(m.topToAlphabeticDistance||0);if(frag.IsText())frag.SetWidth(m.width);else if(frag.IsIcon())frag.CalculateWidthFromHeight(this._iconSet)}width+=frag.GetWidth();height=Math.max(height,frag.GetHeight());fbbAscent=Math.max(fbbAscent,frag.GetFontBoundingBoxAscent());fbbDescent=Math.max(fbbDescent,frag.GetFontBoundingBoxDescent());topToAlphabeticDistance=Math.max(topToAlphabeticDistance,frag.GetTopToAlphabeticDistance())}return{width,height,fontBoundingBoxAscent:fbbAscent, +fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance}}_AddLine(fragments,width,height,fbbAscent,fbbDescent,topToAlphabeticDistance){this._lines.push(C3.New(C3.WordWrap.Line,{fragments,width,height,fontBoundingBoxAscent:fbbAscent,fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance}))}WordWrap(fragmentArr,measureFunc,wrapWidth,wrapMode,endOfLineMargin){if(typeof fragmentArr==="string")fragmentArr=[C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(fragmentArr)})];C3.clearArray(this._lines); +if(!fragmentArr.length||fragmentArr.length===1&&fragmentArr[0].IsText()&&fragmentArr[0].IsEmpty()||wrapWidth<2)return;if(fragmentArr.length===1){const frag=fragmentArr[0];if(frag.IsText()&&frag.GetLength()<=100&&!frag.HasNewLine()){let {width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance}=measureFunc(frag);width+=endOfLineMargin;frag.SetWidth(width);frag.SetHeight(height);frag.SetFontBoundingBoxAscent(fontBoundingBoxAscent||0);frag.SetFontBoundingBoxDescent(fontBoundingBoxDescent|| +0);frag.SetTopToAlphabeticDistance(topToAlphabeticDistance||0);if(width<=wrapWidth){this._AddLine([frag],width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance);return}}}let tokenisedFragments;if(wrapMode==="word")tokenisedFragments=this._TokeniseWords(fragmentArr);else{tokenisedFragments=[];for(const frag of fragmentArr)if(frag.IsText()){const chArr=frag.GetCharacterArray();C3.appendArray(tokenisedFragments,chArr.map(ch=>[C3.New(C3.TextFragment,{chArr:[ch],styles:frag.GetStyles()})]))}else tokenisedFragments.push([frag])}this._WrapText(tokenisedFragments, +measureFunc,wrapWidth,endOfLineMargin)}_TokeniseWords(fragmentArr){const ret=[];let curWord=[];let isCurWhitespace=false;for(const frag of fragmentArr){const styles=frag.GetStyles();if(frag.IsIcon()){if(curWord.length>0)ret.push(curWord);ret.push([frag]);curWord=[];continue}for(const ch of frag.GetCharacterArray())if(IsNewline(ch)){if(curWord.length>0)ret.push(curWord);const newlineFrag=C3.New(C3.TextFragment,{chArr:["\n"],styles});ret.push([newlineFrag]);curWord=[]}else if(curWord.length===0){const newFrag= +C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag);isCurWhitespace=IsWordBreakWhiteSpace(ch)}else{const isWhitespace=IsWordBreakWhiteSpace(ch);if(isWhitespace===isCurWhitespace){const curFrag=curWord.at(-1);if(curFrag.GetStyles()===styles)curFrag._AppendChar(ch);else{const newFrag=C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag)}}else{ret.push(curWord);curWord=[];const newFrag=C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag);isCurWhitespace=isWhitespace}}}if(curWord.length> +0)ret.push(curWord);return ret}_CopyLine(line){return line.map(f=>f._Clone())}_AddWordToLine(currentLine,curWord){const lastFrag=currentLine.length?currentLine.at(-1):null;let i=0;if(lastFrag&&lastFrag.IsText()&&curWord[0].IsText()&&curWord[0].GetStyles()===lastFrag.GetStyles()){lastFrag._Append(curWord[0].GetCharacterArray());i=1}for(let len=curWord.length;i=wrapWidth){if(currentLine.length>0)this._AddLine(currentLine,currentLineWidth,currentLineHeight,currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);currentLine=[];if(curWord[0].IsText()&&C3.IsCharArrayAllWhitespace(curWord[0].GetCharacterArray())){currentLineWidth=0;currentLineHeight=0;currentLineFbbAscent=0;currentLineFbbDescent=0;currentLineTopToAlphabetic=0}else{this._AddWordToLine(currentLine,curWord);const metrics= +this._MeasureLine(currentLine,measureFunc);currentLineWidth=metrics.width;currentLineHeight=metrics.height;currentLineFbbAscent=metrics.fontBoundingBoxAscent;currentLineFbbDescent=metrics.fontBoundingBoxDescent;currentLineTopToAlphabetic=metrics.topToAlphabeticDistance}}else{currentLine=tryLine;currentLineWidth=tryLineWidth;currentLineHeight=tryMetrics.height;currentLineFbbAscent=tryMetrics.fontBoundingBoxAscent;currentLineFbbDescent=tryMetrics.fontBoundingBoxDescent;currentLineTopToAlphabetic=tryMetrics.topToAlphabeticDistance}}if(currentLine.length> +0)this._AddLine(currentLine,currentLineWidth,currentLineHeight,currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);this._TrimLinesTrailingWhitespace(measureFunc,endOfLineMargin)}_TrimLinesTrailingWhitespace(measureFunc,endOfLineMargin){for(const line of this._lines){const fragments=line._GetFragmentsArray();if(!fragments.length)continue;let lastFrag=fragments.at(-1);if(lastFrag.IsText()){const chArr=lastFrag.GetCharacterArray();const trimmedArr=chArr.slice(0);WordBreakTrimEnd(trimmedArr); +if(trimmedArr.length===0){line.OffsetWidth(-lastFrag.GetWidth());fragments.pop()}else if(trimmedArr.length0){lastFrag=fragments.at(-1);lastFrag.OffsetWidth(endOfLineMargin);line.OffsetWidth(endOfLineMargin)}}}}Clear(){C3.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((a, +v)=>Math.max(a,v.GetWidth()),0)}GetTotalLineHeight(){return this._lines.reduce((a,v)=>a+v.GetHeight(),0)}}; + +} + +// ../lib/str/textLayout/line.js +{ +'use strict';const C3=self.C3; +C3.WordWrap.Line=class WordWrapLine{constructor(opts){this._fragments=opts.fragments||[];this._width=opts.width||-1;this._height=opts.height||-1;this._fontBoundingBoxAscent=opts.fontBoundingBoxAscent||-1;this._fontBoundingBoxDescent=opts.fontBoundingBoxDescent||-1;this._topToAlphabeticDistance=opts.topToAlphabeticDistance||-1;this._posX=0;this._posY=0}fragments(){return this._fragments.values()}_GetFragmentsArray(){return this._fragments}OffsetWidth(w){this._width+=w}GetWidth(){return this._width}GetHeight(){return this._height}GetFoundBoundingBoxAscent(){return this._fontBoundingBoxAscent}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(x){this._posX=x}GetPosX(){return this._posX}SetPosY(y){this._posY= +y}GetPosY(){return this._posY}}; + +} + +// ../lib/str/textLayout/fragmentBase.js +{ +'use strict';const C3=self.C3; +C3.FragmentBase=class FragmentBase{constructor(opts){this._styles=opts.styles||[];this._width=opts.width||-1;this._height=opts.height||-1;this._fontBoundingBoxAscent=opts.fontBoundingBoxAscent||-1;this._fontBoundingBoxDescent=opts.fontBoundingBoxDescent||-1;this._topToAlphabeticDistance=opts.topToAlphabeticDistance||-1;this._posX=0;this._posY=0}IsText(){return false}IsIcon(){return false}GetStyles(){return this._styles}GetStyleTag(tag){const styles=this._styles;for(let i=styles.length-1;i>=0;--i){const s= +styles[i];if(s.tag===tag)return s}return null}HasStyleTag(tag){return!!this.GetStyleTag(tag)}GetStyleMap(){const ret=new Map;for(const s of this._styles)ret.set(s.tag,s.param);return ret}OffsetWidth(w){this._width+=w}SetWidth(w){this._width=w}GetWidth(){return this._width}SetHeight(h){this._height=h}GetHeight(){return this._height}SetFontBoundingBoxAscent(v){this._fontBoundingBoxAscent=v}GetFontBoundingBoxAscent(){return this._fontBoundingBoxAscent}SetFontBoundingBoxDescent(v){this._fontBoundingBoxDescent= +v}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}SetTopToAlphabeticDistance(v){this._topToAlphabeticDistance=v}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(x){this._posX=x}GetPosX(){return this._posX}SetPosY(y){this._posY=y}GetPosY(){return this._posY}}; + +} + +// ../lib/str/textLayout/textFragment.js +{ +'use strict';const C3=self.C3; +C3.TextFragment=class TextFragment extends C3.FragmentBase{constructor(opts){super(opts);this._chArr=opts.chArr}IsText(){return true}_Append(chArr){C3.appendArray(this._chArr,chArr);this._width=-1;this._height=-1;this._fontBoundingBoxAscent=-1;this._fontBoundingBoxDescent=-1;this._topToAlphabeticDistance=-1}_AppendChar(ch){this._chArr.push(ch)}_Clone(){return C3.New(C3.TextFragment,{chArr:this._chArr.slice(0),styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent, +fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetCharacterArray(){return this._chArr}SetCharacterArray(arr){this._chArr=arr}GetLength(){return this._chArr.length}IsEmpty(){return this._chArr.length===0}HasNewLine(){return this._chArr.includes("\n")}}; + +} + +// ../lib/str/textLayout/iconFragment.js +{ +'use strict';const C3=self.C3; +C3.IconFragment=class IconFragment extends C3.FragmentBase{constructor(opts){super(opts);this._icon=opts.icon}IsIcon(){return true}GetIconParameter(){return this._icon}_Clone(){return C3.New(C3.IconFragment,{icon:this._icon,styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent,fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetTextIcon(iconSet){if(!iconSet)return null;let index=Number(this._icon); +if(String(index)===this._icon){index=Math.floor(index);return iconSet.GetTextIconByIndex(index)}else return iconSet.GetTextIconByTag(this._icon)}CalculateWidthFromHeight(iconSet){const textIcon=this.GetTextIcon(iconSet);if(!textIcon){this._width=0;return}this._width=this._height*textIcon.GetWidth()/textIcon.GetHeight()}GetDrawable(iconSet){const textIcon=this.GetTextIcon(iconSet);return textIcon?textIcon.GetDrawable():null}GetLength(){return 1}}; + +} + +// ../lib/str/textLayout/textIconManager.js +{ +'use strict';const C3=self.C3; +C3.TextIconManager=class TextIconManager{constructor(opts){this._iconSets=new Map;this._getIconSetMetaCallback=opts.getIconSetMeta;this._getIconSetContentCallback=opts.getIconSetContent}Release(){for(const iconSet of this._iconSets.values())iconSet.Release();this._iconSets.clear()}GetIconSet(iconSource){let iconSet=this._iconSets.get(iconSource);if(iconSet)return iconSet;const iconMeta=this._getIconSetMetaCallback(iconSource);iconSet=C3.New(C3.TextIconSet,this,{source:iconSource,iconMeta});this._iconSets.set(iconSource, +iconSet);return iconSet}HasIconSet(iconSource){return this._iconSets.has(iconSource)}DeleteIconSet(iconSource){const iconSet=this._iconSets.get(iconSource);if(iconSet)iconSet.Release();this._iconSets.delete(iconSource)}async _GetIconSetContent(iconSource){return await this._getIconSetContentCallback(iconSource)}}; + +} + +// ../lib/str/textLayout/textIconSet.js +{ +'use strict';const C3=self.C3; +C3.TextIconSet=class TextIconSet{constructor(textIconManager,opts){this._textIconManager=textIconManager;this._source=opts.source;this._iconsArray=[];this._iconsByTag=new Map;this._hasStartedLoad=false;this._isLoading=false;this._loadPromise=null;const iconMetaArr=opts.iconMeta.icons;for(let i=0,len=iconMetaArr.length;i=this._iconsArray.length)return null;return this._iconsArray[index]}GetTextIconByTag(tag){return this._iconsByTag.get(tag.toLowerCase())||null}}; + +} + +// ../lib/str/textLayout/textIcon.js +{ +'use strict';const C3=self.C3;C3.TextIcon=class TextIcon{constructor(textIconSet,opts){this._textIconSet=textIconSet;this._source=opts.source||null;this._index=opts.index;this._tag=opts.tag;this._width=opts.width;this._height=opts.height;this._drawable=null}Release(){this._width=0;this._height=0;this._textIconSet=null}GetSource(){return this._source}GetWidth(){return this._width}GetHeight(){return this._height}_SetDrawable(drawable){this._drawable=drawable}GetDrawable(){return this._drawable}}; + +} + +// ../lib/gfx/gfx.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempVec3a=vec3.create();const tempVec3b=vec3.create();const tempVec3c=vec3.create();const tempVec4=vec4.create();const tempMat4=mat4.create();const neartl=vec3.create();const neartr=vec3.create();const nearbl=vec3.create();const nearbr=vec3.create();const fartl=vec3.create();const fartr=vec3.create();const farbl=vec3.create();const farbr=vec3.create(); +const unitViewport=vec4.fromValues(0,0,1,1); +C3.Gfx={Project(objx,objy,objz,mv,proj,viewport,windowCoordinate){const fTemp0=mv[0]*objx+mv[4]*objy+mv[8]*objz+mv[12];const fTemp1=mv[1]*objx+mv[5]*objy+mv[9]*objz+mv[13];const fTemp2=mv[2]*objx+mv[6]*objy+mv[10]*objz+mv[14];const fTemp3=mv[3]*objx+mv[7]*objy+mv[11]*objz+mv[15];let fTemp4=proj[0]*fTemp0+proj[4]*fTemp1+proj[8]*fTemp2+proj[12]*fTemp3;let fTemp5=proj[1]*fTemp0+proj[5]*fTemp1+proj[9]*fTemp2+proj[13]*fTemp3;let fTemp6=proj[2]*fTemp0+proj[6]*fTemp1+proj[10]*fTemp2+proj[14]*fTemp3;let fTemp7= +proj[3]*fTemp0+proj[7]*fTemp1+proj[11]*fTemp2+proj[15]*fTemp3;if(fTemp7===0)return false;fTemp7=1/fTemp7;fTemp4*=fTemp7;fTemp5*=fTemp7;fTemp6*=fTemp7;windowCoordinate[0]=(fTemp4*.5+.5)*viewport[2]+viewport[0];windowCoordinate[1]=(fTemp5*.5+.5)*viewport[3]+viewport[1];windowCoordinate[2]=(1+fTemp6)*.5;return true},Unproject(winx,winy,winz,mv,proj,viewport,objectCoordinate){const A=tempMat4;const vec=tempVec4;mat4.multiply(A,proj,mv);if(mat4.invert(A,A)===null)return false;vec[0]=(winx-viewport[0])/ +viewport[2]*2-1;vec[1]=(winy-viewport[1])/viewport[3]*2-1;vec[2]=2*winz-1;vec[3]=1;vec4.transformMat4(vec,vec,A);if(vec[3]===0)return false;vec[3]=1/vec[3];objectCoordinate[0]=vec[0]*vec[3];objectCoordinate[1]=vec[1]*vec[3];objectCoordinate[2]=vec[2]*vec[3];return true},UnprojectScreenToWorldZ(winx,winy,worldZ,mv,proj,viewport,objectCoordinate){const nearPt=tempVec3a;const farPt=tempVec3b;if(!C3.Gfx.Unproject(winx,winy,0,mv,proj,viewport,nearPt))return false;if(!C3.Gfx.Unproject(winx,winy,1,mv,proj, +viewport,farPt))return false;const dirVec=tempVec3b;vec3.subtract(dirVec,farPt,nearPt);const planeNormal=tempVec3c;vec3.set(planeNormal,0,0,1);const planeConstant=-worldZ;const denominator=vec3.dot(planeNormal,dirVec);let distance=0;if(denominator===0){const planeDistToPt=vec3.dot(planeNormal,nearPt)+planeConstant;if(planeDistToPt!==0)return false}else{distance=-(vec3.dot(nearPt,planeNormal)+planeConstant)/denominator;if(distance<0)return false}vec3.scaleAndAdd(objectCoordinate,nearPt,dirVec,distance); +return true}};function PlaneFromPoints(ptA,ptB,ptC,plane){const normal=tempVec3c;vec3.subtract(tempVec3a,ptC,ptB);vec3.subtract(tempVec3b,ptA,ptB);vec3.cross(normal,tempVec3a,tempVec3b);vec3.normalize(normal,normal);plane.set(normal[0],normal[1],normal[2],vec3.dot(ptA,normal))} +function IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const nxT=plane.xF;const nyT=plane.yF;const nzT=plane.zF;const nxF=1-nxT;const nyF=1-nyT;const nzF=1-nzT;const minD=nx*minX*nxT+nx*maxX*nxF+ny*minY*nyT+ny*maxY*nyF+nz*minZ*nzT+nz*maxZ*nzF;if(minD>=d)return true;const maxD=nx*maxX*nxT+nx*minX*nxF+ny*maxY*nyT+ny*minY*nyF+nz*maxZ*nzT+nz*minZ*nzF;return maxD>d} +function IsPointInFrontOfPlane(x,y,z,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const minD=nx*x+ny*y+nz*z;return minD>=d}class Plane{constructor(){this.x=NaN;this.y=NaN;this.z=NaN;this.w=NaN;this.xF=NaN;this.yF=NaN;this.zF=NaN}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;this.xF=x>0?1:0;this.yF=y>0?1:0;this.zF=z>0?1:0}} +C3.Gfx.ViewFrustum=class ViewFrustum{constructor(){this._leftP=new Plane;this._topP=new Plane;this._rightP=new Plane;this._bottomP=new Plane;this._nearP=new Plane;this._farP=new Plane}CalculatePlanes(mv,proj){const vp=unitViewport;C3.Gfx.Unproject(0,1,0,mv,proj,vp,neartl);C3.Gfx.Unproject(1,1,0,mv,proj,vp,neartr);C3.Gfx.Unproject(0,0,0,mv,proj,vp,nearbl);C3.Gfx.Unproject(1,0,0,mv,proj,vp,nearbr);C3.Gfx.Unproject(0,1,1,mv,proj,vp,fartl);C3.Gfx.Unproject(1,1,1,mv,proj,vp,fartr);C3.Gfx.Unproject(0,0, +1,mv,proj,vp,farbl);C3.Gfx.Unproject(1,0,1,mv,proj,vp,farbr);PlaneFromPoints(nearbl,neartl,fartl,this._leftP);PlaneFromPoints(neartl,neartr,fartr,this._topP);PlaneFromPoints(neartr,nearbr,farbr,this._rightP);PlaneFromPoints(nearbr,nearbl,farbl,this._bottomP);PlaneFromPoints(farbl,fartl,fartr,this._farP);PlaneFromPoints(nearbr,neartr,neartl,this._nearP)}ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ){return IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._leftP)&&IsInFrontOfPlane(minX,minY,minZ,maxX, +maxY,maxZ,this._topP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._rightP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._bottomP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._nearP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._farP)}IsBehindNearPlane(x,y,z){return!IsPointInFrontOfPlane(x,y,z,this._nearP)}}; + +} + +// ../lib/gfx/rendererBase.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tmpVec3a=vec3.fromValues(0,0,0);const tmpVec3b=vec3.fromValues(0,0,0);const tmpVec3c=vec3.fromValues(0,0,0);const defaultUpVector=vec3.fromValues(0,1,0);const tmpVec4=vec4.fromValues(0,0,0,0);const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1); +const DEFAULT_RENDERERBASE_OPTS={nearZ:1,farZ:1E4};const matWebGLtoWebGPU=mat4.fromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1); +C3.Gfx.RendererBase=class RendererBase{constructor(opts){opts=Object.assign({},DEFAULT_RENDERERBASE_OPTS,opts);this._width=0;this._height=0;this._fovY=C3.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=mat4.create();this._matMV=mat4.create();this._zAxisScale=false;this._nearZ=opts.nearZ;this._farZ=opts.farZ;this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._spPoints=null;this._spTilemapFill=null;this._spTileRandomization=null;this._spColorFill= +null;this._spLinearGradientFill=null;this._spPenumbraFill=null;this._spHardEllipseFill=null;this._spHardEllipseOutline=null;this._spSmoothEllipseFill=null;this._spSmoothEllipseOutline=null;this._spSmoothLineFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._baseZ=0;this._currentZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack= +[this._lineOffset];this._frameNumber=0;this._enableMipmaps=true;this._hasMajorPerformanceCaveat=false}FillIndexBufferData(indexData){let i=0,len=indexData.length,fv=0;while(i=100)throw new Error("pushed too many line widths - check push/pop pairs"); +this._lineWidthStack.push(n);this._lineWidth=n}PopLineWidth(){if(this._lineWidthStack.length<=1)throw new Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(type){if(type=== +"butt")this.PushLineCapButt();else if(type==="square")this.PushLineCapSquare();else if(type==="zag")this.PushLineCapZag();else throw new Error("invalid line cap");}PushLineCapButt(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(this._lineCapStack.length>= +100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(this._lineCapStack.length<=1)throw new Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(n){this._lineOffset=n;this._lineOffsetStack[this._lineOffsetStack.length-1]=n}GetLineOffset(){return this._lineOffset}PushLineOffset(n){if(this._lineOffsetStack.length>=100)throw new Error("pushed too many line offsets - check push/pop pairs"); +this._lineOffsetStack.push(n);this._lineOffset=n}PopLineOffset(){if(this._lineOffsetStack.length<=1)throw new Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(pts){const pts_count=pts.length/2;if(pts_count<3)throw new Error("need at least 3 points");const tris=pts_count-2;const last_tri=tris-1;const p0x=pts[0];const p0y=pts[1];for(let i=0;i0)throw new Error("releasing state group still in use"); +this._renderer=null;this._shaderProgram=null;this._shaderProgramName=""}Apply(){const renderer=this._renderer;renderer.SetProgram(this._shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetColor(this._color);renderer.SetCurrentZ(this._zElevation);renderer._SetCurrentStateGroup(this)}GetKey(){return C3.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram= +null}OnContextRestored(renderer){this._shaderProgram=renderer.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw new Error("failed to restore shader program");}static MakeKey(shaderProgram_or_name,blendMode,c,zElevation){const shaderProgramName=typeof shaderProgram_or_name==="string"?shaderProgram_or_name:shaderProgram_or_name.GetName();return shaderProgramName+","+blendMode+","+c.getR()+","+c.getG()+","+c.getB()+","+c.getA()+","+zElevation}}; + +} + +// ../lib/gfx/mesh.js +{ +'use strict';const C3=self.C3;const tempQuadTex=C3.New(C3.Quad);function interpolateQuad(srcX,srcY,quad){const qtlx=quad.getTlx();const qtly=quad.getTly();const qtrx=quad.getTrx()-qtlx;const qtry=quad.getTry()-qtly;const qblx=quad.getBlx()-qtlx;const qbly=quad.getBly()-qtly;const xix=qtrx*srcX;const xiy=qtry*srcX;const yix=qblx*srcY;const yiy=qbly*srcY;return[qtlx+xix+yix,qtly+xiy+yiy]} +C3.Gfx.MeshPoint=class MeshPoint{constructor(mesh,col,row){this._mesh=mesh;this._col=col;this._row=row;this._x=NaN;this._y=NaN;this._zElevation=NaN;this._u=NaN;this._v=NaN;this._x=0;this._y=0;this._zElevation=0;this._u=0;this._v=0}_Init(x,y,u,v){this._x=x;this._y=y;this._u=u;this._v=v}GetX(){return this._x}SetX(x){if(this._x===x)return;this._x=x;this._mesh._SetPointsChanged()}GetY(){return this._y}SetY(y){if(this._y===y)return;this._y=y;this._mesh._SetPointsChanged()}GetZElevation(){return this._zElevation}SetZElevation(z){if(this._zElevation=== +z)return;this._zElevation=Math.max(z,0);this._mesh._SetPointsChanged()}GetU(){return this._u}SetU(u){this._u=u}GetV(){return this._v}SetV(v){this._v=v}_Interpolate_TexRect(srcPoint,quadPos,rcTex){[this._x,this._y]=interpolateQuad(srcPoint._x,srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;this._u=C3.lerp(rcTex.getLeft(),rcTex.getRight(),srcPoint._u);this._v=C3.lerp(rcTex.getTop(),rcTex.getBottom(),srcPoint._v)}_Interpolate_TexQuad(srcPoint,quadPos,quadTex){[this._x,this._y]=interpolateQuad(srcPoint._x, +srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;[this._u,this._v]=interpolateQuad(srcPoint._u,srcPoint._v,quadTex)}SaveToJson(){return{"x":this.GetX(),"y":this.GetY(),"z":this.GetZElevation(),"u":this.GetU(),"v":this.GetV()}}LoadFromJson(o){this.SetX(o["x"]);this.SetY(o["y"]);if(o.hasOwnProperty("z"))this.SetZElevation(o["z"]);this.SetU(o["u"]);this.SetV(o["v"])}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}}; +C3.Gfx.Mesh=class Mesh{constructor(hsize,vsize,owner){if(hsize<2||vsize<2)throw new Error("invalid mesh size");this._hsize=hsize;this._vsize=vsize;this._owner=owner||null;this._pts=[];this._minX=0;this._minY=0;this._maxX=1;this._maxY=1;this._maxZ=0;this._pointsChanged=false;const lastX=hsize-1;const lastY=vsize-1;for(let y=0;y0}GetMeshPointAt(x,y){x=Math.floor(x);y=Math.floor(y);if(x<0||x>=this._hsize||y<0||y>=this._vsize)return null;return this._pts[y][x]}CalculateTransformedMesh(srcMesh,quadPos,rcTex_or_quad){const isTexRect=rcTex_or_quad instanceof +C3.Rect;if(srcMesh.GetHSize()!==this.GetHSize()||srcMesh.GetVSize()!==this.GetVSize())throw new Error("source mesh wrong size");const srcPts=srcMesh._pts;const destPts=this._pts;for(let y=0,lenY=destPts.length;y[x,y,z];const pts=this._pts;let prevRow=pts[0];for(let y=1,lenY=pts.length;y{curX=C3.clamp(C3.lerp(curX,nextX,rayHit),0,1);curY=C3.clamp(C3.lerp(curY,nextY,rayHit),0,1);outPts.push(curX,curY)};for(let i=0,len=inPts.length;i1E6)throw new Error("Too many mesh poly points"); +const srcTlx=curCol*colWidthNorm;const srcTly=curRow*rowHeightNorm;const srcBrx=(curCol+1)*colWidthNorm;const srcBry=(curRow+1)*rowHeightNorm;isUpper=C3.isPointInTriangleInclusive(curX,curY,srcTlx,srcTly,srcBrx,srcTly,srcBrx,srcBry);if(disableCheck!==DISABLE_DIAGONAL){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcBry,-RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();isUpper=!isUpper;disableCheck=DISABLE_DIAGONAL;continue}}if(curRow>0&& +disableCheck!==DISABLE_TOP_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcTly,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curRow--;isUpper=false;disableCheck=DISABLE_BOTTOM_EDGE;continue}}if(curCol=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol++;isUpper=false;disableCheck= +DISABLE_LEFT_EDGE;continue}}if(curCol>0&&disableCheck!==DISABLE_LEFT_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcTlx,srcBry,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol--;isUpper=true;disableCheck=DISABLE_RIGHT_EDGE;continue}}if(curRow=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit(); +curRow++;isUpper=true;disableCheck=DISABLE_TOP_EDGE;continue}}break}}return C3.New(C3.CollisionPoly,outPts)}TransformCollisionPoly(srcPoly,destPoly){const ptsArr=this._TransformPolyPoints(srcPoly);this._SimplifyPoly(ptsArr);destPoly.setPoints(ptsArr)}_TransformPolyPoints(srcPoly){const outPts=[];const ptsArr=srcPoly.pointsArr();for(let i=0,len=ptsArr.length;iR_EPSILON||dx==0&&dy===0)outPts.push(curX,curY);curX=nextX;curY=nextY;lastDx=dx;lastDy=dy}if(outPts.length>=6&&outPts.lengthrow.map(pt=>pt.SaveToJson()))}}LoadFromJson(o){const cols=this.GetHSize();const rows= +this.GetVSize();if(o["cols"]!==cols||o["rows"]!==rows)throw new Error("mesh data wrong size");const meshRows=o["points"];for(let y=0;ymaxTextureSize||this._height>maxTextureSize)throw new Error("texture data exceeds maximum texture size");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha); +gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);if(!this._renderer.SupportsNPOTTextures()&&!isPOT&&this._IsTiled()){if(data===null)throw new Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");if(data instanceof ArrayBuffer)data=new ImageData(new Uint8ClampedArray(data),this._width,this._height);if(data instanceof ImageData){const tmpCanvas=C3.CreateCanvas(this._width,this._height);const tmpCtx=tmpCanvas.getContext("2d"); +tmpCtx.putImageData(data,0,0);data=tmpCanvas}const canvas=C3.CreateCanvas(C3.nextHighestPowerOfTwo(this._width),C3.nextHighestPowerOfTwo(this._height));const ctx=canvas.getContext("2d");ctx.imageSmoothingEnabled=this._sampling!=="nearest";ctx.drawImage(data,0,0,this._width,this._height,0,0,canvas.width,canvas.height);gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,canvas)}else if(webglVersion>=2){let levels;if(this._isMipMapped)levels=Math.floor(Math.log2(Math.max(this._width, +this._height))+1);else levels=1;gl.texStorage2D(gl.TEXTURE_2D,levels,formatspec.sizedinternalformat,this._width,this._height);if(data instanceof ArrayBuffer)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this._width,this._height,formatspec.format,formatspec.type,new Uint8Array(data));else if(data!==null)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data)}else if(data instanceof ArrayBuffer)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format, +formatspec.type,new Uint8Array(data));else if(data===null)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);else gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,data);if(data!==null)this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_CreateDynamic(width,height,opts){opts=Object.assign({},CREATEFROM_DEFAULT_OPTIONS, +opts);if(this._texture)throw new Error("already created texture");this._wrapX=opts.wrapX;this._wrapY=opts.wrapY;this._sampling=opts.sampling;this._pixelFormat=opts.pixelFormat;this._isMipMapped=!!opts.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=opts.mipMapQuality;if(!VALID_WRAP_MODES.has(this._wrapX)||!VALID_WRAP_MODES.has(this._wrapY))throw new Error("invalid wrap mode");if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(!VALID_PIXEL_FORMATS.has(this._pixelFormat))throw new Error("invalid pixel format"); +if(!VALID_MIPMAP_QUALITIES.has(this._mipMapQuality))throw new Error("invalid mipmap quality");this._isStatic=false;this._width=Math.floor(width);this._height=Math.floor(height);const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);const maxTextureSize=this._renderer.GetMaxTextureSize();if(this._width<=0||this._height<=0)throw new Error("invalid texture size");if(this._width>maxTextureSize||this._height>maxTextureSize)throw new Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&& +this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat: +formatspec.internalformat;gl.texImage2D(gl.TEXTURE_2D,0,internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_GetMipMapHint(gl){if(this._mipMapQuality==="default")return this._isStatic?gl.NICEST:gl.FASTEST;else if(this._mipMapQuality==="low")return gl.FASTEST;else if(this._mipMapQuality==="high")return gl.NICEST;else throw new Error("invalid mipmap quality"); +}_IsTiled(){return this._wrapX!=="clamp-to-edge"||this._wrapY!=="clamp-to-edge"}_GetTextureWrapMode(gl,wrapMode){if(wrapMode==="clamp-to-edge")return gl.CLAMP_TO_EDGE;else if(wrapMode==="repeat")return gl.REPEAT;else if(wrapMode==="mirror-repeat")return gl.MIRRORED_REPEAT;else throw new Error("invalid wrap mode");}_SetTextureParameters(gl){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._GetTextureWrapMode(gl,this._wrapX));gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_WRAP_T,this._GetTextureWrapMode(gl,this._wrapY));if(this._sampling==="nearest"){gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);this._isMipMapped=false}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D);const useTrilinear=this._sampling=== +"trilinear"&&!this._renderer.HasMajorPerformanceCaveat();gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,useTrilinear?gl.LINEAR_MIPMAP_LINEAR:gl.LINEAR_MIPMAP_NEAREST)}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);this._isMipMapped=false}}const anisotropicExt=this._renderer._GetAnisotropicExtension();if(anisotropicExt&&this._anisotropy>0&&this._sampling!=="nearest")gl.texParameterf(gl.TEXTURE_2D,anisotropicExt["TEXTURE_MAX_ANISOTROPY_EXT"],Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(data, +opts){if((typeof HTMLImageElement==="undefined"||!(data instanceof HTMLImageElement))&&(typeof HTMLVideoElement==="undefined"||!(data instanceof HTMLVideoElement))&&(typeof HTMLCanvasElement==="undefined"||!(data instanceof HTMLCanvasElement))&&(typeof ImageBitmap==="undefined"||!(data instanceof ImageBitmap))&&(typeof OffscreenCanvas==="undefined"||!(data instanceof OffscreenCanvas))&&!(data instanceof ImageData))throw new Error("invalid texture source");if(!this._texture||this._refCount<=0)throw new Error("texture not created"); +if(this._isStatic)throw new Error("cannot update static texture");opts=Object.assign({},UPDATE_DEFAULT_OPTIONS,opts);const dataWidth=data.width||data.videoWidth;const dataHeight=data.height||data.videoHeight;const webglVersion=this._renderer.GetWebGLVersionNumber();const gl=this._renderer.GetContext();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],!!opts.flipY);const formatspec=GetFormatSpecifiers(this._pixelFormat, +gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat:formatspec.internalformat;try{if(this._width===dataWidth&&this._height===dataHeight){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}else{this._width=dataWidth;this._height=dataHeight; +const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");gl.texImage2D(gl.TEXTURE_2D,0,internalformat,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}}catch(e){console.error("Error updating WebGL texture: ",e)}gl.bindTexture(gl.TEXTURE_2D, +null);this._renderer._ResetLastTexture()}_Delete(){if(this._refCount>0)throw new Error("texture still has references");if(!this._texture)throw new Error("already deleted texture");allTextures.delete(this);const gl=this._renderer.GetContext();gl.deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(this._refCount<=0)throw new Error("no more references"); +this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let size=this._width*this._height;switch(this._pixelFormat){case "rgba8":size*=4;break;case "rgb8":size*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":size*=2;break}if(this._isMipMapped)size+=Math.floor(size/3);return size}static OnContextLost(){allTextures.clear()}static allTextures(){return allTextures.values()}}; + +} + +// ../lib/gfx/webgl/renderTarget.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4;const VALID_SAMPLINGS=new Set(["nearest","bilinear","trilinear"]);const DEFAULT_RENDERTARGET_OPTIONS={sampling:"trilinear",alpha:true,depth:false,isSampled:true,isDefaultSize:true,multisampling:0};const allRenderTargets=new Set; +C3.Gfx.WebGLRenderTarget=class WebGLRenderTarget{constructor(renderer){this._renderer=renderer;this._frameBuffer=null;this._frameBufferNoDepth=null;this._texture=null;this._renderBuffer=null;this._width=0;this._height=0;this._isDefaultSize=true;this._sampling="trilinear";this._alpha=true;this._depth=false;this._isSampled=true;this._multisampling=0;this._projectionMatrix=mat4.create();this._lastFov=0;this._lastNearZ=0;this._lastFarZ=0}_Create(width,height,opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS, +opts);const webGLVersion=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw new Error("already created render target");this._sampling=opts.sampling;this._alpha=!!opts.alpha;this._depth=!!opts.depth;this._isSampled=!!opts.isSampled;this._isDefaultSize=!!opts.isDefaultSize;this._multisampling=opts.multisampling;if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(this._multisampling>0&&(webGLVersion<2||this._isSampled))throw new Error("invalid use of multisampling"); +if(webGLVersion<2)this._isSampled=true;this._width=width;this._height=height;if(this._width<=0||this._height<=0)throw new Error("invalid render target size");this._CalculateProjection();const gl=this._renderer.GetContext();this._frameBuffer=gl.createFramebuffer();if(this._depth)this._frameBufferNoDepth=gl.createFramebuffer();if(this._isSampled){this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:false}); +const tex=this._texture._GetTexture();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0)}}else{this._renderBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);const internalFormat=this._alpha?gl.RGBA8:gl.RGB8;if(this._multisampling> +0){const formatSamples=gl.getInternalformatParameter(gl.RENDERBUFFER,internalFormat,gl.SAMPLES);if(formatSamples&&formatSamples[0]){const maxSamples=formatSamples[0];if(this._multisampling>maxSamples)this._multisampling=maxSamples}else this._multisampling=0}if(this._multisampling===0)gl.renderbufferStorage(gl.RENDERBUFFER,internalFormat,this._width,this._height);else gl.renderbufferStorageMultisample(gl.RENDERBUFFER,this._multisampling,internalFormat,this._width,this._height);gl.bindFramebuffer(gl.FRAMEBUFFER, +this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer)}gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,rendererDepthBuffer)}gl.bindFramebuffer(gl.FRAMEBUFFER,null);allRenderTargets.add(this)}_Resize(width,height){if(this._width===width&&this._height===height)return;this._width=width;this._height=height;this._CalculateProjection();const gl=this._renderer.GetContext();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._texture)this._texture._Update(new ImageData(this._width, +this._height));else{gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._alpha?gl.RGBA8:gl.RGB8,this._width,this._height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer)if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT, +gl.RENDERBUFFER,rendererDepthBuffer);gl.bindFramebuffer(gl.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw new Error("already deleted render target");allRenderTargets.delete(this);const gl=this._renderer.GetContext();if(this._texture){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0)}this._renderer.DeleteTexture(this._texture);this._texture=null}else if(this._renderBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null)}gl.deleteRenderbuffer(this._renderBuffer);this._renderBuffer=null}gl.bindFramebuffer(gl.FRAMEBUFFER, +null);if(this._renderer.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,null)}gl.deleteFramebuffer(this._frameBuffer);if(this._depth)gl.deleteFramebuffer(this._frameBufferNoDepth);const batchState=this._renderer.GetBatchState();batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;this._frameBuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height); +this._lastFov=this._renderer.GetFovY();this._lastNearZ=this._renderer.GetNearZ();this._lastFarZ=this._renderer.GetFarZ()}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){if(this._renderer.GetFovY()!==this._lastFov||this._renderer.GetNearZ()!==this._lastNearZ||this._renderer.GetFarZ()!==this._lastFarZ)this._CalculateProjection();return this._projectionMatrix}IsLinearSampling(){return this._sampling!== +"nearest"}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const ret={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};if(!this._isDefaultSize){ret.width=this._width;ret.height=this._height}return ret}IsCompatibleWithOptions(opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS, +opts);if(opts.sampling!=="nearest"!==this.IsLinearSampling())return false;if(!!opts.alpha!==this.HasAlpha())return false;if(!!opts.depth!==this.HasDepthBuffer())return false;if(this._renderer.GetWebGLVersionNumber()>=2)if(!!opts.isSampled!==this.IsSampled())return false;if(typeof opts.width==="number"||typeof opts.height==="number")return!this.IsDefaultSize()&&this.GetWidth()===Math.floor(opts.width)&&this.GetHeight()===Math.floor(opts.height);else return this.IsDefaultSize()}_GetWebGLTexture(){if(!this._texture)return null; +return this._texture._GetTexture()}GetEstimatedMemoryUsage(){if(this._texture)return this._texture.GetEstimatedMemoryUsage();return this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(renderer,renderTarget){const imageData=await renderer.ReadBackRenderTargetToImageData(renderTarget,true);return await C3.ImageDataToBlob(imageData)}static OnContextLost(){allRenderTargets.clear()}static allRenderTargets(){return allRenderTargets.values()}static ResizeAll(width,height){for(const rt of allRenderTargets)if(rt.IsDefaultSize())rt._Resize(width, +height)}}; + +} + +// ../lib/gfx/webgl/shaderProgram.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4; +const RESERVED_UNIFORM_NAMES=new Set(["aPos","aTex","aPoints","matP","matMV","samplerFront","samplerBack","samplerDepth","destStart","destEnd","srcStart","srcEnd","srcOriginStart","srcOriginEnd","pixelSize","seconds","devicePixelRatio","layerScale","layerAngle","layoutStart","layoutEnd","color","color2_","pointTexStart","pointTexEnd","zElevation","tileSize","tileSpacing","outlineThickness","zNear","zFar"]); +C3.Gfx.WebGLShaderProgram=class WebGLShaderProgram extends C3.Gfx.ShaderProgramBase{static async Compile(renderer,shaderInfo){const gl=renderer.GetContext();const fragSrc=shaderInfo.src;const vertexSrc=shaderInfo.vertexSrc;const name=shaderInfo.name;const fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fragmentShader,fragSrc);gl.compileShader(fragmentShader);const vertexShader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vertexShader,vertexSrc);gl.compileShader(vertexShader); +const shaderProgram=gl.createProgram();gl.attachShader(shaderProgram,fragmentShader);gl.attachShader(shaderProgram,vertexShader);gl.bindAttribLocation(shaderProgram,0,"aPos");gl.bindAttribLocation(shaderProgram,1,"aTex");gl.bindAttribLocation(shaderProgram,2,"aPoints");gl.linkProgram(shaderProgram);const parallelShaderCompileExt=renderer._GetParallelShaderCompileExtension();if(parallelShaderCompileExt)await renderer._WaitForObjectReady(()=>gl.getProgramParameter(shaderProgram,parallelShaderCompileExt["COMPLETION_STATUS_KHR"])); +else await C3.Wait(5);if(!gl.getShaderParameter(fragmentShader,gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(fragmentShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling fragment shader: "+log);}if(!gl.getShaderParameter(vertexShader,gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(vertexShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling vertex shader: "+ +log);}if(!gl.getProgramParameter(shaderProgram,gl.LINK_STATUS)){const log=gl.getProgramInfoLog(shaderProgram);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error linking shader program: "+log);}const infoLog=C3.FilterUnprintableChars(gl.getProgramInfoLog(shaderProgram)||"").trim();if(infoLog&&!C3.IsStringAllWhitespace(infoLog))console.info(`[WebGL] Shader program '${name}' compilation log: `,infoLog);gl.deleteShader(fragmentShader); +gl.deleteShader(vertexShader);return shaderProgram}static async Create(renderer,shaderInfo){const shaderProgram=await C3.Gfx.WebGLShaderProgram.Compile(renderer,shaderInfo);return new C3.Gfx.WebGLShaderProgram(renderer,shaderProgram,shaderInfo)}constructor(renderer,shaderProgram,shaderInfo){super(renderer,shaderInfo);const gl=renderer.GetContext();const batchState=renderer.GetBatchState();renderer.EndBatch();gl.useProgram(shaderProgram);this._gl=gl;this._shaderProgram=shaderProgram;this._isDeviceTransform= +shaderInfo.name==="";const locAPos=gl.getAttribLocation(shaderProgram,"aPos");const locATex=gl.getAttribLocation(shaderProgram,"aTex");this._locAPoints=gl.getAttribLocation(shaderProgram,"aPoints");if(locAPos!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._vertexBuffer);gl.vertexAttribPointer(locAPos,renderer.GetNumVertexComponents(),gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locAPos)}if(locATex!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._texcoordBuffer);gl.vertexAttribPointer(locATex, +2,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locATex)}if(this._locAPoints!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._pointBuffer);gl.vertexAttribPointer(this._locAPoints,4,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(this._locAPoints)}gl.bindBuffer(gl.ARRAY_BUFFER,null);this._uMatP=new C3.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new C3.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new C3.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new C3.Gfx.WebGLShaderUniform(this, +"samplerFront","sampler");this._uPointTexStart=new C3.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new C3.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new C3.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new C3.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new C3.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new C3.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new C3.Gfx.WebGLShaderUniform(this, +"outlineThickness","float");this._uSamplerBack=new C3.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uSamplerDepth=new C3.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new C3.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new C3.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new C3.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new C3.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new C3.Gfx.WebGLShaderUniform(this, +"srcOriginStart","vec2");this._uSrcOriginEnd=new C3.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new C3.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new C3.Gfx.WebGLShaderUniform(this,"seconds","float");this._uDevicePixelRatio=new C3.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new C3.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new C3.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new C3.Gfx.WebGLShaderUniform(this, +"layoutStart","vec2");this._uLayoutEnd=new C3.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._uZNear=new C3.Gfx.WebGLShaderUniform(this,"zNear","float");this._uZFar=new C3.Gfx.WebGLShaderUniform(this,"zFar","float");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uDevicePixelRatio.IsUsed()|| +this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());const customParameterDefs=shaderInfo.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._hasCurrentMatP=false;this._hasCurrentMatMV=false;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0); +this._uSamplerBack.Init1i(1);this._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uZNear.Init1f(renderer.GetNearZ());this._uZFar.Init1f(renderer.GetFarZ()); +this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const p of customParameterDefs){const uniformName=p[0];const paramType=p[2];const shaderUniform=new C3.Gfx.WebGLShaderUniform(this,uniformName,paramType);if(paramType==="color")shaderUniform.Init3f(0,0,0);else shaderUniform.Init1f(0);this._uCustomParameters.push(shaderUniform)}if(this._isDeviceTransform)this._UpdateDeviceTransformUniforms(batchState.currentMatP); +else{this.UpdateMatP(batchState.currentMatP,true);this.UpdateMatMV(batchState.currentMV,true)}const currentShader=batchState.currentShader;gl.useProgram(currentShader?currentShader._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(paramIndex){if(paramIndex< +0||paramIndex>=this._uCustomParameters.length)return null;return this._uCustomParameters[paramIndex].GetType()}AreCustomParametersAlreadySetInBatch(params){for(let i=0,len=params.length;i=2)prefix="#version 300 es\n";else{if(hasFragDepthExt)prefix="#extension GL_EXT_frag_depth : enable\n";if(useDerivatives){prefix+="#extension GL_EXT_shader_texture_lod : enable\n";prefix+="#extension GL_OES_standard_derivatives : enable\n"}}return prefix+ +` +#ifdef GL_FRAGMENT_PRECISION_HIGH +#define highmedp highp +#else +#define highmedp mediump +#endif +precision highmedp float; +${webGLVer>=2?"in":"varying"} vec2 vTex; +${webGLVer>=2?"out lowp vec4 outColor;":""} +uniform lowp vec4 color; +uniform lowp sampler2D samplerFront; +uniform vec2 pixelSize; + +uniform vec2 tileSize; +uniform vec2 tileSpacing; +uniform float outlineThickness; + +const float PI = 3.1415926; + +lowp vec4 cospVec4(lowp vec4 a, lowp vec4 b, float x) +{ + return (a + b + (a - b) * cos(x * PI)) / 2.0; +} + +vec3 randVec3(vec2 seed) +{ + return vec3(fract(sin(dot(seed.xy + vec2(0.1, 0.1), vec2(12.9898,78.233))) * 43758.5453), + fract(sin(dot(seed.yx + vec2(0.1, 0.1), vec2(12.9898,-78.233))) * 43758.5453), + fract(sin(dot(seed.xy + vec2(0.1, 0.1), vec2(-12.9898,-78.233))) * 43758.5453)); +} + +lowp vec4 sampleTile(vec2 tile, vec2 uv, vec2 ddx, vec2 ddy) +{ + vec2 posRandom = tileSize; + float angleRandom = outlineThickness; + + vec3 rand = (randVec3(floor(tile + 0.5)) - 0.5) * 2.0; + + float angle = angleRandom * rand.z * PI; + float sin_a = sin(angle); + float cos_a = cos(angle); + float aspect = pixelSize.x / pixelSize.y; + + vec2 mid = tile + vec2(0.5, 0.5); + vec2 dp = uv - mid; + dp.x /= aspect; + vec2 r = vec2(dp.x * cos_a - dp.y * sin_a, + dp.y * cos_a + dp.x * sin_a); + r.x *= aspect; + + vec2 p = mid + r + (posRandom * rand.xy / 2.0); + + ${webGLVer>=2?"return textureGrad(samplerFront, p, ddx, ddy);":""} + ${webGLVer<2&&useDerivatives?"return texture2DGradEXT(samplerFront, p, ddx, ddy);":""} + ${webGLVer<2&&!useDerivatives?"return texture2D(samplerFront, p);":""} +} + +void main(void) { + + ${webGLVer<2?"lowp vec4 outColor;":""} + + float blendMarginX = tileSpacing.x; + float blendMarginY = tileSpacing.y; + + vec2 tile = floor(vTex); + vec2 tex = fract(vTex); + vec2 ddx = ${webGLVer>=2||useDerivatives?"dFdx(vTex)":"vec2(0.0, 0.0)"}; + vec2 ddy = ${webGLVer>=2||useDerivatives?"dFdy(vTex)":"vec2(0.0, 0.0)"}; + + vec4 curTile = sampleTile(tile, vTex, ddx, ddy); + + bool inLeftMargin = (tex.x < blendMarginX); + bool inRightMargin = (tex.x > 1.0 - blendMarginX); + bool inTopMargin = (tex.y < blendMarginY); + bool inBottomMargin = (tex.y > 1.0 - blendMarginY); + + if (inLeftMargin) + { + lowp vec4 leftTile = sampleTile(tile + vec2(-1.0, 0.0), vTex, ddx, ddy); + float leftMix = (tex.x / (blendMarginX * 2.0)) + 0.5; + lowp vec4 leftMixedTile = cospVec4(leftTile, curTile, leftMix); + + if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + lowp vec4 topLeftTile = sampleTile(tile + vec2(-1.0, -1.0), vTex, ddx, ddy); + lowp vec4 topLeftMixedTile = cospVec4(topLeftTile, topTile, leftMix); + + outColor = cospVec4(topLeftMixedTile, leftMixedTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomLeftTile = sampleTile(tile + vec2(-1.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomLeftMixedTile = cospVec4(bottomLeftTile, bottomTile, leftMix); + + outColor = cospVec4(leftMixedTile, bottomLeftMixedTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = leftMixedTile; + } + } + else if (inRightMargin) + { + lowp vec4 rightTile = sampleTile(tile + vec2(1.0, 0.0), vTex, ddx, ddy); + float rightMix = (tex.x - (1.0 - blendMarginX)) / (blendMarginX * 2.0); + lowp vec4 rightMixedTile = cospVec4(curTile, rightTile, rightMix); + + if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + lowp vec4 topRightTile = sampleTile(tile + vec2(1.0, -1.0), vTex, ddx, ddy); + lowp vec4 topRightMixedTile = cospVec4(topTile, topRightTile, rightMix); + + outColor = cospVec4(topRightMixedTile, rightMixedTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomRightTile = sampleTile(tile + vec2(1.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomRightMixedTile = cospVec4(bottomTile, bottomRightTile, rightMix); + + outColor = cospVec4(rightMixedTile, bottomRightMixedTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = rightMixedTile; + } + } + else if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + outColor = cospVec4(topTile, curTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + outColor = cospVec4(curTile, bottomTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = curTile; + } + + outColor *= color; + ${webGLVer<2?"gl_FragColor = outColor;":""} + ${webGLVer>=2?"gl_FragDepth = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);":""} + ${webGLVer<2&&hasFragDepthExt?"gl_FragDepthEXT = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);":""} +} +`}static GetPointVertexShaderSource_WebGL1(){return["attribute vec4 aPoints;","varying float pointOpacity;","uniform float zElevation;","uniform mat4 matP;","uniform mat4 matMV;","void main(void) {","\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);","\tgl_PointSize = aPoints.z;","\tpointOpacity = aPoints.w;","}"].join("\n")}static GetPointVertexShaderSource_WebGL2(){return["#version 300 es","in vec4 aPoints;","out float pointOpacity;","uniform float zElevation;","uniform mat4 matP;", +"uniform mat4 matMV;","void main(void) {","\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);","\tgl_PointSize = aPoints.z;","\tpointOpacity = aPoints.w;","}"].join("\n")}static GetPointFragmentShaderSource_WebGL1_NoFragDepth(){return["uniform lowp sampler2D samplerFront;","varying lowp float pointOpacity;","uniform mediump vec2 pointTexStart;","uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);", +"\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));","\tgl_FragColor = texture2D(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","}"].join("\n")}static GetPointFragmentShaderSource_WebGL1_FragDepthEXT(){return["#extension GL_EXT_frag_depth : enable","uniform lowp sampler2D samplerFront;","varying lowp float pointOpacity;","uniform mediump vec2 pointTexStart;", +"uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);","\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));","\tgl_FragColor = texture2D(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","\tgl_FragDepthEXT = (gl_FragColor.a == 0.0 ? 1.0 : gl_FragCoord.z);", +"}"].join("\n")}static GetPointFragmentShaderSource_WebGL2(){return["#version 300 es","uniform lowp sampler2D samplerFront;","in lowp float pointOpacity;","uniform mediump vec2 pointTexStart;","uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","out lowp vec4 outColor;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);","\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));", +"\toutColor = texture(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","\tgl_FragDepth = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);","}"].join("\n")}static GetColorFillFragmentShaderSource(){return["uniform lowp vec4 color;","void main(void) {","\tgl_FragColor = color;","}"].join("\n")}static GetLinearGradientFillFragmentShaderSource(){return["precision lowp float;","varying mediump vec2 vTex;","uniform vec4 color;","uniform vec4 color2_;","vec3 fromLinear(vec3 linearRGB)", +"{","\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));","\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);","\tvec3 lower = linearRGB * vec3(12.92);","\treturn mix(higher, lower, vec3(cutoff));","}","vec3 toLinear(vec3 sRGB)","{","\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));","\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));","\tvec3 lower = sRGB/vec3(12.92);","\treturn mix(higher, lower, vec3(cutoff));","}","void main(void) {","\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);", +"\tfloat a = mix(color.a, color2_.a, vTex.x);","\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);","}"].join("\n")}static GetPenumbraFillFragmentShaderSource(){return[`#ifdef GL_FRAGMENT_PRECISION_HIGH`,`#define highmedp highp`,`#else`,`#define highmedp mediump`,`#endif`,`precision lowp float;`,`varying highmedp vec2 vTex;`,`uniform vec4 color;`,`void main(void) {`,` highmedp float grad = vTex.x / (1.0 - vTex.y);`,` gl_FragColor = color * (1.0 - (cos(grad * 3.141592653589793) + 1.0) / 2.0);`, +`}`].join("\n")}static GetSmoothLineFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","void main(void) {","\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;","\tgl_FragColor = color * f;","}"].join("\n")}static GetHardEllipseFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float f = step(diffSq.x + diffSq.y, 0.25);", +"\tgl_FragColor = color * f;","}"].join("\n")}static GetHardEllipseOutlineFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","uniform mediump vec2 pixelSize;","uniform mediump float outlineThickness;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float distSq = diffSq.x + diffSq.y;","\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump float innerF = step(distSq, 0.25);", +"\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;","\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;","\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);","\tgl_FragColor = color * innerF * outerF;","}"].join("\n")}static GetSmoothEllipseFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","uniform mediump vec2 pixelSize;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;", +"\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump vec2 halfNormSq = halfNorm * halfNorm;","\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;","\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;","\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);","\tgl_FragColor = color * f;","}"].join("\n")}static GetSmoothEllipseOutlineFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;", +"uniform mediump vec2 pixelSize;","uniform mediump float outlineThickness;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float distSq = diffSq.x + diffSq.y;","\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump vec2 halfNormSq = halfNorm * halfNorm;","\tmediump vec2 pxNorm = pixelSize * norm;","\tmediump vec2 innerEdge1 = halfNorm - pxNorm;","\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;", +"\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);","\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;","\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;","\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);","\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;","\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);","\tgl_FragColor = color * innerF * outerF;", +"}"].join("\n")}}; + +} + +// ../lib/gfx/webgl/shaderUniform.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const mat4=glMatrix.mat4;const TYPE_SIZES=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]); +C3.Gfx.WebGLShaderUniform=class WebGLShaderUniform{constructor(owner,name,type){if(!TYPE_SIZES.has(type))throw new Error("invalid uniform type");this._owner=owner;this._gl=this._owner.GetWebGLContext();this._name=name;this._type=type;this._isColorType=this._type==="color";this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),name);this._isUsed=!!this._location;const typeSize=TYPE_SIZES.get(type);this._lastValue=new Float32Array(typeSize);this._lastBatchValue=new Float32Array(typeSize)}Release(){this._owner= +null;this._gl=null;this._location=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(v0){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastBatchValue.set(this._lastValue);this._gl.uniform1f(this._location,v0)}Init1i(v0){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastBatchValue.set(this._lastValue);this._gl.uniform1i(this._location,v0)}Init2f(v0,v1){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastBatchValue.set(this._lastValue); +this._gl.uniform2f(this._location,v0,v1)}Init3f(v0,v1,v2){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastValue[2]=v2;this._lastBatchValue.set(this._lastValue);this._gl.uniform3f(this._location,v0,v1,v2)}Init4f(v0,v1,v2,v3){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastValue[2]=v2;this._lastValue[3]=v3;this._lastBatchValue.set(this._lastValue);this._gl.uniform4f(this._location,v0,v1,v2,v3)}Update1f(v0){v0=Math.fround(v0);const lastValue= +this._lastValue;if(lastValue[0]===v0)return;lastValue[0]=v0;this._gl.uniform1f(this._location,v0)}Update1i(v0){const lastValue=this._lastValue;if(lastValue[0]===v0)return;lastValue[0]=v0;this._gl.uniform1i(this._location,v0)}Update2f(v0,v1){v0=Math.fround(v0);v1=Math.fround(v1);const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1)return;lastValue[0]=v0;lastValue[1]=v1;this._gl.uniform2f(this._location,v0,v1)}Update3f(v0,v1,v2){v0=Math.fround(v0);v1=Math.fround(v1);v2=Math.fround(v2); +const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1&&lastValue[2]===v2)return;lastValue[0]=v0;lastValue[1]=v1;lastValue[2]=v2;this._gl.uniform3f(this._location,v0,v1,v2)}Update4f(v0,v1,v2,v3){v0=Math.fround(v0);v1=Math.fround(v1);v2=Math.fround(v2);v3=Math.fround(v3);const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1&&lastValue[2]===v2&&lastValue[3]===v3)return;lastValue[0]=v0;lastValue[1]=v1;lastValue[2]=v2;lastValue[3]=v3;this._gl.uniform4f(this._location, +v0,v1,v2,v3)}UpdateMatrix4fv(m){const lastValue=this._lastValue;if(mat4.exactEquals(lastValue,m))return;C3.typedArraySet16(lastValue,m,0);this._gl.uniformMatrix4fv(this._location,false,m)}IsSetToCustomInBatch(p){const batchValue=this._lastBatchValue;if(this.IsColorType())return batchValue[0]===Math.fround(p.getR())&&batchValue[1]===Math.fround(p.getG())&&batchValue[2]===Math.fround(p.getB());else return batchValue[0]===Math.fround(p)}SetBatchValueCustom(p){const batchValue=this._lastBatchValue;if(this.IsColorType()){batchValue[0]= +p.getR();batchValue[1]=p.getG();batchValue[2]=p.getB()}else batchValue[0]=p}IsSetTo1InBatch(x){return this._lastBatchValue[0]===Math.fround(x)}IsSetTo2InBatch(x,y){const batchValue=this._lastBatchValue;return batchValue[0]===Math.fround(x)&&batchValue[1]===Math.fround(y)}SetBatch1(x){this._lastBatchValue[0]=x}SetBatch2(x,y){const batchValue=this._lastBatchValue;batchValue[0]=x;batchValue[1]=y}}; + +} + +// ../lib/gfx/webgl/batchJob.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const BATCH_NULL=0;const BATCH_QUAD=1;const BATCH_SETTEXTURE=2;const BATCH_SETCOLOR=3;const BATCH_SETBLEND=4;const BATCH_SETVIEWPORT=5;const BATCH_SETPROJECTION=6;const BATCH_SETMODELVIEW=7;const BATCH_SETRENDERTARGET=8;const BATCH_CLEARSURFACE=9;const BATCH_POINTS=10;const BATCH_SETPROGRAM=11;const BATCH_SETPROGRAMPARAMETERS=12;const BATCH_SETPROGRAMCUSTOMPARAMETERS=13; +const BATCH_INVALIDATEFRAMEBUFFER=14;const BATCH_SETPOINTTEXCOORDS=15;const BATCH_SETTILEMAPINFO=16;const BATCH_BLITFRAMEBUFFER=17;const BATCH_STARTQUERY=18;const BATCH_ENDQUERY=19;const BATCH_SETELLIPSEPARAMS=20;const BATCH_SETGRADIENTCOLOR=21;const BATCH_CLEARDEPTH=22;const BATCH_SETDEPTHENABLED=23;const BATCH_SETDEPTHSAMPLINGENABLED=24;const BATCH_COPLANAR_STARTSTENCILPASS=25;const BATCH_COPLANAR_STARTCOLORPASS=26;const BATCH_COPLANAR_RESTORE=27;const BATCH_SET_SCISSOR=28; +const BATCH_SETTILERANDOMIZATIONINFO=29;C3.Gfx.BatchState=class BatchState{constructor(renderer){this.renderer=renderer;this.currentMV=mat4.create();this.currentMatP=mat4.create();this.currentFramebuffer=null;this.currentFramebufferNoDepth=null;this.isDepthSamplingEnabled=false;this.currentColor=vec4.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new C3.Rect;this.clearColor=C3.New(C3.Color,0,0,0,0)}}; +C3.Gfx.WebGLBatchJob=class WebGLBatchJob{constructor(batchState){const arrayBuffer=new ArrayBuffer(96);this._type=0;this._batchState=batchState;this._gl=batchState.renderer.GetContext();this._startIndex=0;this._indexCount=0;this._texParam=null;this._mat4param=new Float32Array(arrayBuffer,0,16);this._colorParam=new Float32Array(arrayBuffer,64,4);this._srcOriginRect=new Float32Array(arrayBuffer,80,4);this._shaderParams=[]}InitQuad(startIndex,indexCount){this._type=BATCH_QUAD;this._startIndex=startIndex; +this._indexCount=indexCount}DoQuad(){const gl=this._gl;gl.drawElements(gl.TRIANGLES,this._indexCount,gl.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(rendererTex){this._type=BATCH_SETTEXTURE;this._texParam=rendererTex}DoSetTexture(){const gl=this._gl;const texParam=this._texParam;gl.bindTexture(gl.TEXTURE_2D,texParam?texParam._GetTexture():null)}InitSetColor(c){this._type=BATCH_SETCOLOR;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam;const batchState=this._batchState; +vec4.copy(batchState.currentColor,c);batchState.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=BATCH_SETGRADIENTCOLOR;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam;const s=this._batchState.currentShader;if(s._uColor2.IsUsed())s._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(s,d){this._type=BATCH_SETBLEND;this._startIndex=s;this._indexCount=d}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitSetViewport(x,y,w,h){this._type= +BATCH_SETVIEWPORT;const colorParam=this._colorParam;colorParam[0]=x;colorParam[1]=y;colorParam[2]=w;colorParam[3]=h}DoSetViewport(){const colorParam=this._colorParam;this._gl.viewport(colorParam[0],colorParam[1],colorParam[2],colorParam[3])}InitSetProjection(m){this._type=BATCH_SETPROJECTION;mat4.copy(this._mat4param,m)}DoSetProjection(){const batchState=this._batchState;const allShaderPrograms=batchState.renderer._allShaderPrograms;const currentShader=batchState.currentShader;const mat4param=this._mat4param; +for(let i=0,len=allShaderPrograms.length;i{const fontName=e.font.GetName();for(const f of allRendererTexts)if(f.IsBBCodeEnabled()||C3.equalsNoCase(f.GetFontName(),fontName))f._SetTextChanged()}); +function fillOrStrokeText(ctx,isStroke,text,x,y,maxWidth){if(isStroke)if(C3.Platform.BrowserEngine==="Gecko")ctx.strokeText(text,x,y,maxWidth);else ctx.strokeText(text,x,y);else if(C3.Platform.BrowserEngine==="Gecko")ctx.fillText(text,x,y,maxWidth);else ctx.fillText(text,x,y)}function fillOrStrokeRect(ctx,isStroke,x,y,w,h){if(isStroke)ctx.strokeRect(x,y,w,h);else ctx.fillRect(x,y,w,h)}function ptToPx(pt){return pt*(4/3)} +function getOffsetParam(paramStr,fragHeight){paramStr=paramStr.trim();const param=parseFloat(paramStr);if(!isFinite(param))return 0;if(paramStr.endsWith("%"))return fragHeight*param/100;else return param}let didCheckFoundBoundingBoxSupport=false;let supportsFontBoundingBoxMeasurements=false; +C3.Gfx.RendererText=class RendererText{constructor(renderer,opts){opts=Object.assign({},DEFAULT_OPTS,opts);this._renderer=renderer;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isBold=false;this._isItalic=false;this._colorStr="black";this._isBBcodeEnabled=false;this._iconSet=null;this._iconSmoothing=true;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText= +C3.New(C3.WordWrap);this._wrapMode="word";this._textChanged=false;this._drawMaxCharCount=-1;this._drawCharCount=0;this._cssWidth=0;this._cssHeight=0;this._width=0;this._height=0;this._zoom=1;this._changed=false;this._textCanvas=null;this._textContext=null;this._measureContext=null;this._measureContextTop=null;this._lastCanvasWidth=-1;this._lastCanvasHeight=-1;this._lastTextCanvasFont="";this._lastMeasureCanvasFont="";this._lastTextCanvasFillStyle="";this._lastTextCanvasOpacity=1;this._lastTextCanvasLineWidth= +1;this._measureTextCallback=frag=>this._MeasureText(frag);this._texture=null;this._rcTex=new C3.Rect;this._scaleFactor=1;this._textureTimeout=new C3.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},opts.timeout);this.ontextureupdate=null;this._wasReleased=false;allRendererTexts.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._iconSet=null;this._bbString=null;this._textCanvas=null;this._textContext=null;this._measureContext=null;this._measureContextTop= +null;this._measureTextCallback=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._wrappedText=null;this._renderer=null;this._wasReleased=true;allRendererTexts.delete(this)}_SetChanged(){this._changed=true}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=true}SetBBCodeEnabled(e){e=!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;const textBaseline=this._isBBcodeEnabled?"alphabetic":"top"; +if(this._textContext)this._textContext.textBaseline=textBaseline;if(this._measureContext)this._measureContext.textBaseline=textBaseline;this._SetTextChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetIconSet(iconSet){if(this._iconSet===iconSet)return;this._iconSet=iconSet;this._wrappedText.SetIconSet(iconSet);if(this._iconSet&&this._iconSet.IsLoading())this._iconSet.LoadContent().then(()=>this._SetChanged());this._SetTextChanged()}SetIconSmoothing(s){s=!!s;if(this._iconSmoothing===s)return; +this._iconSmoothing=s;this._SetChanged()}SetFontName(fontName){if(!fontName)fontName="serif";if(this._fontName===fontName)return;this._fontName=fontName;this._SetTextChanged()}GetFontName(){return this._fontName}SetFontSize(fontSize){if(fontSize<.1)fontSize=.1;if(this._fontSize===fontSize)return;this._fontSize=fontSize;this._SetTextChanged()}SetFontSizeScale(s){if(this._fontSizeScale===s)return;this._fontSizeScale=s;this._SetTextChanged()}SetLineHeight(h){if(this._lineHeight===h)return;this._lineHeight= +h;this._SetChanged()}SetBold(bold){bold=!!bold;if(this._isBold===bold)return;this._isBold=bold;this._SetTextChanged()}SetItalic(italic){italic=!!italic;if(this._isItalic===italic)return;this._isItalic=italic;this._SetTextChanged()}SetDrawMaxCharacterCount(n){n=Math.floor(n);if(this._drawMaxCharCount===n)return;this._drawMaxCharCount=n;this._SetChanged()}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetFontString(useCssUnits,frag){let ret=[];if(this._isBold||frag.HasStyleTag("b"))ret.push("bold"); +if(this._isItalic||frag.HasStyleTag("i"))ret.push("italic");const sizeStyle=frag.GetStyleTag("size");const fontSize=(sizeStyle?parseFloat(sizeStyle.param):this._fontSize)*this._fontSizeScale;if(useCssUnits)ret.push(fontSize+"pt");else ret.push(fontSize*this.GetDrawScale()+"pt");let fontName=this._fontName;const fontStyle=frag.GetStyleTag("font");if(fontStyle&&fontStyle.param){fontName=fontStyle.param;if(this.onloadfont&&!this._alreadyLoadedFonts.has(fontName)){this.onloadfont(fontName);this._alreadyLoadedFonts.add(fontName)}}if(fontName)if(GENERIC_FONT_FAMILIES.has(fontName))ret.push(fontName); +else ret.push('"'+fontName+'"');return ret.join(" ")}SetColor(c){if(c instanceof C3.Color)c=c.getCssRgb();if(this._colorStr===c)return;this._colorStr=c;this._SetChanged()}SetColorRgb(r,g,b){tempColor.setRgb(r,g,b);this.SetColor(tempColor)}SetHorizontalAlignment(h){if(!VALID_HORIZ_ALIGNMENTS.has(h))throw new Error("invalid horizontal alignment");if(this._horizontalAlign===h)return;this._horizontalAlign=h;this._SetChanged()}SetVerticalAlignment(v){if(!VALID_VERT_ALIGNMENTS.has(v))throw new Error("invalid vertical alignment"); +if(this._verticalAlign===v)return;this._verticalAlign=v;this._SetChanged()}SetWordWrapMode(m){if(!VALID_WORD_WRAP_MODES.has(m))throw new Error("invalid word wrap mode");if(this._wrapMode===m)return;this._wrapMode=m;this._SetTextChanged()}SetText(text){if(this._text===text)return;this._text=text;this._SetTextChanged()}GetDrawScale(){return this._scaleFactor*this._zoom*self.devicePixelRatio}SetSize(cssWidth,cssHeight,zoom){if(typeof zoom==="undefined")zoom=1;if(cssWidth<=0||cssWidth<=0)return;if(this._cssWidth=== +cssWidth&&this._cssHeight===cssHeight&&this._zoom===zoom)return;const oldCssWidth=this._cssWidth;this._cssWidth=cssWidth;this._cssHeight=cssHeight;this._zoom=zoom;const dpr=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*dpr;this._height=this._cssHeight*this._zoom*dpr;const maxDim=Math.max(this._width,this._height);const maxTextureSize=Math.min(this._renderer.GetMaxTextureSize(),MAX_TEXTURE_SIZE);let scale=1;if(maxDim>maxTextureSize){scale=maxTextureSize/maxDim;this._width=Math.min(this._width* +scale,maxTextureSize);this._height=Math.min(this._height*scale,maxTextureSize)}this._scaleFactor=scale;if(this._cssWidth!==oldCssWidth)this._SetTextChanged();else this._SetChanged()}GetWidth(){return this._width}GetHeight(){return this._height}GetZoom(){return this._zoom}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+EXTRA_LINE_HEIGHT)- +this._lineHeight}GetLengthInGraphemes(){this._MaybeWrapText();let ret=0;for(const line of this._wrappedText.GetLines())for(const frag of line.fragments())ret+=frag.GetLength();return ret}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}HitTestFragment(x,y){this._MaybeUpdate();const scale=this.GetDrawScale();const lines=this._wrappedText.GetLines();for(const line of lines){const yOff=line.GetFontBoundingBoxDescent()*scale;if(y>=line.GetPosY()-line.GetHeight()*scale+ +yOff&&y=frag.GetPosX()&&xa+v.GetHeight()*scale+lineSpaceHeight,0)-lineSpaceHeight; +penY=Math.max(this._height/2-linesTotalHeight/2,0);if(useFontBoundingBoxMeasurements)firstLineTextHeight=lines[0].GetTopToAlphabeticDistance()*scale}else if(this._verticalAlign==="bottom"){const linesTotalHeight=lines.reduce((a,v)=>a+v.GetHeight()*scale+lineSpaceHeight,0)-this._lineHeight*scale;const lastLineDescentHeight=useFontBoundingBoxMeasurements?lines.at(-1).GetFontBoundingBoxDescent()*scale:0;penY=this._height-linesTotalHeight-lastLineDescentHeight-2}for(let i=0,len=lines.length;i0&&penY>this._height-EXTRA_LINE_HEIGHT*scale)break}else if(i>0&&penY>=this._height-curLineTextHeight)break;if(startPenY>=0)this._DrawTextLine(line,penY,scale);if(!this._isBBcodeEnabled)penY+=curLineTextHeight;penY+=lineSpaceHeight}}_DrawTextLine(line,penY,scale){let penX=0;if(this._horizontalAlign==="center")penX=(this._width-line.GetWidth()* +scale)/2;else if(this._horizontalAlign==="right")penX=this._width-line.GetWidth()*scale;line.SetPosX(penX);line.SetPosY(penY);for(const frag of line.fragments()){this._DrawFragment(frag,penX,penY,scale,line.GetHeight());penX+=frag.GetWidth()*scale}}_DrawFragment(frag,penX,penY,scale,lineHeight){const offsetXStyle=frag.GetStyleTag("offsetx");penX+=offsetXStyle?getOffsetParam(offsetXStyle.param,frag.GetHeight())*scale:0;const offsetYStyle=frag.GetStyleTag("offsety");penY+=offsetYStyle?getOffsetParam(offsetYStyle.param, +frag.GetHeight())*scale:0;if(frag.IsIcon()){const iconOffsetYStyle=frag.GetStyleTag("iconoffsety");penY+=iconOffsetYStyle?getOffsetParam(iconOffsetYStyle.param,frag.GetHeight())*scale:.2*frag.GetHeight()*scale}frag.SetPosX(penX);frag.SetPosY(penY);const textContext=this._textContext;const lineFontScale=lineHeight/16;let fragWidth=frag.GetWidth()*scale;const fragHeight=frag.GetHeight()*scale;const fragFontScale=frag.GetHeight()/16;const lineSpaceHeight=(EXTRA_LINE_HEIGHT+this._lineHeight)*scale;let chArr= +frag.IsText()?frag.GetCharacterArray():null;if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(frag.IsText())if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(frag).width*scale}this._drawCharCount+=frag.GetLength()}const backgroundStyle=frag.GetStyleTag("background");const hasUnderline=frag.HasStyleTag("u");const hasStrikethrough=frag.HasStyleTag("s");if(frag.IsText()&& +C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle&&!hasUnderline&&!hasStrikethrough||frag.HasStyleTag("hide"))return;if(backgroundStyle){this._SetDrawCanvasColor(backgroundStyle.param);textContext.fillRect(penX,penY-fragHeight,fragWidth,fragHeight+lineSpaceHeight)}const colorStyle=frag.GetStyleTag("color");this._SetDrawCanvasColor(colorStyle?colorStyle.param:this._colorStr);const opacityStyle=frag.GetStyleTag("opacity");this._SetDrawCanvasOpacity(opacityStyle?parseFloat(opacityStyle.param)/100: +1);const lineThicknessStyle=frag.GetStyleTag("linethickness");const lineThicknessScale=lineThicknessStyle?parseFloat(lineThicknessStyle.param):1;const isStroke=frag.HasStyleTag("stroke");if(isStroke)this._SetDrawCanvasLineWith(fragFontScale*.5*lineThicknessScale*this.GetDrawScale());if(frag.IsText()){const text=chArr.join("");this._SetDrawFontString(this._GetFontString(false,frag));fillOrStrokeText(textContext,isStroke,text,penX,penY,fragWidth);if(!isStroke){this._SetDrawCanvasLineWith(fragFontScale* +.5*lineThicknessScale*this.GetDrawScale());const outlineStyle=frag.GetStyleTag("outline");if(outlineStyle){this._SetDrawCanvasColor(outlineStyle.param);fillOrStrokeText(textContext,true,text,penX,penY,fragWidth)}}}else if(frag.IsIcon())if(frag.GetWidth()>0){const drawable=frag.GetDrawable(this._iconSet);if(drawable)textContext.drawImage(drawable,penX,penY-fragHeight,fragWidth,fragHeight)}this._SetDrawCanvasColor(colorStyle?colorStyle.param:this._colorStr);if(hasUnderline)fillOrStrokeRect(textContext, +isStroke,penX,penY+scale*lineFontScale,fragWidth,scale*lineFontScale*lineThicknessScale);if(hasStrikethrough){const defaultStrikeY=penY-fragHeight/4;const defaultStrikeHeight=scale*fragFontScale;const strikeYMid=defaultStrikeY+defaultStrikeHeight/2;textContext.fillRect(penX,strikeYMid-defaultStrikeHeight*lineThicknessScale/2,fragWidth,defaultStrikeHeight*lineThicknessScale)}}_UpdateTexture(){if(this._renderer.IsContextLost())return;if(!this._texture)this._texture=this._renderer.CreateDynamicTexture(this._textCanvas.width, +this._textCanvas.height,{mipMap:true,mipMapQuality:"high"});this._renderer.UpdateTexture(this._textCanvas,this._texture);this._rcTex.set(0,0,this._width/this._texture.GetWidth(),this._height/this._texture.GetHeight());if(this.ontextureupdate)this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){if(this._texture){if(!this._renderer.IsContextLost())this._renderer.DeleteTexture(this._texture);this._texture=null}}static OnContextLost(){for(const rendererText of allRendererTexts)rendererText.ReleaseTexture()}static GetAll(){return allRendererTexts.values()}}; + +} + +// ../lib/gfx/webgl/query.js +{ +'use strict';const C3=self.C3; +class WebGLRealTimeElapsedQuery{constructor(renderer){this._gl=renderer.GetContext();this._version=renderer.GetWebGLVersionNumber();this._timerExt=renderer._GetDisjointTimerQueryExtension();this._query=null;this._isActive=false;this._hasResult=false;this._result=0;if(this._version===1)this._query=this._timerExt["createQueryEXT"]();else this._query=this._gl["createQuery"]()}Release(){this._DeleteQueryObject();this._gl=null;this._timerExt=null;this._hasResult=false}_DeleteQueryObject(){if(!this._query)return;if(this._version=== +1)this._timerExt["deleteQueryEXT"](this._query);else this._gl["deleteQuery"](this._query);this._query=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");if(this._version===1)this._timerExt["beginQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"],this._query);else this._gl["beginQuery"](this._timerExt["TIME_ELAPSED_EXT"],this._query);this._isActive=true}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");if(this._version===1)this._timerExt["endQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"]); +else this._gl["endQuery"](this._timerExt["TIME_ELAPSED_EXT"]);this._isActive=false}CheckForResult(){if(!this._query||this._hasResult||this._isActive)return;let available=false;if(this._version===1)available=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_AVAILABLE_EXT"]);else available=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT_AVAILABLE"]);const disjoint=this._gl.getParameter(this._timerExt["GPU_DISJOINT_EXT"]);if(available&&!disjoint){if(this._version=== +1)this._result=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_EXT"]);else this._result=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT"]);this._result/=1E9;this._hasResult=true}if(available||disjoint)this._DeleteQueryObject()}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw new Error("no result available");return this._result}} +C3.Gfx.WebGLTimeElapsedQuery=class WebGLTimeElapsedQuery{constructor(renderer){this._renderer=renderer;this._frameNumber=renderer.GetFrameNumber();this._isActive=false;this._parentQuery=null;this._isNested=false;this._realQuery=null;this._queries=[]}Release(){for(const q of this._queries)if(q instanceof WebGLRealTimeElapsedQuery)q.Release();C3.clearArray(this._queries);this._parentQuery=null;this._realQuery=null;this._renderer=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active"); +const stack=this._renderer._GetTimeQueryStack();if(stack.length>0){this._isNested=true;this._parentQuery=stack.at(-1);this._parentQuery._EndReal();this._parentQuery._queries.push(this)}else{this._isNested=false;this._parentQuery=null}this._isActive=true;stack.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");const top=this._renderer._GetTimeQueryStack().pop();if(top!==this)throw new Error("can only end most nested query");this._isActive=false;this._EndReal(); +if(this._parentQuery){this._parentQuery._StartReal();this._parentQuery=null}}_StartReal(){this._realQuery=C3.New(WebGLRealTimeElapsedQuery,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const q of this._queries)q.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(q=>q.HasResult())}GetResult(){return this._queries.reduce((a,v)=>a+v.GetResult(), +0)}GetFrameNumber(){return this._frameNumber}}; + +} + +// ../lib/gfx/webgl/queryResultBuffer.js +{ +'use strict';const C3=self.C3; +C3.Gfx.WebGLQueryResultBuffer=class WebGLQueryResultBuffer{constructor(renderer,maxQueries=1E3){this._renderer=renderer;this._maxQueries=maxQueries;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const q of this._buffer)q.Release();C3.clearArray(this._buffer)}AddTimeElapsedQuery(){const ret=new C3.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(ret);if(this._buffer.length>this._maxQueries){const oldest= +this._buffer.shift();oldest.Release()}return ret}CheckForResults(toFrameNumber){for(const q of this._buffer){if(q.GetFrameNumber()>=toFrameNumber)return;if(q.IsNested())return;q.CheckForResult()}}GetFrameRangeResultSum(startFrame,endFrame){if(endFrame<=startFrame)return NaN;let sum=0;for(const q of this._buffer){if(q.GetFrameNumber()>=endFrame)break;if(q.GetFrameNumber()0)this._buffer.splice(0,i);return}}}}; + +} + +// ../lib/gfx/webgl/webglRenderer.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const DEFAULT_WEBGLRENDERER_OPTS={powerPreference:"default",enableGpuProfiling:true,alpha:false,lowLatency:false,depth:false,canSampleDepth:false,maxWebGLVersion:2,failIfMajorPerformanceCaveat:false};const VALID_POWER_PREFERENCES=new Set(["default","low-power","high-performance"]);const MAX_VERTICES=8E3;const MAX_INDICES=MAX_VERTICES/2*3; +const MAX_POINTS=8E3;const LAST_POINT=MAX_POINTS-4;const PARTIAL_TEXTURE_UPLOAD_CHUNK_SIZE=256*1024;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1);const tmpProjection=mat4.create();const tmpModelView=mat4.create();const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;let loseContextExtension=null; +if(C3.isDebug){self.debug_lose_webgl_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.loseContext()};self.debug_restore_webgl_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.restoreContext()}}const pendingPolls=new Set;let pollRafId=-1; +function CheckPendingPolls(){pollRafId=-1;for(const info of pendingPolls)if(info.checkFunc()){info.resolve();pendingPolls.delete(info)}if(pendingPolls.size>0)pollRafId=self.requestAnimationFrame(CheckPendingPolls)} +C3.Gfx.WebGLRenderer=class WebGLRenderer extends C3.Gfx.RendererBase{constructor(canvas,opts){super(opts);opts=Object.assign({},DEFAULT_WEBGLRENDERER_OPTS,opts);if(!VALID_POWER_PREFERENCES.has(opts.powerPreference))throw new Error("invalid power preference");const attribs={"alpha":!!opts.alpha,"depth":false,"antialias":false,"powerPreference":opts.powerPreference,"failIfMajorPerformanceCaveat":!!opts.failIfMajorPerformanceCaveat};if(opts.lowLatency){attribs["desynchronized"]=true;attribs["preserveDrawingBuffer"]= +true}let gl=null;let version=0;if(opts.maxWebGLVersion>=2){gl=canvas.getContext("webgl2",attribs);version=2}if(!gl){gl=canvas.getContext("webgl",attribs);version=1}if(!gl)throw new Error("renderer-unavailable (could not get WebGL context)");this._gl=gl;this._attribs=gl.getContextAttributes();if(opts.lowLatency&&!this._attribs["desynchronized"])console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=gl.getParameter(gl.VERSION);this._version=version; +this._viewport=vec4.create();this._didChangeTransform=false;this._bbProjectionMatrix=mat4.create();this._usesDepthBuffer=!!opts.depth;this._canSampleDepth=!!(opts.depth&&opts.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=false;this._depthBuffer=null;this._isAutoSizeDepthBuffer=true;this._depthBufferWidth=0;this._depthBufferHeight=0;this._vertexBuffer=null;this._texcoordBuffer=null;this._indexBuffer=null;this._pointBuffer=null;this._vertexData=new Float32Array(MAX_VERTICES* +this.GetNumVertexComponents());this._indexData=new Uint16Array(MAX_INDICES);this._texcoordData=new Float32Array(MAX_VERTICES*2);this._pointData=new Float32Array(MAX_POINTS*4);this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._lastVertexPtr=0;this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._batch=[];this._batchPtr=0;this._topOfBatch=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=C3.New(C3.Gfx.BatchState,this);this._lastColor=C3.New(C3.Color,1,1,1,1);this._lastTexture0= +null;this._lastTexture1=null;this._lastSrcBlend=0;this._lastDestBlend=0;this._lastPointTexCoords=new C3.Rect;this._lastScissorRect=C3.New(C3.Rect,0,0,-1,-1);this._coplanarMode=0;this._maxTextureSize=-1;this._minPointSize=0;this._maxPointSize=0;this._highpPrecision=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=false;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt= +null;this._stdDerivativesExt=null;this._textureLodExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!opts.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return true}async InitState(){super.InitState();const gl=this._gl;const numVertexComponents=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture0=null;this._lastTexture1=null;this._vertexPtr=0;this._pointPtr= +0;this._lastVertexPtr=MAX_VERTICES*numVertexComponents-4*numVertexComponents;C3.clearArray(this._batch);this._batchPtr=0;this._topOfBatch=0;this._lastProgram=null;this._currentRenderTarget=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;const batchState=this._batchState;batchState.currentShader=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;vec4.set(batchState.currentColor,1,1,1,1);batchState.clearColor.setRgba(0,0,0,0);batchState.pointTexCoords.set(0, +0,1,1);gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT);gl.enable(gl.BLEND);gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=gl.ONE;this._lastDestBlend=gl.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(gl);gl.disable(gl.CULL_FACE);gl.disable(gl.STENCIL_TEST);gl.disable(gl.DITHER);if(this._usesDepthBuffer){gl.enable(gl.DEPTH_TEST);gl.depthMask(true);gl.depthFunc(gl.LEQUAL)}else{gl.disable(gl.DEPTH_TEST);gl.depthMask(false)}this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled= +false;this._pointBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._pointData.byteLength,gl.DYNAMIC_DRAW);this._vertexBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertexData.byteLength,gl.DYNAMIC_DRAW);this._texcoordBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texcoordData.byteLength,gl.DYNAMIC_DRAW);this._indexBuffer= +gl.createBuffer();gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,this._indexData,gl.STATIC_DRAW);gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,null);this._maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);const pointsizes=gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);this._minPointSize=pointsizes[0];this._maxPointSize=pointsizes[1];const highpVertex=gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT);const highpFrag=gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, +gl.HIGH_FLOAT);if(highpVertex&&highpFrag)this._highpPrecision=Math.min(highpVertex["precision"],highpFrag["precision"]);else this._highpPrecision=0;if(this._maxPointSize>2048)this._maxPointSize=2048;this._extensions=gl.getSupportedExtensions();const debug_ext=gl.getExtension("WEBGL_debug_renderer_info");if(debug_ext){this._unmaskedVendor=gl.getParameter(debug_ext["UNMASKED_VENDOR_WEBGL"]);this._unmaskedRenderer=gl.getParameter(debug_ext["UNMASKED_RENDERER_WEBGL"])}this._parallelShaderCompileExt=gl.getExtension("KHR_parallel_shader_compile"); +if(C3.isDebug)loseContextExtension=gl.getExtension("WEBGL_lose_context");if(this._isGpuProfilingEnabled)if(this.GetWebGLVersionNumber()===1){if(C3.Platform.BrowserEngine!=="Chromium"||C3.Platform.BrowserVersionNumber>=81||typeof document!=="undefined")this._timerExt=gl.getExtension("EXT_disjoint_timer_query")}else this._timerExt=gl.getExtension("EXT_disjoint_timer_query_webgl2")||gl.getExtension("EXT_disjoint_timer_query");this._anisotropicExt=gl.getExtension("EXT_texture_filter_anisotropic");if(this._anisotropicExt)this._maxAnisotropy= +gl.getParameter(this._anisotropicExt["MAX_TEXTURE_MAX_ANISOTROPY_EXT"]);else this._maxAnisotropy=0;if(this.GetWebGLVersionNumber()<2&&this._usesDepthBuffer&&this._canSampleDepth){this._depthTextureExt=gl.getExtension("WEBGL_depth_texture");if(!this._depthTextureExt)throw new Error("no depth texture support");}if(this.GetWebGLVersionNumber()<2){this._fragDepthExt=gl.getExtension("EXT_frag_depth");this._stdDerivativesExt=gl.getExtension("OES_standard_derivatives");this._textureLodExt=gl.getExtension("EXT_shader_texture_lod")}const WebGLShaderProgram= +C3.Gfx.WebGLShaderProgram;const vsSource=WebGLShaderProgram.GetDefaultVertexShaderSource(false);let textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_NoFragDepth();let textureFillVertexSrc=vsSource;let pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_NoFragDepth();let pointVertexSrc=WebGLShaderProgram.GetPointVertexShaderSource_WebGL1();let tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_NoFragDepth();let tilemapVertexSrc= +WebGLShaderProgram.GetDefaultVertexShaderSource(true);let useFragDepthExt=false;if(this._usesDepthBuffer&&(C3.Platform.Browser!=="Safari"||C3.Platform.BrowserVersionNumber>=15.5))if(this.GetWebGLVersionNumber()<2){if(this._fragDepthExt){textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_FragDepthEXT();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_FragDepthEXT();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_FragDepthEXT(); +useFragDepthExt=true}}else{textureFillVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2();textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL2();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL2();pointVertexSrc=WebGLShaderProgram.GetPointVertexShaderSource_WebGL2();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL2();tilemapVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2(true)}const tileRandomizationFragmentSrc= +WebGLShaderProgram.GetTileRandomizationFragmentShaderSource(this.GetWebGLVersionNumber(),useFragDepthExt,this._stdDerivativesExt&&this._textureLodExt);const tileRandomizationVertexSrc=this.GetWebGLVersionNumber()>=2?WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2():vsSource;const DEFAULT_SHADER_PROGRAMS=[[textureFillFragmentSrc,textureFillVertexSrc,""],[textureFillFragmentSrc,textureFillVertexSrc,""],[pointFragmentSrc,pointVertexSrc,""],[WebGLShaderProgram.GetColorFillFragmentShaderSource(), +vsSource,""],[WebGLShaderProgram.GetLinearGradientFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetPenumbraFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseOutlineFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseOutlineFragmentShaderSource(), +vsSource,""],[WebGLShaderProgram.GetSmoothLineFillFragmentShaderSource(),vsSource,""],[tilemapFragmentSrc,tilemapVertexSrc,""],[tileRandomizationFragmentSrc,tileRandomizationVertexSrc,""]];const defaultShaders=await Promise.all(DEFAULT_SHADER_PROGRAMS.map(i=>this.CreateShaderProgram({src:i[0],vertexSrc:i[1],name:i[2]})));this._spTextureFill=defaultShaders[0];this._spDeviceTransformTextureFill=defaultShaders[1];this._spPoints=defaultShaders[2]; +this._spColorFill=defaultShaders[3];this._spLinearGradientFill=defaultShaders[4];this._spPenumbraFill=defaultShaders[5];this._spHardEllipseFill=defaultShaders[6];this._spHardEllipseOutline=defaultShaders[7];this._spSmoothEllipseFill=defaultShaders[8];this._spSmoothEllipseOutline=defaultShaders[9];this._spSmoothLineFill=defaultShaders[10];this._spTilemapFill=defaultShaders[11];this._spTileRandomization=defaultShaders[12];this.SetTextureFillMode()}async CreateShaderProgram(shaderInfo){const ret=await C3.Gfx.WebGLShaderProgram.Create(this, +shaderInfo);this._AddShaderProgram(ret);return ret}ResetLastProgram(){this._lastProgram=null}SetSize(w,h,force){if(this._width===w&&this._height===h&&!force)return;this.EndBatch();const gl=this._gl;const batchState=this._batchState;this._width=w;this._height=h;this._SetViewport(0,0,w,h);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,w/h);this.SetProjectionMatrix(this._bbProjectionMatrix);if(this._spDeviceTransformTextureFill){gl.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()); +this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP);this._lastProgram=this._spDeviceTransformTextureFill;this._batchState.currentShader=this._spDeviceTransformTextureFill}gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE1);gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE0);this._lastTexture0=null;this._lastTexture1=null;if(this._usesDepthBuffer&&this._isAutoSizeDepthBuffer)this._SetDepthBufferSize(this._width,this._height);if(this._currentRenderTarget)this._currentRenderTarget._Resize(this._width, +this._height);gl.bindFramebuffer(gl.FRAMEBUFFER,null);this._currentRenderTarget=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null}_SetDepthBufferSize(width,height){const gl=this._gl;if(this._depthBuffer&&this._depthBufferWidth===width&&this._depthBufferHeight===height)return;if(this._canSampleDepth){if(this._depthBuffer)gl.deleteTexture(this._depthBuffer);this._depthBuffer=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._depthBuffer);gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);if(this.GetWebGLVersionNumber()>=2)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH24_STENCIL8,width,height,0,gl.DEPTH_STENCIL,gl.UNSIGNED_INT_24_8,null);else if(this._depthTextureExt)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH_STENCIL,width,height,0,gl.DEPTH_STENCIL,this._depthTextureExt["UNSIGNED_INT_24_8_WEBGL"], +null);else;gl.bindTexture(gl.TEXTURE_2D,null)}else{if(this._depthBuffer)gl.deleteRenderbuffer(this._depthBuffer);this._depthBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,this._depthBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._version>=2?gl.DEPTH24_STENCIL8:gl.DEPTH_STENCIL,width,height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}this._depthBufferWidth=width;this._depthBufferHeight=height}SetFixedSizeDepthBuffer(width,height){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer= +false;this._SetDepthBufferSize(width,height)}SetAutoSizeDepthBuffer(){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer=true;this._SetDepthBufferSize(this._width,this._height)}_SetViewport(x,y,w,h){const viewport=this._viewport;if(viewport[0]===x&&viewport[1]===y&&viewport[2]===w&&viewport[3]===h)return;const b=this.PushBatch();b.InitSetViewport(x,y,w,h);vec4.set(viewport,x,y,w,h);this._topOfBatch=0}SetFovY(f){super.SetFovY(f);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/ +this._height)}SetNearZ(z){super.SetNearZ(z);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetFarZ(z){super.SetFarZ(z);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetProjectionMatrix(matP){if(mat4.exactEquals(this._matP,matP))return;const b=this.PushBatch();b.InitSetProjection(matP);mat4.copy(this._matP,matP);this._topOfBatch=0;this._didChangeTransform=true}SetDefaultRenderTargetProjectionState(){let projectionMatrix;let viewportWidth, +viewportHeight;const currentRenderTarget=this._currentRenderTarget;if(currentRenderTarget===null){projectionMatrix=this._bbProjectionMatrix;viewportWidth=this.GetWidth();viewportHeight=this.GetHeight()}else{projectionMatrix=currentRenderTarget.GetProjectionMatrix();viewportWidth=currentRenderTarget.GetWidth();viewportHeight=currentRenderTarget.GetHeight()}this.SetProjectionMatrix(projectionMatrix);this._SetViewport(0,0,viewportWidth,viewportHeight)}SetModelViewMatrix(matMV){if(mat4.exactEquals(this._matMV, +matMV))return;const b=this.PushBatch();b.InitSetModelView(matMV);mat4.copy(this._matMV,matMV);this._topOfBatch=0;this._didChangeTransform=true}ResetDidChangeTransformFlag(){this._didChangeTransform=false}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const batch=this._batch;if(this._batchPtr===batch.length)batch.push(new C3.Gfx.WebGLBatchJob(this._batchState));return batch[this._batchPtr++]}EndBatch(){if(this._batchPtr===0)return;if(this.IsContextLost())return; +this._WriteBuffers();this._ExecuteBatch();this._batchPtr=0;this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._topOfBatch=0}_WriteBuffers(){const gl=this._gl;if(this._pointPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr))}if(this._vertexPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr));gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer); +gl.bufferSubData(gl.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr))}}_ExecuteBatch(){const batch=this._batch;for(let i=0,len=this._batchPtr;i=this._lastVertexPtr){this.EndBatch(); +v=0}if(this._topOfBatch===1)this._batch[this._batchPtr-1]._indexCount+=6;else{const b=this.PushBatch();b.InitQuad(v,6);this._topOfBatch=1}}_WriteQuadToVertexBuffer(quad){quad.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(quad){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);defaultTexCoordsQuad.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(tlx,tly,trx,try_,brx,bry,blx,bly){this._ExtendQuadBatch();const vd= +this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z;vd[v++]=trx;vd[v++]=try_;vd[v++]=z;vd[v++]=brx;vd[v++]=bry;vd[v++]=z;vd[v++]=blx;vd[v++]=bly;vd[v++]=z;this._vertexPtr=v;defaultTexCoordsQuad.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(quad,rcTex){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);rcTex.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(quad,uv){this._ExtendQuadBatch(); +this._WriteQuadToVertexBuffer(quad);uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,rcTex){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr=v;rcTex.writeAsQuadToTypedArray(this._texcoordData,this._texPtr); +this._texPtr+=8}Quad3D2(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,uv){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr=v;uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(mode,curTex){this.SetCurrentZ(0);mat4.copy(tmpProjection,this._matP); +mat4.copy(tmpModelView,this._matMV);this.SetDefaultRenderTargetProjectionState();const [width,height]=this.GetRenderTargetSize(this._currentRenderTarget);const tempMat4b=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ(height),0,0,0,height);this.SetModelViewMatrix(tempMat4b);if(mode==="crop"&&this._currentRenderTarget&&curTex){const left=this._width/2;const top=this._height/2;const srcW=curTex.GetWidth();const srcH=curTex.GetHeight();const destW=this._currentRenderTarget.GetWidth();const destH= +this._currentRenderTarget.GetHeight();const copyW=Math.min(destW,srcW);const copyH=Math.min(destH,srcH);const srcOffY=Math.max(srcH-destH,0);const destOffY=Math.max(destH-srcH,0);tmpRect.set(-left,top-destOffY,-left+copyW,top-copyH-destOffY);tmpQuad.setFromRect(tmpRect);tmpRect.set(0,srcOffY,copyW,copyH+srcOffY);tmpRect.divide(srcW,srcH);this.Quad3(tmpQuad,tmpRect)}else{const halfW=width/2;const halfH=height/2;this.Rect2(-halfW,halfH,halfW,-halfH)}this.SetProjectionMatrix(tmpProjection);this.SetModelViewMatrix(tmpModelView)}StartRenderingPoints(rect){if(this._lastPointTexCoords.equals(rect))return; +this._lastPointTexCoords.copy(rect);const b=this.PushBatch();b.InitSetPointTexCoords(rect);this._topOfBatch=0}FinishRenderingPoints(){}Point(x_,y_,size_,opacity_){if(this._pointPtr>=LAST_POINT)this.EndBatch();let p=this._pointPtr;const z=this._baseZ+this._currentZ;if(this._topOfBatch===2&&this._lastPointZ===z)this._batch[this._batchPtr-1]._indexCount++;else{const b=this.PushBatch();b.InitPoints(p,z);this._topOfBatch=2;this._lastPointZ=z}const pd=this._pointData;pd[p++]=x_;pd[p++]=y_;pd[p++]=size_; +pd[p++]=opacity_;this._pointPtr=p}SetProgram(program){if(this._lastProgram===program)return;const b=this.PushBatch();b.InitSetProgram(program);this._lastProgram=program;this._topOfBatch=0;this._currentStateGroup=null}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(c){const b=this.PushBatch();b.InitSetGradientColor(c);this._topOfBatch=0}SetEllipseParams(pixelW,pixelH,outlineThickness=1){const b=this.PushBatch();b.InitSetEllipseParams(pixelW, +pixelH,outlineThickness);this._topOfBatch=0}SetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY){if(this._lastProgram!==this._spTilemapFill)throw new Error("must set tilemap fill mode first");const b=this.PushBatch();b.InitSetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY);this._topOfBatch=0}SetTileRandomizationInfo(textureWidth,textureHeight,xRandom,yRandom,angleRandom,blendMarginX,blendMarginY){if(this._lastProgram!== +this._spTileRandomization)throw new Error("must set tile randomization mode first");const b=this.PushBatch();b.InitSetTileRandomizationInfo(textureWidth,textureHeight,xRandom,yRandom,angleRandom,blendMarginX,blendMarginY);this._topOfBatch=0}SetProgramParameters(backTex,destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time){const s=this._lastProgram;time=time%10800;if(!s._hasAnyOptionalUniforms||s.AreOptionalUniformsAlreadySetInBatch(destRect,srcRect,srcOriginRect, +layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time))return;const b=this.PushBatch();b.InitSetProgramParameters();s.SetOptionalUniformsInBatch(destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time);const mat4param=b._mat4param;mat4param[0]=pixelWidth;mat4param[1]=pixelHeight;destRect.writeToTypedArray(mat4param,2);mat4param[6]=layerScale;mat4param[7]=layerAngle;srcRect.writeToTypedArray(mat4param,12);const colorParam=b._colorParam;layoutRect.writeToTypedArray(colorParam, +0);const tmp=colorParam[1];colorParam[1]=colorParam[3];colorParam[3]=tmp;srcOriginRect.writeToTypedArray(b._srcOriginRect,0);b._startIndex=time;b._indexCount=dpr;if(s._uSamplerBack.IsUsed())b._texParam=backTex?backTex.GetTexture():null;else b._texParam=null;this._topOfBatch=0}SetProgramCustomParameters(params){const s=this._lastProgram;if(params.length===0||s.AreCustomParametersAlreadySetInBatch(params))return;const b=this.PushBatch();b.InitSetProgramCustomParameters();s.SetCustomParametersInBatch(params); +C3.shallowAssignArray(b._shaderParams,params);this._topOfBatch=0}ClearRgba(r,g,b_,a){const b=this.PushBatch();b.InitClearSurface2(r,g,b_,a);this._topOfBatch=0}Clear(c){const b=this.PushBatch();b.InitClearSurface(c);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){if(!this._usesDepthBuffer||!this._currentRenderTarget||!this._currentRenderTarget.HasDepthBuffer())return;const batch=this.PushBatch();batch.InitClearDepth(this._isDepthEnabled);this._topOfBatch=0}SetDepthEnabled(e){e= +!!e;if(this._isDepthEnabled===e)return;if(!this._usesDepthBuffer)return;this._isDepthEnabled=e;const batch=this.PushBatch();batch.InitSetDepthEnabled(e);this._topOfBatch=0}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(e){e=!!e;if(!this._canSampleDepth)return;if(this._isDepthSamplingEnabled===e)return;if(e&&this.IsDepthEnabled())throw new Error("depth still enabled");this._isDepthSamplingEnabled= +e;const batch=this.PushBatch();batch.InitSetDepthSamplingEnabled(e);this._topOfBatch=0}SetScissorRect(x,y,w,h,rtHeight_=0){x=Math.floor(x);y=Math.floor(y);w=Math.floor(w);h=Math.floor(h);if(this._lastScissorRect.equalsWH(x,y,w,h))return;this._lastScissorRect.setWH(x,y,w,h);const rtHeight=rtHeight_||this.GetRenderTargetSize(this.GetRenderTarget())[1];y=rtHeight-y-h;const batch=this.PushBatch();batch.InitSetScissor(true,x,y,w,h);this._topOfBatch=0}RemoveScissorRect(){if(this._lastScissorRect.getRight()=== +-1)return;this._lastScissorRect.set(0,0,-1,-1);const batch=this.PushBatch();batch.InitSetScissor(false,0,0,0,0);this._topOfBatch=0}CheckForQueryResults(){for(const qrb of this._allQueryResultBuffers)qrb.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();C3.Gfx.WebGLRendererTexture.OnContextLost();C3.Gfx.WebGLRenderTarget.OnContextLost();C3.Gfx.RendererText.OnContextLost(); +for(const qrb of this._allQueryResultBuffers)qrb.Clear();this._extensions=[];this._timerExt=null;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt=null;this._stdDerivativesExt=null;this._textureLodExt=null;this._maxAnisotropy=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._depthBuffer=null;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored= +true;await this.InitState();this._isInitialisingAfterContextRestored=false;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextRestored(this);this.SetSize(this._width,this._height,true)}CreateStaticTexture(data,opts){if(this.IsContextLost())throw new Error("context lost");this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture,this);rendererTex._CreateStatic(data,opts);return rendererTex}async CreateStaticTextureAsync(data,opts){if(this.IsContextLost())throw new Error("context lost"); +opts=Object.assign({},opts);if(C3.Supports.ImageBitmapOptions){let imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"premultiply"});const isTiled=opts.wrapX&&opts.wrapX!=="clamp-to-edge"||opts.wrapY&&opts.wrapY!=="clamp-to-edge";const isPOT=C3.isPOT(imageBitmap.width)&&C3.isPOT(imageBitmap.height);if(!this.SupportsNPOTTextures()&&!isPOT&&isTiled)if(C3.Supports.ImageBitmapOptionsResize){imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"premultiply","resizeWidth":C3.nextHighestPowerOfTwo(imageBitmap.width), +"resizeHeight":C3.nextHighestPowerOfTwo(imageBitmap.height)});opts.premultiplyAlpha=false}else imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"none"});else opts.premultiplyAlpha=false;return await C3.Asyncify(()=>this.CreateStaticTexture(imageBitmap,opts))}else{if(data instanceof Blob){if(typeof Image==="undefined")throw new Error("texture upload variant not supported in worker");const img=await C3.BlobToImage(data);data=img}return await C3.Asyncify(()=>this.CreateStaticTexture(data, +opts))}}CreateDynamicTexture(width,height,opts){this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture,this);rendererTex._CreateDynamic(width,height,opts);return rendererTex}UpdateTexture(data,rendererTex,opts){this.EndBatch();rendererTex._Update(data,opts)}DeleteTexture(rendererTex){if(!rendererTex)return;rendererTex.SubtractReference();if(rendererTex.GetReferenceCount()>0)return;this.EndBatch();if(rendererTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0= +null}if(rendererTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1);this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0);this._lastTexture1=null}rendererTex._Delete()}CreateRenderTarget(opts){let width=this._width;let height=this._height;let isDefaultSize=true;if(opts){if(typeof opts.width==="number"){width=Math.floor(opts.width);isDefaultSize=false}if(typeof opts.height==="number"){height=Math.floor(opts.height);isDefaultSize=false}}if(width<=0|| +height<=0)throw new Error("invalid size");this.EndBatch();const renderTarget=C3.New(C3.Gfx.WebGLRenderTarget,this);renderTarget._Create(width,height,Object.assign({isDefaultSize},opts));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return renderTarget}SetRenderTarget(renderTarget,updateProjection=true){if(renderTarget===this._currentRenderTarget)return;if(renderTarget&&renderTarget.IsDefaultSize())renderTarget._Resize(this._width, +this._height);const b=this.PushBatch();b.InitSetRenderTarget(renderTarget);this._currentRenderTarget=renderTarget;this._topOfBatch=0;if(updateProjection)this.SetDefaultRenderTargetProjectionState()}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(renderTarget){if(renderTarget)return[renderTarget.GetWidth(),renderTarget.GetHeight()];else return[this._width,this._height]}CopyRenderTarget(renderTarget,mode="stretch"){if(this._version<2||this._currentRenderTarget&&this._currentRenderTarget.GetMultisampling()> +0){this.SetCopyBlend();this.ResetColor();this.DrawRenderTarget(renderTarget,mode)}else{const b=this.PushBatch();b.InitBlitFramebuffer(renderTarget,this._currentRenderTarget,mode);this._topOfBatch=0}}DrawRenderTarget(renderTarget,mode="stretch"){const tex=renderTarget.GetTexture();if(!tex)throw new Error("not a texture-backed render target");this.SetTexture(tex);this.FullscreenQuad(mode,tex)}InvalidateRenderTarget(renderTarget){if(this._version<2)return;const b=this.PushBatch();b.InitInvalidateFramebuffer(renderTarget._GetFramebuffer()); +this._topOfBatch=0}DeleteRenderTarget(renderTarget){this.SetRenderTarget(null);this.EndBatch();const renderTex=renderTarget.GetTexture();if(renderTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0=null}if(renderTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1);this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0);this._lastTexture1=null}renderTarget._Delete()}async ReadBackRenderTargetToImageData(renderTarget, +forceSynchronous,areaRect){this.EndBatch();const oldRenderTarget=this._currentRenderTarget;let width,height,framebuffer;if(renderTarget){width=renderTarget.GetWidth();height=renderTarget.GetHeight();framebuffer=renderTarget._GetFramebuffer()}else{width=this.GetWidth();height=this.GetHeight();framebuffer=null}let x=0;let y=0;let areaWidth=width;let areaHeight=height;if(areaRect){x=C3.clamp(Math.floor(areaRect.getLeft()),0,width-1);y=C3.clamp(Math.floor(areaRect.getTop()),0,height-1);let w=areaRect.width(); +if(w===0)w=width-x;else w=C3.clamp(Math.floor(w),0,width-x);let h=areaRect.height();if(h===0)h=height-y;else h=C3.clamp(Math.floor(h),0,height-y);areaWidth=w;areaHeight=h;y=height-(y+areaHeight)}const gl=this._gl;gl.bindFramebuffer(gl.FRAMEBUFFER,framebuffer);const restorePreviousRenderTarget=()=>{gl.bindFramebuffer(gl.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(oldRenderTarget)};let imageData; +if(!forceSynchronous&&this.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,framebuffer);const pixelBuffer=gl.createBuffer();const bufferSize=areaWidth*areaHeight*4;const PIXEL_PACK_BUFFER=gl["PIXEL_PACK_BUFFER"];gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl.bufferData(PIXEL_PACK_BUFFER,bufferSize,gl["STREAM_READ"]);gl.readPixels(x,y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,0);gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.bindBuffer(PIXEL_PACK_BUFFER,null);restorePreviousRenderTarget(); +const sync=gl["fenceSync"](gl["SYNC_GPU_COMMANDS_COMPLETE"],0);await this._WaitForObjectReady(()=>gl["getSyncParameter"](sync,gl["SYNC_STATUS"])===gl["SIGNALED"]);gl["deleteSync"](sync);imageData=new ImageData(areaWidth,areaHeight);gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl["getBufferSubData"](PIXEL_PACK_BUFFER,0,new Uint8Array(imageData.data.buffer),0,bufferSize);gl.bindBuffer(PIXEL_PACK_BUFFER,null);gl.deleteBuffer(pixelBuffer)}else{imageData=new ImageData(areaWidth,areaHeight);gl.readPixels(x, +y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(imageData.data.buffer));restorePreviousRenderTarget()}return imageData}CoplanarStartStencilPass(){this.SetDepthEnabled(true);const batch=this.PushBatch();batch.InitCoplanarStartStencilPass();this._topOfBatch=0;this._coplanarMode=1}CoplanarStartColorPass(){this.SetDepthEnabled(false);const batch=this.PushBatch();batch.InitCoplanarStartColorPass();this._topOfBatch=0;this._coplanarMode=2}IsCoplanarColorPass(){return this._coplanarMode=== +2}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(true);const batch=this.PushBatch();batch.InitCoplanarRestore();this._topOfBatch=0;this._coplanarMode=0}StartQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitStartQuery(query);this._topOfBatch=0}EndQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitEndQuery(query);this._topOfBatch=0}_WaitForObjectReady(checkFunc){const ret=new Promise(resolve=>pendingPolls.add({resolve,checkFunc})); +if(pollRafId===-1)pollRafId=self.requestAnimationFrame(CheckPendingPolls);return ret}IsDesynchronized(){return!!this._attribs["desynchronized"]}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs["alpha"]?4:3)}GetEstimatedRenderBufferMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRenderTarget.allRenderTargets()){if(t.GetTexture())continue;ret+=t.GetEstimatedMemoryUsage()}return ret}GetEstimatedTextureMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRendererTexture.allTextures())ret+= +t.GetEstimatedMemoryUsage();return ret}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return this.GetWebGLVersionNumber()>=2}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return this._highpPrecision!==0}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetWebGLExtensionsAnalyticsString(){if(this.GetWebGLVersionNumber()>= +2)return"webgl2";else{const exts=[];if(this._fragDepthExt)exts.push("EXT_frag_depth");if(this._stdDerivativesExt)exts.push("OES_standard_derivatives");if(this._textureLodExt)exts.push("EXT_shader_texture_lod");if(exts.length>0)return"webgl1:"+exts.join(",");else return"webgl1:none"}}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(qrb){this._allQueryResultBuffers.add(qrb)}_RemoveQueryResultBuffer(qrb){this._allQueryResultBuffers.delete(qrb)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(gl){this._InitBlendModeData([["normal", +gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["additive",gl.ONE,gl.ONE],["xor",gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["copy",gl.ONE,gl.ZERO],["destination-over",gl.ONE_MINUS_DST_ALPHA,gl.ONE],["source-in",gl.DST_ALPHA,gl.ZERO],["destination-in",gl.ZERO,gl.SRC_ALPHA],["source-out",gl.ONE_MINUS_DST_ALPHA,gl.ZERO],["destination-out",gl.ZERO,gl.ONE_MINUS_SRC_ALPHA],["source-atop",gl.DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],["destination-atop",gl.ONE_MINUS_DST_ALPHA,gl.SRC_ALPHA]])}CreateRendererText(){return C3.New(C3.Gfx.RendererText, +this)}CreateWebGLText(){return this.CreateRendererText()}}; + +} + +// ../lib/gfx/effectCompositor/effectChainManager.js +{ +'use strict';const C3=self.C3;const DEFAULT_CTOR_OPTS={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null}; +C3.Gfx.EffectChainManager=class EffectChainManager{constructor(opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._cbGetDrawSize=opts.getDrawSize;this._cbGetRenderTarget=opts.getRenderTarget;this._cbReleaseRenderTarget=opts.releaseRenderTarget;this._cbGetTime=opts.getTime;this._cbRedraw=opts.redraw;this._webgpuBackTexture=null;this._allEffectChains=new Set}_AddEffectChain(ec){this._allEffectChains.add(ec)}_RemoveEffectChain(ec){this._allEffectChains.delete(ec)}OnContextLost(){this._webgpuBackTexture= +null;for(const ec of this._allEffectChains)ec.OnContextLost()}GetDrawSize(renderer){if(this._cbGetDrawSize)return this._cbGetDrawSize(renderer);else return[renderer.GetWidth(),renderer.GetHeight()]}GetRenderTarget(effectChain){return this._cbGetRenderTarget(effectChain)}ReleaseRenderTarget(rt,effectChain){this._cbReleaseRenderTarget(rt,effectChain)}GetTime(){return this._cbGetTime()}Redraw(effectChain){this._cbRedraw(effectChain)}_GetWebGPUBackTexture(renderer,width,height){if(this._webgpuBackTexture&& +(this._webgpuBackTexture.GetWidth()!==width||this._webgpuBackTexture.GetHeight()!==height)){renderer.DeleteTexture(this._webgpuBackTexture);this._webgpuBackTexture=null}if(this._webgpuBackTexture===null)this._webgpuBackTexture=renderer.CreateStaticTexture(null,{width,height,sampling:"nearest",mipMap:false});return this._webgpuBackTexture}}; + +} + +// ../lib/gfx/effectCompositor/effectChain.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const mat4=glMatrix.mat4;const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);const tempRect3=C3.New(C3.Rect);const tempRect4=C3.New(C3.Rect);const tempMat4a=mat4.create();const tempMat4b=mat4.create();const DEFAULT_CTOR_OPTS={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:false}; +const DEFAULT_BUILDSTEPS_OPTS={indexMap:null,forcePreDraw:false,forcePostDraw:false,is3D:false,isSourceTextureRotated:false,isRotatedOrNegativeSizeInstance:false,useFullSurface:false}; +C3.Gfx.EffectChain=class EffectChain{constructor(manager,opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._manager=manager;this._cbDrawContent=opts.drawContent;this._cbGetSourceTextureInfo=opts.getSourceTextureInfo;this._cbGetShaderParameters=opts.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._needsRebuild=false;this._blendMode=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending= +false;this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._didChangeTransform=false;this._depthEnabledAtStart=false;this._coplanarColorPassAtStart=false;this._canUseFastPath=false;this._useFullSurface=false;this._isSourceTextureRotated=false;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!opts.invalidateRenderTargets;this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._drawWidth= +0;this._drawHeight=0;this._contentObject=null;this._contextObject=null;this._layoutRect=C3.New(C3.Rect);this._drawSurfaceRect=C3.New(C3.Rect);this._rcTexOriginal=C3.New(C3.Rect);this._rcTexBounce=C3.New(C3.Rect);this._rcTexDest=C3.New(C3.Rect);this._devicePixelRatio=1;this._layerScale=1;this._layerAngle=0;this._time=0;this._destRenderTarget=null;this._backTex=null;this._compositOffX=0;this._compositOffY=0;this._updateOwnProjection=false;this._projectionMatrix=mat4.create();this._modelViewMatrix=mat4.create(); +this._manager._AddEffectChain(this)}Release(){this._manager._RemoveEffectChain(this);C3.clearArray(this._steps);C3.clearArray(this._shaderProgramList);C3.clearArray(this._shaderProgramIndices);this._contentObject=null;this._contextObject=null;this._cbDrawContent=null;this._cbGetSourceTextureInfo=null;this._cbGetShaderParameters=null}OnContextLost(){this._needsRebuild=true;C3.clearArray(this._steps);C3.clearArray(this._shaderProgramList);C3.clearArray(this._shaderProgramIndices)}NeedsRebuild(){return this._needsRebuild}BuildSteps(shaderProgramList, +opts){opts=Object.assign({},DEFAULT_BUILDSTEPS_OPTS,opts);C3.clearArray(this._steps);this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending=false;this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!opts.isSourceTextureRotated;this._useFullSurface=!!opts.useFullSurface;this._needsRebuild= +false;C3.shallowAssignArray(this._shaderProgramList,shaderProgramList);if(shaderProgramList.length===0)return;if(opts.indexMap){if(opts.indexMap.length!==shaderProgramList.length)throw new Error("incorrect indexMap length");C3.shallowAssignArray(this._shaderProgramIndices,opts.indexMap)}else{C3.clearArray(this._shaderProgramIndices);for(let i=0,len=shaderProgramList.length;i=1?this._GetRenderTarget():null;this._renderTargets[2]=this._numTempSurfacesRequired=== +2?this._GetRenderTarget():null;for(const step of this._steps){const srcTarget=this._GetRenderTargetForId(step.GetSrcTargetId());const destTarget=this._GetRenderTargetForId(step.GetDestTargetId());if(renderer.IsWebGPU())step.Run_WebGPU(renderer,srcTarget,destTarget);else step.Run_WebGL(renderer,srcTarget,destTarget)}if(this._renderTargets[1])this._ReleaseRenderTarget(this._renderTargets[1]);if(this._renderTargets[2])this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(renderer); +this._destRenderTarget=null;this._backTex=null;this._contentObject=null;this._contextObject=null;this._cbDrawContentHook=null}_CalculateDrawSizeAndRectangles(renderer,opts){const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);this._SetDrawSize(renderer,drawWidth,drawHeight);this._CalculateRectangles(opts)}_SetDrawSize(renderer,drawWidth,drawHeight){if(drawWidth<=0||drawHeight<=0)throw new Error("invalid draw size");if(this._drawWidth!==drawWidth||this._drawHeight!==drawHeight)this._CalculateDeviceTransformMatrices(renderer, +drawWidth,drawHeight,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=drawWidth;this._drawHeight=drawHeight}_CalculateDeviceTransformMatrices(renderer,width,height,offX,offY,projMat,mvMat){const scrollX=width/2+offX;const scrollY=height/2+offY;renderer.CalculatePerspectiveMatrix(projMat,width/height);const tempMat4=renderer.CalculateLookAtModelView2(scrollX,scrollY,renderer.GetDefaultCameraZ(height),scrollX,scrollY,0,height);mat4.copy(mvMat,tempMat4)}_CalculateRectangles(opts){this._layoutRect.copy(opts.layoutRect); +if(opts.drawSurfaceRect)this._drawSurfaceRect.copy(opts.drawSurfaceRect);else this._drawSurfaceRect.set(0,0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);const boxScale=this._layerScale*this._devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*boxScale,this._boxExtendVertical*boxScale);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight); +this._drawSurfaceRect.clampBoth(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,this._drawHeight)}_OnBeforeStartEffectChain(renderer){this._depthEnabledAtStart=renderer.IsDepthEnabled();this._coplanarColorPassAtStart=renderer.IsCoplanarColorPass();if(this._useFullSurface){renderer.SetDepthEnabled(false);if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}else{tempRect.copy(this._drawSurfaceRect);if(renderer.IsWebGL()){const boxScale= +this._layerScale*this._devicePixelRatio;tempRect.inflate(Math.max(this._boxExtendHorizontal,1)*boxScale,Math.max(this._boxExtendVertical,1)*boxScale);tempRect.roundOuter();tempRect.clamp(0,0,this._drawWidth,this._drawHeight)}else tempRect.roundOuter();renderer.SetScissorRect(tempRect.getLeft(),tempRect.getTop(),tempRect.width(),tempRect.height(),this._drawHeight)}}_OnAfterEffectChainDrawContent(renderer){renderer.ResetColor();if(!this._useFullSurface){if(this._coplanarColorPassAtStart)renderer.CoplanarRestoreStandardRendering(); +renderer.SetDepthEnabled(false);if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(true)}_OnAfterEndEffectChain(renderer){renderer.SetDepthSamplingEnabled(false);if(this._coplanarColorPassAtStart)renderer.CoplanarStartColorPass();renderer.SetDepthEnabled(this._depthEnabledAtStart);if(!this._useFullSurface)renderer.RemoveScissorRect();if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(false);this._didChangeTransform= +renderer.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(id){return id<0?null:this._renderTargets[id]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(rt){this._manager.ReleaseRenderTarget(rt,this)}_GetShaderProgramAt(i){return this._shaderProgramList[i]}_DrawContent(renderer){if(this._cbDrawContentHook)this._cbDrawContentHook(this,renderer,()=>this._cbDrawContent(renderer, +this));else this._cbDrawContent(renderer,this);if(!this._canUseFastPath)this._OnAfterEffectChainDrawContent(renderer)}_IsRenderTargetSameSizeAndOffset(renderer){if(this._useFullSurface)return true;if(this._compositOffX!==0||this._compositOffY!==0)return false;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget());if(rtWidth!==this._drawWidth||rtHeight!==this._drawHeight)return false;return true}_SetDeviceTransform(renderer,isLast){let projMat=this._projectionMatrix;let mvMat= +this._modelViewMatrix;if(isLast&&!this._IsRenderTargetSameSizeAndOffset(renderer)){projMat=tempMat4a;mvMat=tempMat4b;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget());this._CalculateDeviceTransformMatrices(renderer,rtWidth,rtHeight,this._compositOffX,this._compositOffY,projMat,mvMat);if(!this._useFullSurface)renderer.RemoveScissorRect()}renderer.SetProjectionMatrix(projMat);renderer.SetModelViewMatrix(mvMat)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(index, +renderer){return this._cbGetShaderParameters(this._shaderProgramIndices[index],renderer)}_SetProgramParameters(renderer,index){let rcTexDest=this._rcTexDest;let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal;if(renderer.IsWebGL()){tempRect2.copy(rcTexDest);tempRect2.flipAround(1);rcTexDest=tempRect2;tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect);tempRect4.flipAround(1);srcOriginRect=tempRect4}this._DoSetProgramParameters(renderer,index, +srcRect,srcOriginRect,rcTexDest,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(renderer,index){let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal;let pixelWidth=1/this._drawWidth;let pixelHeight=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(!srcTexRect){tempRect.set(0,0,0,0);srcTexRect=tempRect}if(!srcWidth)srcWidth=this._drawWidth;if(!srcHeight)srcHeight=this._drawHeight; +srcRect=srcTexRect;srcOriginRect=srcTexRect;pixelWidth=1/srcWidth;pixelHeight=1/srcHeight}else if(renderer.IsWebGL()){tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect);tempRect4.flipAround(1);srcOriginRect=tempRect4}let rcTexDest=this._rcTexDest;if(renderer.IsWebGL()){rcTexDest=tempRect2;rcTexDest.copy(this._rcTexDest);rcTexDest.flipAround(1)}this._DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,pixelWidth,pixelHeight);if(renderer.IsWebGPU()&& +this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_GetBackTex(renderer){if(this._isAnyShaderBackgroundBlending)if(renderer.IsWebGPU())if(this._UseCopyTextureBackgroundSampling())return this._backTex;else return this._destRenderTarget.GetTexture();else return this._destRenderTarget;else return null}_DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,pixelWidth,pixelHeight){renderer.SetProgramParameters(this._GetBackTex(renderer), +rcTexDest,srcRect,srcOriginRect,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(index,renderer))}_Render_FastPath(renderer,opts){const shaderProgram=this._shaderProgramList[0];const wasDepthEnabled=renderer.IsDepthEnabled();const usesDepth=shaderProgram.UsesDepth();if(usesDepth){renderer.SetDepthEnabled(false);renderer.SetDepthSamplingEnabled(true);this._rcTexDest.set(0,0,1,1); +this._rcTexOriginal.set(0,0,1,1)}renderer.SetProgram(shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetRenderTarget(this._destRenderTarget);let pixelWidth=0;let pixelHeight=1;this._rcTexOriginal.set(0,0,1,1);if(shaderProgram.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(srcTexRect)this._rcTexOriginal.copy(srcTexRect);pixelWidth=Number.isFinite(srcWidth)?1/srcWidth:0;pixelHeight= +Number.isFinite(srcHeight)?1/srcHeight:0}else{const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);pixelWidth=1/drawWidth;pixelHeight=1/drawHeight}if(opts.layoutRect)this._layoutRect.copy(opts.layoutRect);else this._layoutRect.set(0,0,0,0);renderer.SetProgramParameters(this._GetBackTex(renderer),this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(0, +renderer));if(renderer.IsWebGPU()&&this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated);renderer.SetBaseZ(0);this._DrawContent(renderer);if(usesDepth){renderer.SetDepthSamplingEnabled(false);renderer.SetDepthEnabled(wasDepthEnabled)}}_UseCopyTextureBackgroundSampling(){return this._useCopyTextureBackgroundSampling}_UseRenderTargetBackgroundSampling(){return!this._useCopyTextureBackgroundSampling}IsAnyShaderBackgroundBlending(){return this._isAnyShaderBackgroundBlending}CanSkipCalculatingDrawSurfaceRect(){if(!this._canUseFastPath)return false; +if(this._UseCopyTextureBackgroundSampling())return false;return true}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(msg, +renderer,renderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/step.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step=class EffectChainStep{constructor(effectChain,srcTargetId,destTargetId,index=-1){this._effectChain=effectChain;this._srcTargetId=srcTargetId;this._destTargetId=destTargetId;this._index=index}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/preDrawStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.PreDraw=class PreDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/postDrawStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.PostDraw=class PostDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget);effectChain._SetDeviceTransform(renderer,true);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture()); +tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce()); +else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}renderer.SetBackTexture(null);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// ../lib/gfx/effectCompositor/firstBounceStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.FirstBounce=class FirstBounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex()); +effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex());effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/bounceStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.Bounce=class BounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget);const isLast=this.GetDestTargetId()===0;if(isLast)renderer.SetBlendMode(effectChain._GetBlendMode());else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend()}renderer.SetProgram(this.GetShaderProgram()); +effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());effectChain._SetDeviceTransform(renderer,isLast);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain(); +renderer.SetRenderTarget(destRenderTarget,false);const isLast=this.GetDestTargetId()===0;if(isLast){renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetBackTexture(null);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce());else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}}else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend(); +tempQuad.setFromRect(effectChain._GetRcTexBounce())}renderer.SetProgram(this.GetShaderProgram());effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// interfaces/IRuntime.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;let runtime=null;const keysDownByKey=new Set;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}const tempZOrderList=[];const tempInstances=[];let didWarnInAlertPolyfill=false; +self.IRuntime=class IRuntime{constructor(runtime_,objects){runtime=runtime_;Object.defineProperties(this,{assets:{value:runtime.GetAssetManager().GetIAssetManager(),writable:false},objects:{value:objects,writable:false},globalVars:{value:{},writable:false},projectName:{value:runtime.GetProjectName(),writable:false},projectVersion:{value:runtime.GetProjectVersion(),writable:false},storage:{value:new self.IStorage(runtime),writable:false},isInWorker:{value:runtime.IsInWorker(),writable:false},viewportWidth:{value:runtime.GetOriginalViewportWidth(), +writable:false},viewportHeight:{value:runtime.GetOriginalViewportHeight(),writable:false}});runtime.UserScriptDispatcher().addEventListener("keydown",e=>{if(keysDownByKey.has(e["key"])){e.stopPropagation();return}keysDownByKey.add(e["key"])});runtime.UserScriptDispatcher().addEventListener("keyup",e=>keysDownByKey.delete(e["key"]));runtime.Dispatcher().addEventListener("window-blur",()=>keysDownByKey.clear());if(runtime.IsInWorker())self["alert"]=message=>{if(!didWarnInAlertPolyfill){didWarnInAlertPolyfill= +true;console.warn("[Construct] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual.")}return this.alert(message)}}_InitGlobalVars(globalVarDescriptors){Object.defineProperties(this.globalVars, +globalVarDescriptors)}addEventListener(name,func){runtime.UserScriptDispatcher().addEventListener(name,func)}removeEventListener(name,func){runtime.UserScriptDispatcher().removeEventListener(name,func)}callFunction(name,...params){C3X.RequireString(name);const eventSheetManager=runtime.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(name);if(!functionBlock)throw new Error(`cannot find function name '${name}'`);if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +if(params.lengthlayout.GetILayout())}goToLayout(nameOrIndex){const layoutManager=runtime.GetLayoutManager();let layout=null;if(typeof nameOrIndex==="number"||typeof nameOrIndex==="string")layout=layoutManager.GetLayout(nameOrIndex);else throw new TypeError("expected string or number");if(!layout)throw new Error("invalid layout");if(layoutManager.IsPendingChangeMainLayout())return; +layoutManager.ChangeMainLayout(layout)}get keyboard(){const ret=runtime._GetCommonScriptInterfaces().keyboard;if(!ret)throw new Error("runtime.keyboard used but Keyboard object missing - add it to your project first");return ret}get mouse(){const ret=runtime._GetCommonScriptInterfaces().mouse;if(!ret)throw new Error("runtime.mouse used but Mouse object missing - add it to your project first");return ret}get touch(){const ret=runtime._GetCommonScriptInterfaces().touch;if(!ret)throw new Error("runtime.touch used but Touch object missing - add it to your project first"); +return ret}invokeDownload(url,filename){C3X.RequireString(url);C3X.RequireString(filename);runtime.InvokeDownload(url,filename)}getInstanceByUid(uid){C3X.RequireFiniteNumber(uid);const ret=runtime.GetInstanceByUID(uid);return ret?ret.GetInterfaceClass():null}sortZOrder(iterable,callback){C3X.RequireFunction(callback);const layout=runtime.GetCurrentLayout();for(const iinst of iterable){const inst=runtime._UnwrapIWorldInstance(iinst);const wi=inst.GetWorldInfo();tempZOrderList.push([wi.GetLayer().GetIndex(), +wi.GetZIndex()]);tempInstances.push(inst)}if(tempZOrderList.length===0)return;tempZOrderList.sort(SortZOrderList);tempInstances.sort((a,b)=>callback(a.GetInterfaceClass(),b.GetInterfaceClass()));let anyChanged=false;for(let i=0,len=tempZOrderList.length;i0)throw new Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");map.get(this)._SetUserScriptInstanceClass(Class)}createInstance(layerNameOrIndex,x,y,createHierarchy,template){C3X.RequireNumber(x);C3X.RequireNumber(y);if(typeof layerNameOrIndex!=="number"&&typeof layerNameOrIndex!=="string")throw new TypeError("invalid layer parameter");const objectClass=map.get(this);const runtime=objectClass.GetRuntime(); +const layer=runtime.GetMainRunningLayout().GetLayer(layerNameOrIndex);if(!layer)throw new Error("invalid layer");const inst=runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager=runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(!eventSheetManager.IsInEventEngine()&&!runtime.GetLayoutManager().IsEndingLayout())runtime.FlushPendingInstances(); +return inst.GetInterfaceClass()}}; + +} + +// interfaces/ILayout.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const VALID_WHERE_STRINGS=["above","below","top-sublayer","bottom-sublayer"]; +self.ILayout=class ILayout{constructor(layout){map.set(this,layout);const effectInstanceArr=[];const effectList=layout.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;ilayer.GetILayer())}*allLayers(){for(const layer of map.get(this).allLayers())yield layer.GetILayer()}addLayer(layerName,iInsertBy,whereStr){const ILayer=self.ILayer;C3X.RequireString(layerName);C3X.RequireOptionalInstanceOf(iInsertBy,ILayer);const insertBy=iInsertBy?ILayer._Unwrap(iInsertBy):null;const where=VALID_WHERE_STRINGS.indexOf(whereStr);if(where<0)throw new Error("invalid location"); +map.get(this).AddLayer(layerName,insertBy,where)}moveLayer(iLayer,iInsertBy,whereStr){const ILayer=self.ILayer;C3X.RequireInstanceOf(iLayer,ILayer);const layer=ILayer._Unwrap(iLayer);if(!layer)throw new Error("invalid layer");C3X.RequireOptionalInstanceOf(iInsertBy,ILayer);const insertBy=iInsertBy?ILayer._Unwrap(iInsertBy):null;const where=VALID_WHERE_STRINGS.indexOf(whereStr);if(where<0)throw new Error("invalid location");map.get(this).MoveLayer(layer,insertBy,where)}removeLayer(iLayer){const ILayer= +self.ILayer;C3X.RequireInstanceOf(iLayer,ILayer);const layer=ILayer._Unwrap(iLayer);if(!layer)throw new Error("invalid layer");const runtime=layer.GetRuntime();map.get(this).RemoveLayer(layer);if(!runtime.GetEventSheetManager().IsInEventEngine())runtime.FlushPendingInstances()}removeAllDynamicLayers(){const layout=map.get(this);const runtime=layout.GetRuntime();layout.RemoveAllDynamicLayers();if(!runtime.GetEventSheetManager().IsInEventEngine())runtime.FlushPendingInstances()}setVanishingPoint(vpX, +vpY){C3X.RequireFiniteNumber(vpX);C3X.RequireFiniteNumber(vpY);map.get(this).SetVanishingPointXY(vpX,vpY)}getVanishingPoint(){return map.get(this)._GetVanishingPoint()}set projection(p){C3X.RequireString(p);const layout=map.get(this);if(p==="perspective")layout.SetPerspectiveProjection();else if(p==="orthographic")layout.SetOrthographicProjection();else throw new Error("invalid projection");}get projection(){if(map.get(this).IsOrthographicProjection())return"orthographic";else return"perspective"}}; + +} + +// interfaces/ILayer.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.ILayer=class ILayer{constructor(layer){map.set(this,layer);const effectInstanceArr=[];const effectList=layer.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;is.GetInterfaceClass()):[]}*otherContainerInstances(){const inst=map.get(this);if(!inst.IsInContainer())return;for(const s of inst.siblings())yield s.GetInterfaceClass()}get templateName(){return map.get(this).GetTemplateName()}set timeScale(t){C3X.RequireFiniteNumber(t); +map.get(this).SetTimeScale(t)}get timeScale(){return map.get(this).GetActiveTimeScale()}restoreTimeScale(){map.get(this).RestoreTimeScale()}}; + +} + +// interfaces/IWorldInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;const ILayer=self.ILayer;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.IWorldInstance=class IWorldInstance extends IInstance{constructor(){super();const inst=IInstance._GetInitInst();map.set(this,inst);const effectInstanceArr=[];const wi=inst.GetWorldInfo();const instanceEffectList=wi.GetInstanceEffectList();if(instanceEffectList){const effectCount=wi.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let i=0;iinst.GetInterfaceClass())}}; + +} + +// interfaces/IEffectInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const tempColor=C3.New(C3.Color); +self.IEffectInstance=class IEffectInstance{constructor(effectList,index){map.set(this,effectList);const descriptors={index:{value:index,writable:false}};Object.defineProperties(this,descriptors)}get name(){const effectTypes=map.get(this).GetAllEffectTypes();return effectTypes[this.index].GetName()}get isActive(){return map.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const fxList=map.get(this);if(fxList.IsEffectIndexActive(this.index)===a)return;fxList.SetEffectIndexActive(this.index, +a);fxList.UpdateActiveEffects();fxList.GetRuntime().UpdateRender()}setParameter(i,v){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const oldValue=fxList.GetEffectParameter(this.index,i);if(oldValue===null)throw new RangeError("invalid index");if(oldValue instanceof C3.Color){if(!Array.isArray(v)||v.length<3)throw new TypeError("expected array with 3 elements");tempColor.setRgb(v[0],v[1],v[2]);v=tempColor}else if(typeof v!=="number")throw new TypeError("expected number");const didChange= +fxList.SetEffectParameter(this.index,i,v);if(didChange&&fxList.IsEffectIndexActive(this.index))fxList.GetRuntime().UpdateRender()}getParameter(i){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const ret=fxList.GetEffectParameter(this.index,i);if(ret===null)throw new RangeError("invalid index");if(ret instanceof C3.Color)return[ret.getR(),ret.getG(),ret.getB()];else return ret}}; + +} + +// interfaces/IAnimation.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.IAnimation=class IAnimation{constructor(animationInfo){map.set(this,animationInfo);Object.defineProperties(this,{name:{value:animationInfo.GetName(),writable:false},speed:{value:animationInfo.GetSpeed(),writable:false},isLooping:{value:animationInfo.IsLooping(),writable:false},repeatCount:{value:animationInfo.GetRepeatCount(),writable:false},repeatTo:{value:animationInfo.GetRepeatTo(),writable:false},isPingPong:{value:animationInfo.IsPingPong(),writable:false},frameCount:{value:animationInfo.GetFrameCount(), +writable:false}})}getFrames(){return map.get(this).GetFrames().map(f=>f.GetIAnimationFrame())}*frames(){for(const f of map.get(this).GetFrames())yield f.GetIAnimationFrame()}}; + +} + +// interfaces/IImageInfo.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;self.IImageInfo=class IImageInfo{constructor(imageInfo){map.set(this,imageInfo)}get width(){return map.get(this).GetWidth()}get height(){return map.get(this).GetHeight()}getSize(){const imageInfo=map.get(this);return[imageInfo.GetWidth(),imageInfo.GetHeight()]}}; + +} + +// interfaces/IAnimationFrame.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.IAnimationFrame=class IAnimationFrame extends self.IImageInfo{constructor(animationFrameInfo){super(animationFrameInfo.GetImageInfo());map.set(this,animationFrameInfo);Object.defineProperties(this,{duration:{value:animationFrameInfo.GetDuration(),writable:false},originX:{value:animationFrameInfo.GetOriginX(),writable:false},originY:{value:animationFrameInfo.GetOriginY(),writable:false}})}getOrigin(){const afi=map.get(this);return[afi.GetOriginX(),afi.GetOriginY()]}getImagePointCount(){return map.get(this).GetImagePointCount()}getImagePointX(nameOrIndex){return this.getImagePoint(nameOrIndex)[0]}getImagePointY(nameOrIndex){return this.getImagePoint(nameOrIndex)[1]}getImagePoint(nameOrIndex){const afi= +map.get(this);let ip=null;if(typeof nameOrIndex==="number")ip=afi.GetImagePointByIndex(Math.floor(nameOrIndex));else if(typeof nameOrIndex==="string")ip=afi.GetImagePointByName(nameOrIndex);else throw new TypeError("expected string or number");if(!ip)return this.getOrigin();return[ip.GetX(),ip.GetY()]}getPolyPointCount(){const poly=map.get(this).GetCollisionPoly();return poly?poly.pointCount():0}getPolyPointX(index){return this.getPolyPoint(index)[0]}getPolyPointY(index){return this.getPolyPoint(index)[1]}getPolyPoint(index){C3X.RequireFiniteNumber(index); +index=Math.floor(index);const poly=map.get(this).GetCollisionPoly();if(!poly||index<0||index>=poly.pointCount())return[0,0];const pointsArr=poly.pointsArr();const ptX=pointsArr[index*2];const ptY=pointsArr[index*2+1];return[ptX,ptY]}}; + +} + +// interfaces/ITimelineState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;function GetTimelineState(iface){const timelineState=map.get(iface);if(timelineState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return timelineState} +self.ITimelineState=class ITimelineState{constructor(timelineState){map.set(this,timelineState)}pause(){GetTimelineState(this).Stop()}resume(){GetTimelineState(this).Resume()}hasTags(tags){return GetTimelineState(this).HasTags(tags)}set time(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTime(t)}get time(){return GetTimelineState(this).GetTime()}set totalTime(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTotalTime(t)}get totalTime(){return GetTimelineState(this).GetTotalTime()}set isLooping(l){GetTimelineState(this).SetLoop(!!l)}get isLooping(){return GetTimelineState(this).GetLoop()}set isPingPong(p){GetTimelineState(this).SetPingPong(!!p)}get isPingPong(){return GetTimelineState(this).GetPingPong()}set playbackRate(p){C3X.RequireFiniteNumber(p); +GetTimelineState(this).SetPlaybackRate(p)}get playbackRate(){return GetTimelineState(this).GetPlaybackRate()}get progress(){const timelineState=GetTimelineState(this);return timelineState.GetTime()/timelineState.GetTotalTime()}get tags(){return GetTimelineState(this).GetTags()}get finished(){return GetTimelineState(this).GetPlayPromise()}get isPlaying(){return GetTimelineState(this).IsPlaying()}get isPaused(){return GetTimelineState(this).IsPaused()}get isReleased(){return map.get(this).IsReleased()}}; + +} + +// interfaces/ITweenState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const behInstMap=new WeakMap;let easeToIndexFunc=null;function GetTweenState(iface){const tweenState=map.get(iface);if(tweenState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return tweenState} +self.ITweenState=class ITweenState extends self.ITimelineState{constructor(tweenState,behInst,opts){super(tweenState);if(!easeToIndexFunc)easeToIndexFunc=opts.easeToIndexFunc;map.set(this,tweenState);if(behInst)behInstMap.set(this,behInst)}stop(){const tweenState=GetTweenState(this);const behInst=behInstMap.get(this);behInst.ReleaseTween(tweenState)}setEase(easeName){C3X.RequireString(easeName);const ease=self.Ease.GetEaseFromIndex(easeToIndexFunc(easeName));GetTweenState(this).SetEase(ease)}get instance(){const inst= +GetTweenState(this).GetInstance();return inst?inst.GetInterfaceClass():null}get isDestroyOnComplete(){return GetTweenState(this).GetDestroyInstanceOnComplete()}set isDestroyOnComplete(d){GetTweenState(this).SetDestroyInstanceOnComplete(!!d)}get value(){const tweenState=GetTweenState(this);if(tweenState.GetId()!=="value")throw new Error("not a value tween");return tweenState.GetPropertyTrack("value").GetSourceAdapterValue()}}; + +} + +// assets/assetManager.js +{ +'use strict';const C3=self.C3;const VALID_LOAD_POLICIES=new Set(["local","remote"]);const EXT_TO_TYPE=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function GetTypeFromFileExtension(filename){if(!filename)return"";const parts=filename.split(".");if(parts.length<2)return"";const ext=parts.at(-1).toLowerCase();return EXT_TO_TYPE.get(ext)||""} +function AddScript(url){return new Promise((resolve,reject)=>{const elem=document.createElement("script");elem.onload=resolve;elem.onerror=reject;elem.async=false;elem.type="module";elem.src=url;document.head.appendChild(elem)})} +C3.AssetManager=class AssetManager extends C3.DefendedBase{constructor(runtime,opts){super();const exportType=opts["exportType"];this._runtime=runtime;this._fileStructure="folders";this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova=exportType==="cordova";this._isiOSCordova=!!opts["isiOSCordova"];this._isFileProtocol=!!opts["isFileProtocol"];this._swClientId=opts["swClientId"];this._supportedAudioFormats=opts["supportedAudioFormats"]||{};this._audioFiles= +new Map;this._preloadSounds=false;this._mediaSubfolder="";this._fontsSubfolder="";this._iconsSubfolder="";const isRemoteLoadPolicy=exportType==="html5"||exportType==="scirra-arcade"||exportType==="instant-games";this._defaultLoadPolicy=isRemoteLoadPolicy?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=false;this._totalAssetSizeToLoad=0;this._assetSizeLoaded=0;this._lastLoadProgress=0;this._hasHadErrorLoading=false; +this._loadingRateLimiter=C3.New(C3.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new C3.PromiseThrottle(Math.max(C3.hardwareConcurrency,8));const localUrlBlobs=opts["previewImageBlobs"];if(localUrlBlobs){const projectFileBlobs=opts["previewProjectFileBlobs"];if(projectFileBlobs)Object.assign(localUrlBlobs,projectFileBlobs);const projectData=opts["projectData"];if(projectData)localUrlBlobs["data.json"]=projectData;for(const [url,blob]of Object.entries(localUrlBlobs))this._localUrlBlobs.set(url, +blob)}const localSWUrlMap=opts["previewProjectFileSWUrls"];if(localSWUrlMap)for(const [srcUrl,destUrl]of Object.entries(localSWUrlMap))this._localBlobSWUrls.set(srcUrl,destUrl);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const url of this._localBlobUrlCache.values())if(url.startsWith("blob:"))URL.revokeObjectURL(url);this._localBlobUrlCache.clear();for(const asset of this._allAssets)asset.Release();C3.clearArray(this._allAssets);this._assetsByUrl.clear(); +C3.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetFileStructure(f){this._fileStructure=f;if(f==="flat"){const newMap=new Map;for(const [url,blob]of this._localUrlBlobs.entries())newMap.set(url.toLowerCase(),blob);this._localUrlBlobs=newMap}}GetFileStructure(){return this._fileStructure}_SetMediaSubfolder(folder){this._mediaSubfolder=folder}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(folder){this._fontsSubfolder=folder}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(folder){this._iconsSubfolder= +folder}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.has(url)}_GetLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.get(url)||null}GetLocalUrlAsBlobUrl(url){if(this._fileStructure==="flat")url=url.toLowerCase();if(!this._HasLocalUrlBlob(url))return url;let ret=this._localBlobUrlCache.get(url);if(!ret){const blob= +this._GetLocalUrlBlob(url);ret=URL.createObjectURL(blob);this._localBlobUrlCache.set(url,ret)}return ret}FetchBlob(url,loadPolicy){loadPolicy=loadPolicy||this._defaultLoadPolicy;const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return Promise.resolve(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlob(url);else if(loadPolicy==="local")return this._promiseThrottle.Add(()=> +C3.FetchBlob(url));else return C3.FetchBlob(url)}else return C3.FetchBlob(url)}FetchArrayBuffer(url){const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToArrayBuffer(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsArrayBuffer(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchArrayBuffer(url));else return C3.FetchArrayBuffer(url)}else return C3.FetchArrayBuffer(url)}FetchText(url){const localBlob= +this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToString(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsText(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchText(url));else return C3.FetchText(url)}else return C3.FetchText(url)}async FetchJson(url){const text=await this.FetchText(url);return JSON.parse(text)}_CordovaFetchLocalFileAs(filename, +as_){if(this._fileStructure==="flat")filename=filename.toLowerCase();return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{"filename":filename,"as":as_})}CordovaFetchLocalFileAsText(filename){return this._CordovaFetchLocalFileAs(filename,"text")}async CordovaFetchLocalFileAsBlob(filename){const buffer=await this._CordovaFetchLocalFileAs(filename,"buffer");const type=GetTypeFromFileExtension(filename);return new Blob([buffer],{"type":type})}async CordovaFetchLocalFileAsBlobURL(filename){if(this._fileStructure=== +"flat")filename=filename.toLowerCase();let blobUrl=this._localBlobUrlCache.get(filename);if(blobUrl)return blobUrl;const blob=await this.CordovaFetchLocalFileAsBlob(filename);blobUrl=URL.createObjectURL(blob);this._localBlobUrlCache.set(filename,blobUrl);return blobUrl}CordovaFetchLocalFileAsArrayBuffer(filename){return this._CordovaFetchLocalFileAs(filename,"buffer")}GetMediaFileUrl(filename){if(this._fileStructure==="flat")filename=filename.toLowerCase();filename=this._mediaSubfolder+filename;if(this._HasLocalUrlBlob(filename))return this.GetLocalUrlAsBlobUrl(filename); +else return filename}GetProjectFileUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else if(this._HasLocalUrlBlob(url))return Promise.resolve(this.GetLocalUrlAsBlobUrl(url));else if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(url);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}GetProjectFileIframeUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else{const queryIndex=url.indexOf("?");const queryStr= +queryIndex===-1?"":url.substr(queryIndex);const urlNoSearch=queryIndex===-1?url:url.substr(0,queryIndex);if(this._HasLocalUrlBlob(urlNoSearch)){let localUrl=this._localBlobSWUrls.get(urlNoSearch)||this.GetLocalUrlAsBlobUrl(urlNoSearch);if(!localUrl.startsWith("blob:")&&this._swClientId){const asUrl=new URL(localUrl);const params=new URLSearchParams(queryStr);params.set("__c3_client_id",this._swClientId);asUrl.search=params.toString();localUrl=asUrl.toString()}return Promise.resolve(localUrl)}else if(this._isCordova&& +this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(urlNoSearch);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}}LoadProjectFileUrl(url){return this.GetProjectFileUrl(url)}LoadImage(opts){if(opts.loadPolicy&&!VALID_LOAD_POLICIES.has(opts.loadPolicy))throw new Error("invalid load policy");let asset=this._assetsByUrl.get(opts.url);if(asset)return asset;asset=C3.New(C3.ImageAsset,this,{url:opts.url,size:opts.size||0,loadPolicy:opts.loadPolicy||this._defaultLoadPolicy}); +this._allAssets.push(asset);this._assetsByUrl.set(asset.GetURL(),asset);if(!this._hasFinishedInitialLoad){this._totalAssetSizeToLoad+=asset.GetSize();this._loadPromises.push(asset.Load().then(()=>this._AddLoadedSize(asset.GetSize())))}return asset}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises);this._lastLoadProgress=1}catch(err){console.error("Error loading: ",err);this._hasHadErrorLoading=true;this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad= +true}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(s){this._assetSizeLoaded+=s;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const event=C3.New(C3.Event,"loadingprogress");this._lastLoadProgress=C3.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);event.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(event)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(arr){C3.shallowAssignArray(this._webFonts,arr);if(this._webFonts.length)this._loadPromises.push(this._LoadWebFonts())}async _LoadWebFonts(){const promises= +[];const loadFontsForDOM=[];for(const [name,filename,size]of this._webFonts){this._totalAssetSizeToLoad+=size;promises.push(this._LoadWebFont(name,filename,loadFontsForDOM).then(()=>this._AddLoadedSize(size)))}await Promise.all(promises);if(this._runtime.IsInWorker()&&loadFontsForDOM.length>0)await this._runtime.PostComponentMessageToDOMAsync("runtime","load-webfonts",{"webfonts":loadFontsForDOM})}async _LoadWebFont(name,filename,loadFontsForDOM){try{const url=await this.GetProjectFileUrl(filename); +const fontFace=new FontFace(name,`url('${url}')`);if(this._runtime.IsInWorker())self.fonts.add(fontFace);else document.fonts.add(fontFace);await fontFace.load();if(this._runtime.IsInWorker())loadFontsForDOM.push({name,url})}catch(err){console.warn(`[C3 runtime] Failed to load web font '${name}': `,err)}}IsAudioFormatSupported(type){return!!this._supportedAudioFormats[type]}_SetAudioFiles(arr,preloadSounds){this._preloadSounds=!!preloadSounds;for(const [fileName,projectFilesInfo,isMusic]of arr)this._audioFiles.set(fileName, +{fileName,formats:projectFilesInfo.map(si=>({type:si[0],fileExtension:si[1],fullName:fileName+si[1],fileSize:si[2]})),isMusic})}GetPreferredAudioFile(namePart){if(this._fileStructure==="flat")namePart=namePart.toLowerCase();const info=this._audioFiles.get(namePart);if(!info)return null;let webMOpusFile=null;for(const formatInfo of info.formats){if(!webMOpusFile&&formatInfo.type==="audio/webm; codecs=opus")webMOpusFile=formatInfo;if(this.IsAudioFormatSupported(formatInfo.type))return formatInfo}return webMOpusFile}GetProjectAudioFileUrl(namePart){const formatInfo= +this.GetPreferredAudioFile(namePart);if(!formatInfo)return null;return{url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type}}GetAudioToPreload(){if(this._preloadSounds){const ret=[];for(const info of this._audioFiles.values()){if(info.isMusic)continue;const formatInfo=this.GetPreferredAudioFile(info.fileName);if(!formatInfo)continue;ret.push({originalUrl:info.fileName,url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type,fileSize:formatInfo.fileSize})}return ret}else return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...urls){const scriptUrls= +await Promise.all(urls.map(url=>this.GetProjectFileUrl(url)));if(this._runtime.IsInWorker())if(urls.length===1){const url=urls[0];await self.c3_import((C3.IsRelativeURL(url)?"./":"")+url)}else{const scriptStr=urls.map(url=>`import "${C3.IsRelativeURL(url)?"./":""}${url}";`).join("\n");const blobUrl=URL.createObjectURL(new Blob([scriptStr],{type:"application/javascript"}));await self.c3_import(blobUrl)}else await Promise.all(scriptUrls.map(url=>AddScript(url)))}async CompileWebAssembly(url){if(WebAssembly.compileStreaming){const fetchUrl= +await this.GetProjectFileUrl(url);return await WebAssembly.compileStreaming(fetch(fetchUrl))}else{const arrayBuffer=await C3.FetchArrayBuffer(url);return await WebAssembly.compile(arrayBuffer)}}async LoadStyleSheet(url){const fetchUrl=await this.GetProjectFileUrl(url);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{"url":fetchUrl})}}; + +} + +// assets/asset.js +{ +'use strict';const C3=self.C3; +C3.Asset=class Asset extends C3.DefendedBase{constructor(assetManager,opts){super();this._assetManager=assetManager;this._runtime=assetManager.GetRuntime();this._url=opts.url||"";this._size=opts.size;this._loadPolicy=opts.loadPolicy;this._blob=opts.blob||null;this._isLoaded=!!this._blob;this._loadPromise=null}Release(){this._loadPromise=null;this._assetManager=null;this._runtime=null;this._blob=null}GetURL(){return this._url}GetSize(){return this._size}Load(){if(this._loadPolicy==="local"||this._blob){this._isLoaded= +true;return Promise.resolve()}if(this._loadPromise)return this._loadPromise;this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(blob=>{this._isLoaded=true;this._loadPromise=null;this._blob=blob;return blob}).catch(err=>console.error("Error loading resource: ",err));return this._loadPromise}IsLoaded(){return this._isLoaded}GetBlob(){if(this._blob)return Promise.resolve(this._blob);if(this._loadPromise)return this._loadPromise;return this._assetManager.FetchBlob(this._url, +this._loadPolicy)}}; + +} + +// assets/imageAsset.js +{ +'use strict';const C3=self.C3;const promiseThrottle=new C3.PromiseThrottle;const allImageAssets=new Set; +C3.ImageAsset=class ImageAsset extends C3.Asset{constructor(assetManager,opts){super(assetManager,opts);this._texturePromise=null;this._webglTexture=null;this._refCount=0;this._imageWidth=-1;this._imageHeight=-1;allImageAssets.add(this)}Release(){this.ReleaseTexture();if(this._refCount!==0)throw new Error("released image asset which still has texture references");this._texturePromise=null;allImageAssets.delete(this);super.Release()}static OnRendererContextLost(){for(const imageAsset of allImageAssets){imageAsset._texturePromise= +null;imageAsset._webglTexture=null;imageAsset._refCount=0}}LoadStaticTexture(renderer,opts){opts=opts||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;opts.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texturePromise=this.GetBlob().then(blob=>promiseThrottle.Add(()=>renderer.CreateStaticTextureAsync(blob,opts).then(texture=>{this._texturePromise=null;if(this._refCount===0){renderer.DeleteTexture(texture); +return null}this._webglTexture=texture;this._imageWidth=texture.GetWidth();this._imageHeight=texture.GetHeight();return this._webglTexture}))).catch(err=>{console.error("Failed to load texture: ",err);throw err;});return this._texturePromise}ReleaseTexture(){if(this._refCount<=0)throw new Error("texture released too many times");this._refCount--;if(this._refCount===0&&this._webglTexture){const renderer=this._webglTexture.GetRenderer();renderer.DeleteTexture(this._webglTexture);this._webglTexture= +null}}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const blob=await this.GetBlob();if(C3.Supports.ImageBitmap)return await createImageBitmap(blob);else return await C3.BlobToImage(blob)}}; + +} + +// layouts/renderCell.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()} +C3.RenderCell=class RenderCell extends C3.DefendedBase{constructor(grid,x,y){super();this._grid=grid;this._x=x;this._y=y;this._instances=[];this._isSorted=true;this._pendingRemoval=new Set;this._isAnyPendingRemoval=false}Release(){C3.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){C3.clearArray(this._instances);this._isSorted=true;this._pendingRemoval.clear();this._isAnyPendingRemoval=false}SetChanged(){this._isSorted=false}IsEmpty(){if(!this._instances.length)return true; +if(this._instances.length>this._pendingRemoval.size)return false;this._FlushPending();return true}Insert(inst){if(this._pendingRemoval.has(inst)){this._pendingRemoval.delete(inst);if(this._pendingRemoval.size===0)this._isAnyPendingRemoval=false;return}this._instances.push(inst);this._isSorted=this._instances.length===1}Remove(inst){this._pendingRemoval.add(inst);this._isAnyPendingRemoval=true;if(this._pendingRemoval.size>=50)this._FlushPending()}_FlushPending(){if(!this._isAnyPendingRemoval)return; +if(this._instances.length===this._pendingRemoval.size){this.Reset();return}C3.arrayRemoveAllInSet(this._instances,this._pendingRemoval);this._pendingRemoval.clear();this._isAnyPendingRemoval=false}_EnsureSorted(){if(this._isSorted)return;this._instances.sort(SortByInstLastCachedZIndex);this._isSorted=true}Dump(result){this._FlushPending();this._EnsureSorted();if(this._instances.length)result.push(this._instances)}}; + +} + +// layouts/renderGrid.js +{ +'use strict';const C3=self.C3; +C3.RenderGrid=class RenderGrid extends C3.DefendedBase{constructor(cellWidth,cellHeight){super();this._cellWidth=cellWidth;this._cellHeight=cellHeight;this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(x,y,createIfMissing){let ret=this._cells.Get(x,y);if(ret)return ret;else if(createIfMissing){ret=C3.New(C3.RenderCell,this,x,y);this._cells.Set(x,y,ret);return ret}else return null}XToCell(x){return Math.floor(x/this._cellWidth)}YToCell(y){return Math.floor(y/this._cellHeight)}Update(inst, +oldRange,newRange){if(oldRange)for(let x=oldRange.getLeft(),lenx=oldRange.getRight();x<=lenx;++x)for(let y=oldRange.getTop(),leny=oldRange.getBottom();y<=leny;++y){if(newRange&&newRange.containsPoint(x,y))continue;const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Remove(inst);if(cell.IsEmpty())this._cells.Delete(x,y)}if(newRange)for(let x=newRange.getLeft(),lenx=newRange.getRight();x<=lenx;++x)for(let y=newRange.getTop(),leny=newRange.getBottom();y<=leny;++y){if(oldRange&&oldRange.containsPoint(x, +y))continue;this.GetCell(x,y,true).Insert(inst)}}QueryRange(rc,result){let x=this.XToCell(rc.getLeft());const ystart=this.YToCell(rc.getTop());const lenx=this.XToCell(rc.getRight());const leny=this.YToCell(rc.getBottom());for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Dump(result)}}MarkRangeChanged(rc){let x=rc.getLeft();const ystart=rc.getTop();const lenx=rc.getRight();const leny=rc.getBottom();for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell= +this.GetCell(x,y,false);if(!cell)continue;cell.SetChanged()}}}; + +} + +// layouts/layer.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const renderCellArr=[];const tmpDestRect=new C3.Rect;const tmpSrcRect=new C3.Rect;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tempVec3=vec3.create();const tempVec4=vec4.create();const camVector=vec3.create();const lookVector=vec3.create();const upVector=vec3.create();const tempVec2=C3.New(C3.Vector2); +const tempRect=C3.New(C3.Rect);function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()}function SortByInstZElevation(a,b){return a.GetWorldInfo().GetZElevation()-b.GetWorldInfo().GetZElevation()}const tempInstanceList1=[];const tempInstanceList2=[];const tempInstancesByCameraDist=[]; +const DEFAULT_LAYER_OPTIONS={name:"",sid:-1,isDynamic:false,isVisible:true,isInteractive:true,backgroundColor:[1,1,1,1],isTransparent:true,parallax:[1,1],opacity:1,isForceOwnTexture:false,renderAs3d:false,useCameraDistanceDrawOrder:false,useRenderCells:false,scaleRate:1,blendMode:0,zElevation:0,initialInstancesData:[],effectListData:[],subLayersData:[]}; +C3.Layer=class Layer extends C3.DefendedBase{constructor(layout,parentLayer,opts){super();opts=Object.assign({},DEFAULT_LAYER_OPTIONS,opts);this._layout=layout;this._runtime=layout.GetRuntime();this._parentLayer=parentLayer;this._name=opts.name;this._index=-1;this._sid=opts.sid;this._isDynamic=!!opts.isDynamic;this._isVisible=!!opts.isVisible;this._isInteractive=!!opts.isInteractive;this._backgroundColor=C3.New(C3.Color);this._backgroundColor.setFromJSON(opts.backgroundColor);this._isTransparent= +!!opts.isTransparent;this._parallaxX=opts.parallax[0];this._parallaxY=opts.parallax[1];this._color=C3.New(C3.Color,1,1,1,opts.opacity);this._premultipliedColor=C3.New(C3.Color);this._isForceOwnTexture=!!opts.isForceOwnTexture;this._renderAs3d=!!opts.renderAs3d;this._useCameraDistanceDrawOrder=!!opts.useCameraDistanceDrawOrder;this._useRenderCells=!!opts.useRenderCells;this._scaleRate=opts.scaleRate;this._blendMode=opts.blendMode;this._curRenderTarget=null;this._scale=1;this._zElevation=opts.zElevation; +this._angle=0;this._scrollX=0;this._scrollY=0;this._hasOwnScrollPosition=false;this._viewport=C3.New(C3.Rect);this._viewportZ0=C3.New(C3.Rect);this._viewport3D=C3.New(C3.Rect);this._isViewportChanged=true;this._projectionMatrix=mat4.create();this._isProjectionMatrixChanged=true;this._modelViewMatrix=mat4.create();this._isMVMatrixChanged=true;this._viewFrustum=C3.New(C3.Gfx.ViewFrustum);this._isViewFrustumChanged=true;this._startupInitialInstances=[];this._initialInstancesData=opts.initialInstancesData; +this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._zIndicesUpToDate=false;this._anyInstanceZElevated=false;const canvasManager=this._runtime.GetCanvasManager();this._effectList=C3.New(C3.EffectList,this,opts.effectListData);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layer=effectChain.GetContentObject();const renderSurface=layer.GetRenderTarget();renderer.SetColor(layer.GetPremultipliedColor()); +renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface);canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)});this._needsRebuildEffectChainSteps=true;this._wasDefaultColor=true;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=false;this._lastRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._curRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this); +this._UpdatePremultipliedColor();if(this.UsesRenderCells())this._renderGrid=C3.New(C3.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight());this._subLayers=opts.subLayersData.map(ld=>C3.Layer.CreateFromExportData(this._layout,this,ld))}_InitInitialInstances(){for(const instData of this._initialInstancesData){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);this._layout._AddInitialObjectClass(objectClass);if(!objectClass.GetDefaultInstanceData()){objectClass.SetDefaultInstanceData(instData); +objectClass._SetDefaultLayerIndex(this._index)}this._initialInstances.push(instData);this._initialUIDsToInstanceData.set(instData[2],instData)}C3.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData=null}static CreateFromExportData(layout,parentLayer,data){return C3.New(C3.Layer,layout,parentLayer,{name:data[0],sid:data[2],isVisible:data[3],isInteractive:data[13],backgroundColor:data[4].map(x=>x/255),isTransparent:data[5],parallax:[data[6],data[7]],opacity:data[8], +isForceOwnTexture:data[9],renderAs3d:data[17],useCameraDistanceDrawOrder:data[18],useRenderCells:data[10],scaleRate:data[11],blendMode:data[12],zElevation:data[16],initialInstancesData:data[14],effectListData:data[15],subLayersData:data[19]})}Release(){for(const subLayer of this._subLayers)subLayer.Release();C3.clearArray(this._subLayers);for(const inst of this._instances)this._runtime.DestroyInstance(inst);C3.clearArray(this._instances);this._iLayer=null;this._parentLayer=null;this._layout=null; +this._runtime=null}GetInitialInstanceData(uid){return this._initialUIDsToInstanceData.get(uid)}CreateInitialInstances(createdInstances){const isFirstVisit=this._layout.IsFirstVisit();let k=0;const initialInstances=this._initialInstances;for(let i=0,len=initialInstances.length;i=0)assignedZIndices.add(cachedZIndex)}let index=-1;for(const inst of this._instances){const wi=inst.GetWorldInfo();if(wi._GetLastCachedZIndex()>=0)continue;++index;while(assignedZIndices.has(index))++index;wi._SetZIndex(index)}}this._instances.sort(SortByInstLastCachedZIndex)}_Start(){}_End(){for(const inst of this._instances)if(!inst.GetObjectClass().IsGlobal())this._runtime.DestroyInstance(inst); +this._runtime.FlushPendingInstances();C3.clearArray(this._instances);this._anyInstanceZElevated=false;this.SetZIndicesChanged()}RecreateInitialObjects(objectClass,rc,offsetX,offsetY,createHierarchy){const eventSheetManager=this._runtime.GetEventSheetManager();const allObjectClasses=this._runtime.GetAllObjectClasses();const isFamily=objectClass.IsFamily();const ret=[];for(const instData of this._initialInstances){const worldData=instData[0];const x=worldData[0];const y=worldData[1];if(!rc.containsPoint(x, +y))continue;const objectType=allObjectClasses[instData[1]];if(objectType!==objectClass)if(isFamily){if(!objectClass.FamilyHasMember(objectType))continue}else continue;let createOnLayer=this;const runningLayout=this._runtime.GetCurrentLayout();if(this.GetLayout()!==runningLayout){createOnLayer=runningLayout.GetLayerByName(this.GetName());if(!createOnLayer)createOnLayer=runningLayout.GetLayerByIndex(this.GetIndex())}const inst=this._runtime.CreateInstanceFromData(instData,createOnLayer,false,undefined, +undefined,false,createHierarchy);createOnLayer.SortAndAddInstancesByZIndex(inst);const wi=inst.GetWorldInfo();wi.OffsetXY(offsetX,offsetY);wi.SetBboxChanged();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);ret.push(inst)}return ret}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(i){this._index=i}GetIndex(){return this._index}_GetSiblingIndex(){let ret= +-1;const parentLayer=this.GetParentLayer();if(parentLayer)ret=parentLayer.GetSubLayers().indexOf(this);else ret=this.GetLayout()._GetRootLayers().indexOf(this);return ret}GetSID(){return this._sid}GetRuntime(){return this._runtime}IsDynamic(){return this._isDynamic}HasAnyDynamicParentLayer(){for(const parent of this.parentLayers())if(parent.IsDynamic())return true;return false}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps(); +return this._effectChain}_MaybeRebuildEffectChainSteps(){const isDefaultColor=this.HasDefaultColor();if(!this._needsRebuildEffectChainSteps&&isDefaultColor===this._wasDefaultColor&&!this._effectChain.NeedsRebuild())return;const activeEffectTypes=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor,useFullSurface:true});this._needsRebuildEffectChainSteps= +false;this._wasDefaultColor=isDefaultColor}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=true}UsesRenderCells(){return this._useRenderCells&&!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=false}IsVisible(){for(const layer of this.selfAndParentLayers())if(!layer._IsVisibleFlagSet())return false;return true}_IsVisibleFlagSet(){return this._isVisible}SetVisible(v){v=!!v;if(this._isVisible=== +v)return;this._isVisible=v;this._runtime.UpdateRender()}SetInteractive(i){this._isInteractive=!!i}IsInteractive(){return this._isInteractive}IsSelfAndParentsInteractive(){for(const layer of this.selfAndParentLayers())if(!layer.IsInteractive())return false;return true}SetOwnScrollPositionEnabled(e){e=!!e;if(this._hasOwnScrollPosition===e)return;this._hasOwnScrollPosition=e;if(e){const layout=this.GetLayout();this._scrollX=layout.GetScrollX();this._scrollY=layout.GetScrollY()}this._SetMVMatrixChanged(); +this._runtime.UpdateRender()}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(x){const layout=this.GetLayout();const lbound=layout.GetScrollLeftBound();const rbound=layout.GetScrollRightBound();if(x>rbound)x=rbound;if(xbbound)y=bbound;if(y0}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){if(this.RendersIn3DMode()&& +this._useCameraDistanceDrawOrder){C3.shallowAssignArray(tempInstancesByCameraDist,this._GetInstances());tempInstancesByCameraDist.sort((a,b)=>this._SortInstancesByCameraDistance(a,b));return tempInstancesByCameraDist}else return this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(arr){C3.appendArray(arr,this._GetInstancesInDrawOrder());for(const subLayer of this._subLayers)if(subLayer.IsVisible()&&subLayer.GetOpacity()>0)subLayer._AppendAllInstancesIncludingSubLayersInDrawOrder(arr)}_SortInstancesByCameraDistance(a, +b){const camVec=this.GetLayout().Get3DCameraPosition();const camX=camVec[0];const camY=camVec[1];const camZ=camVec[2];const wiA=a.GetWorldInfo();const wiB=b.GetWorldInfo();const dxA=wiA.GetX()-camX;const dyA=wiA.GetY()-camY;const dzA=wiA.GetZElevation()-camZ;const dxB=wiB.GetX()-camX;const dyB=wiB.GetY()-camY;const dzB=wiB.GetZElevation()-camZ;return dxB*dxB+dyB*dyB+dzB*dzB-(dxA*dxA+dyA*dyA+dzA*dzA)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(t){t= +!!t;if(this._isTransparent===t)return;this._isTransparent=t;this._runtime.UpdateRender()}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(f){f=!!f;if(this._isForceOwnTexture===f)return;this._isForceOwnTexture=f;this._runtime.UpdateRender()}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return false; +for(const subLayer of this._subLayers)if(!subLayer.SelfAndAllSubLayersHave3DCamera())return false;return true}SetBlendMode(bm){if(this._blendMode===bm)return;this._blendMode=bm;this._runtime.UpdateRender()}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}_SetParentLayer(layer){this._parentLayer=layer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return this._subLayers.length>0}_AddSubLayer(layer,atTop=true){if(atTop)this._subLayers.push(layer); +else this._subLayers.unshift(layer)}_InsertSubLayer(layer,insertBy,isAbove){let i=this._subLayers.indexOf(insertBy);if(i===-1)throw new Error("cannot find layer to insert by");if(isAbove)++i;this._subLayers.splice(i,0,layer)}_RemoveSubLayer(layer){const i=this._subLayers.indexOf(layer);if(i===-1)throw new Error("cannot find layer to remove");this._subLayers.splice(i,1)}HasAnyVisibleSubLayer(){for(const subLayer of this._subLayers)if(subLayer.ShouldDraw())return true;return false}*selfAndAllSubLayers(){for(const subLayer of this._subLayers)yield*subLayer.selfAndAllSubLayers(); +yield this}*parentLayers(){let parentLayer=this.GetParentLayer();while(parentLayer){yield parentLayer;parentLayer=parentLayer.GetParentLayer()}}*selfAndParentLayers(){yield this;yield*this.parentLayers()}HasParentLayer(layer){for(const p of this.parentLayers())if(p===layer)return true;return false}IsTransformCompatibleWith(otherLayer){return this===otherLayer||this._parallaxX===otherLayer._parallaxX&&this._parallaxY===otherLayer._parallaxY&&this._scale===otherLayer._scale&&this._scaleRate===otherLayer._scaleRate&& +this._angle===otherLayer._angle&&this.GetScrollX()===otherLayer.GetScrollX()&&this.GetScrollY()===otherLayer.GetScrollY()}SaveTransform(){return{"parallaxX":this.GetParallaxX(),"parallaxY":this.GetParallaxY(),"scale":this.GetOwnScale(),"scaleRate":this.GetScaleRate(),"angle":this.GetOwnAngle(),"hasOwnScroll":this.IsOwnScrollPositionEnabled(),"scrollX":this.GetScrollX(),"scrollY":this.GetScrollY()}}RestoreTransform(t){this.SetParallax(t["parallaxX"],t["parallaxY"]);this.SetOwnScale(t["scale"]);this.SetScaleRate(t["scaleRate"]); +this.SetAngle(t["angle"]);this.SetOwnScrollPositionEnabled(t["hasOwnScroll"]);this.SetScrollX(t["scrollX"]);this.SetScrollY(t["scrollY"]);this._MaybeUpdateViewport()}_RemoveAllInstancesInSet(s){if(s.size===0)return;const numRemoved=C3.arrayRemoveAllInSet(this._instances,s);if(numRemoved>0){this._MaybeResetAnyInstanceZElevatedFlag();this.SetZIndicesChanged()}}SetZIndicesChanged(){this._zIndicesUpToDate=false;this._isRenderListUpToDate=false}_UpdateZIndices(){if(this._zIndicesUpToDate)return;this._instances.sort(SortByInstZElevation); +if(this.UsesRenderCells())for(let i=0,len=this._instances.length;i1)arr=this._MergeAllSortedZArrays_pass(arr);return arr[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices(); +C3.clearArray(renderCellArr);this._renderGrid.QueryRange(this.GetViewport(),renderCellArr);if(!renderCellArr.length)return[];if(renderCellArr.length===1)return renderCellArr[0];return this._MergeAllSortedZArrays(renderCellArr)}ShouldDraw(){return this.IsVisible()&&this.GetOpacity()>0&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()||!this.IsTransparent())return true;for(const subLayer of this._subLayers)if(subLayer._DrawsAnyContentInSelfOrSubLayers())return true; +return false}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||this.GetBlendMode()!==0||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return true;for(const subLayer of this._subLayers)if(subLayer.SelfOrAnySubLayerUsesOwnTexture())return true;return false}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(z){if(this._layout.IsOrthographicProjection())return 1;else{const camZ=this.GetCameraZ();return camZ/(camZ- +z)}}GetCameraZ(viewH){return this.GetDefaultCameraZ(viewH)/this.GetNormalScale()}_SetMVMatrixChanged(){this._isMVMatrixChanged=true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetModelViewMatrix(renderer){if(this._isMVMatrixChanged){this._CalculateModelViewMatrix(renderer,this._modelViewMatrix,0,0,null);this._isMVMatrixChanged=false}return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const camPos=this.GetLayout().Get3DCameraPosition();return[camPos[0],camPos[1], +camPos[2]]}else return this._Get2DCameraPosition()}_Get2DCameraPosition(offX=0,offY=0,viewH=0){const runtime=this._runtime;const layout=this.GetLayout();const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();let scrollOriginX=(this.GetScrollX()-parallaxOriginX)*this._parallaxX+parallaxOriginX;let scrollOriginY=(this.GetScrollY()-parallaxOriginY)*this._parallaxY+parallaxOriginY;if(runtime.IsPixelRoundingEnabled()){scrollOriginX=Math.round(scrollOriginX); +scrollOriginY=Math.round(scrollOriginY)}let camX=scrollOriginX+offX;let camY=scrollOriginY+offY;const camZ=layout.IsOrthographicProjection()?this.GetDefaultCameraZ(viewH):this.GetCameraZ(viewH);const [vpX,vpY]=this._GetVanishingPoint();if(vpX!==.5||vpY!==.5){const zf=this.GetDefaultCameraZ(viewH)/camZ;let camOffX=(vpX-.5)*runtime.GetViewportWidth()/zf;let camOffY=(vpY-.5)*runtime.GetViewportHeight()/zf;const a=this.GetAngle();if(a!==0){tempVec2.set(camOffX,camOffY);tempVec2.rotate(a);camOffX=tempVec2.getX(); +camOffY=tempVec2.getY()}camX+=camOffX;camY+=camOffY}return[camX,camY,camZ]}_CalculateModelViewMatrix(renderer,outMat,offX,offY,viewH){const runtime=this._runtime;const layout=this.GetLayout();if(this.Has3DCamera()){vec3.copy(camVector,layout.Get3DCameraPosition());vec3.copy(lookVector,layout.Get3DCameraLookAt());vec3.copy(upVector,layout.Get3DCameraUpVector());const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();const lookDx=lookVector[0]-camVector[0]; +const lookDy=lookVector[1]-camVector[1];const lookDz=lookVector[2]-camVector[2];camVector[0]=(camVector[0]-parallaxOriginX)*this._parallaxX+parallaxOriginX;camVector[1]=(camVector[1]-parallaxOriginY)*this._parallaxY+parallaxOriginY;camVector[2]*=Math.max(this._parallaxX,this._parallaxY);lookVector[0]=camVector[0]+lookDx;lookVector[1]=camVector[1]+lookDy;lookVector[2]=camVector[2]+lookDz}else{const [camX,camY,camZ]=this._Get2DCameraPosition(offX,offY,viewH);vec3.set(camVector,camX,camY,camZ);vec3.set(lookVector, +camX,camY,camZ-100);const a=this.GetAngle();if(a===0)vec3.set(upVector,0,1,0);else vec3.set(upVector,Math.sin(a),Math.cos(a),0)}renderer.CalculateLookAtModelView(outMat,camVector,lookVector,upVector,viewH||runtime.GetViewportHeight())}_SetProjectionMatrixChanged(){this._isProjectionMatrixChanged=true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetProjectionMatrix(renderer){if(this._isProjectionMatrixChanged){this._CalculateProjectionMatrix(renderer);this._isProjectionMatrixChanged= +false}return this._projectionMatrix}_CalculateProjectionMatrix(renderer){const canvasManager=this._runtime.GetCanvasManager();const [vpX,vpY]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())renderer.CalculateOrthographicMatrix(this._projectionMatrix,canvasManager.GetDrawWidth(),canvasManager.GetDrawHeight());else if(vpX===.5&&vpY===.5)mat4.copy(this._projectionMatrix,canvasManager.GetDefaultProjectionMatrix());else{const drawW=canvasManager.GetDrawWidth();const drawH=canvasManager.GetDrawHeight(); +renderer.CalculatePerspectiveMatrix(this._projectionMatrix,drawW/drawH,vpX,vpY)}}_SetTransform(renderer,updateProjection=true,offX=0,offY=0,viewH=0){if(updateProjection)renderer.SetProjectionMatrix(this._GetProjectionMatrix(renderer));let modelViewMatrix=null;if(offX===0&&offY===0&&viewH===0)modelViewMatrix=this._GetModelViewMatrix(renderer);else{this._CalculateModelViewMatrix(renderer,tempMat4,offX,offY,viewH);modelViewMatrix=tempMat4}renderer.SetModelViewMatrix(modelViewMatrix)}PrepareForDraw(renderer){this._SetTransform(renderer); +renderer.SetBaseZ(this.GetZElevation())}Draw(renderer,destinationRenderTarget,isFirstToTarget){const canvasManager=this._runtime.GetCanvasManager();const useOwnTexture=this.UsesOwnTexture();let ownRenderTarget=null;let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer=canvasManager.GetLayerTimingsBuffer(this);if(timingsBuffer){layerQuery=timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+ +1)*2);if(useOwnTexture){const rtOpts={sampling:this._runtime.GetSampling(),isSampled:true,canReadPixels:renderer.IsWebGPU()?this._runtime.UsesAnyBackgroundBlending():false};if(canvasManager.GetCurrentFullscreenScalingQuality()==="low"){rtOpts.width=canvasManager.GetDrawWidth();rtOpts.height=canvasManager.GetDrawHeight()}ownRenderTarget=this._runtime.GetAdditionalRenderTarget(rtOpts);this._curRenderTarget=ownRenderTarget;renderer.SetRenderTarget(ownRenderTarget);if(this.IsTransparent())renderer.ClearRgba(0, +0,0,0)}else{this._curRenderTarget=destinationRenderTarget;renderer.SetRenderTarget(destinationRenderTarget)}if(!this.IsTransparent())renderer.Clear(this._backgroundColor);this._layout._DrawLayerList(renderer,this._curRenderTarget,this._subLayers,useOwnTexture&&this.IsTransparent());this._SetTransform(renderer);renderer.SetBaseZ(this.GetZElevation());renderer.SetDepthEnabled(this.RendersIn3DMode());if(this.GetNormalScale()>Number.EPSILON){this._UpdateZIndices();const useRenderCells=this.UsesRenderCells()&& +this.GetZElevation()===0&&!this._anyInstanceZElevated;if(this.Has3DCamera())this._DrawInstances_3DCamera(renderer);else if(useRenderCells)this._DrawInstances_RenderCells(renderer);else this._DrawInstances(renderer,this._GetInstancesInDrawOrder())}renderer.SetBaseZ(0);renderer.SetCurrentZ(0);if(useOwnTexture){renderer.SetDepthEnabled(false);this._DrawLayerOwnTextureToRenderTarget(renderer,ownRenderTarget,destinationRenderTarget,isFirstToTarget)}if(layerQuery)renderer.EndQuery(layerQuery);if(this._runtime.IsGPUProfiling()&& +renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+1)*2+1);this._curRenderTarget=null}_DrawInstances(renderer,instances){const viewport=this.GetViewport();const renderTarget=this._curRenderTarget;const isOrthographic=this.GetLayout().IsOrthographicProjection();const hasVanishingPointOutsideViewport=this.GetLayout().HasVanishingPointOutsideViewport();let lastInst=null;for(let i=0,len=instances.length;i0)postRenderInstances.push(inst);const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst);let endIndex=i+1;for(;endIndex0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length===1&&!coplanarInstances[0].MustMitigateZFighting()){this._DrawInstanceMaybeWithEffects(inst,wi,renderer,renderTarget);for(let j=0,lenj=postRenderInstances.length;j0)if(this._IsPointBehindNearPlane(bbLeft,bbTop,topZ)||this._IsPointBehindNearPlane(bbRight,bbTop,topZ)||this._IsPointBehindNearPlane(bbRight,bbBottom,topZ)||this._IsPointBehindNearPlane(bbLeft,bbBottom,topZ))return null}else if(topZ>=this.GetCameraZ())return null;let [stlx,stly]=this.LayerToDrawSurface(bbLeft,bbTop,z);let [sbrx, +sbry]=this.LayerToDrawSurface(bbRight,bbBottom,z);if(this.GetAngle()!==0||depth>0||this.Has3DCamera()){const [strx,stry]=this.LayerToDrawSurface(bbRight,bbTop,z);const [sblx,sbly]=this.LayerToDrawSurface(bbLeft,bbBottom,z);if(depth>0){const [stlxTop,stlyTop]=this.LayerToDrawSurface(bbLeft,bbTop,topZ);const [strxTop,stryTop]=this.LayerToDrawSurface(bbRight,bbTop,topZ);const [sbrxTop,sbryTop]=this.LayerToDrawSurface(bbRight,bbBottom,topZ);const [sblxTop,sblyTop]=this.LayerToDrawSurface(bbLeft,bbBottom, +topZ);let temp=Math.min(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);sbrx=Math.max(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);stlx=temp;temp=Math.min(stly,sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);sbry=Math.max(stly,sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);stly=temp}else{let temp=Math.min(stlx,sbrx,strx,sblx);sbrx=Math.max(stlx,sbrx,strx,sblx);stlx=temp;temp=Math.min(stly,sbry,stry,sbly);sbry=Math.max(stly,sbry,stry,sbly);stly=temp}}tmpRect.set(stlx,stly,sbrx,sbry); +return tmpRect}_GetViewFrustum(){if(this._isViewFrustumChanged){this._UpdateViewFrustum();this._isViewFrustumChanged=false}return this._viewFrustum}_UpdateViewFrustum(){const renderer=this._runtime.GetRenderer();const matP=this._GetProjectionMatrix(renderer);const matMV=this._GetModelViewMatrix(renderer);this._viewFrustum.CalculatePlanes(matMV,matP)}_IsPointBehindNearPlane(x,y,z){return this._GetViewFrustum().IsBehindNearPlane(x,y,z)}_SaveToJson(){const o={"d":this.IsDynamic(),"s":this.GetOwnScale(), +"a":this.GetOwnAngle(),"v":this._IsVisibleFlagSet(),"i":this.IsInteractive(),"bc":this._backgroundColor.toJSON(),"t":this.IsTransparent(),"sx":this._scrollX,"sy":this._scrollY,"hosp":this._hasOwnScrollPosition,"px":this.GetParallaxX(),"py":this.GetParallaxY(),"c":this._color.toJSON(),"sr":this.GetScaleRate(),"fx":this._effectList.SaveToJson(),"cg":this._createdGlobalUids};return o}_LoadFromJson(o){this._isDynamic=!!o["d"];this._scale=o["s"];this._angle=o["a"];this._isVisible=!!o["v"];this._isInteractive= +o.hasOwnProperty("i")?o["i"]:true;this._backgroundColor.setFromJSON(o["bc"]);this._isTransparent=!!o["t"];if(o.hasOwnProperty("sx"))this._scrollX=o["sx"];if(o.hasOwnProperty("sy"))this._scrollY=o["sy"];if(o.hasOwnProperty("hosp"))this._hasOwnScrollPosition=!!o["hosp"];this._parallaxX=o["px"];this._parallaxY=o["py"];this._color.setFromJSON(o["c"]);this._UpdatePremultipliedColor();this._scaleRate=o["sr"];C3.shallowAssignArray(this._createdGlobalUids,o["cg"]);C3.shallowAssignArray(this._initialInstances, +this._startupInitialInstances);const tempSet=new Set(this._createdGlobalUids);let j=0;for(let i=0,len=this._initialInstances.length;i{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});return}if(inst.HasChildren()){const instances=[...inst.allChildren()];instances.push(inst);instances.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex}); +for(const instanceToAdd of instances){if(!instanceToAdd.IsInContainer())continue;for(const instanceToAddSibling of instanceToAdd.siblings()){if(instances.includes(instanceToAddSibling))continue;const siblingAndChildren=[...instanceToAddSibling.allChildren()];siblingAndChildren.push(instanceToAddSibling);siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren|| +!siblingAndChildren.length)continue;instances.splice(instances.length,0,...siblingAndChildren)}}for(const instance of instances)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance,true)}else{if(inst.GetPlugin().IsWorldType())this._AddInstance(inst,true);if(!inst.IsInContainer())return;for(const sibling of inst.siblings()){const siblingAndChildren=[...sibling.allChildren()];siblingAndChildren.push(sibling);siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex(); +const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren||!siblingAndChildren.length)continue;for(const instance of siblingAndChildren)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance,true)}}}}; + +} + +// layouts/layout.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const tempDestRect=C3.New(C3.Rect);const tempSrcRect=C3.New(C3.Rect);const tempLayoutRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const tempRender3dList=[];const tempInstanceList1=[];const tempInstanceList2=[];const tempInstanceList3=[];function vec3EqualsXYZ(v,x,y,z){return v[0]===Math.fround(x)&&v[1]===Math.fround(y)&&v[2]===Math.fround(z)} +let lastLayerPreparedForDrawing=null;function MaybePrepareLayerDraw(layer,renderer){if(lastLayerPreparedForDrawing===layer)return;layer.PrepareForDraw(renderer);lastLayerPreparedForDrawing=layer} +C3.Layout=class Layout extends C3.DefendedBase{constructor(layoutManager,index,data){super();this._layoutManager=layoutManager;this._runtime=layoutManager.GetRuntime();this._name=data[0];this._originalWidth=data[1];this._originalHeight=data[2];this._width=data[1];this._height=data[2];this._isUnboundedScrolling=!!data[3];this._isOrthographicProjection=!!data[4];this._vanishingPointX=data[5];this._vanishingPointY=data[6];this._eventSheetName=data[7];this._eventSheet=null;this._sid=data[8];this._index= +index;this._scrollX=0;this._scrollY=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._createdPersistedInstances=[];this._createdPersistedInstancesToDataMap=new Map;this._createdPersistedIndexToInstanceMap=new Map;this._initialNonWorld=[];this._is3dCameraEnabled=false;this._cam3dposition=vec3.create();this._cam3dlook=vec3.create();this._cam3dup=vec3.create();this._rootLayers=[]; +this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const canvasManager=this._runtime.GetCanvasManager();this._effectList=C3.New(C3.EffectList,this,data[11]);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layout=effectChain.GetContentObject();const renderSurface=layout.GetRenderTarget();renderer.ResetColor();renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface); +canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)});this._needsRebuildEffectChainSteps=true;this._wasFullScreenQualityLow=false;this._curRenderTarget=null;this._persistData={};this._persistedIntances=new Map;this._isFirstVisit=true;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);for(const layerData of data[9])this._rootLayers.push(C3.Layer.CreateFromExportData(this, +null,layerData));this._ReindexLayers();for(const layer of this.allLayers())layer._InitInitialInstances();for(const instData of data[10]){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);if(!objectClass)throw new Error("missing nonworld object class");if(!objectClass.GetDefaultInstanceData())objectClass.SetDefaultInstanceData(instData);this._initialNonWorld.push(instData);this._AddInitialObjectClass(objectClass)}}Release(){for(const l of this._allLayersFlat)l.Release();C3.clearArray(this._allLayersFlat); +this._textureLoadPendingPromises.clear();this._eventSheet=null;this._layoutManager=null;this._runtime=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();return this._effectChain}_MaybeRebuildEffectChainSteps(){const isFullscreenQualityLow=this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()==="low";if(!this._needsRebuildEffectChainSteps&& +this._wasFullScreenQualityLow===isFullscreenQualityLow&&!this._effectChain.NeedsRebuild())return;const activeEffectTypes=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePostDraw:isFullscreenQualityLow,useFullSurface:true});this._needsRebuildEffectChainSteps=false;this._wasFullScreenQualityLow=isFullscreenQualityLow}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects(); +this._needsRebuildEffectChainSteps=true}GetMinLayerScale(){let m=this._allLayersFlat[0].GetNormalScale();for(let i=1,len=this._allLayersFlat.length;irbound)x=rbound;if(xbbound)y=bbound;if(y1||vpY<0||vpY>1}SetPerspectiveProjection(){if(!this._isOrthographicProjection)return;this._isOrthographicProjection=false;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}SetOrthographicProjection(){if(this._isOrthographicProjection)return; +this._isOrthographicProjection=true;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(e){e=!!e;if(this._is3dCameraEnabled===e)return;this._is3dCameraEnabled=e;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(camX,camY,camZ, +lookX,lookY,lookZ,upX,upY,upZ){if(vec3EqualsXYZ(this._cam3dposition,camX,camY,camZ)&&vec3EqualsXYZ(this._cam3dlook,lookX,lookY,lookZ)&&vec3EqualsXYZ(this._cam3dup,upX,upY,upZ))return;vec3.set(this._cam3dposition,camX,camY,camZ);vec3.set(this._cam3dlook,lookX,lookY,lookZ);vec3.set(this._cam3dup,upX,upY,upZ);this.Set3DCameraChanged()}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(s){if(this._scale=== +s)return;this._scale=s;this._SetAllLayersMVChanged();this.BoundScrolling();this._runtime.UpdateRender()}SetAngle(a){a=C3.clampAngle(a);if(this._angle===a)return;this._angle=a;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(w){if(!isFinite(w)||w<1)return;this._width=w}GetHeight(){return this._height}SetHeight(h){if(!isFinite(h)||h<1)return;this._height=h}GetEventSheet(){return this._eventSheet}_GetRootLayers(){return this._rootLayers}*allLayers(){for(const rootLayer of this._rootLayers)yield*rootLayer.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(p){if(typeof p=== +"number")return this.GetLayerByIndex(p);else return this.GetLayerByName(p.toString())}GetLayerByIndex(i){i=C3.clamp(Math.floor(i),0,this._allLayersFlat.length-1);return this._allLayersFlat[i]}GetLayerByName(name){return this._layersByName.get(name.toLowerCase())||null}HasLayerByName(name){return!!this.GetLayerByName(name)}GetLayerBySID(sid){return this._layersBySid.get(sid)||null}_SetAllLayersProjectionChanged(){for(const layer of this._allLayersFlat)layer._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const layer of this._allLayersFlat)layer._SetMVMatrixChanged()}AddLayer(layerName, +insertBy,where){if(this.HasLayerByName(layerName))throw new Error(`layer name '${layerName}' already in use`);if(!insertBy&&where<2)throw new Error("invalid insert position");const parentLayer=where>=2?insertBy:insertBy.GetParentLayer();const layer=C3.New(C3.Layer,this,parentLayer,{name:layerName,sid:Math.floor(Math.random()*1E15),isDynamic:true});this._InsertLayer(layer,insertBy,where);this.GetRuntime().UpdateRender();this._ReindexLayers()}MoveLayer(layer,insertBy,where){if(!insertBy&&where<2)throw new Error("invalid insert position"); +this._RemoveLayer(layer);this._InsertLayer(layer,insertBy,where);this.GetRuntime().UpdateRender();this._ReindexLayers()}RemoveLayer(layer){if(this._RemoveLayer(layer)){layer.Release();this.GetRuntime().UpdateRender();this._ReindexLayers()}}RemoveAllDynamicLayers(){const toRemove=new Set;for(const layer of this.allLayers())if(layer.IsDynamic()&&!layer.HasAnyDynamicParentLayer())toRemove.add(layer);for(const layer of toRemove){this._RemoveLayer(layer);layer.Release()}this.GetRuntime().UpdateRender(); +this._ReindexLayers()}_InsertLayer(layer,insertBy,where){if(where>=2)if(insertBy){if(insertBy===layer||insertBy.HasParentLayer(layer))throw new Error(`cannot move layer '${layer.GetName()}' to sub-layer of itself`);insertBy._AddSubLayer(layer,where===2);layer._SetParentLayer(insertBy)}else{if(where===2)this._rootLayers.push(layer);else this._rootLayers.unshift(layer);layer._SetParentLayer(null)}else{const parentLayer=insertBy.GetParentLayer();if(parentLayer){if(insertBy.HasParentLayer(layer))throw new Error(`cannot move layer '${layer.GetName()}' to sub-layer of itself`); +parentLayer._InsertSubLayer(layer,insertBy,where===0);layer._SetParentLayer(parentLayer)}else{let i=this._rootLayers.indexOf(insertBy);if(i===-1)throw new Error("cannot find layer to insert by");if(where===0)++i;this._rootLayers.splice(i,0,layer);layer._SetParentLayer(null)}}}_RemoveLayer(layer){const parentLayer=layer.GetParentLayer();if(parentLayer){parentLayer._RemoveSubLayer(layer);return true}else if(this._rootLayers.length>1){const i=this._rootLayers.indexOf(layer);if(i===-1)throw new Error("cannot find layer to remove"); +this._rootLayers.splice(i,1);return true}return false}_ReindexLayers(){this._allLayersFlat=[...this.allLayers()];this._layersByName.clear();this._layersBySid.clear();for(let i=0,len=this._allLayersFlat.length;il.ShouldDraw())[0];while(firstDrawLayer){if(!firstDrawLayer.IsTransparent()){tempColor.copyRgb(firstDrawLayer.GetBackgroundColor());tempColor.setA(1);return tempColor}else if(firstDrawLayer.UsesOwnTexture()){tempColor.setRgba(0, +0,0,0);return tempColor}firstDrawLayer=firstDrawLayer.GetSubLayers().filter(l=>l.ShouldDraw())[0]}tempColor.setRgba(0,0,0,0);return tempColor}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(objectClass){if(objectClass.IsInContainer())for(const containerType of objectClass.GetContainer().GetObjectTypes())this._initialObjectClasses.add(containerType);else this._initialObjectClasses.add(objectClass)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(previousLayout, +renderer){if(previousLayout===this||!renderer)return Promise.resolve();if(previousLayout){C3.CopySet(this._textureLoadedTypes,previousLayout._textureLoadedTypes);previousLayout._textureLoadedTypes.clear()}const promises=[];for(const oc of this._initialObjectClasses)if(!this._textureLoadedTypes.has(oc)){promises.push(oc.LoadTextures(renderer));this._textureLoadedTypes.add(oc)}return Promise.all(promises)}async MaybeLoadTexturesFor(objectClass){if(objectClass.IsFamily())throw new Error("cannot load textures for family"); +const renderer=this._runtime.GetRenderer();if(!renderer||renderer.IsContextLost()||this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.add(objectClass);const loadPromise=objectClass.LoadTextures(renderer);this._AddPendingTextureLoadPromise(loadPromise);await loadPromise;objectClass.OnDynamicTextureLoadComplete();this._runtime.UpdateRender()}_AddPendingTextureLoadPromise(promise){this._textureLoadPendingPromises.add(promise);promise.then(()=>this._textureLoadPendingPromises.delete(promise)).catch(()=> +this._textureLoadPendingPromises.delete(promise))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(objectClass){if(objectClass.IsFamily()||objectClass.GetInstanceCount()>0)throw new Error("cannot unload textures");const renderer=this._runtime.GetRenderer();if(!renderer||!this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.delete(objectClass);objectClass.ReleaseTextures(renderer)}_Unload(nextLayout,renderer){if(nextLayout=== +this||!renderer)return;for(const oc of this._textureLoadedTypes)if(!oc.IsGlobal()&&!nextLayout._initialObjectClasses.has(oc)){oc.ReleaseTextures();this._textureLoadedTypes.delete(oc)}}_OnRendererContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(isFirstLayout){const runtime=this._runtime;const layoutManager=this._layoutManager;const eventSheetManager=runtime.GetEventSheetManager();if(this._eventSheetName){this._eventSheet=eventSheetManager.GetEventSheetByName(this._eventSheetName); +this._eventSheet._UpdateDeepIncludes()}layoutManager._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=runtime.GetOriginalViewportWidth()/2;this._scrollY=runtime.GetOriginalViewportHeight()/2;this.BoundScrolling();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._MoveGlobalObjectsToThisLayout(isFirstLayout);this._runtime.SetUsingCreatePromises(true);this._CreateInitialInstances();if(!this._isFirstVisit)this._CreatePersistedInstances(); +this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateAndLinkContainerInstances(this._createdPersistedInstances);this._CreateInitialNonWorldInstances();layoutManager.ClearPendingChangeLayout();runtime.FlushPendingInstances();this._runtime.SetUsingCreatePromises(false);const createPromises=this._runtime.GetCreatePromises();await Promise.all(createPromises);C3.clearArray(createPromises);if(!runtime.IsLoadingState()){for(const inst of this._createdInstances)inst.SetupInitialSceneGraphConnections(); +for(const inst of this._createdPersistedInstances)inst.SetupPersistedSceneGraphConnections(this._createdPersistedInstancesToDataMap,this._createdPersistedIndexToInstanceMap);for(const [sidStr,typeData]of Object.entries(this._persistData)){const objectClass=this._runtime.GetObjectClassBySID(parseInt(sidStr,10));if(!objectClass||objectClass.IsFamily()||!objectClass.HasPersistBehavior())continue;C3.clearArray(typeData)}for(const inst of this._createdInstances)inst._TriggerOnCreated();for(const inst of this._createdPersistedInstances)inst._TriggerOnCreated()}C3.clearArray(this._createdInstances); +C3.clearArray(this._createdPersistedInstances);this._createdPersistedInstancesToDataMap.clear();this._createdPersistedIndexToInstanceMap.clear();await Promise.all([...this._initialObjectClasses].map(oc=>oc.PreloadTexturesWithInstances(this._runtime.GetRenderer())));if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("beforefirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("beforeprojectstart"))}runtime.Dispatcher().dispatchEvent(new C3.Event("beforelayoutstart")); +await this.DispatchUserScriptEventAsyncWait(new C3.Event("beforelayoutstart"));if(!runtime.IsLoadingState())await runtime.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutStart,null,null);runtime.Dispatcher().dispatchEvent(new C3.Event("afterlayoutstart"));await this.DispatchUserScriptEventAsyncWait(new C3.Event("afterlayoutstart"));if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("afterfirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("afterprojectstart"))}eventSheetManager._RunQueuedTriggers(layoutManager); +await this.WaitForPendingTextureLoadsToComplete();this._isFirstVisit=false}_MoveGlobalObjectsToThisLayout(isFirstLayout){for(const objectClass of this._runtime.GetAllObjectClasses()){if(objectClass.IsFamily()||!objectClass.IsWorldType())continue;for(const inst of objectClass.GetInstances()){const wi=inst.GetWorldInfo();const oldLayer=wi.GetLayer();const layerIndex=C3.clamp(oldLayer.GetIndex(),0,this._allLayersFlat.length-1);const newLayer=this._allLayersFlat[layerIndex];wi._SetLayer(newLayer,true); +newLayer._MaybeAddInstance(inst)}}if(!isFirstLayout)for(const layer of this._allLayersFlat)layer._SortInstancesByLastCachedZIndex(false)}_CreateInitialInstances(){for(const layer of this._allLayersFlat){layer.CreateInitialInstances(this._createdInstances);layer._Start()}}_CreatePersistedInstances(){let uidsChanged=false;for(const [sidStr,typeData]of Object.entries(this._persistData)){const objectClass=this._runtime.GetObjectClassBySID(parseInt(sidStr,10));if(!objectClass||objectClass.IsFamily()|| +!objectClass.HasPersistBehavior())continue;for(const instData of typeData){let layer=null;if(objectClass.IsWorldType()){if(instData.hasOwnProperty("instJson"))layer=this.GetLayerBySID(instData["instJson"]["w"]["l"]);else layer=this.GetLayerBySID(instData["w"]["l"]);if(!layer)continue}const inst=this._runtime.CreateInstanceFromData(objectClass,layer,false,0,0,true);if(instData.hasOwnProperty("instJson"))inst.LoadFromJson(instData["instJson"]);else inst.LoadFromJson(instData);uidsChanged=true;this._createdPersistedInstances.push(inst); +if(instData.hasOwnProperty("instJson")){this._createdPersistedInstancesToDataMap.set(inst,instData);this._createdPersistedIndexToInstanceMap.set(instData["index"],inst)}}}for(const layer of this._allLayersFlat){layer._SortInstancesByLastCachedZIndex(true);layer.SetZIndicesChanged()}if(uidsChanged){this._runtime.FlushPendingInstances();this._runtime._RefreshUidMap()}}_CreateAndLinkContainerInstances(createdInstances){for(const inst of createdInstances){if(!inst.IsInContainer())continue;const wi=inst.GetWorldInfo(); +const iid=inst.GetIID();for(const containerType of inst.GetObjectClass().GetContainer().objectTypes()){if(containerType===inst.GetObjectClass())continue;const instances=containerType.GetInstances();if(instances.length>iid)inst._AddSibling(instances[iid]);else{let s;if(wi)s=this._runtime.CreateInstanceFromData(containerType,wi.GetLayer(),true,wi.GetX(),wi.GetY(),true);else s=this._runtime.CreateInstanceFromData(containerType,null,true,0,0,true);this._runtime.FlushPendingInstances();containerType._UpdateIIDs(); +inst._AddSibling(s);createdInstances.push(s)}}}}_CreateInitialNonWorldInstances(){for(const instData of this._initialNonWorld){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);if(!objectClass.IsInContainer())this._runtime.CreateInstanceFromData(instData,null,true)}}_CreateGlobalNonWorlds(){const createdInstances=[];const initialNonWorld=this._initialNonWorld;let k=0;for(let i=0,len=initialNonWorld.length;il.ShouldDraw()); +for(let i=0,len=layersToDraw.length;i=2||tempRender3dList.length===1&&tempRender3dList[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(renderer, +destRenderTarget,tempRender3dList);i+=tempRender3dList.length;C3.clearArray(tempRender3dList);continue}C3.clearArray(tempRender3dList)}layer.Draw(renderer,destRenderTarget,canCopyFirstLayer&&i===0);++i}}_DrawLayoutOwnTextureToRenderTarget(renderer,ownRenderTarget){const activeEffectTypes=this._effectList.GetActiveEffectTypes();const runtime=this._runtime;if(activeEffectTypes.length===0){renderer.SetRenderTarget(null);renderer.SetTextureFillMode();renderer.CopyRenderTarget(ownRenderTarget);renderer.InvalidateRenderTarget(ownRenderTarget); +runtime.ReleaseAdditionalRenderTarget(ownRenderTarget)}else{tempLayoutRect.set(0,0,runtime.GetViewportWidth(),runtime.GetViewportHeight());this.GetEffectChain().Render(renderer,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:tempLayoutRect,drawSurfaceRect:null,invalidateRenderTargets:true})}}_Draw3DLayers(renderer,renderTarget,layerList){if(!layerList[0].IsTransparent()){tempColor.copyRgb(layerList[0].GetBackgroundColor()); +tempColor.setA(1);renderer.Clear(tempColor)}const canvasManager=this._runtime.GetCanvasManager();renderer.SetDepthEnabled(true);const fullInstanceList=tempInstanceList1;const coplanarInstances=tempInstanceList2;const postRenderInstances=tempInstanceList3;for(const layer of layerList){layer._UpdateZIndices();layer._AppendAllInstancesIncludingSubLayersInDrawOrder(fullInstanceList)}const firstLayer=layerList[0];let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer= +canvasManager.GetLayerTimingsBuffer(firstLayer);if(timingsBuffer){layerQuery=timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((firstLayer.GetIndex()+1)*2);for(let i=0,len=fullInstanceList.length;i0)postRenderInstances.push(inst); +const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst);let endIndex=i+1;for(;endIndex0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length=== +1&&!coplanarInstances[0].MustMitigateZFighting()){MaybePrepareLayerDraw(wiLayer,renderer);wiLayer._DrawInstanceMaybeWithEffects(inst,wi,renderer,renderTarget);for(let j=0,lenj=postRenderInstances.length;j=0;--i){const dld=dynamicLayersData[i];const sid=dld["sid"];const layerName=dld["name"];const parentSid=dld["parentSid"];const siblingIndex=dld["siblingIndex"];const layerData=dld["data"]; +this._ReindexLayers();if(this.HasLayerByName(layerName)||this.GetLayerBySID(sid))continue;let parentLayer;let parentLayerArr;if(parentSid===null){parentLayer=null;parentLayerArr=this._rootLayers}else{parentLayer=this.GetLayerBySID(parentSid);if(!parentLayer)continue;parentLayerArr=parentLayer.GetSubLayers()}const layer=C3.New(C3.Layer,this,parentLayer,{name:layerName,sid,isDynamic:true});parentLayerArr.push(layer);let arr=reorderLayers.get(parentLayerArr);if(!arr){arr=[];reorderLayers.set(parentLayerArr, +arr)}arr.push({layer,siblingIndex});layer._LoadFromJson(layerData)}for(const [parentLayerArr,reorderArr]of reorderLayers){reorderArr.sort((a,b)=>a.siblingIndex-b.siblingIndex);for(const r of reorderArr){const layer=r.layer;const siblingIndex=r.siblingIndex;let i=parentLayerArr.indexOf(layer);parentLayerArr.splice(i,1);parentLayerArr.splice(siblingIndex,0,layer)}}}this._ReindexLayers();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.layout= +this.GetILayout();const runtime=this._runtime;const shouldTime=runtime.IsDebug()&&!runtime.GetEventSheetManager().IsInEventEngine();if(shouldTime)C3Debugger.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);if(shouldTime)C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}_LogLayerTree(){this._LogLayerList(this._rootLayers)}_LogLayerList(layersArr,indent=0){const layersRev=layersArr.slice(0); +layersRev.reverse();for(const layer of layersRev){console.log(`${"\t".repeat(indent)}- ${layer.GetName()}`);this._LogLayerList(layer.GetSubLayers(),indent+1)}}}; + +} + +// layouts/layoutManager.js +{ +'use strict';const C3=self.C3; +C3.LayoutManager=class LayoutManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._runtime=null;this._mainRunningLayout=null;this._firstLayout=null;this._pendingChangeLayout=null;C3.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear(); +C3.clearArray(this._runningSubLayouts)}Create(layoutData){const layout=C3.New(C3.Layout,this,this._allLayouts.length,layoutData);this._allLayouts.push(layout);this._layoutsByName.set(layout.GetName().toLowerCase(),layout);this._layoutsBySid.set(layout.GetSID(),layout)}GetRuntime(){return this._runtime}SetFirstLayout(layout){this._firstLayout=layout}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw new Error("no first layout"); +}GetLayoutByName(name){return this._layoutsByName.get(name.toLowerCase())||null}GetLayoutBySID(sid){return this._layoutsBySid.get(sid)||null}GetLayoutByIndex(index){index=C3.clamp(Math.floor(index),0,this._allLayouts.length-1);return this._allLayouts[index]}GetLayout(p){if(typeof p==="number")return this.GetLayoutByIndex(p);else return this.GetLayoutByName(p.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(layout){this._mainRunningLayout=layout}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(layout){if(this._runningSubLayouts.includes(layout))throw new Error("layout already running"); +this._runningSubLayouts.push(layout)}_RemoveRunningSubLayout(layout){const i=this._runningSubLayouts.indexOf(layout);if(i===-1)throw new Error("layout not running");this._runningSubLayouts.splice(i,1)}*runningLayouts(){if(this._mainRunningLayout)yield this._mainRunningLayout;if(this._runningSubLayouts.length)yield*this._runningSubLayouts}IsLayoutRunning(layout){return this._mainRunningLayout===layout||this._runningSubLayouts.includes(layout)}SetIsEndingLayout(e){if(e)this._isEndingLayout++;else{if(this._isEndingLayout<= +0)throw new Error("already unset");this._isEndingLayout--}}IsEndingLayout(){return this._isEndingLayout>0}ChangeMainLayout(layout){this._pendingChangeLayout=layout}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const runningLayout=this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const runningLayout= +this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersMVChanged()}}; + +} + +// timelines/timelineManager.js +{ +'use strict';const C3=self.C3;const NAMES_REGEXP=new RegExp("<(.+?)>","g"); +C3.TimelineManager=class TimelineManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._timelineDataManager=C3.New(C3.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];this._hasRuntimeListeners=false;this._changingLayout=false;this._isTickingTimelines= +false;this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance);this._beforeLoad=e=>this._OnBeforeLoad();this._afterLoad=e=>this._OnAfterLoad();this._afterLayoutStart=e=>this._OnAfterLayoutStart();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._tickFunc=null;this._tick2Func= +null;this._beforeLayoutChange=null;this._layoutChange=null;this._instanceDestroy=null;this._afterLoad=null;for(const timeline of this._timelines){timeline.Stop();timeline.Release()}C3.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;C3.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;C3.clearArray(this._playingTimelines);this._playingTimelines=null;C3.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines= +null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;C3.clearArray(this._destroyedWhileLoadingState);this._destroyedWhileLoadingState=null;this._runtime=null}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("pretick",this._tickFunc);dispatcher.addEventListener("tick2",this._tick2Func);dispatcher.addEventListener("beforelayoutchange", +this._beforeLayoutChange);dispatcher.addEventListener("layoutchange",this._layoutChange);dispatcher.addEventListener("instancedestroy",this._instanceDestroy);dispatcher.addEventListener("beforeload",this._beforeLoad);dispatcher.addEventListener("afterload",this._afterLoad);dispatcher.addEventListener("afterlayoutstart",this._afterLayoutStart)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("pretick",this._tickFunc);dispatcher.removeEventListener("tick2", +this._tick2Func);dispatcher.removeEventListener("beforelayoutchange",this._beforeLayoutChange);dispatcher.removeEventListener("layoutchange",this._layoutChange);dispatcher.removeEventListener("instancedestroy",this._instanceDestroy);dispatcher.removeEventListener("beforeload",this._beforeLoad);dispatcher.removeEventListener("afterload",this._afterLoad);dispatcher.removeEventListener("afterlayoutstart",this._afterLayoutStart)}Create(timelineData){this._timelineDataManager.Add(timelineData);const timeline= +C3.TimelineState.CreateInitial(timelineData,this);this.Add(timeline);this.SetTimelineObjectClassesToMap(timeline);this._timelinesCreatedByTemplate.set(timeline.GetName(),0)}CreateFromTemplate(template){const timelineDataManager=this.GetTimelineDataManager();const templateName=template.GetTemplateName();const timelineDataItem=timelineDataManager.Get(templateName);const timeline=C3.TimelineState.CreateFromTemplate(`${templateName}:${this._timelinesCreatedByTemplate.get(templateName)}`,timelineDataItem, +this);this._IncreaseTemplateTimelinesCount(templateName);this.Add(timeline);return timeline}_IncreaseTemplateTimelinesCount(templateName){this._timelinesCreatedByTemplate.set(templateName,this._timelinesCreatedByTemplate.get(templateName)+1)}_SetCreatedTemplateTimelinesCount(){for(const timeline of this._timelines){if(timeline.IsTemplate())continue;const templateName=timeline.GetTemplateName();this._IncreaseTemplateTimelinesCount(templateName)}}_ClearCreatedTemplateTimelinesCount(){for(const templateName of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(templateName, +0)}Add(timeline){this._timelines.push(timeline);this._timelinesByName.set(timeline.GetName().toLowerCase(),timeline)}Remove(timeline){timeline.Removed();if(timeline.IsTemplate())return;C3.arrayFindRemove(this._timelines,timeline);C3.arrayFindRemove(this._scheduledTimelines,timeline);C3.arrayFindRemove(this._playingTimelines,timeline);C3.arrayFindRemove(this._markedForRemovalTimelines,timeline);this._timelinesByName.delete(timeline.GetName().toLowerCase());this.RemoveTimelineFromObjectClassMap(timeline); +if(!timeline.IsReleased())timeline.Release()}Trigger(method){this._runtime.Trigger(method,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(inst){this._pluginInstance=inst}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const timeline of this._timelines)yield timeline}*GetPlayingTimelines(){for(const timeline of this._playingTimelines)yield timeline}SetTimelineObjectClassToMap(objectClass,timeline){if(!this._objectClassToTimelineMap.has(objectClass))this._objectClassToTimelineMap.set(objectClass, +new Set);this._objectClassToTimelineMap.get(objectClass).add(timeline)}SetTimelineObjectClassesToMap(timeline){for(const objectClass of timeline.GetObjectClasses())this.SetTimelineObjectClassToMap(objectClass,timeline)}RemoveTimelineFromObjectClassMap(timeline){for(const [objectClass,timelines]of this._objectClassToTimelineMap.entries())if(timelines.has(timeline)){timelines.delete(timeline);if(timelines.size===0)this._objectClassToTimelineMap.delete(objectClass)}}GetTimelinesForObjectClass(objectClass){if(!this._objectClassToTimelineMap.has(objectClass))return; +return this._objectClassToTimelineMap.get(objectClass)}GetTimelineOfTemplateForInstances(templateTimeline,instancesObject){if(!instancesObject)return;for(const timeline of this._timelines){const found=instancesObject.every(io=>{return timeline.HasTrackInstance(io.instance,io.trackId)});if(found)if(timeline.GetName().includes(templateTimeline.GetName()))return timeline}}GetTimelineByName(name){return this._timelinesByName.get(name.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(name){for(const timeline of this._scheduledTimelines)if(timeline.GetName()=== +name)return timeline;for(const timeline of this._playingTimelines)if(timeline.GetName()===name)return timeline;return null}*GetTimelinesByName(name){if(NAMES_REGEXP.test(name)){NAMES_REGEXP.lastIndex=0;let match;const uniqueNames=new Set;do{match=NAMES_REGEXP.exec(name);if(match){const names=match[1].split(",");for(const name of names)uniqueNames.add(name)}}while(match);for(const name of uniqueNames.values()){const timeline=this.GetTimelineByName(name);if(timeline)yield timeline}uniqueNames.clear()}else{const timeline= +this.GetTimelineByName(name);if(timeline)yield timeline}}*GetTimelinesByTags(tags){for(const timeline of this._timelines)if(timeline.HasTags(tags))yield timeline}AddScheduledTimeline(timeline){if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline);this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(timeline){C3.arrayFindRemove(this._playingTimelines,timeline);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(timeline){if(this._playingTimelines.includes(timeline)){timeline.SetPlaying(true); +timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false)}else{timeline.SetPlaying(false);timeline.SetScheduled(true);timeline.SetMarkedForRemoval(false);if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline)}this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.ResolvePlayPromise();C3.arrayFindRemove(this._scheduledTimelines,timeline);this._MaybeDisableRuntimeListeners()}CompleteTimeline(timeline){timeline.SetPlaying(false); +timeline.SetScheduled(false);if(this._playingTimelines.includes(timeline)){timeline.SetMarkedForRemoval(true);this._markedForRemovalTimelines.push(timeline);C3.arrayFindRemove(this._playingTimelines,timeline)}}CompleteTimelineBeforeChangeOfLayout(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false);timeline.SetPlaybackRate(1);C3.arrayFindRemove(this._playingTimelines,timeline)}CompleteTimelineAndResolve(timeline){this.CompleteTimeline(timeline);timeline.ResolvePlayPromise()}_OnTick(){if(this.GetRuntime().IsLoadingState())return; +if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;this._isTickingTimelines=true;while(this._scheduledTimelines.length){const t=this._scheduledTimelines.pop();t.SetInitialState();if(t.GetRenderChange()!==0)this._renderChange=1;this._playingTimelines.push(t)}const dt=this._runtime._GetDtFast();const dt1=this._runtime.GetDt1();const ts=this._runtime.GetTimeScale();for(let i=this._playingTimelines.length-1;i>=0;i--){const t=this._playingTimelines[i];if(t)t.Tick(dt,ts,dt1)}this._isTickingTimelines= +false;if(this._renderChange!==0)this.GetRuntime().UpdateRender()}_OnTick2(){if(this.GetRuntime().IsLoadingState())return;if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;let timelinesToRemove;for(let i=0,l=this._markedForRemovalTimelines.length;it)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}for(const timeline of this._playingTimelines.map(t=> +t)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}}_OnAfterLoad(){for(const destroyedInstance of this._destroyedWhileLoadingState)this._OnInstanceDestroy(destroyedInstance);C3.clearArray(this._destroyedWhileLoadingState)}_OnAfterLayoutStart(){const layoutManager=this._runtime.GetLayoutManager();const runningLayout=layoutManager.GetMainRunningLayout();if(!runningLayout)return;for(const timeline of this._timelines){const startOnLayout=timeline.GetStartOnLayout();if(!startOnLayout)continue; +if(runningLayout.GetName()===startOnLayout)this.ScheduleTimeline(timeline)}}_SaveToJson(){return{"timelinesJson":this._SaveTimelinesToJson(),"scheduledTimelinesJson":this._SaveScheduledTimelinesToJson(),"playingTimelinesJson":this._SavePlayingTimelinesToJson(),"markedForRemovalTimelinesJson":this._SaveMarkedForRemovalTimelinesToJson(),"hasRuntimeListeners":this._hasRuntimeListeners,"changingLayout":this._changingLayout,"isTickingTimelines":this._isTickingTimelines}}_LoadFromJson(o){if(!o)return;this._ClearCreatedTemplateTimelinesCount(); +this._LoadTimelinesFromJson(o["timelinesJson"]);this._LoadScheduledTimelinesFromJson(o["scheduledTimelinesJson"]);this._LoadPlayingTimelinesFromJson(o["playingTimelinesJson"]);this._LoadMarkedForRemovalTimelinesFromJson(o["markedForRemovalTimelinesJson"]);this._hasRuntimeListeners=!o["hasRuntimeListeners"];this._changingLayout=!!o["changingLayout"];this._isTickingTimelines=!!o["isTickingTimelines"];this._SetCreatedTemplateTimelinesCount();this._MaybeEnableRuntimeListeners();this._MaybeDisableRuntimeListeners()}_SaveTimelinesToJson(){return this._timelines.map(timelineState=> +timelineState._SaveToJson())}_LoadTimelinesFromJson(timelinesJson){for(const timelineJson of timelinesJson){let timeline=this.GetTimelineByName(timelineJson["name"]);if(timeline)timeline._LoadFromJson(timelineJson);else{const templateName=this._GetTemplateNameFromJson(timelineJson);if(!templateName)continue;const templateTimeline=this.GetTimelineByName(templateName);timeline=this.CreateFromTemplate(templateTimeline);timeline._LoadFromJson(timelineJson)}if(!timeline.HasTracks())this.Remove(timeline)}}_GetTemplateNameFromJson(timelineJson){const name= +timelineJson["name"];const nameParts=name.split(":");if(!nameParts||nameParts.length!==2)return null;return nameParts[0]}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(scheduledTimelinesJson){this._LoadTimelines(scheduledTimelinesJson,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(playingTimelinesJson){this._LoadTimelines(playingTimelinesJson, +this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(markedForRemovalTimelinesJson){this._LoadTimelines(markedForRemovalTimelinesJson,this._markedForRemovalTimelines)}_IsTimelineInJson(timeline,json){if(!json)return false;for(const name of json)if(name===timeline.GetName())return true;return false}_SaveTimelines(collection){return collection.map(t=>t.GetName())}_LoadTimelines(timelinesJson, +collection){const timelinesToRemove=new Set;for(const timeline of collection)if(!this._IsTimelineInJson(timeline,timelinesJson))timelinesToRemove.add(timeline);C3.arrayRemoveAllInSet(collection,timelinesToRemove);if(timelinesJson){const ff=tn=>t=>t.GetName()===tn;for(const name of timelinesJson){const timeline=this.GetTimelineByName(name);if(timeline){const t=collection.find(ff(name));if(!t)collection.push(timeline)}}}}}; + +} + +// timelines/timelineInfo.js +{ +'use strict';const C3=self.C3;const STEPS=100;const LENGTH_STEP_SIZE=.01;const BEZIER_STEP_SIZE=30;const TANGENT_RESULT=[0,0];const MAP_RESULT=[0,0];const PROJECTION_RESULT=[0,0,0,0,0]; +C3.TimelineInfo=class TimelineInfo{constructor(timeline,trackId){this._initialized=false;this._timeline=timeline;this._segments=[];let trackState=null;if(trackId)trackState=this._timeline.GetTrackById(trackId);else trackState=C3.first(this._timeline.GetTracks());if(!trackState)return;const xTrack=trackState.GetPropertyTrack("offsetX");const yTrack=trackState.GetPropertyTrack("offsetY");if(!xTrack||!yTrack)return;this._xTrack=xTrack;this._yTrack=yTrack;const xPropertyKeyframes=xTrack.GetPropertyKeyframeDataItemArrayIncludingDisabled(); +const yPropertyKeyframes=yTrack.GetPropertyKeyframeDataItemArrayIncludingDisabled();for(let i=1,len=Math.min(xPropertyKeyframes.length,yPropertyKeyframes.length);if[3]-s[3]);return ret[0]}Tangent(t,segmentIndex){return this._segments[segmentIndex].Tangent(t)}TangentAngle(x,y,t,segmentIndex){return this._segments[segmentIndex].TangentAngle(x,y,t)}}; +C3.TimelineCubicBezierSegmentInfo=class TimelineCubicBezierSegmentInfo{constructor(startX,startY,endX,endY,index){this._index=index;const startXAddon=startX.GetAddOn("cubic-bezier");const endXAddon=endX.GetAddOn("cubic-bezier");const startYAddon=startY.GetAddOn("cubic-bezier");const endYAddon=endY.GetAddOn("cubic-bezier");this._aX=startX.GetValueWithResultMode();this._aY=startY.GetValueWithResultMode();this._bX=startX.GetValueWithResultMode()+startXAddon.GetStartAnchor();this._bY=startY.GetValueWithResultMode()+ +startYAddon.GetStartAnchor();this._cX=endX.GetValueWithResultMode()+endXAddon.GetEndAnchor();this._cY=endY.GetValueWithResultMode()+endYAddon.GetEndAnchor();this._dX=endX.GetValueWithResultMode();this._dY=endY.GetValueWithResultMode();this._initialized=false;this._len=STEPS;this._arcLengths=new Array(this._len+1);this._arcLengths[0]=0;this._length=0;this._lut=[];this._CalculateLength()}Release(){C3.clearArray(this._arcLengths);this._arcLengths=null;C3.clearArray(this._lut);this._lut=null}GetType(){return"cubic-bezier"}GetIndex(){return this._index}GetStepCount(){return Math.floor(this._length/ +BEZIER_STEP_SIZE)}GetStepIncrement(){return 1/this.GetStepCount()}SetOrigin(ox,oy){this._originX=ox;this._originY=oy;this._arcLengths=new Array(this._len+1);this._arcLengths[0]=0;this._CalculateLength()}Map(u){if(!this._initialized)return NaN;const mt=this._Map(u);MAP_RESULT[0]=this._X(mt);MAP_RESULT[1]=this._Y(mt);return MAP_RESULT}Project(x,y,tRange){const lut=this._GenerateLUT(STEPS);const i=this._FindClosestFromLUT(x,y,lut,tRange);const p=this._RefineProjection(x,y,lut,i);PROJECTION_RESULT[0]= +p.x;PROJECTION_RESULT[1]=p.y;PROJECTION_RESULT[2]=p.t;PROJECTION_RESULT[3]=p.distance;return PROJECTION_RESULT}Tangent(t){const mt=1-t;const a=mt*mt;const b=2*mt*t;const c=t*t;const d0x=3*(this._bX+this._originX-(this._aX+this._originX));const d0y=3*(this._bY+this._originY-(this._aY+this._originY));const d1x=3*(this._cX+this._originX-(this._bX+this._originX));const d1y=3*(this._cY+this._originY-(this._bY+this._originY));const d2x=3*(this._dX+this._originX-(this._cX+this._originX));const d2y=3*(this._dY+ +this._originY-(this._cY+this._originY));const dx=a*d0x+b*d1x+c*d2x;const dy=a*d0y+b*d1y+c*d2y;const m=Math.hypot(dx,dy);TANGENT_RESULT[0]=dx/m;TANGENT_RESULT[1]=dy/m;return TANGENT_RESULT}TangentAngle(x,y,t){const tanget=this.Tangent(t);const angle=C3.angleTo(x,y,x+tanget[0],y+tanget[1]);return angle}_Map(u){if(!this._initialized)return;let targetLength=u*this._arcLengths[this._len];let low=0;let high=this._len;let index=0;while(lowtargetLength)index--;const lengthBefore=this._arcLengths[index];if(lengthBefore===targetLength)return index/this._len;else return(index+(targetLength-lengthBefore)/(this._arcLengths[index+1]-lengthBefore))/this._len}_X(t){if(!this._initialized)return NaN;return self.Ease.GetRuntimeEase("cubicbezier")(t,this._aX+this._originX,this._bX+this._originX,this._cX+this._originX,this._dX+this._originX)}_Y(t){if(!this._initialized)return NaN;return self.Ease.GetRuntimeEase("cubicbezier")(t, +this._aY+this._originY,this._bY+this._originY,this._cY+this._originY,this._dY+this._originY)}_GenerateLUT(steps){steps=steps||STEPS;if(this._lut.length===steps)return this._lut;this._lut=[];steps++;for(let i=0;i{p.t=index/(LUT.length-1);p.distance=C3.distanceTo(x,y,p.x, +p.y);if(tRange&&C3.IsArray(tRange)&&C3.IsFiniteNumber(tRange[0])&&C3.IsFiniteNumber(tRange[1])){if(p.t>=tRange[0]&&p.t<=tRange[1])if(p.distanceepsilon)q=null;return q}_CalculateLength(){this._initialized=true;let ox=this._X(0);let oy= +this._Y(0);let clen=0;for(let i=1;i<=this._len;i++){const x=this._X(i*LENGTH_STEP_SIZE);const y=this._Y(i*LENGTH_STEP_SIZE);const dx=ox-x;const dy=oy-y;clen+=Math.hypot(dx,dy);this._arcLengths[i]=clen;ox=x;oy=y}this._length=clen}}; +C3.TimelineLineSegmentInfo=class TimelineLineSegmentInfo{constructor(startX,startY,index){this._index=index;this._targetX=startX.GetValueWithResultMode();this._targetY=startY.GetValueWithResultMode();this._originX=0;this._originY=0}Release(){}GetType(){return"line"}GetIndex(){return this._index}SetOrigin(ox,oy){this._originX=ox;this._originY=oy}GetX(){return this._targetX+this._originX}GetY(){return this._targetY+this._originY}}; + +} + +// timelines/state/timelineState.js +{ +'use strict';const C3=self.C3;const PING_PONG_BEGIN=0;const PING_PONG_END=1; +C3.TimelineState=class Timeline extends C3.DefendedBase{constructor(name,timelineDataItem,timelineManager){super();this._runtime=timelineManager.GetRuntime();this._timelineManager=timelineManager;this._timelineDataItem=timelineDataItem;this._name=name;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playPromise=null;this._playResolve=null;this._playheadTime=0;this._playbackRate=1;this._pingPongState=PING_PONG_BEGIN; +this._currentRepeatCount=1;this._isPlaying=false;this._isScheduled=false;this._initialStateSet=false;this._complete=true;this._released=false;this._markedForRemoval=false;this._completedTick=-1;this._implicitPause=false;this._isTemplate=false;this._finishedTriggers=false;this._firstTick=false;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=false;this._renderChange=0;this._hasNestedContent=0;this._iTimelineState=null}static CreateInitial(timelineDataJson,timelineManager){const timelineDataManager= +timelineManager.GetTimelineDataManager();const nameId=timelineDataManager.GetNameId();const timelineDataItem=timelineDataManager.Get(timelineDataJson[nameId]);const timeline=C3.New(C3.TimelineState,timelineDataJson[nameId],timelineDataItem,timelineManager);timeline.SetIsTemplate(true);return timeline}static CreateFromTemplate(name,timelineDataItem,timelineManager){return C3.New(C3.TimelineState,name,timelineDataItem,timelineManager)}Release(){if(this.IsReleased())return;const dispatcher=this._runtime.Dispatcher(); +this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const track of this._tracks)track.Release();C3.clearArray(this._tracks);this._tracks=null;this._runtime=null;this._timelineManager=null;this._timelineDataItem=null;this._released=true;this._playPromise=null;this._playResolve=null;this.FireReleaseEvent(dispatcher)}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"timelinestatereleased");event.timelineState=this;dispatcher.dispatchEvent(event)}GetType(){return 0}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength= +this._tracks.push(C3.TrackState.Create(this,trackDataItem))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(instance,sourceAdapter,propertyName,propertyTrack){if(!this._hasNestedContent)return;let ret;for(let i=0;i0}GetPlayPromise(){if(this._playPromise)return this._playPromise;this._playPromise=new Promise(resolve=>{this._playResolve=resolve});return this._playPromise}ResolvePlayPromise(){if(!this._playPromise)return; +this._playResolve();this._playPromise=null;this._playResolve=null}SetTags(tags){this._tags=C3.TimelineState._GetTagArray(tags);this._tagsChanged=true}GetTags(){return this._tags}GetStringTags(){if(this._tagsChanged)this._stringTags=this._tags.join(" ");this._tagsChanged=false;return this._stringTags}HasTags(tags){if(!this._tags)return false;if(!this._tags.length)return false;const t=C3.TimelineState._GetTagArray(tags);if(!t)return false;if(!t.length)return false;return t.every(C3.TimelineState._HasTag, +this)}OnStarted(){if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineStarted);C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}OnCompleted(){this._completedTick= +this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return;this._finishedTriggers=true;if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinished);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineFinished); +C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}SetPlaying(p){this._isPlaying=p}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(playingOnly=false){if(this.IsCompletedTick())return true;if(this.IsScheduled()&&!playingOnly)return true;return this._isPlaying}_IsPlaying(){return this.IsPlaying(true)}IsPaused(){return this._IsPaused()}_IsPaused(){if(this.IsReleased())return false;if(this.IsScheduled())return false;if(this._IsPlaying())return false;if(this.IsComplete())return false; +return true}SetScheduled(s){this._isScheduled=s}IsScheduled(){return this._isScheduled}SetComplete(c){this._complete=c;const t=this.GetTime();if(t<=0||t>=this.GetTotalTime())this._complete=true}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(mfr){this._markedForRemoval=mfr}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(ip){this._implicitPause=ip}IsImplicitPause(){return this._implicitPause}SetIsTemplate(it){this._isTemplate=!!it}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime}SetTime(time){const lastGlobalTime= +this.GetTime();this._SetTime(time);this.SetComplete(false);if(!this.IsComplete())this.SetImplicitPause(true);if(!this._IsPlaying()&&!this.IsScheduled()&&this._initialStateSet);else if(!this._IsPlaying()&&!this.IsScheduled()&&!this._initialStateSet)this.SetInitialStateFromSetTime();else if(this._IsPlaying())this.Stop();else if(this.IsScheduled()){this._timelineManager.DeScheduleTimeline(this);this.SetInitialStateFromSetTime()}this._SetUpdateStateBefore();this._Interpolate(this.GetTime(),false,true, +true,lastGlobalTime);this._SetUpdateStateAfter();if(this._renderChange)this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime(); +else this._playheadTime=time;for(const track of this._tracks)track.SetResetState()}_OnSetTime(){if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSet);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByTags);C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}_CanResume(){if(this.GetLoop())return true; +else if(this.GetPingPong()&&this._pingPongState===PING_PONG_END)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else{if(this.GetTime()<=0)return false}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else if(this.GetTime()<=0)return false;return true}Resume(){if(this.IsReleased())return;if(this._CanResume())this.Play(true)}Play(resume=false){if(this.IsReleased())return false;if(this.IsScheduled())return false; +if(this._IsPlaying()&&this.IsCompletedTick())return this._SchedulePlayingTimeline();if(this._IsPlaying())return false;if(!this.IsComplete()&&!resume&&!this.IsImplicitPause())return false;return this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(false);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return true}_ScheduleStoppedTimeline(){this.SetImplicitPause(false);this._timelineManager.ScheduleTimeline(this); +this.GetPlayPromise();return true}Stop(completed=false){if(this.IsReleased())return;this.SetComplete(completed);this._timelineManager.CompleteTimeline(this);if(this.IsComplete())this.ResolvePlayPromise()}Reset(render=true,beforeChangeLayout=false){if(this.IsReleased())return;if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(this.IsComplete())return;this.Stop(true);if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime()); +const time=this.GetTime();this._SetUpdateStateBefore();if(beforeChangeLayout)this._InterpolateBeforeChangeLayout(time);else this._Interpolate(time,false,false,true);if(render)this._OnSetTime();this._SetUpdateStateAfter();if(this._renderChange&&render)this.GetRuntime().UpdateRender()}ResetBeforeChangeLayout(){this.Reset(false,true)}_InterpolateBeforeChangeLayout(time){this._Interpolate(time,false,false,true,NaN,false,true)}_OnBeforeChangeLayout(){if(this.IsReleased())return true;if(!this.GetRuntime().IsLoadingState())if(this.HasValidGlobalTracks())return false; +this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);if(!this.GetRuntime().IsLoadingState())this.ResetBeforeChangeLayout();return true}SetInitialStateFromSetTime(){this.SetInitialState(true)}SetInitialState(fromSetTime){if(this.IsMarkedForRemoval())return;if(fromSetTime){this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState();this._SetUpdateStateAfter()}else{this.SetPlaying(true); +this.SetScheduled(false);this.OnStarted();if(this.IsComplete()){this._completedTick=-1;if(this._pingPongState!==PING_PONG_BEGIN)this._playbackRate=Math.abs(this._playbackRate);this._pingPongState=PING_PONG_BEGIN;this._currentRepeatCount=1;this._complete=false;this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime());this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState(); +this._SetUpdateStateAfter()}else{this._firstTick=true;this._finishedTriggers=false;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetResumeState();this._SetUpdateStateAfter()}}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=0;for(const track of this._tracks)if(track.IsNested())this._hasNestedContent=1}_SetUpdateStateAfter(){this._renderChange=0;for(const track of this._tracks){track._SetUpdateState();if(this._renderChange===0&&track.GetRenderChange()=== +1)this._renderChange=1;if(!this._beforeAndAfterTracks&&track.GetNeedsBeforeAndAfter()===1){if(!this._beforeAndAfterTracks)this._beforeAndAfterTracks=[];this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(track)}}}Tick(deltaTime,timeScale,deltaTime1){if(this.GetUseSystemTimescale()){if(deltaTime===0&&this._lastDelta===0)return;this._lastDelta=deltaTime}else{if(deltaTime1===0&&this._lastDelta===0)return;this._lastDelta=deltaTime1;deltaTime=deltaTime1;timeScale=1}const lastTime=this._playheadTime; +const newDeltaTime=deltaTime*timeScale*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime;if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<=0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&& +pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<= +0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}let i;const l=this._tracksLength;if(complete){for(i=0;i0){if(startOffset<0)this._playheadTime=0;else if(startOffset>=totalTime)this._playheadTime=totalTime;else this._playheadTime=startOffset;track.Interpolate(startOffset,true,false,ensureValue,this._firstTick,false)}else track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false)}else for(i=0;i0){t=track.GetStartOffset();this._SetTime(t)}}track.Interpolate(t,isTicking,setTime,ensureValue,this._firstTick,ignoreGlobals)}for(const track of this._tracks)track.AfterInterpolate();if(this._firstTick&&onTickCall)this._firstTick=false}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TrackState.Create(this,trackDataItem);this._tracksLength=this._tracks.push(track);return track}Removed(){if(this.IsReleased())return; +for(const track of this._tracks)track.TimelineRemoved()}CleanCaches(){for(const track of this._tracks)track.CleanCaches()}ClearTrackInstances(){for(const track of this._tracks)track.ClearInstance()}SetTrackInstance(trackId,instance){if(!instance)return;for(const track of this._tracks){if(!track.IsInstanceTrack())continue;if(trackId){if(track.GetId()!==trackId)continue;track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}else{if(track.HasInstance())continue; +track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}}}HasTrackInstance(instance,trackId){for(const track of this._tracks){if(!track.IsInstanceTrack())continue;if(trackId){if(trackId===track.GetId()&&instance===track.GetInstance())return true}else if(instance===track.GetInstance())return true}return false}HasValidTracks(){return this._tracks.some(t=>{if(t.IsInstanceTrack())return t.CanInstanceBeValid();else return true})}HasValidGlobalTracks(){return this._tracks.some(t=> +{if(t.IsInstanceTrack()){if(!t.CanInstanceBeValid())return false;const objectClass=t.GetObjectClass();if(!objectClass)return false;return objectClass.IsGlobal()}else return false})}GetPropertyTrack(propertyName){for(const track of this.GetTracks())for(const propertyTrack of track.GetPropertyTracks())if(propertyTrack.GetPropertyName()===propertyName)return propertyTrack}GetTrackFromInstance(instance){for(const track of this._tracks)if(instance===track.GetInstance())return track;return null}GetKeyframeWithTags(tags){let tagsArray= +tags?tags.split(" "):[];const tagsSet=new Set(tagsArray.map(t=>t.toLowerCase().trim()));tagsArray=[...tagsSet.values()];for(const track of this.GetTracks())for(const keyframeDataItem of track.GetKeyframeDataItems()){const hasAllTags=tagsArray.every(t=>keyframeDataItem.HasTag(t));if(hasAllTags)return keyframeDataItem}}GetObjectClasses(){const ret=[];for(const track of this.GetTracks())ret.push(track.GetObjectClass());return ret.filter(oc=>oc)}_SaveToJson(){return{"tracksJson":this._SaveTracksToJson(), +"name":this._name,"playheadTime":this.GetTime(),"playbackRate":this._playbackRate,"pingPongState":this._pingPongState,"currentRepeatCount":this._currentRepeatCount,"isPlaying":this._isPlaying,"isScheduled":this._isScheduled,"initialStateSet":this._initialStateSet,"finishedTriggers":this._finishedTriggers,"complete":this._complete,"released":this._released,"markedForRemoval":this._markedForRemoval,"completedTick":this._completedTick,"implicitPause":this._implicitPause,"isTemplate":this._isTemplate, +"tags":this._tags.join(" "),"stringTags":this._stringTags,"tagsChanged":this._tagsChanged,"firstTick":this._firstTick}}_LoadFromJson(o){if(!o)return;this._LoadTracksFromJson(o["tracksJson"]);this._name=o["name"];this._playheadTime=o["playheadTime"];this._playbackRate=o["playbackRate"];this._pingPongState=o["pingPongState"];this._currentRepeatCount=o["currentRepeatCount"];this._isPlaying=!!o["isPlaying"];this._isScheduled=!!o["isScheduled"];this._initialStateSet=!!o["initialStateSet"];this._finishedTriggers= +o.hasOwnProperty("finishedTriggers")?!!o["finishedTriggers"]:false;this._complete=!!o["complete"];this._released=!!o["released"];this._markedForRemoval=!!o["markedForRemoval"];this._completedTick=o["completedTick"];this._implicitPause=!!o["implicitPause"];this._isTemplate=!!o["isTemplate"];this._tags=o["tags"].split(" ");this._stringTags=o["stringTags"];this._tagsChanged=!!o["tagsChanged"];this._firstTick=!!o["firstTick"]}_SaveTracksToJson(){return this._tracks.map(trackState=>trackState._SaveToJson())}_LoadTracksFromJson(tracksJson){this.ClearTrackInstances(); +tracksJson.forEach((trackJson,i)=>{const track=this._tracks[i];track._LoadFromJson(trackJson)});this._tracks.filter(track=>track.CanInstanceBeValid())}static _HasTag(tag){const tags=this.GetTags();if(tag==="")return tags.length===1&&tags[0]==="";return tags.map(t=>t.toLowerCase()).includes(tag.toLowerCase())}static _GetTagArray(tags){if(C3.IsArray(tags))return tags.slice(0);if(C3.IsString(tags))return tags.split(" ");throw new Error("invalid tags");}GetITimelineState(){if(!this._iTimelineState)this._iTimelineState= +C3.New(self.ITimelineState,this);return this._iTimelineState}}; + +} + +// timelines/state/trackState.js +{ +'use strict';const C3=self.C3;const INSTANCE_TRACK=0;const VALUE_TRACK=1;const AUDIO_TRACK=2; +C3.TrackState=class Track extends C3.DefendedBase{constructor(timeline,trackDataItem){super();this._timeline=timeline;this._trackDataItem=trackDataItem;this._trackData=trackDataItem.GetTrackData();this._instanceUid=NaN;this._objectClassIndex=NaN;this._instance=null;this._worldInfo=null;this._isNested=trackDataItem.GetStartOffset()>0;this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray(); +this._propertyTracks=[];this.CreatePropertyTrackStates();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0}static Create(timeline,trackDataItem){return C3.New(C3.TrackState,timeline,trackDataItem)}Release(){this._keyframeDataItems=null;for(const propertyTrack of this._propertyTracks)propertyTrack.Release();C3.clearArray(this._propertyTracks);this._propertyTracks=null;this._timeline=null;this._instance=null;this._worldInfo=null;this._trackDataItem=null;this._lastKeyframeDataItem= +null}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.PropertyTrackState.Create(this,propertyTrackDataItem))}TimelineRemoved(){for(const propertyTrack of this._propertyTracks)propertyTrack.TimelineRemoved()}CleanCaches(){for(const propertyTrack of this._propertyTracks)propertyTrack.CleanCaches();this._instance=null;this._worldInfo=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){if(this._keyframeDataItems)return this._keyframeDataItems; +this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return this._keyframeDataItems}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(propertyName){for(let i=0;ipt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter= +1;this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time);this.OnKeyframeReached(this._GetLastKeyFrameBeforeTime(time))}SetResumeState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const playbackDirection=this._timeline.IsForwardPlayBack();const time=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time); +for(const propertyTrack of this._propertyTracks)propertyTrack.SetResumeState(time)}SetEndState(){if(this.GetTimeline().IsComplete())return;this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;if(!this._isNested){const time=this._timeline.GetTime();const totalTime=this.GetStartOffset()+this.GetLocalTotalTime();if(time>=totalTime)this.Interpolate(this.GetLocalTotalTime(),true,false,true,false,false,true);else if(time<=0)this.Interpolate(0,true,false,true,false,false,true)}}_SetUpdateState(){for(let i= +0,l=this._propertyTracks.length;ithis.GetLocalTotalTime())return;for(const propertyTrack of this._propertyTracks)propertyTrack.SetInitialState();this._initialStateOfNestedSet=true}MaybeSetEndStateOfNestedTrack(time,isTicking){if(!isTicking)return;if(!this._isNested)return;if(this._endStateOfNestedSet)return;const timeline=this.GetTimeline();if(timeline.IsForwardPlayBack()){if(time>=this.GetLocalTotalTime()){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(this.GetLocalTotalTime(), +false,true);this._endStateOfNestedSet=true}}else if(time<=0){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(0,false,true);this._endStateOfNestedSet=true}}MaybeTriggerKeyframeReachedConditions(time,isTicking,firstTick){if(firstTick)return;if(!isTicking)return;if(!C3.Plugins.Timeline)return;const timeline=this.GetTimeline();const nextKeyframe=this._lastKeyframeDataItem.GetNext();const lastTime=this._lastKeyframeDataItem.GetTime();const nextTime=nextKeyframe?nextKeyframe.GetTime(): +timeline.GetTotalTime();if(time<=lastTime||time>=nextTime){this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem);if(timeline.IsForwardPlayBack()){if(nextKeyframe)this.OnKeyframeReached(this._lastKeyframeDataItem)}else{const nextKeyframe=this._lastKeyframeDataItem.GetNext();if(nextKeyframe)this.OnKeyframeReached(nextKeyframe)}}}_GetLastKeyFrameBeforeTime(time){const keyframeDataItem=this._trackData.GetKeyFrameDataItemAtTime(time,this._trackDataItem); +if(keyframeDataItem)return keyframeDataItem;else return this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem)}OnKeyframeReached(keyframeDataItem){if(!C3.Plugins.Timeline)return;const timeline=this.GetTimeline();const timelineManager=timeline.GetTimelineManager();C3.Plugins.Timeline.Cnds.PushTriggerTimeline(timeline);C3.Plugins.Timeline.Cnds.PushTriggerKeyframe(keyframeDataItem);timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyKeyframeReached);timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnKeyframeReached); +C3.Plugins.Timeline.Cnds.PopTriggerTimeline(timeline);C3.Plugins.Timeline.Cnds.PopTriggerKeyframe(keyframeDataItem)}AddKeyframe(){const keyframeData=this._trackDataItem.GetKeyframeData();const keyframeDataItem=keyframeData.AddEmptyKeyframeDataItem();return keyframeDataItem}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData();const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.PropertyTrackState.Create(this,propertyTrackDataItem); +this._propertyTracks.push(propertyTrack);return propertyTrack}DeleteKeyframes(match){const keyframeData=this._trackDataItem.GetKeyframeData();keyframeData.DeleteKeyframeDataItems(match)}DeletePropertyKeyframes(match){for(const propertyTrack of this._propertyTracks)propertyTrack.DeletePropertyKeyframes(match)}SaveState(){for(const propertyTrack of this._propertyTracks)propertyTrack.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return; +for(const propertyTrack of this._propertyTracks)propertyTrack.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;let difference=false;for(const propertyTrack of this._propertyTracks){const diff=propertyTrack.CompareSaveStateWithCurrent();if(!difference&&diff)difference=true}if(difference){const keyframeDataItem=this.AddKeyframe();keyframeDataItem.SetTime(this.GetTimeline().GetTime());keyframeDataItem.SetEase("noease"); +keyframeDataItem.SetEnable(true);keyframeDataItem.SetTags("")}}_SaveToJson(){const instance=this.GetInstance();const uid=instance?instance.GetUID():this.GetInstanceUID();return{"propertyTracksJson":this._SavePropertyTracksToJson(),"lastKeyframeDataItemJson":this._SaveLastKeyframeDataItemToJson(),"initialStateOfNestedSet":this._initialStateOfNestedSet,"endStateOfNestedSet":this._endStateOfNestedSet,"instanceUid":uid}}_LoadFromJson(o){if(!o)return;this._LoadPropertyTracksFromJson(o["propertyTracksJson"]); +this._LoadLastKeyframeDataItemFromJson(o["lastKeyframeDataItemJson"]);this._LoadInstanceFromJson(o["instanceUid"]);this._initialStateOfNestedSet=false;if(o.hasOwnProperty["initialStateOfNestedSet"])this._initialStateOfNestedSet=o["initialStateOfNestedSet"];this._endStateOfNestedSet=false;if(o.hasOwnProperty["endStateOfNestedSet"])this._endStateOfNestedSet=o["endStateOfNestedSet"];for(const propertyTrack of this._propertyTracks){if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange= +1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;if(this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter()))this._needsBeforeAndAfter=1}_SaveLastKeyframeDataItemToJson(){const keyframeData=this._trackDataItem.GetKeyframeData();return keyframeData.GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(propertyTrackState=>propertyTrackState._SaveToJson())}_LoadPropertyTracksFromJson(propertyTracksJson){propertyTracksJson.forEach((propertyTrackJson, +i)=>{const propertyTrack=this._propertyTracks[i];propertyTrack._LoadFromJson(propertyTrackJson)})}_LoadInstanceFromJson(uid){if(!C3.IsFiniteNumber(uid))return;const instance=this.GetRuntime().GetInstanceByUID(uid);if(!instance)return;const timeline=this.GetTimeline();timeline.SetTrackInstance(this._trackDataItem.GetId(),instance)}_LoadLastKeyframeDataItemFromJson(lastKeyframeDataItemIndex){const keyframeData=this._trackDataItem.GetKeyframeData();this._lastKeyframeDataItem=keyframeData.GetKeyframeDataItemFromIndex(lastKeyframeDataItemIndex)}}; + +} + +// timelines/state/propertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState=class PropertyTrack extends C3.DefendedBase{constructor(track,propertyTrackDataItem){super();this._track=track;this._propertyTrackDataItem=propertyTrackDataItem;this._propertyTrackData=propertyTrackDataItem.GetPropertyTrackData();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._lastPropertyKeyframeDataItem= +null;this._absoluteValueObject=null}static Create(track,propertyTrackDataItem){return C3.New(C3.PropertyTrackState,track,propertyTrackDataItem)}Release(){this._track=null;if(this._sourceAdapter){this._sourceAdapter.Release();this._sourceAdapter=null}this._propertyKeyframeDataItems=null;this._propertyTrackDataItem=null;this._propertyTrackData=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(avo){this._absoluteValueObject= +avo}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;const id=this._propertyTrackDataItem.GetSourceAdapterId();let ret;switch(id){case "behavior":ret= +new C3.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":ret=new C3.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":ret=new C3.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":ret=new C3.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":ret=new C3.PropertyTrackState.PropertySourceAdapter(this);this._renderChange=1;this._worldInfoChange=1;break;case "value":ret=new C3.PropertyTrackState.ValueSourceAdapter(this); +break;case "audio":ret=new C3.PropertyTrackState.AudioSourceAdapter(this);break}this._sourceAdapter=ret;return this._sourceAdapter}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(said){this._propertyTrackDataItem.SetSourceAdapterId(said)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(sargs){this._propertyTrackDataItem.SetSourceAdapterArguments(sargs)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(pn){this._propertyTrackDataItem.SetProperty(pn)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(pt){this._propertyTrackDataItem.SetType(pt)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(min){this._propertyTrackDataItem.SetMin(min)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(max){this._propertyTrackDataItem.SetMax(max)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(e){this._propertyTrackDataItem.SetEnable(e)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(im){this._propertyTrackDataItem.SetInterpolationMode(im)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(rm){this._propertyTrackDataItem.SetResultMode(rm)}SetEase(e){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())propertyKeyframeDataItem.SetEase(e)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){if(this._propertyKeyframeDataItems)return this._propertyKeyframeDataItems; +this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();return this._propertyKeyframeDataItems}GetPropertyKeyframeDataItemArrayIncludingDisabled(){return this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArrayIncludingDisabled()}GetPropertyKeyFrameDataItemAtTime(time){return this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time,this._propertyTrackDataItem)}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time){return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem)}GetPropertyKeyframeDataItemPairForTime(time){let start=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time,this._propertyTrackDataItem);let end;if(start)end=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(time,this._propertyTrackDataItem);else{start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);end=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,this._propertyTrackDataItem)}return{start, +end}}*GetPropertyKeyframeValues(){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())yield propertyKeyframeDataItem.GetValueWithResultMode()}*GetPropertyKeyframeTimes(){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())yield propertyKeyframeDataItem.GetTime()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetResetState(){this.GetSourceAdapter().SetResetState()}SetInitialState(time){this.GetSourceAdapter().SetInitialState(); +this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time);this._SetUpdateState()}SetResumeState(time){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time)}_SetUpdateState(){const track=this.GetTrack();this._needsBeforeAndAfter=0;if(track.IsInstanceTrack()){const timeline=this.GetTimeline();const instance=track.GetInstance();const sourceAdapter=this.GetSourceAdapter();const propertyName=this.GetPropertyName(); +const mayNeedBeforeAndAfterInterpolate=sourceAdapter.MayNeedBeforeAndAfterInterpolate();if(mayNeedBeforeAndAfterInterpolate){const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,propertyName,this);if(similarPropertyTracks&&similarPropertyTracks.length)this._needsBeforeAndAfter=1}else this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(time){const timeline=this.GetTimeline();const propertyKeyframeDataItem=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time, +this._propertyTrackDataItem);if(propertyKeyframeDataItem)return propertyKeyframeDataItem;else if(timeline.IsForwardPlayBack())return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(time,setTime=false,ensureValue=false,endState=false){let start;let end; +let propertyKeyframeReached=false;if(setTime)start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime){this._lastPropertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);propertyKeyframeReached=true}}else{this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);propertyKeyframeReached=true}start=this._lastPropertyKeyframeDataItem}if(start)end=start.GetNext();this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time){if(this._lastPropertyKeyframeDataItem){const timeline= +this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem);const start=this._lastPropertyKeyframeDataItem;const end=start.GetNext();return this._sourceAdapter.GetInterpolatedValue(time,start,end)}GetInterpolatedValueFast(time,start,end){return this._sourceAdapter.GetInterpolatedValue(time,start,end)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData; +return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)}static GetEndPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData;return propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem= +propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem=null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){const difference=this.GetSourceAdapter().CompareInitialStateWithCurrent();if(difference){const propertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem);const currentState=this.GetSourceAdapter().GetCurrentState();propertyKeyframeDataItem.SetAbsoluteValue(currentState)}}CompareSaveStateWithCurrent(){const difference=this.GetSourceAdapter().CompareSaveStateWithCurrent();if(difference)this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return difference}AddPropertyKeyframeAtCurrentTime(){const time=this.GetTimeline().GetTime();const sourceAdapter= +this.GetSourceAdapter();const startPropertyKeyframe=C3.PropertyTrackState.GetStartPropertyKeyframeForTime(time,this);const propertyKeyframeDataItem=this.AddPropertyKeyframe();propertyKeyframeDataItem.SetType(startPropertyKeyframe.GetType());propertyKeyframeDataItem.SetTime(time);propertyKeyframeDataItem.SetEase(startPropertyKeyframe.GetEase());propertyKeyframeDataItem.SetEnable(true);propertyKeyframeDataItem.SetValue(sourceAdapter.GetValueAtTime());propertyKeyframeDataItem.SetAbsoluteValue(sourceAdapter.GetCurrentState())}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return; +this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/propertySourceAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +NS.PropertySourceAdapter=class PropertySourceAdapter{constructor(propertyTrack){this._propertyTrack=propertyTrack;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){if(this._propertyAdapter){this._propertyAdapter.Release();this._propertyAdapter=null}this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){if(this._propertyAdapter)this._propertyAdapter.TimelineRemoved()}CleanCaches(){if(this._propertyAdapter)this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;this._propertyAdapter= +this._CreatePropertyAdapter();return this._propertyAdapter}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetResetState(){this.GetPropertyAdapter().SetResetState()}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this._propertyAdapter.BeforeChangeProperty()}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const type=this._propertyTrack.GetPropertyKeyframeType(); +let value;switch(type){case "numeric":{value=NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "angle":{value=NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "boolean":{value=NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "color":{value=NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "text":{value=NS.TextTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}}this._propertyAdapter.ChangeProperty(time, +value,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "angle":return NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "boolean":return NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "color":return NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack); +case "text":return NS.TextTypeAdapter.Interpolate(time,start,end,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const propertyTrack= +this._propertyTrack;const track=propertyTrack.GetTrack();const time=track.GetTimeline().GetTime();const start=NS.GetStartPropertyKeyframeForTime(time,propertyTrack);const end=start.GetNext();const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{return NS.NumericTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "angle":{return NS.AngleTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "boolean":{return NS.BooleanTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "color":{return NS.ColorTypeAdapter.Interpolate(time, +start,end,propertyTrack)}case "text":{return NS.TextTypeAdapter.Interpolate(time,start,end,propertyTrack)}}}_CreatePropertyAdapter(){const pt=this._propertyTrack;const type=pt.CanHavePropertyKeyframes()?pt.GetPropertyKeyframeType():"";switch(type){case "combo":case "boolean":case "text":case "string":{return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this)}case "numeric":case "number":case "angle":{if(this._propertyTrack.GetPropertyType()==="combo")return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this); +return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}case "color":case "offsetColor":{return new NS.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}default:{return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}}_SaveToJson(){return{"propertyAdapterJson":this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return;this.GetPropertyAdapter()._LoadFromJson(o["propertyAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class InstanceVariableSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetIndex(){if(this._updatedIndex)return this._updatedIndex;return super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(index){const i=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX];if(i=== +index)return;this._updatedIndex=index}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;return super.GetInterpolatedValue(time,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"index":this._updatedIndex})}_LoadFromJson(o){if(!o)return; +super._LoadFromJson(o);this._updatedIndex=o["index"]}}C3.PropertyTrackState.InstanceVariableSourceAdapter=InstanceVariableSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/behaviorSourceAdapter.js +{ +'use strict';const C3=self.C3;const SID=0;const INDEX=1;const NAME=2; +class BehaviorSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._sid=NaN}GetEditorIndex(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();return dataItem.GetSourceAdapterArguments()[INDEX]}GetTarget(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const track=this._propertyTrack.GetTrack();const sid=this._sid?this._sid:dataItem.GetSourceAdapterArguments()[SID];const instance=track.GetInstance();const index= +instance.GetBehaviorIndexBySID(sid);const behaviorInstance=instance.GetBehaviorInstances()[index];return behaviorInstance.GetSdkInstance()}GetBehaviorType(objectClass){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const name=dataItem.GetSourceAdapterArguments()[NAME];return objectClass.GetBehaviorTypeByName(name)}UpdateBehaviorTypeSid(sid){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();if(dataItem.GetSourceAdapterArguments()[SID]===sid)return;this._sid=sid}Interpolate(time, +start,end,setTime,ensureValue,endState,propertyKeyframeReached){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;return super.GetInterpolatedValue(time, +start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"sid":this._sid})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._sid=o["sid"]}}C3.PropertyTrackState.BehaviorSourceAdapter=BehaviorSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/effectSourceAdapter.js +{ +'use strict';const C3=self.C3;const NAME=0;const INDEX=1; +class EffectSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList); +const effectIndex=effectType.GetIndex();if(instanceEffectList.IsEffectIndexActive(effectIndex))return instanceEffectList.GetEffectParametersForIndex(effectIndex);return null}GetEffectType(effectList){const pTrack=this._propertyTrack;const name=pTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[NAME];return effectList.GetEffectTypeByName(name)}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this._IsEffectActive())return;super.Interpolate(time,start,end, +setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){if(!this._IsEffectActive())return;return super.GetInterpolatedValue(time,start,end)}_IsEffectActive(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList);if(!effectType)return;const effectIndex=effectType.GetIndex(); +return instanceEffectList.IsEffectIndexActive(effectIndex)}}C3.PropertyTrackState.EffectSourceAdapter=EffectSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/pluginSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class PluginSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin= +track.GetInstance().GetObjectClass().GetPlugin();if(templatePlugin!==currentPlugin)return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin=track.GetInstance().GetObjectClass().GetPlugin();if(templatePlugin!==currentPlugin)return;return super.GetInterpolatedValue(time,start,end)}GetOptionalCallbacks(){const track= +this._propertyTrack.GetTrack();const plugin=track.GetObjectClass().GetPlugin();if(C3.Plugins.Sprite&&plugin instanceof C3.Plugins.Sprite)if(this._propertyTrack.GetPropertyName()==="initial-frame"||this._propertyTrack.GetPropertyName()==="initial-animation")switch(this._propertyTrack.GetResultMode()){case "relative":{return null}case "absolute":{return null}}}}C3.PropertyTrackState.PluginSourceAdapter=PluginSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/valueSourceAdapter.js +{ +'use strict';const C3=self.C3; +class ValueSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._value=0;this._init=false}MayNeedBeforeAndAfterInterpolate(){return false}SetInitialState(){const propertyTrackData=this._propertyTrack.GetPropertyTrackData();let propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();propertyTrackDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem);this._value=propertyTrackDataItem.GetValueWithResultMode()}SetResumeState(){}GetValue(){if(!this._init)this._propertyTrack.Interpolate(0);return this._value}Interpolate(time, +start,end,setTime,ensureValue,endState,propertyKeyframeReached){this._value=C3.PropertyTrackState.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);this._init=true}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return false}CompareSaveStateWithCurrent(){return false}_SaveToJson(){return{"value":this._value,"init":this._init}}_LoadFromJson(o){if(!o)return;this._value=o["value"];this._init=o.hasOwnProperty("init")?o["init"]:true}} +C3.PropertyTrackState.ValueSourceAdapter=ValueSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/audioSourceAdapter.js +{ +'use strict';const C3=self.C3;const PROJECT_FILE=0;const PROJECT_FILE_NAME=0;const PROJECT_FILE_TYPE=1;const START_OFFSET=1;const AUDIO_DURATION=2;const AUDIO_TAG=3; +class AudioSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._audioPlaybackStarted=false;this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[PROJECT_FILE];this._startOffsetTime=this._sourceAdapterArgs[START_OFFSET];if(this._sourceAdapterArgs[AUDIO_TAG])this._audioTag= +this._sourceAdapterArgs[AUDIO_TAG];else this._audioTag=Math.random().toString(36).slice(2);this._pauseTime=NaN;this._pauseVolume=NaN;this._volume=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=null;this._track=null;this._sourceAdapterArgs=null;this._fileArgs=null;this._audioSource=null}_Initialize(){if(!self.C3.Plugins.Audio)return;const runtime=this._propertyTrack.GetRuntime();const audioObjectClass= +runtime.GetObjectClassByName("audio");if(audioObjectClass)this._sdkInstance=audioObjectClass.GetSingleGlobalInstance().GetSdkInstance();this._actions=self.C3.Plugins.Audio.Acts;this._expressions=self.C3.Plugins.Audio.Exps}_MaybeSetAudioSource(){if(this._audioSource)return;const track=this._propertyTrack.GetTrack();const audioSourcePropertyTrack=track.GetPropertyTrack("audioSource");if(audioSourcePropertyTrack)this._audioSource=audioSourcePropertyTrack.GetSourceAdapter()}_GetPauseVolume(){const track= +this._propertyTrack.GetTrack();const volumePropertyTrack=track.GetPropertyTrack("volume");if(volumePropertyTrack)return volumePropertyTrack.GetSourceAdapter()._pauseVolume;else return this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=false;if(this._sdkInstance){if(this._expressions){this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,this._audioTag);this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)}if(this._actions)this._actions.Stop.call(this._sdkInstance, +this._audioTag)}}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(v){this._volume=v}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=false}SetResumeState(){super.SetResumeState();const timeline=this._propertyTrack.GetTimeline();const time=timeline.GetTime();this._pauseTime=time-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{break}case "volume":{this._pauseVolume=this._propertyTrack.GetInterpolatedValue(time); +break}}this._audioPlaybackStarted=false}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this._sdkInstance)return;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{if(!this._timeline.IsForwardPlayBack())return;if(setTime){if(this._actions)this._actions.Stop.call(this._sdkInstance,this._audioTag);return}if(time{const propertyTrackDataItem= +this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem)});return propertyKeyframeDataItem.GetAbsoluteValue()}_CurrentKeyframeGetter(){const timeline= +this._propertyTrack.GetTimeline();const time=timeline.GetTime()-this._propertyTrack.GetTrack().GetStartOffset();const propertyKeyframe=this._PickTimelinePlaybackMode(()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData= +this._propertyTrack.GetPropertyTrackData();const ret=propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem);if(!ret)return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return ret});return propertyKeyframe.GetAbsoluteValue()}_PickTimelinePlaybackMode(forwardFunc,backwardFunc){const timeline=this._propertyTrack.GetTimeline();return timeline.IsForwardPlayBack()?forwardFunc():backwardFunc()}_PickResultMode(relativeFunc,absoluteFunc){const resultMode= +this._propertyTrack.GetResultMode();return resultMode==="relative"?relativeFunc():absoluteFunc()}_PickFirstAbsoluteUpdate(firstFunc,otherFunc){if(this.GetFirstAbsoluteUpdate()){this.SetFirstAbsoluteUpdate(false);return firstFunc()}else return otherFunc()}_GetAbsoluteInitialValue(keyframeValue){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){if(this._target)return this._target;this._target=this._sourceAdapter.GetTarget();return this._target}_PickSource(bFunc,eFunc,ivFunc,pFunc,wiFunc, +aFunc){const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":return bFunc();case "effect":return eFunc();case "instance-variable":return ivFunc();case "plugin":return pFunc();case "world-instance":return wiFunc();case "audio":return aFunc()}}_SaveToJson(){return{"firstAbsoluteUpdate":this._firstAbsoluteUpdate,"saveState":this._saveState}}_LoadFromJson(o){if(!o)return;this._firstAbsoluteUpdate=o["firstAbsoluteUpdate"];this._saveState=o["saveState"]}_GetPropertyKeyframeStubs(propertyTracks, +firstOnly=false){const ret=[];for(const propertyTrack of propertyTracks){const startOffset=propertyTrack.GetTrack().GetStartOffset();for(const propertyKeyframeDataItem of propertyTrack.GetPropertyKeyframeDataItems())if(firstOnly&&propertyKeyframeDataItem.GetTime()===0)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()});else if(!firstOnly)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()})}return ret.sort((f, +s)=>f.time-s.time)}_GetLastPropertyKeyframeStub(timeline,time,propertyKeyframeStubs){return this._GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs)}_GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs){for(let i=propertyKeyframeStubs.length-1;i>=0;i--){const stubTime=propertyKeyframeStubs[i].time;if(stubTime<=time)return propertyKeyframeStubs[i]}return null}}; + +} + +// timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const TMP_COLORS_MAP=new Map;const TMP_COLOR=[0,0,0]; +class ColorInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._ToColorArray(target.GetPropertyValueByIndex(index));case "effect":return this._ToColorArray(target[index]);case "plugin":return this._ToColorArray(target.GetPropertyValueByIndex(index)); +case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const firstKeyframeColor=this._FirstKeyframeGetter();return!this._CompareColors(firstKeyframeColor,this._Getter())}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return!this._CompareColors(this._saveState,this._Getter())}_CompareColors(fColor,sColor){fColor=this._GetColorFromArray(fColor);sColor=this._GetColorFromArray(sColor);return fColor.equalsIgnoringAlpha(sColor)}_FirstKeyframeGetter(){const color= +super._FirstKeyframeGetter();return this._GetColorFromArray(color)}_CurrentKeyframeGetter(){const color=super._CurrentKeyframeGetter();return this._GetColorFromArray(color)}_GetAbsoluteInitialValue(value){}_ToColorArray(color){if(C3.IsInstanceOf(color,C3.Color))return color.toArray().slice(0,3);return color.slice(0,3)}_GetColorFromArray(color){if(C3.IsInstanceOf(color,C3.Color))return color;return new C3.Color(color[0],color[1],color[2],1)}CanChange(value){return true}MayNeedBeforeAndAfterInterpolate(){return true}BeforeChangeProperty(){const timeline= +this._propertyTrack.GetTimeline();const instance=this._propertyTrack.GetInstance();const sourceAdapter=this._propertyTrack.GetSourceAdapter();const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,this._property,this._propertyTrack);if(propertyTracks&&propertyTracks.length>1){if(!TMP_COLORS_MAP.has(instance))TMP_COLORS_MAP.set(instance,new Map);const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))instanceMap.set(id, +new Map);const sourceMap=instanceMap.get(id);if(!sourceMap.has(this._property))sourceMap.set(this._property,{used:false,color:new C3.Color(0,0,0,1)})}}_GetTmpColor(instance,sourceId,propertyName){const tmpColorObj=TMP_COLORS_MAP.get(instance).get(sourceId).get(propertyName);tmpColorObj.used=true;return tmpColorObj.color}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const timeline=this._propertyTrack.GetTimeline();const track=this._propertyTrack.GetTrack(); +const instance=this._propertyTrack.GetInstance();const sourceAdapter=this._propertyTrack.GetSourceAdapter();const sourceAdapterId=this._propertyTrack.GetSourceAdapterId();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,this._propertyTrack);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs=this._GetPropertyKeyframeStubs(propertyTracks,true);const stub=this._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(), +propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time-startOffset;if(t===0)this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(value[0],value[1],value[2]);else{if(t<0)return;const r=value[0];const g=value[1];const b=value[2];const v=this._propertyTrack.Interpolate(t,false,true);const dr=C3.Color.DiffChannel(r,v[0]);const dg=C3.Color.DiffChannel(g,v[1]);const db=C3.Color.DiffChannel(b,v[2]);this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(dr, +dg,db)}}}else this._Setter(value[0],value[1],value[2])}AfterChangeProperty(){const instance=this._propertyTrack.GetInstance();if(!TMP_COLORS_MAP.has(instance))return;const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))return;const sourceMap=instanceMap.get(id);if(!sourceMap.has(this._property))return;const tmpColorObj=sourceMap.get(this._property);const used=tmpColorObj.used;const color=tmpColorObj.color;if(used)this._Setter(color.getR(), +color.getG(),color.getB());if(sourceMap.size===0)instanceMap.delete(id);if(instanceMap.size===0)TMP_COLORS_MAP.delete(instance)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "effect":return target[index].clone();case "plugin":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(r, +g,b){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "effect":target[index].setRgb(r,g,b);break;case "plugin":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(r,g,b);break}}_SaveToJson(){}_LoadFromJson(o){}} +C3.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=ColorInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +class NoInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return false}ChangeProperty(time, +value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const propertyTrack=this._propertyTrack;const track=propertyTrack.GetTrack();const id=propertyTrack.GetSourceAdapterId();const timeline=propertyTrack.GetTimeline();const instance=track.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,propertyTrack);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs= +this._GetPropertyKeyframeStubs(propertyTracks);const t=time+track.GetStartOffset();const stub=this._GetLastPropertyKeyframeStub(timeline,t,propertyKeyframeStubs);if(stub)value=stub.value}const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{if(!NS.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "angle":{if(!NS.AngleTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "boolean":{if(!NS.BooleanTypeAdapter.WillChange(this._GetIndex(), +this._GetTarget(),value,id))return;break}case "color":{if(!NS.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "text":{if(!NS.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}}this._Setter(value)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index]; +case "instance-variable":return target.GetInstanceVariableValue(index);case "plugin":return target.GetPropertyValueByIndex(index)}}_Setter(value){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value); +break}}}C3.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=NoInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState.PropertyInterpolationAdapter;const INSTANCE_FUNC_MAP=new Map;const add=(prop,setter,absolute_setter,getter,round,fRound=false,init=null,reset=null)=>{INSTANCE_FUNC_MAP.set(prop,{setter,absolute_setter,getter,round,fRound,init,reset})};add("offsetX",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetX(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetX(v)},(wi,v)=>wi.SetX(v),wi=>wi.GetX(),true); +add("offsetY",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetY(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetY(v)},(wi,v)=>wi.SetY(v),wi=>wi.GetY(),true); +add("offsetWidth",(wi,v,t,a,noChanges)=>{if(v===0)return;const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentWidth()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size= +(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalWidth();const sdki=wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalWidth();return wi._GetSceneGraphInfo()._GetStartWidth()};const get_last_property_keyframe_value=(wi,t,propertyName,defaultValue=0)=>{const track=get_track(wi,t);if(!track)return defaultValue;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return defaultValue;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData(); +if(!parentPropertyKeyframeData)return defaultValue;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return defaultValue;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=isTween?p.GetWidth():p._GetSceneGraphInfo()._GetStartWidth();const ownStartScale=isTween?p._GetSceneGraphInfo().GetParentScaleX():p._GetSceneGraphInfo().GetStartScaleX();let absoluteToFactor=ownStartSize* +ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetWidth");absoluteToFactor+=get_original_size(p,t)*get_last_property_keyframe_value(p,t,"offsetScaleX");for(let i=1;iwi.SetWidth(v),wi=>wi.GetWidth(),true); +add("offsetHeight",(wi,v,t,a,noChanges)=>{if(v===0)return;const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentHeight()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size= +(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalHeight();const sdki=wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalHeight();return wi._GetSceneGraphInfo()._GetStartHeight()};const get_last_property_keyframe_value=(wi,t,propertyName,defaultValue=0)=>{const track=t.GetTimeline().GetTrackFromInstance(wi.GetInstance());if(!track)return defaultValue;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return defaultValue; +const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!parentPropertyKeyframeData)return defaultValue;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return defaultValue;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=isTween?p.GetHeight():p._GetSceneGraphInfo()._GetStartHeight();const ownStartScale=isTween?p._GetSceneGraphInfo().GetParentScaleY(): +p._GetSceneGraphInfo().GetStartScaleY();let absoluteToFactor=ownStartSize*ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetHeight");absoluteToFactor+=get_original_size(p,t)*get_last_property_keyframe_value(p,t,"offsetScaleY");for(let i=1;iwi.SetHeight(v),wi=>wi.GetHeight(),true);add("offsetAngle",(wi,v)=>wi.OffsetAngle(v),(wi,v)=>wi.SetAngle(v),wi=>wi.GetAngle(),false,true); +add("offsetOpacity",(wi,v,t,a,noChanges)=>{const opacityFactor=a._opacityFactor?a._opacityFactor:1;v/=opacityFactor;const o=wi.GetOpacity();const nv=o+v;const min=0;const max=1;if(a._clampAccumulator===0){if(nv>max)a._clampAccumulator+=nv-max;else if(nv0&&a._clampAccumulator>0){if(nv>max)a._clampAccumulator+=nv-max}else if(v>0&&a._clampAccumulator<0){a._clampAccumulator+=v;if(a._clampAccumulator>0)a._clampAccumulator= +0}else if(v<0&&a._clampAccumulator>0){a._clampAccumulator+=v;if(a._clampAccumulator<0)a._clampAccumulator=0}else if(v<0&&a._clampAccumulator<0)if(nv{wi.SetOpacity(v)},wi=>{return wi.GetOpacity()},false,true,(a,wi,t)=>{a._clampAccumulator=0;switch(a._propertyTrack.GetResultMode()){case "relative":{const propertyTrackData=a._propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=a._propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData(); +const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();let startingAbsoluteOpacity=a.GetWorldInfo().GetOpacity();let currentAbsoluteOpacity=startingAbsoluteOpacity;for(const propertyKeyframeDataItem of propertyKeyframeDataItems){const time=propertyKeyframeDataItem.GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity=startingAbsoluteOpacity+currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity, +0,1)}a._totalForewardOpacityDelta=startingAbsoluteOpacity-currentAbsoluteOpacity;a._totalForewardOpacityDelta=Math.round((a._totalForewardOpacityDelta+Number.EPSILON)*100)/100;currentAbsoluteOpacity=startingAbsoluteOpacity;for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const time=propertyKeyframeDataItems[i].GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity-=currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity, +0,1)}a._totalBackwardOpacityDelta=currentAbsoluteOpacity;a._totalBackwardOpacityDelta=Math.round((a._totalBackwardOpacityDelta+Number.EPSILON)*100)/100;break}case "absolute":{break}}const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentOpacity()){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_last_property_keyframe_value= +(wi,t,propertyName)=>{const track=t.GetTimeline().GetTrackFromInstance(wi.GetInstance());if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!parentPropertyKeyframeData)return 0;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()}; +let opacityFactor=parents[0]._GetSceneGraphInfo().GetStartOpacity();opacityFactor+=get_last_property_keyframe_value(parents[0],t,"offsetOpacity");for(let i=1;i{switch(a._propertyTrack.GetResultMode()){case "relative":{a._clampAccumulator=0;const wi=a.GetWorldInfo();let currentOpacity=wi.GetOpacity();currentOpacity=Math.round((currentOpacity+Number.EPSILON)* +100)/100;if(a._propertyTrack.GetTimeline().IsForwardPlayBack()){wi.SetOpacity(currentOpacity+a._totalForewardOpacityDelta);a._lastValue=0}else{wi.SetOpacity(currentOpacity-a._totalBackwardOpacityDelta);a._lastValue=a.GetSourceAdapter().GetValueAtTime()}break}case "absolute":{break}}});add("offsetOriginX",(wi,v)=>wi.OffsetOriginX(v),(wi,v)=>wi.SetOriginX(v),wi=>wi.GetOriginX(),false);add("offsetOriginY",(wi,v)=>wi.OffsetOriginY(v),(wi,v)=>wi.SetOriginY(v),wi=>wi.GetOriginY(),false); +add("offsetZElevation",(wi,v)=>wi.OffsetZElevation(v),(wi,v)=>wi.SetZElevation(v),wi=>wi.GetZElevation(),true); +add("offsetScaleX",(wi,v,t,a)=>{if(v===0)return;const mirrorFactor=wi.GetWidth()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentWidth()){const value=t.GetOriginalWidth()*mirrorFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetWidth").setter(wi,1,t,a,true);wi.OffsetWidth(value/a._absoluteToFactor,true)}else wi.OffsetWidth(t.GetOriginalWidth()*mirrorFactor*v)},(wi,v,t)=>{wi.SetWidth(t.GetOriginalWidth()*v)},(wi,t)=>{const mirrorFactor= +wi.GetWidth()<0?-1:1;if(wi.GetTransformWithParentWidth()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetWidth()/parentTrack.GetOriginalWidth();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetWidth()/sdki.GetOriginalWidth();else parentScale=1}return wi.GetWidth()*mirrorFactor/(t.GetOriginalWidth()*parentScale)}else return wi.GetWidth()* +mirrorFactor/t.GetOriginalWidth()},false); +add("offsetScaleY",(wi,v,t,a)=>{if(v===0)return;const flipFactor=wi.GetHeight()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentHeight()){const value=t.GetOriginalHeight()*flipFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetHeight").setter(wi,1,t,a,true);wi.OffsetHeight(value/a._absoluteToFactor,true)}else wi.OffsetHeight(t.GetOriginalHeight()*flipFactor*v)},(wi,v,t)=>{wi.SetHeight(t.GetOriginalHeight()*v)},(wi,t)=>{const flipFactor= +wi.GetHeight()<0?-1:1;if(wi.GetTransformWithParentHeight()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetHeight()/parentTrack.GetOriginalHeight();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetHeight()/sdki.GetOriginalHeight();else parentScale=1}return wi.GetHeight()*flipFactor/(t.GetOriginalHeight()*parentScale)}else return wi.GetHeight()* +flipFactor/t.GetOriginalHeight()},false); +class NumericInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter);this._lastValue=0;this._clampAccumulator=0;this._totalForewardOpacityDelta=0;this._totalBackwardOpacityDelta=0;this._opacityFactor=NaN;this._absoluteToFactor=NaN;this._instance_getter=null;this._instance_setter=null;this._instance_absolute_setter=null;this._reset_action=null;this._init_action=null;this._source_adapter_getter=null;this._source_adapter_setter= +null;this._source_adapter_absolute_setter=null;this._round=false;this._fRound=false;if(C3.IsInstanceOf(this._propertyTrack.GetTimeline(),C3.TweenState))this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this);else this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const property=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":{const p= +INSTANCE_FUNC_MAP.get(property);this._instance_getter=p.getter;this._instance_setter=p.setter;this._instance_absolute_setter=p.absolute_setter;this._round=p.round;this._fRound=p.fRound;this._init_action=p.init;this._reset_action=p.reset;break}case "audio":{this._source_adapter_getter=sourceAdapter.Getter;this._source_adapter_setter=sourceAdapter.Setter;this._source_adapter_absolute_setter=sourceAdapter.AbsoluteSetter;this._round=!!sourceAdapter.DoesRounding();this._fRound=false;break}}}Release(){this._typeAdapter= +null;this._instance_getter=null;this._instance_setter=null;this._instance_absolute_setter=null;this._absoluteToFactor=NaN;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(v){this._lastValue=v}SetResetState(){if(this._reset_action)this._reset_action(this)}SetInitialState(){const initValue=this._typeAdapter.SetInitialState();if(typeof initValue==="number")this._lastValue=initValue;if(this._init_action){const wi= +this.GetWorldInfo();const track=this._propertyTrack.GetTrack();this._init_action(this,wi,track)}}SetResumeState(){const resumeValue=this._typeAdapter.SetResumeState();if(typeof resumeValue==="number")this._lastValue=resumeValue}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!== +this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){return this._typeAdapter.ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id= +this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index];case "instance-variable":return target.GetInstanceVariableValue(index);case "plugin":return target.GetPropertyValueByIndex(index);case "world-instance":return this._instance_getter(wi,track);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),wi,track)}}_Setter(value,start,end){const target=this._GetTarget();const index=this._GetIndex(); +const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":target.OffsetPropertyValueByIndex(index,value);break;case "effect":target[index]+=value;break;case "instance-variable":target.SetInstanceVariableOffset(index,value);break;case "plugin":target.OffsetPropertyValueByIndex(index,value,this.GetSourceAdapter().GetOptionalCallbacks());break;case "world-instance":this._instance_setter(wi,value,track,this);break; +case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),wi,value,track,this);break}}_SetterAbsolute(value,propertyKeyframeReached,endState){let mode=this._propertyTrack.GetInterpolationMode();mode=mode==="default"?"continuous":mode;if(mode==="discrete"&&!propertyKeyframeReached)return;if(mode==="discrete"&&endState){const timeline=this._propertyTrack.GetTimeline();const time=timeline.GetTime();const propertyKeyframeDataItem=this._propertyTrack.GetPropertyKeyFrameDataItemAtTime(time); +if(!propertyKeyframeDataItem)return}const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value,this.GetSourceAdapter().GetOptionalCallbacks()); +break;case "world-instance":this._instance_absolute_setter(wi,value,track);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),wi,value,track);break}}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState){this._typeAdapter._MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState)}_AddDelta(value,start,end,forceEndValue,endState){switch(this._propertyTrack.GetPropertyType()){case "angle":{value=C3.toDegrees(value); +break}default:{value=value;break}}const stringValue=value.toString();const decimalsString=stringValue.split(".")[1]||"";const decimalPlaces=decimalsString.length;const v=this._Getter();let rv;if(decimalPlaces===0)if(this._round)rv=Math.round(v);else if(this._fRound)switch(this._propertyTrack.GetPropertyType()){case "angle":{rv=C3.toRadians(Math.round(C3.toDegrees(v)));break}default:{rv=Math.round((v+Number.EPSILON)*100)/100;break}}else rv=v;else if(this._round)rv=Number(C3.toFixed(v,decimalPlaces)); +else if(this._fRound)rv=v;else rv=v;this._Setter(rv-v,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"v":this._lastValue,"a":this._clampAccumulator,"fod":this._totalForewardOpacityDelta,"bod":this._totalBackwardOpacityDelta})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._lastValue=o["v"];this._clampAccumulator=o["a"];this._totalForewardOpacityDelta=C3.IsFiniteNumber(o["fod"])?o["fod"]:0;this._totalBackwardOpacityDelta=C3.IsFiniteNumber(o["bod"])?o["bod"]:0}} +C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=NumericInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTimeline.js +{ +'use strict';const C3=self.C3; +class AbsoluteValueObject{constructor(propertyTracks){this._used=false;this._value=0;this._propertyKeyframeReached=false;this._endState=false;this._propertyTracks=propertyTracks;for(let i=0,l=this._propertyTracks.length;i{return adapter._PickTimelinePlaybackMode(()=>0,()=>adapter.GetSourceAdapter().GetValueAtTime())},()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){const adapter= +this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{return false}case "absolute":{return true}}}BeforeChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();const property=propertyTrack.GetPropertyName();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const valueObj= +propertyTrack.GetAbsoluteValueObject();valueObj.Reset()}else{const timeline=propertyTrack.GetTimeline();const instance=propertyTrack.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,propertyTrack);if(similarPropertyTracks&&similarPropertyTracks.length>1)new AbsoluteValueObject(similarPropertyTracks)}break}}}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const adapter= +this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{const lastValue=adapter.GetLastValue();adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value);adapter.SetLastValue(value);break}case "absolute":{const timeline=propertyTrack.GetTimeline();const track=propertyTrack.GetTrack();const instance=propertyTrack.GetInstance();const sourceAdapter= +propertyTrack.GetSourceAdapter();if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject=propertyTrack.GetAbsoluteValueObject();const similarpropertyTracks=absoluteValueObject.GetPropertyTracks();const propertyKeyframeStubs=adapter._GetPropertyKeyframeStubs(similarpropertyTracks,true);const stub=adapter._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(),propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time-startOffset;if(t===0){absoluteValueObject.SetEndState(endState); +absoluteValueObject.SetPropertyKeyframeReached(propertyKeyframeReached);absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+value)}else{if(t<0)return;const v=propertyTrack.GetInterpolatedValue(t);absoluteValueObject.SetEndState(endState);absoluteValueObject.SetPropertyKeyframeReached(propertyKeyframeReached);absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+(value-v))}}}else adapter._SetterAbsolute(value,propertyKeyframeReached, +endState);break}}}AfterChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject=propertyTrack.GetAbsoluteValueObject();if(absoluteValueObject.GetUsed())adapter._SetterAbsolute(absoluteValueObject.GetValue(),absoluteValueObject.GetPropertyKeyframeReached(),absoluteValueObject.GetEndState())}break}}}_MaybeEnsureValue(time, +start,end,setTime,lastValue,currentValue){const adapter=this._numericInterpolationAdapter;if(setTime)return;if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(),start,end)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=NumericInterpolationAdapterForTimeline; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTween.js +{ +'use strict';const C3=self.C3; +class NumericInterpolationAdapterForTween{constructor(numericInterpolationAdapter){this._numericInterpolationAdapter=numericInterpolationAdapter}Release(){this._numericInterpolationAdapter=null}GetType(){return 1}SetInitialState(){const adapter=this._numericInterpolationAdapter;adapter.SetFirstAbsoluteUpdate(true);return this._GetAbsoluteInitialValue(adapter._FirstKeyframeGetter())}SetResumeState(){const adapter=this._numericInterpolationAdapter;if(adapter._FirstKeyframeGetter()===adapter._CurrentKeyframeGetter())return; +adapter.SetFirstAbsoluteUpdate(true);return this._GetAbsoluteInitialValue(adapter._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return false}BeforeChangeProperty(){}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const adapter=this._numericInterpolationAdapter;const lastValue=adapter.GetLastValue();switch(adapter.GetPropertyTrack().GetResultMode()){case "relative":{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time, +start,end,setTime,lastValue,value,false,endState);break}case "absolute":{if(adapter.GetFirstAbsoluteUpdate()){adapter.SetFirstAbsoluteUpdate(false);adapter._Setter(lastValue,start,end)}else if(time===0&&adapter.GetPropertyTrack().GetTimeline().GetTotalTime()===0)adapter._SetterAbsolute(value,true,false);else{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value,this._ForceEndValue(),endState)}break}}adapter.SetLastValue(value)}AfterChangeProperty(){}_GetAbsoluteInitialValue(keyframeValue){const adapter= +this._numericInterpolationAdapter;return keyframeValue-adapter.GetCurrentState()}_ForceEndValue(){const adapter=this._numericInterpolationAdapter;const inst=adapter.GetWorldInfo().GetInstance();const runtime=adapter.GetPropertyTrack().GetRuntime();const timelineManager=runtime.GetTimelineManager();let activeTimelineCount=0;for(const timeline of timelineManager.GetPlayingTimelines())if(timeline.GetType()===0){if(timeline.HasTrackInstance(inst))activeTimelineCount++}else if(timeline.GetType()===1)if(timeline.GetInstance()=== +inst)activeTimelineCount++;return activeTimelineCount<=1}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState){const adapter=this._numericInterpolationAdapter;if(setTime)if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end,forceEndValue,endState);else{if(!end)adapter._AddDelta(start.GetValueWithResultMode(),start, +end,forceEndValue,endState)}else if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=NumericInterpolationAdapterForTween; + +} + +// timelines/state/propertyTypeAdapters/numericTypeAdapter.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease; +C3.PropertyTrackState.NumericTypeAdapter=class NumericTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){const step= +propertyTrack.GetTimeline().GetStep();if(mode==="step"&&step!==0){const s=1/step;time=Math.floor(time*s)/s}const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const startAddon=start.GetAddOn("cubic-bezier");const endAddon=end.GetAddOn("cubic-bezier");const doCubicBezier=startAddon&&startAddon.GetStartEnable()&&endAddon&&endAddon.GetEndEnable();if(!doCubicBezier&&sv===ev)return sv;const st=start.GetTime();const et=end.GetTime();if(mode==="step"&&step!==0)time=C3.clamp(time, +st,et);const n=C3.normalize(time,st,et);const e=start.GetEase();let ret;if(doCubicBezier){const dt=et-st;ret=Ease.GetRuntimeEase(e)(dt*n,0,1,dt);ret=Ease.GetRuntimeEase("cubicbezier")(ret,sv,sv+startAddon.GetStartAnchor(),ev+endAddon.GetEndAnchor(),ev)}else ret=Ease.GetRuntimeEase(e)((et-st)*n,sv,ev-sv,et-st);if(propertyTrack.GetPropertyType()==="integer")return Math.floor(ret);return ret}}}; + +} + +// timelines/state/propertyTypeAdapters/angleTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.AngleTypeAdapter=class AngleTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){const step= +propertyTrack.GetTimeline().GetStep();if(mode==="step"&&step!==0){const s=1/step;time=Math.floor(time*s)/s}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();if(mode==="step"&&step!==0)time=C3.clamp(time,st,et);const angleAddon=start.GetAddOn("angle");if(angleAddon){const revolutions=angleAddon.GetRevolutions();if(sv===ev&&revolutions===0)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase()); +const easeRes=easeFunc(n,0,1,1);switch(angleAddon.GetDirection()){case "closest":return C3.angleLerp(sv,ev,easeRes,revolutions);case "clockwise":return C3.angleLerpClockwise(sv,ev,easeRes,revolutions);case "anti-clockwise":return C3.angleLerpAntiClockwise(sv,ev,easeRes,revolutions)}}else{if(sv===ev)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase());return C3.angleLerp(sv,ev,easeFunc(n,0,1,1))}}}}; + +} + +// timelines/state/propertyTypeAdapters/booleanTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.BooleanTypeAdapter=class BooleanTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(!!oldValue===!!newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()?1:0}return start.GetValueWithResultMode()?1:0}}; + +} + +// timelines/state/propertyTypeAdapters/colorTypeAdapter.js +{ +'use strict';const C3=self.C3;const TEMP_COLOR_ARRAY=[0,0,0];const TEMP_COLOR_ARRAY_2=[0,0,0];const TEMP_COLOR_ARRAY_3=[0,0,0]; +C3.PropertyTrackState.ColorTypeAdapter=class ColorTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(Array.isArray(newValue)){TEMP_COLOR_ARRAY[0]=newValue[0];TEMP_COLOR_ARRAY[1]=newValue[1];TEMP_COLOR_ARRAY[2]= +newValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(newValue);TEMP_COLOR_ARRAY[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()*255);TEMP_COLOR_ARRAY[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(Array.isArray(oldValue)){TEMP_COLOR_ARRAY_2[0]=oldValue[0];TEMP_COLOR_ARRAY_2[1]=oldValue[1];TEMP_COLOR_ARRAY_2[2]=oldValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(oldValue);TEMP_COLOR_ARRAY_2[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()* +255);TEMP_COLOR_ARRAY_2[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY_2[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(TEMP_COLOR_ARRAY[0]!==TEMP_COLOR_ARRAY_2[0])return true;if(TEMP_COLOR_ARRAY[1]!==TEMP_COLOR_ARRAY_2[1])return true;if(TEMP_COLOR_ARRAY[2]!==TEMP_COLOR_ARRAY_2[2])return true;return false}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData(); +propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);const color=propertyTrackDataItem.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2];return TEMP_COLOR_ARRAY}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(mode==="discrete"){const color=start.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2]; +return TEMP_COLOR_ARRAY}else if(mode==="continuous"||mode==="step"){const step=propertyTrack.GetTimeline().GetStep();if(mode==="step"&&step!==0){const s=1/step;time=Math.floor(time*s)/s}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();if(mode==="step"&&step!==0)time=C3.clamp(time,st,et);const n=C3.normalize(time,st,et);const e=start.GetEase();const sr=sv[0];const sg=sv[1];const sb=sv[2];const er=ev[0];const eg=ev[1];const eb= +ev[2];const easeFunc=self.Ease.GetRuntimeEase(e);const d=et-st;const dn=d*n;if(sr===er)TEMP_COLOR_ARRAY[0]=sr;else TEMP_COLOR_ARRAY[0]=easeFunc(dn,sr,er-sr,d);if(sg===eg)TEMP_COLOR_ARRAY[1]=sg;else TEMP_COLOR_ARRAY[1]=easeFunc(dn,sg,eg-sg,d);if(sb===eb)TEMP_COLOR_ARRAY[2]=sb;else TEMP_COLOR_ARRAY[2]=easeFunc(dn,sb,eb-sb,d);return TEMP_COLOR_ARRAY}}}; + +} + +// timelines/state/propertyTypeAdapters/textTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.TextTypeAdapter=class TextTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}return start.GetValueWithResultMode()}}; + +} + +// timelines/data/timelineDataManager.js +{ +'use strict';const C3=self.C3; +C3.TimelineDataManager=class TimelineDataManager{constructor(){this._timelineDataItems=new Map}Release(){for(const timelineDataItem of this._timelineDataItems.values())timelineDataItem.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(data){const timelineDataItem=new C3.TimelineDataItem(data);const name=timelineDataItem.GetName();this._timelineDataItems.set(name,timelineDataItem)}Get(name){return this._timelineDataItems.get(name)}GetNameId(){return 0}static _CreateDataItems(items,jsonItems, +dataItemConstructor,dataContainer){if(!jsonItems)return;for(const jsonItem of jsonItems)C3.TimelineDataManager._CreateDataItem("create",jsonItem,items,dataItemConstructor,dataContainer)}static _CreateDataItemsIncludingDisabled(items,jsonItems,dataItemConstructor,dataContainer){if(!jsonItems)return;for(const jsonItem of jsonItems)C3.TimelineDataManager._CreateDataItem("create-including-disabled",jsonItem,items,dataItemConstructor,dataContainer)}static _LoadDataItemsFromJson(items,jsonItems,dataItemConstructor, +dataContainer){if(items.length)jsonItems.forEach((jsonItem,index)=>{items[index]._LoadFromJson(jsonItem)});else jsonItems.forEach(jsonItem=>{C3.TimelineDataManager._CreateDataItem("load",jsonItem,items,dataItemConstructor,dataContainer)})}static _CreateDataItem(mode,json,items,dataItemConstructor,dataContainer){let dataItem;if(typeof dataItemConstructor==="function")switch(mode){case "load":dataItem=new dataItemConstructor(null,dataContainer);break;case "create":dataItem=new dataItemConstructor(json, +dataContainer);break;case "create-including-disabled":dataItem=new dataItemConstructor(json,dataContainer);break}else if(typeof dataItemConstructor==="object"){const prop=dataItemConstructor.prop;const value=json[prop];const cnstrctr=dataItemConstructor.map.get(value);switch(mode){case "load":dataItem=new cnstrctr(null,dataContainer);break;case "create":dataItem=new cnstrctr(json,dataContainer);break;case "create-including-disabled":dataItem=new cnstrctr(json,dataContainer);break}}switch(mode){case "load":dataItem._LoadFromJson(json); +items.push(dataItem);break;case "create":if(typeof dataItem.GetEnable==="function"&&!dataItem.GetEnable())return dataItem.Release();items.push(dataItem);break;case "create-including-disabled":items.push(dataItem);break}}}; + +} + +// timelines/data/timelineData.js +{ +'use strict';const C3=self.C3;const NAME=0;const TOTAL_TIME=1;const STEP=2;const INTERPOLATION_MODE=3;const RESULT_MODE=4;const TRACKS=5;const LOOP=6;const PING_PONG=7;const REPEAT_COUNT=8;const START_ON_LAYOUT=9;const TRANSFORM_WITH_SCENE_GRAPH=10;const USE_SYSTEM_TIMESCALE=11; +C3.TimelineDataItem=class TimelineDataItem{constructor(timelineDataJson){this._name="";this._totalTime=NaN;this._step=0;this._interpolationMode="default";this._resultMode="default";this._loop=false;this._pingPong=false;this._repeatCount=1;this._trackData=null;this._startOnLayout="";this._transformWithSceneGraph=false;this._useSystemTimescale=true;if(!timelineDataJson)return;this._name=timelineDataJson[NAME];this._totalTime=timelineDataJson[TOTAL_TIME];this._step=timelineDataJson[STEP];this._interpolationMode= +timelineDataJson[INTERPOLATION_MODE];this._resultMode=timelineDataJson[RESULT_MODE];this._loop=!!timelineDataJson[LOOP];this._pingPong=!!timelineDataJson[PING_PONG];this._repeatCount=timelineDataJson[REPEAT_COUNT];this._startOnLayout=timelineDataJson[START_ON_LAYOUT];this._transformWithSceneGraph=!!timelineDataJson[TRANSFORM_WITH_SCENE_GRAPH];this._useSystemTimescale=!!timelineDataJson[USE_SYSTEM_TIMESCALE];this._trackData=new C3.TrackData(timelineDataJson[TRACKS],this)}Release(){this._trackData.Release(); +this._trackData=null}GetTrackData(){if(!this._trackData)this._trackData=new C3.TrackData(null,this);return this._trackData}GetName(){return this._name}SetName(n){this._name=n}GetTotalTime(){return this._totalTime}SetTotalTime(tt){this._totalTime=tt}GetStep(){return this._step}SetStep(s){this._step=s}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetLoop(){return this._loop}SetLoop(l){this._loop= +l}GetPingPong(){return this._pingPong}SetPingPong(p){this._pingPong=p}GetRepeatCount(){return this._repeatCount}SetRepeatCount(rc){this._repeatCount=rc}GetStartOnLayout(){return this._startOnLayout}GetTransformWithSceneGraph(){return this._transformWithSceneGraph}GetUseSystemTimescale(){return this._useSystemTimescale}_SaveToJson(){return{"trackDataJson":this._trackData._SaveToJson(),"name":this._name,"totalTime":this._totalTime,"step":this._step,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode, +"loop":this._loop,"pingPong":this._pingPong,"repeatCount":this._repeatCount,"startOnLayout":this._startOnLayout,"transformWithSceneGraph":!!this._transformWithSceneGraph,"useSystemTimescale":this._useSystemTimescale}}_LoadFromJson(o){if(!o)return;this.GetTrackData()._LoadFromJson(o["trackDataJson"]);this._name=o["name"];this._totalTime=o["totalTime"];this._step=o["step"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._loop=o["loop"];this._pingPong=o["pingPong"]; +this._repeatCount=o["repeatCount"];this._startOnLayout=o["startOnLayout"];this._transformWithSceneGraph=!!o["transformWithSceneGraph"];this._useSystemTimescale=!!o["useSystemTimescale"]}}; + +} + +// timelines/data/trackData.js +{ +'use strict';const C3=self.C3;const WI_DATA=0;const OC_INDEX=1;const WI_UID=2;const INTERPOLATION_MODE=1;const RESULT_MODE=2;const ENABLED=3;const KEYFRAMES=4;const PROPERTY_TRACKS=5;const ID=6;const NESTED_DATA=7;const START_OFFSET=0;const LOCAL_TOTAL_TIME=1;const WI_ADDITIONAL_DATA=8;const ORIGINAL_WIDTH=0;const ORIGINAL_HEIGHT=1;const TRACK_TYPE=9;const TRACK_NAME=10; +class TrackDataItem{constructor(trackDataJson,trackData){this._trackData=trackData;this._instanceData=null;this._additionalInstanceData=null;this._instanceUid=NaN;this._objectClassIndex=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._keyframeData=null;this._propertyTrackData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";if(!trackDataJson)return; +if(trackDataJson[WI_DATA]){this._instanceData=trackDataJson[WI_DATA];this._instanceUid=trackDataJson[WI_DATA][WI_UID];this._objectClassIndex=trackDataJson[WI_DATA][OC_INDEX]}this._interpolationMode=trackDataJson[INTERPOLATION_MODE];this._resultMode=trackDataJson[RESULT_MODE];this._enabled=!!trackDataJson[ENABLED];if(trackDataJson[ID])this._id=trackDataJson[ID];if(trackDataJson[NESTED_DATA]){this._nestedData=trackDataJson[NESTED_DATA];this._startOffset=trackDataJson[NESTED_DATA][START_OFFSET];this._localTotalTime= +trackDataJson[NESTED_DATA][LOCAL_TOTAL_TIME]}if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[TRACK_TYPE])this._type=trackDataJson[TRACK_TYPE];if(trackDataJson[TRACK_NAME])this._name=trackDataJson[TRACK_NAME];this._keyframeData=new C3.KeyframeData(trackDataJson[KEYFRAMES],this);this._propertyTrackData=new C3.PropertyTrackData(trackDataJson[PROPERTY_TRACKS], +this)}Release(){this._instanceData=null;this._trackData=null;if(this._keyframeData){this._keyframeData.Release();this._keyframeData=null}if(this._propertyTrackData){this._propertyTrackData.Release();this._propertyTrackData=null}this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){if(!this._keyframeData)this._keyframeData=new C3.KeyframeData(null,this);return this._keyframeData}GetPropertyTrackData(){if(!this._propertyTrackData)this._propertyTrackData=new C3.PropertyTrackData(null, +this);return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(index){this._objectClassIndex=index}GetInstanceUID(){return this._instanceUid}SetInstanceUID(uid){this._instanceUid=uid}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled= +!!e}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(t){this._localTotalTime=t}GetOriginalWidth(){return this._additionalInstanceData[ORIGINAL_WIDTH]}SetOriginalWidth(w){if(!this._additionalInstanceData)this._additionalInstanceData=[];this._additionalInstanceData[ORIGINAL_WIDTH]=w}GetOriginalHeight(){if(!this._additionalInstanceData)this._additionalInstanceData=[];return this._additionalInstanceData[ORIGINAL_HEIGHT]}SetOriginalHeight(h){if(!this._additionalInstanceData)this._additionalInstanceData= +[];this._additionalInstanceData[ORIGINAL_HEIGHT]=h}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{"keyframeDataJson":this._keyframeData._SaveToJson(),"propertyTrackDataJson":this._propertyTrackData._SaveToJson(),"instanceData":this._instanceData,"additionalInstanceData":this._additionalInstanceData,"instanceUid":this._instanceUid,"objectClassIndex":this._objectClassIndex,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled, +"id":this._id,"nestedData":this._nestedData,"type":this._type,"name":this._name}}_LoadFromJson(o){if(!o)return;this._instanceData=o["instanceData"];this._instanceUid=o["instanceUid"];this._objectClassIndex=o["objectClassIndex"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._id=o["id"];this._type=o["type"]?o["type"]:0;this._name=o["name"]?o["name"]:"";this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();if(o["nestedData"]){this._nestedData= +o["nestedData"];this._startOffset=this._nestedData[START_OFFSET];this._localTotalTime=this._nestedData[LOCAL_TOTAL_TIME]}if(o["additionalInstanceData"])this._additionalInstanceData=o["additionalInstanceData"];this.GetKeyframeData()._LoadFromJson(o["keyframeDataJson"]);this.GetPropertyTrackData()._LoadFromJson(o["propertyTrackDataJson"])}} +C3.TrackData=class TrackData{constructor(tracksDataJson,timelineDataItem){this._timelineDataItem=timelineDataItem;this._trackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._trackDataItems,tracksDataJson,TrackDataItem,this)}Release(){this._timelineDataItem=null;for(const trackDataItem of this._trackDataItems)trackDataItem.Release();C3.clearArray(this._trackDataItems);this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const trackDataItem= +new TrackDataItem(null,this);this._trackDataItems.push(trackDataItem);return trackDataItem}GetFirstKeyframeDataItem(trackDataItem){return trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return keyframeDataItems.at(-1)}GetKeyFrameDataItemAtTime(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length; +for(let i=0;itime)return keyframeDataItem}}GetFirstKeyFrameDataItemHigherOrEqualThan(time,trackDataItem){const keyframeDataItems= +trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length;for(let i=0;i=time)return keyframeDataItem}}GetFirstKeyFrameDataItemLowerOrEqualThan(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();for(let i=keyframeDataItems.length-1;i>=0;i--){const keyframeDataItem=keyframeDataItems[i];if(keyframeDataItem.GetTime()<=time)return keyframeDataItem}}*trackDataItems(){for(const trackDataItem of this._trackDataItems)yield trackDataItem}_SaveToJson(){return{"trackDataItemsJson":this._trackDataItems.map(trackDataItem=> +trackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,o["trackDataItemsJson"],TrackDataItem,this)}}; + +} + +// timelines/data/propertyTrackData.js +{ +'use strict';const C3=self.C3;const SOURCE_DATA=0;const SOURCE=0;const PROPERTY=1;const TYPE=2;const MIN=3;const MAX=4;const INTERPOLATION_MODE=5;const RESULT_MODE=6;const ENABLED=7;const PROPERTY_KEYFRAMES=8;const CAN_HAVE_PROPERTY_KEYFRAMES=9; +class PropertyTrackDataItem{constructor(propertyTrackDataJson,propertyTrackData){this._propertyTrackData=propertyTrackData;this._sourceAdapterId="";this._sourceAdapterArguments=null;this._property=null;this._type=null;this._min=NaN;this._max=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._propertyKeyframeData=null;this._canHavePropertyKeyframes=true;if(!propertyTrackDataJson)return;this._sourceAdapterId=propertyTrackDataJson[SOURCE_DATA][SOURCE];this._sourceAdapterArguments= +propertyTrackDataJson[SOURCE_DATA].slice(1);this._property=propertyTrackDataJson[PROPERTY];this._type=propertyTrackDataJson[TYPE];this._min=propertyTrackDataJson[MIN];this._max=propertyTrackDataJson[MAX];this._interpolationMode=propertyTrackDataJson[INTERPOLATION_MODE];this._resultMode=propertyTrackDataJson[RESULT_MODE];this._enabled=!!propertyTrackDataJson[ENABLED];this._propertyKeyframeData=new C3.PropertyKeyframeData(propertyTrackDataJson[PROPERTY_KEYFRAMES],this);this._canHavePropertyKeyframes= +propertyTrackDataJson[CAN_HAVE_PROPERTY_KEYFRAMES]}Release(){this._propertyKeyframeData.Release();this._propertyKeyframeData=null;this._propertyTrackData=null;this._sourceAdapterArguments=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){if(!this._propertyKeyframeData)this._propertyKeyframeData=new C3.PropertyKeyframeData(null,this);return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(said){this._sourceAdapterId= +said}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(sargs){this._sourceAdapterArguments=sargs}GetProperty(){return this._property}SetProperty(p){this._property=p}GetType(){return this._type}SetType(t){this._type=t}GetMin(){return this._min}SetMin(min){this._min=min}GetMax(){return this._max}SetMax(max){this._max=max}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode= +rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled=!!e}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{"propertyKeyframeDataJson":this._propertyKeyframeData._SaveToJson(),"sourceAdapterId":this._sourceAdapterId,"sourceAdapterArguments":this._sourceAdapterArguments,"property":this._property,"type":this._type,"min":this._min,"max":this._max,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"canHavePropertyKeyframes":this._canHavePropertyKeyframes}}_LoadFromJson(o){if(!o)return; +this._sourceAdapterId=o["sourceAdapterId"];this._sourceAdapterArguments=o["sourceAdapterArguments"];this._property=o["property"];this._type=o["type"];this._min=o["min"];this._max=o["max"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._canHavePropertyKeyframes=o["canHavePropertyKeyframes"];this.GetPropertyKeyframeData()._LoadFromJson(o["propertyKeyframeDataJson"])}} +C3.PropertyTrackData=class PropertyTrackData{constructor(propertyTracksDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._propertyTrackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,propertyTracksDataJson,PropertyTrackDataItem,this)}Release(){this._trackDataItem=null;for(const propertyTrackDataItem of this._propertyTrackDataItems)propertyTrackDataItem.Release();C3.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const propertyTrackDataItem= +new PropertyTrackDataItem(null,this);this._propertyTrackDataItems.push(propertyTrackDataItem);return propertyTrackDataItem}GetFirstPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();return propertyKeyframeData.GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +return propertyKeyframeDataItems.at(-1)}GetPropertyKeyFrameDataItemAtTime(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;itime)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData(); +const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;i=time)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const propertyKeyframeDataItem=propertyKeyframeDataItems[i];if(propertyKeyframeDataItem.GetTime()<=time)return propertyKeyframeDataItem}}*propertyTrackDataItems(){for(const propertyTrackDataItem of this._propertyTrackDataItems)yield propertyTrackDataItem}_SaveToJson(){return{"propertyTrackDataItemsJson":this._propertyTrackDataItems.map(propertyTrackDataItem=>propertyTrackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems, +o["propertyTrackDataItemsJson"],PropertyTrackDataItem,this)}}; + +} + +// timelines/data/keyframeData.js +{ +'use strict';const C3=self.C3;const TIME=0;const EASE=1;const ENABLE=2;const TAGS=3; +class KeyframeDataItem{constructor(keyframeDataJson,keyframeData){this._keyframeData=keyframeData;this._time=-1;this._ease="noease";this._enable=false;this._tags=null;this._lowerTags=null;if(!keyframeDataJson)return;this._time=keyframeDataJson[TIME];this._ease=keyframeDataJson[EASE];this._enable=!!keyframeDataJson[ENABLE];const tagStr=keyframeDataJson[TAGS];this._tags=tagStr?tagStr.split(" "):[];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()));this._next=null}Release(){this._keyframeData= +null;C3.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null;this._next=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(next){this._next=next}GetTime(){return this._time}SetTime(t){this._time=t;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetTags(){return this._tags}SetTags(t){this._tags=t?t.split(" "):[];this._lowerTags= +new Set(this._tags.map(t=>t.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(tag){return this._lowerTags.has(tag.toLowerCase())}_SaveToJson(){return{"time":this._time,"ease":this._ease,"enable":this._enable,"tags":this._tags}}_LoadFromJson(o){if(!o)return;this._time=o["time"];this._ease=o["ease"];this._enable=o["enable"];this._tags=o["tags"];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()))}} +C3.KeyframeData=class KeyframeData{constructor(keyframesDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._keyframeDataItems=[];C3.TimelineDataManager._CreateDataItems(this._keyframeDataItems,keyframesDataJson,KeyframeDataItem,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const keyframeDataItem of this._keyframeDataItems)keyframeDataItem.Release();C3.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((first, +second)=>first.GetTime()-second.GetTime());for(let i=0;ia.GetTime()-b.GetTime())}GetKeyframeDataItemIndex(keyframeDataItem){return this._keyframeDataItems.indexOf(keyframeDataItem)}GetKeyframeDataItemFromIndex(index){return this._keyframeDataItems[index]}*keyframeDataItems(){for(const keyframeDataItem of this._keyframeDataItems)yield keyframeDataItem}*keyframeDataItemsReverse(){for(let i= +this._keyframeDataItems.length-1;i>=0;i--)yield this._keyframeDataItems[i]}_SaveToJson(){return{"keyframeDataItemsJson":this._keyframeDataItems.map(keyframeDataItem=>keyframeDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,o["keyframeDataItemsJson"],KeyframeDataItem,this);this._LinkKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeData.js +{ +'use strict';const C3=self.C3;const VALUE_DATA=0;const VALUE_DATA_VALUE=0;const VALUE_DATA_ABSOLUTE_VALUE=1;const VALUE_DATA_TYPE=2;const TIME=1;const EASE=2;const ENABLE=3;const ADDONS=4;const PATH_MODE=5; +class PropertyKeyframeDataItem{constructor(propertyKeyframeDataJson,propertyKeyframeData){this._propertyKeyframeData=propertyKeyframeData;this._value=null;this._aValue=null;this._type="";this._time=NaN;this._ease="noease";this._enable=false;this._addonData=null;this._addonInstance=undefined;this._pathMode="line";if(!propertyKeyframeDataJson)return;this._value=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_VALUE];this._aValue=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_ABSOLUTE_VALUE];this._type= +propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_TYPE];this._time=propertyKeyframeDataJson[TIME];this._ease=propertyKeyframeDataJson[EASE];this._enable=!!propertyKeyframeDataJson[ENABLE];this._pathMode=propertyKeyframeDataJson[PATH_MODE];this._addonData=null;if(!!propertyKeyframeDataJson[ADDONS])this._addonData=new C3.AddonData(propertyKeyframeDataJson[ADDONS],this);this._next=null;this._prev=null}Release(){this._propertyKeyframeData=null;if(this._addonData){this._addonData.Release();this._addonData= +null}this._next=null;this._prev=null}GetAddonData(){return this._addonData}SetNext(next){this._next=next}GetNext(){return this._next}SetPrevious(prev){this._prev=prev}GetPrevious(){return this._prev}GetValue(){return this._value}SetValue(value){if(this._type==="color"&&C3.IsFiniteNumber(value)){this._value[0]=C3.GetRValue(value);this._value[1]=C3.GetGValue(value);this._value[2]=C3.GetBValue(value)}else this._value=value}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(aValue){if(this._type=== +"color"&&C3.IsFiniteNumber(aValue)){this._aValue[0]=C3.GetRValue(aValue);this._aValue[1]=C3.GetGValue(aValue);this._aValue[2]=C3.GetBValue(aValue)}else this._aValue=aValue}GetValueWithResultMode(){const rm=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if(rm==="relative")return this.GetValue();else if(rm==="absolute")return this.GetAbsoluteValue()}GetType(){return this._type}SetType(t){this._type=t}GetTime(){return this._time}SetTime(t){this._time=t;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease= +e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetPathMode(){return this._pathMode}GetAddOn(id){if(!this._addonData)return;if(this._addonInstance||this._addonInstance===null)return this._addonInstance;const addonArray=this._addonData.GetAddDataItemArray();if(!addonArray){this._addonInstance=null;return this._addonInstance}const len=addonArray.length;for(let i=0;ifirst.GetTime()-second.GetTime());for(let i=0;i=0)current.SetPrevious(dataItems[i-1])}dataItems=this._propertyKeyframeDataItemsIncludingDisabled;dataItems.sort((first,second)=>first.GetTime()-second.GetTime());for(let i=0;i=0)current.SetPrevious(dataItems[i-1])}}AddEmptyPropertyKeyframeDataItem(){const propertyKeyframeDataItem=new PropertyKeyframeDataItem(null,this);this._propertyKeyframeDataItems.push(propertyKeyframeDataItem);this._LinkPropertyKeyframeDataItems();return propertyKeyframeDataItem}DeletePropertyKeyframeDataItems(match){for(const propertyKeyframeDataItem of this._propertyKeyframeDataItems){if(!match(propertyKeyframeDataItem))continue;const index= +this._propertyKeyframeDataItems.indexOf(propertyKeyframeDataItem);if(index===-1)continue;propertyKeyframeDataItem.Release();this._propertyKeyframeDataItems.splice(index,1)}this.SortPropertyKeyFrameDataItems();this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,b)=>a.GetTime()-b.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetLastPropertyKeyframeDataItem(){return this._propertyKeyframeDataItems[this._propertyKeyframeDataItems.length- +1]}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}GetPropertyKeyframeDataItemArrayIncludingDisabled(){return this._propertyKeyframeDataItemsIncludingDisabled}*propertyKeyframeDataItems(){for(const propertyKeyframeDataItem of this._propertyKeyframeDataItems)yield propertyKeyframeDataItem}*propertyKeyframeDataItemsReverse(){for(let i=this._propertyKeyframeDataItems.length-1;i>=0;i--)yield this._propertyKeyframeDataItems[i]}_SaveToJson(){const propertyKeyframeDataItems=this._propertyKeyframeDataItems; +const propertyKeyframeDataItemsIncludingDisabled=this._propertyKeyframeDataItemsIncludingDisabled;return{"propertyKeyframeDataItemsJson":propertyKeyframeDataItems.map(propertyTrackDataItem=>{return propertyTrackDataItem._SaveToJson()}),"propertyKeyframeDataItemsIncludingDisabledJson":propertyKeyframeDataItemsIncludingDisabled.map(propertyTrackDataItem=>{return propertyTrackDataItem._SaveToJson()})}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems, +o["propertyKeyframeDataItemsJson"],PropertyKeyframeDataItem,this);C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItemsIncludingDisabled,o["propertyKeyframeDataItemsIncludingDisabledJson"],PropertyKeyframeDataItem,this);this._LinkPropertyKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeAddonData.js +{ +'use strict';const C3=self.C3;const ADDON_ID=0;const ADDON_DATA=1;class AddonDataItem{constructor(addonDataJson,addonData){this._addonData=addonData;this._id=addonDataJson[ADDON_ID];this._data=addonDataJson[ADDON_DATA]}Release(){this._addonData=null;this._data=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{"id":this._id,"data":this._data}}_LoadFromJson(o){if(!o)return;this._id=o["id"];this._data=o["data"]}}const START_ANCHOR=0;const START_ENABLE=1; +const END_ANCHOR=2;const END_ENABLE=3; +class AddonDataCubicBezierItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._startAnchor=this._data[START_ANCHOR];this._startEnable=!!this._data[START_ENABLE];this._endAnchor=this._data[END_ANCHOR];this._endEnable=!!this._data[END_ENABLE]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),{"startAnchor":this._startAnchor, +"startEnable":!!this._startEnable,"endAnchor":this._endAnchor,"endEnable":!!this._endEnable})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._startAnchor=o["startAnchor"];this._startEnable=!!o["startEnable"];this._endAnchor=o["endAnchor"];this._endEnable=!!o["endEnable"]}}const DIRECTION=0;const REVOLUTIONS=1; +class AddonDataAngleItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._direction=this._data[DIRECTION];this._revolutions=this._data[REVOLUTIONS]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),{"direction":this._direction,"revolutions":this._revolutions})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._direction=o["direction"]; +this._revolutions=o["revolutions"]}} +C3.AddonData=class AddonData{constructor(addonsDataJson,propertyKeyframeDataItem){this._propertyKeyframeDataItem=propertyKeyframeDataItem;this._addonDataItems=[];C3.TimelineDataManager._CreateDataItems(this._addonDataItems,addonsDataJson,{prop:0,map:new Map([["cubic-bezier",AddonDataCubicBezierItem],["angle",AddonDataAngleItem]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const addonDataItem of this._addonDataItems)addonDataItem.Release();C3.clearArray(this._addonDataItems);this._addonDataItems= +null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const addonDataItem of this._addonDataItems)yield addonDataItem}_SaveToJson(){return{"addonDataItemsJson":this._addonDataItems.map(addonDataItem=>addonDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,o["addonDataItemsJson"],{prop:"id",map:new Map([["cubic-bezier",AddonDataCubicBezierItem], +["angle",AddonDataAngleItem]])},this)}}; + +} + +// timelines/tweens/tweenState.js +{ +'use strict';const C3=self.C3;const INITIAL_VALUE_MODE_START_VALUE="start-value";const INITIAL_VALUE_MODE_CURRENT_STATE="current-state";const PING_PONG_BEGIN=0;const PING_PONG_END=1;let createdTweens=0; +C3.TweenState=class Tween extends C3.TimelineState{constructor(tweenDataItem,timelineManager){super(`tween-${createdTweens++}`,tweenDataItem,timelineManager);this._id="";this._destroyInstanceOnComplete=false;this._initialValueMode=INITIAL_VALUE_MODE_START_VALUE;this._instance=null;this._on_completed_callbacks=null;this._on_started_callbacks=null;this._track=null;this._iTweenState=null}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"tweenstatereleased");event.tweenState=this;dispatcher.dispatchEvent(event)}GetType(){return 1}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(C3.TweenTrackState.Create(this, +trackDataItem));this._track=this._tracks[0]}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TweenTrackState.Create(this,trackDataItem);this._tracks.push(track);this._track=this._tracks[0];return track}GetPropertyTrack(propertyName){return this._track.GetPropertyTracks()[0]}SetPropertyType(type){this._propertyType=type}GetInstance(){const tracks=this.GetTracks();if(!tracks||!tracks.length)return;const track=tracks[0];this._track=track;if(!track)return; +const instance=track.GetInstance();return track.IsInstanceValid()?instance:undefined}AddStartedCallback(c){if(!this._on_started_callbacks)this._on_started_callbacks=[];this._on_started_callbacks.push(c)}AddCompletedCallback(c){if(!this._on_completed_callbacks)this._on_completed_callbacks=[];this._on_completed_callbacks.push(c)}RemoveStartedCallback(c){if(!this._on_started_callbacks)return;const index=this._on_started_callbacks.indexOf(c);if(index!==-1)this._on_started_callbacks.splice(index,1)}RemoveCompletedCallback(c){if(!this._on_completed_callbacks)return; +const index=this._on_completed_callbacks.indexOf(c);if(index!==-1)this._on_completed_callbacks.splice(index,1)}SetStartValue(startValue,propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks){if(propertyTrack.GetPropertyName()!==propertyName)continue;const propertyTrackData=propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem); +propertyKeyframeDataItem.SetValue(startValue);propertyKeyframeDataItem.SetAbsoluteValue(startValue)}}_GetPropertyTrackState(propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks)if(propertyTrack.GetPropertyName()===propertyName)return propertyTrack}BeforeSetEndValues(properties){for(const propertyName of properties){const propertyTrackState=this._GetPropertyTrackState(propertyName);this.SetStartValue(propertyTrackState.GetCurrentState(),propertyName)}if(this.IsForwardPlayBack()){const newTotalTime= +this.GetTotalTime()-this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(0)}else{const newTotalTime=this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(newTotalTime)}this.SetInitialStateFromSetTime()}SetEndValue(endValue,propertyName){const propertyTrackState=this._GetPropertyTrackState(propertyName);const propertyTrackData=propertyTrackState.GetPropertyTrackData(); +const propertyTrackDataItem=propertyTrackState.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);propertyKeyframeDataItem.SetTime(this.GetTotalTime());propertyKeyframeDataItem.SetValue(endValue);propertyKeyframeDataItem.SetAbsoluteValue(endValue)}SetId(id){this._id=id}GetId(){return this._id}SetInitialValueMode(initialValueMode){this._initialValueMode=initialValueMode}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(releaseOnComplete){this._destroyInstanceOnComplete= +releaseOnComplete}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const c of this._on_started_callbacks)c(this);if(this.IsComplete())return;for(const track of this._tracks)track.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return;this._finishedTriggers=true;if(this._on_completed_callbacks)for(const c of this._on_completed_callbacks)c(this)}SetTime(time){this._DeleteIntermediateKeyframes(); +super.SetTime(time)}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time;this._track.SetResetState()}SetInitialState(fromSetTime){if(!this.InitialStateSet()&&this.GetInitialValueMode()===INITIAL_VALUE_MODE_CURRENT_STATE)for(const track of this._tracks)track.CompareInitialStateWithCurrent();super.SetInitialState(fromSetTime)}Stop(completed=false){super.Stop(completed); +if(this.IsComplete())return;for(const track of this._tracks)track.SaveState()}Reset(render=true,beforeChangeLayout=false){this._DeleteIntermediateKeyframes();super.Reset(render,beforeChangeLayout)}_DeleteIntermediateKeyframes(){for(const track of this._tracks){const del=kf=>{const time=kf.GetTime();const totalTime=this.GetTotalTime();return time!==0&&time!==totalTime};track.DeleteKeyframes(del);track.DeletePropertyKeyframes(del)}}_OnBeforeChangeLayout(){if(this.IsReleased())return true;const instance= +this.GetInstance();if(instance&&instance.GetObjectClass().IsGlobal())return false;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return true}Tick(deltaTime,timeScale,deltaTime1){if(!this._instance)this._instance=this.GetInstance();if(!this._instance||this._instance.IsDestroyed()){this.Stop(true);this.OnCompleted();return}const instanceTimeScale=this._instance.GetTimeScale();if(instanceTimeScale!==-1)deltaTime=deltaTime1*instanceTimeScale;if(deltaTime=== +0&&this._lastDelta===0)return;this._lastDelta=deltaTime;const lastTime=this._playheadTime;const newDeltaTime=deltaTime*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime;if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>= +totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<= +0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&&pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue= +true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<=0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}if(complete){this._track.SetEndState();this.Stop(true);this.OnCompleted();return}this._track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false);if(this._firstTick)this._firstTick=false}_SaveToJson(){const ret=super._SaveToJson();const tweenDataItem= +this.GetTimelineDataItem();return Object.assign(ret,{"tweenDataItemJson":tweenDataItem._SaveToJson(),"id":this._id,"destroyInstanceOnComplete":this._destroyInstanceOnComplete,"initialValueMode":this._initialValueMode})}_LoadFromJson(o){if(!o)return;const tweenDataItem=this.GetTimelineDataItem();tweenDataItem._LoadFromJson(o["tweenDataItemJson"]);super._LoadFromJson(o);this._id=o["id"];this._destroyInstanceOnComplete=o["destroyInstanceOnComplete"];this._initialValueMode=o["initialValueMode"]}static IsPlaying(tween){return tween.IsPlaying()}static IsPaused(tween){return tween.IsPaused()}static Build(config){const timelineManager= +config.runtime.GetTimelineManager();const tweenDataItem=new C3.TimelineDataItem;if(config.json){tweenDataItem._LoadFromJson(config.json["tweenDataItemJson"]);const tween=new C3.TweenState(tweenDataItem,timelineManager);tween._LoadFromJson(config.json);return tween}else{const tween=new C3.TweenState(tweenDataItem,timelineManager);if(!C3.IsArray(config.propertyTracksConfig))config.propertyTracksConfig=[config.propertyTracksConfig];tween.SetId(config.id);tween.SetTags(config.tags);tween.SetInitialValueMode(config.initialValueMode); +tween.SetDestroyInstanceOnComplete(config.releaseOnComplete);tween.SetLoop(config.loop);tween.SetPingPong(config.pingPong);tween.SetTotalTime(config.time);tween.SetStep(0);tween.SetInterpolationMode("default");tween.SetResultMode(config.propertyTracksConfig[0].resultMode);tween.SetRepeatCount(config.repeatCount);const track=tween.AddTrack();track.SetInstanceUID(config.instance.GetUID());track.SetInterpolationMode("default");track.SetResultMode(config.propertyTracksConfig[0].resultMode);track.SetEnable(true); +track.SetObjectClassIndex(config.instance.GetObjectClass().GetIndex());const sdkIntance=config.instance.GetSdkInstance();const w=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalWidth():config.instance.GetWorldInfo().GetWidth();const h=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalHeight():config.instance.GetWorldInfo().GetHeight();track.SetOriginalWidth(w);track.SetOriginalHeight(h);const startKeyframeDataItem=track.AddKeyframe();startKeyframeDataItem.SetTime(0);startKeyframeDataItem.SetEase("noease"); +startKeyframeDataItem.SetEnable(true);startKeyframeDataItem.SetTags("");const endKeyframeDataItem=track.AddKeyframe();endKeyframeDataItem.SetTime(config.time);endKeyframeDataItem.SetEase("noease");endKeyframeDataItem.SetEnable(true);endKeyframeDataItem.SetTags("");for(const propertyTrackConfig of config.propertyTracksConfig){const propertyTrack=track.AddPropertyTrack();propertyTrack.SetSourceAdapterId(propertyTrackConfig.sourceId);propertyTrack.SetSourceAdapterArgs(propertyTrackConfig.sourceArgs); +propertyTrack.SetPropertyName(propertyTrackConfig.property);propertyTrack.SetPropertyType(propertyTrackConfig.type);propertyTrack.SetMin(NaN);propertyTrack.SetMax(NaN);propertyTrack.SetInterpolationMode("default");propertyTrack.SetResultMode(propertyTrackConfig.resultMode);propertyTrack.SetEnable(true);const startPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();startPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);startPropertyKeyframeDataItem.SetTime(0);startPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease); +startPropertyKeyframeDataItem.SetEnable(true);startPropertyKeyframeDataItem.SetValue(propertyTrackConfig.startValue);startPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.startValue);const endPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();endPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);endPropertyKeyframeDataItem.SetTime(config.time);endPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease);endPropertyKeyframeDataItem.SetEnable(true);endPropertyKeyframeDataItem.SetValue(propertyTrackConfig.endValue); +endPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.endValue);propertyTrack.GetSourceAdapter()}return tween}}GetITweenState(behInst,opts){if(!this._iTweenState)this._iTweenState=C3.New(self.ITweenState,this,behInst,opts);return this._iTweenState}}; + +} + +// timelines/tweens/tweenTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenTrackState=class TweenTrack extends C3.TrackState{constructor(timeline,trackDataItem){super(timeline,trackDataItem);this._firstPropertyTrack=null;this._secondPropertyTrack=null}static Create(timeline,trackDataItem){return C3.New(C3.TweenTrackState,timeline,trackDataItem)}_CachePropertyTracks(){if(this._propertyTracks.length===1)this._firstPropertyTrack=this._propertyTracks[0];else{this._firstPropertyTrack=this._propertyTracks[0];this._secondPropertyTrack=this._propertyTracks[1]}}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem)); +this._CachePropertyTracks()}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData();const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem);this._propertyTracks.push(propertyTrack);this._CachePropertyTracks();return propertyTrack}SetInitialState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const timeline=this.GetTimeline();const isForwardPlayBack= +timeline.IsForwardPlayBack();const time=isForwardPlayBack?0:this.GetLocalTotalTime();for(const propertyTrack of this._propertyTracks){propertyTrack.SetInitialState(time);if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange=1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;const nba=this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter=1;this._lastKeyframeDataItem= +this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time)}BeforeInterpolate(){}Interpolate(time,isTicking=false,setTime=false,ensureValue=false,firstTick=false,ignoreGlobals=false,endState=false){if(!this._instance)this.GetInstance();if(!this._instance)return;const instanceValid=!this._instance.IsDestroyed();if(!instanceValid)return false;if(ignoreGlobals&&this.GetObjectClass().IsGlobal())return false;if(this._secondPropertyTrack){this._firstPropertyTrack.Interpolate(time, +setTime,ensureValue,endState);this._secondPropertyTrack.Interpolate(time,setTime,ensureValue,endState)}else this._firstPropertyTrack.Interpolate(time,setTime,ensureValue,endState);if(this._firstPropertyTrack.GetWorldInfoChange()!==0){if(!this._worldInfo)this._worldInfo=this._instance.GetWorldInfo();if(this._worldInfo)this._worldInfo.SetBboxChanged()}}AfterInterpolate(){}_LoadFromJson(o){super._LoadFromJson(o);this._CachePropertyTracks()}}; + +} + +// timelines/tweens/tweenPropertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenPropertyTrackState=class TweenPropertyTrackState extends C3.PropertyTrackState{constructor(track,propertyTrackDataItem){super(track,propertyTrackDataItem);this._basic=false}static Create(track,propertyTrackDataItem){return C3.New(C3.TweenPropertyTrackState,track,propertyTrackDataItem)}Interpolate(time,setTime=false,ensureValue=false,endState=false){let start;let end;if(this._basic){start=this._propertyKeyframeDataItems[0];end=this._propertyKeyframeDataItems[1]}else if(setTime){start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem);end=start.GetNext()}else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);start=this._lastPropertyKeyframeDataItem;end=start.GetNext()}this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue,endState)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem=propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=this.GetPropertyKeyframeDataItems().length<= +2;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem=null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match);this._basic=this.GetPropertyKeyframeDataItems().length<=2}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson(),"basic":this._basic}}_LoadFromJson(o){if(!o)return;this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"]);this._basic= +o["basic"]}}; + +} + +// timelines/transitions/transition.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const NAME=0;const TRANSITION_KEYFRAMES=1; +C3.Transition=class Transition extends C3.DefendedBase{constructor(data,addCustomEase=true){super();this._name=data[NAME];this._linear=false;this._transitionKeyframes=[];for(const transitionKeyframeData of data[TRANSITION_KEYFRAMES]){const transitionKeyframe=C3.TransitionKeyframe.Create(this,transitionKeyframeData);this._transitionKeyframes.push(transitionKeyframe)}for(let i=0;ithis.Interpolate(t,sv,dv,tt))}static Create(data){return C3.New(C3.Transition,data)}Release(){for(const transitionKeyframe of this._transitionKeyframes)transitionKeyframe.Release();C3.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear(); +this._transitionKeyframeCache=null}MakeLinear(linear){this._linear=!!linear}GetTransitionKeyFrameAt(x){const transitionKeyframe=this._transitionKeyframeCache.get(x);if(transitionKeyframe)return transitionKeyframe;for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()===x){this._transitionKeyframeCache.set(x,transitionKeyframe);return transitionKeyframe}}GetFirstTransitionKeyFrameHigherThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()> +x)return transitionKeyframe}GetFirstTransitionKeyFrameHigherOrEqualThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()>=x)return transitionKeyframe}GetFirstTransitionKeyFrameLowerThan(x){for(let i=this._transitionKeyframes.length-1;i>=0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()= +0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()<=x)return transitionKeyframe}}Interpolate(time,startValue,deltaValue,totalTime){let n=time/totalTime;if(this._linear){if(totalTime===0)return startValue+deltaValue;return Ease.NoEase(time,startValue,deltaValue,totalTime)}if(totalTime===0)n=1;let start=this.GetFirstTransitionKeyFrameLowerOrEqualThan(n);let end=start.GetNext();if(!end){start=this.GetFirstTransitionKeyFrameLowerThan(n);end=start.GetNext()}const delta= +end.GetValueX()-start.GetValueX();const nn=C3.mapToRange(n,start.GetValueX(),end.GetValueX(),0,delta);const startX=start.GetValueX();const startY=start.GetValueY();const anchor1X=start.GetValueX()+start.GetStartAnchorX();const anchor1Y=start.GetValueY()+start.GetStartAnchorY();const anchor2X=end.GetValueX()+end.GetEndAnchorX();const anchor2Y=end.GetValueY()+end.GetEndAnchorY();const endX=end.GetValueX();const endY=end.GetValueY();let ret=Ease.GetRuntimeEase("spline")(nn,startX,startY,anchor1X,anchor1Y, +anchor2X,anchor2Y,endX,endY,this._precalculatedSamples.get(start));ret+=start.GetValueY();return(1-ret)*startValue+ret*(startValue+deltaValue)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let i=0;ithis._OnInstanceDestroy(e.instance)}Release(){this.RemoveRuntimeListeners();if(this._templateDataMap){for(const objectClassTemplatesMap of this._templateDataMap.values())objectClassTemplatesMap.clear();this._templateDataMap.clear()}this._templateDataMap=null;this._runtime=null}Create(templateInstanceData){if(!this._templateDataMap)this._templateDataMap= +new Map;if(!templateInstanceData)return;const templateData=templateInstanceData[0][16];const templateName=templateData[0];const objectClassIndex=templateInstanceData[1];if(!this._templateDataMap.has(objectClassIndex))this._templateDataMap.set(objectClassIndex,new Map);const objectClassTemplatesMap=this._templateDataMap.get(objectClassIndex);objectClassTemplatesMap.set(templateName,templateInstanceData)}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.addEventListener("instancedestroy", +this._instanceDestroy)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.removeEventListener("instancedestroy",this._instanceDestroy)}HasTemplates(){if(!this._templateDataMap)return false;return this._templateDataMap.size!==0}GetTemplateData(objectClass_or_index,templateName){let index=0;if(objectClass_or_index instanceof C3.ObjectClass)index=objectClass_or_index.GetIndex();else index=objectClass_or_index;if(!this._templateDataMap.has(index))return;const ret= +this._templateDataMap.get(index).get(templateName);if(ret)return JSON.parse(JSON.stringify(ret));return undefined}MapInstanceToTemplateName(inst,templateName){if(!this._instanceToTemplateNameMap)this._instanceToTemplateNameMap=new WeakMap;if(this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.set(inst,templateName)}GetInstanceTemplateName(inst){if(!this._instanceToTemplateNameMap)return"";const ret=this._instanceToTemplateNameMap.get(inst);if(ret)return ret;return""}_OnInstanceDestroy(inst){if(!this._instanceToTemplateNameMap)return; +if(!this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.delete(inst)}}; + +} + +// events/stacks/solStack.js +{ +'use strict';const C3=self.C3; +C3.SolStack=class SolStack extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._stack=[];this._stack.push(C3.New(C3.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const s of this._stack)s.Release();C3.clearArray(this._stack);this._current=null;this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}GetOneBelowCurrentSol(){return this._stack[this._index-1]}Clear(){this.GetCurrentSol().Clear()}PushClean(){const stack=this._stack; +const index=++this._index;if(index===stack.length){const sol=C3.New(C3.Sol,this);stack.push(sol);this._current=sol}else{const sol=stack[index];sol.Reset();this._current=sol}}PushCopy(){const stack=this._stack;const index=++this._index;if(index===stack.length)stack.push(C3.New(C3.Sol,this));const sol=stack[index];sol.Copy(stack[index-1]);this._current=sol}Pop(){this._current=this._stack[--this._index]}RemoveInstances(s){const stack=this._stack;for(let i=0,len=stack.length;i=0}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index=== +this._stack.length){const ret=C3.New(C3.Loop,this);this._stack.push(ret);return ret}else{const ret=this._stack[this._index];ret.Reset();return ret}}Pop(){--this._index}FindByName(name){const stack=this._stack;for(let i=this._index;i>=0;--i){const loop=stack[i];if(loop.GetName()===name)return loop}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}; + +} + +// events/stacks/loop.js +{ +'use strict';const C3=self.C3;C3.Loop=class Loop extends C3.DefendedBase{constructor(loopStack){super();this._loopStack=loopStack;this._name="";this._index=0;this._isStopped=false;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=false;this._end=NaN}SetName(name){this._name=name}GetName(){return this._name}SetIndex(i){this._index=i}GetIndex(){return this._index}Stop(){this._isStopped=true}IsStopped(){return this._isStopped}SetEnd(e){this._end=e}GetEnd(){return this._end}}; + +} + +// events/stacks/arrayStack.js +{ +'use strict';const C3=self.C3;C3.ArrayStack=class ArrayStack extends C3.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){C3.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const ret=[];this._stack.push(ret);return ret}else return this._stack[this._index]}Pop(){--this._index}}; + +} + +// events/eventSheetManager.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortSolArray(a,b){return a.GetIndex()-b.GetIndex()}function IsSolArrayIdentical(a,b){for(let i=0,len=a.length;ithis._InvokeFunctionFromJS(name,params)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release(); +this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;C3.clearArray(this._queuedTriggers);C3.clearArray(this._queuedDebugTriggers);this._runtime=null;C3.clearArray(this._allSheets);this._sheetsByName.clear()}Create(eventSheetData){const eventSheet=C3.New(C3.EventSheet,this,eventSheetData);this._allSheets.push(eventSheet);this._sheetsByName.set(eventSheet.GetName().toLowerCase(),eventSheet)}_AddTriggerToPostInit(trig){this._triggersToPostInit.push(trig)}_PostInit(){for(const customActionBlock of this._customActionBlocksMap.values())customActionBlock._CheckOverrideState(); +for(const functionBlock of this._functionBlocksByName.values())functionBlock._PostInit();for(const customActionBlock of this._customActionBlocksMap.values())customActionBlock._PostInit();for(const sheet of this._allSheets)sheet._PostInit();for(const sheet of this._allSheets)sheet._UpdateDeepIncludes();for(const trig of this._triggersToPostInit)trig._PostInit(false);C3.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(name){return this._sheetsByName.get(name.toLowerCase())|| +null}_RegisterGroup(group){this._allGroups.push(group);this._groupsByName.set(group.GetGroupName(),group)}_RegisterEventBlock(eventBlock){this._blocksBySid.set(eventBlock.GetSID(),eventBlock)}_RegisterCondition(condition){this._cndsBySid.set(condition.GetSID(),condition)}_RegisterAction(action){this._actsBySid.set(action.GetSID(),action)}_RegisterFunctionBlock(functionBlock){switch(functionBlock.GetFunctionType()){case 0:this._functionBlocksByName.set(functionBlock.GetFunctionName().toLowerCase(), +functionBlock);break;case 1:this._customActionBlocksMap.set(functionBlock.GetFunctionName().toLowerCase(),functionBlock);break;default:}}_RegisterEventVariable(ev){this._eventVarsBySid.set(ev.GetSID(),ev);if(ev.IsGlobal())this._allGlobalVars.push(ev);else this._allLocalVars.push(ev)}_DeduplicateSolModifierList(arr){if(arr.length>=2)arr.sort(SortSolArray);let candidateList=this._allUniqueSolModifiers.get(arr.length);if(!candidateList){candidateList=[];this._allUniqueSolModifiers.set(arr.length,candidateList)}for(let i= +0,len=candidateList.length;iresolve=r);this._queuedDebugTriggers.push([method,inst,behaviorType,resolve]);return ret}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw new Error("should not be in breakpoint");const layoutManager=this._runtime.GetLayoutManager();while(this._queuedDebugTriggers.length){const [method,inst,behaviorType,resolve]=this._queuedDebugTriggers.shift();const ret=yield*this._DebugTrigger(layoutManager,method,inst,behaviorType);resolve(ret)}}async RunQueuedDebugTriggersAsync(){for(const breakEventObject of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(breakEventObject)}_FastTrigger(layoutManager, +method,inst,value){let ret=false;const layout=layoutManager.GetMainRunningLayout();const eventSheet=layout.GetEventSheet();if(!eventSheet)return;this._executingTriggerDepth++;this._runtime.PushCurrentLayout(layout);const deepIncludes=eventSheet.deepIncludes();for(let i=0,len=deepIncludes.length;i0}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return this._runningEventsDepth>0}IsInEventEngine(){return this.IsRunningEvents()||this.IsInTrigger()}_RunQueuedTriggers(layoutManager){for(const [method,inst,behaviorType]of this._queuedTriggers)this._Trigger(layoutManager, +method,inst,behaviorType);C3.clearArray(this._queuedTriggers)}BlockFlushingInstances(e){if(e)this._blockFlushingDepth++;else this._blockFlushingDepth--}IsFlushingBlocked(){return this._blockFlushingDepth>0}ClearSol(solModifiers){for(let i=0,len=solModifiers.length;i0){for(const t of pushSet)t.GetSolStack().PushClean();return[...pushSet]}else return null}AddScheduledWait(){const w=C3.New(C3.ScheduledWait,this);this._scheduledWaits.push(w);return w}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(!this._scheduledWaits.length)return;const frame=this.GetCurrentEventStackFrame();let didAnyRun=false;this._runningEventsDepth++;for(let i=0, +len=this._scheduledWaits.length;iw.ShouldRelease());for(const w of toRelease)w.Release()}ClearAllScheduledWaits(){for(const w of this._scheduledWaits)w.Release();C3.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(s){for(const w of this._scheduledWaits)w.RemoveInstances(s)}AddAsyncActionPromise(p){this._asyncActionPromises.push(p)}ClearAsyncActionPromises(){C3.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const ret= +Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return ret}_SaveToJson(){return{"groups":this._SaveGroupsToJson(),"cnds":this._SaveCndsToJson(),"acts":this._SaveActsToJson(),"vars":this._SaveVarsToJson(),"waits":this._SaveScheduledWaitsToJson()}}_LoadFromJson(o){this._LoadGroupsFromJson(o["groups"]);this._LoadCndsFromJson(o["cnds"]);this._LoadActsFromJson(o["acts"]);this._LoadVarsFromJson(o["vars"]);this._LoadScheduledWaitsFromJson(o["waits"])}_SaveGroupsToJson(){const o={};for(const group of this.GetAllGroups())o[group.GetSID().toString()]= +group.IsGroupActive();return o}_LoadGroupsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const group=this.GetEventGroupBySID(sid);if(group)group.SetGroupActive(data)}}_SaveCndsToJson(){const o={};for(const [sid,cnd]of this._cndsBySid){const data=cnd._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadCndsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,cnd]of this._cndsBySid)cnd._LoadFromJson(map.get(sid)|| +null)}_SaveActsToJson(){const o={};for(const [sid,act]of this._actsBySid){const data=act._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadActsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,act]of this._actsBySid)act._LoadFromJson(map.get(sid)||null)}_SaveVarsToJson(){const o={};for(const [sid,eventVar]of this._eventVarsBySid)if(!eventVar.IsConstant()&&(eventVar.IsGlobal()||eventVar.IsStatic()))o[sid.toString()]= +eventVar.GetValue();return o}_LoadVarsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const eventVar=this.GetEventVariableBySID(sid);if(eventVar)eventVar.SetValue(data)}}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(w=>!w.IsPromise()).map(w=>w._SaveToJson())}_LoadScheduledWaitsFromJson(arr){this.ClearAllScheduledWaits();for(const data of arr){const sw=C3.ScheduledWait._CreateFromJson(this,data);if(sw)this._scheduledWaits.push(sw)}}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(l=> +l.GetEventSheet()).filter(eventSheet=>eventSheet).map(e=>e._GetPerfRecord())}FindFirstFunctionBlockParent(parent){while(parent){const scopeParent=parent.GetScopeParent();if(scopeParent instanceof C3.FunctionBlock)return scopeParent;parent=scopeParent}return null}_InvokeFunctionFromJS(name,params){if(!Array.isArray(params))params=[];const functionBlock=this.GetFunctionBlockByName(name.toLowerCase());if(!functionBlock)return null;if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +const functionParameters=functionBlock.GetFunctionParameters();if(params.length1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i< +len;++i)if(!parents[i].RunPreTrigger(frame)){okToRun=false;break}}if(okToRun){if(trigger.IsOrBlock())trigger.RunOrBlockTrigger(frame,index);else trigger.Run(frame);ret=frame.GetLastEventTrue()}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();eventSheetManager.PopSol(trigger.GetSolModifiersIncludingParents());if(currentEvent)eventSheetManager.PopSol(currentEvent.GetSolModifiersIncludingParents());if(!currentEvent&&triggerDepth===1){eventSheetManager.ClearAsyncActionPromises(); +if(!eventSheetManager.IsFlushingBlocked())runtime.FlushPendingInstances()}return ret}*_DebugExecuteTrigger(inst,trigger,index){const runtime=this._runtime;const eventSheetManager=this._eventSheetManager;const currentEvent=eventSheetManager.GetCurrentEvent();const eventStack=eventSheetManager.GetEventStack();const triggerDepth=eventSheetManager.GetTriggerDepth();let ret=false;if(currentEvent)eventSheetManager.PushCleanSol(currentEvent.GetSolModifiersIncludingParents());eventSheetManager.PushCleanSol(trigger.GetSolModifiersIncludingParents()); +const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i0){let hasAnyActionWithReturnType=false;for(const a of this._actions){a._PostInit();if(a.HasReturnType())hasAnyActionWithReturnType=true}if(hasAnyActionWithReturnType){this._RunActions=this._RunActions_ReturnValue; +this._DebugRunActions=this._DebugRunActions_ReturnValue}else{this._RunActions=this._RunActions_Fast;this._DebugRunActions=this._DebugRunActions_Fast}}const subEvents=this._subEvents;for(let i=0,len=subEvents.length;ic.DebugCanRunFast());dd.canRunAllActionsFast=this._actions.every(a=>a.DebugCanRunFast());dd.canRunAllSubEventsFast=this._subEvents.every(s=>s.DebugCanRunFast());dd.canRunSelfFast=dd.canRunAllConditionsFast&&dd.canRunAllActionsFast&&dd.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let e=this;do{e._UpdateCanRunFast(); +e=e.GetParent()}while(e)}_IdentifyTopLevelGroup(){if(!this.IsGroup())return;let p=this.GetParent();this._isTopLevelGroup=true;while(p){if(!p.IsGroup()){this._isTopLevelGroup=false;break}p=p.GetParent()}}_IdentifySolModifiersIncludingParents(){const allObjectClasses=this._runtime.GetAllObjectClasses();if(this._solModifiers===allObjectClasses)this._solModifiersIncludingParents=allObjectClasses;else{this._solModifiersIncludingParents=C3.cloneArray(this._solModifiers);let p=this.GetParent();while(p){for(const o of p._solModifiers)this._AddParentSolModifier(o); +p=p.GetParent()}const eventSheetManager=this.GetEventSheetManager();this._solModifiers=eventSheetManager._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=eventSheetManager._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(!this.HasAnyTriggeredCondition())return;this._triggerParents=[];let p=this.GetParent();while(p){this._triggerParents.push(p);p=p.GetParent()}this._triggerParents.reverse()}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds= +true;if(this._parent)this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){if(!this._hasGotSolModifiersIncludingParents){this._hasGotSolModifiersIncludingParents=true;this._IdentifySolModifiersIncludingParents()}return this._solModifiersIncludingParents}HasSolModifier(objectClass){return this._solModifiers.includes(objectClass)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(p){this._scopeParent= +p}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(a){a= +!!a;if(!this._isGroup)throw new Error("not a group");if(this._isGroupActive===a)return;this._isGroupActive=a;for(const include of this._containedIncludes)include.UpdateActive();if(this._containedIncludes.length){const currentLayout=this._runtime.GetCurrentLayout();const mainEventSheet=currentLayout.GetEventSheet();if(mainEventSheet)mainEventSheet._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&& +this._scopeParent instanceof C3.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(i){i=Math.floor(i);if(i<0||i>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[i]}GetConditionByDebugIndex(i){return this.GetConditionAt(i)}IsFirstConditionOfType(cnd){let i=cnd.GetIndex();if(i===0)return true; +--i;const cndObjectClass=cnd.GetObjectClass();for(;i>=0;--i){const c=this._conditions[i];if(c.GetObjectClass()===cndObjectClass||c.IsSystemCondition()&&c.GetFirstObjectParameterObjectClass()===cndObjectClass)return false}return true}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(i){i=Math.floor(i);if(i<0||i>=this._actions.length)throw new RangeError("invalid action index");return this._actions[i]}GetActionByDebugIndex(i){i=Math.floor(i);const ret=this._actions.find(a=> +a.GetDebugIndex()===i);if(!ret)throw new RangeError("invalid action debug index");return ret}_HasActionIndex(i){i=Math.floor(i);return i>=0&&ie instanceof C3.EventVariable)}RunPreTrigger(frame){frame.SetCurrentEvent(this);const conditions=this._conditions;let isAnyTrue=conditions.length===0;for(let i=0,len=conditions.length;i +0)if(isRecursive){const paramResults=parameters.map(p=>p.Get(0));eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults)}else this._scopeParent.EvaluateFunctionParameters(parameters);else if(isRecursive)eventSheetManager.GetLocalVarStack().Push()}RunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked,pickInfo){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;let extraPopSolModifiers=null;const runtime=this._runtime;const eventStack= +this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);if(pickInfo!==null){if(pickInfo.copyFromObjectClass){const copyFromSol=isCopyPicked?pickInfo.copyFromObjectClass.GetCurrentSol(): +pickInfo.copyFromObjectClass.GetSolStack().GetOneBelowCurrentSol();const copyToSol=pickInfo.copyToObjectClass.GetCurrentSol();copyToSol.SetArrayPicked(copyFromSol.GetInstances());copyToSol.ClearElseInstances();if(!isCopyPicked)pickInfo.copyToObjectClass.ApplySolToContainer()}else if(pickInfo.pickObjectClass){const objectClassSol=pickInfo.pickObjectClass.GetCurrentSol();objectClassSol.SetArrayPicked(pickInfo.pickInstances);objectClassSol.ClearElseInstances()}if(pickInfo.pushCleanSolDynamic)extraPopSolModifiers= +eventSheetManager.PushCleanSolDynamic(combinedSolModifiers)}const frame=eventStack.Push(this);if(isCopyPicked)frame.SetDynamicSolModifiers(combinedSolModifiers);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop(); +if(extraPopSolModifiers!==null)eventSheetManager.PopSol(extraPopSolModifiers);if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}*DebugRunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked,pickInfo){let ret;let asyncId;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const hasAnySolModifiers=combinedSolModifiers.length>0;let extraPopSolModifiers=null;const runtime=this._runtime;const eventStack=this._eventStack; +const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);if(pickInfo!==null){if(pickInfo.copyFromObjectClass){const copyFromSol=isCopyPicked?pickInfo.copyFromObjectClass.GetCurrentSol():pickInfo.copyFromObjectClass.GetSolStack().GetOneBelowCurrentSol(); +const copyToSol=pickInfo.copyToObjectClass.GetCurrentSol();copyToSol.SetArrayPicked(copyFromSol.GetInstances());copyToSol.ClearElseInstances();if(!isCopyPicked)pickInfo.copyToObjectClass.ApplySolToContainer()}else if(pickInfo.pickObjectClass){const objectClassSol=pickInfo.pickObjectClass.GetCurrentSol();objectClassSol.SetArrayPicked(pickInfo.pickInstances);objectClassSol.ClearElseInstances()}if(pickInfo.pushCleanSolDynamic)extraPopSolModifiers=eventSheetManager.PushCleanSolDynamic(combinedSolModifiers)}const frame= +eventStack.Push(this);if(isCopyPicked)frame.SetDynamicSolModifiers(combinedSolModifiers);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();yield*this._DebugRunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(extraPopSolModifiers!==null)eventSheetManager.PopSol(extraPopSolModifiers); +if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}RunAsMappedFunctionCall(paramResults,isCopyPicked){const solModifiers=this.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push(); +this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame=eventStack.Push(this);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);this._RunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(paramResults, +isCopyPicked){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const solModifiers=this.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults); +if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame=eventStack.Push(this);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);yield*this._DebugRunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}RunAsExpressionFunctionCall(combinedSolModifiers,isCopyPicked, +returnType,defaultReturnValue,...paramResults){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();if(paramResults.length>0)this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers); +else eventSheetManager.PushCleanSol(combinedSolModifiers);const frame=eventStack.Push(this);frame.InitCallFunctionExpression(returnType,defaultReturnValue);eventStack.PushExpFunc(frame);runtime.SetDebuggingEnabled(false);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}runtime.SetDebuggingEnabled(true); +eventStack.Pop();eventStack.PopExpFunc();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret||frame.GetFunctionReturnValue()}}; + +} + +// events/eventScript.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[];let hadUserScriptException=false; +C3.EventScript=class EventScript extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const runtime=eventSheet.GetRuntime();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;const userMethod=runtime.GetObjectReference(data[1]);this._func=userMethod;this._displayNumber=data[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber); +this._debugData=runtime.IsDebug()?{isBreakpoint:data[3][0],isBreakable:data[3][1]}:null}static Create(eventSheet,parent,data){return C3.New(C3.EventScript,eventSheet,parent,data)}_PostInit(){const userMethod=this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&& +this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b}IsElseBlock(){return false}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetSolModifiersIncludingParents(){if(this._parent)return this._parent.GetSolModifiersIncludingParents();else return EMPTY_SOL_MODIFIERS}Run(frame){frame.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(err){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`, +"font-size: 1.2em; font-weight: bold;",err);if(self.C3Debugger)self.C3Debugger._SetLastErrorScript(this);if(!hadUserScriptException){console.info(`%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()`,"font-weight: bold; text-decoration: underline","","font-weight: bold");hadUserScriptException=true}}}*DebugRun(frame){frame.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(frame)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&& +!this._runtime.DebugBreakNext()}static HadUserScriptException(){return hadUserScriptException}static SetHadUserScriptException(){hadUserScriptException=true}}; + +} + +// events/functionBlock.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.FunctionBlock=class FunctionBlock extends C3.DefendedBase{constructor(eventSheet,parent,data){super();this._eventSheet=eventSheet;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._functionType=0;this._functionName="";this._returnType=0;this._functionParameters=[];this._isEnabled=true;this._aceName="";this._objectClass=null;this._hasOverrides=false;this._innerLocalVariables=[];this._isCopyPicked=false;this._isAsync=false;this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map; +this._eventBlock=C3.EventBlock.Create(eventSheet,parent,data);this._eventBlock._SetScopeParent(this)}InitFunctionBlock(funcData){this._functionType=0;this._functionName=funcData[0];this._returnType=funcData[1];this._functionParameters=funcData[2].map(paramData=>C3.EventVariable.Create(this._eventSheet,this,paramData));this._isEnabled=funcData[3];this._isAsync=funcData[4];this._isCopyPicked=funcData[5]}InitCustomACEBlock(funcData){this._functionType=1;this._aceName=funcData[1];this._objectClass=this._runtime.GetObjectClassByIndex(funcData[2]); +this._eventBlock._AddSolModifier(this._objectClass);this._functionName=this._objectClass.GetName()+"."+this._aceName;this._returnType=funcData[3];this._functionParameters=funcData[4].map(paramData=>C3.EventVariable.Create(this._eventSheet,this,paramData));this._isEnabled=funcData[5];this._isAsync=funcData[6];this._isCopyPicked=funcData[7];this._objectClass.AddCustomAction(this)}static CreateFunctionBlock(eventSheet,parent,data){const ret=C3.New(C3.FunctionBlock,eventSheet,parent,data);const funcData= +data[1];ret.InitFunctionBlock(funcData);return ret}static CreateCustomACEBlock(eventSheet,parent,data){const ret=C3.New(C3.FunctionBlock,eventSheet,parent,data);const funcData=data[1];ret.InitCustomACEBlock(funcData);return ret}_CheckOverrideState(){if(this._objectClass&&this._objectClass.IsFamily())for(const objectType of this._objectClass.GetFamilyMembers())if(objectType.HasOwnCustomActionByName(this._aceName)){this._hasOverrides=true;break}}_PostInit(){for(const fp of this._functionParameters)fp._PostInit(); +this._eventBlock._PostInit(false)}GetFunctionType(){return this._functionType}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(localVariable){this._innerLocalVariables.push(localVariable)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(parameters){const functionParameters=this._functionParameters;for(let i= +0,len=functionParameters.length;ip.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetACEName(){return this._aceName}HasCustomACEOverrides(){return this._hasOverrides}GetReturnType(){return this._returnType}GetObjectClass(){return this._objectClass}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null; +case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsCopyPicked(){return this._isCopyPicked}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const asyncId=this._nextAsyncId++;this._currentAsyncId=asyncId;let resolve;const promise=new Promise(r=>resolve=r);this._asyncMap.set(asyncId,{resolve,pauseCount:0});return[asyncId,promise]}MaybeFinishAsyncFunctionCall(asyncId){const info=this._asyncMap.get(asyncId);if(info.pauseCount===0){info.resolve();this._asyncMap.delete(asyncId)}this._currentAsyncId= +-1}PauseCurrentAsyncFunction(){const info=this._asyncMap.get(this._currentAsyncId);info.pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(asyncId){this._currentAsyncId=asyncId;const info=this._asyncMap.get(asyncId);info.pauseCount--}RunAsFamilyCustomActionWithOverrides(combinedSolModifiers,parameters){const objectTypeMap=new Map;const familyInstances=[];for(const inst of this._objectClass.GetCurrentSol().GetInstances()){const objectType=inst.GetObjectClass();if(objectType.HasOwnCustomActionByName(this._aceName)){const arr= +objectTypeMap.get(objectType);if(Array.isArray(arr))arr.push(inst);else objectTypeMap.set(objectType,[inst])}else familyInstances.push(inst)}if(familyInstances.length>0)this._eventBlock.RunAsFunctionCall(combinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:familyInstances});if(objectTypeMap.size>0)for(const [objectType,arr]of objectTypeMap){const eventBlock=objectType.GetOwnCustomActionByName(this._aceName).GetEventBlock();const allCombinedSolModifiers= +[...(new Set([...combinedSolModifiers,...eventBlock.GetSolModifiers()]))];eventBlock.RunAsFunctionCall(allCombinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:objectType,pickInstances:arr})}}*DebugRunAsFamilyCustomActionWithOverrides(combinedSolModifiers,parameters){const objectTypeMap=new Map;const familyInstances=[];for(const inst of this._objectClass.GetCurrentSol().GetInstances()){const objectType=inst.GetObjectClass();if(objectType.HasOwnCustomActionByName(this._aceName)){const arr= +objectTypeMap.get(objectType);if(Array.isArray(arr))arr.push(inst);else objectTypeMap.set(objectType,[inst])}else familyInstances.push(inst)}if(familyInstances.length>0)yield*this._eventBlock.DebugRunAsFunctionCall(combinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:familyInstances});if(objectTypeMap.size>0)for(const [objectType,arr]of objectTypeMap){const eventBlock=objectType.GetOwnCustomActionByName(this._aceName).GetEventBlock();const allCombinedSolModifiers= +[...(new Set([...combinedSolModifiers,...eventBlock.GetSolModifiers()]))];yield*eventBlock.DebugRunAsFunctionCall(allCombinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:objectType,pickInstances:arr})}}}; + +} + +// events/eventVariable.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[]; +C3.EventVariable=class EventVariable extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._localVarStack=eventSheetManager.GetLocalVarStack();this._name=data[1];this._type=data[2];this._initialValue=data[3];this._isStatic=!!data[4];this._isConstant=!!data[5];this._isFunctionParameter=parent instanceof +C3.FunctionBlock;this._sid=data[6];this._jsPropName=this._runtime.GetJsPropName(data[8]);this._scriptSetter=v=>this.SetValue(v);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;if(this.IsBoolean())this._value=this._value?1:0;if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this._localIndex=eventSheetManager._GetNextLocalVarIndex(this);eventSheetManager._RegisterEventVariable(this)}static Create(eventSheet, +parent,data){return C3.New(C3.EventVariable,eventSheet,parent,data)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const functionBlock=this._eventSheetManager.FindFirstFunctionBlockParent(this);if(functionBlock)functionBlock._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return this._type=== +0}IsString(){return this._type===1}IsBoolean(){return this._type===2}IsElseBlock(){return false}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}Run(frame){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return true}*DebugRun(frame){this.Run(frame)}SetValue(v){if(this.IsNumber()){if(typeof v!=="number")v=parseFloat(v)}else if(this.IsString()){if(typeof v!=="string")v=v.toString()}else if(this.IsBoolean())v= +v?1:0;if(this._hasSingleValue)this._value=v;else this._localVarStack.GetCurrent()[this._localIndex]=v}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let ret=this.GetValue();if(this.IsBoolean())ret=!!ret;return ret}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:false,enumerable:true,get:this._scriptGetter,set:this._scriptSetter}}}; + +} + +// events/eventInclude.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const EMPTY_SOL_MODIFIERS=[]; +C3.EventInclude=class EventInclude extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._includeSheet=null;this._includeSheetName=data[1];this._isActive=true}static Create(eventSheet,parent,data){return C3.New(C3.EventInclude,eventSheet,parent,data)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName); +this._eventSheet._AddShallowInclude(this);let p=this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup())p._AddContainedInclude(this);p=p.GetParent()}this.UpdateActive();if(this._runtime.IsDebug())this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetIncludeSheet(){return this._includeSheet}Run(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses(); +if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);this._includeSheet.Run();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}*DebugRun(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses();if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);yield*this._includeSheet.DebugRun();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}DebugCanRunFast(){return false}IsActive(){return this._isActive}UpdateActive(){let p= +this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup()&&!p.IsGroupActive()){this._isActive=false;return}p=p.GetParent()}this._isActive=true}}; + +} + +// events/expNode.js +{ +'use strict';const C3=self.C3;const assert=self.assert;C3.ExpNode=class ExpNode extends C3.DefendedBase{constructor(owner){super();this._owner=owner;this._runtime=owner.GetRuntime()}_PostInit(){}static CreateNode(owner,data){const type=data[0];const Classes=[BehaviorExpressionNode,ObjectExpressionNode,InstVarExpressionNode,EventVarExpNode,SystemExpressionExpNode,CallFunctionExpressionExpNode];return C3.New(Classes[type],owner,data)}}; +class SystemExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(data[1]);if(this._func===C3.Plugins.System.Exps.random||this._func===C3.Plugins.System.Exps.choose)this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}} +class CallFunctionExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._functionBlock=null;this._functionName=data[1];this._owner.SetVariesPerInstance()}_PostInit(){const eventSheetManager=this._runtime.GetEventSheetManager();this._functionBlock=eventSheetManager.GetFunctionBlockByName(this._functionName);this._functionName=null;const myEventBlock=this._owner.GetEventBlock();const callEventBlock=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...(new Set([...myEventBlock.GetSolModifiersIncludingParents(), +...callEventBlock.GetSolModifiersIncludingParents()]))];this._combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const functionBlock=this._functionBlock;if(functionBlock.IsEnabled()){const callEventBlock=functionBlock.GetEventBlock();return C3.EventBlock.prototype.RunAsExpressionFunctionCall.bind(callEventBlock,this._combinedSolModifiers,functionBlock.IsCopyPicked(),functionBlock.GetReturnType(),functionBlock.GetDefaultReturnValue())}else{const defaultReturnValue= +functionBlock.GetDefaultReturnValue();return()=>defaultReturnValue}}}function WrapIndex(index,len){if(index>=len)return index%len;else if(index<0){if(index<=-len)index%=len;if(index<0)index+=len;return index}else return index} +class ObjectExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._func=this._runtime.GetObjectReference(data[2]);this._returnsString=!!data[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}ExpObject_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len=== +0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}} +class InstVarExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._varIndex=data[3];this._returnsString=!!data[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const instances=this._objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);return instances[index]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);const inst=instances[index];const offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}ExpInstVar_InstExpr(instIndex){const objectClass=this._objectClass;const instances=objectClass.GetInstances(); +const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}} +class BehaviorExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2]);this._func=this._runtime.GetObjectReference(data[3]);this._returnsString=!!data[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}ExpBehavior_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}}class EventVarExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._eventVar=null;this._eventVarSid=data[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}; + +} + +// events/parameter.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.Parameter=class Parameter extends C3.DefendedBase{constructor(owner,type,index){super();this._owner=owner;this._index=index;this._type=type;this.Get=null;this._variesPerInstance=false;this._isConstant=false}static Create(owner,data,index){const type=data[0];const Classes=[ExpressionParameter,StringExpressionParameter,FileParameter,ComboParameter,ObjectParameter,LayerExpressionParameter,LayoutParameter,ExpressionParameter,ComboParameter,ComboParameter,InstVarParameter,EventVarParameter,FileParameter, +VariadicParameter,StringExpressionParameter,TimelineParameter,BooleanParameter,FunctionParameter,EaseParameter,TilemapBrushParameter,TemplateExpressionParameter];return C3.New(Classes[type],owner,type,index,data)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=true}_MaybeVaryFor(objectClass){if(this._variesPerInstance)return;if(!objectClass)return;if(!objectClass.GetPlugin().IsSingleGlobal())this._variesPerInstance=true}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}IsObjectParameter(){return this._type=== +4}};function GetExpressionFunc(number){const ret=self.C3_ExpressionFuncs[number];if(!ret)throw new Error("invalid expression number");return ret} +class ExpressionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._solIndex=0;const expData=data[1];this._expressionNumber=expData[0];this._numberedNodes=[];this._expressionFunc=null;for(let i=1,len=expData.length;i=this._numberedNodes.length)throw new RangeError("invalid numbered node"); +return this._numberedNodes[i]}_PostInit(){for(const node of this._numberedNodes)node._PostInit();const func=GetExpressionFunc(this._expressionNumber);if(this._numberedNodes.length)this._expressionFunc=func(this);else this._expressionFunc=func}GetSolIndex(){return this._solIndex}GetExpression(solIndex){this._solIndex=solIndex;return this._expressionFunc()}} +class StringExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetStringExpression;if(type===14){this.GetEventBlock().SetAllSolModifiers();if(this._owner instanceof C3.Action)this.GetEventBlock().SetSolWriterAfterCnds()}}GetStringExpression(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();if(typeof ret==="string")return ret;else return""}_GetFastTriggerValue(){return GetExpressionFunc(this._expressionNumber)()}} +class LayerExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetLayer;this._isConstant=false}GetLayer(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();const layout=this.GetRuntime().GetCurrentLayout();return layout.GetLayer(ret)}} +class ComboParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._combo=data[1];this.Get=this.GetCombo;this._isConstant=true}GetCombo(){return this._combo}}class BooleanParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._bool=data[1];this.Get=this.GetBoolean;this._isConstant=true}GetBoolean(){return this._bool}} +class ObjectParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._objectClass=this.GetRuntime().GetObjectClassByIndex(data[1]);this.Get=this.GetObjectClass;const eventBlock=this.GetEventBlock();eventBlock._AddSolModifier(this._objectClass);if(this._owner instanceof C3.Action)eventBlock.SetSolWriterAfterCnds();else if(eventBlock.GetParent())eventBlock.GetParent().SetSolWriterAfterCnds();this._isConstant=true}GetObjectClass(){return this._objectClass}} +class LayoutParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(data[1]);this.Get=this.GetLayout;this._isConstant=true}GetLayout(){return this._layout}} +class TimelineParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(data[1]);this.Get=this.GetTimeline;this._isConstant=true}GetTimeline(){return this._timeline}}class FileParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._fileInfo=data[1];this.Get=this.GetFile;this._isConstant=true}GetFile(){return this._fileInfo}} +class InstVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._instVarIndex=data[1];const ownerObjectClass=this._owner.GetObjectClass();if(this._owner instanceof C3.Condition&&this._owner.IsStatic()){this.Get=this.GetInstanceVariable;this._isConstant=true}else if(ownerObjectClass&&ownerObjectClass.IsFamily()){this.Get=this.GetFamilyInstanceVariable;this.SetVariesPerInstance()}else{this.Get=this.GetInstanceVariable;this._isConstant=true}}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(solIndex){solIndex= +solIndex||0;const familyType=this._owner.GetObjectClass();const sol=familyType.GetCurrentSol();const instances=sol.GetInstances();let realType=null;if(instances.length)realType=instances[solIndex%instances.length].GetObjectClass();else if(sol.HasAnyElseInstances()){const elseInstances=sol.GetElseInstances();realType=elseInstances[solIndex%elseInstances.length].GetObjectClass()}else if(familyType.GetInstanceCount()>0){const familyInstances=familyType.GetInstances();realType=familyInstances[solIndex% +familyInstances.length].GetObjectClass()}else return 0;return this._instVarIndex+realType.GetFamilyInstanceVariableOffset(familyType.GetFamilyIndex())}} +class EventVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._eventVarSid=data[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=true}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}} +class FunctionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._functionBlockName=data[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=true}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}} +class VariadicParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._subParams=[];this._variadicRet=[];this._isConstant=true;for(let i=1,len=data.length;i0;this._isFastTrigger=data[3]===2;this._isLooping=!!data[4];this._isInverted=!!data[5];this._isStatic=!!data[6];this._sid=data[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._objectClass=null;this._behaviorType=null;this._behaviorIndex= +-1;this._systemPlugin=null;this.Run=noop;this.DebugRun=noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:data[8][0],canDebug:data[8][1]}:null;if(data[0]===-1)this._systemPlugin=this._runtime.GetSystemPlugin();else{this._objectClass=this._runtime.GetObjectClassByIndex(data[0]);if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex= +this._objectClass.GetBehaviorIndexByName(data[2])}if(this._eventBlock.GetParent())this._eventBlock.GetParent().SetSolWriterAfterCnds()}if(data.length===10){let paramData=data[9];for(let data of paramData){this._parameters.push(C3.Parameter.Create(this,data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(eventBlock,data, +index){return C3.New(C3.Condition,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance=true}if(this._isFastTrigger){this.Run=this._RunFastTrigger;this.DebugRun=this._DebugRunFastTrigger}else if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this._isStatic){this.Run= +this._RunStatic;this.DebugRun=this._DebugRunStatic}else{this.Run=this._RunObject;this.DebugRun=this._DebugRunObject}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin=this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const isInverted=this._isInverted;const parameters=this._parameters;if(parameters.length===0){const boundFunc=plugin._GetBoundACEMethod(func,bindThis);if(isInverted)this.Run=function RunSingleCnd_0param(){return C3.xor(boundFunc(),isInverted)};else this.Run=boundFunc}else if(parameters.length===1){const param0=parameters[0];if(!isInverted&¶m0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc= +plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_1param(){return C3.xor(boundFunc(param0.Get(0)),isInverted)}}}else if(parameters.length===2){const param0=parameters[0];const param1=parameters[1];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_2params(){return C3.xor(boundFunc(param0.Get(0), +param1.Get(0)),isInverted)}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func,bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_3params(){return C3.xor(boundFunc(param0.Get(0),param1.Get(0),param2.Get(0)),isInverted)}}}else this.Run= +fallbackMethod}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsStatic(){return this._isStatic}IsBreakpoint(){return this._debugData.isBreakpoint}IsSystemCondition(){return!!this._systemPlugin}GetFirstObjectParameterObjectClass(){for(const p of this._parameters)if(p.IsObjectParameter())return p.GetObjectClass(); +return null}_SetBreakpoint(b){this._debugData.isBreakpoint=!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData=new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters, +results);return C3.xor(this._func.apply(this._systemPlugin,results),this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._systemPlugin,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunSingleGlobal(){const results=this._results;EvalParams(this._parameters,results); +const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return C3.xor(this._func.apply(inst,results),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();let ret=this._func.apply(inst,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunFastTrigger(){return true}*_DebugRunFastTrigger(){if(this.IsBreakpoint()|| +this._runtime.DebugBreakNext())yield this;return true}_RunStatic(){const results=this._results;EvalParams(this._parameters,results);const ret=this._func.apply(this._behaviorType||this._objectClass,results);this._objectClass.ApplySolToContainer();return ret}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._behaviorType||this._objectClass, +results);if(C3.IsIterator(ret))ret=yield*ret;this._objectClass.ApplySolToContainer();return ret}else return this.Run()}_RunObject(){const parameters=this._parameters;const results=this._results;const sol=this._objectClass.GetCurrentSol();for(let i=0,len=parameters.length;i=0;const allInstances=objectClass.GetInstances(); +const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;sol.ClearArrays();for(let i=0,len=allInstances.length;i=0;const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;const solInstances=sol._GetOwnInstances();const solElseInstances=sol._GetOwnElseInstances();const isUsingElseInstances=isInOrBlock&&!this._eventBlock.IsFirstConditionOfType(this);const arr=isUsingElseInstances?solElseInstances:solInstances;let k=0;let isAnyTrue=false;for(let i=0, +len=arr.length;i=0;const results=this._results;const func=this._func;const isInverted=this._isInverted;for(let i=0,len=solInstances.length;i[arr[0].GetUID(),arr[1].GetUID(),arr[2]]);ex[k]=saveVal}return{"ex":ex}}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}if(!o)return;const runtime=this._runtime;const ex=o["ex"];if(ex){const map=this.GetSavedDataMap();map.clear(); +for(const [k,v]of Object.entries(ex)){let loadVal=v;if(k==="collmemory")loadVal=C3.New(C3.PairMap,v.map(arr=>[runtime.GetInstanceByUID(arr[0]),runtime.GetInstanceByUID(arr[1]),arr[2]]).filter(arr=>arr[0]&&arr[1]));map.set(k,loadVal)}}}}; + +} + +// events/action.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function EvalParams(parameters,results){for(let i=0,len=parameters.length;i=4?data[3]:-1;this._actionType=data.length>=5?data[4]&255:0;this._flags=data.length>=5?data[4]>>8:0;this._func=null;this._objectClass=null;this._behaviorType=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._callCustomAceObjectClass=null;this._callEventBlock= +null;this.Run=noop;this.DebugRun=noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;const isScript=data[0]===-3;const debugInfo=isScript?data[2]:data[5];this._debugData=runtime.IsDebug()||isScript?{isBreakpoint:debugInfo[0],canDebug:debugInfo[1],index:debugInfo[2]}:null;if(data[0]===-1){this._systemPlugin=runtime.GetSystemPlugin();this._func=runtime.GetObjectReference(data[1])}else if(data[0]===-2)this._callFunctionName=data[1]; +else if(isScript){const userMethod=runtime.GetObjectReference(data[1]);this._func=userMethod;this.Run=this.RunUserScript;this.DebugRun=this.DebugRunUserScript;this._actionType=1}else{this._objectClass=runtime.GetObjectClassByIndex(data[0]);if(this._flags&FLAG_CUSTOM_ACE){this._callFunctionName=data[1];this._callCustomAceObjectClass=runtime.GetObjectClassByIndex(data[2])}else{if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2])}this._func= +runtime.GetObjectReference(data[1])}}if(data.length===7){const paramData=data[6];for(const data of paramData){this._parameters.push(C3.Parameter.Create(this,data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}if(this.CanPickAnyObjectClass()){this._eventBlock.SetAllSolModifiers();this._eventBlock.SetSolWriterAfterCnds()}this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(eventBlock, +data,index){return C3.New(C3.Action,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance=true}if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._callFunctionName){if(this._flags&FLAG_CUSTOM_ACE)this._SetCallCustomActionRunMethod();else this._SetCallFunctionRunMethod();this._callFunctionName="";this._callCustomAceObjectClass=null}else if(this.Run===this.RunUserScript){const userMethod= +this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}else if(this._behaviorType)if(this.IsAsync()){this.Run=this._RunBehavior_Async;this.DebugRun=this._DebugRunBehavior_Async}else{this.Run=this._RunBehavior;this.DebugRun=this._DebugRunBehavior}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this.IsAsync()){this.Run= +this._RunObject_Async;this.DebugRun=this._DebugRunObject_Async}else if(this.CallBeforeAfterHooks()){this.Run=this._RunObject_BeforeAfterHooks;this.DebugRun=this._DebugRunObject_BeforeAfterHooks}else if(!this._parameters.length){this.Run=this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else if(this._parameters.every(p=>p.VariesPerInstance())){this.Run=this._RunObject_AllParamsVary;this.DebugRun=this._DebugRunObject_AllParamsVary}else if(this._anyParamVariesPerInstance){this.Run= +this._RunObject_SomeParamsVary;this.DebugRun=this._DebugRunObject_SomeParamsVary}else if(this._parameters.every(p=>p.IsConstant())){EvalParams(this._parameters,this._results);this.Run=this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else{this.Run=this._RunObject_ParamsDontVary;this.DebugRun=this._DebugRunObject_ParamsDontVary}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin= +this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const eventSheetManager=this._eventBlock.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(this._callFunctionName);if(functionBlock.IsEnabled()){const isCopyPicked=(this._flags&FLAG_COPYPICKED)!==0;this._callEventBlock=functionBlock.GetEventBlock();let combinedSolModifiers= +[...(new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()]))];combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(combinedSolModifiers);const pickInfo=!functionBlock.IsCopyPicked()&&this._HasCopyPickedParent()?{pushCleanSolDynamic:true}:null;this.Run=C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,combinedSolModifiers,this._parameters,isCopyPicked,pickInfo);if(this._runtime.IsDebug()){const thiz= +this;this.DebugRun=function*DebugRunCallFunction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz;const ret=yield*thiz._callEventBlock.DebugRunAsFunctionCall(combinedSolModifiers,thiz._parameters,isCopyPicked,pickInfo);return ret}}else this.DebugRun=noopGenerator}else{this.Run=noop;this.DebugRun=noopGenerator}}_SetCallCustomActionRunMethod(){const eventSheetManager=this._eventBlock.GetEventSheetManager();const customAceBlock=eventSheetManager.GetCustomActionBlockByName(this._callCustomAceObjectClass, +this._callFunctionName);if(customAceBlock.IsEnabled()){const isCopyPicked=(this._flags&FLAG_COPYPICKED)!==0;this._callEventBlock=customAceBlock.GetEventBlock();let combinedSolModifiers=[...(new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents(),this._objectClass,customAceBlock.GetObjectClass()]))];combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(combinedSolModifiers);const isOTtoOT=!this._objectClass.IsFamily()&&!customAceBlock.GetObjectClass().IsFamily(); +const isOTtoFamily=!this._objectClass.IsFamily()&&customAceBlock.GetObjectClass().IsFamily();const isFamilyToFamily=this._objectClass.IsFamily();let pickInfo=null;if(!customAceBlock.IsCopyPicked()&&this._HasCopyPickedParent()){pickInfo=pickInfo||{};pickInfo.pushCleanSolDynamic=true}if(isOTtoFamily||!isCopyPicked){pickInfo=pickInfo||{};pickInfo.copyFromObjectClass=this._objectClass;pickInfo.copyToObjectClass=customAceBlock.GetObjectClass()}if(isOTtoOT||isOTtoFamily||isFamilyToFamily&&!customAceBlock.HasCustomACEOverrides())this.Run= +C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,combinedSolModifiers,this._parameters,isCopyPicked,pickInfo);else if(isFamilyToFamily)this.Run=C3.FunctionBlock.prototype.RunAsFamilyCustomActionWithOverrides.bind(customAceBlock,combinedSolModifiers,this._parameters);else;if(this._runtime.IsDebug()){const thiz=this;if(isOTtoOT||isOTtoFamily||isFamilyToFamily&&!customAceBlock.HasCustomACEOverrides())this.DebugRun=function*DebugRunCustomAction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz; +const ret=yield*thiz._callEventBlock.DebugRunAsFunctionCall(combinedSolModifiers,thiz._parameters,isCopyPicked,pickInfo);return ret};else if(isFamilyToFamily)this.DebugRun=function*DebugRunCustomAction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz;const ret=yield*customAceBlock.DebugRunAsFamilyCustomActionWithOverrides(combinedSolModifiers,thiz._parameters);return ret}}else this.DebugRun=noopGenerator}else{this.Run=noop;this.DebugRun=noopGenerator}}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const parameters=this._parameters;if(parameters.length===0)this.Run=plugin._GetBoundACEMethod(func,bindThis);else if(parameters.length===1){const param0=parameters[0];if(param0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_1param(){return boundFunc(param0.Get(0))}}}else if(parameters.length===2){const param0=parameters[0]; +const param1=parameters[1];if(param0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_2params(){return boundFunc(param0.Get(0),param1.Get(0))}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(param0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func, +bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_3params(){return boundFunc(param0.Get(0),param1.Get(0),param2.Get(0))}}}else this.Run=fallbackMethod}GetSID(){return this._sid}IsAsync(){return this._actionType===1}CanBailOut(){return this._actionType===2}CallBeforeAfterHooks(){return this._actionType===3}CanPickAnyObjectClass(){return(this._flags&FLAG_CANPICKANYOBJECTCLASS)!==0}HasReturnType(){return this.IsAsync()|| +this.CanBailOut()}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}_HasCopyPickedParent(){let parent=this._eventBlock;do{if(parent instanceof C3.FunctionBlock&&parent.IsCopyPicked())return true;parent=parent.GetScopeParent()}while(parent);return false}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(b){this._debugData.isBreakpoint=!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&& +!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData=new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters,results);return this._func.apply(this._systemPlugin,results)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results= +this._results;EvalParams(this._parameters,results);const ret=yield*this._func.apply(this._systemPlugin,results);return ret}else return this.Run()}_RunSingleGlobal(){const results=this._results;EvalParams(this._parameters,results);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters, +results);const ret=yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results);return ret}else return this.Run()}_RunObject_ParamsConst(){const results=this._results;const instances=this._objectClass.GetCurrentSol().GetInstances();for(let i=0,len=instances.length;ilayout.GetWidth()||bbox.getTop()>layout.GetHeight()} +function PickDistance(which,x,y){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let wi=inst.GetWorldInfo();let pickme=inst;let dist2=C3.distanceSquared(wi.GetX(),wi.GetY(),x,y);for(let i=1,len=instances.length;idist2){dist2=d2;pickme=inst}}sol.PickOne(pickme);return true} +function SetX(x){const wi=this.GetWorldInfo();if(wi.GetX()===x)return;wi.SetX(x);wi.SetBboxChanged()}function SetY(y){const wi=this.GetWorldInfo();if(wi.GetY()===y)return;wi.SetY(y);wi.SetBboxChanged()}function SetPos(x,y){const wi=this.GetWorldInfo();if(wi.EqualsXY(x,y))return;wi.SetXY(x,y);wi.SetBboxChanged()} +function SetPosToObject(objectClass,imgPt){if(!objectClass)return;const inst=objectClass.GetPairedInstance(this._inst);if(!inst)return;const [x,y]=inst.GetImagePoint(imgPt);const wi=this.GetWorldInfo();if(wi.GetX()===x&&wi.GetY()===y)return;wi.SetXY(x,y);wi.SetBboxChanged()}function MoveForward(dist){if(dist===0)return;const wi=this.GetWorldInfo();wi.OffsetXY(wi.GetCosAngle()*dist,wi.GetSinAngle()*dist);wi.SetBboxChanged()} +function MoveAtAngle(a,dist){if(dist===0)return;const wi=this.GetWorldInfo();a=C3.toRadians(a);wi.OffsetXY(Math.cos(a)*dist,Math.sin(a)*dist);wi.SetBboxChanged()}function GetX(){return this.GetWorldInfo().GetX()}function GetY(){return this.GetWorldInfo().GetY()}function GetDt(){return this._runtime.GetDt(this._inst)}function CompareWidth(cmp,w){return C3.compare(this.GetWorldInfo().GetWidth(),cmp,w)}function CompareHeight(cmp,h){return C3.compare(this.GetWorldInfo().GetHeight(),cmp,h)} +function SetWidth(w){const wi=this.GetWorldInfo();if(wi.GetWidth()===w)return;wi.SetWidth(w);wi.SetBboxChanged()}function SetHeight(h){const wi=this.GetWorldInfo();if(wi.GetHeight()===h)return;wi.SetHeight(h);wi.SetBboxChanged()}function SetSize(w,h){const wi=this.GetWorldInfo();if(wi.GetWidth()===w&&wi.GetHeight()===h)return;wi.SetSize(w,h);wi.SetBboxChanged()}function GetWidth(){return this.GetWorldInfo().GetWidth()}function GetHeight(){return this.GetWorldInfo().GetHeight()} +function GetBboxLeft(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function GetBboxTop(){return this.GetWorldInfo().GetBoundingBox().getTop()}function GetBboxRight(){return this.GetWorldInfo().GetBoundingBox().getRight()}function GetBboxBottom(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function GetBboxMidX(){const bbox=this.GetWorldInfo().GetBoundingBox();return(bbox.getLeft()+bbox.getRight())/2} +function GetBboxMidY(){const bbox=this.GetWorldInfo().GetBoundingBox();return(bbox.getTop()+bbox.getBottom())/2}function IsAngleWithin(within,a){return C3.angleDiff(this.GetWorldInfo().GetAngle(),C3.toRadians(a))<=C3.toRadians(within)}function IsAngleClockwiseFrom(a){return C3.angleClockwise(this.GetWorldInfo().GetAngle(),C3.toRadians(a))} +function IsBetweenAngles(a,b){const lower=C3.toRadians(a);const upper=C3.toRadians(b);const angle=this.GetWorldInfo().GetAngle();const obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)} +function SetAngle(a){const wi=this.GetWorldInfo();const newAngle=C3.clampAngle(C3.toRadians(a));if(isNaN(newAngle)||wi.GetAngle()===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function RotateClockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()+C3.toRadians(a));wi.SetBboxChanged()}function RotateCounterclockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()-C3.toRadians(a));wi.SetBboxChanged()} +function RotateTowardAngle(amt,target){const wi=this.GetWorldInfo();const a=wi.GetAngle();const newAngle=C3.angleRotate(a,C3.toRadians(target),C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function RotateTowardPosition(amt,x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const target=Math.atan2(dy,dx);const newAngle=C3.angleRotate(a,target,C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function SetTowardPosition(x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const newAngle=Math.atan2(dy,dx);if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function GetAngle(){return C3.toDegrees(this.GetWorldInfo().GetAngle())}function CompareOpacity(cmp,x){return C3.compare(C3.roundToDp(this.GetWorldInfo().GetOpacity()*100,6),cmp,x)}function IsVisible(){return this.GetWorldInfo().IsVisible()} +function SetVisible(v){const wi=this.GetWorldInfo();if(v===2)v=!wi.IsVisible();else v=v!==0;if(wi.IsVisible()===v)return;wi.SetVisible(v);this._runtime.UpdateRender()}function SetOpacity(o){const newOpacity=C3.clamp(o/100,0,1);const wi=this.GetWorldInfo();if(wi.GetTransformWithParentOpacity()){if(wi._GetSceneGraphInfo().GetOwnOpacity()===newOpacity)return}else if(wi.GetOpacity()===newOpacity)return;wi.SetOpacity(newOpacity);this._runtime.UpdateRender()} +function SetDefaultColor(rgb){tempColor.setFromRgbValue(rgb);const wi=this.GetWorldInfo();if(wi.GetUnpremultipliedColor().equalsIgnoringAlpha(tempColor))return;wi.SetUnpremultipliedColor(tempColor);this._runtime.UpdateRender()}function GetColor(){const c=this.GetWorldInfo().GetUnpremultipliedColor();return C3.PackRGBAEx(c.getR(),c.getG(),c.getB(),c.getA())}function GetOpacity(){return C3.roundToDp(this.GetWorldInfo().GetOpacity()*100,6)} +function IsOnLayer(layer){if(!layer)return false;return this.GetWorldInfo().GetLayer()===layer} +function PickTopBottom(which){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let pickme=inst;for(let i=1,len=instances.length;ipickmeLayerIndex||instLayerIndex===pickmeLayerIndex&&instWi.GetZIndex()> +pickmeWi.GetZIndex())pickme=inst}else if(instLayerIndexCollMemory_RemoveInstance(collMemory,e.instance))}const lsol= +ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol();const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;lCollMemory_RemoveInstance(collMemory,e.instance))}const lsol=ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol(); +const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;l0)parentInstances=parentInstances.concat(parentInstsPendingCreate)}if(parentInstances.length=== +0)return false;const parentInstancesSet=new Set(parentInstances);const pickParents=new Set;for(let i=0,len=myInstances.length;i0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=new Set;for(let i=0,len=myInstances.length;i0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=[];for(let i=0,len=myInstances.length;ibestVal){bestVal=v;pickInst=inst}}sol.PickOne(pickInst); +return true}function PickByUID(uid){if(this._runtime.GetCurrentCondition().IsInverted())return PickByUID_Inverted(this,uid);else return PickByUID_Normal(this,uid)} +function PickByUID_Normal(objectClass,uid){const inst=objectClass.GetRuntime().GetInstanceByUID(uid);if(!inst)return false;const sol=objectClass.GetCurrentSol();if(!sol.IsSelectAll()&&!sol._GetOwnInstances().includes(inst))return false;if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass)){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}}else if(inst.GetObjectClass()===objectClass){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}return false} +function PickByUID_Inverted(objectClass,uid){const sol=objectClass.GetCurrentSol();if(sol.IsSelectAll()){sol._SetSelectAll(false);sol.ClearArrays();const instances=objectClass.GetInstances();for(let i=0,len=instances.length;iv.GetValue());if(functionBlock.IsAsync())this._asyncId=functionBlock.PauseCurrentAsyncFunction()}for(const objectClass of allObjectClasses){const sol= +objectClass.GetCurrentSol();if(sol.IsSelectAll()&&!this._event.HasSolModifier(objectClass))continue;this._solModifiers.push(objectClass);this._sols.set(objectClass,C3.New(C3.SolState,sol))}const dynamicSolModifiersSet=eventSheetManager.GetDynamicSolModifiersSet();this._dynamicSolModifiers=dynamicSolModifiersSet.size>0?dynamicSolModifiersSet:null}InitTimer(seconds){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+seconds}InitSignal(tag){this._type="signal"; +this._Init();this._signalTag=tag.toLowerCase()}InitPromise(p){this._type="promise";this._Init();p.then(()=>this.SetSignalled()).catch(err=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",err);this.SetSignalled()})}IsTimer(){return this._type==="timer"}IsSignal(){return this._type==="signal"}IsPromise(){return this._type==="promise"}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=true}_ShouldRun(){if(this.IsTimer())return this._time<= +this._eventSheetManager.GetRuntime().GetGameTime();else return this.IsSignalled()}_RestoreState(frame){frame._Restore(this._event,this._actIndex);for(const [objectClass,solState]of this._sols.entries()){const sol=objectClass.GetCurrentSol();solState._Restore(sol)}if(this._dynamicSolModifiers)frame.SetDynamicSolModifiers([...this._dynamicSolModifiers]);const callingFunctionBlock=this._callingFunctionBlock;if(callingFunctionBlock){callingFunctionBlock.SetFunctionParameters(this._functionParameters); +callingFunctionBlock._GetAllInnerLocalVariables().map((v,index)=>v.SetValue(this._functionInnerLocalVars[index]));if(callingFunctionBlock.IsAsync())callingFunctionBlock.ResumeAsyncFunction(this._asyncId)}}_Run(frame){this._RestoreState(frame);this._event._ResumeActionsAndSubEvents(frame);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease= +true}async _DebugRun(frame){this._RestoreState(frame);for(const breakEventObject of this._event._DebugResumeActionsAndSubEvents(frame))await this._eventSheetManager.GetRuntime().DebugBreak(breakEventObject);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=true}ShouldRelease(){return this._shouldRelease}RemoveInstances(s){for(const solState of this._sols.values())solState.RemoveInstances(s)}_SaveToJson(){const sols= +{};const o={"t":this._time,"st":this._signalTag,"s":this._isSignalled,"ev":this._event.GetSID(),"sm":this._solModifiers.map(oc=>oc.GetSID()),"dsm":this._dynamicSolModifiers?[...this._dynamicSolModifiers].map(oc=>oc.GetSID()):null,"sols":sols};if(this._event._HasActionIndex(this._actIndex))o["act"]=this._event.GetActionAt(this._actIndex).GetSID();for(const [objectClass,solState]of this._sols)sols[objectClass.GetSID().toString()]=solState._SaveToJson();return o}static _CreateFromJson(eventSheetManager, +o){const runtime=eventSheetManager.GetRuntime();const event=eventSheetManager.GetEventBlockBySID(o["ev"]);if(!event)return null;let actIndex=0;if(o.hasOwnProperty("act")){const act=eventSheetManager.GetActionBySID(o["act"]);if(!act)return null;actIndex=act.GetIndex()}const sw=C3.New(C3.ScheduledWait,eventSheetManager);sw._time=o["t"];sw._type=sw._time===-1?"signal":"timer";sw._signalTag=o["st"];sw._isSignalled=o["s"];sw._event=event;sw._actIndex=actIndex;for(const sid of o["sm"]){const objectClass= +runtime.GetObjectClassBySID(sid);if(objectClass)sw._solModifiers.push(objectClass)}if(Array.isArray(o["dsm"]))for(const sid of o["dsm"]){const objectClass=runtime.GetObjectClassBySID(sid);if(objectClass){if(!sw._dynamicSolModifiers)sw._dynamicSolModifiers=new Set;sw._dynamicSolModifiers.add(objectClass)}}for(const [sidStr,solData]of Object.entries(o["sols"])){const sid=parseInt(sidStr,10);const objectClass=runtime.GetObjectClassBySID(sid);if(!objectClass)continue;const solState=C3.New(C3.SolState, +null);solState._LoadFromJson(eventSheetManager,solData);sw._sols.set(objectClass,solState)}return sw}}; + +} + +// events/solState.js +{ +'use strict';const C3=self.C3; +C3.SolState=class SolState extends C3.DefendedBase{constructor(sol){super();this._objectClass=null;this._isSelectAll=true;this._instances=[];if(sol){this._objectClass=sol.GetObjectClass();this._isSelectAll=sol.IsSelectAll();C3.shallowAssignArray(this._instances,sol._GetOwnInstances())}}Release(){this._objectClass=null;C3.clearArray(this._instances)}_Restore(sol){sol._SetSelectAll(this._isSelectAll);C3.shallowAssignArray(sol._GetOwnInstances(),this._instances)}RemoveInstances(s){C3.arrayRemoveAllInSet(this._instances,s)}_SaveToJson(){return{"sa":this._isSelectAll, +"insts":this._instances.map(inst=>inst.GetUID())}}_LoadFromJson(eventSheetManager,o){const runtime=eventSheetManager.GetRuntime();this._isSelectAll=!!o["sa"];C3.clearArray(this._instances);for(const uid of o["insts"]){const inst=runtime.GetInstanceByUID(uid);if(inst)this._instances.push(inst)}}}; + +} + +// sdk/sdkPluginBase.js +{ +'use strict';const C3=self.C3;function GetNextParamMap(paramMap,param){let nextParamMap=paramMap.get(param);if(!nextParamMap){nextParamMap=new Map;paramMap.set(param,nextParamMap)}return nextParamMap} +C3.SDKPluginBase=class SDKPluginBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._isSingleGlobal=!!opts.isSingleGlobal;this._isWorldType=!!opts.isWorld;this._isRotatable=!!opts.isRotatable;this._mustPredraw=!!opts.mustPredraw;this._hasEffects=!!opts.hasEffects;this._supportsSceneGraph=!!opts.supportsSceneGraph;this._supportsMesh=!!opts.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=new Map;this._boundACEMethodCache_1param=new Map;this._boundACEMethodCache_2params= +new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(func,bindThis){if(!bindThis)throw new Error("missing 'this' binding"); +let ret=this._boundACEMethodCache.get(func);if(ret)return ret;ret=func.bind(bindThis);this._boundACEMethodCache.set(func,ret);return ret}_GetBoundACEMethod_1param(func,bindThis,param0){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_1param,func);let ret=param0map.get(param0);if(ret)return ret;ret=func.bind(bindThis,param0);param0map.set(param0,ret);return ret}_GetBoundACEMethod_2params(func,bindThis,param0,param1){if(!bindThis)throw new Error("missing 'this' binding"); +const param0map=GetNextParamMap(this._boundACEMethodCache_2params,func);const param1map=GetNextParamMap(param0map,param0);let ret=param1map.get(param1);if(ret)return ret;ret=func.bind(bindThis,param0,param1);param1map.set(param1,ret);return ret}_GetBoundACEMethod_3params(func,bindThis,param0,param1,param2){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_3params,func);const param1map=GetNextParamMap(param0map,param0);const param2map= +GetNextParamMap(param1map,param1);let ret=param2map.get(param2);if(ret)return ret;ret=func.bind(bindThis,param0,param1,param2);param2map.set(param2,ret);return ret}_SetSingleGlobalObjectClass(objectClass){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");this._singleGlobalObjectClass=objectClass}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin"); +return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}; + +} + +// sdk/sdkDOMPluginBase.js +{ +'use strict';const C3=self.C3; +C3.SDKDOMPluginBase=class SDKDOMPluginBase extends C3.SDKPluginBase{constructor(opts,DOM_COMPONENT_ID){super(opts);this._domComponentId=DOM_COMPONENT_ID;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",sdkInst=>sdkInst._OnElemFocused());this.AddElementMessageHandler("elem-blurred",sdkInst=>{if(sdkInst)sdkInst._OnElemBlurred()})}Release(){super.Release()}_AddElement(sdkInst){const elementId=this._nextElementId++;this._instMap.set(elementId,sdkInst);return elementId}_RemoveElement(elementId){this._instMap.delete(elementId)}AddElementMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,e=>{const sdkInst=this._instMap.get(e["elementId"]);func(sdkInst,e)})}}; + +} + +// sdk/sdkTypeBase.js +{ +'use strict';const C3=self.C3; +C3.SDKTypeBase=class SDKTypeBase extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._runtime=objectClass.GetRuntime();this._plugin=objectClass.GetPlugin()}Release(){this._objectClass=null;this._runtime=null;this._plugin=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}OnCreate(){}FinishCondition(f){}BeforeRunAction(method){}AfterRunAction(method){}LoadTextures(renderer){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(renderer){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable, +additionalProperties){const e=C3.New(C3.Event,name,cancelable);e.objectClass=this;if(additionalProperties)Object.assign(e,additionalProperties);this.GetObjectClass().DispatchUserScriptEvent(e)}}; + +} + +// sdk/sdkInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKInstanceBase=class SDKInstanceBase extends C3.DefendedBase{constructor(inst,domComponentId){super();this._inst=inst;this._domComponentId=domComponentId;this._wrapperComponentId=null;this._runtime=inst.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tickFunc=null;this._tick2Func=null;this._isTicking=false;this._isTicking2=false;this._disposables=null;this._wasReleased=false}Release(){this._wasReleased=true;this._StopTicking();this._StopTicking2(); +this._tickFunc=null;this._tick2Func=null;if(this._disposables){this._disposables.Release();this._disposables=null}this._inst=null;this._runtime=null;this._objectClass=null;this._sdkType=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(method){return this._runtime.Trigger(method, +this._inst,null)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,null)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,null)}FastTrigger(method,value){return this._runtime.FastTrigger(method,this._inst,value)}DebugFastTrigger(method,value){return this._runtime.DebugFastTrigger(method,this._inst,value)}ScheduleTriggers(f){return this._runtime.ScheduleTriggers(f)}AddDOMMessageHandler(handler,func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId, +handler,func)}AddDOMMessageHandlers(list){for(const [handler,func]of list)this.AddDOMMessageHandler(handler,func)}PostToDOM(handler,data){this._runtime.PostComponentMessageToDOM(this._domComponentId,handler,data)}PostToDOMAsync(handler,data){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,handler,data)}_PostToDOMMaybeSync(handler,data){if(this._runtime.IsInWorker())this.PostToDOM(handler,data);else return window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event", +"component":this._domComponentId,"handler":handler,"data":data,"responseId":null})}SetWrapperExtensionComponentId(componentId){if(!componentId)throw new Error("cannot set empty component id");this._wrapperComponentId=componentId}IsWrapperExtensionAvailable(){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");return this._runtime.HasWrapperComponentId(this._wrapperComponentId)}AddWrapperExtensionMessageHandler(handler,func){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set"); +this._runtime.AddWrapperExtensionMessageHandler(this._wrapperComponentId,handler,func)}AddWrapperExtensionMessageHandlers(list){for(const [handler,func]of list)this.AddWrapperExtensionMessageHandler(handler,func)}SendWrapperExtensionMessage(messageId,params){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set");this._runtime.SendWrapperExtensionMessage(this._wrapperComponentId,messageId,params)}SendWrapperExtensionMessageAsync(messageId,params){if(!this._wrapperComponentId)throw new Error("wrapper extension component id not set"); +return this._runtime.SendWrapperExtensionMessageAsync(this._wrapperComponentId,messageId,params)}Tick(){}Tick2(){}_StartTicking(){if(this._isTicking)return;if(!this._tickFunc)this._tickFunc=()=>this.Tick();this._runtime.Dispatcher().addEventListener("tick",this._tickFunc);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return; +if(!this._tick2Func)this._tick2Func=()=>this.Tick2();this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func);this._isTicking2=false}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset, +opts){if(offset===0)return;const value=this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset,opts)}SetPropertyColorOffsetValueByIndex(offset,r,g,b){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._inst.HasScriptInterface())return; +const scriptInterface=this.GetScriptInterface();const e=C3.New(C3.Event,name,cancelable);e.instance=scriptInterface;if(additionalProperties)Object.assign(e,additionalProperties);scriptInterface.dispatchEvent(e)}}; + +} + +// sdk/sdkWorldInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKWorldInstanceBase=class SDKWorldInstanceBase extends C3.SDKInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._worldInfo=inst.GetWorldInfo();this._renderercontextlost_handler=null;this._renderercontextrestored_handler=null}Release(){if(this._renderercontextlost_handler){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("renderercontextlost",this._renderercontextlost_handler);dispatcher.removeEventListener("renderercontextrestored",this._renderercontextrestored_handler); +this._renderercontextlost_handler=null;this._renderercontextrestored_handler=null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){this.HandleRendererContextLoss()}OnWebGLContextLost(){}OnWebGLContextRestored(){}HandleRendererContextLoss(){if(this._renderercontextlost_handler)return;this._renderercontextlost_handler=()=>this.OnRendererContextLost();this._renderercontextrestored_handler=()=>this.OnRendererContextRestored();const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("rendererontextlost", +this._renderercontextlost_handler);dispatcher.addEventListener("renderercontextrestored",this._renderercontextrestored_handler)}OnRendererContextLost(){this.OnWebGLContextLost()}OnRendererContextRestored(){this.OnWebGLContextRestored()}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return false}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known");const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetWidth();else;}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known"); +const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetHeight();else;}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){const imageInfo=this.GetCurrentImageInfo();if(imageInfo){const texture=imageInfo.GetTexture();if(texture)return[texture.GetWidth(),texture.GetHeight()]}return[100,100]}GetCurrentTexRect(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.GetTexRect():null}GetCurrentTexQuad(){const imageInfo=this.GetCurrentImageInfo();return imageInfo? +imageInfo.GetTexQuad():null}IsCurrentTexRotated(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.IsRotated():false}GetImagePoint(nameOrIndex){const wi=this._inst.GetWorldInfo();return[wi.GetX(),wi.GetY(),wi.GetTotalZElevation()]}LoadTilemapData(data,mapWidth,mapHeight){}TestPointOverlapTile(x,y){}RendersToOwnZPlane(){return true}}; + +} + +// sdk/sdkDOMInstanceBase.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect); +C3.SDKDOMInstanceBase=class SDKDOMInstanceBase extends C3.SDKWorldInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=true;this._elemHasFocus=false;this._autoFontSize=false;this._autoFontSizeOffset=-.2;this._lastRect=C3.New(C3.Rect,0,0,-1,-1);const canvasManager=this._runtime.GetCanvasManager();this._lastWindowWidth=canvasManager.GetLastWidth();this._lastWindowHeight=canvasManager.GetLastHeight();this._isPendingUpdateState= +false;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw new Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(handler,data){if(!data)data={};data["elementId"]=this._elementId;this.PostToDOM(handler,data)}_PostToDOMElementMaybeSync(handler,data){if(!data)data={};data["elementId"]=this._elementId; +return this._PostToDOMMaybeSync(handler,data)}PostToDOMElementAsync(handler,data){if(!data)data={};data["elementId"]=this._elementId;return this.PostToDOMAsync(handler,data)}CreateElement(data){if(!data)data={};const isVisible=this.GetWorldInfo().IsVisible();data["elementId"]=this._elementId;data["isVisible"]=isVisible;Object.assign(data,this.GetElementState());this._isElementShowing=!!data["isVisible"];this._PostToDOMMaybeSync("create",data);this._UpdatePosition(true)}SetElementVisible(v){v=!!v; +if(this._isElementShowing===v)return;this._isElementShowing=v;this.PostToDOMElement("set-visible",{"isVisible":v})}Tick(){this._UpdatePosition(false)}_ShouldPreserveElement(){const fullscreenMode=this._runtime.GetCanvasManager().GetFullscreenMode();return C3.Platform.OS==="Android"&&(fullscreenMode==="scale-inner"||fullscreenMode==="scale-outer"||fullscreenMode==="crop")}_UpdatePosition(first){const wi=this.GetWorldInfo();const layer=wi.GetLayer();const bbox=wi.GetBoundingBox();let [cleft,ctop]=layer.LayerToCanvasCss(bbox.getLeft(), +bbox.getTop());let [cright,cbottom]=layer.LayerToCanvasCss(bbox.getRight(),bbox.getBottom());const canvasManager=this._runtime.GetCanvasManager();const rightEdge=canvasManager.GetCssWidth();const bottomEdge=canvasManager.GetCssHeight();if(!wi.IsVisible()||!layer.IsVisible()){this.SetElementVisible(false);return}if(!this._ShouldPreserveElement()){if(cright<=0||cbottom<=0||cleft>=rightEdge||ctop>=bottomEdge){this.SetElementVisible(false);return}if(cleft<1)cleft=1;if(ctop<1)ctop=1;if(cright>=rightEdge)cright= +rightEdge-1;if(cbottom>=bottomEdge)cbottom=bottomEdge-1}tempRect.set(cleft,ctop,cright,cbottom);const curWinWidth=canvasManager.GetLastWidth();const curWinHeight=canvasManager.GetLastHeight();if(!first&&tempRect.equals(this._lastRect)&&this._lastWindowWidth===curWinWidth&&this._lastWindowHeight===curWinHeight){this.SetElementVisible(true);return}this._lastRect.copy(tempRect);this._lastWindowWidth=curWinWidth;this._lastWindowHeight=curWinHeight;this.SetElementVisible(true);let fontSize=null;if(this._autoFontSize)fontSize= +layer.GetDisplayScale()+this._autoFontSizeOffset;this.PostToDOMElement("update-position",{"left":Math.round(this._lastRect.getLeft())+canvasManager.GetCanvasClientX(),"top":Math.round(this._lastRect.getTop())+canvasManager.GetCanvasClientY(),"width":Math.round(this._lastRect.width()),"height":Math.round(this._lastRect.height()),"fontSize":fontSize})}FocusElement(){this._PostToDOMElementMaybeSync("focus",{"focus":true})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{"focus":false})}_OnElemFocused(){this._elemHasFocus= +true}_OnElemBlurred(){this._elemHasFocus=false}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(prop,val){this.PostToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(prop),"val":val})}SetElementAttribute(attribName,value){this.PostToDOMElement("set-attribute",{"name":attribName,"val":value})}RemoveElementAttribute(attribName){this.PostToDOMElement("remove-attribute",{"name":attribName})}UpdateElementState(){if(this._isPendingUpdateState)return;this._isPendingUpdateState=true;Promise.resolve().then(()=> +{this._isPendingUpdateState=false;this.PostToDOMElement("update-state",this.GetElementState())})}GetElementState(){}GetElementId(){return this._elementId}}; + +} + +// sdk/sdkBehaviorBase.js +{ +'use strict';const C3=self.C3;const IBehavior=self.IBehavior; +C3.SDKBehaviorBase=class SDKBehaviorBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._myObjectClasses=C3.New(C3.ArraySet);this._myInstances=C3.New(C3.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=opts.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(objectClass){this._myObjectClasses.Add(objectClass)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(inst){this._myInstances.Add(inst)}_RemoveInstance(inst){this._myInstances.Delete(inst)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(this._iBehavior===null){const CustomScriptClass= +this._scriptInterfaceClass;if(CustomScriptClass){this._iBehavior=new CustomScriptClass(this);if(!(this._iBehavior instanceof IBehavior))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new IBehavior(this)}return this._iBehavior}}; + +} + +// sdk/sdkBehaviorTypeBase.js +{ +'use strict';const C3=self.C3;C3.SDKBehaviorTypeBase=class SDKBehaviorTypeBase extends C3.DefendedBase{constructor(behaviorType){super();this._runtime=behaviorType.GetRuntime();this._behaviorType=behaviorType;this._objectClass=behaviorType.GetObjectClass();this._behavior=behaviorType.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._runtime=null;this._behaviorType=null;this._objectClass=null;this._behavior=null}OnCreate(){}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}; + +} + +// sdk/sdkBehaviorInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKBehaviorInstanceBase=class SDKBehaviorInstanceBase extends C3.DefendedBase{constructor(behInst,domComponentId){super();this._behInst=behInst;this._domComponentId=domComponentId;this._inst=behInst.GetObjectInstance();this._runtime=behInst.GetRuntime();this._behaviorType=behInst.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isTicking=false;this._isTicking2=false;this._isPostTicking=false;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking(); +if(this._disposables){this._disposables.Release();this._disposables=null}this._behInst=null;this._inst=null;this._runtime=null;this._behaviorType=null;this._sdkType=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(method){return this._runtime.Trigger(method, +this._inst,this._behaviorType)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,this._behaviorType)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){if(this._isTicking)return;this._runtime._AddBehInstToTick(this);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime._RemoveBehInstToTick(this);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return; +this._runtime._AddBehInstToTick2(this);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime._RemoveBehInstToTick2(this);this._isTicking2=false}IsTicking2(){return this._isTicking2}_StartPostTicking(){if(this._isPostTicking)return;this._runtime._AddBehInstToPostTick(this);this._isPostTicking=true}_StopPostTicking(){if(!this._isPostTicking)return;this._runtime._RemoveBehInstToPostTick(this);this._isPostTicking=false}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,func)}OnSpriteFrameChanged(prevFrame,nextFrame){}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset){if(offset===0)return;const value=this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset)}SetPropertyColorOffsetValueByIndex(index, +offsetR,offsetG,offsetB){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._behInst.HasScriptInterface())return;const scriptInterface=this.GetScriptInterface();const e=C3.New(C3.Event,name,cancelable);e.behaviorInstance=scriptInterface;e.instance=scriptInterface.instance;if(additionalProperties)Object.assign(e,additionalProperties); +scriptInterface.dispatchEvent(e)}}; + +} + +// objects/pluginManager.js +{ +'use strict';const C3=self.C3;C3.Plugins={};C3.Behaviors={}; +C3.PluginManager=class PluginManager extends C3.DefendedBase{constructor(runtime,wrapperComponentIds){super();this._runtime=runtime;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._solidBehavior=null;this._jumpthruBehavior=null;this._wrapperComponentIds=new Set(wrapperComponentIds)}CreatePlugin(pluginData){const Ctor=this._runtime.GetObjectReference(pluginData[0]);if(!Ctor)throw new Error("missing plugin");C3.AddCommonACEs(pluginData, +Ctor);const plugin=C3.New(Ctor,{runtime:this._runtime,isSingleGlobal:pluginData[1],isWorld:pluginData[2],isRotatable:pluginData[5],hasEffects:pluginData[8],mustPredraw:pluginData[9],supportsSceneGraph:pluginData[13],supportsMesh:pluginData[14]});plugin.OnCreate();this._allPlugins.push(plugin);this._pluginsByCtor.set(Ctor,plugin)}CreateSystemPlugin(){this._systemPlugin=C3.New(C3.Plugins.System,{runtime:this._runtime,isSingleGlobal:true});this._systemPlugin.OnCreate()}CreateBehavior(behaviorData){const Ctor= +this._runtime.GetObjectReference(behaviorData[1]);if(!Ctor)throw new Error("missing behavior");const behavior=C3.New(Ctor,{runtime:this._runtime});behavior.OnCreate();this._allBehaviors.push(behavior);this._behaviorsByCtor.set(Ctor,behavior);if(!this._solidBehavior&&C3.Behaviors.solid&&behavior instanceof C3.Behaviors.solid)this._solidBehavior=behavior;else if(!this._jumpthruBehavior&&C3.Behaviors.jumpthru&&behavior instanceof C3.Behaviors.jumpthru)this._jumpthruBehavior=behavior}GetPluginByConstructorFunction(ctor){return this._pluginsByCtor.get(ctor)|| +null}HasBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.has(ctor)}GetBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.get(ctor)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}HasWrapperComponentId(id){return this._wrapperComponentIds.has(id)}}; + +} + +// objects/imageInfo.js +{ +'use strict';const C3=self.C3;const allImageInfos=new Set; +C3.ImageInfo=class ImageInfo extends C3.DefendedBase{constructor(){super();this._generation=0;this._url="";this._size=0;this._offsetX=0;this._offsetY=0;this._width=0;this._height=0;this._isRotated=false;this._hasMetaData=false;this._imageAsset=null;this._textureState="";this._rcTex=C3.New(C3.Rect);this._quadTex=C3.New(C3.Quad);this._blobUrl="";this._iImageInfo=new self.IImageInfo(this);allImageInfos.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;allImageInfos.delete(this);this.ReleaseBlobURL()}static OnRendererContextLost(){for(const imageInfo of allImageInfos){imageInfo._textureState= +"";imageInfo._rcTex.set(0,0,0,0);imageInfo._quadTex.setFromRect(imageInfo._rcTex)}}LoadData(imageData){this._url=imageData[0];this._size=imageData[1];this._offsetX=imageData[2];this._offsetY=imageData[3];this._width=imageData[4];this._height=imageData[5];this._isRotated=imageData[6];this._hasMetaData=true}LoadDynamicAsset(runtime,url){if(this._imageAsset)throw new Error("already loaded asset");this._url=url;const opts={};if(C3.IsAbsoluteURL(url))opts.loadPolicy="remote";this.LoadAsset(runtime,opts); +return this._imageAsset.Load()}async LoadDynamicBlobAsset(runtime,blob){if(this._imageAsset)throw new Error("already loaded asset");this._url="";this._size=blob.size;this._imageAsset=C3.New(C3.ImageAsset,runtime.GetAssetManager(),{blob,size:this._size,loadPolicy:"local"})}ReplaceWith(otherImageInfo){if(otherImageInfo===this)throw new Error("cannot replace with self");this._generation++;this.ReleaseTexture();this._url=otherImageInfo._url;this._size=otherImageInfo._size;this._offsetX=otherImageInfo._offsetX; +this._offsetY=otherImageInfo._offsetY;this._width=otherImageInfo._width;this._height=otherImageInfo._height;this._isRotated=otherImageInfo._isRotated;this._hasMetaData=otherImageInfo._hasMetaData;this._imageAsset=otherImageInfo._imageAsset;this._textureState=otherImageInfo._textureState;this._rcTex=otherImageInfo._rcTex;this._quadTex=otherImageInfo._quadTex;this.ReleaseBlobURL()}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(runtime, +opts){if(this._imageAsset)throw new Error("already got asset");opts=Object.assign({},opts,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=runtime.LoadImage(opts)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(renderer,opts){if(!this._imageAsset)throw new Error("no asset");if(this._textureState)throw new Error("already loaded texture");const startGeneration=this._generation;this._textureState="loading";const texture=await this._imageAsset.LoadStaticTexture(renderer, +opts);if(this._generation!==startGeneration)return null;if(!texture){this._textureState="";return null}this._textureState="loaded";if(!this._hasMetaData){this._width=texture.GetWidth();this._height=texture.GetHeight();this._hasMetaData=true}const wr=this._isRotated?this._height:this._width;const hr=this._isRotated?this._width:this._height;this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+wr,this._offsetY+hr);this._rcTex.divide(texture.GetWidth(),texture.GetHeight());this._quadTex.setFromRect(this._rcTex); +if(this._isRotated)this._quadTex.rotatePointsAnticlockwise();return texture}ReleaseTexture(){if(!this._textureState)return;if(this._imageAsset)this._imageAsset.ReleaseTexture();this._textureState="";this._rcTex.set(0,0,0,0);this._quadTex.setFromRect(this._rcTex)}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}GetIImageInfo(){return this._iImageInfo}GetImageAsset(){return this._imageAsset}async ExtractImageToCanvas(drawable){if(!drawable)drawable= +await this._imageAsset.LoadToDrawable();const canvas=C3.CreateCanvas(this._width,this._height);const ctx=canvas.getContext("2d");if(this._isRotated){ctx.rotate(Math.PI/-2);ctx.translate(-this._height,0);ctx.drawImage(drawable,this._offsetX,this._offsetY,this._height,this._width,0,0,this._height,this._width)}else ctx.drawImage(drawable,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return canvas}async ExtractImageToBlobURL(drawable){if(this._blobUrl)return this._blobUrl; +const canvas=await this.ExtractImageToCanvas(drawable);const blob=await C3.CanvasToBlob(canvas);this._blobUrl=URL.createObjectURL(blob);return this._blobUrl}ReleaseBlobURL(){if(this._blobUrl){URL.revokeObjectURL(this._blobUrl);this._blobUrl=""}}}; + +} + +// objects/animationInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationInfo=class AnimationInfo extends C3.DefendedBase{constructor(animData){super();this._name=animData[0];this._speed=animData[1];this._isLooping=!!animData[2];this._repeatCount=animData[3];this._repeatTo=animData[4];this._isPingPong=!!animData[5];this._sid=animData[6];this._frames=animData[7].map(frameData=>C3.New(C3.AnimationFrameInfo,frameData));this._iAnimation=new self.IAnimation(this)}Release(){for(const f of this._frames)f.Release();C3.clearArray(this._frames)}LoadAllAssets(runtime){for(const f of this._frames)f.GetImageInfo().LoadAsset(runtime)}LoadAllTextures(renderer,opts){return Promise.all(this._frames.map(f=> +f.GetImageInfo().LoadStaticTexture(renderer,opts)))}ReleaseAllTextures(){for(const f of this._frames)f.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(i){i=Math.floor(i);if(i<0||i>=this._frames.length)throw new RangeError("invalid frame");return this._frames[i]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}GetIAnimation(){return this._iAnimation}}; + +} + +// objects/animationFrameInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationFrameInfo=class AnimationFrameInfo extends C3.DefendedBase{constructor(frameData){super();this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(frameData);this._duration=frameData[7];this._origin=C3.New(C3.Vector2,frameData[8],frameData[9]);this._imagePoints=frameData[10].map(data=>C3.New(C3.ImagePoint,this,data));this._imagePointsByName=new Map;for(const ip of this._imagePoints)this._imagePointsByName.set(ip.GetName().toLowerCase(),ip);this._collisionPoly=null;const polyPoints= +frameData[11];if(polyPoints.length>=6)this._collisionPoly=C3.New(C3.CollisionPoly,polyPoints);this._tag=frameData[12]?frameData[12]:"";this._iAnimationFrame=new self.IAnimationFrame(this)}Release(){if(this._collisionPoly){this._collisionPoly.Release();this._collisionPoly=null}this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(name){return this._imagePointsByName.get(name.toLowerCase())|| +null}GetImagePointByIndex(index){index=Math.floor(index);if(index<0||index>=this._imagePoints.length)return null;return this._imagePoints[index]}GetImagePointCount(){return this._imagePoints.length}GetTag(){return this._tag}GetIAnimationFrame(){return this._iAnimationFrame}}; + +} + +// objects/imagePoint.js +{ +'use strict';const C3=self.C3;C3.ImagePoint=class ImagePoint extends C3.DefendedBase{constructor(afi,data){super();this._afi=afi;this._name=data[0];this._pos=C3.New(C3.Vector2,data[1],data[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}; + +} + +// objects/objectClass.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IObjectClass=self.IObjectClass;const assert=self.assert; +C3.ObjectClass=class ObjectClass extends C3.DefendedBase{constructor(runtime,index,data){super();const PluginCtor=runtime.GetObjectReference(data[1]);this._runtime=runtime;this._plugin=runtime.GetPluginManager().GetPluginByConstructorFunction(PluginCtor);this._sdkType=null;this._instSdkCtor=PluginCtor.Instance;this._index=index;this._sid=data[11];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[14]);this._isGlobal=!!data[9];this._isFamily=!!data[2];this._isOnLoaderLayout=!!data[10]; +this._instVars=data[3].map(arr=>({sid:arr[0],type:arr[1],name:arr[2],jsPropName:runtime.GetJsPropName(arr[3])}));this._behaviorsCount=data[4];this._effectsCount=data[5];this._isWorldType=this._plugin.IsWorldType();this._dispatcher=C3.New(C3.Event.Dispatcher);this._effectList=null;this._collisionGrid=C3.New(C3.SparseGrid,runtime.GetOriginalViewportWidth(),runtime.GetOriginalViewportHeight());this._anyCollisionCellChanged=true;this._anyInstanceParallaxed=false;this._familyMembers=null;this._familyMembersSet= +null;this._familyIndex=-1;this._families=null;this._familiesSet=null;this._familyInstVarMap=null;this._familyBehaviorMap=null;this._familyEffectMap=null;this._isInContainer=false;this._container=null;this._behaviorTypes=data[8].map(behaviorTypeData=>C3.BehaviorType.Create(this,behaviorTypeData));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._customActionMap=new Map;this._solStack=C3.New(C3.SolStack,this); +this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=false;this._container=null;this._imageInfo=null;this._animations=null;this._animationsByName=null;this._animationsBySid=null;this._textureRefCount=0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=true;if(this._plugin.HasEffects())this._effectList=C3.New(C3.EffectList,this,data[12]);if(data[6]){this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(data[6])}if(data[7]){this._animations= +data[7].map(animData=>C3.New(C3.AnimationInfo,animData));this._animationsByName=new Map;this._animationsBySid=new Map;for(const anim of this._animations){this._animationsByName.set(anim.GetName().toLowerCase(),anim);this._animationsBySid.set(anim.GetSID(),anim)}}if(this._isFamily){this._familyMembers=[];this._familyMembersSet=new Set;this._familyIndex=this._runtime._GetNextFamilyIndex()}else{this._families=[];this._familiesSet=new Set;this._familyInstVarMap=[];this._familyBehaviorMap=[];this._familyEffectMap= +[]}this._sdkType=C3.New(PluginCtor.Type,this,data[15]);this._iObjectClass=null;this._instanceUserScriptClass=null;this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);const CustomScriptClass=this._sdkType.GetScriptInterfaceClass();if(CustomScriptClass){this._iObjectClass=new CustomScriptClass(this);if(!(this._iObjectClass instanceof IObjectClass))throw new TypeError("script interface class must derive from IObjectClass");}else this._iObjectClass=new IObjectClass(this);if(data[13]){const tilemapData= +data[13];if(tilemapData){const tilePolyData=tilemapData[0];const maxTileIndex=tilemapData[1];const brushData=tilemapData[2];this._sdkType.LoadTilemapData(tilePolyData,maxTileIndex,brushData)}}if(!this._runtime.UsesLoaderLayout()||this._isFamily||this._isOnLoaderLayout||!this._isWorldType)this.OnCreate();if(this._plugin.IsSingleGlobal()){this._plugin._SetSingleGlobalObjectClass(this);this._CreateSingleGlobalInstance(data)}this._loadInstancesJson=null}static Create(runtime,index,objectClassData){return C3.New(C3.ObjectClass, +runtime,index,objectClassData)}Release(){this._dispatcher.Release();this._dispatcher=null;if(this._imageInfo){this._imageInfo.Release();this._imageInfo=null}if(this._animations){for(const a of this._animations)a.Release();C3.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._loadInstancesJson=null;this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._container=null;this._runtime=null}_LoadFamily(familyData){for(let i= +1,len=familyData.length;i0}LoadTextures(renderer){if(this._isFamily)return Promise.resolve();this._textureRefCount++;if(this._textureRefCount===1)return this._sdkType.LoadTextures(renderer)|| +Promise.resolve();else return Promise.resolve()}ReleaseTextures(){if(this._isFamily)return;this._textureRefCount--;if(this._textureRefCount<0)throw new Error("released textures too many times");if(this._textureRefCount===0)this._sdkType.ReleaseTextures()}OnDynamicTextureLoadComplete(){if(this._isFamily)throw new Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(renderer){if(this._isFamily)return Promise.resolve();return this._sdkType.PreloadTexturesWithInstances(renderer)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(Ctor){return Ctor&& +this._usedBehaviorCtors.has(Ctor)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(iv=>iv.sid)}GetInstanceVariableIndexBySID(sid){return this._instVars.findIndex(iv=>iv.sid===sid)}GetInstanceVariableIndexByName(name){return this._instVars.findIndex(iv=>iv.name===name)}_GetAllInstanceVariableNames(){return this._instVars.map(iv=>iv.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(iv=>iv.jsPropName)}GetInstanceVariableType(i){i= +Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].type}GetInstanceVariableName(i){i=Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(name){return this._behaviorsByName.get(name.toLowerCase())|| +null}GetBehaviorIndexByName(name){const ret=this._behaviorNameToIndex.get(name.toLowerCase());if(typeof ret==="undefined")return-1;else return ret}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(i){this._defaultLayerIndex= +i}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(family){return this._familiesSet.has(family)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(objectType){return this._familyMembersSet.has(objectType)}GetFamilyBehaviorOffset(familyIndex){return this._familyBehaviorMap[familyIndex]}GetFamilyInstanceVariableOffset(familyIndex){return this._familyInstVarMap[familyIndex]}AddCustomAction(customAceBlock){this._customActionMap.set(customAceBlock.GetACEName().toLowerCase(), +customAceBlock)}HasOwnCustomActionByName(name){return!!this.GetOwnCustomActionByName(name)}GetOwnCustomActionByName(name){const ret=this._customActionMap.get(name.toLowerCase());return ret&&ret.IsEnabled()?ret:null}GetAnimationByName(name){if(!this._animations)throw new Error("no animations");return this._animationsByName.get(name.toLowerCase())||null}GetAnimationBySID(sid){if(!this._animations)throw new Error("no animations");return this._animationsBySid.get(sid)||null}GetFirstAnimationFrame(){if(!this._animations)throw new Error("no animations"); +return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const firstFrameInfo=this.GetFirstAnimationFrame().GetImageInfo();return[firstFrameInfo.GetWidth(),firstFrameInfo.GetHeight()]}else if(this._imageInfo)return[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()];else return[100,100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw new Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances; +yield*this._runtime.instancesPendingCreateForObjectClass(this)}GetInstanceCount(){return this._instances.length}_AddInstance(inst){this._instances.push(inst)}_SetIIDsStale(){this._iidsStale=true}_UpdateIIDs(){if(!this._iidsStale||this._isFamily)return;const instances=this._instances;let i=0;for(let len=instances.length;i0)return instances[inst.GetIID()%instances.length];else return null}*allCorrespondingInstances(inst,objectClass){const myInstances=this.GetCurrentSol().GetInstances();const myInstanceCount=myInstances.length;const otherSol=objectClass.GetCurrentSol();const otherInstances=objectClass.GetCurrentSol().GetInstances(); +const otherInstanceCount=otherInstances.length;let index=inst.GetIID();if(objectClass.IsFamily()||!otherSol.IsSelectAll())index=otherInstances.indexOf(inst);const divisor=Math.ceil(myInstanceCount/otherInstanceCount);const remainder=myInstanceCount%otherInstanceCount;let startIndex=0;let correspondCount=0;if(remainder===0||indexinst.SaveToJson())};if(this._savedData&&this._savedData.size)o["ex"]=C3.ToSuperJSON(this._savedData);return o}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}const ex=o["ex"];if(ex)this._savedData=C3.FromSuperJSON(ex);const existingInstances=this._instances;const loadInstances=o["instances"];for(let i=0,len=Math.min(existingInstances.length,loadInstances.length);io.IsWorldType())}}; + +} + +// objects/instance.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IInstance=self.IInstance;const EMPTY_ARRAY=[];let nextPuid=0;const savedDataMaps=new WeakMap;const unsavedDataMaps=new WeakMap;const FLAG_DESTROYED=1<<0;const FLAG_TILEMAP=1<<1;const FLAG_MUST_PREDRAW=1<<2;const FLAG_SOLID_ENABLED=1<<3;const FLAG_JUMPTHRU_ENABLED=1<<4;const FLAG_MUST_MITIGATE_Z_FIGHTING=1<<5;const FLAG_IS_DRAWING_WITH_EFFECTS=1<<6; +C3.Instance=class Instance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._objectType=opts.objectType;this._worldInfo=null;this._sdkInst=null;this._iScriptInterface=null;this._iid=0;this._uid=opts.uid;this._puid=nextPuid++;this._flags=0;this._instVarValues=EMPTY_ARRAY;this._behaviorInstances=EMPTY_ARRAY;const behaviorTypes=this._objectType.GetBehaviorTypesIncludingInherited();if(behaviorTypes.length>0)this._behaviorInstances=behaviorTypes.map((behaviorType,index)=> +C3.New(C3.BehaviorInstance,{runtime:this._runtime,behaviorType:behaviorType,instance:this,index}));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;const plugin=this.GetPlugin();if(plugin.MustPreDraw())this._flags|=FLAG_MUST_PREDRAW;if(plugin.IsWorldType()){this._worldInfo=C3.New(C3.WorldInfo,this,opts.layer);if(opts.worldData)this._worldInfo.Init(opts.worldData);else{this._worldInfo.InitNoData();const [width,height]=this._objectType.GetDefaultInstanceSize(); +this._worldInfo.SetSize(width,height);if(this.GetObjectClass().UsesEffects())this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}}if(opts.instVarData)this._LoadInstanceVariableData(opts.instVarData);else this._LoadDefaultInstanceVariables()}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}if(this._behaviorInstances.length>0){for(const behInst of this._behaviorInstances)behInst.Release();C3.clearArray(this._behaviorInstances)}this._sdkInst.Release(); +this._sdkInst=null;const savedData=savedDataMaps.get(this);if(savedData){savedData.clear();savedDataMaps.delete(this)}const unsavedData=unsavedDataMaps.get(this);if(unsavedData){unsavedData.clear();unsavedDataMaps.delete(this)}if(this._siblings)C3.clearArray(this._siblings);if(this._dispatcher){this._dispatcher.Release();this._dispatcher=null}this._runtime=null;this._objectType=null;if(this._instVarValues.length>0)C3.clearArray(this._instVarValues);if(this._worldInfo){this._worldInfo.Release();this._worldInfo= +null}}_LoadInstanceVariableData(instVarData){if(instVarData.length>0){this._instVarValues=[];C3.shallowAssignArray(this._instVarValues,instVarData)}}_LoadDefaultInstanceVariables(){const len=this._objectType.GetInstanceVariablesCount();if(len===0)return;this._instVarValues=[];const typeToInitValue=[0,0,""];for(let i=0;i{const objectClass=objectClass_||inst.GetObjectClass();const instSet=pickMap.get(objectClass);if(instSet)instSet.add(inst);else pickMap.set(objectClass,new Set([inst]))};addInst(this,createdObjectClass);if(this.IsInContainer())for(const s of this.siblings())addInst(s);if(includeHierarchy)for(const c of this.allChildren())addInst(c)}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw new Error("object does not support scene graph"); +}HasParent(){return this.GetParent()!==null}GetParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetParent();return parentWi?parentWi.GetInstance():null}GetTopParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetTopParent();return parentWi?parentWi.GetInstance():null}*parents(){const wi=this.GetWorldInfo();if(!wi)return;for(const parentWi of wi.parents())yield parentWi.GetInstance()}HasChild(child){if(!child)return false;for(const c of this.children())if(c=== +child)return true;return false}HasChildren(){const wi=this.GetWorldInfo();return wi?wi.HasChildren():false}GetChildrenOfObjectClass(objectClass){const wi=this.GetWorldInfo();if(!wi)return[];const objectClassName=objectClass.GetName();return wi.GetChildren().map(wi=>wi.GetInstance()).filter(i=>i.GetObjectClass().GetName()===objectClassName)}GetChildren(){const wi=this.GetWorldInfo();if(!wi)return[];return wi.GetChildren().map(wi=>wi.GetInstance())}*children(){const wi=this.GetWorldInfo();if(!wi)return; +for(const childWi of wi.children())yield childWi.GetInstance()}*allChildren(){const wi=this.GetWorldInfo();if(!wi)return;for(const childWi of wi.allChildren())yield childWi.GetInstance()}GetChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetChildCount():0}GetParentCount(){return[...this.parents()].length}GetAllChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetAllChildCount():0}GetChildAt(index){const wi=this.GetWorldInfo();if(!wi)return null;const childWi=wi.GetChildAt(index);return childWi? +childWi.GetInstance():null}AddChild(childInst,opts){this.VerifySupportsSceneGraph();childInst.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(childInst.GetWorldInfo(),opts||{})}RemoveChild(childInst){const wi=this.GetWorldInfo();if(!wi)return;wi.RemoveChild(childInst.GetWorldInfo())}GetDestroyWithParent(){const wi=this.GetWorldInfo();return wi?wi.GetDestroyWithParent():false}SetupInitialSceneGraphConnections(){const wi=this.GetWorldInfo();if(!wi)return;const childrenData=wi.GetSceneGraphChildrenExportData(); +if(!childrenData)return;for(const childData of childrenData){const child=this._runtime.GetInstanceByUID(childData[2]);if(child){const flags=childData[3];this.AddChild(child,{transformX:!!(flags>>0&1),transformY:!!(flags>>1&1),transformWidth:!!(flags>>2&1),transformHeight:!!(flags>>3&1),transformAngle:!!(flags>>4&1),destroyWithParent:!!(flags>>5&1),transformZElevation:!!(flags>>6&1),transformOpacity:!!(flags>>7&1),transformVisibility:!!(flags>>8&1)})}}}SetupPersistedSceneGraphConnections(instanceToPersistedDataMap, +persistedIndexToInstanceMap){const persistedData=instanceToPersistedDataMap.get(this);if(!persistedData)return;for(const persistedChildData of persistedData["sceneGraphJson"]["children"]){const child=persistedIndexToInstanceMap.get(persistedChildData["index"]);if(!child)continue;const flags=persistedChildData["flags"];this.AddChild(child,{transformX:!!(flags>>0&1),transformY:!!(flags>>1&1),transformWidth:!!(flags>>2&1),transformHeight:!!(flags>>3&1),transformAngle:!!(flags>>4&1),destroyWithParent:!!(flags>> +5&1),transformZElevation:!!(flags>>6&1),transformOpacity:!!(flags>>7&1),transformVisibility:!!(flags>>8&1)})}}GetTemplateName(){const templateManager=this._runtime.GetTemplateManager();return templateManager?templateManager.GetInstanceTemplateName(this):""}IsInContainer(){return this._siblings!==null}_AddSibling(inst){this._siblings.push(inst)}GetSiblings(){return this._siblings}HasSibling(objectClass){return!!this.GetSibling(objectClass)}GetSibling(objectClass){const siblings=this.siblings();if(siblings=== +null||siblings.length===0)return false;for(const s of siblings)if(s.GetObjectClass()===objectClass)return s;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol().SetSinglePicked(s)}_PushSiblingsToSolInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushInstance(s)}_SetSiblingsToSolInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnInstances()[i]=s}_PushSiblingsToSolElseInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushElseInstance(s)}_SetSiblingsToSolElseInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[i]= +s}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(i){this._iid=i}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(ctor){if(!ctor)return null;for(const behInst of this._behaviorInstances)if(behInst.GetBehavior()instanceof ctor)return behInst;return null}GetBehaviorSdkInstanceFromCtor(ctor){if(!ctor)return null;const behInst=this.GetBehaviorInstanceFromCtor(ctor); +if(behInst)return behInst.GetSdkInstance();else return null}GetBehaviorIndexBySID(sid){const behaviorInstances=this._behaviorInstances;for(let i=0,len=behaviorInstances.length;i=instVarValues.length)throw new RangeError("invalid instance variable");return instVarValues[index]}_GetInstanceVariableValueUnchecked(index){return this._instVarValues[index]}_GetInstanceVariableTypedValue(index){const ret=this._instVarValues[index];if(this._objectType.GetInstanceVariableType(index)===0)return!!ret;else return ret}SetInstanceVariableValue(index,value){index=index|0;const instVarValues=this._instVarValues;if(index< +0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const type=this._objectType.GetInstanceVariableType(index);switch(type){case 0:instVarValues[index]=value?1:0;break;case 1:instVarValues[index]=typeof value==="number"?value:parseFloat(value);break;case 2:instVarValues[index]=typeof value==="string"?value:value.toString();break;default:throw new Error("unknown instance variable type");}}SetInstanceVariableOffset(index,offset){if(offset===0)return;index=index|0;const instVarValues= +this._instVarValues;if(index<0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const lastValue=instVarValues[index];if(typeof lastValue==="number")if(typeof offset==="number")instVarValues[index]+=offset;else instVarValues[index]+=parseFloat(offset);else if(typeof lastValue==="boolean")throw new Error("can not set offset of boolean variable");else if(typeof lastValue==="string")throw new Error("can not set offset of string variable");else throw new Error("unknown instance variable type"); +}GetSavedDataMap(){let ret=savedDataMaps.get(this);if(ret)return ret;ret=new Map;savedDataMaps.set(this,ret);return ret}GetUnsavedDataMap(){let ret=unsavedDataMaps.get(this);if(ret)return ret;ret=new Map;unsavedDataMaps.set(this,ret);return ret}_HasAnyCreateDestroyHandler(name){const objectType=this.GetObjectClass();if(objectType.UserScriptDispatcher().HasAnyHandlerFor(name))return true;for(const family of objectType.GetFamilies())if(family.UserScriptDispatcher().HasAnyHandlerFor(name))return true; +if(this._runtime.UserScriptDispatcher().HasAnyHandlerFor(name))return true;return false}_TriggerOnCreatedOnSelfAndRelated(){const instancesToTriggerOnCreated=new Set;instancesToTriggerOnCreated.add(this);const wi=this.GetWorldInfo();if(wi&&wi.HasChildren())for(const c of this.allChildren()){instancesToTriggerOnCreated.add(c);if(!c.IsInContainer())continue;for(const s of c.siblings())instancesToTriggerOnCreated.add(s)}if(this.IsInContainer())for(const s of this.siblings())instancesToTriggerOnCreated.add(s); +for(const instance of instancesToTriggerOnCreated.values())instance._TriggerOnCreated()}_TriggerOnCreated(){if(this._objectType._GetUserScriptInstanceClass())this.GetInterfaceClass();if(this._HasAnyCreateDestroyHandler("instancecreate")){const objectType=this.GetObjectClass();const instCreateEvent=new C3.Event("instancecreate");instCreateEvent.instance=this.GetInterfaceClass();objectType.DispatchUserScriptEvent(instCreateEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instCreateEvent); +this._runtime.DispatchUserScriptEvent(instCreateEvent)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(isEndingLayout){if(this._iScriptInterface){const e=new C3.Event("destroy");e.isEndingLayout=isEndingLayout;this.DispatchUserScriptEvent(e)}if(!this._HasAnyCreateDestroyHandler("instancedestroy"))return;const objectType=this.GetObjectClass(); +const instDestroyEvent=new C3.Event("instancedestroy");instDestroyEvent.instance=this.GetInterfaceClass();instDestroyEvent.isEndingLayout=isEndingLayout;objectType.DispatchUserScriptEvent(instDestroyEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instDestroyEvent);this._runtime.DispatchUserScriptEvent(instDestroyEvent)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(mode="full"){const o={};if(mode==="full")o["uid"]=this.GetUID(); +else o["c3"]=true;if(mode!=="visual-state"){const savedData=savedDataMaps.get(this);if(savedData&&savedData.size)o["ex"]=C3.ToSuperJSON(savedData);if(this.GetTimeScale()!==-1)o["mts"]=this.GetTimeScale();if(this._objectType.GetInstanceVariablesCount()>0){const ivs={};const ivSids=this._objectType.GetInstanceVariableSIDs();for(let i=0,len=this._instVarValues.length;i=this._instVarValues.length)continue;let v=value;if(v===null)v=NaN;this._instVarValues[index]=v}}if(this.GetPlugin().IsWorldType()){const worldData=o["w"];const layerSid=worldData["l"];if(this._worldInfo.GetLayer().GetSID()!==layerSid){const oldLayer=this._worldInfo.GetLayer();const newLayer=oldLayer.GetLayout().GetLayerBySID(layerSid); +if(newLayer){this._worldInfo._SetLayer(newLayer);oldLayer._RemoveInstance(this,true);newLayer._AddInstance(this,true);newLayer.SetZIndicesChanged();this._worldInfo.SetBboxChanged()}else if(mode==="full")this._runtime.DestroyInstance(this)}this._worldInfo._LoadFromJson(worldData,mode)}if(mode!=="visual-state"){const behs=o["behs"];if(behs)for(const [sidStr,data]of Object.entries(behs)){const sid=parseInt(sidStr,10);const index=this.GetBehaviorIndexBySID(sid);if(index<0||index>=this._behaviorInstances.length)continue; +this._behaviorInstances[index].LoadFromJson(data)}}const ownData=o["data"];if(ownData)this._sdkInst.LoadFromJson(ownData,mode)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}_InitUserScriptInterface(){const DefaultScriptClass=this._worldInfo?self.IWorldInstance:IInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const UserScriptClass=this._objectType._GetUserScriptInstanceClass();const ScriptInterfaceClass= +UserScriptClass||SdkScriptClass||DefaultScriptClass;IInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IInstance._Init(null);if(SdkScriptClass&&!(this._iScriptInterface instanceof DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`);if(UserScriptClass){const ExpectedBaseClass=SdkScriptClass||DefaultScriptClass;if(!(this._iScriptInterface instanceof ExpectedBaseClass))throw new TypeError(`setInstanceClass(): class '${UserScriptClass.name}' does not extend the right base class '${ExpectedBaseClass.name}'`); +}return this._iScriptInterface}_GetInstVarsScriptDescriptor(instDescriptors){if(this._instVarValues.length===0)return;const varDescriptors={};const instVarJsPropNames=this._objectType._GetAllInstanceVariableJsPropNames();for(let i=0,len=instVarJsPropNames.length;i0}GetChildren(){return this._children}_MaybeSortChildren(){if(!this.HasChildren())return;if(!this._tmpSceneGraphChildrenIndexes)return;if(this._children.length===1)return;this._children.sort((f,s)=>{const fIndex=this._tmpSceneGraphChildrenIndexes.get(f.GetInstance()); +const sIndex=this._tmpSceneGraphChildrenIndexes.get(s.GetInstance());if(C3.IsFiniteNumber(fIndex)&&C3.IsFiniteNumber(sIndex))return fIndex-sIndex;return 0})}GetStartScaleX(){return this._startScaleX}SetStartScaleX(sx){this._startScaleX=sx}GetStartScaleY(){return this._startScaleY}SetStartScaleY(sy){this._startScaleY=sy}GetStartOpacity(){return this._startOpacity}GetOwnOpacity(){return this._ownOpacity}SetOwnOpacity(ownOpacity){this._ownOpacity=ownOpacity}_GetStartWidth(){if(this._startWidth===0)return Number.EPSILON; +return this._startWidth}_GetStartHeight(){if(this._startHeight===0)return Number.EPSILON;return this._startHeight}GetParentScaleX(){if(this._owner.GetTransformWithParentWidth()){const p=this._parent;let cw=p.GetWidth();let sw=p._GetSceneGraphInfo()._GetStartWidth();if(cw===0)cw=Number.EPSILON;if(sw===Number.EPSILON&&cw===Number.EPSILON)return 1;if(sw===Number.EPSILON&&cw!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+cw/sdkIntance.GetOriginalWidth()}return cw/ +sw}return 1}GetParentScaleY(){if(this._owner.GetTransformWithParentHeight()){const p=this._parent;let ch=p.GetHeight();let sh=p._GetSceneGraphInfo()._GetStartHeight();if(ch===0)ch=Number.EPSILON;if(sh===Number.EPSILON&&ch===Number.EPSILON)return 1;if(sh===Number.EPSILON&&ch!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+ch/sdkIntance.GetOriginalHeight()}return ch/sh}return 1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(mode){return{"sw":this._startWidth, +"sh":this._startHeight,"sx":this._startScaleX,"sy":this._startScaleY,"psa":this._parentStartAngle,"oo":this._ownOpacity,"so":this._startOpacity,"p":this._GetParentJson(mode),"c":this._GetChildrenJson(mode)}}_GetFlagsString(wi){let flagsStr="";if(wi.GetTransformWithParentX())flagsStr+="x";if(wi.GetTransformWithParentY())flagsStr+="y";if(wi.GetTransformWithParentWidth())flagsStr+="w";if(wi.GetTransformWithParentHeight())flagsStr+="h";if(wi.GetTransformWithParentAngle())flagsStr+="a";if(wi.GetTransformWithParentZElevation())flagsStr+= +"z";if(wi.GetDestroyWithParent())flagsStr+="d";if(wi.GetTransformWithParentOpacity())flagsStr+="o";if(wi.GetTransformWithParentVisibility())flagsStr+="v";return flagsStr}_GetParentJson(mode){if(!this._parent)return null;if(!this._parent.GetInstance()||this._parent.GetInstance().IsDestroyed())return null;return this._GetInstanceJson(this._parent,this._owner,mode)}_GetChildrenJson(mode){return this._children.map(c=>{return this._GetInstanceJson(c,c,mode)})}_GetInstanceJson(wi,flagsSource,mode){const inst= +wi.GetInstance();const ret={};ret["uid"]=inst.GetUID();ret["f"]=this._GetFlagsString(flagsSource);ret["offsets"]=flagsSource._SaveSceneGraphPropertiesToJson();ret["data"]=C3.SceneGraphInfo.GetSceneGraphInstanceDataFromInstance(inst);ret["oci"]=inst.GetObjectClass().GetIndex();if(mode==="state"){ret["inst"]=inst.SaveToJson();ret["instIndex"]=NaN}else{ret["instIndex"]=inst.GetObjectClass().GetInstances().indexOf(inst);ret["inst"]=null}return ret}_LoadFromJson(o){this._startWidth=o["sw"];this._startHeight= +o["sh"];this._startScaleX=o["sx"];this._startScaleY=o["sy"];this._parentStartAngle=o["psa"];this._ownOpacity=o["oo"];this._startOpacity=o["so"]}_SetTmpSceneGraphChildren(tmpSceneGraphChildren,tmpSceneGraphChildrenIndexes){this._tmpSceneGraphChildren=tmpSceneGraphChildren;this._tmpSceneGraphChildrenIndexes=tmpSceneGraphChildrenIndexes}_OnAfterLoad(o,opts){const owner=this._owner;const runtime=owner.GetRuntime();const processedExistingWis=new Set;if(o["p"]&&!this._parent){const parentUid=o["p"]["uid"]; +const parentInst=runtime.GetInstanceByUID(parentUid);if(opts&&!opts.ignoreMissingInstances);if(parentInst){const parentWi=parentInst.GetWorldInfo();if(parentInst.HasChild(this._owner.GetInstance()))this._parent=parentWi;else{parentInst.AddChild(this._owner.GetInstance(),this._GetFlagsObj(o["p"]["f"]));if(!processedExistingWis.has(this._owner))this._owner._LoadSceneGraphPropertiesFromJson(o["p"]["offsets"]);processedExistingWis.add(this._owner);const pwi=parentInst.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}else if(C3.IsFiniteNumber(o["p"]["oci"])){const objectClass= +runtime.GetObjectClassByIndex(o["p"]["oci"]);const system=runtime.GetSystemPlugin();const parentInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true);if(opts&&!opts.ignoreMissingInstances);if(parentInstance){const instData=this._GetInstanceData(o["p"],runtime);parentInstance.LoadFromJson(instData);const parentWi=parentInstance.GetWorldInfo();parentWi.GetLayer().SortAndAddInstancesByZIndex(parentInstance);parentInstance.AddChild(owner.GetInstance(),this._GetFlagsObj(o["p"]["f"])); +const pwi=parentInstance.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}}const childInstances=[];for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(childInst)childInstances.push(childInst)}let childIndex=0;for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(opts&&!opts.ignoreMissingInstances);if(childInst){if(this._tmpSceneGraphChildren&&this._tmpSceneGraphChildren[childIndex]){const existingChildIntance= +this._tmpSceneGraphChildren[childIndex];if(existingChildIntance.GetObjectClass()!==childInst.GetObjectClass()){childIndex++;continue}if(existingChildIntance.IsDestroyed()){childIndex++;continue}const newChildData=o["c"][childIndex];if(opts&&opts.alwaysApplyJson)this._AddAndSetChildInstance(existingChildIntance.GetWorldInfo(),newChildData,processedExistingWis,true);else this._AddAndSetChildInstance(existingChildIntance.GetWorldInfo(),newChildData,processedExistingWis,false);childIndex++;continue}const objectClass= +childInst.GetObjectClass();const childrenCount=this._GetInstancesOfObjectClassCount(childInstances,objectClass);const childrenOfClassCount=owner.GetInstance().GetChildrenOfObjectClass(objectClass).length;if(childrenCount===childrenOfClassCount){const existingChild=owner.GetInstance().GetChildAt(childIndex);const existingChildWi=existingChild.GetWorldInfo();if(existingChildWi){if(!processedExistingWis.has(existingChildWi))existingChildWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(existingChildWi)}childIndex++; +continue}if(childInst.HasParent()){const childWi=this._CreateNewChildInstance(childData,opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis);childIndex++;continue}this._AddAndSetChildInstance(childInst.GetWorldInfo(),childData,processedExistingWis)}else if(this._tmpSceneGraphChildren&&this._tmpSceneGraphChildren[childIndex]){const existingChildIntance=this._tmpSceneGraphChildren[childIndex];const objectClass=runtime.GetObjectClassByIndex(this._GetObjectClassIndex(childData)); +if(existingChildIntance.GetObjectClass()!==objectClass){childIndex++;continue}if(existingChildIntance.IsDestroyed()){childIndex++;continue}const newChildData=o["c"][childIndex];this._AddAndSetChildInstance(existingChildIntance.GetWorldInfo(),newChildData,processedExistingWis)}else{const childWi=this._CreateNewChildInstance(childData,opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis)}childIndex++}}_GetFlagsObj(flagsString){const opts={};opts.transformX=flagsString.includes("x"); +opts.transformY=flagsString.includes("y");opts.transformWidth=flagsString.includes("w");opts.transformHeight=flagsString.includes("h");opts.transformAngle=flagsString.includes("a");opts.transformZElevation=flagsString.includes("z");opts.destroyWithParent=flagsString.includes("d");opts.transformOpacity=flagsString.includes("o");opts.transformVisibility=flagsString.includes("v");return opts}_GetObjectClassIndex(childData){if(C3.IsFiniteNumber(childData["oci"]))return childData["oci"];return childData[1]}_CreateNewChildInstance(childData, +opts){if(!C3.IsFiniteNumber(childData["oci"]))return;const owner=this._owner;const runtime=owner.GetRuntime();let childInstance;if(childData["data"])childInstance=runtime.CreateInstanceFromData(childData["data"],owner.GetLayer(),false,0,0,false,true);else{const objectClass=runtime.GetObjectClassByIndex(childData["oci"]);childInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true)}if(opts&&!opts.ignoreMissingInstances);if(!childInstance)return;const instData=this._GetInstanceData(childData, +runtime);childInstance.LoadFromJson(instData);const childWi=childInstance.GetWorldInfo();childWi.GetLayer().SortAndAddInstancesByZIndex(childInstance,true);return childWi}_AddAndSetChildInstance(childWi,childData,processedExistingWis,setJson=true){const owner=this._owner;const added=owner.AddChild(childWi,this._GetFlagsObj(childData["f"]));if(added&&setJson){if(!processedExistingWis.has(childWi))childWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(childWi)}this._MaybeSortChildren()}_GetInstancesOfObjectClassCount(instances, +objectClass){return instances.filter(i=>i.GetObjectClass().GetName()===objectClass.GetName()).length}_GetInstanceData(json,runtime){if(C3.IsFiniteNumber(json["instIndex"])){const objectClass=runtime.GetObjectClassByIndex(json["oci"]);const instancesJson=objectClass._GetLoadInstancesJson();return instancesJson[json["instIndex"]]}else if(C3.IsString(json["inst"]))return JSON.parse(json["inst"]);else if(json["inst"])return json["inst"]}static GetSceneGraphInstanceDataFromInstance(sourceInstance){let instData= +sourceInstance.GetWorldInfo().GetLayer().GetInitialInstanceData(sourceInstance.GetUID());if(!instData)return null;instData=JSON.parse(JSON.stringify(instData));const newSgiData=[];for(const child of[...sourceInstance.GetChildren()]){const childWi=child.GetWorldInfo();newSgiData.push([childWi.GetLayout().GetSID(),childWi.GetLayer().GetIndex(),child.GetUID(),C3.SceneGraphInfo._GetFlagsNumber(childWi),child.GetObjectClass().IsInContainer()?1:0,childWi.GetZIndex(),C3.SceneGraphInfo.GetSceneGraphInstanceDataFromInstance(child)])}if(C3.IsArray(instData[0][14]))instData[0][14][1]= +newSgiData;else{instData[0][14]=[];instData[0][14][0]=C3.SceneGraphInfo._GetDefaultFlagsNumber();instData[0][14][1]=newSgiData;instData[0][14][2]=sourceInstance.GetWorldInfo().GetZIndex()}return instData}static _GetFlagsNumber(wi){let flagsNumber=0;flagsNumber|=Number(wi.GetTransformWithParentVisibility())<<8;flagsNumber|=Number(wi.GetTransformWithParentOpacity())<<7;flagsNumber|=Number(wi.GetTransformWithParentZElevation())<<6;flagsNumber|=Number(wi.GetDestroyWithParent())<<5;flagsNumber|=Number(wi.GetTransformWithParentAngle())<< +4;flagsNumber|=Number(wi.GetTransformWithParentHeight())<<3;flagsNumber|=Number(wi.GetTransformWithParentWidth())<<2;flagsNumber|=Number(wi.GetTransformWithParentY())<<1;flagsNumber|=Number(wi.GetTransformWithParentX())<<0;return flagsNumber}static _GetDefaultFlagsNumber(wi){let flagsNumber=0;flagsNumber|=1<<8;flagsNumber|=1<<7;flagsNumber|=1<<6;flagsNumber|=1<<5;flagsNumber|=1<<4;flagsNumber|=1<<3;flagsNumber|=1<<2;flagsNumber|=1<<1;flagsNumber|=1<<0;return flagsNumber}}; + +} + +// objects/worldInfo.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const bboxChangeEvent=C3.New(C3.Event,"bboxchange",false);const tempColor=C3.New(C3.Color,0,0,0,0);const tempCollisionPoly=C3.New(C3.CollisionPoly);const DEFAULT_COLOR=C3.New(C3.Color,1,1,1,1);const DEFAULT_RENDER_CELLS=C3.New(C3.Rect,0,0,-1,-1);const DEFAULT_COLLISION_CELLS=C3.New(C3.Rect,0,0,-1,-1); +const VALID_SET_MESH_POINT_MODES=new Set(["absolute","relative"]);const EMPTY_ARRAY=[];let enableUpdateRendererStateGroup=true;const FLAG_IS_VISIBLE=1<<0;const FLAG_BBOX_CHANGED=1<<1;const FLAG_ENABLE_BBOX_CHANGED_EVENT=1<<2;const FLAG_COLLISION_ENABLED=1<<3;const FLAG_COLLISION_CELL_CHANGED=1<<4;const FLAG_SOLID_FILTER_INCLUSIVE=1<<5;const FLAG_HAS_ANY_ACTIVE_EFFECT=1<<6;const FLAG_IS_ROTATABLE=1<<7;const FLAG_DESTROYED=1<<8;const FLAG_DESTROY_WITH_PARENT=1<<9; +const FLAG_TRANSFORM_WITH_PARENT_X=1<<10;const FLAG_TRANSFORM_WITH_PARENT_Y=1<<11;const FLAG_TRANSFORM_WITH_PARENT_W=1<<12;const FLAG_TRANSFORM_WITH_PARENT_H=1<<13;const FLAG_TRANSFORM_WITH_PARENT_A=1<<14;const FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION=1<<15;const FLAG_TRANSFORM_WITH_PARENT_OPACITY=1<<22;const FLAG_TRANSFORM_WITH_PARENT_VISIBILITY=1<<23; +const MASK_ALL_SCENE_GRAPH_FLAGS=FLAG_DESTROY_WITH_PARENT|FLAG_TRANSFORM_WITH_PARENT_X|FLAG_TRANSFORM_WITH_PARENT_Y|FLAG_TRANSFORM_WITH_PARENT_W|FLAG_TRANSFORM_WITH_PARENT_H|FLAG_TRANSFORM_WITH_PARENT_A|FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION|FLAG_TRANSFORM_WITH_PARENT_OPACITY|FLAG_TRANSFORM_WITH_PARENT_VISIBILITY;const FLAG_MESH_CHANGED=1<<16;const FLAG_PHYSICS_BODY_CHANGED=1<<17;const FLAG_SIN_COS_ANGLE_CHANGED=1<<18;const FLAG_USE_POINTS_SHADER_PROGRAM=1<<19;const FLAG_DRAW_BACK_FACE_ONLY=1<<20; +const FLAG_DRAW_NON_BACK_FACES_ONLY=1<<21;const FLAG_BLEND_MODE_BIT_OFFSET=26;const FLAG_BLEND_MODE_MASK=31<=children.length)return null;return children[index]}_CreateSceneGraphInfo(parent){if(!this._sceneGraphInfo)this._sceneGraphInfo=C3.New(C3.SceneGraphInfo,this);if(parent)this._sceneGraphInfo.SetParent(parent)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){if(!this._sceneGraphInfo)return; +this._sceneGraphInfo.Release();this._sceneGraphInfo=null}_SetParent(parent){if(parent){parent._CreateSceneGraphInfo(null);this._CreateSceneGraphInfo(parent)}else{if(this._sceneGraphInfo)this._sceneGraphInfo.SetParent(null);if(!this.HasChildren())this._ReleaseSceneGraphInfo()}}_HasAnyParent(child){if(!this.HasParent())return false;const parent=this.GetParent();if(parent===child)return true;return parent._HasAnyParent(child)}_HasChildRecursive(child){if(this.HasChild(child))return true;for(const c of this.GetChildren())if(c._HasChildRecursive(child))return true; +return false}_AddChildToSceneGraphInfo(child){this._sceneGraphInfo.GetChildren().push(child)}_RemoveChildFromSceneGraphInfo(child){const children=this._sceneGraphInfo.GetChildren();const index=children.indexOf(child);if(index!==-1)children.splice(index,1);if(children.length===0&&!this.HasParent())this._ReleaseSceneGraphInfo();if(!child.HasChildren())child._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const data=sceneGraphExportDataMap.get(this);return data?data.childrenData:null}GetSceneGraphZIndexExportData(){const data= +sceneGraphExportDataMap.get(this);return data?data.zIndexData:NaN}GetSceneGraphZIndex(){const sceneGraphZIndex=sceneGraphZIndexMap.get(this);return C3.IsFiniteNumber(sceneGraphZIndex)?sceneGraphZIndex:NaN}SetSceneGraphZIndex(z){sceneGraphZIndexMap.set(this,z)}SetUsePointsShaderProgram(){this._SetFlag(FLAG_USE_POINTS_SHADER_PROGRAM,true);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(!enableUpdateRendererStateGroup)return;const renderer=this._runtime.GetRenderer();if(this._stateGroup)renderer.ReleaseStateGroup(this._stateGroup); +let shaderProgram;if((this._flags&FLAG_USE_POINTS_SHADER_PROGRAM)!==0)shaderProgram=renderer.GetPointsRenderingProgram()||"";else shaderProgram=renderer.GetTextureFillShaderProgram()||"";this._stateGroup=renderer.AcquireStateGroup(shaderProgram,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===DEFAULT_COLOR}SetBlendMode(bm){bm=bm|0;if(bm<0||bm>31)throw new RangeError("invalid blend mode"); +if(this.GetBlendMode()===bm)return;this._flags=this._flags&~FLAG_BLEND_MODE_MASK|bm<>FLAG_BLEND_MODE_BIT_OFFSET}_SetLayer(layer,updateRenderCell){const doUpdateRenderCell=updateRenderCell&&this._layer!==layer;if(doUpdateRenderCell)this._RemoveFromRenderCells();this._layer=layer;if(doUpdateRenderCell)this._UpdateRenderCell();if(this.GetZElevation()!==0)this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(z){this._zIndex= +z|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(bit,enable){if(enable)this._flags|=bit;else this._flags&=~bit}IsVisible(){return(this._flags&FLAG_IS_VISIBLE)!==0}SetVisible(v){this._SetFlag(FLAG_IS_VISIBLE,v);if(!this.HasChildren())return;for(const child of this.GetChildren())if(child.GetTransformWithParentVisibility())child.SetVisible(v)}IsCollisionEnabled(){return(this._flags&FLAG_COLLISION_ENABLED)!==0}SetCollisionEnabled(e){e= +!!e;if(this.IsCollisionEnabled()===e)return;this._SetFlag(FLAG_COLLISION_ENABLED,e);if(e)this.SetBboxChanged();else this._RemoveFromCollisionCells()}SetSolidCollisionFilter(isInclusive,tags){this._SetFlag(FLAG_SOLID_FILTER_INCLUSIVE,isInclusive);if(this._solidFilterTags)this._solidFilterTags.clear();if(!tags.trim()){this._solidFilterTags=null;return}if(!this._solidFilterTags)this._solidFilterTags=new Set;for(const tag of tags.split(" "))if(tag)this._solidFilterTags.add(tag.toLowerCase())}IsSolidCollisionAllowed(solidTagSet){const isInclusive= +(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;const filterTags=this._solidFilterTags;if(!solidTagSet||!filterTags)return!isInclusive;for(const tag of filterTags)if(solidTagSet.has(tag))return isInclusive;return!isInclusive}SetBboxChanged(){this._flags|=FLAG_BBOX_CHANGED|FLAG_COLLISION_CELL_CHANGED|FLAG_MESH_CHANGED;this._objectClass._SetAnyCollisionCellChanged(true);this._runtime.UpdateRender();if(this._layer.UsesRenderCells()){this.CalculateBbox(this._boundingBox,this._boundingQuad,true);this._flags&= +~FLAG_BBOX_CHANGED;this._UpdateRenderCell()}if((this._flags&FLAG_ENABLE_BBOX_CHANGED_EVENT)!==0)this._inst.Dispatcher().dispatchEvent(bboxChangeEvent);if(this._sceneGraphInfo!==null){const children=this._sceneGraphInfo.GetChildren();for(let i=0,len=children.length;i=layer.GetCameraZ())return false; +layer.GetViewportForZ(totalZElevation,tempRect);return tempRect.intersectsRect(this.GetBoundingBox())}IsInViewport3D(viewFrustum){const bbox=this.GetBoundingBox();const minX=bbox.getLeft();const maxX=bbox.getRight();const minY=bbox.getTop();const maxY=bbox.getBottom();const minZ=this.GetTotalZElevation();const maxZ=minZ+this.GetDepth();return viewFrustum.ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ)}IsInViewport2(){const layer=this.GetLayer();if(layer.Has3DCamera())return this.IsInViewport3D(layer._GetViewFrustum()); +else{const layout=layer.GetLayout();return this.IsInViewport(layer.GetViewport(),layout.HasVanishingPointOutsideViewport(),layout.IsOrthographicProjection())}}_SetDrawBackFaceOnly(e){this._SetFlag(FLAG_DRAW_BACK_FACE_ONLY,e)}_SetDrawNonBackFacesOnly(e){this._SetFlag(FLAG_DRAW_NON_BACK_FACES_ONLY,e)}IsDrawBackFaceOnly(){return(this._flags&FLAG_DRAW_BACK_FACE_ONLY)!==0}IsDrawNonBackFacesOnly(){return(this._flags&FLAG_DRAW_NON_BACK_FACES_ONLY)!==0}SetSourceCollisionPoly(poly){this._sourceCollisionPoly= +poly;this._DiscardTransformedCollisionPoly();if(this.HasMesh())this._meshInfo.meshPoly=null}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return this._sourceCollisionPoly!==null||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}return this._GetCustomTransformedCollisionPolyPrecalc(w, +h,a,sina,cosa)}_GetCustomTransformedCollisionPolyPrecalc(w,h,a,sinA,cosA){let tpi=this._transformedPolyInfo;if(tpi===null){tpi={poly:C3.New(C3.CollisionPoly),width:NaN,height:NaN,angle:NaN};this._transformedPolyInfo=tpi}const transformedPoly=tpi.poly;if(tpi.width===w&&tpi.height===h&&tpi.angle===a)return transformedPoly;const sourcePoly=this._sourceCollisionPoly;if(this.HasMesh()){const ox=this.GetOriginX();const oy=this.GetOriginY();const sourceMesh=this.GetSourceMesh();let meshPoly=this._meshInfo.meshPoly; +if(!meshPoly){if(sourcePoly){tempCollisionPoly.copy(sourcePoly);tempCollisionPoly.offset(ox,oy)}else tempCollisionPoly.setDefaultPoints();meshPoly=sourceMesh.InsertPolyMeshVertices(tempCollisionPoly);this._meshInfo.meshPoly=meshPoly}sourceMesh.TransformCollisionPoly(meshPoly,transformedPoly);transformedPoly.offset(-ox,-oy);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else if(sourcePoly){transformedPoly.copy(sourcePoly);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else transformedPoly.setFromQuad(this.GetBoundingQuad(), +-this.GetX(),-this.GetY());tpi.width=w;tpi.height=h;tpi.angle=a;return transformedPoly}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(true);const tpi=this._transformedPolyInfo;if(tpi===null)return;tpi.width=NaN}CreateMesh(hsize,vsize){hsize=Math.floor(hsize);vsize=Math.floor(vsize);if(!this.GetInstance().GetPlugin().SupportsMesh())throw new Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:C3.New(C3.Gfx.Mesh,hsize,vsize),transformedMesh:C3.New(C3.Gfx.Mesh, +hsize,vsize),meshPoly:null}}HasMesh(){return this._meshInfo!==null}GetSourceMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(e){this._SetFlag(FLAG_MESH_CHANGED,e)}IsMeshChanged(){return(this._flags&FLAG_MESH_CHANGED)!==0}SetPhysicsBodyChanged(e){this._SetFlag(FLAG_PHYSICS_BODY_CHANGED,e)}IsPhysicsBodyChanged(){return(this._flags&FLAG_PHYSICS_BODY_CHANGED)!== +0}_ExpandBboxForMesh(bbox){const sourceMesh=this._meshInfo.sourceMesh;const minX=Math.min(sourceMesh.GetMinX(),0);const minY=Math.min(sourceMesh.GetMinY(),0);const maxX=Math.max(sourceMesh.GetMaxX(),1);const maxY=Math.max(sourceMesh.GetMaxY(),1);const w=bbox.width();const h=bbox.height();bbox.offsetLeft(minX*w);bbox.offsetTop(minY*h);bbox.offsetRight((maxX-1)*w);bbox.offsetBottom((maxY-1)*h);this._depth=sourceMesh.GetMaxZ()}ReleaseMesh(){if(!this._meshInfo)return;this._meshInfo.sourceMesh.Release(); +this._meshInfo.transformedMesh.Release();this._meshInfo=null;this._DiscardTransformedCollisionPoly()}SetMeshPoint(col,row,opts){col=Math.floor(col);row=Math.floor(row);const mode=opts.mode||"absolute";if(!VALID_SET_MESH_POINT_MODES.has(mode))throw new Error("invalid mode");const isRelative=mode==="relative";let posx=opts.x;let posy=opts.y;const zElevation=opts.zElevation;let texu=typeof opts.u==="number"?opts.u:isRelative?0:-1;let texv=typeof opts.v==="number"?opts.v:isRelative?0:-1;if(!this.HasMesh())return false; +const sourceMesh=this.GetSourceMesh();const p=sourceMesh.GetMeshPointAt(col,row);if(p===null)return false;let ret=false;if(typeof zElevation==="number"&&p.GetZElevation()!==zElevation){p.SetZElevation(zElevation);ret=true}if(isRelative){posx+=col/(sourceMesh.GetHSize()-1);posy+=row/(sourceMesh.GetVSize()-1)}if(texu===-1&&!isRelative)texu=p.GetU();else{if(isRelative)texu+=col/(sourceMesh.GetHSize()-1);texu=C3.clamp(texu,0,1)}if(texv===-1&&!isRelative)texv=p.GetV();else{if(isRelative)texv+=row/(sourceMesh.GetVSize()- +1);texv=C3.clamp(texv,0,1)}if(p.GetX()===posx&&p.GetY()===posy&&p.GetU()===texu&&p.GetV()===texv)return ret;p.SetX(posx);p.SetY(posy);p.SetU(texu);p.SetV(texv);this._DiscardTransformedCollisionPoly();return true}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(x,y){if(!this.GetBoundingBox().containsPoint(x,y))return false;if(!this.GetBoundingQuad().containsPoint(x,y))return false;if(this.HasTilemap())return this._inst.GetSdkInstance().TestPointOverlapTile(x,y);if(!this.HasOwnCollisionPoly())return true; +return this.GetTransformedCollisionPoly().containsPoint(x-this.GetX(),y-this.GetY())}_IsCollisionCellChanged(){return(this._flags&FLAG_COLLISION_CELL_CHANGED)!==0}_UpdateCollisionCell(){if(!this._IsCollisionCellChanged()||!this.IsCollisionEnabled()||(this._flags&FLAG_DESTROYED)!==0)return;const bbox=this.GetBoundingBox();const grid=this._objectClass._GetCollisionCellGrid();const collisionCells=this._collisionCells;tempRect.set(grid.XToCell(bbox.getLeft()),grid.YToCell(bbox.getTop()),grid.XToCell(bbox.getRight()), +grid.YToCell(bbox.getBottom()));if(collisionCells.equals(tempRect))return;const inst=this._inst;if(collisionCells===DEFAULT_COLLISION_CELLS){grid.Update(inst,null,tempRect);this._collisionCells=C3.New(C3.Rect,tempRect)}else{grid.Update(inst,collisionCells,tempRect);collisionCells.copy(tempRect)}this._flags&=~FLAG_COLLISION_CELL_CHANGED}_RemoveFromCollisionCells(){const collisionCells=this._collisionCells;if(collisionCells===DEFAULT_COLLISION_CELLS)return;this._objectClass._GetCollisionCellGrid().Update(this._inst, +collisionCells,null);this._collisionCells=DEFAULT_COLLISION_CELLS}_UpdateRenderCell(){const layer=this.GetLayer();if(!layer.UsesRenderCells()||(this._flags&FLAG_DESTROYED)!==0)return;const renderGrid=layer.GetRenderGrid();const bbox=this.GetBoundingBox();const renderCells=this._renderCells;tempRect.set(renderGrid.XToCell(bbox.getLeft()),renderGrid.YToCell(bbox.getTop()),renderGrid.XToCell(bbox.getRight()),renderGrid.YToCell(bbox.getBottom()));if(renderCells.equals(tempRect))return;const inst=this._inst; +if(renderCells===DEFAULT_RENDER_CELLS){renderGrid.Update(inst,null,tempRect);this._renderCells=C3.New(C3.Rect,tempRect)}else{renderGrid.Update(inst,renderCells,tempRect);renderCells.copy(tempRect)}layer.SetRenderListStale()}_RemoveFromRenderCells(){const renderCells=this._renderCells;if(renderCells===DEFAULT_RENDER_CELLS)return;this.GetLayer().GetRenderGrid().Update(this._inst,renderCells,null);this._renderCells=DEFAULT_RENDER_CELLS}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const inst= +this._inst;const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances.at(-1)===inst)return;layer._RemoveInstance(inst,false);layer._AddInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToBottom(){const inst=this._inst;const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances[0]===inst)return;layer._RemoveInstance(inst,false);layer._PrependInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToLayer(layerMove){const inst= +this._inst;const curLayer=this._layer;if(curLayer.GetLayout()!==layerMove.GetLayout())throw new Error("layer from different layout");if(layerMove===curLayer)return;curLayer._RemoveInstance(inst,true);this._SetLayer(layerMove);layerMove._AddInstance(inst,true);this._runtime.UpdateRender()}ZOrderMoveAdjacentToInstance(otherInst,isAfter){const inst=this._inst;let didChangeLayer=false;const curLayer=this._layer;if(otherInst.GetUID()===inst.GetUID())return;const otherWi=otherInst.GetWorldInfo();if(!otherWi)throw new Error("expected world instance"); +const otherLayer=otherWi.GetLayer();if(curLayer.GetIndex()!==otherLayer.GetIndex()){curLayer._RemoveInstance(inst,true);this._SetLayer(otherLayer);otherLayer._AddInstance(inst,true);didChangeLayer=true}const didChangeZOrder=otherLayer.MoveInstanceAdjacent(inst,otherInst,!!isAfter);if(didChangeLayer||didChangeZOrder)this._runtime.UpdateRender()}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(e){this._SetFlag(FLAG_HAS_ANY_ACTIVE_EFFECT,e)}HasAnyActiveEffect(){return(this._flags& +FLAG_HAS_ANY_ACTIVE_EFFECT)!==0}_SaveToJson(mode){const o={"x":this.GetX(),"y":this.GetY(),"w":this.GetWidth(),"h":this.GetHeight(),"l":this.GetLayer().GetSID(),"zi":this.GetZIndex()};if(this.GetZElevation()!==0)o["ze"]=this.GetZElevation();if(this.GetAngle()!==0)o["a"]=this._GetAngleNoReflect();if(!this.HasDefaultColor())o["c"]=this._color.toJSON();if(this.GetOriginX()!==.5)o["oX"]=this.GetOriginX();if(this.GetOriginY()!==.5)o["oY"]=this.GetOriginY();if(this.GetBlendMode()!==0)o["bm"]=this.GetBlendMode(); +if(!this.IsVisible())o["v"]=this.IsVisible();if(!this.IsCollisionEnabled())o["ce"]=this.IsCollisionEnabled();if(this.IsBboxChangeEventEnabled())o["be"]=this.IsBboxChangeEventEnabled();if(this._instanceEffectList)o["fx"]=this._instanceEffectList._SaveToJson();const isSolidFilterInclusive=(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;if(isSolidFilterInclusive)o["sfi"]=isSolidFilterInclusive;if(this._solidFilterTags)o["sft"]=[...this._solidFilterTags].join(" ");if(this._sceneGraphInfo&&mode!=="visual-state"){o["sgi"]= +this._sceneGraphInfo._SaveToJson(mode);if(sceneGraphExportDataMap.has(this)){o["sgcd"]=sceneGraphExportDataMap.get(this).childrenData;o["sgzid"]=sceneGraphExportDataMap.get(this).zIndexData}}if(this.HasMesh())o["mesh"]=this.GetSourceMesh().SaveToJson();return o}_SaveSceneGraphPropertiesToJson(){return{"x":this._x,"y":this._y,"z":this._zElevation,"w":this._w,"h":this._h,"a":this._a}}_LoadSceneGraphPropertiesFromJson(o){if(!o)return;this._x=o["x"];this._y=o["y"];this._zElevation=o["z"];this._w=o["w"]; +this._h=o["h"];this._a=o["a"];this._MarkSinCosAngleChanged();this.SetBboxChanged()}_SetupSceneGraphConnectionsOnChangeOfLayout(){this._ReleaseTmpSceneGraphInfo();this._ResetAllSceneGraphState();this._CreateSceneGraphInfo(null);if(this._sceneGraphInfo)this._sceneGraphInfo._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren,this._tmpSceneGraphChildrenIndexes)}_OnBeforeLoad(mode){if(mode!=="visual-state")this._ResetAllSceneGraphState()}_OnAfterLoad(o,mode="full",opts=null){if(o.hasOwnProperty("sgi")&& +mode!=="visual-state"){if((this._flags&FLAG_DESTROYED)!==0)return;this._sceneGraphInfo._OnAfterLoad(o["sgi"],opts)}}_OnAfterLoad2(o,mode="full",opts=null){if(o.hasOwnProperty("sgi")&&mode!=="visual-state"){if((this._flags&FLAG_DESTROYED)!==0)return;this._sceneGraphInfo._SetTmpSceneGraphChildren(null,null);this._ReleaseTmpSceneGraphInfo();this.SetBboxChanged()}}_LoadFromJson(o,mode){enableUpdateRendererStateGroup=false;this.SetX(o["x"]);this.SetY(o["y"]);this.SetWidth(o["w"]);this.SetHeight(o["h"]); +this._SetZIndex(o["zi"]);this.SetZElevation(o.hasOwnProperty("ze")?o["ze"]:0);this.SetAngle(o.hasOwnProperty("a")?o["a"]:0);if(o.hasOwnProperty("c"))tempColor.setFromJSON(o["c"]);else if(o.hasOwnProperty("o")){tempColor.copyRgb(this._color);tempColor.a=o["o"]}else tempColor.setRgba(1,1,1,1);this._SetColor(tempColor);this.SetOriginX(o.hasOwnProperty("oX")?o["oX"]:.5);this.SetOriginY(o.hasOwnProperty("oY")?o["oY"]:.5);this.SetBlendMode(o.hasOwnProperty("bm")?o["bm"]:0);this.SetVisible(o.hasOwnProperty("v")? +o["v"]:true);this.SetCollisionEnabled(o.hasOwnProperty("ce")?o["ce"]:true);this.SetBboxChangeEventEnabled(o.hasOwnProperty("be")?o["be"]:false);this.SetSolidCollisionFilter(o.hasOwnProperty("sfi")?o["sfi"]:false,o.hasOwnProperty("sft")?o["sft"]:"");if(this._instanceEffectList&&o.hasOwnProperty("fx"))this._instanceEffectList._LoadFromJson(o["fx"]);if(!o.hasOwnProperty("sgi")&&mode!=="visual-state")if(this._tmpSceneGraphChildren)for(const inst of this._tmpSceneGraphChildren){if(inst.IsDestroyed())continue; +this._runtime.DestroyInstance(inst)}if(o.hasOwnProperty("sgi")&&mode!=="visual-state"){this._CreateSceneGraphInfo(null);const sgi=this._sceneGraphInfo;const sgiData=o["sgi"];sgi._LoadFromJson(sgiData);sgi._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren,this._tmpSceneGraphChildrenIndexes);if(o["sgcd"]&&C3.IsFiniteNumber(o["sgzid"]))sceneGraphExportDataMap.set(this,{childrenData:o["sgcd"],zIndexData:o["sgzid"]})}if(o.hasOwnProperty("mesh")){const meshData=o["mesh"];this.CreateMesh(meshData["cols"], +meshData["rows"]);this.GetSourceMesh().LoadFromJson(meshData)}else this.ReleaseMesh();this.SetBboxChanged();enableUpdateRendererStateGroup=true;this._UpdateRendererStateGroup();if(mode!=="visual-state")this._runtime.AddInstanceNeedingAfterLoad(this.GetInstance(),o)}}; + +} + +// objects/behaviorType.js +{ +'use strict';const C3=self.C3; +C3.BehaviorType=class BehaviorType extends C3.DefendedBase{constructor(objectClass,data){super();const runtime=objectClass.GetRuntime();const pluginManager=runtime.GetPluginManager();const BehaviorCtor=runtime.GetObjectReference(data[1]);if(!pluginManager.HasBehaviorByConstructorFunction(BehaviorCtor))pluginManager.CreateBehavior(data);this._runtime=runtime;this._objectClass=objectClass;this._behavior=pluginManager.GetBehaviorByConstructorFunction(BehaviorCtor);this._sdkType=null;this._instSdkCtor= +BehaviorCtor.Instance;this._sid=data[2];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[3]);this._sdkType=C3.New(BehaviorCtor.Type,this);this.OnCreate()}static Create(objectClass,behaviorTypeData){return C3.New(C3.BehaviorType,objectClass,behaviorTypeData)}Release(){this._runtime=null;this._behavior=null;this._sdkType.Release();this._sdkType=null;this._instSdkCtor=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}; + +} + +// objects/behaviorInstance.js +{ +'use strict';const C3=self.C3;const IBehaviorInstance=self.IBehaviorInstance; +C3.BehaviorInstance=class BehaviorInstance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._behaviorType=opts.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=opts.instance;this._index=opts.index;this._sdkInst=null;this._iScriptInterface=null;this._behavior._AddInstance(this._inst)}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}this._behavior._RemoveInstance(this._inst);this._sdkInst.Release(); +this._sdkInst=null;this._runtime=null;this._behaviorType=null;this._behavior=null;this._inst=null}_CreateSdkInstance(properties){if(this._sdkInst)throw new Error("already got sdk instance");this._sdkInst=C3.New(this._behaviorType.GetInstanceSdkCtor(),this,properties)}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(prevFrame, +nextFrame){this._sdkInst.OnSpriteFrameChanged(prevFrame,nextFrame)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(o){return this._sdkInst.LoadFromJson(o)}static SortByTickSequence(a,b){const instA=a.GetObjectInstance();const instB=b.GetObjectInstance();const typeIndexA=instA.GetObjectClass().GetIndex();const typeIndexB=instB.GetObjectClass().GetIndex();if(typeIndexA!==typeIndexB)return typeIndexA-typeIndexB;const seqA= +instA.GetPUID();const seqB=instB.GetPUID();if(seqA!==seqB)return seqA-seqB;return a.GetBehaviorInstance()._GetIndex()-b.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const DefaultScriptClass=IBehaviorInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const ScriptInterfaceClass=SdkScriptClass||DefaultScriptClass;IBehaviorInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IBehaviorInstance._Init(null);if(SdkScriptClass&&!(this._iScriptInterface instanceof +DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`);return this._iScriptInterface}GetScriptInterface(){return this._iScriptInterface||this._InitScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}}; + +} + +// objects/effectList.js +{ +'use strict';const C3=self.C3; +C3.EffectList=class EffectList extends C3.DefendedBase{constructor(owner,data){super();this._owner=owner;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._effectParamBuffers=[];this._allInstanceEffectLists=new Set;this._preservesOpaqueness=true;for(const d of data){const et=C3.New(C3.EffectType,this,d,this._allEffectTypes.length);this._allEffectTypes.push(et);this._effectTypesByName.set(et.GetName().toLowerCase(),et);if(d.length>=3)this._effectParams.push(this._LoadSingleEffectParameters(et, +d[2]))}this.GetRuntime()._AddEffectList(this)}Release(){for(const cpb of this._effectParamBuffers)cpb.Release();C3.clearArray(this._effectParamBuffers);C3.clearArray(this._allEffectTypes);C3.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();C3.clearArray(this._effectParams);this._owner=null}_AddInstanceEffectList(iel){this._allInstanceEffectLists.add(iel)}_RemoveInstanceEffectList(iel){this._allInstanceEffectLists.delete(iel)}_InitRenderer(renderer){if(renderer.IsWebGPU()){this._effectParamBuffers= +this._allEffectTypes.map(et=>{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null});this._UpdateAllEffectParamBuffers()}for(const iel of this._allInstanceEffectLists)iel._InitRenderer(renderer)}PrependEffectTypes(arr){if(!arr.length)return;this._allEffectTypes=arr.concat(this._allEffectTypes);for(const et of arr)this._effectTypesByName.set(et.GetName().toLowerCase(),et);for(let i= +0,len=this._allEffectTypes.length;i0}GetEffectTypeByName(name){return this._effectTypesByName.get(name.toLowerCase())||null}GetEffectTypeByIndex(index){index=Math.floor(+index);if(index<0||index>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[index]}IsEffectIndexActive(index){return this.GetEffectTypeByIndex(index).IsActive()}SetEffectIndexActive(index, +a){this.GetEffectTypeByIndex(index).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return this._activeEffectTypes.length>0}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false;const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false; +oldValue.copyRgb(value)}else{if(oldValue===value)return false;effectParams[paramIndex]=value}if(effectIndex +({"name":et.GetName(),"active":et.IsActive(),"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}LoadFromJson(arr){for(const o of arr){const et=this.GetEffectTypeByName(o["name"]);if(!et)continue;et.SetActive(o["active"]);this._effectParams[et.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// objects/effectType.js +{ +'use strict';const C3=self.C3; +C3.EffectType=class EffectType extends C3.DefendedBase{constructor(effectList,data,index){super();this._effectList=effectList;this._id=data[0];this._name=data[1];this._index=index;this._shaderProgram=null;this._isActive=true}Release(){this._effectList=null;this._shaderProgram=null}Clone(effectListOwner){const ret=C3.New(C3.EffectType,effectListOwner,[this._id,this._name],-1);ret._shaderProgram=this._shaderProgram;ret._isActive=this._isActive;return ret}_InitRenderer(renderer){const shaderProgram=renderer.GetShaderProgramByName(this._id); +if(!shaderProgram)throw new Error("failed to find shader program '"+this._id+"'");this._shaderProgram=shaderProgram}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(i){this._index=i}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(a){this._isActive=!!a}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const ret=[];for(let i=0, +len=this._shaderProgram.GetParameterCount();i{const inst=effectChain.GetContentObject(); +const wi=inst.GetWorldInfo();renderer.SetColor(wi.GetPremultipliedColor());renderer.SetCurrentZ(wi.GetTotalZElevation());inst.Draw(renderer);renderer.SetCurrentZ(0)},getSourceTextureInfo:inst=>{const srcTexRect=inst.GetCurrentTexRect();const [srcWidth,srcHeight]=inst.GetCurrentSurfaceSize();return{srcTexRect,srcWidth,srcHeight}},getShaderParameters:index=>this._GetEffectChainShaderParametersForIndex(index)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=true;this._effectParams= +[];this._effectParamBuffers=[];this._InitRenderer(inst.GetRuntime().GetRenderer());for(let i=0,len=this._effectList.GetAllEffectTypes().length;i{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null})}_LoadEffectParameters(data){let index=0;for(const e of data){this._effectParams.push(this._LoadSingleEffectParameters(index, +e));++index}this._UpdateAllEffectParamBuffers();this.UpdateActiveEffects()}_LoadSingleEffectParameters(index,arr){this._activeEffectFlags[index]=arr[0];const ret=arr.slice(1);for(let i=0,len=ret.length;i0;const isRotatedOrNegativeSizeInstance=wi.GetAngle()!==0||wi.GetWidth()<0||wi.GetHeight()<0;const isTexRotated=inst.IsCurrentTexRotated();if(!this._needsRebuildSteps&&isDefaultColor===this._wasDefaultColor&&is3D===this._was3D&& +isRotatedOrNegativeSizeInstance===this._wasRotatedOrNegativeSize&&isTexRotated===this._wasTexRotated&&!this._effectChain.NeedsRebuild())return;this._effectChain.BuildSteps(this._activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor||inst.MustPreDraw(),is3D,isSourceTextureRotated:isTexRotated,isRotatedOrNegativeSizeInstance});this._needsRebuildSteps=false;this._wasDefaultColor=isDefaultColor;this._was3D=is3D;this._wasRotatedOrNegativeSize= +isRotatedOrNegativeSizeInstance;this._wasTexRotated=isTexRotated}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex]; +if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false;const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false;oldValue.copyRgb(value)}else{if(oldValue===value)return false; +effectParams[paramIndex]=value}if(effectIndex +et.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(i){return this._activeEffectFlags[i]}SetEffectIndexActive(i,e){this._activeEffectFlags[i]=!!e}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(et=>({"name":et.GetName(),"active":this._activeEffectFlags[et.GetIndex()],"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}_LoadFromJson(arr){for(const o of arr){const et=this._effectList.GetEffectTypeByName(o["name"]); +if(!et)continue;this._activeEffectFlags[et.GetIndex()]=o["active"];this._effectParams[et.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// collisions/collisionEngine.js +{ +'use strict';const C3=self.C3;const tempCandidates=[];const tileCollRectCandidates=[];const tempJumpthruRet=[];const tempPolyA=C3.New(C3.CollisionPoly);const tempPolyB=C3.New(C3.CollisionPoly);const tempQuad=C3.New(C3.Quad);const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);let tempPolyC=null;let tempRect3=null;let tempQuadB=null; +C3.CollisionEngine=class CollisionEngine extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._registeredCollisions=[];this._collisionCheckCount=0;this._collisionCheckSec=0;this._polyCheckCount=0;this._polyCheckSec=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=this._polyCheckCount;this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(a, +b){const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw||!bw)return;if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return;this._registeredCollisions.push([a,b])}AddRegisteredCollisionCandidates(inst,otherType,arr){for(const [a,b]of this._registeredCollisions){let otherInst=null;if(inst===a)otherInst=b;else if(inst===b)otherInst=a;else continue;if(!otherInst.BelongsToObjectClass(otherType))continue;if(!arr.includes(otherInst))arr.push(otherInst)}}CheckRegisteredCollision(a,b){if(!this._registeredCollisions.length)return false; +for(const [c,d]of this._registeredCollisions)if(a===c&&b===d||a===d&&b===c)return true;return false}ClearRegisteredCollisions(){C3.clearArray(this._registeredCollisions)}TestOverlap(a,b){if(!a||!b||a===b)return false;const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return false;this._collisionCheckCount++;const layerA=aw.GetLayer();const layerB=bw.GetLayer();const areLayerTransformsCompatible=layerA.IsTransformCompatibleWith(layerB);if(areLayerTransformsCompatible)return this._TestOverlap_SameLayers(aw, +bw);else return this._TestOverlap_DifferentLayers(aw,bw)}_TestOverlap_SameLayers(aw,bw){if(!aw.GetBoundingBox().intersectsRect(bw.GetBoundingBox()))return false;this._polyCheckCount++;if(!aw.GetBoundingQuad().intersectsQuad(bw.GetBoundingQuad()))return false;if(aw.HasTilemap()&&bw.HasTilemap())return false;if(aw.HasTilemap())return this.TestTilemapOverlap(aw,bw);else if(bw.HasTilemap())return this.TestTilemapOverlap(bw,aw);if(!aw.HasOwnCollisionPoly()&&!bw.HasOwnCollisionPoly())return true;const polyA= +aw.GetTransformedCollisionPoly();const polyB=bw.GetTransformedCollisionPoly();return polyA.intersectsPoly(polyB,bw.GetX()-aw.GetX(),bw.GetY()-aw.GetY())}_TestOverlap_DifferentLayers(aw,bw){const aIsTileMap=aw.HasTilemap();const bIsTileMap=bw.HasTilemap();if(aIsTileMap&&!bIsTileMap)return this.TestTilemapOverlapDifferentLayers(aw,bw);else if(bIsTileMap&&!aIsTileMap)return this.TestTilemapOverlapDifferentLayers(bw,aw);else if(!bIsTileMap&&!aIsTileMap){const layerA=aw.GetLayer();const layerB=bw.GetLayer(); +tempPolyA.copy(aw.GetTransformedCollisionPoly());tempPolyB.copy(bw.GetTransformedCollisionPoly());const ptsArrA=tempPolyA.pointsArr();for(let i=0,len=ptsArrA.length;i{let ret=interactiveLayersCache.get(layer); +if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};if(sol.IsSelectAll()){if(!isInverted){sol._SetSelectAll(false);C3.clearArray(sol._GetOwnInstances())}if(isOrBlock)C3.clearArray(sol._GetOwnElseInstances());for(const inst of objectClass.GetInstances()){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();let containsPoint=false;if(isLayerInteractive(layer)&&wi.IsInViewport2()){const [lx,ly]=layer.CanvasCssToLayer(ptx,pty,wi.GetTotalZElevation()); +containsPoint=wi.ContainsPoint(lx,ly)}if(containsPoint)if(isInverted)return false;else sol._PushInstance(inst);else if(isOrBlock)sol._PushElseInstance(inst)}}else{let arr;let isPickingElseInstances=false;if(isOrBlock)if(this._runtime.IsCurrentConditionFirst()&&!sol._GetOwnElseInstances().length&&sol._GetOwnInstances().length)arr=sol._GetOwnInstances();else{arr=sol._GetOwnElseInstances();isPickingElseInstances=true}else arr=sol._GetOwnInstances();let j=0;for(let i=0,len=arr.length;i0){const PI=Math.PI;this.hitNormal=C3.clampAngle(this.hitNormal+PI);this.normalX=-this.normalX;this.normalY=-this.normalY}}TestInstanceSegment(inst,sx1,sy1,sx2,sy2){const t=C3.rayIntersect(this.x1, +this.y1,this.x2,this.y2,sx1,sy1,sx2,sy2);if(t>=0&&t[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:rt=>this.ReleaseEffectCompositorRenderTarget(rt),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeStartFrame=0;this._gpuTimeEndFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer= +null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=C3.New(C3.Rect);this._snapshotUrl="";this._snapshotPromise=null;this._snapshotResolve=null;this._isPastingToDrawingCanvas=0;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=e=>this._loadingProgress=e.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFrameNumber= +0;this._splashFadeInFinishTime=0;this._splashFadeOutStartTime=0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(resolve=>this._splashDoneResolve=resolve)}_SetGPUPowerPreference(pref){this._gpuPreference=pref}_SetWebGPUEnabled(e){this._isWebGPUEnabled=!!e}_SetZAxisScale(s){this._zAxisScale=s}_SetFieldOfView(f){this._fieldOfView=f}_SetZDistances(zNear,zFar){this._zNear=zNear;this._zFar=zFar}_SetLimitedToWebGL1(l){this._isLimitedToWebGL1=!!l}async CreateCanvas(opts){this._canvas= +opts["canvas"];this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",e=>this._OnWindowResize(e));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",e=>this._OnFullscreenChange(e));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",e=>this._OnFullscreenError(e));this._canvas.addEventListener("webglcontextlost",e=>this._OnWebGLContextLost(e));this._canvas.addEventListener("webglcontextrestored",e=>this._OnWebGLContextRestored(e));this._isDocumentFullscreen= +!!opts["isFullscreen"];const useWebGPU=navigator["gpu"]&&this._isWebGPUEnabled;let hasMajorPerformanceCaveat=false;if(useWebGPU)try{await this._InitWebGPUContext(true)}catch(err){this._MaybeLogRendererError("WebGPU",err);this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(true)}catch(err){this._MaybeLogRendererError("WebGL",err);this._webglRenderer=null}if(!this.GetRenderer())hasMajorPerformanceCaveat=true;if(!this.GetRenderer()&&useWebGPU)try{await this._InitWebGPUContext(false)}catch(err){this._MaybeLogRendererError("WebGPU", +err);this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(false)}catch(err){this._MaybeLogRendererError("WebGL",err);this._webglRenderer=null}const renderer=this.GetRenderer();if(!renderer)throw new Error("failed to acquire a renderer - check WebGL or WebGPU is supported");renderer.SetHasMajorPerformanceCaveat(hasMajorPerformanceCaveat);if(this._webgpuRenderer){this._webgpuRenderer.ondevicelost=()=>this._OnWebGPUDeviceLost();this._webgpuRenderer.ondevicerestored=()=>this._OnWebGPUDeviceRestored()}if(this._zAxisScale=== +"normalized")renderer.SetZAxisScaleNormalized();else{renderer.SetZAxisScaleRegular();renderer.SetFovY(this._fieldOfView)}this.SetSize(opts["windowInnerWidth"],opts["windowInnerHeight"],true);await this._InitRenderer()}_MaybeLogRendererError(rendererType,err){if(err&&typeof err.message==="string"&&err.message.startsWith("renderer-unavailable"))return;console.error(`Error creating ${rendererType} renderer: `,err)}async _InitWebGPUContext(failIfMajorPerformanceCaveat){const ctorOpts={nearZ:this._zNear, +farZ:this._zFar};const rendererOpts={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat,usesBackgroundBlending:this._runtime.UsesAnyBackgroundBlending(),canSampleBackbuffer:this._runtime.UsesAnyCrossSampling(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=C3.New(C3.Gfx.WebGPURenderer,ctorOpts);await this._webgpuRenderer.Create(this._canvas,rendererOpts)}async _InitWebGLContext(failIfMajorPerformanceCaveat){const rendererOpts= +{powerPreference:this._gpuPreference,enableGpuProfiling:true,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat,nearZ:this._zNear,farZ:this._zFar};if(this._isLimitedToWebGL1)rendererOpts.maxWebGLVersion=1;if(C3.Platform.OS==="Android"&&C3.Platform.BrowserEngine==="Chromium"&&C3.Platform.BrowserVersionNumber<75){console.warn("[Construct] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."); +rendererOpts.maxWebGLVersion=1}if(this._runtime.GetCompositingMode()==="standard")rendererOpts.alpha=true;else{rendererOpts.alpha=false;rendererOpts.lowLatency=true}this._webglRenderer=C3.New(C3.Gfx.WebGLRenderer,this._canvas,rendererOpts);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){data.src=data.wgsl;const vertexSrc=C3.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();promises.push(this._webgpuRenderer.CreateShaderProgram(Object.assign({vertexSrc, +name:id},data)))}await Promise.all(promises)}}async _InitWebGL(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){let vertexSrc;if(data.glslWebGL2&&this._webglRenderer.GetWebGLVersionNumber()>=2){data.src=data.glslWebGL2;vertexSrc=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2()}else{if(!data.glsl)throw new Error(`shader '${id}' does not support WebGL 1`);data.src=data.glsl;vertexSrc=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource()}promises.push(this._webglRenderer.CreateShaderProgram(Object.assign({vertexSrc, +name:id},data)))}await Promise.all(promises);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}if(this._webglRenderer.SupportsGPUProfiling())this._gpuFrameTimingsBuffer=C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer)}async _InitRenderer(){if(this._webgpuRenderer)await this._InitWebGPU();else if(this._webglRenderer)await this._InitWebGL();const renderer=this.GetRenderer();renderer.SetMipmapsEnabled(this._enableMipmaps);if(renderer.SupportsGPUProfiling())this._gpuLastUtilisation= +0;for(const effectList of this._runtime._GetAllEffectLists()){for(const effectType of effectList.GetAllEffectTypes())effectType._InitRenderer(renderer);effectList._InitRenderer(renderer);effectList.UpdateActiveEffects()}}Release(){this._runtime=null;this._webglRenderer=null;this._canvas=null}_OnWindowResize(e){const runtime=this._runtime;if(runtime.IsExportToVideo())return;const dpr=e["devicePixelRatio"];if(runtime.IsInWorker())self.devicePixelRatio=dpr;runtime._SetDevicePixelRatio(dpr);this._isDocumentFullscreen= +!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"]);runtime.UpdateRender();const ev=new C3.Event("window-resize");ev.data=e;runtime.Dispatcher().dispatchEventAndWaitAsyncSequential(ev);const ev2=new C3.Event("resize");ev2.cssWidth=this.GetCssWidth();ev2.cssHeight=this.GetCssHeight();ev2.deviceWidth=this.GetDeviceWidth();ev2.deviceHeight=this.GetDeviceHeight();runtime.DispatchUserScriptEvent(ev2);if(runtime.IsDebug()&&(runtime.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused()))runtime.Render()}_OnFullscreenChange(e){this._isDocumentFullscreen= +!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}_OnFullscreenError(e){this._isDocumentFullscreen=!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}SetSize(availableWidth,availableHeight,force=false){availableWidth=Math.floor(availableWidth);availableHeight=Math.floor(availableHeight);if(availableWidth<=0||availableHeight<=0)throw new Error("invalid size");if(this._windowInnerWidth===availableWidth&& +this._windowInnerHeight===availableHeight&&!force)return;this._windowInnerWidth=availableWidth;this._windowInnerHeight=availableHeight;const fullscreenMode=this.GetCurrentFullscreenMode();if(fullscreenMode==="letterbox-scale")this._CalculateLetterboxScale(availableWidth,availableHeight);else if(fullscreenMode==="letterbox-integer-scale")this._CalculateLetterboxIntegerScale(availableWidth,availableHeight);else if(fullscreenMode==="off")this._CalculateFixedSizeCanvas(availableWidth,availableHeight); +else this._CalculateFullsizeCanvas(availableWidth,availableHeight);this._UpdateFullscreenScalingQuality(fullscreenMode);this._canvas.width=this._canvasDeviceWidth;this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{"marginLeft":this._canvasCssOffsetX,"marginTop":this._canvasCssOffsetY,"styleWidth":this._canvasCssWidth,"styleHeight":this._canvasCssHeight,"displayScale":this.GetDisplayScale()});const renderer=this.GetRenderer();renderer.SetSize(this._canvasDeviceWidth, +this._canvasDeviceHeight,true);for(const rt of this._availableAdditionalRenderTargets)renderer.DeleteRenderTarget(rt);C3.clearArray(this._availableAdditionalRenderTargets);renderer.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,this.GetDrawWidth()/this.GetDrawHeight());const layoutManager=this._runtime.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(availableWidth, +availableHeight){const dpr=this._runtime.GetDevicePixelRatio();const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight=this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth=availableHeight*originalAspectRatio;this._canvasCssWidth=Math.round(letterboxedWidth);this._canvasCssHeight= +availableHeight;this._canvasCssOffsetX=Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=0}else{const letterboxedHeight=availableWidth/originalAspectRatio;this._canvasCssWidth=availableWidth;this._canvasCssHeight=Math.round(letterboxedHeight);this._canvasCssOffsetX=0;this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}this._canvasDeviceWidth=Math.round(this._canvasCssWidth*dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._runtime.SetViewportSize(originalViewportWidth, +originalViewportHeight)}_CalculateLetterboxIntegerScale(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();if(dpr!==1){availableWidth+=1;availableHeight+=1}const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight=this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;let intScale;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth= +availableHeight*originalAspectRatio;intScale=letterboxedWidth*dpr/originalViewportWidth}else{const letterboxedHeight=availableWidth/originalAspectRatio;intScale=letterboxedHeight*dpr/originalViewportHeight}if(intScale>1)intScale=Math.floor(intScale);else if(intScale<1)intScale=1/Math.ceil(1/intScale);this._canvasDeviceWidth=Math.round(originalViewportWidth*intScale);this._canvasDeviceHeight=Math.round(originalViewportHeight*intScale);this._canvasCssWidth=this._canvasDeviceWidth/dpr;this._canvasCssHeight= +this._canvasDeviceHeight/dpr;this._canvasCssOffsetX=Math.max(Math.floor((availableWidth-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((availableHeight-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(originalViewportWidth,originalViewportHeight)}_CalculateFullsizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=availableWidth;this._canvasCssHeight=availableHeight;this._canvasDeviceWidth=Math.round(this._canvasCssWidth* +dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._canvasCssOffsetX=0;this._canvasCssOffsetY=0;const displayScale=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/displayScale,this._canvasCssHeight/displayScale)}_CalculateFixedSizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth* +dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);if(this.IsDocumentFullscreen()){this._canvasCssOffsetX=Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}else{this._canvasCssOffsetX=0;this._canvasCssOffsetY=0}this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(fullscreenMode){if(this._wantFullscreenScalingQuality==="high"){this._drawWidth= +this._canvasDeviceWidth;this._drawHeight=this._canvasDeviceHeight;this._fullscreenScalingQuality="high"}else{let viewportWidth,viewportHeight;if(this.GetCurrentFullscreenMode()==="off"){viewportWidth=this._runtime.GetViewportWidth();viewportHeight=this._runtime.GetViewportHeight()}else{viewportWidth=this._runtime.GetOriginalViewportWidth();viewportHeight=this._runtime.GetOriginalViewportHeight()}if(this._canvasDeviceWidthoriginalAspectRatio)this._drawHeight= +this._drawWidth/currentAspectRatio}else if(fullscreenMode==="scale-outer"){const originalAspectRatio=viewportWidth/viewportHeight;const currentAspectRatio=this._windowInnerWidth/this._windowInnerHeight;if(currentAspectRatio>originalAspectRatio)this._drawWidth=this._drawHeight*currentAspectRatio;else if(currentAspectRatiooriginalAspectRatio||fullscreenMode==="scale-inner"&¤tAspectRatiort.IsCompatibleWithOptions(opts)); +let ret;if(useIndex!==-1){ret=arr[useIndex];arr.splice(useIndex,1)}else ret=this.GetRenderer().CreateRenderTarget(opts);this._usedAdditionalRenderTargets.add(ret);return ret}ReleaseAdditionalRenderTarget(renderTarget){if(!this._usedAdditionalRenderTargets.has(renderTarget))throw new Error("render target not in use");this._usedAdditionalRenderTargets.delete(renderTarget);this._availableAdditionalRenderTargets.push(renderTarget)}GetEffectCompositorRenderTarget(){const opts={sampling:this._runtime.GetSampling()}; +if(this.GetCurrentFullscreenScalingQuality()==="low"){opts.width=this.GetDrawWidth();opts.height=this.GetDrawHeight()}return this.GetAdditionalRenderTarget(opts)}ReleaseEffectCompositorRenderTarget(renderTarget){this.ReleaseAdditionalRenderTarget(renderTarget)}*activeLayersGpuProfiles(){for(const layout of this._runtime.GetLayoutManager().runningLayouts())for(const layer of layout.GetLayers()){const p=this._layersGpuProfile.get(layer);if(p)yield p}}GetLayerTimingsBuffer(layer){if(!this.GetRenderer().SupportsGPUProfiling())return null; +let p=this._layersGpuProfile.get(layer);if(!p){p={name:layer.GetName(),timingsBuffer:C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0};this._layersGpuProfile.set(layer,p)}return p.timingsBuffer}_Update1sFrameRange(){const renderer=this.GetRenderer();if(!renderer.SupportsGPUProfiling())return;if(this._gpuTimeEndFrame===0){this._gpuTimeEndFrame=renderer.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const p of this.activeLayersGpuProfiles())p.curUtilisation= +NaN}}_UpdateTick(){if(this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling())this._UpdateTick_WebGL();if(this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling())this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(!isNaN(this._gpuCurUtilisation))return;this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame);if(isNaN(this._gpuCurUtilisation))return;if(this._runtime.IsDebug())for(const p of this.activeLayersGpuProfiles()){p.curUtilisation= +p.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame);if(isNaN(p.curUtilisation))return}this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const p of this.activeLayersGpuProfiles()){p.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);p.lastUtilisation=Math.min(p.curUtilisation,1)}self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation, +[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(this._gpuTimeEndFrame===0)return;for(let frameNumber=this._gpuTimeStartFrame;frameNumber{this._snapshotResolve= +resolve});return this._snapshotPromise}_MaybeTakeSnapshot(){if(!this._snapshotFormat)return;let canvas=this._canvas;const snapArea=this._snapshotArea;const x=C3.clamp(Math.floor(snapArea.getLeft()),0,canvas.width);const y=C3.clamp(Math.floor(snapArea.getTop()),0,canvas.height);let w=snapArea.width();if(w===0)w=canvas.width-x;else w=C3.clamp(Math.floor(w),0,canvas.width-x);let h=snapArea.height();if(h===0)h=canvas.height-y;else h=C3.clamp(Math.floor(h),0,canvas.height-y);if((x!==0||y!==0||w!==canvas.width|| +h!==canvas.height)&&(w>0&&h>0)){canvas=C3.CreateCanvas(w,h);const ctx=canvas.getContext("2d");ctx.drawImage(this._canvas,x,y,w,h,0,0,w,h)}C3.CanvasToBlob(canvas,this._snapshotFormat,this._snapshotQuality).then(blob=>{if(this._snapshotUrl)URL.revokeObjectURL(this._snapshotUrl);this._snapshotUrl=URL.createObjectURL(blob);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=1}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(p){if(p)this._isPastingToDrawingCanvas++; +else this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return this._isPastingToDrawingCanvas>0}InitLoadingScreen(loaderStyle){const renderer=this.GetRenderer();if(loaderStyle===2){this._percentText=C3.New(C3.Gfx.RendererText,this.GetRenderer());this._percentText.SetFontName("Arial");this._percentText.SetFontSize(16);this._percentText.SetHorizontalAlignment("center");this._percentText.SetVerticalAlignment("center");this._percentText.SetSize(PERCENTTEXT_WIDTH,PERCENTTEXT_HEIGHT)}else if(loaderStyle=== +0){const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(loadingLogoAsset)loadingLogoAsset.LoadStaticTexture(renderer).catch(err=>console.warn(`[C3 runtime] Failed to create texture for loading logo: `,err))}else if(loaderStyle===4){this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(tex=>{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.logo=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(tex=> +{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.powered=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(tex=>{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.website=tex}).catch(err=>console.warn("Failed to load splash image: ",err))}}async _LoadSvgSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString();const blob= +await C3.FetchBlob(url);const drawable=await this._runtime.RasterSvgImage(blob,2048,2048);return await this.GetRenderer().CreateStaticTextureAsync(drawable,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString();const blob=await C3.FetchBlob(url);return await this.GetRenderer().CreateStaticTextureAsync(blob,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime= +Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3)this.HideCordovaSplashScreen()}async EndLoadingScreen(){const renderer=this.GetRenderer();this._loadingProgress=1;const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle===4)await this._splashDonePromise;this._splashDoneResolve=null;this._splashDonePromise= +null;if(this._rafId!==-1){cancelAnimationFrame(this._rafId);this._rafId=-1}this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;if(this._percentText){this._percentText.Release();this._percentText=null}this._runtime.ReleaseLoadingLogoAsset();renderer.Start();if(this._splashTextures.logo){renderer.DeleteTexture(this._splashTextures.logo);this._splashTextures.logo=null}if(this._splashTextures.powered){renderer.DeleteTexture(this._splashTextures.powered); +this._splashTextures.powered=null}if(this._splashTextures.website){renderer.DeleteTexture(this._splashTextures.website);this._splashTextures.website=null}renderer.ClearRgba(0,0,0,0);renderer.Finish();this._splashState="done";this._gpuTimeStartFrame=renderer.GetFrameNumber();if(loaderStyle===3)this.HideCordovaSplashScreen()}_DrawLoadingScreen(){if(this._rafId===-1)return;const renderer=this.GetRenderer();renderer.Start();this._rafId=-1;const hasHadError=this._runtime.GetAssetManager().HasHadErrorLoading(); +const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3){this.SetCssTransform(renderer);renderer.ClearRgba(0,0,0,0);renderer.ResetColor();renderer.SetTextureFillMode();renderer.SetTexture(null)}if(loaderStyle===0)this._DrawProgressBarAndLogoLoadingScreen(hasHadError);else if(loaderStyle===1)this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);else if(loaderStyle===2)this._DrawPercentTextLoadingScreen(hasHadError);else if(loaderStyle===3)C3.noop();else if(loaderStyle===4)this._DrawSplashLoadingScreen(hasHadError); +else throw new Error("invalid loader style");renderer.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}_DrawPercentTextLoadingScreen(hasHadError){if(hasHadError)this._percentText.SetColorRgb(1,0,0);else this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(this._loadingProgress*100)+"%");const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=PERCENTTEXT_WIDTH/2;const hh=PERCENTTEXT_HEIGHT/2;tempQuad.setRect(midX-hw,midY-hh,midX+ +hw,midY+hh);const renderer=this.GetRenderer();renderer.SetTexture(this._percentText.GetTexture());renderer.Quad3(tempQuad,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(hasHadError,width,yOff){const renderer=this.GetRenderer();const height=PROGRESSBAR_HEIGHT;renderer.SetColorFillMode();if(hasHadError)renderer.SetColorRgba(1,0,0,1);else renderer.SetColorRgba(.118,.565,1,1);const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=width/2;const hh=height/2;tempRect.setWH(midX- +hw,midY-hh+yOff,Math.floor(width*this._loadingProgress),height);renderer.Rect(tempRect);tempRect.setWH(midX-hw,midY-hh+yOff,width,height);tempRect.offset(-.5,-.5);tempRect.inflate(.5,.5);renderer.SetColorRgba(0,0,0,1);renderer.LineRect2(tempRect);tempRect.inflate(1,1);renderer.SetColorRgba(1,1,1,1);renderer.LineRect2(tempRect)}_DrawProgressBarAndLogoLoadingScreen(hasHadError){const renderer=this.GetRenderer();const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(!loadingLogoAsset){this._DrawProgressBarLoadingScreen(hasHadError, +PROGRESSBAR_WIDTH,0);return}const logoTexture=loadingLogoAsset.GetTexture();if(!logoTexture){this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);return}const logoW=logoTexture.GetWidth();const logoH=logoTexture.GetHeight();const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=logoW/2;const hh=logoH/2;tempQuad.setRect(midX-hw,midY-hh,midX+hw,midY+hh);renderer.SetTexture(logoTexture);renderer.Quad(tempQuad);this._DrawProgressBarLoadingScreen(hasHadError,logoW, +hh+16)}_DrawSplashLoadingScreen(hasHadError){const renderer=this.GetRenderer();const logoTex=this._splashTextures.logo;const poweredTex=this._splashTextures.powered;const websiteTex=this._splashTextures.website;const nowTime=Date.now();if(this._splashFrameNumber===0)this._loaderStartTime=nowTime;const allowQuickSplash=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova();const splashAfterFadeOutWait=allowQuickSplash?0:SPLASH_AFTER_FADEOUT_WAIT_TIME;const splashMinDisplayTime= +allowQuickSplash?0:SPLASH_MIN_DISPLAY_TIME;let a=1;if(this._splashState==="fade-in")a=Math.min((nowTime-this._loaderStartTime)/SPLASH_FADE_DURATION,1);else if(this._splashState==="fade-out")a=Math.max(1-(nowTime-this._splashFadeOutStartTime)/SPLASH_FADE_DURATION,0);renderer.SetColorFillMode();renderer.SetColorRgba(.231*a,.251*a,.271*a,a);tempRect.set(0,0,this._canvasCssWidth,this._canvasCssHeight);renderer.Rect(tempRect);const w=Math.ceil(this._canvasCssWidth);const h=Math.ceil(this._canvasCssHeight); +let drawW,drawH;if(this._canvasCssHeight>256){renderer.SetColorRgba(.302*a,.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a);else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress;tempRect.setWH(w*.5-drawW/2,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(poweredTex){drawW=C3.clamp(h*.22,105,w*.6)* +1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.2-drawH/2,drawW,drawH);renderer.SetTexture(poweredTex);renderer.Rect(tempRect)}if(logoTex){drawW=Math.min(h*.395,w*.95);drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.485-drawH/2,drawW,drawH);renderer.SetTexture(logoTex);renderer.Rect(tempRect)}if(websiteTex){drawW=C3.clamp(h*.22,105,w*.6)*1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.868-drawH/2,drawW,drawH);renderer.SetTexture(websiteTex);renderer.Rect(tempRect)}}else{renderer.SetColorRgba(.302*a, +.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a);else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress;tempRect.setWH(w*.5-drawW/2,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(logoTex){drawW=h*.55;drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.45-drawH/2,drawW,drawH);renderer.SetTexture(logoTex); +renderer.Rect(tempRect)}}this._splashFrameNumber++;if(this._splashState==="fade-in"&&nowTime-this._loaderStartTime>=SPLASH_FADE_DURATION&&this._splashFrameNumber>=2){this._splashState="wait";this._splashFadeInFinishTime=nowTime}if(this._splashState==="wait"&&nowTime-this._splashFadeInFinishTime>=splashMinDisplayTime&&this._loadingProgress>=1){this._splashState="fade-out";this._splashFadeOutStartTime=nowTime}if(this._splashState==="fade-out"&&nowTime-this._splashFadeOutStartTime>=SPLASH_FADE_DURATION+ +splashAfterFadeOutWait||allowQuickSplash&&this._loadingProgress>=1&&nowTime-this._loaderStartTime<500)this._splashDoneResolve()}}; + +} + +// runtime.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const DEFAULT_RUNTIME_OPTS={"messagePort":null,"runtimeBaseUrl":"","headless":false,"hasDom":true,"isInWorker":false,"useAudio":true,"projectData":"","exportType":""};let ife=true; +C3.Runtime=class C3Runtime extends C3.DefendedBase{constructor(opts){opts=Object.assign({},DEFAULT_RUNTIME_OPTS,opts);super();this._messagePort=opts["messagePort"];this._runtimeBaseUrl=opts["runtimeBaseUrl"];this._previewUrl=opts["previewUrl"];this._isHeadless=!!opts["headless"];this._hasDom=!!opts["hasDom"];this._isInWorker=!!opts["isInWorker"];ife=opts["ife"];this._useAudio=!!opts["useAudio"];this._exportType=opts["exportType"];this._isiOSCordova=!!opts["isiOSCordova"];this._isiOSWebView=!!opts["isiOSWebView"]; +this._isWebView2Wrapper=!!opts["isWebView2Wrapper"];this._isFBInstantAvailable=!!opts["isFBInstantAvailable"];this._opusWasmScriptUrl=opts["opusWasmScriptUrl"];this._opusWasmBinaryUrl=opts["opusWasmBinaryUrl"];this._isDebug=!!(this._exportType==="preview"&&opts["isDebug"]);this._breakpointsEnabled=this._isDebug;this._isDebugging=this._isDebug;this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=false;this._projectName="";this._projectVersion= +"";this._projectUniqueId="";this._appId="";this._originalViewportWidth=0;this._originalViewportHeight=0;this._devicePixelRatio=self.devicePixelRatio;this._parallaxXorigin=0;this._parallaxYorigin=0;this._viewportWidth=0;this._viewportHeight=0;this._loaderStyle=0;this._usesLoaderLayout=false;this._isLoading=true;this._usesAnyBackgroundBlending=false;this._usesAnyCrossSampling=false;this._usesAnyDepthSampling=false;this._loadingLogoAsset=null;this._assetManager=C3.New(C3.AssetManager,this,opts);this._layoutManager= +C3.New(C3.LayoutManager,this);this._eventSheetManager=C3.New(C3.EventSheetManager,this);this._pluginManager=C3.New(C3.PluginManager,this,opts["wrapperComponentIds"]);this._collisionEngine=C3.New(C3.CollisionEngine,this);this._timelineManager=C3.New(C3.TimelineManager,this);this._transitionManager=C3.New(C3.TransitionManager,this);this._templateManager=C3.New(C3.TemplateManager,this);this._textIconManager=C3.New(C3.TextIconManager,{getIconSetMeta:iconSource=>this._GetTextIconSetMeta(iconSource),getIconSetContent:iconSource=> +this._GetTextIconSetContent(iconSource)});this._iconChangeHandlers=new Map;this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._hasPendingInstances=false;this._isFlushingPendingInstances=false;this._objectCount=0;this._nextUid=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick= +new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=false;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=false;this._needRender=true;this._pauseOnBlur=false;this._isPausedOnBlur=false;this._exportToVideo=null;this._tickCallbacks={normal:timestamp=>{this._rafId=-1;this._ruafId=-1;this.Tick(timestamp)},tickOnly:timestamp=> +{this._ruafId=-1;this.Tick(timestamp,false,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._rafId=-1;this._ruafId=-1;this._tickCount=0;this._tickCountNoSave=0;this._hasStarted=false;this._isInTick=false;this._hasStartedTicking=false;this._isLayoutFirstTick=true;this._suspendCount=0;this._scheduleTriggersThrottle=new C3.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._startTime=0;this._lastTickTime=0;this._dtRaw=0;this._dt1=0;this._dt=0;this._timeScale=1;this._minimumFramerate= +30;this._gameTime=C3.New(C3.KahanSum);this._gameTimeRaw=C3.New(C3.KahanSum);this._wallTime=C3.New(C3.KahanSum);this._instanceTimes=new Map;this._fpsFrameCount=-1;this._fpsLastTime=0;this._fps=0;this._mainThreadTimeCounter=0;this._mainThreadTime=0;this._isLoadingState=false;this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._projectStorage=null;this._savegamesStorage=null;this._dispatcher=C3.New(C3.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises= +new Map;this._nextDomResponseId=0;this._didRequestDeviceOrientationEvent=false;this._didRequestDeviceMotionEvent=false;this._isReadyToHandleEvents=false;this._waitingToHandleEvents=[];this._eventObjects={"pretick":C3.New(C3.Event,"pretick",false),"tick":C3.New(C3.Event,"tick",false),"tick2":C3.New(C3.Event,"tick2",false),"instancedestroy":C3.New(C3.Event,"instancedestroy",false),"beforelayoutchange":C3.New(C3.Event,"beforelayoutchange",false),"layoutchange":C3.New(C3.Event,"layoutchange",false)}; +this._eventObjects["instancedestroy"].instance=null;this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._jobScheduler=C3.New(C3.JobSchedulerRuntime,this,opts["jobScheduler"]);if(opts["canvas"])this._canvasManager= +C3.New(C3.CanvasManager,this);this._messagePort.onmessage=e=>this["_OnMessageFromDOM"](e.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",e=>this._OnVisibilityChange(e));this.AddDOMComponentMessageHandler("runtime","wrapper-extension-message",e=>this._OnWrapperExtensionMessage(e));this.AddDOMComponentMessageHandler("runtime","opus-decode",e=>this._WasmDecodeWebMOpus(e["arrayBuffer"]));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo()); +this.AddDOMComponentMessageHandler("runtime","js-invoke-function",e=>this._InvokeFunctionFromJS(e));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self["goToLastErrorScript"]);this.AddDOMComponentMessageHandler("runtime","offline-audio-render-completed",e=>this._OnOfflineAudioRenderCompleted(e));this._dispatcher.addEventListener("window-blur",e=>this._OnWindowBlur(e));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners(); +this._templateManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null};this._instancesNeedingAfterLoadMap=new WeakMap;this._instancesNeedingAfterLoadArray=[]}static Create(opts){return C3.New(C3.Runtime,opts)}Release(){C3.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release(); +this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._templateManager.Release();this._templateManager=null;this._textIconManager.Release();this._textIconManager=null;if(this._canvasManager){this._canvasManager.Release();this._canvasManager= +null}this._dispatcher.Release();this._dispatcher=null;this._tickEvent=null}["_OnMessageFromDOM"](data){const type=data["type"];if(type==="event")this._OnEventFromDOM(data);else if(type==="result")this._OnResultFromDOM(data);else throw new Error(`unknown message '${type}'`);}_OnEventFromDOM(e){if(!this._isReadyToHandleEvents){this._waitingToHandleEvents.push(e);return}const component=e["component"];const handler=e["handler"];const data=e["data"];const dispatchOpts=e["dispatchOpts"];const dispatchRuntimeEvent= +!!(dispatchOpts&&dispatchOpts["dispatchRuntimeEvent"]);const dispatchUserScriptEvent=!!(dispatchOpts&&dispatchOpts["dispatchUserScriptEvent"]);const responseId=e["responseId"];if(component==="runtime"){if(dispatchRuntimeEvent){const event=new C3.Event(handler);event.data=data;this._dispatcher.dispatchEventAndWaitAsyncSequential(event)}if(dispatchUserScriptEvent){const event=new C3.Event(handler,true);for(const [key,value]of Object.entries(data))event[key]=value;this.DispatchUserScriptEvent(event)}}const handlerMap= +this._domEventHandlers.get(component);if(!handlerMap){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM event handlers for component '${component}'`);return}const func=handlerMap.get(handler);if(!func){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM handler '${handler}' for component '${component}'`);return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!== +null)this._PostResultToDOM(responseId,false,""+err);return}if(responseId!==null)if(ret&&ret.then)ret.then(result=>this._PostResultToDOM(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToDOM(responseId,false,""+err)});else this._PostResultToDOM(responseId,true,ret)}_PostResultToDOM(responseId,isOk,result){this._messagePort.postMessage({"type":"result","responseId":responseId,"isOk":isOk,"result":result})}_OnResultFromDOM(data){const responseId= +data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=this._pendingResponsePromises.get(responseId);if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);this._pendingResponsePromises.delete(responseId)}AddDOMComponentMessageHandler(component,handler,func){let handlerMap=this._domEventHandlers.get(component);if(!handlerMap){handlerMap=new Map;this._domEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[Runtime] Component '${component}' already has handler '${handler}'`); +handlerMap.set(handler,func)}PostComponentMessageToDOM(component,handler,data,transfer){this._messagePort.postMessage({"type":"event","component":component,"handler":handler,"data":data,"responseId":null},transfer)}PostComponentMessageToDOMAsync(component,handler,data,transfer){const responseId=this._nextDomResponseId++;const ret=new Promise((resolve,reject)=>{this._pendingResponsePromises.set(responseId,{resolve,reject})});this._messagePort.postMessage({"type":"event","component":component,"handler":handler, +"data":data,"responseId":responseId},transfer);return ret}SendWrapperExtensionMessage(componentId,messageId,params,asyncId=-1){this.PostComponentMessageToDOM("runtime","send-wrapper-extension-message",{"componentId":componentId,"messageId":messageId,"params":params,"asyncId":asyncId})}SendWrapperExtensionMessageAsync(componentId,messageId,params){const responseId=this._nextDomResponseId++;const ret=new Promise((resolve,reject)=>{this._pendingResponsePromises.set(responseId,{resolve,reject})});this.SendWrapperExtensionMessage(componentId, +messageId,params,responseId);return ret}_OnWrapperExtensionMessage(data){if(data["asyncId"]!==-1){const responseId=data["asyncId"];const pendingPromise=this._pendingResponsePromises.get(responseId);pendingPromise.resolve(data["params"]);this._pendingResponsePromises.delete(responseId)}else this._OnEventFromDOM({"component":"wrapper-extension:"+data["componentId"],"handler":data["messageId"],"data":data["params"],"responseId":null})}AddWrapperExtensionMessageHandler(componentId,messageId,func){this.AddDOMComponentMessageHandler("wrapper-extension:"+ +componentId,messageId,func)}HasWrapperComponentId(id){return this._pluginManager.HasWrapperComponentId(id)}PostToDebugger(data){if(!this.IsDebug())throw new Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",data)}async Init(opts){if(this.IsDebug())await C3Debugger.Init(this);else if(self.C3Debugger)self.C3Debugger.InitPreview(this);const [o]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);await this._LoadDataJson(o); +await this._InitialiseCanvas(opts);if(!this.IsPreview())console.info("Made with Construct, the game and app creator :: https://www.construct.net");if(this.GetWebGLRenderer()){const webglRenderer=this.GetWebGLRenderer();console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${webglRenderer.GetWebGLVersionNumber()} [${webglRenderer.GetUnmaskedRenderer()}] (${webglRenderer.IsDesynchronized()?"desynchronized":"standard"} compositing)`)}else if(this.GetWebGPURenderer())console.info(`[C3 runtime] Hosted in ${this.IsInWorker()? +"worker":"DOM"}, rendering with WebGPU [${this.GetWebGPURenderer().GetBasicAdapterInfoString()}]`);if(this.GetRenderer().HasMajorPerformanceCaveat())console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=true;for(const e of this._waitingToHandleEvents)this._OnEventFromDOM(e);C3.clearArray(this._waitingToHandleEvents);if(this._canvasManager)this._canvasManager.StartLoadingScreen(); +for(const f of opts["runOnStartupFunctions"])this._additionalLoadPromises.push(this._RunOnStartupFunction(f));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);C3.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading()){if(this._canvasManager)this._canvasManager.HideCordovaSplashScreen();return}if(this._canvasManager)await this._canvasManager.EndLoadingScreen();await this._dispatcher.dispatchEventAndWaitAsync(new C3.Event("beforeruntimestart")); +await this.Start();this._messagePort.postMessage({"type":"runtime-ready"});return this}async _RunOnStartupFunction(f){try{await f(this._iRuntime)}catch(err){console.error("[C3 runtime] Error in runOnStartup function: ",err)}}async _LoadDataJson(o){const projectData=o["project"];this._projectName=projectData[0];this._projectVersion=projectData[16];this._projectUniqueId=projectData[31];this._appId=projectData[38];const loadingLogoFilename=projectData[39]||"loading-logo.png";this._isPixelRoundingEnabled= +!!projectData[9];this._originalViewportWidth=this._viewportWidth=projectData[10];this._originalViewportHeight=this._viewportHeight=projectData[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=projectData[36];this._framerateMode=projectData[37];if(this._compositingMode==="low-latency"&&this.IsAndroidWebView()&&C3.Platform.BrowserVersionNumber<=77){console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."); +this._compositingMode="standard"}this._uses3dFeatures=!!projectData[40];this._sampling=projectData[14];this._usesAnyBackgroundBlending=projectData[15];this._usesAnyCrossSampling=projectData[42];this._usesAnyDepthSampling=projectData[17];this._usesLoaderLayout=!!projectData[18];this._loaderStyle=projectData[19];this._nextUid=projectData[21];this._pauseOnBlur=projectData[22];const assetManager=this._assetManager;assetManager._SetFileStructure(projectData[45]);assetManager._SetAudioFiles(projectData[7], +projectData[25]);assetManager._SetMediaSubfolder(projectData[8]);assetManager._SetFontsSubfolder(projectData[32]);assetManager._SetIconsSubfolder(projectData[28]);assetManager._SetWebFonts(projectData[29]);if(this._loaderStyle===0){let url="";if(this.IsPreview()){if(assetManager._HasLocalUrlBlob(loadingLogoFilename))url=assetManager.GetLocalUrlAsBlobUrl(loadingLogoFilename)}else if(assetManager.GetFileStructure()==="flat")url=assetManager.GetIconsSubfolder()+loadingLogoFilename;else url=loadingLogoFilename; +if(url)this._loadingLogoAsset=assetManager.LoadImage({url})}if(this._canvasManager){this._canvasManager.SetFullscreenMode(C3.CanvasManager._FullscreenModeNumberToString(projectData[12]));this._canvasManager.SetFullscreenScalingQuality(projectData[23]?"high":"low");this._canvasManager.SetMipmapsEnabled(projectData[24]!==0);this._canvasManager._SetGPUPowerPreference(projectData[34]);this._canvasManager._SetTextureAnisotropy(projectData[41]);this._canvasManager._SetWebGPUEnabled(projectData[13]);this._canvasManager._SetZAxisScale(projectData[30]); +this._canvasManager._SetZDistances(projectData[46],projectData[47]);this._canvasManager._SetFieldOfView(projectData[26]);this._canvasManager._SetLimitedToWebGL1(projectData[48])}const exportToVideoOpts=projectData[43];if(exportToVideoOpts)await this._LoadExportToVideoData(exportToVideoOpts);this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(const pluginData of projectData[2])this._pluginManager.CreatePlugin(pluginData);this._objectReferenceTable=self.C3_GetObjectRefTable(); +this._LoadJsPropNameTable();for(const objectClassData of projectData[3]){const objectClass=C3.ObjectClass.Create(this,this._allObjectClasses.length,objectClassData);this._allObjectClasses.push(objectClass);this._objectClassesByName.set(objectClass.GetName().toLowerCase(),objectClass);this._objectClassesBySid.set(objectClass.GetSID(),objectClass)}for(const familyData of projectData[4]){const familyType=this._allObjectClasses[familyData[0]];familyType._LoadFamily(familyData)}for(const containerData of projectData[27]){const containerTypes= +containerData.map(index=>this._allObjectClasses[index]);this._allContainers.push(C3.New(C3.Container,this,containerTypes))}for(const objectClass of this._allObjectClasses)objectClass._OnAfterCreate();for(const layoutData of projectData[5])this._layoutManager.Create(layoutData);const firstLayoutName=projectData[1];if(firstLayoutName){const firstLayout=this._layoutManager.GetLayoutByName(firstLayoutName);if(firstLayout)this._layoutManager.SetFirstLayout(firstLayout)}for(const timelineData of projectData[33])this._timelineManager.Create(timelineData); +for(const transitionData of projectData[35])this._transitionManager.Create(transitionData);for(const templateInstanceData of projectData[44])this._templateManager.Create(templateInstanceData);if(!this._templateManager.HasTemplates()){this._templateManager.Release();this._templateManager=null}this._InitScriptInterfaces();for(const eventSheetData of projectData[6])this._eventSheetManager.Create(eventSheetData);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();C3.clearArray(this._objectReferenceTable); +this.FlushPendingInstances();let targetOrientation="any";const orientations=projectData[20];if(orientations===1)targetOrientation="portrait";else if(orientations===2)targetOrientation="landscape";this.PostComponentMessageToDOM("runtime","set-target-orientation",{"targetOrientation":targetOrientation})}async _LoadExportToVideoData(exportToVideoOpts){const format=exportToVideoOpts["format"];if(format==="image-sequence")this._exportToVideo=new self.C3ExportToImageSequence(this,exportToVideoOpts);else if(format=== +"image-sequence-gif")this._exportToVideo=new self.C3ExportToGIF(this,exportToVideoOpts);else if(format==="webm")this._exportToVideo=new self.C3ExportToWebMVideo(this,exportToVideoOpts);else if(format==="mp4")this._exportToVideo=new self.C3ExportToMP4Video(this,exportToVideoOpts);else;this._framerateMode="unlimited-frame";this._canvasManager.SetFullscreenMode("off");this._devicePixelRatio=1;self.devicePixelRatio=1;await this.PostComponentMessageToDOMAsync("runtime","set-exporting-to-video",{"message":this._exportToVideo.GetExportingMessageForPercent(0), +"duration":this._exportToVideo.GetDuration()})}GetLoaderStyle(){return this._loaderStyle}IsExportToVideo(){return this._exportToVideo!==null}GetExportVideoDuration(){return this._exportToVideo.GetDuration()}GetExportVideoFramerate(){return this._exportToVideo.GetFramerate()}_InitExportToVideo(){return this._exportToVideo.Init({width:this._canvasManager.GetDeviceWidth(),height:this._canvasManager.GetDeviceHeight()})}_ExportToVideoAddFrame(){const time=this._tickCount/this.GetExportVideoFramerate(); +return this._exportToVideo.AddFrame(this._canvasManager.GetCanvas(),time)}_ExportToVideoAddKeyframe(){if(this._exportToVideo)this._exportToVideo.AddKeyframe()}_OnOfflineAudioRenderCompleted(e){this._exportToVideo.OnOfflineAudioRenderCompleted(e)}_ExportToVideoFinish(){return this._exportToVideo.Finish()}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(promise){this._additionalLoadPromises.push(promise)}SetUsingCreatePromises(e){this._isUsingCreatePromises= +!!e}AddCreatePromise(promise){if(!this._isUsingCreatePromises)return;this._additionalCreatePromises.push(promise)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(el){this._allEffectLists.push(el)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(opts){if(!this._canvasManager)return;await this._canvasManager.CreateCanvas(opts);this._canvasManager.InitLoadingScreen(this._loaderStyle)}async _MaybeLoadOpusDecoder(){if(this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus"))return; +let wasmBlob=null;let wasmBuffer=null;try{if(this.IsiOSCordova()&&this._assetManager.IsFileProtocol())wasmBuffer=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl);else wasmBuffer=await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(err){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",err);return}if(wasmBuffer)this.AddJobWorkerBuffer(wasmBuffer,"opus-decoder-wasm");else this.AddJobWorkerBlob(wasmBlob,"opus-decoder-wasm"); +await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}async _WasmDecodeWebMOpus(arrayBuffer){const result=await this.AddJob("OpusDecode",{"arrayBuffer":arrayBuffer},[arrayBuffer]);return result}async Start(){this._hasStarted=true;this._startTime=Date.now();if(this._usesLoaderLayout){for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&!objectClass.IsOnLoaderLayout()&&objectClass.IsWorldType())objectClass.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading= +false;this._OnLoadFinished()})}else this._isLoading=false;this._assetManager.SetInitialLoadFinished();if(this.IsDebug())C3Debugger.RuntimeInit(ife);for(const layout of this._layoutManager.GetAllLayouts())layout._CreateGlobalNonWorlds();if(this.IsExportToVideo())await this._InitExportToVideo();const firstLayout=this._layoutManager.GetFirstLayout();await firstLayout._Load(null,this.GetRenderer());await firstLayout._StartRunning(true);this._fpsLastTime=performance.now();if(!this._usesLoaderLayout)this._OnLoadFinished(); +const state=await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking");if(state["isSuspended"]&&!this.IsExportToVideo())this._suspendCount++;else this.Tick()}_OnLoadFinished(){this.Trigger(C3.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(index){index=Math.floor(index);const objRefTable=this._objectReferenceTable;if(index<0||index>=objRefTable.length)throw new Error("invalid object reference");return objRefTable[index]}_LoadJsPropNameTable(){for(const entry of self.C3_JsPropNameTable){const propName= +C3.first(Object.keys(entry));this._jsPropNameTable.push(propName)}}GetJsPropName(index){index=Math.floor(index);const jsPropNameTable=this._jsPropNameTable;if(index<0||index>=jsPropNameTable.length)throw new Error("invalid prop reference");return jsPropNameTable[index]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetRuntimeBaseURL(){return this._runtimeBaseUrl}GetPreviewURL(){return this._previewUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return this.GetCurrentEventStackFrame().GetConditionIndex()=== +0}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(i){i=Math.floor(i);if(i<0||i>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[i]}GetObjectClassByName(name){return this._objectClassesByName.get(name.toLowerCase())||null}GetObjectClassBySID(sid){return this._objectClassesBySid.get(sid)||null}GetSingleGlobalObjectClassByCtor(ctor){const plugin= +this._pluginManager.GetPluginByConstructorFunction(ctor);if(!plugin)return null;return plugin.GetSingleGlobalObjectClass()}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;yield*objectClass.instances()}}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.runtime=this.GetIRuntime();const shouldTime=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine(); +if(shouldTime)C3Debugger.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);if(shouldTime)C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(w,h){if(this._originalViewportWidth===w&&this._originalViewportHeight===h)return;this._originalViewportWidth= +w;this._originalViewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(w,h){if(this._viewportWidth===w&&this._viewportHeight===h)return;this._viewportWidth=w;this._viewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}_SetDevicePixelRatio(r){if(this.IsExportToVideo())return; +this._devicePixelRatio=r}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){if(!this._canvasManager)return this._viewportWidth;return this._canvasManager.GetDrawWidth()}GetDrawHeight(){if(!this._canvasManager)return this._viewportHeight;return this._canvasManager.GetDrawHeight()}GetRenderScale(){if(!this._canvasManager)return 1;return this._canvasManager.GetRenderScale()}GetDisplayScale(){if(!this._canvasManager)return 1; +return this._canvasManager.GetDisplayScale()}GetEffectLayerScaleParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectLayerScaleParam()}GetEffectDevicePixelRatioParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectDevicePixelRatioParam()}GetCanvasClientX(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientX()}GetCanvasClientY(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientY()}GetCanvasCssWidth(){if(!this._canvasManager)return 0; +return this._canvasManager.GetCssWidth()}GetCanvasCssHeight(){if(!this._canvasManager)return 0;return this._canvasManager.GetCssHeight()}GetFullscreenMode(){if(!this._canvasManager)return"off";return this._canvasManager.GetFullscreenMode()}GetAdditionalRenderTarget(opts){if(!this._canvasManager)return null;return this._canvasManager.GetAdditionalRenderTarget(opts)}ReleaseAdditionalRenderTarget(renderTarget){if(!this._canvasManager)return;this._canvasManager.ReleaseAdditionalRenderTarget(renderTarget)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyCrossSampling(){return this._usesAnyCrossSampling}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}GetGPUUtilisation(){if(!this._canvasManager)return NaN; +return this._canvasManager.GetGPUUtilisation()}IsLinearSampling(){return this.GetSampling()!=="nearest"}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){if(this._loadingLogoAsset){this._loadingLogoAsset.Release();this._loadingLogoAsset=null}}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetTemplateManager(){return this._templateManager}GetAssetManager(){return this._assetManager}LoadImage(opts){return this._assetManager.LoadImage(opts)}CreateInstance(objectClass, +layer,x,y,createHierarchy,templateName){if(templateName&&this._templateManager){const templateData=this._templateManager.GetTemplateData(objectClass,templateName);if(templateData){const inst=this.CreateInstanceFromData(templateData,layer,false,x,y,false,createHierarchy,undefined,createHierarchy);this._templateManager.MapInstanceToTemplateName(inst,templateName);return inst}}return this.CreateInstanceFromData(objectClass,layer,false,x,y,false,createHierarchy,undefined,createHierarchy)}CreateInstanceFromData(instData_or_objectClass, +layer,isStartupInstance,x,y,skipSiblings,createHierarchy,previousInstance,creatingHierarchy){let instData=null;let objectClass=null;if(instData_or_objectClass instanceof C3.ObjectClass){objectClass=instData_or_objectClass;if(objectClass.IsFamily()){const members=objectClass.GetFamilyMembers();const i=Math.floor(this.Random()*members.length);objectClass=members[i]}instData=objectClass.GetDefaultInstanceData()}else{instData=instData_or_objectClass;objectClass=this.GetObjectClassByIndex(instData[1])}const isWorld= +objectClass.GetPlugin().IsWorldType();if(this._isLoading&&isWorld&&!objectClass.IsOnLoaderLayout())return null;const originalLayer=layer;if(!isWorld)layer=null;let uid;if(isStartupInstance&&!skipSiblings&&instData&&!this._instancesByUid.has(instData[2]))uid=instData[2];else uid=this._nextUid++;const worldData=instData?instData[0]:null;const inst=C3.New(C3.Instance,{runtime:this,objectType:objectClass,layer:layer,worldData,instVarData:instData?instData[3]:null,uid:uid});this._instancesByUid.set(uid, +inst);let wi=null;if(isWorld){wi=inst.GetWorldInfo();if(typeof x!=="undefined"&&typeof y!=="undefined"){wi.SetX(x);wi.SetY(y)}objectClass._SetAnyCollisionCellChanged(true)}if(layer){if(!creatingHierarchy)layer._AddInstance(inst,true);if(layer.GetParallaxX()!==1||layer.GetParallaxY()!==1)objectClass._SetAnyInstanceParallaxed(true);layer.GetLayout().MaybeLoadTexturesFor(objectClass)}this._objectCount++;let needsSiblingCreation=true;if(previousInstance){const previousObjectClass=previousInstance.GetObjectClass(); +if(previousObjectClass.IsInContainer()&&objectClass.IsInContainer()){const container=objectClass.GetContainer();const previousContainer=previousObjectClass.GetContainer();if(container===previousContainer)needsSiblingCreation=false}}if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&needsSiblingCreation){for(const containerType of objectClass.GetContainer().objectTypes()){if(containerType===objectClass)continue;const siblingInst=this.CreateInstanceFromData(containerType,originalLayer, +false,wi?wi.GetX():x,wi?wi.GetY():y,true,false,undefined,creatingHierarchy);inst._AddSibling(siblingInst)}for(const s of inst.siblings()){s._AddSibling(inst);for(const s2 of inst.siblings())if(s!==s2)s._AddSibling(s2)}}if(isWorld&&!isStartupInstance&&!!createHierarchy)this._CreateChildInstancesFromData(inst,worldData,wi,layer,x,y,creatingHierarchy);if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&!!createHierarchy)for(const sibling of inst.siblings()){const swi=sibling.GetWorldInfo(); +if(!swi)continue;const siblingPlugin=sibling.GetPlugin();const sWorldData=sibling.GetObjectClass().GetDefaultInstanceData()[0];if(siblingPlugin.IsWorldType())this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,swi.GetX(),swi.GetY(),creatingHierarchy);else this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,undefined,undefined,creatingHierarchy)}if(!skipSiblings&&!!createHierarchy){if(typeof x==="undefined")x=worldData[0];if(typeof y==="undefined")y=worldData[1];const pwi=wi.GetTopParent(); +const newX=x-wi.GetX()+pwi.GetX();const newY=y-wi.GetY()+pwi.GetY();pwi.SetXY(newX,newY)}objectClass._SetIIDsStale();const instPropertyData=instData?C3.cloneArray(instData[5]):null;const behPropertyData=instData?instData[4].map(bp=>C3.cloneArray(bp)):null;const hasTilemap=isWorld&&worldData&&worldData[13];if(hasTilemap)inst._SetHasTilemap();inst._CreateSdkInstance(instPropertyData,behPropertyData);if(hasTilemap){const tilemapData=worldData[13];inst.GetSdkInstance().LoadTilemapData(tilemapData[2], +tilemapData[0],tilemapData[1])}this._instancesPendingCreate.push(inst);this._hasPendingInstances=true;if(this.IsDebug())C3Debugger.InstanceCreated(inst);return inst}_CreateChildInstancesFromData(parentInstance,parentWorldData,parentWorldInfo,layer,x,y,creatingHierarchy){const parentZIndex=parentWorldInfo.GetSceneGraphZIndexExportData();const childrenData=parentWorldInfo.GetSceneGraphChildrenExportData();parentInstance.GetWorldInfo().SetSceneGraphZIndex(parentZIndex);if(!childrenData)return;if(typeof x=== +"undefined")x=parentWorldData[0];if(typeof y==="undefined")y=parentWorldData[1];const sceneGraphSiblings=new Set;const parentX=parentWorldData[0];const parentY=parentWorldData[1];for(const childData of childrenData){const childLayoutSID=childData[0];const childLayerIndex=childData[1];const childUID=childData[2];const childFlags=childData[3];const childIsInContainer=!!childData[4];const childZIndex=childData[5];const uniqueInstanceData=childData[6];let childInstData;if(uniqueInstanceData)childInstData= +uniqueInstanceData;else{const layout=this._layoutManager.GetLayoutBySID(childLayoutSID);const l=layout.GetLayer(childLayerIndex);childInstData=l.GetInitialInstanceData(childUID)}const childObjectClass=this.GetObjectClassByIndex(childInstData[1]);const hasSibling=parentInstance.HasSibling(childObjectClass);const siblingProcessed=sceneGraphSiblings.has(childObjectClass);if(hasSibling&&!siblingProcessed&&childIsInContainer){const childInst=parentInstance.GetSibling(childObjectClass);const childX=x+childInstData[0][0]- +parentX;const childY=y+childInstData[0][1]-parentY;childInst.GetWorldInfo().SetXY(childX,childY);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex);parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>>4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1),transformOpacity:!!(childFlags>>7&1),transformVisibility:!!(childFlags>> +8&1)});sceneGraphSiblings.add(childObjectClass)}else{const childX=x+childInstData[0][0]-parentX;const childY=y+childInstData[0][1]-parentY;const childInst=this.CreateInstanceFromData(childInstData,layer,false,childX,childY,false,true,parentInstance,creatingHierarchy);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex);parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>> +4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1),transformOpacity:!!(childFlags>>7&1),transformVisibility:!!(childFlags>>8&1)})}}}DestroyInstance(inst){if(this._instancesToReleaseAtEndOfTick.has(inst))return;const objectClass=inst.GetObjectClass();let s=this._instancesPendingDestroy.get(objectClass);if(s){if(s.has(inst))return;s.add(inst)}else{s=new Set;s.add(inst);this._instancesPendingDestroy.set(objectClass,s)}if(this.IsDebug())C3Debugger.InstanceDestroyed(inst); +inst._MarkDestroyed();this._hasPendingInstances=true;if(inst.IsInContainer())for(const s of inst.siblings())this.DestroyInstance(s);for(const c of inst.children())if(c.GetDestroyWithParent())this.DestroyInstance(c);if(!this._layoutManager.IsEndingLayout()&&!this._isLoadingState){const eventSheetManager=this.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnDestroyed();eventSheetManager.BlockFlushingInstances(false)}inst._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}FlushPendingInstances(){if(!this._hasPendingInstances)return; +this._isFlushingPendingInstances=true;this._FlushInstancesPendingCreate();this._FlushInstancesPendingDestroy();this._isFlushingPendingInstances=false;this._hasPendingInstances=false;this.UpdateRender()}_FlushInstancesPendingCreate(){for(const inst of this._instancesPendingCreate){const objectType=inst.GetObjectClass();objectType._AddInstance(inst);for(const family of objectType.GetFamilies()){family._AddInstance(inst);family._SetIIDsStale()}}C3.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(true); +for(const [objectClass,s]of this._instancesPendingDestroy.entries()){this._FlushInstancesPendingDestroyForObjectClass(objectClass,s);s.clear()}this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(false)}_FlushInstancesPendingDestroyForObjectClass(objectClass,s){for(const inst of s){const instanceDestroyEvent=this._eventObjects["instancedestroy"];instanceDestroyEvent.instance=inst;this._dispatcher.dispatchEvent(instanceDestroyEvent);this._instancesByUid.delete(inst.GetUID()); +this._instanceTimes.delete(inst);const wi=inst.GetWorldInfo();if(wi){wi._RemoveFromCollisionCells();wi._RemoveFromRenderCells();wi._MarkDestroyed()}this._instancesToReleaseAtEndOfTick.add(inst);this._objectCount--}C3.arrayRemoveAllInSet(objectClass.GetInstances(),s);objectClass._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(objectClass);if(objectClass.GetInstances().length===0)objectClass._SetAnyInstanceParallaxed(false);for(const family of objectClass.GetFamilies()){C3.arrayRemoveAllInSet(family.GetInstances(), +s);family._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(family)}if(objectClass.GetPlugin().IsWorldType()){const layers=new Set([...s].map(i=>i.GetWorldInfo().GetLayer()));for(const layer of layers)layer._RemoveAllInstancesInSet(s)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(objectClass){for(const inst of this._GetInstancesPendingCreate())if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass))yield inst}else if(inst.GetObjectClass()=== +objectClass)yield inst}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(uid,inst){this._instancesByUid.set(uid,inst)}_OnRendererContextLost(){this._dispatcher.dispatchEvent(C3.New(C3.Event,"renderercontextlost"));this.SetSuspended(true);for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&objectClass.HasLoadedTextures())objectClass.ReleaseTextures();const runningLayout=this.GetMainRunningLayout();if(runningLayout)runningLayout._OnRendererContextLost();C3.ImageInfo.OnRendererContextLost(); +C3.ImageAsset.OnRendererContextLost()}async _OnRendererContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetRenderer());this._dispatcher.dispatchEvent(C3.New(C3.Event,"renderercontextrestored"));this.SetSuspended(false);this.UpdateRender()}_OnVisibilityChange(e){this.SetSuspended(e["hidden"])}_OnWindowBlur(e){if(!this.IsPreview()||!this._pauseOnBlur||C3.Platform.IsMobile)return;if(!e.data["parentHasFocus"]){this.SetSuspended(true);this._isPausedOnBlur=true}}_OnWindowFocus(){if(!this._isPausedOnBlur)return; +this.SetSuspended(false);this._isPausedOnBlur=false}_RequestAnimationFrame(){const tickCallbacks=this._tickCallbacks;if(this._framerateMode==="vsync"){if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.normal)}else if(this._framerateMode==="unlimited-tick"){if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.tickOnly);if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.renderOnly)}else if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.normal)}_CancelAnimationFrame(){if(this._rafId!== +-1){self.cancelAnimationFrame(this._rafId);this._rafId=-1}if(this._ruafId!==-1){C3.CancelUnlimitedAnimationFrame(this._ruafId);this._ruafId=-1}}IsSuspended(){return this._suspendCount>0}SetSuspended(s){if(this.IsExportToVideo())return;const wasSuspended=this.IsSuspended();this._suspendCount+=s?1:-1;if(this._suspendCount<0)this._suspendCount=0;const isSuspended=this.IsSuspended();if(!wasSuspended&&isSuspended){console.log("[Construct] Suspending");this._CancelAnimationFrame();this._dispatcher.dispatchEvent(C3.New(C3.Event, +"suspend"));this.Trigger(C3.Plugins.System.Cnds.OnSuspend,null,null)}else if(wasSuspended&&!isSuspended){console.log("[Construct] Resuming");const now=performance.now();this._lastTickTime=now;this._fpsLastTime=now;this._fpsFrameCount=0;this._fps=0;this._mainThreadTime=0;this._mainThreadTimeCounter=0;this._dispatcher.dispatchEvent(C3.New(C3.Event,"resume"));this.Trigger(C3.Plugins.System.Cnds.OnResume,null,null);if(!this.HitBreakpoint())this.Tick(now)}}_AddBehInstToTick(behSdkInst){this._behInstsToTick.Add(behSdkInst)}_AddBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Add(behSdkInst)}_AddBehInstToTick2(behSdkInst){this._behInstsToTick2.Add(behSdkInst)}_RemoveBehInstToTick(behSdkInst){this._behInstsToTick.Remove(behSdkInst)}_RemoveBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Remove(behSdkInst)}_RemoveBehInstToTick2(behSdkInst){this._behInstsToTick2.Remove(behSdkInst)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true); +for(const bi of this._behInstsToTick)bi.Tick();this._behInstsToTick.SetQueueingEnabled(false)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick)bi.PostTick();this._behInstsToPostTick.SetQueueingEnabled(false)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2)bi.Tick2();this._behInstsToTick2.SetQueueingEnabled(false)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true);for(const bi of this._behInstsToTick){const ret= +bi.Tick();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick.SetQueueingEnabled(false)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick){const ret=bi.PostTick();if(C3.IsIterator(ret))yield*ret}this._behInstsToPostTick.SetQueueingEnabled(false)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2){const ret=bi.Tick2();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick2.SetQueueingEnabled(false)}async Tick(timestamp, +isDebugStep,mode){this._hasStartedTicking=true;const isBackgroundWake=mode==="background-wake";const shouldRender=mode!=="background-wake"&&mode!=="skip-render";if(!this._hasStarted||this.IsSuspended()&&!isDebugStep&&!isBackgroundWake)return;const startTime=performance.now();this._isInTick=true;this._MeasureDt(timestamp||0);const beforePreTickRet=this.Step_BeforePreTick();if(this.IsDebugging())await beforePreTickRet;const pretickRet=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects["pretick"]); +if(pretickRet instanceof Promise)await pretickRet;const afterPreTickRet=this.Step_AfterPreTick();if(this.IsDebugging())await afterPreTickRet;if(this._NeedsHandleSaveOrLoad())await this._HandleSaveOrLoad();if(this.GetLayoutManager().IsPendingChangeMainLayout())await this._MaybeChangeLayout();const runEventsRet=this.Step_RunEventsEtc();if(this.IsDebugging())await runEventsRet;if(shouldRender)this.Render();if(this.IsExportToVideo()){await this._ExportToVideoAddFrame();if(this.GetGameTime()>=this.GetExportVideoDuration()){this._ExportToVideoFinish(); +return}}if(!this.IsSuspended()&&!isBackgroundWake)this._RequestAnimationFrame();this._tickCount++;this._tickCountNoSave++;this._isInTick=false;this._mainThreadTimeCounter+=performance.now()-startTime}async Step_BeforePreTick(){const eventSheetManager=this._eventSheetManager;const isDebug=this.IsDebug();this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true);this.PushCurrentLayout(this.GetMainRunningLayout());if(isDebug)C3Debugger.StartMeasuringTime();if(this.IsDebugging())await eventSheetManager.DebugRunScheduledWaits(); +else eventSheetManager.RunScheduledWaits();if(isDebug)C3Debugger.AddEventsTime();this.PopCurrentLayout();eventSheetManager.BlockFlushingInstances(false);this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true)}async Step_AfterPreTick(){const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const userScriptEventObjects=this._userScriptEventObjects;if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick()); +else this._BehaviorTick();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorPostTick());else this._BehaviorPostTick();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick"]);else dispatcher.dispatchEvent(eventObjects["tick"]);if(isDebug)C3Debugger.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(false);this.DispatchUserScriptEvent(userScriptEventObjects["tick"])}async Step_RunEventsEtc(){const eventSheetManager= +this._eventSheetManager;const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await eventSheetManager.DebugRunEvents(this._layoutManager);else eventSheetManager.RunEvents(this._layoutManager);if(isDebug)C3Debugger.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=false;eventSheetManager.BlockFlushingInstances(true); +if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick2());else this._BehaviorTick2();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick2"]);else dispatcher.dispatchEvent(eventObjects["tick2"]);if(isDebug)C3Debugger.AddPluginTickTime();eventSheetManager.BlockFlushingInstances(false);if(isDebugging)await eventSheetManager.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(this._instancesToReleaseAtEndOfTick.size=== +0)return;const dispatcher=this._dispatcher;dispatcher.SetDelayRemoveEventsEnabled(true);for(const objectClass of this._instancesToReleaseAffectedObjectClasses)objectClass.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const inst of this._instancesToReleaseAtEndOfTick)inst.Release();this._instancesToReleaseAtEndOfTick.clear();dispatcher.SetDelayRemoveEventsEnabled(false)}async _MaybeChangeLayout(){const layoutManager= +this.GetLayoutManager();let i=0;while(layoutManager.IsPendingChangeMainLayout()&&i++<10)await this._DoChangeLayout(layoutManager.GetPendingChangeMainLayout())}_MeasureDt(timestamp){let dtRaw=0;if(this.IsExportToVideo()){dtRaw=1/this.GetExportVideoFramerate();this._dtRaw=dtRaw;this._dt1=dtRaw}else if(this._lastTickTime!==0){const msDiff=Math.max(timestamp-this._lastTickTime,0);dtRaw=msDiff/1E3;if(dtRaw>.5)dtRaw=0;this._dtRaw=dtRaw;const maxDt1=1/this._minimumFramerate;this._dt1=Math.min(dtRaw,maxDt1)}this._lastTickTime= +timestamp;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(dtRaw*this._timeScale);this._wallTime.Add(this._dt1);for(const [inst,instTime]of this._instanceTimes)instTime.Add(this._dt1*inst.GetTimeScale());if(this._canvasManager)this._canvasManager._UpdateTick();if(timestamp-this._fpsLastTime>=1E3){this._fpsLastTime+=1E3;if(timestamp-this._fpsLastTime>=1E3)this._fpsLastTime=timestamp;this._fps=this._fpsFrameCount;this._fpsFrameCount=0;this._mainThreadTime=Math.min(this._mainThreadTimeCounter/ +1E3,1);this._mainThreadTimeCounter=0;if(this._canvasManager)this._canvasManager._Update1sFrameRange();this._collisionEngine._Update1sStats();if(this.IsDebug())C3Debugger.Update1sPerfStats()}this._fpsFrameCount++}_SetTrackingInstanceTime(inst,enable){if(enable){if(!this._instanceTimes.has(inst)){const instTime=C3.New(C3.KahanSum);instTime.Copy(this._gameTime);this._instanceTimes.set(inst,instTime)}}else this._instanceTimes.delete(inst)}_GetInstanceGameTime(inst){const instTime=this._instanceTimes.get(inst); +return instTime?instTime.Get():this.GetGameTime()}async _DoChangeLayout(changeToLayout){const dispatcher=this._dispatcher;const layoutManager=this.GetLayoutManager();const prevLayout=layoutManager.GetMainRunningLayout();await prevLayout._StopRunning();prevLayout._Unload(changeToLayout,this.GetRenderer());if(prevLayout===changeToLayout)this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();dispatcher.dispatchEvent(this._eventObjects["beforelayoutchange"]); +C3.Asyncify.SetHighThroughputMode(true);await changeToLayout._Load(prevLayout,this.GetRenderer());C3.Asyncify.SetHighThroughputMode(false);await changeToLayout._StartRunning(false);dispatcher.dispatchEvent(this._eventObjects["layoutchange"]);this.UpdateRender();this._isLayoutFirstTick=true;this.FlushPendingInstances();this._ExportToVideoAddKeyframe()}UpdateRender(){this._needRender=true}GetWebGLRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetWebGLRenderer()}GetWebGPURenderer(){if(!this._canvasManager)return null; +return this._canvasManager.GetWebGPURenderer()}GetRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetRenderer()}Render(){const canvasManager=this._canvasManager;if(!canvasManager||canvasManager.IsRendererContextLost())return;const renderer=this.GetRenderer();const supportsGPUProfiling=renderer.SupportsGPUProfiling();const isWebGLProfiling=supportsGPUProfiling&&renderer.IsWebGL();const isWebGPUProfiling=supportsGPUProfiling&&renderer.IsWebGPU();if(isWebGLProfiling)renderer.CheckForQueryResults(); +if(!this._needRender&&!this.IsExportToVideo()){renderer.IncrementFrameNumber();return}const layout=this._layoutManager.GetMainRunningLayout();renderer.Start();const isDebug=this.IsDebug();if(isDebug)C3Debugger.StartMeasuringTime();this._needRender=false;let webglFrameQuery=null;if(isWebGLProfiling){webglFrameQuery=canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery();renderer.StartQuery(webglFrameQuery)}let webgpuFrameTimings=null;if(isWebGPUProfiling){webgpuFrameTimings=renderer.StartFrameTiming((1+ +layout.GetLayerCount())*2);renderer.WriteTimestamp(0)}if(this.Uses3DFeatures()&&canvasManager.GetCurrentFullscreenScalingQuality()==="low")renderer.SetFixedSizeDepthBuffer(canvasManager.GetDrawWidth(),canvasManager.GetDrawHeight());else renderer.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),layout);if(webglFrameQuery)renderer.EndQuery(webglFrameQuery);if(isWebGPUProfiling){renderer.WriteTimestamp(1);this._canvasManager._AddWebGPUFrameTiming(webgpuFrameTimings)}renderer.Finish();if(isDebug){C3Debugger.AddDrawCallsTime(); +C3Debugger.UpdateInspectHighlight()}if(canvasManager)canvasManager._MaybeTakeSnapshot()}_Render(renderer,layout){renderer.SetTextureFillMode();renderer.SetAlphaBlend();renderer.SetColorRgba(1,1,1,1);renderer.SetRenderTarget(null);renderer.SetTexture(null);renderer.SetDepthEnabled(this.Uses3DFeatures());layout.Draw(renderer)}Trigger(method,inst,behaviorType){if(!this._hasStarted)return false;const isTopLevel=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let startTime=0;if(isTopLevel)startTime= +performance.now();const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._Trigger(this._layoutManager,method,inst,behaviorType);if(isTopLevel){const triggerTime=performance.now()-startTime;this._mainThreadTimeCounter+=triggerTime;if(isDebug)C3Debugger.AddTriggersTime(triggerTime)}if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugTrigger(method,inst,behaviorType){if(!this.IsDebug())return this.Trigger(method,inst,behaviorType);if(this.HitBreakpoint())throw new Error("called DebugTrigger() while stopped on breakpoint"); +if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw new Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType)}async TriggerAsync(method,inst,behaviorType){if(!this.IsDebugging())return this.Trigger(method,inst,behaviorType);if(!this._hasStarted)return false;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(method,inst,behaviorType);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(method, +inst,behaviorType);const startTime=performance.now();const iter=this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType);let result=iter.next();while(!result.done){await this.DebugBreak(result.value);result=iter.next()}if(!this.IsSuspended()&&!this._eventSheetManager.IsInTrigger()){await this._eventSheetManager.RunQueuedDebugTriggersAsync();if(this._hasStartedTicking&&!this._isInTick)this._RequestAnimationFrame()}this._mainThreadTimeCounter+=performance.now()-startTime; +return result.value}FastTrigger(method,inst,value){const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._FastTrigger(this._layoutManager,method,inst,value);if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugFastTrigger(method,inst,value){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,method,inst,value)}ScheduleTriggers(f){return this._scheduleTriggersThrottle.Add(f)}PushCurrentLayout(layout){this._currentLayoutStack.push(layout)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw new Error("layout stack empty"); +this._currentLayoutStack.pop()}GetCurrentLayout(){if(!this._currentLayoutStack.length)return this.GetMainRunningLayout();return this._currentLayoutStack.at(-1)}GetDt(inst){if(!inst||inst.GetTimeScale()===-1)return this._dt;return this._dt1*inst.GetTimeScale()}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetDtRaw(){return this._dtRaw}GetTimeScale(){return this._timeScale}SetTimeScale(ts){if(isNaN(ts)||ts<0)ts=0;this._timeScale=ts}SetMinimumFramerate(fps){this._minimumFramerate=C3.clamp(fps, +1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(uid){if(this._isLoadingState)throw new Error("cannot call while loading state - wait until afterload event"); +return this._instancesByUid.get(uid)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;for(const inst of objectClass.GetInstances())this._instancesByUid.set(inst.GetUID(),inst)}}IsPreview(){return this._exportType==="preview"}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return this._exportType==="cordova"}IsAndroidWebView(){return C3.Platform.OS==="Android"&&(this._exportType=== +"cordova"||this._exportType==="playable-ad"||this._exportType==="instant-games")}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}IsWebView2Wrapper(){return this._isWebView2Wrapper}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){return this.GetRenderer().GetZAxisScaleFactor(this.GetViewportHeight())}GetDefaultCameraZ(viewH){return this.GetRenderer().GetDefaultCameraZ(viewH|| +this.GetViewportHeight())}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(e){e=!!e;if(this._isPixelRoundingEnabled===e)return;this._isPixelRoundingEnabled=e;this.GetLayoutManager().SetAllLayerMVChanged();this.UpdateRender()}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}GetTextIconSet(iconSource){if(!this._iconChangeHandlers.has(iconSource)){const changeHandler=()=>this.DeleteTextIconSet(iconSource);this._iconChangeHandlers.set(iconSource,changeHandler);iconSource.Dispatcher().addEventListener("animationframeimagechange", +changeHandler)}const iconSet=this._textIconManager.GetIconSet(iconSource);if(!iconSet.HasLoaded())iconSet.LoadContent().then(()=>this.UpdateRender());return iconSet}DeleteTextIconSet(iconSource){this._textIconManager.DeleteIconSet(iconSource)}_GetTextIconSetMeta(iconSource){const icons=[];for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames()){const imageInfo=frame.GetImageInfo();icons.push({source:frame,width:imageInfo.GetWidth(),height:imageInfo.GetHeight(),tag:frame.GetTag()})}return{icons}}async _GetTextIconSetContent(iconSource){const promiseThrottle= +C3.New(C3.PromiseThrottle);const assetDrawablePromises=[];const assetDrawableMap=new Map;for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames()){const imageAsset=frame.GetImageInfo().GetImageAsset();if(assetDrawableMap.has(imageAsset))continue;assetDrawableMap.set(imageAsset,null);assetDrawablePromises.push(promiseThrottle.Add(async()=>{const drawable=await imageAsset.LoadToDrawable();assetDrawableMap.set(imageAsset,drawable)}))}await Promise.all(assetDrawablePromises); +const extractPromises=[];for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames())extractPromises.push(promiseThrottle.Add(async()=>{const imageInfo=frame.GetImageInfo();const imageAssetDrawable=assetDrawableMap.get(imageInfo.GetImageAsset());const canvas=await imageInfo.ExtractImageToCanvas(imageAssetDrawable);const imageBitmap=await createImageBitmap(canvas);return{drawable:imageBitmap}}));const iconsArr=await Promise.all(extractPromises);for(const drawable of assetDrawableMap.values())if(drawable instanceof +ImageBitmap&&drawable["close"])drawable["close"]();return{icons:iconsArr}}SaveToSlot(slotName){this._saveToSlotName=slotName}LoadFromSlot(slotName){this._loadFromSlotName=slotName}LoadFromJsonString(str){this._loadFromJson=str}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!!(this._saveToSlotName||this._loadFromSlotName||this._loadFromJson!==null)}async _HandleSaveOrLoad(){if(this._saveToSlotName){this.FlushPendingInstances();await this._DoSaveToSlot(this._saveToSlotName); +this._ClearSaveOrLoad()}if(this._loadFromSlotName){await this._DoLoadFromSlot(this._loadFromSlotName);this._ClearSaveOrLoad();if(this.IsDebug())C3Debugger.StepIfPausedInDebugger()}if(this._loadFromJson!==null){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson);this._lastSaveJson=this._loadFromJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from JSON string: ", +err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null}_GetProjectStorage(){if(!this._projectStorage)this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()});return this._projectStorage}_GetSavegamesStorage(){if(!this._savegamesStorage)this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+ +this.GetProjectUniqueId(),description:this.GetProjectName()});return this._savegamesStorage}async _DoSaveToSlot(slotName){const saveJson=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(slotName,saveJson);console.log("[Construct] Saved state to storage ("+saveJson.length+" chars)");this._lastSaveJson=saveJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to save state to storage: ", +err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(slotName){try{const loadJson=await this._GetSavegamesStorage().getItem(slotName);if(!loadJson)throw new Error("empty slot");console.log("[Construct] Loaded state from storage ("+loadJson.length+" chars)");await this._DoLoadFromJsonString(loadJson);this._lastSaveJson=loadJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from storage: ", +err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const o={"c3save":true,"version":1,"rt":{"time":this.GetGameTime(),"timeRaw":this.GetGameTimeRaw(),"walltime":this.GetWallTime(),"timescale":this.GetTimeScale(),"tickcount":this.GetTickCount(),"next_uid":this._nextUid,"running_layout":this.GetMainRunningLayout().GetSID(),"start_time_offset":Date.now()-this._startTime},"types":{},"layouts":{},"events":this._eventSheetManager._SaveToJson(),"timelines":this._timelineManager._SaveToJson(), +"user_script_data":null};for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;o["types"][objectClass.GetSID().toString()]=objectClass._SaveToJson()}for(const layout of this._layoutManager.GetAllLayouts())o["layouts"][layout.GetSID().toString()]=layout._SaveToJson();const saveEvent=this._CreateUserScriptEvent("save");saveEvent.saveData=null;await this.DispatchUserScriptEventAsyncWait(saveEvent);o["user_script_data"]=saveEvent.saveData; +return JSON.stringify(o)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(jsonStr){const layoutManager=this.GetLayoutManager();const o=JSON.parse(jsonStr);if(o["c2save"])throw new Error("C2 saves are incompatible with C3 runtime");if(!o["c3save"])throw new Error("not valid C3 save data");if(o["version"]>1)throw new Error("C3 save data from future version");this.ClearIntancesNeedingAfterLoad();this._dispatcher.dispatchEvent(C3.New(C3.Event,"beforeload"));for(const inst of this.allInstances()){const objectClass= +inst.GetObjectClass();if(objectClass.HasNoSaveBehavior())continue;inst._OnBeforeLoad()}const rt=o["rt"];this._gameTime.Set(rt["time"]);if(rt.hasOwnProperty("timeRaw"))this._gameTimeRaw.Set(rt["timeRaw"]);this._wallTime.Set(rt["walltime"]);this._timeScale=rt["timescale"];this._tickCount=rt["tickcount"];this._startTime=Date.now()-rt["start_time_offset"];const layoutSid=rt["running_layout"];this._isLoadingState=true;let changedLayout=false;if(layoutSid!==this.GetMainRunningLayout().GetSID()){const changeToLayout= +layoutManager.GetLayoutBySID(layoutSid);if(changeToLayout){await this._DoChangeLayout(changeToLayout);changedLayout=true}else return}for(const [sidStr,data]of Object.entries(o["layouts"])){const sid=parseInt(sidStr,10);const layout=layoutManager.GetLayoutBySID(sid);if(!layout)continue;layout._LoadFromJson(data)}for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue; +objectClass._LoadFromJson(data)}for(const layout of this._layoutManager.GetAllLayouts())for(const layer of layout.allLayers())layer._LoadFromJsonAfterInstances();this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=false;if(changedLayout){for(const inst of this.allInstances())inst.SetupInitialSceneGraphConnections();for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()|| +objectClass.HasNoSaveBehavior())continue;objectClass._SetupSceneGraphConnectionsOnChangeOfLayout(data)}}this._nextUid=rt["next_uid"];this._eventSheetManager._LoadFromJson(o["events"]);for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||!objectClass.IsInContainer())continue;for(const inst of objectClass.GetInstances()){const iid=inst.GetIID();for(const otherType of objectClass.GetContainer().objectTypes()){if(otherType===objectClass)continue;const otherInstances=otherType.GetInstances(); +if(iid<0||iid>=otherInstances.length)throw new Error("missing sibling instance");inst._AddSibling(otherInstances[iid])}}}this._timelineManager._LoadFromJson(o["timelines"]);layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(C3.New(C3.Event,"afterload"));this.DoAfterLoad();for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(objectClass)objectClass._ClearLoadInstancesJson()}const loadEvent= +this._CreateUserScriptEvent("load");loadEvent.saveData=o["user_script_data"];await this.DispatchUserScriptEventAsyncWait(loadEvent);this.UpdateRender()}SortOnTmpHierarchyPosition(f,s){return f.GetWorldInfo().GetTmpHierarchyPosition()-s.GetWorldInfo().GetTmpHierarchyPosition()}AddInstanceNeedingAfterLoad(inst,data){if(!inst.GetWorldInfo())return;this._instancesNeedingAfterLoadMap.set(inst,data);this._instancesNeedingAfterLoadArray.push(inst)}ClearIntancesNeedingAfterLoad(){this._instancesNeedingAfterLoadMap= +new WeakMap;C3.clearArray(this._instancesNeedingAfterLoadArray)}DoAfterLoad(mode="full",opts=null){this._instancesNeedingAfterLoadArray.sort(this.SortOnTmpHierarchyPosition);for(const wi of this._instancesNeedingAfterLoadArray)wi._OnAfterLoad(this._instancesNeedingAfterLoadMap.get(wi),mode,opts);for(const wi of this._instancesNeedingAfterLoadArray)wi._OnAfterLoad2(this._instancesNeedingAfterLoadMap.get(wi),mode,opts);this.ClearIntancesNeedingAfterLoad()}async AddJobWorkerScripts(scripts){const loadUrls= +await Promise.all(scripts.map(async url=>{const isCrossOrigin=C3.IsAbsoluteURL(url)&&(new URL(url)).origin!==location.origin;const isCordovaFileProtocol=this.IsCordova()&&this._assetManager.IsFileProtocol();if(isCrossOrigin||isCordovaFileProtocol||this.IsPreview()||this.GetExportType()==="playable-ad"){const blob=await this._assetManager.FetchBlob(url);return URL.createObjectURL(blob)}else if(C3.IsRelativeURL(url))return(new URL(url,this._runtimeBaseUrl)).toString();else return url}));this._jobScheduler.ImportScriptsToJobWorkers(loadUrls)}AddJobWorkerBlob(blob, +id){this._jobScheduler.SendBlobToJobWorkers(blob,id)}AddJobWorkerBuffer(buffer,id){this._jobScheduler.SendBufferToJobWorkers(buffer,id)}AddJob(type,params,transferables,maxWorkerNum){return this._jobScheduler.AddJob(type,params,transferables,null,null,maxWorkerNum)}BroadcastJob(type,params,transferables,maxWorkerNum){return this._jobScheduler.BroadcastJob(type,params,transferables,maxWorkerNum)}GetMaxNumJobWorkers(){return this._jobScheduler.GetMaxNumWorkers()}InvokeDownload(url,filename){this.PostComponentMessageToDOM("runtime", +"invoke-download",{"url":url,"filename":filename})}async RasterSvgImage(blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight,imageBitmapOpts){surfaceWidth=surfaceWidth||imageWidth;surfaceHeight=surfaceHeight||imageHeight;if(this.IsInWorker()){const result=await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{"blob":blob,"imageWidth":imageWidth,"imageHeight":imageHeight,"surfaceWidth":surfaceWidth,"surfaceHeight":surfaceHeight,"imageBitmapOpts":imageBitmapOpts});return result["imageBitmap"]}else{const canvas= +await self["C3_RasterSvgImageBlob"](blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight);if(imageBitmapOpts)return await self.createImageBitmap(canvas,imageBitmapOpts);else return canvas}}async GetSvgImageSize(blob){if(this.IsInWorker())return await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{"blob":blob});else return await self["C3_GetSvgImageSize"](blob)}RequestDeviceOrientationEvent(){if(this._didRequestDeviceOrientationEvent)return;this._didRequestDeviceOrientationEvent= +true;this.PostComponentMessageToDOM("runtime","enable-device-orientation")}RequestDeviceMotionEvent(){if(this._didRequestDeviceMotionEvent)return;this._didRequestDeviceMotionEvent=true;this.PostComponentMessageToDOM("runtime","enable-device-motion")}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(f){this._randomNumberCallback=f}_GetRemotePreviewStatusInfo(){const renderer=this.GetRenderer();return{"fps":this.GetFPS(),"cpu":this.GetMainThreadTime(),"gpu":this.GetGPUUtilisation(), +"layout":this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"","renderer":renderer.IsWebGL()?renderer.GetUnmaskedRenderer():renderer.GetBasicAdapterInfoString()}}HitBreakpoint(){if(!this.IsDebug())return false;return C3Debugger.HitBreakpoint()}DebugBreak(eventObject){if(!this.IsDebugging())return Promise.resolve();return C3Debugger.DebugBreak(eventObject)}DebugBreakNext(){if(!this.IsDebugging())return false;return C3Debugger.BreakNext()}SetDebugBreakpointsEnabled(e){this._breakpointsEnabled= +!!e;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){if(d)this._debuggingDisabled--;else this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&this._debuggingDisabled===0}IsCPUProfiling(){return this.IsDebug()&&C3Debugger.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&& +C3Debugger.IsGPUProfiling()}async DebugIterateAndBreak(iter){if(!iter)return;for(const breakEventObject of iter)await this.DebugBreak(breakEventObject)}DebugFireGeneratorEventAndBreak(event){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(event))}_InvokeFunctionFromJS(e){return this._eventSheetManager._InvokeFunctionFromJS(e["name"],e["params"])}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(name){const e=C3.New(C3.Event,name,false);e.runtime=this._iRuntime;return e}_InitScriptInterfaces(){const objectDescriptors= +{};for(const objectClass of this._allObjectClasses)objectDescriptors[objectClass.GetJsPropName()]={value:objectClass.GetIObjectClass(),enumerable:true,writable:false};const objects=Object.create(Object.prototype,objectDescriptors);this._iRuntime=new self.IRuntime(this,objects);this._userScriptEventObjects={"tick":this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const globalVarDescriptors={};for(const globalVar of this.GetEventSheetManager().GetAllGlobalVariables())globalVarDescriptors[globalVar.GetJsPropName()]= +globalVar._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(globalVarDescriptors)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(interface_,class_){this._interfaceMap.set(interface_,class_)}_UnwrapScriptInterface(interface_){return this._interfaceMap.get(interface_)}_UnwrapIObjectClass(iObjectClass){if(!(iObjectClass instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");const objectClass=this._UnwrapScriptInterface(iObjectClass); +if(!objectClass||!(objectClass instanceof C3.ObjectClass))throw new Error("invalid IObjectClass");return objectClass}_UnwrapIWorldInstance(iinst){if(!(iinst instanceof self.IWorldInstance))throw new TypeError("expected IWorldInstance");const inst=this._UnwrapScriptInterface(iinst);if(!inst||!(inst instanceof C3.Instance))throw new Error("invalid IInstance");return inst}};self["C3_CreateRuntime"]=C3.Runtime.Create;self["C3_InitRuntime"]=(runtime,opts)=>runtime.Init(opts); + +} + +// workers/jobSchedulerRuntime.js +{ +'use strict';const C3=self.C3; +C3.JobSchedulerRuntime=class JobSchedulerRuntime extends C3.DefendedBase{constructor(runtime,data){super();this._runtime=runtime;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=data["inputPort"];data["outputPort"].onmessage=e=>this._OnJobWorkerMessage(e);this._maxNumWorkers=data["maxNumWorkers"];this._jobWorkerCount=1;this._isCreatingWorker=false;this._hadErrorCreatingWorker=false}async Init(){}GetMaxNumWorkers(){return this._maxNumWorkers}ImportScriptsToJobWorkers(scripts){this._inputPort.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlobToJobWorkers(blob, +id){this._inputPort.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBufferToJobWorkers(buffer,id){this._inputPort.postMessage({"type":"_send_buffer","buffer":buffer,"id":id},[buffer])}AddJob(type,params,transferables,progressHandler,abortDisposable,maxWorkerNum){if(!transferables)transferables=[];if(typeof maxWorkerNum==="number"){maxWorkerNum=Math.floor(maxWorkerNum);if(maxWorkerNum<=0)throw new Error("invalid maxWorkerNum");}const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":false, +"maxWorkerNum":maxWorkerNum,"jobId":jobId,"params":params,"transferables":transferables};const promise=new Promise((resolve,reject)=>{this._jobPromises.set(jobId,{resolve:resolve,progress:progressHandler,reject:reject,cancelled:false,maxWorkerNum})});if(abortDisposable)abortDisposable.SetAction(()=>this._CancelJob(jobId));this._inputPort.postMessage(job,transferables);this._MaybeCreateExtraWorker();return promise}BroadcastJob(type,params,transferables,maxWorkerNum){if(!transferables)transferables= +[];if(typeof maxWorkerNum==="number"){maxWorkerNum=Math.floor(maxWorkerNum);if(maxWorkerNum<=0)throw new Error("invalid maxWorkerNum");}const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":true,"maxWorkerNum":maxWorkerNum,"jobId":jobId,"params":params,"transferables":transferables};this._inputPort.postMessage(job,transferables)}_CancelJob(jobId){const job=this._jobPromises.get(jobId);if(job){job.cancelled=true;job.resolve=null;job.progress=null;job.reject=null;this._inputPort.postMessage({"type":"_cancel", +"jobId":jobId})}}_OnJobWorkerMessage(e){const msg=e.data;const type=msg["type"];const id=msg["jobId"];switch(type){case "result":this._OnJobResult(id,msg["result"]);break;case "progress":this._OnJobProgress(id,msg["progress"]);break;case "error":this._OnJobError(id,msg["error"]);break;case "ready":this._OnJobWorkerReady();break;default:throw new Error(`unknown message from worker '${type}'`);}}_OnJobResult(jobId,result){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID"); +if(!p.cancelled)p.resolve(result);this._jobPromises.delete(jobId)}_OnJobProgress(jobId,progress){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled&&p.progress)p.progress(progress)}_OnJobError(jobId,error){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled)p.reject(error);this._jobPromises.delete(jobId)}_OnJobWorkerReady(){if(!this._isCreatingWorker)return;this._isCreatingWorker=false;this._jobWorkerCount++;if(this._jobWorkerCount< +this._maxNumWorkers)this._MaybeCreateExtraWorker();else this._inputPort.postMessage({"type":"_no_more_workers"})}_GetWorkerCountNeededForPendingJobs(){let needWorkerCount=0;const sortedJobList=[...this._jobPromises.values()].sort((a,b)=>{const an=a.maxWorkerNum||Infinity;const bn=b.maxWorkerNum||Infinity;return an-bn});for(const job of sortedJobList){const maxWorkerNum=job.maxWorkerNum||Infinity;if(needWorkerCount= +this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._GetWorkerCountNeededForPendingJobs()<=this._jobWorkerCount)return;try{this._isCreatingWorker=true;const result=await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker");result["outputPort"].onmessage=e=>this._OnJobWorkerMessage(e)}catch(err){this._hadErrorCreatingWorker=true;this._isCreatingWorker=false;console.error(`[Construct] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`, +err)}}}; + +} + +{ +self["C3_Shaders"] = {}; + +} + +{ +'use strict';{const C3=self.C3;let cacheRegex=null;let lastRegex="";let lastFlags="";let regexMatches=[];let lastMatchesStr="";let lastMatchesRegex="";let lastMatchesFlags="";const forEachStack=C3.New(C3.ArrayStack);function ForEachOrdered_SortInstances(a,b){const va=a[1];const vb=b[1];if(typeof va==="number"&&typeof vb==="number")return va-vb;else{const sa=""+va;const sb=""+vb;if(sasb)return 1;else return 0}}C3.Plugins.System=class SystemPlugin extends C3.SDKPluginBase{constructor(opts){super(opts); +this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingTotal=0;this._imagesLoadingComplete=0;this._functionMaps=new Map;this._signalTags=[]}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(method){this._runtime.Trigger(method,null,null)}GetRegex(regex,flags){if(!cacheRegex||regex!==lastRegex||flags!==lastFlags){cacheRegex=new RegExp(regex,flags);lastRegex=regex;lastFlags= +flags}cacheRegex.lastIndex=0;return cacheRegex}GetRegexMatches(str,regex,flags){if(str===lastMatchesStr&®ex===lastMatchesRegex&&flags===lastMatchesFlags)return regexMatches;const cacheRegex=this.GetRegex(regex,flags);regexMatches=str.match(cacheRegex);lastMatchesStr=str;lastMatchesRegex=regex;lastMatchesFlags=flags;return regexMatches}async _LoadTexturesForObjectClasses(layout,objectClasses){if(!objectClasses.length)return;this._imagesLoadingTotal+=objectClasses.length;const promises=[];for(const oc of objectClasses)promises.push(layout.MaybeLoadTexturesFor(oc)); +await C3.PromiseAllWithProgress(promises,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;if(this._imagesLoadingComplete===this._imagesLoadingTotal){this._imagesLoadingComplete=0;this._imagesLoadingTotal=0;this._runtime.Trigger(C3.Plugins.System.Cnds.OnImageLoadingComplete,null,null)}}_UnloadTexturesForObjectClasses(layout,objectClasses){for(const oc of objectClasses)if(oc.GetInstanceCount()===0)layout.MaybeUnloadTexturesFor(oc)}_GetForEachStack(){return forEachStack}_Repeat(count){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetEnd(count);if(isSolModifierAfterCnds)for(let i=0;i=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>= +end&&!loop.IsStopped();--i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}*_DebugFor(name,start,end){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetName(name);loop.SetEnd(end);if(end=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>=end&&!loop.IsStopped();--i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame); +eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}_ForEach(objectClass){const eventSheetManager=this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds= +oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();const isInContainer=objectClass.IsInContainer();const sol=objectClass.GetCurrentSol();const instances=forEachStack.Push();C3.shallowAssignArray(instances,sol.GetInstances());loop.SetEnd(instances.length);if(isSolModifierAfterCnds)for(let i=0,len=instances.length;i=lastTime+thisSeconds){cndSavedData.set("Every_lastTime",lastTime+thisSeconds);if(curTime>=cndSavedData.get("Every_lastTime")+.04)cndSavedData.set("Every_lastTime",curTime);cndSavedData.set("Every_seconds",seconds);return true}else if(curTime=a&&x<=b},CompareVar(ev,cmp,val){return C3.compare(ev.GetValue(),cmp,val)},CompareBoolVar(ev){return!!ev.GetValue()}, +CompareTime(cmp,t){const gameTime=this._runtime.GetGameTime();if(cmp===0){const cnd=this._runtime.GetCurrentCondition();const cndSavedData=cnd.GetSavedDataMap();if(!cndSavedData.get("CompareTime_executed"))if(gameTime>=t){cndSavedData.set("CompareTime_executed",true);return true}return false}else return C3.compare(gameTime,cmp,t)},IsNaN(n){return isNaN(n)},AngleWithin(a1,within,a2){return C3.angleDiff(C3.toRadians(a1),C3.toRadians(a2))<=C3.toRadians(within)},IsClockwiseFrom(a1,a2){return C3.angleClockwise(C3.toRadians(a1), +C3.toRadians(a2))},IsBetweenAngles(a,la,ua){let angle=C3.toRadians(a);let lower=C3.toRadians(la);let upper=C3.toRadians(ua);let obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)},IsValueType(v,t){if(typeof v==="number")return t===0;else return t===1},EvaluateExpression(v){return!!v},OnSignal(tag){return tag.toLowerCase()===this._signalTags.at(-1)},PickByComparison(objectClass, +exp,cmp,val){if(!objectClass)return false;const forEachStack=this._GetForEachStack();const tempInstances=forEachStack.Push();const sol=objectClass.GetCurrentSol();C3.shallowAssignArray(tempInstances,sol.GetInstances());if(sol.IsSelectAll())C3.clearArray(sol._GetOwnElseInstances());const cnd=this._runtime.GetCurrentCondition();let k=0;for(let i=0,len=tempInstances.length;i=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer();return true},PickRandom(objectClass){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const index=Math.floor(this._runtime.Random()*instances.length);if(index>=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer(); +return true},PickAll(objectClass){if(!objectClass)return false;if(!objectClass.GetInstanceCount())return false;const sol=objectClass.GetCurrentSol();sol._SetSelectAll(true);objectClass.ApplySolToContainer();return true},PickOverlappingPoint(objectClass,x,y){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const currentEvent=this._runtime.GetCurrentEvent();const isOrBlock=currentEvent.IsOrBlock();const isInverted=this._runtime.GetCurrentCondition().IsInverted(); +if(sol.IsSelectAll()){C3.shallowAssignArray(tmpPickArray,instances);sol.ClearArrays();sol._SetSelectAll(false)}else if(isOrBlock){C3.shallowAssignArray(tmpPickArray,sol._GetOwnElseInstances());C3.clearArray(sol._GetOwnElseInstances())}else{C3.shallowAssignArray(tmpPickArray,sol._GetOwnInstances());C3.clearArray(sol._GetOwnInstances())}for(let i=0,len=tmpPickArray.length;i=0;--i){const inst=instancesPendingCreate[i];if(isFamily){if(inst.GetObjectClass().BelongsToFamily(objectClass)){pick=inst;break}}else if(inst.GetObjectClass()===objectClass){pick=inst;break}}if(!pick){const instances= +objectClass.GetInstances();if(instances.length)pick=instances.at(-1)}if(!pick)return false;const sol=objectClass.GetCurrentSol();sol.PickOne(pick);objectClass.ApplySolToContainer();return true},Repeat(count){if(this._runtime.IsDebugging())return this._DebugRepeat(count);else return this._Repeat(count)},While(){if(this._runtime.IsDebugging())return this._DebugWhile();else return this._While()},For(name,start,end){if(this._runtime.IsDebugging())return this._DebugFor(name,start,end);else return this._For(name, +start,end)},ForEach(objectClass){if(this._runtime.IsDebugging())return this._DebugForEach(objectClass);else return this._ForEach(objectClass)},ForEachOrdered(objectClass,expression,order){if(this._runtime.IsDebugging())return this._DebugForEachOrdered(objectClass,order);else return this._ForEachOrdered(objectClass,order)},LayerVisible(layer){return layer?layer.IsVisible():false},LayerInteractive(layer){return layer?layer.IsSelfAndParentsInteractive():false},LayerEmpty(layer){return layer?!layer.GetInstanceCount(): +false},LayerCmpOpacity(layer,cmp,o){if(!layer)return false;return C3.compare(layer.GetOpacity()*100,cmp,o)},OnImageLoadingComplete(){return true},IsLoadingImages(){return this._imagesLoadingTotal>0},TemplateExists(objectClass,template){const templateManager=this._runtime.GetTemplateManager();if(!templateManager)return false;if(!template)return false;return!!templateManager.GetTemplateData(objectClass,template)}}} +{const C3=self.C3;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}function SortInstancesByValue(a,b){return a[1]-b[1]}const tempZOrderList=[];const tempInstValues=[];const tempRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);C3.Plugins.System.Acts={SetVar(ev,x){ev.SetValue(x)},AddVar(ev,x){if(ev.IsNumber()&&typeof x!=="number")x=parseFloat(x);ev.SetValue(ev.GetValue()+x)}, +SubVar(ev,x){if(!ev.IsNumber())return;ev.SetValue(ev.GetValue()-x)},SetBoolVar(ev,x){ev.SetValue(!!x)},ToggleBoolVar(ev){ev.SetValue(!ev.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},CreateObject(objectClass,layer,x,y,createHierarchy,template){if(!objectClass||!layer)return;const inst=this._runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);const pickMap=new Map;inst.CollectInstancesToPick(pickMap,objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)},CreateObjectByName(objectClassName,layer,x,y,createHierarchy,template){if(!objectClassName||!layer)return;const objectClass=this._runtime.GetObjectClassByName(objectClassName); +if(!objectClass)return;C3.Plugins.System.Acts.CreateObject.call(this,objectClass,layer,x,y,createHierarchy,template)},RecreateInitialObjects(objectClass,x1,y1,x2,y2,sourceLayoutName,sourceLayerParam,offsetX,offsetY,createHierarchy){if(!objectClass)return;let sourceLayout=this._runtime.GetCurrentLayout();if(sourceLayoutName){const lookupLayout=this._runtime.GetLayoutManager().GetLayoutByName(sourceLayoutName);if(lookupLayout)sourceLayout=lookupLayout;else return}let sourceLayer=null;if(typeof sourceLayerParam!== +"number"||sourceLayerParam>=0){sourceLayer=sourceLayout.GetLayer(sourceLayerParam);if(!sourceLayer)return}tempRect.set(x1,y1,x2,y2);const allCreatedInstances=sourceLayout.RecreateInitialObjects(objectClass,tempRect,sourceLayer,offsetX,offsetY,createHierarchy);objectClass.GetCurrentSol().SetArrayPicked(allCreatedInstances);objectClass.ApplySolToContainer()},StopLoop(){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return;loopStack.GetCurrent().Stop()},SetGroupActive(groupName,a){const group= +this._runtime.GetEventSheetManager().GetEventGroupByName(groupName);if(!group)return;if(a===0)group.SetGroupActive(false);else if(a===1)group.SetGroupActive(true);else group.SetGroupActive(!group.IsGroupActive())},SetTimescale(ts){this._runtime.SetTimeScale(ts)},SetObjectTimescale(objectClass,ts){if(ts<0)ts=0;if(!objectClass)return;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.SetTimeScale(ts)},RestoreObjectTimescale(objectClass){if(!objectClass)return; +const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.RestoreTimeScale()},Wait(seconds){if(seconds<0)return;this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(seconds);return true},WaitForSignal(tag){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(tag);return true},WaitForPreviousActions(){const eventSheetManager=this._runtime.GetEventSheetManager();eventSheetManager.AddScheduledWait().InitPromise(eventSheetManager.GetPromiseForAllAsyncActions()); +return true},Signal(tag){const lowerTag=tag.toLowerCase();this._signalTags.push(lowerTag);this._runtime.Trigger(C3.Plugins.System.Cnds.OnSignal,null);this._signalTags.pop();for(const w of this._runtime.GetEventSheetManager().scheduledWaits())if(w.IsSignal()&&w.GetSignalTag()===lowerTag)w.SetSignalled()},async SnapshotCanvas(format,quality,x,y,width,height){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;this.UpdateRender();await canvasManager.SnapshotCanvas(format=== +0?"image/png":"image/jpeg",quality/100,x,y,width,height);await this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnCanvasSnapshot,null)},SetCanvasSize(w,h){if(w<=0||h<=0)return;this._runtime.SetViewportSize(w,h);this._runtime.GetCurrentLayout().BoundScrolling();const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true);else{this._runtime.SetOriginalViewportSize(w, +h);canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)}this._runtime.UpdateRender()},SetFullscreenQuality(q){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")return;canvasManager.SetFullscreenScalingQuality(q!==0?"high":"low");canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)},SaveState(slot){this._runtime.SaveToSlot(slot)},LoadState(slot){this._runtime.LoadFromSlot(slot)}, +LoadStateJSON(jsonStr){this._runtime.LoadFromJsonString(jsonStr)},SetHalfFramerateMode(m){},ResetPersisted(){for(const layout of this._runtime.GetLayoutManager().GetAllLayouts())layout.ResetPersistData()},SetPixelRounding(m){this._runtime.SetPixelRoundingEnabled(m!==0)},SetMinimumFramerate(fps){this._runtime.SetMinimumFramerate(fps)},SortZOrderByInstVar(objectClass,instVar){if(!objectClass)return;const sol=objectClass.GetCurrentSol();const pickedInstances=sol.GetInstances();const zOrderList=tempZOrderList; +const instValues=tempInstValues;const layout=this._runtime.GetCurrentLayout();const isFamily=objectClass.IsFamily();const familyIndex=objectClass.GetFamilyIndex();for(let i=0,len=pickedInstances.length;i0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers); +else eventSheetManager.PushCleanSol(solModifiers);const paramResults=[];const callerFunctionBlock=eventSheetManager.FindFirstFunctionBlockParent(currentEvent);if(callerFunctionBlock){const callerParameters=callerFunctionBlock.GetFunctionParameters();for(let i=forwardParams,len=callerParameters.length;in)ret=n}return ret},clamp(x,l,u){return C3.clamp(x,l,u)},distance(x1,y1,x2,y2){return C3.distanceTo(x1,y1,x2,y2)},angle(x1,y1,x2,y2){return C3.toDegrees(C3.angleTo(x1,y1,x2,y2))},lerp(a,b,x){return C3.lerp(a,b,x)},unlerp(a,b,y){return C3.unlerp(a,b,y)},qarp(a,b,c,x){return C3.qarp(a,b,c,x)},cubic(a,b,c,d,x){return C3.cubic(a,b,c,d,x)},cosp(a,b,x){return C3.cosp(a,b,x)},anglediff(a, +b){return C3.toDegrees(C3.angleDiff(C3.toRadians(a),C3.toRadians(b)))},anglelerp(a,b,x){return C3.toDegrees(C3.angleLerp(C3.toRadians(a),C3.toRadians(b),x))},anglerotate(a,b,c){return C3.toDegrees(C3.angleRotate(C3.toRadians(a),C3.toRadians(b),C3.toRadians(c)))},setbit(n,b,v){n=n|0;b=b|0;v=v!==0?1:0;return n&~(1<=arr.length)return"";return arr[index]},tokencount(text,sep){if(typeof text!=="string"||typeof sep!=="string"||!text.length)return 0;return text.split(sep).length},find(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),"i"));else return-1},findcase(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),""));else return-1},replace(text,find,replace){if(typeof text=== +"string"&&typeof find==="string"&&typeof replace==="string")return text.replace(new RegExp(C3.EscapeRegex(find),"gi"),replace);else return typeof text==="string"?text:""},regexsearch(text,regex,flags){const cacheRegex=this.GetRegex(regex,flags);return text?text.search(cacheRegex):-1},regexreplace(text,regex,flags,replace){const cacheRegex=this.GetRegex(regex,flags);return text?text.replace(cacheRegex,replace):""},regexmatchcount(text,regex,flags){const matches=this.GetRegexMatches(text.toString(), +regex,flags);return matches?matches.length:0},regexmatchat(text,regex,flags,index){index=Math.floor(index);const matches=this.GetRegexMatches(text.toString(),regex,flags);if(!matches||index<0||index>=matches.length)return"";else return matches[index]},zeropad(n,d){let s=n<0?"-":"";if(n<0)n=-n;const zeroes=d-n.toString().length;s+="0".repeat(Math.max(zeroes,0));return s+n.toString()},urlencode(s){return encodeURIComponent(s)},urldecode(s){return decodeURIComponent(s)},dt(){return this._runtime._GetDtFast()}, +timescale(){return this._runtime.GetTimeScale()},wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()}, +windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()}, +layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},layoutangle(){return C3.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},vanishingpointx(){return this._runtime.GetCurrentLayout().GetVanishingPointX()*100},vanishingpointy(){return this._runtime.GetCurrentLayout().GetVanishingPointY()*100},viewportleft(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?layer.GetViewport3D().getLeft():0},viewporttop(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getTop():0},viewportright(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getRight():0},viewportbottom(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getBottom():0},viewportwidth(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().width():0},viewportheight(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().height():0},viewportmidx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);if(layer){const vp=layer.GetViewport3D();return(vp.getLeft()+vp.getRight())/2}else return 0},viewportmidy(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +if(layer){const vp=layer.GetViewport3D();return(vp.getTop()+vp.getBottom())/2}else return 0},canvastolayerx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x,y)[0]:0},canvastolayery(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x,y)[1]:0},layertocanvasx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x, +y)[0]:0},layertocanvasy(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x,y)[1]:0},layertolayerx(fromLayerParam,toLayerParam,x,y){const layout=this._runtime.GetCurrentLayout();const fromLayer=layout.GetLayer(fromLayerParam);const toLayer=layout.GetLayer(toLayerParam);if(!fromLayer||!toLayer||fromLayer===toLayer)return x;const [canvasX,canvasY]=fromLayer.LayerToCanvasCss(x,y);return toLayer.CanvasCssToLayer(canvasX,canvasY)[0]}, +layertolayery(fromLayerParam,toLayerParam,x,y){const layout=this._runtime.GetCurrentLayout();const fromLayer=layout.GetLayer(fromLayerParam);const toLayer=layout.GetLayer(toLayerParam);if(!fromLayer||!toLayer||fromLayer===toLayer)return y;const [canvasX,canvasY]=fromLayer.LayerToCanvasCss(x,y);return toLayer.CanvasCssToLayer(canvasX,canvasY)[1]},layerscale(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOwnScale():0},layerangle(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?C3.toDegrees(layer.GetOwnAngle()):0},layeropacity(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOpacity()*100:0},layerscalerate(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScaleRate():0},layerscrollx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScrollX():0},layerscrolly(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScrollY():0},layerparallaxx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxX()*100:0},layerparallaxy(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxY()*100:0},layerzelevation(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetZElevation():0},layerindex(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetIndex():-1},canvassnapshot(){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return"";return canvasManager.GetCanvasSnapshotUrl()},loopindex(name){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return 0;if(name){const loop=loopStack.FindByName(name);return loop?loop.GetIndex():0}else return loopStack.GetCurrent().GetIndex()},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(name, +str,...paramResults){const mapEntry=this._GetFunctionMap(name.toLowerCase(),false);if(!mapEntry){console.warn(`[Construct] Call mapped function: map name '${name}' not found; returning 0`);return 0}let functionBlock=mapEntry.strMap.get(str.toLowerCase());if(!functionBlock)if(mapEntry.defaultFunc)functionBlock=mapEntry.defaultFunc;else{console.warn(`[Construct] Call mapped function: no function associated with map '${name}' string '${str}'; returning 0 (consider setting a default)`);return 0}const returnType= +functionBlock.GetReturnType();const defaultReturnValue=functionBlock.GetDefaultReturnValue();if(returnType===0){console.warn(`[Construct] Call mapped function: map '${name}' string '${str}' has no return type so cannot be called from an expression; returning 0`);return 0}if(!functionBlock.IsEnabled())return defaultReturnValue;const runtime=this._runtime;const eventSheetManager=runtime.GetEventSheetManager();const currentEvent=eventSheetManager.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiersIncludingParents(); +const hasAnySolModifiers=solModifiers.length>0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const calleeParameters=functionBlock.GetFunctionParameters();for(let i=paramResults.length,len=calleeParameters.length;ia.LoadAllTextures(renderer,opts)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const inst of this._objectClass.instancesIncludingPendingCreate())inst.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(doPick){C3.Plugins.Sprite.FinishCollisionCondition(this, +doPick)}BeforeRunAction(method){spawnPickStack.push({objectClass:null,createHierarchy:false,instances:[]})}_SpawnPickInstance(objectClass,inst,createHierarchy){const entry=spawnPickStack.at(-1);entry.objectClass=objectClass;entry.createHierarchy=createHierarchy;entry.instances.push(inst)}AfterRunAction(method){const entry=spawnPickStack.pop();const objectClass=entry.objectClass;const createHierarchy=entry.createHierarchy;if(!objectClass)return;const pickMap=new Map;for(const inst of entry.instances)inst.CollectInstancesToPick(pickMap, +objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const INITIAL_ANIMATION=1;const INITIAL_FRAME=2;const ENABLE_COLLISIONS=3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const tempVec2=C3.New(C3.Vector2);const FLAG_PLAYING_FORWARDS=1<<0;const FLAG_ANIMATION_PLAYING=1<<1;const FLAG_ANIMATION_TRIGGER=1<<2;C3.Plugins.Sprite.Instance=class SpriteInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);let initiallyVisible=true;let initialAnimation= +"";let initialFrame=0;let collisionEnabled=true;if(properties){initiallyVisible=!!properties[INITIALLY_VISIBLE];initialAnimation=properties[INITIAL_ANIMATION];initialFrame=properties[INITIAL_FRAME];collisionEnabled=properties[ENABLE_COLLISIONS]}this._currentAnimation=this._objectClass.GetAnimationByName(initialAnimation)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=C3.clamp(initialFrame,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex); +const initialImageInfo=this._currentAnimationFrame.GetImageInfo();this._currentTexture=initialImageInfo.GetTexture();this._currentRcTex=initialImageInfo.GetTexRect();this._currentQuadTex=initialImageInfo.GetTexQuad();this.HandleRendererContextLoss();inst.SetFlag(FLAG_ANIMATION_PLAYING,true);inst.SetFlag(FLAG_PLAYING_FORWARDS,this._currentAnimation.GetSpeed()>=0);this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo(); +this._animationTimer=C3.New(C3.KahanSum);this._frameStartTime=0;this._animationRepeats=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=0;const wi=this.GetWorldInfo();this._bquadRef=wi.GetBoundingQuad();wi.SetVisible(initiallyVisible);wi.SetCollisionEnabled(collisionEnabled);wi.SetOriginX(this._currentAnimationFrame.GetOriginX());wi.SetOriginY(this._currentAnimationFrame.GetOriginY());wi.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly()); +wi.SetBboxChanged();if((this._objectClass.GetAnimationCount()!==1||this._objectClass.GetAnimations()[0].GetFrameCount()!==1)&&this._currentAnimationSpeed!==0)this._StartTicking()}Release(){this._currentAnimation=null;this._currentAnimationFrame=null;this._currentTexture=null;this._animationTimer=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return true}OnRendererContextLost(){this._currentTexture=null}OnRendererContextRestored(){this._UpdateCurrentTexture()}Draw(renderer){const texture= +this._currentTexture;if(texture===null)return;renderer.SetTexture(texture);const wi=this.GetWorldInfo();if(wi.HasMesh())this._DrawMesh(wi,renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=this._bquadRef;if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);renderer.Quad4(quad,this._currentQuadTex)}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad; +if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,this._currentQuadTex);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(FLAG_ANIMATION_PLAYING)}SetAnimationPlaying(e){this._inst.SetFlag(FLAG_ANIMATION_PLAYING,e)}IsPlayingForwards(){return this._inst.GetFlag(FLAG_PLAYING_FORWARDS)}SetPlayingForwards(e){this._inst.SetFlag(FLAG_PLAYING_FORWARDS, +e)}IsInAnimationTrigger(){return this._inst.GetFlag(FLAG_ANIMATION_TRIGGER)}SetInAnimationTrigger(e){this._inst.SetFlag(FLAG_ANIMATION_TRIGGER,e)}Tick(){if(this._changeAnimationName)this._DoChangeAnimation();if(this._changeAnimFrameIndex>=0)this._DoChangeAnimFrame();const currentAnimationSpeed=this._currentAnimationSpeed;if(!this.IsAnimationPlaying()||currentAnimationSpeed===0){this._StopTicking();return}const dt=this._runtime.GetDt(this._inst);this._animationTimer.Add(dt);const now=this.GetAnimationTime(); +const prevFrame=this._currentAnimationFrame;const currentFrameTime=prevFrame.GetDuration()/currentAnimationSpeed;if(now=frameCount)if(isPingPong){this.SetPlayingForwards(false);this._currentFrameIndex=frameCount-2}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(false);else this._currentFrameIndex=repeatTo}if(this._currentFrameIndex<0)if(isPingPong){this._currentFrameIndex=1;this.SetPlayingForwards(true);if(!isLooping){this._animationRepeats++; +if(this._animationRepeats>=repeatCount)this._FinishAnimation(true)}}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(true);else this._currentFrameIndex=repeatTo}this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,frameCount-1);const nextFrame=currentAnimation.GetFrameAt(this._currentFrameIndex);if(now>this._frameStartTime+nextFrame.GetDuration()/currentAnimationSpeed)this._frameStartTime=now;this._OnFrameChanged(prevFrame, +nextFrame)}_FinishAnimation(reverse){this._currentFrameIndex=reverse?0:this._currentAnimation.GetFrameCount()-1;this.SetAnimationPlaying(false);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(true);this.DispatchScriptEvent("animationend",false,{animationName:this._animTriggerName});this.Trigger(C3.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(false);this._animationRepeats=0}_OnFrameChanged(prevFrame, +nextFrame,opts){if(prevFrame===nextFrame)return;const wi=this.GetWorldInfo();const prevImage=prevFrame.GetImageInfo();const nextImage=nextFrame.GetImageInfo();const oldW=prevImage.GetWidth();const oldH=prevImage.GetHeight();const newW=nextImage.GetWidth();const newH=nextImage.GetHeight();if(opts&&opts.onFrameChange)opts.onFrameChange(wi,oldW,oldH,newW,newH);else{if(oldW!==newW)wi.SetWidth(wi.GetWidth()*(newW/oldW));if(oldH!==newH)wi.SetHeight(wi.GetHeight()*(newH/oldH))}wi.SetOriginX(nextFrame.GetOriginX()); +wi.SetOriginY(nextFrame.GetOriginY());wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly());wi.SetBboxChanged();this._currentAnimationFrame=nextFrame;this._currentTexture=nextImage.GetTexture();this._currentRcTex=nextImage.GetTexRect();this._currentQuadTex=nextImage.GetTexQuad();const behaviorInstances=this.GetInstance().GetBehaviorInstances();for(let i=0,len=behaviorInstances.length;i=0);if(this._currentAnimationSpeed>0)this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(f){f=C3.clamp(Math.floor(f),0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationRepeatTo=f}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(opts){const prevFrame=this._currentAnimationFrame;const animation=this._objectClass.GetAnimationByName(this._changeAnimationName); +this._changeAnimationName="";if(!animation)return;if(animation===this._currentAnimation&&this.IsAnimationPlaying())return;this._currentAnimation=animation;this.SetPlayingForwards(animation.GetSpeed()>=0);this._currentAnimationSpeed=Math.abs(animation.GetSpeed());this._currentAnimationRepeatTo=animation.GetRepeatTo();this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1);if(this._changeAnimationFrom===1)this._currentFrameIndex=0;this.SetAnimationPlaying(true); +this._frameStartTime=this.GetAnimationTime();const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(prevFrame,nextFrame,opts)}_DoChangeAnimFrame(){const prevFrame=this._currentAnimationFrame;const prevFrameIndex=this._currentFrameIndex;this._currentFrameIndex=C3.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;if(prevFrameIndex===this._currentFrameIndex)return;const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex); +this._OnFrameChanged(prevFrame,nextFrame);this._frameStartTime=this.GetAnimationTime()}_UpdateCurrentTexture(){const curImageInfo=this._currentAnimationFrame.GetImageInfo();this._currentTexture=curImageInfo.GetTexture();this._currentRcTex=curImageInfo.GetTexRect();this._currentQuadTex=curImageInfo.GetTexQuad();this.GetWorldInfo().SetMeshChanged(true)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(nameOrIndex){const frame= +this._currentAnimationFrame;const wi=this.GetWorldInfo();let ip=null;if(typeof nameOrIndex==="string")ip=frame.GetImagePointByName(nameOrIndex);else if(typeof nameOrIndex==="number")ip=frame.GetImagePointByIndex(nameOrIndex-1);else throw new TypeError("expected string or number");let ptZ=wi.GetTotalZElevation();if(!ip)return[wi.GetX(),wi.GetY(),ptZ];tempVec2.copy(ip.GetVec2());if(wi.HasMesh()){const [tx,ty,tz]=wi.GetSourceMesh().TransformPoint(tempVec2.getX(),tempVec2.getY());tempVec2.set(tx,ty); +ptZ+=tz}tempVec2.offset(-frame.GetOriginX(),-frame.GetOriginY());tempVec2.scale(wi.GetWidth(),wi.GetHeight());tempVec2.rotate(wi.GetAngle());tempVec2.offset(wi.GetX(),wi.GetY());return[tempVec2.getX(),tempVec2.getY(),ptZ]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(index){index=Math.floor(index);const wi=this.GetWorldInfo();const poly=wi.GetTransformedCollisionPoly();const pointCount=poly.pointCount();if(index===pointCount)index= +0;if(index<0||index>=pointCount)return[0,0];const pointsArr=poly.pointsArr();return[pointsArr[index*2+0]+wi.GetX(),pointsArr[index*2+1]+wi.GetY()]}GetDebuggerProperties(){const Acts=C3.Plugins.Sprite.Acts;const prefix="plugins.sprite.debugger.animation-properties";return[{title:prefix+".title",properties:[{name:prefix+".current-animation",value:this._currentAnimation.GetName(),onedit:v=>this.CallAction(Acts.SetAnim,v,0)},{name:prefix+".current-frame",value:this._currentFrameIndex,onedit:v=>this.CallAction(Acts.SetAnimFrame, +v)},{name:prefix+".is-playing",value:this.IsAnimationPlaying(),onedit:v=>v?this.CallAction(Acts.StartAnim,0):this.CallAction(Acts.StopAnim)},{name:prefix+".speed",value:this._currentAnimationSpeed,onedit:v=>this.CallAction(Acts.SetAnimSpeed,v)},{name:prefix+".repeats",value:this._animationRepeats,onedit:v=>this._animationRepeats=v}]}]}SaveToJson(){const o={"a":this._currentAnimation.GetSID()};if(this._frameStartTime!==0)o["fs"]=this._frameStartTime;const animTime=this.GetAnimationTime();if(animTime!== +0)o["at"]=animTime;if(this._currentFrameIndex!==0)o["f"]=this._currentFrameIndex;if(this._currentAnimationSpeed!==0)o["cas"]=this._currentAnimationSpeed;if(this._animationRepeats!==1)o["ar"]=this._animationRepeats;if(this._currentAnimationRepeatTo!==0)o["rt"]=this._currentAnimationRepeatTo;if(!this.IsAnimationPlaying())o["ap"]=this.IsAnimationPlaying();if(!this.IsPlayingForwards())o["af"]=this.IsPlayingForwards();const wi=this.GetWorldInfo();if(wi.IsCollisionEnabled())o["ce"]=wi.IsCollisionEnabled(); +return o}LoadFromJson(o){const anim=this.GetObjectClass().GetAnimationBySID(o["a"]);if(anim)this._currentAnimation=anim;this._frameStartTime=o.hasOwnProperty("fs")?o["fs"]:0;this._animationTimer.Set(o.hasOwnProperty("at")?o["at"]:0);const frameIndex=o.hasOwnProperty("f")?o["f"]:0;this._currentFrameIndex=C3.clamp(frameIndex,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=o.hasOwnProperty("cas")?o["cas"]:0;this._animationRepeats=o.hasOwnProperty("ar")?o["ar"]:1;const repeatToIndex= +o.hasOwnProperty("rt")?o["rt"]:0;this._currentAnimationRepeatTo=C3.clamp(repeatToIndex,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(o.hasOwnProperty("ap")?!!o["ap"]:true);this.SetPlayingForwards(o.hasOwnProperty("af")?!!o["af"]:true);const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._currentAnimationFrame=nextFrame;this._UpdateCurrentTexture();const wi=this.GetWorldInfo();wi.SetOriginX(nextFrame.GetOriginX());wi.SetOriginY(nextFrame.GetOriginY()); +wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly());wi.SetCollisionEnabled(!!o["ce"]);if(this.IsAnimationPlaying())this._StartTicking()}GetPropertyValueByIndex(index){const wi=this.GetWorldInfo();switch(index){case ENABLE_COLLISIONS:return wi.IsCollisionEnabled();case INITIAL_FRAME:return C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1);case INITIAL_ANIMATION:return this._currentAnimation.GetName()}}SetPropertyValueByIndex(index,value,opts){const wi=this.GetWorldInfo(); +switch(index){case ENABLE_COLLISIONS:{wi.SetCollisionEnabled(!!value);break}case INITIAL_FRAME:{this.SetAnimationPlaying(false);const totalFrames=this._currentAnimation.GetFrameCount()-1;const nextIndex=value=C3.clamp(value,0,totalFrames);const prevFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const nextFrame=this._currentAnimation.GetFrameAt(nextIndex);this._OnFrameChanged(prevFrame,nextFrame,opts);this._currentFrameIndex=C3.clamp(nextIndex,0,totalFrames);break}case INITIAL_ANIMATION:{this._changeAnimationName= +value;this._DoChangeAnimation(opts);const totalFrames=this._currentAnimation.GetFrameCount();if(totalFrames>1&&this._currentAnimation.GetSpeed()>0)this._StartTicking();else this._StopTicking();break}}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const map=new WeakMap;const ANIM_FROM_MODES=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class ISpriteInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return map.get(this).GetImagePointCount()}getImagePointX(nameOrIndex){return this.getImagePoint(nameOrIndex)[0]}getImagePointY(nameOrIndex){return this.getImagePoint(nameOrIndex)[1]}getImagePointZ(nameOrIndex){return this.getImagePoint(nameOrIndex)[2]}getImagePoint(nameOrIndex){if(typeof nameOrIndex!== +"string"&&typeof nameOrIndex!=="number")throw new TypeError("expected string or number");return map.get(this).GetImagePoint(nameOrIndex)}getPolyPointCount(){return map.get(this).GetCollisionPolyPointCount()}getPolyPointX(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)[0]}getPolyPointY(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)[1]}getPolyPoint(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)}stopAnimation(){map.get(this).SetAnimationPlaying(false)}startAnimation(from= +"current-frame"){C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");map.get(this)._StartAnim(f)}setAnimation(name,from="beginning"){C3X.RequireString(name);C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");const inst=map.get(this);if(!inst.GetObjectClass().GetAnimationByName(name))throw new Error(`animation name "${name}" does not exist`);inst._SetAnim(name,f)}getAnimation(name){C3X.RequireString(name); +const a=map.get(this).GetObjectClass().GetAnimationByName(name);return a?a.GetIAnimation():null}get animation(){return map.get(this)._GetCurrentAnimation().GetIAnimation()}get animationName(){return map.get(this)._GetCurrentAnimationName()}set animationFrame(frameIndex){C3X.RequireFiniteNumber(frameIndex);map.get(this)._SetAnimFrame(frameIndex)}get animationFrame(){return map.get(this)._GetAnimFrame()}set animationSpeed(s){C3X.RequireFiniteNumber(s);map.get(this)._SetAnimSpeed(s)}get animationSpeed(){return map.get(this)._GetAnimSpeed()}set animationRepeatToFrame(f){C3X.RequireFiniteNumber(f); +map.get(this)._SetAnimRepeatToFrame(f)}get animationRepeatToFrame(){return map.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}getImageSize(){const imageInfo=map.get(this).GetCurrentImageInfo();return[imageInfo.GetWidth(),imageInfo.GetHeight()]}async replaceCurrentAnimationFrame(blob){C3X.RequireInstanceOf(blob,Blob);const sdkInst=map.get(this);const runtime=sdkInst.GetRuntime(); +const curImageInfo=sdkInst.GetCurrentImageInfo();const imageInfo=C3.New(C3.ImageInfo);imageInfo.LoadDynamicBlobAsset(runtime,blob);await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling()});if(sdkInst.WasReleased()){imageInfo.Release();return}curImageInfo.ReplaceWith(imageInfo);const sdkType=sdkInst.GetSdkType();sdkType._UpdateAllCurrentTexture();sdkType.GetObjectClass().Dispatcher().dispatchEvent(new C3.Event("animationframeimagechange"));runtime.UpdateRender()}setSolidCollisionFilter(isInclusive, +tags){C3X.RequireString(tags);map.get(this).GetWorldInfo().SetSolidCollisionFilter(!!isInclusive,tags)}}} +{const C3=self.C3;C3.Plugins.Sprite.Cnds={IsAnimPlaying(animName){return C3.equalsNoCase(this._GetCurrentAnimationName(),animName)},CompareFrame(cmp,frameNum){return C3.compare(this._currentFrameIndex,cmp,frameNum)},CompareFrameTag(cmp,frameTag){const selfTag=this._currentAnimationFrame.GetTag();return C3.compare(selfTag.toLowerCase(),cmp,frameTag.toLowerCase())},CompareAnimSpeed(cmp,x){return C3.compare(this._GetAnimSpeed(),cmp,x)},OnAnimFinished(animName){return C3.equalsNoCase(this._animTriggerName, +animName)},OnAnyAnimFinished(){return true},OnFrameChanged(){return true},IsMirrored(){return this.GetWorldInfo().GetWidth()<0},IsFlipped(){return this.GetWorldInfo().GetHeight()<0},OnURLLoaded(){return true},OnURLFailed(){return true},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}} +{const C3=self.C3;C3.Plugins.Sprite.Acts={Spawn(objectClass,layer,imgPt,createHierarchy){if(!objectClass||!layer)return;const [imgPtX,imgPtY]=this.GetImagePoint(imgPt);const inst=this._runtime.CreateInstance(objectClass,layer,imgPtX,imgPtY,createHierarchy);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);if(objectClass.GetPlugin().IsRotatable()){const instWi=inst.GetWorldInfo();instWi.SetAngle(this.GetWorldInfo().GetAngle());instWi.SetBboxChanged()}const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(objectClass!==this._runtime.GetCurrentAction().GetObjectClass())this._sdkType._SpawnPickInstance(objectClass,inst,createHierarchy)},StopAnim(){this.SetAnimationPlaying(false)},StartAnim(from){this._StartAnim(from)},SetAnim(animName,from){this._SetAnim(animName,from)},SetAnimFrame(frameNum){this._SetAnimFrame(frameNum)},SetAnimSpeed(s){this._SetAnimSpeed(s)}, +SetAnimRepeatToFrame(f){this._SetAnimRepeatToFrame(f)},SetMirrored(m){const wi=this.GetWorldInfo();const oldW=wi.GetWidth();const newW=Math.abs(oldW)*(m===0?-1:1);if(oldW===newW)return;wi.SetWidth(newW);wi.SetBboxChanged()},SetFlipped(f){const wi=this.GetWorldInfo();const oldH=wi.GetHeight();const newH=Math.abs(oldH)*(f===0?-1:1);if(oldH===newH)return;wi.SetHeight(newH);wi.SetBboxChanged()},SetScale(s){const frame=this._currentAnimationFrame;const imageInfo=frame.GetImageInfo();const wi=this.GetWorldInfo(); +const mirrorFactor=wi.GetWidth()<0?-1:1;const flipFactor=wi.GetHeight()<0?-1:1;const newWidth=imageInfo.GetWidth()*s*mirrorFactor;const newHeight=imageInfo.GetHeight()*s*flipFactor;if(wi.GetWidth()!==newWidth||wi.GetHeight()!==newHeight){wi.SetSize(newWidth,newHeight);wi.SetBboxChanged()}},async LoadURL(url,resize,crossOrigin){const curAnimFrame=this._currentAnimationFrame;const curImageInfo=curAnimFrame.GetImageInfo();const wi=this.GetWorldInfo();const runtime=this._runtime;const sdkType=this._sdkType; +if(curImageInfo.GetURL()===url){if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}this.Trigger(C3.Plugins.Sprite.Cnds.OnURLLoaded);return}const imageInfo=C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");if(this.WasReleased()){imageInfo.Release();return}await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling()})}catch(err){console.error("Load image from URL failed: ", +err);if(!this.WasReleased())this.Trigger(C3.Plugins.Sprite.Cnds.OnURLFailed);return}if(this.WasReleased()){imageInfo.Release();return}curImageInfo.ReplaceWith(imageInfo);sdkType._UpdateAllCurrentTexture();sdkType.GetObjectClass().Dispatcher().dispatchEvent(new C3.Event("animationframeimagechange"));runtime.UpdateRender();if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}await this.TriggerAsync(C3.Plugins.Sprite.Cnds.OnURLLoaded)},SetCollisions(e){this.GetWorldInfo().SetCollisionEnabled(e)}, +SetSolidCollisionFilter(mode,tags){this.GetWorldInfo().SetSolidCollisionFilter(mode===0,tags)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationFrameTag(){return this._currentAnimationFrame.GetTag()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(imgpt){return this.GetImagePoint(imgpt)[0]},ImagePointY(imgpt){return this.GetImagePoint(imgpt)[1]}, +ImagePointZ(imgpt){return this.GetImagePoint(imgpt)[2]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(i){return this.GetCollisionPolyPoint(i)[0]},PolyPointYAt(i){return this.GetCollisionPolyPoint(i)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Keyboard=class KeyboardPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Keyboard.Type=class KeyboardType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let keyboardObjectType=null;function GetKeyboardSdkInstance(){return keyboardObjectType.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class IKeyboardObjectType extends self.IObjectClass{constructor(objectType){super(objectType);keyboardObjectType= +objectType;objectType.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(keyOrCode){const keyboardInst=GetKeyboardSdkInstance();if(typeof keyOrCode==="string")return keyboardInst.IsKeyDown(keyOrCode);else if(typeof keyOrCode==="number")return keyboardInst.IsKeyCodeDown(keyOrCode);else throw new TypeError("expected string or number");}}} +{const C3=self.C3;C3.Plugins.Keyboard.Instance=class KeyboardInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerString="";this._triggerTypedKey="";const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"keydown",e=>this._OnKeyDown(e.data)),C3.Disposable.From(rt,"keyup",e=>this._OnKeyUp(e.data)),C3.Disposable.From(rt,"window-blur", +()=>this._OnWindowOrKeyboardBlur()),C3.Disposable.From(rt,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];if(this._keysDownByString.has(keyString))return;this._keysDownByString.add(keyString);this._keysDownByWhich.add(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKey);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKey); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCode)}_OnKeyUp(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];this._keysDownByString.delete(keyString);this._keysDownByWhich.delete(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const which of this._keysDownByWhich){this._keysDownByWhich.delete(which);this._triggerWhich=which;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}this._keysDownByString.clear()}IsKeyDown(str){return this._keysDownByString.has(str)}IsKeyCodeDown(which){return this._keysDownByWhich.has(which)}SaveToJson(){return{"tk":this._triggerWhich, +"tkk":this._triggerTypedKey}}LoadFromJson(o){this._triggerWhich=o["tk"];if(o.hasOwnProperty("tkk"))this._triggerTypedKey=o["tkk"]}GetDebuggerProperties(){const prefix="plugins.keyboard";return[{title:prefix+".name",properties:[{name:prefix+".debugger.last-key-code",value:this._triggerWhich},{name:prefix+".debugger.last-key-string",value:C3.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:prefix+".debugger.last-typed-key",value:this._triggerTypedKey}]}]}}} +{const C3=self.C3;const LEFTRIGHT_KEY_STRINGS=["ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","MetaLeft","MetaRight"];C3.Plugins.Keyboard.Cnds={IsKeyDown(which){return this._keysDownByWhich.has(which)},OnKey(which){return this._triggerWhich===which},OnAnyKey(){return true},OnAnyKeyReleased(){return true},OnKeyReleased(which){return this._triggerWhich===which},IsKeyCodeDown(which){which=Math.floor(which);return this._keysDownByWhich.has(which)},OnKeyCode(which){return this._triggerWhich=== +which},OnKeyCodeReleased(which){return this._triggerWhich===which},OnLeftRightKeyPressed(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},OnLeftRightKeyReleased(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},IsLeftRightKeyDown(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._keysDownByString.has(keyString)}}}{const C3=self.C3;C3.Plugins.Keyboard.Acts={}} +{const C3=self.C3;function StringFromCharCode(kc){kc=Math.floor(kc);switch(kc){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del"; +case 91:return"left window key";case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2"; +case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(kc)}} +C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(kc){return StringFromCharCode(kc)},TypedKey(){return this._triggerTypedKey}}}; + +} + +{ +'use strict';{const C3=self.C3;const actionPromises=[];C3.Plugins.Audio=class AudioPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}_AddActionPromise(promise){actionPromises.push(promise)}static async WaitForAllActionPromises(){await Promise.all(actionPromises);C3.clearArray(actionPromises)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Audio.Type=class AudioType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function GetAudioDOMInterface(){if(self["C3Audio_DOMInterface"])return self["C3Audio_DOMInterface"];else throw new Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class IAudioObjectType extends self.IObjectClass{constructor(objectType){super(objectType)}get audioContext(){return GetAudioDOMInterface()["GetAudioContextExtern"]()}get destinationNode(){return GetAudioDOMInterface()["GetDestinationNodeExtern"]()}}} +{const C3=self.C3;const DOM_COMPONENT_ID="audio";const LATENCY_HINTS=["interactive","balanced","playback"];C3.Plugins.Audio.Instance=class AudioInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst,DOM_COMPONENT_ID);this._nextPlayTime=0;this._triggerTags=[];this._enableMultiTags=true;this._timeScaleMode=0;this._saveLoadMode=0;this._playInBackground=false;this._panningModel=1;this._distanceModel=1;this._listenerPos=[this._runtime.GetViewportWidth()/2,this._runtime.GetViewportHeight()/ +2,600];this._listenerForwardVec=[0,0,-1];this._listenerUpVec=[0,1,0];this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=false;this._sampleRate=0;this._audioContextState="suspended";this._outputLatency=0;this._effectCount=new Map;this._preloadTotal=0;this._preloadCount=0;this._bufferMetadata=new Map;this._remoteUrls=new Map;let latencyHint="interactive";if(properties){this._timeScaleMode=properties[0]; +this._saveLoadMode=properties[1];this._playInBackground=properties[2];latencyHint=LATENCY_HINTS[properties[3]];this._enableMultiTags=properties[4];this._panningModel=properties[5];this._distanceModel=properties[6];this._listenerPos[2]=properties[7];this._referenceDistance=properties[8];this._maxDistance=properties[9];this._rolloffFactor=properties[10]}this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=[];this.AddDOMMessageHandlers([["state",e=>this._OnUpdateState(e)],["audiocontext-state", +e=>this._OnAudioContextStateChanged(e)],["fxstate",e=>this._OnUpdateFxState(e)],["trigger",e=>this._OnTrigger(e)],["buffer-metadata",e=>this._OnBufferMetadata(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context", +{"preloadList":this._runtime.GetAssetManager().GetAudioToPreload().map(o=>({"originalUrl":o.originalUrl,"url":o.url,"type":o.type,"fileSize":o.fileSize})),"isiOSCordova":this._runtime.IsiOSCordova(),"isSafari":C3.Platform.Browser==="Safari","timeScaleMode":this._timeScaleMode,"latencyHint":latencyHint,"panningModel":this._panningModel,"distanceModel":this._distanceModel,"refDistance":this._referenceDistance,"maxDistance":this._maxDistance,"rolloffFactor":this._rolloffFactor,"listenerPos":this._listenerPos}).then(info=> +{this._sampleRate=info["sampleRate"];this._audioContextState=info["audioContextState"];this._outputLatency=info["outputLatency"]}));this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_SplitTags(tagStr){if(this._enableMultiTags)return tagStr.split(" ").filter(s=>!!s);else return tagStr?[tagStr]:[]}_MatchTagLists(tagArr1,tagArr2){for(const t2 of tagArr2){let found=false;for(const t1 of tagArr1)if(C3.equalsNoCase(t1,t2)){found=true;break}if(!found)return false}return true}_MatchTagListToStr(tagArr, +tagStr){return this._MatchTagLists(tagArr,this._SplitTags(tagStr))}_AddActionPromise(promise){this.GetPlugin()._AddActionPromise(promise)}_OnInstanceDestroyed(inst){if(this._listenerInst===inst)this._listenerInst=null}DbToLinearNoCap(x){return Math.pow(10,x/20)}DbToLinear(x){const v=this.DbToLinearNoCap(x);if(!isFinite(v))return 0;return Math.max(Math.min(v,1),0)}LinearToDbNoCap(x){return Math.log(x)/Math.log(10)*20}LinearToDb(x){return this.LinearToDbNoCap(Math.max(Math.min(x,1),0))}_OnSuspend(){if(this._playInBackground)return; +this.PostToDOM("set-suspended",{"isSuspended":true})}_OnResume(){if(this._playInBackground)return;this.PostToDOM("set-suspended",{"isSuspended":false})}_OnUpdateState(e){const tickCount=e["tickCount"];this._outputLatency=e["outputLatency"];const preservePlaceholders=this._lastAIState.filter(ai=>ai.hasOwnProperty("placeholder")&&(ai["placeholder"]>tickCount||ai["placeholder"]===-1));this._lastAIState=e["audioInstances"];this._lastAnalysersData=e["analysers"];if(preservePlaceholders.length>0)C3.appendArray(this._lastAIState, +preservePlaceholders)}_OnBufferMetadata(e){this._bufferMetadata.set(e["originalUrl"],{duration:e["duration"]})}_OnAudioContextStateChanged(e){this._audioContextState=e["audioContextState"]}GetAudioContextState(){if(this._runtime.IsExportToVideo())return"running";else return this._audioContextState}_OnUpdateFxState(e){this._lastFxState=e["fxstate"]}_GetFirstAudioStateByTags(tagStr){const tagArr=this._SplitTags(tagStr);for(const a of this._lastAIState)if(this._MatchTagLists(a["tags"],tagArr))return a; +return null}_IsTagPlaying(tagStr){const tagArr=this._SplitTags(tagStr);return this._lastAIState.some(ai=>this._MatchTagLists(ai["tags"],tagArr)&&ai["isPlaying"])}_MaybeMarkAsPlaying(originalUrl,tagStr,isMusic,isLooping,vol){if(this._IsTagPlaying(tagStr))return null;const bufferMeta=this._bufferMetadata.get(originalUrl);const state={"tags":this._SplitTags(tagStr),"duration":bufferMeta?bufferMeta.duration:0,"volume":vol,"isPlaying":true,"playbackTime":0,"playbackRate":1,"uid":-1,"bufferOriginalUrl":originalUrl, +"bufferUrl":"","bufferType":"","isMusic":isMusic,"isLooping":isLooping,"isMuted":false,"resumePosition":0,"pan":null,"placeholder":-1};this._lastAIState.push(state);return state}async _OnTrigger(e){const type=e["type"];this._triggerTags=e["tags"];const aiId=e["aiid"];if(type==="ended"){for(const aiState of this._lastAIState)if(aiState["aiid"]===aiId){aiState["isPlaying"]=false;break}await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnEnded)}else if(type==="fade-ended")await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnFadeEnded)}_MatchTriggerTag(tagStr){return this._MatchTagListToStr(this._triggerTags, +tagStr)}Tick(){const o={"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTimeRaw(),"instPans":this.GetInstancePans(),"tickCount":this._runtime.GetTickCountNoSave()};if(this._listenerInst){const wi=this._listenerInst.GetWorldInfo();this._listenerPos[0]=wi.GetX();this._listenerPos[1]=wi.GetY();o["listenerPos"]=this._listenerPos;o["listenerOrientation"]=[...this._listenerForwardVec,...this._listenerUpVec]}this.PostToDOM("tick",o)}rotatePtAround(px,py,a,ox,oy){if(a===0)return[px, +py];const sin_a=Math.sin(a);const cos_a=Math.cos(a);px-=ox;py-=oy;const left_sin_a=px*sin_a;const top_sin_a=py*sin_a;const left_cos_a=px*cos_a;const top_cos_a=py*cos_a;px=left_cos_a-top_sin_a;py=top_cos_a+left_sin_a;px+=ox;py+=oy;return[px,py]}GetInstancePans(){return this._lastAIState.filter(ai=>ai["uid"]!==-1).map(ai=>this._runtime.GetInstanceByUID(ai["uid"])).filter(inst=>inst).map(inst=>{const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(), +wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);return{"uid":inst.GetUID(),"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()-layerAngle}})}GetAnalyserData(tagStr,index){for(const o of this._lastAnalysersData)if(o.index===index&&C3.equalsNoCase(o["tag"],tagStr))return o;return null}_IncrementEffectCount(tagStr){for(const tag of this._SplitTags(tagStr)){const lowerTag=tag.toLowerCase();this._effectCount.set(lowerTag,(this._effectCount.get(lowerTag)||0)+1)}}_ShouldSave(ai){if(ai.hasOwnProperty("placeholder"))return false; +if(this._saveLoadMode===3)return false;else if(ai["isMusic"]&&this._saveLoadMode===1)return false;else if(!ai["isMusic"]&&this._saveLoadMode===2)return false;else return true}SaveToJson(){return{"isSilent":this._isSilent,"masterVolume":this._masterVolume,"listenerZ":this._listenerPos[2],"listenerForwardVec":this._listenerForwardVec,"listenerUpVec":this._listenerUpVec,"listenerUid":this._listenerInst?this._listenerInst.GetUID():-1,"remoteUrls":[...this._remoteUrls.entries()],"playing":this._lastAIState.filter(ai=> +this._ShouldSave(ai)),"effects":this._lastFxState,"analysers":this._lastAnalysersData}}LoadFromJson(o){this._isSilent=o["isSilent"];this._masterVolume=o["masterVolume"];this._listenerPos[2]=o["listenerZ"];this._listenerInst=null;this._loadListenerUid=o["listenerUid"];if(o.hasOwnProperty("listenerForwardVec"))this._listenerForwardVec=o["listenerForwardVec"];else this._listenerForwardVec=[0,0,-1];if(o.hasOwnProperty("listenerUpVec"))this._listenerUpVec=o["listenerUpVec"];else this._listenerUpVec=[0, +1,0];this._remoteUrls.clear();if(o["remoteUrls"])for(const [k,v]of o["remoteUrls"])this._remoteUrls.set(k,v);this._lastAIState=o["playing"];for(const a of this._lastAIState)if(a.hasOwnProperty("tag")&&!a.hasOwnProperty("tags"))a["tags"]=[a["tag"]].filter(s=>!!s);this._lastFxState=o["effects"];this._lastAnalysersData=o["analysers"]}_OnAfterLoad(){if(this._loadListenerUid!==-1){this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid);this._loadListenerUid=-1;if(this._listenerInst){const wi= +this._listenerInst.GetWorldInfo();this._listenerPos[0]=wi.GetX();this._listenerPos[1]=wi.GetY()}}for(const ai of this._lastAIState){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(ai["bufferOriginalUrl"]);if(info){ai["bufferUrl"]=info.url;ai["bufferType"]=info.type}else ai["bufferUrl"]=null}for(const fxChainData of Object.values(this._lastFxState))for(const fxData of fxChainData)if(fxData.hasOwnProperty("bufferOriginalUrl")){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(fxData["bufferOriginalUrl"]); +if(info){fxData["bufferUrl"]=info.url;fxData["bufferType"]=info.type}}this.PostToDOM("load-state",{"saveLoadMode":this._saveLoadMode,"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTimeRaw(),"listenerPos":this._listenerPos,"listenerOrientation":[...this._listenerForwardVec,...this._listenerUpVec],"isSilent":this._isSilent,"masterVolume":this._masterVolume,"playing":this._lastAIState.filter(ai=>ai["bufferUrl"]!==null),"effects":this._lastFxState})}GetDebuggerProperties(){const fxProps= +[];for(const [tag,fxChainData]of Object.entries(this._lastFxState))fxProps.push({name:"$"+tag,value:fxChainData.map(d=>d["type"]).join(", ")});const prefix="plugins.audio.debugger";return[{title:prefix+".tag-effects",properties:fxProps},{title:prefix+".currently-playing",properties:[{name:prefix+".currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((s,index)=>({name:"$#"+index,value:`${s["bufferOriginalUrl"]} ("${s["tags"]}") ${Math.round(s["playbackTime"]*10)/10} / ${Math.round(s["duration"]* +10)/10}`}))]}]}}}{const C3=self.C3;C3.Plugins.Audio.Cnds={OnEnded(tagStr){return this._MatchTriggerTag(tagStr)},OnFadeEnded(tagStr){return this._MatchTriggerTag(tagStr)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return true},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const ai of this._lastAIState)if(ai["isPlaying"])return true;return false},IsTagPlaying(tagStr){return this._IsTagPlaying(tagStr)}}} +{const C3=self.C3;const FILTER_TYPES=["lowpass","highpass","bandpass","lowshelf","highshelf","peaking","notch","allpass"];C3.Plugins.Audio.Acts={Play(file,looping,vol,stereoPan,tagStr){const ret=C3.Plugins.Audio.Acts._DoPlay.call(this,file,looping,vol,stereoPan,tagStr);this._AddActionPromise(ret);return ret},PlayFromTimeline(file,vol,tagStr,startOffset){C3.Plugins.Audio.Acts._DoPlay.call(this,file,0,vol,0,tagStr,startOffset)},async _DoPlay(file,looping,vol,stereoPan,tagStr,startOffset){if(this._isSilent)return; +const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":startOffset|| +0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtPosition(file,looping,vol,x,y,z,angle,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!== +0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":z,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]= +this._runtime.GetTickCountNoSave()}},async PlayAtObject(file,looping,vol,objectClass,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]); +if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()- +layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayByName(folder,filename,looping,vol,stereoPan,tagStr){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime; +this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}}, +async PlayAtPositionByName(folder,filename,looping,vol,x,y,z,angle,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename, +"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":z,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtObjectByName(folder,filename, +looping,vol,objectClass,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;if(this._isSilent)return;if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase()); +if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()- +layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},SetLooping(tagStr,looping){this.PostToDOM("set-looping",{"tags":this._SplitTags(tagStr),"isLooping":looping===0})},SetMuted(tagStr,muted){this.PostToDOM("set-muted",{"tags":this._SplitTags(tagStr),"isMuted":muted===0})},SetVolume(tagStr,vol){this.PostToDOM("set-volume",{"tags":this._SplitTags(tagStr), +"vol":this.DbToLinear(vol)})},FadeVolume(tagStr,vol,duration,ending){this.PostToDOM("fade-volume",{"tags":this._SplitTags(tagStr),"vol":this.DbToLinear(vol),"duration":duration,"stopOnEnd":ending===0})},SetStereoPan(tagStr,p){this.PostToDOM("set-stereo-pan",{"tags":this._SplitTags(tagStr),"p":C3.clamp(p/100,-1,1)})},async Preload(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload", +{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},async PreloadByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},SetPlaybackRate(tagStr,rate){this.PostToDOM("set-playback-rate", +{"tags":this._SplitTags(tagStr),"rate":Math.max(rate,0)})},Stop(tagStr){this.PostToDOM("stop",{"tags":this._SplitTags(tagStr)})},StopAll(){this.PostToDOM("stop-all")},SetPaused(tagStr,state){this.PostToDOM("set-paused",{"tags":this._SplitTags(tagStr),"paused":state===0})},Seek(tagStr,pos){this.PostToDOM("seek",{"tags":this._SplitTags(tagStr),"pos":pos})},SetSilent(s){if(s===2)s=this._isSilent?1:0;s=s===0;if(this._isSilent===s)return;this._isSilent=s;this.PostToDOM("set-silent",{"isSilent":s})},SetMasterVolume(vol){const mv= +this.DbToLinear(vol);if(this._masterVolume===mv)return;this._masterVolume=mv;this.PostToDOM("set-master-volume",{"vol":mv})},AddFilterEffect(tagStr,type,freq,detune,q,gain,mix){const typeStr=FILTER_TYPES[type];this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"filter","tags":this._SplitTags(tagStr),"params":[typeStr,freq,detune,q,gain,C3.clamp(mix/100,0,1)]})},AddDelayEffect(tagStr,delay,gain,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"delay", +"tags":this._SplitTags(tagStr),"params":[delay,this.DbToLinear(gain),C3.clamp(mix/100,0,1)]})},AddFlangerEffect(tagStr,delay,modulation,freq,feedback,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"flanger","tags":this._SplitTags(tagStr),"params":[delay/1E3,modulation/1E3,freq,feedback/100,C3.clamp(mix/100,0,1)]})},AddPhaserEffect(tagStr,freq,detune,q,mod,modfreq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"phaser","tags":this._SplitTags(tagStr), +"params":[freq,detune,q,mod,modfreq,C3.clamp(mix/100,0,1)]})},AddConvolutionEffect(tagStr,file,norm,mix){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"convolution","tags":this._SplitTags(tagStr),"bufferOriginalUrl":file[0],"bufferUrl":info.url,"bufferType":info.type,"params":[norm===0,C3.clamp(mix/100,0,1)]})},AddGainEffect(tagStr,g){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect", +{"type":"gain","tags":this._SplitTags(tagStr),"params":[this.DbToLinear(g)]})},AddStereoPanEffect(tagStr,g){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"stereopan","tags":this._SplitTags(tagStr),"params":[C3.clamp(g/100,-1,1)]})},AddMuteEffect(tagStr){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"gain","tags":this._SplitTags(tagStr),"params":[0]})},AddTremoloEffect(tagStr,freq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect", +{"type":"tremolo","tags":this._SplitTags(tagStr),"params":[freq,C3.clamp(mix/100,0,1)]})},AddRingModEffect(tagStr,freq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"ringmod","tags":this._SplitTags(tagStr),"params":[freq,C3.clamp(mix/100,0,1)]})},AddDistortionEffect(tagStr,threshold,headroom,drive,makeupgain,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"distortion","tags":this._SplitTags(tagStr),"params":[this.DbToLinearNoCap(threshold), +this.DbToLinearNoCap(headroom),drive,this.DbToLinearNoCap(makeupgain),C3.clamp(mix/100,0,1)]})},AddCompressorEffect(tagStr,threshold,knee,ratio,attack,release){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"compressor","tags":this._SplitTags(tagStr),"params":[threshold,knee,ratio,attack/1E3,release/1E3]})},AddAnalyserEffect(tagStr,fftSize,smoothing){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"analyser","tags":this._SplitTags(tagStr),"params":[fftSize, +smoothing]})},RemoveEffects(tagStr){const tagArr=this._SplitTags(tagStr);for(const tag of tagArr)this._effectCount.set(tag.toLowerCase(),0);this.PostToDOM("remove-effects",{"tags":tagArr});this._lastFxState={}},SetEffectParameter(tagStr,index,param,value,ramp,time){this.PostToDOM("set-effect-param",{"tags":this._SplitTags(tagStr),"index":Math.floor(index),"param":param,"value":value,"ramp":ramp,"time":time})},SetListenerObject(objectClass){if(!objectClass)return;const inst=objectClass.GetFirstPicked(); +if(!inst||!inst.GetWorldInfo())return;this._listenerInst=inst},SetListenerZ(z){this._listenerPos[2]=z},SetListenerOrientation(fx,fy,fz,ux,uy,uz){this._listenerForwardVec[0]=fx;this._listenerForwardVec[1]=fy;this._listenerForwardVec[2]=-fz;this._listenerUpVec[0]=ux;this._listenerUpVec[1]=uy;this._listenerUpVec[2]=-uz},ScheduleNextPlay(t){this._nextPlayTime=Math.max(t,0)},UnloadAudio(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return; +this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAudioByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(url,type,name){this._remoteUrls.set(name.toLowerCase(),{url,type})}}} +{const C3=self.C3;C3.Plugins.Audio.Exps={Duration(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["duration"]:0},PlaybackTime(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["playbackTime"]:0},PlaybackRate(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["playbackRate"]:0},Volume(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?this.LinearToDb(a["volume"]):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(tag){return this._effectCount.get(tag.toLowerCase())|| +0},AnalyserFreqBinCount(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index));return o?o["binCount"]:0},AnalyserFreqBinAt(tagStr,index,bin){const o=this.GetAnalyserData(tagStr,Math.floor(index));if(!o)return 0;bin=Math.floor(bin);if(bin<0||bin>=o["binCount"])return 0;return o["freqBins"][bin]},AnalyserPeakLevel(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index));return o?o["peak"]:0},AnalyserRMSLevel(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index)); +return o?o["rms"]:0},SampleRate(){return this._sampleRate},CurrentTime(){if(self["C3_GetAudioContextCurrentTime"])return self["C3_GetAudioContextCurrentTime"]();else return performance.now()/1E3},OutputLatency(){return this._outputLatency}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.TiledBg=class TiledBgPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;function WrapModeToStr(wrapMode){switch(wrapMode){case 0:return"clamp-to-edge";case 1:return"repeat";case 2:return"mirror-repeat"}return"repeat"}C3.Plugins.TiledBg.Type=class TiledBgType extends C3.SDKTypeBase{constructor(objectClass,exportData){super(objectClass);this._wrapX="repeat";this._wrapY="repeat";if(exportData){this._wrapX=WrapModeToStr(exportData[0]);this._wrapY=WrapModeToStr(exportData[1])}}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer, +{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const ORIGIN=1;const IMAGE_OFFSET_X=4;const IMAGE_OFFSET_Y=5;const IMAGE_SCALE_X=6;const IMAGE_SCALE_Y=7;const IMAGE_ANGLE=8;const ENABLE_TILE_RANDOMIZATION=9;const TILE_XRANDOM=10;const TILE_YRANDOM=11;const TILE_ANGLERANDOM=12;const TILE_BLENDMARGINX=13;const TILE_BLENDMARGINY=14;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const rcTex=C3.New(C3.Rect);const qTex=C3.New(C3.Quad);C3.Plugins.TiledBg.Instance=class TiledBgInstance extends C3.SDKWorldInstanceBase{constructor(inst, +properties){super(inst);this._imageOffsetX=0;this._imageOffsetY=0;this._imageScaleX=1;this._imageScaleY=1;this._imageAngle=0;this._enableTileRandomization=false;this._tileXRandom=0;this._tileYRandom=0;this._tileAngleRandom=0;this._tileBlendMarginX=0;this._tileBlendMarginY=0;this._ownImageInfo=null;if(properties){this.GetWorldInfo().SetVisible(!!properties[INITIALLY_VISIBLE]);this._imageOffsetX=properties[IMAGE_OFFSET_X];this._imageOffsetY=properties[IMAGE_OFFSET_Y];this._imageScaleX=properties[IMAGE_SCALE_X]; +this._imageScaleY=properties[IMAGE_SCALE_Y];this._imageAngle=C3.toRadians(properties[IMAGE_ANGLE]);this._enableTileRandomization=!!properties[ENABLE_TILE_RANDOMIZATION];this._tileXRandom=properties[TILE_XRANDOM];this._tileYRandom=properties[TILE_YRANDOM];this._tileAngleRandom=properties[TILE_ANGLERANDOM];this._tileBlendMarginX=properties[TILE_BLENDMARGINX];this._tileBlendMarginY=properties[TILE_BLENDMARGINY]}}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){if(this._ownImageInfo){this._ownImageInfo.Release(); +this._ownImageInfo=null}}CalculateTextureCoordsFor3DFace(areaWidth,areaHeight,outQuad){const imageInfo=this.GetCurrentImageInfo();const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const imageAngle=this._imageAngle;rcTex.set(0,0,areaWidth/(imageWidth*this._imageScaleX),areaHeight/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(imageAngle===0)outQuad.setFromRect(rcTex); +else outQuad.setFromRotatedRect(rcTex,-imageAngle)}SetTilingShaderProgram(renderer){if(this._enableTileRandomization){const imageInfo=this.GetCurrentImageInfo();renderer.SetTileRandomizationMode();renderer.SetTileRandomizationInfo(imageInfo.GetWidth()*this._imageScaleX,imageInfo.GetHeight()*this._imageScaleY,this._tileXRandom,this._tileYRandom,this._tileAngleRandom,this._tileBlendMarginX,this._tileBlendMarginY)}else renderer.SetTextureFillMode()}Draw(renderer){const imageInfo=this.GetCurrentImageInfo(); +const texture=imageInfo.GetTexture();if(texture===null)return;this.SetTilingShaderProgram(renderer);renderer.SetTexture(texture);const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const wi=this.GetWorldInfo();rcTex.set(0,0,wi.GetWidth()/(imageWidth*this._imageScaleX),wi.GetHeight()/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(wi.HasMesh())this._DrawMesh(wi, +renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=wi.GetBoundingQuad();if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);if(this._imageAngle===0)renderer.Quad3(quad,rcTex);else{qTex.setFromRotatedRect(rcTex,-this._imageAngle);renderer.Quad4(quad,qTex)}}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad;if(this._runtime.IsPixelRoundingEnabled())quad= +wi.PixelRoundQuad(quad);let texCoords=rcTex;if(this._imageAngle!==0){qTex.setFromRotatedRect(rcTex,-this._imageAngle);texCoords=qTex}transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,texCoords);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return true}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(true)}_SetImageOffsetX(x){if(this._imageOffsetX=== +x)return;this._imageOffsetX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(y){if(this._imageOffsetY===y)return;this._imageOffsetY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(x){if(this._imageScaleX===x)return;this._imageScaleX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(y){if(this._imageScaleY=== +y)return;this._imageScaleY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(a){if(this._imageAngle===a)return;this._imageAngle=a;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageAngle(){return this._imageAngle}_SetTileRandomizationEnabled(e){e=!!e;if(this._enableTileRandomization===e)return;this._enableTileRandomization=e;this._runtime.UpdateRender()}_IsTileRandomizationEnabled(){return this._enableTileRandomization}_SetTileXRandom(x){if(this._tileXRandom=== +x)return;this._tileXRandom=x;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileXRandom(){return this._tileXRandom}_SetTileYRandom(y){if(this._tileYRandom===y)return;this._tileYRandom=y;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileYRandom(){return this._tileYRandom}_SetTileAngleRandom(a){if(this._tileAngleRandom===a)return;this._tileAngleRandom=a;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileAngleRandom(){return this._tileAngleRandom}_SetTileBlendMarginX(x){if(this._tileBlendMarginX=== +x)return;this._tileBlendMarginX=x;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileBlendMarginX(){return this._tileBlendMarginX}_SetTileBlendMarginY(y){if(this._tileBlendMarginY===y)return;this._tileBlendMarginY=y;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileBlendMarginY(){return this._tileBlendMarginY}GetDebuggerProperties(){const propsPrefix="plugins.tiledbg.properties";return[{title:propsPrefix+".image-transform.name",properties:[{name:propsPrefix+ +".image-offset-x.name",value:this._GetImageOffsetX(),onedit:v=>this._SetImageOffsetX(v)},{name:propsPrefix+".image-offset-y.name",value:this._GetImageOffsetY(),onedit:v=>this._SetImageOffsetY(v)},{name:propsPrefix+".image-scale-x.name",value:this._GetImageScaleX()*100,onedit:v=>this._SetImageScaleX(v/100)},{name:propsPrefix+".image-scale-y.name",value:this._GetImageScaleY()*100,onedit:v=>this._SetImageScaleY(v/100)},{name:propsPrefix+".image-angle.name",value:C3.toDegrees(this._GetImageAngle()),onedit:v=> +this._SetImageAngle(C3.toRadians(v))}]},{title:propsPrefix+".tile-randomization.name",properties:[{name:propsPrefix+".enable-tile-randomization.name",value:this._IsTileRandomizationEnabled(),onedit:v=>this._SetTileRandomizationEnabled(v)},{name:propsPrefix+".x-random.name",value:this._GetTileXRandom()*100,onedit:v=>this._SetTileXRandom(v/100)},{name:propsPrefix+".y-random.name",value:this._GetTileYRandom()*100,onedit:v=>this._SetTileYRandom(v/100)},{name:propsPrefix+".angle-random.name",value:this._GetTileAngleRandom()* +100,onedit:v=>this._SetTileAngleRandom(v/100)},{name:propsPrefix+".blend-margin-x.name",value:this._GetTileBlendMarginX()*100,onedit:v=>this._SetTileBlendMarginX(v/100)},{name:propsPrefix+".blend-margin-y.name",value:this._GetTileBlendMarginY()*100,onedit:v=>this._SetTileBlendMarginY(v/100)}]}]}GetPropertyValueByIndex(index){switch(index){case IMAGE_OFFSET_X:return this._GetImageOffsetX();case IMAGE_OFFSET_Y:return this._GetImageOffsetY();case IMAGE_SCALE_X:return this._GetImageScaleX();case IMAGE_SCALE_Y:return this._GetImageScaleY(); +case IMAGE_ANGLE:return this._GetImageAngle();case ENABLE_TILE_RANDOMIZATION:return this._IsTileRandomizationEnabled();case TILE_XRANDOM:return this._GetTileXRandom();case TILE_YRANDOM:return this._GetTileYRandom();case TILE_ANGLERANDOM:return this._GetTileAngleRandom();case TILE_BLENDMARGINX:return this._GetTileBlendMarginX();case TILE_BLENDMARGINY:return this._GetTileBlendMarginY()}}SetPropertyValueByIndex(index,value){switch(index){case IMAGE_OFFSET_X:this._SetImageOffsetX(value);break;case IMAGE_OFFSET_Y:this._SetImageOffsetY(value); +break;case IMAGE_SCALE_X:this._SetImageScaleX(value);break;case IMAGE_SCALE_Y:this._SetImageScaleY(value);break;case IMAGE_ANGLE:this._SetImageAngle(value);break;case ENABLE_TILE_RANDOMIZATION:this._SetTileRandomizationEnabled(!!value);break;case TILE_XRANDOM:this._SetTileXRandom(value);break;case TILE_YRANDOM:this._SetTileYRandom(value);break;case TILE_ANGLERANDOM:this._SetTileAngleRandom(value);break;case TILE_BLENDMARGINX:this._SetTileBlendMarginX(value);break;case TILE_BLENDMARGINY:this._SetTileBlendMarginY(value); +break}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const map=new WeakMap;self.ITiledBackgroundInstance=class ITiledBackgroundInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageOffsetX(x)}get imageOffsetX(){return map.get(this)._GetImageOffsetX()}set imageOffsetY(y){C3X.RequireFiniteNumber(y);map.get(this)._SetImageOffsetY(y)}get imageOffsetY(){return map.get(this)._GetImageOffsetY()}setImageOffset(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetImageOffsetX(x);inst._SetImageOffsetY(y)}getImageOffset(){const inst=map.get(this);return[inst._GetImageOffsetX(),inst._GetImageOffsetY()]}set imageScaleX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageScaleX(x)}get imageScaleX(){return map.get(this)._GetImageScaleX()}set imageScaleY(y){C3X.RequireFiniteNumber(y);map.get(this)._SetImageScaleY(y)}get imageScaleY(){return map.get(this)._GetImageScaleY()}setImageScale(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetImageScaleX(x);inst._SetImageScaleY(y)}getImageScale(){const inst=map.get(this);return[inst._GetImageScaleX(),inst._GetImageScaleY()]}set imageAngle(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(a)}get imageAngle(){return map.get(this)._GetImageAngle()}set imageAngleDegrees(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(C3.toRadians(a))}get imageAngleDegrees(){return C3.toDegrees(map.get(this)._GetImageAngle())}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}getImageSize(){const imageInfo= +map.get(this).GetCurrentImageInfo();return[imageInfo.GetWidth(),imageInfo.GetHeight()]}set enableTileRandomization(e){map.get(this)._SetTileRandomizationEnabled(!!e)}get enableTileRandomization(){return map.get(this)._IsTileRandomizationEnabled()}set tileXRandom(x){C3X.RequireFiniteNumber(x);map.get(this)._SetTileXRandom(x)}get tileXRandom(){return map.get(this)._GetTileXRandom()}set tileYRandom(y){C3X.RequireFiniteNumber(y);map.get(this)._SetTileYRandom(y)}get tileYRandom(){return map.get(this)._GetTileYRandom()}setTileRandom(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetTileXRandom(x);inst._SetTileYRandom(y)}getTileRandom(){const inst=map.get(this);return[inst._GetTileXRandom(),inst._GetTileYRandom()]}set tileAngleRandom(a){C3X.RequireFiniteNumber(a);map.get(this)._SetTileAngleRandom(a)}get tileAngleRandom(){return map.get(this)._GetTileAngleRandom()}set tileBlendMarginX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetTileBlendMarginX(x)}get tileBlendMarginX(){return map.get(this)._GetTileBlendMarginX()}set tileBlendMarginY(y){C3X.RequireFiniteNumber(y); +map.get(this)._SetTileBlendMarginY(y)}get tileBlendMarginY(){return map.get(this)._GetTileBlendMarginY()}setTileBlendMargin(x,y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetTileBlendMarginX(x);inst._SetTileBlendMarginY(y)}getTileBlendMargin(){const inst=map.get(this);return[inst._GetTileBlendMarginX(),inst._GetTileBlendMarginY()]}async replaceImage(blob){C3X.RequireInstanceOf(blob,Blob);const sdkInst=map.get(this);const runtime=sdkInst.GetRuntime();const imageInfo= +C3.New(C3.ImageInfo);imageInfo.LoadDynamicBlobAsset(runtime,blob);await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"});if(sdkInst.WasReleased()){imageInfo.Release();return}sdkInst._ReleaseOwnImage();sdkInst._ownImageInfo=imageInfo;runtime.UpdateRender()}}}{const C3=self.C3;C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return true},OnURLFailed(){return true},IsTileRandomizationEnabled(){return this._IsTileRandomizationEnabled()}}} +{const C3=self.C3;C3.Plugins.TiledBg.Acts={SetImageOffsetX(x){this._SetImageOffsetX(x)},SetImageOffsetY(y){this._SetImageOffsetY(y)},SetImageScaleX(x){this._SetImageScaleX(x/100)},SetImageScaleY(y){this._SetImageScaleY(y/100)},SetImageAngle(a){this._SetImageAngle(C3.toRadians(a))},SetTileRandomizationEnabled(e){this._SetTileRandomizationEnabled(e)},SetTilePosRandom(x,y){this._SetTileXRandom(x/100);this._SetTileYRandom(y/100)},SetTileAngleRandom(a){this._SetTileAngleRandom(a/100)},SetTileBlendMargin(x, +y){this._SetTileBlendMarginX(x/100);this._SetTileBlendMarginY(y/100)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},async LoadURL(url,crossOrigin){if(this._ownImageInfo&&this._ownImageInfo.GetURL()===url)return;const runtime=this._runtime;const imageInfo=C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");if(this.WasReleased()){imageInfo.Release();return null}const texture= +await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"});if(!texture)return}catch(err){console.error("Load image from URL failed: ",err);if(!this.WasReleased())this.Trigger(C3.Plugins.TiledBg.Cnds.OnURLFailed);return}if(this.WasReleased()){imageInfo.Release();return}this._ReleaseOwnImage();this._ownImageInfo=imageInfo;runtime.UpdateRender();await this.TriggerAsync(C3.Plugins.TiledBg.Cnds.OnURLLoaded)}}} +{const C3=self.C3;C3.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return this._imageScaleX*100},ImageScaleY(){return this._imageScaleY*100},ImageAngle(){return C3.toDegrees(this._imageAngle)},TileXRandom(){return this._GetTileXRandom()*100},TileYRandom(){return this._GetTileYRandom()*100},TileAngleRandom(){return this._GetTileAngleRandom()* +100},TileBlendMarginX(){return this._GetTileBlendMarginX()*100},TileBlendMarginY(){return this._GetTileBlendMarginY()*100}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Spritefont2=class SpriteFontPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Type=class SpriteFontType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass);this._spriteFont=C3.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(characterWidth,characterHeight, +characterSet,spacingData){const imageInfo=this.GetImageInfo();const sf=this._spriteFont;sf.SetWidth(imageInfo.GetWidth());sf.SetHeight(imageInfo.GetHeight());sf.SetCharacterWidth(characterWidth);sf.SetCharacterHeight(characterHeight);sf.SetCharacterSet(characterSet);sf.SetSpacingData(spacingData);sf.UpdateCharacterMap()}}} +{const C3=self.C3;const C3X=self.C3X;const tempVec2=C3.New(C3.Vector2);const TEXT=0;const ENABLE_BBCODE=1;const CHARACTER_WIDTH=2;const CHARACTER_HEIGHT=3;const CHARACTER_SET=4;const SPACING_DATA=5;const SCALE=6;const CHARACTER_SPACING=7;const LINE_HEIGHT=8;const HORIZONTAL_ALIGNMENT=9;const VERTICAL_ALIGNMENT=10;const WRAPPING=11;const INITIALLY_VISIBLE=12;const ORIGIN=13;const READ_ALOUD=14;const HORIZONTAL_ALIGNMENTS=["left","center","right"];const VERTICAL_ALIGNMENTS=["top","center","bottom"]; +const WORD_WRAP=0;const CHARACTER_WRAP=1;C3.Plugins.Spritefont2.Instance=class SpriteFontInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._text="";this._enableBBcode=true;this._characterWidth=16;this._characterHeight=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";let spacingData="";this._characterScale=1;this._characterSpacing=0;this._lineHeight=0;this._horizontalAlign=0;this._verticalAlign= +0;this._wrapByWord=true;this._needsTextLayout=true;this._readAloud=false;this._screenReaderText=null;this._spriteFontText=null;this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;if(properties){this._text=properties[0];this._enableBBcode=properties[1];this._characterWidth=properties[2];this._characterHeight=properties[3];this._characterSet=properties[4];spacingData=properties[5];this._characterScale=properties[6];this._characterSpacing=properties[7];this._lineHeight=properties[8]; +this._horizontalAlign=properties[9];this._verticalAlign=properties[10];this._wrapByWord=properties[11]===0;const wi=this.GetWorldInfo();wi.SetVisible(properties[12]);this._readAloud=!!properties[READ_ALOUD]}this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,this._characterSet,spacingData);this._spriteFontText=C3.New(self.SpriteFontText,this._sdkType.GetSpriteFont());const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._UpdateSettings(); +this._UpdateScreenReaderText();this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();if(this._screenReaderText){this._screenReaderText.Release();this._screenReaderText=null}this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const sft=this._spriteFontText;if(!sft)return;sft.SetBBCodeEnabled(this._enableBBcode);sft.SetText(this._text);sft.SetWordWrapMode(this._wrapByWord?"word":"character");sft.SetHorizontalAlign(HORIZONTAL_ALIGNMENTS[this._horizontalAlign]); +sft.SetVerticalAlign(VERTICAL_ALIGNMENTS[this._verticalAlign]);sft.SetSpacing(this._characterSpacing);sft.SetLineHeight(this._lineHeight)}_UpdateTextSize(){const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._spriteFontText.SetScale(this._characterScale)}_UpdateTextLayout(){this._UpdateTextSize();this._spriteFontText._MaybeWrapText();if(this._needsTextLayout)this.Draw(null)}_UpdateScreenReaderText(){if(this._readAloud){let text=this._text;if(this._enableBBcode)text= +C3.BBString.StripAnyTags(text);if(this._screenReaderText)this._screenReaderText.SetText(text);else this._screenReaderText=C3.New(C3.ScreenReaderText,this._runtime,text)}else if(this._screenReaderText){this._screenReaderText.Release();this._screenReaderText=null}}Draw(renderer){const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;if(renderer)renderer.SetTexture(texture);const wi=this.GetWorldInfo();let q=wi.GetBoundingQuad();const sft=this._spriteFontText; +sft.SetScale(this._characterScale);sft.SetSceneGraphScale(wi.GetSceneGraphScale());if(this._runtime.IsPixelRoundingEnabled())q=wi.PixelRoundQuad(q);sft.SetSize(wi.GetWidth(),wi.GetHeight());sft.GetSpriteFont().SetTexRect(imageInfo.GetTexRect());sft.SetColor(wi.GetUnpremultipliedColor());sft.Draw(renderer,q.getTlx(),q.getTly(),wi.GetAngle());this._needsTextLayout=false}SaveToJson(){const ret={"t":this._text,"ebbc":this._enableBBcode,"csc":this._characterScale,"csp":this._characterSpacing,"lh":this._lineHeight, +"ha":this._horizontalAlign,"va":this._verticalAlign,"w":this._wrapByWord,"cw":this._sdkType.GetSpriteFont().GetCharacterWidth(),"ch":this._sdkType.GetSpriteFont().GetCharacterHeight(),"cs":this._sdkType.GetSpriteFont().GetCharacterSet(),"sd":this._sdkType.GetSpriteFont().GetSpacingData()};if(this._typewriterEndTime!==-1)ret["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime,"l":this._typewriterLength};return ret}LoadFromJson(o){this._CancelTypewriter();this._text=o["t"];this._enableBBcode= +o["ebbc"];this._characterScale=o["csc"];this._characterSpacing=o["csp"];this._lineHeight=o["lh"];this._horizontalAlign=o["ha"];this._verticalAlign=o["va"];this._wrapByWord=o["w"];if(o.hasOwnProperty("tw")){const tw=o["tw"];this._typewriterStartTime=tw["st"];this._typewriterEndTime=tw["en"];this._typewriterLength=o["l"]}const spriteFont=this._sdkType.GetSpriteFont();spriteFont.SetCharacterWidth(o["cw"]);spriteFont.SetCharacterHeight(o["ch"]);spriteFont.SetCharacterSet(o["cs"]);spriteFont.SetSpacingData(o["sd"]); +this._UpdateSettings();this._UpdateScreenReaderText();if(this._typewriterEndTime!==-1)this._StartTicking()}GetPropertyValueByIndex(index){switch(index){case TEXT:return this.GetText();case ENABLE_BBCODE:return this._enableBBcode;case CHARACTER_WIDTH:return this._sdkType.GetSpriteFont().GetCharacterWidth();case CHARACTER_HEIGHT:return this._sdkType.GetSpriteFont().GetCharacterHeight();case CHARACTER_SET:return this._sdkType.GetSpriteFont().GetCharacterSet();case SPACING_DATA:return this._sdkType.GetSpriteFont().GetSpacingData(); +case SCALE:return this._GetScale();case CHARACTER_SPACING:return this._GetCharacterSpacing();case LINE_HEIGHT:return this._GetLineHeight();case HORIZONTAL_ALIGNMENT:return this._GetHAlign();case VERTICAL_ALIGNMENT:return this._GetVAlign();case WRAPPING:return this._IsWrapByWord()?CHARACTER_WRAP:WORD_WRAP}}SetPropertyValueByIndex(index,value){switch(index){case TEXT:this._SetText(value);break;case ENABLE_BBCODE:if(this._enableBBcode===!!value)return;this._enableBBcode=!!value;this._UpdateSettings(); +break;case CHARACTER_WIDTH:this._sdkType.GetSpriteFont().SetCharacterWidth(value);break;case CHARACTER_HEIGHT:this._sdkType.GetSpriteFont().SetCharacterHeight(value);break;case CHARACTER_SET:this._sdkType.GetSpriteFont().SetCharacterSet(value);break;case SPACING_DATA:this._sdkType.GetSpriteFont().SetSpacingData(value);break;case SCALE:this._SetScale(value);break;case CHARACTER_SPACING:this._SetCharacterSpacing(value);break;case LINE_HEIGHT:this._SetLineHeight(value);break;case HORIZONTAL_ALIGNMENT:this._SetHAlign(value); +break;case VERTICAL_ALIGNMENT:this._SetVAlign(value);break;case WRAPPING:this._SetWrapByWord(value===WORD_WRAP);break}}_SetText(text){if(this._text===text)return;this._text=text;this._spriteFontText.SetText(text);this._UpdateScreenReaderText();this._runtime.UpdateRender()}GetText(){return this._text}_StartTypewriter(text,duration){this._SetText(text);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+duration/this.GetInstance().GetActiveTimeScale(); +this._typewriterLength=C3.CountGraphemes(C3.BBString.StripAnyTags(text));this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){if(this._typewriterEndTime===-1)return;this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}_SetScale(s){if(this._characterScale=== +s)return;this._characterScale=s;this._spriteFontText.SetScale(this._characterScale);this._runtime.UpdateRender()}_GetScale(){return this._characterScale}_SetCharacterSpacing(s){if(this._characterSpacing===s)return;this._characterSpacing=s;this._spriteFontText.SetSpacing(this._characterSpacing);this._runtime.UpdateRender()}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(h){if(this._lineHeight===h)return;this._lineHeight=h;this._spriteFontText.SetLineHeight(this._lineHeight);this._runtime.UpdateRender()}_GetLineHeight(){return this._lineHeight}_SetHAlign(h){if(this._horizontalAlign=== +h)return;this._horizontalAlign=h;this._UpdateSettings();this._runtime.UpdateRender()}_GetHAlign(){return this._horizontalAlign}_SetVAlign(v){if(this._verticalAlign===v)return;this._verticalAlign=v;this._UpdateSettings();this._runtime.UpdateRender()}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(w){w=!!w;if(this._wrapByWord===w)return;this._wrapByWord=w;this._UpdateSettings();this._runtime.UpdateRender()}_IsWrapByWord(){return this._wrapByWord}_SetReadAloud(r){this._readAloud=!!r;this._UpdateScreenReaderText()}_IsReadAloud(){return this._readAloud}_GetTextWidth(){this._UpdateTextSize(); +return this._spriteFontText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();return this._spriteFontText.GetTextHeight()}_GetTagAtPosition(x,y){this._UpdateTextLayout();const wi=this.GetWorldInfo();tempVec2.set(x-wi.GetX(),y-wi.GetY());tempVec2.rotate(-wi.GetAngle());tempVec2.offset(wi.GetWidth()*wi.GetOriginX(),wi.GetHeight()*wi.GetOriginY());const frag=this._spriteFontText.HitTestFragment(tempVec2.getX(),tempVec2.getY());if(frag){const fragTagStyle=frag.GetStyleTag("tag");if(fragTagStyle)return fragTagStyle.param}return""}_HasTagAtPosition(tag, +x,y){const hitTag=this._GetTagAtPosition(x,y);return hitTag&&C3.equalsNoCase(tag,hitTag)}_GetTagPosition(tag,index){this._UpdateTextLayout();index=Math.floor(index);const frag=this._spriteFontText.FindFragmentWithTag(tag,index);if(!frag)return null;const wi=this.GetWorldInfo();tempVec2.set(frag.GetPosX(),frag.GetPosY());tempVec2.offset(-wi.GetWidth()*wi.GetOriginX(),-wi.GetHeight()*wi.GetOriginY());tempVec2.rotate(wi.GetAngle());tempVec2.offset(wi.GetX(),wi.GetY());return{x:tempVec2.getX(),y:tempVec2.getY(), +width:frag.GetWidth(),height:frag.GetHeight()}}_GetTagCount(tag){this._UpdateTextLayout();return this._spriteFontText.CountFragmentsWithTag(tag)}Tick(){const wallTime=this._runtime.GetWallTime();if(wallTime>=this._typewriterEndTime){this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}else{let displayLength=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,wallTime,0,this._typewriterLength);displayLength=Math.floor(displayLength); +if(displayLength!==this._spriteFontText.GetDrawMaxCharacterCount()){this._spriteFontText.SetDrawMaxCharacterCount(displayLength);this._runtime.UpdateRender()}}}GetDebuggerProperties(){const prefix="plugins.spritefont2";return[{title:prefix+".name",properties:[{name:prefix+".properties.text.name",value:this.GetText(),onedit:v=>this._SetText(v)},{name:prefix+".properties.scale.name",value:this._GetScale(),onedit:v=>this._SetScale(v)},{name:prefix+".properties.character-spacing.name",value:this._GetCharacterSpacing(), +onedit:v=>this._SetCharacterSpacing(v)},{name:prefix+".properties.line-height.name",value:this._GetLineHeight(),onedit:v=>this._SetLineHeight(v)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const map=new WeakMap;const SCRIPT_HORIZONTAL_ALIGNMENTS=new Map([["left",0],["center",1],["right",2]]);const SCRIPT_VERTICAL_ALIGNMENTS=new Map([["top",0],["center",1],["bottom",2]]);const SCRIPT_WRAP_MODES=new Map([["word",true],["character",false]]);self.ISpriteFontInstance=class ISpriteFontInstance extends self.IWorldInstance{constructor(){super(); +map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return map.get(this).GetText()}set text(str){C3X.RequireString(str);const inst=map.get(this);inst._CancelTypewriter();inst._SetText(str)}typewriterText(str,duration){C3X.RequireString(str);C3X.RequireFiniteNumber(duration);const inst=map.get(this);inst._CancelTypewriter();inst._StartTypewriter(str,duration)}typewriterFinish(){map.get(this)._FinishTypewriter()}set characterScale(s){C3X.RequireFiniteNumber(s);map.get(this)._SetScale(s)}get characterScale(){return map.get(this)._GetScale()}set characterSpacing(s){C3X.RequireFiniteNumber(s); +map.get(this)._SetCharacterSpacing(s)}get characterSpacing(){return map.get(this)._GetCharacterSpacing()}set lineHeight(lho){C3X.RequireFiniteNumber(lho);map.get(this)._SetLineHeight(lho)}get lineHeight(){return map.get(this)._GetLineHeight()}set horizontalAlign(str){C3X.RequireString(str);const h=SCRIPT_HORIZONTAL_ALIGNMENTS.get(str);if(typeof h==="undefined")throw new Error("invalid mode");map.get(this)._SetHAlign(h)}get horizontalAlign(){return HORIZONTAL_ALIGNMENTS[map.get(this)._GetHAlign()]}set verticalAlign(str){C3X.RequireString(str); +const v=SCRIPT_VERTICAL_ALIGNMENTS.get(str);if(typeof v==="undefined")throw new Error("invalid mode");map.get(this)._SetVAlign(v)}get verticalAlign(){return VERTICAL_ALIGNMENTS[map.get(this)._GetVAlign()]}set wordWrapMode(str){C3X.RequireString(str);const isWrapByWord=SCRIPT_WRAP_MODES.get(str);if(typeof isWrapByWord==="undefined")throw new Error("invalid mode");map.get(this)._SetWrapByWord(isWrapByWord)}get wordWrapMode(){return map.get(this)._IsWrapByWord()?"word":"character"}set readAloud(r){map.get(this)._SetReadAloud(!!r)}get readAloud(){return map.get(this)._IsReadAloud()}get textWidth(){return map.get(this)._GetTextWidth()}get textHeight(){return map.get(this)._GetTextHeight()}getTextSize(){const inst= +map.get(this);return[inst._GetTextWidth(),inst._GetTextHeight()]}hasTagAtPosition(tag,x,y){C3X.RequireString(tag);C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);return map.get(this)._HasTagAtPosition(tag,x,y)}getTagAtPosition(x,y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);return map.get(this)._GetTagAtPosition(x,y)}getTagPositionAndSize(tag,index=0){C3X.RequireString(tag);C3X.RequireFiniteNumber(index);return map.get(this)._GetTagPosition(tag,index)}getTagCount(tag){C3X.RequireString(tag); +return map.get(this)._GetTagCount(tag)}}}{const C3=self.C3;C3.Plugins.Spritefont2.Cnds={CompareText(text,caseSensitive){if(caseSensitive)return this._text===text;else return C3.equalsNoCase(this._text,text)},IsRunningTypewriterText(){return this._typewriterEndTime!==-1},OnTypewriterTextFinished(){return true},HasTagAtPosition(tag,x,y){return this._HasTagAtPosition(tag,x,y)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Acts={SetText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;this._SetText(param.toString())},AppendText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;param=param.toString();if(!param)return;this._SetText(this._text+param)},TypewriterText(param,duration){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/ +1E10;this._StartTypewriter(param.toString(),duration)},TypewriterFinish(){this._FinishTypewriter()},SetScale(s){this._SetScale(s)},SetCharacterSpacing(s){this._SetCharacterSpacing(s)},SetLineHeight(h){this._SetLineHeight(h)},SetCharacterWidth(chars,width){let didAnyChange=false;const spriteFont=this._sdkType.GetSpriteFont();for(const ch of chars)if(ch===" "){spriteFont.SetSpaceWidth(width);didAnyChange=true}else{const sfc=spriteFont.GetCharacter(ch);if(sfc){sfc.SetDisplayWidth(width);didAnyChange= +true}}if(didAnyChange)spriteFont.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},SetHAlign(h){this._SetHAlign(h)},SetVAlign(v){this._SetVAlign(v)},SetWrapping(w){this._SetWrapByWord(w===0)},SetReadAloud(r){this._SetReadAloud(r)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Exps={CharacterWidth(ch){const sfc=this._sdkType.GetSpriteFont().GetCharacter(ch);if(sfc)return sfc.GetDisplayWidth();else return this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){if(this._enableBBcode)return C3.BBString.StripAnyTags(this._text); +else return this._text},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},TagAtPosition(x,y){return this._GetTagAtPosition(x,y)},TagCount(tag){return this._GetTagCount(tag)},TagX(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.x:0},TagY(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.y:0},TagWidth(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.width:0},TagHeight(tag,index){const ret=this._GetTagPosition(tag, +index);return ret?ret.height:0}}}; + +} + +{ +'use strict';const C3=self.C3; +self.SpriteFontCharacter=class SpriteFontCharacter{constructor(spriteFont,char,x,y){let charWidth=spriteFont.GetCharacterWidth();let charHeight=spriteFont.GetCharacterHeight();this._spriteFont=spriteFont;this._char=char;this._pxRect=new C3.Rect(x,y,x+charWidth,y+charHeight);this._texRect=new C3.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._spriteFont=null;this._pxRect=null;this._texRect=null}_UpdateTexRect(){let w=this._spriteFont.GetWidth();let h=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect); +this._texRect.divide(w,h);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(w){this._displayWidth=w}GetDisplayWidth(){if(this._displayWidth<0)return this._spriteFont.GetCharacterWidth();else return this._displayWidth}}; + +} + +{ +'use strict';const C3=self.C3;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const tmpColor=new C3.Color;const VALID_HORIZ_ALIGNMENTS=new Set(["left","center","right"]);const VALID_VERT_ALIGNMENTS=new Set(["top","center","bottom"]);const VALID_WORD_WRAP_MODES=new Set(["word","character"]);function getOffsetParam(paramStr,fragHeight){paramStr=paramStr.trim();const param=parseFloat(paramStr);if(!isFinite(param))return 0;if(paramStr.endsWith("%"))return fragHeight*param/100;else return param} +self.SpriteFontText=class SpriteFontText{constructor(spriteFont){this._spriteFont=spriteFont;this._cssWidth=0;this._cssHeight=0;this._text="";this._isBBcodeEnabled=false;this._bbString=null;this._wrappedText=C3.New(C3.WordWrap);this._wrapMode="word";this._wrapChanged=false;this._horizontalAlign="left";this._verticalAlign="top";this._scale=1;this._sceneGraphScale=1;this._spacing=0;this._lineHeight=0;this._color=C3.New(C3.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback= +frag=>this._MeasureText(frag);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._color=null;this._measureTextCallback=null;this._wrappedText.Clear();this._wrappedText=null;this._spriteFont=null;this._bbString=null}_MeasureText(frag){if(frag.IsIcon())return{width:0,height:0};const chArr=frag.GetCharacterArray();const scaleStyle=frag.GetStyleTag("scale");const scale=(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle= +frag.GetStyleTag("scalex");const scaleX=(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=frag.GetStyleTag("scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const lineTotalHeight=this._spriteFont.GetCharacterHeight()*scaleY+this._lineHeight;const spriteFont=this.GetSpriteFont();const defaultCharWidth=spriteFont.GetCharacterWidth()*scaleX;const spacing=this.GetSpacing();if(spriteFont.HasAnyCustomWidths()){let strLen=0;let totalWidth=0;for(const ch of chArr){let charWidth= +defaultCharWidth;const sfc=spriteFont.GetCharacter(ch);if(sfc)charWidth=sfc.GetDisplayWidth()*scaleX;else if(ch===" ")charWidth=spriteFont.GetSpaceWidth()*scaleX;totalWidth+=charWidth;++strLen}return{width:totalWidth+strLen*spacing,height:lineTotalHeight}}else{const strLen=chArr.length;const spaceCount=Math.max(strLen,0);return{width:defaultCharWidth*strLen+spaceCount*spacing,height:lineTotalHeight}}}_SetWrapChanged(){this._wrapChanged=true;this._wrappedText.Clear()}SetSize(cssWidth,cssHeight){if(cssWidth<= +0||cssHeight<=0)return;if(this._cssWidth===cssWidth&&this._cssHeight===cssHeight)return;if(this._cssWidth!==cssWidth)this._SetWrapChanged();this._cssWidth=cssWidth;this._cssHeight=cssHeight}SetDrawMaxCharacterCount(n){this._drawMaxCharCount=Math.floor(n)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}HitTestFragment(x,y){const lines=this._wrappedText.GetLines();for(const line of lines)if(y>line.GetPosY()&&y=frag.GetPosX()&& +xa+v.GetHeight(),0)-lineSpaceHeight;if(this._verticalAlign==="center")penY=Math.max(Math.floor(this._cssHeight/2-linesTotalHeight/2),0);else if(this._verticalAlign==="bottom")penY=Math.floor(this._cssHeight-linesTotalHeight);for(let i=0,len=lines.length;i0&&penY>this._cssHeight-(curLineTextHeight- +lineSpaceHeight))break;if(penY>=0)this._DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a);penY+=curLineTextHeight}}_DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a){const lineHeight=line.GetHeight();let penX=0;if(this._horizontalAlign==="center")penX=Math.max(Math.floor((this._cssWidth-line.GetWidth())/2),0);else if(this._horizontalAlign==="right")penX=Math.max(Math.floor(this._cssWidth-line.GetWidth()),0);line.SetPosX(penX);line.SetPosY(penY);for(const frag of line.fragments()){if(frag.IsIcon())continue; +this._DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight);penX+=frag.GetWidth()}}_DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight){if(frag.IsIcon())return;const offsetXStyle=frag.GetStyleTag("offsetx");penX+=offsetXStyle?getOffsetParam(offsetXStyle.param,frag.GetHeight()):0;const offsetYStyle=frag.GetStyleTag("offsety");penY+=offsetYStyle?getOffsetParam(offsetYStyle.param,frag.GetHeight()):0;frag.SetPosX(penX);frag.SetPosY(penY);let chArr=frag.GetCharacterArray(); +let fragWidth=frag.GetWidth();if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(frag).width}this._drawCharCount+=chArr.length}const backgroundStyle=frag.GetStyleTag("background");if(C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle||frag.HasStyleTag("hide"))return;const scaleStyle=frag.GetStyleTag("scale");const scale= +(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle=frag.GetStyleTag("scalex");const scaleX=(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=frag.GetStyleTag("scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const charHeight=this._spriteFont.GetCharacterHeight()*scaleY;const lineSpaceHeight=this._lineHeight;penY+=lineHeight-lineSpaceHeight-charHeight;if(backgroundStyle&&renderer){renderer.SetColorFillMode();tmpColor.parseString(backgroundStyle.param); +tmpColor.setA(1);renderer.SetColor(tmpColor);tmpRect.set(penX,penY,penX+fragWidth,penY+charHeight);if(tmpRect.getRight()>this._cssWidth)tmpRect.setRight(this._cssWidth);tmpQuad.setFromRotatedRectPrecalc(tmpRect,sin_a,cos_a);tmpQuad.offset(offX,offY);renderer.Quad(tmpQuad);renderer.SetTextureFillMode()}const colorStyle=frag.GetStyleTag("color");if(colorStyle){tmpColor.parseString(colorStyle.param);tmpColor.setA(this._color.getA())}else tmpColor.copy(this._color);const opacityStyle=frag.GetStyleTag("opacity"); +if(opacityStyle)tmpColor.setA(tmpColor.getA()*parseFloat(opacityStyle.param)/100);tmpColor.premultiply();if(renderer)renderer.SetColor(tmpColor);const drawCharWidth=this._spriteFont.GetCharacterWidth()*scaleX;const endOfLineMargin=Math.abs(this.GetSpacing());for(const ch of chArr){const sfc=this._spriteFont.GetCharacter(ch);if(sfc){const layoutCharWidth=sfc.GetDisplayWidth()*scaleX;if(penX+layoutCharWidth>this._cssWidth+endOfLineMargin+1E-5)return;tmpRect.set(penX,penY,penX+drawCharWidth,penY+charHeight); +tmpQuad.setFromRotatedRectPrecalc(tmpRect,sin_a,cos_a);tmpQuad.offset(offX,offY);if(renderer)renderer.Quad3(tmpQuad,sfc.GetTexRect());penX+=layoutCharWidth+this._spacing}else penX+=this._spriteFont.GetSpaceWidth()*scaleX+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(e){e=!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;this._SetWrapChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(text){if(this._text===text)return;this._text=text;this._SetWrapChanged()}SetWordWrapMode(w){if(!VALID_WORD_WRAP_MODES.has(w))throw new Error("invalid word wrap mode"); +if(this._wrapMode===w)return;this._wrapMode=w;this._SetWrapChanged()}SetHorizontalAlign(a){if(!VALID_HORIZ_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._horizontalAlign=a}SetVerticalAlign(a){if(!VALID_VERT_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._verticalAlign=a}SetScale(s){if(this._scale===s)return;this._scale=s;this._SetWrapChanged()}GetScale(){return this._scale}SetSceneGraphScale(s){if(this._sceneGraphScale===s)return;this._sceneGraphScale=s;this._SetWrapChanged()}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(s){if(this._spacing=== +s)return;this._spacing=s;this._SetWrapChanged()}GetSpacing(){return this._spacing}SetLineHeight(h){this._lineHeight=h;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(o){o=C3.clamp(o,0,1);this._color.a=o}SetColor(c){if(this._color.equals(c))return;this._color.copy(c)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const lineTextHeight=this._spriteFont.GetCharacterHeight()*this._scale; +const lineSpaceHeight=this._lineHeight;const lineTotalHeight=lineTextHeight+lineSpaceHeight;return this._wrappedText.GetLineCount()*lineTotalHeight-lineSpaceHeight}}; + +} + +{ +'use strict';const C3=self.C3;const SpriteFontText=self.SpriteFontText;const DEFAULT_SPRITEFONT_OPTS={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""}; +self.SpriteFont=class SpriteFont{constructor(opts){opts=Object.assign({},DEFAULT_SPRITEFONT_OPTS,opts);if(opts.width<=0||opts.height<=0||opts.characterWidth<=0||opts.characterHeight<=0)throw new Error("invalid size");this._width=opts.width;this._height=opts.height;this._characterWidth=opts.characterWidth;this._characterHeight=opts.characterHeight;this._characterSet=opts.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=false;this._spaceWidth=-1;this._texRect=new C3.Rect(0, +0,1,1);this._characterMap=new Map;this._mapChanged=true;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;if(this._allTexts)this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let c of this._characterMap.values())c.Release();this._characterMap.clear()}_AddSpriteFontText(sft){this._allTexts.add(sft)}_RemoveSpriteFontText(sft){this._allTexts.delete(sft)}UpdateCharacterMap(){if(!this._mapChanged)return;this._ReleaseCharacters();let charSetArr= +C3.SplitGraphemes(this._characterSet);let cols=Math.floor(this._width/this._characterWidth);let rows=Math.floor(this._height/this._characterHeight);let last=cols*rows;for(let i=0,len=charSetArr.length;i=last)break;let char=charSetArr[i];if(this._characterMap.has(char))continue;let x=i%cols;let y=Math.floor(i/cols);this._characterMap.set(char,C3.New(self.SpriteFontCharacter,this,char,x*this._characterWidth,y*this._characterHeight))}this._hasAnyCustomWidths=false;this._spaceWidth=-1; +if(Array.isArray(this._spacingParsed))for(let entry of this._spacingParsed){if(!Array.isArray(entry))continue;if(entry.length!==2)continue;let charWidth=entry[0];let str=entry[1];if(typeof charWidth!=="number"||!isFinite(charWidth)||typeof str!=="string")continue;if(charWidth===this._characterWidth)continue;for(let ch of str){let sfc=this._characterMap.get(ch);if(sfc){sfc.SetDisplayWidth(charWidth);this._hasAnyCustomWidths=true}else if(ch===" "){this._spaceWidth=charWidth;this._hasAnyCustomWidths= +true}}}this._mapChanged=false;for(let sft of this._allTexts)sft._SetWrapChanged()}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=true;for(const sft of this._allTexts)sft._SetWrapChanged()}GetCharacter(ch){this.UpdateCharacterMap();return this._characterMap.get(ch)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._width===w)return;this._width=w;this._mapChanged=true}GetWidth(){return this._width}SetHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._height===h)return;this._height=h;this._mapChanged=true}GetHeight(){return this._height}SetTexRect(rc){if(this._texRect.equals(rc))return;this._texRect.copy(rc);for(const sfc of this._characterMap.values())sfc._UpdateTexRect()}GetTexRect(){return this._texRect}SetCharacterWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._characterWidth===w)return;this._characterWidth=w;this._mapChanged=true}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._characterHeight===h)return;this._characterHeight=h;this._mapChanged=true}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(s){if(this._characterSet===s)return;this._characterSet=s;this._mapChanged=true}GetCharacterSet(){return this._characterSet}SetSpacingData(s){if(this._spacingData===s)return;this._spacingData=s;this._mapChanged=true;this._spacingParsed=null;if(this._spacingData.length)try{this._spacingParsed=JSON.parse(this._spacingData)}catch(e){this._spacingParsed= +null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(w){if(w<0)w=-1;if(this._spaceWidth===w)return;this._spaceWidth=w;if(this._spaceWidth>=0)this._hasAnyCustomWidths=true}GetSpaceWidth(){if(this._spaceWidth<0)return this._characterWidth;else return this._spaceWidth}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.DrawingCanvas=class DrawingCanvasPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.DrawingCanvas.Type=class DrawingCanvasType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const RESOLUTION_MODE=0;const INITIALLY_VISIBLE=1;const ORIGIN=2;const MULTISAMPLING=3;const tempColor=C3.New(C3.Color);const tempColor2=C3.New(C3.Color);const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);function ClonePolyArray(arr){return arr.map(p=>p.slice(0))}function SortByInstanceZIndex(a,b){return a.GetWorldInfo().GetZIndex()-b.GetWorldInfo().GetZIndex()}let drawDepth=0;C3.Plugins.DrawingCanvas.Instance=class DrawingCanvasInstance extends C3.SDKWorldInstanceBase{constructor(inst, +properties){super(inst);this._renderTarget=null;this._rcTex=C3.New(C3.Rect);const wi=this.GetWorldInfo();this._isFixedResolution=false;this._fixedResolutionWidth=Math.floor(wi.GetWidth());this._fixedResolutionHeight=Math.floor(wi.GetHeight());this._multisampling=0;this._texRenderTarget=null;this._drawCommands=[];this._currentPoly=[];this._drawBlendMode=0;this._drawScale=1;this._texScale=1;this._lineDashTexture=null;this._savedImageUrl="";this._snapshot=null;this._tempRect=C3.New(C3.Rect);this._deviceQuadUnrotated= +C3.New(C3.Quad);this._deviceQuadRotated=C3.New(C3.Quad);if(properties){this._isFixedResolution=properties[RESOLUTION_MODE]===1;wi.SetVisible(!!properties[INITIALLY_VISIBLE]);this._multisampling=[0,2,4,8][properties[MULTISAMPLING]]}const renderer=this._runtime.GetRenderer();this._SetDrawingBlendMode(0);if(renderer.IsWebGL()&&renderer.GetWebGLVersionNumber()<2)this._multisampling=0;this._StartTicking2()}Release(){if(this._renderTarget){this._renderTarget.GetRenderer().DeleteRenderTarget(this._renderTarget); +this._renderTarget=null}if(this._texRenderTarget){this._texRenderTarget.GetRenderer().DeleteRenderTarget(this._texRenderTarget);this._texRenderTarget=null}C3.clearArray(this._drawCommands);super.Release()}IsFixedResolutionMode(){return this._isFixedResolution}_GetLineDashTexture(){this._MaybeCreateLineDashTexture();return this._lineDashTexture}_MaybeCreateLineDashTexture(){if(this._lineDashTexture)return;const canvas=C3.CreateCanvas(512,8);const ctx=canvas.getContext("2d");ctx.clearRect(0,0,512,8); +ctx.fillStyle="white";ctx.fillRect(0,0,256,8);this._lineDashTexture=this._runtime.GetRenderer().CreateStaticTexture(canvas,{wrapX:"repeat",sampling:this._runtime.GetSampling()})}_SetDrawingBlendMode(bm){this._drawBlendMode=bm}_ApplyCurrentDrawingBlendMode(renderer){renderer.SetBlendMode(this._drawBlendMode)}_AddDrawCommand(cmd){this._drawCommands.push(cmd);this._runtime.UpdateRender()}_SetFixedResolutionMode(fixedWidth,fixedHeight){this._isFixedResolution=true;this._fixedResolutionWidth=Math.floor(fixedWidth); +this._fixedResolutionHeight=Math.floor(fixedHeight)}_SetAutoResolutionMode(){this._isFixedResolution=false}_ClearCanvas(color){C3.clearArray(this._drawCommands);this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.ClearCanvas(color))}_ClearRect(left,top,right,bottom,color){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.ClearRect(left,top,right,bottom,color))}_FillRect(left,top,right,bottom,color){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillRect(left, +top,right,bottom,color))}_FillLinearGradient(left,top,right,bottom,color1,color2,dir){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillLinearGradient(left,top,right,bottom,color1,color2,dir))}_FillEllipse(x,y,radiusX,radiusY,color,isSmooth){if(radiusX<=0||radiusY<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillEllipse(x,y,radiusX,radiusY,color,isSmooth))}_OutlineEllipse(x,y,radiusX,radiusY,color,thickness,isSmooth){if(radiusX<= +0||radiusY<=0||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.OutlineEllipse(x,y,radiusX,radiusY,color,thickness,isSmooth))}_OutlineRect(left,top,right,bottom,color,thickness){if(left===right||top===bottom||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.OutlineRect(left,top,right,bottom,color,thickness))}_Line(x1,y1,x2,y2,color,thickness,capStr){if(x1===x2&&y1===y2||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.Line(x1, +y1,x2,y2,color,thickness,capStr))}_LineDashed(x1,y1,x2,y2,color,thickness,dashLength,capStr){if(x1===x2&&y1===y2||thickness<=0||dashLength<=0)return;const dashTex=this._GetLineDashTexture();this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LineDashed(x1,y1,x2,y2,color,thickness,dashLength,dashTex,capStr))}_LinePoly(polyArr,color,thickness,capStr){if(polyArr.length<2||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LinePoly(ClonePolyArray(polyArr),color, +thickness,capStr))}_LineDashedPoly(polyArr,color,thickness,dashLength,capStr){if(polyArr.length<2||thickness<=0||dashLength<=0)return;const dashTex=this._GetLineDashTexture();this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LineDashedPoly(ClonePolyArray(polyArr),color,thickness,dashLength,dashTex,capStr))}_FillPoly(polyArr,color){if(polyArr.length<3)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillPoly(ClonePolyArray(polyArr),color))}_SetDrawBlend(blendMode){this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SetDrawBlend(blendMode))}_PasteInstances(instanceArr, +includeFx){const myWi=this.GetWorldInfo();const myBbox=myWi.GetBoundingBox();const myQuad=myWi.GetBoundingQuad();const instances=instanceArr.filter(inst=>{const instWi=inst.GetWorldInfo();return instWi&&myBbox.intersectsRect(instWi.GetBoundingBox())&&(myWi.GetAngle()===0||myQuad.intersectsQuad(instWi.GetBoundingQuad()))});if(instances.length===0)return;instances.sort(SortByInstanceZIndex);let resolve=null;const ret=new Promise(r=>resolve=r);this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.DrawInstances(instances, +includeFx,myWi,resolve));return ret}_GetPixelScale(){return 1/(this._drawScale*this._texScale)}_UpdateRenderTargetSize(renderer,rtWidth,rtHeight){if(this._renderTarget)renderer.DeleteRenderTarget(this._renderTarget);this._renderTarget=renderer.CreateRenderTarget({width:rtWidth,height:rtHeight,sampling:this._runtime.GetSampling(),isSampled:this._multisampling===0,canReadPixels:this._multisampling===0,canUpdate:this._multisampling===0,multisampling:this._multisampling});if(this._multisampling>0){if(this._texRenderTarget)renderer.DeleteRenderTarget(this._texRenderTarget); +this._texRenderTarget=renderer.CreateRenderTarget({width:rtWidth,height:rtHeight,sampling:this._runtime.GetSampling(),isSampled:true,canReadPixels:true,canUpdate:true})}renderer.SetTexture(null)}_GetRenderTarget(){return this._renderTarget}_GetTexRenderTarget(){return this._texRenderTarget}GetMultisampling(){return this._multisampling}_SetRenderTargetDeviceTransform(renderer){this._runtime.GetCanvasManager().SetDeviceTransform(renderer,this._renderTarget.GetWidth(),this._renderTarget.GetHeight(), +false)}HasAnyDrawingCommandInQueue(){return this._drawCommands.some(c=>!(c instanceof C3.Plugins.DrawingCanvas.DrawCommand.SaveImage))}_CalculateUnrotatedDeviceCoords(outRect,outQuad){const wi=this.GetWorldInfo();const layer=wi.GetLayer();const layout=layer.GetLayout();const angle=wi.GetAngle();const layerAngle=layer.GetOwnAngle();const layoutAngle=layout.GetAngle();if(angle!==0||layerAngle!==0||layoutAngle!==0){layout.SetAngle(0);layer.SetAngle(0);wi.SetAngle(0);wi.SetBboxChanged()}const quad=wi.GetBoundingQuad(); +const [dl,dt]=layer.LayerToDrawSurface(quad.getTlx(),quad.getTly());const [dr,db]=layer.LayerToDrawSurface(quad.getBrx(),quad.getBry());const offX=dl-Math.round(dl);const offY=dt-Math.round(dt);outRect.set(dl,dt,dr,db);outRect.offset(-offX,-offY);outRect.normalize();outQuad.setFromRect(outRect);if(angle!==0||layerAngle!==0||layoutAngle!==0){layout.SetAngle(layoutAngle);layer.SetAngle(layerAngle);wi.SetAngle(angle);wi.SetBboxChanged()}}_CalculateRotatedDeviceCoords(outQuad){const wi=this.GetWorldInfo(); +const layer=wi.GetLayer();const layout=layer.GetLayout();const layerAngle=layer.GetOwnAngle();const layoutAngle=layout.GetAngle();if(layerAngle!==0||layoutAngle!==0){layout.SetAngle(0);layer.SetAngle(0)}const quad=wi.GetBoundingQuad();const [dtlx,dtly]=layer.LayerToDrawSurface(quad.getTlx(),quad.getTly());const [dtrx,dtry]=layer.LayerToDrawSurface(quad.getTrx(),quad.getTry());const [dbrx,dbry]=layer.LayerToDrawSurface(quad.getBrx(),quad.getBry());const [dblx,dbly]=layer.LayerToDrawSurface(quad.getBlx(), +quad.getBly());const offX=dtlx-Math.round(dtlx);const offY=dtly-Math.round(dtly);outQuad.set(dtlx,dtly,dtrx,dtry,dbrx,dbry,dblx,dbly);outQuad.offset(offX,offY);if(layerAngle!==0||layoutAngle!==0){layout.SetAngle(layoutAngle);layer.SetAngle(layerAngle)}}_CalculateSurfaceDeviceSize(){const renderer=this._runtime.GetRenderer();const tempRect=this._tempRect;this._CalculateUnrotatedDeviceCoords(tempRect,this._deviceQuadUnrotated);this._CalculateRotatedDeviceCoords(this._deviceQuadRotated);let rtWidth= +0;let rtHeight=0;if(this._isFixedResolution){rtWidth=this._fixedResolutionWidth;rtHeight=this._fixedResolutionHeight;if(renderer.IsWebGL())this._rcTex.set(0,1,1,0);else this._rcTex.set(0,0,1,1)}else{const EPSILON=.001;rtWidth=Math.ceil(tempRect.width()+EPSILON);rtHeight=Math.ceil(tempRect.height()+EPSILON);if(renderer.IsWebGL())this._rcTex.set(0,1,tempRect.width()/rtWidth,1-tempRect.height()/rtHeight);else this._rcTex.set(0,0,tempRect.width()/rtWidth,tempRect.height()/rtHeight)}const maxTextureSize= +renderer.GetMaxTextureSize();const maxRtDim=Math.max(rtWidth,rtHeight);if(maxRtDim>maxTextureSize){this._texScale=maxTextureSize/maxRtDim;rtWidth=Math.round(rtWidth*this._texScale);rtHeight=Math.round(rtHeight*this._texScale)}else this._texScale=1;return[rtWidth,rtHeight]}_OnResolutionChanged(){this.DispatchScriptEvent("resolutionchange");this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnResolutionChanged)}_MaybeCreateRenderTarget(){if(this._renderTarget)return;const [rtWidth,rtHeight]=this._CalculateSurfaceDeviceSize(); +if(rtWidth<=0||rtHeight<=0)return;this._drawScale=tempRect.width()/this.GetWorldInfo().GetWidth();this._UpdateRenderTargetSize(this._runtime.GetRenderer(),rtWidth,rtHeight);this._OnResolutionChanged()}Tick2(){const renderer=this._runtime.GetRenderer();const wi=this.GetWorldInfo();const tempRect=this._tempRect;++drawDepth;const [rtWidth,rtHeight]=this._CalculateSurfaceDeviceSize();if(rtWidth<=0||rtHeight<=0){--drawDepth;return}this._drawScale=this._isFixedResolution?1:tempRect.width()/wi.GetWidth(); +const drawScale=this._drawScale*this._texScale;const didRenderTargetChange=!this._renderTarget||this._renderTarget.GetWidth()!==rtWidth||this._renderTarget.GetHeight()!==rtHeight;if(didRenderTargetChange)this._OnResolutionChanged();if(this._drawCommands.length>0||!this._renderTarget){if(!this._renderTarget||didRenderTargetChange&&this.HasAnyDrawingCommandInQueue())this._UpdateRenderTargetSize(renderer,rtWidth,rtHeight);renderer.SetRenderTarget(this._renderTarget);this._SetRenderTargetDeviceTransform(renderer); +this._ApplyCurrentDrawingBlendMode(renderer);if(renderer.IsWebGPU()&&this._multisampling>0)renderer.SetRenderingToMultisampleCount(this._multisampling);for(const dc of this._drawCommands)dc.Do(renderer,drawScale,this);C3.clearArray(this._drawCommands);renderer.SetAlphaBlend();if(renderer.IsWebGPU()&&this._multisampling>0)renderer.SetRenderingToMultisampleCount(0);if(this._multisampling>0){renderer.SetRenderTarget(this._texRenderTarget);renderer.CopyRenderTarget(this._renderTarget,"crop")}}--drawDepth}Draw(renderer){const wi= +this.GetWorldInfo();const layer=wi.GetLayer();const canvasManager=this._runtime.GetCanvasManager();const lastRenderTarget=renderer.GetRenderTarget();let quad=this._deviceQuadUnrotated;if(!this._renderTarget)return;if(renderer.IsWebGPU())renderer._MaybeDoPendingClearRenderPass(this._renderTarget);if(this._multisampling===0)renderer.SetTexture(this._renderTarget.GetTexture());else renderer.SetTexture(this._texRenderTarget.GetTexture());let didChangeTransform=false;if(drawDepth>0)if(this._inst._IsDrawingWithEffects())quad= +wi.GetBoundingQuad();else{canvasManager.SetDeviceTransform(renderer,lastRenderTarget.GetWidth(),lastRenderTarget.GetHeight(),false);didChangeTransform=true;quad=this._deviceQuadRotated}else if(wi.GetAngle()===0&&layer.GetAngle()===0&&!wi.HasMesh()&&layer.RendersIn2DMode()){canvasManager.SetDeviceTransform(renderer);didChangeTransform=true}else quad=wi.GetBoundingQuad();if(wi.HasMesh())this._DrawMesh(renderer,wi);else renderer.Quad3(quad,this._rcTex);if(didChangeTransform)layer._SetTransform(renderer, +false);renderer.SetTexture(null)}_DrawMesh(renderer,wi){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),tempQuad,this._rcTex);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetSnapshotPixel(x,y){if(!this._snapshot)return[0,0,0,0];const width=this._snapshot.width;const height=this._snapshot.height;x=Math.floor(x);if(this._runtime.GetRenderer().IsWebGL())y=height-1-Math.floor(y); +else y=Math.floor(y);if(x<0||y<0||x>=width||y>=height)return[0,0,0,0];const data=this._snapshot.data;const ptr=y*width*4+x*4;let r=data[ptr]/255;let g=data[ptr+1]/255;let b=data[ptr+2]/255;let a=data[ptr+3]/255;if(a!==0){r/=a;g/=a;b/=a}return[r*100,g*100,b*100,a*100]}SetSnapshotPixel(x,y,rgb){if(!this._snapshot)return[0,0,0,0];tempColor.setFromRgbValue(rgb);tempColor.premultiply();const width=this._snapshot.width;const height=this._snapshot.height;x=Math.floor(x);y=height-1-Math.floor(y);if(x<0|| +y<0||x>=width||y>=height)return;const data=this._snapshot.data;const ptr=y*width*4+x*4;data[ptr]=Math.floor(tempColor.getR()*255);data[ptr+1]=Math.floor(tempColor.getG()*255);data[ptr+2]=Math.floor(tempColor.getB()*255);data[ptr+3]=Math.floor(tempColor.getA()*255)}GetImagePixelData(){return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(async imageData=>{const imgDataBuffer=imageData.data.buffer;const width=imageData.width;const height=imageData.height; +const processedBuffer=await this._runtime.AddJob("ProcessImageData",{"buffer":imgDataBuffer,"width":width,"height":height,"unpremultiply":true,"flipY":true},[imgDataBuffer]);resolve(new ImageData(new Uint8ClampedArray(processedBuffer),width,height))}))})}LoadImagePixelData(imageData,premultiplyAlpha,flipY){this._MaybeCreateRenderTarget();if(!this._renderTarget)throw new Error("invalid canvas size");if(imageData.width!==this._renderTarget.GetWidth()||imageData.height!==this._renderTarget.GetHeight())throw new Error(`wrong size ImageData: expected ${this._renderTarget.GetWidth()} x ${this._renderTarget.GetHeight()}, got ${imageData.width} x ${imageData.height}`); +C3.clearArray(this._drawCommands);const renderer=this._runtime.GetRenderer();if(this._texRenderTarget){const lastRenderTarget=renderer.GetRenderTarget();const texture=this._texRenderTarget.GetTexture();renderer.UpdateTexture(imageData,texture,{premultiplyAlpha:!!premultiplyAlpha,flipY:!!flipY});renderer.SetRenderTarget(this._renderTarget);renderer.CopyRenderTarget(this._texRenderTarget,"crop");renderer.SetRenderTarget(lastRenderTarget)}else{const texture=this._renderTarget.GetTexture();renderer.UpdateTexture(imageData, +texture,{premultiplyAlpha:!!premultiplyAlpha,flipY:!!flipY})}this._runtime.UpdateRender()}GetScriptInterfaceClass(){return self.IDrawingCanvasInstance}};const map=new WeakMap;function arrToColor(arr){tempColor.setFromJSON(arr);return tempColor}function arrToColor2(arr){tempColor2.setFromJSON(arr);return tempColor2}const VALID_GRADIENT_DIRECTIONS=["horizontal","vertical"];const VALID_LINE_CAPS=new Set(["butt","square"]);function ValidateLineCap(capStr){if(!VALID_LINE_CAPS.has(capStr))throw new Error("invalid line cap"); +}function ValidatePoly(polyArr){C3X.RequireArray(polyArr);for(const p of polyArr){C3X.RequireArray(p);C3X.RequireFiniteNumber(p[0]);C3X.RequireFiniteNumber(p[1])}}const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);self.IDrawingCanvasInstance=class IDrawingCanvasInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}setFixedResolutionMode(fixedWidth, +fixedHeight){C3X.RequireFiniteNumber(fixedWidth);C3X.RequireFiniteNumber(fixedHeight);map.get(this)._SetFixedResolutionMode(fixedWidth,fixedHeight)}setAutoResolutionMode(){map.get(this)._SetAutoResolutionMode()}clearCanvas(rgbArr){C3X.RequireArray(rgbArr);map.get(this)._ClearCanvas(arrToColor(rgbArr))}clearRect(left,top,right,bottom,rgbArr){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr);map.get(this)._ClearRect(left, +top,right,bottom,arrToColor(rgbArr))}fillRect(left,top,right,bottom,rgbArr){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr);map.get(this)._FillRect(left,top,right,bottom,arrToColor(rgbArr))}fillLinearGradient(left,top,right,bottom,rgbArr1,rgbArr2,dirStr="horizontal"){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr1); +C3X.RequireArray(rgbArr2);const dir=VALID_GRADIENT_DIRECTIONS.indexOf(dirStr);if(dir<0)throw new Error("invalid gradient direction");map.get(this)._FillLinearGradient(left,top,right,bottom,arrToColor(rgbArr1),arrToColor2(rgbArr2),dir)}fillEllipse(x,y,radiusX,radiusY,rgbArr,isSmooth=true){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);C3X.RequireFiniteNumber(radiusX);C3X.RequireFiniteNumber(radiusY);C3X.RequireArray(rgbArr);map.get(this)._FillEllipse(x,y,radiusX,radiusY,arrToColor(rgbArr),!!isSmooth)}outlineEllipse(x, +y,radiusX,radiusY,rgbArr,thickness,isSmooth=true){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);C3X.RequireFiniteNumber(radiusX);C3X.RequireFiniteNumber(radiusY);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);map.get(this)._OutlineEllipse(x,y,radiusX,radiusY,arrToColor(rgbArr),thickness,!!isSmooth)}outlineRect(left,top,right,bottom,rgbArr,thickness){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr); +C3X.RequireFiniteNumber(thickness);map.get(this)._OutlineRect(left,top,right,bottom,arrToColor(rgbArr),thickness)}line(x1,y1,x2,y2,rgbArr,thickness,capStr="butt"){C3X.RequireFiniteNumber(x1);C3X.RequireFiniteNumber(y1);C3X.RequireFiniteNumber(x2);C3X.RequireFiniteNumber(y2);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);ValidateLineCap(capStr);map.get(this)._Line(x1,y1,x2,y2,arrToColor(rgbArr),thickness,capStr)}lineDashed(x1,y1,x2,y2,rgbArr,thickness,dashLength,capStr="butt"){C3X.RequireFiniteNumber(x1); +C3X.RequireFiniteNumber(y1);C3X.RequireFiniteNumber(x2);C3X.RequireFiniteNumber(y2);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);C3X.RequireFiniteNumber(dashLength);ValidateLineCap(capStr);map.get(this)._LineDashed(x1,y1,x2,y2,arrToColor(rgbArr),thickness,dashLength,capStr)}linePoly(polyArr,rgbArr,thickness,capStr="butt"){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);ValidateLineCap(capStr);map.get(this)._LinePoly(polyArr,arrToColor(rgbArr),thickness, +capStr)}lineDashedPoly(polyArr,rgbArr,thickness,dashLength,capStr="butt"){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);C3X.RequireFiniteNumber(dashLength);ValidateLineCap(capStr);map.get(this)._LineDashedPoly(polyArr,arrToColor(rgbArr),thickness,dashLength,capStr)}fillPoly(polyArr,rgbArr){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);map.get(this)._FillPoly(polyArr,arrToColor(rgbArr))}setDrawBlend(blendMode){const bmIndex=BLEND_MODE_TO_INDEX.get(blendMode);if(typeof bmIndex!== +"number")throw new Error("invalid blend mode");map.get(this)._SetDrawBlend(bmIndex)}pasteInstances(instanceArr,includeFx=true){C3X.RequireArray(instanceArr);const inst=map.get(this);const runtime=inst.GetRuntime();return inst._PasteInstances(instanceArr.map(i=>runtime._UnwrapIWorldInstance(i)),!!includeFx)}getImagePixelData(){return map.get(this).GetImagePixelData()}loadImagePixelData(imageData,premultiplyAlpha=false){C3X.RequireInstanceOf(imageData,ImageData);map.get(this).LoadImagePixelData(imageData, +premultiplyAlpha,true)}get surfaceDeviceWidth(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget();if(!rt)throw new Error("invalid canvas size");return rt.GetWidth()}get surfaceDeviceHeight(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget();if(!rt)throw new Error("invalid canvas size");return rt.GetHeight()}getSurfaceDeviceSize(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget(); +if(!rt)throw new Error("invalid canvas size");return[rt.GetWidth(),rt.GetHeight()]}get pixelScale(){return map.get(this)._GetPixelScale()}}}{const C3=self.C3;C3.Plugins.DrawingCanvas.Cnds={OnSavedImage(){return true},OnSnapshot(){return true},OnResolutionChanged(){return true}}} +{const C3=self.C3;const tempColor1=C3.New(C3.Color);const tempColor2=C3.New(C3.Color);function RgbToColor(rgb){tempColor1.setFromRgbValue(rgb);return tempColor1}function RgbToColor2(rgb){tempColor2.setFromRgbValue(rgb);return tempColor2}C3.Plugins.DrawingCanvas.Acts={SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},SetResolutionMode(mode,fixedWidth,fixedHeight){if(mode===1)this._SetFixedResolutionMode(fixedWidth,fixedHeight);else this._SetAutoResolutionMode()}, +ClearCanvas(rgb){this._ClearCanvas(RgbToColor(rgb))},ClearRect(left,top,right,bottom,rgb){this._ClearRect(left,top,right,bottom,RgbToColor(rgb))},FillRect(left,top,right,bottom,rgb){this._FillRect(left,top,right,bottom,RgbToColor(rgb))},FillLinearGradient(left,top,right,bottom,rgb1,rgb2,dir){this._FillLinearGradient(left,top,right,bottom,RgbToColor(rgb1),RgbToColor2(rgb2),dir)},FillEllipse(x,y,radiusX,radiusY,rgb,edge){this._FillEllipse(x,y,radiusX,radiusY,RgbToColor(rgb),edge!==0)},OutlineEllipse(x, +y,radiusX,radiusY,rgb,thickness,edge){this._OutlineEllipse(x,y,radiusX,radiusY,RgbToColor(rgb),thickness,edge!==0)},OutlineRect(left,top,right,bottom,rgb,thickness){this._OutlineRect(left,top,right,bottom,RgbToColor(rgb),thickness)},Line(x1,y1,x2,y2,rgb,thickness,cap){const capStr=cap===0?"butt":"square";this._Line(x1,y1,x2,y2,RgbToColor(rgb),thickness,capStr)},LineDashed(x1,y1,x2,y2,rgb,thickness,dashLength,cap){const capStr=cap===0?"butt":"square";this._LineDashed(x1,y1,x2,y2,RgbToColor(rgb),thickness, +dashLength,capStr)},AddPolyPoint(x,y){this._currentPoly.push([x,y])},ResetPoly(){C3.clearArray(this._currentPoly)},LinePoly(rgb,thickness,cap){const capStr=cap===0?"butt":"square";this._LinePoly(this._currentPoly,RgbToColor(rgb),thickness,capStr)},LineDashedPoly(rgb,thickness,dashLength,cap){const capStr=cap===0?"butt":"square";this._LineDashedPoly(this._currentPoly,RgbToColor(rgb),thickness,dashLength,capStr)},FillPoly(rgb){this._FillPoly(this._currentPoly,RgbToColor(rgb))},SetDrawBlend(blendMode){if(blendMode>= +2)blendMode++;this._SetDrawBlend(blendMode)},PasteObject(objectClass,includeFx){if(!objectClass)return;return this._PasteInstances(objectClass.GetCurrentSol().GetInstances(),includeFx!==0)},SaveImage(format,quality,x,y,width,height){const formatStr=format===0?"image/png":"image/jpeg";quality/=100;const areaRect=C3.New(C3.Rect);areaRect.setWH(x,y,width,height);return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(async imageData=>{const imgDataBuffer= +imageData.data.buffer;const width=imageData.width;const height=imageData.height;const needFlipY=this._runtime.GetRenderer().IsWebGL();const processedBuffer=await this._runtime.AddJob("ProcessImageData",{"buffer":imgDataBuffer,"width":width,"height":height,"unpremultiply":true,"flipY":needFlipY&&!C3.Supports.ImageBitmapOptions},[imgDataBuffer]);imageData=new ImageData(new Uint8ClampedArray(processedBuffer),width,height);let blob;if(C3.Supports.ImageBitmapOptions){const imageBitmap=await createImageBitmap(imageData, +{"premultiplyAlpha":"none","imageOrientation":needFlipY?"flipY":"none"});blob=await C3.DrawableToBlob(imageBitmap,formatStr,quality)}else blob=await C3.ImageDataToBlob(imageData,formatStr,quality);if(this._savedImageUrl)URL.revokeObjectURL(this._savedImageUrl);this._savedImageUrl=URL.createObjectURL(blob);this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnSavedImage);resolve()},areaRect))})},SaveSnapshot(){return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(imageData=> +{this._snapshot=imageData;this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnSnapshot);resolve()}))})},ClearSnapshot(){this._snapshot=null},SnapshotSetPixel(x,y,rgb){this.SetSnapshotPixel(x,y,rgb)},LoadSnapshot(){if(!this._snapshot||!this._renderTarget)return;if(this._snapshot.width!==this._renderTarget.GetWidth()||this._snapshot.height!==this._renderTarget.GetHeight())return;this.LoadImagePixelData(this._snapshot,false)}}} +{const C3=self.C3;C3.Plugins.DrawingCanvas.Exps={SavedImageURL(){return this._savedImageUrl},SnapshotRedAt(x,y){return this.GetSnapshotPixel(x,y)[0]},SnapshotGreenAt(x,y){return this.GetSnapshotPixel(x,y)[1]},SnapshotBlueAt(x,y){return this.GetSnapshotPixel(x,y)[2]},SnapshotAlphaAt(x,y){return this.GetSnapshotPixel(x,y)[3]},SnapshotWidth(){return this._snapshot?this._snapshot.width:0},SnapshotHeight(){return this._snapshot?this._snapshot.height:0},PixelScale(){return this._GetPixelScale()},SurfaceDeviceWidth(){const rt= +this._GetRenderTarget();return rt?rt.GetWidth():0},SurfaceDeviceHeight(){const rt=this._GetRenderTarget();return rt?rt.GetHeight():0}}}; + +} + +{ +'use strict';const C3=self.C3;const tempQuad=C3.New(C3.Quad);const tempUvQuad=C3.New(C3.Quad);const tempVector2=C3.New(C3.Vector2);C3.Plugins.DrawingCanvas.DrawCommand=class DrawCommand{constructor(){}Do(renderer){throw new Error("required override");}};const DrawCommand=C3.Plugins.DrawingCanvas.DrawCommand; +DrawCommand.SaveImage=class SaveImageCommand extends DrawCommand{constructor(callback,areaRect){super();this._callback=callback;this._areaRect=areaRect}Do(renderer,scale,canvasInst){let readRenderTarget=renderer.GetRenderTarget();if(readRenderTarget.GetMultisampling()>=2){const texRenderTarget=canvasInst._GetTexRenderTarget();renderer.SetRenderTarget(texRenderTarget);renderer.CopyRenderTarget(readRenderTarget,"crop");renderer.SetRenderTarget(readRenderTarget);readRenderTarget=texRenderTarget}renderer.ReadBackRenderTargetToImageData(readRenderTarget, +false,this._areaRect).then(this._callback)}};DrawCommand.ClearCanvas=class ClearCanvasCommand extends DrawCommand{constructor(color){super();this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer){renderer.Clear(this._color)}}; +DrawCommand.ClearRect=class ClearRectCommand extends DrawCommand{constructor(left,top,right,bottom,color){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer,scale,canvasInst){this._rect.multiply(scale,scale);renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.SetBlendMode(3);renderer.Rect(this._rect);canvasInst._ApplyCurrentDrawingBlendMode(renderer)}}; +DrawCommand.FillRect=class FillRectCommand extends DrawCommand{constructor(left,top,right,bottom,color){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);this._rect.multiply(scale,scale);renderer.Rect(this._rect)}}; +DrawCommand.FillLinearGradient=class FillLinearGradientCommand extends DrawCommand{constructor(left,top,right,bottom,color1,color2,dir){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color1=C3.New(C3.Color,color1);this._color2=C3.New(C3.Color,color2);this._dir=dir}Do(renderer,scale){renderer.SetLinearGradientFillMode();renderer.SetColor(this._color1);renderer.SetGradientColor(this._color2);this._rect.multiply(scale,scale);tempQuad.setFromRect(this._rect);if(this._dir=== +0)tempUvQuad.set(0,0,1,0,1,1,0,1);else tempUvQuad.set(0,1,0,0,1,0,1,1);renderer.Quad4(tempQuad,tempUvQuad)}}; +DrawCommand.FillEllipse=class FillEllipseCommand extends DrawCommand{constructor(x,y,radiusX,radiusY,color,isSmooth){super();this._rect=C3.New(C3.Rect);this._rect.set(x-radiusX,y-radiusY,x+radiusX,y+radiusY);this._color=C3.New(C3.Color,color);this._color.premultiply();this._isSmooth=isSmooth}Do(renderer,scale){this._rect.multiply(scale,scale);if(this._isSmooth){renderer.SetSmoothEllipseFillMode();renderer.SetColor(this._color);this._rect.inflate(.5,.5);renderer.SetEllipseParams(1/this._rect.width(), +1/this._rect.height());renderer.Rect(this._rect)}else{renderer.SetHardEllipseFillMode();renderer.SetColor(this._color);renderer.Rect(this._rect)}}}; +DrawCommand.OutlineEllipse=class OutlinellipseCommand extends DrawCommand{constructor(x,y,radiusX,radiusY,color,thickness,isSmooth){super();this._rect=C3.New(C3.Rect);this._rect.set(x-radiusX,y-radiusY,x+radiusX,y+radiusY);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._isSmooth=isSmooth}Do(renderer,scale){this._rect.multiply(scale,scale);if(this._isSmooth){renderer.SetSmoothEllipseOutlineMode();renderer.SetColor(this._color);this._rect.inflate(.5,.5); +renderer.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*scale);renderer.Rect(this._rect)}else{renderer.SetHardEllipseOutlineMode();renderer.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*scale);renderer.SetColor(this._color);renderer.Rect(this._rect)}}}; +DrawCommand.OutlineRect=class OutlineRectCommand extends DrawCommand{constructor(left,top,right,bottom,color,thickness){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCapZag();renderer.PushLineWidth(this._thickness*scale);this._rect.multiply(scale,scale);renderer.LineRect2(this._rect);renderer.PopLineCap(); +renderer.PopLineWidth()}}; +DrawCommand.Line=class LineCommand extends DrawCommand{constructor(x1,y1,x2,y2,color,thickness,cap){super();this._rect=C3.New(C3.Rect);this._rect.set(x1,y1,x2,y2);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._cap=cap}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCap(this._cap);renderer.PushLineWidth(this._thickness*scale);const rc=this._rect;rc.multiply(scale,scale);renderer.Line(rc.getLeft(),rc.getTop(), +rc.getRight(),rc.getBottom());renderer.PopLineCap();renderer.PopLineWidth()}}; +DrawCommand.LinePoly=class LinePolyCommand extends DrawCommand{constructor(poly,color,thickness,cap){super();this._poly=poly;this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._cap=cap}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCap(this._cap);renderer.PushLineWidth(this._thickness*scale);const poly=this._poly;for(let i=0,len=poly.length;ithis._SaveInstanceState(inst,canvasWi))}_SaveInstanceState(inst,canvasWi){const canvasAngle=canvasWi.GetAngle(); +const canvasLayer=canvasWi.GetLayer();const instWi=inst.GetWorldInfo();const instLayer=instWi.GetLayer();const oldX=instWi.GetX();const oldY=instWi.GetY();const oldWidth=instWi.GetWidth();const oldHeight=instWi.GetHeight();const oldAngle=instWi.GetAngle();if(!this._layerTransforms.has(instLayer))this._layerTransforms.set(instLayer,instLayer.SaveTransform());const areLayerTransformsCompatible=canvasLayer.IsTransformCompatibleWith(instLayer);if(!areLayerTransformsCompatible){const [dsx,dsy]=instLayer.LayerToDrawSurface(oldX, +oldY);const [tx,ty]=canvasLayer.DrawSurfaceToLayer(dsx,dsy);instWi.SetXY(tx,ty);const scaleFactor=instLayer.GetNormalScale()/canvasLayer.GetNormalScale();instWi.SetSize(oldWidth*scaleFactor,oldHeight*scaleFactor);const angleOffset=canvasLayer.GetOwnAngle()-instLayer.GetOwnAngle();instWi.OffsetAngle(angleOffset)}if(canvasAngle!==0){const canvasQuad=canvasWi.GetBoundingQuad();const canvasMidX=canvasQuad.midX();const canvasMidY=canvasQuad.midY();const sinA=-canvasWi.GetSinAngle();const cosA=canvasWi.GetCosAngle(); +tempVector2.set(oldX,oldY);tempVector2.offset(-canvasMidX,-canvasMidY);tempVector2.rotatePrecalc(sinA,cosA);tempVector2.offset(canvasMidX,canvasMidY);instWi.SetXY(tempVector2.getX(),tempVector2.getY());instWi.OffsetAngle(-canvasAngle)}if(canvasAngle!==0||!areLayerTransformsCompatible)instWi.SetBboxChanged();const ret=[inst,inst.SaveToJson("visual-state")];if(canvasAngle!==0||!areLayerTransformsCompatible){instWi.SetXY(oldX,oldY);instWi.SetSize(oldWidth,oldHeight);instWi.SetAngle(oldAngle);instWi.SetBboxChanged()}return ret}Do(renderer, +scale,canvasInst){const canvasManager=canvasInst.GetRuntime().GetCanvasManager();const layer=canvasInst.GetWorldInfo().GetLayer();const layout=layer.GetLayout();const viewport=layer.GetViewport();const canvasBbox=canvasInst.GetWorldInfo().GetBoundingBox();const renderTarget=canvasInst._GetRenderTarget();const isMultisamplng=canvasInst.GetMultisampling()>=2;const includeFx=this._includeFx;const restoreLayoutTransform=layout.SaveTransform();layout.RestoreTransform(this._layoutTransform);const restoreLayerTransforms= +new Map;for(const [layer,transform]of this._layerTransforms){restoreLayerTransforms.set(layer,layer.SaveTransform());layer.RestoreTransform(transform)}canvasManager.SetIsPastingToDrawingCanvas(true);const viewOffX=(viewport.width()-canvasBbox.width())/-2;const viewOffY=(viewport.height()-canvasBbox.height())/-2;const [canvasDeviceLeft,canvasDeviceTop]=layer.LayerToDrawSurface(canvasBbox.getLeft(),canvasBbox.getTop());canvasManager.SetDeviceTransformOffset(canvasDeviceLeft,canvasDeviceTop);const canvasOffX= +canvasBbox.getLeft()-viewport.getLeft();const canvasOffY=canvasBbox.getTop()-viewport.getTop();const offX=viewOffX+canvasOffX;const offY=viewOffY+canvasOffY;const viewH=renderTarget.GetHeight();let effectiveScale=1;if(canvasInst.IsFixedResolutionMode())effectiveScale=renderTarget.GetWidth()/Math.floor(canvasBbox.width())/layer.GetNormalScale();else effectiveScale=canvasManager.GetRenderScale()*self.devicePixelRatio;const effectiveViewH=viewH/effectiveScale;const pxOff=.5/effectiveScale;renderer.SetProjectionMatrix(renderTarget.GetProjectionMatrix()); +layer._SetTransform(renderer,false,offX+pxOff,offY+pxOff,effectiveViewH);for(let i=0,len=this._instances.length;i{layer._SetTransform(renderer);drawContent();effectChain._SetDeviceTransform(renderer)},compositOffX:canvasDeviceLeft,compositOffY:canvasDeviceTop,updateOwnProjection:true};inst._SetIsDrawingWithEffects(true);if(layer._DrawInstanceWithEffects(inst,wi,renderer,renderTarget,opts))layer._SetTransform(renderer,false,offX+pxOff,offY+pxOff,effectiveViewH);inst._SetIsDrawingWithEffects(false)}else layer._DrawInstance(inst,wi,renderer);inst.LoadFromJson(oldState, +"visual-state")}canvasManager.SetDeviceTransformOffset(0,0);canvasManager.SetIsPastingToDrawingCanvas(false);canvasInst._SetRenderTargetDeviceTransform(renderer);canvasInst._ApplyCurrentDrawingBlendMode(renderer);layout.RestoreTransform(restoreLayoutTransform);for(const [layer,transform]of restoreLayerTransforms)layer.RestoreTransform(transform);this._resolve()}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Arr=class ArrayPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Arr.Type=class ArrayType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;function ResizeArray(arr,len,data){if(lenarr.length)if(typeof data==="function")for(let i=arr.length;iC3.MakeFilledArray(this._cy,()=>C3.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(x,y,z){x=Math.floor(x);y=Math.floor(y);z=Math.floor(z);if(x>=0&&x=0&&y=0&&z=0&&x=0&&y=0&&zC3.MakeFilledArray(h,()=>C3.MakeFilledArray(d,0)));for(let x=0;xC3.MakeFilledArray(d,0));for(let y=0;y0){const i=Math.floor(this._runtime.Random()*len);--len;if(axis===0){const v1=this.At(len,y,z);const v2=this.At(i,y,z);this.Set(len,y,z,v2);this.Set(i,y,z,v1)}else if(axis===1){const v1=this.At(x,len,z);const v2=this.At(x,i,z);this.Set(x,len,z,v2);this.Set(x,i,z,v1)}else if(axis===2){const v1=this.At(x,y,len);const v2=this.At(x,y,i);this.Set(x,y,len,v2);this.Set(x,y,i,v1)}}}GetDebuggerProperties(){const prefix="plugins.arr.debugger";const propsPrefix="plugins.arr.properties";const ret= +[{title:prefix+".array-properties.title",properties:[{name:propsPrefix+".width.name",value:this._cx,onedit:v=>this.SetSize(v,this._cy,this._cz)},{name:propsPrefix+".height.name",value:this._cy,onedit:v=>this.SetSize(this._cx,v,this._cz)},{name:propsPrefix+".depth.name",value:this._cz,onedit:v=>this.SetSize(this._cx,this._cy,v)},{name:propsPrefix+".elements.name",value:this._cx*this._cy*this._cz}]}];const dataProps=[];if(this._cy===1&&this._cz===1)for(let x=0;xthis._arr[x][0][0]=v});else for(let x=0;x=0&&this._forDepth=0&&this._forDepth=0&&this._forDepthsb)return 1;else return 0}}C3.Plugins.Arr.Acts={Clear(v){const cx=this._cx;const cy=this._cy;const cz=this._cz;const arr=this._arr;for(let x=0;xC3.MakeFilledArray(cz,value));if(where===0)arr.push(add);else arr.unshift(add);this._cx++}else if(axis===1){for(let x=0;xCompareValues(a[0][0],b[0][0]));else if(axis===1)for(let x=0;xCompareValues(a[0],b[0]));else for(let x=0;x=cx)return;arr.splice(index,1);this._cx--}else if(axis===1){if(index>=cy)return;for(let x=0;x=cz)return;for(let x=0;xcx)return;arr.splice(index,0,C3.MakeFilledArray(cy, +()=>C3.MakeFilledArray(cz,value)));this._cx++}else if(axis===1){if(index>cy)return;for(let x=0;xcz)return;for(let x=0;x=0;--x)if(arr[x][0][0]===v)return x;return-1},JoinString(sep){let arr=[];for(let x=0;xthis._OnPointerLockChange(e)],["pointer-lock-error",e=>this._OnPointerLockError(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data)),C3.Disposable.From(rt,"dblclick",e=>this._OnDoubleClick(e.data)),C3.Disposable.From(rt,"wheel",e=>this._OnMouseWheel(e.data)),C3.Disposable.From(rt, +"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(e){if(e["pointerType"]!=="mouse")return;this._mouseXcanvas=e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerMove(e){this._movementX=e["movementX"];this._movementY=e["movementY"];this.Trigger(C3.Plugins.Mouse.Cnds.OnMovement);this._movementX=0;this._movementY=0;if(e["pointerType"]!=="mouse")return; +this._mouseXcanvas=e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerUp(e){if(e["pointerType"]!=="mouse")return;this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_CheckButtonChanges(lastButtons,buttons){this._CheckButtonChange(lastButtons,buttons,1,0);this._CheckButtonChange(lastButtons,buttons,4,1);this._CheckButtonChange(lastButtons,buttons,2,2)}_CheckButtonChange(lastButtons, +buttons,checkButtonFlag,resultButton){if(!(lastButtons&checkButtonFlag)&&buttons&checkButtonFlag)this._OnMouseDown(resultButton);else if(lastButtons&checkButtonFlag&&!(buttons&checkButtonFlag))this._OnMouseUp(resultButton)}_OnMouseDown(button){this._buttonMap[button]=true;this.Trigger(C3.Plugins.Mouse.Cnds.OnAnyClick);this._triggerButton=button;this._triggerType=0;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(button){if(!this._buttonMap[button])return; +this._buttonMap[button]=false;this._triggerButton=button;this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}_OnDoubleClick(e){this._triggerButton=e["button"];this._triggerType=1;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(e){this._triggerDir=e["deltaY"]<0?1:0;this._wheelDeltaX=e["deltaX"];this._wheelDeltaY=e["deltaY"];this._wheelDeltaZ=e["deltaZ"];this.Trigger(C3.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let i=0,len=this._buttonMap.length;i< +len;++i){if(!this._buttonMap[i])return;this._buttonMap[i]=false;this._triggerButton=i;this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}}GetMousePositionForLayer(layerNameOrNumber){const layout=this._runtime.GetMainRunningLayout();const x=this._mouseXcanvas;const y=this._mouseYcanvas;if(typeof layerNameOrNumber==="undefined"){const layer=layout.GetLayerByIndex(0);return layer.CanvasCssToLayer_DefaultTransform(x,y)}else{const layer=layout.GetLayer(layerNameOrNumber);if(layer)return layer.CanvasCssToLayer(x, +y);else return[0,0]}}IsMouseButtonDown(button){button=Math.floor(button);return!!this._buttonMap[button]}_IsMouseOverCanvas(){return this._mouseXcanvas>=0&&this._mouseYcanvas>=0&&this._mouseXcanvas({name:"$"+layer.GetName(),value:layer.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}} +{const C3=self.C3;C3.Plugins.Mouse.Cnds={OnClick(button,type){return this._triggerButton===button&&this._triggerType===type},OnAnyClick(){return true},IsButtonDown(button){return this._buttonMap[button]},OnRelease(button){return this._triggerButton===button},IsOverObject(objectClass){if(!this._IsMouseOverCanvas())return false;const cnd=this._runtime.GetCurrentCondition();const isInverted=cnd.IsInverted();const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return C3.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +mx,my,isInverted),isInverted)},OnObjectClicked(button,type,objectClass){if(button!==this._triggerButton||type!==this._triggerType)return false;if(!this._IsMouseOverCanvas())return false;const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,mx,my,false)},OnWheel(dir){return dir===2||this._triggerDir===dir},OnPointerLocked(){return true},OnPointerUnlocked(){return true},OnPointerLockError(){return true},HasPointerLock(){return this._hasPointerLock}, +OnMovement(){return true}}}{const C3=self.C3;const CURSOR_STYLES=["auto","pointer","text","crosshair","move","help","wait","none"];C3.Plugins.Mouse.Acts={SetCursor(c){this.SetCursorStyle(CURSOR_STYLES[c])},SetCursorSprite(objectClass){this.SetCursorObjectClass(objectClass)},RequestPointerLock(){this._PostToDOMMaybeSync("request-pointer-lock")},ReleasePointerLock(){this.PostToDOM("release-pointer-lock")}}} +{const C3=self.C3;C3.Plugins.Mouse.Exps={X(layerParam){return this.GetMousePositionForLayer(layerParam)[0]},Y(layerParam){return this.GetMousePositionForLayer(layerParam)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas},MovementX(){return this._movementX},MovementY(){return this._movementY},WheelDeltaX(){return this._wheelDeltaX},WheelDeltaY(){return this._wheelDeltaY},WheelDeltaZ(){return this._wheelDeltaZ}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Particles=class ParticlesPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Particles.Type=class ParticlesType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const RATE=0;const SPRAY_CONE=1;const TYPE=2;const SPAWNOBJECTCLASS=3;const INITIALLY_VISIBLE=4;const SPEED=5;const SIZE=6;const OPACITY=7;const GROW_RATE=8;const X_RANDOMISER=9;const Y_RANDOMISER=10;const INITIAL_SPEED_RANDOMISER=11;const SIZE_RANDOMISER=12;const GROW_RATE_RANDOMISER=13;const ACCELERATION=14;const GRAVITY=15;const ANGLE_RANDOMISER=16;const LIFE_SPEED_RANDOMISER=17;const OPACITY_RANDOMISER=18;const DESTROY_MODE=19;const TIMEOUT=20;const CONTINUOUS= +0;const ONE_SHOT=1;const tempRect=C3.New(C3.Rect);C3.Plugins.Particles.Instance=class ParticlesInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._isFirstTick=true;const pe=C3.New(self.ParticleEngine);this._particleEngine=pe;pe.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(inst,dx,dy,dSize,dAngle,dOpacity)=>this._OnParticleUpdate(inst,dx,dy,dSize,dAngle,dOpacity);this._particleDestroyCallback=inst=>this._OnParticleDestroy(inst); +this._hasAnyDefaultParticle=true;let isInitiallyVisible=true;if(properties){pe.SetRate(properties[RATE]);pe.SetSprayCone(C3.toRadians(properties[SPRAY_CONE]));pe.SetSprayType(properties[TYPE]?"one-shot":"continuous-spray");this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(properties[SPAWNOBJECTCLASS]));isInitiallyVisible=properties[INITIALLY_VISIBLE];pe.SetInitSpeed(properties[SPEED]);pe.SetInitSize(properties[SIZE]);pe.SetInitOpacity(properties[OPACITY]/100);pe.SetGrowRate(properties[GROW_RATE]); +pe.SetInitXRandom(properties[X_RANDOMISER]);pe.SetInitYRandom(properties[Y_RANDOMISER]);pe.SetInitSpeedRandom(properties[INITIAL_SPEED_RANDOMISER]);pe.SetInitSizeRandom(properties[SIZE_RANDOMISER]);pe.SetGrowRandom(properties[GROW_RATE_RANDOMISER]);pe.SetAcceleration(properties[ACCELERATION]);pe.SetGravity(properties[GRAVITY]);pe.SetLifeAngleRandom(properties[ANGLE_RANDOMISER]);pe.SetLifeSpeedRandom(properties[LIFE_SPEED_RANDOMISER]);pe.SetLifeOpacityRandom(properties[OPACITY_RANDOMISER]);pe.SetDestroyModeIndex(properties[DESTROY_MODE]); +pe.SetTimeout(properties[TIMEOUT])}this._UpdateEngineParameters();if(this._spawnObjectClass)this._hasAnyDefaultParticle=false;if(pe.GetSprayType()==="one-shot")pe.CreateOneShotSpray();else pe.SetSpraying(true);const wi=this.GetWorldInfo();wi.SetVisible(isInitiallyVisible);wi.SetBboxChangeEventEnabled(true);this._inst.Dispatcher().addEventListener("bboxchange",()=>{wi.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});if(this.GetRuntime().GetRenderer().IsWebGPU())wi.SetUsePointsShaderProgram(); +this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad);this._StartTicking()}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._particleEngine.Release();this._particleEngine=null;this._particleUpdateCallback=null;this._particleDestroyCallback=null;super.Release()}GetParticleEngine(){return this._particleEngine}_SetRate(r){this._particleEngine.SetRate(r);if(this._particleEngine.GetSprayType()=== +"one-shot"&&this._isFirstTick)this._particleEngine.SetParticleCount(r)}_SetParticleObjectClass(objectClass){if(objectClass===this.GetObjectClass())objectClass=null;if(objectClass===this._spawnObjectClass)return;this._spawnObjectClass=objectClass;this._particleEngine.onparticlecreate=objectClass?p=>this._OnParticleCreate(p):null;if(!this._spawnObjectClass)this._hasAnyDefaultParticle=true}_UpdateEngineParameters(){const pe=this._particleEngine;const wi=this.GetWorldInfo();pe.SetMasterOpacity(wi.GetOpacity()); +pe.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());pe.SetSpawnX(wi.GetX());pe.SetSpawnY(wi.GetY());pe.SetSpawnAngle(wi.GetAngle());pe.SetInitSizeScale(Math.abs(wi.GetSceneGraphScale()))}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(renderer){if(!this._hasAnyDefaultParticle)return;const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;const wi=this.GetWorldInfo();const layer=wi.GetLayer();const viewport=tempRect;if(this._runtime.GetCanvasManager().IsPastingToDrawingCanvas())viewport.set(-Infinity, +-Infinity,Infinity,Infinity);else if(layer.Has3DCamera())layer.CalculateViewport3D(wi.GetTotalZElevation(),viewport);else layer.GetViewportForZ(wi.GetTotalZElevation(),viewport);renderer.SetTexture(texture);const zScaleFactor=layer.Get2DScaleFactorToZ(wi.GetTotalZElevation());this._particleEngine.SetParticleScale(layer.GetRenderScale()*zScaleFactor);this._particleEngine.Draw(renderer,imageInfo.GetTexQuad(),viewport,layer.Has3DCamera())}SaveToJson(){const pe=this._particleEngine;return{"r":pe.GetRate(), +"sc":pe.GetSprayCone(),"st":pe.GetSprayType(),"isp":pe.GetInitSpeed(),"isz":pe.GetInitSize(),"io":pe.GetInitOpacity(),"gr":pe.GetGrowRate(),"xr":pe.GetInitXRandom(),"yr":pe.GetInitYRandom(),"spr":pe.GetInitSpeedRandom(),"szr":pe.GetInitSizeRandom(),"grnd":pe.GetGrowRandom(),"acc":pe.GetAcceleration(),"g":pe.GetGravity(),"lar":pe.GetLifeAngleRandom(),"lsr":pe.GetLifeSpeedRandom(),"lor":pe.GetLifeOpacityRandom(),"dm":pe.GetDestroyModeIndex(),"to":pe.GetTimeout(),"s":pe.IsSpraying(),"pcc":pe._GetCreateCounter(), +"ft":this._isFirstTick,"soc":this._spawnObjectClass?this._spawnObjectClass.GetSID():null,"p":pe.GetParticles().map(p=>p.toJSON())}}LoadFromJson(o,mode){const pe=this._particleEngine;pe.SetRate(o["r"]);pe.SetSprayCone(o["sc"]);pe.SetSprayType(o["st"]);pe.SetInitSpeed(o["isp"]);pe.SetInitSize(o["isz"]);pe.SetInitOpacity(o["io"]);pe.SetGrowRate(o["gr"]);pe.SetInitXRandom(o["xr"]);pe.SetInitYRandom(o["yr"]);pe.SetInitSpeedRandom(o["spr"]);pe.SetInitSizeRandom(o["szr"]);pe.SetGrowRandom(o["grnd"]);pe.SetAcceleration(o["acc"]); +pe.SetGravity(o["g"]);pe.SetLifeAngleRandom(o["lar"]);pe.SetLifeSpeedRandom(o["lsr"]);pe.SetLifeOpacityRandom(o["lor"]);pe.SetDestroyModeIndex(o["dm"]);pe.SetTimeout(o["to"]);pe.SetSpraying(o["s"]);pe._SetCreateCounter(o["pcc"]);this._isFirstTick=o["ft"];if(o.hasOwnProperty("soc")){const objectClass=this.GetRuntime().GetObjectClassBySID(o["soc"]);if(objectClass)this._SetParticleObjectClass(objectClass)}const particlesData=o["p"];pe.SetParticleCount(particlesData.length);const particles=pe.GetParticles(); +for(let i=0,len=particles.length;i0){this._particleEngine.Tick(FF_DT);time-=FF_DT}if(this._particleEngine.IsSpraying())this._runtime.UpdateRender(); +this.GetWorldInfo().SetBboxChanged();this._isFirstTick=false}_OnParticleCreate(p){const inst=this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),p.GetX(),p.GetY());const wi=inst.GetWorldInfo();wi.SetSize(p.GetSize(),p.GetSize());wi.SetAngle(p.GetAngle());wi.SetOpacity(p.GetOpacity());wi.SetUnpremultipliedColor(this.GetWorldInfo().GetUnpremultipliedColor());wi.SetBboxChanged();wi.ZOrderMoveAdjacentToInstance(this.GetInstance(),true);inst._TriggerOnCreated();p.SetUpdateCallback(this._particleUpdateCallback); +p.SetDestroyCallback(this._particleDestroyCallback);return inst}_OnParticleUpdate(inst,dx,dy,dSize,dAngle,dOpacity){if(inst.IsDestroyed())return;const wi=inst.GetWorldInfo();wi.OffsetXY(dx,dy);wi.SetSize(wi.GetWidth()+dSize,wi.GetHeight()+dSize);wi.SetAngle(wi.GetAngle()+dAngle);wi.SetOpacity(wi.GetOpacity()+dOpacity);wi.SetBboxChanged()}_OnParticleDestroy(inst){if(inst.IsDestroyed())return;this._runtime.DestroyInstance(inst)}GetPropertyValueByIndex(index){const pe=this._particleEngine;switch(index){case RATE:return pe.GetRate(); +case SPRAY_CONE:return C3.toDegrees(pe.GetSprayCone());case TYPE:return pe.GetSprayType()==="one-shot"?ONE_SHOT:CONTINUOUS;case SPEED:return pe.GetInitSpeed();case SIZE:return pe.GetInitSize();case OPACITY:return pe.GetInitOpacity()*100;case GROW_RATE:return pe.GetGrowRate();case X_RANDOMISER:return pe.GetInitXRandom();case Y_RANDOMISER:return pe.GetInitYRandom();case INITIAL_SPEED_RANDOMISER:return pe.GetInitSpeedRandom();case SIZE_RANDOMISER:return pe.GetInitSizeRandom();case GROW_RATE_RANDOMISER:return pe.GetGrowRandom(); +case ACCELERATION:return pe.GetAcceleration();case GRAVITY:return pe.GetGravity();case ANGLE_RANDOMISER:return pe.GetLifeAngleRandom();case LIFE_SPEED_RANDOMISER:return pe.GetLifeSpeedRandom();case OPACITY_RANDOMISER:return pe.GetLifeOpacityRandom();case DESTROY_MODE:return pe.GetDestroyModeIndex();case TIMEOUT:return pe.GetTimeout()}}SetPropertyValueByIndex(index,value){const pe=this._particleEngine;switch(index){case RATE:pe.SetRate(value);break;case SPRAY_CONE:pe.SetSprayCone(C3.toRadians(value)); +break;case TYPE:pe.SetSprayType(value?"one-shot":"continuous-spray");break;case SPEED:pe.SetInitSpeed(value);break;case SIZE:pe.SetInitSize(value);break;case OPACITY:pe.SetInitOpacity(value/100);break;case GROW_RATE:pe.SetGrowRate(value);break;case X_RANDOMISER:pe.SetInitXRandom(value);break;case Y_RANDOMISER:pe.SetInitYRandom(value);break;case INITIAL_SPEED_RANDOMISER:pe.SetInitSpeedRandom(value);break;case SIZE_RANDOMISER:pe.SetInitSizeRandom(value);break;case GROW_RATE_RANDOMISER:pe.SetGrowRandom(value); +break;case ACCELERATION:pe.SetAcceleration(value);break;case GRAVITY:pe.SetGravity(value);break;case ANGLE_RANDOMISER:pe.SetLifeAngleRandom(value);break;case LIFE_SPEED_RANDOMISER:pe.SetLifeSpeedRandom(value);break;case OPACITY_RANDOMISER:pe.SetLifeOpacityRandom(value);break;case DESTROY_MODE:pe.SetDestroyModeIndex(value);break;case TIMEOUT:pe.SetTimeout(value);break}}GetDebuggerProperties(){const prefix="plugins.particles";const propPrefix=prefix+".properties";const dbgPrefix=prefix+".debugger"; +const pe=this._particleEngine;return[{title:prefix+".name",properties:[{name:dbgPrefix+".particle-count",value:pe.GetParticleCount()},{name:propPrefix+".type.name",value:[propPrefix+".type.items."+pe.GetSprayType()]},{name:dbgPrefix+".is-spraying",value:pe.IsSpraying(),onedit:v=>pe.SetSpraying(v)},{name:propPrefix+".rate.name",value:pe.GetRate(),onedit:v=>pe.SetRate(v)},{name:propPrefix+".spray-cone.name",value:C3.toDegrees(pe.GetSprayCone()),onedit:v=>pe.SetSprayCone(C3.toRadians(v))},{name:propPrefix+ +".speed.name",value:pe.GetInitSpeed(),onedit:v=>pe.SetInitSpeed(v)},{name:propPrefix+".size.name",value:pe.GetInitSize(),onedit:v=>pe.SetInitSize(v)},{name:propPrefix+".opacity.name",value:pe.GetInitOpacity(),onedit:v=>pe.SetInitOpacity(v)},{name:propPrefix+".grow-rate.name",value:pe.GetGrowRate(),onedit:v=>pe.SetGrowRate(v)},{name:propPrefix+".x-randomiser.name",value:pe.GetInitXRandom(),onedit:v=>pe.SetInitXRandom(v)},{name:propPrefix+".y-randomiser.name",value:pe.GetInitYRandom(),onedit:v=>pe.SetInitYRandom(v)}, +{name:propPrefix+".initial-speed-randomiser.name",value:pe.GetInitSpeedRandom(),onedit:v=>pe.SetInitSpeedRandom(v)},{name:propPrefix+".size-randomiser.name",value:pe.GetInitSizeRandom(),onedit:v=>pe.SetInitSizeRandom(v)},{name:propPrefix+".grow-rate-randomiser.name",value:pe.GetGrowRandom(),onedit:v=>pe.SetGrowRandom(v)},{name:propPrefix+".acceleration.name",value:pe.GetAcceleration(),onedit:v=>pe.SetAcceleration(v)},{name:propPrefix+".gravity.name",value:pe.GetGravity(),onedit:v=>pe.SetGravity(v)}, +{name:propPrefix+".angle-randomiser.name",value:pe.GetLifeAngleRandom(),onedit:v=>pe.SetLifeAngleRandom(v)},{name:propPrefix+".life-speed-randomiser.name",value:pe.GetLifeSpeedRandom(),onedit:v=>pe.SetLifeSpeedRandom(v)},{name:propPrefix+".opacity-randomiser.name",value:pe.GetLifeOpacityRandom(),onedit:v=>pe.SetLifeOpacityRandom(v)},{name:propPrefix+".timeout.name",value:pe.GetTimeout(),onedit:v=>pe.SetTimeout(v)}]}]}GetScriptInterfaceClass(){return self.IParticlesInstance}};const map=new WeakMap; +function GetParticleEngine(iinst){return map.get(iinst).GetParticleEngine()}self.IParticlesInstance=class IParticlesInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set isSpraying(s){GetParticleEngine(this).SetSpraying(!!s)}get isSpraying(){return GetParticleEngine(this).IsSpraying()}set rate(r){C3X.RequireFiniteNumber(r);map.get(this)._SetRate(r)}get rate(){return GetParticleEngine(this).GetRate()}set sprayCone(c){C3X.RequireFiniteNumber(c); +GetParticleEngine(this).SetSprayCone(c)}get sprayCone(){return GetParticleEngine(this).GetSprayCone()}set initSpeed(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSpeed(s)}get initSpeed(){return GetParticleEngine(this).GetInitSpeed()}set initSize(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSize(s)}get initSize(){return GetParticleEngine(this).GetInitSize()}set initOpacity(o){C3X.RequireFiniteNumber(o);GetParticleEngine(this).SetInitOpacity(o)}get initOpacity(){return GetParticleEngine(this).GetInitOpacity()}set initXRandom(x){C3X.RequireFiniteNumber(x); +GetParticleEngine(this).SetInitXRandom(x)}get initXRandom(){return GetParticleEngine(this).GetInitXRandom()}set initYRandom(y){C3X.RequireFiniteNumber(y);GetParticleEngine(this).SetInitYRandom(y)}get initYRandom(){return GetParticleEngine(this).GetInitYRandom()}set initSpeedRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSpeedRandom(s)}get initSpeedRandom(){return GetParticleEngine(this).GetInitSpeedRandom()}set initSizeRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSizeRandom(s)}get initSizeRandom(){return GetParticleEngine(this).GetInitSizeRandom()}set initGrowRate(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetGrowRate(r)}get initGrowRate(){return GetParticleEngine(this).GetGrowRate()}set initGrowRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetGrowRandom(r)}get initGrowRandom(){return GetParticleEngine(this).GetGrowRandom()}set acceleration(a){C3X.RequireFiniteNumber(a);GetParticleEngine(this).SetAcceleration(a)}get acceleration(){return GetParticleEngine(this).GetAcceleration()}set gravity(g){C3X.RequireFiniteNumber(g);GetParticleEngine(this).SetGravity(g)}get gravity(){return GetParticleEngine(this).GetGravity()}set lifeAngleRandom(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetLifeAngleRandom(r)}get lifeAngleRandom(){return GetParticleEngine(this).GetLifeAngleRandom()}set lifeSpeedRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeSpeedRandom(r)}get lifeSpeedRandom(){return GetParticleEngine(this).GetLifeSpeedRandom()}set lifeOpacityRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeOpacityRandom(r)}get lifeOpacityRandom(){return GetParticleEngine(this).GetLifeOpacityRandom()}set timeout(t){C3X.RequireFiniteNumber(t); +GetParticleEngine(this).SetTimeout(t)}get timeout(){return GetParticleEngine(this).GetTimeout()}fastForward(time){C3X.RequireFiniteNumber(time);map.get(this)._FastForward(time)}setParticleObjectClass(iObjectClass){const inst=map.get(this);if(iObjectClass)inst._SetParticleObjectClass(inst.GetRuntime()._UnwrapIObjectClass(iObjectClass));else inst._SetParticleObjectClass(null)}}}{const C3=self.C3;C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}}} +{const C3=self.C3;C3.Plugins.Particles.Acts={SetSpraying(s){this._particleEngine.SetSpraying(s!==0)},SetRate(r){this._SetRate(r)},SetParticleObject(objectClass){this._SetParticleObjectClass(objectClass)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(c){this._particleEngine.SetSprayCone(C3.toRadians(c))},SetInitSpeed(x){this._particleEngine.SetInitSpeed(x)},SetInitSize(x){this._particleEngine.SetInitSize(x)},SetInitOpacity(x){this._particleEngine.SetInitOpacity(x/100)},SetGrowRate(x){this._particleEngine.SetGrowRate(x)}, +SetXRandomiser(x){this._particleEngine.SetInitXRandom(x)},SetYRandomiser(x){this._particleEngine.SetInitYRandom(x)},SetSpeedRandomiser(x){this._particleEngine.SetInitSpeedRandom(x)},SetSizeRandomiser(x){this._particleEngine.SetInitSizeRandom(x)},SetGrowRateRandomiser(x){this._particleEngine.SetGrowRandom(x)},SetParticleAcc(x){this._particleEngine.SetAcceleration(x)},SetGravity(x){this._particleEngine.SetGravity(x)},SetAngleRandomiser(x){this._particleEngine.SetLifeAngleRandom(x)},SetLifeSpeedRandomiser(x){this._particleEngine.SetLifeSpeedRandom(x)}, +SetOpacityRandomiser(x){this._particleEngine.SetLifeOpacityRandom(x)},SetTimeout(x){this._particleEngine.SetTimeout(x)},FastForward(time){this._FastForward(time)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return C3.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return this._particleEngine.GetInitOpacity()*100},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()}, +YRandom(){return this._particleEngine.GetInitYRandom()},InitSizeRandom(){return this._particleEngine.GetInitSizeRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()}, +ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}}}; + +} + +{ +'use strict';const C3=self.C3;const inactiveParticles=[];const MAX_RECYCLE_PARTICLES=1E3;const VALID_SPRAY_TYPES=new Set(["continuous-spray","one-shot"]);const DESTROY_MODES=["fade-to-invisible","timeout-expired","particle-stopped"];const tempRect=C3.New(C3.Rect); +self.ParticleEngine=class ParticleEngine{constructor(){this._rate=0;this._sprayCone=0;this._sprayType="continuous-spray";this._isSpraying=false;this._masterOpacity=0;this._isPixelRounding=false;this._spawnX=0;this._spawnY=0;this._spawnAngle=0;this._initSpeed=0;this._initSize=0;this._initSizeScale=1;this._initOpacity=0;this._growRate=0;this._xRandom=0;this._yRandom=0;this._initSpeedRandom=0;this._initSizeRandom=0;this._growRandom=0;this._acceleration=0;this._gravity=0;this._lifeAngleRandom=0;this._lifeSpeedRandom= +0;this._lifeOpacityRandom=0;this._destroyMode=0;this._timeout=0;this._createCounter=0;this._particleScale=1;this.ononeshotfinish=null;this.onparticlecreate=null;this._particles=[];this._boundingBox=new C3.Rect;this._color=new C3.Color}Release(){this.Cancel();C3.clearArray(this._particles);this._particles=null;this.ononeshotfinish=null;this.onparticlecreate=null;this._boundingBox=null;this._color=null}Cancel(){const particles=this._particles;for(let i=0,len=particles.length;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES);this._isSpraying=false}CreateOneShotSpray(){for(let i=0,len=this._rate;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}else if(c>particles.length){const diff=c-particles.length;for(let i=0;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}_MaybeFinishOneShot(){if(this._sprayType==="one-shot"&&this._particles.length===0&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=false}}Draw(renderer,texQuad,viewport,forceQuads){tempRect.set(texQuad.getTlx(),texQuad.getTly(),texQuad.getBrx(),texQuad.getBry());renderer.StartRenderingPoints(tempRect); +this._color.copy(renderer.GetColor());const particles=this._particles;for(let i=0,len=particles.length;i=1&&(engine.GetDestroyModeIndex()===2?this._speed>0:this._agerenderer.GetMaxPointSize()||scaledSizethis._OnPermissionResult(e));const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data,false)),C3.Disposable.From(rt, +"pointercancel",e=>this._OnPointerUp(e.data,true)),C3.Disposable.From(rt,"deviceorientation",e=>this._OnDeviceOrientation(e.data)),C3.Disposable.From(rt,"deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e.data)),C3.Disposable.From(rt,"devicemotion",e=>this._OnDeviceMotion(e.data)),C3.Disposable.From(rt,"tick2",e=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(e){if(e["pointerType"]==="mouse")if(this._useMouseInput)this._isMouseDown=true;else return; +const pointerId=e["pointerId"];if(this._touches.has(pointerId))return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();const nowTime=performance.now();const index=this._touches.size;this._triggerIndex=index;this._triggerId=pointerId;const touchInfo=C3.New(C3.Plugins.Touch.TouchInfo);touchInfo.Init(nowTime,x,y,pointerId,index);this._touches.set(pointerId,touchInfo);this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchStart); +this._curTouchX=x;this._curTouchY=y;this.Trigger(C3.Plugins.Touch.Cnds.OnTouchObject)}_OnPointerMove(e){if(e["pointerType"]==="mouse"&&!this._isMouseDown)return;const touchInfo=this._touches.get(e["pointerId"]);if(!touchInfo)return;const nowTime=performance.now();if(nowTime-touchInfo.GetTime()<2)return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();touchInfo.Update(nowTime,x,y,e["width"],e["height"],e["pressure"])}_OnPointerUp(e,isCancel){if(e["pointerType"]=== +"mouse")if(this._isMouseDown)this._isMouseDown=false;else return;const nowTime=performance.now();const pointerId=e["pointerId"];const touchInfo=this._touches.get(pointerId);if(!touchInfo)return;this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchEnd);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchEnd);if(!isCancel){const tap=touchInfo.ShouldTriggerTap(nowTime);if(tap==="single-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnTapGesture); +this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnTapGestureObject)}else if(tap==="double-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGestureObject)}}touchInfo.Release();this._touches.delete(pointerId)}_RequestPermission(type){this._PostToDOMMaybeSync("request-permission",{"type":type});return new Promise((resolve,reject)=> +{this._permissionPromises.push({type,resolve,reject})})}_OnPermissionResult(e){const isGranted=e["result"];const type=e["type"];this._triggerPermission=type;const toResolve=this._permissionPromises.filter(o=>o.type===type);for(const o of toResolve)o.resolve(isGranted?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(o=>o.type!==type);if(isGranted){this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionGranted);if(type===0)this._runtime.RequestDeviceOrientationEvent();else this._runtime.RequestDeviceMotionEvent()}else this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(e){if(typeof e["webkitCompassHeading"]=== +"number")this._orientCompassHeading=e["webkitCompassHeading"];else if(e["absolute"])this._orientCompassHeading=e["alpha"];this._orientAlpha=e["alpha"];this._orientBeta=e["beta"];this._orientGamma=e["gamma"]}_OnDeviceOrientationAbsolute(e){this._orientCompassHeading=e["alpha"]}_OnDeviceMotion(e){const acc=e["acceleration"];if(acc){this._accX=acc["x"];this._accY=acc["y"];this._accZ=acc["z"]}const withG=e["accelerationIncludingGravity"];if(withG){this._accWithGX=withG["x"];this._accWithGY=withG["y"]; +this._accWithGZ=withG["z"]}}_OnTick2(){const nowTime=performance.now();let index=0;for(const touchInfo of this._touches.values()){if(touchInfo.GetTime()<=nowTime-50)touchInfo._SetLastTime(nowTime);if(touchInfo.ShouldTriggerHold(nowTime)){this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this._getTouchIndex=index;this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGestureObject); +this._getTouchIndex=0}++index}}_GetTouchByIndex(index){index=Math.floor(index);for(const touchInfo of this._touches.values()){if(index===0)return touchInfo;--index}return null}_IsClientPosOnCanvas(touchX,touchY){return touchX>=0&&touchY>=0&&touchX({name:"$"+ti.GetId(),value:ti.GetX()+ +", "+ti.GetY()}))}]}}} +{const C3=self.C3;const tempArr=[];C3.Plugins.Touch.Cnds={OnTouchStart(){return true},OnTouchEnd(){return true},IsInTouch(){return this._touches.size>0},OnTouchObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},IsTouchingObject(objectClass){if(!objectClass)return false;const interactiveLayersCache=new Map; +const isLayerInteractive=layer=>{let ret=interactiveLayersCache.get(layer);if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();if(!isLayerInteractive(layer)||!wi.IsInViewport2())continue;for(const touchInfo of this._touches.values()){if(!this._IsClientPosOnCanvas(touchInfo.GetX(), +touchInfo.GetY()))continue;const [px,py]=layer.CanvasCssToLayer(touchInfo.GetX(),touchInfo.GetY(),wi.GetTotalZElevation());if(wi.ContainsPoint(px,py)){tempArr.push(inst);break}}}interactiveLayersCache.clear();if(tempArr.length){sol.SetArrayPicked(tempArr);objectClass.ApplySolToContainer();C3.clearArray(tempArr);return true}else return false},CompareTouchSpeed(index,cmp,s){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return false;return C3.compare(touchInfo.GetSpeed(),cmp,s)},OrientationSupported(){return true}, +MotionSupported(){return true},CompareOrientation(orientation,cmp,a){this._runtime.RequestDeviceOrientationEvent();let v=0;if(orientation===0)v=this._orientAlpha;else if(orientation===1)v=this._orientBeta;else v=this._orientGamma;return C3.compare(v,cmp,a)},CompareAcceleration(a,cmp,x){this._runtime.RequestDeviceMotionEvent();let v=0;if(a===0)v=this._accWithGX;else if(a===1)v=this._accWithGY;else if(a===2)v=this._accWithGZ;else if(a===3)v=this._accX;else if(a===4)v=this._accY;else v=this._accZ;return C3.compare(v, +cmp,x)},OnNthTouchStart(index){index=Math.floor(index);return index===this._triggerIndex},OnNthTouchEnd(index){index=Math.floor(index);return index===this._triggerIndex},HasNthTouch(index){index=Math.floor(index);return this._touches.size>=index+1},OnHoldGesture(){return true},OnTapGesture(){return true},OnDoubleTapGesture(){return true},OnHoldGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},OnDoubleTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnPermissionGranted(type){return this._triggerPermission===type},OnPermissionDenied(type){return this._triggerPermission===type}}}{const C3=self.C3;C3.Plugins.Touch.Acts={RequestPermission(type){this._RequestPermission(type)}}} +{const C3=self.C3;C3.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},Y(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XForID(id,layerParam){const touchInfo=this._touches.get(id);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YForID(id,layerParam){const touchInfo=this._touches.get(id); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},AbsoluteX(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteY(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYAt(index){const touchInfo=this._GetTouchByIndex(index); +if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetY();else return 0},SpeedAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetSpeed();else return 0},SpeedForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetSpeed();else return 0},AngleAt(index){const touchInfo= +this._GetTouchByIndex(index);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},AngleForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},Alpha(){this._runtime.RequestDeviceOrientationEvent();return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent(); +return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();return this._accX},AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ}, +TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetWidth();else return 0},HeightForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetHeight();else return 0},PressureForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetPressure();else return 0}}}; + +} + +{ +'use strict';const C3=self.C3;const GESTURE_HOLD_THRESHOLD=15;const GESTURE_HOLD_TIMEOUT=500;const GESTURE_TAP_TIMEOUT=333;const GESTURE_DOUBLETAP_THRESHOLD=25;let lastTapX=-1E3;let lastTapY=-1E3;let lastTapTime=-1E4; +C3.Plugins.Touch.TouchInfo=class TouchInfo extends C3.DefendedBase{constructor(){super();this._pointerId=0;this._startIndex=0;this._startTime=0;this._time=0;this._lastTime=0;this._startX=0;this._startY=0;this._x=0;this._y=0;this._lastX=0;this._lastY=0;this._width=0;this._height=0;this._pressure=0;this._hasTriggeredHold=false;this._isTooFarForHold=false}Release(){}Init(nowTime,x,y,id,index){this._pointerId=id;this._startIndex=index;this._time=nowTime;this._lastTime=nowTime;this._startTime=nowTime; +this._startX=x;this._startY=y;this._x=x;this._y=y;this._lastX=x;this._lastY=y}Update(nowTime,x,y,width,height,pressure){this._lastTime=this._time;this._time=nowTime;this._lastX=this._x;this._lastY=this._y;this._x=x;this._y=y;this._width=width;this._height=height;this._pressure=pressure;if(!this._isTooFarForHold&&C3.distanceTo(this._startX,this._startY,this._x,this._y)>=GESTURE_HOLD_THRESHOLD)this._isTooFarForHold=true}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(t){this._lastTime= +t}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const dist=C3.distanceTo(this._x,this._y,this._lastX,this._lastY);const dt=(this._time-this._lastTime)/1E3;if(dt>0)return dist/dt;else return 0}GetAngle(){return C3.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(nowTime){if(this._hasTriggeredHold)return false;if(nowTime-this._startTime>=GESTURE_HOLD_TIMEOUT&&!this._isTooFarForHold&& +C3.distanceTo(this._startX,this._startY,this._x,this._y)this._OnOnlineStateChanged(e)], +["backbutton",()=>this._OnBackButton()],["sw-message",e=>this._OnSWMessage(e)],["hashchange",e=>this._OnHashChange(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),C3.Disposable.From(rt,"window-resize",()=>this._OnWindowResize()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state", +{"exportType":this._runtime.GetExportType()}).then(data=>{this._initLocationStr=data["location"];this._isOnline=data["isOnline"];this._referrer=data["referrer"];this._docTitle=data["title"];this._isCookieEnabled=data["isCookieEnabled"];this._screenWidth=data["screenWidth"];this._screenHeight=data["screenHeight"];this._windowOuterWidth=data["windowOuterWidth"];this._windowOuterHeight=data["windowOuterHeight"];this._isConstructArcade=data["isConstructArcade"]}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(e){const isOnline= +!!e["isOnline"];if(this._isOnline===isOnline)return;this._isOnline=isOnline;if(this._isOnline)await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOnline);else await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOffline)}async _OnWindowResize(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(e){const messageType= +e["type"];if(messageType==="downloading-update")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateFound);else if(messageType==="update-ready"||messageType==="update-pending")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateReady);else if(messageType==="offline-ready")this.Trigger(C3.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(e){this._initLocationStr=e["location"];this.Trigger(C3.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){const prefix="plugins.browser.debugger";return[{title:"plugins.browser.name", +properties:[{name:prefix+".user-agent",value:navigator.userAgent},{name:prefix+".is-online",value:this._isOnline},{name:prefix+".is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}} +{const C3=self.C3;C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return true},OnOffline(){return true},OnResize(){return true},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return true},IsPortraitLandscape(p){const lastInnerWidth=this._runtime.GetCanvasManager().GetLastWidth();const lastInnerHeight=this._runtime.GetCanvasManager().GetLastHeight();const current=lastInnerWidth<=lastInnerHeight? +0:1;return current===p},OnUpdateFound(){return true},OnUpdateReady(){return true},OnOfflineReady(){return true},OnHashChange(){return true},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return true},OnPageVisible(){return true},HasJava(){return false},IsDownloadingUpdate(){return false},OnMenuButton(){return false},OnSearchButton(){return false},IsMetered(){return false},IsCharging(){return true},SupportsFullscreen(){return true}}} +{const C3=self.C3;const ORIENTATIONS=["portrait","landscape","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];C3.Plugins.Browser.Acts={Alert(message){this.PostToDOM("alert",{"message":message.toString()})},Close(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())self.C3Debugger.CloseWindow();else this.PostToDOM("close")},Focus(){this.PostToDOM("set-focus",{"isFocus":true})},Blur(){this.PostToDOM("set-focus",{"isFocus":false})},GoBack(){if(this._isConstructArcade)return; +this.PostToDOM("navigate",{"type":"back"})},GoForward(){if(this._isConstructArcade)return;this.PostToDOM("navigate",{"type":"forward"})},GoHome(){},Reload(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())this._runtime.PostToDebugger({"type":"reload"});else this.PostToDOM("navigate",{"type":"reload"})},GoToURL(url,target){this._PostToDOMMaybeSync("navigate",{"type":"url","url":url,"target":target,"exportType":this._runtime.GetExportType()})},GoToURLWindow(url,tag){this._PostToDOMMaybeSync("navigate", +{"type":"new-window","url":url,"tag":tag,"exportType":this._runtime.GetExportType()})},RequestFullScreen(mode,navUi){if(mode>=2)mode+=1;if(mode===6)mode=2;if(mode===1)mode=0;const modeStr=C3.CanvasManager._FullscreenModeNumberToString(mode);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(modeStr);this._PostToDOMMaybeSync("request-fullscreen",{"navUI":navUi})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(pattern){const arr=pattern.split(",");for(let i=0,len=arr.length;i< +len;++i)arr[i]=parseInt(arr[i],10);this._PostToDOMMaybeSync("vibrate",{"pattern":arr})},async InvokeDownload(url,filename){if(!url||!filename)return;const urlToDownload=await this._runtime.GetAssetManager().GetProjectFileUrl(url);this._runtime.InvokeDownload(urlToDownload,filename)},InvokeDownloadString(str,mimeType,filename){if(!filename)return;const dataUri=`data:${mimeType},${encodeURIComponent(str)}`;this._runtime.InvokeDownload(dataUri,filename)},ConsoleLog(type,msg){msg=msg.toString();if(type=== +0)console.log(msg);else if(type===1)console.warn(msg);else if(type===2)console.error(msg)},ConsoleGroup(name){console.group(name)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(jsStr){try{eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}},LockOrientation(o){o=Math.floor(o);if(o<0||o>=ORIENTATIONS.length)return;const orientation=ORIENTATIONS[o];this._PostToDOMMaybeSync("lock-orientation",{"orientation":orientation})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")}, +LoadStyleSheet(url){this._runtime.GetAssetManager().LoadStyleSheet(url)},async SetDocumentCSSStyle(propName,value,selector,type){await this.PostToDOMAsync("set-document-css-style",{"prop":C3.CSSToCamelCase(propName),"value":value,"selector":selector,"is-all":type!==0})},async GetDocumentCSSStyle(propName,selector,tag){const ret=await this.PostToDOMAsync("get-document-css-style",{"prop":propName,"selector":selector});if(ret["isOk"])this._cssStyleMap.set(tag.toLowerCase(),ret["result"].trim())},SetHash(h){this.PostToDOM("set-hash", +{"hash":h})}}} +{const C3=self.C3;C3.Plugins.Browser.Exps={URL(){if(this._runtime.IsInWorker())return this._initLocationStr;else return location.toString()},Protocol(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).protocol;else return location.protocol},Domain(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hostname;else return location.hostname},Port(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).port;else return location.port},PathName(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).pathname; +else return location.pathname},Hash(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hash;else return location.hash},QueryString(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).search;else return location.search},QueryParam(param){const search=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;const match=RegExp("[?&]"+param+"=([^&]*)").exec(search);if(match)return decodeURIComponent(match[1].replace(/\+/g," "));else return""}, +Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(jsStr){let result=0;try{result=eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}if(typeof result==="number"||typeof result==="string")return result;if(typeof result==="boolean")return result?1:0;else return 0},CSSStyleValue(tag){return this._cssStyleMap.get(tag)||""},Name(){return navigator.appName}, +Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const connection=navigator["connection"];if(connection)return connection["downlink"]||connection["downlinkMax"]||connection["bandwidth"]||Infinity;else return Infinity},ConnectionType(){const connection=navigator["connection"];if(connection)return connection["type"]||"unknown";else return"unknown"},DevicePixelRatio(){return self.devicePixelRatio}, +ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}}}; + +} + +{ +'use strict';{const C3=self.C3;const C3X=self.C3X;let tempVec2a=null;let tempVec2b=null;let vec2RecycleCache=[];let Box2D=null;let physicsBehavior=null;const PHYSICS_COLLISIONS_KEY="Physics_DisabledCollisions";function SetObjectTypeCollisionsEnabled(typeA,typeB,state){const savedA=typeA.GetSavedDataMap();const savedB=typeB.GetSavedDataMap();if(state){const setA=savedA.get(PHYSICS_COLLISIONS_KEY);if(setA)setA.delete(typeB.GetSID());const setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(setB)setB.delete(typeA.GetSID())}else{let setA= +savedA.get(PHYSICS_COLLISIONS_KEY);if(!setA){setA=new Set;savedA.set(PHYSICS_COLLISIONS_KEY,setA)}let setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(!setB){setB=new Set;savedB.set(PHYSICS_COLLISIONS_KEY,setB)}setA.add(typeB.GetSID());setB.add(typeA.GetSID())}}C3.Behaviors.Physics=class PhysicsBehavior extends C3.SDKBehaviorBase{constructor(opts){opts.scriptInterfaceClass=self.IPhysicsBehavior;super(opts);this._world=null;this._worldG=10;this._worldScale=.02;this._worldManifold=null;this._lastUpdateTick= +-1;this._steppingMode=1;this._velocityIterations=8;this._positionIterations=3;this._allCollisionsEnabled=true;this._runtime.AddLoadPromise(this._LoadBox2DWasm())}async _LoadBox2DWasm(){const box2dWasmUrl=await this._runtime.GetAssetManager().GetProjectFileUrl("box2d.wasm");await new Promise(resolve=>{self["Box2DWasmModule"]({"wasmBinaryFile":box2dWasmUrl}).then(box2d=>{Box2D=box2d;this._InitBox2DWorld();resolve()})})}_InitBox2DWorld(){const collisionEngine=this._runtime.GetCollisionEngine();tempVec2a= +C3.Behaviors.Physics.GetVec2(0,0);tempVec2b=C3.Behaviors.Physics.GetVec2(0,0);this._world=new Box2D["b2World"](C3.Behaviors.Physics.GetTempVec2A(0,this._worldG),true);const listener=new Box2D["JSContactListener"];listener["BeginContact"]=contactPtr=>{const contact=Box2D["wrapPointer"](contactPtr,Box2D["b2Contact"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureA"]()["GetBody"]());const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureB"]()["GetBody"]()); +collisionEngine.RegisterCollision(behA.GetObjectInstance(),behB.GetObjectInstance())};listener["EndContact"]=()=>{};listener["PreSolve"]=()=>{};listener["PostSolve"]=()=>{};this._world["SetContactListener"](listener);const filter=new Box2D["JSContactFilter"];filter["ShouldCollide"]=(fixAPtr,fixBPtr)=>{if(this._allCollisionsEnabled)return true;const fixtureA=Box2D["wrapPointer"](fixAPtr,Box2D["b2Fixture"]);const fixtureB=Box2D["wrapPointer"](fixBPtr,Box2D["b2Fixture"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureA["GetBody"]()); +const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureB["GetBody"]());const typeA=behA.GetObjectInstance().GetObjectClass();const typeB=behB.GetObjectInstance().GetObjectClass();const sidA=typeA.GetSID();const sidB=typeB.GetSID();const setA=typeA.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setA&&setA.has(sidB))return false;const setB=typeB.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setB&&setB.has(sidA))return false;return true};this._world["SetContactFilter"](filter);this._worldManifold= +new Box2D["b2WorldManifold"]}Release(){super.Release()}GetBox2D(){return Box2D}GetWorld(){return this._world}GetWorldScale(){return this._worldScale}GetSteppingMode(){return this._steppingMode}SetSteppingMode(m){this._steppingMode=m}SetLastUpdateTick(t){this._lastUpdateTick=t}GetLastUpdateTick(){return this._lastUpdateTick}SetVelocityIterations(v){this._velocityIterations=Math.max(v,1)}GetVelocityIterations(){return this._velocityIterations}SetPositionIterations(p){this._positionIterations=Math.max(p, +1)}GetPositionIterations(){return this._positionIterations}SetIterations(v,p){this.SetVelocityIterations(v);this.SetPositionIterations(p)}GetGravity(){return this._worldG}SetGravity(g){if(g===this._worldG)return;this._world["SetGravity"](C3.Behaviors.Physics.GetTempVec2A(0,g));this._worldG=g;this._WakeUpAllPhysicsBodies()}_WakeUpAllPhysicsBodies(){for(const inst of this.GetInstances()){const behInst=C3.Behaviors.Physics.Instance.LookupBehInstFromInst(inst);if(!behInst)continue;const body=behInst.GetBody(); +if(!body)continue;body["SetAwake"](true)}}DisableShouldCollideFastPath(){this._allCollisionsEnabled=false}SetCollisionsEnabled(typeA,typeB,state){state=!!state;if(!typeA||!typeB)return;if(typeB.IsFamily())for(const member of typeB.GetFamilyMembers())SetObjectTypeCollisionsEnabled(typeA,member,state);else SetObjectTypeCollisionsEnabled(typeA,typeB,state);this.DisableShouldCollideFastPath()}GetWorldManifold(){return this._worldManifold}static GetPhysicsCollisionKey(){return PHYSICS_COLLISIONS_KEY}static GetVec2(x, +y){if(vec2RecycleCache.length){const ret=vec2RecycleCache.pop();ret["set_x"](x);ret["set_y"](y);return ret}else{const b2Vec2=Box2D["b2Vec2"];return new b2Vec2(x,y)}}static FreeVec2(v){vec2RecycleCache.push(v)}static GetTempVec2A(x,y){tempVec2a["set_x"](x);tempVec2a["set_y"](y);return tempVec2a}static GetTempVec2B(x,y){tempVec2b["set_x"](x);tempVec2b["set_y"](y);return tempVec2b}static CreatePolygonShape(vertices){const b2PolygonShape=Box2D["b2PolygonShape"];const shape=new b2PolygonShape;const buffer= +Box2D["_malloc"](vertices.length*8);let offset=0;for(let i=0;i>2]=vertices[i]["get_x"]();Box2D["HEAPF32"][buffer+(offset+4)>>2]=vertices[i]["get_y"]();offset+=8}const ptr_wrapped=Box2D["wrapPointer"](buffer,Box2D["b2Vec2"]);shape["Set"](ptr_wrapped,vertices.length);Box2D["_free"](buffer);return shape}};const STEPPING_MODES=["fixed","variable"];self.IPhysicsBehavior=class IPhysicsBehavior extends self.IBehavior{constructor(behavior){super(behavior); +physicsBehavior=behavior}set worldGravity(g){C3X.RequireFiniteNumber(g);physicsBehavior.SetGravity(g)}get worldGravity(){return physicsBehavior.GetGravity()}set steppingMode(s){const i=STEPPING_MODES.indexOf(s);if(i<0)throw new Error("invalid stepping mode");physicsBehavior.SetSteppingMode(STEPPING_MODES[i])}get steppingMode(){return STEPPING_MODES[physicsBehavior.GetSteppingMode()]}set velocityIterations(v){C3X.RequireFiniteNumber(v);physicsBehavior.SetVelocityIterations(v)}get velocityIterations(){return physicsBehavior.GetVelocityIterations()}set positionIterations(p){C3X.RequireFiniteNumber(p); +physicsBehavior.SetPositionIterations(p)}get positionIterations(){return physicsBehavior.GetPositionIterations()}setCollisionsEnabled(iObjectClassA,iObjectClassB,state){const runtime=physicsBehavior.GetRuntime();const objectClassA=runtime._UnwrapIObjectClass(iObjectClassA);const objectClassB=runtime._UnwrapIObjectClass(iObjectClassB);state=!!state;physicsBehavior.SetCollisionsEnabled(objectClassA,objectClassB,state)}}}{const C3=self.C3;C3.Behaviors.Physics.Type=class PhysicsType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const assert=self.assert;const IMMOVABLE=0;const COLLISION_MASK=1;const PREVENT_ROTATION=2;const DENSITY=3;const FRICTION=4;const ELASTICITY=5;const LINEAR_DAMPING=6;const ANGULAR_DAMPING=7;const BULLET=8;const ENABLE=9;const body2beh=new WeakMap;const inst2beh=new WeakMap;const tileConvexPolyCache=new WeakMap;const TILE_FLIPPED_HORIZONTAL=-2147483648;const TILE_FLIPPED_VERTICAL=1073741824;const TILE_FLIPPED_DIAGONAL= +536870912;const TILE_FLAGS_MASK=3758096384;const TILE_ID_MASK=536870911;const GetTempVec2A=C3.Behaviors.Physics.GetTempVec2A;const GetTempVec2B=C3.Behaviors.Physics.GetTempVec2B;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);C3.Behaviors.Physics.Instance=class PhysicsInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);const behavior=this.GetBehavior();const wi=this.GetWorldInfo();this._box2d=behavior.GetBox2D();this._world=behavior.GetWorld(); +this._worldScale=behavior.GetWorldScale();this._isImmovable=false;this._collisionMask=0;this._actualCollisionMask=0;this._preventRotation=false;this._density=1;this._friction=.5;this._restitution=.2;this._linearDamping=0;this._angularDamping=.01;this._isBullet=false;this._isEnabled=true;this._body=null;this._fixtures=[];this._myJoints=[];this._myCreatedJoints=[];this._joiningMe=new Set;this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle();this._lastWidth=0;this._lastHeight= +0;this._lastTickOverride=false;if(properties){this._isImmovable=!!properties[IMMOVABLE];this._collisionMask=properties[COLLISION_MASK];this._preventRotation=!!properties[PREVENT_ROTATION];this._density=properties[DENSITY];this._friction=properties[FRICTION];this._restitution=properties[ELASTICITY];this._linearDamping=properties[LINEAR_DAMPING];this._angularDamping=properties[ANGULAR_DAMPING];this._isBullet=!!properties[BULLET];this._isEnabled=!!properties[ENABLE]}const rt=this._runtime.Dispatcher(); +this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"beforeload",()=>this._OnBeforeLoad()),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()));inst2beh.set(this._inst,this);if(this._isEnabled)this._StartTicking()}PostCreate(){this._CreateBody()}Release(){this._DestroyMyJoints();C3.clearArray(this._myCreatedJoints);this._joiningMe.clear();if(this._body){this._DestroyFixtures();this._world["DestroyBody"](this._body); +this._body=null}super.Release()}_CreateFixture(fixDef){if(!this._body)return;const fixture=this._body["CreateFixture"](fixDef);this._fixtures.push(fixture);return fixture}_DestroyFixtures(){if(!this._body)return;for(const fixture of this._fixtures)this._body["DestroyFixture"](fixture);C3.clearArray(this._fixtures)}_GetBoundingQuadExcludingMesh(){const wi=this.GetWorldInfo();if(wi.HasMesh()){wi.CalculateBbox(tempRect,tempQuad,false);return tempQuad}else return wi.GetBoundingQuad()}_Destroy(o){this._box2d["destroy"](o)}_CreateBody(){if(!this._isEnabled)return; +const b2FixtureDef=this._box2d["b2FixtureDef"];const b2BodyDef=this._box2d["b2BodyDef"];const wi=this.GetWorldInfo();const hasPoly=wi.HasOwnCollisionPoly();this._actualCollisionMask=this._collisionMask;if(!hasPoly&&!this._inst.HasTilemap()&&this._actualCollisionMask===0)this._actualCollisionMask=1;if(!this._body){const bodyDef=new b2BodyDef;bodyDef["set_type"](this._isImmovable?0:2);let bodyX=wi.GetX()*this._worldScale;let bodyY=wi.GetY()*this._worldScale;if(this._actualCollisionMask===2){const bquad= +this._GetBoundingQuadExcludingMesh();bodyX=bquad.midX()*this._worldScale;bodyY=bquad.midY()*this._worldScale}bodyDef["set_position"](GetTempVec2B(bodyX,bodyY));bodyDef["set_angle"](wi.GetAngle());bodyDef["set_fixedRotation"](this._preventRotation);bodyDef["set_linearDamping"](this._linearDamping);bodyDef["set_angularDamping"](this._angularDamping);bodyDef["set_bullet"](this._isBullet);this._body=this._world["CreateBody"](bodyDef);this._Destroy(bodyDef);body2beh.set(this._body,this)}this._DestroyFixtures(); +const fixDef=new b2FixtureDef;fixDef["set_density"](this._density);fixDef["set_friction"](this._friction);fixDef["set_restitution"](this._restitution);const instW=Math.max(Math.abs(wi.GetWidth()),1);const instH=Math.max(Math.abs(wi.GetHeight()),1);if(this._actualCollisionMask===0)if(this._inst.HasTilemap())this._CreateTilemapFixtures(fixDef);else this._CreatePolygonFixture(fixDef,instW,instH);else if(this._actualCollisionMask===1)this._CreateBoundingBoxFixture(fixDef,wi,instW,instH);else this._CreateCircleFixture(fixDef, +instW,instH);this._lastWidth=wi.GetWidth();this._lastHeight=wi.GetHeight();wi.SetPhysicsBodyChanged(false);this._Destroy(fixDef)}_CreateBoundingBoxFixture(fixDef,wi,instW,instH){const b2PolygonShape=this._box2d["b2PolygonShape"];const shape=new b2PolygonShape;const fixWidth=instW*this._worldScale;const fixHeight=instH*this._worldScale;let originX=wi.GetOriginX();let originY=wi.GetOriginY();if(wi.GetWidth()<0)originX=1-originX;if(wi.GetHeight()<0)originY=1-originY;const fixOriginX=(.5-originX)*fixWidth; +const fixOriginY=(.5-originY)*fixHeight;const originVec=C3.Behaviors.Physics.GetVec2(fixOriginX,fixOriginY);shape["SetAsBox"](fixWidth/2,fixHeight/2,originVec,0);fixDef["set_shape"](shape);this._CreateFixture(fixDef);this._Destroy(shape);C3.Behaviors.Physics.FreeVec2(originVec)}_CreateCircleFixture(fixDef,instW,instH){const b2CircleShape=this._box2d["b2CircleShape"];const shape=new b2CircleShape;shape["set_m_radius"](Math.min(instW,instH)*this._worldScale*.5);fixDef["set_shape"](shape);this._CreateFixture(fixDef); +this._Destroy(shape)}_CreatePolygonFixture(fixDef,instW,instH){const wi=this.GetWorldInfo();const isMirrored=wi.GetWidth()<0;const isFlipped=wi.GetHeight()<0;const worldScale=this._worldScale;const transformedPoly=wi.GetCustomTransformedCollisionPoly(isMirrored?-instW:instW,isFlipped?-instH:instH,0);const ptsArr=transformedPoly.pointsArr();const ptsCount=ptsArr.length/2;const arr=[];for(let i=0;i1/30)dt=1/30}const tickCount=runtime.GetTickCountNoSave();if(tickCount>behavior.GetLastUpdateTick()&&runtime.GetTimeScale()>0){const isDebug=this._runtime.IsDebug();let startTime=0;if(isDebug)startTime=performance.now();if(dt!==0)this._world["Step"](dt,behavior.GetVelocityIterations(),behavior.GetPositionIterations());this._world["ClearForces"]();if(isDebug)self.C3Debugger.AddPhysicsTime(performance.now()- +startTime);behavior.SetLastUpdateTick(tickCount)}this._UpdateBodyToMatchInstance(true)}_UpdateBodyToMatchInstance(isTickUpdate){const inst=this._inst;const wi=inst.GetWorldInfo();const worldScale=this._worldScale;if(wi.GetWidth()!==this._lastWidth||wi.GetHeight()!==this._lastHeight||wi.IsPhysicsBodyChanged())this._CreateBody();const body=this._body;const curX=wi.GetX();const curY=wi.GetY();const diffX=curX-this._lastKnownX;const diffY=curY-this._lastKnownY;const POS_EPSILON=.001;const posChanged= +Math.abs(diffX)>POS_EPSILON||Math.abs(diffY)>POS_EPSILON;const angleChanged=wi.GetAngle()!==this._lastKnownAngle;let newBodyX=curX;let newBodyY=curY;if(this._actualCollisionMask===2){const bquad=this._GetBoundingQuadExcludingMesh();newBodyX=bquad.midX();newBodyY=bquad.midY()}if(posChanged){if(angleChanged)body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),wi.GetAngle());else body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),body["GetAngle"]());if(isTickUpdate){body["SetLinearVelocity"](GetTempVec2A(diffX, +diffY));this._lastTickOverride=true}body["SetAwake"](true)}else if(isTickUpdate&&this._lastTickOverride){this._lastTickOverride=false;body["SetLinearVelocity"](GetTempVec2A(0,0));body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),body["GetAngle"]())}if(!posChanged&&angleChanged){body["SetTransform"](body["GetPosition"](),wi.GetAngle());body["SetAwake"](true)}const pos=body["GetPosition"]();const newX=pos["get_x"]()/worldScale;const newY=pos["get_y"]()/worldScale;const newAngle= +body["GetAngle"]();if(newX!==wi.GetX()||newY!==wi.GetY()||newAngle!==wi.GetAngle()){wi.SetXY(newX,newY);wi.SetAngle(newAngle);wi.SetBboxChanged();if(this._actualCollisionMask===2){const bquad=this._GetBoundingQuadExcludingMesh();const dx=bquad.midX()-wi.GetX();const dy=bquad.midY()-wi.GetY();if(dx!==0||dy!==0){wi.OffsetXY(-dx,-dy);wi.SetBboxChanged()}}}this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle()}GetPropertyValueByIndex(index){switch(index){case PREVENT_ROTATION:return this._IsPreventRotate(); +case DENSITY:return this._GetDensity();case FRICTION:return this._GetFriction();case ELASTICITY:return this._GetElasticity();case LINEAR_DAMPING:return this._GetLinearDamping();case ANGULAR_DAMPING:return this._GetAngularDamping();case BULLET:return this._IsBullet();case ENABLE:return this._IsEnabled()}}SetPropertyValueByIndex(index,value){switch(index){case PREVENT_ROTATION:this._SetPreventRotate(value);break;case DENSITY:this._SetDensity(value);break;case FRICTION:this._SetFriction(value);break; +case ELASTICITY:this._SetElasticity(value);break;case LINEAR_DAMPING:this._SetLinearDamping(value);break;case ANGULAR_DAMPING:this._SetAngularDamping(value);break;case BULLET:this._SetBullet(value);break;case ENABLE:this._SetEnabled(value);break}}_SetEnabled(e){e=!!e;if(this._isEnabled&&!e){this._RemoveOtherInstanceJointsToMe();this._DestroyBody();this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){this._isEnabled=true;this._CreateBody();this._StartTicking()}}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const prefix= +"behaviors.physics";const props=[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)},{name:prefix+".properties.immovable.name",value:this._IsImmovable(),onedit:v=>this._SetImmovable(v)},{name:prefix+".properties.density.name",value:this._GetDensity(),onedit:v=>this._SetDensity(v)},{name:prefix+".properties.friction.name",value:this._GetFriction(),onedit:v=>this._SetFriction(v)},{name:prefix+".properties.elasticity.name",value:this._GetElasticity(),onedit:v=> +this._SetElasticity(v)},{name:prefix+".properties.linear-damping.name",value:this._GetLinearDamping(),onedit:v=>this._SetLinearDamping(v)},{name:prefix+".properties.angular-damping.name",value:this._GetAngularDamping(),onedit:v=>this._SetAngularDamping(v)}];if(this._isEnabled){props.push({name:prefix+".debugger.is-sleeping",value:this._IsSleeping()});props.push({name:prefix+".debugger.velocity-x",value:this._GetVelocityX(),onedit:v=>this._SetVelocity(v,this._GetVelocityY())});props.push({name:prefix+ +".debugger.velocity-y",value:this._GetVelocityY(),onedit:v=>this._SetVelocity(this._GetVelocityX(),v)});props.push({name:prefix+".debugger.angular-velocity",value:C3.toDegrees(this._GetAngularVelocity()),onedit:v=>this._SetAngularVelocity(C3.toRadians(v))});props.push({name:prefix+".debugger.mass",value:this._GetMass()})}return[{title:"$"+this.GetBehaviorType().GetName(),properties:props}]}_ApplyForce(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(fx,fy,x,y)}_ApplyForceToward(f, +px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyForceAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyForce(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyForce"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale),true)}_ApplyImpulse(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt); +this._DoApplyImpulse(fx,fy,x,y)}_ApplyImpulseToward(f,px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyImpulseAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyImpulse(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyLinearImpulse"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale), +true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_ApplyTorque(m){if(!this._isEnabled)return;this._body["ApplyTorque"](m,true)}_ApplyTorqueToAngle(m,a){const f=C3.angleClockwise(this.GetWorldInfo().GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_ApplyTorqueToPosition(m,x,y){const wi=this.GetWorldInfo();const a=C3.angleTo(wi.GetX(),wi.GetY(),x,y);const f=C3.angleClockwise(wi.GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_SetAngularVelocity(v){if(!this._isEnabled)return; +this._body["SetAngularVelocity"](v);this._body["SetAwake"](true)}_GetAngularVelocity(){return this._isEnabled?this._body["GetAngularVelocity"]():0}_SetVelocity(vx,vy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["SetLinearVelocity"](GetTempVec2A(vx*worldScale,vy*worldScale));this._body["SetAwake"](true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_GetVelocity(){if(!this._isEnabled)return[0,0];const worldScale= +this._worldScale;const vec=this._body["GetLinearVelocity"]();return[vec["get_x"]()/worldScale,vec["get_y"]()/worldScale]}_GetVelocityX(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_x"]()/this._worldScale:0}_GetVelocityY(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_y"]()/this._worldScale:0}_SetDensity(d){if(!this._isEnabled)return;if(this._density===d)return;this._density=d;for(const fixture of this._fixtures)fixture["SetDensity"](d);this._body["ResetMassData"]()}_GetDensity(){return this._isEnabled? +this._density:0}_SetFriction(f){if(!this._isEnabled)return;if(this._friction===f)return;this._friction=f;for(const fixture of this._fixtures)fixture["SetFriction"](f);for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(contact)contact["ResetFriction"]()}}_GetFriction(){return this._isEnabled?this._friction:0}_SetElasticity(e){if(!this._isEnabled)return;if(this._restitution=== +e)return;this._restitution=e;for(const fixture of this._fixtures)fixture["SetRestitution"](e)}_GetElasticity(){return this._isEnabled?this._restitution:0}_SetLinearDamping(ld){if(!this._isEnabled)return;if(this._linearDamping===ld)return;this._linearDamping=ld;this._body["SetLinearDamping"](ld)}_GetLinearDamping(){return this._isEnabled?this._linearDamping:0}_SetAngularDamping(ad){if(!this._isEnabled)return;if(this._angularDamping===ad)return;this._angularDamping=ad;this._body["SetAngularDamping"](ad)}_GetAngularDamping(){return this._isEnabled? +this._angularDamping:0}_SetImmovable(i){if(!this._isEnabled)return;i=!!i;if(this._isImmovable===i)return;this._isImmovable=i;this._body["SetType"](this._isImmovable?0:2);this._body["SetAwake"](true)}_IsImmovable(){return this._isImmovable}_SetPreventRotate(i){if(!this._isEnabled)return;i=!!i;if(this._preventRotation===i)return;this._preventRotation=i;this._body["SetFixedRotation"](this._preventRotation);this._body["SetAngularVelocity"](0);this._body["SetAwake"](true)}_IsPreventRotate(){return this._preventRotation}_SetBullet(i){if(!this._isEnabled)return; +i=!!i;if(this._isBullet===i)return;this._isBullet=i;this._body["SetBullet"](this._isBullet);this._body["SetAwake"](true)}_IsBullet(){return this._isBullet}_GetMass(){return this._isEnabled?this._body["GetMass"]()/this._worldScale:0}_GetCenterOfMassX(){return this._isEnabled?(this._body["GetPosition"]()["get_x"]()+this._body["GetLocalCenter"]()["get_x"]())/this._worldScale:0}_GetCenterOfMassY(){return this._isEnabled?(this._body["GetPosition"]()["get_y"]()+this._body["GetLocalCenter"]()["get_y"]())/ +this._worldScale:0}_GetCenterOfMass(){if(!this._isEnabled)return[0,0];const posVec=this._body["GetPosition"]();const centerVec=this._body["GetLocalCenter"]();const worldScale=this._worldScale;return[(posVec["get_x"]()+centerVec["get_x"]())/worldScale,(posVec["get_y"]()+centerVec["get_y"]())/worldScale]}_IsSleeping(){return this._isEnabled?!this._body["IsAwake"]():false}_GetContactCount(){if(!this._isEnabled)return 0;let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge= +contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold=contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();count+=pointCount}return count}_GetContactPositionAt(index){index=Math.floor(index);if(!this._isEnabled)return[0,0];let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold= +contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();if(index>=count&&index=px&&px>=x2-.1||x1-.1<=px&&px<=x2+.1;const b2=y1+.1>=py&&py>=y2-.1||y1-.1<=py&&py<=y2+.1;return b1&&b2&&b2Separator.isOnLine(px,py,x1,y1,x2,y2)};b2Separator.isOnLine=function(px,py,x1,y1,x2,y2){if(Math.abs(x2-x1)>.1){const a=(y2-y1)/(x2-x1);const possibleY=a*(px-x1)+y1;const diff=Math.abs(possibleY-py);return diff<.1}return Math.abs(px-x1)<.1}; +b2Separator.pointsMatch=function(x1,y1,x2,y2){return Math.abs(x2-x1)<.1&&Math.abs(y2-y1)<.1}; +b2Separator.Separate=function(verticesVec,objarea){const calced=b2Separator.calcShapes(verticesVec);let ret=[];for(let i=0,len=calced.length;i=objarea*.001)ret.push(poly);else for(let j=0,lenj=poly.length;j=n)return[];if(!b2Separator.isOnSegment(v2["get_x"](),v2["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p1["get_x"](),p1["get_y"]()))vec1.push(vec[k]);break}h=k;if(k-1<0)k=n-1;else k--}vec1.reverse();h=-1;k=i2;while(true){if(k!== +j1)vec2.push(vec[k]);else{if(h<0||h>=n)return[];if(k===j1&&!b2Separator.isOnSegment(v1["get_x"](),v1["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p2["get_x"](),p2["get_y"]()))vec2.push(vec[k]);break}h=k;if(k+1>n-1)k=0;else k++}queue.push(vec1,vec2);queue.shift();break}}if(isConvex)figsVec.push(queue.shift())}return figsVec}; +function SplitConvexPolysOver8Points(convexPolys){const ret=[];for(const arr of convexPolys)if(arr.length<=8)ret.push(arr);else ret.push.apply(ret,SplitConvexPoly(arr));return ret}function SplitConvexPoly(arr){const ret=[];ret.push(arr.splice(0,8));const first=ret[0][0];let last=ret[0][7];while(arr.length){const poly=arr.splice(0,Math.min(arr.length,6));let nextLast=poly.at(-1);poly.push(CloneVec2(first));poly.push(CloneVec2(last));ret.push(poly);last=nextLast}return ret}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Pin=class PinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Pin.Type=class PinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;C3.Behaviors.Pin.Instance=class PinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._pinDist=0;this._pinAngle=0;this._pinImagePoint=0;this._dx=0;this._dy=0;this._dWidth=0;this._dHeight=0;this._dAngle=0;this._dz=0;this._lastKnownAngle=0;this._destroy=false;if(properties)this._destroy=properties[0];const rt=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt, +"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",e=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(inst){if(inst){this._pinInst=inst;this._StartTicking2()}else{this._pinInst=null;this._StopTicking2()}}_Pin(objectClass,mode,propList){if(!objectClass)return;const otherInst=objectClass.GetFirstPicked(this._inst);if(!otherInst)return;this._mode=mode;this._SetPinInst(otherInst);const myWi=this._inst.GetWorldInfo();const otherWi= +otherInst.GetWorldInfo();if(this._mode==="properties"){const propSet=this._propSet;propSet.clear();for(const p of propList)propSet.add(p);this._dx=myWi.GetX()-otherWi.GetX();this._dy=myWi.GetY()-otherWi.GetY();this._dAngle=myWi.GetAngle()-otherWi.GetAngle();this._lastKnownAngle=myWi.GetAngle();this._dz=myWi.GetZElevation()-otherWi.GetZElevation();if(propSet.has("x")&&propSet.has("y")){this._pinAngle=C3.angleTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())-otherWi.GetAngle();this._pinDist= +C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}if(propSet.has("width-abs"))this._dWidth=myWi.GetWidth()-otherWi.GetWidth();else if(propSet.has("width-scale"))this._dWidth=myWi.GetWidth()/otherWi.GetWidth();if(propSet.has("height-abs"))this._dHeight=myWi.GetHeight()-otherWi.GetHeight();else if(propSet.has("height-scale"))this._dHeight=myWi.GetHeight()/otherWi.GetHeight()}else this._pinDist=C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}SaveToJson(){const propSet= +this._propSet;const mode=this._mode;const ret={"uid":this._pinInst?this._pinInst.GetUID():-1,"m":mode,"d":this._destroy};if(mode==="rope"||mode==="bar")ret["pd"]=this._pinDist;else if(mode==="properties"){ret["ps"]=[...this._propSet];if(propSet.has("imagepoint"))ret["ip"]=this._pinImagePoint;else if(propSet.has("x")&&propSet.has("y")){ret["pa"]=this._pinAngle;ret["pd"]=this._pinDist}else{if(propSet.has("x"))ret["dx"]=this._dx;if(propSet.has("y"))ret["dy"]=this._dy}if(propSet.has("angle")){ret["da"]= +this._dAngle;ret["lka"]=this._lastKnownAngle}if(propSet.has("width-abs")||propSet.has("width-scale"))ret["dw"]=this._dWidth;if(propSet.has("height-abs")||propSet.has("height-scale"))ret["dh"]=this._dHeight;if(propSet.has("z"))ret["dz"]=this._dz}return ret}LoadFromJson(o){const mode=o["m"];const propSet=this._propSet;propSet.clear();this._pinUid=o["uid"];if(typeof mode==="number"){this._LoadFromJson_Legacy(o);return}this._mode=mode;if(o.hasOwnProperty("d"))this._destroy=!!o["d"];if(mode==="rope"|| +mode==="bar")this._pinDist=o["pd"];else if(mode==="properties"){for(const p of o["ps"])propSet.add(p);if(propSet.has("imagepoint"))this._pinImagePoint=o["ip"];else if(propSet.has("x")&&propSet.has("y")){this._pinAngle=o["pa"];this._pinDist=o["pd"]}else{if(propSet.has("x"))this._dx=o["dx"];if(propSet.has("y"))this._dy=o["dy"]}if(propSet.has("angle")){this._dAngle=o["da"];this._lastKnownAngle=o["lka"]||0}if(propSet.has("width-abs")||propSet.has("width-scale"))this._dWidth=o["dw"];if(propSet.has("height-abs")|| +propSet.has("height-scale"))this._dHeight=o["dh"];if(propSet.has("z"))this._dz=o["dz"]}}_LoadFromJson_Legacy(o){const propSet=this._propSet;const myStartAngle=o["msa"];const theirStartAngle=o["tsa"];const pinAngle=o["pa"];const pinDist=o["pd"];const mode=o["m"];switch(mode){case 0:this._mode="properties";propSet.add("x").add("y").add("angle");this._pinAngle=pinAngle;this._pinDist=pinDist;this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 1:this._mode="properties";propSet.add("x").add("y"); +this._pinAngle=pinAngle;this._pinDist=pinDist;break;case 2:this._mode="properties";propSet.add("angle");this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 3:this._mode="rope";this._pinDist=o["pd"];break;case 4:this._mode="bar";this._pinDist=o["pd"];break}}_OnAfterLoad(){if(this._pinUid===-1)this._SetPinInst(null);else{this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid));this._pinUid=-1}}_OnInstanceDestroyed(inst){if(this._pinInst===inst){this._SetPinInst(null); +if(this._destroy)this._runtime.DestroyInstance(this._inst)}}Tick2(){const pinInst=this._pinInst;if(!pinInst)return;const pinWi=pinInst.GetWorldInfo();const myInst=this._inst;const myWi=myInst.GetWorldInfo();const mode=this._mode;let bboxChanged=false;if(mode==="rope"||mode==="bar"){const dist=C3.distanceTo(myWi.GetX(),myWi.GetY(),pinWi.GetX(),pinWi.GetY());if(dist>this._pinDist||mode==="bar"&&dist=this._duration}Update(){if(this.HasFinished())if(this._isRegular)this._current.Subtract(this._duration);else return true;return false}SaveToJson(){return{"c":this._current.Get(),"t":this._total.Get(),"d":this._duration,"r":this._isRegular,"p":this._isPaused}}LoadFromJson(o){this._current.Set(o["c"]);this._total.Set(o["t"]);this._duration=o["d"];this._isRegular=!!o["r"];this._isPaused= +!!o["p"]}};C3.Behaviors.Timer.Instance=class TimerInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._timers=new Map}Release(){this._timers.clear();super.Release()}_StartTimer(duration,name,isRegular){const timer=new C3.Behaviors.Timer.SingleTimer(0,0,duration,isRegular);this._timers.set(name.toLowerCase(),timer);this._UpdateTickState()}_StopTimer(name){this._timers.delete(name.toLowerCase());this._UpdateTickState()}_StopAllTimers(){this._timers.clear(); +this._UpdateTickState()}_IsTimerRunning(name){return this._timers.has(name.toLowerCase())}_GetTimerCurrentTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetCurrentTime():0}_GetTimerTotalTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetTotalTime():0}_GetTimerDuration(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetDuration():0}_HasTimerFinished(name){const timer=this._timers.get(name.toLowerCase());return timer? +timer.HasFinished():false}_SetTimerPaused(name,isPaused){const timer=this._timers.get(name.toLowerCase());if(timer)timer.SetPaused(isPaused)}_IsTimerPaused(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.IsPaused():false}_UpdateTickState(){if(this._timers.size>0){this._StartTicking();this._StartTicking2()}else{this._StopTicking();this._StopTicking2()}}SaveToJson(){const ret={};for(const [name,timer]of this._timers.entries())ret[name]=timer.SaveToJson();return ret}LoadFromJson(o){this._timers.clear(); +for(const [name,data]of Object.entries(o)){const timer=new C3.Behaviors.Timer.SingleTimer;timer.LoadFromJson(data);this._timers.set(name,timer)}this._UpdateTickState()}Tick(){const dt=this._runtime.GetDt(this._inst);for(const [name,timer]of this._timers)if(!timer.IsPaused()){timer.Add(dt);if(timer.HasFinished())this.DispatchScriptEvent("timer",false,{tag:name})}}Tick2(){for(const [name,timer]of this._timers.entries()){const shouldDelete=timer.Update();if(shouldDelete)this._timers.delete(name)}}GetDebuggerProperties(){return[{title:"behaviors.timer.debugger.timers", +properties:[...this._timers.entries()].map(entry=>({name:"$"+entry[0],value:`${Math.round(entry[1].GetCurrentTime()*10)/10} / ${Math.round(entry[1].GetDuration()*10)/10}`}))}]}GetScriptInterfaceClass(){return self.ITimerBehaviorInstance}};const map=new WeakMap;const VALID_TIMER_TYPES=["once","regular"];self.ITimerBehaviorInstance=class ITimerBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTimer(duration,name,type= +"once"){C3X.RequireFiniteNumber(duration);C3X.RequireString(name);const i=VALID_TIMER_TYPES.indexOf(type);if(i===-1)throw new Error("invalid type");map.get(this)._StartTimer(duration,name,i===1)}setTimerPaused(name,isPaused){C3X.RequireString(name);map.get(this)._SetTimerPaused(name,!!isPaused)}stopTimer(name){C3X.RequireString(name);map.get(this)._StopTimer(name)}stopAllTimers(){map.get(this)._StopAllTimers()}isTimerRunning(name){C3X.RequireString(name);return map.get(this)._IsTimerRunning(name)}isTimerPaused(name){C3X.RequireString(name); +return map.get(this)._IsTimerPaused(name)}getCurrentTime(name){C3X.RequireString(name);return map.get(this)._GetTimerCurrentTime(name)}getTotalTime(name){C3X.RequireString(name);return map.get(this)._GetTimerTotalTime(name)}getDuration(name){C3X.RequireString(name);return map.get(this)._GetTimerDuration(name)}hasFinished(name){C3X.RequireString(name);return map.get(this)._HasTimerFinished(name)}}} +{const C3=self.C3;C3.Behaviors.Timer.Cnds={OnTimer(name){return this._HasTimerFinished(name)},IsTimerRunning(name){return this._IsTimerRunning(name)},IsTimerPaused(name){return this._IsTimerPaused(name)}}}{const C3=self.C3;C3.Behaviors.Timer.Acts={StartTimer(duration,type,name){this._StartTimer(duration,name,type===1)},StopTimer(name){this._StopTimer(name)},StopAllTimers(){this._StopAllTimers()},PauseResumeTimer(name,state){this._SetTimerPaused(name,state===0)}}} +{const C3=self.C3;C3.Behaviors.Timer.Exps={CurrentTime(name){return this._GetTimerCurrentTime(name)},TotalTime(name){return this._GetTimerTotalTime(name)},Duration(name){return this._GetTimerDuration(name)}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Anchor=class AnchorBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Anchor.Type=class AnchorType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const ANCHOR_LEFT=0;const ANCHOR_TOP=1;const ANCHOR_RIGHT=2;const ANCHOR_BOTTOM=3;const ENABLE=4;C3.Behaviors.Anchor.Instance=class AnchorInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._anchorLeft=2;this._anchorTop=2;this._anchorRight=0;this._anchorBottom=0;this._isEnabled=true;const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop= +bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();if(properties){this._anchorLeft=properties[ANCHOR_LEFT];this._anchorTop=properties[ANCHOR_TOP];this._anchorRight=properties[ANCHOR_RIGHT];this._anchorBottom=properties[ANCHOR_BOTTOM];this._isEnabled=!!properties[ENABLE]}const rt= +this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"layoutchange",()=>this._OnLayoutChange()));if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"xl":this._xLeft,"yt":this._yTop,"xr":this._xRight,"yb":this._yBottom,"rd":this._rDiff,"bd":this._bDiff,"al":this._anchorLeft,"at":this._anchorTop,"ar":this._anchorRight,"ab":this._anchorBottom,"e":this._isEnabled}}LoadFromJson(o){this._xLeft=o["xl"];this._yTop=o["yt"];this._xRight= +o["xr"];this._yBottom=o["yb"];this._rDiff=o["rd"];this._bDiff=o["bd"];this._anchorLeft=o["al"];this._anchorTop=o["at"];this._anchorRight=o["ar"];this._anchorBottom=o["ab"];this._isEnabled=o["e"];if(this._isEnabled)this._StartTicking();else this._StopTicking()}_SetEnabled(e){if(this._isEnabled&&!e){this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop=bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()- +bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();this._isEnabled=true;this._StartTicking()}}_IsEnabled(){return this._isEnabled}_UpdatePosition(){if(!this._isEnabled)return;const wi=this._inst.GetWorldInfo();const viewport=wi.GetLayer().GetViewport();if(this._anchorLeft===0){const n=viewport.getLeft()+this._xLeft-wi.GetBoundingBox().getLeft(); +if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}else if(this._anchorLeft===1){const n=viewport.getRight()-this._xRight-wi.GetBoundingBox().getLeft();if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}if(this._anchorTop===0){const n=viewport.getTop()+this._yTop-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}else if(this._anchorTop===1){const n=viewport.getBottom()-this._yBottom-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}if(this._anchorRight===1){const n= +viewport.getRight()-this._rDiff-wi.GetBoundingBox().getRight();if(n!==0){wi.OffsetX(wi.GetOriginX()*n);wi.SetWidth(Math.max(wi.GetWidth()+n),0);wi.SetBboxChanged();this._rDiff=viewport.getRight()-wi.GetBoundingBox().getRight()}}if(this._anchorBottom===1){const n=viewport.getBottom()-this._bDiff-wi.GetBoundingBox().getBottom();if(n!==0){wi.OffsetY(wi.GetOriginY()*n);wi.SetHeight(Math.max(wi.GetHeight()+n,0));wi.SetBboxChanged();this._bDiff=viewport.getBottom()-wi.GetBoundingBox().getBottom()}}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(index){switch(index){case ANCHOR_LEFT:return this._anchorLeft; +case ANCHOR_TOP:return this._anchorTop;case ANCHOR_RIGHT:return this._anchorRight;case ANCHOR_BOTTOM:return this._anchorBottom;case ENABLE:return this._isEnabled}}SetPropertyValueByIndex(index,value){switch(index){case ANCHOR_LEFT:this._anchorLeft=value;break;case ANCHOR_TOP:this._anchorTop=value;break;case ANCHOR_RIGHT:this._anchorRight=value;break;case ANCHOR_BOTTOM:this._anchorBottom=value;break;case ENABLE:this._isEnabled=!!value;if(this._isEnabled)this._StartTicking();else this._StopTicking(); +break}}GetDebuggerProperties(){const prefix="behaviors.anchor";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.IAnchorBehaviorInstance}};const map=new WeakMap;self.IAnchorBehaviorInstance=class IAnchorBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get isEnabled(){return map.get(this)._IsEnabled()}set isEnabled(e){map.get(this)._SetEnabled(e)}}} +{const C3=self.C3;C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._IsEnabled()}}}{const C3=self.C3;C3.Behaviors.Anchor.Acts={SetEnabled(e){this._SetEnabled(e!==0)}}}{const C3=self.C3;C3.Behaviors.Anchor.Exps={}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Tween=class TweenBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Tween.Type=class TweenType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const ENABLED=0;NAMESPACE.Instance=class TweenInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._allowMultiple=false;this._enabled=true;if(properties){this._allowMultiple=false;this._enabled=!!properties[ENABLED]}this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._finishingTween=null;this._activeTweensJson=null;this._disabledTweensJson=null;this._waitingForReleaseTweensJson= +null;this._finishingTweenName="";this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;if(this._finishingTween){this.ReleaseAndCompleteTween(this._finishingTween);this._finishingTween=null}this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens= +null;super.Release()}SetEnabled(e){this._enabled=!!e;if(e){if(this._waitingForReleaseTweens&&this._waitingForReleaseTweens.size)this._StartTicking2()}else this._StopTicking2();for(const tween of this.AllTweens())if(e){if(this.IsInDisabledList(tween))tween.Resume()}else{if(tween.IsPlaying()||tween.IsScheduled())this.AddToDisabledList(tween);tween.Stop()}if(e)this.ClearDisabledList()}IsEnabled(){return this._enabled}AddToDisabledList(tween){this._disabledTweens.push(tween)}IsInDisabledList(tween){return this._disabledTweens.includes(tween)}ClearDisabledList(){C3.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const inst= +this.GetObjectInstance();if(!inst)return false;return!inst.IsDestroyed()}GetTween(tags,property,includeWaitingForRelease=false){const tweens=property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(!tweens||!tweens.length)return;for(const tween of tweens)if(tween.HasTags(tags))return tween}GetTweenIncludingWaitingForRelease(tags,property){return this.GetTween(tags,property,true)}*GetTweens(tags,property,includeWaitingForRelease=false){const tweens= +property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(tweens&&tweens.length)for(const tween of tweens)if(tween.HasTags(tags))yield tween}*GetTweensIncludingWaitingForRelease(tags,property){yield*this.GetTweens(tags,property,true)}PropertyTweens(property,includeWaitingForRelease){if(includeWaitingForRelease){let active=this._activeTweens.get(property);let waitingForRelease=this._waitingForReleaseTweens.get(property);if(!active)active=[];if(!waitingForRelease)waitingForRelease= +[];return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{let active=this._activeTweens.get(property);if(!active)active=[];return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweens(includeWaitingForRelease){if(includeWaitingForRelease){const active=[...this._activeTweens.values()].flat();const waitingForRelease=[...this._waitingForReleaseTweens.values()].flat();return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{const active=[...this._activeTweens.values()].flat(); +return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweensIncludingWaitingForRelease(){return this.AllTweens(true)}SaveToJson(){return{"s":false,"e":!!this._enabled,"at":this._SaveActiveTweensToJson(),"dt":this._SaveDisabledTweensToJson(),"wt":this._SaveWaitingForReleaseTweensToJson(),"ft":this._SaveFinishingTweenToJson()}}LoadFromJson(o){if(!o)return;this._activeTweensJson=o["at"];this._disabledTweensJson=o["dt"];this._waitingForReleaseTweensJson=o["wt"];this._finishingTweenName=o["ft"];this._allowMultiple= +false;this._enabled=!!o["e"]}_OnAfterLoad(e){const timelineManager=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,timelineManager);if(this._disabledTweensJson){C3.clearArray(this._disabledTweens);for(const tweenName of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,tweenName,timelineManager)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,timelineManager);this._finishingTween=this._GetTween(this._finishingTweenName, +timelineManager);if(this._enabled){if(this._waitingForReleaseTweens&&this._waitingForReleaseTweens.size)this._StartTicking2()}else this._StopTicking2()}_PopulateTweenMap(restoreJson,map,timelineManager){if(!restoreJson)return;for(const property in restoreJson){let tweens=map.get(property);tweens?C3.clearArray(tweens):tweens=[];const tweensJson=restoreJson[property];for(const tweenJson of tweensJson){const success=this._PopulateTweenArray(tweens,tweenJson["name"],timelineManager);if(!success){const tween= +C3.TweenState.Build({runtime:this.GetRuntime(),json:tweenJson});tween.AddCompletedCallback(tween=>this._FinishTriggers(tween));timelineManager.AddScheduledTimeline(tween);this._PopulateTweenArray(tweens,tween,timelineManager)}else this._LoadTweenFromJson(tweenJson["name"],tweenJson,timelineManager)}map.set(property,tweens)}}_GetTween(name,timelineManager){return timelineManager.GetScheduledOrPlayingTimelineByName(name)}_PopulateTweenArray(collection,tweenOrName,timelineManager){if(typeof tweenOrName=== +"string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)return!!collection.push(tween)}else return!!collection.push(tweenOrName);return false}_LoadTweenFromJson(tweenOrName,tweenJson,timelineManager){if(typeof tweenOrName==="string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)tween._LoadFromJson(tweenJson)}else tweenOrName._LoadFromJson(tweenJson)}_SaveActiveTweensToJson(){const ret={};for(const [property,tweens]of this._activeTweens)ret[property]=tweens.filter(t=> +!t.IsReleased()).map(t=>t._SaveToJson());return ret}_SaveDisabledTweensToJson(){return this._disabledTweens.filter(t=>!t.IsReleased()).map(t=>t.GetName())}_SaveWaitingForReleaseTweensToJson(){const ret={};for(const [property,tweens]of this._waitingForReleaseTweens)ret[property]=tweens.map(tween=>tween._SaveToJson());return ret}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(args){const propertyTracksConfig= +NAMESPACE.Config.GetPropertyTracksConfig(args.property,args.startValue,args.endValue,args.ease,args.resultMode,this.GetObjectInstance());const tweenId=NAMESPACE.Maps.GetPropertyFromIndex(args.property);if(!NAMESPACE.Maps.IsValueId(tweenId))this.ReleaseTweens(args.property);const tween=C3.TweenState.Build({runtime:this.GetRuntime(),id:tweenId,tags:args.tags,time:args.time,instance:this.GetObjectInstance(),releaseOnComplete:!!args.releaseOnComplete,loop:!!args.loop,pingPong:!!args.pingPong,repeatCount:args.repeatCount, +initialValueMode:args.initialValueMode,propertyTracksConfig:propertyTracksConfig});tween.AddCompletedCallback(tween=>this._FinishTriggers(tween));this._AddTween(tween,args.property);return tween}_MaybeRemoveFromActiveTweenMap(tween){const id=tween.GetId();if(this._activeTweens.has(id)){const tweenArray=this._activeTweens.get(id);if(tweenArray){const index=tweenArray.indexOf(tween);if(index!==-1)tweenArray.splice(index,1)}}}ReleaseTween(tween,complete=false){this._MaybeRemoveFromActiveTweenMap(tween); +if(tween.IsReleased())return;if(this._IsInWaitingList(tween))return;tween.Stop(complete);this._AddToWaitingList(tween)}ReleaseTweens(indexProperty,complete=false){if(C3.IsFiniteNumber(indexProperty)){const stringProperty=NAMESPACE.Maps.GetPropertyFromIndex(indexProperty);if(!this._activeTweens.has(stringProperty))return;const tweenArray=this._activeTweens.get(stringProperty);const finishingTween=this.GetFinishingTween();for(const tween of tweenArray){if(tween===finishingTween)continue;if(tween.IsReleased())continue; +if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}C3.clearArray(tweenArray)}else{const finishingTween=this.GetFinishingTween();for(const tween of this.AllTweens()){if(tween===finishingTween)continue;if(tween.IsReleased())continue;if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}for(const property of this._activeTweens.keys()){C3.clearArray(this._activeTweens.get(property));this._activeTweens.delete(property)}this._activeTweens.clear()}}ReleaseAndCompleteTween(tween){this.ReleaseTween(tween, +true)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,true)}GetPropertyValueByIndex(index){switch(index){case ENABLED:return this._enabled}}SetPropertyValueByIndex(index,value){switch(index){case ENABLED:this._enabled=!!value;break}}_GetBehaviorType(tween){const instance=tween.GetInstance();const behaviorInstances=instance.GetBehaviorInstances();for(const behaviorInstance of behaviorInstances){const behaviorType=behaviorInstance.GetBehaviorType();if(behaviorType.GetInstanceSdkCtor()===this.constructor)return behaviorType}}Trigger(method, +runtime,inst,behaviorType){if(this._runtime)return super.Trigger(method);else return runtime.Trigger(method,inst,behaviorType)}_FinishTriggers(tween){this._finishingTween=tween;NAMESPACE.Cnds.SetFinishingTween(tween);let instance;let runtime;if(!this.GetRuntime()){instance=tween.GetInstance();if(!instance)return;if(instance&&instance.IsDestroyed())return;runtime=instance.GetRuntime();const behaviorType=this._GetBehaviorType(tween);this.Trigger(NAMESPACE.Cnds.OnTweensFinished,runtime,instance,behaviorType); +this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished,runtime,instance,behaviorType);tween.Stop()}else{instance=this._inst;runtime=this._runtime;this.Trigger(NAMESPACE.Cnds.OnTweensFinished);this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished);this.ReleaseTween(tween)}this._finishingTween=null;NAMESPACE.Cnds.SetFinishingTween(null);if(tween.GetDestroyInstanceOnComplete())runtime.DestroyInstance(instance)}_AddTween(tween,indexProperty){const stringProperty=NAMESPACE.Maps.GetPropertyFromIndex(indexProperty); +if(!this._activeTweens.has(stringProperty))this._activeTweens.set(stringProperty,[]);const tweenArray=this._activeTweens.get(stringProperty);tweenArray.push(tween)}_AddToWaitingList(tween){const id=tween.GetId();if(!this._waitingForReleaseTweens.has(id))this._waitingForReleaseTweens.set(id,[]);this._waitingForReleaseTweens.get(id).push(tween);if(!this.IsTicking2())this._StartTicking2()}_IsInWaitingList(tween){const id=tween.GetId();if(!this._waitingForReleaseTweens.has(id))return false;return this._waitingForReleaseTweens.get(id).includes(tween)}_ReleaseWaitingTweens(){if(!this._waitingForReleaseTweens.size)return; +for(const tweenArray of this._waitingForReleaseTweens.values()){for(const tween of tweenArray){if(tween.IsReleased())continue;tween.Release()}C3.clearArray(tweenArray)}this._waitingForReleaseTweens.clear();if(this.IsTicking2())this._StopTicking2()}GetDebuggerProperties(){const prefix="behaviors.tween";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this.IsEnabled(),onedit:v=>this.SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.ITweenBehaviorInstance}}} +{const C3=self.C3;let finishingTween=null;C3.Behaviors.Tween.Cnds={SetFinishingTween(tween){finishingTween=tween},OnTweensFinished(tags){return finishingTween.HasTags(tags)},OnAnyTweensFinished(){return true},IsPlaying(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPlaying)},IsAnyPlaying(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false; +return tweens.some(C3.TweenState.IsPlaying)},IsPaused(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)},IsAnyPaused(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)}}} +{const C3=self.C3;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.Acts={SetEnabled(enable){this.SetEnabled(!!enable)},async TweenOneProperty(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.OneProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},async TweenTwoProperties(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.TwoProperties(this, +...args));if(tween.Play())await tween.GetPlayPromise()},async TweenValue(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.ValueProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},PauseTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Stop()},PauseAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Stop()}, +ResumeTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Resume()},ResumeAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Resume()},StopTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))this.ReleaseTween(tween)},StopAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())this.ReleaseTween(tween)}, +SetOnePropertyTweensEndValue(tags,property,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;const propertyName=C3.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues([propertyName]);tween.SetEndValue(endValue,propertyName)}},SetTwoPropertiesTweensEndValue(tags,property,endValueX,endValueY){if(!this.IsEnabled()||!this.IsInstanceValid())return;const properties=C3.Behaviors.Tween.Maps.GetRealProperties(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues(properties); +tween.SetEndValue(endValueX,properties[0]);tween.SetEndValue(endValueY,properties[1])}},SetValuePropertyTweensStartValue(tags,startValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value"))tween.SetStartValue(startValue,"value")},SetValuePropertyTweensEndValue(tags,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value")){tween.BeforeSetEndValues(["value"]);tween.SetEndValue(endValue,"value")}}, +SetTweensEase(tags,easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.GetTweens(tags))tween.SetEase(ease)},SetAllTweensEase(easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.AllTweens())tween.SetEase(ease)},SetTweensTime(tags,time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetTime(time)}, +SetAllTweensTime(time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetTime(time)},SetTweensPlaybackRate(tags,rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetPlaybackRate(rate)},SetAllTweensPlaybackRate(rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetPlaybackRate(rate)},SetTweensDestroyOnComplete(tags,destroyOnComplete){if(!this.IsEnabled()|| +!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)},SetAllTweensDestroyOnComplete(destroyOnComplete){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)}}} +{const C3=self.C3;C3.Behaviors.Tween.Exps={Time(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()},Progress(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()/tween.GetTotalTime()},Value(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags,"value");if(!tween)return 0;return tween.GetPropertyTrack("value").GetSourceAdapterValue()},Tags(){if(!this.GetFinishingTween())return"";return this.GetFinishingTween().GetStringTags()}}}; + +} + +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const PAIR_PROPERTIES=["position","size","scale"];const SINGLE_PROPERTIES=["offsetX","offsetY","offsetWidth","offsetHeight","offsetAngle","offsetOpacity","offsetColor","offsetZElevation","offsetScaleX","offsetScaleY"];const VALUE_PROPERTIES=["value"];const PROPERTY_INDEX_TO_NAME=[].concat(PAIR_PROPERTIES).concat(SINGLE_PROPERTIES).concat(VALUE_PROPERTIES); +const PROPERTY_PAIR_TO_REAL_PROPERTIES={"position":["offsetX","offsetY"],"size":["offsetWidth","offsetHeight"],"scale":["offsetScaleX","offsetScaleY"]};const ALL_REAL_PROPERTIES=Object.assign({},PROPERTY_INDEX_TO_NAME.reduce((o,key)=>Object.assign({},o,{[key]:[key]}),{}),PROPERTY_PAIR_TO_REAL_PROPERTIES); +C3.Behaviors.Tween.Maps=class Maps{constructor(){}static GetEases(){return[...Ease.GetRuntimeEaseNames()]}static GetEaseFromIndex(index){return[...Ease.GetRuntimeEaseNames()][index]}static GetPropertyFromIndex(index){return PROPERTY_INDEX_TO_NAME[index]}static GetPropertyIndexFromName(name){return PROPERTY_INDEX_TO_NAME.indexOf(name)}static GetPairPropertyFromIndex(index){return PAIR_PROPERTIES[index]}static GetSinglePropertyFromIndex(index){return SINGLE_PROPERTIES[index]}static GetValuePropertyFromIndex(index){return VALUE_PROPERTIES[index]}static GetPairProperties(pairId){return PROPERTY_PAIR_TO_REAL_PROPERTIES[pairId]}static GetRealProperties(id){if(C3.IsString(id))return ALL_REAL_PROPERTIES[id];else return ALL_REAL_PROPERTIES[PROPERTY_INDEX_TO_NAME[id]]}static IsPairId(id){return!!PROPERTY_PAIR_TO_REAL_PROPERTIES[id]}static IsColorId(id){return id=== +"offsetColor"}static IsAngleId(id){return id==="offsetAngle"}static IsOpacityId(id){return id==="offsetOpacity"}static IsValueId(id){return id==="value"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TWEEN_CONFIGURATIONS=new Map; +NAMESPACE.Config=class Config{constructor(){}static GetPropertyTracksConfig(property,startValue,endValue,ease,resultMode,instance){if(TWEEN_CONFIGURATIONS.size===0)this._CreateConfigObjects();const propertyType=NAMESPACE.PropertyTypes.Pick(property);let config=TWEEN_CONFIGURATIONS.get(propertyType);if(C3.IsFiniteNumber(property))property=NAMESPACE.Maps.GetPropertyFromIndex(property);return this._GetConfig(config,property,startValue,endValue,ease,resultMode,instance)}static TransformValue(property, +value){const configFunctionObject=C3.Behaviors.Tween.GetPropertyTracksConfig(property);return configFunctionObject.valueGetter(value)}static _CreateConfigObjects(){const types=NAMESPACE.PropertyTypes;const getters=NAMESPACE.ValueGetters;this._AddConfigObject(types.PAIR,this._GetPairConfig,getters._GetPropertyValue);this._AddConfigObject(types.COLOR,this._GetColorConfig,getters._GetColorPropertyValue);this._AddConfigObject(types.ANGLE,this._GetAngleConfig,getters._GetPropertyAngleValue);this._AddConfigObject(types.VALUE, +this._GetValueConfig,getters._GetPropertyValue);this._AddConfigObject(types.OTHER,this._GetCommonConfig,getters._GetPropertyValue)}static _AddConfigObject(name,configGetter,valueGetter){TWEEN_CONFIGURATIONS.set(name,this._CreateConfigObject(name,configGetter,valueGetter))}static _CreateConfigObject(name,configFunc,valueGetter){return{name:name,configFunc:configFunc,valueGetter:valueGetter}}static _GetConfig(config,property,startValue,endValue,ease,resultMode,instance){return config.configFunc(property, +config.valueGetter(startValue),config.valueGetter(endValue),ease,resultMode,instance)}static _GetPairConfig(property,startValues,endValues,ease,resultMode,instance){const properties=NAMESPACE.Maps.GetPairProperties(property);return properties.map((property,index)=>{return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValues[index],endValue:endValues[index],ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}})}static _GetColorConfig(property, +startValue,endValue,ease,resultMode,instance){if(C3.Plugins.Text&&instance.GetPlugin()instanceof C3.Plugins.Text)return{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode};else return{sourceId:"world-instance",property:property,type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetAngleConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"angle",valueType:"angle",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetCommonConfig(property,startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetValueConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"value",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const COMMON_FIXED_ARGS={resultMode:"absolute"};const COMMON_VARIABLE_ARGS=Object.assign({},COMMON_FIXED_ARGS,{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:false,pingPong:false,repeatCount:1});const ONE_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:0,endValue:0}); +const TWO_PROPERTIES_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]});const COLOR_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]});const VALUE_PROPERTY_ARGS=Object.assign({},ONE_PROPERTY_ARGS,{initialValueMode:"start-value"});const X=0;const Y=1;const R=0;const G=1;const B=2; +NAMESPACE.TweenArguments=class TweenArguments{constructor(){}static _SetCommonProperties(argsObject,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount){argsObject.tags=tags;argsObject.time=time;argsObject.ease=ease;argsObject.releaseOnComplete=destroyOnComplete;argsObject.loop=loop;argsObject.pingPong=pingPong;argsObject.repeatCount=repeatCount}static OneProperty(inst,tags,property,endValue,time,ease,destroyOnComplete,loop,pingPong,repeatCount){const propertyName=typeof property==="string"? +property:NAMESPACE.Maps.GetSinglePropertyFromIndex(property);const args=NAMESPACE.Maps.IsColorId(propertyName)?COLOR_PROPERTY_ARGS:ONE_PROPERTY_ARGS;this._SetCommonProperties(args,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);if(NAMESPACE.Maps.IsColorId(propertyName)){COLOR_PROPERTY_ARGS.endValue[R]=C3.GetRValue(endValue);COLOR_PROPERTY_ARGS.endValue[G]=C3.GetGValue(endValue);COLOR_PROPERTY_ARGS.endValue[B]=C3.GetBValue(endValue);COLOR_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName)}else if(NAMESPACE.Maps.IsOpacityId(propertyName))ONE_PROPERTY_ARGS.endValue= +endValue/100;else ONE_PROPERTY_ARGS.endValue=endValue;args.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName);return args}static TwoProperties(inst,tags,property,endValueX,endValueY,time,ease,destroyOnComplete,loop,pingPong,repeatCount){this._SetCommonProperties(TWO_PROPERTIES_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);const pairName=typeof property==="string"?property:NAMESPACE.Maps.GetPairPropertyFromIndex(property);TWO_PROPERTIES_ARGS.endValue[X]=endValueX;TWO_PROPERTIES_ARGS.endValue[Y]= +endValueY;TWO_PROPERTIES_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(pairName);return TWO_PROPERTIES_ARGS}static ValueProperty(inst,tags,startValue,endValue,time,ease,destroyOnComplete,loop,pingPong,repeatCount){this._SetCommonProperties(VALUE_PROPERTY_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);VALUE_PROPERTY_ARGS.startValue=startValue;VALUE_PROPERTY_ARGS.endValue=endValue;VALUE_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName("value");return VALUE_PROPERTY_ARGS}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TYPE_CHECK_OBJECTS=[]; +NAMESPACE.PropertyTypes=class PropertyTypes{constructor(){}static Pick(property){if(TYPE_CHECK_OBJECTS.length===0){const arr=TYPE_CHECK_OBJECTS;arr.push({checkFunc:NAMESPACE.Maps.IsPairId,result:this.PAIR});arr.push({checkFunc:NAMESPACE.Maps.IsColorId,result:this.COLOR});arr.push({checkFunc:NAMESPACE.Maps.IsAngleId,result:this.ANGLE});arr.push({checkFunc:NAMESPACE.Maps.IsValueId,result:this.VALUE});arr.push({checkFunc:()=>true,result:this.OTHER})}if(C3.IsFiniteNumber(property))property=C3.Behaviors.Tween.Maps.GetPropertyFromIndex(property); +for(const propertyTypeFunctionObject of TYPE_CHECK_OBJECTS)if(propertyTypeFunctionObject.checkFunc(property))return propertyTypeFunctionObject.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.ValueGetters=class ValueGetters{constructor(){}static _GetPropertyAngleValue(value){const r=C3.toRadians(parseFloat(value));return C3.clampAngle(r)}static _GetColorPropertyValue(value){return value.slice(0)}static _GetPropertyValue(value){return value}}; + +} + +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;const map=new WeakMap; +const TWEEN_PROPERTIES=new Map([["x",{name:"offsetX",type:"one"}],["y",{name:"offsetY",type:"one"}],["width",{name:"offsetWidth",type:"one"}],["height",{name:"offsetHeight",type:"one"}],["angle",{name:"offsetAngle",type:"one"}],["opacity",{name:"offsetOpacity",type:"one"}],["color",{name:"offsetColor",type:"color"}],["z-elevation",{name:"offsetZElevation",type:"one"}],["x-scale",{name:"offsetScaleX",type:"one"}],["y-scale",{name:"offsetScaleY",type:"one"}],["position",{name:"position",type:"two"}], +["size",{name:"size",type:"two"}],["scale",{name:"scale",type:"two"}],["value",{name:"value",type:"value"}]]);function getIndexForEase(ease){C3X.RequireString(ease);const easeInternalName=Ease.ToInternal(ease);let easeIndex;if(easeInternalName)easeIndex=Ease.GetIndexForEase(easeInternalName,null);else easeIndex=Ease.GetIndexForEase(ease,null);if(easeIndex===-1)throw new Error(`invalid ease name '${ease}'`);return easeIndex} +const TWEEN_OPTS={tags:"",destroyOnComplete:false,loop:false,pingPong:false,repeatCount:1,startValue:0};const I_TWEEN_OPTS={easeToIndexFunc:getIndexForEase}; +self.ITweenBehaviorInstance=class ITweenBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTween(prop,endValue,time,ease,opts){const inst=map.get(this);if(!inst.IsEnabled()||!inst.IsInstanceValid())return null;const info=TWEEN_PROPERTIES.get(prop);if(!info)throw new Error("invalid tween property");if(info.type==="one"||info.type==="value")C3X.RequireNumber(endValue);else{C3X.RequireArray(endValue);if(info.type==="two"){C3X.RequireNumber(endValue[0]); +C3X.RequireNumber(endValue[1])}else if(info.type==="color"){C3X.RequireNumber(endValue[0]);C3X.RequireNumber(endValue[1]);C3X.RequireNumber(endValue[2])}}if(prop==="angle")endValue=C3.toDegrees(endValue);else if(prop==="opacity")endValue*=100;else if(prop==="color")endValue=C3.PackRGBEx(endValue[0],endValue[1],endValue[2]);const easeIndex=getIndexForEase(ease);C3X.RequireFiniteNumber(time);opts=Object.assign({},TWEEN_OPTS,opts);if(info.type==="value")C3X.RequireNumber(opts.startValue);let tween;if(info.type=== +"one"||info.type==="color")tween=inst.CreateTween(NAMESPACE.TweenArguments.OneProperty(inst,opts.tags,info.name,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));else if(info.type==="two")tween=inst.CreateTween(NAMESPACE.TweenArguments.TwoProperties(inst,opts.tags,info.name,endValue[0],endValue[1],time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));else if(info.type==="value")tween=inst.CreateTween(NAMESPACE.TweenArguments.ValueProperty(inst, +opts.tags,opts.startValue,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));if(!tween.Play())throw new Error("failed to start tween");return tween.GetITweenState(inst,I_TWEEN_OPTS)}*allTweens(){const inst=map.get(this);for(const tween of inst.AllTweens())yield tween.GetITweenState(inst,I_TWEEN_OPTS)}*tweensByTags(tags){C3X.RequireString(tags);const inst=map.get(this);for(const tween of inst.GetTweens(tags))yield tween.GetITweenState(inst,I_TWEEN_OPTS)}get isEnabled(){return map.get(this).IsEnabled()}set isEnabled(e){map.get(this).SetEnabled(e)}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Sin=class SinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Sin.Type=class SinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const MOVEMENT=0;const WAVE=1;const PERIOD=2;const PERIOD_RANDOM=3;const PERIOD_OFFSET=4;const PERIOD_OFFSET_RANDOM=5;const MAGNITUDE=6;const MAGNITUDE_RANDOM=7;const ENABLE=8;const HORIZONTAL=0;const VERTICAL=1;const SIZE=2;const WIDTH=3;const HEIGHT=4;const ANGLE=5;const OPACITY=6;const VALUE=7;const FORWARDS_BACKWARDS=8;const ZELEVATION=9;const SINE=0;const TRIANGLE=1;const SAWTOOTH=2;const REVERSE_SAWTOOTH=3;const SQUARE= +4;const _2pi=2*Math.PI;const _pi_2=Math.PI/2;const _3pi_2=3*Math.PI/2;const MOVEMENT_LOOKUP=[0,1,8,3,4,2,5,6,9,7];C3.Behaviors.Sin.Instance=class SinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._i=0;this._movement=0;this._wave=0;this._period=0;this._mag=0;this._isEnabled=true;this._basePeriod=0;this._basePeriodOffset=0;this._baseMag=0;this._periodRandom=0;this._periodOffsetRandom=0;this._magnitudeRandom=0;this._initialValue=0;this._initialValue2= +0;this._lastKnownValue=0;this._lastKnownValue2=0;this._ratio=0;if(properties){this._movement=MOVEMENT_LOOKUP[properties[MOVEMENT]];this._wave=properties[WAVE];this._periodRandom=this._runtime.Random()*properties[PERIOD_RANDOM];this._basePeriod=properties[PERIOD];this._period=properties[PERIOD];this._period+=this._periodRandom;this._basePeriodOffset=properties[PERIOD_OFFSET];if(this._period!==0){this._periodOffsetRandom=this._runtime.Random()*properties[PERIOD_OFFSET_RANDOM];this._i=properties[PERIOD_OFFSET]/ +this._period*_2pi;this._i+=this._periodOffsetRandom/this._period*_2pi}this._magnitudeRandom=this._runtime.Random()*properties[MAGNITUDE_RANDOM];this._baseMag=properties[MAGNITUDE];this._mag=properties[MAGNITUDE];this._mag+=this._magnitudeRandom;this._isEnabled=!!properties[ENABLE]}if(this._movement===ANGLE)this._mag=C3.toRadians(this._mag);this.Init();if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"i":this._i,"e":this._isEnabled,"mv":this._movement,"w":this._wave, +"p":this._period,"mag":this._mag,"iv":this._initialValue,"iv2":this._initialValue2,"r":this._ratio,"lkv":this._lastKnownValue,"lkv2":this._lastKnownValue2}}LoadFromJson(o){this._i=o["i"];this._SetEnabled(o["e"]);this._movement=o["mv"];this._wave=o["w"];this._period=o["p"];this._mag=o["mag"];this._initialValue=o["iv"];this._initialValue2=o["iv2"];this._ratio=o["r"];this._lastKnownValue=o["lkv"];this._lastKnownValue2=o["lkv2"]}Init(){const wi=this._inst.GetWorldInfo();switch(this._movement){case HORIZONTAL:this._initialValue= +wi.GetX();break;case VERTICAL:this._initialValue=wi.GetY();break;case SIZE:this._initialValue=wi.GetWidth();this._ratio=wi.GetHeight()/wi.GetWidth();break;case WIDTH:this._initialValue=wi.GetWidth();break;case HEIGHT:this._initialValue=wi.GetHeight();break;case ANGLE:this._initialValue=wi.GetAngle();break;case OPACITY:this._initialValue=wi.GetOpacity();break;case VALUE:this._initialValue=0;break;case FORWARDS_BACKWARDS:this._initialValue=wi.GetX();this._initialValue2=wi.GetY();break;case ZELEVATION:this._initialValue= +wi.GetZElevation();break;default:}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(x){x=x%_2pi;switch(this._wave){case SINE:return Math.sin(x);case TRIANGLE:if(x<=_pi_2)return x/_pi_2;else if(x<=_3pi_2)return 1-2*(x-_pi_2)/Math.PI;else return(x-_3pi_2)/_pi_2-1;case SAWTOOTH:return 2*x/_2pi-1;case REVERSE_SAWTOOTH:return-2*x/_2pi+1;case SQUARE:return xthis._SetEnabled(v)},{name:prefix+".properties.period.name",value:this._GetPeriod(),onedit:v=>this._SetPeriod(v)}, +{name:prefix+".properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:v=>this._SetMagnitude_ConvertAngle(v)},{name:prefix+".debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};const map=new WeakMap;const VALID_MOVEMENTS=["horizontal","vertical","size","width","height","angle","opacity","value-only","forwards-backwards","z-elevation"];const VALID_WAVES=["sine","triangle","sawtooth", +"reverse-sawtooth","square"];self.ISineBehaviorInstance=class ISineBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}set period(x){C3X.RequireFiniteNumber(x);map.get(this)._SetPeriod(x)}get period(){return map.get(this)._GetPeriod()}set magnitude(m){C3X.RequireFiniteNumber(m);map.get(this)._SetMagnitude(m)}get magnitude(){return map.get(this)._GetMagnitude()}set phase(p){map.get(this)._SetPhase(p)}get phase(){return map.get(this)._GetPhase()}set movement(m){C3X.RequireString(m); +const i=VALID_MOVEMENTS.indexOf(m);if(i===-1)throw new Error("invalid movement");map.get(this)._SetMovement(i)}get movement(){return VALID_MOVEMENTS[map.get(this)._GetMovement()]}set wave(w){C3X.RequireString(w);const i=VALID_WAVES.indexOf(w);if(i===-1)throw new Error("invalid wave");map.get(this)._SetWave(i)}get wave(){return VALID_WAVES[map.get(this)._GetWave()]}get value(){const inst=map.get(this);return inst.WaveFunc(inst._GetPhase())*inst._GetMagnitude()}updateInitialState(){map.get(this).Init()}set isEnabled(e){map.get(this)._SetEnabled(!!e)}get isEnabled(){return map.get(this)._IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(m){return this._GetMovement()===m},ComparePeriod(cmp,v){return C3.compare(this._GetPeriod(),cmp,v)},CompareMagnitude(cmp,v){return C3.compare(this._GetMagnitude_ConvertAngle(),cmp,v)},CompareWave(w){return this._GetWave()===w}}} +{const C3=self.C3;C3.Behaviors.Sin.Acts={SetEnabled(e){this._SetEnabled(e!==0)},SetPeriod(x){this._SetPeriod(x)},SetMagnitude(x){this._SetMagnitude_ConvertAngle(x)},SetMovement(m){this._SetMovement(m)},SetWave(w){this._wave=w},SetPhase(x){const _2pi=Math.PI*2;this._SetPhase(x*_2pi%_2pi)},UpdateInitialState(){this.Init()}}} +{const C3=self.C3;C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Fade=class FadeBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Fade.Type=class FadeType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const FADE_IN_TIME=0;const WAIT_TIME=1;const FADE_OUT_TIME=2;const DESTROY=3;const ACTIVE_AT_START=4;C3.Behaviors.Fade.Instance=class FadeInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._fadeInTime=0;this._waitTime=0;this._fadeOutTime=0;this._destroy=true;this._activeAtStart=true;this._setMaxOpacity=false;this._stage=0;this._stageTime=C3.New(C3.KahanSum);this._maxOpacity= +this._inst.GetWorldInfo().GetOpacity()||1;if(properties){this._fadeInTime=properties[FADE_IN_TIME];this._waitTime=properties[WAIT_TIME];this._fadeOutTime=properties[FADE_OUT_TIME];this._destroy=!!properties[DESTROY];this._activeAtStart=!!properties[ACTIVE_AT_START];this._stage=this._activeAtStart?0:3}if(this._activeAtStart)if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"fit":this._fadeInTime, +"wt":this._waitTime,"fot":this._fadeOutTime,"d":this._destroy,"s":this._stage,"st":this._stageTime.Get(),"mo":this._maxOpacity}}LoadFromJson(o){this._fadeInTime=o["fit"];this._waitTime=o["wt"];this._fadeOutTime=o["fot"];this._destroy=o["d"];this._stage=o["s"];this._stageTime.Set(o["st"]);this._maxOpacity=o["mo"];if(this._stage===3)this._StopTicking();else this._StartTicking()}Tick(){const dt=this._runtime.GetDt(this._inst);this._stageTime.Add(dt);const wi=this._inst.GetWorldInfo();if(this._stage=== +0){wi.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity);this._runtime.UpdateRender();if(wi.GetOpacity()>=this._maxOpacity){wi.SetOpacity(this._maxOpacity);this._stage=1;this._stageTime.Reset();this.DispatchScriptEvent("fadeinend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeInEnd)}}if(this._stage===1)if(this._stageTime.Get()>=this._waitTime){this._stage=2;this._stageTime.Reset();this.DispatchScriptEvent("waitend");this.Trigger(C3.Behaviors.Fade.Cnds.OnWaitEnd)}if(this._stage===2)if(this._fadeOutTime!== +0){wi.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity);this._runtime.UpdateRender();if(wi.GetOpacity()<=0){this._stage=3;this._stageTime.Reset();this.DispatchScriptEvent("fadeoutend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeOutEnd);if(this._destroy)this._runtime.DestroyInstance(this._inst)}}else{this._stage=3;this._stageTime.Reset()}if(this._stage===3)this._StopTicking()}_StartFade(){if(!this._activeAtStart&&!this._setMaxOpacity){this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()|| +1;this._setMaxOpacity=true}if(this._stage===3)this.Start()}_RestartFade(){this.Start()}Start(){this._stage=0;this._stageTime.Reset();if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}this._StartTicking()}_SetFadeInTime(t){this._fadeInTime=Math.max(t,0)}_GetFadeInTime(){return this._fadeInTime}_SetWaitTime(t){this._waitTime=Math.max(t,0)}_GetWaitTime(){return this._waitTime}_SetFadeOutTime(t){this._fadeOutTime= +Math.max(t,0)}_GetFadeOutTime(){return this._fadeOutTime}GetPropertyValueByIndex(index){switch(index){case FADE_IN_TIME:return this._GetFadeInTime();case WAIT_TIME:return this._GetWaitTime();case FADE_OUT_TIME:return this._GetFadeOutTime();case DESTROY:return this._destroy}}SetPropertyValueByIndex(index,value){switch(index){case FADE_IN_TIME:this._SetFadeInTime(value);break;case WAIT_TIME:this._SetWaitTime(value);break;case FADE_OUT_TIME:this._SetFadeOutTime(value);break;case DESTROY:this._destroy= +!!value;break}}GetDebuggerProperties(){const prefix="behaviors.fade";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.fade-in-time.name",value:this._GetFadeInTime(),onedit:v=>this._SetFadeInTime(v)},{name:prefix+".properties.wait-time.name",value:this._GetWaitTime(),onedit:v=>this._SetWaitTime(v)},{name:prefix+".properties.fade-out-time.name",value:this._GetFadeOutTime(),onedit:v=>this._SetFadeOutTime(v)},{name:prefix+".debugger.stage",value:[prefix+".debugger."+ +["fade-in","wait","fade-out","done"][this._stage]]}]}]}GetScriptInterfaceClass(){return self.IFadeBehaviorInstance}};const map=new WeakMap;self.IFadeBehaviorInstance=class IFadeBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startFade(){map.get(this)._StartFade()}restartFade(){map.get(this)._RestartFade()}set fadeInTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeInTime(t)}get fadeInTime(){return map.get(this)._GetFadeInTime()}set waitTime(t){C3X.RequireFiniteNumber(t); +map.get(this)._SetWaitTime(t)}get waitTime(){return map.get(this)._GetWaitTime()}set fadeOutTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeOutTime(t)}get fadeOutTime(){return map.get(this)._GetFadeOutTime()}}}{const C3=self.C3;C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return true},OnFadeInEnd(){return true},OnWaitEnd(){return true}}} +{const C3=self.C3;C3.Behaviors.Fade.Acts={StartFade(){this._StartFade()},RestartFade(){this._RestartFade()},SetFadeInTime(t){this._SetFadeInTime(t)},SetWaitTime(t){this._SetWaitTime(t)},SetFadeOutTime(t){this._SetFadeOutTime(t)}}}{const C3=self.C3;C3.Behaviors.Fade.Exps={FadeInTime(){return this._GetFadeInTime()},WaitTime(){return this._GetWaitTime()},FadeOutTime(){return this._GetFadeOutTime()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Bullet=class BulletBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Bullet.Type=class BulletType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const SPEED=0;const ACCELERATION=1;const GRAVITY=2;const BOUNCE_OFF_SOLIDS=3;const SET_ANGLE=4;const STEPPING=5;const ENABLE=6;C3.Behaviors.Bullet.Instance=class BulletInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);const wi=this.GetWorldInfo();this._speed=0;this._acc=0;this._g=0;this._bounceOffSolid=false;this._setAngle=false;this._isStepping=false;this._isEnabled=true;this._dx= +0;this._dy=0;this._lastX=wi.GetX();this._lastY=wi.GetY();this._lastKnownAngle=wi.GetAngle();this._travelled=0;this._stepSize=Math.min(Math.abs(wi.GetWidth()),Math.abs(wi.GetHeight())/2);this._stopStepping=false;if(properties){this._speed=properties[SPEED];this._acc=properties[ACCELERATION];this._g=properties[GRAVITY];this._bounceOffSolid=!!properties[BOUNCE_OFF_SOLIDS];this._setAngle=!!properties[SET_ANGLE];this._isStepping=!!properties[STEPPING];this._isEnabled=!!properties[ENABLE]}const a=wi.GetAngle(); +this._dx=Math.cos(a)*this._speed;this._dy=Math.sin(a)*this._speed;if(this._isEnabled){this._StartTicking();if(this._bounceOffSolid)this._StartPostTicking()}}Release(){super.Release()}SaveToJson(){const o={"dx":this._dx,"dy":this._dy,"lx":this._lastX,"ly":this._lastY,"lka":this._lastKnownAngle,"t":this._travelled};if(this._acc!==0)o["acc"]=this._acc;if(this._g!==0)o["g"]=this._g;if(this._isStepping)o["st"]=this._isStepping;if(!this._isEnabled)o["e"]=this._isEnabled;if(this._bounceOffSolid)o["bos"]= +this._bounceOffSolid;if(this._setAngle)o["sa"]=this._setAngle;return o}LoadFromJson(o){this._dx=o["dx"];this._dy=o["dy"];this._lastX=o["lx"];this._lastY=o["ly"];this._lastKnownAngle=o["lka"];this._travelled=o["t"];this._acc=o.hasOwnProperty("acc")?o["acc"]:0;this._g=o.hasOwnProperty("g")?o["g"]:0;this._isStepping=o.hasOwnProperty("st")?o["st"]:false;this._bounceOffSolid=o.hasOwnProperty("bos")?o["bos"]:false;this._setAngle=o.hasOwnProperty("sa")?o["sa"]:false;this._SetEnabled(o.hasOwnProperty("e")? +o["e"]:true)}Tick(){if(!this._isEnabled)return;const dt=this._runtime.GetDt(this._inst);const wi=this._inst.GetWorldInfo();if(wi.GetAngle()!==this._lastKnownAngle){const angle=wi.GetAngle();if(this._setAngle){const s=C3.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(angle)*s;this._dy=Math.sin(angle)*s}this._lastKnownAngle=angle}let xacc=0;let yacc=0;if(this._acc!==0){let s=C3.distanceTo(0,0,this._dx,this._dy);let a=0;if(this._dx===0&&this._dy===0)a=wi.GetAngle();else a=C3.angleTo(0,0,this._dx, +this._dy);s+=this._acc*dt;xacc=Math.cos(a)*this._acc;yacc=Math.sin(a)*this._acc;if(s<0){s=0;xacc=0;yacc=0}this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}if(this._g!==0){this._dy+=this._g*dt;yacc+=this._g}this._lastX=wi.GetX();this._lastY=wi.GetY();if(this._dx!==0||this._dy!==0){const mx=this._dx*dt+.5*xacc*dt*dt;const my=this._dy*dt+.5*yacc*dt*dt;const stepDist=C3.distanceTo(0,0,mx,my);this._MoveBy(mx,my,stepDist);this._travelled+=stepDist;if(this._setAngle&&(mx!==0||my!==0)){const a=C3.angleTo(0, +0,mx,my);wi.SetAngle(a);this._lastKnownAngle=wi.GetAngle()}wi.SetBboxChanged()}}_MoveBy(mx,my,stepDist){const wi=this.GetWorldInfo();if(!this._isStepping||stepDist<=this._stepSize){wi.OffsetXY(mx,my);wi.SetBboxChanged();if(this._isStepping)this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep);return}this._stopStepping=false;const startX=wi.GetX();const startY=wi.GetY();const endX=startX+mx;const endY=startY+my;const a=C3.angleTo(0,0,mx,my);const stepX=Math.cos(a)*this._stepSize;const stepY=Math.sin(a)*this._stepSize; +const stepCount=Math.floor(stepDist/this._stepSize);for(let i=1;i<=stepCount;++i){wi.SetXY(startX+stepX*i,startY+stepY*i);wi.SetBboxChanged();this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep);if(this._inst.IsDestroyed()||this._stopStepping)return}wi.SetXY(endX,endY);wi.SetBboxChanged();this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep)}PostTick(){if(!this._isEnabled||!this._bounceOffSolid||this._dx===0&&this._dy===0)return;const dt=this._runtime.GetDt(this._inst);const wi=this._inst.GetWorldInfo();const collisionEngine= +this._runtime.GetCollisionEngine();const bounceSolid=collisionEngine.TestOverlapSolid(this._inst);if(bounceSolid){collisionEngine.RegisterCollision(this._inst,bounceSolid);const s=C3.distanceTo(0,0,this._dx,this._dy);const bounceAngle=collisionEngine.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(bounceAngle)*s;this._dy=Math.sin(bounceAngle)*s;wi.OffsetXY(this._dx*dt,this._dy*dt);wi.SetBboxChanged();if(this._setAngle){wi.SetAngle(bounceAngle);this._lastKnownAngle=wi.GetAngle(); +wi.SetBboxChanged()}if(!collisionEngine.PushOutSolid(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30)))collisionEngine.PushOutSolidNearest(this._inst,100)}}GetPropertyValueByIndex(index){switch(index){case SPEED:return this._GetSpeed();case ACCELERATION:return this._GetAcceleration();case GRAVITY:return this._GetGravity();case SET_ANGLE:return this._setAngle;case STEPPING:return this._isStepping;case ENABLE:return this._IsEnabled()}}SetPropertyValueByIndex(index,value){switch(index){case SPEED:this._SetSpeed(value); +break;case ACCELERATION:this._acc=value;break;case GRAVITY:this._g=value;break;case SET_ANGLE:this._setAngle=!!value;break;case STEPPING:this._isStepping=!!value;break;case ENABLE:this._SetEnabled(!!value);break}}_SetSpeed(s){const a=C3.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}_GetSpeed(){return C3.roundToDp(C3.distanceTo(0,0,this._dx,this._dy),6)}_SetAcceleration(a){this._acc=a}_GetAcceleration(){return this._acc}_SetGravity(g){this._g=g}_GetGravity(){return this._g}_SetAngleOfMotion(a){const s= +C3.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}_GetAngleOfMotion(){return C3.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(b){b=!!b;if(this._bounceOffSolid===b)return;this._bounceOffSolid=b;if(this._isEnabled)if(this._bounceOffSolid)this._StartPostTicking();else this._StopPostTicking()}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(d){this._travelled=d}_GetDistanceTravelled(){return this._travelled}_SetEnabled(e){this._isEnabled=!!e; +if(this._isEnabled){this._StartTicking();if(this._bounceOffSolid)this._StartPostTicking()}else{this._StopTicking();this._StopPostTicking()}}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const prefix="behaviors.bullet";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".debugger.vector-x",value:this._dx,onedit:v=>this._dx=v},{name:prefix+".debugger.vector-y",value:this._dy,onedit:v=>this._dy=v},{name:prefix+".properties.speed.name",value:this._GetSpeed(),onedit:v=> +this._SetSpeed(v)},{name:prefix+".debugger.angle-of-motion",value:C3.toDegrees(this._GetAngleOfMotion())},{name:prefix+".properties.gravity.name",value:this._GetGravity(),onedit:v=>this._SetGravity(v)},{name:prefix+".properties.acceleration.name",value:this._GetAcceleration(),onedit:v=>this._SetAcceleration(v)},{name:prefix+".debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}}; +const map=new WeakMap;self.IBulletBehaviorInstance=class IBulletBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get speed(){return map.get(this)._GetSpeed()}set speed(s){C3X.RequireFiniteNumber(s);map.get(this)._SetSpeed(s)}get acceleration(){return map.get(this)._GetAcceleration()}set acceleration(a){C3X.RequireFiniteNumber(a);map.get(this)._SetAcceleration(a)}get gravity(){return map.get(this)._GetGravity()}set gravity(g){C3X.RequireFiniteNumber(g); +map.get(this)._SetGravity(g)}get angleOfMotion(){return map.get(this)._GetAngleOfMotion()}set angleOfMotion(a){C3X.RequireFiniteNumber(a);map.get(this)._SetAngleOfMotion(a)}get bounceOffSolids(){return map.get(this)._IsBounceOffSolids()}set bounceOffSolids(b){map.get(this)._SetBounceOffSolids(!!b)}get distanceTravelled(){return map.get(this)._GetDistanceTravelled()}set distanceTravelled(d){C3X.RequireFiniteNumber(d);map.get(this)._SetDistanceTravelled(d)}get isEnabled(){return map.get(this)._IsEnabled()}set isEnabled(e){map.get(this)._SetEnabled(e)}}} +{const C3=self.C3;C3.Behaviors.Bullet.Cnds={CompareSpeed(cmp,s){const speed=Math.hypot(this._dx,this._dy);return C3.compare(speed,cmp,s)},CompareTravelled(cmp,d){return C3.compare(this._GetDistanceTravelled(),cmp,d)},OnStep(){return true},IsEnabled(){return this._IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.Bullet.Acts={SetSpeed(s){this._SetSpeed(s)},SetAcceleration(a){this._SetAcceleration(a)},SetGravity(g){this._SetGravity(g)},SetAngleOfMotion(a){this._SetAngleOfMotion(C3.toRadians(a))},Bounce(objectClass){if(!objectClass)return;const otherInst=objectClass.GetFirstPicked(this._inst);if(!otherInst)return;const wi=this._inst.GetWorldInfo();const collisionEngine=this._runtime.GetCollisionEngine();const dt=this._runtime.GetDt(this._inst);const s=C3.distanceTo(0,0,this._dx, +this._dy);const bounceAngle=collisionEngine.CalculateBounceAngle(this._inst,this._lastX,this._lastY,otherInst);this._dx=Math.cos(bounceAngle)*s;this._dy=Math.sin(bounceAngle)*s;wi.OffsetXY(this._dx*dt,this._dy*dt);wi.SetBboxChanged();if(this._setAngle){wi.SetAngle(bounceAngle);this._lastKnownAngle=wi.GetAngle();wi.SetBboxChanged()}if(s!==0)if(this._bounceOffSolid){if(!collisionEngine.PushOutSolid(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30)))collisionEngine.PushOutSolidNearest(this._inst, +100)}else collisionEngine.PushOut(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30),otherInst)},SetBounceOffSolids(b){this._SetBounceOffSolids(b)},SetDistanceTravelled(d){this._SetDistanceTravelled(d)},SetEnabled(e){this._SetEnabled(e)},StopStepping(){this._stopStepping=true}}} +{const C3=self.C3;C3.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return C3.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.wrap=class WrapBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.wrap.Type=class WrapType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const MODE=0;const bound=new C3.Rect;C3.Behaviors.wrap.Instance=class WrapInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._mode=0;if(properties)this._mode=properties[MODE];this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"m":this._mode}}LoadFromJson(o){this._mode=o["m"]}Tick(){const wi=this._inst.GetWorldInfo();const layer=wi.GetLayer();const layout=layer.GetLayout();const bbox=wi.GetBoundingBox();if(this._mode=== +0)bound.set(0,0,layout.GetWidth(),layout.GetHeight());else bound.copy(layer.GetViewport());if(bbox.getRight()bound.getRight()){wi.SetX(bound.getLeft()+1-(bbox.getRight()-wi.GetX()));wi.SetBboxChanged()}else if(bbox.getBottom()bound.getBottom()){wi.SetY(bound.getTop()+1-(bbox.getBottom()- +wi.GetY()));wi.SetBboxChanged()}}GetPropertyValueByIndex(index){switch(index){case MODE:return this._mode}}SetPropertyValueByIndex(index,value){switch(index){case MODE:this._mode=value;break}}}}{const C3=self.C3;C3.Behaviors.wrap.Cnds={}}{const C3=self.C3;C3.Behaviors.wrap.Acts={}}{const C3=self.C3;C3.Behaviors.wrap.Exps={}}; + +} + +{ +const C3 = self.C3; +self.C3_GetObjectRefTable = function () { + return [ + C3.Plugins.Sprite, + C3.Behaviors.Physics, + C3.Behaviors.Pin, + C3.Behaviors.Timer, + C3.Plugins.Keyboard, + C3.Plugins.Audio, + C3.Behaviors.Anchor, + C3.Behaviors.Tween, + C3.Plugins.TiledBg, + C3.Plugins.Spritefont2, + C3.Behaviors.Sin, + C3.Plugins.DrawingCanvas, + C3.Plugins.Arr, + C3.Plugins.Mouse, + C3.Plugins.Particles, + C3.Plugins.Touch, + C3.Plugins.Browser, + C3.Behaviors.Fade, + C3.Behaviors.Bullet, + C3.Behaviors.wrap, + C3.Plugins.System.Cnds.IsGroupActive, + C3.Plugins.System.Cnds.OnLayoutStart, + C3.Behaviors.Physics.Acts.CreateLimitedRevoluteJoint, + C3.Behaviors.Physics.Acts.SetSteppingMode, + C3.Behaviors.Pin.Acts.Pin, + C3.Plugins.Sprite.Cnds.CompareInstanceVar, + C3.Plugins.System.Cnds.CompareVar, + C3.Plugins.Sprite.Cnds.IsOverlapping, + C3.Plugins.System.Cnds.TriggerOnce, + C3.Behaviors.Physics.Acts.ApplyForce, + C3.Behaviors.Physics.Exps.VelocityX, + C3.Plugins.System.Exps.dt, + C3.Plugins.Sprite.Cnds.CompareX, + C3.Plugins.Sprite.Exps.ImagePointX, + C3.Plugins.Sprite.Acts.SetInstanceVar, + C3.Plugins.System.Exps.random, + C3.Plugins.Sprite.Cnds.CompareY, + C3.Plugins.Sprite.Exps.ImagePointY, + C3.Behaviors.Physics.Acts.SetAngularVelocity, + C3.Plugins.Sprite.Cnds.IsBetweenAngles, + C3.Plugins.System.Cnds.Else, + C3.Plugins.Sprite.Acts.AddInstanceVar, + C3.Plugins.Sprite.Acts.SubInstanceVar, + C3.Behaviors.Physics.Acts.ApplyForceToward, + C3.Plugins.System.Cnds.Compare, + C3.Plugins.Sprite.Exps.Angle, + C3.Plugins.Sprite.Acts.SetAngle, + C3.Plugins.System.Acts.SetVar, + C3.Behaviors.Physics.Acts.SetEnabled, + C3.Behaviors.Physics.Acts.ApplyTorqueToAngle, + C3.Behaviors.Physics.Acts.EnableCollisions, + C3.Behaviors.Timer.Acts.StartTimer, + C3.Behaviors.Physics.Acts.SetVelocity, + C3.Plugins.Sprite.Exps.X, + C3.Plugins.Sprite.Exps.Y, + C3.Behaviors.Timer.Cnds.IsTimerRunning, + C3.Plugins.Sprite.Acts.SetX, + C3.Plugins.Sprite.Acts.SetScale, + C3.Plugins.System.Exps.min, + C3.Plugins.System.Exps.max, + C3.Plugins.Sprite.Acts.SetPos, + C3.Plugins.Sprite.Cnds.OnCollision, + C3.Plugins.Sprite.Acts.ZMoveToObject, + C3.Plugins.System.Exps.anglediff, + C3.Plugins.Sprite.Cnds.OnCreated, + C3.Behaviors.Physics.Acts.SetImmovable, + C3.Plugins.System.Acts.SetMinimumFramerate, + C3.Plugins.Arr.Acts.SetSize, + C3.Plugins.Arr.Acts.Clear, + C3.Behaviors.Physics.Exps.VelocityY, + C3.Plugins.Sprite.Acts.SetAnimSpeed, + C3.Plugins.Sprite.Exps.AnimationFrameCount, + C3.Plugins.Sprite.Acts.SetVisible, + C3.Plugins.System.Acts.SetTimescale, + C3.Plugins.Audio.Acts.Play, + C3.Plugins.System.Acts.Wait, + C3.Plugins.System.Acts.RestartLayout, + C3.Behaviors.Timer.Cnds.OnTimer, + C3.Behaviors.Pin.Acts.PinByProperties, + C3.Plugins.Sprite.Acts.SetSize, + C3.Plugins.Sprite.Exps.Width, + C3.Plugins.Sprite.Exps.Height, + C3.Behaviors.Bullet.Acts.SetSpeed, + C3.Behaviors.Bullet.Exps.Speed, + C3.Behaviors.Physics.Exps.AngularVelocity, + C3.Plugins.Browser.Cnds.OnResize, + C3.Plugins.TiledBg.Acts.SetY, + C3.Plugins.System.Exps.viewporttop, + C3.Plugins.TiledBg.Acts.SetWidth, + C3.Plugins.System.Exps.viewportright, + C3.Plugins.System.Exps.viewportleft, + C3.Plugins.TiledBg.Acts.SetHeight, + C3.Plugins.System.Exps.viewportbottom, + C3.Plugins.TiledBg.Exps.Y, + C3.Plugins.TiledBg.Acts.SetX, + C3.Plugins.System.Exps.int, + C3.Plugins.System.Cnds.While, + C3.Plugins.System.Exps.choose, + C3.Plugins.TiledBg.Acts.Destroy, + C3.Plugins.System.Acts.SetLayerBackground, + C3.Plugins.System.Exps.rgbex255, + C3.Plugins.TiledBg.Acts.SetDefaultColor, + C3.Plugins.TiledBg.Acts.SetEffectParam, + C3.Plugins.Sprite.Acts.SetAnimFrame, + C3.Plugins.Sprite.Acts.SetDefaultColor, + C3.Plugins.Sprite.Exps.ColorValue, + C3.Plugins.Touch.Cnds.IsTouchingObject, + C3.Plugins.Keyboard.Cnds.IsKeyDown, + C3.Plugins.Sprite.Acts.Destroy, + C3.Plugins.Spritefont2.Cnds.CompareInstanceVar, + C3.Plugins.Spritefont2.Acts.SetVisible, + C3.Plugins.Audio.Cnds.IsTagPlaying, + C3.Plugins.Spritefont2.Acts.SetText, + C3.Plugins.System.Cnds.PickOverlappingPoint, + C3.Behaviors.Physics.Cnds.CompareVelocity, + C3.Plugins.System.Acts.SetObjectTimescale, + C3.Plugins.System.Cnds.ForEach, + C3.Plugins.Sprite.Acts.SetWidth, + C3.Plugins.Sprite.Acts.SetHeight, + C3.Plugins.System.Acts.AddVar, + C3.Plugins.Sprite.Exps.AnimationName, + C3.Plugins.System.Acts.ResetPersisted, + C3.Plugins.System.Acts.Scroll, + C3.Plugins.System.Exps.scrollx, + C3.Plugins.System.Exps.scrolly, + C3.Plugins.System.Acts.SetLayoutScale, + C3.Plugins.System.Exps.layoutscale, + C3.Plugins.Spritefont2.Acts.SetScale, + C3.Plugins.Spritefont2.Acts.SetDefaultColor, + C3.Behaviors.Tween.Cnds.IsPlaying, + C3.Plugins.System.Acts.SetLayerOpacity, + C3.Behaviors.Tween.Exps.Value, + C3.Behaviors.Tween.Cnds.OnTweensFinished, + C3.Plugins.Audio.Acts.Stop, + C3.Behaviors.Tween.Acts.TweenValue, + C3.Plugins.System.Acts.SetLayerVisible, + C3.Plugins.Sprite.Acts.MoveToLayer, + C3.Plugins.Spritefont2.Acts.MoveToLayer, + C3.Plugins.System.Acts.CreateObject, + C3.Plugins.TiledBg.Acts.SetSize, + C3.Behaviors.Tween.Acts.TweenOneProperty, + C3.Plugins.Sprite.Cnds.PickDistance, + C3.Behaviors.Timer.Acts.StopTimer, + C3.Plugins.System.Cnds.Every, + C3.Plugins.Arr.Acts.Push, + C3.Plugins.Arr.Acts.SetXY, + C3.Plugins.Arr.Exps.Width, + C3.Plugins.DrawingCanvas.Acts.ClearCanvas, + C3.Plugins.System.Exps.rgba, + C3.Plugins.Arr.Cnds.CompareSize, + C3.Plugins.Arr.Acts.Pop, + C3.Plugins.System.Cnds.Repeat, + C3.Plugins.System.Exps.loopindex, + C3.Plugins.Arr.Exps.At, + C3.Plugins.DrawingCanvas.Acts.ResetPoly, + C3.Plugins.DrawingCanvas.Acts.AddPolyPoint, + C3.Plugins.DrawingCanvas.Acts.FillPoly, + C3.Plugins.Sprite.Cnds.IsAnimPlaying, + C3.Plugins.Sprite.Acts.MoveToTop, + C3.Plugins.System.Exps.len, + C3.Plugins.Particles.Acts.Destroy, + C3.Behaviors.Physics.Acts.SetFriction, + C3.Plugins.Sprite.Acts.SetY, + C3.Plugins.Sprite.Acts.SetAnim, + C3.Plugins.Sprite.Acts.Spawn, + C3.Plugins.Sprite.Exps.LayerName, + C3.Behaviors.Pin.Acts.PinByImagePoint, + C3.Behaviors.Physics.Acts.SetWorldGravity, + C3.Plugins.TiledBg.Exps.Width, + C3.Plugins.Audio.Acts.SetPlaybackRate, + C3.Plugins.Sprite.Acts.SetCollisions, + C3.Plugins.Sprite.Exps.AnimationFrame, + C3.Behaviors.Tween.Acts.TweenTwoProperties, + C3.Behaviors.Sin.Acts.SetEnabled, + C3.Behaviors.Sin.Cnds.IsEnabled, + C3.Plugins.System.Exps.anglelerp, + C3.Plugins.Touch.Cnds.OnTouchObject, + C3.Plugins.Browser.Acts.GoToURLWindow, + C3.Plugins.Sprite.Cnds.IsVisible, + C3.Plugins.Audio.Acts.SetSilent, + C3.Plugins.Touch.Cnds.OnTouchEnd, + C3.Plugins.Sprite.Cnds.CompareFrame, + C3.Plugins.System.Cnds.PickAll, + C3.Plugins.Audio.Acts.StopAll, + C3.Plugins.System.Acts.ResetGlobals, + C3.Plugins.System.Cnds.CompareBoolVar, + C3.Plugins.System.Acts.SetBoolVar, + C3.Behaviors.Tween.Cnds.IsAnyPlaying, + C3.Plugins.Audio.Acts.Seek, + C3.Behaviors.Fade.Acts.StartFade, + C3.Behaviors.Tween.Cnds.OnAnyTweensFinished, + C3.Plugins.Mouse.Cnds.IsOverObject, + C3.Plugins.Sprite.Cnds.OnDestroyed, + C3.Plugins.System.Cnds.EveryTick, + C3.ScriptsInEvents.Introevent_Event2_Act1, + C3.Plugins.Sprite.Acts.StopAnim, + C3.Plugins.Mouse.Acts.SetCursor, + C3.Plugins.System.Acts.GoToLayout, + C3.Plugins.System.Acts.WaitForPreviousActions, + C3.Behaviors.Tween.Acts.StopAllTweens, + C3.ScriptsInEvents.Rhm_ads_Event1_Act1, + C3.ScriptsInEvents.Rhm_ads_Event2_Act1, + C3.Plugins.Browser.Acts.ConsoleLog, + C3.Plugins.Browser.Acts.Focus + ]; +}; +self.C3_JsPropNameTable = [ + {var: 0}, + {adjust: 0}, + {Physics: 0}, + {Pin: 0}, + {landPhysics: 0}, + {which: 0}, + {first: 0}, + {angular: 0}, + {jump: 0}, + {moreJump: 0}, + {Timer: 0}, + {body: 0}, + {Keyboard: 0}, + {playerLine: 0}, + {head: 0}, + {headLine: 0}, + {Audio: 0}, + {tail: 0}, + {hold: 0}, + {handCollision: 0}, + {who: 0}, + {tin: 0}, + {heavyBall: 0}, + {groundCollision: 0}, + {ballLine: 0}, + {rightShoe: 0}, + {hair: 0}, + {rightShort: 0}, + {tshirt: 0}, + {ballShadow: 0}, + {playerShadow: 0}, + {snow: 0}, + {Anchor: 0}, + {Tween: 0}, + {pause: 0}, + {groundTile: 0}, + {groundLine: 0}, + {whiteLine: 0}, + {TPG: 0}, + {scoreBG: 0}, + {fontWonder: 0}, + {fenceTile: 0}, + {grassTile: 0}, + {Sine: 0}, + {cloudTile: 0}, + {buildingTile: 0}, + {DrawingCanvas: 0}, + {Array: 0}, + {head3: 0}, + {body3: 0}, + {Mouse: 0}, + {p3Collision: 0}, + {p1Collision: 0}, + {head2: 0}, + {body2: 0}, + {p2Collision: 0}, + {head4: 0}, + {body4: 0}, + {p4Collision: 0}, + {night: 0}, + {starTile: 0}, + {normalBall: 0}, + {kamesBall: 0}, + {snowParticle: 0}, + {Touch: 0}, + {buttonRight: 0}, + {buttonLeft: 0}, + {tutorial: 0}, + {pauseButtons: 0}, + {Browser: 0}, + {Fade: 0}, + {fadeOut: 0}, + {titleBG: 0}, + {title: 0}, + {cpu: 0}, + {hover: 0}, + {startButton: 0}, + {moreButton: 0}, + {startButton2: 0}, + {hitfx: 0}, + {basketText: 0}, + {game_bg: 0}, + {introtwporg: 0}, + {play_intro_btn: 0}, + {groundTileSnow: 0}, + {buildingTile2: 0}, + {buildingTile3: 0}, + {smallBall: 0}, + {startX: 0}, + {titleChars: 0}, + {groundTilePlaj: 0}, + {seaTile: 0}, + {mountain: 0}, + {seaWhite: 0}, + {have: 0}, + {ready: 0}, + {arm: 0}, + {potaP: 0}, + {potaP2: 0}, + {potaSprite: 0}, + {potaTiled: 0}, + {scoreCollision: 0}, + {arm2: 0}, + {arm3: 0}, + {arm4: 0}, + {handCollision2: 0}, + {handCollision3: 0}, + {handCollision4: 0}, + {potaCollision: 0}, + {potaBack: 0}, + {potaShadow: 0}, + {potaFile: 0}, + {ballCol: 0}, + {grassLineTile: 0}, + {groundTileIndoor: 0}, + {indoorBGTile: 0}, + {indoorBGTile2: 0}, + {font: 0}, + {indoorBGTile3: 0}, + {landPhysics2: 0}, + {armBiz: 0}, + {indoorTitle: 0}, + {snowTile: 0}, + {Bullet: 0}, + {Wrap: 0}, + {shark: 0}, + {Sprite: 0}, + {logowhiteloading: 0}, + {yandexTrademark: 0}, + {ADS_getItOnGoogle: 0}, + {ADS_getItOnApple: 0}, + {Game_1: 0}, + {Game_2: 0}, + {Game_3: 0}, + {Game_4: 0}, + {initializing: 0}, + {CoverImage: 0}, + {player: 0}, + {skin: 0}, + {tiles: 0}, + {line: 0}, + {balls: 0}, + {startButtons: 0}, + {groundPortrait: 0}, + {upArrow: 0}, + {speed: 0}, + {angularMaxRND: 0}, + {angularMinRND: 0}, + {wooble: 0}, + {angularSub: 0}, + {snowSlip: 0}, + {P1Control: 0}, + {P2Control: 0}, + {p1Score: 0}, + {p2Score: 0}, + {goal: 0}, + {CPU: 0}, + {biz: 0}, + {velX: 0}, + {velAng: 0}, + {ang: 0}, + {team1: 0}, + {team2: 0}, + {screenWidth: 0}, + {screenHeight: 0}, + {rnd: 0}, + {op: 0}, + {i: 0}, + {x0: 0}, + {y0: 0}, + {a0: 0}, + {x1: 0}, + {y1: 0}, + {a1: 0}, + {rndChar: 0}, + {rndBall: 0}, + {rndGoal: 0}, + {rndPlace: 0}, + {rndArm: 0}, + {startText: 0}, + {waitText: 0}, + {meter: 0}, + {menu: 0}, + {isRestartLayoutCalled: 0}, + {refURL: 0}, + {webSite: 0}, + {gameName: 0}, + {scaleStartValue: 0}, + {scaleEndValue: 0}, + {buttonHoverValue: 0}, + {TweenTime: 0}, + {OverME: 0}, + {RefreshRateForce: 0}, + {ScnRefreshRate: 0}, + {divideSmooth_Hz: 0}, + {angularOffset_Hz: 0}, + {jumpPower_Hz: 0}, + {jumpAddForce_Hz: 0}, + {angularForce_Hz: 0}, + {armAngleSpeed_Hz: 0}, + {ballSpeed_Hz: 0}, + {ballSpeedDefaultVal_Hz: 0}, + {snowFrictionValue_Hz: 0}, + {ballMaxHeight_Hz: 0}, + {isRewardedLoaded: 0} +]; + +self.InstanceType = { + landPhysics: class extends self.ISpriteInstance {}, + body: class extends self.ISpriteInstance {}, + Keyboard: class extends self.IInstance {}, + playerLine: class extends self.ISpriteInstance {}, + head: class extends self.ISpriteInstance {}, + headLine: class extends self.ISpriteInstance {}, + Audio: class extends self.IInstance {}, + heavyBall: class extends self.ISpriteInstance {}, + groundCollision: class extends self.ISpriteInstance {}, + ballLine: class extends self.ISpriteInstance {}, + rightShoe: class extends self.ISpriteInstance {}, + hair: class extends self.ISpriteInstance {}, + rightShort: class extends self.ISpriteInstance {}, + tshirt: class extends self.ISpriteInstance {}, + ballShadow: class extends self.ISpriteInstance {}, + playerShadow: class extends self.ISpriteInstance {}, + pause: class extends self.ISpriteInstance {}, + groundTile: class extends self.ITiledBackgroundInstance {}, + groundLine: class extends self.ISpriteInstance {}, + whiteLine: class extends self.ISpriteInstance {}, + TPG: class extends self.ISpriteInstance {}, + scoreBG: class extends self.ISpriteInstance {}, + fontWonder: class extends self.ISpriteFontInstance {}, + fenceTile: class extends self.ITiledBackgroundInstance {}, + grassTile: class extends self.ITiledBackgroundInstance {}, + cloudTile: class extends self.ITiledBackgroundInstance {}, + buildingTile: class extends self.ITiledBackgroundInstance {}, + DrawingCanvas: class extends self.IDrawingCanvasInstance {}, + Array: class extends self.IArrayInstance {}, + head3: class extends self.ISpriteInstance {}, + body3: class extends self.ISpriteInstance {}, + Mouse: class extends self.IInstance {}, + p3Collision: class extends self.ISpriteInstance {}, + p1Collision: class extends self.ISpriteInstance {}, + head2: class extends self.ISpriteInstance {}, + body2: class extends self.ISpriteInstance {}, + p2Collision: class extends self.ISpriteInstance {}, + head4: class extends self.ISpriteInstance {}, + body4: class extends self.ISpriteInstance {}, + p4Collision: class extends self.ISpriteInstance {}, + starTile: class extends self.ITiledBackgroundInstance {}, + normalBall: class extends self.ISpriteInstance {}, + kamesBall: class extends self.ISpriteInstance {}, + snowParticle: class extends self.IParticlesInstance {}, + Touch: class extends self.IInstance {}, + buttonRight: class extends self.ISpriteInstance {}, + buttonLeft: class extends self.ISpriteInstance {}, + tutorial: class extends self.ISpriteInstance {}, + pauseButtons: class extends self.ISpriteInstance {}, + Browser: class extends self.IInstance {}, + fadeOut: class extends self.ISpriteInstance {}, + titleBG: class extends self.ITiledBackgroundInstance {}, + title: class extends self.ISpriteInstance {}, + startButton: class extends self.ISpriteInstance {}, + moreButton: class extends self.ISpriteInstance {}, + startButton2: class extends self.ISpriteInstance {}, + hitfx: class extends self.ISpriteInstance {}, + basketText: class extends self.ISpriteInstance {}, + game_bg: class extends self.ISpriteInstance {}, + introtwporg: class extends self.ISpriteInstance {}, + play_intro_btn: class extends self.ISpriteInstance {}, + groundTileSnow: class extends self.ITiledBackgroundInstance {}, + buildingTile2: class extends self.ITiledBackgroundInstance {}, + buildingTile3: class extends self.ITiledBackgroundInstance {}, + smallBall: class extends self.ISpriteInstance {}, + titleChars: class extends self.ISpriteInstance {}, + groundTilePlaj: class extends self.ITiledBackgroundInstance {}, + seaTile: class extends self.ITiledBackgroundInstance {}, + mountain: class extends self.ISpriteInstance {}, + seaWhite: class extends self.ISpriteInstance {}, + arm: class extends self.ISpriteInstance {}, + potaP: class extends self.ISpriteInstance {}, + handCollision: class extends self.ISpriteInstance {}, + potaP2: class extends self.ISpriteInstance {}, + potaSprite: class extends self.ISpriteInstance {}, + potaTiled: class extends self.ITiledBackgroundInstance {}, + scoreCollision: class extends self.ISpriteInstance {}, + arm2: class extends self.ISpriteInstance {}, + arm3: class extends self.ISpriteInstance {}, + arm4: class extends self.ISpriteInstance {}, + handCollision2: class extends self.ISpriteInstance {}, + handCollision3: class extends self.ISpriteInstance {}, + handCollision4: class extends self.ISpriteInstance {}, + potaCollision: class extends self.ISpriteInstance {}, + potaBack: class extends self.ISpriteInstance {}, + potaShadow: class extends self.ISpriteInstance {}, + potaFile: class extends self.ISpriteInstance {}, + ballCol: class extends self.ISpriteInstance {}, + grassLineTile: class extends self.ITiledBackgroundInstance {}, + groundTileIndoor: class extends self.ITiledBackgroundInstance {}, + indoorBGTile: class extends self.ITiledBackgroundInstance {}, + indoorBGTile2: class extends self.ITiledBackgroundInstance {}, + font: class extends self.ISpriteFontInstance {}, + indoorBGTile3: class extends self.ITiledBackgroundInstance {}, + landPhysics2: class extends self.ISpriteInstance {}, + armBiz: class extends self.ISpriteInstance {}, + indoorTitle: class extends self.ISpriteInstance {}, + snowTile: class extends self.ITiledBackgroundInstance {}, + shark: class extends self.ISpriteInstance {}, + Sprite: class extends self.ISpriteInstance {}, + logowhiteloading: class extends self.ISpriteInstance {}, + yandexTrademark: class extends self.ISpriteInstance {}, + ADS_getItOnGoogle: class extends self.ISpriteInstance {}, + ADS_getItOnApple: class extends self.ISpriteInstance {}, + Game_1: class extends self.ISpriteInstance {}, + Game_2: class extends self.ISpriteInstance {}, + Game_3: class extends self.ISpriteInstance {}, + Game_4: class extends self.ISpriteInstance {}, + initializing: class extends self.ISpriteInstance {}, + CoverImage: class extends self.ISpriteInstance {}, + player: class extends self.ISpriteInstance {}, + skin: class extends self.ISpriteInstance {}, + tiles: class extends self.ITiledBackgroundInstance {}, + line: class extends self.ISpriteInstance {}, + balls: class extends self.ISpriteInstance {}, + startButtons: class extends self.ISpriteInstance {}, + groundPortrait: class extends self.ITiledBackgroundInstance {}, + cpu: class extends self.ISpriteInstance {} +} +} + +{ + +const C3 = self.C3; + +function unaryminus(n) +{ + return (typeof n === "number" ? -n : n); +} + +function bothNumbers(a, b) +{ + return typeof a === "number" && typeof b === "number"; +} + +function add(l, r) +{ + if (bothNumbers(l, r)) + return l + r; + else + return l; +} + +function subtract(l, r) +{ + if (bothNumbers(l, r)) + return l - r; + else + return l; +} + +function multiply(l, r) +{ + if (bothNumbers(l, r)) + return l * r; + else + return l; +} + +function divide(l, r) +{ + if (bothNumbers(l, r)) + return l / r; + else + return l; +} + +function mod(l, r) +{ + if (bothNumbers(l, r)) + return l % r; + else + return l; +} + +function pow(l, r) +{ + if (bothNumbers(l, r)) + return Math.pow(l, r); + else + return l; +} + +function and(l, r) +{ + if (typeof l === "string" || typeof r === "string") + { + // & with either side string does string concatenation + let lstr, rstr; + + if (typeof l === "number") + lstr = (Math.round(l * 1e10) / 1e10).toString(); + else + lstr = l; + + if (typeof r === "number") + rstr = (Math.round(r * 1e10) / 1e10).toString(); + else + rstr = r; + + return lstr + rstr; + } + else + { + // & with neither side a string does logical AND + return (l && r ? 1 : 0); + } +} + +function or(l, r) +{ + if (bothNumbers(l, r)) + return (l || r ? 1 : 0); + else + return l; +} + +self.C3_ExpressionFuncs = [ + () => "P1", + () => "head", + () => -10, + () => 10, + () => 0, + () => 1, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((n0.ExpBehavior() * 2) * f1()); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(1); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => f0(v1.GetValue(), v2.GetValue()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => (f0(v1.GetValue(), v2.GetValue()) * (-1)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => v0.GetValue(); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (v0.GetValue() * (-1)); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((n0.ExpInstVar() * f1()) * v2.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.lerp(n0.ExpInstVar(), 0, (f1() / v2.GetValue())); + }, + () => -8, + () => 8, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.lerp(n0.ExpInstVar(), 0, ((f1() / v2.GetValue()) / 2)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() * f1()) * v2.GetValue()); + }, + () => "Control P1", + () => 2, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (v0.GetValue() * f1()); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(); + }, + () => 180, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() - v1.GetValue()); + }, + () => -1, + () => 0.1, + () => "enablePota", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const v4 = p._GetNode(4).GetVar(); + return () => (((((60 - n0.ExpObject()) * (n1.ExpObject() / 160)) * f2(0.9, 1.1)) * f3()) * v4.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const v4 = p._GetNode(4).GetVar(); + return () => ((((((-n0.ExpObject()) - 50) * (n1.ExpObject() / 160)) * f2(0.9, 1.1)) * f3()) * v4.GetValue()); + }, + () => "wait", + () => 0.3, + () => 100, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((-5) * (n0.ExpObject() - n1.ExpObject(1))); + }, + () => "Skin P1", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(6); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => f0(f1(0.2, (1 - ((n2.ExpObject() - n3.ExpObject()) / 150))), 1); + }, + () => "Arm P1", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject("arm1"); + }, + () => 125, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => C3.lerp(n0.ExpObject(), n1.ExpObject(1), (f2() * 10)); + }, + () => "P2", + () => "Control P2", + () => "Skin P2", + () => "Arm P2", + () => "P3", + () => 3, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => (f0(v1.GetValue(), v2.GetValue()) * n3.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => ((f0(v1.GetValue(), v2.GetValue()) * (-1)) * n3.ExpInstVar()); + }, + () => "Control P3", + () => 4, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + return () => f0(n1.ExpObject(), 180); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() + (-v1.GetValue())); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() - (-v1.GetValue())); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + const v5 = p._GetNode(5).GetVar(); + return () => (((((225 - n0.ExpObject()) * (f1(n2.ExpObject(), 0) / 160)) * f3(0.9, 1.1)) * f4()) * v5.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + const v5 = p._GetNode(5).GetVar(); + return () => ((((((-n0.ExpObject()) - 50) * (f1(n2.ExpObject(), 0) / 160)) * f3(0.9, 1.1)) * f4()) * v5.GetValue()); + }, + () => "Skin P3", + () => "Arm P3", + () => "P4", + () => "Control P4", + () => "Skin P4", + () => "Arm P4", + () => "Ball", + () => 60, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() * 5); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.clamp(n0.ExpBehavior(), (-v1.GetValue()), v2.GetValue()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => f0(0.2, (n1.ExpInstVar_Family() - ((n2.ExpObject() - n3.ExpObject()) / 150))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const n2 = p._GetNode(2); + return () => (f0(Math.abs(n1.ExpBehavior()), 20) * (n2.ExpObject() / 8)); + }, + () => 15, + () => 275, + () => "", + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 5); + }, + () => 144, + () => 146, + () => -5, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpInstVar() * n1.ExpBehavior()); + }, + () => "Players", + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.clamp(n0.ExpBehavior(), ((-1) * v1.GetValue()), v2.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => C3.clamp(n0.ExpBehavior(), (-100), 100); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior(); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpBehavior() * 3) + n1.ExpBehavior()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => ((n0.ExpBehavior() * 3) + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() / 2); + }, + () => "General", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0("BG"); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("BG") - f1("BG")) + 100); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + return () => ((f0("BG") - n1.ExpObject()) + 100); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0("BG") - 50); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => f0(f1(8)); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 1, 2); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(149, 237, 244); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 214, 159); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(254, 240, 220); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(89, 89, 198); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(119, 120, 210); + }, + () => "back", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(82, 82, 186); + }, + () => "middle", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(72, 68, 159); + }, + () => "front", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(63, 52, 145); + }, + () => 5, + () => 6, + () => 7, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + return () => f0(f1(n2.ExpObject())); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + return () => f0(f1(138, 72, 54), f2(255, 216, 60), f3(39, 39, 39)); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + return () => f0(f1(255, 225, 188), f2(143, 98, 87), f3(246, 202, 159), f4(214, 169, 124)); + }, + () => "Control", + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (n0.ExpObject() - f1("UI")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("UI") - f1("UI")); + }, + () => "jump1", + () => "jump2", + () => "Goal", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + return () => (v0.GetValue() + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar(); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() * 1.2); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() / 1.2); + }, + () => 0.05, + p => { + const n0 = p._GetNode(0); + return () => ((((n0.ExpObject()) === ("rainBow") ? 1 : 0)) ? (2) : (1)); + }, + () => "blink1", + () => 0.2, + () => 0.01, + () => "blue", + () => "red", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => C3.lerp(f0(), n1.ExpObject(), f2()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => C3.lerp(f0(), 1.5, f1()); + }, + () => 1.2, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 200, 37); + }, + () => "blink2", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 255, 255); + }, + () => "End", + () => "OPOutOver", + () => "OP", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutOver"); + }, + () => "menu", + () => "music", + () => "sound", + () => "Op", + () => "Top", + () => 26, + () => 290, + () => 27, + () => 21, + () => 55, + () => -160, + () => 39, + () => "appear", + () => 145, + () => 110, + () => 113, + () => "CPU", + () => "jump", + () => "attack", + () => 0.5, + () => 90, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (0.5 + (f0((-2), 2) / 10)); + }, + () => 360, + () => 0.7, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 2); + }, + () => 355, + () => "Trail", + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 85); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 1); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 0, 0, 0); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 3); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0() + 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject(v1.GetValue(), 0); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject(v1.GetValue(), 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const n2 = p._GetNode(2); + const v3 = p._GetNode(3).GetVar(); + const n4 = p._GetNode(4); + const v5 = p._GetNode(5).GetVar(); + const n6 = p._GetNode(6); + const v7 = p._GetNode(7).GetVar(); + return () => (C3.toDegrees(C3.angleTo(n0.ExpObject((v1.GetValue() - 1), 0), n2.ExpObject((v3.GetValue() - 1), 1), n4.ExpObject(v5.GetValue(), 0), n6.ExpObject(v7.GetValue(), 1))) + 90); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject((v1.GetValue() + 1), 0); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject((v1.GetValue() + 1), 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const n2 = p._GetNode(2); + const v3 = p._GetNode(3).GetVar(); + const n4 = p._GetNode(4); + const v5 = p._GetNode(5).GetVar(); + const n6 = p._GetNode(6); + const v7 = p._GetNode(7).GetVar(); + return () => (C3.toDegrees(C3.angleTo(n0.ExpObject(v1.GetValue(), 0), n2.ExpObject(v3.GetValue(), 1), n4.ExpObject((v5.GetValue() + 1), 0), n6.ExpObject((v7.GetValue() + 1), 1))) + 90); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() - ((n1.ExpInstVar_Family() * Math.cos(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() - ((n1.ExpInstVar_Family() * Math.sin(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() + ((n1.ExpInstVar_Family() * Math.cos(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() + ((n1.ExpInstVar_Family() * Math.sin(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => f0(100, 100, 100, ((n1.ExpInstVar_Family() * v2.GetValue()) * v3.GetValue())); + }, + () => "rainBow", + () => "7", + () => "1", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(247, 237, 0); + }, + () => "2", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(237, 174, 1); + }, + () => "3", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(230, 0, 0); + }, + () => "4", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(133, 31, 228); + }, + () => "5", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(34, 207, 250); + }, + () => "6", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(17, 138, 217); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(126, 224, 1); + }, + () => "Bonus", + () => 95, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("Top") - f1("Top")) * 2); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0((-1), (-1), (-1), f1(f2(2, 2, 1, 0))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0((-1), f1(f2(3))); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + const f5 = p._GetNode(5).GetBoundMethod(); + return () => ((((v0.GetValue()) === (0) ? 1 : 0)) ? (f1((-1), (-1), f2(1, 2))) : (f3((-1), (-1), f4(f5(3))))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0(0, f1(f2(3))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 0, 1, 2, 3); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + (((n1.ExpInstVar() + 0)) ? ((-3)) : (3))); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SHORT ARM"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "LONG ARM"); + }, + () => 200, + () => 150, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SNOW"); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(230, 230, 230); + }, + () => -281492157629439, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 228, 228); + }, + () => 400, + () => 250, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(229, 229, 229); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(162, 226, 253); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(246, 252, 254); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(195, 148, 89); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 229, 196); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(100, 100, 100); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "BIG HEAD"); + }, + () => 1.5, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 0.001); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SMALL HEAD"); + }, + () => 0.6, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "BUSINESS"); + }, + () => "Animation 2", + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "HEAVY BALL"); + }, + () => "Game", + () => "heavy", + () => 50, + () => 61, + () => 11, + () => 74, + () => 86, + () => 12, + () => 105, + () => 14, + () => 130, + () => 24, + () => 19, + () => 166, + () => 20, + () => 210, + () => 242, + () => 17, + () => 270, + () => 285, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "LIGHT BALL"); + }, + () => "kames", + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "DOUBLE POINT"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "LONG HOOP"); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 15); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 15); + }, + () => 141, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SHORT HOOP"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "LARGE HOOP"); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 6); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + ((((n1.ExpInstVar()) === (0) ? 1 : 0)) ? (3) : ((-3)))); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 6); + }, + () => "UI", + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (0.5 + (v0.GetValue() * 0.3)); + }, + () => -15, + () => "refsoc", + () => "show", + () => -200, + () => "Effect", + () => "goal", + () => 158, + () => 30, + () => "move", + () => "move2", + () => 450, + () => "shrink", + () => "bup", + () => -6, + () => "stopSine", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0(n1.ExpObject(), 0, (f2() * 10)); + }, + () => -3, + () => "http://www.twoplayergames.org/?utm_source=Html5Game&utm_medium=BasketRandom", + () => "NewWindow", + () => 70, + () => "Menu", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() - n1.ExpObject()); + }, + () => "size", + () => -25, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(60); + }, + () => "disappear", + () => "OPOutMenu", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar_Family(); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutMenu"); + }, + () => 1.15, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + n1.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("Top") - f1("Top")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 10); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 4); + }, + () => 0.4, + () => "Functions", + () => "MoreGamesButtons", + () => "xScale", + () => 0.13, + () => "MoreGamesFunctions", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://www.twoplayergames.org/action" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://www.twoplayergames.org/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "Game_1", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://www.twoplayergames.org/game/boxing-random" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "Game_2", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://www.twoplayergames.org/game/soccer-random" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "Game_3", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://www.twoplayergames.org/game/volley-random" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "Google Play", + () => "https://play.google.com/store/apps/details?id=com.twoplayergames.basketrandom", + () => "Apple Store", + () => "https://apps.apple.com/us/app/basket-random/id6444939178", + () => 35, + () => 40, + () => 170, + () => 4800, + () => 0.001, + () => 0.65, + () => 45, + () => 165, + () => 4700, + () => 48, + () => 160, + () => 4500, + () => 58, + () => 0.8, + () => 4000, + () => 0.9, + () => 2500, + () => 80, + () => 3500, + () => 85, + () => 9, + () => 0.0001, + () => 1.1, + () => 7.5, + () => 115, + () => 175, + () => 1.25, + () => 1.45, + () => 120, + () => 75, + () => 4100, + () => 171, + () => 1.4, + () => 137, + () => 5500, + () => 238, + () => 179, + () => 6000, + () => 272, + () => "AD STARTED - BROWSER LOG ", + () => "AD FINISHED - BROWSER LOG ", + () => "AD ERROR - BROWSER LOG " +]; + + +} + diff --git a/basketrandom/scripts/dispatchworker.js b/basketrandom/scripts/dispatchworker.js new file mode 100644 index 00000000..9f523d65 --- /dev/null +++ b/basketrandom/scripts/dispatchworker.js @@ -0,0 +1,10 @@ +'use strict';self.inputPort=null;self.jobQueue=[];self.jobWorkers=[];self.sentBlobs=[];self.sentBuffers=[];self.importedScripts=[];self.lastBroadcasts=new Map; +class JobWorker{constructor(port,number){this._port=port;this._number=number;this._isReady=false;this._isBusy=false;this._port.onmessage=e=>this._OnMessage(e.data)}ImportScripts(scripts){this._port.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlob(blob,id){this._port.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBuffer(buffer,id){this._port.postMessage({"type":"_send_buffer","buffer":buffer,"id":id})}SendJob(job){if(this._isBusy||!this._isReady)throw new Error("cannot take job"); +this._isBusy=true;this._port.postMessage(job,job["transferables"])}_InitBroadcast(job){this._port.postMessage(job,job["transferables"])}SendReady(){this._port.postMessage({"type":"_ready"})}IsReady(){return this._isReady}_OnReady(){this._isReady=true;this.MaybeStartNextJob()}IsBusy(){return this._isBusy}GetNumber(){return this._number}_OnMessage(msg){const type=msg["type"];switch(type){case "ready":this._OnReady();return;case "done":this._OnJobDone();return;default:console.error("unknown message from worker '"+ +type+"'");return}}_OnJobDone(){this._isBusy=false;this.MaybeStartNextJob()}MaybeStartNextJob(){if(this._isBusy||!this._isReady)return;const i=this._FindAvailableJob();if(i===-1)return;const job=self.jobQueue[i];const isBroadcast=job["isBroadcast"];if(isBroadcast){job["doneFlags"][this._number]=true;if(job["doneFlags"].every(x=>x))self.jobQueue.splice(i,1)}else self.jobQueue.splice(i,1);this.SendJob(job)}_FindAvailableJob(){for(let i=0,len=self.jobQueue.length;i=job["maxWorkerNum"])continue;if(!job["isBroadcast"]||this._number{const msg=e.data;const type=msg["type"];if(type==="_init"){self.inputPort=msg["in-port"];self.inputPort.onmessage=OnInputPortMessage}else if(type==="_addJobWorker")AddJobWorker(msg["port"])}); +function OnInputPortMessage(e){const msg=e.data;const type=msg["type"];if(type==="_cancel"){CancelJob(msg.jobId);return}else if(type==="_import_scripts"){const scripts=msg["scripts"];for(const w of self.jobWorkers)w.ImportScripts(scripts);self.importedScripts.push(scripts);return}else if(type==="_send_blob"){const blob=msg["blob"];const id=msg["id"];for(const w of self.jobWorkers)w.SendBlob(blob,id);self.sentBlobs.push([blob,id]);return}else if(type==="_send_buffer"){const buffer=msg["buffer"];const id= +msg["id"];for(const w of self.jobWorkers)w.SendBuffer(buffer,id);self.sentBuffers.push([buffer,id]);return}else if(type==="_no_more_workers"){self.sentBlobs.length=0;self.sentBuffers.length=0;self.importedScripts.length=0;self.lastBroadcasts.clear();return}self.jobQueue.push(msg);if(msg["isBroadcast"]){const maxWorkerNum=msg["maxWorkerNum"];const curWorkerCount=self.jobWorkers.length;const useWorkerCount=typeof maxWorkerNum==="number"?Math.min(maxWorkerNum,curWorkerCount):curWorkerCount;msg["doneFlags"]= +(new Array(useWorkerCount)).fill(false);msg["transferables"]=[];self.lastBroadcasts.delete(msg["type"]);self.lastBroadcasts.set(msg["type"],msg)}for(const w of self.jobWorkers)w.MaybeStartNextJob()}; diff --git a/basketrandom/scripts/jobworker.js b/basketrandom/scripts/jobworker.js new file mode 100644 index 00000000..6f5140fb --- /dev/null +++ b/basketrandom/scripts/jobworker.js @@ -0,0 +1,9 @@ +'use strict';self.dispatchPort=null;self.outputPort=null;self.workerNumber=-1;self.activeJobId=null;self.sentBlobs=new Map;self.sentBuffers=new Map;self.JobHandlers={}; +function FlipImageData(data,width,height){const stride=width*4;const tempRow=new Uint8Array(stride);const imageBuffer=data.buffer;for(let topY=0,len=Math.floor(height/2);topY{const msg=e.data;const type=msg["type"];switch(type){case "init":self.workerNumber=msg["number"];self.dispatchPort=msg["dispatch-port"];self.dispatchPort.onmessage=OnDispatchWorkerMessage;self.outputPort=msg["output-port"];return;case "terminate":self.close();return;default:console.error("unknown message '"+type+"'");return}});function SendReady(){self.dispatchPort.postMessage({"type":"ready"});self.outputPort.postMessage({"type":"ready"})} +function SendError(isBroadcast,e){if(!isBroadcast)self.outputPort.postMessage({"type":"error","jobId":self.activeJobId,"error":e.toString()});SendDone()}function SendResult(isBroadcast,ret){if(!isBroadcast){const transferables=ret.transferables||[];self.outputPort.postMessage({"type":"result","jobId":self.activeJobId,"result":ret.result},transferables)}SendDone()}function SendDone(){self.activeJobId=null;self.dispatchPort.postMessage({"type":"done"})} +function SendProgress(val){self.outputPort.postMessage({"type":"progress","jobId":self.activeJobId,"progress":val})} +function OnDispatchWorkerMessage(e){const msg=e.data;const type=msg["type"];if(type==="_import_scripts"){importScripts(...msg["scripts"]);return}else if(type==="_send_blob"){self.sentBlobs.set(msg["id"],msg["blob"]);return}else if(type==="_send_buffer"){self.sentBuffers.set(msg["id"],msg["buffer"]);return}else if(type==="_ready"){SendReady();return}const jobId=msg["jobId"];const isBroadcast=msg["isBroadcast"];const params=msg["params"];let ret;self.activeJobId=jobId;if(!self.JobHandlers.hasOwnProperty(type)){console.error(`no handler for message type '${type}'`); +return}try{ret=self.JobHandlers[type](params)}catch(e){SendError(isBroadcast,"Exception in job handler: "+e);return}if(ret&&ret.then)ret.then(asyncRet=>SendResult(isBroadcast,asyncRet)).catch(err=>SendError(isBroadcast,"Rejection in job handler: "+err));else SendResult(isBroadcast,ret)}; diff --git a/basketrandom/scripts/main.js b/basketrandom/scripts/main.js new file mode 100644 index 00000000..005b3042 --- /dev/null +++ b/basketrandom/scripts/main.js @@ -0,0 +1,278 @@ +'use strict';{window.DOMHandler=class DOMHandler{constructor(iRuntime,componentId){this._iRuntime=iRuntime;this._componentId=componentId;this._hasTickCallback=false;this._tickCallback=()=>this.Tick()}Attach(){}PostToRuntime(handler,data,dispatchOpts,transferables){this._iRuntime.PostToRuntimeComponent(this._componentId,handler,data,dispatchOpts,transferables)}PostToRuntimeAsync(handler,data,dispatchOpts,transferables){return this._iRuntime.PostToRuntimeComponentAsync(this._componentId,handler,data, +dispatchOpts,transferables)}_PostToRuntimeMaybeSync(name,data,dispatchOpts){if(this._iRuntime.UsesWorker())this.PostToRuntime(name,data,dispatchOpts);else this._iRuntime._GetLocalRuntime()["_OnMessageFromDOM"]({"type":"event","component":this._componentId,"handler":name,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null})}AddRuntimeMessageHandler(handler,func){this._iRuntime.AddRuntimeComponentMessageHandler(this._componentId,handler,func)}AddRuntimeMessageHandlers(list){for(const [handler, +func]of list)this.AddRuntimeMessageHandler(handler,func)}GetRuntimeInterface(){return this._iRuntime}GetComponentID(){return this._componentId}_StartTicking(){if(this._hasTickCallback)return;this._iRuntime._AddRAFCallback(this._tickCallback);this._hasTickCallback=true}_StopTicking(){if(!this._hasTickCallback)return;this._iRuntime._RemoveRAFCallback(this._tickCallback);this._hasTickCallback=false}Tick(){}};window.RateLimiter=class RateLimiter{constructor(callback,interval){this._callback=callback; +this._interval=interval;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false}SetCanRunImmediate(c){this._canRunImmediate=!!c}Call(){if(this._timerId!==-1)return;const nowTime=Date.now();const timeSinceLastCall=nowTime-this._lastCallTime;const interval=this._interval;if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc, +Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;this._callback();this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._lastCallTime=Date.now()}_OnTimer(){this._timerId=-1;this._lastCallTime=Date.now();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._timerCallFunc=null}}}; + + +'use strict';{class ElementState{constructor(elem){this._elem=elem;this._hadFirstUpdate=false;this._isVisibleFlag=true}SetVisibleFlag(f){this._isVisibleFlag=!!f}GetVisibleFlag(){return this._isVisibleFlag}HadFirstUpdate(){return this._hadFirstUpdate}SetHadFirstUpdate(){this._hadFirstUpdate=true}GetElement(){return this._elem}}window.DOMElementHandler=class DOMElementHandler extends self.DOMHandler{constructor(iRuntime,componentId){super(iRuntime,componentId);this._elementMap=new Map;this._autoAttach= +true;this.AddRuntimeMessageHandlers([["create",e=>this._OnCreate(e)],["destroy",e=>this._OnDestroy(e)],["set-visible",e=>this._OnSetVisible(e)],["update-position",e=>this._OnUpdatePosition(e)],["update-state",e=>this._OnUpdateState(e)],["focus",e=>this._OnSetFocus(e)],["set-css-style",e=>this._OnSetCssStyle(e)],["set-attribute",e=>this._OnSetAttribute(e)],["remove-attribute",e=>this._OnRemoveAttribute(e)]]);this.AddDOMElementMessageHandler("get-element",elem=>elem)}SetAutoAttach(e){this._autoAttach= +!!e}AddDOMElementMessageHandler(handler,func){this.AddRuntimeMessageHandler(handler,e=>{const elementId=e["elementId"];const elem=this.GetElementById(elementId);return func(elem,e)})}_OnCreate(e){const elementId=e["elementId"];const elem=this.CreateElement(elementId,e);const elementState=new ElementState(elem);this._elementMap.set(elementId,elementState);elem.style.boxSizing="border-box";elem.style.display="none";elementState.SetVisibleFlag(e["isVisible"]);const focusElem=this._GetFocusElement(elem); +focusElem.addEventListener("focus",e=>this._OnFocus(elementId));focusElem.addEventListener("blur",e=>this._OnBlur(elementId));if(this._autoAttach)document.body.appendChild(elem)}CreateElement(elementId,e){throw new Error("required override");}DestroyElement(elem){}_OnDestroy(e){const elementId=e["elementId"];const elem=this.GetElementById(elementId);this.DestroyElement(elem);if(this._autoAttach)elem.parentElement.removeChild(elem);this._elementMap.delete(elementId)}PostToRuntimeElement(handler,elementId, +data){if(!data)data={};data["elementId"]=elementId;this.PostToRuntime(handler,data)}_PostToRuntimeElementMaybeSync(handler,elementId,data){if(!data)data={};data["elementId"]=elementId;this._PostToRuntimeMaybeSync(handler,data)}_OnSetVisible(e){if(!this._autoAttach)return;const elemState=this._elementMap.get(e["elementId"]);const elem=elemState.GetElement();if(elemState.HadFirstUpdate())elem.style.display=e["isVisible"]?"":"none";else elemState.SetVisibleFlag(e["isVisible"])}_OnUpdatePosition(e){if(!this._autoAttach)return; +const elemState=this._elementMap.get(e["elementId"]);const elem=elemState.GetElement();elem.style.left=e["left"]+"px";elem.style.top=e["top"]+"px";elem.style.width=e["width"]+"px";elem.style.height=e["height"]+"px";const fontSize=e["fontSize"];if(fontSize!==null)elem.style.fontSize=fontSize+"em";if(!elemState.HadFirstUpdate()){elemState.SetHadFirstUpdate();if(elemState.GetVisibleFlag())elem.style.display=""}}_OnUpdateState(e){const elem=this.GetElementById(e["elementId"]);this.UpdateState(elem,e)}UpdateState(elem, +e){throw new Error("required override");}_GetFocusElement(elem){return elem}_OnFocus(elementId){this.PostToRuntimeElement("elem-focused",elementId)}_OnBlur(elementId){this.PostToRuntimeElement("elem-blurred",elementId)}_OnSetFocus(e){const elem=this._GetFocusElement(this.GetElementById(e["elementId"]));if(e["focus"])elem.focus();else elem.blur()}_OnSetCssStyle(e){const elem=this.GetElementById(e["elementId"]);const prop=e["prop"];const val=e["val"];if(prop.startsWith("--"))elem.style.setProperty(prop, +val);else elem.style[prop]=val}_OnSetAttribute(e){const elem=this.GetElementById(e["elementId"]);elem.setAttribute(e["name"],e["val"])}_OnRemoveAttribute(e){const elem=this.GetElementById(e["elementId"]);elem.removeAttribute(e["name"])}GetElementById(elementId){const elementState=this._elementMap.get(elementId);if(!elementState)throw new Error(`no element with id ${elementId}`);return elementState.GetElement()}}}; + + +'use strict';{const isiOSLike=/(iphone|ipod|ipad|macos|macintosh|mac os x)/i.test(navigator.userAgent);const isAndroid=/android/i.test(navigator.userAgent);const isSafari=/safari/i.test(navigator.userAgent)&&!/(chrome|chromium|edg\/|OPR\/|nwjs)/i.test(navigator.userAgent);let resolveCounter=0;function AddScript(url){const elem=document.createElement("script");elem.async=false;elem.type="module";if(url.isStringSrc)return new Promise(resolve=>{const resolveName="c3_resolve_"+resolveCounter;++resolveCounter; +self[resolveName]=resolve;elem.textContent=url.str+`\n\nself["${resolveName}"]();`;document.head.appendChild(elem)});else return new Promise((resolve,reject)=>{elem.onload=resolve;elem.onerror=reject;elem.src=url;document.head.appendChild(elem)})}let didCheckWorkerModuleSupport=false;let isWorkerModuleSupported=false;function SupportsWorkerTypeModule(){if(!didCheckWorkerModuleSupport){try{new Worker("blob://",{get type(){isWorkerModuleSupported=true}})}catch(e){}didCheckWorkerModuleSupport=true}return isWorkerModuleSupported} +let tmpAudio=new Audio;const supportedAudioFormats={"audio/webm; codecs=opus":!!tmpAudio.canPlayType("audio/webm; codecs=opus"),"audio/ogg; codecs=opus":!!tmpAudio.canPlayType("audio/ogg; codecs=opus"),"audio/webm; codecs=vorbis":!!tmpAudio.canPlayType("audio/webm; codecs=vorbis"),"audio/ogg; codecs=vorbis":!!tmpAudio.canPlayType("audio/ogg; codecs=vorbis"),"audio/mp4":!!tmpAudio.canPlayType("audio/mp4"),"audio/mpeg":!!tmpAudio.canPlayType("audio/mpeg")};tmpAudio=null;async function BlobToString(blob){const arrayBuffer= +await BlobToArrayBuffer(blob);const textDecoder=new TextDecoder("utf-8");return textDecoder.decode(arrayBuffer)}function BlobToArrayBuffer(blob){return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsArrayBuffer(blob)})}const queuedArrayBufferReads=[];let activeArrayBufferReads=0;const MAX_ARRAYBUFFER_READS=8;window["RealFile"]=window["File"];const domHandlerClasses=[];const runtimeEventHandlers= +new Map;const pendingResponsePromises=new Map;let nextResponseId=0;const runOnStartupFunctions=[];self.runOnStartup=function runOnStartup(f){if(typeof f!=="function")throw new Error("runOnStartup called without a function");runOnStartupFunctions.push(f)};const WEBVIEW_EXPORT_TYPES=new Set(["cordova","playable-ad","instant-games"]);function IsWebViewExportType(exportType){return WEBVIEW_EXPORT_TYPES.has(exportType)}let isWrapperFullscreen=false;window.RuntimeInterface=class RuntimeInterface{constructor(opts){this._useWorker= +opts.useWorker;this._messageChannelPort=null;this._runtimeBaseUrl="";this._scriptFolder=opts.scriptFolder;this._workerScriptURLs={};this._worker=null;this._localRuntime=null;this._domHandlers=[];this._runtimeDomHandler=null;this._canvas=null;this._isExportingToVideo=false;this._exportToVideoDuration=0;this._jobScheduler=null;this._rafId=-1;this._rafFunc=()=>this._OnRAFCallback();this._rafCallbacks=[];this._wrapperInitResolve=null;this._wrapperComponentIds=[];this._exportType=opts.exportType;this._isFileProtocol= +location.protocol.substr(0,4)==="file";if(this._useWorker&&(typeof OffscreenCanvas==="undefined"||!navigator["userActivation"]||!SupportsWorkerTypeModule()))this._useWorker=false;if(this._useWorker&&isSafari)this._useWorker=false;if(this._exportType==="playable-ad"||this._exportType==="instant-games")this._useWorker=false;if(this._exportType==="cordova"&&this._useWorker)if(isAndroid){const chromeVer=/Chrome\/(\d+)/i.exec(navigator.userAgent);if(!chromeVer||!(parseInt(chromeVer[1],10)>=90))this._useWorker= +false}else this._useWorker=false;if(this.IsWebView2Wrapper())self["chrome"]["webview"].addEventListener("message",e=>this._OnWrapperMessage(e.data));else if(this._exportType==="macos-wkwebview")self["C3WrapperOnMessage"]=msg=>this._OnWrapperMessage(msg);this._localFileBlobs=null;this._localFileStrings=null;if(this._exportType==="html5"&&!window.isSecureContext)console.warn("[Construct] Warning: the browser indicates this is not a secure context. Some features may be unavailable. Use secure (HTTPS) hosting to ensure all features are available."); +this.AddRuntimeComponentMessageHandler("runtime","cordova-fetch-local-file",e=>this._OnCordovaFetchLocalFile(e));this.AddRuntimeComponentMessageHandler("runtime","create-job-worker",e=>this._OnCreateJobWorker(e));this.AddRuntimeComponentMessageHandler("runtime","send-wrapper-extension-message",e=>this._OnSendWrapperExtensionMessage(e));if(this._exportType==="cordova")document.addEventListener("deviceready",()=>this._Init(opts));else this._Init(opts)}Release(){this._CancelAnimationFrame();if(this._messageChannelPort){this._messageChannelPort.onmessage= +null;this._messageChannelPort=null}if(this._worker){this._worker.terminate();this._worker=null}if(this._localRuntime){this._localRuntime.Release();this._localRuntime=null}if(this._canvas){this._canvas.parentElement.removeChild(this._canvas);this._canvas=null}}GetCanvas(){return this._canvas}GetRuntimeBaseURL(){return this._runtimeBaseUrl}UsesWorker(){return this._useWorker}GetExportType(){return this._exportType}IsFileProtocol(){return this._isFileProtocol}GetScriptFolder(){return this._scriptFolder}IsiOSCordova(){return isiOSLike&& +this._exportType==="cordova"}IsiOSWebView(){const ua=navigator.userAgent;return isiOSLike&&IsWebViewExportType(this._exportType)||navigator["standalone"]||/crios\/|fxios\/|edgios\//i.test(ua)}IsAndroid(){return isAndroid}IsAndroidWebView(){return isAndroid&&IsWebViewExportType(this._exportType)}IsWebView2Wrapper(){return this._exportType==="windows-webview2"||!!(this._exportType==="preview"&&window["chrome"]&&window["chrome"]["webview"]&&window["chrome"]["webview"]["postMessage"])}async _Init(opts){if(this._exportType=== +"macos-wkwebview")this._SendWrapperMessage({"type":"ready"});else if(this.IsWebView2Wrapper()){this._SetupWebView2Polyfills();const result=await this._InitWrapper();this._wrapperComponentIds=result["registeredComponentIds"]}if(this._exportType==="playable-ad"){this._localFileBlobs=self["c3_base64files"];this._localFileStrings={};await this._ConvertDataUrisToBlobs();for(let i=0,len=opts.engineScripts.length;i{frameNum++;document.body.style.opacity=frameNum%2===0?"1":"0.999"})}if(opts.runtimeBaseUrl)this._runtimeBaseUrl=opts.runtimeBaseUrl;else{const origin=location.origin;this._runtimeBaseUrl= +(origin==="null"?"file:///":origin)+location.pathname;const i=this._runtimeBaseUrl.lastIndexOf("/");if(i!==-1)this._runtimeBaseUrl=this._runtimeBaseUrl.substr(0,i+1)}if(opts.workerScripts)this._workerScriptURLs=opts.workerScripts;const messageChannel=new MessageChannel;this._messageChannelPort=messageChannel.port1;this._messageChannelPort.onmessage=e=>this["_OnMessageFromRuntime"](e.data);if(window["c3_addPortMessageHandler"])window["c3_addPortMessageHandler"](e=>this._OnMessageFromDebugger(e));this._jobScheduler= +new self.JobSchedulerDOM(this);await this._jobScheduler.Init();if(typeof window["StatusBar"]==="object")window["StatusBar"]["hide"]();if(typeof window["AndroidFullScreen"]==="object")try{await new Promise((resolve,reject)=>{window["AndroidFullScreen"]["immersiveMode"](resolve,reject)})}catch(err){console.error("Failed to enter Android immersive mode: ",err)}if(this._useWorker)await this._InitWorker(opts,messageChannel.port2);else await this._InitDOM(opts,messageChannel.port2)}_GetWorkerURL(url){let ret; +if(this._workerScriptURLs.hasOwnProperty(url))ret=this._workerScriptURLs[url];else if(url.endsWith("/workermain.js")&&this._workerScriptURLs.hasOwnProperty("workermain.js"))ret=this._workerScriptURLs["workermain.js"];else if(this._exportType==="playable-ad"&&this._localFileBlobs.hasOwnProperty(url))ret=this._localFileBlobs[url];else ret=url;if(ret instanceof Blob)ret=URL.createObjectURL(ret);return ret}async CreateWorker(url,baseUrl,workerOpts){if(url.startsWith("blob:"))return new Worker(url,workerOpts); +if(this._exportType==="cordova"&&this._isFileProtocol){let filePath="";if(workerOpts.isC3MainWorker)filePath=url;else filePath=this._scriptFolder+url;const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filePath);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return new Worker(URL.createObjectURL(blob),workerOpts)}const absUrl=new URL(url,baseUrl);const isCrossOrigin=location.origin!==absUrl.origin;if(isCrossOrigin){const response=await fetch(absUrl);if(!response.ok)throw new Error("failed to fetch worker script"); +const blob=await response.blob();return new Worker(URL.createObjectURL(blob),workerOpts)}else return new Worker(absUrl,workerOpts)}_GetWindowInnerWidth(){return Math.max(window.innerWidth,1)}_GetWindowInnerHeight(){return Math.max(window.innerHeight,1)}_GetCommonRuntimeOptions(opts){return{"runtimeBaseUrl":this._runtimeBaseUrl,"previewUrl":location.href,"windowInnerWidth":this._GetWindowInnerWidth(),"windowInnerHeight":this._GetWindowInnerHeight(),"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen(), +"projectData":opts.projectData,"previewImageBlobs":window["cr_previewImageBlobs"]||this._localFileBlobs,"previewProjectFileBlobs":window["cr_previewProjectFileBlobs"],"previewProjectFileSWUrls":window["cr_previewProjectFiles"],"swClientId":window["cr_swClientId"]||"","exportType":opts.exportType,"isDebug":(new URLSearchParams(self.location.search)).has("debug"),"ife":!!self.ife,"jobScheduler":this._jobScheduler.GetPortData(),"supportedAudioFormats":supportedAudioFormats,"opusWasmScriptUrl":window["cr_opusWasmScriptUrl"]|| +this._scriptFolder+"opus.wasm.js","opusWasmBinaryUrl":window["cr_opusWasmBinaryUrl"]||this._scriptFolder+"opus.wasm.wasm","isFileProtocol":this._isFileProtocol,"isiOSCordova":this.IsiOSCordova(),"isiOSWebView":this.IsiOSWebView(),"isWebView2Wrapper":this.IsWebView2Wrapper(),"wrapperComponentIds":this._wrapperComponentIds,"isFBInstantAvailable":typeof self["FBInstant"]!=="undefined"}}async _InitWorker(opts,port2){const workerMainUrl=this._GetWorkerURL(opts.workerMainUrl);if(this._exportType==="preview"){this._worker= +new Worker("previewworker.js",{type:"module",name:"Runtime"});await new Promise((resolve,reject)=>{const messageHandler=e=>{this._worker.removeEventListener("message",messageHandler);if(e.data&&e.data["type"]==="ok")resolve();else reject()};this._worker.addEventListener("message",messageHandler);this._worker.postMessage({"type":"construct-worker-init","import":(new URL(workerMainUrl,this._runtimeBaseUrl)).toString()})})}else this._worker=await this.CreateWorker(workerMainUrl,this._runtimeBaseUrl, +{type:"module",name:"Runtime",isC3MainWorker:true});this._canvas=document.createElement("canvas");this._canvas.style.display="none";const offscreenCanvas=this._canvas["transferControlToOffscreen"]();document.body.appendChild(this._canvas);window["c3canvas"]=this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();let workerDependencyScripts=opts.workerDependencyScripts||[];let engineScripts=opts.engineScripts;workerDependencyScripts=await Promise.all(workerDependencyScripts.map(url=> +this._MaybeGetCordovaScriptURL(url)));engineScripts=await Promise.all(engineScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));if(this._exportType==="cordova")for(let i=0,len=opts.projectScripts.length;inew C(this));this._FindRuntimeDOMHandler();this._runtimeDomHandler._EnableWindowResizeEvent(); +self["c3_callFunction"]=(name,params)=>this._runtimeDomHandler._InvokeFunctionFromJS(name,params);if(this._exportType==="preview")self["goToLastErrorScript"]=()=>this.PostToRuntimeComponent("runtime","go-to-last-error-script")}async _InitDOM(opts,port2){this._canvas=document.createElement("canvas");this._canvas.style.display="none";document.body.appendChild(this._canvas);window["c3canvas"]=this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();this._domHandlers=domHandlerClasses.map(C=> +new C(this));this._FindRuntimeDOMHandler();let engineScripts=opts.engineScripts.map(url=>typeof url==="string"?(new URL(url,this._runtimeBaseUrl)).toString():url);if(Array.isArray(opts.workerDependencyScripts)){const workerDependencyScripts=[...opts.workerDependencyScripts].map(s=>s instanceof Blob?URL.createObjectURL(s):s);engineScripts.unshift(...workerDependencyScripts)}engineScripts=await Promise.all(engineScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));await Promise.all(engineScripts.map(url=> +AddScript(url)));const scriptsStatus=self["C3_ProjectScriptsStatus"];const mainProjectScript=opts.mainProjectScript;const allProjectScripts=opts.projectScripts;for(let [originalUrl,loadUrl]of allProjectScripts){if(!loadUrl)loadUrl=originalUrl;if(originalUrl===mainProjectScript)try{loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl);if(this._exportType==="preview"&&!scriptsStatus[originalUrl])this._ReportProjectMainScriptError(originalUrl,"main script did not run to completion")}catch(err){this._ReportProjectMainScriptError(originalUrl, +err)}else if(originalUrl==="scriptsInEvents.js"||originalUrl.endsWith("/scriptsInEvents.js")){loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl)}}if(this._exportType==="preview"&&typeof self.C3.ScriptsInEvents!=="object"){this._RemoveLoadingMessage();const msg="Failed to load JavaScript code used in events. Check all your JavaScript code has valid syntax.";console.error("[C3 runtime] "+msg);alert(msg);return}const runtimeOpts=Object.assign(this._GetCommonRuntimeOptions(opts), +{"isInWorker":false,"messagePort":port2,"canvas":this._canvas,"runOnStartupFunctions":runOnStartupFunctions});this._runtimeDomHandler._EnableWindowResizeEvent();this._OnBeforeCreateRuntime();this._localRuntime=self["C3_CreateRuntime"](runtimeOpts);await self["C3_InitRuntime"](this._localRuntime,runtimeOpts)}_ReportProjectMainScriptError(url,err){this._RemoveLoadingMessage();console.error(`[Preview] Failed to load project main script (${url}): `,err);alert(`Failed to load project main script (${url}). Check all your JavaScript code has valid syntax. Press F12 and check the console for error details.`)}_OnBeforeCreateRuntime(){this._RemoveLoadingMessage()}_RemoveLoadingMessage(){const loadingElem= +window["cr_previewLoadingElem"];if(loadingElem){loadingElem.parentElement.removeChild(loadingElem);window["cr_previewLoadingElem"]=null}}async _OnCreateJobWorker(e){const outputPort=await this._jobScheduler._CreateJobWorker();return{"outputPort":outputPort,"transferables":[outputPort]}}_GetLocalRuntime(){if(this._useWorker)throw new Error("not available in worker mode");return this._localRuntime}PostToRuntimeComponent(component,handler,data,dispatchOpts,transferables){this._messageChannelPort.postMessage({"type":"event", +"component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null},transferables)}PostToRuntimeComponentAsync(component,handler,data,dispatchOpts,transferables){const responseId=nextResponseId++;const ret=new Promise((resolve,reject)=>{pendingResponsePromises.set(responseId,{resolve,reject})});this._messageChannelPort.postMessage({"type":"event","component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":responseId},transferables); +return ret}["_OnMessageFromRuntime"](data){const type=data["type"];if(type==="event")return this._OnEventFromRuntime(data);else if(type==="result")this._OnResultFromRuntime(data);else if(type==="runtime-ready")this._OnRuntimeReady();else if(type==="alert-error"){this._RemoveLoadingMessage();alert(data["message"])}else if(type==="creating-runtime")this._OnBeforeCreateRuntime();else throw new Error(`unknown message '${type}'`);}_OnEventFromRuntime(e){const component=e["component"];const handler=e["handler"]; +const data=e["data"];const responseId=e["responseId"];const handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){console.warn(`[DOM] No event handlers for component '${component}'`);return}const func=handlerMap.get(handler);if(!func){console.warn(`[DOM] No handler '${handler}' for component '${component}'`);return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!==null)this._PostResultToRuntime(responseId,false, +""+err);return}if(responseId===null)return ret;else if(ret&&ret.then)ret.then(result=>this._PostResultToRuntime(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToRuntime(responseId,false,""+err)});else this._PostResultToRuntime(responseId,true,ret)}_PostResultToRuntime(responseId,isOk,result){let transferables;if(result&&result["transferables"])transferables=result["transferables"];this._messageChannelPort.postMessage({"type":"result", +"responseId":responseId,"isOk":isOk,"result":result},transferables)}_OnResultFromRuntime(data){const responseId=data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=pendingResponsePromises.get(responseId);if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);pendingResponsePromises.delete(responseId)}AddRuntimeComponentMessageHandler(component,handler,func){let handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){handlerMap=new Map; +runtimeEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[DOM] Component '${component}' already has handler '${handler}'`);handlerMap.set(handler,func)}static AddDOMHandlerClass(Class){if(domHandlerClasses.includes(Class))throw new Error("DOM handler already added");domHandlerClasses.push(Class)}_FindRuntimeDOMHandler(){for(const dh of this._domHandlers)if(dh.GetComponentID()==="runtime"){this._runtimeDomHandler=dh;return}throw new Error("cannot find runtime DOM handler"); +}_OnMessageFromDebugger(e){this.PostToRuntimeComponent("debugger","message",e)}_OnRuntimeReady(){for(const h of this._domHandlers)h.Attach()}static IsDocumentFullscreen(){return!!(document["fullscreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||isWrapperFullscreen)}static _SetWrapperIsFullscreenFlag(f){isWrapperFullscreen=!!f}async GetRemotePreviewStatusInfo(){return await this.PostToRuntimeComponentAsync("runtime","get-remote-preview-status-info")}_AddRAFCallback(f){this._rafCallbacks.push(f); +this._RequestAnimationFrame()}_RemoveRAFCallback(f){const i=this._rafCallbacks.indexOf(f);if(i===-1)throw new Error("invalid callback");this._rafCallbacks.splice(i,1);if(!this._rafCallbacks.length)this._CancelAnimationFrame()}_RequestAnimationFrame(){if(this._rafId===-1&&this._rafCallbacks.length)this._rafId=requestAnimationFrame(this._rafFunc)}_CancelAnimationFrame(){if(this._rafId!==-1){cancelAnimationFrame(this._rafId);this._rafId=-1}}_OnRAFCallback(){this._rafId=-1;for(const f of this._rafCallbacks)f(); +this._RequestAnimationFrame()}TryPlayMedia(mediaElem){this._runtimeDomHandler.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._runtimeDomHandler.RemovePendingPlay(mediaElem)}_PlayPendingMedia(){this._runtimeDomHandler._PlayPendingMedia()}SetSilent(s){this._runtimeDomHandler.SetSilent(s)}IsAudioFormatSupported(typeStr){return!!supportedAudioFormats[typeStr]}async _WasmDecodeWebMOpus(arrayBuffer){const result=await this.PostToRuntimeComponentAsync("runtime","opus-decode",{"arrayBuffer":arrayBuffer}, +null,[arrayBuffer]);return new Float32Array(result)}SetIsExportingToVideo(duration){this._isExportingToVideo=true;this._exportToVideoDuration=duration}IsExportingToVideo(){return this._isExportingToVideo}GetExportToVideoDuration(){return this._exportToVideoDuration}IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"}IsRelativeURL(url){return!this.IsAbsoluteURL(url)}async _MaybeGetCordovaScriptURL(url){if(this._exportType==="cordova"&&(url.startsWith("file:")|| +this._isFileProtocol&&this.IsRelativeURL(url))){let filename=url;if(filename.startsWith(this._runtimeBaseUrl))filename=filename.substr(this._runtimeBaseUrl.length);const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filename);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return URL.createObjectURL(blob)}else return url}async _OnCordovaFetchLocalFile(e){const filename=e["filename"];switch(e["as"]){case "text":return await this.CordovaFetchLocalFileAsText(filename); +case "buffer":return await this.CordovaFetchLocalFileAsArrayBuffer(filename);default:throw new Error("unsupported type");}}_GetPermissionAPI(){const api=window["cordova"]&&window["cordova"]["plugins"]&&window["cordova"]["plugins"]["permissions"];if(typeof api!=="object")throw new Error("Permission API is not loaded");return api}_MapPermissionID(api,permission){const permissionID=api[permission];if(typeof permissionID!=="string")throw new Error("Invalid permission name");return permissionID}_HasPermission(id){const api= +this._GetPermissionAPI();return new Promise((resolve,reject)=>api["checkPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}_RequestPermission(id){const api=this._GetPermissionAPI();return new Promise((resolve,reject)=>api["requestPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}async RequestPermissions(permissions){if(this.GetExportType()!=="cordova")return true;if(this.IsiOSCordova())return true;for(const id of permissions){const alreadyGranted= +await this._HasPermission(id);if(alreadyGranted)continue;const granted=await this._RequestPermission(id);if(granted===false)return false}return true}async RequirePermissions(...permissions){if(await this.RequestPermissions(permissions)===false)throw new Error("Permission not granted");}CordovaFetchLocalFile(filename){const path=window["cordova"]["file"]["applicationDirectory"]+"www/"+filename;return new Promise((resolve,reject)=>{window["resolveLocalFileSystemURL"](path,entry=>{entry["file"](resolve, +reject)},reject)})}async CordovaFetchLocalFileAsText(filename){const file=await this.CordovaFetchLocalFile(filename);return await BlobToString(file)}_CordovaMaybeStartNextArrayBufferRead(){if(!queuedArrayBufferReads.length)return;if(activeArrayBufferReads>=MAX_ARRAYBUFFER_READS)return;activeArrayBufferReads++;const job=queuedArrayBufferReads.shift();this._CordovaDoFetchLocalFileAsAsArrayBuffer(job.filename,job.successCallback,job.errorCallback)}CordovaFetchLocalFileAsArrayBuffer(filename){return new Promise((resolve, +reject)=>{queuedArrayBufferReads.push({filename:filename,successCallback:result=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();resolve(result)},errorCallback:err=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();reject(err)}});this._CordovaMaybeStartNextArrayBufferRead()})}async _CordovaDoFetchLocalFileAsAsArrayBuffer(filename,successCallback,errorCallback){try{const file=await this.CordovaFetchLocalFile(filename);const arrayBuffer=await BlobToArrayBuffer(file); +successCallback(arrayBuffer)}catch(err){errorCallback(err)}}_OnWrapperMessage(msg){if(msg==="entered-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._runtimeDomHandler._OnFullscreenChange()}else if(msg==="exited-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._runtimeDomHandler._OnFullscreenChange()}else if(typeof msg==="object"){const type=msg["type"];if(type==="wrapper-init-response"){this._wrapperInitResolve(msg);this._wrapperInitResolve=null}else if(type=== +"extension-message")this.PostToRuntimeComponent("runtime","wrapper-extension-message",msg);else console.warn("Unknown wrapper message: ",msg)}else console.warn("Unknown wrapper message: ",msg)}_OnSendWrapperExtensionMessage(data){this._SendWrapperMessage({"type":"extension-message","componentId":data["componentId"],"messageId":data["messageId"],"params":data["params"]||[],"asyncId":data["asyncId"]})}_SendWrapperMessage(o){if(this.IsWebView2Wrapper())window["chrome"]["webview"]["postMessage"](JSON.stringify(o)); +else if(this._exportType==="macos-wkwebview")window["webkit"]["messageHandlers"]["C3Wrapper"]["postMessage"](JSON.stringify(o));else;}_SetupWebView2Polyfills(){window.moveTo=(x,y)=>{this._SendWrapperMessage({"type":"set-window-position","windowX":Math.ceil(x),"windowY":Math.ceil(y)})};window.resizeTo=(w,h)=>{this._SendWrapperMessage({"type":"set-window-size","windowWidth":Math.ceil(w),"windowHeight":Math.ceil(h)})}}_InitWrapper(){if(!this.IsWebView2Wrapper())return Promise.resolve();return new Promise(resolve=> +{this._wrapperInitResolve=resolve;this._SendWrapperMessage({"type":"wrapper-init"})})}async _ConvertDataUrisToBlobs(){const promises=[];for(const [filename,data]of Object.entries(this._localFileBlobs))promises.push(this._ConvertDataUriToBlobs(filename,data));await Promise.all(promises)}async _ConvertDataUriToBlobs(filename,data){if(typeof data==="object"){this._localFileBlobs[filename]=new Blob([data["str"]],{"type":data["type"]});this._localFileStrings[filename]=data["str"]}else{let blob=await this._FetchDataUri(data); +if(!blob)blob=this._DataURIToBinaryBlobSync(data);this._localFileBlobs[filename]=blob}}async _FetchDataUri(dataUri){try{const response=await fetch(dataUri);return await response.blob()}catch(err){console.warn("Failed to fetch a data: URI. Falling back to a slower workaround. This is probably because the Content Security Policy unnecessarily blocked it. Allow data: URIs in your CSP to avoid this.",err);return null}}_DataURIToBinaryBlobSync(datauri){const o=this._ParseDataURI(datauri);return this._BinaryStringToBlob(o.data, +o.mime_type)}_ParseDataURI(datauri){const comma=datauri.indexOf(",");if(comma<0)throw new URIError("expected comma in data: uri");const typepart=datauri.substring(5,comma);const datapart=datauri.substring(comma+1);const typearr=typepart.split(";");const mimetype=typearr[0]||"";const encoding1=typearr[1];const encoding2=typearr[2];let decodeddata;if(encoding1==="base64"||encoding2==="base64")decodeddata=atob(datapart);else decodeddata=decodeURIComponent(datapart);return{mime_type:mimetype,data:decodeddata}}_BinaryStringToBlob(binstr, +mime_type){let len=binstr.length;let len32=len>>2;let a8=new Uint8Array(len);let a32=new Uint32Array(a8.buffer,0,len32);let i,j;for(i=0,j=0;i{const styleLink=document.createElement("link");styleLink.onload=()=>resolve(styleLink);styleLink.onerror=err=>reject(err);styleLink.rel="stylesheet";styleLink.href=cssUrl;document.head.appendChild(styleLink)})}function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})}async function BlobToImage(blob){const blobUrl= +URL.createObjectURL(blob);try{return await FetchImage(blobUrl)}finally{URL.revokeObjectURL(blobUrl)}}function BlobToString(blob){return new Promise((resolve,reject)=>{let fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsText(blob)})}async function BlobToSvgImage(blob,width,height){if(!/firefox/i.test(navigator.userAgent))return await BlobToImage(blob);let str=await BlobToString(blob);const parser=new DOMParser;const doc=parser.parseFromString(str, +"image/svg+xml");const rootElem=doc.documentElement;if(rootElem.hasAttribute("width")&&rootElem.hasAttribute("height")){const widthStr=rootElem.getAttribute("width");const heightStr=rootElem.getAttribute("height");if(!widthStr.includes("%")&&!heightStr.includes("%"))return await BlobToImage(blob)}rootElem.setAttribute("width",width+"px");rootElem.setAttribute("height",height+"px");const serializer=new XMLSerializer;str=serializer.serializeToString(doc);blob=new Blob([str],{type:"image/svg+xml"}); +return await BlobToImage(blob)}function IsInContentEditable(el){do{if(el.parentNode&&el.hasAttribute("contenteditable"))return true;el=el.parentNode}while(el);return false}const keyboardInputElementTagNames=new Set(["input","textarea","datalist","select"]);function IsKeyboardInputElement(elem){return keyboardInputElementTagNames.has(elem.tagName.toLowerCase())||IsInContentEditable(elem)}const canvasOrDocTags=new Set(["canvas","body","html"]);function PreventDefaultOnCanvasOrDoc(e){if(!e.target.tagName)return; +const tagName=e.target.tagName.toLowerCase();if(canvasOrDocTags.has(tagName))e.preventDefault()}function BlockWheelZoom(e){if(e.metaKey||e.ctrlKey)e.preventDefault()}self["C3_GetSvgImageSize"]=async function(blob){const img=await BlobToImage(blob);if(img.width>0&&img.height>0)return[img.width,img.height];else{img.style.position="absolute";img.style.left="0px";img.style.top="0px";img.style.visibility="hidden";document.body.appendChild(img);const rc=img.getBoundingClientRect();document.body.removeChild(img); +return[rc.width,rc.height]}};self["C3_RasterSvgImageBlob"]=async function(blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight){const img=await BlobToSvgImage(blob,imageWidth,imageHeight);const canvas=document.createElement("canvas");canvas.width=surfaceWidth;canvas.height=surfaceHeight;const ctx=canvas.getContext("2d");ctx.drawImage(img,0,0,imageWidth,imageHeight);return canvas};let isCordovaPaused=false;document.addEventListener("pause",()=>isCordovaPaused=true);document.addEventListener("resume", +()=>isCordovaPaused=false);function ParentHasFocus(){try{return window.parent&&window.parent.document.hasFocus()}catch(err){return false}}function KeyboardIsVisible(){const elem=document.activeElement;if(!elem)return false;const tagName=elem.tagName.toLowerCase();const inputTypes=new Set(["email","number","password","search","tel","text","url"]);if(tagName==="textarea")return true;if(tagName==="input")return inputTypes.has(elem.type.toLowerCase()||"text");return IsInContentEditable(elem)}const DOM_COMPONENT_ID= +"runtime";const HANDLER_CLASS=class RuntimeDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._isFirstSizeUpdate=true;this._enableWindowResizeEvent=false;this._simulatedResizeTimerId=-1;this._targetOrientation="any";this._attachedDeviceOrientationEvent=false;this._attachedDeviceMotionEvent=false;this._pageVisibilityIsHidden=false;this._screenReaderTextWrap=document.createElement("div");this._screenReaderTextWrap.className="c3-screen-reader-text";this._screenReaderTextWrap.setAttribute("aria-live", +"polite");document.body.appendChild(this._screenReaderTextWrap);this._debugHighlightElem=null;this._isExportToVideo=false;this._exportVideoProgressMessage="";this._exportVideoUpdateTimerId=-1;this._enableAndroidVKDetection=false;this._lastWindowWidth=iRuntime._GetWindowInnerWidth();this._lastWindowHeight=iRuntime._GetWindowInnerHeight();this._virtualKeyboardHeight=0;this._vkTranslateYOffset=0;iRuntime.AddRuntimeComponentMessageHandler("canvas","update-size",e=>this._OnUpdateCanvasSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"invoke-download",e=>this._OnInvokeDownload(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","load-webfonts",e=>this._OnLoadWebFonts(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","raster-svg-image",e=>this._OnRasterSvgImage(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","get-svg-image-size",e=>this._OnGetSvgImageSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","set-target-orientation",e=>this._OnSetTargetOrientation(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"register-sw",()=>this._OnRegisterSW());iRuntime.AddRuntimeComponentMessageHandler("runtime","post-to-debugger",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","go-to-script",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","before-start-ticking",()=>this._OnBeforeStartTicking());iRuntime.AddRuntimeComponentMessageHandler("runtime","debug-highlight",e=>this._OnDebugHighlight(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"enable-device-orientation",()=>this._AttachDeviceOrientationEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","enable-device-motion",()=>this._AttachDeviceMotionEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","add-stylesheet",e=>this._OnAddStylesheet(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","script-create-worker",e=>this._OnScriptCreateWorker(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","alert",e=>this._OnAlert(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"screen-reader-text",e=>this._OnScreenReaderTextEvent(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","hide-cordova-splash",()=>this._OnHideCordovaSplash());iRuntime.AddRuntimeComponentMessageHandler("runtime","set-exporting-to-video",e=>this._SetExportingToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","export-to-video-progress",e=>this._OnExportVideoProgress(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","exported-to-video",e=>this._OnExportedToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"exported-to-image-sequence",e=>this._OnExportedToImageSequence(e));const allowDefaultContextMenuTagNames=new Set(["input","textarea","datalist"]);window.addEventListener("contextmenu",e=>{const t=e.target;const name=t.tagName.toLowerCase();if(!allowDefaultContextMenuTagNames.has(name)&&!IsInContentEditable(t))e.preventDefault()});const canvas=iRuntime.GetCanvas();window.addEventListener("selectstart",PreventDefaultOnCanvasOrDoc);window.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc); +canvas.addEventListener("selectstart",PreventDefaultOnCanvasOrDoc);canvas.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc);window.addEventListener("touchstart",PreventDefaultOnCanvasOrDoc,{"passive":false});if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc,{"passive":false});canvas.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc)}else canvas.addEventListener("touchstart",PreventDefaultOnCanvasOrDoc);this._mousePointerLastButtons= +0;window.addEventListener("mousedown",e=>{if(e.button===1)e.preventDefault()});window.addEventListener("mousewheel",BlockWheelZoom,{"passive":false});window.addEventListener("wheel",BlockWheelZoom,{"passive":false});window.addEventListener("resize",()=>this._OnWindowResize());window.addEventListener("fullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("webkitfullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("mozfullscreenchange",()=>this._OnFullscreenChange()); +window.addEventListener("fullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("webkitfullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("mozfullscreenerror",e=>this._OnFullscreenError(e));if(iRuntime.IsiOSWebView())if(window["visualViewport"]){let lastVisualViewportHeight=Infinity;window["visualViewport"].addEventListener("resize",()=>{const curVisualViewportHeight=window["visualViewport"].height;if(curVisualViewportHeight>lastVisualViewportHeight)document.scrollingElement.scrollTop= +0;lastVisualViewportHeight=curVisualViewportHeight})}else window.addEventListener("focusout",()=>{if(!KeyboardIsVisible())document.scrollingElement.scrollTop=0});this._mediaPendingPlay=new Set;this._mediaRemovedPendingPlay=new WeakSet;this._isSilent=false}_OnBeforeStartTicking(){self.setTimeout(()=>{this._enableAndroidVKDetection=true},1E3);if(this._iRuntime.GetExportType()==="cordova"){document.addEventListener("pause",()=>this._OnVisibilityChange(true));document.addEventListener("resume",()=>this._OnVisibilityChange(false))}else document.addEventListener("visibilitychange", +()=>this._OnVisibilityChange(document.visibilityState==="hidden"));this._pageVisibilityIsHidden=!!(document.visibilityState==="hidden"||isCordovaPaused);return{"isSuspended":this._pageVisibilityIsHidden}}Attach(){window.addEventListener("focus",()=>this._PostRuntimeEvent("window-focus"));window.addEventListener("blur",()=>{this._PostRuntimeEvent("window-blur",{"parentHasFocus":ParentHasFocus()});this._mousePointerLastButtons=0});window.addEventListener("focusin",e=>{if(IsKeyboardInputElement(e.target))this._PostRuntimeEvent("keyboard-blur")}); +window.addEventListener("keydown",e=>this._OnKeyEvent("keydown",e));window.addEventListener("keyup",e=>this._OnKeyEvent("keyup",e));window.addEventListener("dblclick",e=>this._OnMouseEvent("dblclick",e,DISPATCH_RUNTIME_AND_SCRIPT));window.addEventListener("wheel",e=>this._OnMouseWheelEvent("wheel",e));if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",e=>{this._HandlePointerDownFocus(e);this._OnPointerEvent("pointerdown",e)});if(this._iRuntime.UsesWorker()&&typeof window["onpointerrawupdate"]!== +"undefined"&&self===self.top)window.addEventListener("pointerrawupdate",e=>this._OnPointerRawUpdate(e));else window.addEventListener("pointermove",e=>this._OnPointerEvent("pointermove",e));window.addEventListener("pointerup",e=>this._OnPointerEvent("pointerup",e));window.addEventListener("pointercancel",e=>this._OnPointerEvent("pointercancel",e))}else{window.addEventListener("mousedown",e=>{this._HandlePointerDownFocus(e);this._OnMouseEventAsPointer("pointerdown",e)});window.addEventListener("mousemove", +e=>this._OnMouseEventAsPointer("pointermove",e));window.addEventListener("mouseup",e=>this._OnMouseEventAsPointer("pointerup",e));window.addEventListener("touchstart",e=>{this._HandlePointerDownFocus(e);this._OnTouchEvent("pointerdown",e)});window.addEventListener("touchmove",e=>this._OnTouchEvent("pointermove",e));window.addEventListener("touchend",e=>this._OnTouchEvent("pointerup",e));window.addEventListener("touchcancel",e=>this._OnTouchEvent("pointercancel",e))}const playFunc=()=>this._PlayPendingMedia(); +window.addEventListener("pointerup",playFunc,true);window.addEventListener("touchend",playFunc,true);window.addEventListener("click",playFunc,true);window.addEventListener("keydown",playFunc,true);window.addEventListener("gamepadconnected",playFunc,true);if(this._iRuntime.IsAndroid()&&!this._iRuntime.IsAndroidWebView()&&navigator["virtualKeyboard"]){navigator["virtualKeyboard"]["overlaysContent"]=true;navigator["virtualKeyboard"].addEventListener("geometrychange",()=>{this._OnAndroidVirtualKeyboardChange(this._GetWindowInnerHeight(), +navigator["virtualKeyboard"]["boundingRect"]["height"])})}}_OnAndroidVirtualKeyboardChange(windowHeight,vkHeight){document.body.style.transform="";this._vkTranslateYOffset=0;if(vkHeight>0){const activeElement=document.activeElement;if(activeElement){const rc=activeElement.getBoundingClientRect();const rcMidY=(rc.top+rc.bottom)/2;const targetY=(windowHeight-vkHeight)/2;let shiftY=rcMidY-targetY;if(shiftY>vkHeight)shiftY=vkHeight;if(shiftY<0)shiftY=0;if(shiftY>0){document.body.style.transform=`translateY(${-shiftY}px)`; +this._vkTranslateYOffset=shiftY}}}}_PostRuntimeEvent(name,data){this.PostToRuntime(name,data||null,DISPATCH_RUNTIME_ONLY)}_GetWindowInnerWidth(){return this._iRuntime._GetWindowInnerWidth()}_GetWindowInnerHeight(){return this._iRuntime._GetWindowInnerHeight()}_EnableWindowResizeEvent(){this._enableWindowResizeEvent=true;this._lastWindowWidth=this._iRuntime._GetWindowInnerWidth();this._lastWindowHeight=this._iRuntime._GetWindowInnerHeight()}_OnWindowResize(){if(this._isExportToVideo)return;if(!this._enableWindowResizeEvent)return; +const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();if(this._iRuntime.IsAndroidWebView())if(this._enableAndroidVKDetection)if(this._lastWindowWidth===width&&height0){this._virtualKeyboardHeight=0;this._OnAndroidVirtualKeyboardChange(height,this._virtualKeyboardHeight)}this._lastWindowWidth= +width;this._lastWindowHeight=height}else{this._lastWindowWidth=width;this._lastWindowHeight=height}this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()});if(this._iRuntime.IsiOSWebView()){if(this._simulatedResizeTimerId!==-1)clearTimeout(this._simulatedResizeTimerId);this._OnSimulatedResize(width,height,0)}}_ScheduleSimulatedResize(width,height,count){if(this._simulatedResizeTimerId!== +-1)clearTimeout(this._simulatedResizeTimerId);this._simulatedResizeTimerId=setTimeout(()=>this._OnSimulatedResize(width,height,count),48)}_OnSimulatedResize(originalWidth,originalHeight,count){const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();this._simulatedResizeTimerId=-1;if(width!=originalWidth||height!=originalHeight)this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()}); +else if(count<10)this._ScheduleSimulatedResize(width,height,count+1)}_OnSetTargetOrientation(e){this._targetOrientation=e["targetOrientation"]}_TrySetTargetOrientation(){const orientation=this._targetOrientation;if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=>console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result= +screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result=screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ",err)}}_OnFullscreenChange(){if(this._isExportToVideo)return;const isDocFullscreen=RuntimeInterface.IsDocumentFullscreen();if(isDocFullscreen&&this._targetOrientation!== +"any")this._TrySetTargetOrientation();this.PostToRuntime("fullscreenchange",{"isFullscreen":isDocFullscreen,"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnFullscreenError(e){console.warn("[Construct] Fullscreen request failed: ",e);this.PostToRuntime("fullscreenerror",{"isFullscreen":RuntimeInterface.IsDocumentFullscreen(),"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnVisibilityChange(isHidden){if(this._pageVisibilityIsHidden=== +isHidden)return;this._pageVisibilityIsHidden=isHidden;if(isHidden)this._iRuntime._CancelAnimationFrame();else this._iRuntime._RequestAnimationFrame();this.PostToRuntime("visibilitychange",{"hidden":isHidden})}_OnKeyEvent(name,e){if(e.key==="Backspace")PreventDefaultOnCanvasOrDoc(e);if(this._isExportToVideo)return;const code=KEY_CODE_ALIASES.get(e.code)||e.code;this._PostToRuntimeMaybeSync(name,{"code":code,"key":e.key,"which":e.which,"repeat":e.repeat,"altKey":e.altKey,"ctrlKey":e.ctrlKey,"metaKey":e.metaKey, +"shiftKey":e.shiftKey,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseWheelEvent(name,e){if(this._isExportToVideo)return;this.PostToRuntime(name,{"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"deltaX":e.deltaX,"deltaY":e.deltaY,"deltaZ":e.deltaZ,"deltaMode":e.deltaMode,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseEvent(name,e,opts){if(this._isExportToVideo)return;if(IsCompatibilityMouseEvent(e))return; +this._PostToRuntimeMaybeSync(name,{"button":e.button,"buttons":e.buttons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"timeStamp":e.timeStamp},opts)}_OnMouseEventAsPointer(name,e){if(this._isExportToVideo)return;if(IsCompatibilityMouseEvent(e))return;const pointerId=1;const lastButtons=this._mousePointerLastButtons;if(name==="pointerdown"&&lastButtons!==0)name="pointermove"; +else if(name==="pointerup"&&e.buttons!==0)name="pointermove";this._PostToRuntimeMaybeSync(name,{"pointerId":pointerId,"pointerType":"mouse","button":e.button,"buttons":e.buttons,"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"width":0,"height":0,"pressure":0,"tangentialPressure":0,"tiltX":0,"tiltY":0,"twist":0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT); +this._mousePointerLastButtons=e.buttons;this._OnMouseEvent(e.type,e,DISPATCH_SCRIPT_ONLY)}_OnPointerEvent(name,e){if(this._isExportToVideo)return;let lastButtons=0;if(e.pointerType==="mouse")lastButtons=this._mousePointerLastButtons;this._PostToRuntimeMaybeSync(name,{"pointerId":e.pointerId,"pointerType":e.pointerType,"button":e.button,"buttons":e.buttons,"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset, +"movementX":e.movementX||0,"movementY":e.movementY||0,"width":e.width||0,"height":e.height||0,"pressure":e.pressure||0,"tangentialPressure":e["tangentialPressure"]||0,"tiltX":e.tiltX||0,"tiltY":e.tiltY||0,"twist":e["twist"]||0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT);if(e.pointerType==="mouse"){let mouseEventName="mousemove";if(name==="pointerdown")mouseEventName="mousedown";else if(name==="pointerup")mouseEventName="mouseup";this._OnMouseEvent(mouseEventName,e,DISPATCH_SCRIPT_ONLY); +this._mousePointerLastButtons=e.buttons}}_OnPointerRawUpdate(e){this._OnPointerEvent("pointermove",e)}_OnTouchEvent(fireName,e){if(this._isExportToVideo)return;for(let i=0,len=e.changedTouches.length;ithis._OnDeviceOrientation(e));window.addEventListener("deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e))}_AttachDeviceMotionEvent(){if(this._attachedDeviceMotionEvent)return;this._attachedDeviceMotionEvent=true;window.addEventListener("devicemotion", +e=>this._OnDeviceMotion(e))}_OnDeviceOrientation(e){if(this._isExportToVideo)return;this.PostToRuntime("deviceorientation",{"absolute":!!e["absolute"],"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp,"webkitCompassHeading":e["webkitCompassHeading"],"webkitCompassAccuracy":e["webkitCompassAccuracy"]},DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceOrientationAbsolute(e){if(this._isExportToVideo)return;this.PostToRuntime("deviceorientationabsolute",{"absolute":!!e["absolute"], +"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceMotion(e){if(this._isExportToVideo)return;let accProp=null;const acc=e["acceleration"];if(acc)accProp={"x":acc["x"]||0,"y":acc["y"]||0,"z":acc["z"]||0};let withGProp=null;const withG=e["accelerationIncludingGravity"];if(withG)withGProp={"x":withG["x"]||0,"y":withG["y"]||0,"z":withG["z"]||0};let rotationRateProp=null;const rotationRate=e["rotationRate"];if(rotationRate)rotationRateProp= +{"alpha":rotationRate["alpha"]||0,"beta":rotationRate["beta"]||0,"gamma":rotationRate["gamma"]||0};this.PostToRuntime("devicemotion",{"acceleration":accProp,"accelerationIncludingGravity":withGProp,"rotationRate":rotationRateProp,"interval":e["interval"],"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnUpdateCanvasSize(e){const runtimeInterface=this.GetRuntimeInterface();if(runtimeInterface.IsExportingToVideo())return;const canvas=runtimeInterface.GetCanvas();canvas.style.width=e["styleWidth"]+ +"px";canvas.style.height=e["styleHeight"]+"px";canvas.style.marginLeft=e["marginLeft"]+"px";canvas.style.marginTop=e["marginTop"]+"px";document.documentElement.style.setProperty("--construct-scale",e["displayScale"]);if(this._isFirstSizeUpdate){canvas.style.display="";this._isFirstSizeUpdate=false}}_OnInvokeDownload(e){const url=e["url"];const filename=e["filename"];const a=document.createElement("a");const body=document.body;a.textContent=filename;a.href=url;a.download=filename;body.appendChild(a); +a.click();body.removeChild(a)}async _OnLoadWebFonts(e){const webfonts=e["webfonts"];await Promise.all(webfonts.map(async info=>{const fontFace=new FontFace(info.name,`url('${info.url}')`);document.fonts.add(fontFace);await fontFace.load()}))}async _OnRasterSvgImage(e){const blob=e["blob"];const imageWidth=e["imageWidth"];const imageHeight=e["imageHeight"];const surfaceWidth=e["surfaceWidth"];const surfaceHeight=e["surfaceHeight"];const imageBitmapOpts=e["imageBitmapOpts"];const canvas=await self["C3_RasterSvgImageBlob"](blob, +imageWidth,imageHeight,surfaceWidth,surfaceHeight);let ret;if(imageBitmapOpts)ret=await createImageBitmap(canvas,imageBitmapOpts);else ret=await createImageBitmap(canvas);return{"imageBitmap":ret,"transferables":[ret]}}async _OnGetSvgImageSize(e){return await self["C3_GetSvgImageSize"](e["blob"])}async _OnAddStylesheet(e){await AddStyleSheet(e["url"])}_PlayPendingMedia(){const mediaToTryPlay=[...this._mediaPendingPlay];this._mediaPendingPlay.clear();if(!this._isSilent)for(const mediaElem of mediaToTryPlay){const playRet= +mediaElem.play();if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}}TryPlayMedia(mediaElem){if(typeof mediaElem.play!=="function")throw new Error("missing play function");this._mediaRemovedPendingPlay.delete(mediaElem);let playRet;try{playRet=mediaElem.play()}catch(err){this._mediaPendingPlay.add(mediaElem);return}if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}RemovePendingPlay(mediaElem){this._mediaPendingPlay.delete(mediaElem); +this._mediaRemovedPendingPlay.add(mediaElem)}SetSilent(s){this._isSilent=!!s}_OnHideCordovaSplash(){if(navigator["splashscreen"]&&navigator["splashscreen"]["hide"])navigator["splashscreen"]["hide"]()}_OnDebugHighlight(e){const show=e["show"];if(!show){if(this._debugHighlightElem)this._debugHighlightElem.style.display="none";return}if(!this._debugHighlightElem){this._debugHighlightElem=document.createElement("div");this._debugHighlightElem.id="inspectOutline";document.body.appendChild(this._debugHighlightElem)}const elem= +this._debugHighlightElem;elem.style.display="";elem.style.left=e["left"]-1+"px";elem.style.top=e["top"]-1+"px";elem.style.width=e["width"]+2+"px";elem.style.height=e["height"]+2+"px";elem.textContent=e["name"]}_OnRegisterSW(){if(window["C3_RegisterSW"])window["C3_RegisterSW"]()}_OnPostToDebugger(data){if(!window["c3_postToMessagePort"])return;data["from"]="runtime";window["c3_postToMessagePort"](data)}_InvokeFunctionFromJS(name,params){return this.PostToRuntimeAsync("js-invoke-function",{"name":name, +"params":params})}_OnScriptCreateWorker(e){const url=e["url"];const opts=e["opts"];const port2=e["port2"];const worker=new Worker(url,opts);worker.postMessage({"type":"construct-worker-init","port2":port2},[port2])}_OnAlert(e){alert(e["message"])}_OnScreenReaderTextEvent(e){const type=e["type"];if(type==="create"){const p=document.createElement("p");p.id="c3-sr-"+e["id"];p.textContent=e["text"];this._screenReaderTextWrap.appendChild(p)}else if(type==="update"){const p=document.getElementById("c3-sr-"+ +e["id"]);if(p)p.textContent=e["text"];else console.warn(`[Construct] Missing screen reader text with id ${e["id"]}`)}else if(type==="release"){const p=document.getElementById("c3-sr-"+e["id"]);if(p)p.remove();else console.warn(`[Construct] Missing screen reader text with id ${e["id"]}`)}else console.warn(`[Construct] Unknown screen reader text update '${type}'`)}_SetExportingToVideo(e){this._isExportToVideo=true;const headerElem=document.createElement("h1");headerElem.id="exportToVideoMessage";headerElem.textContent= +e["message"];document.body.prepend(headerElem);document.body.classList.add("exportingToVideo");this.GetRuntimeInterface().GetCanvas().style.display="";this._iRuntime.SetIsExportingToVideo(e["duration"])}_OnExportVideoProgress(e){this._exportVideoProgressMessage=e["message"];if(this._exportVideoUpdateTimerId===-1)this._exportVideoUpdateTimerId=setTimeout(()=>this._DoUpdateExportVideoProgressMessage(),250)}_DoUpdateExportVideoProgressMessage(){this._exportVideoUpdateTimerId=-1;const headerElem=document.getElementById("exportToVideoMessage"); +if(headerElem)headerElem.textContent=this._exportVideoProgressMessage}_OnExportedToVideo(e){window.c3_postToMessagePort({"type":"exported-video","arrayBuffer":e["arrayBuffer"],"contentType":e["contentType"],"time":e["time"]})}_OnExportedToImageSequence(e){window.c3_postToMessagePort({"type":"exported-image-sequence","blobArr":e["blobArr"],"time":e["time"],"gif":e["gif"]})}};RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; + + +'use strict';{const DISPATCH_WORKER_SCRIPT_NAME="dispatchworker.js";const JOB_WORKER_SCRIPT_NAME="jobworker.js";self.JobSchedulerDOM=class JobSchedulerDOM{constructor(runtimeInterface){this._runtimeInterface=runtimeInterface;this._baseUrl=runtimeInterface.GetRuntimeBaseURL();if(runtimeInterface.GetExportType()==="preview")this._baseUrl+="workers/";else this._baseUrl+=runtimeInterface.GetScriptFolder();this._maxNumWorkers=Math.min(navigator.hardwareConcurrency||2,16);this._dispatchWorker=null;this._jobWorkers= +[];this._inputPort=null;this._outputPort=null}_GetWorkerScriptFolder(){if(this._runtimeInterface.GetExportType()==="playable-ad")return this._runtimeInterface.GetScriptFolder();else return""}async Init(){if(this._hasInitialised)throw new Error("already initialised");this._hasInitialised=true;const dispatchWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+DISPATCH_WORKER_SCRIPT_NAME);this._dispatchWorker=await this._runtimeInterface.CreateWorker(dispatchWorkerScriptUrl, +this._baseUrl,{name:"DispatchWorker"});const messageChannel=new MessageChannel;this._inputPort=messageChannel.port1;this._dispatchWorker.postMessage({"type":"_init","in-port":messageChannel.port2},[messageChannel.port2]);this._outputPort=await this._CreateJobWorker()}async _CreateJobWorker(){const number=this._jobWorkers.length;const jobWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+JOB_WORKER_SCRIPT_NAME);const jobWorker=await this._runtimeInterface.CreateWorker(jobWorkerScriptUrl, +this._baseUrl,{name:"JobWorker"+number});const dispatchChannel=new MessageChannel;const outputChannel=new MessageChannel;this._dispatchWorker.postMessage({"type":"_addJobWorker","port":dispatchChannel.port1},[dispatchChannel.port1]);jobWorker.postMessage({"type":"init","number":number,"dispatch-port":dispatchChannel.port2,"output-port":outputChannel.port2},[dispatchChannel.port2,outputChannel.port2]);this._jobWorkers.push(jobWorker);return outputChannel.port1}GetPortData(){return{"inputPort":this._inputPort, +"outputPort":this._outputPort,"maxNumWorkers":this._maxNumWorkers}}GetPortTransferables(){return[this._inputPort,this._outputPort]}}}; + + +'use strict';{if(window["C3_IsSupported"]){const enableWorker=false;window["c3_runtimeInterface"]=new self.RuntimeInterface({useWorker:enableWorker,workerMainUrl:"workermain.js",engineScripts:["scripts/c3runtime.js"],projectScripts:[["scripts/project/FrameRateLimit.js"], ["scripts/project/scriptsInEvents.js"]],mainProjectScript:"scripts/project/FrameRateLimit.js",scriptFolder:"scripts/",workerDependencyScripts:[],exportType:"html5"})}}; +'use strict';{const R_TO_D=180/Math.PI;const DOM_COMPONENT_ID="audio";self.AudioDOMHandler=class AudioDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._audioContext=null;this._destinationNode=null;this._hasUnblocked=false;this._hasAttachedUnblockEvents=false;this._unblockFunc=()=>this._UnblockAudioContext();this._audioBuffers=[];this._audioInstances=[];this._lastAudioInstance=null;this._lastPlayedTags=[];this._loadedAudioUrls=new Set;this._lastTickCount= +-1;this._pendingTags=new Map;this._masterVolume=1;this._isSilent=false;this._timeScaleMode=0;this._timeScale=1;this._gameTime=0;this._panningModel="HRTF";this._distanceModel="inverse";this._refDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._lastListenerPos=[0,0,0];this._lastListenerOrientation=[0,0,-1,0,1,0];this._playMusicAsSound=false;this._hasAnySoftwareDecodedMusic=false;this._supportsWebMOpus=this._iRuntime.IsAudioFormatSupported("audio/webm; codecs=opus");this._effects=new Map; +this._analysers=new Set;this._isPendingPostFxState=false;this._hasStartedOfflineRender=false;this._microphoneTag="";this._microphoneSource=null;self["C3Audio_OnMicrophoneStream"]=(localMediaStream,tag)=>this._OnMicrophoneStream(localMediaStream,tag);this._destMediaStreamNode=null;self["C3Audio_GetOutputStream"]=()=>this._OnGetOutputStream();self["C3Audio_DOMInterface"]=this;this.AddRuntimeMessageHandlers([["create-audio-context",e=>this._CreateAudioContext(e)],["play",e=>this._Play(e)],["stop",e=> +this._Stop(e)],["stop-all",()=>this._StopAll()],["set-paused",e=>this._SetPaused(e)],["set-volume",e=>this._SetVolume(e)],["fade-volume",e=>this._FadeVolume(e)],["set-master-volume",e=>this._SetMasterVolume(e)],["set-muted",e=>this._SetMuted(e)],["set-silent",e=>this._SetSilent(e)],["set-looping",e=>this._SetLooping(e)],["set-playback-rate",e=>this._SetPlaybackRate(e)],["set-stereo-pan",e=>this._SetStereoPan(e)],["seek",e=>this._Seek(e)],["preload",e=>this._Preload(e)],["unload",e=>this._Unload(e)], +["unload-all",()=>this._UnloadAll()],["set-suspended",e=>this._SetSuspended(e)],["add-effect",e=>this._AddEffect(e)],["set-effect-param",e=>this._SetEffectParam(e)],["remove-effects",e=>this._RemoveEffects(e)],["tick",e=>this._OnTick(e)],["load-state",e=>this._OnLoadState(e)],["offline-render-audio",e=>this._OnOfflineRenderAudio(e)],["offline-render-finish",()=>this._OnOfflineRenderFinish()]])}async _CreateAudioContext(e){if(e["isiOSCordova"]||e["isSafari"])this._playMusicAsSound=true;this._timeScaleMode= +e["timeScaleMode"];this._panningModel=["equalpower","HRTF","soundfield"][e["panningModel"]];this._distanceModel=["linear","inverse","exponential"][e["distanceModel"]];this._refDistance=e["refDistance"];this._maxDistance=e["maxDistance"];this._rolloffFactor=e["rolloffFactor"];if(this._iRuntime.IsExportingToVideo()){this._playMusicAsSound=true;const sampleRate=48E3;this._audioContext=new OfflineAudioContext({"numberOfChannels":2,"sampleRate":sampleRate,"length":Math.ceil(this._iRuntime.GetExportToVideoDuration()* +sampleRate)})}else{const opts={"latencyHint":e["latencyHint"]};if(!this.SupportsWebMOpus())opts["sampleRate"]=48E3;if(typeof AudioContext!=="undefined")this._audioContext=new AudioContext(opts);else if(typeof webkitAudioContext!=="undefined")this._audioContext=new webkitAudioContext(opts);else throw new Error("Web Audio API not supported");this._AttachUnblockEvents();this._audioContext.onstatechange=()=>{if(this._audioContext.state!=="running")this._AttachUnblockEvents();this.PostToRuntime("audiocontext-state", +{"audioContextState":this._audioContext.state})}}this._destinationNode=this._audioContext["createGain"]();this._destinationNode["connect"](this._audioContext["destination"]);const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]);this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation); +self["C3_GetAudioContextCurrentTime"]=()=>this.GetAudioCurrentTime();try{await Promise.all(e["preloadList"].map(o=>this._GetAudioBuffer(o["originalUrl"],o["url"],o["type"],false)))}catch(err){console.error("[Construct] Preloading sounds failed: ",err)}return{"sampleRate":this._audioContext["sampleRate"],"audioContextState":this._audioContext.state,"outputLatency":this._audioContext["outputLatency"]||0}}_AttachUnblockEvents(){if(this._hasAttachedUnblockEvents)return;this._hasUnblocked=false;window.addEventListener("pointerup", +this._unblockFunc,true);window.addEventListener("touchend",this._unblockFunc,true);window.addEventListener("click",this._unblockFunc,true);window.addEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=true}_DetachUnblockEvents(){if(!this._hasAttachedUnblockEvents)return;this._hasUnblocked=true;window.removeEventListener("pointerup",this._unblockFunc,true);window.removeEventListener("touchend",this._unblockFunc,true);window.removeEventListener("click",this._unblockFunc,true); +window.removeEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=false}_UnblockAudioContext(){if(this._hasUnblocked)return;const audioContext=this._audioContext;if(audioContext["state"]==="suspended"&&audioContext["resume"])audioContext["resume"]();const buffer=audioContext["createBuffer"](1,220,22050);const source=audioContext["createBufferSource"]();source["buffer"]=buffer;source["connect"](audioContext["destination"]);source["start"](0);if(audioContext["state"]==="running")this._DetachUnblockEvents()}_MatchTagLists(tagArr1, +tagArr2){for(const t2 of tagArr2){let found=false;for(const t1 of tagArr1)if(self.AudioDOMHandler.EqualsNoCase(t1,t2)){found=true;break}if(!found)return false}return true}GetAudioContext(){return this._audioContext}GetAudioCurrentTime(){return this._audioContext["currentTime"]}GetDestinationNode(){return this._destinationNode}["GetAudioContextExtern"](){return this.GetAudioContext()}["GetDestinationNodeExtern"](){return this.GetDestinationNode()}GetDestinationForTag(tag){const fxChain=this._effects.get(tag.toLowerCase()); +if(fxChain)return fxChain[0].GetInputNode();else return this.GetDestinationNode()}AddEffectForTag(tag,effect){tag=tag.toLowerCase();let fxChain=this._effects.get(tag);if(!fxChain){fxChain=[];this._effects.set(tag,fxChain)}effect._SetIndex(fxChain.length);effect._SetTag(tag);fxChain.push(effect);this._ReconnectEffects(tag)}_ReconnectEffects(tag){tag=tag.toLowerCase();let destNode=this.GetDestinationNode();const fxChain=this._effects.get(tag);if(fxChain&&fxChain.length){destNode=fxChain[0].GetInputNode(); +for(let i=0,len=fxChain.length;i{const audioBuffer=this._audioContext["createBuffer"](1,rawAudio.length,48E3);const channelBuffer=audioBuffer["getChannelData"](0);channelBuffer.set(rawAudio); +return audioBuffer});else return new Promise((resolve,reject)=>{this._audioContext["decodeAudioData"](audioData,resolve,reject)})}TryPlayMedia(mediaElem){this._iRuntime.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._iRuntime.RemovePendingPlay(mediaElem)}ReleaseInstancesForBuffer(buffer){let j=0;for(let i=0,len=this._audioInstances.length;i0)for(const ai of this._audioInstances){if(this._MatchTagLists(ai.GetTags(),tags))yield ai}else if(this._lastAudioInstance&&!this._lastAudioInstance.HasEnded())yield this._lastAudioInstance}*audioInstancesByEffectTag(tag){if(tag)for(const ai of this._audioInstances){if(self.AudioDOMHandler.EqualsNoCase(ai.GetEffectTag(), +tag))yield ai}else if(this._lastAudioInstance&&!this._lastAudioInstance.HasEnded())yield this._lastAudioInstance}async _GetAudioBuffer(originalUrl,url,type,isMusic,dontCreate){for(const ab of this._audioBuffers)if(ab.GetUrl()===url){await ab.Load();return ab}if(dontCreate)return null;if(isMusic&&(this._playMusicAsSound||this._hasAnySoftwareDecodedMusic))this.ReleaseAllMusicBuffers();const ret=self.C3AudioBuffer.Create(this,originalUrl,url,type,isMusic);this._audioBuffers.push(ret);await ret.Load(); +if(!this._loadedAudioUrls.has(originalUrl)){this.PostToRuntime("buffer-metadata",{"originalUrl":originalUrl,"duration":ret.GetDuration()});this._loadedAudioUrls.add(originalUrl)}return ret}async _GetAudioInstance(originalUrl,url,type,tags,isMusic){for(const ai of this._audioInstances)if(ai.GetUrl()===url&&(ai.CanBeRecycled()||isMusic)){ai.SetTags(tags);return ai}const buffer=await this._GetAudioBuffer(originalUrl,url,type,isMusic);const ret=buffer.CreateInstance(tags);this._audioInstances.push(ret); +return ret}_AddPendingTags(tags){const tagStr=tags.join(" ");let info=this._pendingTags.get(tagStr);if(!info){let resolve=null;const promise=new Promise(r=>resolve=r);info={pendingCount:0,promise,resolve};this._pendingTags.set(tagStr,info)}info.pendingCount++}_RemovePendingTags(tags){const tagStr=tags.join(" ");const info=this._pendingTags.get(tagStr);if(!info)throw new Error("expected pending tag");info.pendingCount--;if(info.pendingCount===0){info.resolve();this._pendingTags.delete(tagStr)}}TagsReady(tags){const tagStr= +(tags.length===0?this._lastPlayedTags:tags).join(" ");const info=this._pendingTags.get(tagStr);if(info)return info.promise;else return Promise.resolve()}_MaybeStartTicking(){if(this._analysers.size>0){this._StartTicking();return}for(const ai of this._audioInstances)if(ai.IsActive()){this._StartTicking();return}}Tick(){for(const a of this._analysers)a.Tick();const currentTime=this.GetAudioCurrentTime();for(const ai of this._audioInstances)ai.Tick(currentTime);const instStates=this._audioInstances.filter(a=> +a.IsActive()).map(a=>a.GetState());this.PostToRuntime("state",{"tickCount":this._lastTickCount,"outputLatency":this._audioContext["outputLatency"]||0,"audioInstances":instStates,"analysers":[...this._analysers].map(a=>a.GetData())});if(instStates.length===0&&this._analysers.size===0)this._StopTicking()}PostTrigger(type,tags,aiid){this.PostToRuntime("trigger",{"type":type,"tags":tags,"aiid":aiid})}async _Play(e){const originalUrl=e["originalUrl"];const url=e["url"];const type=e["type"];const isMusic= +e["isMusic"];const tags=e["tags"];const isLooping=e["isLooping"];const volume=e["vol"];const position=e["pos"];const panning=e["panning"];const stereoPan=e["stereoPan"];let startTime=e["off"];if(startTime>0&&!e["trueClock"])if(this._audioContext["getOutputTimestamp"]){const outputTimestamp=this._audioContext["getOutputTimestamp"]();startTime=startTime-outputTimestamp["performanceTime"]/1E3+outputTimestamp["contextTime"]}else startTime=startTime-performance.now()/1E3+this._audioContext["currentTime"]; +this._lastPlayedTags=tags.slice(0);this._AddPendingTags(tags);try{this._lastAudioInstance=await this._GetAudioInstance(originalUrl,url,type,tags,isMusic);if(panning){this._lastAudioInstance.SetPannerEnabled(true);this._lastAudioInstance.SetPan(panning["x"],panning["y"],panning["z"],panning["angle"],panning["innerAngle"],panning["outerAngle"],panning["outerGain"]);if(panning.hasOwnProperty("uid"))this._lastAudioInstance.SetUID(panning["uid"])}else if(typeof stereoPan==="number"&&stereoPan!==0){this._lastAudioInstance.SetStereoPannerEnabled(true); +this._lastAudioInstance.SetStereoPan(stereoPan)}else{this._lastAudioInstance.SetPannerEnabled(false);this._lastAudioInstance.SetStereoPannerEnabled(false)}this._lastAudioInstance.Play(isLooping,volume,position,startTime)}catch(err){console.error("[Construct] Audio: error starting playback: ",err);return}finally{this._RemovePendingTags(tags)}this._StartTicking()}_Stop(e){const tags=e["tags"];for(const ai of this.audioInstancesMatchingTags(tags))ai.Stop()}_StopAll(){for(const ai of this._audioInstances)ai.Stop()}_SetPaused(e){const tags= +e["tags"];const paused=e["paused"];for(const ai of this.audioInstancesMatchingTags(tags))if(paused)ai.Pause();else ai.Resume();this._MaybeStartTicking()}_SetVolume(e){const tags=e["tags"];const vol=e["vol"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetVolume(vol)}_SetStereoPan(e){const tags=e["tags"];const p=e["p"];for(const ai of this.audioInstancesMatchingTags(tags)){ai.SetStereoPannerEnabled(true);ai.SetStereoPan(p)}}async _FadeVolume(e){const tags=e["tags"];const vol=e["vol"];const duration= +e["duration"];const stopOnEnd=e["stopOnEnd"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.FadeVolume(vol,duration,stopOnEnd);this._MaybeStartTicking()}_SetMasterVolume(e){this._masterVolume=e["vol"];this._destinationNode["gain"]["value"]=this._masterVolume}_SetMuted(e){const tags=e["tags"];const isMuted=e["isMuted"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetMuted(isMuted)}_SetSilent(e){this._isSilent=e["isSilent"];this._iRuntime.SetSilent(this._isSilent); +for(const ai of this._audioInstances)ai._UpdateMuted()}_SetLooping(e){const tags=e["tags"];const isLooping=e["isLooping"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetLooping(isLooping)}async _SetPlaybackRate(e){const tags=e["tags"];const rate=e["rate"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.SetPlaybackRate(rate)}async _Seek(e){const tags=e["tags"];const pos=e["pos"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.Seek(pos)}async _Preload(e){const originalUrl= +e["originalUrl"];const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];try{await this._GetAudioInstance(originalUrl,url,type,"",isMusic)}catch(err){console.error("[Construct] Audio: error preloading: ",err)}}async _Unload(e){const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];const buffer=await this._GetAudioBuffer("",url,type,isMusic,true);if(!buffer)return;buffer.Release();const i=this._audioBuffers.indexOf(buffer);if(i!==-1)this._audioBuffers.splice(i,1)}_UnloadAll(){for(const buffer of this._audioBuffers)buffer.Release(); +this._audioBuffers.length=0}_SetSuspended(e){const isSuspended=e["isSuspended"];if(!isSuspended&&this._audioContext["resume"])this._audioContext["resume"]();for(const ai of this._audioInstances)ai.SetSuspended(isSuspended);if(isSuspended&&this._audioContext["suspend"])this._audioContext["suspend"]()}_OnTick(e){this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];this._lastTickCount=e["tickCount"];if(this._timeScaleMode!==0)for(const ai of this._audioInstances)ai._UpdatePlaybackRate();const listenerPos= +e["listenerPos"];if(listenerPos&&(this._lastListenerPos[0]!==listenerPos[0]||this._lastListenerPos[1]!==listenerPos[1]||this._lastListenerPos[2]!==listenerPos[2])){this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2])}const listenerOrientation=e["listenerOrientation"];if(listenerOrientation&&(this._lastListenerOrientation[0]!==listenerOrientation[0]|| +this._lastListenerOrientation[1]!==listenerOrientation[1]||this._lastListenerOrientation[2]!==listenerOrientation[2]||this._lastListenerOrientation[3]!==listenerOrientation[3]||this._lastListenerOrientation[4]!==listenerOrientation[4]||this._lastListenerOrientation[5]!==listenerOrientation[5])){for(let i=0;i<6;++i)this._lastListenerOrientation[i]=listenerOrientation[i];this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation)}for(const instPan of e["instPans"]){const uid= +instPan["uid"];for(const ai of this._audioInstances)if(ai.GetUID()===uid)ai.SetPanXYZA(instPan["x"],instPan["y"],instPan["z"],instPan["angle"])}}async _AddEffect(e){const type=e["type"];const tags=e["tags"];const params=e["params"];let effect;let convolutionBuffer;if(type==="convolution")try{convolutionBuffer=await this._GetAudioBuffer(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"],false)}catch(err){console.log("[Construct] Audio: error loading convolution: ",err);return}for(const tag of tags){if(type=== +"filter")effect=new self.C3AudioFilterFX(this,...params);else if(type==="delay")effect=new self.C3AudioDelayFX(this,...params);else if(type==="convolution"){effect=new self.C3AudioConvolveFX(this,convolutionBuffer.GetAudioBuffer(),...params);effect._SetBufferInfo(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"])}else if(type==="flanger")effect=new self.C3AudioFlangerFX(this,...params);else if(type==="phaser")effect=new self.C3AudioPhaserFX(this,...params);else if(type==="gain")effect=new self.C3AudioGainFX(this, +...params);else if(type==="stereopan")effect=new self.C3AudioStereoPanFX(this,...params);else if(type==="tremolo")effect=new self.C3AudioTremoloFX(this,...params);else if(type==="ringmod")effect=new self.C3AudioRingModFX(this,...params);else if(type==="distortion")effect=new self.C3AudioDistortionFX(this,...params);else if(type==="compressor")effect=new self.C3AudioCompressorFX(this,...params);else if(type==="analyser")effect=new self.C3AudioAnalyserFX(this,...params);else throw new Error("invalid effect type"); +this.AddEffectForTag(tag,effect)}this._PostUpdatedFxState()}_SetEffectParam(e){const tags=e["tags"];const index=e["index"];const param=e["param"];const value=e["value"];const ramp=e["ramp"];const time=e["time"];for(const tag of tags){const fxChain=this._effects.get(tag.toLowerCase());if(!fxChain||index<0||index>=fxChain.length)continue;fxChain[index].SetParam(param,value,ramp,time)}this._PostUpdatedFxState()}_RemoveEffects(e){const tags=e["tags"];for(const tag of tags){const lowerTag=tag.toLowerCase(); +const fxChain=this._effects.get(lowerTag);if(!fxChain||!fxChain.length)return;for(const effect of fxChain)effect.Release();this._effects.delete(lowerTag);this._ReconnectEffects(lowerTag)}}_AddAnalyser(analyser){this._analysers.add(analyser);this._MaybeStartTicking()}_RemoveAnalyser(analyser){this._analysers.delete(analyser)}_PostUpdatedFxState(){if(this._isPendingPostFxState)return;this._isPendingPostFxState=true;Promise.resolve().then(()=>this._DoPostUpdatedFxState())}_DoPostUpdatedFxState(){const fxstate= +{};for(const [tag,fxChain]of this._effects)fxstate[tag]=fxChain.map(e=>e.GetState());this.PostToRuntime("fxstate",{"fxstate":fxstate});this._isPendingPostFxState=false}async _OnLoadState(e){const saveLoadMode=e["saveLoadMode"];if(saveLoadMode!==3){const keepAudioInstances=[];for(const ai of this._audioInstances)if(ai.IsMusic()&&saveLoadMode===1||!ai.IsMusic()&&saveLoadMode===2)keepAudioInstances.push(ai);else ai.Release();this._audioInstances=keepAudioInstances}for(const fxChain of this._effects.values())for(const effect of fxChain)effect.Release(); +this._effects.clear();this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]);const listenerOrientation=e["listenerOrientation"];if(Array.isArray(listenerOrientation)){for(let i=0;i<6;++i)this._lastListenerOrientation[i]=listenerOrientation[i];this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation)}this._isSilent= +e["isSilent"];this._iRuntime.SetSilent(this._isSilent);this._masterVolume=e["masterVolume"];this._destinationNode["gain"]["value"]=this._masterVolume;const promises=[];for(const fxChainData of Object.values(e["effects"]))promises.push(Promise.all(fxChainData.map(d=>this._AddEffect(d))));await Promise.all(promises);await Promise.all(e["playing"].map(d=>this._LoadAudioInstance(d,saveLoadMode)));this._MaybeStartTicking()}async _LoadAudioInstance(d,saveLoadMode){if(saveLoadMode===3)return;const originalUrl= +d["bufferOriginalUrl"];const url=d["bufferUrl"];const type=d["bufferType"];const isMusic=d["isMusic"];const tags=d["tags"];const isLooping=d["isLooping"];const volume=d["volume"];const position=d["playbackTime"];if(isMusic&&saveLoadMode===1)return;if(!isMusic&&saveLoadMode===2)return;let ai=null;try{ai=await this._GetAudioInstance(originalUrl,url,type,tags,isMusic)}catch(err){console.error("[Construct] Audio: error loading audio state: ",err);return}ai.LoadPanState(d["pan"]);ai.LoadStereoPanState(d["stereoPan"]); +ai.Play(isLooping,volume,position,0);if(!d["isPlaying"])ai.Pause();ai._LoadAdditionalState(d)}_OnMicrophoneStream(localMediaStream,tag){if(this._microphoneSource)this._microphoneSource["disconnect"]();this._microphoneTag=tag.toLowerCase();this._microphoneSource=this._audioContext["createMediaStreamSource"](localMediaStream);this._microphoneSource["connect"](this.GetDestinationForTag(this._microphoneTag))}_OnGetOutputStream(){if(!this._destMediaStreamNode){this._destMediaStreamNode=this._audioContext["createMediaStreamDestination"](); +this._destinationNode["connect"](this._destMediaStreamNode)}return this._destMediaStreamNode["stream"]}async _OnOfflineRenderAudio(e){try{const time=e["time"];const suspendPromise=this._audioContext["suspend"](time);if(!this._hasStartedOfflineRender){this._audioContext["startRendering"]().then(buffer=>this._OnOfflineRenderCompleted(buffer)).catch(err=>this._OnOfflineRenderError(err));this._hasStartedOfflineRender=true}else this._audioContext["resume"]();await suspendPromise}catch(err){this._OnOfflineRenderError(err)}}_OnOfflineRenderFinish(){this._audioContext["resume"]()}_OnOfflineRenderCompleted(buffer){const channelArrayBuffers= +[];for(let i=0,len=buffer["numberOfChannels"];ithis._reachedCanPlayThrough= +true);this._outNode=this.GetAudioContext()["createGain"]();this._mediaSourceNode=null;this._audioElem.addEventListener("canplay",()=>{if(this._loadResolve){this._loadState="loaded";this._loadResolve();this._loadResolve=null;this._loadReject=null}if(this._mediaSourceNode||!this._audioElem)return;this._mediaSourceNode=this.GetAudioContext()["createMediaElementSource"](this._audioElem);this._mediaSourceNode["connect"](this._outNode)});this.onended=null;this._audioElem.addEventListener("ended",()=>{if(this.onended)this.onended()}); +this._audioElem.addEventListener("error",e=>this._OnError(e))}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._outNode["disconnect"]();this._outNode=null;this._mediaSourceNode["disconnect"]();this._mediaSourceNode=null;if(this._audioElem&&!this._audioElem.paused)this._audioElem.pause();this.onended=null;this._audioElem=null;super.Release()}_Load(){this._loadState="loading";return new Promise((resolve,reject)=>{this._loadResolve=resolve;this._loadReject=reject;this._audioElem.src= +this._url})}_OnError(e){console.error(`[Construct] Audio '${this._url}' error: `,e);if(this._loadReject){this._loadState="failed";this._loadReject(e);this._loadResolve=null;this._loadReject=null}}IsLoaded(){const ret=this._audioElem["readyState"]>=4;if(ret)this._reachedCanPlayThrough=true;return ret||this._reachedCanPlayThrough}IsLoadedAndDecoded(){return this.IsLoaded()}GetAudioElement(){return this._audioElem}GetOutputNode(){return this._outNode}GetDuration(){return this._audioElem["duration"]}}}; +'use strict';{self.C3WebAudioBuffer=class C3WebAudioBuffer extends self.C3AudioBuffer{constructor(audioDomHandler,originalUrl,url,type,isMusic,needsSoftwareDecode){super(audioDomHandler,originalUrl,url,type,isMusic);this._api="webaudio";this._audioData=null;this._audioBuffer=null;this._needsSoftwareDecode=!!needsSoftwareDecode}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._audioData=null;this._audioBuffer=null;super.Release()}async _Fetch(){if(this._audioData)return this._audioData; +const iRuntime=this._audioDomHandler.GetRuntimeInterface();if(iRuntime.GetExportType()==="cordova"&&iRuntime.IsRelativeURL(this._url)&&iRuntime.IsFileProtocol())this._audioData=await iRuntime.CordovaFetchLocalFileAsArrayBuffer(this._url);else{const response=await fetch(this._url);if(!response.ok)throw new Error(`error fetching audio data: ${response.status} ${response.statusText}`);this._audioData=await response.arrayBuffer()}}async _Decode(){if(this._audioBuffer)return this._audioBuffer;this._audioBuffer= +await this._audioDomHandler.DecodeAudioData(this._audioData,this._needsSoftwareDecode);this._audioData=null}async _Load(){try{this._loadState="loading";await this._Fetch();await this._Decode();this._loadState="loaded"}catch(err){this._loadState="failed";console.error(`[Construct] Failed to load audio '${this._url}': `,err)}}IsLoaded(){return!!(this._audioData||this._audioBuffer)}IsLoadedAndDecoded(){return!!this._audioBuffer}GetAudioBuffer(){return this._audioBuffer}GetDuration(){return this._audioBuffer? +this._audioBuffer["duration"]:0}}}; +'use strict';{let nextAiId=0;self.C3AudioInstance=class C3AudioInstance{constructor(audioDomHandler,buffer,tags){this._audioDomHandler=audioDomHandler;this._buffer=buffer;this._tags=tags;this._aiId=nextAiId++;this._gainNode=this.GetAudioContext()["createGain"]();this._gainNode["connect"](this.GetDestinationNode());this._pannerNode=null;this._isPannerEnabled=false;this._pannerPosition=[0,0,0];this._pannerOrientation=[0,0,0];this._pannerConeParams=[0,0,0];this._stereoPannerNode=null;this._isStereoPannerEnabled= +false;this._stereoPan=0;this._isStopped=true;this._isPaused=false;this._resumeMe=false;this._isLooping=false;this._volume=1;this._isMuted=false;this._playbackRate=1;const timeScaleMode=this._audioDomHandler.GetTimeScaleMode();this._isTimescaled=timeScaleMode===1&&!this.IsMusic()||timeScaleMode===2;this._instUid=-1;this._fadeEndTime=-1;this._stopOnFadeEnd=false}Release(){this._audioDomHandler=null;this._buffer=null;if(this._pannerNode){this._pannerNode["disconnect"]();this._pannerNode=null}if(this._stereoPannerNode){this._stereoPannerNode["disconnect"](); +this._stereoPannerNode=null}this._gainNode["disconnect"]();this._gainNode=null}GetAudioContext(){return this._audioDomHandler.GetAudioContext()}SetTags(tags){this._tags=tags}GetTags(){return this._tags}GetEffectTag(){return this._tags.length>0?this._tags[0]:""}GetDestinationNode(){return this._audioDomHandler.GetDestinationForTag(this.GetEffectTag())}GetCurrentTime(){if(this._isTimescaled)return this._audioDomHandler.GetGameTime();else return performance.now()/1E3}GetOriginalUrl(){return this._buffer.GetOriginalUrl()}GetUrl(){return this._buffer.GetUrl()}GetContentType(){return this._buffer.GetContentType()}GetBuffer(){return this._buffer}IsMusic(){return this._buffer.IsMusic()}GetAiId(){return this._aiId}HasEnded(){}CanBeRecycled(){}IsPlaying(){return!this._isStopped&& +!this._isPaused&&!this.HasEnded()}IsActive(){return!this._isStopped&&!this.HasEnded()}GetPlaybackTime(){}GetDuration(applyPlaybackRate){let ret=this._buffer.GetDuration();if(applyPlaybackRate)ret/=this._playbackRate||.001;return ret}Play(isLooping,vol,seekPos,scheduledTime){}Stop(){}Pause(){}IsPaused(){return this._isPaused}Resume(){}SetVolume(v){this._volume=v;this._gainNode["gain"]["cancelScheduledValues"](0);this._fadeEndTime=-1;this._gainNode["gain"]["value"]=this.GetOutputVolume()}FadeVolume(vol, +duration,stopOnEnd){if(this.IsMuted())return;const gainParam=this._gainNode["gain"];gainParam["cancelScheduledValues"](0);const currentTime=this._audioDomHandler.GetAudioCurrentTime();const endTime=currentTime+duration;gainParam["setValueAtTime"](gainParam["value"],currentTime);gainParam["linearRampToValueAtTime"](vol,endTime);this._volume=vol;this._fadeEndTime=endTime;this._stopOnFadeEnd=stopOnEnd}_UpdateVolume(){this.SetVolume(this._volume)}Tick(currentTime){if(this._fadeEndTime!==-1&¤tTime>= +this._fadeEndTime){this._fadeEndTime=-1;if(this._stopOnFadeEnd)this.Stop();this._audioDomHandler.PostTrigger("fade-ended",this._tags,this._aiId)}}GetOutputVolume(){const ret=this._volume;return isFinite(ret)?ret:0}SetMuted(m){m=!!m;if(this._isMuted===m)return;this._isMuted=m;this._UpdateMuted()}IsMuted(){return this._isMuted}IsSilent(){return this._audioDomHandler.IsSilent()}_UpdateMuted(){}SetLooping(l){}IsLooping(){return this._isLooping}SetPlaybackRate(r){if(this._playbackRate===r)return;this._playbackRate= +r;this._UpdatePlaybackRate()}_UpdatePlaybackRate(){}GetPlaybackRate(){return this._playbackRate}Seek(pos){}SetSuspended(s){}SetPannerEnabled(e){e=!!e;if(this._isPannerEnabled===e)return;this._isPannerEnabled=e;if(this._isPannerEnabled){this.SetStereoPannerEnabled(false);if(!this._pannerNode){this._pannerNode=this.GetAudioContext()["createPanner"]();this._pannerNode["panningModel"]=this._audioDomHandler.GetPanningModel();this._pannerNode["distanceModel"]=this._audioDomHandler.GetDistanceModel();this._pannerNode["refDistance"]= +this._audioDomHandler.GetReferenceDistance();this._pannerNode["maxDistance"]=this._audioDomHandler.GetMaxDistance();this._pannerNode["rolloffFactor"]=this._audioDomHandler.GetRolloffFactor()}this._gainNode["disconnect"]();this._gainNode["connect"](this._pannerNode);this._pannerNode["connect"](this.GetDestinationNode())}else{this._pannerNode["disconnect"]();this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetPan(x,y,z,angle,innerAngle,outerAngle,outerGain){if(!this._isPannerEnabled)return; +this.SetPanXYZA(x,y,z,angle);const toDegrees=self.AudioDOMHandler.ToDegrees;if(this._pannerConeParams[0]!==toDegrees(innerAngle)){this._pannerConeParams[0]=toDegrees(innerAngle);this._pannerNode["coneInnerAngle"]=toDegrees(innerAngle)}if(this._pannerConeParams[1]!==toDegrees(outerAngle)){this._pannerConeParams[1]=toDegrees(outerAngle);this._pannerNode["coneOuterAngle"]=toDegrees(outerAngle)}if(this._pannerConeParams[2]!==outerGain){this._pannerConeParams[2]=outerGain;this._pannerNode["coneOuterGain"]= +outerGain}}SetPanXYZA(x,y,z,angle){if(!this._isPannerEnabled)return;const pos=this._pannerPosition;const orient=this._pannerOrientation;const cosa=Math.cos(angle);const sina=Math.sin(angle);if(pos[0]!==x||pos[1]!==y||pos[2]!==z){pos[0]=x;pos[1]=y;pos[2]=z;this._pannerNode["setPosition"](...pos)}if(orient[0]!==cosa||orient[1]!==sina||orient[2]!==0){orient[0]=cosa;orient[1]=sina;orient[2]=0;this._pannerNode["setOrientation"](...orient)}}SetStereoPannerEnabled(e){e=!!e;if(this._isStereoPannerEnabled=== +e)return;this._isStereoPannerEnabled=e;if(this._isStereoPannerEnabled){this.SetPannerEnabled(false);this._stereoPannerNode=this.GetAudioContext()["createStereoPanner"]();this._gainNode["disconnect"]();this._gainNode["connect"](this._stereoPannerNode);this._stereoPannerNode["connect"](this.GetDestinationNode())}else{this._stereoPannerNode["disconnect"]();this._stereoPannerNode=null;this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetStereoPan(p){if(!this._isStereoPannerEnabled)return; +if(this._stereoPan===p)return;this._stereoPannerNode["pan"]["value"]=p;this._stereoPan=p}SetUID(uid){this._instUid=uid}GetUID(){return this._instUid}GetResumePosition(){}Reconnect(toNode){const outNode=this._stereoPannerNode||this._pannerNode||this._gainNode;outNode["disconnect"]();outNode["connect"](toNode)}GetState(){return{"aiid":this.GetAiId(),"tags":this._tags,"duration":this.GetDuration(),"volume":this._fadeEndTime===-1?this._volume:this._gainNode["gain"]["value"],"isPlaying":this.IsPlaying(), +"playbackTime":this.GetPlaybackTime(),"playbackRate":this.GetPlaybackRate(),"uid":this._instUid,"bufferOriginalUrl":this.GetOriginalUrl(),"bufferUrl":"","bufferType":this.GetContentType(),"isMusic":this.IsMusic(),"isLooping":this.IsLooping(),"isMuted":this.IsMuted(),"resumePosition":this.GetResumePosition(),"pan":this.GetPanState(),"stereoPan":this.GetStereoPanState()}}_LoadAdditionalState(d){this.SetPlaybackRate(d["playbackRate"]);this.SetMuted(d["isMuted"])}GetPanState(){if(!this._pannerNode)return null; +const pn=this._pannerNode;return{"pos":this._pannerPosition,"orient":this._pannerOrientation,"cia":pn["coneInnerAngle"],"coa":pn["coneOuterAngle"],"cog":pn["coneOuterGain"],"uid":this._instUid}}LoadPanState(d){if(!d){this.SetPannerEnabled(false);return}this.SetPannerEnabled(true);const pn=this._pannerNode;const panPos=d["pos"];this._pannerPosition[0]=panPos[0];this._pannerPosition[1]=panPos[1];this._pannerPosition[2]=panPos[2];const panOrient=d["orient"];this._pannerOrientation[0]=panOrient[0];this._pannerOrientation[1]= +panOrient[1];this._pannerOrientation[2]=panOrient[2];pn["setPosition"](...this._pannerPosition);pn["setOrientation"](...this._pannerOrientation);this._pannerConeParams[0]=d["cia"];this._pannerConeParams[1]=d["coa"];this._pannerConeParams[2]=d["cog"];pn["coneInnerAngle"]=d["cia"];pn["coneOuterAngle"]=d["coa"];pn["coneOuterGain"]=d["cog"];this._instUid=d["uid"]}GetStereoPanState(){if(this._stereoPannerNode)return this._stereoPan;else return null}LoadStereoPanState(p){if(typeof p!=="number"){this.SetStereoPannerEnabled(false); +return}this.SetStereoPannerEnabled(true);this.SetStereoPan(p)}}}; +'use strict';{self.C3Html5AudioInstance=class C3Html5AudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tags){super(audioDomHandler,buffer,tags);this._buffer.GetOutputNode()["connect"](this._gainNode);this._buffer.onended=()=>this._OnEnded()}Release(){this.Stop();this._buffer.GetOutputNode()["disconnect"]();super.Release()}GetAudioElement(){return this._buffer.GetAudioElement()}_OnEnded(){this._isStopped=true;this._instUid=-1;this._audioDomHandler.PostTrigger("ended",this._tags, +this._aiId)}HasEnded(){return this.GetAudioElement()["ended"]}CanBeRecycled(){if(this._isStopped)return true;return this.HasEnded()}GetPlaybackTime(){let ret=this.GetAudioElement()["currentTime"];if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){const audioElem=this.GetAudioElement();if(audioElem.playbackRate!==1)audioElem.playbackRate=1;if(audioElem.loop!==isLooping)audioElem.loop=isLooping;this.SetVolume(vol);if(audioElem.muted)audioElem.muted= +false;if(audioElem.currentTime!==seekPos)try{audioElem.currentTime=seekPos}catch(err){console.warn(`[Construct] Exception seeking audio '${this._buffer.GetUrl()}' to position '${seekPos}': `,err)}this._audioDomHandler.TryPlayMedia(audioElem);this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1}Stop(){const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isStopped=true;this._isPaused= +false;this._instUid=-1}Pause(){if(this._isPaused||this._isStopped||this.HasEnded())return;const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isPaused=true}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._isPaused=false}_UpdateMuted(){this.GetAudioElement().muted=this._isMuted||this.IsSilent()}SetLooping(l){l=!!l;if(this._isLooping=== +l)return;this._isLooping=l;this.GetAudioElement().loop=l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();try{this.GetAudioElement()["playbackRate"]=r}catch(err){console.warn(`[Construct] Unable to set playback rate '${r}':`,err)}}Seek(pos){if(this._isStopped||this.HasEnded())return;try{this.GetAudioElement()["currentTime"]=pos}catch(err){console.warn(`[Construct] Error seeking audio to '${pos}': `,err)}}GetResumePosition(){return this.GetPlaybackTime()}SetSuspended(s){if(s)if(this.IsPlaying()){this.GetAudioElement()["pause"](); +this._resumeMe=true}else this._resumeMe=false;else if(this._resumeMe){this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._resumeMe=false}}}}; +'use strict';{self.C3WebAudioInstance=class C3WebAudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tags){super(audioDomHandler,buffer,tags);this._bufferSource=null;this._onended_handler=e=>this._OnEnded(e);this._hasPlaybackEnded=true;this._activeSource=null;this._playStartTime=0;this._playFromSeekPos=0;this._resumePosition=0;this._muteVol=1}Release(){this.Stop();this._ReleaseBufferSource();this._onended_handler=null;super.Release()}_ReleaseBufferSource(){if(this._bufferSource){this._bufferSource["onended"]= +null;this._bufferSource["disconnect"]();this._bufferSource["buffer"]=null}this._bufferSource=null;this._activeSource=null}_OnEnded(e){if(this._isPaused||this._resumeMe)return;if(e.target!==this._activeSource)return;this._hasPlaybackEnded=true;this._isStopped=true;this._instUid=-1;this._ReleaseBufferSource();this._audioDomHandler.PostTrigger("ended",this._tags,this._aiId)}HasEnded(){if(!this._isStopped&&this._bufferSource&&this._bufferSource["loop"])return false;if(this._isPaused)return false;return this._hasPlaybackEnded}CanBeRecycled(){if(!this._bufferSource|| +this._isStopped)return true;return this.HasEnded()}GetPlaybackTime(){let ret=0;if(this._isPaused)ret=this._resumePosition;else ret=this._playFromSeekPos+(this.GetCurrentTime()-this._playStartTime)*this._playbackRate;if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){this._muteVol=1;this.SetVolume(vol);this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer(); +this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=isLooping;this._bufferSource["start"](scheduledTime,seekPos);this._hasPlaybackEnded=false;this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1;this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=seekPos}Stop(){if(this._bufferSource)try{this._bufferSource["stop"](0)}catch(err){}this._isStopped= +true;this._isPaused=false;this._instUid=-1}Pause(){if(this._isPaused||this._isStopped||this.HasEnded())return;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%=this.GetDuration();this._isPaused=true;this._bufferSource["stop"](0)}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode); +this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0,this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._isPaused=false}GetOutputVolume(){return super.GetOutputVolume()*this._muteVol}_UpdateMuted(){this._muteVol=this._isMuted||this.IsSilent()?0:1;this._UpdateVolume()}SetLooping(l){l= +!!l;if(this._isLooping===l)return;this._isLooping=l;if(this._bufferSource)this._bufferSource["loop"]=l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();if(this._bufferSource)this._bufferSource["playbackRate"]["value"]=r}Seek(pos){if(this._isStopped||this.HasEnded())return;if(this._isPaused)this._resumePosition=pos;else{this.Pause();this._resumePosition=pos;this.Resume()}}GetResumePosition(){return this._resumePosition}SetSuspended(s){if(s)if(this.IsPlaying()){this._resumeMe= +true;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%=this.GetDuration();this._bufferSource["stop"](0)}else this._resumeMe=false;else if(this._resumeMe){this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]= +this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0,this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._resumeMe=false}}_LoadAdditionalState(d){super._LoadAdditionalState(d);this._resumePosition=d["resumePosition"]}}}; +'use strict';{class AudioFXBase{constructor(audioDomHandler){this._audioDomHandler=audioDomHandler;this._audioContext=audioDomHandler.GetAudioContext();this._index=-1;this._tag="";this._type="";this._params=null}Release(){this._audioContext=null}_SetIndex(i){this._index=i}GetIndex(){return this._index}_SetTag(t){this._tag=t}GetTag(){return this._tag}CreateGain(){return this._audioContext["createGain"]()}GetInputNode(){}ConnectTo(node){}SetAudioParam(ap,value,ramp,time){ap["cancelScheduledValues"](0); +if(time===0){ap["value"]=value;return}const curTime=this._audioContext["currentTime"];time+=curTime;switch(ramp){case 0:ap["setValueAtTime"](value,time);break;case 1:ap["setValueAtTime"](ap["value"],curTime);ap["linearRampToValueAtTime"](value,time);break;case 2:ap["setValueAtTime"](ap["value"],curTime);ap["exponentialRampToValueAtTime"](value,time);break}}GetState(){return{"type":this._type,"tag":this._tag,"params":this._params}}}self.C3AudioFilterFX=class C3AudioFilterFX extends AudioFXBase{constructor(audioDomHandler, +type,freq,detune,q,gain,mix){super(audioDomHandler);this._type="filter";this._params=[type,freq,detune,q,gain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]=type;this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._filterNode["gain"]["vlaue"]= +gain;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value= +Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break;case 1:this._params[1]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[2]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[3]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 4:this._params[4]=value; +this.SetAudioParam(this._filterNode["gain"],value,ramp,time);break}}};self.C3AudioDelayFX=class C3AudioDelayFX extends AudioFXBase{constructor(audioDomHandler,delayTime,delayGain,mix){super(audioDomHandler);this._type="delay";this._params=[delayTime,delayGain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._mainNode=this.CreateGain();this._delayNode=this._audioContext["createDelay"](delayTime); +this._delayNode["delayTime"]["value"]=delayTime;this._delayGainNode=this.CreateGain();this._delayGainNode["gain"]["value"]=delayGain;this._inputNode["connect"](this._mainNode);this._inputNode["connect"](this._dryNode);this._mainNode["connect"](this._wetNode);this._mainNode["connect"](this._delayNode);this._delayNode["connect"](this._delayGainNode);this._delayGainNode["connect"](this._mainNode)}Release(){this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();this._mainNode["disconnect"](); +this._delayNode["disconnect"]();this._delayGainNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[2]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 4:this._params[1]=DbToLinear(value);this.SetAudioParam(this._delayGainNode["gain"],DbToLinear(value),ramp,time);break;case 5:this._params[0]=value;this.SetAudioParam(this._delayNode["delayTime"],value,ramp,time);break}}};self.C3AudioConvolveFX=class C3AudioConvolveFX extends AudioFXBase{constructor(audioDomHandler,buffer,normalize,mix){super(audioDomHandler);this._type="convolution";this._params=[normalize,mix];this._bufferOriginalUrl="";this._bufferUrl="";this._bufferType= +"";this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._convolveNode=this._audioContext["createConvolver"]();this._convolveNode["normalize"]=normalize;this._convolveNode["buffer"]=buffer;this._inputNode["connect"](this._convolveNode);this._inputNode["connect"](this._dryNode);this._convolveNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._convolveNode["disconnect"](); +this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break}}_SetBufferInfo(bufferOriginalUrl, +bufferUrl,bufferType){this._bufferOriginalUrl=bufferOriginalUrl;this._bufferUrl=bufferUrl;this._bufferType=bufferType}GetState(){const ret=super.GetState();ret["bufferOriginalUrl"]=this._bufferOriginalUrl;ret["bufferUrl"]="";ret["bufferType"]=this._bufferType;return ret}};self.C3AudioFlangerFX=class C3AudioFlangerFX extends AudioFXBase{constructor(audioDomHandler,delay,modulation,freq,feedback,mix){super(audioDomHandler);this._type="flanger";this._params=[delay,modulation,freq,feedback,mix];this._inputNode= +this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._feedbackNode=this.CreateGain();this._feedbackNode["gain"]["value"]=feedback;this._delayNode=this._audioContext["createDelay"](delay+modulation);this._delayNode["delayTime"]["value"]=delay;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]= +modulation;this._inputNode["connect"](this._delayNode);this._inputNode["connect"](this._dryNode);this._delayNode["connect"](this._wetNode);this._delayNode["connect"](this._feedbackNode);this._feedbackNode["connect"](this._delayNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._delayNode["delayTime"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._delayNode["disconnect"]();this._oscNode["disconnect"]();this._oscGainNode["disconnect"](); +this._dryNode["disconnect"]();this._wetNode["disconnect"]();this._feedbackNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[4]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 6:this._params[1]=value/1E3;this.SetAudioParam(this._oscGainNode["gain"],value/1E3,ramp,time);break;case 7:this._params[2]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break;case 8:this._params[3]=value/100;this.SetAudioParam(this._feedbackNode["gain"],value/100,ramp,time);break}}};self.C3AudioPhaserFX=class C3AudioPhaserFX extends AudioFXBase{constructor(audioDomHandler,freq,detune,q,modulation,modfreq,mix){super(audioDomHandler);this._type= +"phaser";this._params=[freq,detune,q,modulation,modfreq,mix];this._inputNode=this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]="allpass";this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._oscNode=this._audioContext["createOscillator"](); +this._oscNode["frequency"]["value"]=modfreq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]=modulation;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._filterNode["frequency"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._oscNode["disconnect"](); +this._oscGainNode["disconnect"]();this._dryNode["disconnect"]();this._wetNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 1:this._params[0]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[1]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[2]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 6:this._params[3]=value;this.SetAudioParam(this._oscGainNode["gain"],value,ramp,time);break;case 7:this._params[4]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp, +time);break}}};self.C3AudioGainFX=class C3AudioGainFX extends AudioFXBase{constructor(audioDomHandler,g){super(audioDomHandler);this._type="gain";this._params=[g];this._node=this.CreateGain();this._node["gain"]["value"]=g}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 4:this._params[0]=DbToLinear(value); +this.SetAudioParam(this._node["gain"],DbToLinear(value),ramp,time);break}}};self.C3AudioStereoPanFX=class C3AudioStereoPanFX extends AudioFXBase{constructor(audioDomHandler,p){super(audioDomHandler);this._type="stereopan";this._params=[p];this._node=this._audioContext["createStereoPanner"]();this._node["pan"]["value"]=p}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp, +time){value=Math.min(Math.max(value/100,-1),1);switch(param){case 9:this._params[0]=value;this.SetAudioParam(this._node["pan"],value,ramp,time);break}}};self.C3AudioTremoloFX=class C3AudioTremoloFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="tremolo";this._params=[freq,mix];this._node=this.CreateGain();this._node["gain"]["value"]=1-mix/2;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode= +this.CreateGain();this._oscGainNode["gain"]["value"]=mix/2;this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._node["gain"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"]();this._oscGainNode["disconnect"]();this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/ +100,1),0);this._params[1]=value;this.SetAudioParam(this._node["gain"],1-value/2,ramp,time);this.SetAudioParam(this._oscGainNode["gain"],value/2,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioRingModFX=class C3AudioRingModFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="ringmod";this._params=[freq,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]= +mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._ringNode=this.CreateGain();this._ringNode["gain"]["value"]=0;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscNode["connect"](this._ringNode["gain"]);this._oscNode["start"](0);this._inputNode["connect"](this._ringNode);this._inputNode["connect"](this._dryNode);this._ringNode["connect"](this._wetNode)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"](); +this._ringNode["disconnect"]();this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioDistortionFX=class C3AudioDistortionFX extends AudioFXBase{constructor(audioDomHandler,threshold,headroom,drive,makeupgain,mix){super(audioDomHandler);this._type="distortion";this._params=[threshold,headroom,drive,makeupgain,mix];this._inputNode=this.CreateGain();this._preGain=this.CreateGain();this._postGain=this.CreateGain();this._SetDrive(drive,makeupgain);this._wetNode= +this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._waveShaper=this._audioContext["createWaveShaper"]();this._curve=new Float32Array(65536);this._GenerateColortouchCurve(threshold,headroom);this._waveShaper.curve=this._curve;this._inputNode["connect"](this._preGain);this._inputNode["connect"](this._dryNode);this._preGain["connect"](this._waveShaper);this._waveShaper["connect"](this._postGain);this._postGain["connect"](this._wetNode)}Release(){this._inputNode["disconnect"](); +this._preGain["disconnect"]();this._waveShaper["disconnect"]();this._postGain["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}_SetDrive(drive,makeupgain){if(drive<.01)drive=.01;this._preGain["gain"]["value"]=drive;this._postGain["gain"]["value"]=Math.pow(1/drive,.6)*makeupgain}_GenerateColortouchCurve(threshold,headroom){const n=65536;const n2=n/2;for(let i=0;ithis._OnChangeCursorStyle(e)],["request-pointer-lock",()=>this._OnRequestPointerLock()],["release-pointer-lock",()=>this._OnReleasePointerLock()]]);document.addEventListener("pointerlockchange",e=>this._OnPointerLockChange());document.addEventListener("pointerlockerror",e=>this._OnPointerLockError())}_OnChangeCursorStyle(e){document.documentElement.style.cursor= +e}_OnRequestPointerLock(){this._iRuntime.GetCanvas().requestPointerLock()}_OnReleasePointerLock(){document.exitPointerLock()}_OnPointerLockChange(){this.PostToRuntime("pointer-lock-change",{"has-pointer-lock":!!document.pointerLockElement})}_OnPointerLockError(){this.PostToRuntime("pointer-lock-error",{"has-pointer-lock":!!document.pointerLockElement})}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{const DOM_COMPONENT_ID="touch";const HANDLER_CLASS=class TouchDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this.AddRuntimeMessageHandler("request-permission",e=>this._OnRequestPermission(e))}async _OnRequestPermission(e){const type=e["type"];let result=true;if(type===0)result=await this._RequestOrientationPermission();else if(type===1)result=await this._RequestMotionPermission();this.PostToRuntime("permission-result",{"type":type,"result":result})}async _RequestOrientationPermission(){if(!self["DeviceOrientationEvent"]|| +!self["DeviceOrientationEvent"]["requestPermission"])return true;try{const state=await self["DeviceOrientationEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request orientation permission: ",err);return false}}async _RequestMotionPermission(){if(!self["DeviceMotionEvent"]||!self["DeviceMotionEvent"]["requestPermission"])return true;try{const state=await self["DeviceMotionEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request motion permission: ", +err);return false}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{function elemsForSelector(selector,isAll){if(!selector)return[document.documentElement];else if(isAll)return Array.from(document.querySelectorAll(selector));else{const e=document.querySelector(selector);return e?[e]:[]}}function noop(){}const DOM_COMPONENT_ID="browser";const HANDLER_CLASS=class BrowserDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._exportType="";this.AddRuntimeMessageHandlers([["get-initial-state",e=>this._OnGetInitialState(e)], +["ready-for-sw-messages",()=>this._OnReadyForSWMessages()],["alert",e=>this._OnAlert(e)],["close",()=>this._OnClose()],["set-focus",e=>this._OnSetFocus(e)],["vibrate",e=>this._OnVibrate(e)],["lock-orientation",e=>this._OnLockOrientation(e)],["unlock-orientation",()=>this._OnUnlockOrientation()],["navigate",e=>this._OnNavigate(e)],["request-fullscreen",e=>this._OnRequestFullscreen(e)],["exit-fullscreen",()=>this._OnExitFullscreen()],["set-hash",e=>this._OnSetHash(e)],["set-document-css-style",e=>this._OnSetDocumentCSSStyle(e)], +["get-document-css-style",e=>this._OnGetDocumentCSSStyle(e)]]);window.addEventListener("online",()=>this._OnOnlineStateChanged(true));window.addEventListener("offline",()=>this._OnOnlineStateChanged(false));window.addEventListener("hashchange",()=>this._OnHashChange());document.addEventListener("backbutton",()=>this._OnCordovaBackButton())}_OnGetInitialState(e){this._exportType=e["exportType"];return{"location":location.toString(),"isOnline":!!navigator.onLine,"referrer":document.referrer,"title":document.title, +"isCookieEnabled":!!navigator.cookieEnabled,"screenWidth":screen.width,"screenHeight":screen.height,"windowOuterWidth":window.outerWidth,"windowOuterHeight":window.outerHeight,"isConstructArcade":typeof window["is_scirra_arcade"]!=="undefined"}}_OnReadyForSWMessages(){if(!window["C3_RegisterSW"]||!window["OfflineClientInfo"])return;window["OfflineClientInfo"]["SetMessageCallback"](e=>this.PostToRuntime("sw-message",e["data"]))}_OnOnlineStateChanged(isOnline){this.PostToRuntime("online-state",{"isOnline":isOnline})}_OnCordovaBackButton(){this.PostToRuntime("backbutton")}GetNWjsWindow(){if(this._exportType=== +"nwjs")return nw["Window"]["get"]();else return null}_OnAlert(e){alert(e["message"])}_OnClose(){if(navigator["app"]&&navigator["app"]["exitApp"])navigator["app"]["exitApp"]();else if(navigator["device"]&&navigator["device"]["exitApp"])navigator["device"]["exitApp"]();else window.close()}_OnSetFocus(e){const isFocus=e["isFocus"];if(this._exportType==="nwjs"){const win=this.GetNWjsWindow();if(isFocus)win["focus"]();else win["blur"]()}else if(isFocus)window.focus();else window.blur()}_OnVibrate(e){if(navigator["vibrate"])navigator["vibrate"](e["pattern"])}_OnLockOrientation(e){const orientation= +e["orientation"];if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=>console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result=screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result= +screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ",err)}}_OnUnlockOrientation(){try{if(screen["orientation"]&&screen["orientation"]["unlock"])screen["orientation"]["unlock"]();else if(screen["unlockOrientation"])screen["unlockOrientation"]();else if(screen["webkitUnlockOrientation"])screen["webkitUnlockOrientation"]();else if(screen["mozUnlockOrientation"])screen["mozUnlockOrientation"](); +else if(screen["msUnlockOrientation"])screen["msUnlockOrientation"]()}catch(err){}}_OnNavigate(e){const type=e["type"];if(type==="back")if(navigator["app"]&&navigator["app"]["backHistory"])navigator["app"]["backHistory"]();else window.history.back();else if(type==="forward")window.history.forward();else if(type==="reload")location.reload();else if(type==="url"){const url=e["url"];const target=e["target"];const exportType=e["exportType"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url, +"_system");else if(exportType==="preview"||this._iRuntime.IsWebView2Wrapper())window.open(url,"_blank");else if(!this._isConstructArcade)if(target===2)window.top.location=url;else if(target===1)window.parent.location=url;else window.location=url}else if(type==="new-window"){const url=e["url"];const tag=e["tag"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url,"_system");else window.open(url,tag)}}_OnRequestFullscreen(e){if(this._iRuntime.IsWebView2Wrapper()|| +this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen","fullscreen":true})}else{const opts={"navigationUI":"auto"};const navUI=e["navUI"];if(navUI===1)opts["navigationUI"]="hide";else if(navUI===2)opts["navigationUI"]="show";const elem=document.documentElement;let ret;if(elem["requestFullscreen"])ret=elem["requestFullscreen"](opts);else if(elem["mozRequestFullScreen"])ret=elem["mozRequestFullScreen"](opts); +else if(elem["msRequestFullscreen"])ret=elem["msRequestFullscreen"](opts);else if(elem["webkitRequestFullScreen"])if(typeof Element["ALLOW_KEYBOARD_INPUT"]!=="undefined")ret=elem["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]);else ret=elem["webkitRequestFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnExitFullscreen(){if(this._iRuntime.IsWebView2Wrapper()||this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen", +"fullscreen":false})}else{let ret;if(document["exitFullscreen"])ret=document["exitFullscreen"]();else if(document["mozCancelFullScreen"])ret=document["mozCancelFullScreen"]();else if(document["msExitFullscreen"])ret=document["msExitFullscreen"]();else if(document["webkitCancelFullScreen"])ret=document["webkitCancelFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnSetHash(e){location.hash=e["hash"]}_OnHashChange(){this.PostToRuntime("hashchange",{"location":location.toString()})}_OnSetDocumentCSSStyle(e){const prop= +e["prop"];const value=e["value"];const selector=e["selector"];const isAll=e["is-all"];try{const arr=elemsForSelector(selector,isAll);for(const e of arr)if(prop.startsWith("--"))e.style.setProperty(prop,value);else e.style[prop]=value}catch(err){console.warn("[Browser] Failed to set style: ",err)}}_OnGetDocumentCSSStyle(e){const prop=e["prop"];const selector=e["selector"];try{const elem=document.querySelector(selector);if(elem){const computedStyle=window.getComputedStyle(elem);return{"isOk":true,"result":computedStyle.getPropertyValue(prop)}}else return{"isOk":false}}catch(err){console.warn("[Browser] Failed to get style: ", +err);return{"isOk":false}}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; diff --git a/basketrandom/scripts/offlineclient.js b/basketrandom/scripts/offlineclient.js new file mode 100644 index 00000000..8a6145d1 --- /dev/null +++ b/basketrandom/scripts/offlineclient.js @@ -0,0 +1,2 @@ +'use strict';{class OfflineClient{constructor(){this._broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel("offline");this._queuedMessages=[];this._onMessageCallback=null;if(this._broadcastChannel)this._broadcastChannel.onmessage=e=>this._OnBroadcastChannelMessage(e)}_OnBroadcastChannelMessage(e){if(this._onMessageCallback){this._onMessageCallback(e);return}this._queuedMessages.push(e)}SetMessageCallback(f){this._onMessageCallback=f;for(let e of this._queuedMessages)this._onMessageCallback(e); +this._queuedMessages.length=0}}window.OfflineClientInfo=new OfflineClient}; diff --git a/basketrandom/scripts/project/FrameRateLimit.js b/basketrandom/scripts/project/FrameRateLimit.js new file mode 100644 index 00000000..3a9253c8 --- /dev/null +++ b/basketrandom/scripts/project/FrameRateLimit.js @@ -0,0 +1,92 @@ + +// Import any other script files here, e.g.: +// import * as myModule from "./mymodule.js"; + +runOnStartup(async runtime => +{ + runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime)); +}); + +async function OnBeforeProjectStart(runtime) +{ + // Code to run just before 'On start of layout' on + // the first layout. Loading has finished and initial + // instances are created and available to use here. + + var timestep = 1 / 60; // 60 Hz time step + var accumulator = 0; + + requestAnimationFrame(function gameLoop(timestamp) { + accumulator += (timestamp - lastFrameTimeMs) / 1000; + while (accumulator > timestep) { + accumulator -= timestep; + } + + lastFrameTimeMs = timestamp; + requestAnimationFrame(gameLoop); + }); + + runtime.addEventListener("tick", () => Tick(runtime)); +} + +var lastFrameTimeMs = 0; + +function Tick(runtime) +{ + // Code to run every tick + getScreenRefreshRate(function(FPS){ + //console.log(`${FPS} FPS`); + runtime.globalVars.ScnRefreshRate = FPS; + //console.log("FPS = "+runtime.globalVars.ScnRefreshRate); + + }); +} + +/** + * Allows to obtain the estimated Hz of the primary monitor in the system. + * + * @param {Function} callback The function triggered after obtaining the estimated Hz of the monitor. + * @param {Boolean} runIndefinitely If set to true, the callback will be triggered indefinitely (for live counter). + */ +function getScreenRefreshRate(callback, runIndefinitely){ + let requestId = null; + let callbackTriggered = false; + runIndefinitely = runIndefinitely || false; + + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame; + } + + let DOMHighResTimeStampCollection = []; + + let triggerAnimation = function(DOMHighResTimeStamp){ + DOMHighResTimeStampCollection.unshift(DOMHighResTimeStamp); + + if (DOMHighResTimeStampCollection.length > 10) { + let t0 = DOMHighResTimeStampCollection.pop(); + let fps = Math.floor(1000 * 10 / (DOMHighResTimeStamp - t0)); + + if(!callbackTriggered){ + callback.call(undefined, fps, DOMHighResTimeStampCollection); + } + + if(runIndefinitely){ + callbackTriggered = false; + }else{ + callbackTriggered = true; + } + } + + requestId = window.requestAnimationFrame(triggerAnimation); + }; + + window.requestAnimationFrame(triggerAnimation); + + // Stop after half second if it shouldn't run indefinitely + if(!runIndefinitely){ + window.setTimeout(function(){ + window.cancelAnimationFrame(requestId); + requestId = null; + }, 500); + } +} \ No newline at end of file diff --git a/basketrandom/scripts/project/scriptsInEvents.js b/basketrandom/scripts/project/scriptsInEvents.js new file mode 100644 index 00000000..6c40527c --- /dev/null +++ b/basketrandom/scripts/project/scriptsInEvents.js @@ -0,0 +1,24 @@ + + + +const scriptsInEvents = { + + async Introevent_Event2_Act1(runtime, localVars) + { + initSDK(); + }, + + async Rhm_ads_Event1_Act1(runtime, localVars) + { + CallInterstitialAds(); + }, + + async Rhm_ads_Event2_Act1(runtime, localVars) + { + CallRewardedAds(); + } + +}; + +self.C3.ScriptsInEvents = scriptsInEvents; + diff --git a/basketrandom/scripts/register-sw.js b/basketrandom/scripts/register-sw.js new file mode 100644 index 00000000..f152b5ff --- /dev/null +++ b/basketrandom/scripts/register-sw.js @@ -0,0 +1 @@ +'use strict';{window.C3_RegisterSW=async function C3_RegisterSW(){if(!navigator.serviceWorker)return;try{const reg=await navigator.serviceWorker.register("sw.js",{scope:"./"});console.info("Registered service worker on "+reg.scope)}catch(err){console.warn("Failed to register service worker: ",err)}}}; diff --git a/basketrandom/scripts/supportcheck.js b/basketrandom/scripts/supportcheck.js new file mode 100644 index 00000000..886cbc95 --- /dev/null +++ b/basketrandom/scripts/supportcheck.js @@ -0,0 +1,5 @@ +'use strict';(function(){var isKasperskyScriptInjected=!!document.querySelector('script[src*="kaspersky"]');var tmpCanvas=document.createElement("canvas");var hasWebGL=!!tmpCanvas.getContext("webgl");var missingFeatures=[];if(!hasWebGL)missingFeatures.push("WebGL");if(typeof WebAssembly==="undefined")missingFeatures.push("WebAssembly");if(!("noModule"in HTMLScriptElement.prototype))missingFeatures.push("JavaScript Modules");if(missingFeatures.length===0&&!isKasperskyScriptInjected)window["C3_IsSupported"]= +true;else{var msgWrap=document.createElement("div");msgWrap.id="notSupportedWrap";document.body.appendChild(msgWrap);var msgTitle=document.createElement("h2");msgTitle.id="notSupportedTitle";if(isKasperskyScriptInjected)msgTitle.textContent="Kaspersky Internet Security broke this export";else msgTitle.textContent="Software update needed";msgWrap.appendChild(msgTitle);var msgBody=document.createElement("p");msgBody.className="notSupportedMessage";var msgText="This content is not supported because your device's software appears to be out-of-date. "; +var ua=navigator.userAgent;if(/android/i.test(ua))msgText+='

On Android, fix this by making sure the
Android System Webview app has updates enabled and is up-to-date.';else if(/iphone|ipad|ipod/i.test(ua)){msgText+="Alternatively if Lockdown mode is enabled, try turning it off to view this content.";msgText+="

Note: using the iOS simulator requires Xcode 12+. Otherwise try testing on a real device instead."}else if(/msie/i.test(ua)|| +/trident/i.test(ua)||/edge\//i.test(ua))msgText+="

Note: Internet Explorer and the legacy Edge browser are not supported. Try using Chrome or Firefox instead.";else if(isKasperskyScriptInjected)msgText="It appears a script was added to this export by Kaspersky software. This prevents the exported project from working. Try disabling Kaspersky and exporting again.";else msgText+= +"Try installing any available software updates. Alternatively try on a different device.";msgText+="

Missing features: "+missingFeatures.join(", ")+"
User agent: "+navigator.userAgent+"
";msgBody.innerHTML=msgText;msgWrap.appendChild(msgBody)}})(); diff --git a/basketrandom/test.png b/basketrandom/test.png new file mode 100644 index 00000000..5adfdce9 Binary files /dev/null and b/basketrandom/test.png differ diff --git a/boxingrandom/.gitattributes b/boxingrandom/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/boxingrandom/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/boxingrandom/512x340.jpg b/boxingrandom/512x340.jpg new file mode 100644 index 00000000..61fe0856 Binary files /dev/null and b/boxingrandom/512x340.jpg differ diff --git a/boxingrandom/512x384.jpg b/boxingrandom/512x384.jpg new file mode 100644 index 00000000..2f9a9816 Binary files /dev/null and b/boxingrandom/512x384.jpg differ diff --git a/boxingrandom/512x512.jpg b/boxingrandom/512x512.jpg new file mode 100644 index 00000000..596b4c9f Binary files /dev/null and b/boxingrandom/512x512.jpg differ diff --git a/boxingrandom/appmanifest.json b/boxingrandom/appmanifest.json new file mode 100644 index 00000000..98e76eb6 --- /dev/null +++ b/boxingrandom/appmanifest.json @@ -0,0 +1,10 @@ +{ + "name": "Boxing Random", + "short_name": "Boxing Random", + "description": "", + "start_url": "index.html", + "display": "fullscreen", + "orientation": "landscape", + "background_color": "#000000", + "icons": [] +} \ No newline at end of file diff --git a/boxingrandom/box2d.wasm b/boxingrandom/box2d.wasm new file mode 100644 index 00000000..106566ad Binary files /dev/null and b/boxingrandom/box2d.wasm differ diff --git a/boxingrandom/box2d.wasm.js b/boxingrandom/box2d.wasm.js new file mode 100644 index 00000000..630d78b3 --- /dev/null +++ b/boxingrandom/box2d.wasm.js @@ -0,0 +1,577 @@ +self.Box2DWasmModule = function(Box2D) { + Box2D = Box2D || {}; + var Module = Box2D; + +var b;b||(b=eval("(function() { try { return Box2D || {} } catch(e) { return {} } })()"));var aa={},ba;for(ba in b)b.hasOwnProperty(ba)&&(aa[ba]=b[ba]);var ca=!1,da=!1,ea=!1,fa=!1; +if(b.ENVIRONMENT)if("WEB"===b.ENVIRONMENT)ca=!0;else if("WORKER"===b.ENVIRONMENT)da=!0;else if("NODE"===b.ENVIRONMENT)ea=!0;else if("SHELL"===b.ENVIRONMENT)fa=!0;else throw Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ca="object"===typeof window,da="function"===typeof importScripts,ea="object"===typeof process&&"function"===typeof require&&!ca&&!da,fa=!ca&&!ea&&!da; +if(ea){b.print||(b.print=console.log);b.printErr||(b.printErr=console.warn);var ga,ha;b.read=function(a,c){ga||(ga=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);var d=ga.readFileSync(a);return c?d:d.toString()};b.readBinary=function(a){a=b.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};b.load=function(a){ia(read(a))};b.thisProgram||(b.thisProgram=1 0) var gc = undefined");else if(ca||da)b.read=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},da&&(b.readBinary=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}), +b.readAsync=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)},"undefined"!=typeof arguments&&(b.arguments=arguments),"undefined"!==typeof console?(b.print||(b.print=function(a){console.log(a)}),b.printErr||(b.printErr=function(a){console.warn(a)})):b.print||(b.print=function(){}),da&&(b.load=importScripts),"undefined"===typeof b.setWindowTitle&&(b.setWindowTitle= +function(a){document.title=a});else throw"Unknown runtime environment. Where are we?";function ia(a){eval.call(null,a)}!b.load&&b.read&&(b.load=function(a){ia(b.read(a))});b.print||(b.print=function(){});b.printErr||(b.printErr=b.print);b.arguments||(b.arguments=[]);b.thisProgram||(b.thisProgram="./this.program");b.quit||(b.quit=function(a,c){throw c;});b.print=b.print;b.h=b.printErr;b.preRun=[];b.postRun=[];for(ba in aa)aa.hasOwnProperty(ba)&&(b[ba]=aa[ba]); +var aa=void 0,f={f:function(a){return tempRet0=a},H:function(){return tempRet0},L:function(){return ka},K:function(a){ka=a},s:function(a){switch(a){case "i1":case "i8":return 1;case "i16":return 2;case "i32":return 4;case "i64":return 8;case "float":return 4;case "double":return 8;default:return"*"===a[a.length-1]?f.j:"i"===a[0]?(a=parseInt(a.substr(1)),assert(0===a%8),a/8):0}},F:function(a){return Math.max(f.s(a),f.j)},M:16,aa:function(a,c){"double"===c||"i64"===c?a&7&&(assert(4===(a&7)),a+=4):assert(0=== +(a&3));return a},U:function(a,c,d){return d||"i64"!=a&&"double"!=a?a?Math.min(c||(a?f.F(a):0),f.j):Math.min(c,8):8},l:function(a,c,d){return d&&d.length?b["dynCall_"+a].apply(null,[c].concat(d)):b["dynCall_"+a].call(null,c)},d:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],v:function(a){for(var c=0;c>2];a=(c+a+15|0)&-16;ma[oa>>2]=a;return a>=pa&&!qa()?(ma[oa>>2]=c,0):c},p:function(a,c){return Math.ceil(a/(c?c:16))*(c?c:16)},$:function(a,c,d){return d?+(a>>>0)+4294967296*+(c>>>0):+(a>>>0)+4294967296*+(c|0)},i:1024,j:4,N:0};f.addFunction=f.v;f.removeFunction=f.J;var ra=0;function assert(a,c){a||ta("Assertion failed: "+c)} +function ua(a){var c;c="i32";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return va[a>>0];case "i8":return va[a>>0];case "i16":return ya[a>>1];case "i32":return ma[a>>2];case "i64":return ma[a>>2];case "float":return za[a>>2];case "double":return Aa[a>>3];default:ta("invalid type for setValue: "+c)}return null} +function Ba(a,c,d){var e,g,l;"number"===typeof a?(g=!0,l=a):(g=!1,l=a.length);var m="string"===typeof c?c:null,D;4==d?D=e:D=["function"===typeof Ca?Ca:f.u,f.t,f.u,f.D][void 0===d?2:d](Math.max(l,m?1:c.length));if(g){e=D;assert(0==(D&3));for(a=D+(l&-4);e>2]=0;for(a=D+l;e>0]=0;return D}if("i8"===m)return a.subarray||a.slice?Da.set(a,D):Da.set(new Uint8Array(a),D),D;e=0;for(var na,wa;e>0]=G;break;case "i8":va[g>>0]=G;break;case "i16":ya[g>>1]=G;break;case "i32":ma[g>>2]=G;break;case "i64":tempI64=[G>>>0,(tempDouble=G,1<=+Ea(tempDouble)?0>>0:~~+Ia((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)];ma[g>>2]=tempI64[0];ma[g+4>>2]=tempI64[1];break;case "float":za[g>>2]=G;break;case "double":Aa[g>>3]=G;break;default:ta("invalid type for setValue: "+ +Ga)}wa!==d&&(na=f.s(d),wa=d);e+=na}}return D}function Ja(a){var c;if(0===c||!a)return"";for(var d=0,e,g=0;;){e=Da[a+g>>0];d|=e;if(0==e&&!c)break;g++;if(c&&g==c)break}c||(c=g);e="";if(128>d){for(;0=l&&(l=65536+((l&1023)<<10)|a.charCodeAt(++g)&1023);if(127>=l){if(d>=e)break;c[d++]=l}else{if(2047>=l){if(d+1>=e)break;c[d++]=192|l>>6}else{if(65535>=l){if(d+2>=e)break;c[d++]=224|l>>12}else{if(2097151>=l){if(d+3>=e)break;c[d++]=240|l>>18}else{if(67108863>=l){if(d+4>=e)break;c[d++]=248|l>>24}else{if(d+5>=e)break;c[d++]=252|l>>30;c[d++]=128|l>>24&63}c[d++]=128|l>>18&63}c[d++]=128|l>>12&63}c[d++]= +128|l>>6&63}c[d++]=128|l&63}}c[d]=0}}function Oa(a){for(var c=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le"); +function Pa(a){return a.replace(/__Z[\w\d_]+/g,function(a){var d;a:{var e=b.___cxa_demangle||b.__cxa_demangle;if(e)try{var g=a.substr(1),l=Oa(g)+1,m=Ca(l);La(g,Da,m,l);var D=Ca(4),na=e(m,0,0,D);if(0===ua(D)&&na){d=Ja(na);break a}}catch(wa){}finally{m&&Qa(m),D&&Qa(D),na&&Qa(na)}else f.g("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");d=a}return a===d?a:a+" ["+d+"]"})} +function Ra(){var a;a:{a=Error();if(!a.stack){try{throw Error(0);}catch(c){a=c}if(!a.stack){a="(no stack trace available)";break a}}a=a.stack.toString()}b.extraStackTrace&&(a+="\n"+b.extraStackTrace());return Pa(a)}var Sa=65536,Ua=16777216,Va=16777216;function Wa(a,c){0>2]>c)return!1;var d=pa;for(pa=Math.max(pa,Va);pa>2];)536870912>=pa?pa=Wa(2*pa,a):pa=Math.min(Wa((3*pa+2147483648)/4,a),c);a=b.reallocBuffer(pa);if(!a||a.byteLength!=pa)return pa=d,!1;b.buffer=buffer=a;Za();return!0}var eb; +try{eb=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),eb(new ArrayBuffer(4))}catch(fb){eb=function(a){return a.byteLength}}var gb=b.TOTAL_STACK||5242880,pa=b.TOTAL_MEMORY||16777216;pa>>16)*e+d*(c>>>16)<<16)|0});Math.Y=Math.imul; +if(!Math.fround){var sb=new Float32Array(1);Math.fround=function(a){sb[0]=a;return sb[0]}}Math.S=Math.fround;Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var c=0;32>c;c++)if(a&1<<31-c)return c;return 32});Math.P=Math.clz32;Math.trunc||(Math.trunc=function(a){return 0>a?Math.ceil(a):Math.floor(a)});Math.trunc=Math.trunc;var Ea=Math.abs,Ia=Math.ceil,Ha=Math.floor,Fa=Math.min,tb=0,vb=null,wb=null;function xb(){tb++;b.monitorRunDependencies&&b.monitorRunDependencies(tb)} +function yb(){tb--;b.monitorRunDependencies&&b.monitorRunDependencies(tb);if(0==tb&&(null!==vb&&(clearInterval(vb),vb=null),wb)){var a=wb;wb=null;a()}}b.preloadedImages={};b.preloadedAudios={};var zb=null; +(function(a){function c(c){c=Wa(c,a.usingWasm?Sa:Ua);var d=a.buffer,e=d.byteLength;if(a.usingWasm)try{return-1!==a.wasmMemory.grow((c-e)/65536)?a.buffer=a.wasmMemory.buffer:null}catch(g){return null}else return lb.__growWasmMemory((c-e)/65536),a.buffer!==d?a.buffer:null}function d(a,c){var d=Ta;if(0>a.indexOf("."))d=(d||{})[a];else var e=a.split("."),d=(d||{})[e[0]],d=(d||{})[e[1]];c&&(d=(d||{})[c]);void 0===d&&ta("bad lookupImport to ("+a+")."+c);return d}function e(c){var d=a.buffer;c.byteLength< +d.byteLength&&a.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var d=new Int8Array(d),e=new Int8Array(c);zb||d.set(e.subarray(a.STATIC_BASE,a.STATIC_BASE+a.STATIC_BUMP),a.STATIC_BASE);e.set(d);b.buffer=buffer=c;Za()}function g(){try{var c;if(a.wasmBinary)c=a.wasmBinary,c=new Uint8Array(c);else if(a.readBinary)c=a.readBinary(G);else throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"; +return c}catch(d){ta(d)}}function l(){return a.wasmBinary||"function"!==typeof fetch?new Promise(function(a){a(g())}):fetch(G,{Q:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()})}function m(c,d,e){if("function"!==typeof a.asm||a.asm===Ma)a.asmPreload?a.asm=a.asmPreload:eval(a.read(Ga));return"function"!==typeof a.asm?(a.printErr("asm evalling did not set the module properly"),!1):a.asm(c,d,e)}function D(c,d){function g(c){lb=c.exports; +lb.memory&&e(lb.memory);a.asm=lb;a.usingWasm=!0;yb()}if("object"!==typeof WebAssembly)return a.printErr("no native wasm support detected"),!1;if(!(a.wasmMemory instanceof WebAssembly.Memory))return a.printErr("no native wasm Memory in use"),!1;d.memory=a.wasmMemory;Ta.global={NaN:NaN,Infinity:Infinity};Ta["global.Math"]=c.Math;Ta.env=d;xb();if(a.instantiateWasm)try{return a.instantiateWasm(Ta,g)}catch(m){return a.printErr("Module.instantiateWasm callback failed with error: "+m),!1}l().then(function(a){return WebAssembly.instantiate(a, +Ta)}).then(function(a){g(a.instance)}).catch(function(c){a.printErr("failed to asynchronously prepare wasm: "+c);ta(c)});return{}}var na=a.wasmJSMethod||"native-wasm";a.wasmJSMethod=na;var wa=a.wasmTextFile||"Box2D_v2.3.1_min.wasm.wast",G=a.wasmBinaryFile||"Box2D_v2.3.1_min.wasm.wasm",Ga=a.asmjsCodeFile||"Box2D_v2.3.1_min.wasm.temp.asm.js";"function"===typeof a.locateFile&&(wa=a.locateFile(wa),G=a.locateFile(G),Ga=a.locateFile(Ga));var Ta={global:null,env:null,asm2wasm:{"f64-rem":function(a,c){return a% +c},"f64-to-int":function(a){return a|0},"i32s-div":function(a,c){return(a|0)/(c|0)|0},"i32u-div":function(a,c){return(a>>>0)/(c>>>0)>>>0},"i32s-rem":function(a,c){return(a|0)%(c|0)|0},"i32u-rem":function(a,c){return(a>>>0)%(c>>>0)>>>0},"debugger":function(){debugger}},parent:a},lb=null;a.asmPreload=a.asm;var ub=a.reallocBuffer;a.reallocBuffer=function(a){return"asmjs"===qc?ub(a):c(a)};var qc="";a.asm=function(c,l,G){if(!l.table){var Ma=a.wasmTableSize;void 0===Ma&&(Ma=1024);var mb=a.wasmMaxTableSize; +l.table="object"===typeof WebAssembly&&"function"===typeof WebAssembly.Table?void 0!==mb?new WebAssembly.Table({initial:Ma,maximum:mb,element:"anyfunc"}):new WebAssembly.Table({initial:Ma,element:"anyfunc"}):Array(Ma);a.wasmTable=l.table}l.memoryBase||(l.memoryBase=a.STATIC_BASE);l.tableBase||(l.tableBase=0);for(var V,Ma=na.split(","),mb=0;mb>2]}var Lb={},Mb={};b._sbrk=Nb;var Ob=1; +function Pb(){var a=Eb;if(!a)return(f.f(0),0)|0;var c=Gb[a],d=c.type;if(!d)return(f.f(0),a)|0;var e=Array.prototype.slice.call(arguments);b.___cxa_is_pointer_type(d);Pb.buffer||(Pb.buffer=Ca(4));ma[Pb.buffer>>2]=a;for(var a=Pb.buffer,g=0;g>2],c.w=a,(f.f(e[g]),a)|0;a=ma[a>>2];return(f.f(d),a)|0}b._llvm_bswap_i32=Qb; +function Rb(a,c){Jb=c;try{var d=Kb(),e=Kb(),g=Kb(),l=0;Rb.buffer||(Rb.e=[null,[],[]],Rb.q=function(a,c){var d=Rb.e[a];assert(d);if(0===c||10===c){var e=1===a?b.print:b.printErr,g;a:{for(var l=g=0;d[l];)++l;if(16m?l+=String.fromCharCode(m):(m-=65536,l+=String.fromCharCode(55296|m>>10,56320|m&1023)))):l+=String.fromCharCode(m)}}e(g);d.length=0}else d.push(c)});for(var m=0;m>2],na=ma[e+(8*m+4)>>2],wa=0;wa>2]=cb;b.wasmTableSize=1152;b.wasmMaxTableSize=1152;b.A={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:Infinity,byteLength:eb}; +b.B={abort:ta,assert:assert,enlargeMemory:qa,getTotalMemory:function(){return pa},abortOnCannotGrowMemory:function(){ta("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+pa+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},invoke_iiii:function(a,c,d,e){try{return b.dynCall_iiii(a,c,d,e)}catch(g){if("number"!== +typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_iiii:function(a,c,d,e){return f.d[a](c,d,e)},invoke_viifii:function(a,c,d,e,g,l){try{b.dynCall_viifii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viifii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_viiiii:function(a,c,d,e,g,l){try{b.dynCall_viiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viiiii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_vi:function(a, +c){try{b.dynCall_vi(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_vi:function(a,c){f.d[a](c)},invoke_vii:function(a,c,d){try{b.dynCall_vii(a,c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_vii:function(a,c,d){f.d[a](c,d)},invoke_ii:function(a,c){try{return b.dynCall_ii(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_ii:function(a,c){return f.d[a](c)},invoke_fif:function(a,c,d){try{return b.dynCall_fif(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_fif:function(a,c,d){return f.d[a](c,d)},invoke_viii:function(a,c,d,e){try{b.dynCall_viii(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viii:function(a,c,d,e){f.d[a](c,d,e)},invoke_viifi:function(a,c,d,e,g){try{b.dynCall_viifi(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viifi:function(a,c,d,e,g){f.d[a](c,d,e,g)},invoke_v:function(a){try{b.dynCall_v(a)}catch(c){if("number"!== +typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},jsCall_v:function(a){f.d[a]()},invoke_viif:function(a,c,d,e){try{b.dynCall_viif(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viif:function(a,c,d,e){f.d[a](c,d,e)},invoke_viiiiii:function(a,c,d,e,g,l,m){try{b.dynCall_viiiiii(a,c,d,e,g,l,m)}catch(D){if("number"!==typeof D&&"longjmp"!==D)throw D;b.setThrew(1,0)}},jsCall_viiiiii:function(a,c,d,e,g,l,m){f.d[a](c,d,e,g,l,m)},invoke_iii:function(a,c,d){try{return b.dynCall_iii(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_iii:function(a,c,d){return f.d[a](c,d)},invoke_iiiiii:function(a,c,d,e,g,l){try{return b.dynCall_iiiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_iiiiii:function(a,c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_fiiiif:function(a,c,d,e,g,l){try{return b.dynCall_fiiiif(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_fiiiif:function(a, +c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_viiii:function(a,c,d,e,g){try{b.dynCall_viiii(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viiii:function(a,c,d,e,g){f.d[a](c,d,e,g)},_emscripten_asm_const_iiiii:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_emscripten_asm_const_diiiid:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},_pthread_key_create:function(a){if(0==a)return 22;ma[a>>2]=Ob;Mb[Ob]=0;Ob++;return 0},_abort:function(){b.abort()},___gxx_personality_v0:function(){}, +_emscripten_asm_const_iiidii:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},___assert_fail:function(a,c,d,e){ra=!0;throw"Assertion failed: "+Ja(a)+", at: "+[c?Ja(c):"unknown filename",d,e?Ja(e):"unknown function"]+" at "+Ra();},__ZSt18uncaught_exceptionv:Db,___setErrNo:function(a){b.___errno_location&&(ma[b.___errno_location()>>2]=a);return a},___cxa_begin_catch:function(a){var c=Gb[a];c&&!c.C&&(c.C=!0,Db.e--);c&&(c.da=!1);Fb.push(a);a:{if(a&&!Gb[a])for(var d in Gb)if(Gb[d].w===a){c=d;break a}c=a}c&& +Gb[c].ba++;return a},_emscripten_memcpy_big:function(a,c,d){Da.set(Da.subarray(c,c+d),a);return a},___resumeException:function(a){Eb||(Eb=a);throw a+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";},___cxa_find_matching_catch:Pb,_pthread_getspecific:function(a){return Mb[a]||0},_pthread_once:Hb,___syscall54:function(a,c){Jb=c;return 0},_emscripten_asm_const_iii:function(a,c,d){return Ab[a](c, +d)},_emscripten_asm_const_iiidi:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_pthread_setspecific:function(a,c){if(!(a in Mb))return 22;Mb[a]=c;return 0},_emscripten_asm_const_iiii:function(a,c,d,e){return Ab[a](c,d,e)},___syscall6:function(a,c){Jb=c;try{var d=Lb.G();FS.close(d);return 0}catch(e){return"undefined"!==typeof FS&&e instanceof FS.o||ta(e),-e.r}},___syscall140:function(a,c){Jb=c;try{var d=Lb.G();Kb();var e=Kb(),g=Kb(),l=Kb();FS.Z(d,e,l);ma[g>>2]=d.position;d.I&&0===e&&0===l&&(d.I=null); +return 0}catch(m){return"undefined"!==typeof FS&&m instanceof FS.o||ta(m),-m.r}},___cxa_pure_virtual:function(){ra=!0;throw"Pure virtual function called!";},___syscall146:Rb,DYNAMICTOP_PTR:oa,tempDoublePtr:Bb,ABORT:ra,STACKTOP:ka,STACK_MAX:bb};var Sb=b.asm(b.A,b.B,buffer);b.asm=Sb; +var Tb=b._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0.apply(null,arguments)},Ub=b._emscripten_bind_b2ContactEdge_set_next_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_next_1.apply(null,arguments)},Vb=b._emscripten_bind_b2ChainShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_count_0.apply(null,arguments)},Wb=b._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0.apply(null, +arguments)},Xb=b._emscripten_bind_b2PulleyJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_SetUserData_1.apply(null,arguments)},Yb=b._emscripten_bind_b2Shape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2Shape_ComputeAABB_3.apply(null,arguments)},Zb=b._emscripten_bind_b2FrictionJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_userData_1.apply(null,arguments)},$b=b._emscripten_bind_b2MouseJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MouseJoint_IsActive_0.apply(null, +arguments)},ac=b._emscripten_bind_b2World_IsLocked_0=function(){return b.asm._emscripten_bind_b2World_IsLocked_0.apply(null,arguments)},bc=b._emscripten_bind_b2Draw_GetFlags_0=function(){return b.asm._emscripten_bind_b2Draw_GetFlags_0.apply(null,arguments)},cc=b._emscripten_bind_b2FrictionJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_IsActive_0.apply(null,arguments)},dc=b._emscripten_bind_b2Color_set_g_1=function(){return b.asm._emscripten_bind_b2Color_set_g_1.apply(null, +arguments)},ec=b._emscripten_bind_b2PolygonShape_RayCast_4=function(){return b.asm._emscripten_bind_b2PolygonShape_RayCast_4.apply(null,arguments)},fc=b._emscripten_bind_b2World_GetTreeBalance_0=function(){return b.asm._emscripten_bind_b2World_GetTreeBalance_0.apply(null,arguments)},gc=b._emscripten_bind_b2ChainShape_get_m_vertices_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_vertices_0.apply(null,arguments)},hc=b._emscripten_bind_JSDraw_DrawSolidCircle_4=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidCircle_4.apply(null, +arguments)},ic=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0.apply(null,arguments)},jc=b._emscripten_bind_b2FixtureDef_get_filter_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_filter_0.apply(null,arguments)},kc=b._emscripten_bind_b2FrictionJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_type_0.apply(null,arguments)},lc=b._emscripten_bind_b2MotorJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_type_1.apply(null, +arguments)},mc=b._emscripten_bind_b2FixtureDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_userData_1.apply(null,arguments)},nc=b._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1.apply(null,arguments)},oc=b._emscripten_bind_b2JointEdge_set_joint_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_joint_1.apply(null,arguments)},pc=b._emscripten_bind_b2Fixture___destroy___0=function(){return b.asm._emscripten_bind_b2Fixture___destroy___0.apply(null, +arguments)},rc=b._emscripten_bind_b2World_SetWarmStarting_1=function(){return b.asm._emscripten_bind_b2World_SetWarmStarting_1.apply(null,arguments)},sc=b._emscripten_bind_JSDraw_DrawCircle_3=function(){return b.asm._emscripten_bind_JSDraw_DrawCircle_3.apply(null,arguments)},tc=b._emscripten_bind_b2WeldJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WeldJoint_IsActive_0.apply(null,arguments)},uc=b._emscripten_bind_b2DestructionListener___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListener___destroy___0.apply(null, +arguments)},vc=b._emscripten_bind_b2BodyDef_set_type_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_type_1.apply(null,arguments)},wc=b._emscripten_bind_b2ChainShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeAABB_3.apply(null,arguments)},xc=b._emscripten_bind_b2PulleyJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetUserData_0.apply(null,arguments)},yc=b._emscripten_bind_b2WeldJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionTorque_1.apply(null, +arguments)},zc=b._emscripten_bind_b2MotorJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxForce_0.apply(null,arguments)},Ac=b._emscripten_bind_b2DistanceJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_userData_0.apply(null,arguments)},Bc=b._emscripten_bind_b2BodyDef_get_position_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_position_0.apply(null,arguments)},Cc=b._emscripten_bind_b2RevoluteJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_userData_1.apply(null,arguments)},Dc=b._emscripten_bind_b2WorldManifold_b2WorldManifold_0=function(){return b.asm._emscripten_bind_b2WorldManifold_b2WorldManifold_0.apply(null,arguments)},Ec=b._emscripten_bind_b2WheelJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_collideConnected_0.apply(null,arguments)},Fc=b._emscripten_bind_b2MouseJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_userData_1.apply(null, +arguments)};b.stackSave=function(){return b.asm.stackSave.apply(null,arguments)}; +var Gc=b._emscripten_bind_b2FixtureDef_set_restitution_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_restitution_1.apply(null,arguments)},Hc=b._emscripten_bind_b2RevoluteJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUserData_0.apply(null,arguments)},Ic=b._emscripten_bind_b2Mat33_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ey_0.apply(null,arguments)},Jc=b._emscripten_bind_b2MouseJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetCollideConnected_0.apply(null, +arguments)},Kc=b._emscripten_bind_b2World_GetGravity_0=function(){return b.asm._emscripten_bind_b2World_GetGravity_0.apply(null,arguments)},Lc=b._emscripten_bind_b2Mat33_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ey_1.apply(null,arguments)},Mc=b._emscripten_bind_b2Profile_get_broadphase_0=function(){return b.asm._emscripten_bind_b2Profile_get_broadphase_0.apply(null,arguments)},Nc=b._emscripten_bind_b2PulleyJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyA_0.apply(null, +arguments)},Oc=b._emscripten_bind_b2PrismaticJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetLimits_2.apply(null,arguments)},Pc=b._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0.apply(null,arguments)},Qc=b._emscripten_bind_b2DistanceJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorA_0.apply(null,arguments)},Rc=b._emscripten_bind_b2DistanceJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_userData_1.apply(null,arguments)},Sc=b._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1.apply(null,arguments)},Tc=b._emscripten_bind_b2RopeJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_collideConnected_1.apply(null,arguments)},Uc=b._emscripten_bind_b2ChainShape_set_m_nextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_nextVertex_1.apply(null, +arguments)},Vc=b._emscripten_bind_JSContactListener_EndContact_1=function(){return b.asm._emscripten_bind_JSContactListener_EndContact_1.apply(null,arguments)},Wc=b._emscripten_bind_b2MassData_set_mass_1=function(){return b.asm._emscripten_bind_b2MassData_set_mass_1.apply(null,arguments)},Xc=b._emscripten_bind_b2Vec3_get_x_0=function(){return b.asm._emscripten_bind_b2Vec3_get_x_0.apply(null,arguments)},Yc=b._emscripten_bind_b2ChainShape_CreateChain_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateChain_2.apply(null, +arguments)},Zc=b._emscripten_bind_b2RopeJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetUserData_0.apply(null,arguments)},$c=b._emscripten_bind_b2World_DestroyBody_1=function(){return b.asm._emscripten_bind_b2World_DestroyBody_1.apply(null,arguments)},ad=b._emscripten_bind_b2Profile_get_solvePosition_0=function(){return b.asm._emscripten_bind_b2Profile_get_solvePosition_0.apply(null,arguments)},bd=b._emscripten_bind_b2Shape_RayCast_4=function(){return b.asm._emscripten_bind_b2Shape_RayCast_4.apply(null, +arguments)},cd=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0.apply(null,arguments)},dd=b._emscripten_bind_b2Mat33___destroy___0=function(){return b.asm._emscripten_bind_b2Mat33___destroy___0.apply(null,arguments)},ed=b._emscripten_bind_b2GearJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionTorque_1.apply(null,arguments)},fd=b._emscripten_bind_b2WeldJointDef_set_collideConnected_1= +function(){return b.asm._emscripten_bind_b2WeldJointDef_set_collideConnected_1.apply(null,arguments)},gd=b._emscripten_bind_b2JointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2JointDef_get_collideConnected_0.apply(null,arguments)};b.getTempRet0=function(){return b.asm.getTempRet0.apply(null,arguments)}; +var hd=b._emscripten_bind_b2FrictionJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxTorque_0.apply(null,arguments)},id=b._emscripten_bind_JSQueryCallback_JSQueryCallback_0=function(){return b.asm._emscripten_bind_JSQueryCallback_JSQueryCallback_0.apply(null,arguments)},jd=b._emscripten_bind_b2World_SetAutoClearForces_1=function(){return b.asm._emscripten_bind_b2World_SetAutoClearForces_1.apply(null,arguments)},kd=b._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1= +function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1.apply(null,arguments)},ld=b._emscripten_bind_b2Contact_GetTangentSpeed_0=function(){return b.asm._emscripten_bind_b2Contact_GetTangentSpeed_0.apply(null,arguments)},md=b._emscripten_bind_b2BodyDef_set_position_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_position_1.apply(null,arguments)},nd=b._emscripten_bind_b2Transform_get_q_0=function(){return b.asm._emscripten_bind_b2Transform_get_q_0.apply(null,arguments)}, +od=b._emscripten_bind_b2PolygonShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_count_1.apply(null,arguments)},pd=b._emscripten_bind_b2Contact_GetNext_0=function(){return b.asm._emscripten_bind_b2Contact_GetNext_0.apply(null,arguments)},qd=b._emscripten_bind_b2MotorJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_userData_1.apply(null,arguments)},rd=b._emscripten_bind_b2GearJoint_GetJoint1_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint1_0.apply(null, +arguments)},sd=b._emscripten_bind_b2World_GetProxyCount_0=function(){return b.asm._emscripten_bind_b2World_GetProxyCount_0.apply(null,arguments)},td=b._emscripten_bind_b2MotorJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxTorque_1.apply(null,arguments)},ud=b._emscripten_bind_b2GearJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorA_0.apply(null,arguments)},vd=b._emscripten_bind_b2MouseJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyA_1.apply(null, +arguments)},wd=b._emscripten_bind_b2World_SetContactListener_1=function(){return b.asm._emscripten_bind_b2World_SetContactListener_1.apply(null,arguments)},xd=b._emscripten_bind_b2Body_IsAwake_0=function(){return b.asm._emscripten_bind_b2Body_IsAwake_0.apply(null,arguments)},yd=b._emscripten_bind_b2JointEdge_set_other_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_other_1.apply(null,arguments)},zd=b._emscripten_bind_b2MouseJointDef_set_target_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_target_1.apply(null, +arguments)},db=b._emscripten_replace_memory=function(){return b.asm._emscripten_replace_memory.apply(null,arguments)},Ad=b._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1.apply(null,arguments)},Bd=b._emscripten_bind_b2FixtureDef_get_density_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_density_0.apply(null,arguments)},Cd=b._emscripten_bind_b2GearJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetRatio_0.apply(null, +arguments)},Dd=b._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0.apply(null,arguments)},Ed=b._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0.apply(null,arguments)},Fd=b._emscripten_bind_b2MotorJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_collideConnected_0.apply(null,arguments)}, +Gd=b._emscripten_enum_b2ManifoldType_e_circles=function(){return b.asm._emscripten_enum_b2ManifoldType_e_circles.apply(null,arguments)},Hd=b._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1.apply(null,arguments)},Id=b._emscripten_bind_b2RevoluteJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_Initialize_3.apply(null,arguments)},Jd=b._emscripten_bind_b2FixtureDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_userData_0.apply(null, +arguments)},Kd=b._emscripten_bind_b2DistanceJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetUserData_0.apply(null,arguments)},Ld=b._emscripten_bind_b2FrictionJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_collideConnected_1.apply(null,arguments)},Md=b._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0.apply(null,arguments)},Nd= +b._emscripten_bind_b2GearJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetCollideConnected_0.apply(null,arguments)},Od=b._emscripten_bind_b2Filter_b2Filter_0=function(){return b.asm._emscripten_bind_b2Filter_b2Filter_0.apply(null,arguments)},Pd=b._emscripten_bind_b2MouseJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_type_1.apply(null,arguments)},Qd=b._emscripten_bind_b2Body_ApplyAngularImpulse_2=function(){return b.asm._emscripten_bind_b2Body_ApplyAngularImpulse_2.apply(null, +arguments)},Rd=b._emscripten_enum_b2JointType_e_frictionJoint=function(){return b.asm._emscripten_enum_b2JointType_e_frictionJoint.apply(null,arguments)},Sd=b._emscripten_bind_b2RayCastOutput_set_fraction_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_fraction_1.apply(null,arguments)},Td=b._emscripten_bind_b2Color_set_r_1=function(){return b.asm._emscripten_bind_b2Color_set_r_1.apply(null,arguments)},Ud=b._emscripten_bind_b2DistanceJointDef_get_length_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_length_0.apply(null, +arguments)},Vd=b._emscripten_bind_b2PulleyJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyB_0.apply(null,arguments)},Wd=b._emscripten_bind_b2WheelJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_type_1.apply(null,arguments)},Xd=b._emscripten_bind_b2World_GetTreeQuality_0=function(){return b.asm._emscripten_bind_b2World_GetTreeQuality_0.apply(null,arguments)},Yd=b._emscripten_bind_b2BodyDef_set_gravityScale_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_gravityScale_1.apply(null, +arguments)},Zd=b._emscripten_bind_b2RopeJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyB_1.apply(null,arguments)},$d=b._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0.apply(null,arguments)},ae=b._emscripten_bind_b2AABB_get_lowerBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_lowerBound_0.apply(null,arguments)},be=b._emscripten_bind_b2WheelJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMotorSpeed_1.apply(null, +arguments)},ce=b._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0.apply(null,arguments)},de=b._emscripten_bind_b2Body_SetMassData_1=function(){return b.asm._emscripten_bind_b2Body_SetMassData_1.apply(null,arguments)},ee=b._emscripten_bind_b2BodyDef_get_angularVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularVelocity_0.apply(null,arguments)},fe=b._emscripten_bind_b2WeldJoint_SetDampingRatio_1= +function(){return b.asm._emscripten_bind_b2WeldJoint_SetDampingRatio_1.apply(null,arguments)},ge=b._emscripten_bind_b2PrismaticJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef___destroy___0.apply(null,arguments)},he=b._emscripten_bind_b2Contact_IsTouching_0=function(){return b.asm._emscripten_bind_b2Contact_IsTouching_0.apply(null,arguments)},ie=b._emscripten_bind_b2Draw_SetFlags_1=function(){return b.asm._emscripten_bind_b2Draw_SetFlags_1.apply(null,arguments)}, +je=b._emscripten_bind_b2AABB_Contains_1=function(){return b.asm._emscripten_bind_b2AABB_Contains_1.apply(null,arguments)},ke=b._emscripten_bind_b2DistanceJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetNext_0.apply(null,arguments)},le=b._emscripten_bind_b2EdgeShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_radius_1.apply(null,arguments)},me=b._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0.apply(null, +arguments)},ne=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0.apply(null,arguments)},oe=b._emscripten_bind_b2PrismaticJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetType_0.apply(null,arguments)},pe=b._emscripten_bind_b2Fixture_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Fixture_GetRestitution_0.apply(null,arguments)},qe=b._emscripten_bind_b2Transform_set_q_1=function(){return b.asm._emscripten_bind_b2Transform_set_q_1.apply(null, +arguments)},re=b._emscripten_bind_b2PolygonShape___destroy___0=function(){return b.asm._emscripten_bind_b2PolygonShape___destroy___0.apply(null,arguments)},se=b._emscripten_bind_b2AABB_get_upperBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_upperBound_0.apply(null,arguments)},te=b._emscripten_bind_b2Transform___destroy___0=function(){return b.asm._emscripten_bind_b2Transform___destroy___0.apply(null,arguments)},ue=b._emscripten_bind_b2Body_GetLinearVelocity_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocity_0.apply(null, +arguments)},ve=b._emscripten_bind_b2CircleShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_radius_1.apply(null,arguments)},we=b._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1.apply(null,arguments)},xe=b._emscripten_bind_b2Contact_GetWorldManifold_1=function(){return b.asm._emscripten_bind_b2Contact_GetWorldManifold_1.apply(null,arguments)},ye=b._emscripten_bind_b2RopeJoint_GetMaxLength_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetMaxLength_0.apply(null, +arguments)},ze=b._emscripten_bind_b2GearJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetUserData_0.apply(null,arguments)},Ae=b._emscripten_bind_b2MotorJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCollideConnected_0.apply(null,arguments)},Be=b._emscripten_bind_b2GearJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_type_1.apply(null,arguments)},Ce=b._emscripten_bind_b2DistanceJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetDampingRatio_1.apply(null, +arguments)},De=b._emscripten_bind_b2Contact_GetFixtureA_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureA_0.apply(null,arguments)},Ee=b._emscripten_bind_b2PulleyJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_ratio_0.apply(null,arguments)},Fe=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0.apply(null,arguments)},Ge=b._emscripten_bind_b2CircleShape_set_m_type_1= +function(){return b.asm._emscripten_bind_b2CircleShape_set_m_type_1.apply(null,arguments)},He=b._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1.apply(null,arguments)},Ie=b._emscripten_bind_b2RopeJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorB_0.apply(null,arguments)},Je=b._emscripten_bind_b2AABB_set_upperBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_upperBound_1.apply(null, +arguments)},Ke=b._emscripten_bind_JSRayCastCallback_ReportFixture_4=function(){return b.asm._emscripten_bind_JSRayCastCallback_ReportFixture_4.apply(null,arguments)},Le=b._emscripten_bind_b2ContactImpulse___destroy___0=function(){return b.asm._emscripten_bind_b2ContactImpulse___destroy___0.apply(null,arguments)},Me=b._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0.apply(null,arguments)},Ne=b._emscripten_bind_b2PulleyJointDef_set_lengthB_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthB_1.apply(null,arguments)},Oe=b._emscripten_bind_b2RayCastInput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastInput___destroy___0.apply(null,arguments)},Pe=b._emscripten_bind_b2Body_ApplyForceToCenter_2=function(){return b.asm._emscripten_bind_b2Body_ApplyForceToCenter_2.apply(null,arguments)},Qe=b._emscripten_bind_JSDestructionListener_JSDestructionListener_0=function(){return b.asm._emscripten_bind_JSDestructionListener_JSDestructionListener_0.apply(null, +arguments)},Re=b._emscripten_bind_b2WheelJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorA_1.apply(null,arguments)},Se=b._emscripten_bind_b2FrictionJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyB_0.apply(null,arguments)},Te=b._emscripten_bind_b2WeldJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyA_1.apply(null,arguments)},Ue=b._emscripten_bind_b2DistanceJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyB_0.apply(null, +arguments)},Ve=b._emscripten_enum_b2JointType_e_wheelJoint=function(){return b.asm._emscripten_enum_b2JointType_e_wheelJoint.apply(null,arguments)},We=b._emscripten_bind_b2JointDef___destroy___0=function(){return b.asm._emscripten_bind_b2JointDef___destroy___0.apply(null,arguments)},Xe=b._emscripten_bind_b2ContactEdge___destroy___0=function(){return b.asm._emscripten_bind_b2ContactEdge___destroy___0.apply(null,arguments)},Ye=b._emscripten_bind_b2Filter_get_groupIndex_0=function(){return b.asm._emscripten_bind_b2Filter_get_groupIndex_0.apply(null, +arguments)},Ze=b._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0.apply(null,arguments)},$e=b._emscripten_bind_b2CircleShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetChildCount_0.apply(null,arguments)},af=b._emscripten_bind_b2BodyDef_get_bullet_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_bullet_0.apply(null,arguments)},bf=b._emscripten_bind_b2Color_set_b_1=function(){return b.asm._emscripten_bind_b2Color_set_b_1.apply(null, +arguments)},cf=b._emscripten_bind_b2Mat33_get_ez_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ez_0.apply(null,arguments)},df=b._emscripten_bind_b2MassData_get_center_0=function(){return b.asm._emscripten_bind_b2MassData_get_center_0.apply(null,arguments)},ef=b._emscripten_bind_b2WeldJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyB_0.apply(null,arguments)},ff=b._emscripten_bind_b2WheelJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionForce_1.apply(null, +arguments)},gf=b._emscripten_bind_b2World_SetSubStepping_1=function(){return b.asm._emscripten_bind_b2World_SetSubStepping_1.apply(null,arguments)},hf=b._emscripten_bind_b2Vec2_op_add_1=function(){return b.asm._emscripten_bind_b2Vec2_op_add_1.apply(null,arguments)},jf=b._emscripten_bind_JSDraw_DrawSegment_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSegment_3.apply(null,arguments)},kf=b._emscripten_bind_b2Joint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2Joint_GetCollideConnected_0.apply(null, +arguments)},lf=b._emscripten_bind_b2MotorJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionTorque_1.apply(null,arguments)},mf=b._emscripten_bind_b2FrictionJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyB_0.apply(null,arguments)},nf=b._emscripten_bind_b2WheelJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJointDef___destroy___0.apply(null,arguments)},of=b._emscripten_bind_b2BodyDef_get_gravityScale_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_gravityScale_0.apply(null,arguments)},pf=b._emscripten_bind_b2Vec3_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec3_SetZero_0.apply(null,arguments)},qf=b._emscripten_enum_b2JointType_e_pulleyJoint=function(){return b.asm._emscripten_enum_b2JointType_e_pulleyJoint.apply(null,arguments)},rf=b._emscripten_bind_b2ChainShape_get_m_nextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_nextVertex_0.apply(null,arguments)}, +sf=b._emscripten_bind_b2Contact_SetEnabled_1=function(){return b.asm._emscripten_bind_b2Contact_SetEnabled_1.apply(null,arguments)},tf=b._emscripten_bind_b2Shape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_radius_1.apply(null,arguments)},uf=b._emscripten_bind_b2World_SetDebugDraw_1=function(){return b.asm._emscripten_bind_b2World_SetDebugDraw_1.apply(null,arguments)},vf=b._emscripten_bind_b2ContactID_set_key_1=function(){return b.asm._emscripten_bind_b2ContactID_set_key_1.apply(null, +arguments)},Ca=b._malloc=function(){return b.asm._malloc.apply(null,arguments)},wf=b._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0.apply(null,arguments)},xf=b._emscripten_bind_b2Vec2_Normalize_0=function(){return b.asm._emscripten_bind_b2Vec2_Normalize_0.apply(null,arguments)},yf=b._emscripten_bind_b2WheelJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointSpeed_0.apply(null,arguments)},zf= +b._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1.apply(null,arguments)},Af=b._emscripten_bind_b2ChainShape_set_m_vertices_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_vertices_1.apply(null,arguments)},Bf=b._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0=function(){return b.asm._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0.apply(null,arguments)},Cf=b._emscripten_bind_b2RayCastInput_set_p2_1= +function(){return b.asm._emscripten_bind_b2RayCastInput_set_p2_1.apply(null,arguments)},Df=b._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0.apply(null,arguments)},Ef=b._emscripten_bind_b2Manifold_get_pointCount_0=function(){return b.asm._emscripten_bind_b2Manifold_get_pointCount_0.apply(null,arguments)},Ff=b._emscripten_bind_b2RayCastOutput_get_normal_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_normal_0.apply(null, +arguments)},Gf=b._emscripten_bind_b2WeldJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyA_0.apply(null,arguments)},Hf=b._emscripten_enum_b2DrawFlag_e_jointBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_jointBit.apply(null,arguments)},If=b._emscripten_bind_b2FixtureDef_get_isSensor_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_isSensor_0.apply(null,arguments)},Jf=b._emscripten_bind_b2PrismaticJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_Initialize_4.apply(null, +arguments)},Kf=b._emscripten_bind_b2PulleyJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyB_1.apply(null,arguments)},Lf=b._emscripten_bind_b2WheelJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJoint_EnableMotor_1.apply(null,arguments)},Mf=b._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0.apply(null,arguments)},Nf=b._emscripten_bind_JSDraw_DrawSolidPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidPolygon_3.apply(null, +arguments)},Of=b._emscripten_bind_b2Rot_Set_1=function(){return b.asm._emscripten_bind_b2Rot_Set_1.apply(null,arguments)},Pf=b._emscripten_bind_b2RevoluteJoint_GetJointAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointAngle_0.apply(null,arguments)},Qf=b._emscripten_bind_JSDraw___destroy___0=function(){return b.asm._emscripten_bind_JSDraw___destroy___0.apply(null,arguments)},Rf=b._emscripten_bind_b2MouseJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJointDef___destroy___0.apply(null, +arguments)},Sf=b._emscripten_bind_b2Mat33_Solve22_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve22_1.apply(null,arguments)},Tf=b._emscripten_bind_b2Profile_set_solvePosition_1=function(){return b.asm._emscripten_bind_b2Profile_set_solvePosition_1.apply(null,arguments)},Uf=b._emscripten_bind_b2ContactFilter___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFilter___destroy___0.apply(null,arguments)},Vf=b._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0.apply(null, +arguments)},Wf=b._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1.apply(null,arguments)},Xf=b._emscripten_bind_b2Joint_SetUserData_1=function(){return b.asm._emscripten_bind_b2Joint_SetUserData_1.apply(null,arguments)},Yf=b._emscripten_bind_b2DistanceJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetUserData_1.apply(null,arguments)},Zf=b._emscripten_bind_b2PrismaticJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJoint___destroy___0.apply(null, +arguments)},$f=b._emscripten_bind_b2RopeJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyA_1.apply(null,arguments)},ag=b._emscripten_bind_b2GearJoint___destroy___0=function(){return b.asm._emscripten_bind_b2GearJoint___destroy___0.apply(null,arguments)},bg=b._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0.apply(null,arguments)},cg=b._emscripten_bind_b2ManifoldPoint_get_id_0= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_id_0.apply(null,arguments)},dg=b._emscripten_bind_b2CircleShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_radius_0.apply(null,arguments)},eg=b._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0.apply(null,arguments)},fg=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0.apply(null, +arguments)},gg=b._emscripten_bind_b2Vec3_op_add_1=function(){return b.asm._emscripten_bind_b2Vec3_op_add_1.apply(null,arguments)},hg=b._emscripten_bind_b2FrictionJoint_GetType_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetType_0.apply(null,arguments)},ig=b._emscripten_bind_b2MouseJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetMaxForce_0.apply(null,arguments)},jg=b._emscripten_bind_b2MouseJoint_SetTarget_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetTarget_1.apply(null, +arguments)},kg=b._emscripten_bind_b2MouseJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_dampingRatio_0.apply(null,arguments)},lg=b._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0.apply(null,arguments)},mg=b._emscripten_bind_b2ChainShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_type_1.apply(null,arguments)},ng=b._emscripten_bind_b2RevoluteJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyB_1.apply(null,arguments)},og=b._emscripten_bind_b2Rot_GetXAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetXAxis_0.apply(null,arguments)},pg=b._emscripten_bind_b2Mat33_b2Mat33_0=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_0.apply(null,arguments)},qg=b._emscripten_bind_b2MouseJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyB_0.apply(null,arguments)},rg=b._emscripten_bind_b2Body_GetWorldVector_1= +function(){return b.asm._emscripten_bind_b2Body_GetWorldVector_1.apply(null,arguments)},sg=b._emscripten_bind_b2WeldJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_frequencyHz_0.apply(null,arguments)},tg=b._emscripten_bind_b2GearJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_ratio_1.apply(null,arguments)},ug=b._emscripten_bind_b2Manifold___destroy___0=function(){return b.asm._emscripten_bind_b2Manifold___destroy___0.apply(null, +arguments)},vg=b._emscripten_bind_b2PulleyJointDef_set_lengthA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthA_1.apply(null,arguments)},wg=b._emscripten_bind_b2Contact_IsEnabled_0=function(){return b.asm._emscripten_bind_b2Contact_IsEnabled_0.apply(null,arguments)};b.stackRestore=function(){return b.asm.stackRestore.apply(null,arguments)}; +var xg=b._emscripten_bind_b2World_CreateJoint_1=function(){return b.asm._emscripten_bind_b2World_CreateJoint_1.apply(null,arguments)},yg=b._emscripten_bind_b2PulleyJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_ratio_1.apply(null,arguments)},zg=b._emscripten_bind_b2JointEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_prev_1.apply(null,arguments)},Ag=b._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1.apply(null, +arguments)},Bg=b._emscripten_bind_b2Body_GetLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalPoint_1.apply(null,arguments)},Cg=b._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0.apply(null,arguments)},Dg=b._emscripten_bind_b2DistanceJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_IsActive_0.apply(null,arguments)},Eg=b._emscripten_bind_b2RopeJoint_GetLimitState_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLimitState_0.apply(null, +arguments)},Fg=b._emscripten_bind_b2Profile_get_solveTOI_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveTOI_0.apply(null,arguments)},Gg=b._emscripten_bind_b2Vec2_b2Vec2_0=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_0.apply(null,arguments)},Hg=b._emscripten_bind_b2DistanceJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorB_0.apply(null,arguments)},Ig=b._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0.apply(null, +arguments)},Jg=b._emscripten_bind_b2Vec2_op_sub_1=function(){return b.asm._emscripten_bind_b2Vec2_op_sub_1.apply(null,arguments)},Kg=b._emscripten_bind_b2CircleShape_get_m_p_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_p_0.apply(null,arguments)},Lg=b._emscripten_bind_b2ContactFeature_get_indexA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexA_0.apply(null,arguments)},Mg=b._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0.apply(null, +arguments)},Ng=b._emscripten_bind_b2RevoluteJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableLimit_1.apply(null,arguments)},Og=b._emscripten_bind_b2ContactEdge_get_next_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_next_0.apply(null,arguments)},Pg=b._emscripten_bind_b2AABB_GetPerimeter_0=function(){return b.asm._emscripten_bind_b2AABB_GetPerimeter_0.apply(null,arguments)},Qg=b._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0.apply(null, +arguments)},Rg=b._emscripten_bind_b2Mat33_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ex_0.apply(null,arguments)},Sg=b._emscripten_bind_b2Body_GetPosition_0=function(){return b.asm._emscripten_bind_b2Body_GetPosition_0.apply(null,arguments)},Tg=b._emscripten_bind_b2Profile___destroy___0=function(){return b.asm._emscripten_bind_b2Profile___destroy___0.apply(null,arguments)},Ug=b._emscripten_bind_b2ContactEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_prev_0.apply(null, +arguments)},Vg=b._emscripten_bind_b2DistanceJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetFrequency_1.apply(null,arguments)},Wg=b._emscripten_bind_b2Fixture_GetBody_0=function(){return b.asm._emscripten_bind_b2Fixture_GetBody_0.apply(null,arguments)},Xg=b._emscripten_bind_b2ContactImpulse_set_count_1=function(){return b.asm._emscripten_bind_b2ContactImpulse_set_count_1.apply(null,arguments)},Yg=b._emscripten_bind_b2FixtureDef_set_shape_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_shape_1.apply(null, +arguments)},Zg=b._emscripten_bind_b2PulleyJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyB_0.apply(null,arguments)},$g=b._emscripten_bind_b2ChainShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildCount_0.apply(null,arguments)},ah=b._emscripten_bind_b2CircleShape_b2CircleShape_0=function(){return b.asm._emscripten_bind_b2CircleShape_b2CircleShape_0.apply(null,arguments)},bh=b._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1.apply(null,arguments)},ch=b._emscripten_bind_b2Fixture_SetDensity_1=function(){return b.asm._emscripten_bind_b2Fixture_SetDensity_1.apply(null,arguments)},dh=b._emscripten_bind_b2ChainShape_get_m_prevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_prevVertex_0.apply(null,arguments)},eh=b._emscripten_bind_b2AABB_GetExtents_0=function(){return b.asm._emscripten_bind_b2AABB_GetExtents_0.apply(null,arguments)}, +fh=b._emscripten_bind_b2World_ClearForces_0=function(){return b.asm._emscripten_bind_b2World_ClearForces_0.apply(null,arguments)},gh=b._emscripten_bind_b2Vec3___destroy___0=function(){return b.asm._emscripten_bind_b2Vec3___destroy___0.apply(null,arguments)},hh=b._emscripten_bind_b2WheelJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_userData_1.apply(null,arguments)},ih=b._emscripten_bind_b2WeldJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetFrequency_1.apply(null, +arguments)},jh=b._emscripten_bind_JSContactListener_PreSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PreSolve_2.apply(null,arguments)},kh=b._emscripten_bind_b2Body_SetFixedRotation_1=function(){return b.asm._emscripten_bind_b2Body_SetFixedRotation_1.apply(null,arguments)},lh=b._emscripten_bind_b2RayCastOutput_set_normal_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_normal_1.apply(null,arguments)},mh=b._emscripten_bind_b2DistanceJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetDampingRatio_0.apply(null, +arguments)},nh=b._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1.apply(null,arguments)},oh=b._emscripten_bind_b2RevoluteJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableMotor_1.apply(null,arguments)},ph=b._emscripten_bind_b2Contact_GetChildIndexB_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexB_0.apply(null,arguments)},qh=b._emscripten_bind_b2MouseJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyB_1.apply(null,arguments)},rh=b._emscripten_bind_b2CircleShape_GetType_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetType_0.apply(null,arguments)},sh=b._emscripten_bind_b2PolygonShape_GetType_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetType_0.apply(null,arguments)},th=b._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1.apply(null, +arguments)},uh=b._emscripten_bind_b2RopeJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_collideConnected_0.apply(null,arguments)},vh=b._emscripten_bind_b2FixtureDef_set_filter_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_filter_1.apply(null,arguments)},wh=b._emscripten_bind_b2Body_ApplyTorque_2=function(){return b.asm._emscripten_bind_b2Body_ApplyTorque_2.apply(null,arguments)},xh=b._emscripten_bind_b2RevoluteJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJoint___destroy___0.apply(null, +arguments)},yh=b._emscripten_bind_b2FrictionJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_userData_0.apply(null,arguments)},zh=b._emscripten_bind_b2RayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastCallback___destroy___0.apply(null,arguments)},Ah=b._emscripten_bind_b2RevoluteJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyA_1.apply(null,arguments)},Bh=b._emscripten_bind_b2MotorJoint_SetUserData_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetUserData_1.apply(null,arguments)},Ch=b._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0.apply(null,arguments)},Dh=b._emscripten_bind_b2MotorJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyB_0.apply(null,arguments)},Eh=b._emscripten_bind_b2Transform_Set_2=function(){return b.asm._emscripten_bind_b2Transform_Set_2.apply(null,arguments)},Fh= +b._emscripten_bind_b2MotorJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyA_0.apply(null,arguments)};b.stackAlloc=function(){return b.asm.stackAlloc.apply(null,arguments)}; +var Gh=b._emscripten_bind_b2Draw_AppendFlags_1=function(){return b.asm._emscripten_bind_b2Draw_AppendFlags_1.apply(null,arguments)},Hh=b._emscripten_bind_b2EdgeShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetChildCount_0.apply(null,arguments)},Ih=b._emscripten_bind_b2Contact_ResetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_ResetFriction_0.apply(null,arguments)},Jh=b._emscripten_bind_b2Profile_set_solveTOI_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveTOI_1.apply(null, +arguments)},Kh=b._emscripten_bind_b2PrismaticJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_type_1.apply(null,arguments)},Lh=b._emscripten_bind_b2AABB_GetCenter_0=function(){return b.asm._emscripten_bind_b2AABB_GetCenter_0.apply(null,arguments)},Mh=b._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1.apply(null,arguments)},Nh=b._emscripten_bind_b2FrictionJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJointDef___destroy___0.apply(null, +arguments)},Oh=b._emscripten_bind_b2PrismaticJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionForce_1.apply(null,arguments)},Ph=b._emscripten_bind_b2Transform_b2Transform_0=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_0.apply(null,arguments)},Qh=b._emscripten_enum_b2LimitState_e_equalLimits=function(){return b.asm._emscripten_enum_b2LimitState_e_equalLimits.apply(null,arguments)},Rh=b._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1.apply(null,arguments)},Sh=b._emscripten_bind_b2Body_IsFixedRotation_0=function(){return b.asm._emscripten_bind_b2Body_IsFixedRotation_0.apply(null,arguments)},Th=b._emscripten_enum_b2DrawFlag_e_shapeBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_shapeBit.apply(null,arguments)},Uh=b._emscripten_bind_b2Contact_GetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_GetFriction_0.apply(null,arguments)},Vh= +b._emscripten_bind_b2Body_GetContactList_0=function(){return b.asm._emscripten_bind_b2Body_GetContactList_0.apply(null,arguments)},Wh=b._emscripten_bind_b2DistanceJointDef_set_length_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_length_1.apply(null,arguments)},Xh=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0.apply(null,arguments)},Yh=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0.apply(null, +arguments)},Zh=b._emscripten_bind_b2World_b2World_1=function(){return b.asm._emscripten_bind_b2World_b2World_1.apply(null,arguments)},$h=b._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0.apply(null,arguments)},ai=b._emscripten_bind_b2DistanceJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_type_0.apply(null,arguments)},bi=b._emscripten_bind_b2Draw_ClearFlags_1=function(){return b.asm._emscripten_bind_b2Draw_ClearFlags_1.apply(null, +arguments)},ci=b._emscripten_bind_b2Body_SetAngularDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularDamping_1.apply(null,arguments)},di=b._emscripten_bind_b2Body_IsActive_0=function(){return b.asm._emscripten_bind_b2Body_IsActive_0.apply(null,arguments)},ei=b._emscripten_bind_b2Contact_ResetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_ResetRestitution_0.apply(null,arguments)},fi=b._emscripten_bind_b2World_GetAllowSleeping_0=function(){return b.asm._emscripten_bind_b2World_GetAllowSleeping_0.apply(null, +arguments)},gi=b._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0.apply(null,arguments)},hi=b._emscripten_bind_b2EdgeShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_type_1.apply(null,arguments)},ii=b._emscripten_enum_b2JointType_e_unknownJoint=function(){return b.asm._emscripten_enum_b2JointType_e_unknownJoint.apply(null,arguments)},ji=b._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1.apply(null,arguments)},ki=b._emscripten_bind_b2PulleyJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_IsActive_0.apply(null,arguments)},li=b._emscripten_bind_b2MouseJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetNext_0.apply(null,arguments)},mi=b._emscripten_bind_b2RevoluteJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetUserData_1.apply(null, +arguments)},ni=b._emscripten_bind_b2Manifold_get_localPoint_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localPoint_0.apply(null,arguments)},oi=b._emscripten_bind_b2PulleyJointDef_get_lengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthB_0.apply(null,arguments)},pi=b._emscripten_bind_b2WeldJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetUserData_1.apply(null,arguments)},qi=b._emscripten_bind_b2ChainShape_CreateLoop_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateLoop_2.apply(null, +arguments)},ri=b._emscripten_bind_b2GearJointDef_get_joint1_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint1_0.apply(null,arguments)},si=b._emscripten_bind_b2PrismaticJoint_GetMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorForce_1.apply(null,arguments)},ti=b._emscripten_bind_b2Body_SetUserData_1=function(){return b.asm._emscripten_bind_b2Body_SetUserData_1.apply(null,arguments)},ui=b._emscripten_bind_b2GearJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2GearJoint_IsActive_0.apply(null, +arguments)},vi=b._emscripten_bind_b2EdgeShape_get_m_vertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex0_0.apply(null,arguments)},wi=b._emscripten_enum_b2JointType_e_revoluteJoint=function(){return b.asm._emscripten_enum_b2JointType_e_revoluteJoint.apply(null,arguments)},xi=b._emscripten_bind_b2Vec2_get_x_0=function(){return b.asm._emscripten_bind_b2Vec2_get_x_0.apply(null,arguments)},yi=b._emscripten_bind_b2WeldJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_collideConnected_0.apply(null, +arguments)},zi=b._emscripten_bind_b2FrictionJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxTorque_0.apply(null,arguments)},Ai=b._emscripten_bind_b2EdgeShape_RayCast_4=function(){return b.asm._emscripten_bind_b2EdgeShape_RayCast_4.apply(null,arguments)},Bi=b._emscripten_bind_b2BodyDef_set_allowSleep_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_allowSleep_1.apply(null,arguments)},Ci=b._emscripten_bind_b2PulleyJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetType_0.apply(null, +arguments)},Di=b._emscripten_bind_b2WeldJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorA_1.apply(null,arguments)},Ei=b._emscripten_bind_b2Profile_set_step_1=function(){return b.asm._emscripten_bind_b2Profile_set_step_1.apply(null,arguments)},Fi=b._emscripten_bind_b2ContactEdge_set_other_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_other_1.apply(null,arguments)},Gi=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0.apply(null, +arguments)},Hi=b._emscripten_bind_b2Vec2_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec2_op_mul_1.apply(null,arguments)},Ii=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0.apply(null,arguments)},Ji=b._emscripten_bind_b2EdgeShape___destroy___0=function(){return b.asm._emscripten_bind_b2EdgeShape___destroy___0.apply(null,arguments)},Ki=b._emscripten_bind_b2PolygonShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_count_0.apply(null, +arguments)},Li=b._emscripten_bind_b2RopeJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorA_0.apply(null,arguments)},Mi=b._emscripten_bind_b2DistanceJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyA_0.apply(null,arguments)},Ni=b._emscripten_bind_b2AABB_Combine_2=function(){return b.asm._emscripten_bind_b2AABB_Combine_2.apply(null,arguments)},Oi=b._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1.apply(null, +arguments)},Pi=b._emscripten_bind_b2BodyDef_get_allowSleep_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_allowSleep_0.apply(null,arguments)},Qi=b._emscripten_bind_b2ContactEdge_get_other_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_other_0.apply(null,arguments)},Ri=b._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0.apply(null,arguments)},Si=b._emscripten_bind_b2PulleyJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJointDef___destroy___0.apply(null, +arguments)},Ti=b._emscripten_bind_b2MouseJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyB_0.apply(null,arguments)},Ui=b._emscripten_bind_b2PolygonShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2PolygonShape_TestPoint_2.apply(null,arguments)},Vi=b._emscripten_bind_b2JointEdge_get_other_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_other_0.apply(null,arguments)},Wi=b._emscripten_bind_b2PolygonShape_b2PolygonShape_0=function(){return b.asm._emscripten_bind_b2PolygonShape_b2PolygonShape_0.apply(null, +arguments)},Xi=b._emscripten_bind_b2PolygonShape_Set_2=function(){return b.asm._emscripten_bind_b2PolygonShape_Set_2.apply(null,arguments)},Yi=b._emscripten_bind_b2GearJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionForce_1.apply(null,arguments)},Zi=b._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0.apply(null,arguments)},$i=b._emscripten_bind_b2Fixture_SetUserData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetUserData_1.apply(null, +arguments)},aj=b._emscripten_bind_b2Contact_SetTangentSpeed_1=function(){return b.asm._emscripten_bind_b2Contact_SetTangentSpeed_1.apply(null,arguments)},bj=b._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0.apply(null,arguments)},cj=b._emscripten_bind_b2BodyDef_get_active_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_active_0.apply(null,arguments)},dj=b._emscripten_bind_b2Body_GetAngularVelocity_0= +function(){return b.asm._emscripten_bind_b2Body_GetAngularVelocity_0.apply(null,arguments)},ej=b._emscripten_bind_b2CircleShape_set_m_p_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_p_1.apply(null,arguments)},fj=b._emscripten_bind_b2Draw___destroy___0=function(){return b.asm._emscripten_bind_b2Draw___destroy___0.apply(null,arguments)},gj=b._emscripten_bind_b2WheelJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2WheelJointDef_Initialize_4.apply(null,arguments)},hj= +b._emscripten_bind_b2WeldJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_dampingRatio_1.apply(null,arguments)},ij=b._emscripten_bind_b2ChainShape_b2ChainShape_0=function(){return b.asm._emscripten_bind_b2ChainShape_b2ChainShape_0.apply(null,arguments)},jj=b._emscripten_bind_b2Joint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorB_0.apply(null,arguments)},kj=b._emscripten_bind_b2PrismaticJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_userData_0.apply(null, +arguments)},lj=b._emscripten_bind_b2MotorJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxForce_0.apply(null,arguments)},mj=b._emscripten_bind_b2RevoluteJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyA_0.apply(null,arguments)},nj=b._emscripten_bind_b2ContactID_set_cf_1=function(){return b.asm._emscripten_bind_b2ContactID_set_cf_1.apply(null,arguments)},oj=b._emscripten_bind_b2Body_GetGravityScale_0=function(){return b.asm._emscripten_bind_b2Body_GetGravityScale_0.apply(null, +arguments)},pj=b._emscripten_bind_b2Vec3_Set_3=function(){return b.asm._emscripten_bind_b2Vec3_Set_3.apply(null,arguments)},qj=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1.apply(null,arguments)},rj=b._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1.apply(null,arguments)},sj=b._emscripten_bind_b2PulleyJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetNext_0.apply(null, +arguments)},tj=b._emscripten_bind_b2ChainShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_type_0.apply(null,arguments)},uj=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0.apply(null,arguments)},vj=b._emscripten_bind_JSDraw_DrawTransform_1=function(){return b.asm._emscripten_bind_JSDraw_DrawTransform_1.apply(null,arguments)},wj=b._emscripten_bind_b2GearJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyA_0.apply(null, +arguments)},xj=b._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1.apply(null,arguments)},yj=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0.apply(null,arguments)},zj=b._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0.apply(null,arguments)},Aj= +b._emscripten_bind_JSContactFilter___destroy___0=function(){return b.asm._emscripten_bind_JSContactFilter___destroy___0.apply(null,arguments)},Bj=b._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0.apply(null,arguments)},Cb=b._memset=function(){return b.asm._memset.apply(null,arguments)},Cj=b._emscripten_bind_b2PolygonShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_radius_0.apply(null, +arguments)},Dj=b._emscripten_enum_b2BodyType_b2_kinematicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_kinematicBody.apply(null,arguments)},Ej=b._emscripten_bind_b2Rot_set_s_1=function(){return b.asm._emscripten_bind_b2Rot_set_s_1.apply(null,arguments)},Fj=b._emscripten_enum_b2ManifoldType_e_faceA=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceA.apply(null,arguments)},Gj=b._emscripten_enum_b2ManifoldType_e_faceB=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceB.apply(null, +arguments)},Hj=b._emscripten_bind_b2RevoluteJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyB_0.apply(null,arguments)},Ij=b._emscripten_bind_b2FixtureDef_b2FixtureDef_0=function(){return b.asm._emscripten_bind_b2FixtureDef_b2FixtureDef_0.apply(null,arguments)},Jj=b._emscripten_bind_b2PrismaticJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetUserData_1.apply(null,arguments)},Kj=b._emscripten_bind_b2WorldManifold_set_points_2= +function(){return b.asm._emscripten_bind_b2WorldManifold_set_points_2.apply(null,arguments)},Lj=b._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0.apply(null,arguments)},Mj=b._emscripten_enum_b2ShapeType_e_edge=function(){return b.asm._emscripten_enum_b2ShapeType_e_edge.apply(null,arguments)},Nj=b._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0.apply(null, +arguments)},Oj=b._emscripten_bind_b2BodyDef_set_active_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_active_1.apply(null,arguments)},Pj=b._emscripten_bind_b2EdgeShape_Set_2=function(){return b.asm._emscripten_bind_b2EdgeShape_Set_2.apply(null,arguments)},Qj=b._emscripten_bind_b2FixtureDef_set_isSensor_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_isSensor_1.apply(null,arguments)},Rj=b._emscripten_bind_b2Body_GetWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetWorldPoint_1.apply(null, +arguments)},Sj=b._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0.apply(null,arguments)},Tj=b._emscripten_bind_JSContactFilter_ShouldCollide_2=function(){return b.asm._emscripten_bind_JSContactFilter_ShouldCollide_2.apply(null,arguments)},Uj=b._emscripten_bind_b2Joint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionTorque_1.apply(null,arguments)},Vj=b._emscripten_bind_b2RevoluteJointDef_set_type_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_type_1.apply(null,arguments)},Wj=b._emscripten_bind_b2RayCastInput_set_p1_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_p1_1.apply(null,arguments)},Xj=b._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0.apply(null,arguments)},Yj=b._emscripten_bind_b2BodyDef_get_linearDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearDamping_0.apply(null, +arguments)},Zj=b._emscripten_bind_b2World_Step_3=function(){return b.asm._emscripten_bind_b2World_Step_3.apply(null,arguments)},ak=b._emscripten_bind_b2CircleShape_RayCast_4=function(){return b.asm._emscripten_bind_b2CircleShape_RayCast_4.apply(null,arguments)},bk=b._emscripten_bind_b2Profile_get_step_0=function(){return b.asm._emscripten_bind_b2Profile_get_step_0.apply(null,arguments)},ck=b._emscripten_bind_b2AABB_RayCast_2=function(){return b.asm._emscripten_bind_b2AABB_RayCast_2.apply(null,arguments)}, +dk=b._emscripten_bind_b2Mat22_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat22_SetZero_0.apply(null,arguments)};b.setTempRet0=function(){return b.asm.setTempRet0.apply(null,arguments)}; +var ek=b._emscripten_bind_b2DistanceJoint_GetLength_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLength_0.apply(null,arguments)},fk=b._emscripten_bind_b2PulleyJoint_GetLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthB_0.apply(null,arguments)},gk=b._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0.apply(null,arguments)},hk=b._emscripten_bind_b2WorldManifold_set_separations_2=function(){return b.asm._emscripten_bind_b2WorldManifold_set_separations_2.apply(null, +arguments)},ik=b._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1.apply(null,arguments)},jk=b._emscripten_bind_b2MotorJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetUserData_0.apply(null,arguments)},kk=b._emscripten_bind_b2FrictionJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionTorque_1.apply(null,arguments)},lk=b._emscripten_bind_b2Shape_get_m_type_0= +function(){return b.asm._emscripten_bind_b2Shape_get_m_type_0.apply(null,arguments)},mk=b._emscripten_bind_b2MouseJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetDampingRatio_1.apply(null,arguments)},nk=b._emscripten_bind_b2World_GetAutoClearForces_0=function(){return b.asm._emscripten_bind_b2World_GetAutoClearForces_0.apply(null,arguments)},ok=b._emscripten_bind_b2WorldManifold_set_normal_1=function(){return b.asm._emscripten_bind_b2WorldManifold_set_normal_1.apply(null, +arguments)},pk=b._emscripten_enum_b2ShapeType_e_circle=function(){return b.asm._emscripten_enum_b2ShapeType_e_circle.apply(null,arguments)},qk=b._emscripten_bind_b2BodyDef_set_fixedRotation_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_fixedRotation_1.apply(null,arguments)},rk=b._emscripten_bind_b2Vec2_b2Vec2_2=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_2.apply(null,arguments)},sk=b._emscripten_bind_b2Manifold_get_type_0=function(){return b.asm._emscripten_bind_b2Manifold_get_type_0.apply(null, +arguments)},tk=b._emscripten_bind_b2Body_Dump_0=function(){return b.asm._emscripten_bind_b2Body_Dump_0.apply(null,arguments)},uk=b._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0.apply(null,arguments)},vk=b._emscripten_bind_b2Body_GetWorldCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetWorldCenter_0.apply(null,arguments)},wk=b._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1.apply(null, +arguments)},xk=b._emscripten_bind_b2BodyDef_set_linearVelocity_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearVelocity_1.apply(null,arguments)},yk=b._emscripten_bind_b2JointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2JointDef_set_collideConnected_1.apply(null,arguments)},zk=b._emscripten_bind_b2MotorJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJoint___destroy___0.apply(null,arguments)},Ak=b._emscripten_bind_b2Body_GetUserData_0=function(){return b.asm._emscripten_bind_b2Body_GetUserData_0.apply(null, +arguments)},Bk=b._emscripten_bind_b2Body_GetAngularDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetAngularDamping_0.apply(null,arguments)},Ck=b._emscripten_bind_b2Fixture_RayCast_3=function(){return b.asm._emscripten_bind_b2Fixture_RayCast_3.apply(null,arguments)},Dk=b._emscripten_bind_b2JointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyA_1.apply(null,arguments)},Ek=b._emscripten_bind_b2GearJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_collideConnected_0.apply(null, +arguments)},Fk=b._emscripten_bind_b2RopeJointDef_get_maxLength_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_maxLength_0.apply(null,arguments)},Gk=b._emscripten_bind_b2MouseJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyA_0.apply(null,arguments)},Hk=b._emscripten_bind_b2Body_SetBullet_1=function(){return b.asm._emscripten_bind_b2Body_SetBullet_1.apply(null,arguments)},Ik=b._emscripten_bind_b2DistanceJoint_GetType_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetType_0.apply(null, +arguments)},Jk=b._emscripten_bind_b2FixtureDef_get_restitution_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_restitution_0.apply(null,arguments)},Kk=b._emscripten_bind_b2Fixture_GetType_0=function(){return b.asm._emscripten_bind_b2Fixture_GetType_0.apply(null,arguments)},Lk=b._emscripten_bind_b2WheelJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_enableMotor_1.apply(null,arguments)},Mk=b._emscripten_bind_b2RevoluteJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyB_0.apply(null, +arguments)},Nk=b._emscripten_bind_b2Profile_set_solveInit_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveInit_1.apply(null,arguments)},Ok=b._emscripten_bind_b2RopeJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_type_1.apply(null,arguments)},Pk=b._emscripten_bind_b2PrismaticJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyB_0.apply(null,arguments)},Qk=b._emscripten_bind_b2GearJoint_GetJoint2_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint2_0.apply(null, +arguments)},Rk=b._emscripten_bind_b2PulleyJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_userData_0.apply(null,arguments)},Sk=b._emscripten_bind_b2PrismaticJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyB_1.apply(null,arguments)},Tk=b._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0.apply(null,arguments)},Uk=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0= +function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0.apply(null,arguments)},Vk=b._emscripten_bind_b2Manifold_get_localNormal_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localNormal_0.apply(null,arguments)},Wk=b._emscripten_bind_b2Vec3_b2Vec3_0=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_0.apply(null,arguments)},Xk=b._emscripten_bind_b2Body_SetSleepingAllowed_1=function(){return b.asm._emscripten_bind_b2Body_SetSleepingAllowed_1.apply(null,arguments)}, +Yk=b._emscripten_bind_b2DistanceJoint___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJoint___destroy___0.apply(null,arguments)},Zk=b._emscripten_bind_b2PrismaticJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorA_0.apply(null,arguments)},$k=b._emscripten_bind_b2Manifold_set_pointCount_1=function(){return b.asm._emscripten_bind_b2Manifold_set_pointCount_1.apply(null,arguments)},al=b._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0.apply(null, +arguments)},bl=b._emscripten_bind_b2WeldJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetFrequency_0.apply(null,arguments)},cl=b._emscripten_bind_b2Joint_GetUserData_0=function(){return b.asm._emscripten_bind_b2Joint_GetUserData_0.apply(null,arguments)},dl=b._emscripten_bind_b2WorldManifold_get_points_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_points_1.apply(null,arguments)},el=b._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0.apply(null, +arguments)},fl=b._emscripten_bind_b2Manifold_set_type_1=function(){return b.asm._emscripten_bind_b2Manifold_set_type_1.apply(null,arguments)},gl=b._emscripten_bind_b2Vec3_b2Vec3_3=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_3.apply(null,arguments)},hl=b._emscripten_bind_b2RopeJointDef_set_maxLength_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_maxLength_1.apply(null,arguments)},il=b._emscripten_bind_b2ChainShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2ChainShape_TestPoint_2.apply(null, +arguments)},jl=b._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0.apply(null,arguments)},kl=b._emscripten_bind_b2RayCastInput_get_p2_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p2_0.apply(null,arguments)},ll=b._emscripten_bind_b2BodyDef_set_angle_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angle_1.apply(null,arguments)},ml=b._emscripten_bind_b2WeldJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetUserData_0.apply(null, +arguments)},nl=b._emscripten_bind_b2WheelJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorA_0.apply(null,arguments)},ol=b._emscripten_bind_b2PulleyJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_type_1.apply(null,arguments)},pl=b._emscripten_bind_b2Body_IsBullet_0=function(){return b.asm._emscripten_bind_b2Body_IsBullet_0.apply(null,arguments)},ql=b._emscripten_bind_b2MotorJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyA_1.apply(null, +arguments)},rl=b._emscripten_bind_b2Fixture_TestPoint_1=function(){return b.asm._emscripten_bind_b2Fixture_TestPoint_1.apply(null,arguments)},sl=b._emscripten_bind_b2Mat33_GetSymInverse33_1=function(){return b.asm._emscripten_bind_b2Mat33_GetSymInverse33_1.apply(null,arguments)},tl=b._emscripten_bind_JSDraw_DrawPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawPolygon_3.apply(null,arguments)},ul=b._emscripten_bind_b2PolygonShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeMass_2.apply(null, +arguments)},vl=b._emscripten_bind_b2PrismaticJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableMotor_1.apply(null,arguments)},wl=b._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1.apply(null,arguments)},xl=b._emscripten_bind_b2MouseJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetFrequency_1.apply(null,arguments)},yl=b._emscripten_bind_b2EdgeShape_get_m_vertex1_0= +function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex1_0.apply(null,arguments)},zl=b._emscripten_bind_b2BodyDef_set_awake_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_awake_1.apply(null,arguments)},Al=b._emscripten_bind_b2Vec2_get_y_0=function(){return b.asm._emscripten_bind_b2Vec2_get_y_0.apply(null,arguments)},Bl=b._emscripten_bind_b2Filter_set_categoryBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_categoryBits_1.apply(null,arguments)},Cl=b._emscripten_bind_b2Body_CreateFixture_2= +function(){return b.asm._emscripten_bind_b2Body_CreateFixture_2.apply(null,arguments)},Dl=b._emscripten_bind_b2Body_SetActive_1=function(){return b.asm._emscripten_bind_b2Body_SetActive_1.apply(null,arguments)},El=b._emscripten_bind_b2ContactFeature_get_indexB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexB_0.apply(null,arguments)},Fl=b._emscripten_bind_b2Fixture_GetUserData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetUserData_0.apply(null,arguments)},Gl=b._emscripten_bind_b2PolygonShape_ComputeAABB_3= +function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeAABB_3.apply(null,arguments)},Hl=b._emscripten_bind_b2ContactFeature_get_typeA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeA_0.apply(null,arguments)},Il=b._emscripten_bind_b2MouseJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_maxForce_1.apply(null,arguments)},Jl=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0.apply(null, +arguments)},Kl=b._emscripten_bind_b2EdgeShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2EdgeShape_TestPoint_2.apply(null,arguments)},Ll=b._emscripten_bind_b2WorldManifold_Initialize_5=function(){return b.asm._emscripten_bind_b2WorldManifold_Initialize_5.apply(null,arguments)},Ml=b._emscripten_bind_b2PolygonShape_get_m_centroid_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_centroid_0.apply(null,arguments)},Nl=b._emscripten_bind_b2ChainShape___destroy___0=function(){return b.asm._emscripten_bind_b2ChainShape___destroy___0.apply(null, +arguments)},Ol=b._emscripten_bind_b2GearJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetUserData_1.apply(null,arguments)},Pl=b._emscripten_bind_b2Vec3_set_z_1=function(){return b.asm._emscripten_bind_b2Vec3_set_z_1.apply(null,arguments)},Ql=b._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1.apply(null,arguments)},Rl=b._emscripten_bind_b2DistanceJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetFrequency_0.apply(null, +arguments)},Sl=b._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0.apply(null,arguments)},Tl=b._emscripten_bind_b2Body_SetGravityScale_1=function(){return b.asm._emscripten_bind_b2Body_SetGravityScale_1.apply(null,arguments)},Ul=b._emscripten_enum_b2ContactFeatureType_e_face=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_face.apply(null,arguments)},Vl=b._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0.apply(null,arguments)},Wl=b._emscripten_bind_b2PulleyJointDef_get_lengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthA_0.apply(null,arguments)},Xl=b._emscripten_bind_b2Vec3_set_x_1=function(){return b.asm._emscripten_bind_b2Vec3_set_x_1.apply(null,arguments)},Yl=b._emscripten_bind_b2PulleyJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_type_0.apply(null,arguments)}, +Zl=b._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1.apply(null,arguments)},$l=b._emscripten_bind_b2Shape___destroy___0=function(){return b.asm._emscripten_bind_b2Shape___destroy___0.apply(null,arguments)},am=b._emscripten_bind_b2Joint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionForce_1.apply(null,arguments)},bm=b._emscripten_bind_b2FixtureDef_set_friction_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_friction_1.apply(null, +arguments)},cm=b._emscripten_bind_b2ContactID___destroy___0=function(){return b.asm._emscripten_bind_b2ContactID___destroy___0.apply(null,arguments)},dm=b._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0.apply(null,arguments)},em=b._emscripten_bind_b2World_GetBodyCount_0=function(){return b.asm._emscripten_bind_b2World_GetBodyCount_0.apply(null,arguments)},fm=b._emscripten_bind_b2JointEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_prev_0.apply(null, +arguments)},gm=b._emscripten_bind_b2MotorJointDef_get_linearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_linearOffset_0.apply(null,arguments)},hm=b._emscripten_bind_b2MotorJointDef_Initialize_2=function(){return b.asm._emscripten_bind_b2MotorJointDef_Initialize_2.apply(null,arguments)},im=b._emscripten_bind_b2PrismaticJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorB_0.apply(null,arguments)},jm=b._emscripten_bind_b2Body_SetLinearVelocity_1= +function(){return b.asm._emscripten_bind_b2Body_SetLinearVelocity_1.apply(null,arguments)},km=b._emscripten_enum_b2BodyType_b2_staticBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_staticBody.apply(null,arguments)},lm=b._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1.apply(null,arguments)},mm=b._emscripten_bind_b2RevoluteJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_type_0.apply(null, +arguments)},nm=b._emscripten_bind_b2GearJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_type_0.apply(null,arguments)},om=b._emscripten_bind_b2ChainShape_GetType_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetType_0.apply(null,arguments)},pm=b._emscripten_bind_b2RayCastInput_get_maxFraction_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_maxFraction_0.apply(null,arguments)},qm=b._emscripten_bind_b2GearJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyA_0.apply(null, +arguments)},rm=b._emscripten_bind_b2Body_GetLocalVector_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalVector_1.apply(null,arguments)},sm=b._emscripten_bind_b2PrismaticJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableLimit_1.apply(null,arguments)},tm=b._emscripten_bind_b2FrictionJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxForce_0.apply(null,arguments)},um=b._emscripten_bind_b2BodyDef_set_angularVelocity_1= +function(){return b.asm._emscripten_bind_b2BodyDef_set_angularVelocity_1.apply(null,arguments)},wm=b._emscripten_bind_b2Body_SetLinearDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetLinearDamping_1.apply(null,arguments)},xm=b._emscripten_bind_b2WheelJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyB_0.apply(null,arguments)},ym=b._emscripten_bind_b2GearJointDef_get_joint2_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint2_0.apply(null,arguments)}, +zm=b._emscripten_bind_b2PrismaticJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsActive_0.apply(null,arguments)},Am=b._emscripten_bind_b2Vec3_get_z_0=function(){return b.asm._emscripten_bind_b2Vec3_get_z_0.apply(null,arguments)},Bm=b._emscripten_bind_b2Filter_get_categoryBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_categoryBits_0.apply(null,arguments)},Cm=b._emscripten_bind_b2Color_get_r_0=function(){return b.asm._emscripten_bind_b2Color_get_r_0.apply(null, +arguments)},Dm=b._emscripten_enum_b2JointType_e_weldJoint=function(){return b.asm._emscripten_enum_b2JointType_e_weldJoint.apply(null,arguments)},Em=b._emscripten_bind_b2World_SetContinuousPhysics_1=function(){return b.asm._emscripten_bind_b2World_SetContinuousPhysics_1.apply(null,arguments)},Fm=b._emscripten_bind_b2MouseJointDef_get_target_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_target_0.apply(null,arguments)},Gm=b._emscripten_bind_b2Body_SetTransform_2=function(){return b.asm._emscripten_bind_b2Body_SetTransform_2.apply(null, +arguments)},Hm=b._emscripten_bind_b2PulleyJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_userData_1.apply(null,arguments)},Im=b._emscripten_bind_b2FrictionJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxForce_1.apply(null,arguments)},Jm=b._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0.apply(null,arguments)},Km=b._emscripten_bind_b2BodyDef_get_type_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_type_0.apply(null,arguments)},Lm=b._emscripten_bind_b2Mat33_GetInverse22_1=function(){return b.asm._emscripten_bind_b2Mat33_GetInverse22_1.apply(null,arguments)},Mm=b._emscripten_bind_b2PulleyJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorB_0.apply(null,arguments)},Nm=b._emscripten_bind_b2WheelJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionTorque_1.apply(null,arguments)}, +Om=b._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0.apply(null,arguments)},Pm=b._emscripten_bind_b2ContactFeature_set_typeA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeA_1.apply(null,arguments)},Qm=b._emscripten_bind_b2Fixture_Dump_1=function(){return b.asm._emscripten_bind_b2Fixture_Dump_1.apply(null,arguments)},Rm=b._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0.apply(null, +arguments)},Sm=b._emscripten_bind_b2Manifold_set_localPoint_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localPoint_1.apply(null,arguments)},Tm=b._emscripten_bind_b2JointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2JointDef_get_userData_0.apply(null,arguments)},Um=b._emscripten_bind_b2BodyDef_set_bullet_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_bullet_1.apply(null,arguments)},Vm=b._emscripten_bind_b2WorldManifold___destroy___0=function(){return b.asm._emscripten_bind_b2WorldManifold___destroy___0.apply(null, +arguments)},Wm=b._emscripten_bind_b2RayCastOutput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastOutput___destroy___0.apply(null,arguments)},Xm=b._emscripten_bind_JSContactListener___destroy___0=function(){return b.asm._emscripten_bind_JSContactListener___destroy___0.apply(null,arguments)},Ym=b._emscripten_bind_b2World_DrawDebugData_0=function(){return b.asm._emscripten_bind_b2World_DrawDebugData_0.apply(null,arguments)}; +b.___cxa_can_catch=function(){return b.asm.___cxa_can_catch.apply(null,arguments)}; +var Zm=b._emscripten_bind_b2RopeJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorA_0.apply(null,arguments)},$m=b._emscripten_bind_b2Profile_set_solveVelocity_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveVelocity_1.apply(null,arguments)},an=b._emscripten_bind_b2GearJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_userData_0.apply(null,arguments)},bn=b._emscripten_bind_b2Filter_set_groupIndex_1=function(){return b.asm._emscripten_bind_b2Filter_set_groupIndex_1.apply(null, +arguments)},cn=b._emscripten_bind_b2JointDef_b2JointDef_0=function(){return b.asm._emscripten_bind_b2JointDef_b2JointDef_0.apply(null,arguments)},dn=b._emscripten_bind_b2Rot_set_c_1=function(){return b.asm._emscripten_bind_b2Rot_set_c_1.apply(null,arguments)},en=b._emscripten_bind_b2GearJointDef_b2GearJointDef_0=function(){return b.asm._emscripten_bind_b2GearJointDef_b2GearJointDef_0.apply(null,arguments)},fn=b._emscripten_bind_b2JointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyB_0.apply(null, +arguments)},gn=b._emscripten_bind_b2DistanceJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionForce_1.apply(null,arguments)},hn=b._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0.apply(null,arguments)},jn=b._emscripten_bind_b2MouseJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_frequencyHz_1.apply(null,arguments)},kn=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0.apply(null,arguments)},ln=b._emscripten_bind_b2Joint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorA_0.apply(null,arguments)},mn=b._emscripten_bind_b2Contact_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_GetRestitution_0.apply(null,arguments)},nn=b._emscripten_bind_b2ContactEdge_get_contact_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_contact_0.apply(null,arguments)}, +on=b._emscripten_bind_b2RevoluteJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_userData_0.apply(null,arguments)},pn=b._emscripten_bind_b2Body_ResetMassData_0=function(){return b.asm._emscripten_bind_b2Body_ResetMassData_0.apply(null,arguments)},qn=b._emscripten_bind_b2Fixture_GetAABB_1=function(){return b.asm._emscripten_bind_b2Fixture_GetAABB_1.apply(null,arguments)},rn=b._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1.apply(null, +arguments)},sn=b._emscripten_bind_b2Body_GetMassData_1=function(){return b.asm._emscripten_bind_b2Body_GetMassData_1.apply(null,arguments)},tn=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0.apply(null,arguments)},un=b._emscripten_bind_b2EdgeShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeMass_2.apply(null,arguments)},vn=b._emscripten_bind_b2GearJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyB_0.apply(null, +arguments)},wn=b._emscripten_enum_b2LimitState_e_atLowerLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atLowerLimit.apply(null,arguments)},xn=b._emscripten_bind_b2ManifoldPoint_set_id_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_id_1.apply(null,arguments)},yn=b._emscripten_bind_b2WheelJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyB_0.apply(null,arguments)},zn=b._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0.apply(null, +arguments)},An=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1.apply(null,arguments)},Bn=b._emscripten_bind_b2Body_DestroyFixture_1=function(){return b.asm._emscripten_bind_b2Body_DestroyFixture_1.apply(null,arguments)},Cn=b._emscripten_bind_b2Profile_set_broadphase_1=function(){return b.asm._emscripten_bind_b2Profile_set_broadphase_1.apply(null,arguments)},Dn=b._emscripten_bind_b2WheelJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorB_0.apply(null,arguments)},En=b._emscripten_bind_b2ContactImpulse_get_count_0=function(){return b.asm._emscripten_bind_b2ContactImpulse_get_count_0.apply(null,arguments)},Fn=b._emscripten_bind_b2World_GetJointCount_0=function(){return b.asm._emscripten_bind_b2World_GetJointCount_0.apply(null,arguments)},Gn=b._emscripten_bind_b2WheelJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorSpeed_0.apply(null, +arguments)},Hn=b._emscripten_bind_b2WheelJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_dampingRatio_0.apply(null,arguments)},In=b._emscripten_bind_b2RayCastOutput_get_fraction_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_fraction_0.apply(null,arguments)},Jn=b._emscripten_bind_b2AABB___destroy___0=function(){return b.asm._emscripten_bind_b2AABB___destroy___0.apply(null,arguments)},Kn=b._emscripten_bind_b2GearJoint_SetRatio_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetRatio_1.apply(null, +arguments)},Ln=b._emscripten_bind_b2Body_ApplyLinearImpulse_3=function(){return b.asm._emscripten_bind_b2Body_ApplyLinearImpulse_3.apply(null,arguments)},Mn=b._emscripten_bind_b2Filter___destroy___0=function(){return b.asm._emscripten_bind_b2Filter___destroy___0.apply(null,arguments)},Nn=b._emscripten_bind_b2RopeJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_userData_0.apply(null,arguments)}; +b.___cxa_is_pointer_type=function(){return b.asm.___cxa_is_pointer_type.apply(null,arguments)}; +var On=b._emscripten_bind_b2BodyDef_get_fixedRotation_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_fixedRotation_0.apply(null,arguments)},Pn=b._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1.apply(null,arguments)},Qn=b._emscripten_bind_b2ChainShape_SetPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetPrevVertex_1.apply(null,arguments)},Rn=b._emscripten_bind_b2MotorJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MotorJoint_IsActive_0.apply(null, +arguments)},Sn=b._emscripten_bind_b2MouseJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionTorque_1.apply(null,arguments)},Tn=b._emscripten_bind_b2DistanceJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_collideConnected_1.apply(null,arguments)},Un=b._emscripten_bind_b2WheelJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetUserData_0.apply(null,arguments)},Vn=b._emscripten_bind_b2Vec3_op_sub_1= +function(){return b.asm._emscripten_bind_b2Vec3_op_sub_1.apply(null,arguments)},Wn=b._emscripten_bind_b2WheelJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetNext_0.apply(null,arguments)},Xn=b._emscripten_bind_b2Shape_GetType_0=function(){return b.asm._emscripten_bind_b2Shape_GetType_0.apply(null,arguments)},Yn=b._emscripten_bind_b2AABB_IsValid_0=function(){return b.asm._emscripten_bind_b2AABB_IsValid_0.apply(null,arguments)},Zn=b._emscripten_bind_b2WheelJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyA_0.apply(null, +arguments)},$n=b._emscripten_enum_b2ShapeType_e_chain=function(){return b.asm._emscripten_enum_b2ShapeType_e_chain.apply(null,arguments)},ao=b._emscripten_bind_b2PulleyJoint_GetLengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthA_0.apply(null,arguments)},bo=b._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0.apply(null,arguments)},co=b._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1.apply(null, +arguments)},eo=b._emscripten_bind_b2World___destroy___0=function(){return b.asm._emscripten_bind_b2World___destroy___0.apply(null,arguments)},fo=b._emscripten_bind_b2ChainShape_set_m_prevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_prevVertex_1.apply(null,arguments)},go=b._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0.apply(null,arguments)},ho=b._emscripten_bind_b2ChainShape_SetNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetNextVertex_1.apply(null, +arguments)},io=b._emscripten_bind_b2Body_SetType_1=function(){return b.asm._emscripten_bind_b2Body_SetType_1.apply(null,arguments)},jo=b._emscripten_bind_b2Body_GetMass_0=function(){return b.asm._emscripten_bind_b2Body_GetMass_0.apply(null,arguments)},ko=b._emscripten_bind_b2Rot_b2Rot_0=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_0.apply(null,arguments)},lo=b._emscripten_bind_b2Rot_b2Rot_1=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_1.apply(null,arguments)},mo=b._emscripten_enum_b2JointType_e_distanceJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_distanceJoint.apply(null,arguments)},no=b._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1.apply(null,arguments)},oo=b._emscripten_bind_b2MouseJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetType_0.apply(null,arguments)},po=b._emscripten_bind_b2MouseJoint_GetTarget_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetTarget_0.apply(null, +arguments)},qo=b._emscripten_bind_JSQueryCallback___destroy___0=function(){return b.asm._emscripten_bind_JSQueryCallback___destroy___0.apply(null,arguments)},ro=b._emscripten_bind_b2Fixture_Refilter_0=function(){return b.asm._emscripten_bind_b2Fixture_Refilter_0.apply(null,arguments)},so=b._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1.apply(null,arguments)},to=b._emscripten_bind_b2JointEdge___destroy___0=function(){return b.asm._emscripten_bind_b2JointEdge___destroy___0.apply(null, +arguments)},uo=b._emscripten_bind_b2PulleyJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetRatio_0.apply(null,arguments)},vo=b._emscripten_bind_JSContactListener_BeginContact_1=function(){return b.asm._emscripten_bind_JSContactListener_BeginContact_1.apply(null,arguments)},wo=b._emscripten_bind_b2MotorJointDef_set_linearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_linearOffset_1.apply(null,arguments)},xo=b._emscripten_enum_b2JointType_e_motorJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_motorJoint.apply(null,arguments)},yo=b._emscripten_bind_b2EdgeShape_get_m_vertex2_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex2_0.apply(null,arguments)},zo=b._emscripten_bind_b2JointEdge_get_next_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_next_0.apply(null,arguments)},Ao=b._emscripten_bind_b2RayCastInput_set_maxFraction_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_maxFraction_1.apply(null, +arguments)},Bo=b._emscripten_bind_b2MouseJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyA_0.apply(null,arguments)},Co=b._emscripten_bind_b2BodyDef_get_awake_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_awake_0.apply(null,arguments)},Do=b._emscripten_bind_b2AABB_b2AABB_0=function(){return b.asm._emscripten_bind_b2AABB_b2AABB_0.apply(null,arguments)},Eo=b._emscripten_bind_b2Fixture_SetFriction_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFriction_1.apply(null, +arguments)},Fo=b._emscripten_enum_b2DrawFlag_e_centerOfMassBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_centerOfMassBit.apply(null,arguments)},Go=b._emscripten_bind_b2World_CreateBody_1=function(){return b.asm._emscripten_bind_b2World_CreateBody_1.apply(null,arguments)},Ho=b._emscripten_bind_b2RopeJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_userData_1.apply(null,arguments)},Io=b._emscripten_bind_b2WeldJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetNext_0.apply(null, +arguments)},Jo=b._emscripten_bind_b2WeldJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetType_0.apply(null,arguments)},Ko=b._emscripten_enum_b2ContactFeatureType_e_vertex=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_vertex.apply(null,arguments)},Lo=b._emscripten_bind_b2Rot___destroy___0=function(){return b.asm._emscripten_bind_b2Rot___destroy___0.apply(null,arguments)},Mo=b._emscripten_bind_b2Filter_get_maskBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_maskBits_0.apply(null, +arguments)},No=b._emscripten_bind_b2Mat22_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ex_0.apply(null,arguments)},Oo=b._emscripten_bind_b2Body_GetFixtureList_0=function(){return b.asm._emscripten_bind_b2Body_GetFixtureList_0.apply(null,arguments)},Po=b._emscripten_bind_b2PulleyJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJoint___destroy___0.apply(null,arguments)},Qo=b._emscripten_bind_b2MouseJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_dampingRatio_1.apply(null, +arguments)},Ro=b._emscripten_bind_JSRayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_JSRayCastCallback___destroy___0.apply(null,arguments)},So=b._emscripten_bind_b2ContactListener___destroy___0=function(){return b.asm._emscripten_bind_b2ContactListener___destroy___0.apply(null,arguments)},To=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1.apply(null,arguments)}; +b.establishStackSpace=function(){return b.asm.establishStackSpace.apply(null,arguments)}; +var Uo=b._emscripten_bind_b2FrictionJoint___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJoint___destroy___0.apply(null,arguments)},Vo=b._emscripten_bind_b2WeldJoint_Dump_0=function(){return b.asm._emscripten_bind_b2WeldJoint_Dump_0.apply(null,arguments)},Wo=b._emscripten_bind_b2MotorJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxForce_1.apply(null,arguments)},Xo=b._emscripten_bind_b2MouseJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetFrequency_0.apply(null, +arguments)},Yo=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0.apply(null,arguments)},Zo=b._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1.apply(null,arguments)},$o=b._emscripten_bind_b2GearJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_collideConnected_1.apply(null,arguments)},ap= +b._emscripten_bind_b2Vec2_IsValid_0=function(){return b.asm._emscripten_bind_b2Vec2_IsValid_0.apply(null,arguments)},bp=b._emscripten_bind_b2PrismaticJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyA_1.apply(null,arguments)},cp=b._emscripten_bind_b2World_GetWarmStarting_0=function(){return b.asm._emscripten_bind_b2World_GetWarmStarting_0.apply(null,arguments)},dp=b._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1.apply(null, +arguments)},ep=b._emscripten_bind_b2WeldJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJointDef___destroy___0.apply(null,arguments)},fp=b._emscripten_bind_b2Mat22_Solve_1=function(){return b.asm._emscripten_bind_b2Mat22_Solve_1.apply(null,arguments)},gp=b._emscripten_bind_b2Color_get_g_0=function(){return b.asm._emscripten_bind_b2Color_get_g_0.apply(null,arguments)},hp=b._emscripten_bind_VoidPtr___destroy___0=function(){return b.asm._emscripten_bind_VoidPtr___destroy___0.apply(null, +arguments)},ip=b._emscripten_bind_b2RopeJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetNext_0.apply(null,arguments)},jp=b._emscripten_bind_b2EdgeShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_type_0.apply(null,arguments)},kp=b._emscripten_bind_b2PolygonShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetChildCount_0.apply(null,arguments)},lp=b._emscripten_bind_b2GearJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_ratio_0.apply(null, +arguments)},mp=b._emscripten_bind_b2Mat33_Solve33_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve33_1.apply(null,arguments)},np=b._emscripten_bind_b2WeldJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_userData_1.apply(null,arguments)},op=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0.apply(null,arguments)},pp=b._emscripten_bind_b2RevoluteJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef___destroy___0.apply(null, +arguments)},qp=b._emscripten_bind_b2MotorJointDef_get_correctionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_correctionFactor_0.apply(null,arguments)},rp=b._emscripten_bind_b2ContactFeature_get_typeB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeB_0.apply(null,arguments)},sp=b._emscripten_bind_b2ContactID_get_key_0=function(){return b.asm._emscripten_bind_b2ContactID_get_key_0.apply(null,arguments)},tp=b._emscripten_bind_b2MotorJoint_GetReactionForce_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionForce_1.apply(null,arguments)},up=b._emscripten_bind_b2Rot_GetAngle_0=function(){return b.asm._emscripten_bind_b2Rot_GetAngle_0.apply(null,arguments)},vp=b._emscripten_bind_b2World_SetAllowSleeping_1=function(){return b.asm._emscripten_bind_b2World_SetAllowSleeping_1.apply(null,arguments)},wp=b._emscripten_bind_b2RopeJoint_GetType_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetType_0.apply(null,arguments)},xp=b._emscripten_bind_b2MotorJoint_SetAngularOffset_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetAngularOffset_1.apply(null,arguments)},yp=b._emscripten_bind_b2MotorJoint_GetLinearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetLinearOffset_0.apply(null,arguments)},zp=b._emscripten_bind_b2FrictionJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetCollideConnected_0.apply(null,arguments)},Ap=b._emscripten_bind_b2WheelJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_motorSpeed_1.apply(null, +arguments)},Bp=b._emscripten_bind_b2MotorJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorA_0.apply(null,arguments)},Cp=b._emscripten_bind_b2Fixture_GetDensity_0=function(){return b.asm._emscripten_bind_b2Fixture_GetDensity_0.apply(null,arguments)},Dp=b._emscripten_bind_b2MouseJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_type_0.apply(null,arguments)},Ep=b._emscripten_bind_b2Vec2_Set_2=function(){return b.asm._emscripten_bind_b2Vec2_Set_2.apply(null, +arguments)},Fp=b._emscripten_bind_b2WeldJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_type_0.apply(null,arguments)},Gp=b._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0.apply(null,arguments)},Hp=b._emscripten_bind_b2Rot_get_s_0=function(){return b.asm._emscripten_bind_b2Rot_get_s_0.apply(null,arguments)},Ip=b._emscripten_bind_b2FrictionJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxTorque_1.apply(null, +arguments)},Jp=b._emscripten_bind_b2MouseJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_frequencyHz_0.apply(null,arguments)},Kp=b._emscripten_bind_b2FrictionJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetUserData_1.apply(null,arguments)},Lp=b._emscripten_bind_b2RayCastInput_get_p1_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p1_0.apply(null,arguments)},Mp=b._emscripten_bind_b2DistanceJointDef_get_collideConnected_0= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_collideConnected_0.apply(null,arguments)},Np=b._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1.apply(null,arguments)},Op=b._emscripten_bind_b2ContactFeature___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFeature___destroy___0.apply(null,arguments)},Pp=b._emscripten_bind_b2Color___destroy___0=function(){return b.asm._emscripten_bind_b2Color___destroy___0.apply(null, +arguments)},Qp=b._emscripten_bind_b2DistanceJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyB_1.apply(null,arguments)},Rp=b._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0.apply(null,arguments)},Sp=b._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0.apply(null,arguments)},Tp=b._emscripten_bind_b2RevoluteJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetType_0.apply(null,arguments)},Up=b._emscripten_bind_b2MassData_b2MassData_0=function(){return b.asm._emscripten_bind_b2MassData_b2MassData_0.apply(null,arguments)},Vp=b._emscripten_bind_b2Vec3_set_y_1=function(){return b.asm._emscripten_bind_b2Vec3_set_y_1.apply(null,arguments)},Wp=b._emscripten_bind_b2BodyDef_set_angularDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angularDamping_1.apply(null,arguments)},Xp=b._emscripten_bind_b2AABB_Combine_1= +function(){return b.asm._emscripten_bind_b2AABB_Combine_1.apply(null,arguments)},Yp=b._emscripten_bind_b2WheelJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyB_1.apply(null,arguments)},Zp=b._emscripten_bind_b2PrismaticJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyA_0.apply(null,arguments)},$p=b._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0.apply(null, +arguments)},aq=b._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0.apply(null,arguments)},bq=b._emscripten_bind_b2Body_IsSleepingAllowed_0=function(){return b.asm._emscripten_bind_b2Body_IsSleepingAllowed_0.apply(null,arguments)},cq=b._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0.apply(null,arguments)},dq=b._emscripten_bind_b2Profile_get_solve_0= +function(){return b.asm._emscripten_bind_b2Profile_get_solve_0.apply(null,arguments)},eq=b._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1.apply(null,arguments)},fq=b._emscripten_bind_b2PolygonShape_GetVertexCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertexCount_0.apply(null,arguments)},gq=b._emscripten_bind_b2Rot_get_c_0=function(){return b.asm._emscripten_bind_b2Rot_get_c_0.apply(null, +arguments)},hq=b._emscripten_bind_b2AABB_set_lowerBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_lowerBound_1.apply(null,arguments)},iq=b._emscripten_bind_b2Fixture_SetFilterData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFilterData_1.apply(null,arguments)},jq=b._emscripten_bind_b2MouseJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetMaxForce_1.apply(null,arguments)},kq=b._emscripten_bind_b2WheelJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsMotorEnabled_0.apply(null, +arguments)},lq=b._emscripten_bind_b2JointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2JointDef_set_userData_1.apply(null,arguments)},mq=b._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0.apply(null,arguments)},nq=b._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0.apply(null,arguments)},oq=b._emscripten_bind_b2WeldJointDef_get_dampingRatio_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_get_dampingRatio_0.apply(null,arguments)},pq=b._emscripten_bind_b2Rot_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Rot_SetIdentity_0.apply(null,arguments)},qq=b._emscripten_bind_b2EdgeShape_b2EdgeShape_0=function(){return b.asm._emscripten_bind_b2EdgeShape_b2EdgeShape_0.apply(null,arguments)},rq=b._emscripten_bind_b2FrictionJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionForce_1.apply(null, +arguments)},sq=b._emscripten_bind_b2MouseJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetUserData_0.apply(null,arguments)},tq=b._emscripten_bind_b2DistanceJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_type_1.apply(null,arguments)},uq=b._emscripten_bind_b2WeldJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorA_0.apply(null,arguments)},vq=b._emscripten_bind_b2WeldJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJoint___destroy___0.apply(null, +arguments)},wq=b._emscripten_bind_b2Manifold_b2Manifold_0=function(){return b.asm._emscripten_bind_b2Manifold_b2Manifold_0.apply(null,arguments)},xq=b._emscripten_bind_JSContactListener_PostSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PostSolve_2.apply(null,arguments)},yq=b._emscripten_bind_b2PulleyJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyA_0.apply(null,arguments)},zq=b._emscripten_bind_b2RopeJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_type_0.apply(null, +arguments)},Aq=b._emscripten_bind_b2CircleShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeMass_2.apply(null,arguments)},Bq=b._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0.apply(null,arguments)},Cq=b._emscripten_bind_b2GearJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2GearJointDef___destroy___0.apply(null,arguments)},Dq=b._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1.apply(null,arguments)},Eq=b._emscripten_enum_b2BodyType_b2_dynamicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_dynamicBody.apply(null,arguments)},Fq=b._emscripten_bind_b2CircleShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2CircleShape_TestPoint_2.apply(null,arguments)},Gq=b._emscripten_bind_b2MotorJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxTorque_0.apply(null, +arguments)},Hq=b._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1.apply(null,arguments)},Iq=b._emscripten_bind_b2FrictionJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyB_1.apply(null,arguments)},Jq=b._emscripten_bind_b2MouseJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorB_0.apply(null,arguments)},Kq=b._emscripten_bind_b2RopeJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorB_0.apply(null,arguments)},Lq=b._emscripten_bind_b2GearJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyB_0.apply(null,arguments)},Mq=b._emscripten_bind_b2ChainShape_Clear_0=function(){return b.asm._emscripten_bind_b2ChainShape_Clear_0.apply(null,arguments)},Nq=b._emscripten_bind_b2CircleShape___destroy___0=function(){return b.asm._emscripten_bind_b2CircleShape___destroy___0.apply(null,arguments)},Oq= +b._emscripten_bind_b2MotorJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetType_0.apply(null,arguments)},Pq=b._emscripten_bind_b2World_GetContactCount_0=function(){return b.asm._emscripten_bind_b2World_GetContactCount_0.apply(null,arguments)},Qq=b._emscripten_bind_b2Contact_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Contact_SetRestitution_1.apply(null,arguments)},Rq=b._emscripten_bind_b2BodyDef_get_angularDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularDamping_0.apply(null, +arguments)},Sq=b._emscripten_bind_b2EdgeShape_get_m_vertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex3_0.apply(null,arguments)},Tq=b._emscripten_bind_b2MassData_set_center_1=function(){return b.asm._emscripten_bind_b2MassData_set_center_1.apply(null,arguments)},Uq=b._emscripten_bind_b2Transform_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Transform_SetIdentity_0.apply(null,arguments)},Vq=b._emscripten_bind_b2GearJointDef_set_joint1_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint1_1.apply(null, +arguments)},Wq=b._emscripten_bind_b2EdgeShape_set_m_vertex2_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex2_1.apply(null,arguments)},Xq=b._emscripten_bind_b2Contact_SetFriction_1=function(){return b.asm._emscripten_bind_b2Contact_SetFriction_1.apply(null,arguments)},Yq=b._emscripten_bind_b2MouseJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_collideConnected_1.apply(null,arguments)},Zq=b._emscripten_bind_b2ContactFeature_set_indexB_1= +function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexB_1.apply(null,arguments)},$q=b._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1.apply(null,arguments)},ar=b._emscripten_bind_b2WeldJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetCollideConnected_0.apply(null,arguments)},br=b._emscripten_bind_b2Mat22_GetInverse_0=function(){return b.asm._emscripten_bind_b2Mat22_GetInverse_0.apply(null, +arguments)},cr=b._emscripten_bind_b2WheelJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_frequencyHz_1.apply(null,arguments)},dr=b._emscripten_bind_b2World_GetSubStepping_0=function(){return b.asm._emscripten_bind_b2World_GetSubStepping_0.apply(null,arguments)},er=b._emscripten_bind_b2Rot_GetYAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetYAxis_0.apply(null,arguments)}; +b._emscripten_get_global_libc=function(){return b.asm._emscripten_get_global_libc.apply(null,arguments)}; +var fr=b._emscripten_bind_b2WheelJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAxisA_0.apply(null,arguments)},gr=b._emscripten_bind_b2RopeJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyB_0.apply(null,arguments)},hr=b._emscripten_bind_b2EdgeShape_GetType_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetType_0.apply(null,arguments)},ir=b._emscripten_bind_b2Mat22_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ex_1.apply(null, +arguments)},jr=b._emscripten_bind_b2ManifoldPoint___destroy___0=function(){return b.asm._emscripten_bind_b2ManifoldPoint___destroy___0.apply(null,arguments)},kr=b._emscripten_enum_b2JointType_e_prismaticJoint=function(){return b.asm._emscripten_enum_b2JointType_e_prismaticJoint.apply(null,arguments)},lr=b._emscripten_bind_b2WeldJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_referenceAngle_0.apply(null,arguments)},mr=b._emscripten_bind_b2Vec2_Length_0=function(){return b.asm._emscripten_bind_b2Vec2_Length_0.apply(null, +arguments)},nr=b._emscripten_bind_b2Vec2_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec2_SetZero_0.apply(null,arguments)},or=b._emscripten_bind_b2RopeJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJoint___destroy___0.apply(null,arguments)},pr=b._emscripten_bind_b2World_DestroyJoint_1=function(){return b.asm._emscripten_bind_b2World_DestroyJoint_1.apply(null,arguments)},qr=b._emscripten_bind_b2JointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyB_1.apply(null, +arguments)},rr=b._emscripten_bind_b2Mat22_Set_2=function(){return b.asm._emscripten_bind_b2Mat22_Set_2.apply(null,arguments)},sr=b._emscripten_bind_b2JointEdge_set_next_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_next_1.apply(null,arguments)},tr=b._emscripten_bind_b2WeldJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorB_0.apply(null,arguments)},ur=b._emscripten_enum_b2DrawFlag_e_aabbBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_aabbBit.apply(null, +arguments)},vr=b._emscripten_bind_b2EdgeShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeAABB_3.apply(null,arguments)},wr=b._emscripten_bind_b2PolygonShape_set_m_centroid_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_centroid_1.apply(null,arguments)},xr=b._emscripten_bind_b2WheelJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_collideConnected_1.apply(null,arguments)},yr=b._emscripten_bind_b2World_GetJointList_0= +function(){return b.asm._emscripten_bind_b2World_GetJointList_0.apply(null,arguments)},zr=b._emscripten_bind_b2MotorJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_type_0.apply(null,arguments)},Ar=b._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0.apply(null,arguments)},Br=b._emscripten_bind_b2BodyDef_set_linearDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearDamping_1.apply(null, +arguments)},Cr=b._emscripten_bind_b2FrictionJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetUserData_0.apply(null,arguments)},Dr=b._emscripten_bind_b2Shape_TestPoint_2=function(){return b.asm._emscripten_bind_b2Shape_TestPoint_2.apply(null,arguments)},Er=b._emscripten_bind_b2Manifold_set_localNormal_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localNormal_1.apply(null,arguments)},Fr=b._emscripten_bind_b2JointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyA_0.apply(null, +arguments)},Gr=b._emscripten_bind_b2Body_GetLinearDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearDamping_0.apply(null,arguments)},Hr=b._emscripten_bind_b2WeldJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_frequencyHz_1.apply(null,arguments)},Ir=b._emscripten_bind_b2BodyDef_set_userData_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_userData_1.apply(null,arguments)},Jr=b._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1.apply(null, +arguments)},Kr=b._emscripten_bind_b2Vec2_Skew_0=function(){return b.asm._emscripten_bind_b2Vec2_Skew_0.apply(null,arguments)},Lr=b._emscripten_bind_b2MouseJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetDampingRatio_0.apply(null,arguments)},Mr=b._emscripten_bind_b2RevoluteJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorA_0.apply(null,arguments)},Nr=b._emscripten_bind_b2ContactFeature_set_typeB_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeB_1.apply(null, +arguments)},Or=b._emscripten_bind_b2WheelJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorA_0.apply(null,arguments)},Pr=b._emscripten_bind_b2MotorJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxTorque_0.apply(null,arguments)};b.setThrew=function(){return b.asm.setThrew.apply(null,arguments)}; +var Qr=b._emscripten_bind_b2PrismaticJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_userData_1.apply(null,arguments)},Rr=b._emscripten_bind_b2FrictionJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_type_1.apply(null,arguments)},Sr=b._emscripten_bind_b2FrictionJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2FrictionJointDef_Initialize_3.apply(null,arguments)},Nb=b._sbrk=function(){return b.asm._sbrk.apply(null, +arguments)},Tr=b._emscripten_bind_b2FrictionJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_collideConnected_0.apply(null,arguments)},Ib=b._memcpy=function(){return b.asm._memcpy.apply(null,arguments)},Ur=b._emscripten_bind_b2FrictionJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorA_0.apply(null,arguments)},Vr=b._emscripten_enum_b2DrawFlag_e_pairBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_pairBit.apply(null, +arguments)},Wr=b._emscripten_bind_b2MassData_get_I_0=function(){return b.asm._emscripten_bind_b2MassData_get_I_0.apply(null,arguments)},Xr=b._emscripten_bind_b2WheelJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_motorSpeed_0.apply(null,arguments)},Yr=b._emscripten_bind_b2Filter_set_maskBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_maskBits_1.apply(null,arguments)},Zr=b._emscripten_bind_b2WheelJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetCollideConnected_0.apply(null, +arguments)},$r=b._emscripten_bind_b2EdgeShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_radius_0.apply(null,arguments)},as=b._emscripten_bind_b2World_GetTreeHeight_0=function(){return b.asm._emscripten_bind_b2World_GetTreeHeight_0.apply(null,arguments)},bs=b._emscripten_bind_b2Mat22_b2Mat22_2=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_2.apply(null,arguments)},cs=b._emscripten_bind_b2PrismaticJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetNext_0.apply(null, +arguments)},ds=b._emscripten_bind_b2Mat22_b2Mat22_0=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_0.apply(null,arguments)},es=b._emscripten_bind_b2PrismaticJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyA_0.apply(null,arguments)},gs=b._emscripten_bind_b2RopeJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorA_1.apply(null,arguments)},hs=b._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1.apply(null, +arguments)},is=b._emscripten_bind_b2Mat22_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ey_1.apply(null,arguments)},js=b._emscripten_bind_b2MotorJointDef_set_angularOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_angularOffset_1.apply(null,arguments)},ks=b._emscripten_bind_b2CircleShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_type_0.apply(null,arguments)},ls=b._emscripten_bind_b2Body_GetType_0=function(){return b.asm._emscripten_bind_b2Body_GetType_0.apply(null, +arguments)},ms=b._emscripten_bind_b2ContactEdge_b2ContactEdge_0=function(){return b.asm._emscripten_bind_b2ContactEdge_b2ContactEdge_0.apply(null,arguments)},ns=b._emscripten_bind_b2BodyDef___destroy___0=function(){return b.asm._emscripten_bind_b2BodyDef___destroy___0.apply(null,arguments)},ps=b._emscripten_bind_b2FrictionJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxTorque_1.apply(null,arguments)},Qa=b._free=function(){return b.asm._free.apply(null,arguments)}, +qs=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1.apply(null,arguments)},rs=b._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0.apply(null,arguments)},ss=b._emscripten_bind_b2DistanceJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyA_1.apply(null,arguments)}; +b.runPostSets=function(){return b.asm.runPostSets.apply(null,arguments)}; +var ts=b._emscripten_bind_b2RevoluteJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetLimits_2.apply(null,arguments)},us=b._emscripten_bind_b2WeldJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_type_1.apply(null,arguments)},vs=b._emscripten_bind_b2MotorJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJointDef___destroy___0.apply(null,arguments)},xs=b._emscripten_bind_b2FrictionJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetNext_0.apply(null, +arguments)},ys=b._emscripten_bind_b2Shape_set_m_type_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_type_1.apply(null,arguments)},zs=b._emscripten_bind_b2WheelJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointTranslation_0.apply(null,arguments)},As=b._emscripten_bind_b2WheelJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorTorque_1.apply(null,arguments)},Bs=b._emscripten_bind_b2RopeJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetUserData_1.apply(null, +arguments)},Cs=b._emscripten_bind_b2RopeJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJointDef___destroy___0.apply(null,arguments)},Ds=b._emscripten_bind_b2WheelJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsActive_0.apply(null,arguments)},Es=b._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0.apply(null,arguments)},Fs=b._emscripten_bind_b2MotorJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyB_1.apply(null,arguments)},Gs=b._emscripten_bind_JSDestructionListener___destroy___0=function(){return b.asm._emscripten_bind_JSDestructionListener___destroy___0.apply(null,arguments)},Hs=b._emscripten_bind_b2Transform_b2Transform_2=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_2.apply(null,arguments)},Is=b._emscripten_bind_b2WeldJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionForce_1.apply(null, +arguments)},Js=b._emscripten_bind_b2ChainShape_RayCast_4=function(){return b.asm._emscripten_bind_b2ChainShape_RayCast_4.apply(null,arguments)},Ks=b._emscripten_bind_b2Vec2_set_y_1=function(){return b.asm._emscripten_bind_b2Vec2_set_y_1.apply(null,arguments)},Ls=b._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1.apply(null,arguments)},Ms=b._emscripten_bind_b2ContactID_get_cf_0=function(){return b.asm._emscripten_bind_b2ContactID_get_cf_0.apply(null, +arguments)},Ns=b._emscripten_bind_b2DistanceJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2DistanceJointDef_Initialize_4.apply(null,arguments)},Os=b._emscripten_bind_b2ChainShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_radius_0.apply(null,arguments)},Ps=b._emscripten_bind_b2WeldJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorB_1.apply(null,arguments)},Qs=b._emscripten_bind_b2ChainShape_set_m_radius_1= +function(){return b.asm._emscripten_bind_b2ChainShape_set_m_radius_1.apply(null,arguments)},Rs=b._emscripten_bind_b2DistanceJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionTorque_1.apply(null,arguments)},Ss=b._emscripten_bind_b2World_Dump_0=function(){return b.asm._emscripten_bind_b2World_Dump_0.apply(null,arguments)},Ts=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0.apply(null, +arguments)},Us=b._emscripten_bind_JSContactFilter_JSContactFilter_0=function(){return b.asm._emscripten_bind_JSContactFilter_JSContactFilter_0.apply(null,arguments)},Vs=b._emscripten_bind_b2Profile_set_solve_1=function(){return b.asm._emscripten_bind_b2Profile_set_solve_1.apply(null,arguments)},Ws=b._emscripten_bind_b2FixtureDef_set_density_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_density_1.apply(null,arguments)},Xs=b._emscripten_bind_b2WeldJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetDampingRatio_0.apply(null, +arguments)},Ys=b._emscripten_bind_b2Color_get_b_0=function(){return b.asm._emscripten_bind_b2Color_get_b_0.apply(null,arguments)},Zs=b._emscripten_bind_b2MouseJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_userData_0.apply(null,arguments)},$s=b._emscripten_bind_b2CircleShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeAABB_3.apply(null,arguments)},at=b._emscripten_bind_b2RopeJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionForce_1.apply(null, +arguments)},bt=b._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0.apply(null,arguments)},ct=b._emscripten_bind_b2ManifoldPoint_set_localPoint_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_localPoint_1.apply(null,arguments)},dt=b._emscripten_bind_b2Fixture_GetFilterData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFilterData_0.apply(null,arguments)},et=b._emscripten_bind_b2World_GetBodyList_0= +function(){return b.asm._emscripten_bind_b2World_GetBodyList_0.apply(null,arguments)},ft=b._emscripten_bind_b2Body_GetJointList_0=function(){return b.asm._emscripten_bind_b2Body_GetJointList_0.apply(null,arguments)},gt=b._emscripten_bind_b2Joint_GetNext_0=function(){return b.asm._emscripten_bind_b2Joint_GetNext_0.apply(null,arguments)},ht=b._emscripten_bind_b2Joint_GetType_0=function(){return b.asm._emscripten_bind_b2Joint_GetType_0.apply(null,arguments)},it=b._emscripten_bind_b2World_RayCast_3=function(){return b.asm._emscripten_bind_b2World_RayCast_3.apply(null, +arguments)},jt=b._emscripten_bind_b2MassData_set_I_1=function(){return b.asm._emscripten_bind_b2MassData_set_I_1.apply(null,arguments)},kt=b._emscripten_bind_b2MassData___destroy___0=function(){return b.asm._emscripten_bind_b2MassData___destroy___0.apply(null,arguments)},lt=b._emscripten_bind_b2Profile_get_collide_0=function(){return b.asm._emscripten_bind_b2Profile_get_collide_0.apply(null,arguments)},mt=b._emscripten_bind_b2Color_b2Color_3=function(){return b.asm._emscripten_bind_b2Color_b2Color_3.apply(null, +arguments)},nt=b._emscripten_bind_b2Color_b2Color_0=function(){return b.asm._emscripten_bind_b2Color_b2Color_0.apply(null,arguments)},ot=b._emscripten_bind_b2WheelJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_frequencyHz_0.apply(null,arguments)},pt=b._emscripten_bind_b2WeldJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2WeldJointDef_Initialize_3.apply(null,arguments)},qt=b._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1.apply(null, +arguments)},rt=b._emscripten_enum_b2JointType_e_gearJoint=function(){return b.asm._emscripten_enum_b2JointType_e_gearJoint.apply(null,arguments)},st=b._emscripten_bind_b2FixtureDef_get_friction_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_friction_0.apply(null,arguments)},tt=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1.apply(null,arguments)},ut=b._emscripten_bind_b2Contact_GetManifold_0=function(){return b.asm._emscripten_bind_b2Contact_GetManifold_0.apply(null, +arguments)},vt=b._emscripten_bind_b2QueryCallback___destroy___0=function(){return b.asm._emscripten_bind_b2QueryCallback___destroy___0.apply(null,arguments)},wt=b._emscripten_bind_b2WeldJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorA_0.apply(null,arguments)},xt=b._emscripten_bind_b2MouseJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetUserData_1.apply(null,arguments)},yt=b._emscripten_bind_b2MotorJointDef_set_correctionFactor_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_correctionFactor_1.apply(null,arguments)},zt=b._emscripten_bind_b2ChainShape_GetChildEdge_2=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildEdge_2.apply(null,arguments)},At=b._emscripten_enum_b2JointType_e_mouseJoint=function(){return b.asm._emscripten_enum_b2JointType_e_mouseJoint.apply(null,arguments)},Bt=b._emscripten_bind_b2MotorJointDef_get_angularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_angularOffset_0.apply(null, +arguments)},Ct=b._emscripten_bind_b2WheelJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetUserData_1.apply(null,arguments)},Dt=b._emscripten_bind_b2Body_ApplyForce_3=function(){return b.asm._emscripten_bind_b2Body_ApplyForce_3.apply(null,arguments)},Et=b._emscripten_bind_b2ChainShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_count_1.apply(null,arguments)},Ft=b._emscripten_bind_b2DistanceJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetCollideConnected_0.apply(null, +arguments)},Gt=b._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0.apply(null,arguments)},Ht=b._emscripten_bind_b2PolygonShape_GetVertex_1=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertex_1.apply(null,arguments)},It=b._emscripten_bind_b2World_SetGravity_1=function(){return b.asm._emscripten_bind_b2World_SetGravity_1.apply(null,arguments)},Jt=b._emscripten_bind_b2MouseJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_collideConnected_0.apply(null, +arguments)},Qb=b._llvm_bswap_i32=function(){return b.asm._llvm_bswap_i32.apply(null,arguments)},Kt=b._emscripten_bind_b2Fixture_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Fixture_SetRestitution_1.apply(null,arguments)},Lt=b._emscripten_bind_b2Body_GetTransform_0=function(){return b.asm._emscripten_bind_b2Body_GetTransform_0.apply(null,arguments)},Mt=b._emscripten_enum_b2ShapeType_e_typeCount=function(){return b.asm._emscripten_enum_b2ShapeType_e_typeCount.apply(null,arguments)},Nt= +b._emscripten_bind_b2Mat33_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ex_1.apply(null,arguments)},Ot=b._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0.apply(null,arguments)},Pt=b._emscripten_bind_b2RevoluteJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyA_0.apply(null,arguments)},Qt=b._emscripten_bind_b2PrismaticJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyB_0.apply(null, +arguments)},Rt=b._emscripten_bind_b2WheelJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyA_1.apply(null,arguments)},St=b._emscripten_bind_b2MotorJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxForce_1.apply(null,arguments)},Tt=b._emscripten_bind_b2BodyDef_get_angle_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angle_0.apply(null,arguments)},Ut=b._emscripten_bind_b2FixtureDef_get_shape_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_shape_0.apply(null, +arguments)},Vt=b._emscripten_bind_b2Body_SetAngularVelocity_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularVelocity_1.apply(null,arguments)},Wt=b._emscripten_bind_b2WeldJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_userData_0.apply(null,arguments)},Xt=b._emscripten_bind_b2FrictionJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxForce_1.apply(null,arguments)},Yt=b._emscripten_bind_b2Mat33_b2Mat33_3=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_3.apply(null, +arguments)},Zt=b._emscripten_bind_b2Vec3_get_y_0=function(){return b.asm._emscripten_bind_b2Vec3_get_y_0.apply(null,arguments)},$t=b._emscripten_bind_b2JointDef_get_type_0=function(){return b.asm._emscripten_bind_b2JointDef_get_type_0.apply(null,arguments)},au=b._emscripten_bind_JSQueryCallback_ReportFixture_1=function(){return b.asm._emscripten_bind_JSQueryCallback_ReportFixture_1.apply(null,arguments)},bu=b._emscripten_bind_b2PulleyJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCollideConnected_0.apply(null, +arguments)},cu=b._emscripten_bind_b2Body_CreateFixture_1=function(){return b.asm._emscripten_bind_b2Body_CreateFixture_1.apply(null,arguments)},du=b._emscripten_bind_JSDraw_JSDraw_0=function(){return b.asm._emscripten_bind_JSDraw_JSDraw_0.apply(null,arguments)},eu=b._emscripten_bind_b2MouseJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorA_0.apply(null,arguments)},fu=b._emscripten_bind_b2Transform_get_p_0=function(){return b.asm._emscripten_bind_b2Transform_get_p_0.apply(null, +arguments)},gu=b._emscripten_bind_b2WorldManifold_get_normal_0=function(){return b.asm._emscripten_bind_b2WorldManifold_get_normal_0.apply(null,arguments)},hu=b._emscripten_bind_b2World_GetProfile_0=function(){return b.asm._emscripten_bind_b2World_GetProfile_0.apply(null,arguments)},iu=b._emscripten_bind_b2DistanceJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJointDef___destroy___0.apply(null,arguments)},ju=b._emscripten_bind_b2GearJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyA_1.apply(null, +arguments)},ku=b._emscripten_bind_b2JointDef_set_type_1=function(){return b.asm._emscripten_bind_b2JointDef_set_type_1.apply(null,arguments)},lu=b._emscripten_bind_b2ContactEdge_set_contact_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_contact_1.apply(null,arguments)},mu=b._emscripten_bind_b2MotorJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_userData_0.apply(null,arguments)},nu=b._emscripten_bind_b2World_GetContactList_0=function(){return b.asm._emscripten_bind_b2World_GetContactList_0.apply(null, +arguments)},ou=b._emscripten_bind_b2Mat33_set_ez_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ez_1.apply(null,arguments)},pu=b._emscripten_bind_b2JointEdge_b2JointEdge_0=function(){return b.asm._emscripten_bind_b2JointEdge_b2JointEdge_0.apply(null,arguments)},qu=b._emscripten_bind_b2FrictionJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyA_0.apply(null,arguments)},ru=b._emscripten_bind_b2WheelJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_type_0.apply(null, +arguments)},su=b._emscripten_bind_b2RevoluteJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionForce_1.apply(null,arguments)},tu=b._emscripten_bind_b2PulleyJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_collideConnected_1.apply(null,arguments)},uu=b._emscripten_bind_b2RopeJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetCollideConnected_0.apply(null,arguments)},vu=b._emscripten_bind_b2GearJointDef_set_joint2_1= +function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint2_1.apply(null,arguments)},wu=b._emscripten_bind_b2EdgeShape_set_m_vertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex3_1.apply(null,arguments)},xu=b._emscripten_bind_b2GearJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorB_0.apply(null,arguments)},yu=b._emscripten_bind_b2RopeJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RopeJoint_IsActive_0.apply(null,arguments)}, +zu=b._emscripten_bind_b2Fixture_GetFriction_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFriction_0.apply(null,arguments)},Au=b._emscripten_bind_b2Fixture_GetNext_0=function(){return b.asm._emscripten_bind_b2Fixture_GetNext_0.apply(null,arguments)},Bu=b._emscripten_bind_b2RopeJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyA_0.apply(null,arguments)},Cu=b._emscripten_bind_b2WeldJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorB_0.apply(null, +arguments)},Du=b._emscripten_bind_b2WeldJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_referenceAngle_1.apply(null,arguments)},Eu=b._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1.apply(null,arguments)},Fu=b._emscripten_bind_b2Mat33_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat33_SetZero_0.apply(null,arguments)},Gu=b._emscripten_bind_b2MotorJointDef_get_bodyB_0= +function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyB_0.apply(null,arguments)},Hu=b._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0.apply(null,arguments)},Iu=b._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0.apply(null,arguments)},Ju=b._emscripten_bind_b2Mat22_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ey_0.apply(null, +arguments)},Ku=b._emscripten_bind_b2Mat22_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Mat22_SetIdentity_0.apply(null,arguments)},Lu=b._emscripten_bind_b2Joint_IsActive_0=function(){return b.asm._emscripten_bind_b2Joint_IsActive_0.apply(null,arguments)},Mu=b._emscripten_bind_b2PulleyJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionForce_1.apply(null,arguments)},Nu=b._emscripten_bind_b2Shape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2Shape_get_m_radius_0.apply(null, +arguments)},Ou=b._emscripten_bind_b2Mat22_b2Mat22_4=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_4.apply(null,arguments)},Pu=b._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1.apply(null,arguments)},Qu=b._emscripten_bind_b2PolygonShape_SetAsBox_4=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_4.apply(null,arguments)},Ru=b._emscripten_bind_b2EdgeShape_set_m_vertex1_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex1_1.apply(null, +arguments)},Su=b._emscripten_bind_b2Body_GetWorld_0=function(){return b.asm._emscripten_bind_b2Body_GetWorld_0.apply(null,arguments)},Tu=b._emscripten_enum_b2LimitState_e_inactiveLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_inactiveLimit.apply(null,arguments)},Uu=b._emscripten_bind_b2Vec2_set_x_1=function(){return b.asm._emscripten_bind_b2Vec2_set_x_1.apply(null,arguments)},Vu=b._emscripten_bind_b2Body_SetAwake_1=function(){return b.asm._emscripten_bind_b2Body_SetAwake_1.apply(null, +arguments)},Wu=b._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0.apply(null,arguments)},Xu=b._emscripten_bind_b2Vec2___destroy___0=function(){return b.asm._emscripten_bind_b2Vec2___destroy___0.apply(null,arguments)},Yu=b._emscripten_enum_b2ShapeType_e_polygon=function(){return b.asm._emscripten_enum_b2ShapeType_e_polygon.apply(null,arguments)},Zu=b._emscripten_bind_b2Body_GetInertia_0=function(){return b.asm._emscripten_bind_b2Body_GetInertia_0.apply(null, +arguments)},$u=b._emscripten_bind_b2PulleyJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorA_0.apply(null,arguments)},av=b._emscripten_bind_b2BodyDef_get_linearVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearVelocity_0.apply(null,arguments)},bv=b._emscripten_bind_b2DistanceJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyB_0.apply(null,arguments)},cv=b._emscripten_bind_b2Mat22___destroy___0=function(){return b.asm._emscripten_bind_b2Mat22___destroy___0.apply(null, +arguments)},dv=b._emscripten_bind_b2RevoluteJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetNext_0.apply(null,arguments)},ev=b._emscripten_bind_b2WeldJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyA_0.apply(null,arguments)},fv=b._emscripten_bind_b2MotorJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorB_0.apply(null,arguments)},gv=b._emscripten_bind_b2Fixture_GetShape_0=function(){return b.asm._emscripten_bind_b2Fixture_GetShape_0.apply(null, +arguments)},hv=b._emscripten_bind_b2PulleyJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionTorque_1.apply(null,arguments)},iv=b._emscripten_bind_b2Vec3_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec3_op_mul_1.apply(null,arguments)},jv=b._emscripten_bind_b2PolygonShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_type_1.apply(null,arguments)},kv=b._emscripten_bind_b2WheelJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetType_0.apply(null, +arguments)},lv=b._emscripten_bind_b2MotorJoint_GetAngularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAngularOffset_0.apply(null,arguments)},mv=b._emscripten_bind_b2RevoluteJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsActive_0.apply(null,arguments)},nv=b._emscripten_bind_b2GearJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetNext_0.apply(null,arguments)},ov=b._emscripten_bind_b2MouseJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_maxForce_0.apply(null, +arguments)},pv=b._emscripten_bind_b2DestructionListenerWrapper___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListenerWrapper___destroy___0.apply(null,arguments)},qv=b._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1.apply(null,arguments)},rv=b._emscripten_bind_b2WheelJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAxisA_0.apply(null,arguments)},sv=b._emscripten_bind_b2Body_GetNext_0= +function(){return b.asm._emscripten_bind_b2Body_GetNext_0.apply(null,arguments)},tv=b._emscripten_bind_b2MouseJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionForce_1.apply(null,arguments)},uv=b._emscripten_bind_b2RopeJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyA_0.apply(null,arguments)},vv=b._emscripten_bind_b2ContactFeature_set_indexA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexA_1.apply(null,arguments)}, +wv=b._emscripten_bind_b2Profile_get_solveInit_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveInit_0.apply(null,arguments)},xv=b._emscripten_bind_b2Fixture_IsSensor_0=function(){return b.asm._emscripten_bind_b2Fixture_IsSensor_0.apply(null,arguments)},yv=b._emscripten_bind_b2FrictionJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorB_0.apply(null,arguments)},zv=b._emscripten_bind_b2World_QueryAABB_2=function(){return b.asm._emscripten_bind_b2World_QueryAABB_2.apply(null, +arguments)},Av=b._emscripten_bind_b2Profile_set_collide_1=function(){return b.asm._emscripten_bind_b2Profile_set_collide_1.apply(null,arguments)},Bv=b._emscripten_bind_b2BodyDef_get_userData_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_userData_0.apply(null,arguments)},Cv=b._emscripten_bind_b2MotorJoint_SetLinearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetLinearOffset_1.apply(null,arguments)},Dv=b._emscripten_bind_b2FrictionJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxForce_0.apply(null, +arguments)},Ev=b._emscripten_bind_b2WheelJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_userData_0.apply(null,arguments)},Fv=b._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0.apply(null,arguments)},Gv=b._emscripten_bind_b2World_SetDestructionListener_1=function(){return b.asm._emscripten_bind_b2World_SetDestructionListener_1.apply(null,arguments)},Hv=b._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1.apply(null,arguments)},Iv=b._emscripten_bind_b2WeldJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyB_1.apply(null,arguments)},Jv=b._emscripten_bind_b2Transform_set_p_1=function(){return b.asm._emscripten_bind_b2Transform_set_p_1.apply(null,arguments)},Kv=b._emscripten_bind_b2DistanceJoint_SetLength_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetLength_1.apply(null,arguments)}, +Lv=b._emscripten_bind_b2ManifoldPoint_get_localPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_localPoint_0.apply(null,arguments)},Mv=b._emscripten_bind_b2JointEdge_get_joint_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_joint_0.apply(null,arguments)},Nv=b._emscripten_bind_b2Body_GetLocalCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetLocalCenter_0.apply(null,arguments)},Ov=b._emscripten_bind_b2FixtureDef___destroy___0=function(){return b.asm._emscripten_bind_b2FixtureDef___destroy___0.apply(null, +arguments)},Pv=b._emscripten_bind_b2MouseJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJoint___destroy___0.apply(null,arguments)},Qv=b._emscripten_enum_b2JointType_e_ropeJoint=function(){return b.asm._emscripten_enum_b2JointType_e_ropeJoint.apply(null,arguments)},Rv=b._emscripten_bind_b2Profile_get_solveVelocity_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveVelocity_0.apply(null,arguments)},Sv=b._emscripten_bind_b2WeldJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyB_0.apply(null, +arguments)},Tv=b._emscripten_bind_b2World_GetContinuousPhysics_0=function(){return b.asm._emscripten_bind_b2World_GetContinuousPhysics_0.apply(null,arguments)},Uv=b._emscripten_bind_b2Joint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyA_0.apply(null,arguments)},Vv=b._emscripten_bind_b2MotorJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxTorque_1.apply(null,arguments)},Wv=b._emscripten_bind_b2PulleyJointDef_Initialize_7=function(){return b.asm._emscripten_bind_b2PulleyJointDef_Initialize_7.apply(null, +arguments)},Xv=b._emscripten_bind_b2GearJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyB_1.apply(null,arguments)},Yv=b._emscripten_bind_b2RopeJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionTorque_1.apply(null,arguments)},Zv=b._emscripten_bind_b2WheelJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_dampingRatio_1.apply(null,arguments)},$v=b._emscripten_bind_b2GearJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2GearJoint_GetType_0.apply(null,arguments)},aw=b._emscripten_bind_b2MotorJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetNext_0.apply(null,arguments)},bw=b._emscripten_bind_b2EdgeShape_set_m_vertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex0_1.apply(null,arguments)},cw=b._emscripten_bind_b2RevoluteJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorB_0.apply(null,arguments)}, +dw=b._emscripten_bind_b2RopeJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorB_1.apply(null,arguments)},ew=b._emscripten_bind_b2PrismaticJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUserData_0.apply(null,arguments)},fw=b._emscripten_bind_b2GearJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_userData_1.apply(null,arguments)},gw=b._emscripten_bind_b2Fixture_SetSensor_1=function(){return b.asm._emscripten_bind_b2Fixture_SetSensor_1.apply(null, +arguments)},hw=b._emscripten_bind_b2MotorJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_collideConnected_1.apply(null,arguments)},iw=b._emscripten_bind_b2Contact_GetFixtureB_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureB_0.apply(null,arguments)},jw=b._emscripten_bind_b2ChainShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeMass_2.apply(null,arguments)},kw=b._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0.apply(null,arguments)},lw=b._emscripten_bind_b2Contact_GetChildIndexA_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexA_0.apply(null,arguments)},mw=b._emscripten_bind_b2RopeJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyB_0.apply(null,arguments)},nw=b._emscripten_bind_b2BodyDef_b2BodyDef_0=function(){return b.asm._emscripten_bind_b2BodyDef_b2BodyDef_0.apply(null,arguments)}, +ow=b._emscripten_bind_b2MassData_get_mass_0=function(){return b.asm._emscripten_bind_b2MassData_get_mass_0.apply(null,arguments)},pw=b._emscripten_bind_b2WorldManifold_get_separations_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_separations_1.apply(null,arguments)},qw=b._emscripten_bind_b2Joint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyB_0.apply(null,arguments)},rw=b._emscripten_bind_b2Shape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2Shape_GetChildCount_0.apply(null, +arguments)},sw=b._emscripten_bind_b2WheelJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAxisA_1.apply(null,arguments)},tw=b._emscripten_bind_b2Joint_Dump_0=function(){return b.asm._emscripten_bind_b2Joint_Dump_0.apply(null,arguments)},uw=b._emscripten_bind_b2World_SetContactFilter_1=function(){return b.asm._emscripten_bind_b2World_SetContactFilter_1.apply(null,arguments)},vw=b._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1.apply(null, +arguments)},ww=b._emscripten_bind_b2MotorJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyA_0.apply(null,arguments)},xw=b._emscripten_bind_b2WheelJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_enableMotor_0.apply(null,arguments)},yw=b._emscripten_bind_b2Vec2_LengthSquared_0=function(){return b.asm._emscripten_bind_b2Vec2_LengthSquared_0.apply(null,arguments)},zw=b._emscripten_bind_b2FrictionJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyA_1.apply(null, +arguments)},Aw=b._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0.apply(null,arguments)},Bw=b._emscripten_bind_b2ContactEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_prev_1.apply(null,arguments)},Cw=b._emscripten_bind_b2Shape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2Shape_ComputeMass_2.apply(null,arguments)},Dw=b._emscripten_bind_b2FrictionJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyA_0.apply(null, +arguments)},Ew=b._emscripten_bind_b2WheelJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorB_1.apply(null,arguments)},Fw=b._emscripten_bind_b2Body_GetAngle_0=function(){return b.asm._emscripten_bind_b2Body_GetAngle_0.apply(null,arguments)},Gw=b._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0.apply(null,arguments)},Hw=b._emscripten_bind_b2DistanceJoint_GetBodyA_0= +function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyA_0.apply(null,arguments)},Iw=b._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0.apply(null,arguments)},Jw=b._emscripten_bind_b2PulleyJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyA_1.apply(null,arguments)},Kw=b._emscripten_bind_b2WheelJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorB_0.apply(null, +arguments)},Lw=b._emscripten_bind_b2PolygonShape_SetAsBox_2=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_2.apply(null,arguments)},Mw=b._emscripten_bind_b2PrismaticJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_type_0.apply(null,arguments)},Nw=b._emscripten_bind_b2Color_Set_3=function(){return b.asm._emscripten_bind_b2Color_Set_3.apply(null,arguments)},Ow=b._emscripten_bind_b2WheelJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyA_0.apply(null, +arguments)},Pw=b._emscripten_enum_b2LimitState_e_atUpperLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atUpperLimit.apply(null,arguments)},Qw=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1.apply(null,arguments)},Rw=b._emscripten_bind_b2PolygonShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_type_0.apply(null,arguments)},Sw=b._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1= +function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1.apply(null,arguments)},Tw=b._emscripten_bind_b2PulleyJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_collideConnected_0.apply(null,arguments)},Uw=b._emscripten_bind_JSContactListener_JSContactListener_0=function(){return b.asm._emscripten_bind_JSContactListener_JSContactListener_0.apply(null,arguments)},Vw=b._emscripten_bind_b2WheelJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJoint___destroy___0.apply(null, +arguments)},Ww=b._emscripten_bind_b2PolygonShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_radius_1.apply(null,arguments)},Xw=b._emscripten_bind_b2Fixture_GetMassData_1=function(){return b.asm._emscripten_bind_b2Fixture_GetMassData_1.apply(null,arguments)},Yw=b._emscripten_bind_b2RopeJoint_SetMaxLength_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetMaxLength_1.apply(null,arguments)};b.dynCall_iiii=function(){return b.asm.dynCall_iiii.apply(null,arguments)}; +b.dynCall_viifii=function(){return b.asm.dynCall_viifii.apply(null,arguments)};b.dynCall_viiiii=function(){return b.asm.dynCall_viiiii.apply(null,arguments)};b.dynCall_vi=function(){return b.asm.dynCall_vi.apply(null,arguments)};b.dynCall_vii=function(){return b.asm.dynCall_vii.apply(null,arguments)};b.dynCall_ii=function(){return b.asm.dynCall_ii.apply(null,arguments)};b.dynCall_fif=function(){return b.asm.dynCall_fif.apply(null,arguments)}; +b.dynCall_viii=function(){return b.asm.dynCall_viii.apply(null,arguments)};b.dynCall_viifi=function(){return b.asm.dynCall_viifi.apply(null,arguments)};b.dynCall_v=function(){return b.asm.dynCall_v.apply(null,arguments)};b.dynCall_viif=function(){return b.asm.dynCall_viif.apply(null,arguments)};b.dynCall_viiiiii=function(){return b.asm.dynCall_viiiiii.apply(null,arguments)};b.dynCall_iii=function(){return b.asm.dynCall_iii.apply(null,arguments)}; +b.dynCall_iiiiii=function(){return b.asm.dynCall_iiiiii.apply(null,arguments)};b.dynCall_fiiiif=function(){return b.asm.dynCall_fiiiif.apply(null,arguments)};b.dynCall_viiii=function(){return b.asm.dynCall_viiii.apply(null,arguments)};f.t=b.stackAlloc;f.L=b.stackSave;f.K=b.stackRestore;f.R=b.establishStackSpace;f.f=b.setTempRet0;f.H=b.getTempRet0;b.asm=Sb; +if(zb)if("function"===typeof b.locateFile?zb=b.locateFile(zb):b.memoryInitializerPrefixURL&&(zb=b.memoryInitializerPrefixURL+zb),ea||fa){var Zw=b.readBinary(zb);Da.set(Zw,f.i)}else{var ax=function(){b.readAsync(zb,$w,function(){throw"could not load memory initializer "+zb;})};xb();var $w=function(a){a.byteLength&&(a=new Uint8Array(a));Da.set(a,f.i);b.memoryInitializerRequest&&delete b.memoryInitializerRequest.response;yb()};if(b.memoryInitializerRequest){var bx=function(){var a=b.memoryInitializerRequest; +200!==a.status&&0!==a.status?(console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+a.status+", retrying "+zb),ax()):$w(a.response)};b.memoryInitializerRequest.response?setTimeout(bx,0):b.memoryInitializerRequest.addEventListener("load",bx)}else ax()}b.then=function(a){if(b.calledRun)a(b);else{var c=b.onRuntimeInitialized;b.onRuntimeInitialized=function(){c&&c();a(b)}}return b}; +function ja(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}ja.prototype=Error();ja.prototype.constructor=ja;var cx=null,wb=function dx(){b.calledRun||ex();b.calledRun||(wb=dx)}; +b.callMain=b.O=function(a){function c(){for(var a=0;3>a;a++)e.push(0)}a=a||[];pb||(pb=!0,hb(jb));var d=a.length+1,e=[Ba(rb(b.thisProgram),"i8",0)];c();for(var g=0;g%","[[6,\" \"],[4,\"il.;:!'|\"],[6,\"j1,()[]`\"],[8,\"CEFILTZcfrtx-\\\"°+=*<>\"],[10,\"ABDGHJKNOPQRSUVXYabdeghknopqsuvyz023456789?_~£€\"],[12,\"MWmw#&\\/@%$\"]]",0.8,0,-5,1,0,0,true,1]],[[-128,130,0,16,10,0,0,[1,1,1,0.1],0.5,0.5,0,0,[],null,null,null,["",""]],18,110,[0],[],[true,"Animation 1",0,true]],[[-85,132,0,8,41,0,0,[1,1,1,0.55],0.5,0.5,0,0,[],null,null,null,["",""]],35,111,[0],[[false]],[false,"Animation 1",0,true]],[[-106,145,0,12,33,0,0,[1,1,1,1],0.5833333333333334,0.48484848484848486,0,0,[],null,null,null,["",""]],9,112,[0],[[false]],[true,"Animation 1",0,true]],[[-59,121,0,9,12,0,0,[1,1,1,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],11,113,[0],[[false]],[true,"Animation 1",0,true]],[[-74,121,0,9,12,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],10,114,[0,-1],[[true,2,false,1,0,0,0,0.01,false,true]],[true,"Animation 1",0,true]],[[-72,164,0,14,33,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,1,0,0,[],null,null,null,["",""]],7,115,[0,-1,0,1,0],[[true,0,true,0,1,0,0,0,false,true],[]],[true,"Animation 1",0,true]],[[-107,124,0,8,11,0,0,[1,1,1,1],0.625,0.36363636363636365,0,0,[],null,null,null,["",""]],16,116,[0],[[false]],[true,"Animation 1",0,true]],[[-96,109,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,117,[0],[[false]],[true,"Animation 1",0,true]],[[-108,108,0,10,10,0,0,[1,1,1,1],0.7,0.5,0,0,[],null,null,null,["",""]],14,118,[0],[[false]],[true,"Animation 1",0,true]],[[-67,106,0,11,9,0,0,[1,1,1,1],0.7272727272727273,0.6666666666666666,0,0,[],null,null,null,["",""]],15,120,[0],[[false]],[true,"Animation 1",1,true]],[[46,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,122,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[-27,107,0,7,22,0,0,[1,1,1,1],0.5,0.13636363636363635,0,0,[],null,null,null,["",""]],79,127,[0,0],[[false]],[true,"Animation 1",0,true]],[[292,65,0,23.000000000000004,46.00000000000001,0,0,[1,1,1,0.3],0.023809523809523808,0.5,1,0,[],null,null,null,["",""]],84,25,[],[[0,0,0.3,true,true]],[true,"Animation 1",0,true]],[[402,-44,0,10,12,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],85,87,[],[[false],[true],[]],[true,"Animation 1",5,true]],[[509,-32,0,8,8,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],86,88,[],[[true]],[false,"Animation 1",0,true]],[[603,-24,0,72,72,0,0,[1,1,1,1],0.5,0.527778,0,0,[],null,null,null,["",""]],87,89,[],[[0,0.3,0.1,true,true]],[true,"Default",0,true]],[[46,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,94,[0],[[false]],[true,"Animation 1",0,true]],[[66,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,138,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[66,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,139,[0],[[false]],[true,"Animation 1",1,true]],[[82,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,140,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[82,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,141,[0],[[false]],[true,"Animation 1",2,true]],[[104,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,142,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[104,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,143,[0],[[false]],[true,"Animation 1",3,true]],[[126,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,145,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[126,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,146,[0],[[false]],[true,"Animation 1",4,true]],[[149,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,147,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[149,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,148,[0],[[false]],[true,"Animation 1",5,true]],[[172,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,149,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[172,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,150,[0],[[false]],[true,"Animation 1",6,true]],[[193,65,0,7,14,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,152,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[193,65,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,null,null,["",""]],88,154,[0],[[false]],[true,"Animation 1",7,true]],[[694,-41,0,13,13,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],92,178,[],[[true]],[true,"Animation 1",0,true]],[[480,105,0,56.00000000000001,56.00000000000001,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],96,187,[0],[[true]],[true,"Default",0,true]],[[594,96,0,16,10,0,0,[1,1,1,0.1],0.5,0.5,0,0,[],null,null,null,["",""]],18,10,[2],[],[true,"Animation 1",0,true]],[[597,77,0,8,41,0,0,[1,1,1,0.55],0.5,0.5,0,0,[],null,null,null,["",""]],38,17,[],[[false]],[false,"Animation 1",0,true]],[[597,82,0,12,33,0,0,[1,1,1,1],0.5833333333333334,0.48484848484848486,0,0,[],null,null,null,["",""]],9,19,[2],[[false]],[true,"Animation 1",0,true]],[[597,68,0,9,12,0,0,[1,1,1,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],11,24,[2],[[false]],[true,"Animation 1",0,true]],[[597,68,0,9,12,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],36,26,[0,-1],[[false,2,false,1,0,1,0,0.01,false,true]],[true,"Animation 1",0,true]],[[597,98,0,14,33,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,1,0,0,[],null,null,null,["",""]],37,28,[3,-1,0,1,0],[[false,0,true,0,1,0,0,0,false,true],[]],[true,"Animation 1",0,true]],[[598,82,0,8,11,0,0,[1,1,1,1],0.625,0.36363636363636365,0,0,[],null,null,null,["",""]],16,42,[2],[[false]],[true,"Animation 1",1,true]],[[598,93,0,10,10,0,0,[1,1,1,1],0.7,0.5,0,0,[],null,null,null,["",""]],14,68,[2],[[false]],[true,"Animation 1",0,true]],[[598,63,0,12,9,0,0,[1,1,1,1],0.7500000000000003,0.6666666666666666,0,0,[],null,null,null,["",""]],15,69,[2],[[false]],[true,"Animation 1",6,true]],[[597,73,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,70,[2],[[false]],[true,"Animation 1",0,true]],[[600,71,0,7,22,0,0,[1,1,1,1],0.5,0.13636363636363635,0,0,[],null,[127,[[920516926963411,0,72,115,0,126]],125],null,["",""]],70,71,[0,0],[[true]],[true,"Animation 1",0,true]],[[600,71,0,5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,[115,null,126],null,["",""]],88,72,[2],[[false]],[true,"Animation 1",0,true]],[[556,96,0,16,10,0,0,[1,1,1,0.1],0.5,0.5,0,0,[],null,null,null,["",""]],18,7,[4],[],[true,"Animation 1",0,true]],[[554,77,0,8,41,0,0,[1,1,1,0.55],0.5,0.5,0,0,[],null,null,null,["",""]],41,11,[],[[false]],[false,"Animation 1",0,true]],[[554,82,0,-12,33,0,0,[1,1,1,1],0.5833333333333334,0.48484848484848486,0,0,[],null,null,null,["",""]],9,13,[4],[[false]],[true,"Animation 1",0,true]],[[554,68,0,-9,12,0,0,[1,1,1,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],11,21,[4],[[false]],[true,"Animation 1",0,true]],[[554,68,0,-9,12,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],39,29,[0,-1],[[false,2,false,1,0,1,0,0.01,false,true]],[true,"Animation 1",0,true]],[[554,98,0,-14,33,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,1,0,0,[],null,null,null,["",""]],40,34,[3,-1,0,1,0],[[false,0,true,0,1,0,0,0,false,true],[]],[true,"Animation 1",0,true]],[[553,82,0,-8,11,0,0,[1,1,1,1],0.625,0.36363636363636365,0,0,[],null,null,null,["",""]],16,35,[4],[[false]],[true,"Animation 1",3,true]],[[553,93,0,10,10,0,0,[1,1,1,1],0.7,0.5,0,0,[],null,null,null,["",""]],14,36,[4],[[false]],[true,"Animation 1",0,true]],[[553,63,0,-11,10,0,0,[1,1,1,1],0.7272727272727273,0.6666666666666666,0,0,[],null,null,null,["",""]],15,39,[4],[[false]],[true,"Animation 1",1,true]],[[554,73,0,-8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,40,[4],[[false]],[true,"Animation 1",0,true]],[[551,71,0,7,22,0,0,[1,1,1,1],0.5,0.13636363636363635,0,0,[],null,[127,[[920516926963411,0,75,115,0,138]],137],null,["",""]],72,74,[0,0],[[true]],[true,"Animation 1",0,true]],[[551,71,0,-5,20,0,0,[1,1,1,1],0.5,0.1,0,0,[],null,[115,null,138],null,["",""]],88,75,[4],[[false]],[true,"Animation 1",0,true]],[[240,136,0,8,41,0,0,[1,1,1,0.55],0.5,0.5,0,0,[],null,null,null,["",""]],35,31,[0],[[false]],[false,"Animation 1",0,true]],[[240,141,0,12,33,0,0,[1,1,1,1],0.5833333333333334,0.48484848484848486,0,0,[],null,null,null,["",""]],9,65,[0],[[false]],[true,"Animation 1",0,true]],[[240,127,0,9,12,0,0,[1,1,1,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],11,77,[0],[[false]],[true,"Animation 1",0,true]],[[240,127,0,9,12,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.6666666666666666,0.8333333333333334,0,0,[],null,null,null,["",""]],10,79,[0,-1],[[false,2,false,1,0,1,0,0.01,false,true]],[true,"Animation 1",0,true]],[[240,157,0,14,33,0,0,[0.9647058823529412,0.792156862745098,0.6235294117647059,1],0.5,1,0,0,[],null,null,null,["",""]],7,81,[0,-1,0,1,0],[[false,0,true,0,1,0,0,0,false,true],[]],[true,"Animation 1",0,true]],[[241,141,0,8,11,0,0,[1,1,1,1],0.625,0.36363636363636365,0,0,[],null,null,null,["",""]],16,82,[0],[[false]],[true,"Animation 1",6,true]],[[241,152,0,10,10,0,0,[1,1,1,1],0.7,0.5,0,0,[],null,null,null,["",""]],14,83,[0],[[false]],[true,"Animation 1",0,true]],[[241,122,0,11,9,0,0,[1,1,1,1],0.7272727272727273,0.6666666666666666,0,0,[],null,null,null,["",""]],15,84,[0],[[false]],[true,"Animation 1",1,true]],[[243,130,0,7,14,0,0,[1,1,1,1],0.5,0.21428571428571427,0,0,[],null,[127,null,147],null,["",""]],69,85,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[190,116,0,7,14,0,0.7853981633974483,[1,1,1,1],0.5,0.21428571428571427,0,0,[],null,null,null,["",""]],69,92,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[173,119,0,7,12,0,2.356194490192345,[1,1,1,1],0.5,0.16666666666666666,0,0,[],null,null,null,["",""]],97,93,[0,0,0],[[true]],[true,"Animation 1",0,true]],[[439.6330336804202,-60.11748205547707,0,30.775157928,30.775157928,0,0,[1,1,1,1],0,0.5,0,0,[],null,null,null,["",""]],99,96,[],[],[5,360,1,-1,20,4,100,-8,3,3,0,4,0,0,0,0,0,0,1,0.6]],[[106,132,0,59,14,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[920516926963411,0,162,127,0,163]],151],null,["",""]],103,62,[0],[[],[true],["value offsety -20; duration type 0.025; duration fade 0.1",0,"",true]],["3",true,12,14,"0123456789","[[5,\"1\"],[10,\"023456789\"]]",1,1,0,1,1,0,true,4]],[[45,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,76,[0],[[false]],[true,"Animation 1",0,true]],[[63,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,86,[0],[[false]],[true,"Animation 1",1,true]],[[82,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,97,[0],[[false]],[true,"Animation 1",2,true]],[[103,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,99,[0],[[false]],[true,"Animation 1",3,true]],[[126,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,100,[0],[[false]],[true,"Animation 1",4,true]],[[148,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,102,[0],[[false]],[true,"Animation 1",5,true]],[[171,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,103,[0],[[false]],[true,"Animation 1",6,true]],[[192,29,0,8,13,0,0,[1,1,1,1],0.5,0.46153846153846156,0,0,[],null,null,null,["",""]],17,124,[0],[[false]],[true,"Animation 1",7,true]],[[368,26,0,14,12,0,0,[1,1,1,1],0.7857142857142857,0.4583333333333333,0,0,[],null,null,null,["",""]],105,137,[],[[200,0,0,false,false,false,true]],[true,"Animation 1",0,true]],[[331,23,0,14,12,0,0,[1,1,1,1],0.2142857142857143,0.4583333333333333,0,0,[],null,[127,null,161],null,["",""]],106,156,[],[[200,0,0,false,false,false,true]],[true,"Animation 1",0,true]],[[395,16,0,8,8,0,0,[1,0.8666666666666667,0,1],0.5,0.5,0,0,[],null,null,null,["",""]],107,159,[],[[true]],[true,"Animation 1",0,true]],[[106,154,0,30,30,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,null,163],null,["",""]],108,162,[],[],[true,"Animation 1",0,true]]],[],0,true,false,[]]],[],[]],["intro",290,190,true,false,0.5,0.5,"introEvent",368582379828410,[["Layer 0",0,537390446862752,true,[94,94,94],false,1,1,1,false,false,1,0,true,[],[],0,true,false,[]],["Top",1,407097048176507,true,[94,94,94],true,1,1,1,false,false,1,0,true,[[[145,95,0,429,265,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],58,349,[],[],[true,"Default",0,true]],[[145,95,0,16,16,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,null,null,["",""]],59,350,[],[],[true,"Default",0,true]],[[145,95,0,63,21,0,0,[1,1,1,1],0.504,0.512195,0,0,[],null,null,null,["",""]],60,351,[],[[5,0,1,0,0,0,1,0,true]],[true,"Default",0,true]]],[],0,true,false,[]]],[],[]],["create1",580,380,false,false,0.5,0.5,null,419256803728893,[["Game",0,264689683044690,true,[94,94,94],false,1,1,1,false,false,1,0,true,[[[141,99,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,0],null,["",""]],13,390,[],[],[false,"Animation 1",0,true]],[[153,111,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[419256803728893,0,390,127,0,0]],1],null,["",""]],109,391,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]],[[126,105,0,18,18,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,2],null,["",""]],13,186,[],[],[false,"Animation 1",0,true]],[[135,114,0,18,18,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[419256803728893,0,186,127,0,2]],3],null,["",""]],109,188,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",0,true]],[[123,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,4],null,["",""]],13,185,[],[],[false,"Animation 1",0,true]],[[135,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[419256803728893,0,185,127,0,4]],5],null,["",""]],109,189,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]],[[144,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,6],null,["",""]],13,388,[],[],[false,"Animation 1",0,true]],[[156,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[419256803728893,0,388,127,0,6]],7],null,["",""]],109,389,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]]],[],0,true,false,[]]],[],[]],["create2",580,380,false,false,0.5,0.5,null,702819853530080,[["Game",0,292583189619665,true,[94,94,94],false,1,1,1,false,false,1,0,true,[[[136,90,0,18,18,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,0],null,["",""]],13,392,[],[],[false,"Animation 1",0,true]],[[145,99,0,18,18,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[702819853530080,0,392,127,0,0]],1],null,["",""]],109,393,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",0,true]],[[129,105,0,18,18,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,2],null,["",""]],13,394,[],[],[false,"Animation 1",0,true]],[[138,114,0,18,18,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[702819853530080,0,394,127,0,2]],3],null,["",""]],109,395,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",0,true]],[[144,105,0,18,18,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,4],null,["",""]],13,396,[],[],[false,"Animation 1",0,true]],[[153,114,0,18,18,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[702819853530080,0,396,127,0,4]],5],null,["",""]],109,397,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",0,true]],[[123,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,6],null,["",""]],13,398,[],[],[false,"Animation 1",0,true]],[[135,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[702819853530080,0,398,127,0,6]],7],null,["",""]],109,399,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]],[[144,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,8],null,["",""]],13,400,[],[],[false,"Animation 1",0,true]],[[156,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[702819853530080,0,400,127,0,8]],9],null,["",""]],109,401,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]]],[],0,true,false,[]]],[],[]],["create3",290,190,false,false,0.5,0.5,null,965205579923361,[["Game",0,150073749893406,true,[94,94,94],false,1,1,1,false,false,1,0,true,[[[137,84,0,18,18,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,0],null,["",""]],13,402,[],[],[false,"Animation 1",0,true]],[[146,93,0,18,18,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[965205579923361,0,402,127,0,0]],1],null,["",""]],109,403,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",0,true]],[[134,99,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,2],null,["",""]],13,404,[],[],[false,"Animation 1",0,true]],[[146,111,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[965205579923361,0,404,127,0,2]],3],null,["",""]],109,405,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]],[[124,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,4],null,["",""]],13,406,[],[],[false,"Animation 1",0,true]],[[136,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[965205579923361,0,406,127,0,4]],5],null,["",""]],109,407,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]],[[145,120,0,24,24,0,0,[0.9254901960784314,0.5137254901960784,0.5137254901960784,0.55],0,0,0,0,[],null,[127,null,6],null,["",""]],13,408,[],[],[false,"Animation 1",0,true]],[[157,132,0,24,24,0,0,[1,1,1,1],0.5,0.5,0,0,[],null,[127,[[965205579923361,0,408,127,0,6]],7],null,["",""]],109,409,[],[[false,0,false,0.75,0.5,0.2,0,0.01,false,true]],[true,"Animation 1",1,true]]],[],0,true,false,[]]],[],[]]],[["player1Event",[[3,[true,"P1"],false,null,358572348294868,1,[[-1,22,null,0,false,false,false,0,false,[[1,[0]]]]],[],[[0,0,false,null,661629218932610,2,[],[[69,23,null,620139406616185,0,null,[[0,[1,[1,7,24,false]]],[0,[1,[1,7,25,false]]]]]]],[0,0,false,null,593242181083741,3,[[-1,26,null,1,false,false,false,876331500105820,null]],[[7,27,"Physics",409178209044823,0,null,[[7,[2]],[4,10],[0,[3]],[0,[4]]]],[7,28,"Physics",469509747963619,0,null,[[3,1]]],[35,29,"Pin",198612293472283,0,null,[[4,7],[3,0]]]],[[0,0,false,null,934715757434220,4,[[9,30,null,0,false,false,false,568852100026373,null,[[10,0],[8,0],[7,[5]]]]],[[9,29,"Pin",674756769711161,0,null,[[4,7],[3,0]]]]],[0,0,false,null,413422421011319,5,[[11,30,null,0,false,false,false,715155388126363,null,[[10,0],[8,0],[7,[5]]]]],[[11,29,"Pin",458879077254011,0,null,[[4,10],[3,0]]]]]]],[0,0,false,null,310986542063623,6,[[-1,31,null,0,false,false,false,535869808332924,null,[[11,895506763348983],[8,0],[7,[5]]]]],[],[[0,0,true,null,942268121220674,7,[[7,32,null,0,false,false,false,359129687405720,null,[[4,13]]]],[],[[0,0,false,null,305147711732010,8,[[-1,33,null,0,false,false,false,586190033743681,null]],[[7,34,null,882087500883714,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[99,35,null,850901014100826,0,null,[[0,[7]]]],[99,36,null,276902331633500,0,null,[[0,[8]]]],[99,37,null,478921218949785,0,null,[[3,1]]]],[[0,0,false,null,206375801539629,9,[[19,30,null,0,false,false,false,166025710802051,null,[[10,0],[8,0],[7,[9]]]]],[[7,38,"Physics",441575487316895,0,null,[[0,[10,[0,7,"Physics",39,false]]],[0,[5]],[7,[5]]]]]],[0,0,false,null,151171419681710,10,[[7,40,null,0,false,false,false,450700339422295,null,[[8,5],[0,[11,[1,7,24,false]]]]]],[[7,41,null,223432172925536,0,null,[[10,2],[7,[12,[4,42],[3,455877582027442],[3,262420649510634]]]]]]],[0,0,false,null,178109828076252,11,[[7,40,null,0,false,false,false,103331473935911,null,[[8,2],[0,[11,[1,7,24,false]]]]]],[[7,41,null,758239535707998,0,null,[[10,2],[7,[13,[4,42],[3,455877582027442],[3,262420649510634]]]]]]]]],[0,0,false,null,165254138397271,12,[[7,30,null,0,false,false,false,649011108133010,null,[[10,3],[8,0],[7,[9]]]]],[[7,41,null,254087149024058,0,null,[[10,3],[7,[5]]]],[7,41,null,158780388755314,0,null,[[10,4],[7,[5]]]]]],[0,0,true,null,590053134686673,13,[[7,43,null,0,false,false,false,792593073511633,null,[[8,2],[0,[11,[1,7,25,false]]]]]],[],[[0,0,false,null,188956435583799,14,[[7,40,null,0,false,false,false,849793453035647,null,[[8,4],[0,[11,[1,7,24,false]]]]]],[[7,41,null,924795088830873,0,null,[[10,2],[7,[14,[3,412696536558178]]]]]]],[0,0,false,null,911891623733351,15,[[7,40,null,0,false,false,false,883364628927467,null,[[8,2],[0,[11,[1,7,24,false]]]]]],[[7,41,null,231415435354566,0,null,[[10,2],[7,[15,[3,412696536558178]]]]]]]]],[0,0,false,null,923406388592222,16,[],[[7,44,"Physics",731261780745839,0,null,[[0,[16,[2,7,false,2]]]]],[7,41,null,950051874338671,0,null,[[10,2],[7,[17,[2,7,false,2],[4,45],[3,585122294625856]]]]]]],[0,0,false,null,785167247567145,17,[[7,46,null,0,false,false,false,544913291003034,null,[[0,[18]],[0,[19]]]]],[[7,41,null,641585529710537,0,null,[[10,2],[7,[17,[2,7,false,2],[4,45],[3,585122294625856]]]]]]],[0,0,false,null,211203400027743,18,[[-1,47,null,0,false,false,false,978191480065098,null]],[],[[0,0,false,null,992431531742961,19,[[7,40,null,0,false,false,false,382560494008840,null,[[8,4],[0,[11,[1,7,24,false]]]]]],[[7,48,null,255558647631907,0,null,[[10,2],[7,[20,[3,730424728310926],[4,45],[3,548952495670197]]]]]]],[0,0,false,null,184912169702021,20,[[7,40,null,0,false,false,false,376803049627626,null,[[8,2],[0,[11,[1,7,24,false]]]]]],[[7,49,null,760124067943502,0,null,[[10,2],[7,[20,[3,730424728310926],[4,45],[3,548952495670197]]]]]]]]]]]]]]],[3,[true,"Control P1"],false,null,773979917705646,21,[[-1,22,null,0,false,false,false,0,false,[[1,[21]]]]],[],[[1,"upArrow",0,0,true,false,711563083397915,false,155],[1,"speed",0,13,false,false,257659733919073,false,156],[0,0,false,null,657275202096234,22,[],[[97,50,null,563056238157260,0,null,[[0,[22,[1,69,51,false]]]]]],[[0,0,true,null,841549651952849,23,[[35,30,null,0,false,false,false,453352545180116,null,[[10,0],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,991372131081586,null,[[11,308680730337585],[8,0],[7,[9]]]]],[[97,23,null,709284712941264,0,null,[[0,[11,[1,69,24,false]]],[0,[11,[1,69,25,false]]]]]]],[0,0,false,null,878504018707042,24,[[-1,47,null,0,false,false,false,813361019647243,null]],[[97,23,null,547117828822664,0,null,[[0,[23,[1,69,24,false]]],[0,[23,[1,69,25,false]]]]]]]]],[0,0,false,null,458282642056166,25,[[35,30,null,0,false,false,false,975836023773300,null,[[10,0],[8,0],[7,[5]]]]],[[69,52,null,906133014528721,0,null,[[0,[24,[2,69,false,2],[1,7,53,false]]]]],[97,52,null,357330422094531,0,null,[[0,[25,[2,69,false,2],[1,7,53,false]]]]]]],[0,0,false,null,491880697955141,26,[[-1,47,null,0,false,false,false,302245427110371,null]],[[69,52,null,841256073500936,0,null,[[0,[26,[4,54],[1,69,53,false],[1,7,53,false],[4,45]]]]],[97,52,null,835952239199672,0,null,[[0,[26,[4,54],[1,97,53,false],[1,7,53,false],[4,45]]]]]]],[0,0,false,null,725864200615173,27,[[-1,31,null,0,false,false,false,566727334670668,null,[[11,895506763348983],[8,0],[7,[5]]]]],[],[[0,0,true,null,946030165402141,28,[[-1,31,null,0,false,false,false,820066421753963,null,[[11,308680730337585],[8,0],[7,[9]]]]],[],[[0,0,false,null,122808219494980,29,[[98,55,null,0,false,false,false,664122835304697,null,[[8,0],[0,[9]]]]],[],[[0,0,false,null,628402734248274,30,[[-1,33,null,0,false,false,false,257785170693361,null]],[[98,34,null,548473448583916,259,null,[[4,105],[5,[6]],[7,[5]],[16,false]]],[12,56,null,635973906638694,0,null,[[2,["roket",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[98,57,null,162157729502861,0,null,[[0,[5]]]],[105,52,null,971501183348207,0,null,[[0,[22,[1,7,53,false]]]]],[105,58,"Bullet",494511673090682,0,null,[[3,1]]],[105,59,"Bullet",715491334765445,0,null,[[0,[28,[1,7,53,false]]]]]]]]],[0,0,false,null,899981654250281,31,[],[],[[0,0,false,null,699546004154399,32,[[7,30,null,0,false,false,false,964421288177689,null,[[10,4],[8,2],[7,[19]]]]],[[7,60,"Physics",506878634907225,0,null,[[0,[29,[3,393742379478916],[4,45]]],[0,[11,[1,7,24,false]]],[0,[11,[1,7,25,false]]],[7,[5]]]],[7,48,null,187614087486018,0,null,[[10,4],[7,[29,[3,118852720224131],[4,45]]]]]]],[0,0,false,null,476016184282325,33,[[-1,61,null,0,false,false,false,896860330710793,null,[[7,[16,[2,69,false,2]]],[8,2],[7,[30]]]]],[[69,41,null,982807755788617,0,null,[[10,2],[7,[31,[2,69,false,2],[3,257659733919073]]]]]]],[0,0,false,null,366724600043126,34,[[-1,47,null,0,false,false,false,434132272047745,null]],[[69,41,null,765341990918845,0,null,[[10,2],[7,[30]]]]]]]]]],[0,0,false,null,244741237681839,35,[[-1,47,null,0,false,false,false,110959927832715,null]],[[-1,62,null,358265183925160,0,null,[[11,711563083397915],[7,[5]]]]],[[0,0,false,null,222212373381606,36,[[-1,61,null,0,false,false,false,277214530001556,null,[[7,[16,[2,69,false,2]]],[8,4],[7,[9]]]]],[[69,41,null,289271383950512,0,null,[[10,2],[7,[32,[2,69,false,2],[3,257659733919073]]]]]]],[0,0,false,null,637981023839651,37,[[-1,47,null,0,false,false,false,259449078817219,null]],[[69,41,null,845388033847614,0,null,[[10,2],[7,[5]]]]]]]],[0,0,false,null,702678280556386,38,[[-1,31,null,0,false,false,false,687349995019924,null,[[11,308680730337585],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,173279213606157,null,[[11,711563083397915],[8,0],[7,[5]]]],[7,63,"Timer",0,false,true,false,781695763663376,null,[[1,[33]]]],[7,30,null,0,false,false,false,342407757546356,null,[[10,3],[8,0],[7,[5]]]]],[[-1,62,null,818248304575681,0,null,[[11,711563083397915],[7,[9]]]]],[[0,0,false,null,959178106646176,39,[[-1,33,null,0,false,false,false,564470550971583,null]],[[7,41,null,271900900734864,0,null,[[10,2],[7,[5]]]],[7,41,null,649749676458283,0,null,[[10,3],[7,[9]]]],[7,64,"Timer",225983661996222,0,null,[[0,[34]],[3,0],[1,[33]]]]],[[0,0,false,null,157299684838858,40,[[7,32,null,0,false,false,false,345424722146389,null,[[4,13]]]],[[7,60,"Physics",107351146073852,0,null,[[0,[14,[3,923804197831174]]],[0,[11,[1,7,24,false]]],[0,[11,[1,7,25,false]]],[7,[5]]]],[7,34,null,479024661759156,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[99,35,null,983354353039049,0,null,[[0,[7]]]],[99,36,null,530908005614445,0,null,[[0,[8]]]],[99,37,null,512044973046092,0,null,[[3,1]]],[7,65,"Physics",310998775689231,0,null,[[0,[5]],[0,[5]]]],[7,44,"Physics",387692832752883,0,null,[[0,[5]]]]]],[0,0,false,null,181977044853871,41,[[7,40,null,0,false,false,false,103803022414921,null,[[8,5],[0,[11,[1,7,24,false]]]]]],[[7,41,null,108129704733831,0,null,[[10,2],[7,[35,[1,7,66,false],[1,7,24,false]]]]]]],[0,0,false,null,849925058426814,42,[[7,40,null,0,false,false,false,726362170667594,null,[[8,2],[0,[11,[1,7,24,false]]]]]],[[7,41,null,256485207683431,0,null,[[10,2],[7,[35,[1,7,66,false],[1,7,24,false]]]]]]]]]]]]]]],[3,[true,"Skin P1"],false,null,151747921381704,43,[[-1,22,null,0,false,false,false,0,false,[[1,[36]]]]],[],[[0,0,false,null,127523010153940,44,[[-1,26,null,1,false,false,false,667353918404782,null]],[],[[0,0,false,null,771370272525417,45,[[15,30,null,0,false,false,false,362793171225709,null,[[10,0],[8,0],[7,[5]]]]],[[15,29,"Pin",310106108068067,0,null,[[4,10],[3,0]]]]],[0,0,false,null,157410180999361,46,[[14,30,null,0,false,false,false,569695464761998,null,[[10,0],[8,0],[7,[5]]]]],[[14,29,"Pin",631853399834632,0,null,[[4,7],[3,0]]]]],[0,0,false,null,449022685470371,47,[[16,30,null,0,false,false,false,253848280777568,null,[[10,0],[8,0],[7,[5]]]]],[[16,29,"Pin",603104718238034,0,null,[[4,7],[3,0]]]]],[0,0,false,null,314429908935790,48,[[17,30,null,0,false,false,false,492487144313120,null,[[10,0],[8,0],[7,[5]]]]],[[17,29,"Pin",687142109383193,0,null,[[4,7],[3,0]]]]]]],[0,0,false,null,827856178654243,49,[[18,30,null,0,false,false,false,767973367645181,null,[[10,0],[8,0],[7,[5]]]]],[[18,67,null,818111186263286,0,null,[[0,[37,[1,7,24,false]]]]],[18,68,null,139248267781031,0,null,[[0,[38,[4,69],[4,70],[1,18,71,false],[1,7,71,false]]]]]]]]]]],["player2Event",[]],["player3Event",[[3,[true,"P3"],false,null,382494310240054,1,[[-1,22,null,0,false,false,false,0,false,[[1,[39]]]]],[],[[0,0,false,null,111323974876343,2,[],[[71,23,null,858718590257076,0,null,[[0,[1,[1,32,24,false]]],[0,[1,[1,32,25,false]]]]]]],[0,0,false,null,750940904585247,3,[[-1,26,null,1,false,false,false,960198116291388,null]],[[32,27,"Physics",915576772409089,0,null,[[7,[2]],[4,31],[0,[3]],[0,[4]]]],[32,28,"Physics",497667266166404,0,null,[[3,1]]],[34,29,"Pin",596237907613739,0,null,[[4,32],[3,0]]]],[[0,0,false,null,406554981337087,4,[[9,30,null,0,false,false,false,953351399566515,null,[[10,0],[8,0],[7,[7]]]]],[[9,29,"Pin",875322160757097,0,null,[[4,32],[3,0]]]]],[0,0,false,null,230304047653791,5,[[11,30,null,0,false,false,false,721497225146556,null,[[10,0],[8,0],[7,[7]]]]],[[11,29,"Pin",206261383806501,0,null,[[4,31],[3,0]]]]]]],[0,0,false,null,495465135205289,6,[[-1,31,null,0,false,false,false,436570882246859,null,[[11,895506763348983],[8,0],[7,[5]]]]],[],[[0,0,true,null,162831961513535,7,[[32,32,null,0,false,false,false,688914432562100,null,[[4,13]]]],[],[[0,0,false,null,391179812726916,8,[[-1,33,null,0,false,false,false,286870797895315,null]],[[32,34,null,264741359448805,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[99,35,null,116391328677399,0,null,[[0,[7]]]],[99,36,null,128943843016755,0,null,[[0,[8]]]],[99,37,null,756642849498180,0,null,[[3,1]]]],[[0,0,false,null,642074166115191,9,[[19,30,null,0,false,false,false,612913020114458,null,[[10,0],[8,0],[7,[9]]]]],[[32,38,"Physics",974052011620780,0,null,[[0,[10,[0,32,"Physics",39,false]]],[0,[5]],[7,[5]]]]]],[0,0,false,null,452498062896228,10,[[32,40,null,0,false,false,false,359754945225867,null,[[8,5],[0,[11,[1,32,24,false]]]]]],[[32,41,null,669819915661034,0,null,[[10,2],[7,[40,[4,42],[3,455877582027442],[3,262420649510634],[2,32,false,1]]]]]]],[0,0,false,null,624334190989661,11,[[32,40,null,0,false,false,false,398042214327226,null,[[8,2],[0,[11,[1,32,24,false]]]]]],[[32,41,null,284855281285836,0,null,[[10,2],[7,[41,[4,42],[3,455877582027442],[3,262420649510634],[2,32,false,1]]]]]]],[0,0,false,null,726912204335243,12,[],[[32,41,null,171015972048121,0,null,[[10,1],[7,[9]]]]]]]],[0,0,false,null,660856117128697,13,[[32,30,null,0,false,false,false,669915714811043,null,[[10,3],[8,0],[7,[9]]]]],[[32,41,null,230532593851399,0,null,[[10,3],[7,[5]]]],[32,41,null,474116906570215,0,null,[[10,4],[7,[5]]]]]],[0,0,true,null,775070453295281,14,[[32,43,null,0,false,false,false,990666682436560,null,[[8,2],[0,[11,[1,32,25,false]]]]]],[],[[0,0,false,null,469878728707629,15,[[32,40,null,0,false,false,false,902604571855623,null,[[8,4],[0,[11,[1,32,24,false]]]]]],[[32,41,null,204810005300736,0,null,[[10,2],[7,[14,[3,412696536558178]]]]]]],[0,0,false,null,527961531609936,16,[[32,40,null,0,false,false,false,843435028112462,null,[[8,2],[0,[11,[1,32,24,false]]]]]],[[32,41,null,233146996535263,0,null,[[10,2],[7,[15,[3,412696536558178]]]]]]]]],[0,0,false,null,355005122068944,17,[],[[32,44,"Physics",617301639479810,0,null,[[0,[16,[2,32,false,2]]]]],[32,41,null,597895548236166,0,null,[[10,2],[7,[17,[2,32,false,2],[4,45],[3,585122294625856]]]]]]],[0,0,false,null,413112317691649,18,[[32,46,null,0,false,false,false,866893621044564,null,[[0,[18]],[0,[19]]]]],[[32,41,null,204628536799519,0,null,[[10,2],[7,[17,[2,32,false,2],[4,45],[3,585122294625856]]]]]]],[0,0,false,null,168904531703449,19,[[-1,47,null,0,false,false,false,946799459563348,null]],[],[[0,0,false,null,539764860680307,20,[[32,40,null,0,false,false,false,444250712297719,null,[[8,4],[0,[11,[1,32,24,false]]]]]],[[32,48,null,469448004114468,0,null,[[10,2],[7,[20,[3,730424728310926],[4,45],[3,548952495670197]]]]]]],[0,0,false,null,338316626035163,21,[[32,40,null,0,false,false,false,893459074143325,null,[[8,2],[0,[11,[1,32,24,false]]]]]],[[32,49,null,720141514507363,0,null,[[10,2],[7,[20,[3,730424728310926],[4,45],[3,548952495670197]]]]]]]]]]]]]]],[3,[true,"Control P3"],false,null,965517901142642,22,[[-1,22,null,0,false,false,false,0,false,[[1,[42]]]]],[],[[1,"upArrow",0,0,true,false,267837901477967,false,155],[1,"speed",0,13,false,false,681621315302548,false,156],[0,0,false,null,658638599197227,23,[],[[100,50,null,897274287056061,0,null,[[0,[22,[1,71,51,false]]]]]],[[0,0,true,null,462721857159632,24,[[34,30,null,0,false,false,false,587732100804527,null,[[10,0],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,643370933456226,null,[[11,284675396607854],[8,0],[7,[9]]]]],[[100,23,null,732214334940880,0,null,[[0,[11,[1,71,24,false]]],[0,[11,[1,71,25,false]]]]]]],[0,0,false,null,594226357371139,25,[[-1,47,null,0,false,false,false,515886218479619,null]],[[100,23,null,379792143452619,0,null,[[0,[23,[1,71,24,false]]],[0,[23,[1,71,25,false]]]]]]]]],[0,0,false,null,828702552118808,26,[[34,30,null,0,false,false,false,489366711882969,null,[[10,0],[8,0],[7,[5]]]]],[[100,52,null,294422055162232,0,null,[[0,[43,[1,32,53,false],[2,71,false,2]]]]],[71,52,null,328938076783582,0,null,[[0,[44,[1,32,53,false],[2,71,false,2]]]]]]],[0,0,false,null,622292425821922,27,[[-1,47,null,0,false,false,false,353252996725313,null]],[[71,52,null,414832010426396,0,null,[[0,[26,[4,54],[1,71,53,false],[1,32,53,false],[4,45]]]]],[100,52,null,765606593885728,0,null,[[0,[26,[4,54],[1,100,53,false],[1,32,53,false],[4,45]]]]]]],[0,0,false,null,614108099515919,28,[[-1,31,null,0,false,false,false,121901276770429,null,[[11,895506763348983],[8,0],[7,[5]]]]],[],[[0,0,false,null,708787583945531,29,[[-1,31,null,0,false,false,false,944623729759648,null,[[11,284675396607854],[8,0],[7,[9]]]]],[],[[0,0,false,null,502210379214595,30,[[101,55,null,0,false,false,false,505284367383905,null,[[8,0],[0,[9]]]]],[],[[0,0,false,null,585460502564258,31,[[-1,33,null,0,false,false,false,901991050728682,null]],[[101,34,null,245191072814266,259,null,[[4,106],[5,[6]],[7,[5]],[16,false]]],[12,56,null,266757643641415,0,null,[[2,["roket",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[101,57,null,148386313612104,0,null,[[0,[5]]]],[106,52,null,956347592815998,0,null,[[0,[22,[1,32,53,false]]]]],[106,58,"Bullet",896160509665445,0,null,[[3,1]]],[106,59,"Bullet",786645851338357,0,null,[[0,[22,[1,32,53,false]]]]]]]]],[0,0,false,null,938692439628333,32,[],[],[[0,0,false,null,686639762964698,33,[[32,30,null,0,false,false,false,874769129709949,null,[[10,4],[8,2],[7,[19]]]]],[[32,60,"Physics",561199452304554,0,null,[[0,[29,[3,393742379478916],[4,45]]],[0,[11,[1,32,24,false]]],[0,[11,[1,32,25,false]]],[7,[5]]]],[32,48,null,265289587328623,0,null,[[10,4],[7,[29,[3,118852720224131],[4,45]]]]]]],[0,0,false,null,845085860845074,34,[[-1,61,null,0,false,false,false,254403052111755,null,[[7,[16,[2,71,false,2]]],[8,2],[7,[30]]]]],[[71,41,null,525003688414969,0,null,[[10,2],[7,[31,[2,71,false,2],[3,681621315302548]]]]]]],[0,0,false,null,347270919383244,35,[[-1,47,null,0,false,false,false,230449727598999,null]],[[71,41,null,748917807243641,0,null,[[10,2],[7,[30]]]]]]]]]],[0,0,false,null,444358040598881,36,[[-1,47,null,0,false,false,false,190745137620572,null]],[[-1,62,null,280986605905812,0,null,[[11,267837901477967],[7,[5]]]]],[[0,0,false,null,901743096349906,37,[[-1,61,null,0,false,false,false,302427644525338,null,[[7,[16,[2,71,false,2]]],[8,4],[7,[9]]]]],[[71,41,null,553164421810399,0,null,[[10,2],[7,[32,[2,71,false,2],[3,681621315302548]]]]]]],[0,0,false,null,874298186925040,38,[[-1,47,null,0,false,false,false,756981585212016,null]],[[71,41,null,831995680311719,0,null,[[10,2],[7,[5]]]]]]]],[0,0,false,null,711176531458092,39,[[-1,31,null,0,false,false,false,878585482645329,null,[[11,284675396607854],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,159256985765861,null,[[11,267837901477967],[8,0],[7,[5]]]],[32,63,"Timer",0,false,true,false,633393014221717,null,[[1,[33]]]],[32,30,null,0,false,false,false,183872880779724,null,[[10,3],[8,0],[7,[5]]]]],[[-1,62,null,337681442884394,0,null,[[11,267837901477967],[7,[9]]]]],[[0,0,false,null,261883133179083,40,[[-1,33,null,0,false,false,false,283076242058296,null]],[[32,41,null,545069087730385,0,null,[[10,2],[7,[5]]]],[32,41,null,432362978513289,0,null,[[10,3],[7,[9]]]],[32,64,"Timer",583332434199312,0,null,[[0,[34]],[3,0],[1,[33]]]]],[[0,0,false,null,957415264246228,41,[[32,32,null,0,false,false,false,803886958644461,null,[[4,13]]]],[[32,60,"Physics",974439388075972,0,null,[[0,[14,[3,923804197831174]]],[0,[11,[1,32,24,false]]],[0,[11,[1,32,25,false]]],[7,[5]]]],[32,34,null,279004549928644,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[99,35,null,262003615254947,0,null,[[0,[7]]]],[99,36,null,717873373739357,0,null,[[0,[8]]]],[99,37,null,128048394073062,0,null,[[3,1]]],[32,65,"Physics",567435188932319,0,null,[[0,[5]],[0,[5]]]],[32,44,"Physics",872530368881234,0,null,[[0,[5]]]]]],[0,0,false,null,976573415600737,42,[[32,40,null,0,false,false,false,717989386211116,null,[[8,5],[0,[11,[1,32,24,false]]]]]],[[32,41,null,382906512822869,0,null,[[10,2],[7,[35,[1,32,66,false],[1,32,24,false]]]]]]],[0,0,false,null,552479425602948,43,[[32,40,null,0,false,false,false,525172195341378,null,[[8,2],[0,[11,[1,32,24,false]]]]]],[[32,41,null,296328330506953,0,null,[[10,2],[7,[35,[1,32,66,false],[1,32,24,false]]]]]]]]]]]]]]],[3,[true,"Skin P3"],false,null,168717394599589,44,[[-1,22,null,0,false,false,false,0,false,[[1,[45]]]]],[],[[0,0,false,null,292576625897886,45,[[-1,26,null,1,false,false,false,339028710976708,null]],[],[[0,0,false,null,843181496733442,46,[[15,30,null,0,false,false,false,895817254682155,null,[[10,0],[8,0],[7,[7]]]]],[[15,29,"Pin",918071152875969,0,null,[[4,31],[3,0]]]]],[0,0,false,null,152800731014898,47,[[14,30,null,0,false,false,false,561775432605314,null,[[10,0],[8,0],[7,[7]]]]],[[14,29,"Pin",441309693245052,0,null,[[4,32],[3,0]]]]],[0,0,false,null,324650356231595,48,[[16,30,null,0,false,false,false,415673189605104,null,[[10,0],[8,0],[7,[7]]]]],[[16,29,"Pin",841002527945159,0,null,[[4,32],[3,0]]]]],[0,0,false,null,372794028518337,49,[[17,30,null,0,false,false,false,166078580131082,null,[[10,0],[8,0],[7,[7]]]]],[[17,29,"Pin",587423019540421,0,null,[[4,32],[3,0]]]]]]],[0,0,false,null,249597469668388,50,[[18,30,null,0,false,false,false,914181172660330,null,[[10,0],[8,0],[7,[7]]]]],[[18,67,null,104320334916004,0,null,[[0,[37,[1,32,24,false]]]]],[18,68,null,233830842879330,0,null,[[0,[38,[4,69],[4,70],[1,18,71,false],[1,32,71,false]]]]]]]]]]],["player4Event",[]],["gameEvent",[[1,"angularMaxRND",0,150,false,false,262420649510634,false,157],[1,"angularMinRND",0,100,false,false,455877582027442,false,158],[1,"wooble",0,200,false,false,412696536558178,false,159],[1,"angularSub",0,8,false,false,730424728310926,false,160],[1,"snowSlip",0,2,false,true,385934528122174,false,161],[1,"P1Control",0,0,false,false,308680730337585,false,162],[1,"P2Control",0,0,false,false,284675396607854,false,163],[1,"p1Score",0,0,false,false,870248114194364,false,164],[1,"p2Score",0,0,false,false,336820796057693,false,165],[1,"goal",0,0,true,false,727009003176844,false,166],[1,"CPU",0,0,false,false,174118167449135,false,167],[1,"biz",0,0,false,false,462466925293457,false,168],[1,"sustain",0,40,false,false,870709009414344,false,169],[1,"gravity",0,7,false,false,319222429638591,false,170],[1,"jumpforce",0,500,false,false,923804197831174,false,171],[1,"active",0,0,false,false,342765078376117,false,172],[2,"menuEvent",false],[2,"bonusEvent",false],[2,"player1Event",false],[2,"pauseEvent",false],[2,"player2Event",false],[2,"player3Event",false],[2,"player4Event",false],[2,"MoreGamesButtons",false],[3,[true,"Create"],false,null,740371202745583,1,[[-1,22,null,0,false,false,false,0,false,[[1,[46]]]]],[],[[0,0,true,null,489828176588815,2,[[109,72,null,0,false,false,true,215236817187391,null,[[4,127]]],[109,72,null,0,false,false,true,435571619787615,null,[[4,128]]]],[],[[0,0,false,null,907671252048685,3,[[109,73,"Physics",0,false,false,false,285803121856155,null,[[3,2],[8,4],[0,[47]]]],[12,74,null,0,false,true,false,957511148692086,null,[[1,[48]]]]],[[12,56,null,403166298237522,0,null,[[2,["boxhit",false]],[3,0],[0,[5]],[0,[5]],[1,[48]]]],[109,34,null,620582613250290,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]]]]]],[0,0,false,null,991345226996732,4,[[98,32,null,0,false,false,false,252777305761030,null,[[4,109]]],[-1,31,null,0,false,false,false,474016628881362,null,[[11,308680730337585],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,673843080579053,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,621860945280554,null]],[[109,75,"Physics",509729456715298,0,null,[[0,[49]],[0,[50,[1,109,66,false],[1,109,71,false],[1,98,66,false],[1,98,71,false]]],[7,[5]]]],[12,56,null,267495159822437,0,null,[[2,["press",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[109,34,null,516872106604062,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]]]],[0,0,false,null,912177630441782,5,[[101,32,null,0,false,false,false,697275902192835,null,[[4,109]]],[-1,31,null,0,false,false,false,308330532645587,null,[[11,284675396607854],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,705504953993422,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,420075534285398,null]],[[109,75,"Physics",594391576266618,0,null,[[0,[49]],[0,[50,[1,109,66,false],[1,109,71,false],[1,101,66,false],[1,101,71,false]]],[7,[5]]]],[109,34,null,749478373612115,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[12,56,null,892485996170473,0,null,[[2,["press",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]]]]]],[3,[true,"Ball"],false,null,454542165934448,6,[[-1,22,null,0,false,false,false,0,false,[[1,[51]]]]],[],[[0,0,false,null,769237520676871,7,[[-1,26,null,1,false,false,false,988077025203488,null]],[[30,76,null,123662435707766,0,null,[[0,[5]],[0,[7]],[0,[9]]]],[30,77,null,604025613043937,0,null,[[0,[5]]]]]],[0,0,false,null,159822232518893,8,[[82,78,null,1,false,false,false,221252932351162,null]],[[82,79,"Bullet",828646149482646,0,null,[[0,[52,[2,82,false,0],[0,82,"Bullet",80,false]]]]]]],[0,0,false,null,282568532584743,9,[[105,43,null,0,false,false,false,764286989611427,null,[[8,4],[0,[53]]]]],[[105,81,null,174200171628860,0,null]]],[0,0,false,null,270102322522469,10,[[105,82,null,1,false,false,false,470328702841991,null]],[[105,34,null,436337772288741,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[12,56,null,531578919345864,0,null,[[2,["pof",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]]]],[0,0,true,null,811545808945810,11,[[105,43,null,0,false,false,false,413377124842135,null,[[8,2],[0,[55,[4,83]]]]],[105,40,null,0,false,false,false,825132509557704,null,[[8,2],[0,[55,[4,84]]]]],[105,40,null,0,false,false,false,940817157785960,null,[[8,4],[0,[55,[4,85]]]]]],[[105,81,null,681916865430333,0,null]]],[0,0,false,null,394361819817329,12,[[106,43,null,0,false,false,false,149668394408485,null,[[8,4],[0,[53]]]]],[[106,81,null,895778003483797,0,null]]],[0,0,false,null,839275458182082,13,[[106,82,null,1,false,false,false,156769340106205,null]],[[106,34,null,724278548578923,259,null,[[4,99],[5,[6]],[7,[5]],[16,false]]],[12,56,null,912683037703662,0,null,[[2,["pof",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]]]],[0,0,true,null,637029228525509,14,[[106,43,null,0,false,false,false,960755499639579,null,[[8,2],[0,[55,[4,83]]]]],[106,40,null,0,false,false,false,202382941337876,null,[[8,2],[0,[55,[4,84]]]]],[106,40,null,0,false,false,false,540068931899232,null,[[8,4],[0,[55,[4,85]]]]]],[[106,81,null,235012972480900,0,null]]],[0,0,false,null,911420942425283,15,[],[[105,34,null,455437599734441,259,null,[[4,107],[5,[6]],[7,[9]],[16,false]]],[107,86,null,468967634047300,0,null,[[3,1],[4,105]]]]],[0,0,false,null,393961372125211,16,[],[[106,34,null,139996420630569,259,null,[[4,107],[5,[6]],[7,[9]],[16,false]]],[107,86,null,652316444774548,0,null,[[3,1],[4,106]]]]],[0,0,false,null,898959355753840,17,[[107,78,null,1,false,false,false,732964161807158,null]],[[107,87,"Tween",606349871087637,1,null,[[1,[56]],[3,1],[0,[5]],[0,[5]],[0,[57]],[18,1],[3,1],[3,0],[3,0]]],[107,88,"Tween",147711081958326,1,null,[[1,[58]],[3,6],[0,[59,[4,89]]],[0,[60]],[18,2],[3,0],[3,0],[3,0]]]]]]],[3,[true,"Players"],false,null,139851924359325,18,[[-1,22,null,0,false,false,false,0,false,[[1,[61]]]]],[],[[1,"velX",0,60,false,false,489145114841833,false,173],[1,"velAng",0,500,false,false,589534603444800,false,174],[0,0,false,null,546341842361063,19,[],[[7,65,"Physics",749691576179614,0,null,[[0,[62,[0,7,"Physics",39,false],[3,489145114841833],[3,489145114841833]]],[0,[63,[0,7,"Physics",90,false]]]]],[7,44,"Physics",757988408341402,0,null,[[0,[62,[0,7,"Physics",91,false],[3,589534603444800],[3,589534603444800]]]]],[32,65,"Physics",588006708744000,0,null,[[0,[62,[0,32,"Physics",39,false],[3,489145114841833],[3,489145114841833]]],[0,[63,[0,32,"Physics",90,false]]]]],[32,44,"Physics",361498413256843,0,null,[[0,[62,[0,32,"Physics",91,false],[3,589534603444800],[3,589534603444800]]]]],[37,65,"Physics",788065960933346,0,null,[[0,[62,[0,37,"Physics",39,false],[3,489145114841833],[3,489145114841833]]],[0,[63,[0,37,"Physics",90,false]]]]],[37,44,"Physics",227618663280438,0,null,[[0,[62,[0,37,"Physics",91,false],[3,589534603444800],[3,589534603444800]]]]],[40,65,"Physics",621443015591542,0,null,[[0,[62,[0,40,"Physics",39,false],[3,489145114841833],[3,489145114841833]]],[0,[63,[0,40,"Physics",90,false]]]]],[40,44,"Physics",566129870658906,0,null,[[0,[62,[0,40,"Physics",91,false],[3,589534603444800],[3,589534603444800]]]]]]],[0,0,false,null,764559672536153,20,[],[],[[0,0,true,null,649165148488414,21,[[35,72,null,0,false,false,true,669378000286177,null,[[4,34]]]],[],[[1,"ang",0,0,false,false,290626903247623,false,91],[0,0,false,null,792380901369929,22,[],[[-1,62,null,477444876768768,0,null,[[11,290626903247623],[7,[64,[0,7,"Physics",91,false]]]]],[7,48,null,521894922733557,0,null,[[10,2],[7,[65,[0,32,"Physics",39,false],[0,32,"Physics",91,false]]]]],[32,48,null,494000365314138,0,null,[[10,2],[7,[66,[0,7,"Physics",39,false],[3,290626903247623]]]]],[7,65,"Physics",708586049088608,0,null,[[0,[67,[0,7,"Physics",39,false]]],[0,[67,[0,7,"Physics",90,false]]]]],[32,65,"Physics",228023395905618,0,null,[[0,[67,[0,32,"Physics",39,false]]],[0,[67,[0,32,"Physics",90,false]]]]]]]]],[0,0,false,null,359736984035386,23,[[35,72,null,0,false,false,true,544008618561654,null,[[4,38]]]],[],[[1,"ang",0,0,false,false,193875416518660,false,91],[0,0,false,null,896025223566591,24,[],[[-1,62,null,691864268654356,0,null,[[11,193875416518660],[7,[64,[0,7,"Physics",91,false]]]]],[7,48,null,471855662647100,0,null,[[10,2],[7,[65,[0,37,"Physics",39,false],[0,37,"Physics",91,false]]]]],[37,48,null,147075110454356,0,null,[[10,2],[7,[66,[0,7,"Physics",39,false],[3,193875416518660]]]]],[7,65,"Physics",251375527364492,0,null,[[0,[67,[0,7,"Physics",39,false]]],[0,[67,[0,7,"Physics",90,false]]]]],[37,65,"Physics",117116141210400,0,null,[[0,[67,[0,37,"Physics",39,false]]],[0,[67,[0,37,"Physics",90,false]]]]]]]]],[0,0,false,null,118008491218958,25,[[35,72,null,0,false,false,true,463255797017807,null,[[4,41]]]],[],[[1,"ang",0,0,false,false,231170202127439,false,91],[0,0,false,null,230766485872433,26,[],[[-1,62,null,323138329905948,0,null,[[11,231170202127439],[7,[64,[0,7,"Physics",91,false]]]]],[7,48,null,807758633062506,0,null,[[10,2],[7,[65,[0,40,"Physics",39,false],[0,40,"Physics",91,false]]]]],[40,48,null,604970296252191,0,null,[[10,2],[7,[66,[0,7,"Physics",39,false],[3,231170202127439]]]]],[7,65,"Physics",724982096277108,0,null,[[0,[67,[0,7,"Physics",39,false]]],[0,[67,[0,7,"Physics",90,false]]]]],[40,65,"Physics",769547343347752,0,null,[[0,[67,[0,40,"Physics",39,false]]],[0,[67,[0,40,"Physics",90,false]]]]]]]]]]],[0,0,false,null,593021529484234,27,[],[],[[0,0,false,null,784980221885662,28,[[38,72,null,0,false,false,true,352941293931319,null,[[4,34]]]],[],[[1,"ang",0,0,false,false,913875994158992,false,91],[0,0,false,null,724464603753115,29,[],[[-1,62,null,849987530717353,0,null,[[11,913875994158992],[7,[64,[0,37,"Physics",91,false]]]]],[37,48,null,195032420197021,0,null,[[10,2],[7,[65,[0,32,"Physics",39,false],[0,32,"Physics",91,false]]]]],[32,48,null,306840286070956,0,null,[[10,2],[7,[66,[0,37,"Physics",39,false],[3,913875994158992]]]]],[32,65,"Physics",360984386558787,0,null,[[0,[67,[0,32,"Physics",39,false]]],[0,[67,[0,32,"Physics",90,false]]]]],[37,65,"Physics",102180975409218,0,null,[[0,[67,[0,37,"Physics",39,false]]],[0,[67,[0,37,"Physics",90,false]]]]]]]]],[0,0,false,null,250125150285679,30,[[38,72,null,0,false,false,true,101688001442265,null,[[4,41]]]],[],[[1,"ang",0,0,false,false,604495911950215,false,91],[0,0,false,null,322567800238941,31,[],[[-1,62,null,741959291459376,0,null,[[11,604495911950215],[7,[64,[0,37,"Physics",91,false]]]]],[37,48,null,159100724914609,0,null,[[10,2],[7,[65,[0,40,"Physics",39,false],[0,40,"Physics",91,false]]]]],[40,48,null,414363731738686,0,null,[[10,2],[7,[66,[0,37,"Physics",39,false],[3,604495911950215]]]]],[40,65,"Physics",453572884687045,0,null,[[0,[67,[0,40,"Physics",39,false]]],[0,[67,[0,40,"Physics",90,false]]]]],[37,65,"Physics",589389602696581,0,null,[[0,[67,[0,37,"Physics",39,false]]],[0,[67,[0,37,"Physics",90,false]]]]]]]]]]],[0,0,false,null,367826469323220,32,[],[],[[0,0,false,null,481706574538012,33,[[41,72,null,0,false,false,true,670287400420005,null,[[4,34]]]],[],[[1,"ang",0,0,false,false,238298718108021,false,91],[0,0,false,null,318038229537712,34,[],[[-1,62,null,170133198177953,0,null,[[11,238298718108021],[7,[64,[0,40,"Physics",91,false]]]]],[40,48,null,350545842241996,0,null,[[10,2],[7,[65,[0,32,"Physics",39,false],[0,32,"Physics",91,false]]]]],[32,48,null,660312882184017,0,null,[[10,2],[7,[66,[0,40,"Physics",39,false],[3,238298718108021]]]]],[32,65,"Physics",621455381407302,0,null,[[0,[67,[0,32,"Physics",39,false]]],[0,[67,[0,32,"Physics",90,false]]]]],[40,65,"Physics",926942943544434,0,null,[[0,[67,[0,40,"Physics",39,false]]],[0,[67,[0,40,"Physics",90,false]]]]]]]]]]]]],[3,[true,"General"],false,null,210125335228410,35,[[-1,22,null,0,false,false,false,0,false,[[1,[68]]]]],[],[[1,"team1",0,0,false,false,516198035145613,false,175],[1,"team2",0,0,false,false,542089088464799,false,176],[1,"screenWidth",0,0,false,false,711866737370731,false,177],[1,"screenHeight",0,0,false,false,909866977618611,false,178],[0,0,true,null,788476075180245,36,[[49,92,null,1,false,false,false,201631641605024,null],[-1,26,null,1,false,false,false,341041810547514,null]],[[-1,93,null,600034509341516,2,null,[[0,[5]]]],[78,94,null,978753164665906,0,null,[[0,[69,[4,83]]]]],[122,95,null,341162035703439,0,null,[[0,[70,[4,85],[4,84]]]]],[125,96,null,158912024253947,0,null,[[0,[71,[4,97],[1,125,98,false]]]]],[122,99,null,440498146771015,0,null,[[0,[72,[4,84]]]]]]],[0,0,false,null,529420948329690,37,[[-1,26,null,1,false,false,false,403875869662032,null]],[[-1,62,null,267504263994473,0,null,[[11,516198035145613],[7,[73,[4,100],[4,42]]]]],[-1,62,null,882751390000455,0,null,[[11,542089088464799],[7,[73,[4,100],[4,42]]]]]],[[0,0,false,null,912962769871285,38,[[-1,101,null,0,true,false,false,722582042205454,null],[-1,31,null,0,false,false,false,682045028167169,null,[[11,516198035145613],[8,0],[7,[14,[3,542089088464799]]]]]],[[-1,62,null,316879927256889,0,null,[[11,542089088464799],[7,[73,[4,100],[4,42]]]]]]],[1,"rnd",0,0,false,false,464435176656702,false,179],[0,0,false,null,553110365429368,43,[[-1,31,null,0,false,false,false,825712127505369,null,[[11,462466925293457],[8,0],[7,[5]]]]],[],[[0,0,true,null,831763469712396,44,[[14,30,null,0,false,false,false,594368707533559,null,[[10,0],[8,0],[7,[5]]]],[14,30,null,0,false,false,false,845085794513843,null,[[10,0],[8,0],[7,[74]]]]],[[14,57,null,760843761763831,0,null,[[0,[14,[3,516198035145613]]]]]]],[0,0,true,null,428784197359940,45,[[17,30,null,0,false,false,false,890906130239663,null,[[10,0],[8,0],[7,[5]]]],[17,30,null,0,false,false,false,553756553051616,null,[[10,0],[8,0],[7,[74]]]]],[[17,57,null,882430712531337,0,null,[[0,[14,[3,516198035145613]]]]]]],[0,0,true,null,319592273196655,46,[[16,30,null,0,false,false,false,541283289782525,null,[[10,0],[8,0],[7,[74]]]],[16,30,null,0,false,false,false,356620232717748,null,[[10,0],[8,0],[7,[5]]]]],[[16,57,null,532070126661288,0,null,[[0,[14,[3,516198035145613]]]]]]],[0,0,true,null,609033571170522,48,[[14,30,null,0,false,false,false,331357695739915,null,[[10,0],[8,0],[7,[7]]]],[14,30,null,0,false,false,false,477891128296360,null,[[10,0],[8,0],[7,[75]]]]],[[14,57,null,309426547927942,0,null,[[0,[14,[3,542089088464799]]]]]]],[0,0,true,null,103668502655185,49,[[17,30,null,0,false,false,false,998315102756329,null,[[10,0],[8,0],[7,[7]]]],[17,30,null,0,false,false,false,374654730362780,null,[[10,0],[8,0],[7,[75]]]]],[[17,57,null,231442507441300,0,null,[[0,[14,[3,542089088464799]]]]]]],[0,0,true,null,315386225390318,50,[[16,30,null,0,false,false,false,136349145897731,null,[[10,0],[8,0],[7,[75]]]],[16,30,null,0,false,false,false,683439599317584,null,[[10,0],[8,0],[7,[7]]]]],[[16,57,null,753138058884703,0,null,[[0,[14,[3,542089088464799]]]]]]]]]]],[0,0,false,null,673026883730784,52,[[15,78,null,1,false,false,false,271018021458428,null]],[[15,57,null,934029537527816,0,null,[[0,[76,[4,42],[1,15,102,false]]]]],[15,50,null,825642864295838,0,null,[[0,[77,[4,103],[4,89],[4,89],[4,89]]]]]],[[0,0,false,null,487282827146198,53,[[15,55,null,0,false,false,false,581030618699503,null,[[8,5],[0,[4]]]]],[],[[0,0,false,null,567525447450024,54,[[17,30,null,0,false,false,false,585691593662407,null,[[10,0],[8,0],[7,[16,[2,15,false,0]]]]]],[[17,104,null,696285856334302,0,null,[[3,1]]]]]]]]],[0,0,false,null,893807174520322,55,[[7,78,null,1,false,false,false,490548617627951,null]],[[7,50,null,534713819651313,0,null,[[0,[78,[4,103],[4,89],[4,89],[4,89],[4,89]]]]],[10,50,null,872224941930741,0,null,[[0,[22,[1,7,51,false]]]]],[69,50,null,122733912583099,0,null,[[0,[22,[1,7,51,false]]]]]]],[0,0,false,null,771922096649551,56,[[32,78,null,1,false,false,false,743944978823483,null]],[[32,50,null,694380901779266,0,null,[[0,[78,[4,103],[4,89],[4,89],[4,89],[4,89]]]]],[31,50,null,880332889090414,0,null,[[0,[22,[1,32,51,false]]]]],[71,50,null,757518503223850,0,null,[[0,[22,[1,32,51,false]]]]]]],[0,0,false,null,554145190363898,57,[[37,78,null,1,false,false,false,181918131789725,null]],[[37,50,null,872767412878718,0,null,[[0,[78,[4,103],[4,89],[4,89],[4,89],[4,89]]]]],[36,50,null,475316077150158,0,null,[[0,[22,[1,37,51,false]]]]],[70,50,null,593278400422935,0,null,[[0,[22,[1,37,51,false]]]]]]],[0,0,false,null,929222060760567,58,[[40,78,null,1,false,false,false,504400372619915,null]],[[40,50,null,926820011093388,0,null,[[0,[78,[4,103],[4,89],[4,89],[4,89],[4,89]]]]],[39,50,null,982184268834595,0,null,[[0,[22,[1,40,51,false]]]]],[72,50,null,746168399500014,0,null,[[0,[22,[1,40,51,false]]]]]]]]],[3,[true,"Control"],false,null,842099959132424,59,[[-1,22,null,0,false,false,false,0,false,[[1,[79]]]]],[],[[0,0,false,null,443609811834461,60,[[7,105,"Timer",0,false,false,false,708438400581792,null,[[1,[80]]]]],[[-1,62,null,601456062604735,0,null,[[11,308680730337585],[7,[5]]]]]],[0,0,false,null,687154540281623,61,[[32,105,"Timer",0,false,false,false,934817620946623,null,[[1,[80]]]]],[[-1,62,null,467761174562305,0,null,[[11,284675396607854],[7,[5]]]]]],[0,0,false,null,173335466987062,62,[[-1,31,null,0,false,false,false,948330382363446,null,[[11,895506763348983],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,274252362137060,null,[[11,342765078376117],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,694601271738028,null,[[11,727009003176844],[8,0],[7,[5]]]],[44,106,null,0,false,true,false,756383039129751,null,[[4,19]]],[44,106,null,0,false,true,false,823964315381556,null,[[4,23]]],[44,106,null,0,false,true,false,241374763717448,null,[[4,48]]]],[],[[0,0,true,null,470532884080689,63,[[8,107,null,0,false,false,false,256508001095888,null,[[9,38]]],[44,106,null,0,false,false,false,634962282654510,null,[[4,45]]]],[],[[0,0,false,null,368588143124627,64,[[-1,33,null,0,false,false,false,793140575198401,null]],[],[[0,0,false,null,679995537824999,65,[[7,63,"Timer",0,false,true,false,925908151666930,null,[[1,[81]]]]],[[-1,62,null,200553069941682,0,null,[[11,308680730337585],[7,[9]]]],[7,64,"Timer",107101554058023,0,null,[[0,[34]],[3,0],[1,[80]]]],[7,64,"Timer",179392759912566,0,null,[[0,[60]],[3,0],[1,[81]]]]]]]]]],[0,0,false,null,120299978614252,66,[[-1,47,null,0,false,false,false,684989146382366,null]],[[-1,62,null,704790289254199,0,null,[[11,308680730337585],[7,[5]]]]]],[0,0,false,null,285707079002661,67,[[-1,31,null,0,false,false,false,837990715631497,null,[[11,174118167449135],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,328348757206729,null,[[11,342765078376117],[8,0],[7,[9]]]]],[],[[0,0,true,null,836703864715875,68,[[8,107,null,0,false,false,false,189990841296349,null,[[9,87]]],[44,106,null,0,false,false,false,449068964632145,null,[[4,46]]]],[],[[0,0,false,null,176379879953774,69,[[-1,33,null,0,false,false,false,736593681467693,null]],[],[[0,0,false,null,669133468599378,70,[[32,63,"Timer",0,false,true,false,817731052153966,null,[[1,[81]]]]],[[-1,62,null,152370926546740,0,null,[[11,284675396607854],[7,[9]]]],[32,64,"Timer",935642424516731,0,null,[[0,[34]],[3,0],[1,[80]]]],[32,64,"Timer",129896375330539,0,null,[[0,[60]],[3,0],[1,[81]]]]]]]]]],[0,0,false,null,958335728983498,71,[[-1,47,null,0,false,false,false,496523005061858,null]],[[-1,62,null,280719676992593,0,null,[[11,284675396607854],[7,[5]]]]]]]]]],[0,0,false,null,320181907294440,72,[],[[46,108,null,270141325135944,0,null,[[0,[82,[1,46,66,false],[4,84]]],[0,[83,[4,97],[4,83]]]]],[45,108,null,351562602720816,0,null,[[0,[82,[1,45,66,false],[4,84]]],[0,[83,[4,97],[4,83]]]]]]],[0,0,false,null,727638185708018,73,[[-1,31,null,0,false,false,false,969992042893753,null,[[11,308680730337585],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,640929714478855,null,[[11,895506763348983],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,698968423416552,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,756444767045056,null]],[[12,109,null,209295525023317,0,null,[[3,0],[1,[84,[1,97,110,false]]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[12,111,null,918265881807646,0,null,[[1,[27]],[0,[85,[4,112]]]]]],[[0,0,false,null,355266461111034,74,[[47,30,null,0,false,false,false,466598772165391,null,[[10,0],[8,0],[7,[9]]]]],[[47,81,null,268242998096516,0,null]]],[0,0,false,null,469342562241231,75,[[24,30,null,0,false,false,false,637354301953421,null,[[10,0],[8,0],[7,[9]]]]],[[24,104,null,716857375065431,0,null,[[3,1]]]]],[0,0,false,null,784813909379771,76,[[25,113,null,0,false,false,false,666606572681135,null,[[10,0],[8,0],[7,[9]]]]],[[25,114,null,859741060853535,0,null,[[3,1]]]]]]],[0,0,false,null,262390943356076,77,[[-1,31,null,0,false,false,false,362899568316528,null,[[11,284675396607854],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,287295772809048,null,[[11,895506763348983],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,312772188623943,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,775274980620365,null]],[[12,109,null,777235968706372,0,null,[[3,0],[1,[84,[1,97,110,false]]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[12,111,null,576577887440739,0,null,[[1,[27]],[0,[85,[4,112]]]]]],[[0,0,false,null,427259355230543,78,[[47,30,null,0,false,false,false,970395837571696,null,[[10,0],[8,0],[7,[5]]]]],[[47,81,null,268643362545007,0,null]]],[0,0,false,null,440773771277828,79,[[24,30,null,0,false,false,false,376566196762638,null,[[10,0],[8,0],[7,[5]]]]],[[24,104,null,750145750729070,0,null,[[3,1]]]]],[0,0,false,null,927346900137432,80,[[25,113,null,0,false,false,false,872330308511307,null,[[10,0],[8,0],[7,[5]]]]],[[25,114,null,136747046534893,0,null,[[3,1]]]]]]],[0,0,false,null,248678847168057,81,[[-1,31,null,0,false,false,false,731857797570818,null,[[11,308680730337585],[8,0],[7,[9]]]]],[],[[0,0,false,null,601984124282181,82,[[-1,33,null,0,false,false,false,396948737248683,null]],[],[[0,0,true,null,453978799111102,83,[[7,32,null,0,false,false,false,209484578529087,null,[[4,13]]],[37,32,null,0,false,false,false,425475079753371,null,[[4,13]]]],[],[[0,0,false,null,138297631160512,84,[[12,74,null,0,false,true,false,297876525178751,null,[[1,[86]]]]],[]]]]]]]],[0,0,false,null,428784621584431,85,[[-1,31,null,0,false,false,false,471557605524524,null,[[11,284675396607854],[8,0],[7,[9]]]]],[],[[0,0,false,null,665713215263798,86,[[-1,33,null,0,false,false,false,341820529213512,null]],[],[[0,0,true,null,949407305767272,87,[[32,32,null,0,false,false,false,856231849171180,null,[[4,13]]],[40,32,null,0,false,false,false,255855317748182,null,[[4,13]]]],[],[[0,0,false,null,757919200008736,88,[[12,74,null,0,false,true,false,892473005880953,null,[[1,[87]]]]],[]]]]]]]]]],[3,[true,"Goal"],false,null,566459596397978,89,[[-1,22,null,0,false,false,false,0,false,[[1,[88]]]]],[],[[0,0,false,null,958755318800767,90,[[-1,26,null,1,false,false,false,872999501671074,null]],[],[[0,0,false,null,852520426676739,91,[[-1,61,null,0,false,false,false,618436788182471,null,[[7,[89,[3,870248114194364],[3,336820796057693]]],[8,4],[7,[5]]]]],[[25,114,null,107176796908878,0,null,[[3,1]]],[47,81,null,208898183166590,0,null],[24,104,null,424250939340329,0,null,[[3,1]]]]],[0,0,false,null,543602788605946,92,[[25,113,null,0,false,false,false,128491634168916,null,[[10,0],[8,0],[7,[9]]]]],[[25,115,null,991939536362283,0,null,[[7,[14,[3,870248114194364]]]]]]],[0,0,false,null,670566705464451,93,[[25,113,null,0,false,false,false,309309498517815,null,[[10,0],[8,0],[7,[5]]]]],[[25,115,null,924972354332958,0,null,[[7,[14,[3,336820796057693]]]]]]]]],[4,["score",0,[[1,"who",0,0,false,false,821589602417750,false,180]],true,false,false],false,null,486529419752987,94,[],[[102,116,"Timer",260726543509440,0,null,[[1,[90]]]],[103,117,null,942184389908728,0,null]],[[0,0,false,null,502087931226835,95,[],[[19,104,null,238343259659203,0,null,[[3,0]]],[-1,62,null,676030760819646,0,null,[[11,727009003176844],[7,[9]]]],[-1,118,null,962043469266481,0,null,[[0,[91]]]],[-1,119,null,644865799427929,0,null,[[4,25],[0,[9]]]],[47,81,null,895182421337772,0,null],[25,114,null,946771363697600,0,null,[[3,1]]],[24,104,null,356333121948532,0,null,[[3,1]]],[85,120,"Tween",551292820454739,0,null]],[[0,0,false,null,824718150272471,96,[[-1,31,null,0,false,false,false,933782421834685,null,[[11,821589602417750],[8,0],[7,[5]]]]],[[-1,121,null,385698274418138,0,null,[[11,870248114194364],[7,[92,[1,98,110,false]]]]],[-2,"goalText",null,373804215208311,0,null,[[0,[9]]]],[31,34,null,380481192914008,259,null,[[4,92],[5,[6]],[7,[9]],[16,false]]],[31,122,null,218917578953793,0,null,[[4,92],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[92,88,"Tween",235342548430775,1,null,[[1,[27]],[3,6],[0,[59,[4,89]]],[0,[57]],[18,4],[3,0],[3,1],[3,1]]],[-1,119,null,165874648321758,0,null,[[4,92],[0,[9]]]]],[[0,0,false,null,298360752611621,97,[[25,113,null,0,false,false,false,839500702912249,null,[[10,0],[8,0],[7,[9]]]]],[[25,115,null,598421850393280,0,null,[[7,[14,[3,870248114194364]]]]],[25,64,"Timer",491000194480319,0,null,[[0,[91]],[3,0],[1,[93]]]]]],[0,0,false,null,128645280173546,98,[],[[12,56,null,823965269806617,0,null,[[2,["pain",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]]],[[0,0,false,null,773658281941189,99,[[15,30,null,0,false,false,false,845401254819743,null,[[10,0],[8,0],[7,[7]]]],[15,55,null,0,false,false,false,684401678561479,null,[[8,5],[0,[4]]]]],[[12,111,null,235252283887937,0,null,[[1,[27]],[0,[94]]]]]]]]]],[0,0,false,null,835361267090729,100,[[-1,47,null,0,false,false,false,305544726905887,null]],[[-1,121,null,944256006227886,0,null,[[11,336820796057693],[7,[92,[1,101,110,false]]]]],[-2,"goalText",null,540517485803559,0,null,[[0,[5]]]],[10,34,null,205150077785257,259,null,[[4,92],[5,[6]],[7,[9]],[16,false]]],[10,122,null,819662057831487,0,null,[[4,92],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[92,88,"Tween",731043740371919,1,null,[[1,[27]],[3,6],[0,[59,[4,89]]],[0,[57]],[18,4],[3,0],[3,1],[3,1]]],[-1,119,null,433087055949303,0,null,[[4,92],[0,[9]]]]],[[0,0,false,null,856848016841607,101,[[25,113,null,0,false,false,false,224047268860062,null,[[10,0],[8,0],[7,[5]]]]],[[25,115,null,886738879133277,0,null,[[7,[14,[3,336820796057693]]]]],[25,64,"Timer",522101516736317,0,null,[[0,[91]],[3,0],[1,[93]]]]]],[0,0,false,null,658455217085366,102,[],[[12,56,null,259678337188558,0,null,[[2,["pain",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]]],[[0,0,false,null,163839482182312,103,[[15,30,null,0,false,false,false,576771324505905,null,[[10,0],[8,0],[7,[5]]]],[15,55,null,0,false,false,false,719829232212416,null,[[8,5],[0,[4]]]]],[[12,111,null,956972521426950,0,null,[[1,[27]],[0,[94]]]]]]]]]],[0,0,false,null,507248185447760,104,[],[[-1,93,null,494339093643754,2,null,[[0,[57]]]],[-1,118,null,793217419722695,0,null,[[0,[9]]]],[-1,93,null,877172313795343,2,null,[[0,[95]]]],[-1,62,null,357328140578733,0,null,[[11,727009003176844],[7,[74]]]]],[[0,0,false,null,536043517992438,105,[[-1,31,null,0,false,false,false,748134058621935,null,[[11,870248114194364],[8,2],[7,[96]]]],[-1,31,null,0,false,false,false,629221346549125,null,[[11,336820796057693],[8,2],[7,[96]]]]],[[-1,123,null,584512939335147,0,null],[-1,124,null,916401040851181,0,null]]],[0,0,false,null,752752172271347,106,[[-1,47,null,0,false,false,false,904055090114229,null]],[],[[0,0,false,null,913797811340369,107,[[-1,31,null,0,false,false,false,648641011531815,null,[[11,870248114194364],[8,5],[7,[96]]]]],[[-2,"gameOver",null,861535104897130,0,null,[[1,[97]]]]]],[0,0,false,null,277118692696193,108,[[-1,47,null,0,false,false,false,470795879394332,null]],[[-2,"gameOver",null,713979408893015,0,null,[[1,[98]]]]]]]]]]]]]],[0,0,false,null,820567048447002,109,[[-1,31,null,0,false,false,false,183099311061566,null,[[11,727009003176844],[8,0],[7,[9]]]]],[[-1,125,null,533963281087562,0,null,[[0,[99,[4,126],[4,45]]]]]]],[0,0,false,null,211333034083388,110,[[25,105,"Timer",0,false,false,false,246281522109945,null,[[1,[93]]]]],[[25,127,null,223083540402947,0,null,[[0,[100]]]],[25,128,null,490727383165699,0,null,[[0,[101,[4,89]]]]],[25,64,"Timer",541675785350289,0,null,[[0,[91]],[3,0],[1,[102]]]]]],[0,0,false,null,231011438389849,111,[[25,105,"Timer",0,false,false,false,134636312957892,null,[[1,[102]]]]],[[25,127,null,550870160672192,0,null,[[0,[9]]]],[25,128,null,702910927209570,0,null,[[0,[103,[4,89]]]]],[25,64,"Timer",292397011245738,0,null,[[0,[91]],[3,0],[1,[93]]]]]]]],[3,[true,"End"],false,null,739620096340547,112,[[-1,22,null,0,false,false,false,0,false,[[1,[104]]]]],[],[[0,0,false,null,164370333053836,113,[[19,129,"Tween",0,false,false,false,873375018224241,null,[[1,[105]]]]],[[-1,130,null,784965340374361,0,null,[[5,[106]],[0,[107,[0,19,"Tween",131,false]]]]]]],[0,0,false,null,966802454675834,114,[[19,132,"Tween",1,false,false,false,640512727380186,null,[[1,[105]]]]],[[-1,130,null,456882907562642,0,null,[[5,[106]],[0,[108]]]]]],[4,["gameOver",0,[[1,"who",1,"",false,false,585962555298105,false,180]],true,false,false],false,null,565963435492618,115,[],[[12,56,null,596082241022385,0,null,[[2,["menu",false]],[3,1],[0,[18]],[0,[5]],[1,[109]]]],[12,133,null,905581813377383,0,null,[[1,[110]]]],[12,56,null,590144559771595,0,null,[[2,["win",false]],[3,0],[0,[18]],[0,[5]],[1,[111]]]],[47,81,null,370256423758114,0,null],[19,134,"Tween",497724149145609,1,null,[[1,[105]],[0,[5]],[0,[108]],[0,[34]],[18,1],[3,0],[3,0],[3,0]]],[-1,130,null,977968489710498,0,null,[[5,[106]],[0,[5]]]],[-1,135,null,683360837405343,0,null,[[5,[112]],[3,1]]],[24,136,null,542958537233625,0,null,[[5,[113]]]],[25,137,null,673080752122027,0,null,[[5,[113]]]],[-1,93,null,421677819623936,2,null,[[0,[57]]]],[-1,138,null,999981598537614,256,null,[[4,51],[5,[113]],[0,[5]],[0,[114]],[16,false],[20,[27]]]],[51,139,null,723069309609422,0,null,[[0,[115]],[0,[116]]]],[-1,138,null,868484130857558,256,null,[[4,51],[5,[113]],[0,[5]],[0,[117]],[16,false],[20,[27]]]],[51,139,null,414999656874426,0,null,[[0,[115]],[0,[7]]]],[-1,138,null,329503698124844,256,null,[[4,51],[5,[113]],[0,[5]],[0,[118]],[16,false],[20,[27]]]],[51,139,null,942429315045689,0,null,[[0,[115]],[0,[7]]]],[-1,138,null,300544945198360,256,null,[[4,52],[5,[113]],[0,[119]],[0,[120]],[16,false],[20,[27]]]],[52,88,"Tween",856127507174776,1,null,[[1,[121]],[3,0],[0,[122]],[0,[34]],[18,9],[3,0],[3,0],[3,0]]],[-1,138,null,336518353462151,256,null,[[4,53],[5,[113]],[0,[123]],[0,[124]],[16,false],[20,[27]]]],[53,41,null,470195214178491,0,null,[[10,0],[7,[9]]]],[-1,138,null,605051134657845,256,null,[[4,55],[5,[113]],[0,[122]],[0,[124]],[16,false],[20,[27]]]],[55,41,null,257211661486965,0,null,[[10,0],[7,[9]]]],[-1,138,null,950570781698858,256,null,[[4,54],[5,[113]],[0,[125]],[0,[124]],[16,false],[20,[27]]]],[-2,"ActivateMoreGamesButtons",null,574539909275648,0,null]],[[0,0,false,null,833797330398783,116,[[-1,31,null,0,false,false,false,481539189826273,null,[[11,585962555298105],[8,0],[7,[98]]]]],[],[[0,0,false,null,963453263147041,117,[[-1,31,null,0,false,false,false,108885782533715,null,[[11,174118167449135],[8,0],[7,[5]]]]],[[52,57,null,679349033173424,0,null,[[0,[9]]]]]],[0,0,false,null,390730169655330,118,[[-1,47,null,0,false,false,false,142155781110973,null]],[[52,57,null,556803202447673,0,null,[[0,[7]]]]]]]],[0,0,false,null,243855942448118,119,[[-1,47,null,0,false,false,false,704202642432436,null],[-1,31,null,0,false,false,false,859368397804082,null,[[11,585962555298105],[8,0],[7,[97]]]]],[[52,57,null,228472030731829,0,null,[[0,[74]]]]]]]]]],[3,[true,"CPU"],false,null,726680069802592,120,[[-1,22,null,0,false,false,false,0,false,[[1,[126]]]]],[],[[0,0,false,null,125723685612325,121,[[-1,31,null,0,false,false,false,475993331782965,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,137732482028610,null,[[11,174118167449135],[8,0],[7,[9]]]]],[],[[0,0,false,null,917247552390603,122,[[47,30,null,0,false,false,false,499761389140060,null,[[10,0],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,363943887427336,null]],[[47,81,null,477449459967481,0,null]]],[0,0,false,null,566661320346088,123,[[19,105,"Timer",0,false,false,false,534027913734020,null,[[1,[127]]]]],[[19,116,"Timer",687514410501369,0,null,[[1,[127]]]],[-1,62,null,214245885942560,0,null,[[11,284675396607854],[7,[9]]]],[32,64,"Timer",102813703451888,0,null,[[0,[34]],[3,0],[1,[80]]]]]],[0,0,false,null,586058984159319,124,[[19,105,"Timer",0,false,false,false,155534716223949,null,[[1,[128]]]]],[[-1,62,null,735746369589369,0,null,[[11,284675396607854],[7,[9]]]],[32,64,"Timer",256371551897891,0,null,[[0,[129,[4,42]]],[3,0],[1,[80]]]]]]]],[0,0,false,null,282549818719111,125,[[-1,31,null,0,false,false,false,106068942650378,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,365878662017743,null,[[11,174118167449135],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,839152340753071,null,[[11,895506763348983],[8,0],[7,[5]]]],[102,32,null,0,false,false,false,810991333429050,null,[[4,10]]]],[[-1,62,null,531459623900439,0,null,[[11,284675396607854],[7,[9]]]],[32,64,"Timer",801602113929660,0,null,[[0,[34]],[3,0],[1,[80]]]]]],[0,0,false,null,629403652391916,126,[[-1,31,null,0,false,false,false,976071851658245,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,997978153297161,null,[[11,174118167449135],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,498797900839350,null,[[11,284675396607854],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,728383655908426,null,[[11,895506763348983],[8,0],[7,[5]]]],[126,32,null,0,false,false,false,144429161079475,null,[[4,13]]]],[],[[0,0,false,null,196483520783870,127,[[19,63,"Timer",0,false,true,false,927273712584759,null,[[1,[128]]]],[-1,33,null,0,false,false,false,417531044704679,null]],[[19,64,"Timer",483062468177179,0,null,[[0,[74]],[3,0],[1,[127]]]]]],[0,0,false,null,272019467660385,128,[],[],[[0,0,false,null,929264622872598,129,[[126,40,null,0,false,false,false,128706673307997,null,[[8,3],[0,[22,[1,7,66,false]]]]]],[],[[0,0,false,null,463854047245420,130,[[126,46,null,0,false,false,false,132066633359374,null,[[0,[19]],[0,[130]]]],[-1,33,null,0,false,false,false,947401617065131,null]],[[19,116,"Timer",932296583017856,0,null,[[1,[127]]]],[19,64,"Timer",226259852929197,0,null,[[0,[131,[4,42]]],[3,0],[1,[128]]]]]]]],[0,0,false,null,575146566302356,131,[[-1,47,null,0,false,false,false,196948822728088,null]],[],[[0,0,false,null,322635574043787,132,[[-1,33,null,0,false,false,false,870537253982839,null]],[[19,116,"Timer",129521826663385,0,null,[[1,[127]]]],[19,64,"Timer",115582820085833,0,null,[[0,[131,[4,42]]],[3,0],[1,[128]]]]]]]]]]]]]],[3,[true,"Box"],false,null,750345350447922,133,[[-1,22,null,0,false,false,false,0,false,[[1,[132]]]]],[],[[1,"x1",0,0,true,false,957155205731081,false,181],[1,"x2",0,0,true,false,736002826413587,false,182],[1,"force",0,100,false,false,989481652731349,false,183],[0,0,false,null,189293723495333,134,[[105,72,null,0,false,false,true,779391156950467,null,[[4,106]]]],[[105,81,null,889238019599951,0,null],[106,81,null,853927187434880,0,null],[12,56,null,372643692821144,0,null,[[2,["metal",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]]]],[0,0,false,null,563161052562420,135,[[105,32,null,0,false,false,false,696523727427501,null,[[4,128]]],[-1,31,null,0,false,false,false,219491865031989,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,426271317018831,null]],[[12,56,null,925028231480128,0,null,[[2,["punch",false]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[128,140,null,569900766098349,0,null,[[3,0]]],[127,140,null,666945295906740,0,null,[[3,0]]],[10,140,null,901381915172294,0,null,[[3,0]]],[98,140,null,930170357146959,0,null,[[3,0]]],[-2,"score",null,847372717881243,0,null,[[0,[5]]]],[31,34,null,217843383117699,259,null,[[4,99],[5,[6]],[7,[9]],[16,false]]],[31,122,null,532970869654744,0,null,[[4,99],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[34,41,null,396545359751104,0,null,[[10,0],[7,[9]]]]],[[0,0,false,null,806073803023686,136,[],[[105,81,null,705968020956805,0,null],[12,56,null,241002505688222,0,null,[[2,["bonebreak",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[12,56,null,675444343874074,0,null,[[2,["metal",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]],[32,141,"Physics",179098007443396,0,null],[31,44,"Physics",219729885975813,0,null,[[0,[133,[4,103]]]]],[31,142,"Physics",809238580468071,0,null,[[0,[9]]]],[31,143,"Physics",863518600532685,0,null,[[0,[9]]]],[31,144,"Physics",153219954794002,0,null,[[0,[9]]]],[31,145,"Physics",418271813725316,0,null,[[0,[134]]]]]]]],[0,0,false,null,437611819792842,137,[[106,32,null,0,false,false,false,783168529749276,null,[[4,127]]],[-1,31,null,0,false,false,false,964331571351417,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,799320184390657,null]],[[12,56,null,497397291701351,0,null,[[2,["punch",false]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[31,140,null,675386939945663,0,null,[[3,0]]],[128,140,null,578343043760190,0,null,[[3,0]]],[127,140,null,133520184950672,0,null,[[3,0]]],[101,140,null,935054974033915,0,null,[[3,0]]],[-2,"score",null,566368573402871,0,null,[[0,[9]]]],[10,34,null,687286526347152,259,null,[[4,99],[5,[6]],[7,[9]],[16,false]]],[10,122,null,296885702250440,0,null,[[4,99],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[35,41,null,165584984669218,0,null,[[10,0],[7,[9]]]]],[[0,0,false,null,274897919875971,138,[],[[106,81,null,145934325337293,0,null],[12,56,null,505556415204286,0,null,[[2,["bonebreak",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[12,56,null,952959494522201,0,null,[[2,["metal",false]],[3,0],[0,[54]],[0,[5]],[1,[27]]]],[7,141,"Physics",255255032185055,0,null],[10,44,"Physics",790745057008040,0,null,[[0,[133,[4,103]]]]],[10,142,"Physics",646021382627125,0,null,[[0,[9]]]],[10,143,"Physics",444974909041724,0,null,[[0,[9]]]],[10,144,"Physics",912731431945851,0,null,[[0,[9]]]],[10,145,"Physics",410387009290523,0,null,[[0,[134]]]]]]]],[0,0,false,null,297288032255548,139,[[98,32,null,0,false,false,false,293735300724893,null,[[4,31]]],[-1,31,null,0,false,false,false,252909478417524,null,[[11,308680730337585],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,292697393836280,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,878589380857342,null]],[[12,56,null,194023186936459,0,null,[[2,["punch",false]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[10,140,null,949141958075386,0,null,[[3,0]]],[98,140,null,777353331370991,0,null,[[3,0]]],[-2,"score",null,870646092473648,0,null,[[0,[5]]]],[31,34,null,449980946291603,259,null,[[4,99],[5,[6]],[7,[9]],[16,false]]],[31,122,null,346086816360854,0,null,[[4,99],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[34,41,null,312882000049199,0,null,[[10,0],[7,[9]]]]],[[1,"ang",0,0,false,false,813633452252006,false,91],[0,0,false,null,195885439656346,140,[],[[-1,62,null,595692621859610,0,null,[[11,813633452252006],[7,[135,[4,42]]]]],[32,48,null,668553158867866,0,null,[[10,2],[7,[136,[3,813633452252006]]]]],[32,65,"Physics",449128008681645,0,null,[[0,[137]],[0,[137]]]]]]]],[0,0,false,null,710884877074590,141,[[101,32,null,0,false,false,false,816270646739831,null,[[4,10]]],[-1,31,null,0,false,false,false,315745215292124,null,[[11,284675396607854],[8,0],[7,[9]]]],[-1,31,null,0,false,false,false,943832437793592,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,854841408882941,null]],[[12,56,null,802042122190291,0,null,[[2,["punch",false]],[3,0],[0,[18]],[0,[5]],[1,[27]]]],[31,140,null,186574091664991,0,null,[[3,0]]],[101,140,null,980927081066425,0,null,[[3,0]]],[-2,"score",null,489870584629448,0,null,[[0,[9]]]],[31,34,null,816292384078648,259,null,[[4,99],[5,[6]],[7,[9]],[16,false]]],[31,122,null,874639542533246,0,null,[[4,99],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,false]]],[35,41,null,249355763446772,0,null,[[10,0],[7,[9]]]]],[[1,"ang",0,0,false,false,314474450932696,false,91],[0,0,false,null,463549311018798,142,[],[[-1,62,null,591422102807616,0,null,[[11,314474450932696],[7,[135,[4,42]]]]],[7,48,null,293315556654413,0,null,[[10,2],[7,[138,[3,314474450932696]]]]],[7,65,"Physics",813029528956374,0,null,[[0,[139]],[0,[137]]]]]]]],[0,0,false,null,260037313480422,143,[[18,30,null,0,false,false,false,139824820918167,null,[[10,0],[8,0],[7,[5]]]]],[[-1,62,null,945036573200114,0,null,[[11,957155205731081],[7,[22,[1,18,66,false]]]]]]],[0,0,false,null,730735814881766,144,[[18,30,null,0,false,false,false,928984195028343,null,[[10,0],[8,0],[7,[7]]]]],[[-1,62,null,166388053936993,0,null,[[11,736002826413587],[7,[22,[1,18,66,false]]]]]]],[0,0,false,null,883157744389130,145,[[-1,31,null,0,false,false,false,291031386823579,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,31,null,0,false,false,false,868683406034891,null,[[11,957155205731081],[8,2],[7,[14,[3,736002826413587]]]]]],[],[[0,0,false,null,169294858609745,146,[[102,63,"Timer",0,false,true,false,643093543015719,null,[[1,[90]]]],[-1,146,null,0,false,false,false,338662918466685,null,[[7,[140,[1,103,147,false]]]]]],[[102,64,"Timer",613299947024493,0,null,[[0,[9]],[3,0],[1,[90]]]]]]]],[0,0,false,null,562221248291329,147,[[-1,47,null,0,false,false,false,406098096449847,null]],[[102,116,"Timer",442719413079257,0,null,[[1,[90]]]],[103,117,null,854558369402023,0,null]]],[0,0,false,null,500480440119475,148,[[-1,31,null,0,false,false,false,265396611701768,null,[[11,727009003176844],[8,0],[7,[9]]]]],[[102,116,"Timer",850655800394323,0,null,[[1,[90]]]],[103,117,null,392043934977642,0,null]]],[0,0,false,null,195982747226622,149,[[102,105,"Timer",0,false,false,false,525620294173549,null,[[1,[90]]]]],[[12,56,null,395961259855680,0,null,[[2,["counter,",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[-1,138,null,576242691448808,256,null,[[4,103],[5,[141]],[0,[122]],[0,[142]],[16,true],[20,[27]]]],[103,148,"AnimateText",582543628102879,0,null,[[1,[143]]]],[103,64,"Timer",975625323885552,0,null,[[0,[9]],[3,0],[1,[144]]]]]],[0,0,false,null,946421717729921,150,[[103,105,"Timer",0,false,false,false,993065678236308,null,[[1,[144]]]]],[[103,148,"AnimateText",216221285228899,0,null,[[1,[144]]]],[103,64,"Timer",811721655113845,0,null,[[0,[9]],[3,0],[1,[145]]]],[12,56,null,241372766431440,0,null,[[2,["counter,",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]]]],[0,0,false,null,770132451432756,151,[[103,105,"Timer",0,false,false,false,338366198713960,null,[[1,[145]]]]],[[12,56,null,450957915909646,0,null,[[2,["counter,",false]],[3,0],[0,[5]],[0,[5]],[1,[27]]]],[103,148,"AnimateText",365638466934103,0,null,[[1,[145]]]],[103,64,"Timer",655598570994703,0,null,[[0,[9]],[3,0],[1,[146]]]]]],[0,0,false,null,634600480411693,152,[[103,105,"Timer",0,false,false,false,364909419651956,null,[[1,[146]]]]],[[10,140,null,362423867819857,0,null,[[3,0]]],[98,140,null,675321606983985,0,null,[[3,0]]],[31,140,null,343881115689988,0,null,[[3,0]]],[101,140,null,503653414358191,0,null,[[3,0]]]],[[0,0,false,null,416349864757660,153,[[-1,31,null,0,false,false,false,472018712190225,null,[[11,727009003176844],[8,0],[7,[5]]]],[-1,33,null,0,false,false,false,154151161076865,null]],[[-1,62,null,833529967282905,0,null,[[11,308680730337585],[7,[5]]]],[-1,62,null,133023956402679,0,null,[[11,284675396607854],[7,[5]]]],[19,104,null,767175470407415,0,null,[[3,0]]],[-1,62,null,878381792665217,0,null,[[11,727009003176844],[7,[9]]]],[-1,118,null,395867628640151,0,null,[[0,[91]]]],[12,56,null,435551078357713,0,null,[[2,["refsoc",false]],[3,0],[0,[54]],[0,[5]],[1,[147]]]],[-1,93,null,756028237596134,2,null,[[0,[91]]]],[-1,123,null,209737039011439,0,null],[-1,124,null,359528346875926,0,null]]]]]]],[1,"divideSmooth",0,1.1,false,false,585122294625856,false,184],[1,"angularOffset",0,75,false,false,548952495670197,false,185],[1,"jumpPower",0,60,false,false,118852720224131,false,186],[1,"jumpAddForce",0,4000,false,false,393742379478916,false,187],[1,"angularForce",0,70,false,false,922540702888405,false,188]]],["bonusEvent",[[1,"bombBall",0,0,false,false,730379276888040,false,189],[1,"timeScaler",0,0,false,false,586956771834411,false,190],[3,[true,"Bonus"],false,null,956453493758386,1,[[-1,22,null,0,false,false,false,0,false,[[1,[148]]]]],[],[[1,"rndChar",0,-1,false,false,742416866043478,false,191],[1,"rndType",0,-1,false,false,347139371839372,false,192],[1,"rndPlace",0,0,false,false,274951061636774,false,193],[1,"rndArm",0,0,false,false,174776722011300,false,194],[1,"startText",1,"",true,false,622506128811027,false,195],[1,"waitText",0,0,true,false,565732277731813,false,196],[0,0,false,null,540770498405480,2,[[-1,26,null,1,false,false,false,359764889336009,null]],[[-1,62,null,822684535456104,0,null,[[11,342765078376117],[7,[5]]]],[-1,118,null,450083467568871,0,null,[[0,[9]]]],[-1,62,null,758429657676505,0,null,[[11,586956771834411],[7,[9]]]],[-1,62,null,929964365659541,0,null,[[11,319222429638591],[7,[149]]]],[-1,62,null,856473738510421,0,null,[[11,100159601288384],[7,[150,[4,103]]]]],[-1,62,null,276926334299341,0,null,[[11,462466925293457],[7,[5]]]],[-1,62,null,199175216613942,0,null,[[11,565732277731813],[7,[5]]]],[-1,62,null,632663787920614,0,null,[[11,622506128811027],[7,[27]]]],[-1,62,null,769877089534004,0,null,[[11,308680730337585],[7,[5]]]],[-1,62,null,714826707419554,0,null,[[11,284675396607854],[7,[5]]]],[-1,62,null,162994352768924,0,null,[[11,727009003176844],[7,[74]]]],[-1,118,null,511969153524805,0,null,[[0,[9]]]],[-1,125,null,406341147910603,0,null,[[0,[9]]]],[-1,149,null,857274338095309,0,null,[[0,[122]],[0,[151]]]],[50,108,null,705290066214414,0,null,[[0,[152,[4,85],[4,84]]],[0,[152,[4,97],[4,83]]]]],[50,23,null,794744499737912,0,null,[[0,[122]],[0,[151]]]],[50,150,null,539260649965305,0,null]],[[0,0,false,null,433098845719659,3,[[-1,61,null,0,false,false,false,319494658650602,null,[[7,[89,[3,870248114194364],[3,336820796057693]]],[8,0],[7,[5]]]]],[[-1,62,null,345293207325838,0,null,[[11,742416866043478],[7,[5]]]],[-1,62,null,718868184226394,0,null,[[11,347139371839372],[7,[5]]]],[-1,62,null,108243315792943,0,null,[[11,274951061636774],[7,[5]]]],[-1,62,null,419524289067312,0,null,[[11,174776722011300],[7,[5]]]]]],[0,0,false,null,550218774964454,4,[[-1,47,null,0,false,false,false,581786005262591,null]],[[-1,62,null,738596044288485,0,null,[[11,742416866043478],[7,[153,[4,103],[4,100],[4,103]]]]],[-1,121,null,767553999496181,0,null,[[11,730379276888040],[7,[9]]]],[-1,62,null,323324992585309,0,null,[[11,174776722011300],[7,[154,[4,103],[4,100],[4,42]]]]],[-1,62,null,404401402535329,0,null,[[11,274951061636774],[7,[155,[4,103]]]]],[-1,62,null,735876791845857,0,null,[[11,347139371839372],[7,[156,[3,174776722011300],[4,103]]]]]],[[0,0,false,null,959131457663326,5,[[-1,146,null,0,false,false,false,321073261524658,null,[[7,[157,[4,103]]]]],[-1,31,null,0,false,true,false,830543467217395,null,[[11,347139371839372],[8,0],[7,[9]]]]],[[-1,151,null,867779071759952,0,null,[[4,109],[0,[5]],[0,[5]],[0,[115]],[0,[158]],[1,[159,[4,103]]],[7,[6]],[0,[5]],[0,[5]],[16,true]]]]]]],[0,0,false,null,165890832831200,6,[],[[69,57,null,204966429813468,0,null,[[0,[14,[3,174776722011300]]]]],[97,57,null,785725606961582,0,null,[[0,[14,[3,174776722011300]]]]],[100,57,null,318008486037597,0,null,[[0,[14,[3,174776722011300]]]]],[70,57,null,254066171379944,0,null,[[0,[14,[3,174776722011300]]]]],[71,57,null,980036158208258,0,null,[[0,[14,[3,174776722011300]]]]],[72,57,null,905165777345535,0,null,[[0,[14,[3,174776722011300]]]]]],[[0,0,false,null,445762892081024,7,[],[[101,152,null,552492037403422,0,null,[[4,100],[7,[9]]]],[100,122,null,141500306928030,0,null,[[4,101],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true]]],[98,152,null,389739573935659,0,null,[[4,97],[7,[9]]]],[97,122,null,789777618078319,0,null,[[4,98],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true],[16,true]]]]],[0,0,false,null,105199123200601,8,[[-1,31,null,0,false,false,false,928763252126508,null,[[11,174776722011300],[8,0],[7,[9]]]]],[[-1,62,null,620185249622621,0,null,[[11,622506128811027],[7,[160,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,881289202374713,0,null,[[11,565732277731813],[7,[9]]]]]],[0,0,false,null,547318712222429,9,[[-1,47,null,0,false,false,false,510723082983548,null],[-1,31,null,0,false,false,false,117392659516172,null,[[11,174776722011300],[8,0],[7,[74]]]]],[[-1,62,null,775911987662707,0,null,[[11,622506128811027],[7,[161,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,176118281034990,0,null,[[11,565732277731813],[7,[9]]]]]]]],[0,0,false,null,702626562451815,10,[[-1,31,null,0,false,false,false,778585606491360,null,[[11,347139371839372],[8,0],[7,[9]]]]],[[-1,62,null,845013031321129,0,null,[[11,622506128811027],[7,[162,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,519453850178081,0,null,[[11,565732277731813],[7,[9]]]],[98,57,null,624451033520021,0,null,[[0,[9]]]],[101,57,null,811893531714546,0,null,[[0,[9]]]]]],[0,0,false,null,962836928503946,11,[[-1,47,null,0,false,false,false,642067879651260,null],[-1,31,null,0,false,false,false,474401360091488,null,[[11,347139371839372],[8,0],[7,[74]]]]],[[-1,62,null,138668837553327,0,null,[[11,622506128811027],[7,[163,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,789247833717920,0,null,[[11,565732277731813],[7,[9]]]],[-1,118,null,175483540756113,0,null,[[0,[94]]]],[-1,62,null,973298128861825,0,null,[[11,586956771834411],[7,[94]]]]]],[0,0,false,null,401917153264415,13,[[-1,31,null,0,false,false,false,776039523661086,null,[[11,274951061636774],[8,0],[7,[5]]]]],[[81,154,null,202649800334005,0,null],[89,154,null,839680904961991,0,null],[-1,121,null,992755025052616,0,null,[[11,565732277731813],[7,[9]]]],[73,155,null,504033199309204,0,null,[[0,[164,[4,89]]]]],[-1,62,null,174320441163418,0,null,[[11,412696536558178],[7,[165]]]],[-1,62,null,981786133078949,0,null,[[11,262420649510634],[7,[166]]]],[-1,62,null,896876461403792,0,null,[[11,730424728310926],[7,[149]]]],[43,156,null,835796121592613,0,null],[91,81,null,658541839830683,0,null],[61,154,null,651246211761111,0,null],[65,154,null,885659242589557,0,null],[68,81,null,725464659479107,0,null],[90,81,null,834183515368485,0,null],[66,154,null,746568674398138,0,null],[67,81,null,170830588738578,0,null],[28,154,null,702512170664544,0,null],[26,154,null,841066071318437,0,null],[27,154,null,569894797761798,0,null],[82,81,null,139227200556767,0,null],[29,154,null,794326757731007,0,null],[62,154,null,194997545509963,0,null],[63,154,null,349642237169909,0,null],[42,154,null,586017990825770,0,null],[20,154,null,724358229291689,0,null],[-1,93,null,735851544950046,2,null,[[0,[5]]]],[-1,157,null,818238932388417,0,null,[[5,[5]],[0,[167,[4,89]]]]],[95,81,null,192117979735306,0,null]]],[0,0,false,null,801187896773351,14,[[-1,47,null,0,false,false,false,626959118332555,null],[-1,31,null,0,false,false,false,490417162986825,null,[[11,274951061636774],[8,0],[7,[9]]]]],[[-1,62,null,235752225689298,0,null,[[11,622506128811027],[7,[168,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,701463472694720,0,null,[[11,565732277731813],[7,[9]]]],[73,155,null,748249925031414,0,null,[[0,[169,[4,89]]]]],[65,154,null,625582797570642,0,null],[78,154,null,748492446383842,0,null],[20,154,null,498795795627104,0,null],[27,155,null,559135859190582,0,null,[[0,[170]]]],[21,50,null,201145002037929,0,null,[[0,[171,[4,89]]]]],[19,41,null,203609212277004,0,null,[[10,0],[7,[9]]]],[22,50,null,329396605550907,0,null,[[0,[171,[4,89]]]]],[-1,62,null,196979958047287,0,null,[[11,412696536558178],[7,[172]]]],[-1,62,null,400960807838100,0,null,[[11,262420649510634],[7,[172]]]],[-1,62,null,788340281206741,0,null,[[11,455877582027442],[7,[165]]]],[-1,62,null,467749758844769,0,null,[[11,730424728310926],[7,[149]]]],[74,154,null,921079151438397,0,null],[80,81,null,755954602790306,0,null],[-1,62,null,719771706136832,0,null,[[11,274951061636774],[7,[5]]]],[75,154,null,520635472650029,0,null],[76,154,null,579881668432349,0,null],[68,81,null,499474153395507,0,null],[90,81,null,689456199986755,0,null],[66,154,null,432912405143221,0,null],[67,81,null,675357664437065,0,null],[29,154,null,324833817869931,0,null],[62,154,null,737672411149966,0,null],[63,154,null,234232817494037,0,null],[82,81,null,272241853851582,0,null],[42,154,null,993356859531007,0,null],[114,57,null,533873285887777,0,null,[[0,[9]]]],[113,57,null,959011202720130,0,null,[[0,[9]]]],[115,57,null,755312064775623,0,null,[[0,[9]]]],[28,154,null,690727501517834,0,null],[-1,93,null,394063510943361,2,null,[[0,[5]]]],[-1,157,null,614997342162917,0,null,[[5,[5]],[0,[173,[4,89]]]]],[93,154,null,926126436096825,0,null],[95,81,null,796216634273242,0,null],[110,81,null,946554973050821,0,null],[111,81,null,400999010319098,0,null],[112,81,null,755992612832881,0,null]],[[0,0,false,null,624635569030969,15,[[6,30,null,0,false,false,false,966449793616866,null,[[10,1],[8,0],[7,[5]]]],[6,30,null,0,false,false,false,342516945882277,null,[[10,0],[8,0],[7,[5]]]]],[[6,144,"Physics",669523702083108,0,null,[[0,[5]]]]]]]],[0,0,false,null,820179838908346,16,[[-1,47,null,0,false,false,false,819440457440282,null],[-1,31,null,0,false,false,false,516175671610466,null,[[11,274951061636774],[8,0],[7,[74]]]]],[[81,154,null,421842013598440,0,null],[89,154,null,602568545977531,0,null],[-1,121,null,430804160990001,0,null,[[11,565732277731813],[7,[9]]]],[73,154,null,910468859047740,0,null],[75,154,null,821534519893009,0,null],[76,154,null,369048765465504,0,null],[78,154,null,821182906598460,0,null],[43,156,null,257559951875506,0,null],[61,154,null,944910735962622,0,null],[20,154,null,779152263258759,0,null],[114,57,null,899299065140602,0,null,[[0,[74]]]],[114,23,null,332807355630864,0,null,[[0,[174]],[0,[175]]]],[-1,62,null,862286172111290,0,null,[[11,412696536558178],[7,[165]]]],[-1,62,null,586084477999704,0,null,[[11,262420649510634],[7,[166]]]],[-1,62,null,812943719034098,0,null,[[11,730424728310926],[7,[149]]]],[21,50,null,274538101787611,0,null,[[0,[103,[4,89]]]]],[22,50,null,239550021095243,0,null,[[0,[103,[4,89]]]]],[26,154,null,486798682792909,0,null],[27,154,null,328731027567305,0,null],[29,154,null,234188068107298,0,null],[62,154,null,133316122787588,0,null],[91,81,null,200240007555468,0,null],[63,154,null,605946069994689,0,null],[42,154,null,817830493547274,0,null],[74,154,null,775844640952882,0,null],[80,81,null,869450888315389,0,null],[-1,62,null,630627717822145,0,null,[[11,274951061636774],[7,[5]]]],[-1,93,null,116977229920918,2,null,[[0,[5]]]],[-1,157,null,736391687143603,0,null,[[5,[5]],[0,[176,[4,89]]]]],[28,155,null,600043185088949,0,null,[[0,[177,[4,89]]]]],[110,81,null,651347904997232,0,null],[111,81,null,283444090196331,0,null],[112,81,null,792782300222120,0,null]],[[0,0,false,null,142431529332735,17,[[113,40,null,0,false,false,false,625497375298205,null,[[8,2],[0,[122]]]]],[[113,81,null,378237626844526,0,null]]]]],[0,0,false,null,676048785017342,18,[[-1,31,null,0,false,false,false,248877710009848,null,[[11,742416866043478],[8,0],[7,[7]]]]],[[-1,62,null,524525645176153,0,null,[[11,622506128811027],[7,[178,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,503844909213121,0,null,[[11,565732277731813],[7,[9]]]],[10,68,null,625702497044122,0,null,[[0,[179]]]],[31,68,null,119003149932102,0,null,[[0,[179]]]],[36,68,null,464484053459446,0,null,[[0,[179]]]],[39,68,null,894596713742362,0,null,[[0,[179]]]],[11,68,null,712217590415207,0,null,[[0,[179]]]],[15,68,null,711749850779713,0,null,[[0,[179]]]],[15,158,null,941127370919313,0,null,[[0,[180,[1,15,71,false]]]]],[10,158,null,992899747798489,0,null,[[0,[181,[1,10,71,false]]]]],[31,158,null,308375387031561,0,null,[[0,[181,[1,31,71,false]]]]],[36,158,null,556658908925162,0,null,[[0,[181,[1,36,71,false]]]]],[39,158,null,823449525989656,0,null,[[0,[181,[1,39,71,false]]]]]]],[0,0,false,null,753052014454803,19,[[-1,31,null,0,false,false,false,275166225044997,null,[[11,742416866043478],[8,0],[7,[9]]]]],[[-1,62,null,347987035010631,0,null,[[11,622506128811027],[7,[182,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,146695307033164,0,null,[[11,565732277731813],[7,[9]]]],[10,68,null,727947295824800,0,null,[[0,[183]]]],[31,68,null,301157664277063,0,null,[[0,[183]]]],[36,68,null,921253750723455,0,null,[[0,[183]]]],[39,68,null,712266402568996,0,null,[[0,[183]]]],[11,68,null,112759451561093,0,null,[[0,[183]]]],[10,158,null,585212491631444,0,null,[[0,[181,[1,10,71,false]]]]],[31,158,null,648925716202209,0,null,[[0,[181,[1,31,71,false]]]]],[36,158,null,889234924061189,0,null,[[0,[181,[1,36,71,false]]]]],[39,158,null,269180280787142,0,null,[[0,[181,[1,39,71,false]]]]],[15,81,null,394700474775040,0,null]]],[0,0,false,null,277447076693249,20,[[-1,31,null,0,false,false,false,977030542399950,null,[[11,742416866043478],[8,0],[7,[74]]]]],[[-1,62,null,208671509893440,0,null,[[11,462466925293457],[7,[9]]]],[-1,62,null,264790651365950,0,null,[[11,622506128811027],[7,[184,[3,622506128811027],[4,153],[3,622506128811027]]]]],[-1,121,null,834965001910235,0,null,[[11,565732277731813],[7,[9]]]],[14,159,null,664271703404648,0,null,[[1,[185]],[3,1]]],[17,159,null,862107633385672,0,null,[[1,[185]],[3,1]]],[-1,93,null,883728421200957,2,null,[[0,[5]]]],[16,159,null,378686042214339,0,null,[[1,[185]],[3,1]]],[69,50,null,640771318336919,0,null,[[0,[186,[4,89]]]]],[97,50,null,661217032960491,0,null,[[0,[186,[4,89]]]]],[71,50,null,746617447151468,0,null,[[0,[187,[4,89]]]]],[100,50,null,503995385755737,0,null,[[0,[187,[4,89]]]]],[88,104,null,534009967912360,0,null,[[3,0]]],[17,104,null,264801181415061,0,null,[[3,1]]]],[[0,0,true,null,466866317677561,21,[[14,30,null,0,false,false,false,180153307361798,null,[[10,0],[8,0],[7,[5]]]],[14,30,null,0,false,false,false,996134523192531,null,[[10,0],[8,0],[7,[74]]]]],[[14,57,null,377916354296207,0,null,[[0,[9]]]]]],[0,0,true,null,406309735939516,22,[[17,30,null,0,false,false,false,595314326984963,null,[[10,0],[8,0],[7,[5]]]],[17,30,null,0,false,false,false,489446837100036,null,[[10,0],[8,0],[7,[74]]]]],[[17,57,null,940695329394003,0,null,[[0,[9]]]]]],[0,0,true,null,691865629383638,23,[[16,30,null,0,false,false,false,855082950130788,null,[[10,0],[8,0],[7,[74]]]],[16,30,null,0,false,false,false,440555310472783,null,[[10,0],[8,0],[7,[5]]]]],[[16,57,null,871550118455714,0,null,[[0,[9]]]]]]]],[0,0,false,null,152153459918955,24,[[-1,31,null,0,false,false,false,551914789168748,null,[[11,622506128811027],[8,1],[7,[27]]]]],[[-1,138,null,977385319945597,256,null,[[4,77],[5,[141]],[0,[122]],[0,[96]],[16,false],[20,[27]]]],[77,115,null,600554436128466,0,null,[[7,[14,[3,622506128811027]]]]]]],[0,0,false,null,551544465649956,25,[[-1,31,null,0,false,false,false,324356660714727,null,[[11,552810473595513],[8,0],[7,[9]]]]],[[-1,93,null,417505001504043,2,null,[[0,[188,[3,565732277731813],[3,586956771834411]]]]],[12,56,null,513266777938533,0,null,[[2,["refsoc",false]],[3,0],[0,[54]],[0,[5]],[1,[189]]]],[12,111,null,914240102930417,0,null,[[1,[189]],[0,[100]]]],[13,140,null,105263869679804,0,null,[[3,1]]],[-1,62,null,364741305349859,0,null,[[11,727009003176844],[7,[5]]]],[19,104,null,837868947476110,0,null,[[3,1]]],[77,88,"Tween",293579834375961,1,null,[[1,[190]],[3,1],[0,[137]],[0,[34]],[18,8],[3,1],[3,0],[3,0]]]]],[0,0,false,null,869815285003391,26,[[-1,31,null,0,false,true,false,888444350823685,null,[[11,347139371839372],[8,0],[7,[9]]]]],[[-1,62,null,409317573308762,0,null,[[11,342765078376117],[7,[9]]]]]]]],[0,0,false,null,546216465496532,27,[[77,160,null,1,false,false,false,508432098004765,null]],[[-1,62,null,913072591255890,0,null,[[11,342765078376117],[7,[9]]]]]],[0,0,false,null,219441910842912,28,[[79,78,null,1,false,false,false,316929297670279,null]],[[79,57,null,367963848985724,0,null,[[0,[22,[1,69,110,false]]]]]]]]],[3,[true,"Effect"],false,null,688861007028982,29,[[-1,22,null,0,false,false,false,0,false,[[1,[191]]]]],[],[[1,"speed",0,0.3,false,false,259611595560641,false,156],[4,["goalText",0,[[1,"who",0,0,false,false,594720735489185,false,180]],true,false,false],false,null,845855455676986,30,[],[[12,56,null,842568577335494,0,null,[[2,["goasoc",false]],[3,0],[0,[18]],[0,[5]],[1,[147]]]],[-1,138,null,298619922161464,256,null,[[4,57],[5,[113]],[0,[119]],[0,[120]],[16,false],[20,[27]]]],[57,57,null,740270993497229,0,null,[[0,[14,[3,594720735489185]]]]],[-1,119,null,712961830861123,0,null,[[4,57],[0,[9]]]],[57,108,null,541993555348503,0,null,[[0,[5]],[0,[5]]]],[57,87,"Tween",645880681765991,1,null,[[1,[27]],[3,1],[0,[22,[1,57,161,false]]],[0,[22,[1,57,162,false]]],[0,[14,[3,259611595560641]]],[18,0],[3,0],[3,0],[3,0]]],[57,88,"Tween",935141459233500,1,null,[[1,[192]],[3,0],[0,[122]],[0,[14,[3,259611595560641]]],[18,3],[3,0],[3,0],[3,0]]]],[[0,0,false,null,586510797349272,31,[],[[12,56,null,825597693015867,0,null,[[2,["refsoc",false]],[3,0],[0,[18]],[0,[5]],[1,[147]]]],[-1,93,null,996374135947366,2,null,[[0,[95]]]],[12,56,null,218686934477248,0,null,[[2,["refsoc",false]],[3,0],[0,[18]],[0,[5]],[1,[147]]]]]]]],[0,0,false,null,187614231745097,32,[[57,132,"Tween",1,false,false,false,396853894477169,null,[[1,[192]]]]],[[57,163,"Sine",725440088800119,0,null,[[3,1]]],[-1,93,null,137148110381740,2,null,[[0,[91]]]],[57,163,"Sine",181702715984786,0,null,[[3,0]]],[57,52,null,331676496334688,0,null,[[0,[5]]]],[57,88,"Tween",234445692007799,1,null,[[1,[193]],[3,0],[0,[194]],[0,[14,[3,259611595560641]]],[18,2],[3,1],[3,0],[3,0]]],[57,87,"Tween",282909168492014,1,null,[[1,[27]],[3,1],[0,[5]],[0,[5]],[0,[14,[3,259611595560641]]],[18,0],[3,0],[3,0],[3,0]]]]],[4,["createBallFX",0,[],true,false,false],false,null,112949983451340,33,[],[],[[0,0,true,null,159134165807914,34,[[-1,31,null,0,false,false,false,693448368178254,null,[[11,727009003176844],[8,0],[7,[5]]]]],[[56,52,null,760445920708961,0,null,[[0,[5]]]],[56,87,"Tween",461511688568950,1,null,[[1,[195]],[3,1],[0,[5]],[0,[5]],[0,[34]],[18,3],[3,1],[3,0],[3,0]]]],[[0,0,false,null,126920213807355,35,[[-1,31,null,0,false,false,false,241628024925266,null,[[11,727009003176844],[8,0],[7,[5]]]],[19,63,"Timer",0,false,true,false,978238846308932,null,[[1,[196]]]]],[[19,64,"Timer",116958714438109,0,null,[[0,[197]],[3,0],[1,[196]]]]]]]]]]]],[0,0,false,null,392064428618653,36,[],[[89,164,null,223481825200603,0,null,[[0,[198,[1,89,165,false],[4,45]]]]]]]]],["pauseEvent",[[2,"MoreGamesButtons",false],[1,"pause",0,0,false,false,895506763348983,false,33],[1,"sound",0,0,false,false,905901130947006,false,197],[0,0,false,null,683895126367970,1,[[44,166,null,1,false,false,false,975282365046526,null,[[4,96]]]],[[-1,121,null,507519152148331,0,null,[[11,905901130947006],[7,[9]]]]],[[0,0,false,null,389865017597607,2,[[-1,31,null,0,false,false,false,483463766881526,null,[[11,905901130947006],[8,4],[7,[9]]]]],[[-1,62,null,634942055079048,0,null,[[11,905901130947006],[7,[5]]]]]],[0,0,false,null,929211012971966,3,[[-1,31,null,0,false,false,false,296065438291403,null,[[11,905901130947006],[8,0],[7,[5]]]]],[[12,167,null,104112598368269,0,null,[[0,[5]]]]]],[0,0,false,null,336350994478586,4,[[-1,31,null,0,false,false,false,894455419104243,null,[[11,905901130947006],[8,0],[7,[9]]]]],[[12,167,null,301240177481720,0,null,[[0,[199]]]]]],[0,0,false,null,308246544039948,5,[],[[96,57,null,123105370058991,0,null,[[0,[14,[3,905901130947006]]]]]]]]],[0,0,false,null,386125318611702,6,[[96,78,null,1,false,false,false,666550557291131,null]],[[96,57,null,389809271501621,0,null,[[0,[14,[3,905901130947006]]]]]]],[0,0,false,null,104936265089412,8,[[44,166,null,1,false,false,false,850778254561887,null,[[4,19]]],[-1,31,null,0,false,false,false,340355566469653,null,[[11,895506763348983],[8,0],[7,[5]]]],[19,168,null,0,false,false,false,701580087498232,null],[-1,31,null,0,false,false,false,412923529791305,null,[[11,727009003176844],[8,0],[7,[5]]]]],[[-1,62,null,636030774850120,0,null,[[11,895506763348983],[7,[9]]]],[-1,135,null,966652434682216,0,null,[[5,[112]],[3,1]]],[-1,130,null,314835388166640,0,null,[[5,[106]],[0,[200]]]],[-2,"ActivateMoreGamesButtons",null,497710259494520,0,null],[-1,93,null,485001077725406,2,null,[[0,[201]]]],[-1,118,null,372408713399458,0,null,[[0,[5]]]],[-1,138,null,618752418899278,256,null,[[4,48],[5,[113]],[0,[118]],[0,[151]],[16,false],[20,[27]]]],[-1,138,null,390873525045476,256,null,[[4,48],[5,[113]],[0,[202]],[0,[151]],[16,false],[20,[27]]]],[48,57,null,350757805208330,0,null,[[0,[9]]]],[-1,138,null,664684124622162,256,null,[[4,48],[5,[113]],[0,[203]],[0,[151]],[16,false],[20,[27]]]],[48,57,null,172877739125793,0,null,[[0,[74]]]],[12,169,null,786508752233035,0,null,[[3,0]]],[-1,138,null,173883095452577,256,null,[[4,96],[5,[113]],[0,[204]],[0,[151]],[16,false],[20,[27]]]],[12,169,null,735382559282864,0,null,[[3,0]]],[-2,"ShowAd2",null,971030808831148,0,null]]],[0,0,false,null,380752203964988,9,[[44,170,null,1,false,false,false,143057716904910,null],[44,106,null,0,false,false,false,928877045704012,null,[[4,48]]],[48,30,null,0,false,false,false,200808475829643,null,[[10,0],[8,0],[7,[5]]]]],[],[[1,"temp",0,0,false,false,700500945186073,false,198],[0,0,false,null,421532680566161,10,[[48,55,null,0,false,false,false,352683704942487,null,[[8,0],[0,[5]]]]],[[12,169,null,456781807972748,0,null,[[3,1]]],[-1,135,null,809652937660021,0,null,[[5,[112]],[3,0]]],[-1,62,null,854057059129383,0,null,[[11,895506763348983],[7,[5]]]],[23,104,null,130804770750645,0,null,[[3,1]]],[-2,"DeActivateMoreGamesButtons",null,358595141588692,0,null]],[[0,0,false,null,907273234062272,11,[[-1,171,null,0,false,false,false,158445655676582,null,[[4,48]]]],[[48,81,null,363259760452518,0,null],[96,81,null,647778938863117,0,null],[-1,118,null,529747609268073,0,null,[[0,[14,[3,586956771834411]]]]]]]]],[0,0,false,null,512289786308736,12,[[-1,47,null,0,false,false,false,108412349524451,null],[48,55,null,0,false,false,false,895628152841931,null,[[8,0],[0,[9]]]]],[[12,169,null,217297452779535,0,null,[[3,1]]],[12,172,null,774846416127975,0,null],[-1,173,null,845125447194050,0,null],[-1,62,null,941244566064127,0,null,[[11,905901130947006],[7,[22,[1,96,110,false]]]]],[-1,124,null,987914159531714,0,null]]],[0,0,false,null,207121579631934,13,[[-1,47,null,0,false,false,false,759691866309721,null],[48,55,null,0,false,false,false,545179275048067,null,[[8,0],[0,[74]]]]],[[-2,"MoreGamesButton",null,219867417364865,0,null]]],[0,0,false,null,883798968650037,14,[],[[12,56,null,977759798927656,0,null,[[2,["buttonx",false]],[3,0],[0,[54]],[0,[5]],[1,[111]]]]]]]]]],["menuEvent",[[1,"menu",0,0,false,false,552810473595513,false,199],[1,"ballStartDir",0,1,false,false,100159601288384,false,200],[3,[true,"Menu"],false,null,250689675360837,1,[[-1,22,null,0,false,false,false,0,false,[[1,[205]]]]],[],[[0,0,false,null,385574708920391,2,[[-1,26,null,1,false,false,false,505578862372840,null]],[[13,140,null,350655939620105,0,null,[[3,0]]]],[[0,0,false,null,328425080771235,3,[],[[64,41,null,385950107749256,0,null,[[10,0],[7,[206,[1,64,66,false],[1,52,66,false]]]]]]],[0,0,false,null,241480286152321,4,[[-1,31,null,0,false,false,false,652382698245950,null,[[11,552810473595513],[8,0],[7,[5]]]]],[[12,56,null,175027897965173,0,null,[[2,["menu",false]],[3,1],[0,[18]],[0,[5]],[1,[109]]]],[12,133,null,499887973918403,0,null,[[1,[110]]]],[-1,93,null,322215829073993,2,null,[[0,[57]]]],[52,88,"Tween",382456410818317,1,null,[[1,[121]],[3,0],[0,[122]],[0,[34]],[18,9],[3,0],[3,0],[3,0]]],[12,56,null,991045166414713,0,null,[[2,["start",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[-2,"ActivateMoreGamesButtons",null,401670931763098,0,null]]],[0,0,false,null,810102759188452,5,[[-1,47,null,0,false,false,false,852419433470608,null]],[[-1,135,null,208060148991117,0,null,[[5,[106]],[3,0]]],[52,81,null,793534791641230,0,null],[51,154,null,502896963729282,0,null],[53,81,null,925845965113145,0,null],[55,81,null,172430297314068,0,null],[54,81,null,421120934833515,0,null],[-2,"DeActivateMoreGamesButtons",null,300077681426149,0,null],[47,104,null,985845086157123,0,null,[[3,1]]]]]]],[0,0,false,null,518625068017289,6,[[52,132,"Tween",1,false,false,false,190305828392346,null,[[1,[121]]]]],[[53,87,"Tween",995268526522716,1,null,[[1,[207]],[3,1],[0,[108]],[0,[108]],[0,[34]],[18,9],[3,0],[3,0],[3,0]]],[-1,93,null,658485621008789,2,null,[[0,[91]]]],[55,87,"Tween",114560151193827,1,null,[[1,[207]],[3,1],[0,[108]],[0,[108]],[0,[34]],[18,9],[3,0],[3,0],[3,0]]],[-1,93,null,274938776112968,2,null,[[0,[91]]]],[54,87,"Tween",340655216554254,1,null,[[1,[207]],[3,1],[0,[108]],[0,[108]],[0,[34]],[18,9],[3,0],[3,0],[3,0]]]]],[0,0,false,null,472965571049301,7,[[44,166,null,1,false,false,false,723109858170073,null,[[4,54]]]],[[12,56,null,666872093993787,0,null,[[2,["buttonx",false]],[3,0],[0,[54]],[0,[5]],[1,[111]]]],[-2,"MoreGamesButton",null,483683148934381,0,null]]],[0,0,false,null,220509110097831,8,[[44,166,null,1,false,false,false,645740547566525,null,[[4,124]]],[53,174,"Tween",0,false,true,false,301030362709757,null]],[[53,41,null,397347164498523,0,null,[[10,2],[7,[5]]]],[54,41,null,553226961212552,0,null,[[10,0],[7,[5]]]],[55,41,null,608552645968727,0,null,[[10,2],[7,[5]]]],[-2,"DeActivateMoreGamesButtons",null,234505040570083,0,null],[12,133,null,569406237054321,0,null,[[1,[109]]]],[12,56,null,700336680535201,0,null,[[2,["music",false]],[3,1],[0,[18]],[0,[5]],[1,[110]]]],[12,175,null,720877890336404,0,null,[[1,[110]],[0,[208,[4,42]]]]],[12,56,null,804549528257727,0,null,[[2,["buttonx",false]],[3,0],[0,[54]],[0,[5]],[1,[111]]]],[53,87,"Tween",747554248458229,1,null,[[1,[195]],[3,1],[0,[5]],[0,[5]],[0,[34]],[18,8],[3,1],[3,0],[3,0]]],[55,87,"Tween",805881890677231,1,null,[[1,[195]],[3,1],[0,[5]],[0,[5]],[0,[34]],[18,8],[3,1],[3,0],[3,0]]],[54,87,"Tween",893160896554593,1,null,[[1,[195]],[3,1],[0,[5]],[0,[5]],[0,[34]],[18,8],[3,1],[3,0],[3,0]]],[52,88,"Tween",317052082426668,1,null,[[1,[56]],[3,0],[0,[119]],[0,[34]],[18,8],[3,1],[3,0],[3,0]]],[51,176,"Fade",623528240146081,0,null],[-1,62,null,701690715891419,0,null,[[11,552810473595513],[7,[9]]]],[19,134,"Tween",481708193505084,1,null,[[1,[209]],[0,[108]],[0,[5]],[0,[34]],[18,1],[3,0],[3,0],[3,0]]],[-1,62,null,455514286987757,0,null,[[11,174118167449135],[7,[210,[2,124,false,1]]]]],[-2,"ShowAd2",null,861297356570550,0,null]],[[0,0,false,null,416813908708458,9,[[124,30,null,0,false,false,false,517173878703751,null,[[10,0],[8,0],[7,[5]]]]],[[-1,93,null,620913483551537,2,null,[[0,[49]]]],[12,56,null,753992553598918,0,null,[[2,["refsoc",false]],[3,0],[0,[54]],[0,[5]],[1,[189]]]],[12,111,null,737179471870983,0,null,[[1,[189]],[0,[100]]]],[19,104,null,667980947733684,0,null,[[3,1]]],[13,140,null,181626304721179,0,null,[[3,1]]],[-1,62,null,243692792625215,0,null,[[11,727009003176844],[7,[5]]]],[47,104,null,200482707283861,0,null,[[3,1]]]]],[0,0,false,null,628620436164260,10,[[-1,47,null,0,false,false,false,578384599124295,null]],[[-1,93,null,582045429916430,2,null,[[0,[34]]]],[-1,124,null,181035226174185,0,null],[-1,62,null,596955461069876,0,null,[[11,727009003176844],[7,[5]]]],[-1,62,null,316184816610911,0,null,[[11,870248114194364],[7,[5]]]],[-1,62,null,245486689923637,0,null,[[11,336820796057693],[7,[5]]]],[-1,62,null,122377043936756,0,null,[[11,308680730337585],[7,[5]]]],[-1,62,null,369294083768305,0,null,[[11,284675396607854],[7,[5]]]]]]]],[0,0,false,null,850824268737758,11,[[19,129,"Tween",0,false,false,false,879645646628815,null,[[1,[209]]]]],[[-1,130,null,447663746736666,0,null,[[5,[106]],[0,[211,[0,19,"Tween",131,false]]]]]]],[0,0,false,null,577092143400223,12,[[19,132,"Tween",1,false,false,false,352101396796876,null,[[1,[209]]]]],[[-1,130,null,126445194739049,0,null,[[5,[106]],[0,[5]]]],[-1,135,null,407975923533417,0,null,[[5,[106]],[3,0]]]]],[0,0,false,null,709866254290034,13,[[53,177,"Tween",1,false,false,false,260246317247305,null]],[[53,41,null,342819126594452,0,null,[[10,2],[7,[9]]]]]],[0,0,false,null,441376995004059,14,[[53,30,null,0,false,false,false,453613041886680,null,[[10,2],[8,0],[7,[9]]]]],[],[[0,0,false,null,421012283256538,15,[[33,178,null,0,false,false,false,235656255141556,null,[[4,53]]]],[[53,68,null,859239617718351,0,null,[[0,[212]]]]]],[0,0,false,null,157663606018438,16,[[-1,47,null,0,false,false,false,119648225565424,null]],[[53,68,null,554118252606210,0,null,[[0,[9]]]]]]]],[0,0,false,null,814934606788951,17,[[55,177,"Tween",1,false,false,false,891488023581390,null]],[[55,41,null,993643474234676,0,null,[[10,2],[7,[9]]]]]],[0,0,false,null,235656310340649,18,[[55,30,null,0,false,false,false,404348056595807,null,[[10,2],[8,0],[7,[9]]]]],[],[[0,0,false,null,726911164845993,19,[[33,178,null,0,false,false,false,551329344948066,null,[[4,55]]]],[[55,68,null,468729716795801,0,null,[[0,[212]]]]]],[0,0,false,null,515422872420718,20,[[-1,47,null,0,false,false,false,174893846482520,null]],[[55,68,null,530428509176708,0,null,[[0,[9]]]]]]]],[0,0,false,null,474393175838554,21,[[54,177,"Tween",1,false,false,false,779238575630928,null]],[[54,41,null,757770830222606,0,null,[[10,0],[7,[9]]]]]],[0,0,false,null,486345870663350,22,[[54,30,null,0,false,false,false,665235926087549,null,[[10,0],[8,0],[7,[9]]]]],[],[[0,0,false,null,477463783581383,23,[[33,178,null,0,false,false,false,134952775826759,null,[[4,54]]]],[[54,68,null,596603935640830,0,null,[[0,[212]]]]]],[0,0,false,null,754677656171732,24,[[-1,47,null,0,false,false,false,550245179264101,null]],[[54,68,null,815481943588434,0,null,[[0,[9]]]]]]]],[0,0,false,null,322874037935790,25,[],[[64,67,null,297839950539074,0,null,[[0,[213,[1,52,66,false],[2,64,false,0]]]]]]],[0,0,false,null,322760807047531,26,[[52,82,null,1,false,false,false,168856014680437,null]],[[64,81,null,308115303477679,0,null]]]]]]],["introEvent",[[0,0,false,null,681901161449260,1,[[-1,179,null,0,false,false,false,229845352838503,null]],[[58,108,null,329109012726913,0,null,[[0,[214,[4,85],[4,84]]],[0,[214,[4,97],[4,83]]]]]]],[0,0,false,null,480687243566136,2,[[-1,26,null,1,false,false,false,699080750419268,null]],[[58,180,null,316411442771980,0,null],[59,180,null,352202166348136,0,null],[58,57,null,191329346818353,0,null,[[0,[215,[4,42]]]]]]],[0,0,false,null,309390352101713,3,[[33,178,null,0,false,false,false,717278334829358,null,[[4,60]]]],[[60,108,null,370002709338337,0,null,[[0,[216,[1,60,181,false]]],[0,[216,[1,60,182,false]]]]],[33,183,null,171388744098824,0,null,[[3,1]]],[-1,93,null,934214259655863,2,null,[[0,[91]]]],[33,183,null,777223009083487,0,null,[[3,0]]],[60,108,null,689618878772062,0,null,[[0,[22,[1,60,181,false]]],[0,[22,[1,60,182,false]]]]]]],[0,0,false,null,968957417293005,4,[[44,166,null,1,false,false,false,147592349995746,null,[[4,60]]]],[[-2,"ShowAd2",null,981921815313864,0,null],[60,81,null,132310157385107,0,null],[-1,93,null,231697589900346,2,null,[[0,[57]]]],[59,57,null,181904084843864,0,null,[[0,[9]]]],[12,56,null,897397998728369,0,null,[[2,["intro-button",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[58,57,null,536993638502752,0,null,[[0,[215,[4,42]]]]],[-1,93,null,449816202459747,2,null,[[0,[201]]]],[59,57,null,733297802334909,0,null,[[0,[74]]]],[12,56,null,940046026342190,0,null,[[2,["intro-button",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[58,57,null,840563158524728,0,null,[[0,[215,[4,42]]]]],[-1,93,null,565832426677336,2,null,[[0,[201]]]],[59,57,null,924785499613085,0,null,[[0,[7]]]],[12,56,null,415834187444094,0,null,[[2,["intro-button",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[58,57,null,358338365083368,0,null,[[0,[215,[4,42]]]]],[-1,93,null,609997169822952,2,null,[[0,[201]]]],[59,57,null,186994527415285,0,null,[[0,[75]]]],[12,56,null,271582200218153,0,null,[[2,["intro-button",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[58,57,null,139967920539195,0,null,[[0,[215,[4,42]]]]],[-1,93,null,786125679466317,2,null,[[0,[201]]]],[12,56,null,471732060320295,0,null,[[2,["intro-sound",false]],[3,0],[0,[5]],[0,[5]],[1,[111]]]],[-1,93,null,209860270099605,2,null,[[0,[7]]]],[-1,184,null,180211804012098,0,null,[[6,"game"]]]]]]],["MoreGamesButtons",[[1,"hover",0,0,false,false,273982025391410,false,0],[1,"access_token",0,0,false,false,757553466119548,false,201],[1,"refURL",1,"?utm_source=Html5Game&utm_medium=",false,false,444598871493114,false,202],[1,"webSite",1,"GM",false,false,961538282909139,false,203],[1,"gameName",1,"BoxingRandom",false,false,881301639020267,false,204],[4,["ActivateMoreGamesButtons",0,[],true,false,false],false,null,531061342343981,1,[],[[4,104,null,695590692068037,0,null,[[3,1]]],[-1,93,null,237081986691491,2,null,[[0,[91]]]],[2,104,null,143742357983806,0,null,[[3,1]]],[-1,93,null,561440372754674,2,null,[[0,[91]]]],[3,104,null,257651197759949,0,null,[[3,1]]],[-1,93,null,822216557363196,2,null,[[0,[91]]]],[5,104,null,103666412214086,0,null,[[3,1]]],[-1,93,null,100605398050814,2,null,[[0,[34]]]],[3,88,"Tween",311733942750318,1,null,[[1,[217]],[3,8],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[3,88,"Tween",920373912397341,1,null,[[1,[219]],[3,9],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[2,88,"Tween",995233486076584,1,null,[[1,[217]],[3,8],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[2,88,"Tween",279804012903649,1,null,[[1,[219]],[3,9],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[4,88,"Tween",543810929200072,1,null,[[1,[217]],[3,8],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[4,88,"Tween",342123954478547,1,null,[[1,[219]],[3,9],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[5,88,"Tween",579604185943309,1,null,[[1,[217]],[3,8],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]],[5,88,"Tween",600710533404053,1,null,[[1,[219]],[3,9],[0,[218]],[0,[49]],[18,19],[3,0],[3,1],[3,1]]]]],[4,["DeActivateMoreGamesButtons",0,[],true,false,false],false,null,907916916010046,2,[],[[3,120,"Tween",981166340077331,0,null],[2,120,"Tween",435633125213608,0,null],[4,120,"Tween",554675750980166,0,null],[5,120,"Tween",318050912894256,0,null],[-1,93,null,248908625885042,2,null,[[0,[197]]]],[4,104,null,839362611264884,0,null,[[3,0]]],[-1,93,null,154113943554522,2,null,[[0,[197]]]],[2,104,null,305564799390467,0,null,[[3,0]]],[-1,93,null,850184233145635,2,null,[[0,[197]]]],[3,104,null,595827887505406,0,null,[[3,0]]],[-1,93,null,714821219653452,2,null,[[0,[197]]]],[5,104,null,164454241207696,0,null,[[3,0]]],[-1,93,null,357123382568861,2,null,[[0,[197]]]]]],[4,["MoreGamesButton",0,[],true,false,false],false,null,905153099466235,3,[],[[49,185,null,462523236984836,0,null,[[1,[220,[3,444598871493114],[3,881301639020267],[3,961538282909139]]],[1,[221]]]]]],[0,0,false,null,441225888449200,4,[[33,186,null,1,false,false,false,922741864714873,null,[[3,0],[3,0],[4,3]]],[3,168,null,0,false,false,false,231572181653366,null]],[[49,185,null,392646785764014,0,null,[[1,[222,[3,444598871493114],[3,881301639020267],[3,961538282909139]]],[1,[221]]]]]],[0,0,false,null,866231460125560,5,[[33,186,null,1,false,false,false,488613851220734,null,[[3,0],[3,0],[4,2]]],[2,168,null,0,false,false,false,725416843449812,null]],[[49,185,null,810019436776136,0,null,[[1,[223,[3,444598871493114],[3,881301639020267],[3,961538282909139]]],[1,[221]]]]]],[0,0,false,null,623141688191537,6,[[33,186,null,1,false,false,false,977163914944128,null,[[3,0],[3,0],[4,4]]],[4,168,null,0,false,false,false,717146147043116,null]],[[49,185,null,757056324009047,0,null,[[1,[224,[3,444598871493114],[3,881301639020267],[3,961538282909139]]],[1,[221]]]]]],[0,0,false,null,783450075179381,7,[[33,186,null,1,false,false,false,516856543100454,null,[[3,0],[3,0],[4,5]]],[5,168,null,0,false,false,false,418252508662062,null]],[[49,185,null,207118003551309,0,null,[[1,[225,[3,444598871493114],[3,881301639020267],[3,961538282909139]]],[1,[221]]]]]]]],["GameMonitize-JS",[[2,"gameEvent",false],[4,["ShowAd2",0,[],true,false,false],false,null,991169590421123,1,[],[[-3,187,[false,false,0]]]],[4,["adStarted",0,[],true,false,false],false,null,812959933208350,2,[],[[12,169,null,978158349601444,0,null,[[3,0]]],[-1,118,null,688293334017519,0,null,[[0,[5]]]],[49,188,null,213997971646677,0,null,[[3,0],[7,[226]]]]]],[4,["onClose",0,[],true,false,false],false,null,144526864056944,3,[],[[-2,"CheckIsPaused",null,742599811588619,0,null]]],[4,["onError",0,[],true,false,false],false,null,579949144432182,4,[],[[-1,118,null,892632495312331,0,null,[[0,[9]]]],[12,169,null,768550299337328,0,null,[[3,1]]],[49,188,null,516275865223200,0,null,[[3,0],[7,[227]]]]]],[4,["CheckIsPaused",0,[],true,false,false],false,null,132945966533524,5,[],[],[[0,0,false,null,338782626273966,6,[[-1,31,null,0,false,false,false,934504001771304,null,[[11,895506763348983],[8,0],[7,[5]]]]],[[-1,118,null,693027517082729,0,null,[[0,[9]]]],[12,169,null,462786381897801,0,null,[[3,1]]],[49,188,null,877610983369737,0,null,[[3,0],[7,[228]]]]]],[0,0,false,null,565963850730171,7,[[-1,31,null,0,false,false,false,710570006698026,null,[[11,895506763348983],[8,0],[7,[9]]]]],[[12,169,null,318781328380359,0,null,[[3,0]]],[-1,118,null,751454037001064,0,null,[[0,[5]]]],[49,188,null,492771531399655,0,null,[[3,0],[7,[229]]]]]]]]]]],[["buttonx",[["audio/webm; codecs=opus",".webm",1594]],false],["start",[["audio/webm; codecs=opus",".webm",21451]],false],["win",[["audio/webm; codecs=opus",".webm",29710]],false],["woosh",[["audio/webm; codecs=opus",".webm",1873]],false],["intro-button",[["audio/webm; codecs=opus",".webm",12499]],false],["intro-sound",[["audio/webm; codecs=opus",".webm",38492]],false],["goasoc",[["audio/webm; codecs=opus",".webm",20224]],false],["refsoc",[["audio/webm; codecs=opus",".webm",17492]],false],["wrong",[["audio/webm; codecs=opus",".webm",5314]],false],["menu",[["audio/webm; codecs=opus",".webm",41953]],false],["press",[["audio/webm; codecs=opus",".webm",3216]],false],["music",[["audio/webm; codecs=opus",".webm",367346]],false],["bonebreak",[["audio/webm; codecs=opus",".webm",9580]],false],["counter,",[["audio/webm; codecs=opus",".webm",9720]],false],["punch",[["audio/webm; codecs=opus",".webm",5979]],false],["metal",[["audio/webm; codecs=opus",".webm",3958]],false],["pof",[["audio/webm; codecs=opus",".webm",3632]],false],["spring",[["audio/webm; codecs=opus",".webm",9440]],false],["pain",[["audio/webm; codecs=opus",".webm",4360]],false],["roket",[["audio/webm; codecs=opus",".webm",4636]],false],["boxhit",[["audio/webm; codecs=opus",".webm",5367]],false]],"media/",false,290,190,3,false,"nearest",false,"1.0.2",false,false,2,2,428,true,true,1,true,0.7853981633974483,[],"icons/",[],"normalized","025bjaucvn0","fonts/",[],"default",[],"low-latency","vsync","","loading-logo.png",false,0,false,null,[],"flat"]} \ No newline at end of file diff --git a/boxingrandom/images/armskin-sheet0.png b/boxingrandom/images/armskin-sheet0.png new file mode 100644 index 00000000..101efa66 Binary files /dev/null and b/boxingrandom/images/armskin-sheet0.png differ diff --git a/boxingrandom/images/bombtimer-sheet0.png b/boxingrandom/images/bombtimer-sheet0.png new file mode 100644 index 00000000..f2f58607 Binary files /dev/null and b/boxingrandom/images/bombtimer-sheet0.png differ diff --git a/boxingrandom/images/buildingtile-sheet0.png b/boxingrandom/images/buildingtile-sheet0.png new file mode 100644 index 00000000..93bce323 Binary files /dev/null and b/boxingrandom/images/buildingtile-sheet0.png differ diff --git a/boxingrandom/images/buildingtile2-sheet0.png b/boxingrandom/images/buildingtile2-sheet0.png new file mode 100644 index 00000000..646a188a Binary files /dev/null and b/boxingrandom/images/buildingtile2-sheet0.png differ diff --git a/boxingrandom/images/buildingtile3-sheet0.png b/boxingrandom/images/buildingtile3-sheet0.png new file mode 100644 index 00000000..47d344e2 Binary files /dev/null and b/boxingrandom/images/buildingtile3-sheet0.png differ diff --git a/boxingrandom/images/cloudtile-sheet0.png b/boxingrandom/images/cloudtile-sheet0.png new file mode 100644 index 00000000..111b1d85 Binary files /dev/null and b/boxingrandom/images/cloudtile-sheet0.png differ diff --git a/boxingrandom/images/fencetile-sheet0.png b/boxingrandom/images/fencetile-sheet0.png new file mode 100644 index 00000000..ccb5c550 Binary files /dev/null and b/boxingrandom/images/fencetile-sheet0.png differ diff --git a/boxingrandom/images/game_bg-sheet0.png b/boxingrandom/images/game_bg-sheet0.png new file mode 100644 index 00000000..284d7693 Binary files /dev/null and b/boxingrandom/images/game_bg-sheet0.png differ diff --git a/boxingrandom/images/grasslinetile-sheet0.png b/boxingrandom/images/grasslinetile-sheet0.png new file mode 100644 index 00000000..afa36ca7 Binary files /dev/null and b/boxingrandom/images/grasslinetile-sheet0.png differ diff --git a/boxingrandom/images/grasstile-sheet0.png b/boxingrandom/images/grasstile-sheet0.png new file mode 100644 index 00000000..6351a65f Binary files /dev/null and b/boxingrandom/images/grasstile-sheet0.png differ diff --git a/boxingrandom/images/grasstile2-sheet0.png b/boxingrandom/images/grasstile2-sheet0.png new file mode 100644 index 00000000..ae6bb6e1 Binary files /dev/null and b/boxingrandom/images/grasstile2-sheet0.png differ diff --git a/boxingrandom/images/groundtile-sheet0.png b/boxingrandom/images/groundtile-sheet0.png new file mode 100644 index 00000000..ad7dc02d Binary files /dev/null and b/boxingrandom/images/groundtile-sheet0.png differ diff --git a/boxingrandom/images/groundtileindoor-sheet0.png b/boxingrandom/images/groundtileindoor-sheet0.png new file mode 100644 index 00000000..3adaf09c Binary files /dev/null and b/boxingrandom/images/groundtileindoor-sheet0.png differ diff --git a/boxingrandom/images/groundtileplaj-sheet0.png b/boxingrandom/images/groundtileplaj-sheet0.png new file mode 100644 index 00000000..edb13f2d Binary files /dev/null and b/boxingrandom/images/groundtileplaj-sheet0.png differ diff --git a/boxingrandom/images/groundtilesnow-sheet0.png b/boxingrandom/images/groundtilesnow-sheet0.png new file mode 100644 index 00000000..f233287c Binary files /dev/null and b/boxingrandom/images/groundtilesnow-sheet0.png differ diff --git a/boxingrandom/images/hair-sheet0.png b/boxingrandom/images/hair-sheet0.png new file mode 100644 index 00000000..5434baf2 Binary files /dev/null and b/boxingrandom/images/hair-sheet0.png differ diff --git a/boxingrandom/images/hair-sheet1.png b/boxingrandom/images/hair-sheet1.png new file mode 100644 index 00000000..8b022baa Binary files /dev/null and b/boxingrandom/images/hair-sheet1.png differ diff --git a/boxingrandom/images/indoorbgtile-sheet0.png b/boxingrandom/images/indoorbgtile-sheet0.png new file mode 100644 index 00000000..37105513 Binary files /dev/null and b/boxingrandom/images/indoorbgtile-sheet0.png differ diff --git a/boxingrandom/images/indoorbgtile2-sheet0.png b/boxingrandom/images/indoorbgtile2-sheet0.png new file mode 100644 index 00000000..e34eb699 Binary files /dev/null and b/boxingrandom/images/indoorbgtile2-sheet0.png differ diff --git a/boxingrandom/images/indoorbgtile3-sheet0.png b/boxingrandom/images/indoorbgtile3-sheet0.png new file mode 100644 index 00000000..27954dc8 Binary files /dev/null and b/boxingrandom/images/indoorbgtile3-sheet0.png differ diff --git a/boxingrandom/images/rightshoe-sheet0.png b/boxingrandom/images/rightshoe-sheet0.png new file mode 100644 index 00000000..019d0451 Binary files /dev/null and b/boxingrandom/images/rightshoe-sheet0.png differ diff --git a/boxingrandom/images/rightshort-sheet0.png b/boxingrandom/images/rightshort-sheet0.png new file mode 100644 index 00000000..3a6ad9c9 Binary files /dev/null and b/boxingrandom/images/rightshort-sheet0.png differ diff --git a/boxingrandom/images/seatile-sheet0.png b/boxingrandom/images/seatile-sheet0.png new file mode 100644 index 00000000..8b3a1723 Binary files /dev/null and b/boxingrandom/images/seatile-sheet0.png differ diff --git a/boxingrandom/images/shared-0-sheet0.png b/boxingrandom/images/shared-0-sheet0.png new file mode 100644 index 00000000..b7230903 Binary files /dev/null and b/boxingrandom/images/shared-0-sheet0.png differ diff --git a/boxingrandom/images/shared-0-sheet1.png b/boxingrandom/images/shared-0-sheet1.png new file mode 100644 index 00000000..e7d087fc Binary files /dev/null and b/boxingrandom/images/shared-0-sheet1.png differ diff --git a/boxingrandom/images/shared-0-sheet2.png b/boxingrandom/images/shared-0-sheet2.png new file mode 100644 index 00000000..20efe3bf Binary files /dev/null and b/boxingrandom/images/shared-0-sheet2.png differ diff --git a/boxingrandom/images/shared-0-sheet3.png b/boxingrandom/images/shared-0-sheet3.png new file mode 100644 index 00000000..904d034c Binary files /dev/null and b/boxingrandom/images/shared-0-sheet3.png differ diff --git a/boxingrandom/images/shared-0-sheet4.png b/boxingrandom/images/shared-0-sheet4.png new file mode 100644 index 00000000..8fbdaf7f Binary files /dev/null and b/boxingrandom/images/shared-0-sheet4.png differ diff --git a/boxingrandom/images/shared-1-sheet0.png b/boxingrandom/images/shared-1-sheet0.png new file mode 100644 index 00000000..2dfe5cba Binary files /dev/null and b/boxingrandom/images/shared-1-sheet0.png differ diff --git a/boxingrandom/images/shared-1-sheet1.png b/boxingrandom/images/shared-1-sheet1.png new file mode 100644 index 00000000..685e268a Binary files /dev/null and b/boxingrandom/images/shared-1-sheet1.png differ diff --git a/boxingrandom/images/shared-1-sheet2.png b/boxingrandom/images/shared-1-sheet2.png new file mode 100644 index 00000000..23158338 Binary files /dev/null and b/boxingrandom/images/shared-1-sheet2.png differ diff --git a/boxingrandom/images/shared-1-sheet3.png b/boxingrandom/images/shared-1-sheet3.png new file mode 100644 index 00000000..8c5d1e3d Binary files /dev/null and b/boxingrandom/images/shared-1-sheet3.png differ diff --git a/boxingrandom/images/shared-1-sheet4.png b/boxingrandom/images/shared-1-sheet4.png new file mode 100644 index 00000000..07f9e881 Binary files /dev/null and b/boxingrandom/images/shared-1-sheet4.png differ diff --git a/boxingrandom/images/smoketile-sheet0.png b/boxingrandom/images/smoketile-sheet0.png new file mode 100644 index 00000000..467de131 Binary files /dev/null and b/boxingrandom/images/smoketile-sheet0.png differ diff --git a/boxingrandom/images/snowtile-sheet0.png b/boxingrandom/images/snowtile-sheet0.png new file mode 100644 index 00000000..cc003ab1 Binary files /dev/null and b/boxingrandom/images/snowtile-sheet0.png differ diff --git a/boxingrandom/images/startile-sheet0.png b/boxingrandom/images/startile-sheet0.png new file mode 100644 index 00000000..fb0fcfb5 Binary files /dev/null and b/boxingrandom/images/startile-sheet0.png differ diff --git a/boxingrandom/images/titlebg-sheet0.png b/boxingrandom/images/titlebg-sheet0.png new file mode 100644 index 00000000..c3114d13 Binary files /dev/null and b/boxingrandom/images/titlebg-sheet0.png differ diff --git a/boxingrandom/images/titlechars-sheet0.png b/boxingrandom/images/titlechars-sheet0.png new file mode 100644 index 00000000..95ed46e3 Binary files /dev/null and b/boxingrandom/images/titlechars-sheet0.png differ diff --git a/boxingrandom/images/tshirt-sheet0.png b/boxingrandom/images/tshirt-sheet0.png new file mode 100644 index 00000000..03544d25 Binary files /dev/null and b/boxingrandom/images/tshirt-sheet0.png differ diff --git a/boxingrandom/index.html b/boxingrandom/index.html new file mode 100644 index 00000000..22087980 --- /dev/null +++ b/boxingrandom/index.html @@ -0,0 +1,34 @@ + + + + + Boxing Random + + + + + + + + + + + + + + + + + + + + diff --git a/boxingrandom/media/bonebreak.webm b/boxingrandom/media/bonebreak.webm new file mode 100644 index 00000000..3238ab2d Binary files /dev/null and b/boxingrandom/media/bonebreak.webm differ diff --git a/boxingrandom/media/boxhit.webm b/boxingrandom/media/boxhit.webm new file mode 100644 index 00000000..3a551a1f Binary files /dev/null and b/boxingrandom/media/boxhit.webm differ diff --git a/boxingrandom/media/buttonx.webm b/boxingrandom/media/buttonx.webm new file mode 100644 index 00000000..7b08f377 Binary files /dev/null and b/boxingrandom/media/buttonx.webm differ diff --git a/boxingrandom/media/counter,.webm b/boxingrandom/media/counter,.webm new file mode 100644 index 00000000..92e81a72 Binary files /dev/null and b/boxingrandom/media/counter,.webm differ diff --git a/boxingrandom/media/goasoc.webm b/boxingrandom/media/goasoc.webm new file mode 100644 index 00000000..e0092d3f Binary files /dev/null and b/boxingrandom/media/goasoc.webm differ diff --git a/boxingrandom/media/intro-button.webm b/boxingrandom/media/intro-button.webm new file mode 100644 index 00000000..cb19fa83 Binary files /dev/null and b/boxingrandom/media/intro-button.webm differ diff --git a/boxingrandom/media/intro-sound.webm b/boxingrandom/media/intro-sound.webm new file mode 100644 index 00000000..deab50cb Binary files /dev/null and b/boxingrandom/media/intro-sound.webm differ diff --git a/boxingrandom/media/menu.webm b/boxingrandom/media/menu.webm new file mode 100644 index 00000000..9a23c142 Binary files /dev/null and b/boxingrandom/media/menu.webm differ diff --git a/boxingrandom/media/metal.webm b/boxingrandom/media/metal.webm new file mode 100644 index 00000000..ed36c182 Binary files /dev/null and b/boxingrandom/media/metal.webm differ diff --git a/boxingrandom/media/music.webm b/boxingrandom/media/music.webm new file mode 100644 index 00000000..40e703d7 Binary files /dev/null and b/boxingrandom/media/music.webm differ diff --git a/boxingrandom/media/pain.webm b/boxingrandom/media/pain.webm new file mode 100644 index 00000000..f3aa393f Binary files /dev/null and b/boxingrandom/media/pain.webm differ diff --git a/boxingrandom/media/pof.webm b/boxingrandom/media/pof.webm new file mode 100644 index 00000000..09e6b9a7 Binary files /dev/null and b/boxingrandom/media/pof.webm differ diff --git a/boxingrandom/media/press.webm b/boxingrandom/media/press.webm new file mode 100644 index 00000000..c15c9e30 Binary files /dev/null and b/boxingrandom/media/press.webm differ diff --git a/boxingrandom/media/punch.webm b/boxingrandom/media/punch.webm new file mode 100644 index 00000000..eebd9c6f Binary files /dev/null and b/boxingrandom/media/punch.webm differ diff --git a/boxingrandom/media/refsoc.webm b/boxingrandom/media/refsoc.webm new file mode 100644 index 00000000..e2e03206 Binary files /dev/null and b/boxingrandom/media/refsoc.webm differ diff --git a/boxingrandom/media/roket.webm b/boxingrandom/media/roket.webm new file mode 100644 index 00000000..9e81c3f1 Binary files /dev/null and b/boxingrandom/media/roket.webm differ diff --git a/boxingrandom/media/spring.webm b/boxingrandom/media/spring.webm new file mode 100644 index 00000000..2f779a3f Binary files /dev/null and b/boxingrandom/media/spring.webm differ diff --git a/boxingrandom/media/start.webm b/boxingrandom/media/start.webm new file mode 100644 index 00000000..e45b653c Binary files /dev/null and b/boxingrandom/media/start.webm differ diff --git a/boxingrandom/media/win.webm b/boxingrandom/media/win.webm new file mode 100644 index 00000000..a7bcf22a Binary files /dev/null and b/boxingrandom/media/win.webm differ diff --git a/boxingrandom/media/woosh.webm b/boxingrandom/media/woosh.webm new file mode 100644 index 00000000..4df5fee5 Binary files /dev/null and b/boxingrandom/media/woosh.webm differ diff --git a/boxingrandom/media/wrong.webm b/boxingrandom/media/wrong.webm new file mode 100644 index 00000000..b7c81bbd Binary files /dev/null and b/boxingrandom/media/wrong.webm differ diff --git a/boxingrandom/offline.json b/boxingrandom/offline.json new file mode 100644 index 00000000..d64e62cb --- /dev/null +++ b/boxingrandom/offline.json @@ -0,0 +1 @@ +{"version":1671787833458,"fileList":["box2d.wasm.js","box2d.wasm","scripts/c3runtime.js","data.json","style.css","scripts/offlineclient.js","images/shared-0-sheet0.png","images/shared-0-sheet1.png","images/shared-0-sheet2.png","images/shared-0-sheet3.png","images/shared-0-sheet4.png","images/shared-1-sheet0.png","images/shared-1-sheet1.png","images/shared-1-sheet2.png","images/shared-1-sheet3.png","images/shared-1-sheet4.png","images/rightshoe-sheet0.png","images/hair-sheet0.png","images/hair-sheet1.png","images/rightshort-sheet0.png","images/tshirt-sheet0.png","images/groundtile-sheet0.png","images/fencetile-sheet0.png","images/grasstile-sheet0.png","images/cloudtile-sheet0.png","images/buildingtile-sheet0.png","images/startile-sheet0.png","images/titlebg-sheet0.png","images/game_bg-sheet0.png","images/groundtilesnow-sheet0.png","images/buildingtile2-sheet0.png","images/buildingtile3-sheet0.png","images/titlechars-sheet0.png","images/groundtileplaj-sheet0.png","images/seatile-sheet0.png","images/grasslinetile-sheet0.png","images/groundtileindoor-sheet0.png","images/indoorbgtile-sheet0.png","images/indoorbgtile2-sheet0.png","images/indoorbgtile3-sheet0.png","images/snowtile-sheet0.png","images/bombtimer-sheet0.png","images/armskin-sheet0.png","images/smoketile-sheet0.png","images/grasstile2-sheet0.png","scripts/opus.wasm.js","scripts/opus.wasm.wasm","scripts/main.js","scripts/dispatchworker.js","scripts/jobworker.js","scripts/supportcheck.js","scripts/project/scriptsInEvents.js","media/buttonx.webm","media/start.webm","media/win.webm","media/woosh.webm","media/intro-button.webm","media/intro-sound.webm","media/goasoc.webm","media/refsoc.webm","media/wrong.webm","media/menu.webm","media/press.webm","media/music.webm","media/bonebreak.webm","media/counter,.webm","media/punch.webm","media/metal.webm","media/pof.webm","media/spring.webm","media/pain.webm","media/roket.webm","media/boxhit.webm","scripts/register-sw.js"]} \ No newline at end of file diff --git a/boxingrandom/scripts/c3runtime.js b/boxingrandom/scripts/c3runtime.js new file mode 100644 index 00000000..22b07cdf --- /dev/null +++ b/boxingrandom/scripts/c3runtime.js @@ -0,0 +1,7308 @@ +// Generated by Construct, the game and app creator :: https://www.construct.net +// ../3rdparty/glmatrix.js +{ +/* + @fileoverview gl-matrix - High performance matrix and vector operations +@author Brandon Jones +@author Colin MacKenzie IV +@version 3.4.1 + +Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +'use strict';(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.glMatrix={}))})(this,function(exports){var EPSILON=1E-6;var ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array;var RANDOM=Math.random;var ANGLE_ORDER="zyx";function setMatrixArrayType(type){ARRAY_TYPE=type}var degree=Math.PI/180;function toRadian(a){return a* +degree}function equals$9(a,b){return Math.abs(a-b)<=EPSILON*Math.max(1,Math.abs(a),Math.abs(b))}if(!Math.hypot)Math.hypot=function(){var y=0,i=arguments.length;while(i--)y+=arguments[i]*arguments[i];return Math.sqrt(y)};var common=Object.freeze({__proto__:null,EPSILON:EPSILON,get ARRAY_TYPE(){return ARRAY_TYPE},RANDOM:RANDOM,ANGLE_ORDER:ANGLE_ORDER,setMatrixArrayType:setMatrixArrayType,toRadian:toRadian,equals:equals$9});function create$8(){var out=new ARRAY_TYPE(4);if(ARRAY_TYPE!=Float32Array){out[1]= +0;out[2]=0}out[0]=1;out[3]=1;return out}function clone$8(a){var out=new ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function copy$8(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function identity$5(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out}function fromValues$8(m00,m01,m10,m11){var out=new ARRAY_TYPE(4);out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out}function set$8(out,m00,m01,m10,m11){out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out} +function transpose$2(out,a){if(out===a){var a1=a[1];out[1]=a[2];out[2]=a1}else{out[0]=a[0];out[1]=a[2];out[2]=a[1];out[3]=a[3]}return out}function invert$5(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var det=a0*a3-a2*a1;if(!det)return null;det=1/det;out[0]=a3*det;out[1]=-a1*det;out[2]=-a2*det;out[3]=a0*det;return out}function adjoint$2(out,a){var a0=a[0];out[0]=a[3];out[1]=-a[1];out[2]=-a[2];out[3]=a0;return out}function determinant$3(a){return a[0]*a[3]-a[2]*a[1]}function multiply$8(out,a,b){var a0= +a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;return out}function rotate$4(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;return out}function scale$8(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;return out}function fromRotation$4(out, +rad){var s=Math.sin(rad);var c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;return out}function fromScaling$3(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];return out}function str$8(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function frob$3(a){return Math.hypot(a[0],a[1],a[2],a[3])}function LDU(L,D,U,a){L[2]=a[2]/a[0];U[0]=a[0];U[1]=a[1];U[3]=a[3]-L[2]*U[1];return[L,D,U]}function add$8(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out}function subtract$6(out, +a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out}function exactEquals$8(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$8(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3), +Math.abs(b3))}function multiplyScalar$3(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out}function multiplyScalarAndAdd$3(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;return out}var mul$8=multiply$8;var sub$6=subtract$6;var mat2=Object.freeze({__proto__:null,create:create$8,clone:clone$8,copy:copy$8,identity:identity$5,fromValues:fromValues$8,set:set$8,transpose:transpose$2,invert:invert$5,adjoint:adjoint$2,determinant:determinant$3, +multiply:multiply$8,rotate:rotate$4,scale:scale$8,fromRotation:fromRotation$4,fromScaling:fromScaling$3,str:str$8,frob:frob$3,LDU:LDU,add:add$8,subtract:subtract$6,exactEquals:exactEquals$8,equals:equals$8,multiplyScalar:multiplyScalar$3,multiplyScalarAndAdd:multiplyScalarAndAdd$3,mul:mul$8,sub:sub$6});function create$7(){var out=new ARRAY_TYPE(6);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[4]=0;out[5]=0}out[0]=1;out[3]=1;return out}function clone$7(a){var out=new ARRAY_TYPE(6);out[0]=a[0]; +out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function copy$7(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function identity$4(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out}function fromValues$7(a,b,c,d,tx,ty){var out=new ARRAY_TYPE(6);out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function set$7(out,a,b,c,d,tx,ty){out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function invert$4(out, +a){var aa=a[0],ab=a[1],ac=a[2],ad=a[3];var atx=a[4],aty=a[5];var det=aa*ad-ab*ac;if(!det)return null;det=1/det;out[0]=ad*det;out[1]=-ab*det;out[2]=-ac*det;out[3]=aa*det;out[4]=(ac*aty-ad*atx)*det;out[5]=(ab*atx-aa*aty)*det;return out}function determinant$2(a){return a[0]*a[3]-a[1]*a[2]}function multiply$7(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;out[4]= +a0*b4+a2*b5+a4;out[5]=a1*b4+a3*b5+a5;return out}function rotate$3(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;out[4]=a4;out[5]=a5;return out}function scale$7(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;out[4]=a4;out[5]=a5;return out}function translate$3(out,a,v){var a0=a[0],a1=a[1], +a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=a0*v0+a2*v1+a4;out[5]=a1*v0+a3*v1+a5;return out}function fromRotation$3(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;out[4]=0;out[5]=0;return out}function fromScaling$2(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];out[4]=0;out[5]=0;return out}function fromTranslation$3(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=v[0];out[5]=v[1];return out}function str$7(a){return"mat2d("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"}function frob$2(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],1)}function add$7(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];return out}function subtract$5(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];return out}function multiplyScalar$2(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]= +a[4]*b;out[5]=a[5]*b;return out}function multiplyScalarAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;return out}function exactEquals$7(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]}function equals$7(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];return Math.abs(a0-b0)<=EPSILON*Math.max(1, +Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))}var mul$7=multiply$7;var sub$5=subtract$5;var mat2d=Object.freeze({__proto__:null,create:create$7,clone:clone$7,copy:copy$7,identity:identity$4,fromValues:fromValues$7, +set:set$7,invert:invert$4,determinant:determinant$2,multiply:multiply$7,rotate:rotate$3,scale:scale$7,translate:translate$3,fromRotation:fromRotation$3,fromScaling:fromScaling$2,fromTranslation:fromTranslation$3,str:str$7,frob:frob$2,add:add$7,subtract:subtract$5,multiplyScalar:multiplyScalar$2,multiplyScalarAndAdd:multiplyScalarAndAdd$2,exactEquals:exactEquals$7,equals:equals$7,mul:mul$7,sub:sub$5});function create$6(){var out=new ARRAY_TYPE(9);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]= +0;out[5]=0;out[6]=0;out[7]=0}out[0]=1;out[4]=1;out[8]=1;return out}function fromMat4$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[4];out[4]=a[5];out[5]=a[6];out[6]=a[8];out[7]=a[9];out[8]=a[10];return out}function clone$6(a){var out=new ARRAY_TYPE(9);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out}function copy$6(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]= +a[8];return out}function fromValues$6(m00,m01,m02,m10,m11,m12,m20,m21,m22){var out=new ARRAY_TYPE(9);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function set$6(out,m00,m01,m02,m10,m11,m12,m20,m21,m22){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function identity$3(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function transpose$1(out, +a){if(out===a){var a01=a[1],a02=a[2],a12=a[5];out[1]=a[3];out[2]=a[6];out[3]=a01;out[5]=a[7];out[6]=a02;out[7]=a12}else{out[0]=a[0];out[1]=a[3];out[2]=a[6];out[3]=a[1];out[4]=a[4];out[5]=a[7];out[6]=a[2];out[7]=a[5];out[8]=a[8]}return out}function invert$3(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b01=a22*a11-a12*a21;var b11=-a22*a10+a12*a20;var b21=a21*a10-a11*a20;var det=a00*b01+a01*b11+a02*b21;if(!det)return null;det=1/det;out[0]=b01* +det;out[1]=(-a22*a01+a02*a21)*det;out[2]=(a12*a01-a02*a11)*det;out[3]=b11*det;out[4]=(a22*a00-a02*a20)*det;out[5]=(-a12*a00+a02*a10)*det;out[6]=b21*det;out[7]=(-a21*a00+a01*a20)*det;out[8]=(a11*a00-a01*a10)*det;return out}function adjoint$1(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];out[0]=a11*a22-a12*a21;out[1]=a02*a21-a01*a22;out[2]=a01*a12-a02*a11;out[3]=a12*a20-a10*a22;out[4]=a00*a22-a02*a20;out[5]=a02*a10-a00*a12;out[6]=a10*a21-a11*a20; +out[7]=a01*a20-a00*a21;out[8]=a00*a11-a01*a10;return out}function determinant$1(a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];return a00*(a22*a11-a12*a21)+a01*(-a22*a10+a12*a20)+a02*(a21*a10-a11*a20)}function multiply$6(out,a,b){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b00=b[0],b01=b[1],b02=b[2];var b10=b[3],b11=b[4],b12=b[5];var b20=b[6],b21=b[7],b22=b[8];out[0]=b00*a00+b01*a10+b02*a20;out[1]= +b00*a01+b01*a11+b02*a21;out[2]=b00*a02+b01*a12+b02*a22;out[3]=b10*a00+b11*a10+b12*a20;out[4]=b10*a01+b11*a11+b12*a21;out[5]=b10*a02+b11*a12+b12*a22;out[6]=b20*a00+b21*a10+b22*a20;out[7]=b20*a01+b21*a11+b22*a21;out[8]=b20*a02+b21*a12+b22*a22;return out}function translate$2(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x=v[0],y=v[1];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a10;out[4]=a11;out[5]=a12;out[6]=x*a00+y*a10+a20;out[7]=x*a01+y*a11+a21;out[8]=x* +a02+y*a12+a22;return out}function rotate$2(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);out[0]=c*a00+s*a10;out[1]=c*a01+s*a11;out[2]=c*a02+s*a12;out[3]=c*a10-s*a00;out[4]=c*a11-s*a01;out[5]=c*a12-s*a02;out[6]=a20;out[7]=a21;out[8]=a22;return out}function scale$6(out,a,v){var x=v[0],y=v[1];out[0]=x*a[0];out[1]=x*a[1];out[2]=x*a[2];out[3]=y*a[3];out[4]=y*a[4];out[5]=y*a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out} +function fromTranslation$2(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=v[0];out[7]=v[1];out[8]=1;return out}function fromRotation$2(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=0;out[3]=-s;out[4]=c;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromScaling$1(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=0;out[4]=v[1];out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromMat2d(out,a){out[0]=a[0];out[1]=a[1];out[2]=0;out[3]=a[2];out[4]=a[3]; +out[5]=0;out[6]=a[4];out[7]=a[5];out[8]=1;return out}function fromQuat$1(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out}function normalFromMat4(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20= +a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a12* +b08-a10*b11-a13*b07)*det;out[2]=(a10*b10-a11*b08+a13*b06)*det;out[3]=(a02*b10-a01*b11-a03*b09)*det;out[4]=(a00*b11-a02*b08+a03*b07)*det;out[5]=(a01*b08-a00*b10-a03*b06)*det;out[6]=(a31*b05-a32*b04+a33*b03)*det;out[7]=(a32*b02-a30*b05-a33*b01)*det;out[8]=(a30*b04-a31*b02+a33*b00)*det;return out}function projection(out,width,height){out[0]=2/width;out[1]=0;out[2]=0;out[3]=0;out[4]=-2/height;out[5]=0;out[6]=-1;out[7]=1;out[8]=1;return out}function str$6(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+ +a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"}function frob$1(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}function add$6(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];return out}function subtract$4(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]= +a[8]-b[8];return out}function multiplyScalar$1(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;return out}function multiplyScalarAndAdd$1(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;return out}function exactEquals$6(a,b){return a[0]===b[0]&& +a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]}function equals$6(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7],a8=a[8];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON* +Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))}var mul$6=multiply$6;var sub$4=subtract$4;var mat3=Object.freeze({__proto__:null,create:create$6,fromMat4:fromMat4$1,clone:clone$6,copy:copy$6, +fromValues:fromValues$6,set:set$6,identity:identity$3,transpose:transpose$1,invert:invert$3,adjoint:adjoint$1,determinant:determinant$1,multiply:multiply$6,translate:translate$2,rotate:rotate$2,scale:scale$6,fromTranslation:fromTranslation$2,fromRotation:fromRotation$2,fromScaling:fromScaling$1,fromMat2d:fromMat2d,fromQuat:fromQuat$1,normalFromMat4:normalFromMat4,projection:projection,str:str$6,frob:frob$1,add:add$6,subtract:subtract$4,multiplyScalar:multiplyScalar$1,multiplyScalarAndAdd:multiplyScalarAndAdd$1, +exactEquals:exactEquals$6,equals:equals$6,mul:mul$6,sub:sub$4});function create$5(){var out=new ARRAY_TYPE(16);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=0;out[12]=0;out[13]=0;out[14]=0}out[0]=1;out[5]=1;out[10]=1;out[15]=1;return out}function clone$5(a){var out=new ARRAY_TYPE(16);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]= +a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function copy$5(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function fromValues$5(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){var out=new ARRAY_TYPE(16);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]= +m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function set$5(out,m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]=m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function identity$2(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]= +0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function transpose(out,a){if(out===a){var a01=a[1],a02=a[2],a03=a[3];var a12=a[6],a13=a[7];var a23=a[11];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a01;out[6]=a[9];out[7]=a[13];out[8]=a02;out[9]=a12;out[11]=a[14];out[12]=a03;out[13]=a13;out[14]=a23}else{out[0]=a[0];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a[1];out[5]=a[5];out[6]=a[9];out[7]=a[13];out[8]=a[2];out[9]=a[6];out[10]=a[10];out[11]=a[14];out[12]=a[3];out[13]=a[7];out[14]=a[11];out[15]= +a[15]}return out}function invert$2(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det= +b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a02*b10-a01*b11-a03*b09)*det;out[2]=(a31*b05-a32*b04+a33*b03)*det;out[3]=(a22*b04-a21*b05-a23*b03)*det;out[4]=(a12*b08-a10*b11-a13*b07)*det;out[5]=(a00*b11-a02*b08+a03*b07)*det;out[6]=(a32*b02-a30*b05-a33*b01)*det;out[7]=(a20*b05-a22*b02+a23*b01)*det;out[8]=(a10*b10-a11*b08+a13*b06)*det;out[9]=(a01*b08-a00*b10-a03*b06)*det;out[10]=(a30*b04-a31*b02+a33*b00)*det;out[11]=(a21*b02- +a20*b04-a23*b00)*det;out[12]=(a11*b07-a10*b09-a12*b06)*det;out[13]=(a00*b09-a01*b07+a02*b06)*det;out[14]=(a31*b01-a30*b03-a32*b00)*det;out[15]=(a20*b03-a21*b01+a22*b00)*det;return out}function adjoint(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05= +a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;out[0]=a11*b11-a12*b10+a13*b09;out[1]=a02*b10-a01*b11-a03*b09;out[2]=a31*b05-a32*b04+a33*b03;out[3]=a22*b04-a21*b05-a23*b03;out[4]=a12*b08-a10*b11-a13*b07;out[5]=a00*b11-a02*b08+a03*b07;out[6]=a32*b02-a30*b05-a33*b01;out[7]=a20*b05-a22*b02+a23*b01;out[8]=a10*b10-a11*b08+a13*b06;out[9]=a01*b08-a00*b10-a03*b06;out[10]=a30*b04-a31*b02+a33*b00; +out[11]=a21*b02-a20*b04-a23*b00;out[12]=a11*b07-a10*b09-a12*b06;out[13]=a00*b09-a01*b07+a02*b06;out[14]=a31*b01-a30*b03-a32*b00;out[15]=a20*b03-a21*b01+a22*b00;return out}function determinant(a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=a00*a11-a01*a10;var b1=a00*a12-a02*a10;var b2=a01*a12-a02*a11;var b3=a20*a31-a21*a30;var b4=a20*a32-a22*a30;var b5=a21*a32-a22*a31;var b6= +a00*b5-a01*b4+a02*b3;var b7=a10*b5-a11*b4+a12*b3;var b8=a20*b2-a21*b1+a22*b0;var b9=a30*b2-a31*b1+a32*b0;return a13*b6-a03*b7+a33*b8-a23*b9}function multiply$5(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=b0*a00+b1*a10+b2*a20+b3*a30;out[1]=b0*a01+b1*a11+b2*a21+b3*a31;out[2]=b0*a02+b1*a12+b2*a22+b3*a32;out[3]=b0*a03+b1*a13+b2*a23+ +b3*a33;b0=b[4];b1=b[5];b2=b[6];b3=b[7];out[4]=b0*a00+b1*a10+b2*a20+b3*a30;out[5]=b0*a01+b1*a11+b2*a21+b3*a31;out[6]=b0*a02+b1*a12+b2*a22+b3*a32;out[7]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[8];b1=b[9];b2=b[10];b3=b[11];out[8]=b0*a00+b1*a10+b2*a20+b3*a30;out[9]=b0*a01+b1*a11+b2*a21+b3*a31;out[10]=b0*a02+b1*a12+b2*a22+b3*a32;out[11]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[12];b1=b[13];b2=b[14];b3=b[15];out[12]=b0*a00+b1*a10+b2*a20+b3*a30;out[13]=b0*a01+b1*a11+b2*a21+b3*a31;out[14]=b0*a02+b1*a12+b2*a22+b3*a32;out[15]= +b0*a03+b1*a13+b2*a23+b3*a33;return out}function translate$1(out,a,v){var x=v[0],y=v[1],z=v[2];var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]= +a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out}function scale$5(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function rotate$1(out, +a,rad,axis){var x=axis[0],y=axis[1],z=axis[2];var len=Math.hypot(x,y,z);var s,c,t;var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;var b00,b01,b02;var b10,b11,b12;var b20,b21,b22;if(len0){translation[0]=(ax*bw+aw*bx+ay*bz- +az*by)*2/magnitude;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2/magnitude;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2/magnitude}else{translation[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2}fromRotationTranslation$1(out,a,translation);return out}function getTranslation$1(out,mat){out[0]=mat[12];out[1]=mat[13];out[2]=mat[14];return out}function getScaling(out,mat){var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22= +mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out[0]=Math.hypot(m11,m12,m13);out[1]=Math.hypot(m21,m22,m23);out[2]=Math.hypot(m31,m32,m33);return out}function getRotation(out,mat){var scaling=new ARRAY_TYPE(3);getScaling(scaling,mat);var is1=1/scaling[0];var is2=1/scaling[1];var is3=1/scaling[2];var sm11=mat[0]*is1;var sm12=mat[1]*is2;var sm13=mat[2]*is3;var sm21=mat[4]*is1;var sm22=mat[5]*is2;var sm23=mat[6]*is3;var sm31=mat[8]*is1;var sm32=mat[9]*is2;var sm33=mat[10]*is3;var trace= +sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out[3]=.25*S;out[0]=(sm23-sm32)/S;out[1]=(sm31-sm13)/S;out[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out[3]=(sm23-sm32)/S;out[0]=.25*S;out[1]=(sm12+sm21)/S;out[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out[3]=(sm31-sm13)/S;out[0]=(sm12+sm21)/S;out[1]=.25*S;out[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+sm33-sm11-sm22)*2;out[3]=(sm12-sm21)/S;out[0]=(sm31+sm13)/S;out[1]=(sm23+sm32)/S;out[2]= +.25*S}return out}function decompose(out_r,out_t,out_s,mat){out_t[0]=mat[12];out_t[1]=mat[13];out_t[2]=mat[14];var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22=mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out_s[0]=Math.hypot(m11,m12,m13);out_s[1]=Math.hypot(m21,m22,m23);out_s[2]=Math.hypot(m31,m32,m33);var is1=1/out_s[0];var is2=1/out_s[1];var is3=1/out_s[2];var sm11=m11*is1;var sm12=m12*is2;var sm13=m13*is3;var sm21=m21*is1;var sm22=m22*is2;var sm23=m23*is3; +var sm31=m31*is1;var sm32=m32*is2;var sm33=m33*is3;var trace=sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out_r[3]=.25*S;out_r[0]=(sm23-sm32)/S;out_r[1]=(sm31-sm13)/S;out_r[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out_r[3]=(sm23-sm32)/S;out_r[0]=.25*S;out_r[1]=(sm12+sm21)/S;out_r[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out_r[3]=(sm31-sm13)/S;out_r[0]=(sm12+sm21)/S;out_r[1]=.25*S;out_r[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+ +sm33-sm11-sm22)*2;out_r[3]=(sm12-sm21)/S;out_r[0]=(sm31+sm13)/S;out_r[1]=(sm23+sm32)/S;out_r[2]=.25*S}return out_r}function fromRotationTranslationScale(out,q,v,s){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];out[0]=(1-(yy+zz))*sx;out[1]=(xy+wz)*sx;out[2]=(xz-wy)*sx;out[3]=0;out[4]=(xy-wz)*sy;out[5]=(1-(xx+zz))*sy;out[6]=(yz+wx)*sy;out[7]= +0;out[8]=(xz+wy)*sz;out[9]=(yz-wx)*sz;out[10]=(1-(xx+yy))*sz;out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out}function fromRotationTranslationScaleOrigin(out,q,v,s,o){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];var ox=o[0];var oy=o[1];var oz=o[2];var out0=(1-(yy+zz))*sx;var out1=(xy+wz)*sx;var out2=(xz-wy)*sx;var out4= +(xy-wz)*sy;var out5=(1-(xx+zz))*sy;var out6=(yz+wx)*sy;var out8=(xz+wy)*sz;var out9=(yz-wx)*sz;var out10=(1-(xx+yy))*sz;out[0]=out0;out[1]=out1;out[2]=out2;out[3]=0;out[4]=out4;out[5]=out5;out[6]=out6;out[7]=0;out[8]=out8;out[9]=out9;out[10]=out10;out[11]=0;out[12]=v[0]+ox-(out0*ox+out4*oy+out8*oz);out[13]=v[1]+oy-(out1*ox+out5*oy+out9*oz);out[14]=v[2]+oz-(out2*ox+out6*oy+out10*oz);out[15]=1;return out}function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx= +x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[1]=yx+wz;out[2]=zx-wy;out[3]=0;out[4]=yx-wz;out[5]=1-xx-zz;out[6]=zy+wx;out[7]=0;out[8]=zx+wy;out[9]=zy-wx;out[10]=1-xx-yy;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function frustum(out,left,right,bottom,top,near,far){var rl=1/(right-left);var tb=1/(top-bottom);var nf=1/(near-far);out[0]=near*2*rl;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=near*2*tb;out[6]=0;out[7]= +0;out[8]=(right+left)*rl;out[9]=(top+bottom)*tb;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near*2*nf;out[15]=0;return out}function perspectiveNO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=(far+near)*nf;out[14]=2*far*near*nf}else{out[10]=-1;out[14]=-2*near}return out}var perspective= +perspectiveNO;function perspectiveZO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=far*nf;out[14]=far*near*nf}else{out[10]=-1;out[14]=-near}return out}function perspectiveFromFieldOfView(out,fov,near,far){var upTan=Math.tan(fov.upDegrees*Math.PI/180);var downTan=Math.tan(fov.downDegrees*Math.PI/180); +var leftTan=Math.tan(fov.leftDegrees*Math.PI/180);var rightTan=Math.tan(fov.rightDegrees*Math.PI/180);var xScale=2/(leftTan+rightTan);var yScale=2/(upTan+downTan);out[0]=xScale;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=yScale;out[6]=0;out[7]=0;out[8]=-((leftTan-rightTan)*xScale*.5);out[9]=(upTan-downTan)*yScale*.5;out[10]=far/(near-far);out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near/(near-far);out[15]=0;return out}function orthoNO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt= +1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=2*nf;out[11]=0;out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=(far+near)*nf;out[15]=1;return out}var ortho=orthoNO;function orthoZO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt=1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=nf;out[11]=0; +out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=near*nf;out[15]=1;return out}function lookAt(out,eye,center,up){var x0,x1,x2,y0,y1,y2,z0,z1,z2,len;var eyex=eye[0];var eyey=eye[1];var eyez=eye[2];var upx=up[0];var upy=up[1];var upz=up[2];var centerx=center[0];var centery=center[1];var centerz=center[2];if(Math.abs(eyex-centerx)0){len=1/Math.sqrt(len);z0*=len;z1*=len;z2*=len}var x0=upy*z2-upz*z1,x1=upz*z0-upx*z2,x2=upx*z1-upy*z0;len=x0*x0+x1*x1+x2*x2;if(len>0){len=1/Math.sqrt(len);x0*=len;x1*=len;x2*=len}out[0]=x0;out[1]=x1;out[2]=x2;out[3]=0;out[4]=z1*x2-z2*x1;out[5]=z2*x0-z0*x2;out[6]= +z0*x1-z1*x0;out[7]=0;out[8]=z0;out[9]=z1;out[10]=z2;out[11]=0;out[12]=eyex;out[13]=eyey;out[14]=eyez;out[15]=1;return out}function str$5(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"}function frob(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function add$5(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]= +a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];out[9]=a[9]+b[9];out[10]=a[10]+b[10];out[11]=a[11]+b[11];out[12]=a[12]+b[12];out[13]=a[13]+b[13];out[14]=a[14]+b[14];out[15]=a[15]+b[15];return out}function subtract$3(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]=a[8]-b[8];out[9]=a[9]-b[9];out[10]=a[10]-b[10];out[11]=a[11]-b[11];out[12]= +a[12]-b[12];out[13]=a[13]-b[13];out[14]=a[14]-b[14];out[15]=a[15]-b[15];return out}function multiplyScalar(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;out[9]=a[9]*b;out[10]=a[10]*b;out[11]=a[11]*b;out[12]=a[12]*b;out[13]=a[13]*b;out[14]=a[14]*b;out[15]=a[15]*b;return out}function multiplyScalarAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]= +a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;out[9]=a[9]+b[9]*scale;out[10]=a[10]+b[10]*scale;out[11]=a[11]+b[11]*scale;out[12]=a[12]+b[12]*scale;out[13]=a[13]+b[13]*scale;out[14]=a[14]+b[14]*scale;out[15]=a[15]+b[15]*scale;return out}function exactEquals$5(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]=== +b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]}function equals$5(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var a4=a[4],a5=a[5],a6=a[6],a7=a[7];var a8=a[8],a9=a[9],a10=a[10],a11=a[11];var a12=a[12],a13=a[13],a14=a[14],a15=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];var b4=b[4],b5=b[5],b6=b[6],b7=b[7];var b8=b[8],b9=b[9],b10=b[10],b11=b[11];var b12=b[12],b13=b[13],b14=b[14],b15=b[15];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1), +Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))&&Math.abs(a9-b9)<=EPSILON*Math.max(1,Math.abs(a9), +Math.abs(b9))&&Math.abs(a10-b10)<=EPSILON*Math.max(1,Math.abs(a10),Math.abs(b10))&&Math.abs(a11-b11)<=EPSILON*Math.max(1,Math.abs(a11),Math.abs(b11))&&Math.abs(a12-b12)<=EPSILON*Math.max(1,Math.abs(a12),Math.abs(b12))&&Math.abs(a13-b13)<=EPSILON*Math.max(1,Math.abs(a13),Math.abs(b13))&&Math.abs(a14-b14)<=EPSILON*Math.max(1,Math.abs(a14),Math.abs(b14))&&Math.abs(a15-b15)<=EPSILON*Math.max(1,Math.abs(a15),Math.abs(b15))}var mul$5=multiply$5;var sub$3=subtract$3;var mat4=Object.freeze({__proto__:null, +create:create$5,clone:clone$5,copy:copy$5,fromValues:fromValues$5,set:set$5,identity:identity$2,transpose:transpose,invert:invert$2,adjoint:adjoint,determinant:determinant,multiply:multiply$5,translate:translate$1,scale:scale$5,rotate:rotate$1,rotateX:rotateX$3,rotateY:rotateY$3,rotateZ:rotateZ$3,fromTranslation:fromTranslation$1,fromScaling:fromScaling,fromRotation:fromRotation$1,fromXRotation:fromXRotation,fromYRotation:fromYRotation,fromZRotation:fromZRotation,fromRotationTranslation:fromRotationTranslation$1, +fromQuat2:fromQuat2,getTranslation:getTranslation$1,getScaling:getScaling,getRotation:getRotation,decompose:decompose,fromRotationTranslationScale:fromRotationTranslationScale,fromRotationTranslationScaleOrigin:fromRotationTranslationScaleOrigin,fromQuat:fromQuat,frustum:frustum,perspectiveNO:perspectiveNO,perspective:perspective,perspectiveZO:perspectiveZO,perspectiveFromFieldOfView:perspectiveFromFieldOfView,orthoNO:orthoNO,ortho:ortho,orthoZO:orthoZO,lookAt:lookAt,targetTo:targetTo,str:str$5,frob:frob, +add:add$5,subtract:subtract$3,multiplyScalar:multiplyScalar,multiplyScalarAndAdd:multiplyScalarAndAdd,exactEquals:exactEquals$5,equals:equals$5,mul:mul$5,sub:sub$3});function create$4(){var out=new ARRAY_TYPE(3);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0;out[2]=0}return out}function clone$4(a){var out=new ARRAY_TYPE(3);out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function length$4(a){var x=a[0];var y=a[1];var z=a[2];return Math.hypot(x,y,z)}function fromValues$4(x,y,z){var out=new ARRAY_TYPE(3); +out[0]=x;out[1]=y;out[2]=z;return out}function copy$4(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function set$4(out,x,y,z){out[0]=x;out[1]=y;out[2]=z;return out}function add$4(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];return out}function subtract$2(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];return out}function multiply$4(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];return out}function divide$2(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1]; +out[2]=a[2]/b[2];return out}function ceil$2(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);out[2]=Math.ceil(a[2]);return out}function floor$2(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);out[2]=Math.floor(a[2]);return out}function min$2(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);return out}function max$2(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);return out}function round$2(out,a){out[0]= +Math.round(a[0]);out[1]=Math.round(a[1]);out[2]=Math.round(a[2]);return out}function scale$4(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;return out}function scaleAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;return out}function distance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return Math.hypot(x,y,z)}function squaredDistance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return x*x+y*y+z*z}function squaredLength$4(a){var x= +a[0];var y=a[1];var z=a[2];return x*x+y*y+z*z}function negate$2(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];return out}function inverse$2(out,a){out[0]=1/a[0];out[1]=1/a[1];out[2]=1/a[2];return out}function normalize$4(out,a){var x=a[0];var y=a[1];var z=a[2];var len=x*x+y*y+z*z;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len;return out}function dot$4(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function cross$2(out,a,b){var ax=a[0],ay=a[1],az=a[2];var bx=b[0],by=b[1], +bz=b[2];out[0]=ay*bz-az*by;out[1]=az*bx-ax*bz;out[2]=ax*by-ay*bx;return out}function lerp$4(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);return out}function slerp$1(out,a,b,t){var angle=Math.acos(Math.min(Math.max(dot$4(a,b),-1),1));var sinTotal=Math.sin(angle);var ratioA=Math.sin((1-t)*angle)/sinTotal;var ratioB=Math.sin(t*angle)/sinTotal;out[0]=ratioA*a[0]+ratioB*b[0];out[1]=ratioA*a[1]+ratioB*b[1];out[2]=ratioA*a[2]+ratioB*b[2]; +return out}function hermite(out,a,b,c,d,t){var factorTimes2=t*t;var factor1=factorTimes2*(2*t-3)+1;var factor2=factorTimes2*(t-2)+t;var factor3=factorTimes2*(t-1);var factor4=factorTimes2*(3-2*t);out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function bezier(out,a,b,c,d,t){var inverseFactor=1-t;var inverseFactorTimesTwo=inverseFactor*inverseFactor;var factorTimes2= +t*t;var factor1=inverseFactorTimesTwo*inverseFactor;var factor2=3*t*inverseFactorTimesTwo;var factor3=3*factorTimes2*inverseFactor;var factor4=factorTimes2*t;out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function random$3(out,scale){scale=scale||1;var r=RANDOM()*2*Math.PI;var z=RANDOM()*2-1;var zScale=Math.sqrt(1-z*z)*scale;out[0]=Math.cos(r)*zScale;out[1]= +Math.sin(r)*zScale;out[2]=z*scale;return out}function transformMat4$2(out,a,m){var x=a[0],y=a[1],z=a[2];var w=m[3]*x+m[7]*y+m[11]*z+m[15];w=w||1;out[0]=(m[0]*x+m[4]*y+m[8]*z+m[12])/w;out[1]=(m[1]*x+m[5]*y+m[9]*z+m[13])/w;out[2]=(m[2]*x+m[6]*y+m[10]*z+m[14])/w;return out}function transformMat3$1(out,a,m){var x=a[0],y=a[1],z=a[2];out[0]=x*m[0]+y*m[3]+z*m[6];out[1]=x*m[1]+y*m[4]+z*m[7];out[2]=x*m[2]+y*m[5]+z*m[8];return out}function transformQuat$1(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var x= +a[0],y=a[1],z=a[2];var uvx=qy*z-qz*y,uvy=qz*x-qx*z,uvz=qx*y-qy*x;var uuvx=qy*uvz-qz*uvy,uuvy=qz*uvx-qx*uvz,uuvz=qx*uvy-qy*uvx;var w2=qw*2;uvx*=w2;uvy*=w2;uvz*=w2;uuvx*=2;uuvy*=2;uuvz*=2;out[0]=x+uvx+uuvx;out[1]=y+uvy+uuvy;out[2]=z+uvz+uuvz;return out}function rotateX$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0];r[1]=p[1]*Math.cos(rad)-p[2]*Math.sin(rad);r[2]=p[1]*Math.sin(rad)+p[2]*Math.cos(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateY$2(out, +a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[2]*Math.sin(rad)+p[0]*Math.cos(rad);r[1]=p[1];r[2]=p[2]*Math.cos(rad)-p[0]*Math.sin(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateZ$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0]*Math.cos(rad)-p[1]*Math.sin(rad);r[1]=p[0]*Math.sin(rad)+p[1]*Math.cos(rad);r[2]=p[2];out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function angle$1(a,b){var ax= +a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2],mag=Math.sqrt((ax*ax+ay*ay+az*az)*(bx*bx+by*by+bz*bz)),cosine=mag&&dot$4(a,b)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero$2(out){out[0]=0;out[1]=0;out[2]=0;return out}function str$4(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"}function exactEquals$4(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]}function equals$4(a,b){var a0=a[0],a1=a[1],a2=a[2];var b0=b[0],b1=b[1],b2=b[2];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0), +Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))}var sub$2=subtract$2;var mul$4=multiply$4;var div$2=divide$2;var dist$2=distance$2;var sqrDist$2=squaredDistance$2;var len$4=length$4;var sqrLen$4=squaredLength$4;var forEach$2=function(){var vec=create$4();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=3;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length; +for(i=offset;i0)len=1/Math.sqrt(len);out[0]= +x*len;out[1]=y*len;out[2]=z*len;out[3]=w*len;return out}function dot$3(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cross$1(out,u,v,w){var A=v[0]*w[1]-v[1]*w[0],B=v[0]*w[2]-v[2]*w[0],C=v[0]*w[3]-v[3]*w[0],D=v[1]*w[2]-v[2]*w[1],E=v[1]*w[3]-v[3]*w[1],F=v[2]*w[3]-v[3]*w[2];var G=u[0];var H=u[1];var I=u[2];var J=u[3];out[0]=H*F-I*E+J*D;out[1]=-(G*F)+I*C-J*B;out[2]=G*E-H*C+J*A;out[3]=-(G*D)+H*B-I*A;return out}function lerp$3(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];var aw=a[3];out[0]= +ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);out[3]=aw+t*(b[3]-aw);return out}function random$2(out,scale){scale=scale||1;var v1,v2,v3,v4;var s1,s2;do{v1=RANDOM()*2-1;v2=RANDOM()*2-1;s1=v1*v1+v2*v2}while(s1>=1);do{v3=RANDOM()*2-1;v4=RANDOM()*2-1;s2=v3*v3+v4*v4}while(s2>=1);var d=Math.sqrt((1-s1)/s2);out[0]=scale*v1;out[1]=scale*v2;out[2]=scale*v3*d;out[3]=scale*v4*d;return out}function transformMat4$1(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w;out[1]= +m[1]*x+m[5]*y+m[9]*z+m[13]*w;out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w;out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w;return out}function transformQuat(out,a,q){var x=a[0],y=a[1],z=a[2];var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;out[3]=a[3];return out}function zero$1(out){out[0]=0;out[1]=0;out[2]=0;out[3]=0;return out}function str$3(a){return"vec4("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function exactEquals$3(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$3(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))}var sub$1=subtract$1; +var mul$3=multiply$3;var div$1=divide$1;var dist$1=distance$1;var sqrDist$1=squaredDistance$1;var len$3=length$3;var sqrLen$3=squaredLength$3;var forEach$1=function(){var vec=create$3();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=4;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length;for(i=offset;iEPSILON){out_axis[0]=q[0]/s;out_axis[1]=q[1]/s;out_axis[2]=q[2]/s}else{out_axis[0]=1;out_axis[1]=0;out_axis[2]=0}return rad}function getAngle(a,b){var dotproduct=dot$2(a,b);return Math.acos(2*dotproduct*dotproduct-1)}function multiply$2(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];out[0]=ax*bw+aw*bx+ay*bz-az*by;out[1]=ay*bw+aw*by+az*bx- +ax*bz;out[2]=az*bw+aw*bz+ax*by-ay*bx;out[3]=aw*bw-ax*bx-ay*by-az*bz;return out}function rotateX$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+aw*bx;out[1]=ay*bw+az*bx;out[2]=az*bw-ay*bx;out[3]=aw*bw-ax*bx;return out}function rotateY$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var by=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw-az*by;out[1]=ay*bw+aw*by;out[2]=az*bw+ax*by;out[3]=aw*bw-ay*by;return out}function rotateZ$1(out,a, +rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bz=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+ay*bz;out[1]=ay*bw-ax*bz;out[2]=az*bw+aw*bz;out[3]=aw*bw-az*bz;return out}function calculateW(out,a){var x=a[0],y=a[1],z=a[2];out[0]=x;out[1]=y;out[2]=z;out[3]=Math.sqrt(Math.abs(1-x*x-y*y-z*z));return out}function exp(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var et=Math.exp(w);var s=r>0?et*Math.sin(r)/r:0;out[0]=x*s;out[1]=y*s;out[2]=z*s;out[3]=et*Math.cos(r);return out} +function ln(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var t=r>0?Math.atan2(r,w)/r:0;out[0]=x*t;out[1]=y*t;out[2]=z*t;out[3]=.5*Math.log(x*x+y*y+z*z+w*w);return out}function pow(out,a,b){ln(out,a);scale$2(out,out,b);exp(out,out);return out}function slerp(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];var omega,cosom,sinom,scale0,scale1;cosom=ax*bx+ay*by+az*bz+aw*bw;if(cosom<0){cosom=-cosom;bx=-bx;by=-by;bz=-bz;bw=-bw}if(1-cosom>EPSILON){omega= +Math.acos(cosom);sinom=Math.sin(omega);scale0=Math.sin((1-t)*omega)/sinom;scale1=Math.sin(t*omega)/sinom}else{scale0=1-t;scale1=t}out[0]=scale0*ax+scale1*bx;out[1]=scale0*ay+scale1*by;out[2]=scale0*az+scale1*bz;out[3]=scale0*aw+scale1*bw;return out}function random$1(out){var u1=RANDOM();var u2=RANDOM();var u3=RANDOM();var sqrt1MinusU1=Math.sqrt(1-u1);var sqrtU1=Math.sqrt(u1);out[0]=sqrt1MinusU1*Math.sin(2*Math.PI*u2);out[1]=sqrt1MinusU1*Math.cos(2*Math.PI*u2);out[2]=sqrtU1*Math.sin(2*Math.PI*u3); +out[3]=sqrtU1*Math.cos(2*Math.PI*u3);return out}function invert$1(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var dot=a0*a0+a1*a1+a2*a2+a3*a3;var invDot=dot?1/dot:0;out[0]=-a0*invDot;out[1]=-a1*invDot;out[2]=-a2*invDot;out[3]=a3*invDot;return out}function conjugate$1(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=a[3];return out}function fromMat3(out,m){var fTrace=m[0]+m[4]+m[8];var fRoot;if(fTrace>0){fRoot=Math.sqrt(fTrace+1);out[3]=.5*fRoot;fRoot=.5/fRoot;out[0]=(m[5]-m[7])*fRoot;out[1]=(m[6]- +m[2])*fRoot;out[2]=(m[1]-m[3])*fRoot}else{var i=0;if(m[4]>m[0])i=1;if(m[8]>m[i*3+i])i=2;var j=(i+1)%3;var k=(i+2)%3;fRoot=Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k]+1);out[i]=.5*fRoot;fRoot=.5/fRoot;out[3]=(m[j*3+k]-m[k*3+j])*fRoot;out[j]=(m[j*3+i]+m[i*3+j])*fRoot;out[k]=(m[k*3+i]+m[i*3+k])*fRoot}return out}function fromEuler(out,x,y,z){var order=arguments.length>4&&arguments[4]!==undefined?arguments[4]:ANGLE_ORDER;var halfToRad=Math.PI/360;x*=halfToRad;z*=halfToRad;y*=halfToRad;var sx=Math.sin(x);var cx= +Math.cos(x);var sy=Math.sin(y);var cy=Math.cos(y);var sz=Math.sin(z);var cz=Math.cos(z);switch(order){case "xyz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "xzy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yxz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yzx":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy* +cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zxy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zyx":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;default:throw new Error("Unknown angle order "+order);}return out}function str$2(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}var clone$2=clone$3;var fromValues$2=fromValues$3;var copy$2=copy$3; +var set$2=set$3;var add$2=add$3;var mul$2=multiply$2;var scale$2=scale$3;var dot$2=dot$3;var lerp$2=lerp$3;var length$2=length$3;var len$2=length$2;var squaredLength$2=squaredLength$3;var sqrLen$2=squaredLength$2;var normalize$2=normalize$3;var exactEquals$2=exactEquals$3;function equals$2(a,b){return Math.abs(dot$3(a,b))>=1-EPSILON}var rotationTo=function(){var tmpvec3=create$4();var xUnitVec3=fromValues$4(1,0,0);var yUnitVec3=fromValues$4(0,1,0);return function(out,a,b){var dot=dot$4(a,b);if(dot< +-.999999){cross$2(tmpvec3,xUnitVec3,a);if(len$4(tmpvec3)<1E-6)cross$2(tmpvec3,yUnitVec3,a);normalize$4(tmpvec3,tmpvec3);setAxisAngle(out,tmpvec3,Math.PI);return out}else if(dot>.999999){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out}else{cross$2(tmpvec3,a,b);out[0]=tmpvec3[0];out[1]=tmpvec3[1];out[2]=tmpvec3[2];out[3]=1+dot;return normalize$2(out,out)}}}();var sqlerp=function(){var temp1=create$2();var temp2=create$2();return function(out,a,b,c,d,t){slerp(temp1,a,d,t);slerp(temp2,b,c,t);slerp(out, +temp1,temp2,2*t*(1-t));return out}}();var setAxes=function(){var matr=create$6();return function(out,view,right,up){matr[0]=right[0];matr[3]=right[1];matr[6]=right[2];matr[1]=up[0];matr[4]=up[1];matr[7]=up[2];matr[2]=-view[0];matr[5]=-view[1];matr[8]=-view[2];return normalize$2(out,fromMat3(out,matr))}}();var quat=Object.freeze({__proto__:null,create:create$2,identity:identity$1,setAxisAngle:setAxisAngle,getAxisAngle:getAxisAngle,getAngle:getAngle,multiply:multiply$2,rotateX:rotateX$1,rotateY:rotateY$1, +rotateZ:rotateZ$1,calculateW:calculateW,exp:exp,ln:ln,pow:pow,slerp:slerp,random:random$1,invert:invert$1,conjugate:conjugate$1,fromMat3:fromMat3,fromEuler:fromEuler,str:str$2,clone:clone$2,fromValues:fromValues$2,copy:copy$2,set:set$2,add:add$2,mul:mul$2,scale:scale$2,dot:dot$2,lerp:lerp$2,length:length$2,len:len$2,squaredLength:squaredLength$2,sqrLen:sqrLen$2,normalize:normalize$2,exactEquals:exactEquals$2,equals:equals$2,rotationTo:rotationTo,sqlerp:sqlerp,setAxes:setAxes});function create$1(){var dq= +new ARRAY_TYPE(8);if(ARRAY_TYPE!=Float32Array){dq[0]=0;dq[1]=0;dq[2]=0;dq[4]=0;dq[5]=0;dq[6]=0;dq[7]=0}dq[3]=1;return dq}function clone$1(a){var dq=new ARRAY_TYPE(8);dq[0]=a[0];dq[1]=a[1];dq[2]=a[2];dq[3]=a[3];dq[4]=a[4];dq[5]=a[5];dq[6]=a[6];dq[7]=a[7];return dq}function fromValues$1(x1,y1,z1,w1,x2,y2,z2,w2){var dq=new ARRAY_TYPE(8);dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;dq[4]=x2;dq[5]=y2;dq[6]=z2;dq[7]=w2;return dq}function fromRotationTranslationValues(x1,y1,z1,w1,x2,y2,z2){var dq=new ARRAY_TYPE(8); +dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;var ax=x2*.5,ay=y2*.5,az=z2*.5;dq[4]=ax*w1+ay*z1-az*y1;dq[5]=ay*w1+az*x1-ax*z1;dq[6]=az*w1+ax*y1-ay*x1;dq[7]=-ax*x1-ay*y1-az*z1;return dq}function fromRotationTranslation(out,q,t){var ax=t[0]*.5,ay=t[1]*.5,az=t[2]*.5,bx=q[0],by=q[1],bz=q[2],bw=q[3];out[0]=bx;out[1]=by;out[2]=bz;out[3]=bw;out[4]=ax*bw+ay*bz-az*by;out[5]=ay*bw+az*bx-ax*bz;out[6]=az*bw+ax*by-ay*bx;out[7]=-ax*bx-ay*by-az*bz;return out}function fromTranslation(out,t){out[0]=0;out[1]=0;out[2]=0;out[3]= +1;out[4]=t[0]*.5;out[5]=t[1]*.5;out[6]=t[2]*.5;out[7]=0;return out}function fromRotation(out,q){out[0]=q[0];out[1]=q[1];out[2]=q[2];out[3]=q[3];out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function fromMat4(out,a){var outer=create$2();getRotation(outer,a);var t=new ARRAY_TYPE(3);getTranslation$1(t,a);fromRotationTranslation(out,outer,t);return out}function copy$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];return out}function identity(out){out[0]= +0;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function set$1(out,x1,y1,z1,w1,x2,y2,z2,w2){out[0]=x1;out[1]=y1;out[2]=z1;out[3]=w1;out[4]=x2;out[5]=y2;out[6]=z2;out[7]=w2;return out}var getReal=copy$2;function getDual(out,a){out[0]=a[4];out[1]=a[5];out[2]=a[6];out[3]=a[7];return out}var setReal=copy$2;function setDual(out,q){out[4]=q[0];out[5]=q[1];out[6]=q[2];out[7]=q[3];return out}function getTranslation(out,a){var ax=a[4],ay=a[5],az=a[6],aw=a[7],bx=-a[0],by=-a[1],bz= +-a[2],bw=a[3];out[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;out[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;out[2]=(az*bw+aw*bz+ax*by-ay*bx)*2;return out}function translate(out,a,v){var ax1=a[0],ay1=a[1],az1=a[2],aw1=a[3],bx1=v[0]*.5,by1=v[1]*.5,bz1=v[2]*.5,ax2=a[4],ay2=a[5],az2=a[6],aw2=a[7];out[0]=ax1;out[1]=ay1;out[2]=az1;out[3]=aw1;out[4]=aw1*bx1+ay1*bz1-az1*by1+ax2;out[5]=aw1*by1+az1*bx1-ax1*bz1+ay2;out[6]=aw1*bz1+ax1*by1-ay1*bx1+az2;out[7]=-ax1*bx1-ay1*by1-az1*bz1+aw2;return out}function rotateX(out,a,rad){var bx= +-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateX$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateY(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ +ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateY$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateZ(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw- +ax*bx-ay*by-az*bz;rotateZ$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateByQuatAppend(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],ax=a[0],ay=a[1],az=a[2],aw=a[3];out[0]=ax*qw+aw*qx+ay*qz-az*qy;out[1]=ay*qw+aw*qy+az*qx-ax*qz;out[2]=az*qw+aw*qz+ax*qy-ay*qx;out[3]=aw*qw-ax*qx-ay*qy-az*qz;ax=a[4];ay=a[5];az=a[6];aw=a[7];out[4]=ax* +qw+aw*qx+ay*qz-az*qy;out[5]=ay*qw+aw*qy+az*qx-ax*qz;out[6]=az*qw+aw*qz+ax*qy-ay*qx;out[7]=aw*qw-ax*qx-ay*qy-az*qz;return out}function rotateByQuatPrepend(out,q,a){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],bx=a[0],by=a[1],bz=a[2],bw=a[3];out[0]=qx*bw+qw*bx+qy*bz-qz*by;out[1]=qy*bw+qw*by+qz*bx-qx*bz;out[2]=qz*bw+qw*bz+qx*by-qy*bx;out[3]=qw*bw-qx*bx-qy*by-qz*bz;bx=a[4];by=a[5];bz=a[6];bw=a[7];out[4]=qx*bw+qw*bx+qy*bz-qz*by;out[5]=qy*bw+qw*by+qz*bx-qx*bz;out[6]=qz*bw+qw*bz+qx*by-qy*bx;out[7]=qw*bw-qx*bx-qy* +by-qz*bz;return out}function rotateAroundAxis(out,a,axis,rad){if(Math.abs(rad)0){magnitude=Math.sqrt(magnitude);var a0=a[0]/magnitude;var a1=a[1]/magnitude;var a2=a[2]/magnitude;var a3= +a[3]/magnitude;var b0=a[4];var b1=a[5];var b2=a[6];var b3=a[7];var a_dot_b=a0*b0+a1*b1+a2*b2+a3*b3;out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=(b0-a0*a_dot_b)/magnitude;out[5]=(b1-a1*a_dot_b)/magnitude;out[6]=(b2-a2*a_dot_b)/magnitude;out[7]=(b3-a3*a_dot_b)/magnitude}return out}function str$1(a){return"quat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+")"}function exactEquals$1(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]=== +b[5]&&a[6]===b[6]&&a[7]===b[7]}function equals$1(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4), +Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))}var quat2=Object.freeze({__proto__:null,create:create$1,clone:clone$1,fromValues:fromValues$1,fromRotationTranslationValues:fromRotationTranslationValues,fromRotationTranslation:fromRotationTranslation,fromTranslation:fromTranslation,fromRotation:fromRotation,fromMat4:fromMat4,copy:copy$1,identity:identity, +set:set$1,getReal:getReal,getDual:getDual,setReal:setReal,setDual:setDual,getTranslation:getTranslation,translate:translate,rotateX:rotateX,rotateY:rotateY,rotateZ:rotateZ,rotateByQuatAppend:rotateByQuatAppend,rotateByQuatPrepend:rotateByQuatPrepend,rotateAroundAxis:rotateAroundAxis,add:add$1,multiply:multiply$1,mul:mul$1,scale:scale$1,dot:dot$1,lerp:lerp$1,invert:invert,conjugate:conjugate,length:length$1,len:len$1,squaredLength:squaredLength$1,sqrLen:sqrLen$1,normalize:normalize$1,str:str$1,exactEquals:exactEquals$1, +equals:equals$1});function create(){var out=new ARRAY_TYPE(2);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0}return out}function clone(a){var out=new ARRAY_TYPE(2);out[0]=a[0];out[1]=a[1];return out}function fromValues(x,y){var out=new ARRAY_TYPE(2);out[0]=x;out[1]=y;return out}function copy(out,a){out[0]=a[0];out[1]=a[1];return out}function set(out,x,y){out[0]=x;out[1]=y;return out}function add(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];return out}function subtract(out,a,b){out[0]=a[0]-b[0];out[1]= +a[1]-b[1];return out}function multiply(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];return out}function divide(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];return out}function ceil(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);return out}function floor(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);return out}function min(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);return out}function max(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);return out}function round(out, +a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);return out}function scale(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;return out}function scaleAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;return out}function distance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.hypot(x,y)}function squaredDistance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y}function length(a){var x=a[0],y=a[1];return Math.hypot(x,y)}function squaredLength(a){var x=a[0],y=a[1];return x*x+y*y}function negate(out, +a){out[0]=-a[0];out[1]=-a[1];return out}function inverse(out,a){out[0]=1/a[0];out[1]=1/a[1];return out}function normalize(out,a){var x=a[0],y=a[1];var len=x*x+y*y;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;return out}function dot(a,b){return a[0]*b[0]+a[1]*b[1]}function cross(out,a,b){var z=a[0]*b[1]-a[1]*b[0];out[0]=out[1]=0;out[2]=z;return out}function lerp(out,a,b,t){var ax=a[0],ay=a[1];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);return out}function random(out,scale){scale=scale|| +1;var r=RANDOM()*2*Math.PI;out[0]=Math.cos(r)*scale;out[1]=Math.sin(r)*scale;return out}function transformMat2(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y;out[1]=m[1]*x+m[3]*y;return out}function transformMat2d(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y+m[4];out[1]=m[1]*x+m[3]*y+m[5];return out}function transformMat3(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[3]*y+m[6];out[1]=m[1]*x+m[4]*y+m[7];return out}function transformMat4(out,a,m){var x=a[0];var y=a[1];out[0]=m[0]*x+m[4]*y+m[12];out[1]= +m[1]*x+m[5]*y+m[13];return out}function rotate(out,a,b,rad){var p0=a[0]-b[0],p1=a[1]-b[1],sinC=Math.sin(rad),cosC=Math.cos(rad);out[0]=p0*cosC-p1*sinC+b[0];out[1]=p0*sinC+p1*cosC+b[1];return out}function angle(a,b){var x1=a[0],y1=a[1],x2=b[0],y2=b[1],mag=Math.sqrt((x1*x1+y1*y1)*(x2*x2+y2*y2)),cosine=mag&&(x1*x2+y1*y2)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero(out){out[0]=0;out[1]=0;return out}function str(a){return"vec2("+a[0]+", "+a[1]+")"}function exactEquals(a,b){return a[0]=== +b[0]&&a[1]===b[1]}function equals(a,b){var a0=a[0],a1=a[1];var b0=b[0],b1=b[1];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))}var len=length;var sub=subtract;var mul=multiply;var div=divide;var dist=distance;var sqrDist=squaredDistance;var sqrLen=squaredLength;var forEach=function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=2;if(!offset)offset=0;if(count)l=Math.min(count* +stride+offset,a.length);else l=a.length;for(i=offset;i=b&&c=a?1024*(d-55296)+(a-56320)+65536:d}return 56320<=b&&57343>=b&&1<=c?(d=a.charCodeAt(c-1),a=b,55296<=d&&56319>=d?1024*(d-55296)+(a-56320)+65536:a):b}function l(a,c,b){var d=[a].concat(c).concat([b]),e=d[d.length-2],g=d.lastIndexOf(14);if(1=a||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&70083>=a||72250==a||72326<=a&&72329>=a||73030==a?12:13==a?0:10==a?1:0<=a&&9>=a||11<=a&&12>=a||14<=a&&31>=a||127<=a&&159>=a||173==a||1564==a||6158==a||8203==a||8206<=a&&8207>=a||8232==a||8233==a||8234<=a&&8238>=a||8288<=a&&8292>=a||8293==a||8294<=a&&8303>=a||55296<=a&&57343>=a||65279==a||65520<= +a&&65528>=a||65529<=a&&65531>=a||113824<=a&&113827>=a||119155<=a&&119162>=a||917504==a||917505==a||917506<=a&&917535>=a||917632<=a&&917759>=a||918E3<=a&&921599>=a?2:768<=a&&879>=a||1155<=a&&1159>=a||1160<=a&&1161>=a||1425<=a&&1469>=a||1471==a||1473<=a&&1474>=a||1476<=a&&1477>=a||1479==a||1552<=a&&1562>=a||1611<=a&&1631>=a||1648==a||1750<=a&&1756>=a||1759<=a&&1764>=a||1767<=a&&1768>=a||1770<=a&&1773>=a||1809==a||1840<=a&&1866>=a||1958<=a&&1968>=a||2027<=a&&2035>=a||2070<=a&&2073>=a||2075<=a&&2083>= +a||2085<=a&&2087>=a||2089<=a&&2093>=a||2137<=a&&2139>=a||2260<=a&&2273>=a||2275<=a&&2306>=a||2362==a||2364==a||2369<=a&&2376>=a||2381==a||2385<=a&&2391>=a||2402<=a&&2403>=a||2433==a||2492==a||2494==a||2497<=a&&2500>=a||2509==a||2519==a||2530<=a&&2531>=a||2561<=a&&2562>=a||2620==a||2625<=a&&2626>=a||2631<=a&&2632>=a||2635<=a&&2637>=a||2641==a||2672<=a&&2673>=a||2677==a||2689<=a&&2690>=a||2748==a||2753<=a&&2757>=a||2759<=a&&2760>=a||2765==a||2786<=a&&2787>=a||2810<=a&&2815>=a||2817==a||2876==a||2878== +a||2879==a||2881<=a&&2884>=a||2893==a||2902==a||2903==a||2914<=a&&2915>=a||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&3136>=a||3142<=a&&3144>=a||3146<=a&&3149>=a||3157<=a&&3158>=a||3170<=a&&3171>=a||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&3277>=a||3285<=a&&3286>=a||3298<=a&&3299>=a||3328<=a&&3329>=a||3387<=a&&3388>=a||3390==a||3393<=a&&3396>=a||3405==a||3415==a||3426<=a&&3427>=a||3530==a||3535==a||3538<=a&&3540>=a||3542==a||3551==a||3633==a||3636<=a&&3642>=a||3655<= +a&&3662>=a||3761==a||3764<=a&&3769>=a||3771<=a&&3772>=a||3784<=a&&3789>=a||3864<=a&&3865>=a||3893==a||3895==a||3897==a||3953<=a&&3966>=a||3968<=a&&3972>=a||3974<=a&&3975>=a||3981<=a&&3991>=a||3993<=a&&4028>=a||4038==a||4141<=a&&4144>=a||4146<=a&&4151>=a||4153<=a&&4154>=a||4157<=a&&4158>=a||4184<=a&&4185>=a||4190<=a&&4192>=a||4209<=a&&4212>=a||4226==a||4229<=a&&4230>=a||4237==a||4253==a||4957<=a&&4959>=a||5906<=a&&5908>=a||5938<=a&&5940>=a||5970<=a&&5971>=a||6002<=a&&6003>=a||6068<=a&&6069>=a||6071<= +a&&6077>=a||6086==a||6089<=a&&6099>=a||6109==a||6155<=a&&6157>=a||6277<=a&&6278>=a||6313==a||6432<=a&&6434>=a||6439<=a&&6440>=a||6450==a||6457<=a&&6459>=a||6679<=a&&6680>=a||6683==a||6742==a||6744<=a&&6750>=a||6752==a||6754==a||6757<=a&&6764>=a||6771<=a&&6780>=a||6783==a||6832<=a&&6845>=a||6846==a||6912<=a&&6915>=a||6964==a||6966<=a&&6970>=a||6972==a||6978==a||7019<=a&&7027>=a||7040<=a&&7041>=a||7074<=a&&7077>=a||7080<=a&&7081>=a||7083<=a&&7085>=a||7142==a||7144<=a&&7145>=a||7149==a||7151<=a&&7153>= +a||7212<=a&&7219>=a||7222<=a&&7223>=a||7376<=a&&7378>=a||7380<=a&&7392>=a||7394<=a&&7400>=a||7405==a||7412==a||7416<=a&&7417>=a||7616<=a&&7673>=a||7675<=a&&7679>=a||8204==a||8400<=a&&8412>=a||8413<=a&&8416>=a||8417==a||8418<=a&&8420>=a||8421<=a&&8432>=a||11503<=a&&11505>=a||11647==a||11744<=a&&11775>=a||12330<=a&&12333>=a||12334<=a&&12335>=a||12441<=a&&12442>=a||42607==a||42608<=a&&42610>=a||42612<=a&&42621>=a||42654<=a&&42655>=a||42736<=a&&42737>=a||43010==a||43014==a||43019==a||43045<=a&&43046>= +a||43204<=a&&43205>=a||43232<=a&&43249>=a||43302<=a&&43309>=a||43335<=a&&43345>=a||43392<=a&&43394>=a||43443==a||43446<=a&&43449>=a||43452==a||43493==a||43561<=a&&43566>=a||43569<=a&&43570>=a||43573<=a&&43574>=a||43587==a||43596==a||43644==a||43696==a||43698<=a&&43700>=a||43703<=a&&43704>=a||43710<=a&&43711>=a||43713==a||43756<=a&&43757>=a||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&65039>=a||65056<=a&&65071>=a||65438<=a&&65439>=a||66045==a||66272==a||66422<=a&&66426>=a||68097<=a&& +68099>=a||68101<=a&&68102>=a||68108<=a&&68111>=a||68152<=a&&68154>=a||68159==a||68325<=a&&68326>=a||69633==a||69688<=a&&69702>=a||69759<=a&&69761>=a||69811<=a&&69814>=a||69817<=a&&69818>=a||69888<=a&&69890>=a||69927<=a&&69931>=a||69933<=a&&69940>=a||70003==a||70016<=a&&70017>=a||70070<=a&&70078>=a||70090<=a&&70092>=a||70191<=a&&70193>=a||70196==a||70198<=a&&70199>=a||70206==a||70367==a||70371<=a&&70378>=a||70400<=a&&70401>=a||70460==a||70462==a||70464==a||70487==a||70502<=a&&70508>=a||70512<=a&&70516>= +a||70712<=a&&70719>=a||70722<=a&&70724>=a||70726==a||70832==a||70835<=a&&70840>=a||70842==a||70845==a||70847<=a&&70848>=a||70850<=a&&70851>=a||71087==a||71090<=a&&71093>=a||71100<=a&&71101>=a||71103<=a&&71104>=a||71132<=a&&71133>=a||71219<=a&&71226>=a||71229==a||71231<=a&&71232>=a||71339==a||71341==a||71344<=a&&71349>=a||71351==a||71453<=a&&71455>=a||71458<=a&&71461>=a||71463<=a&&71467>=a||72193<=a&&72198>=a||72201<=a&&72202>=a||72243<=a&&72248>=a||72251<=a&&72254>=a||72263==a||72273<=a&&72278>=a|| +72281<=a&&72283>=a||72330<=a&&72342>=a||72344<=a&&72345>=a||72752<=a&&72758>=a||72760<=a&&72765>=a||72767==a||72850<=a&&72871>=a||72874<=a&&72880>=a||72882<=a&&72883>=a||72885<=a&&72886>=a||73009<=a&&73014>=a||73018==a||73020<=a&&73021>=a||73023<=a&&73029>=a||73031==a||92912<=a&&92916>=a||92976<=a&&92982>=a||94095<=a&&94098>=a||113821<=a&&113822>=a||119141==a||119143<=a&&119145>=a||119150<=a&&119154>=a||119163<=a&&119170>=a||119173<=a&&119179>=a||119210<=a&&119213>=a||119362<=a&&119364>=a||121344<= +a&&121398>=a||121403<=a&&121452>=a||121461==a||121476==a||121499<=a&&121503>=a||121505<=a&&121519>=a||122880<=a&&122886>=a||122888<=a&&122904>=a||122907<=a&&122913>=a||122915<=a&&122916>=a||122918<=a&&122922>=a||125136<=a&&125142>=a||125252<=a&&125258>=a||917536<=a&&917631>=a||917760<=a&&917999>=a?3:127462<=a&&127487>=a?4:2307==a||2363==a||2366<=a&&2368>=a||2377<=a&&2380>=a||2382<=a&&2383>=a||2434<=a&&2435>=a||2495<=a&&2496>=a||2503<=a&&2504>=a||2507<=a&&2508>=a||2563==a||2622<=a&&2624>=a||2691== +a||2750<=a&&2752>=a||2761==a||2763<=a&&2764>=a||2818<=a&&2819>=a||2880==a||2887<=a&&2888>=a||2891<=a&&2892>=a||3007==a||3009<=a&&3010>=a||3014<=a&&3016>=a||3018<=a&&3020>=a||3073<=a&&3075>=a||3137<=a&&3140>=a||3202<=a&&3203>=a||3262==a||3264<=a&&3265>=a||3267<=a&&3268>=a||3271<=a&&3272>=a||3274<=a&&3275>=a||3330<=a&&3331>=a||3391<=a&&3392>=a||3398<=a&&3400>=a||3402<=a&&3404>=a||3458<=a&&3459>=a||3536<=a&&3537>=a||3544<=a&&3550>=a||3570<=a&&3571>=a||3635==a||3763==a||3902<=a&&3903>=a||3967==a||4145== +a||4155<=a&&4156>=a||4182<=a&&4183>=a||4228==a||6070==a||6078<=a&&6085>=a||6087<=a&&6088>=a||6435<=a&&6438>=a||6441<=a&&6443>=a||6448<=a&&6449>=a||6451<=a&&6456>=a||6681<=a&&6682>=a||6741==a||6743==a||6765<=a&&6770>=a||6916==a||6965==a||6971==a||6973<=a&&6977>=a||6979<=a&&6980>=a||7042==a||7073==a||7078<=a&&7079>=a||7082==a||7143==a||7146<=a&&7148>=a||7150==a||7154<=a&&7155>=a||7204<=a&&7211>=a||7220<=a&&7221>=a||7393==a||7410<=a&&7411>=a||7415==a||43043<=a&&43044>=a||43047==a||43136<=a&&43137>=a|| +43188<=a&&43203>=a||43346<=a&&43347>=a||43395==a||43444<=a&&43445>=a||43450<=a&&43451>=a||43453<=a&&43456>=a||43567<=a&&43568>=a||43571<=a&&43572>=a||43597==a||43755==a||43758<=a&&43759>=a||43765==a||44003<=a&&44004>=a||44006<=a&&44007>=a||44009<=a&&44010>=a||44012==a||69632==a||69634==a||69762==a||69808<=a&&69810>=a||69815<=a&&69816>=a||69932==a||70018==a||70067<=a&&70069>=a||70079<=a&&70080>=a||70188<=a&&70190>=a||70194<=a&&70195>=a||70197==a||70368<=a&&70370>=a||70402<=a&&70403>=a||70463==a||70465<= +a&&70468>=a||70471<=a&&70472>=a||70475<=a&&70477>=a||70498<=a&&70499>=a||70709<=a&&70711>=a||70720<=a&&70721>=a||70725==a||70833<=a&&70834>=a||70841==a||70843<=a&&70844>=a||70846==a||70849==a||71088<=a&&71089>=a||71096<=a&&71099>=a||71102==a||71216<=a&&71218>=a||71227<=a&&71228>=a||71230==a||71340==a||71342<=a&&71343>=a||71350==a||71456<=a&&71457>=a||71462==a||72199<=a&&72200>=a||72249==a||72279<=a&&72280>=a||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&94078>=a||119142== +a||119149==a?5:4352<=a&&4447>=a||43360<=a&&43388>=a?6:4448<=a&&4519>=a||55216<=a&&55238>=a?7:4520<=a&&4607>=a||55243<=a&&55291>=a?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a|| +45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468== +a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47E3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a|| +47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296== +a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a|| +50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124== +a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a|| +53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54E3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952== +a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&44059>=a||44061<=a&&44087>=a||44089<=a&&44115>=a||44117<=a&&44143>=a||44145<=a&&44171>=a||44173<=a&&44199>=a||44201<=a&&44227>=a||44229<=a&&44255>=a||44257<=a&&44283>=a||44285<=a&&44311>=a||44313<=a&&44339>=a||44341<=a&&44367>=a||44369<=a&&44395>=a||44397<=a&&44423>=a||44425<=a&&44451>=a||44453<=a&&44479>=a||44481<=a&&44507>=a||44509<=a&&44535>=a||44537<=a&&44563>=a||44565<=a&&44591>=a||44593<=a&&44619>= +a||44621<=a&&44647>=a||44649<=a&&44675>=a||44677<=a&&44703>=a||44705<=a&&44731>=a||44733<=a&&44759>=a||44761<=a&&44787>=a||44789<=a&&44815>=a||44817<=a&&44843>=a||44845<=a&&44871>=a||44873<=a&&44899>=a||44901<=a&&44927>=a||44929<=a&&44955>=a||44957<=a&&44983>=a||44985<=a&&45011>=a||45013<=a&&45039>=a||45041<=a&&45067>=a||45069<=a&&45095>=a||45097<=a&&45123>=a||45125<=a&&45151>=a||45153<=a&&45179>=a||45181<=a&&45207>=a||45209<=a&&45235>=a||45237<=a&&45263>=a||45265<=a&&45291>=a||45293<=a&&45319>=a|| +45321<=a&&45347>=a||45349<=a&&45375>=a||45377<=a&&45403>=a||45405<=a&&45431>=a||45433<=a&&45459>=a||45461<=a&&45487>=a||45489<=a&&45515>=a||45517<=a&&45543>=a||45545<=a&&45571>=a||45573<=a&&45599>=a||45601<=a&&45627>=a||45629<=a&&45655>=a||45657<=a&&45683>=a||45685<=a&&45711>=a||45713<=a&&45739>=a||45741<=a&&45767>=a||45769<=a&&45795>=a||45797<=a&&45823>=a||45825<=a&&45851>=a||45853<=a&&45879>=a||45881<=a&&45907>=a||45909<=a&&45935>=a||45937<=a&&45963>=a||45965<=a&&45991>=a||45993<=a&&46019>=a||46021<= +a&&46047>=a||46049<=a&&46075>=a||46077<=a&&46103>=a||46105<=a&&46131>=a||46133<=a&&46159>=a||46161<=a&&46187>=a||46189<=a&&46215>=a||46217<=a&&46243>=a||46245<=a&&46271>=a||46273<=a&&46299>=a||46301<=a&&46327>=a||46329<=a&&46355>=a||46357<=a&&46383>=a||46385<=a&&46411>=a||46413<=a&&46439>=a||46441<=a&&46467>=a||46469<=a&&46495>=a||46497<=a&&46523>=a||46525<=a&&46551>=a||46553<=a&&46579>=a||46581<=a&&46607>=a||46609<=a&&46635>=a||46637<=a&&46663>=a||46665<=a&&46691>=a||46693<=a&&46719>=a||46721<=a&& +46747>=a||46749<=a&&46775>=a||46777<=a&&46803>=a||46805<=a&&46831>=a||46833<=a&&46859>=a||46861<=a&&46887>=a||46889<=a&&46915>=a||46917<=a&&46943>=a||46945<=a&&46971>=a||46973<=a&&46999>=a||47001<=a&&47027>=a||47029<=a&&47055>=a||47057<=a&&47083>=a||47085<=a&&47111>=a||47113<=a&&47139>=a||47141<=a&&47167>=a||47169<=a&&47195>=a||47197<=a&&47223>=a||47225<=a&&47251>=a||47253<=a&&47279>=a||47281<=a&&47307>=a||47309<=a&&47335>=a||47337<=a&&47363>=a||47365<=a&&47391>=a||47393<=a&&47419>=a||47421<=a&&47447>= +a||47449<=a&&47475>=a||47477<=a&&47503>=a||47505<=a&&47531>=a||47533<=a&&47559>=a||47561<=a&&47587>=a||47589<=a&&47615>=a||47617<=a&&47643>=a||47645<=a&&47671>=a||47673<=a&&47699>=a||47701<=a&&47727>=a||47729<=a&&47755>=a||47757<=a&&47783>=a||47785<=a&&47811>=a||47813<=a&&47839>=a||47841<=a&&47867>=a||47869<=a&&47895>=a||47897<=a&&47923>=a||47925<=a&&47951>=a||47953<=a&&47979>=a||47981<=a&&48007>=a||48009<=a&&48035>=a||48037<=a&&48063>=a||48065<=a&&48091>=a||48093<=a&&48119>=a||48121<=a&&48147>=a|| +48149<=a&&48175>=a||48177<=a&&48203>=a||48205<=a&&48231>=a||48233<=a&&48259>=a||48261<=a&&48287>=a||48289<=a&&48315>=a||48317<=a&&48343>=a||48345<=a&&48371>=a||48373<=a&&48399>=a||48401<=a&&48427>=a||48429<=a&&48455>=a||48457<=a&&48483>=a||48485<=a&&48511>=a||48513<=a&&48539>=a||48541<=a&&48567>=a||48569<=a&&48595>=a||48597<=a&&48623>=a||48625<=a&&48651>=a||48653<=a&&48679>=a||48681<=a&&48707>=a||48709<=a&&48735>=a||48737<=a&&48763>=a||48765<=a&&48791>=a||48793<=a&&48819>=a||48821<=a&&48847>=a||48849<= +a&&48875>=a||48877<=a&&48903>=a||48905<=a&&48931>=a||48933<=a&&48959>=a||48961<=a&&48987>=a||48989<=a&&49015>=a||49017<=a&&49043>=a||49045<=a&&49071>=a||49073<=a&&49099>=a||49101<=a&&49127>=a||49129<=a&&49155>=a||49157<=a&&49183>=a||49185<=a&&49211>=a||49213<=a&&49239>=a||49241<=a&&49267>=a||49269<=a&&49295>=a||49297<=a&&49323>=a||49325<=a&&49351>=a||49353<=a&&49379>=a||49381<=a&&49407>=a||49409<=a&&49435>=a||49437<=a&&49463>=a||49465<=a&&49491>=a||49493<=a&&49519>=a||49521<=a&&49547>=a||49549<=a&& +49575>=a||49577<=a&&49603>=a||49605<=a&&49631>=a||49633<=a&&49659>=a||49661<=a&&49687>=a||49689<=a&&49715>=a||49717<=a&&49743>=a||49745<=a&&49771>=a||49773<=a&&49799>=a||49801<=a&&49827>=a||49829<=a&&49855>=a||49857<=a&&49883>=a||49885<=a&&49911>=a||49913<=a&&49939>=a||49941<=a&&49967>=a||49969<=a&&49995>=a||49997<=a&&50023>=a||50025<=a&&50051>=a||50053<=a&&50079>=a||50081<=a&&50107>=a||50109<=a&&50135>=a||50137<=a&&50163>=a||50165<=a&&50191>=a||50193<=a&&50219>=a||50221<=a&&50247>=a||50249<=a&&50275>= +a||50277<=a&&50303>=a||50305<=a&&50331>=a||50333<=a&&50359>=a||50361<=a&&50387>=a||50389<=a&&50415>=a||50417<=a&&50443>=a||50445<=a&&50471>=a||50473<=a&&50499>=a||50501<=a&&50527>=a||50529<=a&&50555>=a||50557<=a&&50583>=a||50585<=a&&50611>=a||50613<=a&&50639>=a||50641<=a&&50667>=a||50669<=a&&50695>=a||50697<=a&&50723>=a||50725<=a&&50751>=a||50753<=a&&50779>=a||50781<=a&&50807>=a||50809<=a&&50835>=a||50837<=a&&50863>=a||50865<=a&&50891>=a||50893<=a&&50919>=a||50921<=a&&50947>=a||50949<=a&&50975>=a|| +50977<=a&&51003>=a||51005<=a&&51031>=a||51033<=a&&51059>=a||51061<=a&&51087>=a||51089<=a&&51115>=a||51117<=a&&51143>=a||51145<=a&&51171>=a||51173<=a&&51199>=a||51201<=a&&51227>=a||51229<=a&&51255>=a||51257<=a&&51283>=a||51285<=a&&51311>=a||51313<=a&&51339>=a||51341<=a&&51367>=a||51369<=a&&51395>=a||51397<=a&&51423>=a||51425<=a&&51451>=a||51453<=a&&51479>=a||51481<=a&&51507>=a||51509<=a&&51535>=a||51537<=a&&51563>=a||51565<=a&&51591>=a||51593<=a&&51619>=a||51621<=a&&51647>=a||51649<=a&&51675>=a||51677<= +a&&51703>=a||51705<=a&&51731>=a||51733<=a&&51759>=a||51761<=a&&51787>=a||51789<=a&&51815>=a||51817<=a&&51843>=a||51845<=a&&51871>=a||51873<=a&&51899>=a||51901<=a&&51927>=a||51929<=a&&51955>=a||51957<=a&&51983>=a||51985<=a&&52011>=a||52013<=a&&52039>=a||52041<=a&&52067>=a||52069<=a&&52095>=a||52097<=a&&52123>=a||52125<=a&&52151>=a||52153<=a&&52179>=a||52181<=a&&52207>=a||52209<=a&&52235>=a||52237<=a&&52263>=a||52265<=a&&52291>=a||52293<=a&&52319>=a||52321<=a&&52347>=a||52349<=a&&52375>=a||52377<=a&& +52403>=a||52405<=a&&52431>=a||52433<=a&&52459>=a||52461<=a&&52487>=a||52489<=a&&52515>=a||52517<=a&&52543>=a||52545<=a&&52571>=a||52573<=a&&52599>=a||52601<=a&&52627>=a||52629<=a&&52655>=a||52657<=a&&52683>=a||52685<=a&&52711>=a||52713<=a&&52739>=a||52741<=a&&52767>=a||52769<=a&&52795>=a||52797<=a&&52823>=a||52825<=a&&52851>=a||52853<=a&&52879>=a||52881<=a&&52907>=a||52909<=a&&52935>=a||52937<=a&&52963>=a||52965<=a&&52991>=a||52993<=a&&53019>=a||53021<=a&&53047>=a||53049<=a&&53075>=a||53077<=a&&53103>= +a||53105<=a&&53131>=a||53133<=a&&53159>=a||53161<=a&&53187>=a||53189<=a&&53215>=a||53217<=a&&53243>=a||53245<=a&&53271>=a||53273<=a&&53299>=a||53301<=a&&53327>=a||53329<=a&&53355>=a||53357<=a&&53383>=a||53385<=a&&53411>=a||53413<=a&&53439>=a||53441<=a&&53467>=a||53469<=a&&53495>=a||53497<=a&&53523>=a||53525<=a&&53551>=a||53553<=a&&53579>=a||53581<=a&&53607>=a||53609<=a&&53635>=a||53637<=a&&53663>=a||53665<=a&&53691>=a||53693<=a&&53719>=a||53721<=a&&53747>=a||53749<=a&&53775>=a||53777<=a&&53803>=a|| +53805<=a&&53831>=a||53833<=a&&53859>=a||53861<=a&&53887>=a||53889<=a&&53915>=a||53917<=a&&53943>=a||53945<=a&&53971>=a||53973<=a&&53999>=a||54001<=a&&54027>=a||54029<=a&&54055>=a||54057<=a&&54083>=a||54085<=a&&54111>=a||54113<=a&&54139>=a||54141<=a&&54167>=a||54169<=a&&54195>=a||54197<=a&&54223>=a||54225<=a&&54251>=a||54253<=a&&54279>=a||54281<=a&&54307>=a||54309<=a&&54335>=a||54337<=a&&54363>=a||54365<=a&&54391>=a||54393<=a&&54419>=a||54421<=a&&54447>=a||54449<=a&&54475>=a||54477<=a&&54503>=a||54505<= +a&&54531>=a||54533<=a&&54559>=a||54561<=a&&54587>=a||54589<=a&&54615>=a||54617<=a&&54643>=a||54645<=a&&54671>=a||54673<=a&&54699>=a||54701<=a&&54727>=a||54729<=a&&54755>=a||54757<=a&&54783>=a||54785<=a&&54811>=a||54813<=a&&54839>=a||54841<=a&&54867>=a||54869<=a&&54895>=a||54897<=a&&54923>=a||54925<=a&&54951>=a||54953<=a&&54979>=a||54981<=a&&55007>=a||55009<=a&&55035>=a||55037<=a&&55063>=a||55065<=a&&55091>=a||55093<=a&&55119>=a||55121<=a&&55147>=a||55149<=a&&55175>=a||55177<=a&&55203>=a?10:9757== +a||9977==a||9994<=a&&9997>=a||127877==a||127938<=a&&127940>=a||127943==a||127946<=a&&127948>=a||128066<=a&&128067>=a||128070<=a&&128080>=a||128110==a||128112<=a&&128120>=a||128124==a||128129<=a&&128131>=a||128133<=a&&128135>=a||128170==a||128372<=a&&128373>=a||128378==a||128400==a||128405<=a&&128406>=a||128581<=a&&128583>=a||128587<=a&&128591>=a||128675==a||128692<=a&&128694>=a||128704==a||128716==a||129304<=a&&129308>=a||129310<=a&&129311>=a||129318==a||129328<=a&&129337>=a||129341<=a&&129342>=a|| +129489<=a&&129501>=a?13:127995<=a&&127999>=a?14:8205==a?15:9792==a||9794==a||9877<=a&&9878>=a||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&128188>=a||128295==a||128300==a||128488==a||128640==a||128658==a?16:128102<=a&&128105>=a?17:11}this.nextBreak=function(a,c){void 0===c&&(c=0);if(0>c)return 0;if(c>=a.length-1)return a.length;var b=k(h(a,c)),d=[];for(c+=1;c=e.charCodeAt(g)&&56320<=e.charCodeAt(g+1)&&57343>=e.charCodeAt(g+1))){e=k(h(a,c));if(l(b,d,e))return c;d.push(e)}}return a.length};this.splitGraphemes=function(a){for(var c=[],b=0,d;(d=this.nextBreak(a,b))=0&&s<=1&&t>=0&&t<=1}function triangleArea(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function isLeft(a,b,c){return triangleArea(a,b,c)>0}function isLeftOn(a,b,c){return triangleArea(a,b,c)>=0} +function isRight(a,b,c){return triangleArea(a,b,c)<0}function isRightOn(a,b,c){return triangleArea(a,b,c)<=0}var tmpPoint1=[],tmpPoint2=[]; +function collinear(a,b,c,thresholdAngle){if(!thresholdAngle)return triangleArea(a,b,c)===0;else{var ab=tmpPoint1,bc=tmpPoint2;ab[0]=b[0]-a[0];ab[1]=b[1]-a[1];bc[0]=c[0]-b[0];bc[1]=c[1]-b[1];var dot=ab[0]*bc[0]+ab[1]*bc[1],magA=Math.sqrt(ab[0]*ab[0]+ab[1]*ab[1]),magB=Math.sqrt(bc[0]*bc[0]+bc[1]*bc[1]),angle=Math.acos(dot/(magA*magB));return anglev[br][0])br=i;if(!isLeft(polygonAt(polygon,br-1),polygonAt(polygon,br),polygonAt(polygon,br+1))){polygonReverse(polygon);return true}else return false}function polygonReverse(polygon){var tmp=[];var N=polygon.length;for(var i=0;i!==N;i++)tmp.push(polygon.pop());for(var i=0;i!==N;i++)polygon[i]=tmp[i]} +function polygonIsReflex(polygon,i){return isRight(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1))}var tmpLine1=[],tmpLine2=[]; +function polygonCanSee(polygon,a,b){var p,dist,l1=tmpLine1,l2=tmpLine2;if(isLeftOn(polygonAt(polygon,a+1),polygonAt(polygon,a),polygonAt(polygon,b))&&isRightOn(polygonAt(polygon,a-1),polygonAt(polygon,a),polygonAt(polygon,b)))return false;dist=sqdist(polygonAt(polygon,a),polygonAt(polygon,b));for(var i=0;i!==polygon.length;++i){if((i+1)%polygon.length===a||i===a)continue;if(isLeftOn(polygonAt(polygon,a),polygonAt(polygon,b),polygonAt(polygon,i+1))&&isRightOn(polygonAt(polygon,a),polygonAt(polygon, +b),polygonAt(polygon,i))){l1[0]=polygonAt(polygon,a);l1[1]=polygonAt(polygon,b);l2[0]=polygonAt(polygon,i);l2[1]=polygonAt(polygon,i+1);p=lineInt(l1,l2);if(sqdist(polygonAt(polygon,a),p)0)return polygonSlice(polygon,edges);else return[polygon]} +function polygonSlice(polygon,cutEdges){if(cutEdges.length===0)return[polygon];if(cutEdges instanceof Array&&cutEdges.length&&cutEdges[0]instanceof Array&&cutEdges[0].length===2&&cutEdges[0][0]instanceof Array){var polys=[polygon];for(var i=0;imaxlevel){console.warn("quickDecomp: max level ("+ +maxlevel+") reached.");return result}for(var i=0;iupperIndex)upperIndex+=polygon.length; +closestDist=Number.MAX_VALUE;if(upperIndex3&&i>=0;--i)if(collinear(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1),precision)){polygon.splice(i%polygon.length,1);num++}return num} +function polygonRemoveDuplicatePoints(polygon,precision){for(var i=polygon.length-1;i>=1;--i){var pi=polygon[i];for(var j=i-1;j>=0;--j)if(points_eq(pi,polygon[j],precision)){polygon.splice(i,1);continue}}}function scalar_eq(a,b,precision){precision=precision||0;return Math.abs(a-b)<=precision}function points_eq(a,b,precision){return scalar_eq(a[0],b[0],precision)&&scalar_eq(a[1],b[1],precision)} +self.polyDecomp={decomp:polygonDecomp,quickDecomp:polygonQuickDecomp,isSimple:polygonIsSimple,removeCollinearPoints:polygonRemoveCollinearPoints,removeDuplicatePoints:polygonRemoveDuplicatePoints,makeCCW:polygonMakeCCW}; + +} + +// lib/c3.js +{ +'use strict';let isReady=false;let hasAppStarted=false;let buildMode="dev";const C3=self.C3=class C3{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){isReady=true}static IsReady(){return isReady}static SetAppStarted(){hasAppStarted=true}static HasAppStarted(){return hasAppStarted}static SetBuildMode(m){buildMode=m}static GetBuildMode(){return buildMode}static IsReleaseBuild(){return buildMode==="final"}};C3.isDebug=false;C3.isDebugDefend=false; +C3.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}; + +} + +// ../lib/queryParser.js +{ +'use strict';const C3=self.C3; +C3.QueryParser=class QueryParser{constructor(queryString){this._queryString=queryString;this._parameters=new Map;this._Parse()}_Parse(){let str=this._queryString;if(str.startsWith("?")||str.startsWith("#"))str=str.substr(1);const arr=str.split("&");for(const p of arr)this._ParseParameter(p)}_ParseParameter(p){if(!p)return;if(!p.includes("=")){this._parameters.set(p,null);return}const i=p.indexOf("=");const parameterName=decodeURIComponent(p.substring(0,i));const parameterValue=decodeURIComponent(p.substring(i+ +1));this._parameters.set(parameterName,parameterValue)}LogAll(){for(const e of this._parameters)console.log("[QueryParser] Parameter '"+e[0]+"' = "+(e[1]===null?"null":"'"+e[1]+"'"))}Has(name){return this._parameters.has(name)}Get(name){const ret=this._parameters.get(name);if(typeof ret==="undefined")return null;else return ret}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(str){this._queryString=str;this._parameters.clear();this._Parse()}}; +C3.QueryString=new C3.QueryParser(location.search);C3.LocationHashString=new C3.QueryParser(location.hash);if(C3.QueryString.Has("perf"))C3.isPerformanceProfiling=true;if(C3.QueryString.Get("mode")!=="dev")C3.SetBuildMode("final"); + +} + +// ../lib/detect/detect.js +{ +'use strict';const C3=self.C3;const UNKNOWN="(unknown)";C3.Platform={OS:UNKNOWN,OSVersion:UNKNOWN,Browser:UNKNOWN,BrowserVersion:UNKNOWN,BrowserVersionNumber:NaN,BrowserEngine:UNKNOWN,Context:"browser",IsDesktop:true,IsMobile:false,IsAppleOS:false,IsIpadOS:false,GetDetailedInfo:async()=>{}};const windowsNTVerMap=new Map([[5,"2000"],[5.1,"XP"],[5.2,"XP"],[6,"Vista"],[6.1,"7"],[6.2,"8"],[6.3,"8.1"],[10,"10"]]); +function GetWindowsNTVersionName(ntVer){const num=parseFloat(ntVer);const ret=windowsNTVerMap.get(num);if(ret)return ret;if(num>=13)return"11";return"NT "+ntVer}const uaStr=navigator.userAgent;const uaData=navigator["userAgentData"]; +if(uaData&&uaData["brands"].length>0){C3.Platform.OS=uaData["platform"];C3.Platform.IsMobile=uaData["mobile"];C3.Platform.IsDesktop=!C3.Platform.IsMobile;const RECOGNIZED_BROWSERS=new Map([["Google Chrome","Chrome"],["Microsoft Edge","Edge"],["Opera","Opera"],["Opera GX","Opera GX"],["Mozilla Firefox","Firefox"],["Apple Safari","Safari"],["NW.js","NW.js"]]);const RECOGNIZED_ENGINES=new Map([["Chromium","Chromium"],["Gecko","Gecko"],["WebKit","WebKit"]]);function ReadBrandList(brands){let browser= +"";let browser_version="";let engine="";let engine_version="";for(const o of brands){const recognizedBrowser=RECOGNIZED_BROWSERS.get(o["brand"]);if(!browser&&recognizedBrowser){browser=recognizedBrowser;browser_version=o["version"]}const recognizedEngine=RECOGNIZED_ENGINES.get(o["brand"]);if(!engine&&recognizedEngine){engine=recognizedEngine;engine_version=o["version"]}}if(!browser&&engine==="Chromium"){C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=engine_version}C3.Platform.Browser=browser|| +UNKNOWN;C3.Platform.BrowserVersion=browser_version||UNKNOWN;C3.Platform.BrowserEngine=engine||UNKNOWN}ReadBrandList(uaData["brands"]);let didGetDetailedInfo=false;C3.Platform.GetDetailedInfo=async()=>{if(didGetDetailedInfo)return;try{const details=await navigator["userAgentData"]["getHighEntropyValues"](["platformVersion","fullVersionList"]);ReadBrandList(details["fullVersionList"]);if(C3.Platform.OS==="Windows")C3.Platform.OSVersion=GetWindowsNTVersionName(details["platformVersion"]);else C3.Platform.OSVersion= +details["platformVersion"];didGetDetailedInfo=true}catch(err){console.warn("Failed to get detailed user agent information: ",err)}}}else{function RunTest(regex_or_arr,handler){const arr=Array.isArray(regex_or_arr)?regex_or_arr:[regex_or_arr];for(const regex of arr){const result=regex.exec(uaStr);if(result){handler(result);break}}}RunTest(/windows\s+nt\s+([\d\.]+)/i,result=>{C3.Platform.OS="Windows";const ntVer=result[1];C3.Platform.OSVersion=GetWindowsNTVersionName(ntVer)});RunTest(/mac\s+os\s+x\s+([\d\._]+)/i, +result=>{C3.Platform.OS="macOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")});RunTest(/CrOS/,()=>{C3.Platform.OS="Chrome OS"});RunTest(/linux|openbsd|freebsd|netbsd/i,()=>{C3.Platform.OS="Linux"});RunTest(/android/i,()=>{C3.Platform.OS="Android"});RunTest(/android\s+([\d\.]+)/i,result=>{C3.Platform.OS="Android";C3.Platform.OSVersion=result[1]});if(C3.Platform.OS===UNKNOWN){RunTest(/(iphone|ipod|ipad)/i,result=>{C3.Platform.OS="iOS"});RunTest([/iphone\s+os\s+([\d\._]+)/i,/ipad[^)]*os\s+([\d\._]+)/i], +result=>{C3.Platform.OS="iOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")})}const hasChrome=/chrome\//i.test(uaStr);const hasChromium=/chromium\//i.test(uaStr);const hasEdge=/edg\//i.test(uaStr);const hasOpera=/OPR\//.test(uaStr);const hasNWjs=/nwjs/i.test(uaStr);const hasSafari=/safari\//i.test(uaStr);const hasWebKit=/webkit/i.test(uaStr);if(!hasEdge&&!hasOpera)RunTest(/chrome\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine= +"Chromium"});RunTest(/edg\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/OPR\/([\d\.]+)/,result=>{C3.Platform.Browser="Opera";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/chromium\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/nwjs\/[0-9.]+/i,result=>{C3.Platform.Browser="NW.js";C3.Platform.BrowserVersion= +result[1];C3.Platform.BrowserEngine="Chromium";C3.Platform.Context="nwjs"});RunTest(/firefox\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Gecko"});if(hasSafari&&!hasChrome&&!hasChromium&&!hasEdge&&!hasOpera&&!hasNWjs){C3.Platform.Browser="Safari";C3.Platform.BrowserEngine="WebKit";RunTest(/version\/([\d\.]+)/i,result=>{C3.Platform.BrowserVersion=result[1]});RunTest(/crios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome for iOS"; +C3.Platform.BrowserVersion=result[1]});RunTest(/fxios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox for iOS";C3.Platform.BrowserVersion=result[1]});RunTest(/edgios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge for iOS";C3.Platform.BrowserVersion=result[1]})}if(C3.Platform.BrowserEngine===UNKNOWN&&hasWebKit)C3.Platform.BrowserEngine="WebKit";if(C3.Platform.OS==="Android"&&C3.Platform.Browser==="Safari")C3.Platform.Browser="Stock";const desktopOSs=new Set(["Windows","macOS","Linux","Chrome OS"]); +const isDesktop=desktopOSs.has(C3.Platform.OS)||C3.Platform.Context==="nwjs";C3.Platform.IsDesktop=isDesktop;C3.Platform.IsMobile=!isDesktop}if(C3.Platform.Browser==="Chrome"&&C3.Platform.Context==="browser"&&/wv\)/.test(uaStr))C3.Platform.Context="webview";if(C3.Platform.Context!=="nwjs"&&typeof window!=="undefined"&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator["standalone"]))C3.Platform.Context="webapp";C3.Platform.BrowserVersionNumber=parseFloat(C3.Platform.BrowserVersion); +const looksLikeIPadOS=C3.Platform.OS==="macOS"&&navigator["maxTouchPoints"]&&navigator["maxTouchPoints"]>2;if(looksLikeIPadOS){C3.Platform.OS="iOS";C3.Platform.OSVersion=C3.Platform.BrowserVersion;C3.Platform.IsDesktop=false;C3.Platform.IsMobile=true;C3.Platform.IsIpadOS=true}C3.Platform.IsAppleOS=C3.Platform.OS==="macOS"||C3.Platform.OS==="iOS"; + +} + +// ../lib/storage/kvStorage.js +{ +'use strict';{const VERSION=2;const STORE_NAME="keyvaluepairs";const DATABASE_PROMISE_MAP=new Map;const SUPPORTS_GETALL=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAll==="function";const SUPPORTS_GETALLKEYS=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAllKeys==="function";function asyncifyRequest(request){return new Promise((res,rej)=>{request.onsuccess=()=>res(request.result);request.onerror=()=>rej(request.error)})}function asyncifyTransaction(tx){return new Promise((res, +rej)=>{tx.oncomplete=()=>res();tx.onerror=()=>rej(tx.error);tx.onabort=()=>rej(tx.error)})}function openReadOnlyTransaction(name,method){return openTransaction(name,method)}function openWriteTransaction(name,method){return openTransaction(name,method,true)}async function openTransaction(name,method,write=false,allowRetry=true){const db=await lazyOpenDatabase(name);try{const tx=db.transaction([STORE_NAME],write?"readwrite":"readonly");return method(tx)}catch(err){if(allowRetry&&err["name"]==="InvalidStateError"){DATABASE_PROMISE_MAP.delete(name); +return openTransaction(name,method,write,false)}else throw err;}}function lazyOpenDatabase(name){RequireString(name);let dbPromise=DATABASE_PROMISE_MAP.get(name);if(!(dbPromise instanceof Promise)){dbPromise=openDatabase(name);DATABASE_PROMISE_MAP.set(name,dbPromise);dbPromise.catch(err=>DATABASE_PROMISE_MAP.delete(name))}return dbPromise}async function openDatabase(name){RequireString(name);const openRequest=indexedDB.open(name,VERSION);openRequest.addEventListener("upgradeneeded",e=>{try{const db= +e.target.result;db.createObjectStore(STORE_NAME)}catch(err){console.error(`Failed to create objectstore for database ${name}`,err)}});return asyncifyRequest(openRequest)}function RequireString(x){if(typeof x!=="string")throw new TypeError("expected string");}function getEntriesFromCursor(tx,type){const request=tx.objectStore(STORE_NAME).openCursor();return new Promise(resolve=>{const results=[];request.onsuccess=event=>{const cursor=event.target.result;if(cursor){switch(type){case "entries":results.push([cursor.key, +cursor.value]);break;case "keys":results.push(cursor.key);break;case "values":results.push(cursor.value);break}cursor.continue()}else resolve(results)}})}class KVStorageContainer{constructor(name){RequireString(name);this.name=name}async ready(){await lazyOpenDatabase(this.name)}set(key,value){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).put(value,key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx); +await Promise.all([txPromise,requestPromise])})}get(key){RequireString(key);return openReadOnlyTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).get(key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}delete(key){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).delete(key);const requestPromise=asyncifyRequest(request); +const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}clear(){return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).clear();const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}keys(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALLKEYS){const request=tx.objectStore(STORE_NAME).getAllKeys();requestPromise=asyncifyRequest(request)}else requestPromise= +getEntriesFromCursor(tx,"keys");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}values(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALL){const request=tx.objectStore(STORE_NAME).getAll();requestPromise=asyncifyRequest(request)}else requestPromise=getEntriesFromCursor(tx,"values");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}entries(){return openReadOnlyTransaction(this.name, +async tx=>{const requestPromise=getEntriesFromCursor(tx,"entries");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}}self.KVStorageContainer=KVStorageContainer}; + +} + +// ../lib/storage/localForageAdaptor.js +{ +'use strict';{const KVStorageContainer=self.KVStorageContainer;const CRITICAL_ERRORS=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i];const memoryStorage=new WeakMap;let isInMemory=false;if(typeof indexedDB==="undefined"){isInMemory=true; +console.warn("Unable to use local storage because indexedDB is not defined")}function NOT_IMPLEMENTED(name){throw new Error(`"${name}" is not implemented`);}function DISALLOW_CALLBACK(fn){if(typeof fn==="function")throw new Error(`localforage callback API is not implemented; please use the promise API instead`);}function StructuredClone(value){if(typeof value==="object")return new Promise(resolve=>{const {port1,port2}=new MessageChannel;port2.onmessage=ev=>resolve(ev.data);port1.postMessage(value)}); +else return Promise.resolve(value)}class ForageAdaptor{constructor(inst){this._inst=inst;memoryStorage.set(this,new Map)}_MaybeSwitchToMemoryFallback(err){if(isInMemory)return;for(const regex of CRITICAL_ERRORS)if(err&®ex.test(err.message)){console.error("Unable to use local storage, reverting to in-memory store: ",err,err.message);isInMemory=true;break}}async _getItemFallback(name){const value=memoryStorage.get(this).get(name);const ret=await StructuredClone(value);return typeof ret==="undefined"? +null:ret}async _setItemFallback(name,value){value=await StructuredClone(value);memoryStorage.get(this).set(name,value)}_removeItemFallback(name){memoryStorage.get(this).delete(name)}_clearFallback(){memoryStorage.get(this).clear()}_keysFallback(){return Array.from(memoryStorage.get(this).keys())}IsUsingFallback(){return isInMemory}async getItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return await this._getItemFallback(key);let result;try{result=await this._inst.get(key)}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)return await this._getItemFallback(key);else{console.error(`Error reading '${key}' from storage, returning null: `,err);return null}}return typeof result==="undefined"?null:result}async setItem(key,value,successCallback){DISALLOW_CALLBACK(successCallback);if(typeof value==="undefined")value=null;if(isInMemory){await this._setItemFallback(key,value);return}try{await this._inst.set(key,value)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)await this._setItemFallback(key, +value);else throw err;}}async removeItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._removeItemFallback(key);return}try{await this._inst.delete(key)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)this._removeItemFallback(key);else console.error(`Error removing '${key}' from storage: `,err)}}async clear(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._clearFallback();return}try{await this._inst.clear()}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)this._clearFallback();else console.error(`Error clearing storage: `,err)}}async keys(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return this._keysFallback();let result=[];try{result=await this._inst.keys()}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)return this._keysFallback();else console.error(`Error getting storage keys: `,err)}return result}ready(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return Promise.resolve(true); +else return this._inst.ready()}createInstance(options){if(typeof options!=="object")throw new TypeError("invalid options object");const name=options["name"];if(typeof name!=="string")throw new TypeError("invalid store name");const inst=new KVStorageContainer(name);return new ForageAdaptor(inst)}length(successCallback){NOT_IMPLEMENTED("localforage.length()")}key(index,successCallback){NOT_IMPLEMENTED("localforage.key()")}iterate(iteratorCallback,successCallback){NOT_IMPLEMENTED("localforage.iterate()")}setDriver(driverName){NOT_IMPLEMENTED("localforage.setDriver()")}config(options){NOT_IMPLEMENTED("localforage.config()")}defineDriver(customDriver){NOT_IMPLEMENTED("localforage.defineDriver()")}driver(){NOT_IMPLEMENTED("localforage.driver()")}supports(driverName){NOT_IMPLEMENTED("localforage.supports()")}dropInstance(){NOT_IMPLEMENTED("localforage.dropInstance()")}disableMemoryMode(){isInMemory= +false}}self["localforage"]=new ForageAdaptor(new KVStorageContainer("localforage"))}; + +} + +// ../lib/misc/supports.js +{ +'use strict';const C3=self.C3;C3.Supports={};C3.Supports.WebAnimations=(()=>{try{if(C3.Platform.Browser==="Safari")return false;if(typeof document==="undefined")return false;const e=document.createElement("div");if(typeof e.animate==="undefined")return false;const player=e.animate([{opacity:"0"},{opacity:"1"}],1E3);return typeof player.reverse!=="undefined"}catch(e){return false}})();C3.Supports.DialogElement=typeof HTMLDialogElement!=="undefined";C3.Supports.RequestIdleCallback=!!self.requestIdleCallback; +C3.Supports.ImageBitmap=!!self.createImageBitmap;C3.Supports.ImageBitmapOptions=false;C3.Supports.ImageBitmapOptionsResize=false; +if(C3.Supports.ImageBitmap){try{self.createImageBitmap(new ImageData(32,32),{"premultiplyAlpha":"none"}).then(()=>{C3.Supports.ImageBitmapOptions=true}).catch(()=>{C3.Supports.ImageBitmapOptions=false})}catch(err){C3.Supports.ImageBitmapOptions=false}try{self.createImageBitmap(new ImageData(32,32),{"resizeWidth":10,"resizeHeight":10}).then(imageBitmap=>{C3.Supports.ImageBitmapOptionsResize=imageBitmap.width===10&&imageBitmap.height===10}).catch(()=>{C3.Supports.ImageBitmapOptionsResize=false})}catch(err){C3.Supports.ImageBitmapOptionsResize= +false}}C3.Supports.ClipboardReadText=!!(navigator["clipboard"]&&navigator["clipboard"]["readText"]&&C3.Platform.Browser!=="Firefox");C3.Supports.PermissionsQuery=!!(navigator["permissions"]&&navigator["permissions"]["query"]);C3.Supports.Proxies=typeof Proxy!=="undefined";C3.Supports.DownloadAttribute=(()=>{if(typeof document==="undefined")return false;const a=document.createElement("a");return typeof a.download!=="undefined"})();C3.Supports.Fetch=typeof fetch==="function"; +C3.Supports.PersistentStorage=!!(self.isSecureContext&&C3.Platform.Browser!=="Opera"&&(navigator["storage"]&&navigator["storage"]["persist"]));C3.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&(navigator["storage"]&&navigator["storage"]["estimate"]));C3.Supports.Fullscreen=(()=>{if(typeof document==="undefined")return false;if(C3.Platform.OS==="iOS")return false;const elem=document.documentElement;return!!(elem.requestFullscreen||elem.msRequestFullscreen||elem.mozRequestFullScreen||elem.webkitRequestFullscreen)})(); +C3.Supports.ImageDecoder=typeof self["ImageDecoder"]!=="undefined";C3.Supports.WebCodecs=!!self["VideoEncoder"];C3.Supports.NativeFileSystemAPI=!!self["showOpenFilePicker"];C3.Supports.QueryLocalFonts=!!self["queryLocalFonts"];C3.Supports.UserActivation=!!navigator["userActivation"];C3.Supports.CanvasToBlobWebP=false; +(async()=>{let canvas;if(typeof document==="undefined")canvas=new OffscreenCanvas(32,32);else{canvas=document.createElement("canvas");canvas.width=32;canvas.height=32}const ctx=canvas.getContext("2d");ctx.fillStyle="blue";ctx.fillRect(0,0,32,32);let blob=null;try{if(canvas.toBlob)blob=await new Promise(resolve=>canvas.toBlob(resolve,"image/webp",1));else if(canvas["convertToBlob"])blob=await canvas["convertToBlob"]({"type":"image/webp","quality":1});C3.Supports.CanvasToBlobWebP=blob&&blob.type=== +"image/webp"}catch(err){C3.Supports.CanvasToBlobWebP=false}})(); + +} + +// ../lib/misc/polyfills.js +{ +'use strict';const C3=self.C3;if(!String.prototype.trimStart){const startWhitespace=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function trimStart(){return this.replace(startWhitespace,"")}} +if(!String.prototype.trimEnd){const endWhitespace=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function trimEnd(){return this.replace(endWhitespace,"")}}if(!String.prototype.replaceAll)String.prototype.replaceAll=function replaceAll(find,replace){return this.replace(new RegExp(C3.EscapeRegex(find),"g"),replace)};if(!Array.prototype.values)Array.prototype.values=function*(){for(const i of this)yield i}; +if(!Array.prototype.flat){function arrayFlat(arr,depth){return arr.reduce((acc,val)=>{if(depth>0&&Array.isArray(val)){Array.prototype.push.apply(acc,arrayFlat(val,depth-1));return acc}else{acc.push(val);return acc}},[])}Array.prototype.flat=function(depth=1){return arrayFlat(this,depth)}}if(!Array.prototype.at)Array.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]}; +if(!String.prototype.at)String.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]};if(!RegExp.escape)RegExp.escape=function(s){return String(s).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}; +if(navigator["storage"]&&!navigator["storage"]["estimate"]&&navigator["webkitTemporaryStorage"]&&navigator["webkitTemporaryStorage"]["queryUsageAndQuota"])navigator["storage"]["estimate"]=function(){return new Promise((resolve,reject)=>{return navigator["webkitTemporaryStorage"]["queryUsageAndQuota"]((usage,quota)=>resolve({"usage":usage,"quota":quota}),reject)})};if(typeof self.isSecureContext==="undefined")self.isSecureContext=location.protocol==="https:"; +if(typeof self["globalThis"]==="undefined")self["globalThis"]=self; + +} + +// lib/misc/assert.js +{ +'use strict';const C3=self.C3;function assertFail(msg_){let stack=C3.GetCallStack();let msg="Assertion failure: "+msg_+"\n\nStack trace:\n"+stack;console.error(msg)}self.assert=function assert(cnd_,msg_){if(!cnd_)assertFail(msg_)}; + +} + +// ../lib/misc/typeChecks.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;C3.IsNumber=function IsNumber(x){return typeof x==="number"};C3.IsFiniteNumber=function IsFiniteNumber(x){return C3.IsNumber(x)&&isFinite(x)};C3.RequireNumber=function RequireNumber(x){if(!C3.IsNumber(x))throw new TypeError("expected number");};C3.RequireOptionalNumber=function RequireOptionalNumber(x){if(C3.IsNullOrUndefined(x))return}; +C3.RequireNumberInRange=function RequireNumberInRange(x,low,high){if(!C3.IsNumber(x)||isNaN(x)||low>x||high{console.log(`%c${name}`,"font-weight: bold",...args);logRafIds.set(name,-1)}))};let measures; +C3.StartMeasure=function StartMeasure(name){performance.mark(name);if(!measures)measures=new Map;if(!measures.has(name))measures.set(name,{current:0,total:0,average:0,calls:1,toString:function(){return`current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})}; +C3.EndMeasure=function StartMeasure(name){performance.measure("measure",name);const entry=performance.getEntriesByName("measure")[0];const m=measures.get(name);m.current=entry.duration;m.total+=m.current;m.average=m.total/m.calls;m.calls++;console.log(m.toString());performance.clearMarks();performance.clearMeasures()};C3.GetCallStack=function GetCallStack(){return(new Error).stack};C3.Debugger=function Debugger(){debugger};C3.cast=function cast(o,T){if(o&&o instanceof T)return o;else return null}; +C3.getName=function getName(o){if(typeof o==="undefined")return"undefined";if(o===null)return"null";if(typeof o==="boolean")return"";if(C3.IsNumber(o))return"";if(C3.IsString(o))return"";if(C3.IsArray(o))return"";if(typeof o==="symbol")return"<"+o.toString()+">";if(C3.IsFunction(o)){if(o.name&&o.name!=="Function")return o.name;return""}if(typeof o==="object"){if(o.constructor&&o.constructor.name&&o.constructor.name!=="Object")return o.constructor.name; +return""}return""};C3.getType=function getType(o){if(o===null)return"null";if(Array.isArray(o))return"array";return typeof o};C3.range=function*range(a,b){if(!isFinite(Math.abs(a-b)))throw new Error("Invalid parameters");if(a>b)for(let i=a-1;i>=b;i--)yield i;else for(let i=a;i0||ctorProxyToObject.size>0){let uniqueNames=new Set([...ctorObjectToProxy.keys()].map(o=>C3.getName(o)));let leftoverNames=[...uniqueNames].join(",");console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${leftoverNames}`);ctorObjectToProxy.clear();ctorProxyToObject.clear()}} +C3.DefendedBase=class DefendedBase{constructor(){if(!C3.isDebugDefend||!C3.Supports.Proxies)return;let newTarget=new.target;let realObject=Object.create(newTarget.prototype);let proxy=new Proxy(realObject,C3.DefendHandler);ctorObjectToProxy.set(realObject,proxy);ctorProxyToObject.set(proxy,realObject);proxyToObject.set(proxy,realObject);if(checkRafId===-1)checkRafId=requestAnimationFrame(CheckDefendedObjectsUsedCorrectly);return proxy}}; +C3.debugDefend=function debugDefend(o){if(C3.isDebugDefend&&C3.Supports.Proxies&&o instanceof C3.DefendedBase){if(!ctorProxyToObject.has(o))return o;let realObject=ctorProxyToObject.get(o);ctorProxyToObject.delete(o);ctorObjectToProxy.delete(realObject);return o}else if(C3.isDebug)return Object.seal(o);else return o}; +C3.New=function New(Type,...args){let o;try{o=new Type(...args)}catch(e){ctorProxyToObject.clear();ctorObjectToProxy.clear();throw e;}if(C3.isDebugDefend)VerifyObjectPropertiesConsistent(Type,o);return C3.debugDefend(o)};C3.Release=function Release(o){let realObject=proxyToObject.get(o);if(realObject)releasedObjects.set(realObject,C3.GetCallStack())};C3.WasReleased=function(o){let realObject=proxyToObject.get(o);if(!realObject)return false;return!!releasedObjects.get(realObject)}; +let typeProperties=new Map;function getObjectPropertySet(o){let ret=new Set;for(let k in o)ret.add(k);return ret} +function VerifyObjectPropertiesConsistent(Type,o){let properties=getObjectPropertySet(o);let existingProperties=typeProperties.get(Type);if(existingProperties){let inconsistentProperties=[];for(let k of existingProperties.values())if(properties.has(k))properties.delete(k);else inconsistentProperties.push(k);C3.appendArray(inconsistentProperties,[...properties]);if(inconsistentProperties.length)console.warn(`[Defence] '${C3.getName(Type)}' constructor creates inconsistent properties: ${inconsistentProperties.join(", ")}`)}else typeProperties.set(Type,properties)} +C3.PerfMark=class PerfMark{constructor(name){this._name="";if(name)this.start(name)}start(name){if(!C3.isPerformanceProfiling)return;this._name=name;performance.mark(this._name+"-Start")}end(){if(!C3.isPerformanceProfiling)return;performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(name){if(!C3.isPerformanceProfiling)return;this.end();this._name=name;performance.mark(this._name+"-Start")}}; + +} + +// ../lib/misc/mathutil.js +{ +'use strict';const C3=self.C3;const TWO_PI=Math.PI*2;const D_TO_R=Math.PI/180;const R_TO_D=180/Math.PI;C3.wrap=function wrap(x,min,max){x=Math.floor(x);min=Math.floor(min);max=Math.floor(max);if(xb)return b;else return x};C3.clampAngle=function clampAngle(a){a%=TWO_PI;if(a<0)a+=TWO_PI;return a};C3.toRadians=function toRadians(x){return x*D_TO_R};C3.toDegrees=function toDegrees(x){return x*R_TO_D};C3.distanceTo=function distanceTo(x1,y1,x2,y2){return Math.hypot(x2-x1,y2-y1)};C3.distanceSquared=function distanceSquared(x1,y1,x2,y2){const dx=x2-x1;const dy=y2-y1;return dx*dx+dy*dy}; +C3.angleTo=function angleTo(x1,y1,x2,y2){return Math.atan2(y2-y1,x2-x1)};C3.angleDiff=function angleDiff(a1,a2){if(a1===a2)return 0;let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);let n=s1*s2+c1*c2;if(n>=1)return 0;if(n<=-1)return Math.PI;return Math.acos(n)}; +C3.angleRotate=function angleRotate(start,end,step){let ss=Math.sin(start);let cs=Math.cos(start);let se=Math.sin(end);let ce=Math.cos(end);if(Math.acos(ss*se+cs*ce)>step)if(cs*se-ss*ce>0)return C3.clampAngle(start+step);else return C3.clampAngle(start-step);else return C3.clampAngle(end)};C3.angleClockwise=function angleClockwise(a1,a2){let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);return c1*s2-s1*c2<=0}; +C3.angleLerp=function angleLerp(a,b,x,r=0){let diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);else return C3.clampAngle(a-(diff+revs)*x)};C3.angleLerpClockwise=function angleLerpClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);return C3.clampAngle((TWO_PI-diff+revs)*x)}; +C3.angleLerpAntiClockwise=function angleLerpAntiClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle((-TWO_PI+diff-revs)*x);return C3.clampAngle(a-(diff+revs)*x)};C3.lerp=function lerp(a,b,x){return a+x*(b-a)};C3.unlerp=function unlerp(a,b,x){if(a===b)return 0;return(x-a)/(b-a)};C3.relerp=function relerp(a,b,x,c,d){return C3.lerp(c,d,C3.unlerp(a,b,x))};C3.qarp=function qarp(a,b,c,x){return C3.lerp(C3.lerp(a,b,x),C3.lerp(b,c,x),x)}; +C3.cubic=function cubic(a,b,c,d,x){return C3.lerp(C3.qarp(a,b,c,x),C3.qarp(b,c,d,x),x)};C3.cosp=function cosp(a,b,x){return(a+b+(a-b)*Math.cos(x*Math.PI))/2};C3.isPOT=function isPOT(x){return x>0&&(x-1&x)===0};C3.nextHighestPowerOfTwo=function nextHighestPowerOfTwo(x){--x;for(let i=1;i<32;i<<=1)x=x|x>>i;return x+1};C3.roundToNearestFraction=function roundToNearestFraction(x,n){return Math.round(x*n)/n};C3.floorToNearestFraction=function floorToNearestFraction(x,n){return Math.floor(x*n)/n}; +C3.round6dp=function round6dp(x){return Math.round(x*1E6)/1E6};C3.toFixed=function toFixed(n,dp){let ret=n.toFixed(dp);let last=ret.length-1;for(;last>=0&&ret.charAt(last)==="0";--last);if(last>=0&&ret.charAt(last)===".")--last;if(last<0)return ret;return ret.substr(0,last+1)};C3.PackRGB=function PackRGB(red,green,blue){return C3.clamp(red,0,255)|C3.clamp(green,0,255)<<8|C3.clamp(blue,0,255)<<16};const ALPHAEX_SHIFT=1024;const ALPHAEX_MAX=1023;const RGBEX_SHIFT=16384;const RGBEX_MAX=8191; +const RGBEX_MIN=-8192;C3.PackRGBAEx=function PackRGBAEx(red,green,blue,alpha){red=C3.clamp(Math.floor(red*1024),RGBEX_MIN,RGBEX_MAX);green=C3.clamp(Math.floor(green*1024),RGBEX_MIN,RGBEX_MAX);blue=C3.clamp(Math.floor(blue*1024),RGBEX_MIN,RGBEX_MAX);alpha=C3.clamp(Math.floor(alpha*ALPHAEX_MAX),0,ALPHAEX_MAX);if(red<0)red+=RGBEX_SHIFT;if(green<0)green+=RGBEX_SHIFT;if(blue<0)blue+=RGBEX_SHIFT;return-(red*RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT+green*RGBEX_SHIFT*ALPHAEX_SHIFT+blue*ALPHAEX_SHIFT+alpha)}; +C3.PackRGBEx=function PackRGBEx(red,green,blue){return C3.PackRGBAEx(red,green,blue,1)};function isNegativeZero(x){return x===0&&1/x<0}C3.GetRValue=function GetRValue(rgb){if(rgb>=0)return(rgb&255)/255;else{let v=Math.floor(-rgb/(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetGValue=function GetGValue(rgb){if(rgb>=0)return((rgb&65280)>>8)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT)/(RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}};C3.GetBValue=function GetBValue(rgb){if(rgb>=0)return((rgb&16711680)>>16)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*ALPHAEX_SHIFT)/ALPHAEX_SHIFT);if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetAValue=function GetAValue(rgb){if(isNegativeZero(rgb))return 0;else if(rgb>=0)return 1;else{const v=Math.floor(-rgb%ALPHAEX_SHIFT);return v/ALPHAEX_MAX}};C3.greatestCommonDivisor=function greatestCommonDivisor(a,b){a=Math.floor(a);b=Math.floor(b);while(b!==0){let t=b;b=a%b;a=t}return a};const COMMON_ASPECT_RATIOS=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]]; +C3.getAspectRatio=function getAspectRatio(w,h){w=Math.floor(w);h=Math.floor(h);if(w===h)return[1,1];for(let aspect of COMMON_ASPECT_RATIOS){let approxH=w/aspect[0]*aspect[1];if(Math.abs(h-approxH)<1)return aspect.slice(0);approxH=w/aspect[1]*aspect[0];if(Math.abs(h-approxH)<1)return[aspect[1],aspect[0]]}let gcd=C3.greatestCommonDivisor(w,h);return[w/gcd,h/gcd]}; +C3.segmentsIntersect=function segmentsIntersect(a1x,a1y,a2x,a2y,b1x,b1y,b2x,b2y){const min_ax=Math.min(a1x,a2x);const max_ax=Math.max(a1x,a2x);const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_ay=Math.min(a1y,a2y);const max_ay=Math.max(a1y,a2y);const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y- +a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la=qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentsIntersectPreCalc=function segmentsIntersectPreCalc(a1x,a1y,a2x,a2y,min_ax,max_ax,min_ay,max_ay,b1x,b1y,b2x,b2y){const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y-a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la= +qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentIntersectsQuad=function segmentIntersectsQuad(x1,y1,x2,y2,q){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);const tlx=q.getTlx(),tly=q.getTly(),trx=q.getTrx(),try_=q.getTry(),brx=q.getBrx(),bry=q.getBry(),blx=q.getBlx(),bly=q.getBly();return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,tlx,tly,trx,try_)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,trx,try_,brx,bry)||C3.segmentsIntersectPreCalc(x1, +y1,x2,y2,min_x,max_x,min_y,max_y,brx,bry,blx,bly)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,blx,bly,tlx,tly)}; +C3.segmentIntersectsAnyN=function segmentIntersectsAnyN(x1,y1,x2,y2,points){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);let i=0;for(let last=points.length-4;i<=last;i+=2)if(C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[i+2],points[i+3]))return true;return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[0],points[1])};const NO_HIT=2; +const PADDING=1E-6;C3.rayIntersect=function rayIntersect(rx1,ry1,rx2,ry2,sx1,sy1,sx2,sy2){const rdx=rx2-rx1;const rdy=ry2-ry1;const sdx=sx2-sx1;const sdy=sy2-sy1;const det=rdx*sdy-rdy*sdx;if(det===0)return NO_HIT;const gamma=((ry1-ry2)*(sx2-rx1)+rdx*(sy2-ry1))/det;if(0=0&&v>=0&&u+v<=1}; +C3.triangleCartesianToBarycentric=function triangleCartesianToBarycentric(px,py,tx1,ty1,tx2,ty2,tx3,ty3){const v0x=tx2-tx1;const v0y=ty2-ty1;const v1x=tx3-tx1;const v1y=ty3-ty1;const v2x=px-tx1;const v2y=py-ty1;const dot00=v0x*v0x+v0y*v0y;const dot01=v0x*v1x+v0y*v1y;const dot11=v1x*v1x+v1y*v1y;const dot20=v2x*v0x+v2y*v0y;const dot21=v2x*v1x+v2y*v1y;const denom=dot00*dot11-dot01*dot01;const v=(dot11*dot20-dot01*dot21)/denom;const w=(dot00*dot21-dot01*dot20)/denom;const u=1-v-w;return[u,v,w]}; +C3.triangleBarycentricToCartesian=function triangleBarycentricToCartesian(u,v,w,tx1,ty1,tx2,ty2,tx3,ty3){return[u*tx1+v*tx2+w*tx3,u*ty1+v*ty2+w*ty3]}; + +} + +// ../lib/misc/miscutil.js +{ +'use strict';const C3=self.C3;let mainDocument=null;let baseHref="";if(typeof document!=="undefined"){mainDocument=document;const baseElem=document.querySelector("base");baseHref=baseElem&&baseElem.hasAttribute("href")?baseElem.getAttribute("href"):"";if(baseHref){if(baseHref.startsWith("/"))baseHref=baseHref.substr(1);if(!baseHref.endsWith("/"))baseHref+="/"}}C3.GetBaseHref=function GetBaseHref(){return baseHref}; +C3.GetBaseURL=function GetBaseURL(){if(!mainDocument)return"";const loc=mainDocument.location;return C3.GetPathFromURL(loc.origin+loc.pathname)+baseHref};C3.GetPathFromURL=function GetPathFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return url;const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return"";return url.substr(0,lastSlash+1)}; +C3.GetFilenameFromURL=function GetFilenameFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return"";const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return url;return url.substr(lastSlash+1)};C3.GetFileExtension=function GetFileExtension(filename){let i=filename.lastIndexOf(".");if(i<1)return"";else return filename.substr(i)}; +C3.SetFileExtension=function SetFileExtension(filename,newExt){const i=filename.lastIndexOf(".");if(i===-1)return filename+"."+newExt;else return filename.substr(0,i+1)+newExt};C3.GetFileNamePart=function GetFileNamePart(filename){let i=filename.lastIndexOf(".");if(i<1)return filename;else return filename.substr(0,i)};C3.NormalizeFileSeparator=function NormalizeFileSeparator(path){return path.replace(/\\/g,"/")}; +C3.IsFileExtension=function IsFileExtension(filename,extension){const ext=filename?C3.GetFileExtension(filename).slice(1):"";return extension===ext}; +C3.FileNameEquals=function FileNameEquals(file_or_filename,other_file_or_filename){let firstName;let secondName;if(C3.IsFileLike(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename["name"]);if(C3.IsString(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename);if(C3.IsFileLike(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename["name"]);if(C3.IsString(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename);return firstName===secondName}; +C3.ParseFilePath=function ParseFilePath(path){path=C3.NormalizeFileSeparator(path);let root=/^\w:\//.exec(path);if(root){root=root[0];path=path.slice(3);if(path[0]!=="/")path="/"+path}else root="";path=path.replace(/\/{2,}/g,"/");if(path.length>1&&path.slice(-1)==="/")path=path.slice(0,-1);const start=path.lastIndexOf("/")+1;let dir="",base=path,name,ext="";if(start>0){dir=path.slice(0,start);base=path.slice(start)}name=base;const end=base.lastIndexOf(".");if(end>0){ext=base.slice(end);name=base.slice(0, +-ext.length)}const full=root+dir+base;return{dir,base,name,root,ext,full}};C3.Wait=function Wait(delay,argument){return new Promise((resolve,reject)=>{self.setTimeout(resolve,delay,argument)})};C3.swallowException=function swallowException(f){try{f()}catch(e){if(C3.isDebug)console.warn("Swallowed exception: ",e)}};C3.noop=function noop(){};C3.equalsNoCase=function equalsNoCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;return a===b||a.normalize().toLowerCase()===b.normalize().toLowerCase()}; +C3.equalsCase=function equalsCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;if(a===b)return true;return a.normalize()===b.normalize()};C3.typedArraySet16=function typedArraySet16(dest,src,i){dest[i++]=src[0];dest[i++]=src[1];dest[i++]=src[2];dest[i++]=src[3];dest[i++]=src[4];dest[i++]=src[5];dest[i++]=src[6];dest[i++]=src[7];dest[i++]=src[8];dest[i++]=src[9];dest[i++]=src[10];dest[i++]=src[11];dest[i++]=src[12];dest[i++]=src[13];dest[i++]=src[14];dest[i]=src[15]}; +C3.truncateArray=function truncateArray(arr,index){arr.length=index};C3.clearArray=function clearArray(arr){if(!arr)return;if(arr.length===0)return;C3.truncateArray(arr,0)};C3.clear2DArray=function clear2DArray(arr){if(!arr)return;for(let i=0;iarrayLength)C3.extendArray(arr,len,filler)};C3.shallowAssignArray=function shallowAssignArray(dest,src){C3.clearArray(dest);C3.appendArray(dest,src)};C3.appendArray=function appendArray(a,b){if(b.length<1E4)a.push(...b);else for(let i=0,len=b.length;i=arr.length)return;let len=arr.length-1;for(let i=index;i=0)a.splice(i,1)};C3.arraysEqual=function arraysEqual(a,b){let len=a.length;if(b.length!==len)return false;for(let i=0;i=0&&indexy;case 5:return x>=y;default:return false}}; +C3.hasAnyOwnProperty=function hasAnyOwnProperty(o){for(let p in o)if(o.hasOwnProperty(p))return true;return false}; +C3.PromiseAllWithProgress=function PromiseAllWithProgress(arr,progressCallback){if(!arr.length)return Promise.resolve([]);return new Promise((resolve,reject)=>{const results=[];let numberCompleted=0;let cancelled=false;for(let i=0,len=arr.length;i{if(cancelled)return;results[i]=result;++numberCompleted;if(numberCompleted===arr.length)resolve(results);else progressCallback(numberCompleted,arr.length)}).catch(err=>{cancelled=true;reject(err)})}})}; +let memoryCallbacks=[];C3.AddLibraryMemoryCallback=function AddLibraryMemoryCallback(f){memoryCallbacks.push(f)};C3.GetEstimatedLibraryMemoryUsage=function GetEstimatedLibraryMemoryUsage(){let ret=0;for(let f of memoryCallbacks){let m=f();ret+=m}return Math.floor(ret)};let nextTaskId=1;const activeTaskIds=new Map;const taskMessageChannel=new MessageChannel;taskMessageChannel.port2.onmessage=function OnTask(e){const id=e.data;const callback=activeTaskIds.get(id);activeTaskIds.delete(id);if(callback)callback(performance.now())}; +C3.RequestUnlimitedAnimationFrame=function RequestUnlimitedAnimationFrame(callback){const id=nextTaskId++;activeTaskIds.set(id,callback);taskMessageChannel.port1.postMessage(id);return id};C3.CancelUnlimitedAnimationFrame=function CancelUnlimitedAnimationFrame(id){activeTaskIds.delete(id)};C3.PostTask=C3.RequestUnlimitedAnimationFrame;C3.WaitForNextTask=function WaitForNextTask(){return new Promise(resolve=>C3.PostTask(resolve))};const activeRPAFids=new Set; +C3.RequestPostAnimationFrame=function RequestPostAnimationFrame(callback){const id=self.requestAnimationFrame(async timestamp=>{await C3.WaitForNextTask();if(!activeRPAFids.has(id))return;activeRPAFids.delete(id);callback(timestamp)});activeRPAFids.add(id);return id};C3.CancelPostAnimationFrame=function CancelPostAnimationFrame(id){if(!activeRPAFids.has(id))return;self.cancelAnimationFrame(id);activeRPAFids.delete(id)}; + +} + +// lib/misc/runtimeutil.js +{ +'use strict';const C3=self.C3;C3.IsAbsoluteURL=function IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"};C3.IsRelativeURL=function IsRelativeURL(url){return!C3.IsAbsoluteURL(url)};C3.ThrowIfNotOk=function ThrowIfNotOk(response){if(!response.ok)throw new Error(`fetch '${response.url}' response returned ${response.status} ${response.statusText}`);}; +C3.FetchOk=function FetchOk(url,init){return fetch(url,init).then(response=>{C3.ThrowIfNotOk(response);return response})};C3.FetchText=function FetchText(url){return C3.FetchOk(url).then(response=>response.text())};C3.FetchJson=function FetchJson(url){return C3.FetchOk(url).then(response=>response.json())};C3.FetchBlob=function FetchBlob(url){return C3.FetchOk(url).then(response=>response.blob())};C3.FetchArrayBuffer=function FetchArrayBuffer(url){return C3.FetchOk(url).then(response=>response.arrayBuffer())}; +C3.FetchImage=function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})};C3.BlobToArrayBuffer=function BlobToArrayBuffer(blob){if(typeof blob["arrayBuffer"]==="function")return blob["arrayBuffer"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsArrayBuffer(blob)})}; +C3.BlobToString=function BlobToString(blob){if(typeof blob["text"]==="function")return blob["text"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsText(blob)})};C3.BlobToJson=function BlobToJson(blob){return C3.BlobToString(blob).then(text=>JSON.parse(text))}; +C3.BlobToImage=async function BlobToImage(blob,decodeImage){let blobUrl=URL.createObjectURL(blob);try{const img=await C3.FetchImage(blobUrl);URL.revokeObjectURL(blobUrl);blobUrl="";if(decodeImage&&typeof img["decode"]==="function")await img["decode"]();return img}finally{if(blobUrl)URL.revokeObjectURL(blobUrl)}}; +C3.CreateCanvas=function CreateCanvas(width,height){if(typeof document!=="undefined"&&typeof document.createElement==="function"){const canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;return canvas}else return new OffscreenCanvas(width,height)}; +C3.CanvasToBlob=function CanvasToBlob(canvas,type,quality){if(typeof quality!=="number")quality=1;type=type||"image/png";quality=C3.clamp(quality,0,1);if(canvas.toBlob)return new Promise(resolve=>canvas.toBlob(resolve,type,quality));else if(canvas["convertToBlob"])return canvas["convertToBlob"]({"type":type,"quality":quality});else throw new Error("could not convert canvas to blob");}; +C3.DrawableToBlob=function DrawableToBlob(drawable,type,quality){const canvas=C3.CreateCanvas(drawable.width,drawable.height);const ctx=canvas.getContext("2d");ctx.drawImage(drawable,0,0);return C3.CanvasToBlob(canvas,type,quality)}; +C3.ImageDataToBlob=function ImageDataToBlob(imageData,type,quality){if(C3.Supports.ImageBitmapOptions)return createImageBitmap(imageData,{"premultiplyAlpha":"none"}).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else if(C3.Supports.ImageBitmap)return createImageBitmap(imageData).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else{const canvas=C3.CreateCanvas(imageData.width,imageData.height);const ctx=canvas.getContext("2d");ctx.putImageData(imageData,0,0);return C3.CanvasToBlob(canvas, +type,quality)}};C3.CopySet=function CopySet(dest,src){dest.clear();for(const x of src)dest.add(x)};C3.MapToObject=function MapToObject(map){const ret=Object.create(null);for(const [k,v]of map.entries())ret[k]=v;return ret};C3.ObjectToMap=function ObjectToMap(o,map){map.clear();for(const [k,v]of Object.entries(o))map.set(k,v)}; +C3.ToSuperJSON=function ToSuperJSON(v){if(typeof v==="object"&&v!==null)if(v instanceof Set)return{"_c3type_":"set","data":[...v].map(o=>ToSuperJSON(o))};else if(v instanceof Map)return{"_c3type_":"map","data":[...v].map(pair=>[pair[0],ToSuperJSON(pair[1])])};else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=ToSuperJSON(value);return ret}return v}; +C3.FromSuperJSON=function FromSuperJSON(v){if(typeof v==="object"&v!==null)if(v["_c3type_"]==="set")return new Set(v["data"].map(o=>FromSuperJSON(o)));else if(v["_c3type_"]==="map")return new Map(v["data"].map(pair=>[pair[0],FromSuperJSON(pair[1])]));else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=FromSuperJSON(value);return ret}return v}; +C3.CSSToCamelCase=function(str){if(str.startsWith("--"))return str;let ret="";let isAfterHyphen=false;for(const ch of str)if(ch==="-")isAfterHyphen=true;else if(isAfterHyphen){ret+=ch.toUpperCase();isAfterHyphen=false}else ret+=ch;return ret};C3.IsIterator=function(o){return typeof o==="object"&&typeof o.next==="function"}; +C3.MakeFilledArray=function MakeFilledArray(len,data){const ret=[];if(typeof data==="function")for(let i=0;i1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p} +C3.Color=class Color{constructor(r,g,b,a){this._r=NaN;this._g=NaN;this._b=NaN;this._a=NaN;this._r=0;this._g=0;this._b=0;this._a=0;if(r instanceof C3.Color)this.set(r);else this.setRgba(r||0,g||0,b||0,a||0)}setRgb(r,g,b){this._r=+r;this._g=+g;this._b=+b;this.clamp();return this}setRgba(r,g,b,a){this._r=+r;this._g=+g;this._b=+b;this._a=+a;this.clamp();return this}set(c){this._r=c._r;this._g=c._g;this._b=c._b;this._a=c._a;return this}copy(c){return this.set(c)}add(c){this._r+=c._r;this._g+=c._g;this._b+= +c._b;this._a+=c._a;this.clamp()}addRgb(r,g,b,a=0){this._r+=+r;this._g+=+g;this._b+=+b;this._a+=+a;this.clamp()}diff(c){this.setR(Math.max(this._r,c._r)-Math.min(this._r,c._r));this.setG(Math.max(this._g,c._g)-Math.min(this._g,c._g));this.setB(Math.max(this._b,c._b)-Math.min(this._b,c._b));this.setA(Math.max(this._a,c._a)-Math.min(this._a,c._a));this.clamp()}copyRgb(c){this._r=c._r;this._g=c._g;this._b=c._b}setR(r){this._r=C3.clamp(+r,0,1)}getR(){return this._r}setG(g){this._g=C3.clamp(+g,0,1)}getG(){return this._g}setB(b){this._b= +C3.clamp(+b,0,1)}getB(){return this._b}setA(a){this._a=C3.clamp(+a,0,1)}getA(){return this._a}clone(){return C3.New(C3.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i++]=this._b;ta[i]=this._a}writeRGBToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i]=this._b}equals(c){return this._r===c._r&&this._g===c._g&&this._b===c._b&&this._a===c._a}equalsIgnoringAlpha(c){return this._r=== +c._r&&this._g===c._g&&this._b===c._b}equalsRgb(r,g,b){return this._r===r&&this._g===g&&this._b===b}equalsRgba(r,g,b,a){return this._r===r&&this._g===g&&this._b===b&&this._a===a}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)&&arr[offset+3]===Math.fround(this._a)}equalsRGBF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)}multiply(c){this._r*= +c._r;this._g*=c._g;this._b*=c._b;this._a*=c._a}multiplyAlpha(a){this._r*=a;this._g*=a;this._b*=a;this._a*=a}premultiply(){this._r*=this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=C3.clamp(this._r,0,1);this._g=C3.clamp(this._g,0,1);this._b=C3.clamp(this._b,0,1);this._a=C3.clamp(this._a,0,1);return this}setFromRgbValue(rgb){this._r=C3.GetRValue(rgb);this._g=C3.GetGValue(rgb);this._b=C3.GetBValue(rgb); +this._a=C3.GetAValue(rgb)}getCssRgb(_r,_g,_b){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();return`rgb(${r*100}%, ${g*100}%, ${b*100}%)`}getCssRgba(_r,_g,_b,_a){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();const a=C3.IsFiniteNumber(_a)?_a:this.getA();return`rgba(${r*100}%, ${g*100}%, ${b*100}%, ${a})`}toHexString(){const rh= +Math.round(this.getR()*255);const gh=Math.round(this.getG()*255);const bh=Math.round(this.getB()*255);return"#"+padTwoDigits(rh.toString(16))+padTwoDigits(gh.toString(16))+padTwoDigits(bh.toString(16))}parseHexString(str){if(typeof str!=="string")return false;str=str.trim();if(str.charAt(0)==="#")str=str.substr(1);let rv;let gv;let bv;if(str.length===3){rv=parseInt(str[0],16)/15;gv=parseInt(str[1],16)/15;bv=parseInt(str[2],16)/15}else if(str.length===6){rv=parseInt(str.substr(0,2),16)/255;gv=parseInt(str.substr(2, +2),16)/255;bv=parseInt(str.substr(4,2),16)/255}else return false;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}toCommaSeparatedRgb(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return`${rv}, ${gv}, ${bv}`}toRgbArray(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return[rv,gv,bv]}parseCommaSeparatedRgb(str){if(typeof str!== +"string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(),10)/255;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedPercentageRgb(str){if(typeof str!=="string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false; +const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(), +10)/255;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseCommaSeparatedPercentageRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv); +if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseString(str){if(typeof str!=="string")return false;str=str.replace(/\s+/,"");if(str.includes(","))if(str.startsWith("rgb("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgb(str);else return this.parseCommaSeparatedRgb(str);else if(str.startsWith("rgba("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgba(str);else return this.parseCommaSeparatedRgba(str);else if(str.startsWith("hsl(")|| +str.startsWith("hsla("))return this.parseHSLString(str);else{const components=str.split(",");if(str.includes("%")){if(components.length===3)return this.parseCommaSeparatedPercentageRgb(str);else if(components.length===4)return this.parseCommaSeparatedPercentageRgba(str);return false}else{if(components.length===3)return this.parseCommaSeparatedRgb(str);else if(components.length===4)return this.parseCommaSeparatedRgba(str);return false}}else return this.parseHexString(str)}toJSON(){return[this._r,this._g, +this._b,this._a]}setFromHSLA(h,s,l,a){let r;let g;let b;h%=360;s=C3.clamp(s,0,100);l=C3.clamp(l,0,100);a=C3.clamp(a,0,1);h/=360;s/=100;l/=100;if(s===0)r=g=b=l;else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=hueToRGB(p,q,h+1/3);g=hueToRGB(p,q,h);b=hueToRGB(p,q,h-1/3)}this.setR(r);this.setG(g);this.setB(b);this.setA(a);return this}parseHSLString(str){const cleanString=str.replace(/ |hsl|hsla|\(|\)|;/gi,"");const hsl=HSL_TEST.exec(cleanString);const hsla=HSLA_TEST.exec(cleanString);if(hsl&&hsl.length=== +4){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],1);return true}else if(hsla&&hsla.length===5){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],+hsl[4]);return true}return false}toHSLAString(){const r=this._r;const g=this._g;const b=this._b;const a=this._a;const h=C3.Color.GetHue(r,g,b);const s=C3.Color.GetSaturation(r,g,b);const l=C3.Color.GetLuminosity(r,g,b);return`hsla(${h}, ${s}%, ${l}%, ${a})`}toHSLAArray(){const r=this._r;const g=this._g;const b=this._b;return[C3.Color.GetHue(r,g,b),C3.Color.GetSaturation(r, +g,b),C3.Color.GetLuminosity(r,g,b),this._a]}setFromJSON(arr){if(!Array.isArray(arr))return;if(arr.length<3)return;this._r=arr[0];this._g=arr[1];this._b=arr[2];if(arr.length>=4)this._a=arr[3];else this._a=1}set r(r){this.setR(r)}get r(){return this.getR()}set g(g){this.setG(g)}get g(){return this.getG()}set b(b){this.setB(b)}get b(){return this.getB()}set a(a){this.setA(a)}get a(){return this.getA()}setAtIndex(i,v){switch(i){case 0:this.setR(v);break;case 1:this.setG(v);break;case 2:this.setB(v);break; +case 3:this.setA(v);break;default:throw new RangeError("invalid color index");}}getAtIndex(i){switch(i){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(color_or_json_1,color_or_json_2){let c1;let c2;if(Array.isArray(color_or_json_1)){c1=new C3.Color;c1.setFromJSON(color_or_json_1)}else if(color_or_json_1 instanceof C3.Color)c1=color_or_json_1;else throw new Error("unexpected type"); +if(Array.isArray(color_or_json_2)){c2=new C3.Color;c2.setFromJSON(color_or_json_2)}else if(color_or_json_2 instanceof C3.Color)c2=color_or_json_2;else throw new Error("unexpected type");return c1.equals(c2)}static DiffChannel(channel1,channel2){return C3.clamp(Math.max(channel1,channel2)-Math.min(channel1,channel2),0,1)}static Diff(c1,c2){const ret=new C3.Color;ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)- +Math.min(c1._b,c2._b));ret.setA(Math.max(c1._a,c2._a)-Math.min(c1._a,c2._a));return ret}static DiffNoAlpha(c1,c2){const ret=new C3.Color(0,0,0,1);ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)-Math.min(c1._b,c2._b));return ret}static GetHue(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);if(max===min)return 0;let h=0;switch(max){case r:h=(g-b)/(max-min)+(g.5?d/(2-max-min):d/(max+min);return Math.round(s*100)}static GetLuminosity(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);const l=(max+min)/2;if(!max)return 0;return Math.round(l*100)}};C3.Color.White=Object.freeze(C3.New(C3.Color,1,1,1,1)); +C3.Color.Black=Object.freeze(C3.New(C3.Color,0,0,0,1));C3.Color.TransparentBlack=Object.freeze(C3.New(C3.Color,0,0,0,0)); + +} + +// ../lib/misc/vector2.js +{ +'use strict';const C3=self.C3; +C3.Vector2=class Vector2{constructor(x,y){this._x=0;this._y=0;if(x instanceof C3.Vector2)this.copy(x);else this.set(x||0,y||0)}set(x,y){this._x=+x;this._y=+y}copy(v){this._x=v._x;this._y=v._y}equals(v){return this._x===v._x&&this._y===v._y}equalsValues(x,y){return this._x===x&&this._y===y}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._x)&&arr[offset+1]===Math.fround(this._y)}setX(x){this._x=+x}getX(){return this._x}setY(y){this._y=+y}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta, +i){ta[i++]=this._x;ta[i]=this._y}offset(x,y){this._x+=+x;this._y+=+y}scale(x,y){this._x*=x;this._y*=y}divide(x,y){this._x/=x;this._y/=y}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return C3.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.hypot(this._x,this._y)}rotatePrecalc(sin_a,cos_a){const temp= +this._x*cos_a-this._y*sin_a;this._y=this._y*cos_a+this._x*sin_a;this._x=temp}rotate(a){if(a===0)return;this.rotatePrecalc(Math.sin(a),Math.cos(a))}rotateAbout(a,x,y){if(a===0||x===this._x&&y===this._y)return;this._x-=x;this._y-=y;this.rotatePrecalc(Math.sin(a),Math.cos(a));this._x+=+x;this._y+=+y}move(a,dist){if(dist===0)return;this._x+=Math.cos(a)*dist;this._y+=Math.sin(a)*dist}normalize(){const m=this.length();if(m!==0&&m!==1){this._x/=m;this._y/=m}}clamp(lower,upper){this._x=C3.clamp(this._x,lower, +upper);this._y=C3.clamp(this._y,lower,upper)}}; + +} + +// ../lib/misc/rect.js +{ +'use strict';const C3=self.C3; +C3.Rect=class Rect{constructor(left,top,right,bottom){this._left=NaN;this._top=NaN;this._right=NaN;this._bottom=NaN;this._left=0;this._top=0;this._right=0;this._bottom=0;if(left instanceof C3.Rect)this.copy(left);else this.set(left||0,top||0,right||0,bottom||0)}set(left,top,right,bottom){this._left=+left;this._top=+top;this._right=+right;this._bottom=+bottom}setWH(left,top,width,height){left=+left;top=+top;this._left=left;this._top=top;this._right=left+ +width;this._bottom=top+ +height}copy(rect){this._left= ++rect._left;this._top=+rect._top;this._right=+rect._right;this._bottom=+rect._bottom}clone(){return new C3.Rect(this._left,this._top,this._right,this._bottom)}static Merge(first,second){const ret=new C3.Rect;ret.setLeft(Math.min(first._left,second._left));ret.setTop(Math.min(first._top,second._top));ret.setRight(Math.max(first._right,second._right));ret.setBottom(Math.max(first._bottom,second._bottom));return ret}static FromObject(o){return new C3.Rect(o.left,o.top,o.right,o.bottom)}equals(rect){return this._left=== +rect._left&&this._top===rect._top&&this._right===rect._right&&this._bottom===rect._bottom}equalsWH(x,y,w,h){return this._left===x&&this._top===y&&this.width()===w&&this.height()===h}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._left)&&arr[offset+1]===Math.fround(this._top)&&arr[offset+2]===Math.fround(this._right)&&arr[offset+3]===Math.fround(this._bottom)}setLeft(l){this._left=+l}getLeft(){return this._left}setTop(t){this._top=+t}getTop(){return this._top}setRight(r){this._right= ++r}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i]=this._bottom}writeAsQuadToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i++]=this._top;ta[i++]= +this._right;ta[i++]=this._bottom;ta[i++]=this._left;ta[i]=this._bottom}writeAsQuadToTypedArray3D(ta,i,z){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._bottom;ta[i++]=z;ta[i++]=this._left;ta[i++]=this._bottom;ta[i]=z}width(){return this._right-this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(x,y){x=+x;y=+y;this._left+=x;this._top+= +y;this._right+=x;this._bottom+=y}offsetLeft(x){this._left+=+x}offsetTop(y){this._top+=+y}offsetRight(x){this._right+=+x}offsetBottom(y){this._bottom+=+y}toSquare(axis){if(axis!=="x")throw new Error("invalid axis, only 'x' supported");if(this._topr)this._right=+r;if(this._bottom>b)this._bottom=+b}clampFlipped(l,t,r,b){if(this._leftt)this._top=+t;if(this._right>r)this._right=+r;if(this._bottomthis._right)this.swapLeftRight();if(this._top>this._bottom)this.swapTopBottom()}intersectsRect(rect){return!(rect._right< +this._left||rect._bottomthis._right||rect._top>this._bottom)}intersectsRectOffset(rect,x,y){return!(rect._right+xthis._right||rect._top+y>this._bottom)}containsPoint(x,y){return x>=this._left&&x<=this._right&&y>=this._top&&y<=this._bottom}containsRect(rect){return rect._left>=this._left&&rect._top>=this._top&&rect._right<=this._right&&rect._bottom<=this._bottom}expandToContain(rect){if(rect._leftthis._right)this._right=+rect._right;if(rect._bottom>this._bottom)this._bottom=+rect._bottom}lerpInto(rect){this._left=C3.lerp(rect._left,rect._right,this._left);this._top=C3.lerp(rect._top,rect._bottom,this._top);this._right=C3.lerp(rect._left,rect._right,this._right);this._bottom=C3.lerp(rect._top,rect._bottom,this._bottom)}}; + +} + +// ../lib/misc/quad.js +{ +'use strict';const C3=self.C3; +C3.Quad=class Quad{constructor(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=NaN;this._tly=NaN;this._trx=NaN;this._try=NaN;this._brx=NaN;this._bry=NaN;this._blx=NaN;this._bly=NaN;this._tlx=0;this._tly=0;this._trx=0;this._try=0;this._brx=0;this._bry=0;this._blx=0;this._bly=0;if(tlx instanceof C3.Quad)this.copy(tlx);else this.set(tlx||0,tly||0,trx||0,try_||0,brx||0,bry||0,blx||0,bly||0)}set(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=+tlx;this._tly=+tly;this._trx=+trx;this._try=+try_;this._brx=+brx;this._bry= ++bry;this._blx=+blx;this._bly=+bly}setRect(left,top,right,bottom){this.set(left,top,right,top,right,bottom,left,bottom)}copy(q){this._tlx=q._tlx;this._tly=q._tly;this._trx=q._trx;this._try=q._try;this._brx=q._brx;this._bry=q._bry;this._blx=q._blx;this._bly=q._bly}equals(q){return this._tlx===q._tlx&&this._tly===q._tly&&this._trx===q._trx&&this._try===q._try&&this._brx===q._brx&&this._bry===q._bry&&this._blx===q._blx&&this._bly===q._bly}setTlx(v){this._tlx=+v}getTlx(){return this._tlx}setTly(v){this._tly= ++v}getTly(){return this._tly}setTrx(v){this._trx=+v}getTrx(){return this._trx}setTry(v){this._try=+v}getTry(){return this._try}setBrx(v){this._brx=+v}getBrx(){return this._brx}setBry(v){this._bry=+v}getBry(){return this._bry}setBlx(v){this._blx=+v}getBlx(){return this._blx}setBly(v){this._bly=+v}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx, +this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=this._blx;ta[i]=this._bly}writeToTypedArray3D(ta,i,z){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=z;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=z;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=z;ta[i++]=this._blx;ta[i++]=this._bly;ta[i]=z}offset(x, +y){x=+x;y=+y;this._tlx+=x;this._tly+=y;this._trx+=x;this._try+=y;this._brx+=x;this._bry+=y;this._blx+=x;this._bly+=y}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try); +this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(rect){this._tlx=rect._left;this._tly=rect._top;this._trx=rect._right;this._try=rect._top;this._brx=rect._right; +this._bry=rect._bottom;this._blx=rect._left;this._bly=rect._bottom}setFromRotatedRect(rect,a){if(a===0)this.setFromRect(rect);else this.setFromRotatedRectPrecalc(rect,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(rect,sin_a,cos_a){const left_sin_a=rect._left*sin_a;const top_sin_a=rect._top*sin_a;const right_sin_a=rect._right*sin_a;const bottom_sin_a=rect._bottom*sin_a;const left_cos_a=rect._left*cos_a;const top_cos_a=rect._top*cos_a;const right_cos_a=rect._right*cos_a;const bottom_cos_a=rect._bottom* +cos_a;this._tlx=left_cos_a-top_sin_a;this._tly=top_cos_a+left_sin_a;this._trx=right_cos_a-top_sin_a;this._try=top_cos_a+right_sin_a;this._brx=right_cos_a-bottom_sin_a;this._bry=bottom_cos_a+right_sin_a;this._blx=left_cos_a-bottom_sin_a;this._bly=bottom_cos_a+left_sin_a}getBoundingBox(rect){rect.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(x, +y){let v0x=this._trx-this._tlx;let v0y=this._try-this._tly;const v1x=this._brx-this._tlx;const v1y=this._bry-this._tly;const v2x=x-this._tlx;const v2y=y-this._tly;let dot00=v0x*v0x+v0y*v0y;let dot01=v0x*v1x+v0y*v1y;let dot02=v0x*v2x+v0y*v2y;const dot11=v1x*v1x+v1y*v1y;const dot12=v1x*v2x+v1y*v2y;let invDenom=1/(dot00*dot11-dot01*dot01);let u=(dot11*dot02-dot01*dot12)*invDenom;let v=(dot00*dot12-dot01*dot02)*invDenom;if(u>=0&&v>0&&u+v<1)return true;v0x=this._blx-this._tlx;v0y=this._bly-this._tly;dot00= +v0x*v0x+v0y*v0y;dot01=v0x*v1x+v0y*v1y;dot02=v0x*v2x+v0y*v2y;invDenom=1/(dot00*dot11-dot01*dot01);u=(dot11*dot02-dot01*dot12)*invDenom;v=(dot00*dot12-dot01*dot02)*invDenom;return u>=0&&v>0&&u+v<1}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(x1,y1,x2,y2){if(this.containsPoint(x1,y1)||this.containsPoint(x2,y2))return true;return C3.segmentIntersectsQuad(x1,y1,x2,y2,this)}intersectsQuad(rhs){let midX=rhs.midX();let midY= +rhs.midY();if(this.containsPoint(midX,midY))return true;midX=this.midX();midY=this.midY();if(rhs.containsPoint(midX,midY))return true;const tlx=this._tlx,tly=this._tly,trx=this._trx,try_=this._try,brx=this._brx,bry=this._bry,blx=this._blx,bly=this._bly;return C3.segmentIntersectsQuad(tlx,tly,trx,try_,rhs)||C3.segmentIntersectsQuad(trx,try_,brx,bry,rhs)||C3.segmentIntersectsQuad(brx,bry,blx,bly,rhs)||C3.segmentIntersectsQuad(blx,bly,tlx,tly,rhs)}rotatePointsAnticlockwise(){const tlx=this._tlx;const tly= +this._tly;this._tlx=this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=tlx;this._bly=tly}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(i,j){const tmp=this._getAtIndex(i);this._setAtIndex(i,this._getAtIndex(j));this._setAtIndex(j,tmp)}_getAtIndex(i){switch(i){case 0:return this._tlx;case 1:return this._tly; +case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(i,v){v=+v;switch(i){case 0:this._tlx=v;break;case 1:this._tly=v;break;case 2:this._trx=v;break;case 3:this._try=v;break;case 4:this._brx=v;break;case 5:this._bry=v;break;case 6:this._blx=v;break;case 7:this._bly=v;break;default:throw new RangeError("invalid quad point index");}}}; + +} + +// lib/misc/collisionPoly.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const DEFAULT_POLY_POINTS=[0,0,1,0,1,1,0,1];const tempQuad=C3.New(C3.Quad); +C3.CollisionPoly=class CollisionPoly extends C3.DefendedBase{constructor(pointsArr,enabled=true){super();if(!pointsArr)pointsArr=DEFAULT_POLY_POINTS;this._ptsArr=Float64Array.from(pointsArr);this._bbox=new C3.Rect;this._isBboxChanged=true;this._enabled=enabled}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(pointsArr){if(this._ptsArr.length===pointsArr.length)this._ptsArr.set(pointsArr);else this._ptsArr=Float64Array.from(pointsArr);this._isBboxChanged= +true}setDefaultPoints(){this.setPoints(DEFAULT_POLY_POINTS)}copy(poly){this.setPoints(poly._ptsArr)}setBboxChanged(){this._isBboxChanged=true}_updateBbox(){if(!this._isBboxChanged)return;const ptsArr=this._ptsArr;let left=ptsArr[0];let top=ptsArr[1];let right=left;let bottom=top;for(let i=0,len=ptsArr.length;iright)right=x;if(ybottom)bottom=y}this._bbox.set(left,top,right,bottom);this._isBboxChanged=false}setFromRect(rc, +offX,offY){let ptsArr=this._ptsArr;if(ptsArr.length!==8){ptsArr=new Float64Array(8);this._ptsArr=ptsArr}ptsArr[0]=rc.getLeft()-offX;ptsArr[1]=rc.getTop()-offY;ptsArr[2]=rc.getRight()-offX;ptsArr[3]=rc.getTop()-offY;ptsArr[4]=rc.getRight()-offX;ptsArr[5]=rc.getBottom()-offY;ptsArr[6]=rc.getLeft()-offX;ptsArr[7]=rc.getBottom()-offY;this._bbox.copy(rc);if(offX!==0||offY!==0)this._bbox.offset(-offX,-offY);this._isBboxChanged=false}setFromQuad(q,offX,offY){tempQuad.copy(q);tempQuad.offset(offX,offY);this.setPoints(tempQuad.toArray()); +this._isBboxChanged=true}transform(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}this.transformPrecalc(w,h,sina,cosa)}transformPrecalc(w,h,sina,cosa){const ptsArr=this._ptsArr;for(let i=0,len=ptsArr.length;i!filter.includes(ease))}static GetRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return[...PREDEFINED_EASE_MAP.keys()].concat(sortedCustomEases)}static GetCustomRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return sortedCustomEases}static IsPredefinedTranslatedName(easeName){for(const k of EASE_TRANSLATION_KEYS){const translatedName= +self.lang(`ui.bars.timeline.eases.${k}`);if(translatedName===easeName)return true}for(const k of SHORT_EASE_TRANSLATION_KEYS){const translatedName=self.lang(`ui.bars.timeline.short-eases.${k}`);if(translatedName===easeName)return true}}static IsNamePredefined(easeName){this._CreateEaseMap();return[...PREDEFINED_EASE_MAP.keys()].includes(easeName)}static _GetEase(easeName){const realEaseName=ALIAS_MAP.get(easeName);if(realEaseName)return EASE_MAP.get(realEaseName);if(Ease.IsNamePredefined(easeName))return EASE_MAP.get(easeName); +if(PRIVATE_EASE_MAP.has(easeName))return PRIVATE_EASE_MAP.get(easeName)}static GetBuiltInTransition(builtInTransitionName){this._CreateEaseMap();return BUILT_IN_TRANSITION_MAP.get(builtInTransitionName)}static GetEditorEase(easeName,project){this._CreateEaseMap();const ease=Ease._GetEase(easeName);if(ease)return ease;if(!project)throw new Error("missing ease function");return CUSTOM_EASE_EDITOR_MAP.get(project).get(easeName)}static GetRuntimeEase(easeName){this._CreateEaseMap();const ease=Ease._GetEase(easeName); +if(ease)return ease;return CUSTOM_EASE_RUNTIME_MAP.get(easeName)}static GetEaseFromIndex(index){this._CreateEaseMap();const names=this.GetRuntimeEaseNames();return names[index]}static GetIndexForEase(name,project){this._CreateEaseMap();const names=this.GetEditorEaseNames(project);return names.indexOf(name)}static GetIndexForEaseAtRuntime(name){return this.GetIndexForEase(name)}static _CreateEaseMap(){if(EASE_MAP.size!==0)return;this._AddPredifinedEase("default",()=>{});this._AddPredifinedEase("noease", +[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}],true);this._AddPredifinedEase("easeinsine",[{"x":0,"y":0,"sax":.485,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutsine",[{"x":0,"y":0,"sax":.038,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.485,"eay":0,"se":false,"ee":true}]); +this._AddPredifinedEase("easeinoutsine",[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinelastic",[{"x":0,"y":0,"sax":.018,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.116,"y":.002,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.266,"y":-.005,"sax":.024,"say":0,"eax":-.021,"eay":0,"se":true,"ee":true},{"x":.416,"y":.016,"sax":.024,"say":0,"eax":-.026, +"eay":0,"se":true,"ee":true},{"x":.566,"y":-.045,"sax":.061,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.716,"y":.132,"sax":.072,"say":-.004,"eax":-.045,"eay":0,"se":true,"ee":true},{"x":.866,"y":-.373,"sax":.06,"say":0,"eax":-.049,"eay":-.002,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":-.263,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutelastic",[{"x":0,"y":0,"sax":.038,"say":.263,"eax":0,"eay":0,"se":true,"ee":false},{"x":.136,"y":1.373,"sax":.049,"say":.002, +"eax":-.06,"eay":0,"se":true,"ee":true},{"x":.286,"y":.868,"sax":.045,"say":0,"eax":-.072,"eay":.004,"se":true,"ee":true},{"x":.436,"y":1.045,"sax":.025,"say":0,"eax":-.061,"eay":0,"se":true,"ee":true},{"x":.586,"y":.984,"sax":.026,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.736,"y":1.005,"sax":.021,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.886,"y":.998,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.018,"eay":0,"se":false,"ee":true}]); +this._AddPredifinedEase("easeinoutelastic",[{"x":0,"y":0,"sax":.025,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.067,"y":.001,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.18,"y":-.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.292,"y":.025,"sax":.053,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.405,"y":-.118,"sax":.069,"say":0,"eax":-.027,"eay":0,"se":true,"ee":true},{"x":.597,"y":1.118,"sax":.027,"say":0,"eax":-.069,"eay":0,"se":true,"ee":true}, +{"x":.71,"y":.975,"sax":.025,"say":0,"eax":-.053,"eay":0,"se":true,"ee":true},{"x":.822,"y":1.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.935,"y":.999,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.025,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinback",[{"x":0,"y":0,"sax":.35,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.34,"eay":-1.579,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutback", +[{"x":0,"y":0,"sax":.34,"say":1.579,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.35,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutback",[{"x":0,"y":0,"sax":.035,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.242,"y":-.1,"sax":.258,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.76,"y":1.1,"sax":.025,"say":0,"eax":-.26,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.035,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinbounce", +[{"x":0,"y":0,"sax":.033,"say":.025,"eax":0,"eay":0,"se":true,"ee":false},{"x":.092,"y":0,"sax":.026,"say":.078,"eax":-.033,"eay":.025,"se":true,"ee":true},{"x":.274,"y":0,"sax":.097,"say":.319,"eax":-.026,"eay":.078,"se":true,"ee":true},{"x":.637,"y":0,"sax":.105,"say":.625,"eax":-.097,"eay":.319,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.125,"eay":-.004,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutbounce",[{"x":0,"y":0,"sax":.125,"say":.004,"eax":0,"eay":0,"se":true,"ee":false}, +{"x":.365,"y":1,"sax":.097,"say":-.319,"eax":-.105,"eay":-.625,"se":true,"ee":true},{"x":.728,"y":1,"sax":.026,"say":-.078,"eax":-.097,"eay":-.319,"se":true,"ee":true},{"x":.91,"y":1,"sax":.033,"say":-.025,"eax":-.026,"eay":-.078,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.033,"eay":-.025,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutbounce",[{"x":0,"y":0,"sax":.01,"say":.006,"eax":0,"eay":0,"se":true,"ee":false},{"x":.046,"y":0,"sax":.021,"say":.038,"eax":-.01,"eay":.006, +"se":true,"ee":true},{"x":.137,"y":0,"sax":.059,"say":.158,"eax":-.021,"eay":.038,"se":true,"ee":true},{"x":.319,"y":0,"sax":.117,"say":.744,"eax":-.059,"eay":.158,"se":true,"ee":true},{"x":.683,"y":1,"sax":.059,"say":-.158,"eax":-.117,"eay":-.744,"se":true,"ee":true},{"x":.865,"y":1,"sax":.021,"say":-.038,"eax":-.059,"eay":-.158,"se":true,"ee":true},{"x":.956,"y":1,"sax":.01,"say":-.006,"eax":-.021,"eay":-.038,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.01,"eay":-.006,"se":false,"ee":true}]); +this._AddPredifinedEase("easeincubic",[{"x":0,"y":0,"sax":.75,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.138,"eay":-.321,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutcubic",[{"x":0,"y":0,"sax":.138,"say":.321,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.75,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutcubic",[{"x":0,"y":0,"sax":.285,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.081, +"say":.272,"eax":-.081,"eay":-.272,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.285,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquad",[{"x":0,"y":0,"sax":.4,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.178,"eay":-.392,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquad",[{"x":0,"y":0,"sax":.178,"say":.392,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.4,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquad", +[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.03,"say":.065,"eax":-.03,"eay":-.065,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquart",[{"x":0,"y":0,"sax":.264,"say":.079,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.329,"eay":-1.287,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquart",[{"x":0,"y":0,"sax":.329,"say":1.287,"eax":0,"eay":0, +"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.264,"eay":-.079,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquart",[{"x":0,"y":0,"sax":.765,"say":.03,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.765,"eay":-.03,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquint",[{"x":0,"y":0,"sax":.6,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.2,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquint", +[{"x":0,"y":0,"sax":.2,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.6,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquint",[{"eax":0,"eay":0,"ee":false,"sax":.84,"say":0,"se":true,"x":0,"y":0},{"eax":-.84,"eay":0,"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPredifinedEase("easeincirc",[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.024,"eay":-.808,"se":false,"ee":true}]); +this._AddPredifinedEase("easeoutcirc",[{"x":0,"y":0,"sax":.024,"say":.808,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutcirc",[{"x":0,"y":0,"sax":.125,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.02,"say":.428,"eax":-.02,"eay":-.428,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.125,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinexpo",[{"x":0,"y":0,"sax":.66, +"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.14,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutexpo",[{"x":0,"y":0,"sax":.14,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.66,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutexpo",[{"eax":0,"eay":0,"ee":false,"sax":.345,"say":0,"se":true,"x":0,"y":0},{"eax":-.06,"eay":-.5,"ee":true,"sax":.06,"say":.5,"se":true,"x":.5,"y":.5},{"eax":-.335,"eay":0, +"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier);this._AddPrivateCustomEase("spline",this.EaseSpline)}static _AddPredifinedEase(name,dataArray_or_function,linear=false){if(typeof dataArray_or_function==="function")Ease._AddEase(name,dataArray_or_function,"predefined");else if(C3.IsArray(dataArray_or_function))if(self.BuiltInTransition){const builtInTransition=C3.New(self.BuiltInTransition,name,linear);builtInTransition.SetFromJson(dataArray_or_function); +Ease._AddEase(name,(t,sv,dv,tt)=>builtInTransition.Interpolate(t,sv,dv,tt),"predefined");BUILT_IN_TRANSITION_MAP.set(name,builtInTransition)}else{const builtInTransition=C3.New(C3.Transition,[name,dataArray_or_function.map(data=>{return[data["x"],data["y"],data["sax"],data["say"],data["eax"],data["eay"],data["se"],data["ee"]]})],false);builtInTransition.MakeLinear(linear);Ease._AddEase(name,(t,sv,dv,tt)=>builtInTransition.Interpolate(t,sv,dv,tt),"predefined")}else throw new Error("unexpected arguments"); +}static _AddPrivateCustomEase(name,func){Ease._AddEase(name,func,"private")}static AddCustomEase(name,func,project){this._CreateEaseMap();Ease._AddEase(name,func,"custom",project)}static RemoveCustomEase(name,project){if(this.IsNamePredefined(name))return;if([...PRIVATE_EASE_MAP.keys()].includes(name))return;const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);if(customEaseMap)customEaseMap.delete(name)}static _AddEase(name,func,mode,project){switch(mode){case "predefined":{EASE_MAP.set(name,func); +PREDEFINED_EASE_MAP.set(name,func);break}case "custom":{if(project){if(!CUSTOM_EASE_EDITOR_MAP.has(project))CUSTOM_EASE_EDITOR_MAP.set(project,new Map);const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);customEaseMap.set(name,func)}else CUSTOM_EASE_RUNTIME_MAP.set(name,func);break}case "private":{EASE_MAP.set(name,func);PRIVATE_EASE_MAP.set(name,func);break}default:throw new Error("unexpected ease mode");}}static NoEase(t,b,c,d){return c*t/d+b}static EaseInQuad(t,b,c,d){return c*(t/=d)*t+b}static EaseOutQuad(t, +b,c,d){return-c*(t/=d)*(t-2)+b}static EaseInOutQuad(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b}static EaseInCubic(t,b,c,d){return c*(t/=d)*t*t+b}static EaseOutCubic(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b}static EaseInOutCubic(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b}static EaseInQuart(t,b,c,d){return c*(t/=d)*t*t*t+b}static EaseOutQuart(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b}static EaseInOutQuart(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/ +2*((t-=2)*t*t*t-2)+b}static EaseInQuint(t,b,c,d){return c*(t/=d)*t*t*t*t+b}static EaseOutQuint(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b}static EaseInOutQuint(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b}static EaseInSine(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b}static EaseOutSine(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b}static EaseInOutSine(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b}static EaseInExpo(t,b,c,d){return t===0?b:c*Math.pow(2,10*(t/d-1))+ +b}static EaseOutExpo(t,b,c,d){return t===d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b}static EaseInOutExpo(t,b,c,d){if(t===0)return b;if(t===d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b}static EaseInCirc(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b}static EaseOutCirc(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b}static EaseInOutCirc(t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b}static EaseInElastic(t,b,c, +d){let s=1.70158;let p=0;let a=c;if(t===0)return b;if((t/=d)===1)return b+c;if(!p)p=d*.3;if(a{return p3-3*p2+3*p1-p0};const b=(p0,p1,p2,p3)=>{return 3*p2-6*p1+3*p0}; +const c=(p0,p1,p2,p3)=>{return 3*(p1-p0)};const calc_bezier=(aT,a,b,c)=>{return((a*aT+b)*aT+c)*aT};const get_slope=(aT,a,b,c)=>{return 3*a*aT*aT+2*b*aT+c}; +const get_t_for_x=(aX,p0,p1,p2,p3,samples)=>{if(aX==1)return 1;let intervalStart=0;let currentSampleIndex=1;let currentSampleValue=samples[currentSampleIndex];let lastSampleIndex=SAMPLE_COUNT-1;let lastSampleValue=samples[SAMPLE_COUNT-1];while(currentSampleIndex!=lastSampleIndex&¤tSampleValue<=aX){currentSampleIndex++;currentSampleValue=samples[currentSampleIndex];intervalStart+=SAMPLE_STEP}currentSampleIndex--;currentSampleValue=samples[currentSampleIndex];const dist=(aX-currentSampleValue)/ +(samples[currentSampleIndex+1]-currentSampleValue);let guess=intervalStart+dist*SAMPLE_STEP;const va=a(p0,p1,p2,p3);const vb=b(p0,p1,p2,p3);const vc=c(p0,p1,p2,p3);const initSlope=get_slope(guess,va,vb,vc);if(initSlope===0)return guess;else if(initSlope>=NEWTON_RAPHSON_MIN_SLOPE){for(let i=0;i0)aB=guess;else aA=guess;precissionLimit=Math.abs(x)>SUBDIVISION_PRECISION;maxIterations=++i0)return;C3.clearArray(this._captureListeners);this._captureListenersSet.clear();C3.clearArray(this._listeners);this._listenersSet.clear();C3.clearArray(this._queueModifyListeners);C3.Release(this)}_AddListener(func, +capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"add",func,capture});return}if(capture){if(this._captureListenersSet.has(func))return;this._captureListeners.push(func);this._captureListenersSet.add(func)}else{if(this._listenersSet.has(func))return;this._listeners.push(func);this._listenersSet.add(func)}}_RemoveListener(func,capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"remove",func,capture});return}if(capture){if(this._captureListenersSet.has(func)){this._captureListenersSet.delete(func); +C3.arrayFindRemove(this._captureListeners,func)}}else if(this._listenersSet.has(func)){this._listenersSet.delete(func);C3.arrayFindRemove(this._listeners,func)}}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return this._fireDepth>0}_ProcessQueuedListeners(){const removeListenersSet=new Set;const removeCaptureListenersSet=new Set;for(const q of this._queueModifyListeners)if(q.op==="add"){this._AddListener(q.func,q.capture);if(q.capture)removeCaptureListenersSet.delete(q.func); +else removeListenersSet.delete(q.func)}else if(q.op==="remove")if(q.capture){this._captureListenersSet.delete(q.func);removeCaptureListenersSet.add(q.func)}else{this._listenersSet.delete(q.func);removeListenersSet.add(q.func)}else throw new Error("invalid op");C3.arrayRemoveAllInSet(this._listeners,removeListenersSet);C3.arrayRemoveAllInSet(this._captureListeners,removeCaptureListenersSet);C3.clearArray(this._queueModifyListeners)}_FireCancellable(event){this._IncreaseFireDepth();let isStopped=false; +for(let i=0,len=this._captureListeners.length;i0)this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(e){if(e)this._IncreaseFireDepth();else this._DecreaseFireDepth()}_FireAsync(event){let callbackPromises=[];for(let i=0,len=this._captureListeners.length;i +func(event)))}for(let i=0,len=this._listeners.length;ifunc(event)))}return Promise.all(callbackPromises).then(()=>!event.defaultPrevented)}_FireAndWait_AsyncOptional(event){const results=[];this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i!event.defaultPrevented);else return!event.defaultPrevented}async _FireAndWaitAsync(event){return await this._FireAndWait_AsyncOptional(event)}async _FireAndWaitAsyncSequential(event){this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i0?1:timerTimeout)} +function DoAsyncifiedWork(deadline){callbackId=-1;if(!workQueue.length)return;let startTime=performance.now();let curTime=startTime;let jobCount=0;let estimatedNextJobDuration=0;do{DoNextAsyncifiedJob(workQueue.shift());curTime=performance.now();++jobCount;estimatedNextJobDuration=(curTime-startTime)/jobCount*1.1}while(workQueue.length&&(SUPPORTS_RIC&&highThroughputMode===0&&typeof deadline!=="undefined"?estimatedNextJobDuration{workQueue.push({func:func,resolve:resolve,reject:reject,stack:stack});if(asyncifyDisabled){DoNextAsyncifiedJob(workQueue.pop());return}if(callbackId===-1)SetNewCallback(SETTIMEOUT_INTERVAL)})}; +C3.Asyncify.SetHighThroughputMode=function SetHighThroughputMode(m){if(m)++highThroughputMode;else{--highThroughputMode;if(highThroughputMode<0)throw new Error("already turned off high throughput mode");}}; + +} + +// ../lib/util/idleTimeout.js +{ +'use strict';const C3=self.C3;const IDLE_CHECK_MIN_INTERVAL=1E3;const IDLE_CHECK_TIMER_OVERSHOOT=100;let cachedNowTime=-1;function ClearTimeCache(){cachedNowTime=-1}C3.FastGetDateNow=function FastGetDateNow(){if(cachedNowTime===-1){cachedNowTime=Date.now();self.setTimeout(ClearTimeCache,16)}return cachedNowTime};let timerId=-1;let nextDeadline=-1;let activeIdleTimeouts=new Set; +function CheckActiveIdleTimeouts(){timerId=-1;nextDeadline=-1;let nowTime=Date.now();for(let i of activeIdleTimeouts)if(i._CheckTimeout(nowTime)){let deadline=i._GetDeadline();if(nextDeadline===-1||deadlinenowTime+ +IDLE_CHECK_MIN_INTERVAL){self.clearTimeout(timerId);nextDeadline=this._deadline;timerId=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+IDLE_CHECK_TIMER_OVERSHOOT)}}_CheckTimeout(nowTime){if(nowTime>=this._deadline){if(this._callback()){this._deadline=nowTime+this._timeout;return true}this._isActive=false;return false}return true}_GetDeadline(){return this._deadline}Cancel(){if(this._isActive){activeIdleTimeouts.delete(this);this._isActive=false;if(activeIdleTimeouts.size===0&&timerId!==-1){self.clearTimeout(timerId); +timerId=-1;nextDeadline=-1}}}Release(){this.Cancel();this._callback=null}}; + +} + +// ../lib/util/disposable.js +{ +'use strict';const C3=self.C3; +C3.Disposable=class Disposable{constructor(disposeAction){this._disposed=false;this._disposeAction=disposeAction}Dispose(){if(this._disposed)return;this._disposed=true;if(this._disposeAction){this._disposeAction();this._disposeAction=null}}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(instance){return new Disposable(()=>instance.Release())}static From(eventDispatcher,eventNames,eventHandler,opts,scope){if(typeof opts==="undefined"||opts===null)opts=false;else if(typeof opts!== +"boolean"&&typeof opts!=="object")throw new TypeError("invalid event listener options");if(scope)eventHandler=eventHandler.bind(scope);if(eventNames.includes(" ")){eventNames=eventNames.split(" ");const disposable=new C3.CompositeDisposable;for(let eventName of eventNames){eventDispatcher.addEventListener(eventName,eventHandler,opts);disposable.Add(C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventName,eventHandler,opts)))}return disposable}else{eventDispatcher.addEventListener(eventNames, +eventHandler,opts);return C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventNames,eventHandler,opts))}}};C3.StubDisposable=class StubDisposable extends C3.Disposable{SetAction(disposeAction){this._disposeAction=disposeAction}}; +C3.CompositeDisposable=class CompositeDisposable extends C3.Disposable{constructor(...disposables){super();this._disposables=new Set;for(let disposable of disposables)this.Add(disposable)}Add(...disposables){if(this._disposed)throw new Error("already disposed");for(let disposable of disposables)this._disposables.add(disposable)}Remove(disposable){if(this._disposed)throw new Error("already disposed");this._disposables.delete(disposable)}RemoveAll(){if(this._disposed)throw new Error("already disposed"); +if(!this._disposables)return;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear()}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw new Error("already disposed");this._disposed=true;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}; + +} + +// lib/util/kahanSum.js +{ +'use strict';const C3=self.C3;C3.KahanSum=class KahanSum extends C3.DefendedBase{constructor(){super();this._c=0;this._y=0;this._t=0;this._sum=0}Add(v){v=+v;this._y=v-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(v){this._sum-=+v}Get(){return this._sum}Reset(){this._c=0;this._y=0;this._t=0;this._sum=0}Set(s){this._c=0;this._y=0;this._t=0;this._sum=+s}Copy(ks){this._c=ks._c;this._y=ks._y;this._t=ks._t;this._sum=ks._sum}Release(){}}; + +} + +// lib/util/redblackset.js +{ +'use strict';const C3=self.C3;const js_cols={};const RED=true;const BLACK=false;js_cols.RBnode=function(tree){this.tree=tree;this.right=this.tree.sentinel;this.left=this.tree.sentinel;this.parent=null;this.color=false;this.key=null};js_cols.RedBlackSet=function(compare_func){this.size=0;this.sentinel=new js_cols.RBnode(this);this.sentinel.color=BLACK;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=compare_func||this.default_compare}; +js_cols.RedBlackSet.prototype.default_compare=function(a,b){if(a0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.right!=this.sentinel)return this.min(x.right).key;var y=x.parent;while(y!=this.sentinel&&x==y.right){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null}; +js_cols.RedBlackSet.prototype.predecessor=function(key){if(this.size>0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.left!=this.sentinel)return this.max(x.left).key;var y=x.parent;while(y!=this.sentinel&&x==y.left){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null};js_cols.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};js_cols.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key}; +js_cols.RedBlackSet.prototype.get_=function(key){var x=this.root;while(x!=this.sentinel&&this.compare(x.key,key)!=0)if(this.compare(key,x.key)<0)x=x.left;else x=x.right;return x};js_cols.RedBlackSet.prototype.contains=function(key){return this.get_(key).key!=null};js_cols.RedBlackSet.prototype.getValues=function(){var ret=[];this.forEach(function(x){ret.push(x)});return ret}; +js_cols.RedBlackSet.prototype.insertAll=function(col){if(js_cols.typeOf(col)=="array")for(var i=0;icolCount)return false;var i=0;if(this.isEmpty())return true;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(js_cols.contains.call(col,col,n.key))i++;return i==this.getCount()}; +js_cols.RedBlackSet.prototype.intersection=function(col){var result=new js_cols.RedBlackSet(this.compare);if(this.isEmpty())return result;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(col.contains.call(col,n.key,n.key,this))result.insert(n.key);return result}; +C3.RedBlackSet=class RedBlackSet extends C3.DefendedBase{constructor(sortFunc){super();this._rbSet=new js_cols.RedBlackSet(sortFunc);this._enableQueue=false;this._queueInsert=new Set;this._queueRemove=new Set}Add(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.delete(item);else this._queueInsert.add(item);else this._rbSet.insert(item)}Remove(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.add(item);else this._queueInsert.delete(item);else this._rbSet.remove(item)}Has(item){if(this._enableQueue){if(this._queueInsert.has(item))return true; +return!this._queueRemove.has(item)&&this._rbSet.contains(item)}else return this._rbSet.contains(item)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw new Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return this.GetSize()===0}Front(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode"); +const rbSet=this._rbSet;const n=rbSet.min(rbSet.root);return n.key}Shift(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode");const item=this.Front();this.Remove(item);return item}SetQueueingEnabled(q){q=!!q;if(this._enableQueue===q)return;this._enableQueue=q;if(!q){for(const item of this._queueRemove)this._rbSet.remove(item);this._queueRemove.clear();for(const item of this._queueInsert)this._rbSet.insert(item);this._queueInsert.clear()}}ForEach(func){this._rbSet.forEach(func)}*values(){if(this.IsEmpty())return; +const rbSet=this._rbSet;for(let n=rbSet.min(rbSet.root);n!=rbSet.sentinel;n=rbSet.successor_(n))yield n.key}[Symbol.iterator](){return this.values()}}; + +} + +// ../lib/util/promiseThrottle.js +{ +'use strict';const C3=self.C3; +C3.PromiseThrottle=class PromiseThrottle{constructor(maxParallel=C3.hardwareConcurrency){this._maxParallel=maxParallel;this._queue=[];this._activeCount=0}Add(func){return new Promise((resolve,reject)=>{this._queue.push({func,resolve,reject});this._MaybeStartNext()})}_FindInQueue(func){for(let i=0,len=this._queue.length;i=this._maxParallel)return;this._activeCount++;const job=this._queue.shift();try{const result=await job.func();job.resolve(result)}catch(err){job.reject(err)}this._activeCount--;this._MaybeStartNext()}static async Batch(concurrency, +methods){const results=[];let failed=false;const execute=async _=>{let fn;while(fn=methods.pop()){if(failed)return;try{results.push(await fn())}catch(e){failed=true;throw e;}}};const promises=[];while(concurrency--)promises.push(execute());await Promise.all(promises);return results}}; + +} + +// ../lib/util/rateLimiter.js +{ +'use strict';const C3=self.C3; +C3.RateLimiter=class RateLimiter{constructor(callback,interval,intervalOnBattery){this._callback=callback;this._interval=interval;this._intervalOnBattery=intervalOnBattery||interval*2;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false;this._callbackArguments=null}SetCanRunImmediate(c){this._canRunImmediate=!!c}_GetInterval(){if(typeof C3.Battery!=="undefined"&&C3.Battery.IsOnBatteryPower())return this._intervalOnBattery;else return this._interval}Call(...args){if(this._timerId!== +-1)return;this._callbackArguments=args;let nowTime=C3.FastGetDateNow();let timeSinceLastCall=nowTime-this._lastCallTime;let interval=this._GetInterval();if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc,Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;const args=this._callbackArguments;this._callbackArguments=null;if(args)this._callback(...args);else this._callback(); +this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._callbackArguments=null;this._lastCallTime=C3.FastGetDateNow()}_OnTimer(){this._timerId=-1;this._lastCallTime=C3.FastGetDateNow();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._callbackArguments=null;this._timerCallFunc=null}}; + +} + +// ../lib/util/svgRaster/svgRasterManager.js +{ +'use strict';const C3=self.C3; +C3.SVGRasterManager=class SVGRasterManager{constructor(){this._images=new Map;this._allowNpotSurfaces=false;this._getBaseSizeCallback=null;this._rasterAtSizeCallback=null;this._releaseResultCallback=null;this._redrawCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(f){this._getBaseSizeCallback=f}GetBaseSize(dataSource){if(!this._getBaseSizeCallback)throw new Error("no get base size callback set");return this._getBaseSizeCallback(dataSource)}SetRasterAtSizeCallback(f){this._rasterAtSizeCallback= +f}RasterAtSize(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight){if(!this._rasterAtSizeCallback)throw new Error("no raster at size callback set");return this._rasterAtSizeCallback(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight)}SetReleaseResultCallback(f){this._releaseResultCallback=f}ReleaseResult(rasterizedResult){if(!this._releaseResultCallback)throw new Error("no release result callback set");this._releaseResultCallback(rasterizedResult)}SetRedrawCallback(f){this._redrawCallback= +f}Redraw(){if(!this._redrawCallback)throw new Error("no redraw callback set");this._redrawCallback()}AddImage(dataSource){let ret=this._images.get(dataSource);if(!ret){ret=C3.New(C3.SVGRasterImage,this,dataSource);this._images.set(dataSource,ret)}ret.IncReference();return ret}_RemoveImage(ri){this._images.delete(ri.GetDataSource())}OnTexturesChanged(){for(const ri of this._images.values()){ri.ReleaseRasterizedResult();ri.ForceRasterAgain()}}}; + +} + +// ../lib/util/svgRaster/svgRasterImage.js +{ +'use strict';const C3=self.C3;const MAX_SURFACE_SIZE=4096; +C3.SVGRasterImage=class SVGRasterImage{constructor(manager,dataSource){this._manager=manager;this._dataSource=dataSource;this._refCount=0;this._baseWidth=0;this._baseHeight=0;this._getBaseSizePromise=this._manager.GetBaseSize(dataSource).then(baseSize=>{this._baseWidth=baseSize[0];this._baseHeight=baseSize[1];this._manager.Redraw()}).catch(err=>{console.error("[SVG] Error loading SVG: ",err);this._hadError=true;this._manager.Redraw()});this._rasterSurfaceWidth=0;this._rasterSurfaceHeight=0;this._rasterImageWidth= +0;this._rasterImageHeight=0;this._isRasterizing=false;this._rasterizedResult=null;this._forceRaster=false;this._hadError=false}Release(){if(this._refCount<=0)throw new Error("already released");this._refCount--;if(this._refCount===0)this._Release()}ReleaseRasterizedResult(){if(this._rasterizedResult){this._manager.ReleaseResult(this._rasterizedResult);this._rasterizedResult=null}}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return this._refCount> +0}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=true}async StartRasterForSize(context,width,height){if(width===0||height===0||this._hadError)return;if(this._isRasterizing)return;let rasterSurfaceWidth=C3.nextHighestPowerOfTwo(Math.ceil(width));let rasterSurfaceHeight=C3.nextHighestPowerOfTwo(Math.ceil(height));const maxDim=Math.max(rasterSurfaceWidth,rasterSurfaceHeight);if(maxDim>MAX_SURFACE_SIZE){const scale=MAX_SURFACE_SIZE/maxDim;width*=scale;height*= +scale;rasterSurfaceWidth=Math.min(Math.ceil(rasterSurfaceWidth*scale),MAX_SURFACE_SIZE);rasterSurfaceHeight=Math.min(Math.ceil(rasterSurfaceHeight*scale),MAX_SURFACE_SIZE)}if(widthimageAspectRatio){width=rasterSurfaceHeight*imageAspectRatio;height=rasterSurfaceHeight}else{width=rasterSurfaceWidth;height=rasterSurfaceWidth/imageAspectRatio}}if(this._manager.IsNpotSurfaceAllowed()){rasterSurfaceWidth= +Math.ceil(width);rasterSurfaceHeight=Math.ceil(height)}if(rasterSurfaceWidth<=this._rasterSurfaceWidth&&rasterSurfaceHeight<=this._rasterSurfaceHeight&&!this._forceRaster)return;this._isRasterizing=true;this._rasterSurfaceWidth=rasterSurfaceWidth;this._rasterSurfaceHeight=rasterSurfaceHeight;const newRasterizedResult=await this._manager.RasterAtSize(this._dataSource,context,this._rasterSurfaceWidth,this._rasterSurfaceHeight,width,height);if(!this._manager)return;this.ReleaseRasterizedResult();this._rasterizedResult= +newRasterizedResult;this._rasterImageWidth=width;this._rasterImageHeight=height;this._isRasterizing=false;this._forceRaster=false;this._manager.Redraw()}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}; + +} + +// ../lib/str/str.js +{ +'use strict';const C3=self.C3;C3.UTF8_BOM="\ufeff";const NUMERIC_CHARS=new Set([..."0123456789"]);C3.IsNumericChar=function IsNumericChar(c){return NUMERIC_CHARS.has(c)};const WHITESPACE_CHARS=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);C3.IsWhitespaceChar=function IsWhitespaceChar(c){return WHITESPACE_CHARS.has(c)};C3.FilterWhitespace=function FilterWhitespace(str){return[...str].filter(ch=>!C3.IsWhitespaceChar(ch)).join("")}; +C3.IsStringAllWhitespace=function IsStringAllWhitespace(str){for(const ch of str)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsCharArrayAllWhitespace=function IsStringAllWhitespace(chArr){for(const ch of chArr)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsUnprintableChar=function IsUnprintableChar(c){return c.length===1&&c.charCodeAt(0)<32};C3.FilterUnprintableChars=function FilterUnprintableChars(str){return[...str].filter(ch=>!C3.IsUnprintableChar(ch)).join("")}; +const NUMERIC_STRING_CHARS=new Set([..."0123456789.+-e"]);C3.IsStringNumber=function IsStringNumber(str){str=str.trim();if(!str.length)return false;let firstChar=str.charAt(0);if(firstChar!=="-"&&!NUMERIC_CHARS.has(firstChar))return false;for(let ch of str)if(!NUMERIC_STRING_CHARS.has(ch))return false;return true};C3.RemoveTrailingDigits=function RemoveTrailingDigits(str){let i=str.length;while(i>0){let prev_ch=str.charAt(i-1);if(!C3.IsNumericChar(prev_ch))break;--i}return str.substr(0,i)}; +C3.IncrementNumberAtEndOf=function IncrementNumberAtEndOf(str){let baseStr=C3.RemoveTrailingDigits(str);let numberStr=str.substr(baseStr.length);if(numberStr)numberStr=(parseInt(numberStr,10)+1).toString();else numberStr="2";return baseStr+numberStr};const HTML_ENTITY_MAP=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function lookupHtmlEntity(s){return HTML_ENTITY_MAP.get(s)}const HTML_ENTITY_REGEX=/[&<>"']/g; +C3.EscapeHTML=function EscapeHTML(str){return str.replace(HTML_ENTITY_REGEX,lookupHtmlEntity)};C3.EscapeJS=function EscapeJS(str){let ret=C3.ReplaceAll(str,"\\","\\\\");ret=C3.ReplaceAll(ret,'"','\\"');ret=C3.ReplaceAll(ret,"\t","\\t");ret=C3.ReplaceAll(ret,"\r","");return C3.ReplaceAll(ret,"\n","\\n")};C3.EscapeXML=function EscapeXML(str){let ret=C3.ReplaceAll(str,"&","&");ret=C3.ReplaceAll(ret,"<","<");ret=C3.ReplaceAll(ret,">",">");return C3.ReplaceAll(ret,'"',""")}; +const ESCAPE_REGEX=/[-[\]{}()*+?.,\\^$|#\s]/g;C3.EscapeRegex=function EscapeRegex(str){return str.replace(ESCAPE_REGEX,"\\$&")};C3.FindAll=function FindAll(str,find,matchCase=false){if(!find)return[];if(!matchCase){str=str.toLowerCase();find=find.toLowerCase()}const findLen=find.length;let startIndex=0;let index=0;let ret=[];while((index=str.indexOf(find,startIndex))>-1){ret.push(index);startIndex=index+findLen}return ret}; +C3.ReplaceAll=function ReplaceAll(str,find,replace){return str.replaceAll(find,()=>replace)};C3.ReplaceAllCaseInsensitive=function ReplaceAll(str,find,replace){return str.replace(new RegExp(C3.EscapeRegex(find),"gi"),()=>replace)};C3.SetElementContent=function SetElementContent(elem,stringlike){if(typeof stringlike==="string")elem.textContent=stringlike;else if(stringlike.isPlainText())elem.textContent=stringlike.toString();else{elem.innerHTML=stringlike.toHTML();if(stringlike instanceof C3.BBString)stringlike.attachLinkHandlers(elem)}}; +C3.StringLikeEquals=function StringLikeEquals(a,b){if(a instanceof C3.HtmlString||a instanceof C3.BBString)return a.equals(b);else if(b instanceof C3.HtmlString||b instanceof C3.BBString)return b.equals(a);else return a===b};C3.StringSubstitute=function StringSubstitute(str,...arr){let ret=str;for(let i=0,len=arr.length;i=0&&highestUsedIndex>=0&&lowestMissingIndexb)return 1;else if(alowerB)return 1;else if(lowerA0){secondsTotal-=days*24*3600;parts.push(langPluralSub(".days",null,days))}}if(opts.hours){const hours=Math.floor(secondsTotal/3600);if(hours>0||parts.length){secondsTotal-=hours*3600;parts.push(langPluralSub(".hours", +null,hours))}}if(opts.minutes){const minutes=Math.floor(secondsTotal/60);if(minutes>0||parts.length||!opts.seconds){secondsTotal-=minutes*60;parts.push(langPluralSub(".minutes",null,minutes))}}if(opts.seconds){const seconds=Math.floor(secondsTotal%60);parts.push(langPluralSub(".seconds",null,seconds))}const ret=(opts.approximate?lang(".approx-prefix"):"")+parts.join(lang(".separator"));C3.Lang.PopContext();return ret}; +C3.ZeroPad=function(n,d){let s=n<0?"-":"";n=Math.abs(n);let nStr=n.toString();let zeroes=d-nStr.length;for(let i=0;it.toUpperCase())}; +C3.CompareVersionStrings=function CompareVersionStrings(v1,v2){let a1=v1.split(".").map(s=>s.trim());let a2=v2.split(".").map(s=>s.trim());C3.resizeArray(a1,4,"0");C3.resizeArray(a2,4,"0");a1=a1.map(s=>parseInt(s,10));a2=a2.map(s=>parseInt(s,10));for(let i=0;i<4;++i){const diff=a1[i]-a2[i];if(diff!==0)return diff<0?-1:1}return 0};C3.CreateGUID=function CreateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{const r=Math.floor(Math.random()*16);const v=c==="x"?r:r&3|8;return v.toString(16)})}; +C3.StringHammingDistance=function StringHammingDistance(a,b){if(a.length!==b.length)throw new Error("strings must be same length");let ret=0;for(let i=0,len=a.length;ib.length){tmp=a;a=b;b=tmp}row=Array(a.length+1);for(i=0;i<=a.length;i++)row[i]=i;for(i=1;i<=b.length;i++){prev=i;for(j=1;j<=a.length;j++){if(b[i-1]===a[j-1])val=row[j-1];else val=Math.min(row[j-1]+1,Math.min(prev+1,row[j]+1));row[j-1]=prev;prev=val}row[a.length]=prev}return row[a.length]}; + +} + +// ../lib/str/bbstring.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +const BB_CODE_MAP=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["code","code"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["tip1","abbr"],["tip2","abbr"],["tip3","abbr"],["tip4","abbr"],["tip5","abbr"],["tip6","abbr"],["tip7","abbr"],["tip8","abbr"],["tip9","abbr"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]], +["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]);const BBREGEX=/\[(\/?)([a-zA-Z0-9]+)\]/g;const CUSTOM_BBREGEX=/\[(\/?)([^\[\n]*?)\]/g;let linkActions=null;let tipList=null;let classIndex=0; +function bbToHtmlReplacerFunc(match,closeSlash,tagName){const entry=BB_CODE_MAP.get(tagName);if(entry)if(typeof entry==="string"){if(entry==="a"&&linkActions.length===0||entry==="abbr"&&tipList.length===0)return match;if(entry==="a"&&!closeSlash){const index=parseInt(tagName.substring(1),10)-1;if(index<0||index>=linkActions.length)throw new Error("invalid bbcode link substitution");const linkAction=linkActions[index];if(typeof linkAction==="string")return``;else if(typeof linkAction=== +"function")return``;else throw new TypeError("invalid bbcode link action");}else if(entry==="abbr"&&!closeSlash){const index=parseInt(tagName.substring(3),10)-1;if(index<0||index>=tipList.length)throw new Error("invalid bbcode tip substitution");const tip=tipList[index];let tipStr="";if(typeof tip==="string")tipStr=tip;else if(typeof tip==="function")tipStr=tip();if(typeof tipStr!=="string")throw new TypeError("invalid bbcode tip");return``}else return"<"+closeSlash+entry+">"}else if(Array.isArray(entry)){let tag=entry[0];let className=entry[1];if(closeSlash)return"";else return`<${tag} class="${className}">`}else;else if(tagName==="class")if(closeSlash)return"";else return``;else return match}const LINEBREAK_REGEX=/\n/g; +C3.BBString=class BBString{constructor(str,opts){this._bbstr=opts&&opts.noEscape?str:C3.EscapeHTML(str);this._htmlstr="";this._convertLineBreaks=false;this._linkActions=[];this._tipList=[];if(opts){this._convertLineBreaks=!!opts.convertLineBreaks;if(opts.links){if(opts.links.length>9)throw new Error("too many links");this._linkActions=opts.links}if(opts.tips){if(opts.tips.length>9)throw new Error("too many tips");this._tipList=opts.tips}}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion= +this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=false;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){if(this._hasAnyBBtags)return this._bbstr.replace(BBREGEX,"");else return this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let str=this._bbstr;if(this._hasAnyBBtags){classIndex= +0;linkActions=this._linkActions;tipList=this._tipList;str=str.replace(BBREGEX,bbToHtmlReplacerFunc);linkActions=null;tipList=null}if(this._needsLineBreakConversion)str=str.replace(LINEBREAK_REGEX,"
");this._htmlstr=str}return this._htmlstr}attachLinkHandlers(parentElem){if(!this._linkActions.length)return;for(let i=0,len=this._linkActions.length;i0&&bbStr.charAt(index-1)==="\\")continue;const matchStr= +result[0];const closeSlash=result[1];const tagName=result[2];const strFrag=bbStr.substring(prevIndex,index);prevIndex=index+matchStr.length;if(strFrag)this._fragments.push({text:strFrag,styles:styleStack.slice(0)});if(!tagName)continue;if(closeSlash){const lowerTagName=tagName.toLowerCase();for(let i=styleStack.length-1;i>=0;--i)if(styleStack[i].tag===lowerTagName){styleStack.splice(i,1);break}}else{let tag=tagName;let param=null;const eq=tagName.indexOf("=");if(eq!==-1){tag=tagName.substring(0,eq).toLowerCase(); +param=tagName.substring(eq+1)}else tag=tag.toLowerCase();styleStack.push({tag,param})}}if(prevIndex0&&IsWordBreakWhiteSpace(chArr.at(-1)))chArr.pop()}function IsNewline(ch){return ch==="\n"||ch==="\r\n"} +C3.WordWrap=class WordWrap{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(line,measureFunc){let width=0;let height=0;let fbbAscent=0;let fbbDescent=0;let topToAlphabeticDistance=0;for(const frag of line){if(frag.width===-1){const m=measureFunc(frag.chArr,frag.styles);frag.width=m.width;frag.height=m.height;frag.fontBoundingBoxAscent=m.fontBoundingBoxAscent||0;frag.fontBoundingBoxDescent=m.fontBoundingBoxDescent||0;frag.topToAlphabeticDistance= +m.topToAlphabeticDistance||0}width+=frag.width;height=Math.max(height,frag.height);fbbAscent=Math.max(fbbAscent,frag.fontBoundingBoxAscent);fbbDescent=Math.max(fbbDescent,frag.fontBoundingBoxDescent);topToAlphabeticDistance=Math.max(topToAlphabeticDistance,frag.topToAlphabeticDistance)}return{width,height,fontBoundingBoxAscent:fbbAscent,fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance}}_AddLine(fragments,width,height,fbbAscent,fbbDescent,topToAlphabeticDistance){this._lines.push({fragments, +width,height,fontBoundingBoxAscent:fbbAscent,fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance})}WordWrap(fragmentArr,measureFunc,wrapWidth,wrapMode,endOfLineMargin){if(typeof fragmentArr==="string")fragmentArr=[{text:fragmentArr,styles:[]}];C3.clearArray(this._lines);if(!fragmentArr.length||fragmentArr.length===1&&!fragmentArr[0].text.length||wrapWidth<2)return;fragmentArr=fragmentArr.map(frag=>({chArr:C3.SplitGraphemes(frag.text),styles:frag.styles}));if(fragmentArr.length===1){const frag= +fragmentArr[0];const chArr=frag.chArr;const styles=frag.styles;if(chArr.length<=100&&!chArr.includes("\n")){let {width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance}=measureFunc(chArr,styles);width+=endOfLineMargin;fontBoundingBoxAscent=fontBoundingBoxAscent||0;fontBoundingBoxDescent=fontBoundingBoxDescent||0;topToAlphabeticDistance=topToAlphabeticDistance||0;if(width<=wrapWidth){this._AddLine([{chArr,styles,width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance}], +width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance);return}}}let tokenisedFragments;if(wrapMode==="word")tokenisedFragments=this._TokeniseWords(fragmentArr);else{tokenisedFragments=[];for(const frag of fragmentArr)C3.appendArray(tokenisedFragments,frag.chArr.map(ch=>[{chArr:[ch],styles:frag.styles}]))}this._WrapText(tokenisedFragments,measureFunc,wrapWidth,endOfLineMargin)}_TokeniseWords(fragmentArr){const ret=[];let curWord=[];let isCurWhitespace=false;for(const frag of fragmentArr){const chArr= +frag.chArr;const styles=frag.styles;for(const ch of chArr)if(IsNewline(ch)){if(curWord.length>0)ret.push(curWord);ret.push([{chArr:["\n"],styles}]);curWord=[]}else if(curWord.length===0){curWord.push({chArr:[ch],styles});isCurWhitespace=IsWordBreakWhiteSpace(ch)}else{const isWhitespace=IsWordBreakWhiteSpace(ch);if(isWhitespace===isCurWhitespace){const curFrag=curWord.at(-1);if(curFrag.styles===styles)curFrag.chArr.push(ch);else curWord.push({chArr:[ch],styles})}else{ret.push(curWord);curWord=[];curWord.push({chArr:[ch], +styles});isCurWhitespace=isWhitespace}}}if(curWord.length>0)ret.push(curWord);return ret}_CopyLine(line){return line.map(f=>({chArr:f.chArr.slice(0),styles:f.styles,width:f.width,height:f.height,fontBoundingBoxAscent:f.fontBoundingBoxAscent,fontBoundingBoxDescent:f.fontBoundingBoxDescent,topToAlphabeticDistance:f.topToAlphabeticDistance}))}_AddWordToLine(currentLine,curWord){const lastFrag=currentLine.length?currentLine.at(-1):null;let i=0;if(lastFrag&&curWord[0].styles===lastFrag.styles){C3.appendArray(lastFrag.chArr, +curWord[0].chArr);lastFrag.width=-1;lastFrag.height=-1;lastFrag.fontBoundingBoxAscent=-1;lastFrag.fontBoundingBoxDescent=-1;lastFrag.topToAlphabeticDistance=-1;i=1}for(let len=curWord.length;i=wrapWidth){if(currentLine.length>0)this._AddLine(currentLine,currentLineWidth,currentLineHeight, +currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);currentLine=[];if(C3.IsCharArrayAllWhitespace(curWord[0].chArr)){currentLineWidth=0;currentLineHeight=0;currentLineFbbAscent=0;currentLineFbbDescent=0;currentLineTopToAlphabetic=0}else{this._AddWordToLine(currentLine,curWord);const metrics=this._MeasureLine(currentLine,measureFunc);currentLineWidth=metrics.width;currentLineHeight=metrics.height;currentLineFbbAscent=metrics.fontBoundingBoxAscent;currentLineFbbDescent=metrics.fontBoundingBoxDescent; +currentLineTopToAlphabetic=metrics.topToAlphabeticDistance}}else{currentLine=tryLine;currentLineWidth=tryLineWidth;currentLineHeight=tryMetrics.height;currentLineFbbAscent=tryMetrics.fontBoundingBoxAscent;currentLineFbbDescent=tryMetrics.fontBoundingBoxDescent;currentLineTopToAlphabetic=tryMetrics.topToAlphabeticDistance}}if(currentLine.length>0)this._AddLine(currentLine,currentLineWidth,currentLineHeight,currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);this._TrimLinesTrailingWhitespace(measureFunc, +endOfLineMargin)}_TrimLinesTrailingWhitespace(measureFunc,endOfLineMargin){for(const line of this._lines){const fragments=line.fragments;if(!fragments.length)continue;let lastFrag=fragments.at(-1);const chArr=lastFrag.chArr;const trimmedArr=chArr.slice(0);WordBreakTrimEnd(trimmedArr);if(trimmedArr.length===0){line.width-=lastFrag.width;fragments.pop()}else if(trimmedArr.length0){lastFrag=fragments.at(-1);lastFrag.width+=endOfLineMargin;line.width+=endOfLineMargin}}}Clear(){C3.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((a,v)=>Math.max(a,v.width),0)}GetTotalLineHeight(){return this._lines.reduce((a,v)=>a+v.height,0)}}; + +} + +// ../lib/gfx/gfx.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempVec3a=vec3.create();const tempVec3b=vec3.create();const tempVec3c=vec3.create();const tempVec4=vec4.create();const tempMat4=mat4.create();const neartl=vec3.create();const neartr=vec3.create();const nearbl=vec3.create();const nearbr=vec3.create();const fartl=vec3.create();const fartr=vec3.create();const farbl=vec3.create();const farbr=vec3.create(); +const unitViewport=vec4.fromValues(0,0,1,1); +C3.Gfx={Project(objx,objy,objz,mv,proj,viewport,windowCoordinate){const fTemp0=mv[0]*objx+mv[4]*objy+mv[8]*objz+mv[12];const fTemp1=mv[1]*objx+mv[5]*objy+mv[9]*objz+mv[13];const fTemp2=mv[2]*objx+mv[6]*objy+mv[10]*objz+mv[14];const fTemp3=mv[3]*objx+mv[7]*objy+mv[11]*objz+mv[15];let fTemp4=proj[0]*fTemp0+proj[4]*fTemp1+proj[8]*fTemp2+proj[12]*fTemp3;let fTemp5=proj[1]*fTemp0+proj[5]*fTemp1+proj[9]*fTemp2+proj[13]*fTemp3;let fTemp6=proj[2]*fTemp0+proj[6]*fTemp1+proj[10]*fTemp2+proj[14]*fTemp3;let fTemp7= +proj[3]*fTemp0+proj[7]*fTemp1+proj[11]*fTemp2+proj[15]*fTemp3;if(fTemp7===0)return false;fTemp7=1/fTemp7;fTemp4*=fTemp7;fTemp5*=fTemp7;fTemp6*=fTemp7;windowCoordinate[0]=(fTemp4*.5+.5)*viewport[2]+viewport[0];windowCoordinate[1]=(fTemp5*.5+.5)*viewport[3]+viewport[1];windowCoordinate[2]=(1+fTemp6)*.5;return true},Unproject(winx,winy,winz,mv,proj,viewport,objectCoordinate){const A=tempMat4;const vec=tempVec4;mat4.multiply(A,proj,mv);if(mat4.invert(A,A)===null)return false;vec[0]=(winx-viewport[0])/ +viewport[2]*2-1;vec[1]=(winy-viewport[1])/viewport[3]*2-1;vec[2]=2*winz-1;vec[3]=1;vec4.transformMat4(vec,vec,A);if(vec[3]===0)return false;vec[3]=1/vec[3];objectCoordinate[0]=vec[0]*vec[3];objectCoordinate[1]=vec[1]*vec[3];objectCoordinate[2]=vec[2]*vec[3];return true},UnprojectScreenToWorldZ(winx,winy,worldZ,mv,proj,viewport,objectCoordinate){const nearPt=tempVec3a;const farPt=tempVec3b;if(!C3.Gfx.Unproject(winx,winy,0,mv,proj,viewport,nearPt))return false;if(!C3.Gfx.Unproject(winx,winy,1,mv,proj, +viewport,farPt))return false;const dirVec=tempVec3b;vec3.subtract(dirVec,farPt,nearPt);const planeNormal=tempVec3c;vec3.set(planeNormal,0,0,1);const planeConstant=-worldZ;const denominator=vec3.dot(planeNormal,dirVec);let distance=0;if(denominator===0){const planeDistToPt=vec3.dot(planeNormal,nearPt)+planeConstant;if(planeDistToPt!==0)return false}else{distance=-(vec3.dot(nearPt,planeNormal)+planeConstant)/denominator;if(distance<0)return false}vec3.scaleAndAdd(objectCoordinate,nearPt,dirVec,distance); +return true}};function PlaneFromPoints(ptA,ptB,ptC,plane){const normal=tempVec3c;vec3.subtract(tempVec3a,ptC,ptB);vec3.subtract(tempVec3b,ptA,ptB);vec3.cross(normal,tempVec3a,tempVec3b);vec3.normalize(normal,normal);plane.set(normal[0],normal[1],normal[2],vec3.dot(ptA,normal))} +function IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const nxT=plane.xF;const nyT=plane.yF;const nzT=plane.zF;const nxF=1-nxT;const nyF=1-nyT;const nzF=1-nzT;const minD=nx*minX*nxT+nx*maxX*nxF+ny*minY*nyT+ny*maxY*nyF+nz*minZ*nzT+nz*maxZ*nzF;if(minD>=d)return true;const maxD=nx*maxX*nxT+nx*minX*nxF+ny*maxY*nyT+ny*minY*nyF+nz*maxZ*nzT+nz*minZ*nzF;return maxD>d} +function IsPointInFrontOfPlane(x,y,z,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const minD=nx*x+ny*y+nz*z;return minD>=d}class Plane{constructor(){this.x=NaN;this.y=NaN;this.z=NaN;this.w=NaN;this.xF=NaN;this.yF=NaN;this.zF=NaN}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;this.xF=x>0?1:0;this.yF=y>0?1:0;this.zF=z>0?1:0}} +C3.Gfx.ViewFrustum=class ViewFrustum{constructor(){this._leftP=new Plane;this._topP=new Plane;this._rightP=new Plane;this._bottomP=new Plane;this._nearP=new Plane;this._farP=new Plane}CalculatePlanes(mv,proj){const vp=unitViewport;C3.Gfx.Unproject(0,1,0,mv,proj,vp,neartl);C3.Gfx.Unproject(1,1,0,mv,proj,vp,neartr);C3.Gfx.Unproject(0,0,0,mv,proj,vp,nearbl);C3.Gfx.Unproject(1,0,0,mv,proj,vp,nearbr);C3.Gfx.Unproject(0,1,1,mv,proj,vp,fartl);C3.Gfx.Unproject(1,1,1,mv,proj,vp,fartr);C3.Gfx.Unproject(0,0, +1,mv,proj,vp,farbl);C3.Gfx.Unproject(1,0,1,mv,proj,vp,farbr);PlaneFromPoints(nearbl,neartl,fartl,this._leftP);PlaneFromPoints(neartl,neartr,fartr,this._topP);PlaneFromPoints(neartr,nearbr,farbr,this._rightP);PlaneFromPoints(nearbr,nearbl,farbl,this._bottomP);PlaneFromPoints(farbl,fartl,fartr,this._farP);PlaneFromPoints(nearbr,neartr,neartl,this._nearP)}ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ){return IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._leftP)&&IsInFrontOfPlane(minX,minY,minZ,maxX, +maxY,maxZ,this._topP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._rightP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._bottomP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._nearP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._farP)}IsBehindNearPlane(x,y,z){return!IsPointInFrontOfPlane(x,y,z,this._nearP)}}; + +} + +// ../lib/gfx/rendererBase.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tmpVec3a=vec3.fromValues(0,0,0);const tmpVec3b=vec3.fromValues(0,0,0);const tmpVec3c=vec3.fromValues(0,0,0);const defaultUpVector=vec3.fromValues(0,1,0);const tmpVec4=vec4.fromValues(0,0,0,0);const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1); +C3.Gfx.RendererBase=class RendererBase{constructor(){this._width=0;this._height=0;this._fovY=C3.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=mat4.create();this._matMV=mat4.create();this._zAxisScale=false;this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._spPoints=null;this._spTilemapFill=null;this._spColorFill=null;this._spLinearGradientFill=null;this._spPenumbraFill=null;this._spHardEllipseFill=null;this._spHardEllipseOutline=null;this._spSmoothEllipseFill= +null;this._spSmoothEllipseOutline=null;this._spSmoothLineFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._baseZ=0;this._currentZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack=[this._lineOffset];this._frameNumber=0;this._enableMipmaps=true;this._hasMajorPerformanceCaveat=false}FillIndexBufferData(indexData){let i=0,len= +indexData.length,fv=0;while(i=100)throw new Error("pushed too many line widths - check push/pop pairs"); +this._lineWidthStack.push(n);this._lineWidth=n}PopLineWidth(){if(this._lineWidthStack.length<=1)throw new Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(type){if(type=== +"butt")this.PushLineCapButt();else if(type==="square")this.PushLineCapSquare();else if(type==="zag")this.PushLineCapZag();else throw new Error("invalid line cap");}PushLineCapButt(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(this._lineCapStack.length>= +100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(this._lineCapStack.length<=1)throw new Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(n){this._lineOffset=n;this._lineOffsetStack[this._lineOffsetStack.length-1]=n}GetLineOffset(){return this._lineOffset}PushLineOffset(n){if(this._lineOffsetStack.length>=100)throw new Error("pushed too many line offsets - check push/pop pairs"); +this._lineOffsetStack.push(n);this._lineOffset=n}PopLineOffset(){if(this._lineOffsetStack.length<=1)throw new Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(pts){const pts_count=pts.length/2;if(pts_count<3)throw new Error("need at least 3 points");const tris=pts_count-2;const last_tri=tris-1;const p0x=pts[0];const p0y=pts[1];for(let i=0;i0)throw new Error("releasing state group still in use"); +this._renderer=null;this._shaderProgram=null;this._shaderProgramName=""}Apply(){const renderer=this._renderer;renderer.SetProgram(this._shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetColor(this._color);renderer.SetCurrentZ(this._zElevation);renderer._SetCurrentStateGroup(this)}GetKey(){return C3.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram= +null}OnContextRestored(renderer){this._shaderProgram=renderer.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw new Error("failed to restore shader program");}static MakeKey(shaderProgram_or_name,blendMode,c,zElevation){const shaderProgramName=typeof shaderProgram_or_name==="string"?shaderProgram_or_name:shaderProgram_or_name.GetName();return shaderProgramName+","+blendMode+","+c.getR()+","+c.getG()+","+c.getB()+","+c.getA()+","+zElevation}}; + +} + +// ../lib/gfx/mesh.js +{ +'use strict';const C3=self.C3;const tempQuadTex=C3.New(C3.Quad);function interpolateQuad(srcX,srcY,quad){const qtlx=quad.getTlx();const qtly=quad.getTly();const qtrx=quad.getTrx()-qtlx;const qtry=quad.getTry()-qtly;const qblx=quad.getBlx()-qtlx;const qbly=quad.getBly()-qtly;const xix=qtrx*srcX;const xiy=qtry*srcX;const yix=qblx*srcY;const yiy=qbly*srcY;return[qtlx+xix+yix,qtly+xiy+yiy]} +C3.Gfx.MeshPoint=class MeshPoint{constructor(mesh,col,row){this._mesh=mesh;this._col=col;this._row=row;this._x=NaN;this._y=NaN;this._zElevation=NaN;this._u=NaN;this._v=NaN;this._x=0;this._y=0;this._zElevation=0;this._u=0;this._v=0}_Init(x,y,u,v){this._x=x;this._y=y;this._u=u;this._v=v}GetX(){return this._x}SetX(x){if(this._x===x)return;this._x=x;this._mesh._SetPointsChanged()}GetY(){return this._y}SetY(y){if(this._y===y)return;this._y=y;this._mesh._SetPointsChanged()}GetZElevation(){return this._zElevation}SetZElevation(z){if(this._zElevation=== +z)return;this._zElevation=Math.max(z,0);this._mesh._SetPointsChanged()}GetU(){return this._u}SetU(u){this._u=u}GetV(){return this._v}SetV(v){this._v=v}_Interpolate_TexRect(srcPoint,quadPos,rcTex){[this._x,this._y]=interpolateQuad(srcPoint._x,srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;this._u=C3.lerp(rcTex.getLeft(),rcTex.getRight(),srcPoint._u);this._v=C3.lerp(rcTex.getTop(),rcTex.getBottom(),srcPoint._v)}_Interpolate_TexQuad(srcPoint,quadPos,quadTex){[this._x,this._y]=interpolateQuad(srcPoint._x, +srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;[this._u,this._v]=interpolateQuad(srcPoint._u,srcPoint._v,quadTex)}SaveToJson(){return{"x":this.GetX(),"y":this.GetY(),"z":this.GetZElevation(),"u":this.GetU(),"v":this.GetV()}}LoadFromJson(o){this.SetX(o["x"]);this.SetY(o["y"]);if(o.hasOwnProperty("z"))this.SetZElevation(o["z"]);this.SetU(o["u"]);this.SetV(o["v"])}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}}; +C3.Gfx.Mesh=class Mesh{constructor(hsize,vsize,owner){if(hsize<2||vsize<2)throw new Error("invalid mesh size");this._hsize=hsize;this._vsize=vsize;this._owner=owner||null;this._pts=[];this._minX=0;this._minY=0;this._maxX=1;this._maxY=1;this._maxZ=0;this._pointsChanged=false;const lastX=hsize-1;const lastY=vsize-1;for(let y=0;y0}GetMeshPointAt(x,y){x=Math.floor(x);y=Math.floor(y);if(x<0||x>=this._hsize||y<0||y>=this._vsize)return null;return this._pts[y][x]}CalculateTransformedMesh(srcMesh,quadPos,rcTex_or_quad){const isTexRect=rcTex_or_quad instanceof +C3.Rect;if(srcMesh.GetHSize()!==this.GetHSize()||srcMesh.GetVSize()!==this.GetVSize())throw new Error("source mesh wrong size");const srcPts=srcMesh._pts;const destPts=this._pts;for(let y=0,lenY=destPts.length;y[x,y,z];const pts=this._pts;let prevRow=pts[0];for(let y=1,lenY=pts.length;y{curX=C3.clamp(C3.lerp(curX,nextX,rayHit),0,1);curY=C3.clamp(C3.lerp(curY,nextY,rayHit),0,1);outPts.push(curX,curY)};for(let i=0,len=inPts.length;i1E6)throw new Error("Too many mesh poly points"); +const srcTlx=curCol*colWidthNorm;const srcTly=curRow*rowHeightNorm;const srcBrx=(curCol+1)*colWidthNorm;const srcBry=(curRow+1)*rowHeightNorm;isUpper=C3.isPointInTriangleInclusive(curX,curY,srcTlx,srcTly,srcBrx,srcTly,srcBrx,srcBry);if(disableCheck!==DISABLE_DIAGONAL){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcBry,-RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();isUpper=!isUpper;disableCheck=DISABLE_DIAGONAL;continue}}if(curRow>0&& +disableCheck!==DISABLE_TOP_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcTly,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curRow--;isUpper=false;disableCheck=DISABLE_BOTTOM_EDGE;continue}}if(curCol=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol++;isUpper=false;disableCheck= +DISABLE_LEFT_EDGE;continue}}if(curCol>0&&disableCheck!==DISABLE_LEFT_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcTlx,srcBry,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol--;isUpper=true;disableCheck=DISABLE_RIGHT_EDGE;continue}}if(curRow=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit(); +curRow++;isUpper=true;disableCheck=DISABLE_TOP_EDGE;continue}}break}}return C3.New(C3.CollisionPoly,outPts)}TransformCollisionPoly(srcPoly,destPoly){const ptsArr=this._TransformPolyPoints(srcPoly);this._SimplifyPoly(ptsArr);destPoly.setPoints(ptsArr)}_TransformPolyPoints(srcPoly){const outPts=[];const ptsArr=srcPoly.pointsArr();for(let i=0,len=ptsArr.length;iR_EPSILON||dx==0&&dy===0)outPts.push(curX,curY);curX=nextX;curY=nextY;lastDx=dx;lastDy=dy}if(outPts.length>=6&&outPts.lengthrow.map(pt=>pt.SaveToJson()))}}LoadFromJson(o){const cols=this.GetHSize();const rows=this.GetVSize();if(o["cols"]!==cols||o["rows"]!==rows)throw new Error("mesh data wrong size"); +const meshRows=o["points"];for(let y=0;ymaxTextureSize||this._height>maxTextureSize)throw new Error("texture data exceeds maximum texture size");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha); +gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);if(!this._renderer.SupportsNPOTTextures()&&!isPOT&&this._IsTiled()){if(data===null)throw new Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");if(data instanceof ArrayBuffer)data=new ImageData(new Uint8ClampedArray(data),this._width,this._height);if(data instanceof ImageData){const tmpCanvas=C3.CreateCanvas(this._width,this._height);const tmpCtx=tmpCanvas.getContext("2d"); +tmpCtx.putImageData(data,0,0);data=tmpCanvas}const canvas=C3.CreateCanvas(C3.nextHighestPowerOfTwo(this._width),C3.nextHighestPowerOfTwo(this._height));const ctx=canvas.getContext("2d");ctx.imageSmoothingEnabled=this._sampling!=="nearest";ctx.drawImage(data,0,0,this._width,this._height,0,0,canvas.width,canvas.height);gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,canvas)}else if(webglVersion>=2){let levels;if(this._isMipMapped)levels=Math.floor(Math.log2(Math.max(this._width, +this._height))+1);else levels=1;gl.texStorage2D(gl.TEXTURE_2D,levels,formatspec.sizedinternalformat,this._width,this._height);if(data instanceof ArrayBuffer)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this._width,this._height,formatspec.format,formatspec.type,new Uint8Array(data));else if(data!==null)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data)}else if(data instanceof ArrayBuffer)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format, +formatspec.type,new Uint8Array(data));else if(data===null)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);else gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,data);if(data!==null)this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_CreateDynamic(width,height,opts){opts=Object.assign({},CREATEFROM_DEFAULT_OPTIONS, +opts);if(this._texture)throw new Error("already created texture");this._wrapX=opts.wrapX;this._wrapY=opts.wrapY;this._sampling=opts.sampling;this._pixelFormat=opts.pixelFormat;this._isMipMapped=!!opts.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=opts.mipMapQuality;if(!VALID_WRAP_MODES.has(this._wrapX)||!VALID_WRAP_MODES.has(this._wrapY))throw new Error("invalid wrap mode");if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(!VALID_PIXEL_FORMATS.has(this._pixelFormat))throw new Error("invalid pixel format"); +if(!VALID_MIPMAP_QUALITIES.has(this._mipMapQuality))throw new Error("invalid mipmap quality");this._isStatic=false;this._width=Math.floor(width);this._height=Math.floor(height);const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);const maxTextureSize=this._renderer.GetMaxTextureSize();if(this._width<=0||this._height<=0)throw new Error("invalid texture size");if(this._width>maxTextureSize||this._height>maxTextureSize)throw new Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&& +this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat: +formatspec.internalformat;gl.texImage2D(gl.TEXTURE_2D,0,internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_GetMipMapHint(gl){if(this._mipMapQuality==="default")return this._isStatic?gl.NICEST:gl.FASTEST;else if(this._mipMapQuality==="low")return gl.FASTEST;else if(this._mipMapQuality==="high")return gl.NICEST;else throw new Error("invalid mipmap quality"); +}_IsTiled(){return this._wrapX!=="clamp-to-edge"||this._wrapY!=="clamp-to-edge"}_GetTextureWrapMode(gl,wrapMode){if(wrapMode==="clamp-to-edge")return gl.CLAMP_TO_EDGE;else if(wrapMode==="repeat")return gl.REPEAT;else if(wrapMode==="mirror-repeat")return gl.MIRRORED_REPEAT;else throw new Error("invalid wrap mode");}_SetTextureParameters(gl){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._GetTextureWrapMode(gl,this._wrapX));gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_WRAP_T,this._GetTextureWrapMode(gl,this._wrapY));if(this._sampling==="nearest"){gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);this._isMipMapped=false}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D);const useTrilinear=this._sampling=== +"trilinear"&&!this._renderer.HasMajorPerformanceCaveat();gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,useTrilinear?gl.LINEAR_MIPMAP_LINEAR:gl.LINEAR_MIPMAP_NEAREST)}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);this._isMipMapped=false}}const anisotropicExt=this._renderer._GetAnisotropicExtension();if(anisotropicExt&&this._anisotropy>0&&this._sampling!=="nearest")gl.texParameterf(gl.TEXTURE_2D,anisotropicExt["TEXTURE_MAX_ANISOTROPY_EXT"],Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(data, +opts){if((typeof HTMLImageElement==="undefined"||!(data instanceof HTMLImageElement))&&(typeof HTMLVideoElement==="undefined"||!(data instanceof HTMLVideoElement))&&(typeof HTMLCanvasElement==="undefined"||!(data instanceof HTMLCanvasElement))&&(typeof ImageBitmap==="undefined"||!(data instanceof ImageBitmap))&&(typeof OffscreenCanvas==="undefined"||!(data instanceof OffscreenCanvas))&&!(data instanceof ImageData))throw new Error("invalid texture source");if(!this._texture||this._refCount<=0)throw new Error("texture not created"); +if(this._isStatic)throw new Error("cannot update static texture");opts=Object.assign({},UPDATE_DEFAULT_OPTIONS,opts);const dataWidth=data.width||data.videoWidth;const dataHeight=data.height||data.videoHeight;const webglVersion=this._renderer.GetWebGLVersionNumber();const gl=this._renderer.GetContext();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],!!opts.flipY);const formatspec=GetFormatSpecifiers(this._pixelFormat, +gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat:formatspec.internalformat;try{if(this._width===dataWidth&&this._height===dataHeight){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}else{this._width=dataWidth;this._height=dataHeight; +const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");gl.texImage2D(gl.TEXTURE_2D,0,internalformat,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}}catch(e){console.error("Error updating WebGL texture: ",e)}gl.bindTexture(gl.TEXTURE_2D, +null);this._renderer._ResetLastTexture()}_Delete(){if(this._refCount>0)throw new Error("texture still has references");if(!this._texture)throw new Error("already deleted texture");allTextures.delete(this);const gl=this._renderer.GetContext();gl.deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(this._refCount<=0)throw new Error("no more references"); +this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let size=this._width*this._height;switch(this._pixelFormat){case "rgba8":size*=4;break;case "rgb8":size*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":size*=2;break}if(this._isMipMapped)size+=Math.floor(size/3);return size}static OnContextLost(){allTextures.clear()}static allTextures(){return allTextures.values()}}; + +} + +// ../lib/gfx/webgl/renderTarget.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4;const VALID_SAMPLINGS=new Set(["nearest","bilinear","trilinear"]);const DEFAULT_RENDERTARGET_OPTIONS={sampling:"trilinear",alpha:true,depth:false,isSampled:true,isDefaultSize:true,multisampling:0};const allRenderTargets=new Set; +C3.Gfx.WebGLRenderTarget=class WebGLRenderTarget{constructor(renderer){this._renderer=renderer;this._frameBuffer=null;this._frameBufferNoDepth=null;this._texture=null;this._renderBuffer=null;this._width=0;this._height=0;this._isDefaultSize=true;this._sampling="trilinear";this._alpha=true;this._depth=false;this._isSampled=true;this._multisampling=0;this._projectionMatrix=mat4.create();this._lastFov=0}_Create(width,height,opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,opts);const webGLVersion= +this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw new Error("already created render target");this._sampling=opts.sampling;this._alpha=!!opts.alpha;this._depth=!!opts.depth;this._isSampled=!!opts.isSampled;this._isDefaultSize=!!opts.isDefaultSize;this._multisampling=opts.multisampling;if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(this._multisampling>0&&(webGLVersion<2||this._isSampled))throw new Error("invalid use of multisampling"); +if(webGLVersion<2)this._isSampled=true;this._width=width;this._height=height;if(this._width<=0||this._height<=0)throw new Error("invalid render target size");this._CalculateProjection();const gl=this._renderer.GetContext();this._frameBuffer=gl.createFramebuffer();if(this._depth)this._frameBufferNoDepth=gl.createFramebuffer();if(this._isSampled){this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:false}); +const tex=this._texture._GetTexture();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0)}}else{this._renderBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);const internalFormat=this._alpha?gl.RGBA8:gl.RGB8;if(this._multisampling> +0){const formatSamples=gl.getInternalformatParameter(gl.RENDERBUFFER,internalFormat,gl.SAMPLES);if(formatSamples&&formatSamples[0]){const maxSamples=formatSamples[0];if(this._multisampling>maxSamples)this._multisampling=maxSamples}else this._multisampling=0}if(this._multisampling===0)gl.renderbufferStorage(gl.RENDERBUFFER,internalFormat,this._width,this._height);else gl.renderbufferStorageMultisample(gl.RENDERBUFFER,this._multisampling,internalFormat,this._width,this._height);gl.bindFramebuffer(gl.FRAMEBUFFER, +this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer)}gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,rendererDepthBuffer)}gl.bindFramebuffer(gl.FRAMEBUFFER,null);allRenderTargets.add(this)}_Resize(width,height){if(this._width===width&&this._height===height)return;this._width=width;this._height=height;this._CalculateProjection();const gl=this._renderer.GetContext();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._texture)this._texture._Update(new ImageData(this._width, +this._height));else{gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._alpha?gl.RGBA8:gl.RGB8,this._width,this._height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer)if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT, +gl.RENDERBUFFER,rendererDepthBuffer);gl.bindFramebuffer(gl.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw new Error("already deleted render target");allRenderTargets.delete(this);const gl=this._renderer.GetContext();if(this._texture){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0)}this._renderer.DeleteTexture(this._texture);this._texture=null}else if(this._renderBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null)}gl.deleteRenderbuffer(this._renderBuffer);this._renderBuffer=null}gl.bindFramebuffer(gl.FRAMEBUFFER, +null);if(this._renderer.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,null)}gl.deleteFramebuffer(this._frameBuffer);if(this._depth)gl.deleteFramebuffer(this._frameBufferNoDepth);const batchState=this._renderer.GetBatchState();batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;this._frameBuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height); +this._lastFov=this._renderer.GetFovY()}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){if(this._renderer.GetFovY()!==this._lastFov)this._CalculateProjection();return this._projectionMatrix}IsLinearSampling(){return this._sampling!=="nearest"}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const ret= +{sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};if(!this._isDefaultSize){ret.width=this._width;ret.height=this._height}return ret}IsCompatibleWithOptions(opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS,opts);if(opts.sampling!=="nearest"!==this.IsLinearSampling())return false;if(!!opts.alpha!==this.HasAlpha())return false;if(!!opts.depth!==this.HasDepthBuffer())return false;if(this._renderer.GetWebGLVersionNumber()>=2)if(!!opts.isSampled!==this.IsSampled())return false; +if(typeof opts.width==="number"||typeof opts.height==="number")return!this.IsDefaultSize()&&this.GetWidth()===opts.width&&this.GetHeight()===opts.height;else return this.IsDefaultSize()}_GetWebGLTexture(){if(!this._texture)return null;return this._texture._GetTexture()}GetEstimatedMemoryUsage(){if(this._texture)return this._texture.GetEstimatedMemoryUsage();return this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(renderer,renderTarget){const imageData=await renderer.ReadBackRenderTargetToImageData(renderTarget, +true);return await C3.ImageDataToBlob(imageData)}static OnContextLost(){allRenderTargets.clear()}static allRenderTargets(){return allRenderTargets.values()}static ResizeAll(width,height){for(const rt of allRenderTargets)if(rt.IsDefaultSize())rt._Resize(width,height)}}; + +} + +// ../lib/gfx/webgl/shaderProgram.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4;const RESERVED_UNIFORM_NAMES=new Set(["aPos","aTex","aPoints","matP","matMV","samplerFront","samplerBack","samplerDepth","destStart","destEnd","srcStart","srcEnd","srcOriginStart","srcOriginEnd","pixelSize","seconds","devicePixelRatio","layerScale","layerAngle","layoutStart","layoutEnd","color","color2_","pointTexStart","pointTexEnd","zElevation","tileSize","tileSpacing","outlineThickness"]); +C3.Gfx.WebGLShaderProgram=class WebGLShaderProgram extends C3.Gfx.ShaderProgramBase{static async Compile(renderer,fragSrc,vsSource,name){const gl=renderer.GetContext();const fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fragmentShader,fragSrc);gl.compileShader(fragmentShader);const vertexShader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vertexShader,vsSource);gl.compileShader(vertexShader);const shaderProgram=gl.createProgram();gl.attachShader(shaderProgram,fragmentShader); +gl.attachShader(shaderProgram,vertexShader);gl.bindAttribLocation(shaderProgram,0,"aPos");gl.bindAttribLocation(shaderProgram,1,"aTex");gl.bindAttribLocation(shaderProgram,2,"aPoints");gl.linkProgram(shaderProgram);const parallelShaderCompileExt=renderer._GetParallelShaderCompileExtension();if(parallelShaderCompileExt)await renderer._WaitForObjectReady(()=>gl.getProgramParameter(shaderProgram,parallelShaderCompileExt["COMPLETION_STATUS_KHR"]));else await C3.Wait(5);if(!gl.getShaderParameter(fragmentShader, +gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(fragmentShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling fragment shader: "+log);}if(!gl.getShaderParameter(vertexShader,gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(vertexShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling vertex shader: "+log);}if(!gl.getProgramParameter(shaderProgram, +gl.LINK_STATUS)){const log=gl.getProgramInfoLog(shaderProgram);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error linking shader program: "+log);}const infoLog=C3.FilterUnprintableChars(gl.getProgramInfoLog(shaderProgram)||"").trim();if(infoLog&&!C3.IsStringAllWhitespace(infoLog))console.info(`[WebGL] Shader program '${name}' compilation log: `,infoLog);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);return shaderProgram}static async Create(renderer, +shaderInfo,vsSource,name){const shaderProgram=await C3.Gfx.WebGLShaderProgram.Compile(renderer,shaderInfo.src,vsSource,name);return new C3.Gfx.WebGLShaderProgram(renderer,shaderProgram,shaderInfo,name)}constructor(renderer,shaderProgram,shaderInfo,name){super(renderer,name,shaderInfo);const gl=renderer.GetContext();const batchState=renderer.GetBatchState();renderer.EndBatch();gl.useProgram(shaderProgram);this._gl=gl;this._shaderProgram=shaderProgram;this._isDeviceTransform=name===""; +const locAPos=gl.getAttribLocation(shaderProgram,"aPos");const locATex=gl.getAttribLocation(shaderProgram,"aTex");this._locAPoints=gl.getAttribLocation(shaderProgram,"aPoints");if(locAPos!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._vertexBuffer);gl.vertexAttribPointer(locAPos,renderer.GetNumVertexComponents(),gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locAPos)}if(locATex!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._texcoordBuffer);gl.vertexAttribPointer(locATex,2,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locATex)}if(this._locAPoints!== +-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._pointBuffer);gl.vertexAttribPointer(this._locAPoints,4,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(this._locAPoints)}gl.bindBuffer(gl.ARRAY_BUFFER,null);this._uMatP=new C3.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new C3.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new C3.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new C3.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new C3.Gfx.WebGLShaderUniform(this, +"pointTexStart","vec2");this._uPointTexEnd=new C3.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new C3.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new C3.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new C3.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new C3.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new C3.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new C3.Gfx.WebGLShaderUniform(this, +"samplerBack","sampler");this._uSamplerDepth=new C3.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new C3.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new C3.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new C3.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new C3.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new C3.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new C3.Gfx.WebGLShaderUniform(this, +"srcOriginEnd","vec2");this._uPixelSize=new C3.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new C3.Gfx.WebGLShaderUniform(this,"seconds","float");this._uDevicePixelRatio=new C3.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new C3.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new C3.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new C3.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new C3.Gfx.WebGLShaderUniform(this, +"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uDevicePixelRatio.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());const customParameterDefs=shaderInfo.parameters||[];this._uCustomParameters= +[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._hasCurrentMatP=false;this._hasCurrentMatMV=false;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0, +0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const p of customParameterDefs){const uniformName=p[0];const paramType=p[2];const shaderUniform= +new C3.Gfx.WebGLShaderUniform(this,uniformName,paramType);if(paramType==="color")shaderUniform.Init3f(0,0,0);else shaderUniform.Init1f(0);this._uCustomParameters.push(shaderUniform)}if(this._isDeviceTransform)this._UpdateDeviceTransformUniforms(batchState.currentMatP);else{this.UpdateMatP(batchState.currentMatP,true);this.UpdateMatMV(batchState.currentMV,true)}const currentShader=batchState.currentShader;gl.useProgram(currentShader?currentShader._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram); +this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(paramIndex){if(paramIndex<0||paramIndex>=this._uCustomParameters.length)return null;return this._uCustomParameters[paramIndex].GetType()}AreCustomParametersAlreadySetInBatch(params){for(let i=0,len=params.length;i{const fontName=e.font.GetName();for(const f of allRendererTexts)if(f.IsBBCodeEnabled()||C3.equalsNoCase(f.GetFontName(),fontName))f._SetTextChanged()}); +function fillOrStrokeText(ctx,isStroke,text,x,y,maxWidth){if(isStroke)if(C3.Platform.BrowserEngine==="Gecko")ctx.strokeText(text,x,y,maxWidth);else ctx.strokeText(text,x,y);else if(C3.Platform.BrowserEngine==="Gecko")ctx.fillText(text,x,y,maxWidth);else ctx.fillText(text,x,y)}function fillOrStrokeRect(ctx,isStroke,x,y,w,h){if(isStroke)ctx.strokeRect(x,y,w,h);else ctx.fillRect(x,y,w,h)}function ptToPx(pt){return pt*(4/3)}let didCheckFoundBoundingBoxSupport=false; +let supportsFontBoundingBoxMeasurements=false; +C3.Gfx.RendererText=class RendererText{constructor(renderer,opts){opts=Object.assign({},DEFAULT_OPTS,opts);this._renderer=renderer;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isBold=false;this._isItalic=false;this._colorStr="black";this._isBBcodeEnabled=false;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText=C3.New(C3.WordWrap);this._wrapMode="word"; +this._textChanged=false;this._isUpdating=false;this._isAsync=true;this._drawMaxCharCount=-1;this._drawCharCount=0;this._cssWidth=0;this._cssHeight=0;this._width=0;this._height=0;this._zoom=1;this._changed=false;this._textCanvas=null;this._textContext=null;this._measureContext=null;this._measureContextTop=null;this._lastCanvasWidth=-1;this._lastCanvasHeight=-1;this._lastTextCanvasFont="";this._lastMeasureCanvasFont="";this._lastTextCanvasFillStyle="";this._lastTextCanvasOpacity=1;this._lastTextCanvasLineWidth= +1;this._measureTextCallback=(chArr,styles)=>this._MeasureText(chArr,styles);this._texture=null;this._textureWidth=0;this._textureHeight=0;this._rcTex=new C3.Rect;this._scaleFactor=1;this._needToRecreateTexture=false;this._textureTimeout=new C3.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},opts.timeout);this.ontextureupdate=null;this._wasReleased=false;allRendererTexts.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._bbString=null;this._textCanvas= +null;this._textContext=null;this._measureContext=null;this._measureContextTop=null;this._measureTextCallback=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._wrappedText=null;this._renderer=null;this._wasReleased=true;allRendererTexts.delete(this)}_SetChanged(){this._changed=true}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=true}SetIsAsync(a){this._isAsync=!!a}IsAsync(){return this._isAsync}SetBBCodeEnabled(e){e= +!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;const textBaseline=this._isBBcodeEnabled?"alphabetic":"top";if(this._textContext)this._textContext.textBaseline=textBaseline;if(this._measureContext)this._measureContext.textBaseline=textBaseline;this._SetTextChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(fontName){if(!fontName)fontName="serif";if(this._fontName===fontName)return;this._fontName=fontName;this._SetTextChanged()}GetFontName(){return this._fontName}SetFontSize(fontSize){if(fontSize< +.1)fontSize=.1;if(this._fontSize===fontSize)return;this._fontSize=fontSize;this._SetTextChanged()}SetFontSizeScale(s){if(this._fontSizeScale===s)return;this._fontSizeScale=s;this._SetTextChanged()}SetLineHeight(h){if(this._lineHeight===h)return;this._lineHeight=h;this._SetChanged()}SetBold(bold){bold=!!bold;if(this._isBold===bold)return;this._isBold=bold;this._SetTextChanged()}SetItalic(italic){italic=!!italic;if(this._isItalic===italic)return;this._isItalic=italic;this._SetTextChanged()}SetDrawMaxCharacterCount(n){n= +Math.floor(n);if(this._drawMaxCharCount===n)return;this._drawMaxCharCount=n;this._SetChanged()}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(styles,tag){for(let i=styles.length-1;i>=0;--i){const s=styles[i];if(s.tag===tag)return s}return null}_HasStyleTag(styles,tag){return!!this._GetStyleTag(styles,tag)}_GetFontString(useCssUnits,styles){let ret=[];if(this._isBold||this._HasStyleTag(styles,"b"))ret.push("bold");if(this._isItalic||this._HasStyleTag(styles,"i"))ret.push("italic"); +const sizeStyle=this._GetStyleTag(styles,"size");const fontSize=(sizeStyle?parseFloat(sizeStyle.param):this._fontSize)*this._fontSizeScale;if(useCssUnits)ret.push(fontSize+"pt");else ret.push(fontSize*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");let fontName=this._fontName;const fontStyle=this._GetStyleTag(styles,"font");if(fontStyle&&fontStyle.param){fontName=fontStyle.param;if(this.onloadfont&&!this._alreadyLoadedFonts.has(fontName)){this.onloadfont(fontName);this._alreadyLoadedFonts.add(fontName)}}if(fontName)if(GENERIC_FONT_FAMILIES.has(fontName))ret.push(fontName); +else ret.push('"'+fontName+'"');return ret.join(" ")}SetColor(c){if(c instanceof C3.Color)c=c.getCssRgb();if(this._colorStr===c)return;this._colorStr=c;this._SetChanged()}SetColorRgb(r,g,b){tempColor.setRgb(r,g,b);this.SetColor(tempColor)}SetHorizontalAlignment(h){if(!VALID_HORIZ_ALIGNMENTS.has(h))throw new Error("invalid horizontal alignment");if(this._horizontalAlign===h)return;this._horizontalAlign=h;this._SetChanged()}SetVerticalAlignment(v){if(!VALID_VERT_ALIGNMENTS.has(v))throw new Error("invalid vertical alignment"); +if(this._verticalAlign===v)return;this._verticalAlign=v;this._SetChanged()}SetWordWrapMode(m){if(!VALID_WORD_WRAP_MODES.has(m))throw new Error("invalid word wrap mode");if(this._wrapMode===m)return;this._wrapMode=m;this._SetTextChanged()}SetText(text){if(this._text===text)return;this._text=text;this._SetTextChanged()}SetSize(cssWidth,cssHeight,zoom){if(typeof zoom==="undefined")zoom=1;if(cssWidth<=0||cssWidth<=0)return;if(this._cssWidth===cssWidth&&this._cssHeight===cssHeight&&this._zoom===zoom)return; +if(this._zoom===1!==(zoom===1))this._needToRecreateTexture=true;const oldCssWidth=this._cssWidth;const oldZoom=this._zoom;this._cssWidth=cssWidth;this._cssHeight=cssHeight;this._zoom=zoom;const dpr=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*dpr;this._height=this._cssHeight*this._zoom*dpr;const maxDim=Math.max(this._width,this._height);const maxTextureSize=Math.min(this._renderer.GetMaxTextureSize(),MAX_TEXTURE_SIZE);let scale=1;if(maxDim>maxTextureSize){scale=maxTextureSize/maxDim; +this._width=Math.min(this._width*scale,maxTextureSize);this._height=Math.min(this._height*scale,maxTextureSize)}this._scaleFactor=scale;if(this._textureWidth>0&&this._textureHeight>0&&this._zoom===oldZoom)this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);if(this._cssWidth!==oldCssWidth)this._SetTextChanged();else this._SetChanged()}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText(); +return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+EXTRA_LINE_HEIGHT)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}_MaybeUpdate(){if(this._texture&&!this._changed&&!this._textChanged)return;if(this._isUpdating)return;if(this._width<=0||this._height<=0)return;this._changed=false;this._isUpdating=true;if(this._isAsync)C3.Asyncify(()=>this._DoUpdate());else this._DoUpdate()}_DoUpdate(){if(this._wasReleased)return; +this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height));this._MaybeWrapText();this._DrawTextToCanvas();this._UpdateTexture();this._textureTimeout.Reset();this._isUpdating=false}_SetTextCanvasSize(w,h){if(!this._textCanvas)this._textCanvas=C3.CreateCanvas(16,16);let wasReset=false;if(this._lastCanvasWidth!==w||this._lastCanvasHeight!==h){this._lastCanvasWidth=w;this._lastCanvasHeight=h;this._textCanvas.width=w;this._textCanvas.height=h;wasReset=true}if(!this._textContext){this._textContext= +this._textCanvas.getContext("2d");wasReset=true}if(wasReset){this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top";this._textContext.font=this._lastTextCanvasFont;this._textContext.fillStyle=this._lastTextCanvasFillStyle;this._textContext.strokeStyle=this._lastTextCanvasFillStyle;this._textContext.globalAlpha=this._lastTextCanvasOpacity;this._textContext.lineWidth=this._lastTextCanvasLineWidth}else this._textContext.clearRect(0,0,w,h)}_MaybeCreateMeasureContext(){if(this._measureContext)return; +this._measureContext=C3.CreateCanvas(16,16).getContext("2d");this._measureContextTop=C3.CreateCanvas(16,16).getContext("2d");this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top";this._measureContextTop.textBaseline="top"}_SetMeasureFontString(fontString){if(this._lastMeasureCanvasFont===fontString)return;this._lastMeasureCanvasFont=fontString;this._measureContext.font=fontString;this._measureContextTop.font=fontString}_SupportsFontBoundingBoxMeasurements(){if(!didCheckFoundBoundingBoxSupport){didCheckFoundBoundingBoxSupport= +true;this._MaybeCreateMeasureContext();const textMetrics=this._measureContext.measureText("test");supportsFontBoundingBoxMeasurements=typeof textMetrics["fontBoundingBoxAscent"]==="number"&&typeof textMetrics["fontBoundingBoxDescent"]==="number"}return supportsFontBoundingBoxMeasurements}_MaybeWrapText(){if(!this._textChanged)return;this._MaybeCreateMeasureContext();if(this._isBBcodeEnabled&&(!this._bbString||this._bbString.toString()!==this._text))this._bbString=new C3.BBString(this._text,{noEscape:true}); +this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0);this._textChanged=false}_MeasureText(chArr,styles){const text=chArr.join("");this._SetMeasureFontString(this._GetFontString(true,styles));const sizeStyle=this._GetStyleTag(styles,"size");const fontSize=(sizeStyle?parseFloat(sizeStyle.param):this._fontSize)*this._fontSizeScale;const textMetrics=this._measureContext.measureText(text);let topToAlphabeticDistance= +0;if(this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()){const textMetricsTop=this._measureContextTop.measureText(text);topToAlphabeticDistance=textMetrics["fontBoundingBoxAscent"]-textMetricsTop["fontBoundingBoxAscent"]}return{width:textMetrics.width,height:ptToPx(fontSize),fontBoundingBoxAscent:textMetrics["fontBoundingBoxAscent"]||0,fontBoundingBoxDescent:textMetrics["fontBoundingBoxDescent"]||0,topToAlphabeticDistance}}_SetDrawFontString(fontString){if(this._lastTextCanvasFont=== +fontString)return;this._lastTextCanvasFont=fontString;this._textContext.font=fontString}_SetDrawCanvasColor(styleStr){if(this._lastTextCanvasFillStyle===styleStr)return;this._lastTextCanvasFillStyle=styleStr;this._textContext.fillStyle=styleStr;this._textContext.strokeStyle=styleStr}_SetDrawCanvasOpacity(o){if(this._lastTextCanvasOpacity===o)return;this._lastTextCanvasOpacity=o;this._textContext.globalAlpha=o}_SetDrawCanvasLineWith(w){if(this._lastTextCanvasLineWidth===w)return;this._lastTextCanvasLineWidth= +w;this._textContext.lineWidth=w}_DrawTextToCanvas(){this._drawCharCount=0;const scale=this._scaleFactor*this._zoom*self.devicePixelRatio;const lineSpaceHeight=(EXTRA_LINE_HEIGHT+this._lineHeight)*scale;let penY=0;const lines=this._wrappedText.GetLines();if(lines.length===0)return;const useFontBoundingBoxMeasurements=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements();let firstLineTextHeight=lines[0].height*scale;if(this._verticalAlign==="center"){const linesTotalHeight=lines.reduce((a, +v)=>a+v.height*scale+lineSpaceHeight,0)-lineSpaceHeight;penY=Math.max(this._height/2-linesTotalHeight/2,0);if(useFontBoundingBoxMeasurements)firstLineTextHeight=lines[0].topToAlphabeticDistance*scale}else if(this._verticalAlign==="bottom"){const linesTotalHeight=lines.reduce((a,v)=>a+v.height*scale+lineSpaceHeight,0)-this._lineHeight*scale;const lastLineDescentHeight=useFontBoundingBoxMeasurements?lines.at(-1).fontBoundingBoxDescent*scale:0;penY=this._height-linesTotalHeight-lastLineDescentHeight- +2}for(let i=0,len=lines.length;i0&&penY>this._height-EXTRA_LINE_HEIGHT*scale)break}else if(i>0&&penY>=this._height-curLineTextHeight)break;if(startPenY>=0)this._DrawTextLine(line,penY,scale);if(!this._isBBcodeEnabled)penY+=curLineTextHeight;penY+=lineSpaceHeight}}_DrawTextLine(line,penY,scale){let penX=0;if(this._horizontalAlign=== +"center")penX=(this._width-line.width*scale)/2;else if(this._horizontalAlign==="right")penX=this._width-line.width*scale;for(const frag of line.fragments){this._DrawTextFragment(frag,penX,penY,scale,line.height);penX+=frag.width*scale}}_DrawTextFragment(frag,penX,penY,scale,lineHeight){const textContext=this._textContext;const lineFontScale=lineHeight/16;let fragWidth=frag.width*scale;const fragHeight=frag.height*scale;const fragFontScale=frag.height/16;const lineSpaceHeight=(EXTRA_LINE_HEIGHT+this._lineHeight)* +scale;const styles=frag.styles;let chArr=frag.chArr;if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(chArr,styles).width*scale}this._drawCharCount+=chArr.length}const backgroundStyle=this._GetStyleTag(styles,"background");const hasUnderline=this._HasStyleTag(styles,"u");const hasStrikethrough=this._HasStyleTag(styles, +"s");if(C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle&&!hasUnderline&&!hasStrikethrough||this._HasStyleTag(styles,"hide"))return;const text=chArr.join("");const offsetXStyle=this._GetStyleTag(styles,"offsetx");penX+=offsetXStyle?parseFloat(offsetXStyle.param)*scale:0;const offsetYStyle=this._GetStyleTag(styles,"offsety");penY+=offsetYStyle?parseFloat(offsetYStyle.param)*scale:0;if(backgroundStyle){this._SetDrawCanvasColor(backgroundStyle.param);textContext.fillRect(penX,penY-fragHeight,fragWidth, +fragHeight+lineSpaceHeight)}const colorStyle=this._GetStyleTag(styles,"color");this._SetDrawCanvasColor(colorStyle?colorStyle.param:this._colorStr);const opacityStyle=this._GetStyleTag(styles,"opacity");this._SetDrawCanvasOpacity(opacityStyle?parseFloat(opacityStyle.param)/100:1);const lineThicknessStyle=this._GetStyleTag(styles,"linethickness");const lineThicknessScale=lineThicknessStyle?parseFloat(lineThicknessStyle.param):1;const isStroke=this._HasStyleTag(styles,"stroke");if(isStroke)this._SetDrawCanvasLineWith(fragFontScale* +.5*lineThicknessScale*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(false,styles));fillOrStrokeText(textContext,isStroke,text,penX,penY,fragWidth);if(!isStroke){this._SetDrawCanvasLineWith(fragFontScale*.5*lineThicknessScale*this._scaleFactor*this._zoom*self.devicePixelRatio);const outlineStyle=this._GetStyleTag(styles,"outline");if(outlineStyle){this._SetDrawCanvasColor(outlineStyle.param);fillOrStrokeText(textContext,true,text,penX,penY,fragWidth)}}this._SetDrawCanvasColor(colorStyle? +colorStyle.param:this._colorStr);if(hasUnderline)fillOrStrokeRect(textContext,isStroke,penX,penY+scale*lineFontScale,fragWidth,scale*lineFontScale*lineThicknessScale);if(hasStrikethrough){const defaultStrikeY=penY-fragHeight/4;const defaultStrikeHeight=scale*fragFontScale;const strikeYMid=defaultStrikeY+defaultStrikeHeight/2;textContext.fillRect(penX,strikeYMid-defaultStrikeHeight*lineThicknessScale/2,fragWidth,defaultStrikeHeight*lineThicknessScale)}}_UpdateTexture(){if(this._renderer.IsContextLost())return; +this._textureWidth=Math.ceil(this._width);this._textureHeight=Math.ceil(this._height);this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);if(this._needToRecreateTexture){this.ReleaseTexture();this._needToRecreateTexture=false}if(!this._texture)this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:this._zoom===1,mipMapQuality:"high"});this._renderer.UpdateTexture(this._textCanvas,this._texture);if(this.ontextureupdate)this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){if(this._texture){if(!this._renderer.IsContextLost())this._renderer.DeleteTexture(this._texture); +this._texture=null}}static OnContextLost(){for(const rendererText of allRendererTexts)rendererText.ReleaseTexture()}static GetAll(){return allRendererTexts.values()}}; + +} + +// ../lib/gfx/webgl/query.js +{ +'use strict';const C3=self.C3; +class WebGLRealTimeElapsedQuery{constructor(renderer){this._gl=renderer.GetContext();this._version=renderer.GetWebGLVersionNumber();this._timerExt=renderer._GetDisjointTimerQueryExtension();this._query=null;this._isActive=false;this._hasResult=false;this._result=0;if(this._version===1)this._query=this._timerExt["createQueryEXT"]();else this._query=this._gl["createQuery"]()}Release(){this._DeleteQueryObject();this._gl=null;this._timerExt=null;this._hasResult=false}_DeleteQueryObject(){if(!this._query)return;if(this._version=== +1)this._timerExt["deleteQueryEXT"](this._query);else this._gl["deleteQuery"](this._query);this._query=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");if(this._version===1)this._timerExt["beginQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"],this._query);else this._gl["beginQuery"](this._timerExt["TIME_ELAPSED_EXT"],this._query);this._isActive=true}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");if(this._version===1)this._timerExt["endQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"]); +else this._gl["endQuery"](this._timerExt["TIME_ELAPSED_EXT"]);this._isActive=false}CheckForResult(){if(!this._query||this._hasResult||this._isActive)return;let available=false;if(this._version===1)available=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_AVAILABLE_EXT"]);else available=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT_AVAILABLE"]);const disjoint=this._gl.getParameter(this._timerExt["GPU_DISJOINT_EXT"]);if(available&&!disjoint){if(this._version=== +1)this._result=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_EXT"]);else this._result=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT"]);this._result/=1E9;this._hasResult=true}if(available||disjoint)this._DeleteQueryObject()}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw new Error("no result available");return this._result}} +C3.Gfx.WebGLTimeElapsedQuery=class WebGLTimeElapsedQuery{constructor(renderer){this._renderer=renderer;this._frameNumber=renderer.GetFrameNumber();this._isActive=false;this._parentQuery=null;this._isNested=false;this._realQuery=null;this._queries=[]}Release(){for(const q of this._queries)if(q instanceof WebGLRealTimeElapsedQuery)q.Release();C3.clearArray(this._queries);this._parentQuery=null;this._realQuery=null;this._renderer=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active"); +const stack=this._renderer._GetTimeQueryStack();if(stack.length>0){this._isNested=true;this._parentQuery=stack.at(-1);this._parentQuery._EndReal();this._parentQuery._queries.push(this)}else{this._isNested=false;this._parentQuery=null}this._isActive=true;stack.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");const top=this._renderer._GetTimeQueryStack().pop();if(top!==this)throw new Error("can only end most nested query");this._isActive=false;this._EndReal(); +if(this._parentQuery){this._parentQuery._StartReal();this._parentQuery=null}}_StartReal(){this._realQuery=C3.New(WebGLRealTimeElapsedQuery,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const q of this._queries)q.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(q=>q.HasResult())}GetResult(){return this._queries.reduce((a,v)=>a+v.GetResult(), +0)}GetFrameNumber(){return this._frameNumber}}; + +} + +// ../lib/gfx/webgl/queryResultBuffer.js +{ +'use strict';const C3=self.C3; +C3.Gfx.WebGLQueryResultBuffer=class WebGLQueryResultBuffer{constructor(renderer,maxQueries=1E3){this._renderer=renderer;this._maxQueries=maxQueries;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const q of this._buffer)q.Release();C3.clearArray(this._buffer)}AddTimeElapsedQuery(){const ret=new C3.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(ret);if(this._buffer.length>this._maxQueries){const oldest= +this._buffer.shift();oldest.Release()}return ret}CheckForResults(toFrameNumber){for(const q of this._buffer){if(q.GetFrameNumber()>=toFrameNumber)return;if(q.IsNested())return;q.CheckForResult()}}GetFrameRangeResultSum(startFrame,endFrame){if(endFrame<=startFrame)return NaN;let sum=0;for(const q of this._buffer){if(q.GetFrameNumber()>=endFrame)break;if(q.GetFrameNumber()0)this._buffer.splice(0,i);return}}}}; + +} + +// ../lib/gfx/webgl/webglRenderer.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const DEFAULT_WEBGLRENDERER_OPTS={powerPreference:"default",enableGpuProfiling:true,alpha:false,lowLatency:false,depth:false,canSampleDepth:false,maxWebGLVersion:2,failIfMajorPerformanceCaveat:false};const VALID_POWER_PREFERENCES=new Set(["default","low-power","high-performance"]);const MAX_VERTICES=8E3;const MAX_INDICES=MAX_VERTICES/2*3; +const MAX_POINTS=8E3;const LAST_POINT=MAX_POINTS-4;const PARTIAL_TEXTURE_UPLOAD_CHUNK_SIZE=256*1024;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1);const tmpProjection=mat4.create();const tmpModelView=mat4.create();const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;let loseContextExtension=null; +if(C3.isDebug){self.debug_lose_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.loseContext()};self.debug_restore_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.restoreContext()}}const pendingPolls=new Set;let pollRafId=-1; +function CheckPendingPolls(){pollRafId=-1;for(const info of pendingPolls)if(info.checkFunc()){info.resolve();pendingPolls.delete(info)}if(pendingPolls.size>0)pollRafId=self.requestAnimationFrame(CheckPendingPolls)} +C3.Gfx.WebGLRenderer=class WebGLRenderer extends C3.Gfx.RendererBase{constructor(canvas,opts){super();opts=Object.assign({},DEFAULT_WEBGLRENDERER_OPTS,opts);if(!VALID_POWER_PREFERENCES.has(opts.powerPreference))throw new Error("invalid power preference");const attribs={"alpha":!!opts.alpha,"depth":false,"antialias":false,"powerPreference":opts.powerPreference,"failIfMajorPerformanceCaveat":!!opts.failIfMajorPerformanceCaveat};if(opts.lowLatency){attribs["desynchronized"]=true;attribs["preserveDrawingBuffer"]= +true}let gl=null;let version=0;if(opts.maxWebGLVersion>=2){gl=canvas.getContext("webgl2",attribs);version=2}if(!gl){gl=canvas.getContext("webgl",attribs);version=1}if(!gl)throw new Error("failed to initialise WebGL context");this._gl=gl;this._attribs=gl.getContextAttributes();if(opts.lowLatency&&!this._attribs["desynchronized"])console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=gl.getParameter(gl.VERSION);this._version=version;this._viewport=vec4.create(); +this._didChangeTransform=false;this._bbProjectionMatrix=mat4.create();this._usesDepthBuffer=!!opts.depth;this._canSampleDepth=!!(opts.depth&&opts.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=false;this._depthBuffer=null;this._isAutoSizeDepthBuffer=true;this._depthBufferWidth=0;this._depthBufferHeight=0;this._vertexBuffer=null;this._texcoordBuffer=null;this._indexBuffer=null;this._pointBuffer=null;this._vertexData=new Float32Array(MAX_VERTICES*this.GetNumVertexComponents()); +this._indexData=new Uint16Array(MAX_INDICES);this._texcoordData=new Float32Array(MAX_VERTICES*2);this._pointData=new Float32Array(MAX_POINTS*4);this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._lastVertexPtr=0;this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._batch=[];this._batchPtr=0;this._topOfBatch=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=C3.New(C3.Gfx.BatchState,this);this._lastColor=C3.New(C3.Color,1,1,1,1);this._lastTexture0=null;this._lastTexture1= +null;this._lastSrcBlend=0;this._lastDestBlend=0;this._lastPointTexCoords=new C3.Rect;this._lastScissorRect=C3.New(C3.Rect,0,0,-1,-1);this._maxTextureSize=-1;this._minPointSize=0;this._maxPointSize=0;this._highpPrecision=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=false;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled= +!!opts.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return true}async InitState(){super.InitState();const gl=this._gl;const numVertexComponents=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture0=null;this._lastTexture1=null;this._vertexPtr=0;this._pointPtr=0;this._lastVertexPtr=MAX_VERTICES*numVertexComponents-4*numVertexComponents;C3.clearArray(this._batch);this._batchPtr= +0;this._topOfBatch=0;this._lastProgram=null;this._currentRenderTarget=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;const batchState=this._batchState;batchState.currentShader=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;vec4.set(batchState.currentColor,1,1,1,1);batchState.clearColor.setRgba(0,0,0,0);batchState.pointTexCoords.set(0,0,1,1);gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT);gl.enable(gl.BLEND);gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA); +this._lastSrcBlend=gl.ONE;this._lastDestBlend=gl.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(gl);gl.disable(gl.CULL_FACE);gl.disable(gl.STENCIL_TEST);gl.disable(gl.DITHER);if(this._usesDepthBuffer){gl.enable(gl.DEPTH_TEST);gl.depthMask(true);gl.depthFunc(gl.LEQUAL)}else{gl.disable(gl.DEPTH_TEST);gl.depthMask(false)}this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=false;this._pointBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferData(gl.ARRAY_BUFFER, +this._pointData.byteLength,gl.DYNAMIC_DRAW);this._vertexBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertexData.byteLength,gl.DYNAMIC_DRAW);this._texcoordBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texcoordData.byteLength,gl.DYNAMIC_DRAW);this._indexBuffer=gl.createBuffer();gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, +this._indexData,gl.STATIC_DRAW);gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,null);this._maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);const pointsizes=gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);this._minPointSize=pointsizes[0];this._maxPointSize=pointsizes[1];const highpVertex=gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT);const highpFrag=gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT);if(highpVertex&&highpFrag)this._highpPrecision=Math.min(highpVertex["precision"], +highpFrag["precision"]);else this._highpPrecision=0;if(this._maxPointSize>2048)this._maxPointSize=2048;this._extensions=gl.getSupportedExtensions();const debug_ext=gl.getExtension("WEBGL_debug_renderer_info");if(debug_ext){this._unmaskedVendor=gl.getParameter(debug_ext["UNMASKED_VENDOR_WEBGL"]);this._unmaskedRenderer=gl.getParameter(debug_ext["UNMASKED_RENDERER_WEBGL"])}this._parallelShaderCompileExt=gl.getExtension("KHR_parallel_shader_compile");if(C3.isDebug)loseContextExtension=gl.getExtension("WEBGL_lose_context"); +if(this._isGpuProfilingEnabled)if(this.GetWebGLVersionNumber()===1){if(C3.Platform.BrowserEngine!=="Chromium"||C3.Platform.BrowserVersionNumber>=81||typeof document!=="undefined")this._timerExt=gl.getExtension("EXT_disjoint_timer_query")}else this._timerExt=gl.getExtension("EXT_disjoint_timer_query_webgl2")||gl.getExtension("EXT_disjoint_timer_query");this._anisotropicExt=gl.getExtension("EXT_texture_filter_anisotropic");if(this._anisotropicExt)this._maxAnisotropy=gl.getParameter(this._anisotropicExt["MAX_TEXTURE_MAX_ANISOTROPY_EXT"]); +else this._maxAnisotropy=0;if(this.GetWebGLVersionNumber()<2&&this._usesDepthBuffer&&this._canSampleDepth){this._depthTextureExt=gl.getExtension("WEBGL_depth_texture");if(!this._depthTextureExt)throw new Error("no depth texture support");}if(this.GetWebGLVersionNumber()<2)this._fragDepthExt=gl.getExtension("EXT_frag_depth");const WebGLShaderProgram=C3.Gfx.WebGLShaderProgram;const vsSource=WebGLShaderProgram.GetDefaultVertexShaderSource(false);let textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_NoFragDepth(); +let textureFillVertexSrc=vsSource;let pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_NoFragDepth();let pointVertexSrc=WebGLShaderProgram.GetPointVertexShaderSource_WebGL1();let tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_NoFragDepth();let tilemapVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource(true);if(this._usesDepthBuffer&&(C3.Platform.Browser!=="Safari"||C3.Platform.BrowserVersionNumber>=15.5))if(this.GetWebGLVersionNumber()<2){if(this._fragDepthExt){textureFillFragmentSrc= +WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_FragDepthEXT();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_FragDepthEXT();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_FragDepthEXT()}}else{textureFillVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2();textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL2();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL2();pointVertexSrc= +WebGLShaderProgram.GetPointVertexShaderSource_WebGL2();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL2();tilemapVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2(true)}const DEFAULT_SHADER_PROGRAMS=[[textureFillFragmentSrc,textureFillVertexSrc,""],[textureFillFragmentSrc,textureFillVertexSrc,""],[pointFragmentSrc,pointVertexSrc,""],[WebGLShaderProgram.GetColorFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetLinearGradientFillFragmentShaderSource(), +vsSource,""],[WebGLShaderProgram.GetPenumbraFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseOutlineFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseOutlineFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothLineFillFragmentShaderSource(), +vsSource,""],[tilemapFragmentSrc,tilemapVertexSrc,""]];const defaultShaders=await Promise.all(DEFAULT_SHADER_PROGRAMS.map(i=>this.CreateShaderProgram({src:i[0]},i[1],i[2])));this._spTextureFill=defaultShaders[0];this._spDeviceTransformTextureFill=defaultShaders[1];this._spPoints=defaultShaders[2];this._spColorFill=defaultShaders[3];this._spLinearGradientFill=defaultShaders[4];this._spPenumbraFill=defaultShaders[5];this._spHardEllipseFill=defaultShaders[6];this._spHardEllipseOutline= +defaultShaders[7];this._spSmoothEllipseFill=defaultShaders[8];this._spSmoothEllipseOutline=defaultShaders[9];this._spSmoothLineFill=defaultShaders[10];this._spTilemapFill=defaultShaders[11];this.SetTextureFillMode()}async CreateShaderProgram(shaderInfo,vsSource,name){const ret=await C3.Gfx.WebGLShaderProgram.Create(this,shaderInfo,vsSource,name);this._AddShaderProgram(ret);return ret}ResetLastProgram(){this._lastProgram=null}SetSize(w,h,force){if(this._width===w&&this._height===h&&!force)return;this.EndBatch(); +const gl=this._gl;const batchState=this._batchState;this._width=w;this._height=h;this._SetViewport(0,0,w,h);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,w/h);this.SetProjectionMatrix(this._bbProjectionMatrix);if(this._spDeviceTransformTextureFill){gl.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram());this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP);this._lastProgram=this._spDeviceTransformTextureFill;this._batchState.currentShader=this._spDeviceTransformTextureFill}gl.bindTexture(gl.TEXTURE_2D, +null);gl.activeTexture(gl.TEXTURE1);gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE0);this._lastTexture0=null;this._lastTexture1=null;if(this._usesDepthBuffer&&this._isAutoSizeDepthBuffer)this._SetDepthBufferSize(this._width,this._height);if(this._currentRenderTarget)this._currentRenderTarget._Resize(this._width,this._height);gl.bindFramebuffer(gl.FRAMEBUFFER,null);this._currentRenderTarget=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null}_SetDepthBufferSize(width, +height){const gl=this._gl;if(this._depthBuffer&&this._depthBufferWidth===width&&this._depthBufferHeight===height)return;if(this._canSampleDepth){if(this._depthBuffer)gl.deleteTexture(this._depthBuffer);this._depthBuffer=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._depthBuffer);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);if(this.GetWebGLVersionNumber()>=2)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH24_STENCIL8,width,height,0,gl.DEPTH_STENCIL,gl.UNSIGNED_INT_24_8,null);else if(this._depthTextureExt)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH_STENCIL,width,height,0,gl.DEPTH_STENCIL,this._depthTextureExt["UNSIGNED_INT_24_8_WEBGL"],null);else;gl.bindTexture(gl.TEXTURE_2D,null)}else{if(this._depthBuffer)gl.deleteRenderbuffer(this._depthBuffer);this._depthBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER, +this._depthBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._version>=2?gl.DEPTH24_STENCIL8:gl.DEPTH_STENCIL,width,height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}this._depthBufferWidth=width;this._depthBufferHeight=height}SetFixedSizeDepthBuffer(width,height){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer=false;this._SetDepthBufferSize(width,height)}SetAutoSizeDepthBuffer(){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer=true;this._SetDepthBufferSize(this._width,this._height)}_SetViewport(x, +y,w,h){const viewport=this._viewport;if(viewport[0]===x&&viewport[1]===y&&viewport[2]===w&&viewport[3]===h)return;const b=this.PushBatch();b.InitSetViewport(x,y,w,h);vec4.set(viewport,x,y,w,h);this._topOfBatch=0}SetFovY(f){super.SetFovY(f);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetProjectionMatrix(matP){if(mat4.exactEquals(this._matP,matP))return;const b=this.PushBatch();b.InitSetProjection(matP);mat4.copy(this._matP,matP);this._topOfBatch=0;this._didChangeTransform= +true}SetDefaultRenderTargetProjectionState(){let projectionMatrix;let viewportWidth,viewportHeight;const currentRenderTarget=this._currentRenderTarget;if(currentRenderTarget===null){projectionMatrix=this._bbProjectionMatrix;viewportWidth=this.GetWidth();viewportHeight=this.GetHeight()}else{projectionMatrix=currentRenderTarget.GetProjectionMatrix();viewportWidth=currentRenderTarget.GetWidth();viewportHeight=currentRenderTarget.GetHeight()}this.SetProjectionMatrix(projectionMatrix);this._SetViewport(0, +0,viewportWidth,viewportHeight)}SetModelViewMatrix(matMV){if(mat4.exactEquals(this._matMV,matMV))return;const b=this.PushBatch();b.InitSetModelView(matMV);mat4.copy(this._matMV,matMV);this._topOfBatch=0;this._didChangeTransform=true}ResetDidChangeTransformFlag(){this._didChangeTransform=false}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const batch=this._batch;if(this._batchPtr===batch.length)batch.push(new C3.Gfx.WebGLBatchJob(this._batchState)); +return batch[this._batchPtr++]}EndBatch(){if(this._batchPtr===0)return;if(this.IsContextLost())return;this._WriteBuffers();this._ExecuteBatch();this._batchPtr=0;this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._topOfBatch=0}_WriteBuffers(){const gl=this._gl;if(this._pointPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr))}if(this._vertexPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferSubData(gl.ARRAY_BUFFER, +0,this._vertexData.subarray(0,this._vertexPtr));gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr))}}_ExecuteBatch(){const batch=this._batch;for(let i=0,len=this._batchPtr;i=this._lastVertexPtr){this.EndBatch();v=0}if(this._topOfBatch===1)this._batch[this._batchPtr-1]._indexCount+=6;else{const b=this.PushBatch();b.InitQuad(v,6);this._topOfBatch=1}}_WriteQuadToVertexBuffer(quad){quad.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(quad){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);defaultTexCoordsQuad.writeToTypedArray(this._texcoordData, +this._texPtr);this._texPtr+=8}Quad2(tlx,tly,trx,try_,brx,bry,blx,bly){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z;vd[v++]=trx;vd[v++]=try_;vd[v++]=z;vd[v++]=brx;vd[v++]=bry;vd[v++]=z;vd[v++]=blx;vd[v++]=bly;vd[v++]=z;this._vertexPtr=v;defaultTexCoordsQuad.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(quad,rcTex){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);rcTex.writeAsQuadToTypedArray(this._texcoordData, +this._texPtr);this._texPtr+=8}Quad4(quad,uv){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,rcTex){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr= +v;rcTex.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D2(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,uv){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr=v;uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(mode, +curTex){mat4.copy(tmpProjection,this._matP);mat4.copy(tmpModelView,this._matMV);this.SetDefaultRenderTargetProjectionState();const [width,height]=this.GetRenderTargetSize(this._currentRenderTarget);const tempMat4b=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ(height),0,0,0,height);this.SetModelViewMatrix(tempMat4b);if(mode==="crop"&&this._currentRenderTarget&&curTex){const left=this._width/2;const top=this._height/2;const srcW=curTex.GetWidth();const srcH=curTex.GetHeight();const destW= +this._currentRenderTarget.GetWidth();const destH=this._currentRenderTarget.GetHeight();const copyW=Math.min(destW,srcW);const copyH=Math.min(destH,srcH);const srcOffY=Math.max(srcH-destH,0);const destOffY=Math.max(destH-srcH,0);tmpRect.set(-left,top-destOffY,-left+copyW,top-copyH-destOffY);tmpQuad.setFromRect(tmpRect);tmpRect.set(0,srcOffY,copyW,copyH+srcOffY);tmpRect.divide(srcW,srcH);this.Quad3(tmpQuad,tmpRect)}else{const halfW=width/2;const halfH=height/2;this.Rect2(-halfW,halfH,halfW,-halfH)}this.SetProjectionMatrix(tmpProjection); +this.SetModelViewMatrix(tmpModelView)}StartRenderingPoints(rect){if(this._lastPointTexCoords.equals(rect))return;this._lastPointTexCoords.copy(rect);const b=this.PushBatch();b.InitSetPointTexCoords(rect);this._topOfBatch=0}FinishRenderingPoints(){}Point(x_,y_,size_,opacity_){if(this._pointPtr>=LAST_POINT)this.EndBatch();let p=this._pointPtr;const z=this._baseZ+this._currentZ;if(this._topOfBatch===2&&this._lastPointZ===z)this._batch[this._batchPtr-1]._indexCount++;else{const b=this.PushBatch();b.InitPoints(p, +z);this._topOfBatch=2;this._lastPointZ=z}const pd=this._pointData;pd[p++]=x_;pd[p++]=y_;pd[p++]=size_;pd[p++]=opacity_;this._pointPtr=p}SetProgram(program){if(this._lastProgram===program)return;const b=this.PushBatch();b.InitSetProgram(program);this._lastProgram=program;this._topOfBatch=0;this._currentStateGroup=null}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(c){const b=this.PushBatch();b.InitSetGradientColor(c);this._topOfBatch=0}SetEllipseParams(pixelW, +pixelH,outlineThickness=1){const b=this.PushBatch();b.InitSetEllipseParams(pixelW,pixelH,outlineThickness);this._topOfBatch=0}SetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY){if(this._lastProgram!==this._spTilemapFill)throw new Error("must set tilemap fill mode first");const b=this.PushBatch();b.InitSetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY);this._topOfBatch=0}SetProgramParameters(backTex,destRect, +srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time){const s=this._lastProgram;if(!s._hasAnyOptionalUniforms||s.AreOptionalUniformsAlreadySetInBatch(destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time))return;const b=this.PushBatch();b.InitSetProgramParameters();s.SetOptionalUniformsInBatch(destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time);const mat4param=b._mat4param;mat4param[0]= +pixelWidth;mat4param[1]=pixelHeight;destRect.writeToTypedArray(mat4param,2);mat4param[6]=layerScale;mat4param[7]=layerAngle;srcRect.writeToTypedArray(mat4param,12);const colorParam=b._colorParam;layoutRect.writeToTypedArray(colorParam,0);const tmp=colorParam[1];colorParam[1]=colorParam[3];colorParam[3]=tmp;srcOriginRect.writeToTypedArray(b._srcOriginRect,0);b._startIndex=time;b._indexCount=dpr;if(s._uSamplerBack.IsUsed())b._texParam=backTex?backTex.GetTexture():null;else b._texParam=null;this._topOfBatch= +0}SetProgramCustomParameters(params){const s=this._lastProgram;if(params.length===0||s.AreCustomParametersAlreadySetInBatch(params))return;const b=this.PushBatch();b.InitSetProgramCustomParameters();s.SetCustomParametersInBatch(params);C3.shallowAssignArray(b._shaderParams,params);this._topOfBatch=0}ClearRgba(r,g,b_,a){const b=this.PushBatch();b.InitClearSurface2(r,g,b_,a);this._topOfBatch=0}Clear(c){const b=this.PushBatch();b.InitClearSurface(c);this._topOfBatch=0}Start(){}Finish(){super.Finish(); +this._gl.flush()}ClearDepth(){if(!this._usesDepthBuffer||!this._currentRenderTarget||!this._currentRenderTarget.HasDepthBuffer())return;const batch=this.PushBatch();batch.InitClearDepth(this._isDepthEnabled);this._topOfBatch=0}SetDepthEnabled(e){e=!!e;if(this._isDepthEnabled===e)return;if(!this._usesDepthBuffer)return;this._isDepthEnabled=e;const batch=this.PushBatch();batch.InitSetDepthEnabled(e);this._topOfBatch=0}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(e){e= +!!e;if(!this._canSampleDepth)return;if(this._isDepthSamplingEnabled===e)return;if(e&&this.IsDepthEnabled())throw new Error("depth still enabled");this._isDepthSamplingEnabled=e;const batch=this.PushBatch();batch.InitSetDepthSamplingEnabled(e);this._topOfBatch=0}SetScissorRect(x,y,w,h,rtHeight_=0){x=Math.floor(x);y=Math.floor(y);w=Math.floor(w);h=Math.floor(h);if(this._lastScissorRect.equalsWH(x,y,w,h))return;this._lastScissorRect.setWH(x,y,w,h);const rtHeight=rtHeight_||this.GetRenderTargetSize(this.GetRenderTarget())[1]; +y=rtHeight-y-h;const batch=this.PushBatch();batch.InitSetScissor(true,x,y,w,h);this._topOfBatch=0}RemoveScissorRect(){if(this._lastScissorRect.getRight()===-1)return;this._lastScissorRect.set(0,0,-1,-1);const batch=this.PushBatch();batch.InitSetScissor(false,0,0,0,0);this._topOfBatch=0}CheckForQueryResults(){for(const qrb of this._allQueryResultBuffers)qrb.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost(); +C3.Gfx.WebGLRendererTexture.OnContextLost();C3.Gfx.WebGLRenderTarget.OnContextLost();C3.Gfx.RendererText.OnContextLost();for(const qrb of this._allQueryResultBuffers)qrb.Clear();this._extensions=[];this._timerExt=null;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt=null;this._maxAnisotropy=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._depthBuffer= +null;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=true;await this.InitState();this._isInitialisingAfterContextRestored=false;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextRestored(this);this.SetSize(this._width,this._height,true)}CreateStaticTexture(data,opts){if(this.IsContextLost())throw new Error("context lost");this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture, +this);rendererTex._CreateStatic(data,opts);return rendererTex}async CreateStaticTextureAsync(data,opts){if(this.IsContextLost())throw new Error("context lost");opts=Object.assign({},opts);if(C3.Supports.ImageBitmapOptions&&(C3.Platform.Browser!=="Safari"||!(data instanceof ImageData)||typeof Image==="undefined")){let imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"premultiply"});const isTiled=opts.wrapX&&opts.wrapX!=="clamp-to-edge"||opts.wrapY&&opts.wrapY!=="clamp-to-edge";const isPOT= +C3.isPOT(imageBitmap.width)&&C3.isPOT(imageBitmap.height);if(!this.SupportsNPOTTextures()&&!isPOT&&isTiled)if(C3.Supports.ImageBitmapOptionsResize){imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"premultiply","resizeWidth":C3.nextHighestPowerOfTwo(imageBitmap.width),"resizeHeight":C3.nextHighestPowerOfTwo(imageBitmap.height)});opts.premultiplyAlpha=false}else imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"none"});else opts.premultiplyAlpha=false;return await C3.Asyncify(()=> +this.CreateStaticTexture(imageBitmap,opts))}else{if(data instanceof Blob){if(typeof Image==="undefined")throw new Error("texture upload variant not supported in worker");const img=await C3.BlobToImage(data);data=img}return await C3.Asyncify(()=>this.CreateStaticTexture(data,opts))}}CreateDynamicTexture(width,height,opts){this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture,this);rendererTex._CreateDynamic(width,height,opts);return rendererTex}UpdateTexture(data,rendererTex,opts){this.EndBatch(); +rendererTex._Update(data,opts)}DeleteTexture(rendererTex){if(!rendererTex)return;rendererTex.SubtractReference();if(rendererTex.GetReferenceCount()>0)return;this.EndBatch();if(rendererTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0=null}if(rendererTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1);this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0);this._lastTexture1=null}rendererTex._Delete()}CreateRenderTarget(opts){let width= +this._width;let height=this._height;let isDefaultSize=true;if(opts){if(typeof opts.width==="number"){width=opts.width;isDefaultSize=false}if(typeof opts.height==="number"){height=opts.height;isDefaultSize=false}}if(width<=0||height<=0)throw new Error("invalid size");this.EndBatch();const renderTarget=C3.New(C3.Gfx.WebGLRenderTarget,this);renderTarget._Create(width,height,Object.assign({isDefaultSize},opts));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth= +null;return renderTarget}SetRenderTarget(renderTarget,updateProjection=true){if(renderTarget===this._currentRenderTarget)return;if(renderTarget&&renderTarget.IsDefaultSize())renderTarget._Resize(this._width,this._height);const b=this.PushBatch();b.InitSetRenderTarget(renderTarget);this._currentRenderTarget=renderTarget;this._topOfBatch=0;if(updateProjection)this.SetDefaultRenderTargetProjectionState()}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(renderTarget){if(renderTarget)return[renderTarget.GetWidth(), +renderTarget.GetHeight()];else return[this._width,this._height]}CopyRenderTarget(renderTarget,mode="stretch"){if(this._version<2||this._currentRenderTarget&&this._currentRenderTarget.GetMultisampling()>0){this.SetCopyBlend();this.ResetColor();this.DrawRenderTarget(renderTarget,mode)}else{const b=this.PushBatch();b.InitBlitFramebuffer(renderTarget,this._currentRenderTarget,mode);this._topOfBatch=0}}DrawRenderTarget(renderTarget,mode="stretch"){const tex=renderTarget.GetTexture();if(!tex)throw new Error("not a texture-backed render target"); +this.SetTexture(tex);this.FullscreenQuad(mode,tex)}InvalidateRenderTarget(renderTarget){if(this._version<2)return;const b=this.PushBatch();b.InitInvalidateFramebuffer(renderTarget._GetFramebuffer());this._topOfBatch=0}DeleteRenderTarget(renderTarget){this.SetRenderTarget(null);this.EndBatch();const renderTex=renderTarget.GetTexture();if(renderTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0=null}if(renderTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1); +this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0);this._lastTexture1=null}renderTarget._Delete()}async ReadBackRenderTargetToImageData(renderTarget,forceSynchronous,areaRect){this.EndBatch();const oldRenderTarget=this._currentRenderTarget;let width,height,framebuffer;if(renderTarget){width=renderTarget.GetWidth();height=renderTarget.GetHeight();framebuffer=renderTarget._GetFramebuffer()}else{width=this.GetWidth();height=this.GetHeight();framebuffer=null}let x= +0;let y=0;let areaWidth=width;let areaHeight=height;if(areaRect){x=C3.clamp(Math.floor(areaRect.getLeft()),0,width-1);y=C3.clamp(Math.floor(areaRect.getTop()),0,height-1);let w=areaRect.width();if(w===0)w=width-x;else w=C3.clamp(Math.floor(w),0,width-x);let h=areaRect.height();if(h===0)h=height-y;else h=C3.clamp(Math.floor(h),0,height-y);areaWidth=w;areaHeight=h;y=height-(y+areaHeight)}const gl=this._gl;gl.bindFramebuffer(gl.FRAMEBUFFER,framebuffer);const restorePreviousRenderTarget=()=>{gl.bindFramebuffer(gl.FRAMEBUFFER, +null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(oldRenderTarget)};let imageData;if(!forceSynchronous&&this.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,framebuffer);const pixelBuffer=gl.createBuffer();const bufferSize=areaWidth*areaHeight*4;const PIXEL_PACK_BUFFER=gl["PIXEL_PACK_BUFFER"];gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl.bufferData(PIXEL_PACK_BUFFER,bufferSize,gl["STREAM_READ"]); +gl.readPixels(x,y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,0);gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.bindBuffer(PIXEL_PACK_BUFFER,null);restorePreviousRenderTarget();const sync=gl["fenceSync"](gl["SYNC_GPU_COMMANDS_COMPLETE"],0);await this._WaitForObjectReady(()=>gl["getSyncParameter"](sync,gl["SYNC_STATUS"])===gl["SIGNALED"]);gl["deleteSync"](sync);imageData=new ImageData(areaWidth,areaHeight);gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl["getBufferSubData"](PIXEL_PACK_BUFFER,0,new Uint8Array(imageData.data.buffer), +0,bufferSize);gl.bindBuffer(PIXEL_PACK_BUFFER,null);gl.deleteBuffer(pixelBuffer)}else{imageData=new ImageData(areaWidth,areaHeight);gl.readPixels(x,y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(imageData.data.buffer));restorePreviousRenderTarget()}return imageData}CoplanarStartStencilPass(){this.SetDepthEnabled(true);const batch=this.PushBatch();batch.InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(false);const batch=this.PushBatch(); +batch.InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(true);const batch=this.PushBatch();batch.InitCoplanarRestore();this._topOfBatch=0}StartQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitStartQuery(query);this._topOfBatch=0}EndQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitEndQuery(query);this._topOfBatch=0}_WaitForObjectReady(checkFunc){const ret=new Promise(resolve=>pendingPolls.add({resolve, +checkFunc}));if(pollRafId===-1)pollRafId=self.requestAnimationFrame(CheckPendingPolls);return ret}IsDesynchronized(){return!!this._attribs["desynchronized"]}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs["alpha"]?4:3)}GetEstimatedRenderBufferMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRenderTarget.allRenderTargets()){if(t.GetTexture())continue;ret+=t.GetEstimatedMemoryUsage()}return ret}GetEstimatedTextureMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRendererTexture.allTextures())ret+= +t.GetEstimatedMemoryUsage();return ret}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return this.GetWebGLVersionNumber()>=2}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return this._highpPrecision!== +0}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(qrb){this._allQueryResultBuffers.add(qrb)}_RemoveQueryResultBuffer(qrb){this._allQueryResultBuffers.delete(qrb)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(gl){this._InitBlendModeData([["normal", +gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["additive",gl.ONE,gl.ONE],["xor",gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["copy",gl.ONE,gl.ZERO],["destination-over",gl.ONE_MINUS_DST_ALPHA,gl.ONE],["source-in",gl.DST_ALPHA,gl.ZERO],["destination-in",gl.ZERO,gl.SRC_ALPHA],["source-out",gl.ONE_MINUS_DST_ALPHA,gl.ZERO],["destination-out",gl.ZERO,gl.ONE_MINUS_SRC_ALPHA],["source-atop",gl.DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],["destination-atop",gl.ONE_MINUS_DST_ALPHA,gl.SRC_ALPHA]])}CreateRendererText(){return C3.New(C3.Gfx.RendererText, +this)}CreateWebGLText(){return this.CreateRendererText()}}; + +} + +// ../lib/gfx/effectCompositor/effectChainManager.js +{ +'use strict';const C3=self.C3;const DEFAULT_CTOR_OPTS={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null}; +C3.Gfx.EffectChainManager=class EffectChainManager{constructor(opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._cbGetDrawSize=opts.getDrawSize;this._cbGetRenderTarget=opts.getRenderTarget;this._cbReleaseRenderTarget=opts.releaseRenderTarget;this._cbGetTime=opts.getTime;this._cbRedraw=opts.redraw;this._webgpuBackTexture=null}GetDrawSize(renderer){if(this._cbGetDrawSize)return this._cbGetDrawSize(renderer);else return[renderer.GetWidth(),renderer.GetHeight()]}GetRenderTarget(effectChain){return this._cbGetRenderTarget(effectChain)}ReleaseRenderTarget(rt, +effectChain){this._cbReleaseRenderTarget(rt,effectChain)}GetTime(){return this._cbGetTime()}Redraw(effectChain){this._cbRedraw(effectChain)}_GetWebGPUBackTexture(renderer,width,height){if(this._webgpuBackTexture&&(this._webgpuBackTexture.GetWidth()!==width||this._webgpuBackTexture.GetHeight()!==height)){renderer.DeleteTexture(this._webgpuBackTexture);this._webgpuBackTexture=null}if(this._webgpuBackTexture===null)this._webgpuBackTexture=renderer.CreateStaticTexture(null,{width,height,sampling:"nearest", +mipMap:false});return this._webgpuBackTexture}}; + +} + +// ../lib/gfx/effectCompositor/effectChain.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const mat4=glMatrix.mat4;const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);const tempRect3=C3.New(C3.Rect);const tempRect4=C3.New(C3.Rect);const tempMat4a=mat4.create();const tempMat4b=mat4.create();const DEFAULT_CTOR_OPTS={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:false}; +const DEFAULT_BUILDSTEPS_OPTS={indexMap:null,forcePreDraw:false,forcePostDraw:false,is3D:false,isSourceTextureRotated:false,isRotatedOrNegativeSizeInstance:false,useFullSurface:false}; +C3.Gfx.EffectChain=class EffectChain{constructor(manager,opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._manager=manager;this._cbDrawContent=opts.drawContent;this._cbGetSourceTextureInfo=opts.getSourceTextureInfo;this._cbGetShaderParameters=opts.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._blendMode=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending=false; +this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._didChangeTransform=false;this._depthEnabledAtStart=false;this._canUseFastPath=false;this._useFullSurface=false;this._isSourceTextureRotated=false;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!opts.invalidateRenderTargets;this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._drawWidth=0;this._drawHeight=0;this._contentObject= +null;this._contextObject=null;this._layoutRect=C3.New(C3.Rect);this._drawSurfaceRect=C3.New(C3.Rect);this._rcTexOriginal=C3.New(C3.Rect);this._rcTexBounce=C3.New(C3.Rect);this._rcTexDest=C3.New(C3.Rect);this._devicePixelRatio=1;this._layerScale=1;this._layerAngle=0;this._time=0;this._destRenderTarget=null;this._backTex=null;this._compositOffX=0;this._compositOffY=0;this._updateOwnProjection=false;this._projectionMatrix=mat4.create();this._modelViewMatrix=mat4.create()}Release(){C3.clearArray(this._steps); +C3.clearArray(this._shaderProgramList);C3.clearArray(this._shaderProgramIndices);this._contentObject=null;this._contextObject=null;this._cbDrawContent=null;this._cbGetSourceTextureInfo=null;this._cbGetShaderParameters=null}BuildSteps(shaderProgramList,opts){opts=Object.assign({},DEFAULT_BUILDSTEPS_OPTS,opts);C3.clearArray(this._steps);this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending=false; +this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!opts.isSourceTextureRotated;this._useFullSurface=!!opts.useFullSurface;C3.shallowAssignArray(this._shaderProgramList,shaderProgramList);if(shaderProgramList.length===0)return;if(opts.indexMap){if(opts.indexMap.length!==shaderProgramList.length)throw new Error("incorrect indexMap length");C3.shallowAssignArray(this._shaderProgramIndices, +opts.indexMap)}else{C3.clearArray(this._shaderProgramIndices);for(let i=0,len=shaderProgramList.length;i=1?this._GetRenderTarget():null;this._renderTargets[2]=this._numTempSurfacesRequired===2?this._GetRenderTarget():null;for(const step of this._steps){const srcTarget=this._GetRenderTargetForId(step.GetSrcTargetId());const destTarget=this._GetRenderTargetForId(step.GetDestTargetId());if(renderer.IsWebGPU())step.Run_WebGPU(renderer,srcTarget,destTarget);else step.Run_WebGL(renderer,srcTarget,destTarget)}if(this._renderTargets[1])this._ReleaseRenderTarget(this._renderTargets[1]); +if(this._renderTargets[2])this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(renderer);this._destRenderTarget=null;this._backTex=null;this._contentObject=null;this._contextObject=null;this._cbDrawContentHook=null}_CalculateDrawSizeAndRectangles(renderer,opts){const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);this._SetDrawSize(renderer,drawWidth,drawHeight);this._CalculateRectangles(opts)}_SetDrawSize(renderer,drawWidth,drawHeight){if(drawWidth<= +0||drawHeight<=0)throw new Error("invalid draw size");if(this._drawWidth!==drawWidth||this._drawHeight!==drawHeight)this._CalculateDeviceTransformMatrices(renderer,drawWidth,drawHeight,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=drawWidth;this._drawHeight=drawHeight}_CalculateDeviceTransformMatrices(renderer,width,height,offX,offY,projMat,mvMat){const scrollX=width/2+offX;const scrollY=height/2+offY;renderer.CalculatePerspectiveMatrix(projMat,width/height);const tempMat4=renderer.CalculateLookAtModelView2(scrollX, +scrollY,renderer.GetDefaultCameraZ(height),scrollX,scrollY,0,height);mat4.copy(mvMat,tempMat4)}_CalculateRectangles(opts){this._layoutRect.copy(opts.layoutRect);if(opts.drawSurfaceRect)this._drawSurfaceRect.copy(opts.drawSurfaceRect);else this._drawSurfaceRect.set(0,0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);const boxScale=this._layerScale*this._devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal* +boxScale,this._boxExtendVertical*boxScale);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight);this._drawSurfaceRect.clamp(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,this._drawHeight)}_OnBeforeStartEffectChain(renderer){this._depthEnabledAtStart=renderer.IsDepthEnabled();if(this._useFullSurface){renderer.SetDepthEnabled(false);if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}else{tempRect.copy(this._drawSurfaceRect); +if(renderer.IsWebGL()){const boxScale=this._layerScale*this._devicePixelRatio;tempRect.inflate(Math.max(this._boxExtendHorizontal,1)*boxScale,Math.max(this._boxExtendVertical,1)*boxScale);tempRect.roundOuter();tempRect.clamp(0,0,this._drawWidth,this._drawHeight)}else tempRect.roundOuter();renderer.SetScissorRect(tempRect.getLeft(),tempRect.getTop(),tempRect.width(),tempRect.height(),this._drawHeight)}}_OnAfterEffectChainDrawContent(renderer){renderer.ResetColor();if(!this._useFullSurface){renderer.SetDepthEnabled(false); +if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(true)}_OnAfterEndEffectChain(renderer){renderer.SetDepthSamplingEnabled(false);renderer.SetDepthEnabled(this._depthEnabledAtStart);if(!this._useFullSurface)renderer.RemoveScissorRect();if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(false);this._didChangeTransform=renderer.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(id){return id< +0?null:this._renderTargets[id]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(rt){this._manager.ReleaseRenderTarget(rt,this)}_GetShaderProgramAt(i){return this._shaderProgramList[i]}_DrawContent(renderer){if(this._cbDrawContentHook)this._cbDrawContentHook(this,renderer,()=>this._cbDrawContent(renderer,this));else this._cbDrawContent(renderer,this);if(!this._canUseFastPath)this._OnAfterEffectChainDrawContent(renderer)}_IsRenderTargetSameSizeAndOffset(renderer){if(this._useFullSurface)return true; +if(this._compositOffX!==0||this._compositOffY!==0)return false;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget());if(rtWidth!==this._drawWidth||rtHeight!==this._drawHeight)return false;return true}_SetDeviceTransform(renderer,isLast){let projMat=this._projectionMatrix;let mvMat=this._modelViewMatrix;if(isLast&&!this._IsRenderTargetSameSizeAndOffset(renderer)){projMat=tempMat4a;mvMat=tempMat4b;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget()); +this._CalculateDeviceTransformMatrices(renderer,rtWidth,rtHeight,this._compositOffX,this._compositOffY,projMat,mvMat);if(!this._useFullSurface)renderer.RemoveScissorRect()}renderer.SetProjectionMatrix(projMat);renderer.SetModelViewMatrix(mvMat)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(index){return this._cbGetShaderParameters(this._shaderProgramIndices[index])}_SetProgramParameters(renderer,index){let rcTexDest=this._rcTexDest;let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal; +if(renderer.IsWebGL()){tempRect2.copy(rcTexDest);tempRect2.flipAround(1);rcTexDest=tempRect2;tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect);tempRect4.flipAround(1);srcOriginRect=tempRect4}this._DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(renderer,index){let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal;let pixelWidth=1/this._drawWidth; +let pixelHeight=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(!srcTexRect){tempRect.set(0,0,0,0);srcTexRect=tempRect}if(!srcWidth)srcWidth=this._drawWidth;if(!srcHeight)srcHeight=this._drawHeight;srcRect=srcTexRect;srcOriginRect=srcTexRect;pixelWidth=1/srcWidth;pixelHeight=1/srcHeight}else if(renderer.IsWebGL()){tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect); +tempRect4.flipAround(1);srcOriginRect=tempRect4}let rcTexDest=this._rcTexDest;if(renderer.IsWebGL()){rcTexDest=tempRect2;rcTexDest.copy(this._rcTexDest);rcTexDest.flipAround(1)}this._DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,pixelWidth,pixelHeight);if(renderer.IsWebGPU()&&this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_GetBackTex(renderer){if(this._isAnyShaderBackgroundBlending)if(renderer.IsWebGPU())if(this._UseCopyTextureBackgroundSampling())return this._backTex; +else return this._destRenderTarget.GetTexture();else return this._destRenderTarget;else return null}_DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,pixelWidth,pixelHeight){renderer.SetProgramParameters(this._GetBackTex(renderer),rcTexDest,srcRect,srcOriginRect,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(index))}_Render_FastPath(renderer,opts){const shaderProgram= +this._shaderProgramList[0];const wasDepthEnabled=renderer.IsDepthEnabled();const usesDepth=shaderProgram.UsesDepth();if(usesDepth){renderer.SetDepthEnabled(false);renderer.SetDepthSamplingEnabled(true);this._rcTexDest.set(0,0,1,1);this._rcTexOriginal.set(0,0,1,1)}renderer.SetProgram(shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetRenderTarget(this._destRenderTarget);let pixelWidth=0;let pixelHeight=1;this._rcTexOriginal.set(0,0,1,1);if(shaderProgram.UsesAnySrcRectOrPixelSize()&& +this._cbGetSourceTextureInfo){const {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(srcTexRect)this._rcTexOriginal.copy(srcTexRect);pixelWidth=Number.isFinite(srcWidth)?1/srcWidth:0;pixelHeight=Number.isFinite(srcHeight)?1/srcHeight:0}else{const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);pixelWidth=1/drawWidth;pixelHeight=1/drawHeight}if(opts.layoutRect)this._layoutRect.copy(opts.layoutRect);else this._layoutRect.set(0,0,0,0);renderer.SetProgramParameters(this._GetBackTex(renderer), +this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(0));if(renderer.IsWebGPU()&&this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated);renderer.SetBaseZ(0);this._DrawContent(renderer);if(usesDepth){renderer.SetDepthSamplingEnabled(false);renderer.SetDepthEnabled(wasDepthEnabled)}}_UseCopyTextureBackgroundSampling(){return this._useCopyTextureBackgroundSampling}_UseRenderTargetBackgroundSampling(){return!this._useCopyTextureBackgroundSampling}IsAnyShaderBackgroundBlending(){return this._isAnyShaderBackgroundBlending}CanSkipCalculatingDrawSurfaceRect(){if(!this._canUseFastPath)return false; +if(this._UseCopyTextureBackgroundSampling())return false;return true}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(msg, +renderer,renderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/step.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step=class EffectChainStep{constructor(effectChain,srcTargetId,destTargetId,index=-1){this._effectChain=effectChain;this._srcTargetId=srcTargetId;this._destTargetId=destTargetId;this._index=index}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/preDrawStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.PreDraw=class PreDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/postDrawStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.PostDraw=class PostDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget);effectChain._SetDeviceTransform(renderer,true);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture()); +tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce()); +else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}renderer.SetBackTexture(null);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// ../lib/gfx/effectCompositor/firstBounceStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.FirstBounce=class FirstBounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex()); +effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex());effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/bounceStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.Bounce=class BounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget);const isLast=this.GetDestTargetId()===0;if(isLast)renderer.SetBlendMode(effectChain._GetBlendMode());else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend()}renderer.SetProgram(this.GetShaderProgram()); +effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());effectChain._SetDeviceTransform(renderer,isLast);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain(); +renderer.SetRenderTarget(destRenderTarget,false);const isLast=this.GetDestTargetId()===0;if(isLast){renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetBackTexture(null);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce());else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}}else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend(); +tempQuad.setFromRect(effectChain._GetRcTexBounce())}renderer.SetProgram(this.GetShaderProgram());effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// interfaces/IRuntime.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;let runtime=null;const keysDownByKey=new Set;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}const tempZOrderList=[];const tempInstances=[];let didWarnInAlertPolyfill=false; +self.IRuntime=class IRuntime{constructor(runtime_,objects){runtime=runtime_;Object.defineProperties(this,{assets:{value:runtime.GetAssetManager().GetIAssetManager(),writable:false},objects:{value:objects,writable:false},globalVars:{value:{},writable:false},projectName:{value:runtime.GetProjectName(),writable:false},projectVersion:{value:runtime.GetProjectVersion(),writable:false},storage:{value:new self.IStorage(runtime),writable:false},isInWorker:{value:runtime.IsInWorker(),writable:false}});runtime.UserScriptDispatcher().addEventListener("keydown", +e=>{if(keysDownByKey.has(e["key"])){e.stopPropagation();return}keysDownByKey.add(e["key"])});runtime.UserScriptDispatcher().addEventListener("keyup",e=>keysDownByKey.delete(e["key"]));runtime.Dispatcher().addEventListener("window-blur",()=>keysDownByKey.clear());if(runtime.IsInWorker())self["alert"]=message=>{if(!didWarnInAlertPolyfill){didWarnInAlertPolyfill=true;console.warn("[Construct] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual.")}return this.alert(message)}}_InitGlobalVars(globalVarDescriptors){Object.defineProperties(this.globalVars, +globalVarDescriptors)}addEventListener(name,func){runtime.UserScriptDispatcher().addEventListener(name,func)}removeEventListener(name,func){runtime.UserScriptDispatcher().removeEventListener(name,func)}callFunction(name,...params){C3X.RequireString(name);const eventSheetManager=runtime.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(name);if(!functionBlock)throw new Error(`cannot find function name '${name}'`);if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +if(params.length0){solModifiers=sm;if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(sm); +else eventSheetManager.PushCleanSol(sm)}}const ret=callEventBlock.RunAsExpressionFunctionCall(callEventBlock.GetSolModifiersIncludingParents(),functionBlock.IsCopyPicked(),functionBlock.GetReturnType(),functionBlock.GetDefaultReturnValue(),...params);if(solModifiers)eventSheetManager.PopSol(solModifiers);return ret}setReturnValue(v){const frame=runtime.GetEventStack().GetCurrentExpFuncStackFrame();if(!frame)throw new Error("not in a function which returns a value");switch(frame.GetFunctionReturnType()){case 1:if(typeof v=== +"number")frame.SetFunctionReturnValue(v);break;case 2:if(typeof v==="string")frame.SetFunctionReturnValue(v);break;case 3:if(typeof v==="number"||typeof v==="string")frame.SetFunctionReturnValue(v);break}}get dt(){return runtime.GetDt()}get gameTime(){return runtime.GetGameTime()}get wallTime(){return runtime.GetWallTime()}random(){return runtime.Random()}get layout(){return runtime.GetMainRunningLayout().GetILayout()}getLayout(nameOrIndex){const layoutManager=runtime.GetLayoutManager();let layout= +null;if(typeof nameOrIndex==="number"||typeof nameOrIndex==="string")layout=layoutManager.GetLayout(nameOrIndex);else throw new TypeError("expected string or number");if(!layout)throw new Error("invalid layout");return layout.GetILayout()}getAllLayouts(){return runtime.GetLayoutManager().GetAllLayouts().map(layout=>layout.GetILayout())}goToLayout(nameOrIndex){const layoutManager=runtime.GetLayoutManager();let layout=null;if(typeof nameOrIndex==="number"||typeof nameOrIndex==="string")layout=layoutManager.GetLayout(nameOrIndex); +else throw new TypeError("expected string or number");if(!layout)throw new Error("invalid layout");if(layoutManager.IsPendingChangeMainLayout())return;layoutManager.ChangeMainLayout(layout)}get keyboard(){const ret=runtime._GetCommonScriptInterfaces().keyboard;if(!ret)throw new Error("runtime.keyboard used but Keyboard object missing - add it to your project first");return ret}get mouse(){const ret=runtime._GetCommonScriptInterfaces().mouse;if(!ret)throw new Error("runtime.mouse used but Mouse object missing - add it to your project first"); +return ret}get touch(){const ret=runtime._GetCommonScriptInterfaces().touch;if(!ret)throw new Error("runtime.touch used but Touch object missing - add it to your project first");return ret}invokeDownload(url,filename){C3X.RequireString(url);C3X.RequireString(filename);runtime.InvokeDownload(url,filename)}getInstanceByUid(uid){C3X.RequireFiniteNumber(uid);const ret=runtime.GetInstanceByUID(uid);return ret?ret.GetInterfaceClass():null}sortZOrder(iterable,callback){C3X.RequireFunction(callback);const layout= +runtime.GetCurrentLayout();for(const iinst of iterable){const inst=runtime._UnwrapIWorldInstance(iinst);const wi=inst.GetWorldInfo();tempZOrderList.push([wi.GetLayer().GetIndex(),wi.GetZIndex()]);tempInstances.push(inst)}if(tempZOrderList.length===0)return;tempZOrderList.sort(SortZOrderList);tempInstances.sort((a,b)=>callback(a.GetInterfaceClass(),b.GetInterfaceClass()));let anyChanged=false;for(let i=0,len=tempZOrderList.length;i0)throw new Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");map.get(this)._SetUserScriptInstanceClass(Class)}createInstance(layerNameOrIndex,x,y,createHierarchy,template){C3X.RequireNumber(x);C3X.RequireNumber(y);if(typeof layerNameOrIndex!=="number"&&typeof layerNameOrIndex!=="string")throw new TypeError("invalid layer parameter");const objectClass=map.get(this);const runtime=objectClass.GetRuntime(); +const layer=runtime.GetMainRunningLayout().GetLayer(layerNameOrIndex);if(!layer)throw new Error("invalid layer");const inst=runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager=runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(!eventSheetManager.IsInEventEngine())runtime.FlushPendingInstances(); +return inst.GetInterfaceClass()}}; + +} + +// interfaces/ILayout.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.ILayout=class ILayout{constructor(layout){map.set(this,layout);const effectInstanceArr=[];const effectList=layout.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;ilayer.GetILayer())}*allLayers(){for(const layer of map.get(this).allLayers())yield layer.GetILayer()}setVanishingPoint(vpX,vpY){C3X.RequireFiniteNumber(vpX);C3X.RequireFiniteNumber(vpY);map.get(this).SetVanishingPointXY(vpX,vpY)}getVanishingPoint(){return map.get(this)._GetVanishingPoint()}set projection(p){C3X.RequireString(p); +const layout=map.get(this);if(p==="perspective")layout.SetPerspectiveProjection();else if(p==="orthographic")layout.SetOrthographicProjection();else throw new Error("invalid projection");}get projection(){if(map.get(this).IsOrthographicProjection())return"orthographic";else return"perspective"}}; + +} + +// interfaces/ILayer.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.ILayer=class ILayer{constructor(layer){map.set(this,layer);const effectInstanceArr=[];const effectList=layer.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;is.GetInterfaceClass()):[]}*otherContainerInstances(){const inst=map.get(this);if(!inst.IsInContainer())return;for(const s of inst.siblings())yield s.GetInterfaceClass()}}; + +} + +// interfaces/IWorldInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;const ILayer=self.ILayer;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.IWorldInstance=class IWorldInstance extends IInstance{constructor(){super();const inst=IInstance._GetInitInst();map.set(this,inst);const effectInstanceArr=[];const wi=inst.GetWorldInfo();const instanceEffectList=wi.GetInstanceEffectList();if(instanceEffectList){const effectCount=wi.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let i=0;iinst.GetInterfaceClass())}}; + +} + +// interfaces/IEffectInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const tempColor=C3.New(C3.Color); +self.IEffectInstance=class IEffectInstance{constructor(effectList,index){map.set(this,effectList);const descriptors={index:{value:index,writable:false}};Object.defineProperties(this,descriptors)}get name(){const effectTypes=map.get(this).GetAllEffectTypes();return effectTypes[this.index].GetName()}get isActive(){return map.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const fxList=map.get(this);if(fxList.IsEffectIndexActive(this.index)===a)return;fxList.SetEffectIndexActive(this.index, +a);fxList.UpdateActiveEffects();fxList.GetRuntime().UpdateRender()}setParameter(i,v){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const oldValue=fxList.GetEffectParameter(this.index,i);if(oldValue===null)throw new RangeError("invalid index");if(oldValue instanceof C3.Color){if(!Array.isArray(v)||v.length<3)throw new TypeError("expected array with 3 elements");tempColor.setRgb(v[0],v[1],v[2]);v=tempColor}else if(typeof v!=="number")throw new TypeError("expected number");const didChange= +fxList.SetEffectParameter(this.index,i,v);if(didChange&&fxList.IsEffectIndexActive(this.index))fxList.GetRuntime().UpdateRender()}getParameter(i){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const ret=fxList.GetEffectParameter(this.index,i);if(ret===null)throw new RangeError("invalid index");if(ret instanceof C3.Color)return[ret.getR(),ret.getG(),ret.getB()];else return ret}}; + +} + +// interfaces/IAnimation.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.IAnimation=class IAnimation{constructor(animationInfo){map.set(this,animationInfo);Object.defineProperties(this,{name:{value:animationInfo.GetName(),writable:false},speed:{value:animationInfo.GetSpeed(),writable:false},isLooping:{value:animationInfo.IsLooping(),writable:false},repeatCount:{value:animationInfo.GetRepeatCount(),writable:false},repeatTo:{value:animationInfo.GetRepeatTo(),writable:false},isPingPong:{value:animationInfo.IsPingPong(),writable:false},frameCount:{value:animationInfo.GetFrameCount(), +writable:false}})}getFrames(){return map.get(this).GetFrames().map(f=>f.GetIAnimationFrame())}*frames(){for(const f of map.get(this).GetFrames())yield f.GetIAnimationFrame()}}; + +} + +// interfaces/IImageInfo.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;self.IImageInfo=class IImageInfo{constructor(imageInfo){map.set(this,imageInfo)}get width(){return map.get(this).GetWidth()}get height(){return map.get(this).GetHeight()}}; + +} + +// interfaces/IAnimationFrame.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;self.IAnimationFrame=class IAnimationFrame extends self.IImageInfo{constructor(animationFrameInfo){super(animationFrameInfo.GetImageInfo());map.set(this,animationFrameInfo);Object.defineProperties(this,{duration:{value:animationFrameInfo.GetDuration(),writable:false},originX:{value:animationFrameInfo.GetOriginX(),writable:false},originY:{value:animationFrameInfo.GetOriginY(),writable:false}})}}; + +} + +// interfaces/ITimelineState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;function GetTimelineState(iface){const timelineState=map.get(iface);if(timelineState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return timelineState} +self.ITimelineState=class ITimelineState{constructor(timelineState){map.set(this,timelineState)}pause(){GetTimelineState(this).Stop()}resume(){GetTimelineState(this).Resume()}hasTags(tags){return GetTimelineState(this).HasTags(tags)}set time(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTime(t)}get time(){return GetTimelineState(this).GetTime()}set totalTime(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTotalTime(t)}get totalTime(){return GetTimelineState(this).GetTotalTime()}set isLooping(l){GetTimelineState(this).SetLoop(!!l)}get isLooping(){return GetTimelineState(this).GetLoop()}set isPingPong(p){GetTimelineState(this).SetPingPong(!!p)}get isPingPong(){return GetTimelineState(this).GetPingPong()}set playbackRate(p){C3X.RequireFiniteNumber(p); +GetTimelineState(this).SetPlaybackRate(p)}get playbackRate(){return GetTimelineState(this).GetPlaybackRate()}get progress(){const timelineState=GetTimelineState(this);return timelineState.GetTime()/timelineState.GetTotalTime()}get tags(){return GetTimelineState(this).GetTags()}get finished(){return GetTimelineState(this).GetPlayPromise()}get isPlaying(){return GetTimelineState(this).IsPlaying()}get isPaused(){return GetTimelineState(this).IsPaused()}get isReleased(){return map.get(this).IsReleased()}}; + +} + +// interfaces/ITweenState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const behInstMap=new WeakMap;let easeToIndexFunc=null;function GetTweenState(iface){const tweenState=map.get(iface);if(tweenState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return tweenState} +self.ITweenState=class ITweenState extends self.ITimelineState{constructor(tweenState,behInst,opts){super(tweenState);if(!easeToIndexFunc)easeToIndexFunc=opts.easeToIndexFunc;map.set(this,tweenState);if(behInst)behInstMap.set(this,behInst)}stop(){const tweenState=GetTweenState(this);const behInst=behInstMap.get(this);behInst.ReleaseTween(tweenState)}setEase(easeName){C3X.RequireString(easeName);const ease=self.Ease.GetEaseFromIndex(easeToIndexFunc(easeName));GetTweenState(this).SetEase(ease)}get instance(){const inst= +GetTweenState(this).GetInstance();return inst?inst.GetInterfaceClass():null}get isDestroyOnComplete(){return GetTweenState(this).GetDestroyInstanceOnComplete()}set isDestroyOnComplete(d){GetTweenState(this).SetDestroyInstanceOnComplete(!!d)}get value(){const tweenState=GetTweenState(this);if(tweenState.GetId()!=="value")throw new Error("not a value tween");return tweenState.GetPropertyTrack("value").GetSourceAdapterValue()}}; + +} + +// assets/assetManager.js +{ +'use strict';const C3=self.C3;const VALID_LOAD_POLICIES=new Set(["local","remote"]);const EXT_TO_TYPE=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function GetTypeFromFileExtension(filename){if(!filename)return"";const parts=filename.split(".");if(parts.length<2)return"";const ext=parts.at(-1).toLowerCase();return EXT_TO_TYPE.get(ext)||""} +function AddScript(url){return new Promise((resolve,reject)=>{const elem=document.createElement("script");elem.onload=resolve;elem.onerror=reject;elem.async=false;elem.type="module";elem.src=url;document.head.appendChild(elem)})} +C3.AssetManager=class AssetManager extends C3.DefendedBase{constructor(runtime,opts){super();const exportType=opts["exportType"];this._runtime=runtime;this._fileStructure="folders";this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova=exportType==="cordova";this._isiOSCordova=!!opts["isiOSCordova"];this._isFileProtocol=!!opts["isFileProtocol"];this._swClientId=opts["swClientId"];this._supportedAudioFormats=opts["supportedAudioFormats"]||{};this._audioFiles= +new Map;this._preloadSounds=false;this._mediaSubfolder="";this._fontsSubfolder="";this._iconsSubfolder="";const isRemoteLoadPolicy=exportType==="html5"||exportType==="scirra-arcade"||exportType==="instant-games";this._defaultLoadPolicy=isRemoteLoadPolicy?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=false;this._totalAssetSizeToLoad=0;this._assetSizeLoaded=0;this._lastLoadProgress=0;this._hasHadErrorLoading=false; +this._loadingRateLimiter=C3.New(C3.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new C3.PromiseThrottle(Math.max(C3.hardwareConcurrency,8));const localUrlBlobs=opts["previewImageBlobs"];if(localUrlBlobs){const projectFileBlobs=opts["previewProjectFileBlobs"];if(projectFileBlobs)Object.assign(localUrlBlobs,projectFileBlobs);const projectData=opts["projectData"];if(projectData)localUrlBlobs["data.json"]=projectData;for(const [url,blob]of Object.entries(localUrlBlobs))this._localUrlBlobs.set(url, +blob)}const localSWUrlMap=opts["previewProjectFileSWUrls"];if(localSWUrlMap)for(const [srcUrl,destUrl]of Object.entries(localSWUrlMap))this._localBlobSWUrls.set(srcUrl,destUrl);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const url of this._localBlobUrlCache.values())if(url.startsWith("blob:"))URL.revokeObjectURL(url);this._localBlobUrlCache.clear();for(const asset of this._allAssets)asset.Release();C3.clearArray(this._allAssets);this._assetsByUrl.clear(); +C3.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetFileStructure(f){this._fileStructure=f;if(f==="flat"){const newMap=new Map;for(const [url,blob]of this._localUrlBlobs.entries())newMap.set(url.toLowerCase(),blob);this._localUrlBlobs=newMap}}GetFileStructure(){return this._fileStructure}_SetMediaSubfolder(folder){this._mediaSubfolder=folder}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(folder){this._fontsSubfolder=folder}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(folder){this._iconsSubfolder= +folder}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.has(url)}_GetLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.get(url)||null}GetLocalUrlAsBlobUrl(url){if(this._fileStructure==="flat")url=url.toLowerCase();if(!this._HasLocalUrlBlob(url))return url;let ret=this._localBlobUrlCache.get(url);if(!ret){const blob= +this._GetLocalUrlBlob(url);ret=URL.createObjectURL(blob);this._localBlobUrlCache.set(url,ret)}return ret}FetchBlob(url,loadPolicy){loadPolicy=loadPolicy||this._defaultLoadPolicy;const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return Promise.resolve(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlob(url);else if(loadPolicy==="local")return this._promiseThrottle.Add(()=> +C3.FetchBlob(url));else return C3.FetchBlob(url)}else return C3.FetchBlob(url)}FetchArrayBuffer(url){const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToArrayBuffer(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsArrayBuffer(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchArrayBuffer(url));else return C3.FetchArrayBuffer(url)}else return C3.FetchArrayBuffer(url)}FetchText(url){const localBlob= +this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToString(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsText(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchText(url));else return C3.FetchText(url)}else return C3.FetchText(url)}async FetchJson(url){const text=await this.FetchText(url);return JSON.parse(text)}_CordovaFetchLocalFileAs(filename, +as_){if(this._fileStructure==="flat")filename=filename.toLowerCase();return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{"filename":filename,"as":as_})}CordovaFetchLocalFileAsText(filename){return this._CordovaFetchLocalFileAs(filename,"text")}async CordovaFetchLocalFileAsBlob(filename){const buffer=await this._CordovaFetchLocalFileAs(filename,"buffer");const type=GetTypeFromFileExtension(filename);return new Blob([buffer],{"type":type})}async CordovaFetchLocalFileAsBlobURL(filename){if(this._fileStructure=== +"flat")filename=filename.toLowerCase();let blobUrl=this._localBlobUrlCache.get(filename);if(blobUrl)return blobUrl;const blob=await this.CordovaFetchLocalFileAsBlob(filename);blobUrl=URL.createObjectURL(blob);this._localBlobUrlCache.set(filename,blobUrl);return blobUrl}CordovaFetchLocalFileAsArrayBuffer(filename){return this._CordovaFetchLocalFileAs(filename,"buffer")}GetMediaFileUrl(filename){if(this._fileStructure==="flat")filename=filename.toLowerCase();filename=this._mediaSubfolder+filename;if(this._HasLocalUrlBlob(filename))return this.GetLocalUrlAsBlobUrl(filename); +else return filename}GetProjectFileUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else if(this._HasLocalUrlBlob(url))return Promise.resolve(this.GetLocalUrlAsBlobUrl(url));else if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(url);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}GetProjectFileIframeUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else{const queryIndex=url.indexOf("?");const queryStr= +queryIndex===-1?"":url.substr(queryIndex);const urlNoSearch=queryIndex===-1?url:url.substr(0,queryIndex);if(this._HasLocalUrlBlob(urlNoSearch)){let localUrl=this._localBlobSWUrls.get(urlNoSearch)||this.GetLocalUrlAsBlobUrl(urlNoSearch);if(!localUrl.startsWith("blob:")&&this._swClientId){const asUrl=new URL(localUrl);const params=new URLSearchParams(queryStr);params.set("__c3_client_id",this._swClientId);asUrl.search=params.toString();localUrl=asUrl.toString()}return Promise.resolve(localUrl)}else if(this._isCordova&& +this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(urlNoSearch);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}}LoadProjectFileUrl(url){return this.GetProjectFileUrl(url)}LoadImage(opts){if(opts.loadPolicy&&!VALID_LOAD_POLICIES.has(opts.loadPolicy))throw new Error("invalid load policy");let asset=this._assetsByUrl.get(opts.url);if(asset)return asset;asset=C3.New(C3.ImageAsset,this,{url:opts.url,size:opts.size||0,loadPolicy:opts.loadPolicy||this._defaultLoadPolicy}); +this._allAssets.push(asset);this._assetsByUrl.set(asset.GetURL(),asset);if(!this._hasFinishedInitialLoad){this._totalAssetSizeToLoad+=asset.GetSize();this._loadPromises.push(asset.Load().then(()=>this._AddLoadedSize(asset.GetSize())))}return asset}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises);this._lastLoadProgress=1}catch(err){console.error("Error loading: ",err);this._hasHadErrorLoading=true;this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad= +true}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(s){this._assetSizeLoaded+=s;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const event=C3.New(C3.Event,"loadingprogress");this._lastLoadProgress=C3.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);event.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(event)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(arr){C3.shallowAssignArray(this._webFonts,arr);if(this._webFonts.length)this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if(typeof FontFace=== +"undefined")return Promise.resolve();const promises=[];for(const [name,filename,size]of this._webFonts){this._totalAssetSizeToLoad+=size;promises.push(this._LoadWebFont(name,filename).then(()=>this._AddLoadedSize(size)))}return Promise.all(promises)}async _LoadWebFont(name,filename){try{const url=await this.GetProjectFileUrl(filename);const fontFace=new FontFace(name,`url('${url}')`);if(this._runtime.IsInWorker())self.fonts.add(fontFace);else document.fonts.add(fontFace);await fontFace.load()}catch(err){console.warn(`[C3 runtime] Failed to load web font '${name}': `, +err)}}IsAudioFormatSupported(type){return!!this._supportedAudioFormats[type]}_SetAudioFiles(arr,preloadSounds){this._preloadSounds=!!preloadSounds;for(const [fileName,projectFilesInfo,isMusic]of arr)this._audioFiles.set(fileName,{fileName,formats:projectFilesInfo.map(si=>({type:si[0],fileExtension:si[1],fullName:fileName+si[1],fileSize:si[2]})),isMusic})}GetPreferredAudioFile(namePart){if(this._fileStructure==="flat")namePart=namePart.toLowerCase();const info=this._audioFiles.get(namePart);if(!info)return null; +let webMOpusFile=null;for(const formatInfo of info.formats){if(!webMOpusFile&&formatInfo.type==="audio/webm; codecs=opus")webMOpusFile=formatInfo;if(this.IsAudioFormatSupported(formatInfo.type))return formatInfo}return webMOpusFile}GetProjectAudioFileUrl(namePart){const formatInfo=this.GetPreferredAudioFile(namePart);if(!formatInfo)return null;return{url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type}}GetAudioToPreload(){if(this._preloadSounds){const ret=[];for(const info of this._audioFiles.values()){if(info.isMusic)continue; +const formatInfo=this.GetPreferredAudioFile(info.fileName);if(!formatInfo)continue;ret.push({originalUrl:info.fileName,url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type,fileSize:formatInfo.fileSize})}return ret}else return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...urls){const scriptUrls=await Promise.all(urls.map(url=>this.GetProjectFileUrl(url)));if(this._runtime.IsInWorker())if(urls.length===1){const url=urls[0];await self.c3_import((C3.IsRelativeURL(url)? +"./":"")+url)}else{const scriptStr=urls.map(url=>`import "${C3.IsRelativeURL(url)?"./":""}${url}";`).join("\n");const blobUrl=URL.createObjectURL(new Blob([scriptStr],{type:"application/javascript"}));await self.c3_import(blobUrl)}else await Promise.all(scriptUrls.map(url=>AddScript(url)))}async CompileWebAssembly(url){if(WebAssembly.compileStreaming){const fetchUrl=await this.GetProjectFileUrl(url);return await WebAssembly.compileStreaming(fetch(fetchUrl))}else{const arrayBuffer=await C3.FetchArrayBuffer(url); +return await WebAssembly.compile(arrayBuffer)}}async LoadStyleSheet(url){const fetchUrl=await this.GetProjectFileUrl(url);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{"url":fetchUrl})}}; + +} + +// assets/asset.js +{ +'use strict';const C3=self.C3; +C3.Asset=class Asset extends C3.DefendedBase{constructor(assetManager,opts){super();this._assetManager=assetManager;this._runtime=assetManager.GetRuntime();this._url=opts.url;this._size=opts.size;this._loadPolicy=opts.loadPolicy;this._blob=null;this._isLoaded=false;this._loadPromise=null}Release(){this._loadPromise=null;this._assetManager=null;this._runtime=null;this._blob=null}GetURL(){return this._url}GetSize(){return this._size}Load(){if(this._loadPolicy==="local"||this._blob){this._isLoaded=true; +return Promise.resolve()}if(this._loadPromise)return this._loadPromise;this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(blob=>{this._isLoaded=true;this._loadPromise=null;this._blob=blob;return blob}).catch(err=>console.error("Error loading resource: ",err));return this._loadPromise}IsLoaded(){return this._isLoaded}GetBlob(){if(this._blob)return Promise.resolve(this._blob);if(this._loadPromise)return this._loadPromise;return this._assetManager.FetchBlob(this._url,this._loadPolicy)}}; + +} + +// assets/imageAsset.js +{ +'use strict';const C3=self.C3;const promiseThrottle=new C3.PromiseThrottle;const allImageAssets=new Set; +C3.ImageAsset=class ImageAsset extends C3.Asset{constructor(assetManager,opts){super(assetManager,opts);this._texturePromise=null;this._webglTexture=null;this._refCount=0;this._imageWidth=-1;this._imageHeight=-1;allImageAssets.add(this)}Release(){this.ReleaseTexture();if(this._refCount!==0)throw new Error("released image asset which still has texture references");this._texturePromise=null;allImageAssets.delete(this);super.Release()}static OnWebGLContextLost(){for(const imageAsset of allImageAssets){imageAsset._texturePromise= +null;imageAsset._webglTexture=null;imageAsset._refCount=0}}LoadStaticTexture(renderer,opts){opts=opts||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;opts.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texturePromise=this.GetBlob().then(blob=>promiseThrottle.Add(()=>renderer.CreateStaticTextureAsync(blob,opts).then(texture=>{this._texturePromise=null;if(this._refCount===0){renderer.DeleteTexture(texture); +return null}this._webglTexture=texture;this._imageWidth=texture.GetWidth();this._imageHeight=texture.GetHeight();return this._webglTexture}))).catch(err=>{console.error("Failed to load texture: ",err);throw err;});return this._texturePromise}ReleaseTexture(){if(this._refCount<=0)throw new Error("texture released too many times");this._refCount--;if(this._refCount===0&&this._webglTexture){const renderer=this._webglTexture.GetRenderer();renderer.DeleteTexture(this._webglTexture);this._webglTexture= +null}}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const blob=await this.GetBlob();if(C3.Supports.ImageBitmapOptions)return await createImageBitmap(blob,{"premultiplyAlpha":"none"});else if(C3.Supports.ImageBitmap)return await createImageBitmap(blob);else return await C3.BlobToImage(blob)}}; + +} + +// layouts/renderCell.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()} +C3.RenderCell=class RenderCell extends C3.DefendedBase{constructor(grid,x,y){super();this._grid=grid;this._x=x;this._y=y;this._instances=[];this._isSorted=true;this._pendingRemoval=new Set;this._isAnyPendingRemoval=false}Release(){C3.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){C3.clearArray(this._instances);this._isSorted=true;this._pendingRemoval.clear();this._isAnyPendingRemoval=false}SetChanged(){this._isSorted=false}IsEmpty(){if(!this._instances.length)return true; +if(this._instances.length>this._pendingRemoval.size)return false;this._FlushPending();return true}Insert(inst){if(this._pendingRemoval.has(inst)){this._pendingRemoval.delete(inst);if(this._pendingRemoval.size===0)this._isAnyPendingRemoval=false;return}this._instances.push(inst);this._isSorted=this._instances.length===1}Remove(inst){this._pendingRemoval.add(inst);this._isAnyPendingRemoval=true;if(this._pendingRemoval.size>=50)this._FlushPending()}_FlushPending(){if(!this._isAnyPendingRemoval)return; +if(this._instances.length===this._pendingRemoval.size){this.Reset();return}C3.arrayRemoveAllInSet(this._instances,this._pendingRemoval);this._pendingRemoval.clear();this._isAnyPendingRemoval=false}_EnsureSorted(){if(this._isSorted)return;this._instances.sort(SortByInstLastCachedZIndex);this._isSorted=true}Dump(result){this._FlushPending();this._EnsureSorted();if(this._instances.length)result.push(this._instances)}}; + +} + +// layouts/renderGrid.js +{ +'use strict';const C3=self.C3; +C3.RenderGrid=class RenderGrid extends C3.DefendedBase{constructor(cellWidth,cellHeight){super();this._cellWidth=cellWidth;this._cellHeight=cellHeight;this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(x,y,createIfMissing){let ret=this._cells.Get(x,y);if(ret)return ret;else if(createIfMissing){ret=C3.New(C3.RenderCell,this,x,y);this._cells.Set(x,y,ret);return ret}else return null}XToCell(x){return Math.floor(x/this._cellWidth)}YToCell(y){return Math.floor(y/this._cellHeight)}Update(inst, +oldRange,newRange){if(oldRange)for(let x=oldRange.getLeft(),lenx=oldRange.getRight();x<=lenx;++x)for(let y=oldRange.getTop(),leny=oldRange.getBottom();y<=leny;++y){if(newRange&&newRange.containsPoint(x,y))continue;const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Remove(inst);if(cell.IsEmpty())this._cells.Delete(x,y)}if(newRange)for(let x=newRange.getLeft(),lenx=newRange.getRight();x<=lenx;++x)for(let y=newRange.getTop(),leny=newRange.getBottom();y<=leny;++y){if(oldRange&&oldRange.containsPoint(x, +y))continue;this.GetCell(x,y,true).Insert(inst)}}QueryRange(rc,result){let x=this.XToCell(rc.getLeft());const ystart=this.YToCell(rc.getTop());const lenx=this.XToCell(rc.getRight());const leny=this.YToCell(rc.getBottom());for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Dump(result)}}MarkRangeChanged(rc){let x=rc.getLeft();const ystart=rc.getTop();const lenx=rc.getRight();const leny=rc.getBottom();for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell= +this.GetCell(x,y,false);if(!cell)continue;cell.SetChanged()}}}; + +} + +// layouts/layer.js +{ +'use strict';const C3=self.C3;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const renderCellArr=[];const tmpDestRect=new C3.Rect;const tmpSrcRect=new C3.Rect;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tempVec3=vec3.create();const tempVec4=vec4.create();const camVector=vec3.create();const lookVector=vec3.create();const upVector=vec3.create();const tempVec2=C3.New(C3.Vector2);const tempRect=C3.New(C3.Rect); +function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()}function SortByInstZElevation(a,b){return a.GetWorldInfo().GetZElevation()-b.GetWorldInfo().GetZElevation()}const tempInstanceList1=[];const tempInstanceList2=[];const tempInstancesByCameraDist=[]; +C3.Layer=class Layer extends C3.DefendedBase{constructor(layout,parentLayer,data){super();this._layout=layout;this._runtime=layout.GetRuntime();this._parentLayer=parentLayer;this._name=data[0];this._index=-1;this._sid=data[2];this._isVisible=!!data[3];this._isInteractive=!!data[13];this._backgroundColor=C3.New(C3.Color);this._backgroundColor.setFromJSON(data[4].map(x=>x/255));this._isTransparent=!!data[5];this._parallaxX=data[6];this._parallaxY=data[7];this._color=C3.New(C3.Color,1,1,1,data[8]);this._premultipliedColor= +C3.New(C3.Color);this._isForceOwnTexture=data[9];this._renderAs3d=data[17];this._useCameraDistanceDrawOrder=data[18];this._useRenderCells=data[10];this._scaleRate=data[11];this._blendMode=data[12];this._curRenderTarget=null;this._scale=1;this._zElevation=data[16];this._angle=0;this._scrollX=0;this._scrollY=0;this._hasOwnScrollPosition=false;this._viewport=C3.New(C3.Rect);this._viewportZ0=C3.New(C3.Rect);this._viewport3D=C3.New(C3.Rect);this._isViewportChanged=true;this._projectionMatrix=mat4.create(); +this._isProjectionMatrixChanged=true;this._modelViewMatrix=mat4.create();this._isMVMatrixChanged=true;this._viewFrustum=C3.New(C3.Gfx.ViewFrustum);this._isViewFrustumChanged=true;this._startupInitialInstances=[];this._initialInstancesData=data[14];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._zIndicesUpToDate=false;this._anyInstanceZElevated=false;const canvasManager=this._runtime.GetCanvasManager();this._effectList=C3.New(C3.EffectList, +this,data[15]);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layer=effectChain.GetContentObject();const renderSurface=layer.GetRenderTarget();renderer.SetColor(layer.GetPremultipliedColor());renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface);canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)}); +this._needsRebuildEffectChainSteps=true;this._wasDefaultColor=true;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=false;this._lastRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._curRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._iLayer=null;this._UpdatePremultipliedColor();if(this.UsesRenderCells())this._renderGrid=C3.New(C3.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight());this._subLayers=data[19].map(ld=>C3.New(C3.Layer,this._layout, +this,ld))}_Init(){for(const instData of this._initialInstancesData){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);this._layout._AddInitialObjectClass(objectClass);if(!objectClass.GetDefaultInstanceData()){objectClass.SetDefaultInstanceData(instData);objectClass._SetDefaultLayerIndex(this._index)}this._initialInstances.push(instData);this._initialUIDsToInstanceData.set(instData[2],instData)}C3.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData= +null;this._iLayer=new self.ILayer(this)}Release(){this._layout=null;this._runtime=null}GetInitialInstanceData(uid){return this._initialUIDsToInstanceData.get(uid)}CreateInitialInstances(createdInstances){const isFirstVisit=this._layout.IsFirstVisit();let k=0;const initialInstances=this._initialInstances;for(let i=0,len=initialInstances.length;i=0)assignedZIndices.add(cachedZIndex)}let index=-1;for(const inst of this._instances){const wi=inst.GetWorldInfo();if(wi._GetLastCachedZIndex()>=0)continue;++index;while(assignedZIndices.has(index))++index; +wi._SetZIndex(index)}}this._instances.sort(SortByInstLastCachedZIndex)}_Start(){}_End(){for(const inst of this._instances)if(!inst.GetObjectClass().IsGlobal())this._runtime.DestroyInstance(inst);this._runtime.FlushPendingInstances();C3.clearArray(this._instances);this._anyInstanceZElevated=false;this.SetZIndicesChanged()}RecreateInitialObjects(objectClass,rc,offsetX,offsetY,createHierarchy){const eventSheetManager=this._runtime.GetEventSheetManager();const allObjectClasses=this._runtime.GetAllObjectClasses(); +const isFamily=objectClass.IsFamily();const ret=[];for(const instData of this._initialInstances){const worldData=instData[0];const x=worldData[0];const y=worldData[1];if(!rc.containsPoint(x,y))continue;const objectType=allObjectClasses[instData[1]];if(objectType!==objectClass)if(isFamily){if(!objectClass.FamilyHasMember(objectType))continue}else continue;let createOnLayer=this;const runningLayout=this._runtime.GetCurrentLayout();if(this.GetLayout()!==runningLayout){createOnLayer=runningLayout.GetLayerByName(this.GetName()); +if(!createOnLayer)createOnLayer=runningLayout.GetLayerByIndex(this.GetIndex())}const inst=this._runtime.CreateInstanceFromData(instData,createOnLayer,false,undefined,undefined,false,createHierarchy);createOnLayer.SortAndAddInstancesByZIndex(inst);const wi=inst.GetWorldInfo();wi.OffsetXY(offsetX,offsetY);wi.SetBboxChanged();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);ret.push(inst)}return ret}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(i){this._index= +i}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();return this._effectChain}_MaybeRebuildEffectChainSteps(){const isDefaultColor=this.HasDefaultColor();if(!this._needsRebuildEffectChainSteps&&isDefaultColor===this._wasDefaultColor)return;const activeEffectTypes=this.GetEffectList().GetActiveEffectTypes(); +this._effectChain.BuildSteps(activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor,useFullSurface:true});this._needsRebuildEffectChainSteps=false;this._wasDefaultColor=isDefaultColor}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=true}UsesRenderCells(){return this._useRenderCells&&!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate= +false}IsVisible(){for(const layer of this.selfAndParentLayers())if(!layer._IsVisibleFlagSet())return false;return true}_IsVisibleFlagSet(){return this._isVisible}SetVisible(v){v=!!v;if(this._isVisible===v)return;this._isVisible=v;this._runtime.UpdateRender()}SetInteractive(i){this._isInteractive=!!i}IsInteractive(){return this._isInteractive}IsSelfAndParentsInteractive(){for(const layer of this.selfAndParentLayers())if(!layer.IsInteractive())return false;return true}SetOwnScrollPositionEnabled(e){e= +!!e;if(this._hasOwnScrollPosition===e)return;this._hasOwnScrollPosition=e;if(e){const layout=this.GetLayout();this._scrollX=layout.GetScrollX();this._scrollY=layout.GetScrollY()}this._SetMVMatrixChanged();this._runtime.UpdateRender()}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(x){const layout=this.GetLayout();const lbound=layout.GetScrollLeftBound();const rbound=layout.GetScrollRightBound();if(x>rbound)x=rbound;if(xbbound)y=bbound;if(y0}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){if(this.RendersIn3DMode()&&this._useCameraDistanceDrawOrder){C3.shallowAssignArray(tempInstancesByCameraDist,this._GetInstances());tempInstancesByCameraDist.sort((a,b)=>this._SortInstancesByCameraDistance(a,b));return tempInstancesByCameraDist}else return this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(arr){C3.appendArray(arr, +this._GetInstancesInDrawOrder());for(const subLayer of this._subLayers)if(subLayer.IsVisible()&&subLayer.GetOpacity()>0)subLayer._AppendAllInstancesIncludingSubLayersInDrawOrder(arr)}_SortInstancesByCameraDistance(a,b){const camVec=this.GetLayout().Get3DCameraPosition();const camX=camVec[0];const camY=camVec[1];const camZ=camVec[2];const wiA=a.GetWorldInfo();const wiB=b.GetWorldInfo();const dxA=wiA.GetX()-camX;const dyA=wiA.GetY()-camY;const dzA=wiA.GetZElevation()-camZ;const dxB=wiB.GetX()-camX; +const dyB=wiB.GetY()-camY;const dzB=wiB.GetZElevation()-camZ;return dxB*dxB+dyB*dyB+dzB*dzB-(dxA*dxA+dyA*dyA+dzA*dzA)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(t){t=!!t;if(this._isTransparent===t)return;this._isTransparent=t;this._runtime.UpdateRender()}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(f){f=!!f;if(this._isForceOwnTexture===f)return;this._isForceOwnTexture=f;this._runtime.UpdateRender()}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()|| +!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return false;for(const subLayer of this._subLayers)if(!subLayer.SelfAndAllSubLayersHave3DCamera())return false;return true}SetBlendMode(bm){if(this._blendMode===bm)return;this._blendMode=bm;this._runtime.UpdateRender()}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return this._subLayers.length> +0}HasAnyVisibleSubLayer(){for(const subLayer of this._subLayers)if(subLayer.ShouldDraw())return true;return false}*selfAndAllSubLayers(){for(const subLayer of this._subLayers)yield*subLayer.selfAndAllSubLayers();yield this}*parentLayers(){let parentLayer=this.GetParentLayer();while(parentLayer){yield parentLayer;parentLayer=parentLayer.GetParentLayer()}}*selfAndParentLayers(){yield this;yield*this.parentLayers()}IsTransformCompatibleWith(otherLayer){return this===otherLayer||this._parallaxX===otherLayer._parallaxX&& +this._parallaxY===otherLayer._parallaxY&&this._scale===otherLayer._scale&&this._scaleRate===otherLayer._scaleRate&&this._angle===otherLayer._angle&&this.GetScrollX()===otherLayer.GetScrollX()&&this.GetScrollY()===otherLayer.GetScrollY()}SaveTransform(){return{"parallaxX":this.GetParallaxX(),"parallaxY":this.GetParallaxY(),"scale":this.GetOwnScale(),"scaleRate":this.GetScaleRate(),"angle":this.GetOwnAngle(),"hasOwnScroll":this.IsOwnScrollPositionEnabled(),"scrollX":this.GetScrollX(),"scrollY":this.GetScrollY()}}RestoreTransform(t){this.SetParallax(t["parallaxX"], +t["parallaxY"]);this.SetOwnScale(t["scale"]);this.SetScaleRate(t["scaleRate"]);this.SetAngle(t["angle"]);this.SetOwnScrollPositionEnabled(t["hasOwnScroll"]);this.SetScrollX(t["scrollX"]);this.SetScrollY(t["scrollY"]);this._MaybeUpdateViewport()}_RemoveAllInstancesInSet(s){if(s.size===0)return;const numRemoved=C3.arrayRemoveAllInSet(this._instances,s);if(numRemoved>0){this._MaybeResetAnyInstanceZElevatedFlag();this.SetZIndicesChanged()}}SetZIndicesChanged(){this._zIndicesUpToDate=false;this._isRenderListUpToDate= +false}_UpdateZIndices(){if(this._zIndicesUpToDate)return;this._instances.sort(SortByInstZElevation);if(this.UsesRenderCells())for(let i=0,len=this._instances.length;i1)arr=this._MergeAllSortedZArrays_pass(arr);return arr[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();C3.clearArray(renderCellArr);this._renderGrid.QueryRange(this.GetViewport(),renderCellArr);if(!renderCellArr.length)return[];if(renderCellArr.length===1)return renderCellArr[0];return this._MergeAllSortedZArrays(renderCellArr)}ShouldDraw(){return this.IsVisible()&&this.GetOpacity()>0&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()|| +!this.IsTransparent())return true;for(const subLayer of this._subLayers)if(subLayer._DrawsAnyContentInSelfOrSubLayers())return true;return false}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||this.GetBlendMode()!==0||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return true;for(const subLayer of this._subLayers)if(subLayer.SelfOrAnySubLayerUsesOwnTexture())return true;return false}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(z){if(this._layout.IsOrthographicProjection())return 1; +else{const camZ=this.GetCameraZ();return camZ/(camZ-z)}}GetCameraZ(viewH){return this.GetDefaultCameraZ(viewH)/this.GetNormalScale()}_SetMVMatrixChanged(){this._isMVMatrixChanged=true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetModelViewMatrix(renderer){if(this._isMVMatrixChanged){this._CalculateModelViewMatrix(renderer,this._modelViewMatrix,0,0,null);this._isMVMatrixChanged=false}return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const camPos=this.GetLayout().Get3DCameraPosition(); +return[camPos[0],camPos[1],camPos[2]]}else return this._Get2DCameraPosition()}_Get2DCameraPosition(offX=0,offY=0,viewH=0){const runtime=this._runtime;const layout=this.GetLayout();const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();let scrollOriginX=(this.GetScrollX()-parallaxOriginX)*this._parallaxX+parallaxOriginX;let scrollOriginY=(this.GetScrollY()-parallaxOriginY)*this._parallaxY+parallaxOriginY;if(runtime.IsPixelRoundingEnabled()){scrollOriginX= +Math.round(scrollOriginX);scrollOriginY=Math.round(scrollOriginY)}let camX=scrollOriginX+offX;let camY=scrollOriginY+offY;const camZ=layout.IsOrthographicProjection()?this.GetDefaultCameraZ(viewH):this.GetCameraZ(viewH);const [vpX,vpY]=this._GetVanishingPoint();if(vpX!==.5||vpY!==.5){const zf=this.GetDefaultCameraZ(viewH)/camZ;let camOffX=(vpX-.5)*runtime.GetViewportWidth()/zf;let camOffY=(vpY-.5)*runtime.GetViewportHeight()/zf;const a=this.GetAngle();if(a!==0){tempVec2.set(camOffX,camOffY);tempVec2.rotate(a); +camOffX=tempVec2.getX();camOffY=tempVec2.getY()}camX+=camOffX;camY+=camOffY}return[camX,camY,camZ]}_CalculateModelViewMatrix(renderer,outMat,offX,offY,viewH){const runtime=this._runtime;const layout=this.GetLayout();if(this.Has3DCamera()){vec3.copy(camVector,layout.Get3DCameraPosition());vec3.copy(lookVector,layout.Get3DCameraLookAt());vec3.copy(upVector,layout.Get3DCameraUpVector());const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();const lookDx= +lookVector[0]-camVector[0];const lookDy=lookVector[1]-camVector[1];const lookDz=lookVector[2]-camVector[2];camVector[0]=(camVector[0]-parallaxOriginX)*this._parallaxX+parallaxOriginX;camVector[1]=(camVector[1]-parallaxOriginY)*this._parallaxY+parallaxOriginY;camVector[2]*=Math.max(this._parallaxX,this._parallaxY);lookVector[0]=camVector[0]+lookDx;lookVector[1]=camVector[1]+lookDy;lookVector[2]=camVector[2]+lookDz}else{const [camX,camY,camZ]=this._Get2DCameraPosition(offX,offY,viewH);vec3.set(camVector, +camX,camY,camZ);vec3.set(lookVector,camX,camY,camZ-100);const a=this.GetAngle();if(a===0)vec3.set(upVector,0,1,0);else vec3.set(upVector,Math.sin(a),Math.cos(a),0)}renderer.CalculateLookAtModelView(outMat,camVector,lookVector,upVector,viewH||runtime.GetViewportHeight())}_SetProjectionMatrixChanged(){this._isProjectionMatrixChanged=true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetProjectionMatrix(renderer){if(this._isProjectionMatrixChanged){this._CalculateProjectionMatrix(renderer); +this._isProjectionMatrixChanged=false}return this._projectionMatrix}_CalculateProjectionMatrix(renderer){const canvasManager=this._runtime.GetCanvasManager();const [vpX,vpY]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())renderer.CalculateOrthographicMatrix(this._projectionMatrix,canvasManager.GetDrawWidth(),canvasManager.GetDrawHeight());else if(vpX===.5&&vpY===.5)mat4.copy(this._projectionMatrix,canvasManager.GetDefaultProjectionMatrix());else{const drawW=canvasManager.GetDrawWidth(); +const drawH=canvasManager.GetDrawHeight();renderer.CalculatePerspectiveMatrix(this._projectionMatrix,drawW/drawH,vpX,vpY)}}_SetTransform(renderer,updateProjection=true,offX=0,offY=0,viewH=0){if(updateProjection)renderer.SetProjectionMatrix(this._GetProjectionMatrix(renderer));let modelViewMatrix=null;if(offX===0&&offY===0&&viewH===0)modelViewMatrix=this._GetModelViewMatrix(renderer);else{this._CalculateModelViewMatrix(renderer,tempMat4,offX,offY,viewH);modelViewMatrix=tempMat4}renderer.SetModelViewMatrix(modelViewMatrix)}PrepareForDraw(renderer){this._SetTransform(renderer); +renderer.SetBaseZ(this.GetZElevation())}Draw(renderer,destinationRenderTarget,isFirstToTarget){const canvasManager=this._runtime.GetCanvasManager();const useOwnTexture=this.UsesOwnTexture();let ownRenderTarget=null;let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer=canvasManager.GetLayerTimingsBuffer(this);if(timingsBuffer){layerQuery=timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+ +1)*2);if(useOwnTexture){const rtOpts={sampling:this._runtime.GetSampling(),isSampled:true,canReadPixels:renderer.IsWebGPU()?this._runtime.UsesAnyBackgroundBlending():false};if(canvasManager.GetCurrentFullscreenScalingQuality()==="low"){rtOpts.width=canvasManager.GetDrawWidth();rtOpts.height=canvasManager.GetDrawHeight()}ownRenderTarget=this._runtime.GetAdditionalRenderTarget(rtOpts);this._curRenderTarget=ownRenderTarget;renderer.SetRenderTarget(ownRenderTarget);if(this.IsTransparent())renderer.ClearRgba(0, +0,0,0)}else{this._curRenderTarget=destinationRenderTarget;renderer.SetRenderTarget(destinationRenderTarget)}if(!this.IsTransparent())renderer.Clear(this._backgroundColor);this._layout._DrawLayerList(renderer,this._curRenderTarget,this._subLayers,useOwnTexture&&this.IsTransparent());this._SetTransform(renderer);renderer.SetBaseZ(this.GetZElevation());renderer.SetDepthEnabled(this.RendersIn3DMode());if(this.GetNormalScale()>Number.EPSILON){this._UpdateZIndices();const useRenderCells=this.UsesRenderCells()&& +this.GetZElevation()===0&&!this._anyInstanceZElevated;if(this.Has3DCamera())this._DrawInstances_3DCamera(renderer);else if(useRenderCells)this._DrawInstances_RenderCells(renderer);else this._DrawInstances(renderer,this._GetInstancesInDrawOrder())}renderer.SetBaseZ(0);renderer.SetCurrentZ(0);if(useOwnTexture){renderer.SetDepthEnabled(false);this._DrawLayerOwnTextureToRenderTarget(renderer,ownRenderTarget,destinationRenderTarget,isFirstToTarget)}if(layerQuery)renderer.EndQuery(layerQuery);if(this._runtime.IsGPUProfiling()&& +renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+1)*2+1);this._curRenderTarget=null}_DrawInstances(renderer,instances){const viewport=this.GetViewport();const renderTarget=this._curRenderTarget;const isOrthographic=this.GetLayout().IsOrthographicProjection();const hasVanishingPointOutsideViewport=this.GetLayout().HasVanishingPointOutsideViewport();let lastInst=null;for(let i=0,len=instances.length;i0)postRenderInstances.push(inst);const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst);let endIndex=i+1;for(;endIndex0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length===1&&!coplanarInstances[0].MustMitigateZFighting()){this._DrawInstanceMaybeWithEffects(inst,wi,renderer,renderTarget);for(let j=0,lenj=postRenderInstances.length;j0)if(this._IsPointBehindNearPlane(bbLeft,bbTop,topZ)||this._IsPointBehindNearPlane(bbRight,bbTop,topZ)||this._IsPointBehindNearPlane(bbRight,bbBottom,topZ)||this._IsPointBehindNearPlane(bbLeft,bbBottom,topZ))return null}else if(topZ>=this.GetCameraZ())return null;let [stlx,stly]=this.LayerToDrawSurface(bbLeft,bbTop,z);let [sbrx, +sbry]=this.LayerToDrawSurface(bbRight,bbBottom,z);if(this.GetAngle()!==0||depth>0||this.Has3DCamera()){const [strx,stry]=this.LayerToDrawSurface(bbRight,bbTop,z);const [sblx,sbly]=this.LayerToDrawSurface(bbLeft,bbBottom,z);if(depth>0){const [stlxTop,stlyTop]=this.LayerToDrawSurface(bbLeft,bbTop,topZ);const [strxTop,stryTop]=this.LayerToDrawSurface(bbRight,bbTop,topZ);const [sbrxTop,sbryTop]=this.LayerToDrawSurface(bbRight,bbBottom,topZ);const [sblxTop,sblyTop]=this.LayerToDrawSurface(bbLeft,bbBottom, +topZ);let temp=Math.min(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);sbrx=Math.max(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);stlx=temp;temp=Math.min(stly,sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);sbry=Math.max(stly,sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);stly=temp}else{let temp=Math.min(stlx,sbrx,strx,sblx);sbrx=Math.max(stlx,sbrx,strx,sblx);stlx=temp;temp=Math.min(stly,sbry,stry,sbly);sbry=Math.max(stly,sbry,stry,sbly);stly=temp}}tmpRect.set(stlx,stly,sbrx,sbry); +return tmpRect}_GetViewFrustum(){if(this._isViewFrustumChanged){this._UpdateViewFrustum();this._isViewFrustumChanged=false}return this._viewFrustum}_UpdateViewFrustum(){const renderer=this._runtime.GetRenderer();const matP=this._GetProjectionMatrix(renderer);const matMV=this._GetModelViewMatrix(renderer);this._viewFrustum.CalculatePlanes(matMV,matP)}_IsPointBehindNearPlane(x,y,z){return this._GetViewFrustum().IsBehindNearPlane(x,y,z)}_SaveToJson(){const o={"s":this.GetOwnScale(),"a":this.GetOwnAngle(), +"v":this._IsVisibleFlagSet(),"i":this.IsInteractive(),"bc":this._backgroundColor.toJSON(),"t":this.IsTransparent(),"sx":this._scrollX,"sy":this._scrollY,"hosp":this._hasOwnScrollPosition,"px":this.GetParallaxX(),"py":this.GetParallaxY(),"c":this._color.toJSON(),"sr":this.GetScaleRate(),"fx":this._effectList.SaveToJson(),"cg":this._createdGlobalUids};return o}_LoadFromJson(o){this._scale=o["s"];this._angle=o["a"];this._isVisible=!!o["v"];this._isInteractive=o.hasOwnProperty("i")?o["i"]:true;this._backgroundColor.setFromJSON(o["bc"]); +this._isTransparent=!!o["t"];if(o.hasOwnProperty("sx"))this._scrollX=o["sx"];if(o.hasOwnProperty("sy"))this._scrollY=o["sy"];if(o.hasOwnProperty("hosp"))this._hasOwnScrollPosition=!!o["hosp"];this._parallaxX=o["px"];this._parallaxY=o["py"];this._color.setFromJSON(o["c"]);this._scaleRate=o["sr"];C3.shallowAssignArray(this._createdGlobalUids,o["cg"]);C3.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const tempSet=new Set(this._createdGlobalUids);let j=0;for(let i=0,len=this._initialInstances.length;i< +len;++i)if(!tempSet.has(this._initialInstances[i][2])){this._initialInstances[j]=this._initialInstances[i];++j}C3.truncateArray(this._initialInstances,j);this._effectList.LoadFromJson(o["fx"]);this._needsRebuildEffectChainSteps=true;this._SortInstancesByLastCachedZIndex(false);this.SetZIndicesChanged();this._SetMVMatrixChanged();this._SetProjectionMatrixChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(inst){if(this._instances.includes(inst))return;if(inst.HasChildren()){const instances= +[...inst.allChildren()];instances.push(inst);instances.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});for(const instanceToAdd of instances){if(!instanceToAdd.IsInContainer())continue;for(const instanceToAddSibling of instanceToAdd.siblings()){if(instances.includes(instanceToAddSibling))continue;const siblingAndChildren=[...instanceToAddSibling.allChildren()];siblingAndChildren.push(instanceToAddSibling); +siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren||!siblingAndChildren.length)continue;instances.splice(instances.length,0,...siblingAndChildren)}}for(const instance of instances)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance,true)}else{if(inst.GetPlugin().IsWorldType())this._AddInstance(inst,true);if(!inst.IsInContainer())return; +for(const sibling of inst.siblings()){const siblingAndChildren=[...sibling.allChildren()];siblingAndChildren.push(sibling);siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren||!siblingAndChildren.length)continue;for(const instance of siblingAndChildren)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance,true)}}}}; + +} + +// layouts/layout.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const tempDestRect=C3.New(C3.Rect);const tempSrcRect=C3.New(C3.Rect);const tempLayoutRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const tempRender3dList=[];const tempInstanceList1=[];const tempInstanceList2=[];const tempInstanceList3=[];function vec3EqualsXYZ(v,x,y,z){return v[0]===Math.fround(x)&&v[1]===Math.fround(y)&&v[2]===Math.fround(z)} +let lastLayerPreparedForDrawing=null;function MaybePrepareLayerDraw(layer,renderer){if(lastLayerPreparedForDrawing===layer)return;layer.PrepareForDraw(renderer);lastLayerPreparedForDrawing=layer} +C3.Layout=class Layout extends C3.DefendedBase{constructor(layoutManager,index,data){super();this._layoutManager=layoutManager;this._runtime=layoutManager.GetRuntime();this._name=data[0];this._originalWidth=data[1];this._originalHeight=data[2];this._width=data[1];this._height=data[2];this._isUnboundedScrolling=!!data[3];this._isOrthographicProjection=!!data[4];this._vanishingPointX=data[5];this._vanishingPointY=data[6];this._eventSheetName=data[7];this._eventSheet=null;this._sid=data[8];this._index= +index;this._scrollX=0;this._scrollY=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._is3dCameraEnabled=false;this._cam3dposition=vec3.create();this._cam3dlook=vec3.create();this._cam3dup=vec3.create();this._rootLayers=[];this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const canvasManager=this._runtime.GetCanvasManager();this._effectList= +C3.New(C3.EffectList,this,data[11]);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layout=effectChain.GetContentObject();const renderSurface=layout.GetRenderTarget();renderer.ResetColor();renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface);canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)}); +this._needsRebuildEffectChainSteps=true;this._wasFullScreenQualityLow=false;this._curRenderTarget=null;this._persistData={};this._isFirstVisit=true;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);for(const layerData of data[9])this._rootLayers.push(C3.New(C3.Layer,this,null,layerData));this._allLayersFlat=[...this.allLayers()];for(let i=0,len=this._allLayersFlat.length;ie.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePostDraw:isFullscreenQualityLow,useFullSurface:true});this._needsRebuildEffectChainSteps=false;this._wasFullScreenQualityLow=isFullscreenQualityLow}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=true}GetMinLayerScale(){let m= +this._allLayersFlat[0].GetNormalScale();for(let i=1,len=this._allLayersFlat.length;irbound)x=rbound;if(xbbound)y=bbound;if(y1||vpY<0||vpY>1}SetPerspectiveProjection(){if(!this._isOrthographicProjection)return;this._isOrthographicProjection=false;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}SetOrthographicProjection(){if(this._isOrthographicProjection)return; +this._isOrthographicProjection=true;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(e){e=!!e;if(this._is3dCameraEnabled===e)return;this._is3dCameraEnabled=e;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(camX,camY,camZ, +lookX,lookY,lookZ,upX,upY,upZ){if(vec3EqualsXYZ(this._cam3dposition,camX,camY,camZ)&&vec3EqualsXYZ(this._cam3dlook,lookX,lookY,lookZ)&&vec3EqualsXYZ(this._cam3dup,upX,upY,upZ))return;vec3.set(this._cam3dposition,camX,camY,camZ);vec3.set(this._cam3dlook,lookX,lookY,lookZ);vec3.set(this._cam3dup,upX,upY,upZ);this.Set3DCameraChanged()}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(s){if(this._scale=== +s)return;this._scale=s;this._SetAllLayersMVChanged();this.BoundScrolling();this._runtime.UpdateRender()}SetAngle(a){a=C3.clampAngle(a);if(this._angle===a)return;this._angle=a;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(w){if(!isFinite(w)||w<1)return;this._width=w}GetHeight(){return this._height}SetHeight(h){if(!isFinite(h)||h<1)return;this._height=h}GetEventSheet(){return this._eventSheet}*allLayers(){for(const rootLayer of this._rootLayers)yield*rootLayer.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(p){if(typeof p=== +"number")return this.GetLayerByIndex(p);else return this.GetLayerByName(p.toString())}GetLayerByIndex(i){i=C3.clamp(Math.floor(i),0,this._allLayersFlat.length-1);return this._allLayersFlat[i]}GetLayerByName(name){return this._layersByName.get(name.toLowerCase())||null}GetLayerBySID(sid){return this._layersBySid.get(sid)||null}_SetAllLayersProjectionChanged(){for(const layer of this._allLayersFlat)layer._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const layer of this._allLayersFlat)layer._SetMVMatrixChanged()}SaveTransform(){return{"scrollX":this.GetScrollX(), +"scrollY":this.GetScrollY(),"scale":this.GetScale(),"angle":this.GetAngle(),"vpX":this.GetVanishingPointX(),"vpY":this.GetVanishingPointY()}}RestoreTransform(t){this.SetScrollX(t["scrollX"]);this.SetScrollY(t["scrollY"]);this.SetScale(t["scale"]);this.SetAngle(t["angle"]);this.SetVanishingPointXY(t["vpX"],t["vpY"])}GetLayoutBackgroundColor(){let firstDrawLayer=this._rootLayers.filter(l=>l.ShouldDraw())[0];while(firstDrawLayer){if(!firstDrawLayer.IsTransparent()){tempColor.copyRgb(firstDrawLayer.GetBackgroundColor()); +tempColor.setA(1);return tempColor}else if(firstDrawLayer.UsesOwnTexture()){tempColor.setRgba(0,0,0,0);return tempColor}firstDrawLayer=firstDrawLayer.GetSubLayers().filter(l=>l.ShouldDraw())[0]}tempColor.setRgba(0,0,0,0);return tempColor}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(objectClass){if(objectClass.IsInContainer())for(const containerType of objectClass.GetContainer().GetObjectTypes())this._initialObjectClasses.add(containerType); +else this._initialObjectClasses.add(objectClass)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(previousLayout,renderer){if(previousLayout===this||!renderer)return Promise.resolve();if(previousLayout){C3.CopySet(this._textureLoadedTypes,previousLayout._textureLoadedTypes);previousLayout._textureLoadedTypes.clear()}const promises=[];for(const oc of this._initialObjectClasses)if(!this._textureLoadedTypes.has(oc)){promises.push(oc.LoadTextures(renderer));this._textureLoadedTypes.add(oc)}return Promise.all(promises)}async MaybeLoadTexturesFor(objectClass){if(objectClass.IsFamily())throw new Error("cannot load textures for family"); +const renderer=this._runtime.GetRenderer();if(!renderer||renderer.IsContextLost()||this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.add(objectClass);const loadPromise=objectClass.LoadTextures(renderer);this._AddPendingTextureLoadPromise(loadPromise);await loadPromise;objectClass.OnDynamicTextureLoadComplete();this._runtime.UpdateRender()}_AddPendingTextureLoadPromise(promise){this._textureLoadPendingPromises.add(promise);promise.then(()=>this._textureLoadPendingPromises.delete(promise)).catch(()=> +this._textureLoadPendingPromises.delete(promise))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(objectClass){if(objectClass.IsFamily()||objectClass.GetInstanceCount()>0)throw new Error("cannot unload textures");const renderer=this._runtime.GetRenderer();if(!renderer||!this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.delete(objectClass);objectClass.ReleaseTextures(renderer)}_Unload(nextLayout,renderer){if(nextLayout=== +this||!renderer)return;for(const oc of this._textureLoadedTypes)if(!oc.IsGlobal()&&!nextLayout._initialObjectClasses.has(oc)){oc.ReleaseTextures();this._textureLoadedTypes.delete(oc)}}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(isFirstLayout){const runtime=this._runtime;const layoutManager=this._layoutManager;const eventSheetManager=runtime.GetEventSheetManager();if(this._eventSheetName){this._eventSheet=eventSheetManager.GetEventSheetByName(this._eventSheetName);this._eventSheet._UpdateDeepIncludes()}layoutManager._SetMainRunningLayout(this); +this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=runtime.GetOriginalViewportWidth()/2;this._scrollY=runtime.GetOriginalViewportHeight()/2;this.BoundScrolling();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._MoveGlobalObjectsToThisLayout(isFirstLayout);this._runtime.SetUsingCreatePromises(true);this._CreateInitialInstances();if(!this._isFirstVisit)this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances); +this._CreateInitialNonWorldInstances();layoutManager.ClearPendingChangeLayout();runtime.FlushPendingInstances();this._runtime.SetUsingCreatePromises(false);const createPromises=this._runtime.GetCreatePromises();await Promise.all(createPromises);C3.clearArray(createPromises);if(!runtime.IsLoadingState()){for(const inst of this._createdInstances)inst.SetupInitialSceneGraphConnections();for(const inst of this._createdInstances)inst._TriggerOnCreated()}C3.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(oc=> +oc.PreloadTexturesWithInstances(this._runtime.GetRenderer())));if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("beforefirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("beforeprojectstart"))}await this.DispatchUserScriptEventAsyncWait(new C3.Event("beforelayoutstart"));if(!runtime.IsLoadingState())await runtime.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutStart,null,null);runtime.Dispatcher().dispatchEvent(new C3.Event("afterlayoutstart"));await this.DispatchUserScriptEventAsyncWait(new C3.Event("afterlayoutstart")); +if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("afterfirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("afterprojectstart"))}eventSheetManager._RunQueuedTriggers(layoutManager);await this.WaitForPendingTextureLoadsToComplete();this._isFirstVisit=false}_MoveGlobalObjectsToThisLayout(isFirstLayout){for(const objectClass of this._runtime.GetAllObjectClasses()){if(objectClass.IsFamily()||!objectClass.IsWorldType())continue;for(const inst of objectClass.GetInstances()){const wi= +inst.GetWorldInfo();const oldLayer=wi.GetLayer();const layerIndex=C3.clamp(oldLayer.GetIndex(),0,this._allLayersFlat.length-1);const newLayer=this._allLayersFlat[layerIndex];wi._SetLayer(newLayer);newLayer._MaybeAddInstance(inst)}}if(!isFirstLayout)for(const layer of this._allLayersFlat)layer._SortInstancesByLastCachedZIndex(false)}_CreateInitialInstances(){for(const layer of this._allLayersFlat){layer.CreateInitialInstances(this._createdInstances);layer._Start()}}_CreatePersistedInstances(){let uidsChanged= +false;for(const [sidStr,typeData]of Object.entries(this._persistData)){const objectClass=this._runtime.GetObjectClassBySID(parseInt(sidStr,10));if(!objectClass||objectClass.IsFamily()||!objectClass.HasPersistBehavior())continue;for(const instData of typeData){let layer=null;if(objectClass.IsWorldType()){layer=this.GetLayerBySID(instData["w"]["l"]);if(!layer)continue}const inst=this._runtime.CreateInstanceFromData(objectClass,layer,false,0,0,true);inst.LoadFromJson(instData);uidsChanged=true;this._createdInstances.push(inst)}C3.clearArray(typeData)}for(const layer of this._allLayersFlat){layer._SortInstancesByLastCachedZIndex(true); +layer.SetZIndicesChanged()}if(uidsChanged){this._runtime.FlushPendingInstances();this._runtime._RefreshUidMap()}}_CreateAndLinkContainerInstances(createdInstances){for(const inst of createdInstances){if(!inst.IsInContainer())continue;const wi=inst.GetWorldInfo();const iid=inst.GetIID();for(const containerType of inst.GetObjectClass().GetContainer().objectTypes()){if(containerType===inst.GetObjectClass())continue;const instances=containerType.GetInstances();if(instances.length>iid)inst._AddSibling(instances[iid]); +else{let s;if(wi)s=this._runtime.CreateInstanceFromData(containerType,wi.GetLayer(),true,wi.GetX(),wi.GetY(),true);else s=this._runtime.CreateInstanceFromData(containerType,null,true,0,0,true);this._runtime.FlushPendingInstances();containerType._UpdateIIDs();inst._AddSibling(s);createdInstances.push(s)}}}}_CreateInitialNonWorldInstances(){for(const instData of this._initialNonWorld){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);if(!objectClass.IsInContainer())this._runtime.CreateInstanceFromData(instData, +null,true)}}_CreateGlobalNonWorlds(){const createdInstances=[];const initialNonWorld=this._initialNonWorld;let k=0;for(let i=0,len=initialNonWorld.length;il.ShouldDraw());for(let i=0,len=layersToDraw.length;i=2||tempRender3dList.length===1&&tempRender3dList[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(renderer,destRenderTarget,tempRender3dList);i+=tempRender3dList.length;C3.clearArray(tempRender3dList);continue}C3.clearArray(tempRender3dList)}layer.Draw(renderer,destRenderTarget, +canCopyFirstLayer&&i===0);++i}}_DrawLayoutOwnTextureToRenderTarget(renderer,ownRenderTarget){const activeEffectTypes=this._effectList.GetActiveEffectTypes();const runtime=this._runtime;if(activeEffectTypes.length===0){renderer.SetRenderTarget(null);renderer.SetTextureFillMode();renderer.CopyRenderTarget(ownRenderTarget);renderer.InvalidateRenderTarget(ownRenderTarget);runtime.ReleaseAdditionalRenderTarget(ownRenderTarget)}else{tempLayoutRect.set(0,0,runtime.GetViewportWidth(),runtime.GetViewportHeight()); +this.GetEffectChain().Render(renderer,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:tempLayoutRect,drawSurfaceRect:null,invalidateRenderTargets:true})}}_Draw3DLayers(renderer,renderTarget,layerList){if(!layerList[0].IsTransparent()){tempColor.copyRgb(layerList[0].GetBackgroundColor());tempColor.setA(1);renderer.Clear(tempColor)}const canvasManager= +this._runtime.GetCanvasManager();renderer.SetDepthEnabled(true);const fullInstanceList=tempInstanceList1;const coplanarInstances=tempInstanceList2;const postRenderInstances=tempInstanceList3;for(const layer of layerList){layer._UpdateZIndices();layer._AppendAllInstancesIncludingSubLayersInDrawOrder(fullInstanceList)}const firstLayer=layerList[0];let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer=canvasManager.GetLayerTimingsBuffer(firstLayer);if(timingsBuffer){layerQuery= +timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((firstLayer.GetIndex()+1)*2);for(let i=0,len=fullInstanceList.length;i0)postRenderInstances.push(inst);const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst); +let endIndex=i+1;for(;endIndex0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length===1&&!coplanarInstances[0].MustMitigateZFighting()){MaybePrepareLayerDraw(wiLayer, +renderer);wiLayer._DrawInstanceMaybeWithEffects(inst,wi,renderer,renderTarget);for(let j=0,lenj=postRenderInstances.length;j0}ChangeMainLayout(layout){this._pendingChangeLayout=layout}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const runningLayout=this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const runningLayout= +this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersMVChanged()}}; + +} + +// timelines/timelineManager.js +{ +'use strict';const C3=self.C3;const NAMES_REGEXP=new RegExp("<(.+?)>","g"); +C3.TimelineManager=class TimelineManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._timelineDataManager=C3.New(C3.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];this._hasRuntimeListeners=false;this._changingLayout=false;this._isTickingTimelines= +false;this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance);this._beforeLoad=e=>this._OnBeforeLoad();this._afterLoad=e=>this._OnAfterLoad();this._afterLayoutStart=e=>this._OnAfterLayoutStart();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._tickFunc=null;this._tick2Func= +null;this._beforeLayoutChange=null;this._layoutChange=null;this._instanceDestroy=null;this._afterLoad=null;for(const timeline of this._timelines){timeline.Stop();timeline.Release()}C3.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;C3.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;C3.clearArray(this._playingTimelines);this._playingTimelines=null;C3.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines= +null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;C3.clearArray(this._destroyedWhileLoadingState);this._destroyedWhileLoadingState=null;this._runtime=null}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("pretick",this._tickFunc);dispatcher.addEventListener("tick2",this._tick2Func);dispatcher.addEventListener("beforelayoutchange", +this._beforeLayoutChange);dispatcher.addEventListener("layoutchange",this._layoutChange);dispatcher.addEventListener("instancedestroy",this._instanceDestroy);dispatcher.addEventListener("beforeload",this._beforeLoad);dispatcher.addEventListener("afterload",this._afterLoad);dispatcher.addEventListener("afterlayoutstart",this._afterLayoutStart)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("pretick",this._tickFunc);dispatcher.removeEventListener("tick2", +this._tick2Func);dispatcher.removeEventListener("beforelayoutchange",this._beforeLayoutChange);dispatcher.removeEventListener("layoutchange",this._layoutChange);dispatcher.removeEventListener("instancedestroy",this._instanceDestroy);dispatcher.removeEventListener("beforeload",this._beforeLoad);dispatcher.removeEventListener("afterload",this._afterLoad);dispatcher.removeEventListener("afterlayoutstart",this._afterLayoutStart)}Create(timelineData){this._timelineDataManager.Add(timelineData);const timeline= +C3.TimelineState.CreateInitial(timelineData,this);this.Add(timeline);this.SetTimelineObjectClassesToMap(timeline);this._timelinesCreatedByTemplate.set(timeline.GetName(),0)}CreateFromTemplate(template){const timelineDataManager=this.GetTimelineDataManager();const templateName=template.GetTemplateName();const timelineDataItem=timelineDataManager.Get(templateName);const timeline=C3.TimelineState.CreateFromTemplate(`${templateName}:${this._timelinesCreatedByTemplate.get(templateName)}`,timelineDataItem, +this);this._IncreaseTemplateTimelinesCount(templateName);this.Add(timeline);return timeline}_IncreaseTemplateTimelinesCount(templateName){this._timelinesCreatedByTemplate.set(templateName,this._timelinesCreatedByTemplate.get(templateName)+1)}_SetCreatedTemplateTimelinesCount(){for(const timeline of this._timelines){if(timeline.IsTemplate())continue;const templateName=timeline.GetTemplateName();this._IncreaseTemplateTimelinesCount(templateName)}}_ClearCreatedTemplateTimelinesCount(){for(const templateName of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(templateName, +0)}Add(timeline){this._timelines.push(timeline);this._timelinesByName.set(timeline.GetName().toLowerCase(),timeline)}Remove(timeline){timeline.Removed();if(timeline.IsTemplate())return;C3.arrayFindRemove(this._timelines,timeline);C3.arrayFindRemove(this._scheduledTimelines,timeline);C3.arrayFindRemove(this._playingTimelines,timeline);C3.arrayFindRemove(this._markedForRemovalTimelines,timeline);this._timelinesByName.delete(timeline.GetName().toLowerCase());this.RemoveTimelineFromObjectClassMap(timeline); +if(!timeline.IsReleased())timeline.Release()}Trigger(method){this._runtime.Trigger(method,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(inst){this._pluginInstance=inst}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const timeline of this._timelines)yield timeline}SetTimelineObjectClassToMap(objectClass,timeline){if(!this._objectClassToTimelineMap.has(objectClass))this._objectClassToTimelineMap.set(objectClass, +new Set);this._objectClassToTimelineMap.get(objectClass).add(timeline)}SetTimelineObjectClassesToMap(timeline){for(const objectClass of timeline.GetObjectClasses())this.SetTimelineObjectClassToMap(objectClass,timeline)}RemoveTimelineFromObjectClassMap(timeline){for(const [objectClass,timelines]of this._objectClassToTimelineMap.entries())if(timelines.has(timeline)){timelines.delete(timeline);if(timelines.size===0)this._objectClassToTimelineMap.delete(objectClass)}}GetTimelinesForObjectClass(objectClass){if(!this._objectClassToTimelineMap.has(objectClass))return; +return this._objectClassToTimelineMap.get(objectClass)}GetTimelineOfTemplateForInstances(templateTimeline,instancesObject){if(!instancesObject)return;for(const timeline of this._timelines){const found=instancesObject.every(io=>{return timeline.HasTrackInstance(io.instance,io.trackId)});if(found)if(timeline.GetName().includes(templateTimeline.GetName()))return timeline}}GetTimelineByName(name){return this._timelinesByName.get(name.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(name){for(const timeline of this._scheduledTimelines)if(timeline.GetName()=== +name)return timeline;for(const timeline of this._playingTimelines)if(timeline.GetName()===name)return timeline;return null}*GetTimelinesByName(name){if(NAMES_REGEXP.test(name)){NAMES_REGEXP.lastIndex=0;let match;const uniqueNames=new Set;do{match=NAMES_REGEXP.exec(name);if(match){const names=match[1].split(",");for(const name of names)uniqueNames.add(name)}}while(match);for(const name of uniqueNames.values()){const timeline=this.GetTimelineByName(name);if(timeline)yield timeline}uniqueNames.clear()}else{const timeline= +this.GetTimelineByName(name);if(timeline)yield timeline}}*GetTimelinesByTags(tags){for(const timeline of this._timelines)if(timeline.HasTags(tags))yield timeline}AddScheduledTimeline(timeline){if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline);this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(timeline){C3.arrayFindRemove(this._playingTimelines,timeline);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(timeline){if(this._playingTimelines.includes(timeline)){timeline.SetPlaying(true); +timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false)}else{timeline.SetPlaying(false);timeline.SetScheduled(true);timeline.SetMarkedForRemoval(false);if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline)}this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.ResolvePlayPromise();C3.arrayFindRemove(this._scheduledTimelines,timeline);this._MaybeDisableRuntimeListeners()}CompleteTimeline(timeline){timeline.SetPlaying(false); +timeline.SetScheduled(false);if(this._playingTimelines.includes(timeline)){timeline.SetMarkedForRemoval(true);this._markedForRemovalTimelines.push(timeline);C3.arrayFindRemove(this._playingTimelines,timeline)}}CompleteTimelineBeforeChangeOfLayout(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false);timeline.SetPlaybackRate(1);C3.arrayFindRemove(this._playingTimelines,timeline)}CompleteTimelineAndResolve(timeline){this.CompleteTimeline(timeline);timeline.ResolvePlayPromise()}_OnTick(){if(this.GetRuntime().IsLoadingState())return; +if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;this._isTickingTimelines=true;while(this._scheduledTimelines.length){const t=this._scheduledTimelines.pop();t.SetInitialState();if(t.GetRenderChange()!==0)this._renderChange=1;this._playingTimelines.push(t)}const dt=this._runtime._GetDtFast();const dt1=this._runtime.GetDt1();const ts=this._runtime.GetTimeScale();for(let i=this._playingTimelines.length-1;i>=0;i--){const t=this._playingTimelines[i];if(t)t.Tick(dt,ts,dt1)}this._isTickingTimelines= +false;if(this._renderChange!==0)this.GetRuntime().UpdateRender()}_OnTick2(){if(this.GetRuntime().IsLoadingState())return;if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;let timelinesToRemove;for(let i=0,l=this._markedForRemovalTimelines.length;it)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}for(const timeline of this._playingTimelines.map(t=> +t)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}}_OnAfterLoad(){for(const destroyedInstance of this._destroyedWhileLoadingState)this._OnInstanceDestroy(destroyedInstance);C3.clearArray(this._destroyedWhileLoadingState)}_OnAfterLayoutStart(){const layoutManager=this._runtime.GetLayoutManager();const runningLayout=layoutManager.GetMainRunningLayout();if(!runningLayout)return;for(const timeline of this._timelines){const startOnLayout=timeline.GetStartOnLayout();if(!startOnLayout)continue; +if(runningLayout.GetName()===startOnLayout)this.ScheduleTimeline(timeline)}}_SaveToJson(){return{"timelinesJson":this._SaveTimelinesToJson(),"scheduledTimelinesJson":this._SaveScheduledTimelinesToJson(),"playingTimelinesJson":this._SavePlayingTimelinesToJson(),"markedForRemovalTimelinesJson":this._SaveMarkedForRemovalTimelinesToJson(),"hasRuntimeListeners":this._hasRuntimeListeners,"changingLayout":this._changingLayout,"isTickingTimelines":this._isTickingTimelines}}_LoadFromJson(o){if(!o)return;this._ClearCreatedTemplateTimelinesCount(); +this._LoadTimelinesFromJson(o["timelinesJson"]);this._LoadScheduledTimelinesFromJson(o["scheduledTimelinesJson"]);this._LoadPlayingTimelinesFromJson(o["playingTimelinesJson"]);this._LoadMarkedForRemovalTimelinesFromJson(o["markedForRemovalTimelinesJson"]);this._hasRuntimeListeners=!o["hasRuntimeListeners"];this._changingLayout=!!o["changingLayout"];this._isTickingTimelines=!!o["isTickingTimelines"];this._SetCreatedTemplateTimelinesCount();this._MaybeEnableRuntimeListeners();this._MaybeDisableRuntimeListeners()}_SaveTimelinesToJson(){return this._timelines.map(timelineState=> +timelineState._SaveToJson())}_LoadTimelinesFromJson(timelinesJson){for(const timelineJson of timelinesJson){let timeline=this.GetTimelineByName(timelineJson["name"]);if(timeline)timeline._LoadFromJson(timelineJson);else{const templateName=this._GetTemplateNameFromJson(timelineJson);if(!templateName)continue;const templateTimeline=this.GetTimelineByName(templateName);timeline=this.CreateFromTemplate(templateTimeline);timeline._LoadFromJson(timelineJson)}if(!timeline.HasTracks())this.Remove(timeline)}}_GetTemplateNameFromJson(timelineJson){const name= +timelineJson["name"];const nameParts=name.split(":");if(!nameParts||nameParts.length!==2)return null;return nameParts[0]}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(scheduledTimelinesJson){this._LoadTimelines(scheduledTimelinesJson,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(playingTimelinesJson){this._LoadTimelines(playingTimelinesJson, +this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(markedForRemovalTimelinesJson){this._LoadTimelines(markedForRemovalTimelinesJson,this._markedForRemovalTimelines)}_IsTimelineInJson(timeline,json){if(!json)return false;for(const name of json)if(name===timeline.GetName())return true;return false}_SaveTimelines(collection){return collection.map(t=>t.GetName())}_LoadTimelines(timelinesJson, +collection){const timelinesToRemove=new Set;for(const timeline of collection)if(!this._IsTimelineInJson(timeline,timelinesJson))timelinesToRemove.add(timeline);C3.arrayRemoveAllInSet(collection,timelinesToRemove);if(timelinesJson){const ff=tn=>t=>t.GetName()===tn;for(const name of timelinesJson){const timeline=this.GetTimelineByName(name);if(timeline){const t=collection.find(ff(name));if(!t)collection.push(timeline)}}}}}; + +} + +// timelines/state/timelineState.js +{ +'use strict';const C3=self.C3;const PING_PONG_BEGIN=0;const PING_PONG_END=1; +C3.TimelineState=class Timeline extends C3.DefendedBase{constructor(name,timelineDataItem,timelineManager){super();this._runtime=timelineManager.GetRuntime();this._timelineManager=timelineManager;this._timelineDataItem=timelineDataItem;this._name=name;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playPromise=null;this._playResolve=null;this._playheadTime=0;this._playbackRate=1;this._pingPongState=PING_PONG_BEGIN; +this._currentRepeatCount=1;this._isPlaying=false;this._isScheduled=false;this._initialStateSet=false;this._complete=true;this._released=false;this._markedForRemoval=false;this._completedTick=-1;this._implicitPause=false;this._isTemplate=false;this._finishedTriggers=false;this._firstTick=false;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=false;this._renderChange=0;this._hasNestedContent=0;this._iTimelineState=null}static CreateInitial(timelineDataJson,timelineManager){const timelineDataManager= +timelineManager.GetTimelineDataManager();const nameId=timelineDataManager.GetNameId();const timelineDataItem=timelineDataManager.Get(timelineDataJson[nameId]);const timeline=C3.New(C3.TimelineState,timelineDataJson[nameId],timelineDataItem,timelineManager);timeline.SetIsTemplate(true);return timeline}static CreateFromTemplate(name,timelineDataItem,timelineManager){return C3.New(C3.TimelineState,name,timelineDataItem,timelineManager)}Release(){if(this.IsReleased())return;const dispatcher=this._runtime.Dispatcher(); +this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const track of this._tracks)track.Release();C3.clearArray(this._tracks);this._tracks=null;this._runtime=null;this._timelineManager=null;this._timelineDataItem=null;this._released=true;this._playPromise=null;this._playResolve=null;this.FireReleaseEvent(dispatcher)}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"timelinestatereleased");event.timelineState=this;dispatcher.dispatchEvent(event)}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength= +this._tracks.push(C3.TrackState.Create(this,trackDataItem))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(instance,sourceAdapter,propertyName){if(!this._hasNestedContent)return;let ret;for(let i=0;i0}GetPlayPromise(){if(this._playPromise)return this._playPromise;this._playPromise=new Promise(resolve=>{this._playResolve=resolve});return this._playPromise}ResolvePlayPromise(){if(!this._playPromise)return;this._playResolve(); +this._playPromise=null;this._playResolve=null}SetTags(tags){this._tags=C3.TimelineState._GetTagArray(tags);this._tagsChanged=true}GetTags(){return this._tags}GetStringTags(){if(this._tagsChanged)this._stringTags=this._tags.join(" ");this._tagsChanged=false;return this._stringTags}HasTags(tags){if(!this._tags)return false;if(!this._tags.length)return false;const t=C3.TimelineState._GetTagArray(tags);if(!t)return false;if(!t.length)return false;return t.every(C3.TimelineState._HasTag,this)}OnStarted(){if(!C3.Plugins.Timeline|| +this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineStarted);C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return; +this._finishedTriggers=true;if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinished);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineFinished);C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}SetPlaying(p){this._isPlaying= +p}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(playingOnly=false){if(this.IsCompletedTick())return true;if(this.IsScheduled()&&!playingOnly)return true;return this._isPlaying}_IsPlaying(){return this.IsPlaying(true)}IsPaused(){return this._IsPaused()}_IsPaused(){if(this.IsReleased())return false;if(this.IsScheduled())return false;if(this._IsPlaying())return false;if(this.IsComplete())return false;return true}SetScheduled(s){this._isScheduled=s}IsScheduled(){return this._isScheduled}SetComplete(c){this._complete= +c;const t=this.GetTime();if(t<=0||t>=this.GetTotalTime())this._complete=true}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(mfr){this._markedForRemoval=mfr}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(ip){this._implicitPause=ip}IsImplicitPause(){return this._implicitPause}SetIsTemplate(it){this._isTemplate=!!it}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime}SetTime(time){const lastGlobalTime= +this.GetTime();this._SetTime(time);this.SetComplete(false);if(!this.IsComplete())this.SetImplicitPause(true);if(!this._IsPlaying()&&!this.IsScheduled()&&this._initialStateSet);else if(!this._IsPlaying()&&!this.IsScheduled()&&!this._initialStateSet)this.SetInitialStateFromSetTime();else if(this._IsPlaying())this.Stop();else if(this.IsScheduled()){this._timelineManager.DeScheduleTimeline(this);this.SetInitialStateFromSetTime()}this._SetUpdateStateBefore();this._Interpolate(this.GetTime(),false,true, +true,lastGlobalTime);this._SetUpdateStateAfter();if(this._renderChange)this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime(); +else this._playheadTime=time;for(const track of this._tracks)track.SetResetState()}_OnSetTime(){if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSet);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByTags);C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}_CanResume(){if(this.GetLoop())return true; +else if(this.GetPingPong()&&this._pingPongState===PING_PONG_END)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else{if(this.GetTime()<=0)return false}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else if(this.GetTime()<=0)return false;return true}Resume(){if(this.IsReleased())return;if(this._CanResume())this.Play(true)}Play(resume=false){if(this.IsReleased())return false;if(this.IsScheduled())return false; +if(this._IsPlaying()&&this.IsCompletedTick())return this._SchedulePlayingTimeline();if(this._IsPlaying())return false;if(!this.IsComplete()&&!resume&&!this.IsImplicitPause())return false;return this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(false);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return true}_ScheduleStoppedTimeline(){this.SetImplicitPause(false);this._timelineManager.ScheduleTimeline(this); +this.GetPlayPromise();return true}Stop(completed=false){if(this.IsReleased())return;this.SetComplete(completed);this._timelineManager.CompleteTimeline(this);if(this.IsComplete())this.ResolvePlayPromise()}Reset(render=true,beforeChangeLayout=false){if(this.IsReleased())return;if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(this.IsComplete())return;this.Stop(true);if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime()); +const time=this.GetTime();this._SetUpdateStateBefore();if(beforeChangeLayout)this._InterpolateBeforeChangeLayout(time);else this._Interpolate(time,false,false,true);if(render)this._OnSetTime();this._SetUpdateStateAfter();if(this._renderChange&&render)this.GetRuntime().UpdateRender()}ResetBeforeChangeLayout(){this.Reset(false,true)}_InterpolateBeforeChangeLayout(time){this._Interpolate(time,false,false,true,NaN,false,true)}_OnBeforeChangeLayout(){if(this.IsReleased())return true;if(!this.GetRuntime().IsLoadingState())if(this.HasValidGlobalTracks())return false; +this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);if(!this.GetRuntime().IsLoadingState())this.ResetBeforeChangeLayout();return true}SetInitialStateFromSetTime(){this.SetInitialState(true)}SetInitialState(fromSetTime){if(this.IsMarkedForRemoval())return;if(fromSetTime){this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState();this._SetUpdateStateAfter()}else{this.SetPlaying(true); +this.SetScheduled(false);this.OnStarted();if(this.IsComplete()){this._completedTick=-1;if(this._pingPongState!==PING_PONG_BEGIN)this._playbackRate=Math.abs(this._playbackRate);this._pingPongState=PING_PONG_BEGIN;this._currentRepeatCount=1;this._complete=false;this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime());this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState(); +this._SetUpdateStateAfter()}else{this._firstTick=true;this._finishedTriggers=false;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetResumeState();this._SetUpdateStateAfter()}}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=0;for(const track of this._tracks)if(track.IsNested())this._hasNestedContent=1}_SetUpdateStateAfter(){this._renderChange=0;for(const track of this._tracks){track._SetUpdateState();if(this._renderChange===0&&track.GetRenderChange()=== +1)this._renderChange=1;if(!this._beforeAndAfterTracks&&track.GetNeedsBeforeAndAfter()===1){if(!this._beforeAndAfterTracks)this._beforeAndAfterTracks=[];this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(track)}}}Tick(deltaTime,timeScale,deltaTime1){if(deltaTime===0&&this._lastDelta===0)return;this._lastDelta=deltaTime;const lastTime=this._playheadTime;const newDeltaTime=deltaTime*timeScale*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime; +if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<=0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&&pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1); +ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<=0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState, +0,2)}let i;const l=this._tracksLength;if(complete){for(i=0;i0){if(startOffset< +0)this._playheadTime=0;else if(startOffset>=totalTime)this._playheadTime=totalTime;else this._playheadTime=startOffset;track.Interpolate(startOffset,true,false,ensureValue,this._firstTick,false)}else track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false)}else for(i=0;i0){t=track.GetStartOffset();this._SetTime(t)}}track.Interpolate(t,isTicking,setTime,ensureValue, +this._firstTick,ignoreGlobals)}for(const track of this._tracks)track.AfterInterpolate();if(this._firstTick&&onTickCall)this._firstTick=false}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TrackState.Create(this,trackDataItem);this._tracksLength=this._tracks.push(track);return track}Removed(){if(this.IsReleased())return;for(const track of this._tracks)track.TimelineRemoved()}CleanCaches(){for(const track of this._tracks)track.CleanCaches()}ClearTrackInstances(){for(const track of this._tracks)track.ClearInstance()}SetTrackInstance(trackId, +instance){if(!instance)return;for(const track of this._tracks){if(!track.IsInstanceTrack())continue;if(trackId){if(track.GetId()!==trackId)continue;track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}else{if(track.HasInstance())continue;track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}}}HasTrackInstance(instance,trackId){for(const track of this._tracks){if(!track.IsInstanceTrack())continue; +if(trackId){if(trackId===track.GetId()&&instance===track.GetInstance())return true}else if(instance===track.GetInstance())return true}return false}HasValidTracks(){return this._tracks.some(t=>{if(t.IsInstanceTrack())return t.CanInstanceBeValid();else return true})}HasValidGlobalTracks(){return this._tracks.some(t=>{if(t.IsInstanceTrack()){if(!t.CanInstanceBeValid())return false;const objectClass=t.GetObjectClass();if(!objectClass)return false;return objectClass.IsGlobal()}else return false})}GetPropertyTrack(propertyName){for(const track of this.GetTracks())for(const propertyTrack of track.GetPropertyTracks())if(propertyTrack.GetPropertyName()=== +propertyName)return propertyTrack}GetTrackFromInstance(instance){for(const track of this._tracks)if(instance===track.GetInstance())return track;return null}GetKeyframeWithTags(tags){let tagsArray=tags?tags.split(" "):[];const tagsSet=new Set(tagsArray.map(t=>t.toLowerCase().trim()));tagsArray=[...tagsSet.values()];for(const track of this.GetTracks())for(const keyframeDataItem of track.GetKeyframeDataItems()){const hasAllTags=tagsArray.every(t=>keyframeDataItem.HasTag(t));if(hasAllTags)return keyframeDataItem}}GetObjectClasses(){const ret= +[];for(const track of this.GetTracks())ret.push(track.GetObjectClass());return ret.filter(oc=>oc)}_SaveToJson(){return{"tracksJson":this._SaveTracksToJson(),"name":this._name,"playheadTime":this.GetTime(),"playbackRate":this._playbackRate,"pingPongState":this._pingPongState,"currentRepeatCount":this._currentRepeatCount,"isPlaying":this._isPlaying,"isScheduled":this._isScheduled,"initialStateSet":this._initialStateSet,"finishedTriggers":this._finishedTriggers,"complete":this._complete,"released":this._released, +"markedForRemoval":this._markedForRemoval,"completedTick":this._completedTick,"implicitPause":this._implicitPause,"isTemplate":this._isTemplate,"tags":this._tags.join(" "),"stringTags":this._stringTags,"tagsChanged":this._tagsChanged,"firstTick":this._firstTick}}_LoadFromJson(o){if(!o)return;this._LoadTracksFromJson(o["tracksJson"]);this._name=o["name"];this._playheadTime=o["playheadTime"];this._playbackRate=o["playbackRate"];this._pingPongState=o["pingPongState"];this._currentRepeatCount=o["currentRepeatCount"]; +this._isPlaying=!!o["isPlaying"];this._isScheduled=!!o["isScheduled"];this._initialStateSet=!!o["initialStateSet"];this._finishedTriggers=o.hasOwnProperty("finishedTriggers")?!!o["finishedTriggers"]:false;this._complete=!!o["complete"];this._released=!!o["released"];this._markedForRemoval=!!o["markedForRemoval"];this._completedTick=o["completedTick"];this._implicitPause=!!o["implicitPause"];this._isTemplate=!!o["isTemplate"];this._tags=o["tags"].split(" ");this._stringTags=o["stringTags"];this._tagsChanged= +!!o["tagsChanged"];this._firstTick=!!o["firstTick"]}_SaveTracksToJson(){return this._tracks.map(trackState=>trackState._SaveToJson())}_LoadTracksFromJson(tracksJson){tracksJson.forEach((trackJson,i)=>{const track=this._tracks[i];track._LoadFromJson(trackJson)});this._tracks.filter(track=>track.CanInstanceBeValid())}static _HasTag(tag){const tags=this.GetTags();if(tag==="")return tags.length===1&&tags[0]==="";return tags.map(t=>t.toLowerCase()).includes(tag.toLowerCase())}static _GetTagArray(tags){if(C3.IsArray(tags))return tags.slice(0); +if(C3.IsString(tags))return tags.split(" ");throw new Error("invalid tags");}GetITimelineState(){if(!this._iTimelineState)this._iTimelineState=C3.New(self.ITimelineState,this);return this._iTimelineState}}; + +} + +// timelines/state/trackState.js +{ +'use strict';const C3=self.C3;const INSTANCE_TRACK=0;const VALUE_TRACK=1;const AUDIO_TRACK=2; +C3.TrackState=class Track extends C3.DefendedBase{constructor(timeline,trackDataItem){super();this._timeline=timeline;this._trackDataItem=trackDataItem;this._trackData=trackDataItem.GetTrackData();this._instanceUid=NaN;this._objectClassIndex=NaN;this._instance=null;this._worldInfo=null;this._isNested=trackDataItem.GetStartOffset()>0;this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray(); +this._propertyTracks=[];this.CreatePropertyTrackStates();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0}static Create(timeline,trackDataItem){return C3.New(C3.TrackState,timeline,trackDataItem)}Release(){this._keyframeDataItems=null;for(const propertyTrack of this._propertyTracks)propertyTrack.Release();C3.clearArray(this._propertyTracks);this._propertyTracks=null;this._timeline=null;this._instance=null;this._worldInfo=null;this._trackDataItem=null;this._lastKeyframeDataItem= +null}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.PropertyTrackState.Create(this,propertyTrackDataItem))}TimelineRemoved(){for(const propertyTrack of this._propertyTracks)propertyTrack.TimelineRemoved()}CleanCaches(){for(const propertyTrack of this._propertyTracks)propertyTrack.CleanCaches();this._instance=null;this._worldInfo=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){if(this._keyframeDataItems)return this._keyframeDataItems; +this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return this._keyframeDataItems}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(propertyName){for(let i=0;ipt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter= +1;this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time);this.OnKeyframeReached(this._GetLastKeyFrameBeforeTime(time))}SetResumeState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const playbackDirection=this._timeline.IsForwardPlayBack();const time=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time); +for(const propertyTrack of this._propertyTracks)propertyTrack.SetResumeState(time)}SetEndState(){if(this.GetTimeline().IsComplete())return;this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;if(!this._isNested){const time=this._timeline.GetTime();const totalTime=this.GetStartOffset()+this.GetLocalTotalTime();if(time>=totalTime)this.Interpolate(this.GetLocalTotalTime(),true,false,true);else if(time<=0)this.Interpolate(0,true,false,true)}}_SetUpdateState(){for(let i=0, +l=this._propertyTracks.length;ithis.GetLocalTotalTime())return;for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(this.GetLocalTotalTime(),false,true)}for(const propertyTrack of this._propertyTracks)propertyTrack.SetInitialState();this._initialStateOfNestedSet=true}MaybeSetEndStateOfNestedTrack(time,isTicking){if(!isTicking)return; +if(!this._isNested)return;if(this._endStateOfNestedSet)return;const timeline=this.GetTimeline();if(timeline.IsForwardPlayBack()){if(time>=this.GetLocalTotalTime()){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(this.GetLocalTotalTime(),false,true);this._endStateOfNestedSet=true}}else if(time<=0){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(0,false,true);this._endStateOfNestedSet=true}}MaybeTriggerKeyframeReachedConditions(time,isTicking,firstTick){if(firstTick)return; +if(!isTicking)return;if(!C3.Plugins.Timeline)return;const timeline=this.GetTimeline();const nextKeyframe=this._lastKeyframeDataItem.GetNext();const lastTime=this._lastKeyframeDataItem.GetTime();const nextTime=nextKeyframe?nextKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime){this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem);if(timeline.IsForwardPlayBack()){if(nextKeyframe)this.OnKeyframeReached(this._lastKeyframeDataItem)}else{const nextKeyframe= +this._lastKeyframeDataItem.GetNext();if(nextKeyframe)this.OnKeyframeReached(nextKeyframe)}}}_GetLastKeyFrameBeforeTime(time){const keyframeDataItem=this._trackData.GetKeyFrameDataItemAtTime(time,this._trackDataItem);if(keyframeDataItem)return keyframeDataItem;else return this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem)}OnKeyframeReached(keyframeDataItem){const timeline=this.GetTimeline();C3.Plugins.Timeline.Cnds.SetTriggerTimeline(timeline);C3.Plugins.Timeline.Cnds.SetTriggerKeyframe(keyframeDataItem); +const timelineManager=timeline.GetTimelineManager();timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyKeyframeReached);timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnKeyframeReached);C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null);C3.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}AddKeyframe(){const keyframeData=this._trackDataItem.GetKeyframeData();const keyframeDataItem=keyframeData.AddEmptyKeyframeDataItem();return keyframeDataItem}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData(); +const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.PropertyTrackState.Create(this,propertyTrackDataItem);this._propertyTracks.push(propertyTrack);return propertyTrack}DeleteKeyframes(match){const keyframeData=this._trackDataItem.GetKeyframeData();keyframeData.DeleteKeyframeDataItems(match)}DeletePropertyKeyframes(match){for(const propertyTrack of this._propertyTracks)propertyTrack.DeletePropertyKeyframes(match)}SaveState(){for(const propertyTrack of this._propertyTracks)propertyTrack.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance(); +if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;for(const propertyTrack of this._propertyTracks)propertyTrack.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;let difference=false;for(const propertyTrack of this._propertyTracks){const diff=propertyTrack.CompareSaveStateWithCurrent();if(!difference&&diff)difference=true}if(difference){const keyframeDataItem=this.AddKeyframe();keyframeDataItem.SetTime(this.GetTimeline().GetTime()); +keyframeDataItem.SetEase("noease");keyframeDataItem.SetEnable(true);keyframeDataItem.SetTags("")}}_SaveToJson(){const instance=this.GetInstance();const uid=instance?instance.GetUID():this.GetInstanceUID();return{"propertyTracksJson":this._SavePropertyTracksToJson(),"lastKeyframeDataItemJson":this._SaveLastKeyframeDataItemToJson(),"initialStateOfNestedSet":this._initialStateOfNestedSet,"endStateOfNestedSet":this._endStateOfNestedSet,"instanceUid":uid}}_LoadFromJson(o){if(!o)return;this._LoadPropertyTracksFromJson(o["propertyTracksJson"]); +this._LoadLastKeyframeDataItemFromJson(o["lastKeyframeDataItemJson"]);this._LoadInstanceFromJson(o["instanceUid"]);this._initialStateOfNestedSet=false;if(o.hasOwnProperty["initialStateOfNestedSet"])this._initialStateOfNestedSet=o["initialStateOfNestedSet"];this._endStateOfNestedSet=false;if(o.hasOwnProperty["endStateOfNestedSet"])this._endStateOfNestedSet=o["endStateOfNestedSet"];for(const propertyTrack of this._propertyTracks){if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange= +1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;if(this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter()))this._needsBeforeAndAfter=1}_SaveLastKeyframeDataItemToJson(){const keyframeData=this._trackDataItem.GetKeyframeData();return keyframeData.GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(propertyTrackState=>propertyTrackState._SaveToJson())}_LoadPropertyTracksFromJson(propertyTracksJson){propertyTracksJson.forEach((propertyTrackJson, +i)=>{const propertyTrack=this._propertyTracks[i];propertyTrack._LoadFromJson(propertyTrackJson)})}_LoadInstanceFromJson(uid){if(!C3.IsFiniteNumber(uid))return;const instance=this.GetRuntime().GetInstanceByUID(uid);if(!instance)return;const timeline=this.GetTimeline();timeline.ClearTrackInstances();timeline.SetTrackInstance(this._trackDataItem.GetId(),instance)}_LoadLastKeyframeDataItemFromJson(lastKeyframeDataItemIndex){const keyframeData=this._trackDataItem.GetKeyframeData();this._lastKeyframeDataItem= +keyframeData.GetKeyframeDataItemFromIndex(lastKeyframeDataItemIndex)}}; + +} + +// timelines/state/propertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState=class PropertyTrack extends C3.DefendedBase{constructor(track,propertyTrackDataItem){super();this._track=track;this._propertyTrackDataItem=propertyTrackDataItem;this._propertyTrackData=propertyTrackDataItem.GetPropertyTrackData();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._lastPropertyKeyframeDataItem= +null;this._absoluteValueObject=null}static Create(track,propertyTrackDataItem){return C3.New(C3.PropertyTrackState,track,propertyTrackDataItem)}Release(){this._track=null;if(this._sourceAdapter){this._sourceAdapter.Release();this._sourceAdapter=null}this._propertyKeyframeDataItems=null;this._propertyTrackDataItem=null;this._propertyTrackData=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(avo){this._absoluteValueObject= +avo}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;const id=this._propertyTrackDataItem.GetSourceAdapterId();let ret;switch(id){case "behavior":ret= +new C3.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":ret=new C3.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":ret=new C3.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":ret=new C3.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":ret=new C3.PropertyTrackState.PropertySourceAdapter(this);this._renderChange=1;this._worldInfoChange=1;break;case "value":ret=new C3.PropertyTrackState.ValueSourceAdapter(this); +break;case "audio":ret=new C3.PropertyTrackState.AudioSourceAdapter(this);break}this._sourceAdapter=ret;return this._sourceAdapter}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(said){this._propertyTrackDataItem.SetSourceAdapterId(said)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(sargs){this._propertyTrackDataItem.SetSourceAdapterArguments(sargs)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(pn){this._propertyTrackDataItem.SetProperty(pn)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(pt){this._propertyTrackDataItem.SetType(pt)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(min){this._propertyTrackDataItem.SetMin(min)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(max){this._propertyTrackDataItem.SetMax(max)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(e){this._propertyTrackDataItem.SetEnable(e)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(im){this._propertyTrackDataItem.SetInterpolationMode(im)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(rm){this._propertyTrackDataItem.SetResultMode(rm)}SetEase(e){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())propertyKeyframeDataItem.SetEase(e)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){if(this._propertyKeyframeDataItems)return this._propertyKeyframeDataItems; +this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();return this._propertyKeyframeDataItems}*GetPropertyKeyframeValues(){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())yield propertyKeyframeDataItem.GetValueWithResultMode()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetResetState(){this.GetSourceAdapter().SetResetState()}SetInitialState(time){this.GetSourceAdapter().SetInitialState(); +this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time);this._SetUpdateState()}SetResumeState(time){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time)}_SetUpdateState(){const track=this.GetTrack();this._needsBeforeAndAfter=0;if(track.IsInstanceTrack()){const timeline=this.GetTimeline();const instance=track.GetInstance();const sourceAdapter=this.GetSourceAdapter();const propertyName=this.GetPropertyName(); +const mayNeedBeforeAndAfterInterpolate=sourceAdapter.MayNeedBeforeAndAfterInterpolate();if(mayNeedBeforeAndAfterInterpolate){const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,propertyName);if(similarPropertyTracks&&similarPropertyTracks.length)this._needsBeforeAndAfter=1}else this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(time){const timeline=this.GetTimeline();const propertyKeyframeDataItem=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time, +this._propertyTrackDataItem);if(propertyKeyframeDataItem)return propertyKeyframeDataItem;else if(timeline.IsForwardPlayBack())return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(time,setTime=false,ensureValue=false){let start;let end;if(setTime)start= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);start=this._lastPropertyKeyframeDataItem}if(start)end=start.GetNext();this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue)}GetInterpolatedValue(time){if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime= +this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);const start=this._lastPropertyKeyframeDataItem; +const end=start.GetNext();return this._sourceAdapter.GetInterpolatedValue(time,start,end)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData;return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)}static GetEndPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData;return propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem=propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem= +null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){const difference=this.GetSourceAdapter().CompareInitialStateWithCurrent();if(difference){const propertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem);const currentState=this.GetSourceAdapter().GetCurrentState();propertyKeyframeDataItem.SetAbsoluteValue(currentState)}}CompareSaveStateWithCurrent(){const difference= +this.GetSourceAdapter().CompareSaveStateWithCurrent();if(difference)this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return difference}AddPropertyKeyframeAtCurrentTime(){const time=this.GetTimeline().GetTime();const sourceAdapter=this.GetSourceAdapter();const startPropertyKeyframe=C3.PropertyTrackState.GetStartPropertyKeyframeForTime(time,this);const propertyKeyframeDataItem=this.AddPropertyKeyframe();propertyKeyframeDataItem.SetType(startPropertyKeyframe.GetType()); +propertyKeyframeDataItem.SetTime(time);propertyKeyframeDataItem.SetEase(startPropertyKeyframe.GetEase());propertyKeyframeDataItem.SetEnable(true);propertyKeyframeDataItem.SetValue(sourceAdapter.GetValueAtTime());propertyKeyframeDataItem.SetAbsoluteValue(sourceAdapter.GetCurrentState())}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return;this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/propertySourceAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +NS.PropertySourceAdapter=class PropertySourceAdapter{constructor(propertyTrack){this._propertyTrack=propertyTrack;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){if(this._propertyAdapter){this._propertyAdapter.Release();this._propertyAdapter=null}this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){if(this._propertyAdapter)this._propertyAdapter.TimelineRemoved()}CleanCaches(){if(this._propertyAdapter)this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;this._propertyAdapter= +this._CreatePropertyAdapter();return this._propertyAdapter}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetResetState(){this.GetPropertyAdapter().SetResetState()}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this._propertyAdapter.BeforeChangeProperty()}Interpolate(time,start,end,setTime,ensureValue){const type=this._propertyTrack.GetPropertyKeyframeType();let value;switch(type){case "numeric":{value= +NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "angle":{value=NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "boolean":{value=NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "color":{value=NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "text":{value=NS.TextTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}}this._propertyAdapter.ChangeProperty(time,value, +start,end,setTime,ensureValue)}GetInterpolatedValue(time,start,end){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "angle":return NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "boolean":return NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "color":return NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "text":return NS.TextTypeAdapter.Interpolate(time, +start,end,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const propertyTrack= +this._propertyTrack;const track=propertyTrack.GetTrack();const time=track.GetTimeline().GetTime();const start=NS.GetStartPropertyKeyframeForTime(time,propertyTrack);const end=start.GetNext();const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{return NS.NumericTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "angle":{return NS.AngleTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "boolean":{return NS.BooleanTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "color":{return NS.ColorTypeAdapter.Interpolate(time, +start,end,propertyTrack)}case "text":{return NS.TextTypeAdapter.Interpolate(time,start,end,propertyTrack)}}}_CreatePropertyAdapter(){const pt=this._propertyTrack;const type=pt.CanHavePropertyKeyframes()?pt.GetPropertyKeyframeType():"";switch(type){case "combo":case "boolean":case "text":case "string":{return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this)}case "numeric":case "number":case "angle":{if(this._propertyTrack.GetPropertyType()==="combo")return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this); +return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}case "color":case "offsetColor":{return new NS.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}default:{return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}}_SaveToJson(){return{"propertyAdapterJson":this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return;this.GetPropertyAdapter()._LoadFromJson(o["propertyAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class InstanceVariableSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetIndex(){if(this._updatedIndex)return this._updatedIndex;return super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(index){const i=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX];if(i=== +index)return;this._updatedIndex=index}Interpolate(time,start,end,setTime,ensureValue){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;super.Interpolate(time,start,end,setTime,ensureValue)}GetInterpolatedValue(time,start,end){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;return super.GetInterpolatedValue(time,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"index":this._updatedIndex})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._updatedIndex= +o["index"]}}C3.PropertyTrackState.InstanceVariableSourceAdapter=InstanceVariableSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/behaviorSourceAdapter.js +{ +'use strict';const C3=self.C3;const SID=0;const INDEX=1;const NAME=2; +class BehaviorSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._sid=NaN}GetEditorIndex(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();return dataItem.GetSourceAdapterArguments()[INDEX]}GetTarget(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const track=this._propertyTrack.GetTrack();const sid=this._sid?this._sid:dataItem.GetSourceAdapterArguments()[SID];const instance=track.GetInstance();const index= +instance.GetBehaviorIndexBySID(sid);const behaviorInstance=instance.GetBehaviorInstances()[index];return behaviorInstance.GetSdkInstance()}GetBehaviorType(objectClass){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const name=dataItem.GetSourceAdapterArguments()[NAME];return objectClass.GetBehaviorTypeByName(name)}UpdateBehaviorTypeSid(sid){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();if(dataItem.GetSourceAdapterArguments()[SID]===sid)return;this._sid=sid}Interpolate(time, +start,end,setTime,ensureValue){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;super.Interpolate(time,start,end,setTime,ensureValue)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;return super.GetInterpolatedValue(time,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(), +{"sid":this._sid})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._sid=o["sid"]}}C3.PropertyTrackState.BehaviorSourceAdapter=BehaviorSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/effectSourceAdapter.js +{ +'use strict';const C3=self.C3;const NAME=0;const INDEX=1; +class EffectSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList); +const effectIndex=effectType.GetIndex();if(instanceEffectList.IsEffectIndexActive(effectIndex))return instanceEffectList.GetEffectParametersForIndex(effectIndex);return null}GetEffectType(effectList){const pTrack=this._propertyTrack;const name=pTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[NAME];return effectList.GetEffectTypeByName(name)}Interpolate(time,start,end,setTime,ensureValue){if(!this._IsEffectActive())return;super.Interpolate(time,start,end,setTime,ensureValue)}GetInterpolatedValue(time, +start,end){if(!this._IsEffectActive())return;return super.GetInterpolatedValue(time,start,end)}_IsEffectActive(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList);if(!effectType)return;const effectIndex=effectType.GetIndex();return instanceEffectList.IsEffectIndexActive(effectIndex)}} +C3.PropertyTrackState.EffectSourceAdapter=EffectSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/pluginSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class PluginSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(time,start,end,setTime,ensureValue){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin=track.GetInstance().GetObjectClass().GetPlugin(); +if(templatePlugin!==currentPlugin)return;super.Interpolate(time,start,end,setTime,ensureValue)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin=track.GetInstance().GetObjectClass().GetPlugin();if(templatePlugin!==currentPlugin)return;return super.GetInterpolatedValue(time,start,end)}}C3.PropertyTrackState.PluginSourceAdapter=PluginSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/valueSourceAdapter.js +{ +'use strict';const C3=self.C3; +class ValueSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._value=0;this._init=false}MayNeedBeforeAndAfterInterpolate(){return false}SetInitialState(){const propertyTrackData=this._propertyTrack.GetPropertyTrackData();let propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();propertyTrackDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem);this._value=propertyTrackDataItem.GetValueWithResultMode()}SetResumeState(){}GetValue(){if(!this._init)this._propertyTrack.Interpolate(0);return this._value}Interpolate(time, +start,end,setTime,ensureValue){this._value=C3.PropertyTrackState.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);this._init=true}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return false}CompareSaveStateWithCurrent(){return false}_SaveToJson(){return{"value":this._value,"init":this._init}}_LoadFromJson(o){if(!o)return;this._value=o["value"];this._init=o.hasOwnProperty("init")?o["init"]:true}} +C3.PropertyTrackState.ValueSourceAdapter=ValueSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/audioSourceAdapter.js +{ +'use strict';const C3=self.C3;const PROJECT_FILE=0;const PROJECT_FILE_NAME=0;const PROJECT_FILE_TYPE=1;const START_OFFSET=1;const AUDIO_DURATION=2;const AUDIO_TAG=3; +class AudioSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._audioPlaybackStarted=false;this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[PROJECT_FILE];this._startOffsetTime=this._sourceAdapterArgs[START_OFFSET];if(this._sourceAdapterArgs[AUDIO_TAG])this._audioTag= +this._sourceAdapterArgs[AUDIO_TAG];else this._audioTag=Math.random().toString(36).slice(2);this._pauseTime=NaN;this._pauseVolume=NaN;this._volume=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=null;this._track=null;this._sourceAdapterArgs=null;this._fileArgs=null;this._audioSource=null}_Initialize(){if(!self.C3.Plugins.Audio)return;const runtime=this._propertyTrack.GetRuntime();const audioObjectClass= +runtime.GetObjectClassByName("audio");if(audioObjectClass)this._sdkInstance=audioObjectClass.GetSingleGlobalInstance().GetSdkInstance();this._actions=self.C3.Plugins.Audio.Acts;this._expressions=self.C3.Plugins.Audio.Exps}_MaybeSetAudioSource(){if(this._audioSource)return;const track=this._propertyTrack.GetTrack();const audioSourcePropertyTrack=track.GetPropertyTrack("audioSource");if(audioSourcePropertyTrack)this._audioSource=audioSourcePropertyTrack.GetSourceAdapter()}_GetPauseVolume(){const track= +this._propertyTrack.GetTrack();const volumePropertyTrack=track.GetPropertyTrack("volume");if(volumePropertyTrack)return volumePropertyTrack.GetSourceAdapter()._pauseVolume;else return this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=false;if(this._sdkInstance){if(this._expressions){this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,this._audioTag);this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)}if(this._actions)this._actions.Stop.call(this._sdkInstance, +this._audioTag)}}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(v){this._volume=v}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=false}SetResumeState(){super.SetResumeState();const timeline=this._propertyTrack.GetTimeline();const time=timeline.GetTime();this._pauseTime=time-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{break}case "volume":{this._pauseVolume=this._propertyTrack.GetInterpolatedValue(time); +break}}this._audioPlaybackStarted=false}Interpolate(time,start,end,setTime,ensureValue){if(!this._sdkInstance)return;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{if(!this._timeline.IsForwardPlayBack())return;if(setTime){if(this._actions)this._actions.Stop.call(this._sdkInstance,this._audioTag);return}if(time{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem(); +const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem)});return propertyKeyframeDataItem.GetAbsoluteValue()}_CurrentKeyframeGetter(){const timeline=this._propertyTrack.GetTimeline(); +const time=timeline.GetTime()-this._propertyTrack.GetTrack().GetStartOffset();const propertyKeyframe=this._PickTimelinePlaybackMode(()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData(); +const ret=propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem);if(!ret)return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return ret});return propertyKeyframe.GetAbsoluteValue()}_PickTimelinePlaybackMode(forwardFunc,backwardFunc){const timeline=this._propertyTrack.GetTimeline();return timeline.IsForwardPlayBack()?forwardFunc():backwardFunc()}_PickResultMode(relativeFunc,absoluteFunc){const resultMode=this._propertyTrack.GetResultMode(); +return resultMode==="relative"?relativeFunc():absoluteFunc()}_PickFirstAbsoluteUpdate(firstFunc,otherFunc){if(this.GetFirstAbsoluteUpdate()){this.SetFirstAbsoluteUpdate(false);return firstFunc()}else return otherFunc()}_GetAbsoluteInitialValue(keyframeValue){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){if(this._target)return this._target;this._target=this._sourceAdapter.GetTarget();return this._target}_PickSource(bFunc,eFunc,ivFunc,pFunc,wiFunc,aFunc){const id=this._propertyTrack.GetSourceAdapterId(); +switch(id){case "behavior":return bFunc();case "effect":return eFunc();case "instance-variable":return ivFunc();case "plugin":return pFunc();case "world-instance":return wiFunc();case "audio":return aFunc()}}_SaveToJson(){return{"firstAbsoluteUpdate":this._firstAbsoluteUpdate,"saveState":this._saveState}}_LoadFromJson(o){if(!o)return;this._firstAbsoluteUpdate=o["firstAbsoluteUpdate"];this._saveState=o["saveState"]}_GetPropertyKeyframeStubs(propertyTracks,firstOnly=false){const ret=[];for(const propertyTrack of propertyTracks){const startOffset= +propertyTrack.GetTrack().GetStartOffset();for(const propertyKeyframeDataItem of propertyTrack.GetPropertyKeyframeDataItems())if(firstOnly&&propertyKeyframeDataItem.GetTime()===0)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()});else if(!firstOnly)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()})}return ret.sort((f,s)=>f.time-s.time)}_GetLastPropertyKeyframeStub(timeline, +time,propertyKeyframeStubs){return this._GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs)}_GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs){for(let i=propertyKeyframeStubs.length-1;i>=0;i--){const stubTime=propertyKeyframeStubs[i].time;if(stubTime<=time)return propertyKeyframeStubs[i]}return null}}; + +} + +// timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const TMP_COLORS_MAP=new Map;const TMP_COLOR=[0,0,0]; +class ColorInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._ToColorArray(target.GetPropertyValueByIndex(index));case "effect":return this._ToColorArray(target[index]);case "plugin":return this._ToColorArray(target.GetPropertyValueByIndex(index)); +case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const firstKeyframeColor=this._FirstKeyframeGetter();return!this._CompareColors(firstKeyframeColor,this._Getter())}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return!this._CompareColors(this._saveState,this._Getter())}_CompareColors(fColor,sColor){fColor=this._GetColorFromArray(fColor);sColor=this._GetColorFromArray(sColor);return fColor.equalsIgnoringAlpha(sColor)}_FirstKeyframeGetter(){const color= +super._FirstKeyframeGetter();return this._GetColorFromArray(color)}_CurrentKeyframeGetter(){const color=super._CurrentKeyframeGetter();return this._GetColorFromArray(color)}_GetAbsoluteInitialValue(value){}_ToColorArray(color){if(C3.IsInstanceOf(color,C3.Color))return color.toArray().slice(0,3);return color.slice(0,3)}_GetColorFromArray(color){if(C3.IsInstanceOf(color,C3.Color))return color;return new C3.Color(color[0],color[1],color[2],1)}CanChange(value){return true}MayNeedBeforeAndAfterInterpolate(){return true}BeforeChangeProperty(){const timeline= +this._propertyTrack.GetTimeline();const instance=this._propertyTrack.GetInstance();const sourceAdapter=this._propertyTrack.GetSourceAdapter();const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,this._property);if(propertyTracks&&propertyTracks.length>1){if(!TMP_COLORS_MAP.has(instance))TMP_COLORS_MAP.set(instance,new Map);const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))instanceMap.set(id,new Map);const sourceMap= +instanceMap.get(id);if(!sourceMap.has(this._property))sourceMap.set(this._property,{used:false,color:new C3.Color(0,0,0,1)})}}_GetTmpColor(instance,sourceId,propertyName){const tmpColorObj=TMP_COLORS_MAP.get(instance).get(sourceId).get(propertyName);tmpColorObj.used=true;return tmpColorObj.color}ChangeProperty(time,value,start,end,setTime){const timeline=this._propertyTrack.GetTimeline();const track=this._propertyTrack.GetTrack();const instance=this._propertyTrack.GetInstance();const sourceAdapter= +this._propertyTrack.GetSourceAdapter();const sourceAdapterId=this._propertyTrack.GetSourceAdapterId();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs=this._GetPropertyKeyframeStubs(propertyTracks,true);const stub=this._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(),propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time- +startOffset;if(t===0)this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(value[0],value[1],value[2]);else{if(t<0)return;const r=value[0];const g=value[1];const b=value[2];const v=this._propertyTrack.Interpolate(t,false,true);const dr=C3.Color.DiffChannel(r,v[0]);const dg=C3.Color.DiffChannel(g,v[1]);const db=C3.Color.DiffChannel(b,v[2]);this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(dr,dg,db)}}}else this._Setter(value[0],value[1],value[2])}AfterChangeProperty(){const instance= +this._propertyTrack.GetInstance();if(!TMP_COLORS_MAP.has(instance))return;const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))return;const sourceMap=instanceMap.get(id);if(!sourceMap.has(this._property))return;const tmpColorObj=sourceMap.get(this._property);const used=tmpColorObj.used;const color=tmpColorObj.color;if(used)this._Setter(color.getR(),color.getG(),color.getB());if(sourceMap.size===0)instanceMap.delete(id);if(instanceMap.size=== +0)TMP_COLORS_MAP.delete(instance)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "effect":return target[index].clone();case "plugin":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(r,g,b){const id=this._propertyTrack.GetSourceAdapterId(); +const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "effect":target[index].setRgb(r,g,b);break;case "plugin":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(r,g,b);break}}_SaveToJson(){}_LoadFromJson(o){}} +C3.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=ColorInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +class NoInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return false}ChangeProperty(time, +value,start,end,setTime){const propertyTrack=this._propertyTrack;const track=propertyTrack.GetTrack();const id=propertyTrack.GetSourceAdapterId();const timeline=propertyTrack.GetTimeline();const instance=track.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs=this._GetPropertyKeyframeStubs(propertyTracks); +const t=time+track.GetStartOffset();const stub=this._GetLastPropertyKeyframeStub(timeline,t,propertyKeyframeStubs);if(stub)value=stub.value}const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{if(!NS.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "angle":{if(!NS.AngleTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "boolean":{if(!NS.BooleanTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(), +value,id))return;break}case "color":{if(!NS.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "text":{if(!NS.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}}this._Setter(value)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index];case "instance-variable":return target.GetInstanceVariableValue(index); +case "plugin":return target.GetPropertyValueByIndex(index)}}_Setter(value){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value);break}}} +C3.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=NoInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState.PropertyInterpolationAdapter;const INSTANCE_FUNC_MAP=new Map;const add=(prop,setter,absolute_setter,getter,round,fRound=false,init=null,reset=null)=>{INSTANCE_FUNC_MAP.set(prop,{setter,absolute_setter,getter,round,fRound,init,reset})};add("offsetX",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetX(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetX(v)},(wi,v)=>wi.SetX(v),wi=>wi.GetX(),true); +add("offsetY",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetY(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetY(v)},(wi,v)=>wi.SetY(v),wi=>wi.GetY(),true); +add("offsetWidth",(wi,v,t,a,noChanges)=>{if(v===0)return;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentWidth()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size=(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalWidth();const sdki= +wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalWidth();return wi._GetSceneGraphInfo()._GetStartWidth()};const get_last_property_keyframe_value=(wi,t,propertyName)=>{const track=get_track(wi,t);if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!parentPropertyKeyframeData)return 0;const parentLastPropertyKeyframeDataItem= +parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=p._GetSceneGraphInfo()._GetStartWidth();const ownStartScale=p._GetSceneGraphInfo().GetStartScaleX();let absoluteToFactor=ownStartSize*ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetWidth");absoluteToFactor+=get_original_size(p,t)*get_last_property_keyframe_value(p,t,"offsetScaleX"); +for(let i=1;iwi.SetWidth(v),wi=>wi.GetWidth(),true); +add("offsetHeight",(wi,v,t,a,noChanges)=>{if(v===0)return;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentHeight()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size=(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalHeight(); +const sdki=wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalHeight();return wi._GetSceneGraphInfo()._GetStartHeight()};const get_last_property_keyframe_value=(wi,t,propertyName)=>{const track=t.GetTimeline().GetTrackFromInstance(wi.GetInstance());if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!parentPropertyKeyframeData)return 0; +const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=p._GetSceneGraphInfo()._GetStartHeight();const ownStartScale=p._GetSceneGraphInfo().GetStartScaleY();let absoluteToFactor=ownStartSize*ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetHeight");absoluteToFactor+=get_original_size(p,t)* +get_last_property_keyframe_value(p,t,"offsetScaleY");for(let i=1;iwi.SetHeight(v),wi=>wi.GetHeight(), +true);add("offsetAngle",(wi,v)=>wi.OffsetAngle(v),(wi,v)=>wi.SetAngle(v),wi=>wi.GetAngle(),false); +add("offsetOpacity",(wi,v,t,a)=>{const o=wi.GetOpacity();const nv=o+v;const min=0;const max=1;if(a._clampAccumulator===0){if(nv>max)a._clampAccumulator+=nv-max;else if(nv0&&a._clampAccumulator>0){if(nv>max)a._clampAccumulator+=nv-max}else if(v>0&&a._clampAccumulator<0){a._clampAccumulator+=v;if(a._clampAccumulator>0)a._clampAccumulator=0}else if(v<0&&a._clampAccumulator>0){a._clampAccumulator+=v;if(a._clampAccumulator< +0)a._clampAccumulator=0}else if(v<0&&a._clampAccumulator<0)if(nv{wi.SetOpacity(v)},wi=>{return wi.GetOpacity()},false,true,a=>{a._clampAccumulator=0;switch(a._propertyTrack.GetResultMode()){case "relative":{const propertyTrackData=a._propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=a._propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +let startingAbsoluteOpacity=a.GetWorldInfo().GetOpacity();let currentAbsoluteOpacity=startingAbsoluteOpacity;for(const propertyKeyframeDataItem of propertyKeyframeDataItems){const time=propertyKeyframeDataItem.GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity=startingAbsoluteOpacity+currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity,0,1)}a._totalForewardOpacityDelta=startingAbsoluteOpacity-currentAbsoluteOpacity;a._totalForewardOpacityDelta= +Math.round((a._totalForewardOpacityDelta+Number.EPSILON)*100)/100;currentAbsoluteOpacity=startingAbsoluteOpacity;for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const time=propertyKeyframeDataItems[i].GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity-=currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity,0,1)}a._totalBackwardOpacityDelta=currentAbsoluteOpacity;a._totalBackwardOpacityDelta=Math.round((a._totalBackwardOpacityDelta+ +Number.EPSILON)*100)/100;break}case "absolute":{break}}},a=>{switch(a._propertyTrack.GetResultMode()){case "relative":{a._clampAccumulator=0;const wi=a.GetWorldInfo();let currentOpacity=wi.GetOpacity();currentOpacity=Math.round((currentOpacity+Number.EPSILON)*100)/100;if(a._propertyTrack.GetTimeline().IsForwardPlayBack()){wi.SetOpacity(currentOpacity+a._totalForewardOpacityDelta);a._lastValue=0}else{wi.SetOpacity(currentOpacity-a._totalBackwardOpacityDelta);a._lastValue=a.GetSourceAdapter().GetValueAtTime()}break}case "absolute":{break}}}); +add("offsetOriginX",(wi,v)=>wi.OffsetOriginX(v),(wi,v)=>wi.SetOriginX(v),wi=>wi.GetOriginX(),false);add("offsetOriginY",(wi,v)=>wi.OffsetOriginY(v),(wi,v)=>wi.SetOriginY(v),wi=>wi.GetOriginY(),false);add("offsetZElevation",(wi,v)=>wi.OffsetZElevation(v),(wi,v)=>wi.SetZElevation(v),wi=>wi.GetZElevation(),true); +add("offsetScaleX",(wi,v,t,a)=>{if(v===0)return;const mirrorFactor=wi.GetWidth()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentWidth()){const value=t.GetOriginalWidth()*mirrorFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetWidth").setter(wi,1,t,a,true);wi.OffsetWidth(value/a._absoluteToFactor,true)}else wi.OffsetWidth(t.GetOriginalWidth()*mirrorFactor*v)},(wi,v,t)=>{wi.SetWidth(t.GetOriginalWidth()*v)},(wi,t)=>{const mirrorFactor= +wi.GetWidth()<0?-1:1;if(wi.GetTransformWithParentWidth()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetWidth()/parentTrack.GetOriginalWidth();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetWidth()/sdki.GetOriginalWidth();else parentScale=1}return wi.GetWidth()*mirrorFactor/(t.GetOriginalWidth()*parentScale)}else return wi.GetWidth()* +mirrorFactor/t.GetOriginalWidth()},false); +add("offsetScaleY",(wi,v,t,a)=>{if(v===0)return;const flipFactor=wi.GetHeight()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentHeight()){const value=t.GetOriginalHeight()*flipFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetHeight").setter(wi,1,t,a,true);wi.OffsetHeight(value/a._absoluteToFactor,true)}else wi.OffsetHeight(t.GetOriginalHeight()*flipFactor*v)},(wi,v,t)=>{wi.SetHeight(t.GetOriginalHeight()*v)},(wi,t)=>{const flipFactor= +wi.GetHeight()<0?-1:1;if(wi.GetTransformWithParentHeight()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetHeight()/parentTrack.GetOriginalHeight();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetHeight()/sdki.GetOriginalHeight();else parentScale=1}return wi.GetHeight()*flipFactor/(t.GetOriginalHeight()*parentScale)}else return wi.GetHeight()* +flipFactor/t.GetOriginalHeight()},false); +class NumericInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter);this._lastValue=0;this._clampAccumulator=0;this._totalForewardOpacityDelta=0;this._totalBackwardOpacityDelta=0;this._absoluteToFactor=NaN;this._instance_getter=null;this._instance_setter=null;this._instance_absolute_setter=null;this._reset_action=null;this._init_action=null;this._source_adapter_getter=null;this._source_adapter_setter=null;this._source_adapter_absolute_setter= +null;this._round=false;this._fRound=false;if(C3.IsInstanceOf(this._propertyTrack.GetTimeline(),C3.TweenState))this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this);else this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const property=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":{const p=INSTANCE_FUNC_MAP.get(property); +this._instance_getter=p.getter;this._instance_setter=p.setter;this._instance_absolute_setter=p.absolute_setter;this._round=p.round;this._fRound=p.fRound;this._init_action=p.init;this._reset_action=p.reset;break}case "audio":{this._source_adapter_getter=sourceAdapter.Getter;this._source_adapter_setter=sourceAdapter.Setter;this._source_adapter_absolute_setter=sourceAdapter.AbsoluteSetter;this._round=!!sourceAdapter.DoesRounding();this._fRound=false;break}}}Release(){this._typeAdapter=null;this._instance_getter= +null;this._instance_setter=null;this._instance_absolute_setter=null;this._absoluteToFactor=NaN;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(v){this._lastValue=v}SetResetState(){if(this._reset_action)this._reset_action(this)}SetInitialState(){const initValue=this._typeAdapter.SetInitialState();if(typeof initValue==="number")this._lastValue=initValue;if(this._init_action)this._init_action(this)}SetResumeState(){const resumeValue= +this._typeAdapter.SetResumeState();if(typeof resumeValue==="number")this._lastValue=resumeValue}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(time,value,start, +end,setTime,ensureValue,normalizedValue){return this._typeAdapter.ChangeProperty(time,value,start,end,setTime,ensureValue,normalizedValue)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index];case "instance-variable":return target.GetInstanceVariableValue(index); +case "plugin":return target.GetPropertyValueByIndex(index);case "world-instance":return this._instance_getter(wi,track);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),wi,track)}}_Setter(value,start,end){const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":target.OffsetPropertyValueByIndex(index,value);break;case "effect":target[index]+= +value;break;case "instance-variable":target.SetInstanceVariableOffset(index,value);break;case "plugin":target.OffsetPropertyValueByIndex(index,value);break;case "world-instance":this._instance_setter(wi,value,track,this);break;case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),wi,value,track,this);break}}_SetterAbsolute(value,start,end){const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId(); +switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value);break;case "world-instance":this._instance_absolute_setter(wi,value,track);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),wi,value,track);break}}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue){this._typeAdapter._MaybeEnsureValue(time, +start,end,setTime,lastValue,currentValue)}_AddDelta(value,start,end){const stringValue=value.toString();const decimalsString=stringValue.split(".")[1]||"";const decimalPlaces=decimalsString.length;const v=this._Getter();let rv;if(decimalPlaces===0)if(this._round)rv=Math.round(v);else if(this._fRound)rv=Math.round((v+Number.EPSILON)*100)/100;else rv=v;else if(this._round)rv=Number(C3.toFixed(v,decimalPlaces));else rv=v;this._Setter(rv-v,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(), +{"v":this._lastValue,"a":this._clampAccumulator,"fod":this._totalForewardOpacityDelta,"bod":this._totalBackwardOpacityDelta})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._lastValue=o["v"];this._clampAccumulator=o["a"];this._totalForewardOpacityDelta=C3.IsFiniteNumber(o["fod"])?o["fod"]:0;this._totalBackwardOpacityDelta=C3.IsFiniteNumber(o["bod"])?o["bod"]:0}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=NumericInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTimeline.js +{ +'use strict';const C3=self.C3;class AbsoluteValueObject{constructor(propertyTracks){this._used=false;this._value=0;this._propertyTracks=propertyTracks;for(let i=0,l=this._propertyTracks.length;i{return adapter._PickTimelinePlaybackMode(()=>0,()=>adapter.GetSourceAdapter().GetValueAtTime())},()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){const adapter= +this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{return false}case "absolute":{return true}}}BeforeChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();const property=propertyTrack.GetPropertyName();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const valueObj= +propertyTrack.GetAbsoluteValueObject();valueObj.Reset()}else{const timeline=propertyTrack.GetTimeline();const instance=propertyTrack.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property);if(similarPropertyTracks&&similarPropertyTracks.length>1)new AbsoluteValueObject(similarPropertyTracks)}break}}}ChangeProperty(time,value,start,end,setTime,ensureValue){const adapter=this._numericInterpolationAdapter; +const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{const lastValue=adapter.GetLastValue();adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value);adapter.SetLastValue(value);break}case "absolute":{const timeline=propertyTrack.GetTimeline();const track=propertyTrack.GetTrack();const instance=propertyTrack.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter(); +if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject=propertyTrack.GetAbsoluteValueObject();const similarpropertyTracks=absoluteValueObject.GetPropertyTracks();const propertyKeyframeStubs=adapter._GetPropertyKeyframeStubs(similarpropertyTracks,true);const stub=adapter._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(),propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time-startOffset;if(t===0){absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+ +value)}else{if(t<0)return;const v=propertyTrack.GetInterpolatedValue(t);absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+(value-v))}}}else adapter._SetterAbsolute(value);break}}}AfterChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject= +propertyTrack.GetAbsoluteValueObject();if(absoluteValueObject.GetUsed())adapter._SetterAbsolute(absoluteValueObject.GetValue())}break}}}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue){const adapter=this._numericInterpolationAdapter;if(setTime)return;if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(), +start,end)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=NumericInterpolationAdapterForTimeline; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTween.js +{ +'use strict';const C3=self.C3; +class NumericInterpolationAdapterForTween{constructor(numericInterpolationAdapter){this._numericInterpolationAdapter=numericInterpolationAdapter}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const adapter=this._numericInterpolationAdapter;adapter.SetFirstAbsoluteUpdate(true);return this._GetAbsoluteInitialValue(adapter._FirstKeyframeGetter())}SetResumeState(){const adapter=this._numericInterpolationAdapter;if(adapter._FirstKeyframeGetter()===adapter._CurrentKeyframeGetter())return;adapter.SetFirstAbsoluteUpdate(true); +return this._GetAbsoluteInitialValue(adapter._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return false}BeforeChangeProperty(){}ChangeProperty(time,value,start,end,setTime,ensureValue){const adapter=this._numericInterpolationAdapter;const lastValue=adapter.GetLastValue();switch(adapter.GetPropertyTrack().GetResultMode()){case "relative":{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value);break}case "absolute":{if(adapter.GetFirstAbsoluteUpdate()){adapter.SetFirstAbsoluteUpdate(false); +adapter._Setter(lastValue,start,end)}else{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value)}break}}adapter.SetLastValue(value)}AfterChangeProperty(){}_GetAbsoluteInitialValue(keyframeValue){const adapter=this._numericInterpolationAdapter;return keyframeValue-adapter.GetCurrentState()}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue){const adapter=this._numericInterpolationAdapter;if(setTime)if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(), +start,end);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end);else{if(!end)adapter._AddDelta(start.GetValueWithResultMode(),start,end)}else if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(),start,end)}} +C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=NumericInterpolationAdapterForTween; + +} + +// timelines/state/propertyTypeAdapters/numericTypeAdapter.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease; +C3.PropertyTrackState.NumericTypeAdapter=class NumericTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){if(mode=== +"step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const startAddon=start.GetAddOn("cubic-bezier");const endAddon=end.GetAddOn("cubic-bezier");const doCubicBezier=startAddon&&startAddon.GetStartEnable()&&endAddon&&endAddon.GetEndEnable();if(!doCubicBezier&&sv===ev)return sv;const st=start.GetTime();const et=end.GetTime();const n=C3.normalize(time,st,et);const e= +start.GetEase();let ret;if(doCubicBezier){const dt=et-st;ret=Ease.GetRuntimeEase(e)(dt*n,0,1,dt);ret=Ease.GetRuntimeEase("cubicbezier")(ret,sv,sv+startAddon.GetStartAnchor(),ev+endAddon.GetEndAnchor(),ev)}else ret=Ease.GetRuntimeEase(e)((et-st)*n,sv,ev-sv,et-st);if(propertyTrack.GetPropertyType()==="integer")return Math.floor(ret);return ret}}}; + +} + +// timelines/state/propertyTypeAdapters/angleTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.AngleTypeAdapter=class AngleTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){if(mode=== +"step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const angleAddon=start.GetAddOn("angle");if(angleAddon){const revolutions=angleAddon.GetRevolutions();if(sv===ev&&revolutions===0)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase());const easeRes=easeFunc(n,0,1,1);switch(angleAddon.GetDirection()){case "closest":return C3.angleLerp(sv, +ev,easeRes,revolutions);case "clockwise":return C3.angleLerpClockwise(sv,ev,easeRes,revolutions);case "anti-clockwise":return C3.angleLerpAntiClockwise(sv,ev,easeRes,revolutions)}}else{if(sv===ev)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase());return C3.angleLerp(sv,ev,easeFunc(n,0,1,1))}}}}; + +} + +// timelines/state/propertyTypeAdapters/booleanTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.BooleanTypeAdapter=class BooleanTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(!!oldValue===!!newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()?1:0}return start.GetValueWithResultMode()?1:0}}; + +} + +// timelines/state/propertyTypeAdapters/colorTypeAdapter.js +{ +'use strict';const C3=self.C3;const TEMP_COLOR_ARRAY=[0,0,0];const TEMP_COLOR_ARRAY_2=[0,0,0];const TEMP_COLOR_ARRAY_3=[0,0,0]; +C3.PropertyTrackState.ColorTypeAdapter=class ColorTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(Array.isArray(newValue)){TEMP_COLOR_ARRAY[0]=newValue[0];TEMP_COLOR_ARRAY[1]=newValue[1];TEMP_COLOR_ARRAY[2]= +newValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(newValue);TEMP_COLOR_ARRAY[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()*255);TEMP_COLOR_ARRAY[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(Array.isArray(oldValue)){TEMP_COLOR_ARRAY_2[0]=oldValue[0];TEMP_COLOR_ARRAY_2[1]=oldValue[1];TEMP_COLOR_ARRAY_2[2]=oldValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(oldValue);TEMP_COLOR_ARRAY_2[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()* +255);TEMP_COLOR_ARRAY_2[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY_2[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(TEMP_COLOR_ARRAY[0]!==TEMP_COLOR_ARRAY_2[0])return true;if(TEMP_COLOR_ARRAY[1]!==TEMP_COLOR_ARRAY_2[1])return true;if(TEMP_COLOR_ARRAY[2]!==TEMP_COLOR_ARRAY_2[2])return true;return false}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData(); +propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);const color=propertyTrackDataItem.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2];return TEMP_COLOR_ARRAY}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(mode==="discrete"){const color=start.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2]; +return TEMP_COLOR_ARRAY}else if(mode==="continuous"||mode==="step"){if(mode==="step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const n=C3.normalize(time,st,et);const e=start.GetEase();const sr=sv[0];const sg=sv[1];const sb=sv[2];const er=ev[0];const eg=ev[1];const eb=ev[2];const easeFunc=self.Ease.GetRuntimeEase(e); +const d=et-st;const dn=d*n;if(sr===er)TEMP_COLOR_ARRAY[0]=sr;else TEMP_COLOR_ARRAY[0]=easeFunc(dn,sr,er-sr,d);if(sg===eg)TEMP_COLOR_ARRAY[1]=sg;else TEMP_COLOR_ARRAY[1]=easeFunc(dn,sg,eg-sg,d);if(sb===eb)TEMP_COLOR_ARRAY[2]=sb;else TEMP_COLOR_ARRAY[2]=easeFunc(dn,sb,eb-sb,d);return TEMP_COLOR_ARRAY}}}; + +} + +// timelines/state/propertyTypeAdapters/textTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.TextTypeAdapter=class TextTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}return start.GetValueWithResultMode()}}; + +} + +// timelines/data/timelineDataManager.js +{ +'use strict';const C3=self.C3; +C3.TimelineDataManager=class TimelineDataManager{constructor(){this._timelineDataItems=new Map}Release(){for(const timelineDataItem of this._timelineDataItems.values())timelineDataItem.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(data){const timelineDataItem=new C3.TimelineDataItem(data);const name=timelineDataItem.GetName();this._timelineDataItems.set(name,timelineDataItem)}Get(name){return this._timelineDataItems.get(name)}GetNameId(){return 0}static _CreateDataItems(items,jsonItems, +dataItemConstructor,dataContainer){if(!jsonItems)return;for(const jsonItem of jsonItems)C3.TimelineDataManager._CreateDataItem("create",jsonItem,items,dataItemConstructor,dataContainer)}static _LoadDataItemsFromJson(items,jsonItems,dataItemConstructor,dataContainer){if(items.length)jsonItems.forEach((jsonItem,index)=>{items[index]._LoadFromJson(jsonItem)});else jsonItems.forEach(jsonItem=>{C3.TimelineDataManager._CreateDataItem("load",jsonItem,items,dataItemConstructor,dataContainer)})}static _CreateDataItem(mode, +json,items,dataItemConstructor,dataContainer){let dataItem;if(typeof dataItemConstructor==="function")switch(mode){case "load":dataItem=new dataItemConstructor(null,dataContainer);break;case "create":dataItem=new dataItemConstructor(json,dataContainer);break}else if(typeof dataItemConstructor==="object"){const prop=dataItemConstructor.prop;const value=json[prop];const cnstrctr=dataItemConstructor.map.get(value);switch(mode){case "load":dataItem=new cnstrctr(null,dataContainer);break;case "create":dataItem= +new cnstrctr(json,dataContainer);break}}switch(mode){case "load":dataItem._LoadFromJson(json);items.push(dataItem);break;case "create":if(typeof dataItem.GetEnable==="function"&&!dataItem.GetEnable())return dataItem.Release();items.push(dataItem);break}}}; + +} + +// timelines/data/timelineData.js +{ +'use strict';const C3=self.C3;const NAME=0;const TOTAL_TIME=1;const STEP=2;const INTERPOLATION_MODE=3;const RESULT_MODE=4;const TRACKS=5;const LOOP=6;const PING_PONG=7;const REPEAT_COUNT=8;const START_ON_LAYOUT=9;const TRANSFORM_WITH_SCENE_GRAPH=10; +C3.TimelineDataItem=class TimelineDataItem{constructor(timelineDataJson){this._name="";this._totalTime=NaN;this._step=0;this._interpolationMode="default";this._resultMode="default";this._loop=false;this._pingPong=false;this._repeatCount=1;this._trackData=null;this._startOnLayout="";this._transformWithSceneGraph=false;if(!timelineDataJson)return;this._name=timelineDataJson[NAME];this._totalTime=timelineDataJson[TOTAL_TIME];this._step=timelineDataJson[STEP];this._interpolationMode=timelineDataJson[INTERPOLATION_MODE]; +this._resultMode=timelineDataJson[RESULT_MODE];this._loop=!!timelineDataJson[LOOP];this._pingPong=!!timelineDataJson[PING_PONG];this._repeatCount=timelineDataJson[REPEAT_COUNT];this._startOnLayout=timelineDataJson[START_ON_LAYOUT];this._transformWithSceneGraph=!!timelineDataJson[TRANSFORM_WITH_SCENE_GRAPH];this._trackData=new C3.TrackData(timelineDataJson[TRACKS],this)}Release(){this._trackData.Release();this._trackData=null}GetTrackData(){if(!this._trackData)this._trackData=new C3.TrackData(null, +this);return this._trackData}GetName(){return this._name}SetName(n){this._name=n}GetTotalTime(){return this._totalTime}SetTotalTime(tt){this._totalTime=tt}GetStep(){return this._step}SetStep(s){this._step=s}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetLoop(){return this._loop}SetLoop(l){this._loop=l}GetPingPong(){return this._pingPong}SetPingPong(p){this._pingPong= +p}GetRepeatCount(){return this._repeatCount}GetStartOnLayout(){return this._startOnLayout}GetTransformWithSceneGraph(){return this._transformWithSceneGraph}_SaveToJson(){return{"trackDataJson":this._trackData._SaveToJson(),"name":this._name,"totalTime":this._totalTime,"step":this._step,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"loop":this._loop,"pingPong":this._pingPong,"repeatCount":this._repeatCount,"startOnLayout":this._startOnLayout,"transformWithSceneGraph":!!this._transformWithSceneGraph}}_LoadFromJson(o){if(!o)return; +this.GetTrackData()._LoadFromJson(o["trackDataJson"]);this._name=o["name"];this._totalTime=o["totalTime"];this._step=o["step"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._loop=o["loop"];this._pingPong=o["pingPong"];this._repeatCount=o["repeatCount"];this._startOnLayout=o["startOnLayout"];this._transformWithSceneGraph=!!o["transformWithSceneGraph"]}}; + +} + +// timelines/data/trackData.js +{ +'use strict';const C3=self.C3;const WI_DATA=0;const OC_INDEX=1;const WI_UID=2;const INTERPOLATION_MODE=1;const RESULT_MODE=2;const ENABLED=3;const KEYFRAMES=4;const PROPERTY_TRACKS=5;const ID=6;const NESTED_DATA=7;const START_OFFSET=0;const LOCAL_TOTAL_TIME=1;const WI_ADDITIONAL_DATA=8;const ORIGINAL_WIDTH=0;const ORIGINAL_HEIGHT=1;const TRACK_TYPE=9;const TRACK_NAME=10; +class TrackDataItem{constructor(trackDataJson,trackData){this._trackData=trackData;this._instanceData=null;this._additionalInstanceData=null;this._instanceUid=NaN;this._objectClassIndex=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._keyframeData=null;this._propertyTrackData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";if(!trackDataJson)return; +if(trackDataJson[WI_DATA]){this._instanceData=trackDataJson[WI_DATA];this._instanceUid=trackDataJson[WI_DATA][WI_UID];this._objectClassIndex=trackDataJson[WI_DATA][OC_INDEX]}this._interpolationMode=trackDataJson[INTERPOLATION_MODE];this._resultMode=trackDataJson[RESULT_MODE];this._enabled=!!trackDataJson[ENABLED];if(trackDataJson[ID])this._id=trackDataJson[ID];if(trackDataJson[NESTED_DATA]){this._nestedData=trackDataJson[NESTED_DATA];this._startOffset=trackDataJson[NESTED_DATA][START_OFFSET];this._localTotalTime= +trackDataJson[NESTED_DATA][LOCAL_TOTAL_TIME]}if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[TRACK_TYPE])this._type=trackDataJson[TRACK_TYPE];if(trackDataJson[TRACK_NAME])this._name=trackDataJson[TRACK_NAME];this._keyframeData=new C3.KeyframeData(trackDataJson[KEYFRAMES],this);this._propertyTrackData=new C3.PropertyTrackData(trackDataJson[PROPERTY_TRACKS], +this)}Release(){this._instanceData=null;this._trackData=null;if(this._keyframeData){this._keyframeData.Release();this._keyframeData=null}if(this._propertyTrackData){this._propertyTrackData.Release();this._propertyTrackData=null}this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){if(!this._keyframeData)this._keyframeData=new C3.KeyframeData(null,this);return this._keyframeData}GetPropertyTrackData(){if(!this._propertyTrackData)this._propertyTrackData=new C3.PropertyTrackData(null, +this);return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(index){this._objectClassIndex=index}GetInstanceUID(){return this._instanceUid}SetInstanceUID(uid){this._instanceUid=uid}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled= +!!e}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(t){this._localTotalTime=t}GetOriginalWidth(){return this._additionalInstanceData[ORIGINAL_WIDTH]}SetOriginalWidth(w){if(!this._additionalInstanceData)this._additionalInstanceData=[];this._additionalInstanceData[ORIGINAL_WIDTH]=w}GetOriginalHeight(){if(!this._additionalInstanceData)this._additionalInstanceData=[];return this._additionalInstanceData[ORIGINAL_HEIGHT]}SetOriginalHeight(h){if(!this._additionalInstanceData)this._additionalInstanceData= +[];this._additionalInstanceData[ORIGINAL_HEIGHT]=h}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{"keyframeDataJson":this._keyframeData._SaveToJson(),"propertyTrackDataJson":this._propertyTrackData._SaveToJson(),"instanceData":this._instanceData,"additionalInstanceData":this._additionalInstanceData,"instanceUid":this._instanceUid,"objectClassIndex":this._objectClassIndex,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled, +"id":this._id,"nestedData":this._nestedData,"type":this._type,"name":this._name}}_LoadFromJson(o){if(!o)return;this._instanceData=o["instanceData"];this._instanceUid=o["instanceUid"];this._objectClassIndex=o["objectClassIndex"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._id=o["id"];this._type=o["type"]?o["type"]:0;this._name=o["name"]?o["name"]:"";this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();if(o["nestedData"]){this._nestedData= +o["nestedData"];this._startOffset=this._nestedData[START_OFFSET];this._localTotalTime=this._nestedData[LOCAL_TOTAL_TIME]}if(o["additionalInstanceData"])this._additionalInstanceData=o["additionalInstanceData"];this.GetKeyframeData()._LoadFromJson(o["keyframeDataJson"]);this.GetPropertyTrackData()._LoadFromJson(o["propertyTrackDataJson"])}} +C3.TrackData=class TrackData{constructor(tracksDataJson,timelineDataItem){this._timelineDataItem=timelineDataItem;this._trackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._trackDataItems,tracksDataJson,TrackDataItem,this)}Release(){this._timelineDataItem=null;for(const trackDataItem of this._trackDataItems)trackDataItem.Release();C3.clearArray(this._trackDataItems);this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const trackDataItem= +new TrackDataItem(null,this);this._trackDataItems.push(trackDataItem);return trackDataItem}GetFirstKeyframeDataItem(trackDataItem){return trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return keyframeDataItems.at(-1)}GetKeyFrameDataItemAtTime(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length; +for(let i=0;itime)return keyframeDataItem}}GetFirstKeyFrameDataItemHigherOrEqualThan(time,trackDataItem){const keyframeDataItems= +trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length;for(let i=0;i=time)return keyframeDataItem}}GetFirstKeyFrameDataItemLowerOrEqualThan(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();for(let i=keyframeDataItems.length-1;i>=0;i--){const keyframeDataItem=keyframeDataItems[i];if(keyframeDataItem.GetTime()<=time)return keyframeDataItem}}*trackDataItems(){for(const trackDataItem of this._trackDataItems)yield trackDataItem}_SaveToJson(){return{"trackDataItemsJson":this._trackDataItems.map(trackDataItem=> +trackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,o["trackDataItemsJson"],TrackDataItem,this)}}; + +} + +// timelines/data/propertyTrackData.js +{ +'use strict';const C3=self.C3;const SOURCE_DATA=0;const SOURCE=0;const PROPERTY=1;const TYPE=2;const MIN=3;const MAX=4;const INTERPOLATION_MODE=5;const RESULT_MODE=6;const ENABLED=7;const PROPERTY_KEYFRAMES=8;const CAN_HAVE_PROPERTY_KEYFRAMES=9; +class PropertyTrackDataItem{constructor(propertyTrackDataJson,propertyTrackData){this._propertyTrackData=propertyTrackData;this._sourceAdapterId="";this._sourceAdapterArguments=null;this._property=null;this._type=null;this._min=NaN;this._max=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._propertyKeyframeData=null;this._canHavePropertyKeyframes=true;if(!propertyTrackDataJson)return;this._sourceAdapterId=propertyTrackDataJson[SOURCE_DATA][SOURCE];this._sourceAdapterArguments= +propertyTrackDataJson[SOURCE_DATA].slice(1);this._property=propertyTrackDataJson[PROPERTY];this._type=propertyTrackDataJson[TYPE];this._min=propertyTrackDataJson[MIN];this._max=propertyTrackDataJson[MAX];this._interpolationMode=propertyTrackDataJson[INTERPOLATION_MODE];this._resultMode=propertyTrackDataJson[RESULT_MODE];this._enabled=!!propertyTrackDataJson[ENABLED];this._propertyKeyframeData=new C3.PropertyKeyframeData(propertyTrackDataJson[PROPERTY_KEYFRAMES],this);this._canHavePropertyKeyframes= +propertyTrackDataJson[CAN_HAVE_PROPERTY_KEYFRAMES]}Release(){this._propertyKeyframeData.Release();this._propertyKeyframeData=null;this._propertyTrackData=null;this._sourceAdapterArguments=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){if(!this._propertyKeyframeData)this._propertyKeyframeData=new C3.PropertyKeyframeData(null,this);return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(said){this._sourceAdapterId= +said}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(sargs){this._sourceAdapterArguments=sargs}GetProperty(){return this._property}SetProperty(p){this._property=p}GetType(){return this._type}SetType(t){this._type=t}GetMin(){return this._min}SetMin(min){this._min=min}GetMax(){return this._max}SetMax(max){this._max=max}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode= +rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled=!!e}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{"propertyKeyframeDataJson":this._propertyKeyframeData._SaveToJson(),"sourceAdapterId":this._sourceAdapterId,"sourceAdapterArguments":this._sourceAdapterArguments,"property":this._property,"type":this._type,"min":this._min,"max":this._max,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"canHavePropertyKeyframes":this._canHavePropertyKeyframes}}_LoadFromJson(o){if(!o)return; +this._sourceAdapterId=o["sourceAdapterId"];this._sourceAdapterArguments=o["sourceAdapterArguments"];this._property=o["property"];this._type=o["type"];this._min=o["min"];this._max=o["max"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._canHavePropertyKeyframes=o["canHavePropertyKeyframes"];this.GetPropertyKeyframeData()._LoadFromJson(o["propertyKeyframeDataJson"])}} +C3.PropertyTrackData=class PropertyTrackData{constructor(propertyTracksDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._propertyTrackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,propertyTracksDataJson,PropertyTrackDataItem,this)}Release(){this._trackDataItem=null;for(const propertyTrackDataItem of this._propertyTrackDataItems)propertyTrackDataItem.Release();C3.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const propertyTrackDataItem= +new PropertyTrackDataItem(null,this);this._propertyTrackDataItems.push(propertyTrackDataItem);return propertyTrackDataItem}GetFirstPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();return propertyKeyframeData.GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +return propertyKeyframeDataItems.at(-1)}GetPropertyKeyFrameDataItemAtTime(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;itime)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData(); +const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;i=time)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const propertyKeyframeDataItem=propertyKeyframeDataItems[i];if(propertyKeyframeDataItem.GetTime()<=time)return propertyKeyframeDataItem}}*propertyTrackDataItems(){for(const propertyTrackDataItem of this._propertyTrackDataItems)yield propertyTrackDataItem}_SaveToJson(){return{"propertyTrackDataItemsJson":this._propertyTrackDataItems.map(propertyTrackDataItem=>propertyTrackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems, +o["propertyTrackDataItemsJson"],PropertyTrackDataItem,this)}}; + +} + +// timelines/data/keyframeData.js +{ +'use strict';const C3=self.C3;const TIME=0;const EASE=1;const ENABLE=2;const TAGS=3; +class KeyframeDataItem{constructor(keyframeDataJson,keyframeData){this._keyframeData=keyframeData;this._time=-1;this._ease="noease";this._enable=false;this._tags=null;this._lowerTags=null;if(!keyframeDataJson)return;this._time=keyframeDataJson[TIME];this._ease=keyframeDataJson[EASE];this._enable=!!keyframeDataJson[ENABLE];const tagStr=keyframeDataJson[TAGS];this._tags=tagStr?tagStr.split(" "):[];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()));this._next=null}Release(){this._keyframeData= +null;C3.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(next){this._next=next}GetTime(){return this._time}SetTime(t){this._time=t;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetTags(){return this._tags}SetTags(t){this._tags=t?t.split(" "):[];this._lowerTags=new Set(this._tags.map(t=> +t.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(tag){return this._lowerTags.has(tag.toLowerCase())}_SaveToJson(){return{"time":this._time,"ease":this._ease,"enable":this._enable,"tags":this._tags}}_LoadFromJson(o){if(!o)return;this._time=o["time"];this._ease=o["ease"];this._enable=o["enable"];this._tags=o["tags"];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()))}} +C3.KeyframeData=class KeyframeData{constructor(keyframesDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._keyframeDataItems=[];C3.TimelineDataManager._CreateDataItems(this._keyframeDataItems,keyframesDataJson,KeyframeDataItem,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const keyframeDataItem of this._keyframeDataItems)keyframeDataItem.Release();C3.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((first, +second)=>first.GetTime()-second.GetTime());for(let i=0;ia.GetTime()-b.GetTime())}GetKeyframeDataItemIndex(keyframeDataItem){return this._keyframeDataItems.indexOf(keyframeDataItem)}GetKeyframeDataItemFromIndex(index){return this._keyframeDataItems[index]}*keyframeDataItems(){for(const keyframeDataItem of this._keyframeDataItems)yield keyframeDataItem}*keyframeDataItemsReverse(){for(let i= +this._keyframeDataItems.length-1;i>=0;i--)yield this._keyframeDataItems[i]}_SaveToJson(){return{"keyframeDataItemsJson":this._keyframeDataItems.map(keyframeDataItem=>keyframeDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,o["keyframeDataItemsJson"],KeyframeDataItem,this);this._LinkKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeData.js +{ +'use strict';const C3=self.C3;const VALUE_DATA=0;const VALUE_DATA_VALUE=0;const VALUE_DATA_ABSOLUTE_VALUE=1;const VALUE_DATA_TYPE=2;const TIME=1;const EASE=2;const ENABLE=3;const ADDONS=4; +class PropertyKeyframeDataItem{constructor(propertyKeyframeDataJson,propertyKeyframeData){this._propertyKeyframeData=propertyKeyframeData;this._value=null;this._aValue=null;this._type="";this._time=NaN;this._ease="noease";this._enable=false;this._addonData=null;this._addonInstance=undefined;if(!propertyKeyframeDataJson)return;this._value=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_VALUE];this._aValue=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_ABSOLUTE_VALUE];this._type=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_TYPE]; +this._time=propertyKeyframeDataJson[TIME];this._ease=propertyKeyframeDataJson[EASE];this._enable=!!propertyKeyframeDataJson[ENABLE];this._addonData=null;if(!!propertyKeyframeDataJson[ADDONS])this._addonData=new C3.AddonData(propertyKeyframeDataJson[ADDONS],this);this._next=null}Release(){this._propertyKeyframeData=null;if(this._addonData){this._addonData.Release();this._addonData=null}}GetAddonData(){return this._addonData}SetNext(next){this._next=next}GetNext(){return this._next}GetValue(){return this._value}SetValue(value){if(this._type=== +"color"&&C3.IsFiniteNumber(value)){this._value[0]=C3.GetRValue(value);this._value[1]=C3.GetGValue(value);this._value[2]=C3.GetBValue(value)}else this._value=value}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(aValue){if(this._type==="color"&&C3.IsFiniteNumber(aValue)){this._aValue[0]=C3.GetRValue(aValue);this._aValue[1]=C3.GetGValue(aValue);this._aValue[2]=C3.GetBValue(aValue)}else this._aValue=aValue}GetValueWithResultMode(){const rm=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode(); +if(rm==="relative")return this.GetValue();else if(rm==="absolute")return this.GetAbsoluteValue()}GetType(){return this._type}SetType(t){this._type=t}GetTime(){return this._time}SetTime(t){this._time=t;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetAddOn(id){if(!this._addonData)return;if(this._addonInstance||this._addonInstance===null)return this._addonInstance;const addonArray= +this._addonData.GetAddDataItemArray();if(!addonArray){this._addonInstance=null;return this._addonInstance}const len=addonArray.length;for(let i=0;ifirst.GetTime()-second.GetTime());for(let i=0;ia.GetTime()-b.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetLastPropertyKeyframeDataItem(){return this._propertyKeyframeDataItems[this._propertyKeyframeDataItems.length-1]}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const propertyKeyframeDataItem of this._propertyKeyframeDataItems)yield propertyKeyframeDataItem}*propertyKeyframeDataItemsReverse(){for(let i= +this._propertyKeyframeDataItems.length-1;i>=0;i--)yield this._propertyKeyframeDataItems[i]}_SaveToJson(){return{"propertyKeyframeDataItemsJson":this._propertyKeyframeDataItems.map(propertyTrackDataItem=>propertyTrackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,o["propertyKeyframeDataItemsJson"],PropertyKeyframeDataItem,this);this._LinkPropertyKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeAddonData.js +{ +'use strict';const C3=self.C3;const ADDON_ID=0;const ADDON_DATA=1;class AddonDataItem{constructor(addonDataJson,addonData){this._addonData=addonData;this._id=addonDataJson[ADDON_ID];this._data=addonDataJson[ADDON_DATA]}Release(){this._addonData=null;this._data=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{"id":this._id,"data":this._data}}_LoadFromJson(o){if(!o)return;this._id=o["id"];this._data=o["data"]}}const START_ANCHOR=0;const START_ENABLE=1; +const END_ANCHOR=2;const END_ENABLE=3; +class AddonDataCubicBezierItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._startAnchor=this._data[START_ANCHOR];this._startEnable=!!this._data[START_ENABLE];this._endAnchor=this._data[END_ANCHOR];this._endEnable=!!this._data[END_ENABLE]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),{"startAnchor":this._startAnchor, +"startEnable":!!this._startEnable,"endAnchor":this._endAnchor,"endEnable":!!this._endEnable})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._startAnchor=o["startAnchor"];this._startEnable=!!o["startEnable"];this._endAnchor=o["endAnchor"];this._endEnable=!!o["endEnable"]}}const DIRECTION=0;const REVOLUTIONS=1; +class AddonDataAngleItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._direction=this._data[DIRECTION];this._revolutions=this._data[REVOLUTIONS]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),{"direction":this._direction,"revolutions":this._revolutions})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._direction=o["direction"]; +this._revolutions=o["revolutions"]}} +C3.AddonData=class AddonData{constructor(addonsDataJson,propertyKeyframeDataItem){this._propertyKeyframeDataItem=propertyKeyframeDataItem;this._addonDataItems=[];C3.TimelineDataManager._CreateDataItems(this._addonDataItems,addonsDataJson,{prop:0,map:new Map([["cubic-bezier",AddonDataCubicBezierItem],["angle",AddonDataAngleItem]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const addonDataItem of this._addonDataItems)addonDataItem.Release();C3.clearArray(this._addonDataItems);this._addonDataItems= +null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const addonDataItem of this._addonDataItems)yield addonDataItem}_SaveToJson(){return{"addonDataItemsJson":this._addonDataItems.map(addonDataItem=>addonDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,o["addonDataItemsJson"],{prop:"id",map:new Map([["cubic-bezier",AddonDataCubicBezierItem], +["angle",AddonDataAngleItem]])},this)}}; + +} + +// timelines/tweens/tweenState.js +{ +'use strict';const C3=self.C3;const INITIAL_VALUE_MODE_START_VALUE="start-value";const INITIAL_VALUE_MODE_CURRENT_STATE="current-state";const PING_PONG_BEGIN=0;const PING_PONG_END=1;let createdTweens=0; +C3.TweenState=class Tween extends C3.TimelineState{constructor(tweenDataItem,timelineManager){super(`tween-${createdTweens++}`,tweenDataItem,timelineManager);this._id="";this._destroyInstanceOnComplete=false;this._initialValueMode=INITIAL_VALUE_MODE_START_VALUE;this._instance=null;this._on_completed_callbacks=null;this._on_started_callbacks=null;this._track=null;this._iTweenState=null}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"tweenstatereleased");event.tweenState=this;dispatcher.dispatchEvent(event)}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(C3.TweenTrackState.Create(this, +trackDataItem));this._track=this._tracks[0]}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TweenTrackState.Create(this,trackDataItem);this._tracks.push(track);this._track=this._tracks[0];return track}GetPropertyTrack(propertyName){return this._track.GetPropertyTracks()[0]}SetPropertyType(type){this._propertyType=type}GetInstance(){const tracks=this.GetTracks();if(!tracks||!tracks.length)return;const track=tracks[0];this._track=track;if(!track)return; +const instance=track.GetInstance();return track.IsInstanceValid()?instance:undefined}AddStartedCallback(c){if(!this._on_started_callbacks)this._on_started_callbacks=[];this._on_started_callbacks.push(c)}AddCompletedCallback(c){if(!this._on_completed_callbacks)this._on_completed_callbacks=[];this._on_completed_callbacks.push(c)}RemoveStartedCallback(c){if(!this._on_started_callbacks)return;const index=this._on_started_callbacks.indexOf(c);if(index!==-1)this._on_started_callbacks.splice(index,1)}RemoveCompletedCallback(c){if(!this._on_completed_callbacks)return; +const index=this._on_completed_callbacks.indexOf(c);if(index!==-1)this._on_completed_callbacks.splice(index,1)}SetStartValue(startValue,propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks){if(propertyTrack.GetPropertyName()!==propertyName)continue;const propertyTrackData=propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem); +propertyKeyframeDataItem.SetValue(startValue);propertyKeyframeDataItem.SetAbsoluteValue(startValue)}}_GetPropertyTrackState(propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks)if(propertyTrack.GetPropertyName()===propertyName)return propertyTrack}BeforeSetEndValues(properties){for(const propertyName of properties){const propertyTrackState=this._GetPropertyTrackState(propertyName);this.SetStartValue(propertyTrackState.GetCurrentState(),propertyName)}if(this.IsForwardPlayBack()){const newTotalTime= +this.GetTotalTime()-this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(0)}else{const newTotalTime=this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(newTotalTime)}this.SetInitialStateFromSetTime()}SetEndValue(endValue,propertyName){const propertyTrackState=this._GetPropertyTrackState(propertyName);const propertyTrackData=propertyTrackState.GetPropertyTrackData(); +const propertyTrackDataItem=propertyTrackState.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);propertyKeyframeDataItem.SetTime(this.GetTotalTime());propertyKeyframeDataItem.SetValue(endValue);propertyKeyframeDataItem.SetAbsoluteValue(endValue)}SetId(id){this._id=id}GetId(){return this._id}SetInitialValueMode(initialValueMode){this._initialValueMode=initialValueMode}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(releaseOnComplete){this._destroyInstanceOnComplete= +releaseOnComplete}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const c of this._on_started_callbacks)c(this);if(this.IsComplete())return;for(const track of this._tracks)track.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return;this._finishedTriggers=true;if(this._on_completed_callbacks)for(const c of this._on_completed_callbacks)c(this)}SetTime(time){this._DeleteIntermediateKeyframes(); +super.SetTime(time)}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time;this._track.SetResetState()}SetInitialState(fromSetTime){if(!this.InitialStateSet()&&this.GetInitialValueMode()===INITIAL_VALUE_MODE_CURRENT_STATE)for(const track of this._tracks)track.CompareInitialStateWithCurrent();super.SetInitialState(fromSetTime)}Stop(completed=false){super.Stop(completed); +if(this.IsComplete())return;for(const track of this._tracks)track.SaveState()}Reset(render=true,beforeChangeLayout=false){this._DeleteIntermediateKeyframes();super.Reset(render,beforeChangeLayout)}_DeleteIntermediateKeyframes(){for(const track of this._tracks){const del=kf=>{const time=kf.GetTime();const totalTime=this.GetTotalTime();return time!==0&&time!==totalTime};track.DeleteKeyframes(del);track.DeletePropertyKeyframes(del)}}_OnBeforeChangeLayout(){if(this.IsReleased())return true;const instance= +this.GetInstance();if(instance&&instance.GetObjectClass().IsGlobal())return false;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return true}Tick(deltaTime,timeScale,deltaTime1){if(!this._instance)this._instance=this.GetInstance();if(!this._instance||this._instance.IsDestroyed()){this.Stop(true);this.OnCompleted();return}const instanceTimeScale=this._instance.GetTimeScale();if(instanceTimeScale!==-1)deltaTime=deltaTime1*instanceTimeScale;if(deltaTime=== +0&&this._lastDelta===0)return;this._lastDelta=deltaTime;const lastTime=this._playheadTime;const newDeltaTime=deltaTime*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime;if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>= +totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<= +0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&&pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue= +true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<=0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}if(complete){this._track.SetEndState();this.Stop(true);this.OnCompleted();return}this._track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false);if(this._firstTick)this._firstTick=false}_SaveToJson(){const ret=super._SaveToJson();const tweenDataItem= +this.GetTimelineDataItem();return Object.assign(ret,{"tweenDataItemJson":tweenDataItem._SaveToJson(),"id":this._id,"destroyInstanceOnComplete":this._destroyInstanceOnComplete,"initialValueMode":this._initialValueMode})}_LoadFromJson(o){if(!o)return;const tweenDataItem=this.GetTimelineDataItem();tweenDataItem._LoadFromJson(o["tweenDataItemJson"]);super._LoadFromJson(o);this._id=o["id"];this._destroyInstanceOnComplete=o["destroyInstanceOnComplete"];this._initialValueMode=o["initialValueMode"]}static IsPlaying(tween){return tween.IsPlaying()}static IsPaused(tween){return tween.IsPaused()}static Build(config){const timelineManager= +config.runtime.GetTimelineManager();const tweenDataItem=new C3.TimelineDataItem;if(config.json){tweenDataItem._LoadFromJson(config.json["tweenDataItemJson"]);const tween=new C3.TweenState(tweenDataItem,timelineManager);tween._LoadFromJson(config.json);return tween}else{const tween=new C3.TweenState(tweenDataItem,timelineManager);if(!C3.IsArray(config.propertyTracksConfig))config.propertyTracksConfig=[config.propertyTracksConfig];tween.SetId(config.id);tween.SetTags(config.tags);tween.SetInitialValueMode(config.initialValueMode); +tween.SetDestroyInstanceOnComplete(config.releaseOnComplete);tween.SetLoop(config.loop);tween.SetPingPong(config.pingPong);tween.SetTotalTime(config.time);tween.SetStep(0);tween.SetInterpolationMode("default");tween.SetResultMode(config.propertyTracksConfig[0].resultMode);const track=tween.AddTrack();track.SetInstanceUID(config.instance.GetUID());track.SetInterpolationMode("default");track.SetResultMode(config.propertyTracksConfig[0].resultMode);track.SetEnable(true);track.SetObjectClassIndex(config.instance.GetObjectClass().GetIndex()); +const sdkIntance=config.instance.GetSdkInstance();const w=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalWidth():config.instance.GetWorldInfo().GetWidth();const h=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalHeight():config.instance.GetWorldInfo().GetHeight();track.SetOriginalWidth(w);track.SetOriginalHeight(h);const startKeyframeDataItem=track.AddKeyframe();startKeyframeDataItem.SetTime(0);startKeyframeDataItem.SetEase("noease");startKeyframeDataItem.SetEnable(true);startKeyframeDataItem.SetTags(""); +const endKeyframeDataItem=track.AddKeyframe();endKeyframeDataItem.SetTime(config.time);endKeyframeDataItem.SetEase("noease");endKeyframeDataItem.SetEnable(true);endKeyframeDataItem.SetTags("");for(const propertyTrackConfig of config.propertyTracksConfig){const propertyTrack=track.AddPropertyTrack();propertyTrack.SetSourceAdapterId(propertyTrackConfig.sourceId);propertyTrack.SetSourceAdapterArgs(propertyTrackConfig.sourceArgs);propertyTrack.SetPropertyName(propertyTrackConfig.property);propertyTrack.SetPropertyType(propertyTrackConfig.type); +propertyTrack.SetMin(NaN);propertyTrack.SetMax(NaN);propertyTrack.SetInterpolationMode("default");propertyTrack.SetResultMode(propertyTrackConfig.resultMode);propertyTrack.SetEnable(true);const startPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();startPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);startPropertyKeyframeDataItem.SetTime(0);startPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease);startPropertyKeyframeDataItem.SetEnable(true);startPropertyKeyframeDataItem.SetValue(propertyTrackConfig.startValue); +startPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.startValue);const endPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();endPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);endPropertyKeyframeDataItem.SetTime(config.time);endPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease);endPropertyKeyframeDataItem.SetEnable(true);endPropertyKeyframeDataItem.SetValue(propertyTrackConfig.endValue);endPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.endValue); +propertyTrack.GetSourceAdapter()}return tween}}GetITweenState(behInst,opts){if(!this._iTweenState)this._iTweenState=C3.New(self.ITweenState,this,behInst,opts);return this._iTweenState}}; + +} + +// timelines/tweens/tweenTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenTrackState=class TweenTrack extends C3.TrackState{constructor(timeline,trackDataItem){super(timeline,trackDataItem);this._firstPropertyTrack=null;this._secondPropertyTrack=null}static Create(timeline,trackDataItem){return C3.New(C3.TweenTrackState,timeline,trackDataItem)}_CachePropertyTracks(){if(this._propertyTracks.length===1)this._firstPropertyTrack=this._propertyTracks[0];else{this._firstPropertyTrack=this._propertyTracks[0];this._secondPropertyTrack=this._propertyTracks[1]}}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem)); +this._CachePropertyTracks()}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData();const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem);this._propertyTracks.push(propertyTrack);this._CachePropertyTracks();return propertyTrack}SetInitialState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const timeline=this.GetTimeline();const isForwardPlayBack= +timeline.IsForwardPlayBack();const time=isForwardPlayBack?0:this.GetLocalTotalTime();for(const propertyTrack of this._propertyTracks){propertyTrack.SetInitialState(time);if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange=1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;const nba=this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter=1;this._lastKeyframeDataItem= +this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time)}BeforeInterpolate(){}Interpolate(time,isTicking=false,setTime=false,ensureValue=false,firstTick=false,ignoreGlobals=false){if(!this._instance)this.GetInstance();if(!this._instance)return;const instanceValid=!this._instance.IsDestroyed();if(!instanceValid)return false;if(ignoreGlobals&&this.GetObjectClass().IsGlobal())return false;if(this._secondPropertyTrack){this._firstPropertyTrack.Interpolate(time, +setTime,ensureValue);this._secondPropertyTrack.Interpolate(time,setTime,ensureValue)}else this._firstPropertyTrack.Interpolate(time,setTime,ensureValue);if(this._firstPropertyTrack.GetWorldInfoChange()!==0){if(!this._worldInfo)this._worldInfo=this._instance.GetWorldInfo();if(this._worldInfo)this._worldInfo.SetBboxChanged()}}AfterInterpolate(){}_LoadFromJson(o){super._LoadFromJson(o);this._CachePropertyTracks()}}; + +} + +// timelines/tweens/tweenPropertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenPropertyTrackState=class TweenPropertyTrackState extends C3.PropertyTrackState{constructor(track,propertyTrackDataItem){super(track,propertyTrackDataItem);this._basic=false}static Create(track,propertyTrackDataItem){return C3.New(C3.TweenPropertyTrackState,track,propertyTrackDataItem)}Interpolate(time,setTime=false,ensureValue=false){let start;let end;if(this._basic){start=this._propertyKeyframeDataItems[0];end=this._propertyKeyframeDataItems[1]}else if(setTime){start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem);end=start.GetNext()}else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);start=this._lastPropertyKeyframeDataItem;end=start.GetNext()}this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem=propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=this.GetPropertyKeyframeDataItems().length<= +2;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem=null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match);this._basic=this.GetPropertyKeyframeDataItems().length<=2}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson(),"basic":this._basic}}_LoadFromJson(o){if(!o)return;this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"]);this._basic= +o["basic"]}}; + +} + +// timelines/transitions/transition.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const NAME=0;const TRANSITION_KEYFRAMES=1; +C3.Transition=class Transition extends C3.DefendedBase{constructor(data,addCustomEase=true){super();this._name=data[NAME];this._linear=false;this._transitionKeyframes=[];for(const transitionKeyframeData of data[TRANSITION_KEYFRAMES]){const transitionKeyframe=C3.TransitionKeyframe.Create(this,transitionKeyframeData);this._transitionKeyframes.push(transitionKeyframe)}for(let i=0;ithis.Interpolate(t,sv,dv,tt))}static Create(data){return C3.New(C3.Transition,data)}Release(){for(const transitionKeyframe of this._transitionKeyframes)transitionKeyframe.Release();C3.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear(); +this._transitionKeyframeCache=null}MakeLinear(linear){this._linear=!!linear}GetTransitionKeyFrameAt(x){const transitionKeyframe=this._transitionKeyframeCache.get(x);if(transitionKeyframe)return transitionKeyframe;for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()===x){this._transitionKeyframeCache.set(x,transitionKeyframe);return transitionKeyframe}}GetFirstTransitionKeyFrameHigherThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()> +x)return transitionKeyframe}GetFirstTransitionKeyFrameHigherOrEqualThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()>=x)return transitionKeyframe}GetFirstTransitionKeyFrameLowerThan(x){for(let i=this._transitionKeyframes.length-1;i>=0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()= +0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()<=x)return transitionKeyframe}}Interpolate(time,startValue,deltaValue,totalTime){if(this._linear)return Ease.NoEase(time,startValue,deltaValue,totalTime);const n=time/totalTime;let start=this.GetFirstTransitionKeyFrameLowerOrEqualThan(n);let end=start.GetNext();if(!end){start=this.GetFirstTransitionKeyFrameLowerThan(n);end=start.GetNext()}const delta=end.GetValueX()-start.GetValueX();const nn=C3.mapToRange(n, +start.GetValueX(),end.GetValueX(),0,delta);const startX=start.GetValueX();const startY=start.GetValueY();const anchor1X=start.GetValueX()+start.GetStartAnchorX();const anchor1Y=start.GetValueY()+start.GetStartAnchorY();const anchor2X=end.GetValueX()+end.GetEndAnchorX();const anchor2Y=end.GetValueY()+end.GetEndAnchorY();const endX=end.GetValueX();const endY=end.GetValueY();let ret=Ease.GetRuntimeEase("spline")(nn,startX,startY,anchor1X,anchor1Y,anchor2X,anchor2Y,endX,endY,this._precalculatedSamples.get(start)); +ret+=start.GetValueY();return(1-ret)*startValue+ret*(startValue+deltaValue)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let i=0;ithis._OnInstanceDestroy(e.instance)}Release(){this.RemoveRuntimeListeners();if(this._templateDataMap){for(const objectClassTemplatesMap of this._templateDataMap.values())objectClassTemplatesMap.clear();this._templateDataMap.clear()}this._templateDataMap=null;this._runtime=null}Create(templateInstanceData){if(!this._templateDataMap)this._templateDataMap= +new Map;if(!templateInstanceData)return;const templateData=templateInstanceData[0][16];const templateName=templateData[0];const objectClassIndex=templateInstanceData[1];if(!this._templateDataMap.has(objectClassIndex))this._templateDataMap.set(objectClassIndex,new Map);const objectClassTemplatesMap=this._templateDataMap.get(objectClassIndex);objectClassTemplatesMap.set(templateName,templateInstanceData)}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.addEventListener("instancedestroy", +this._instanceDestroy)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.removeEventListener("instancedestroy",this._instanceDestroy)}HasTemplates(){if(!this._templateDataMap)return false;return this._templateDataMap.size!==0}GetTemplateData(objectClass_or_index,templateName){let index=0;if(objectClass_or_index instanceof C3.ObjectClass)index=objectClass_or_index.GetIndex();else index=objectClass_or_index;if(!this._templateDataMap.has(index))return;const ret= +this._templateDataMap.get(index).get(templateName);if(ret)return JSON.parse(JSON.stringify(ret));return undefined}MapInstanceToTemplateName(inst,templateName){if(!this._instanceToTemplateNameMap)this._instanceToTemplateNameMap=new WeakMap;if(this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.set(inst,templateName)}GetInstanceTemplateName(inst){if(!this._instanceToTemplateNameMap)return"";const ret=this._instanceToTemplateNameMap.get(inst);if(ret)return ret;return""}_OnInstanceDestroy(inst){if(!this._instanceToTemplateNameMap)return; +if(!this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.delete(inst)}}; + +} + +// events/stacks/solStack.js +{ +'use strict';const C3=self.C3; +C3.SolStack=class SolStack extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._stack=[];this._stack.push(C3.New(C3.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const s of this._stack)s.Release();C3.clearArray(this._stack);this._current=null;this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){const stack=this._stack;const index=++this._index; +if(index===stack.length){const sol=C3.New(C3.Sol,this);stack.push(sol);this._current=sol}else{const sol=stack[index];sol.Reset();this._current=sol}}PushCopy(){const stack=this._stack;const index=++this._index;if(index===stack.length)stack.push(C3.New(C3.Sol,this));const sol=stack[index];sol.Copy(stack[index-1]);this._current=sol}Pop(){this._current=this._stack[--this._index]}RemoveInstances(s){const stack=this._stack;for(let i=0,len=stack.length;i=0}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index=== +this._stack.length){const ret=C3.New(C3.Loop,this);this._stack.push(ret);return ret}else{const ret=this._stack[this._index];ret.Reset();return ret}}Pop(){--this._index}FindByName(name){const stack=this._stack;for(let i=this._index;i>=0;--i){const loop=stack[i];if(loop.GetName()===name)return loop}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}; + +} + +// events/stacks/loop.js +{ +'use strict';const C3=self.C3;C3.Loop=class Loop extends C3.DefendedBase{constructor(loopStack){super();this._loopStack=loopStack;this._name="";this._index=0;this._isStopped=false;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=false;this._end=NaN}SetName(name){this._name=name}GetName(){return this._name}SetIndex(i){this._index=i}GetIndex(){return this._index}Stop(){this._isStopped=true}IsStopped(){return this._isStopped}SetEnd(e){this._end=e}GetEnd(){return this._end}}; + +} + +// events/stacks/arrayStack.js +{ +'use strict';const C3=self.C3;C3.ArrayStack=class ArrayStack extends C3.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){C3.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const ret=[];this._stack.push(ret);return ret}else return this._stack[this._index]}Pop(){--this._index}}; + +} + +// events/eventSheetManager.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortSolArray(a,b){return a.GetIndex()-b.GetIndex()}function IsSolArrayIdentical(a,b){for(let i=0,len=a.length;ithis._InvokeFunctionFromJS(name,params)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null; +this._localVarStack.Release();this._localVarStack=null;C3.clearArray(this._queuedTriggers);C3.clearArray(this._queuedDebugTriggers);this._runtime=null;C3.clearArray(this._allSheets);this._sheetsByName.clear()}Create(eventSheetData){const eventSheet=C3.New(C3.EventSheet,this,eventSheetData);this._allSheets.push(eventSheet);this._sheetsByName.set(eventSheet.GetName().toLowerCase(),eventSheet)}_AddTriggerToPostInit(trig){this._triggersToPostInit.push(trig)}_PostInit(){for(const functionBlock of this._functionBlocksByName.values())functionBlock._PostInit(false); +for(const sheet of this._allSheets)sheet._PostInit();for(const sheet of this._allSheets)sheet._UpdateDeepIncludes();for(const trig of this._triggersToPostInit)trig._PostInit(false);C3.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(name){return this._sheetsByName.get(name.toLowerCase())||null}_RegisterGroup(group){this._allGroups.push(group);this._groupsByName.set(group.GetGroupName(),group)}_RegisterEventBlock(eventBlock){this._blocksBySid.set(eventBlock.GetSID(), +eventBlock)}_RegisterCondition(condition){this._cndsBySid.set(condition.GetSID(),condition)}_RegisterAction(action){this._actsBySid.set(action.GetSID(),action)}_RegisterFunctionBlock(functionBlock){this._functionBlocksByName.set(functionBlock.GetFunctionName().toLowerCase(),functionBlock)}_RegisterEventVariable(ev){this._eventVarsBySid.set(ev.GetSID(),ev);if(ev.IsGlobal())this._allGlobalVars.push(ev);else this._allLocalVars.push(ev)}_DeduplicateSolModifierList(arr){if(arr.length>=2)arr.sort(SortSolArray); +let candidateList=this._allUniqueSolModifiers.get(arr.length);if(!candidateList){candidateList=[];this._allUniqueSolModifiers.set(arr.length,candidateList)}for(let i=0,len=candidateList.length;iresolve=r);this._queuedDebugTriggers.push([method,inst,behaviorType,resolve]);return ret}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw new Error("should not be in breakpoint");const layoutManager=this._runtime.GetLayoutManager();while(this._queuedDebugTriggers.length){const [method,inst,behaviorType,resolve]=this._queuedDebugTriggers.shift();const ret=yield*this._DebugTrigger(layoutManager,method,inst,behaviorType);resolve(ret)}}async RunQueuedDebugTriggersAsync(){for(const breakEventObject of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(breakEventObject)}_FastTrigger(layoutManager, +method,inst,value){let ret=false;const layout=layoutManager.GetMainRunningLayout();const eventSheet=layout.GetEventSheet();if(!eventSheet)return;this._executingTriggerDepth++;this._runtime.PushCurrentLayout(layout);const deepIncludes=eventSheet.deepIncludes();for(let i=0,len=deepIncludes.length;i0}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return this._runningEventsDepth>0}IsInEventEngine(){return this.IsRunningEvents()||this.IsInTrigger()}_RunQueuedTriggers(layoutManager){for(const [method,inst,behaviorType]of this._queuedTriggers)this._Trigger(layoutManager, +method,inst,behaviorType);C3.clearArray(this._queuedTriggers)}BlockFlushingInstances(e){if(e)this._blockFlushingDepth++;else this._blockFlushingDepth--}IsFlushingBlocked(){return this._blockFlushingDepth>0}ClearSol(solModifiers){for(let i=0,len=solModifiers.length;iw.ShouldRelease());for(const w of toRelease)w.Release()}ClearAllScheduledWaits(){for(const w of this._scheduledWaits)w.Release();C3.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(s){for(const w of this._scheduledWaits)w.RemoveInstances(s)}AddAsyncActionPromise(p){this._asyncActionPromises.push(p)}ClearAsyncActionPromises(){C3.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const ret=Promise.all(this._asyncActionPromises); +this._asyncActionPromises=[];return ret}_SaveToJson(){return{"groups":this._SaveGroupsToJson(),"cnds":this._SaveCndsToJson(),"acts":this._SaveActsToJson(),"vars":this._SaveVarsToJson(),"waits":this._SaveScheduledWaitsToJson()}}_LoadFromJson(o){this._LoadGroupsFromJson(o["groups"]);this._LoadCndsFromJson(o["cnds"]);this._LoadActsFromJson(o["acts"]);this._LoadVarsFromJson(o["vars"]);this._LoadScheduledWaitsFromJson(o["waits"])}_SaveGroupsToJson(){const o={};for(const group of this.GetAllGroups())o[group.GetSID().toString()]= +group.IsGroupActive();return o}_LoadGroupsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const group=this.GetEventGroupBySID(sid);if(group)group.SetGroupActive(data)}}_SaveCndsToJson(){const o={};for(const [sid,cnd]of this._cndsBySid){const data=cnd._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadCndsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,cnd]of this._cndsBySid)cnd._LoadFromJson(map.get(sid)|| +null)}_SaveActsToJson(){const o={};for(const [sid,act]of this._actsBySid){const data=act._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadActsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,act]of this._actsBySid)act._LoadFromJson(map.get(sid)||null)}_SaveVarsToJson(){const o={};for(const [sid,eventVar]of this._eventVarsBySid)if(!eventVar.IsConstant()&&(eventVar.IsGlobal()||eventVar.IsStatic()))o[sid.toString()]= +eventVar.GetValue();return o}_LoadVarsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const eventVar=this.GetEventVariableBySID(sid);if(eventVar)eventVar.SetValue(data)}}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(w=>!w.IsPromise()).map(w=>w._SaveToJson())}_LoadScheduledWaitsFromJson(arr){this.ClearAllScheduledWaits();for(const data of arr){const sw=C3.ScheduledWait._CreateFromJson(this,data);if(sw)this._scheduledWaits.push(sw)}}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(l=> +l.GetEventSheet()).filter(eventSheet=>eventSheet).map(e=>e._GetPerfRecord())}FindFirstFunctionBlockParent(parent){while(parent){const scopeParent=parent.GetScopeParent();if(scopeParent instanceof C3.FunctionBlock)return scopeParent;parent=scopeParent}return null}_InvokeFunctionFromJS(name,params){if(!Array.isArray(params))params=[];const functionBlock=this.GetFunctionBlockByName(name.toLowerCase());if(!functionBlock)return null;if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +const functionParameters=functionBlock.GetFunctionParameters();if(params.length1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i< +len;++i)if(!parents[i].RunPreTrigger(frame)){okToRun=false;break}}if(okToRun){if(trigger.IsOrBlock())trigger.RunOrBlockTrigger(frame,index);else trigger.Run(frame);ret=frame.GetLastEventTrue()}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();eventSheetManager.PopSol(trigger.GetSolModifiersIncludingParents());if(currentEvent)eventSheetManager.PopSol(currentEvent.GetSolModifiersIncludingParents());if(!currentEvent&&triggerDepth===1){eventSheetManager.ClearAsyncActionPromises(); +if(!eventSheetManager.IsFlushingBlocked())runtime.FlushPendingInstances()}return ret}*_DebugExecuteTrigger(inst,trigger,index){const runtime=this._runtime;const eventSheetManager=this._eventSheetManager;const currentEvent=eventSheetManager.GetCurrentEvent();const eventStack=eventSheetManager.GetEventStack();const triggerDepth=eventSheetManager.GetTriggerDepth();let ret=false;if(currentEvent)eventSheetManager.PushCleanSol(currentEvent.GetSolModifiersIncludingParents());eventSheetManager.PushCleanSol(trigger.GetSolModifiersIncludingParents()); +const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i0){let hasAnyActionWithReturnType=false;for(const a of this._actions){a._PostInit();if(a.HasReturnType())hasAnyActionWithReturnType=true}if(hasAnyActionWithReturnType){this._RunActions=this._RunActions_ReturnValue; +this._DebugRunActions=this._DebugRunActions_ReturnValue}else{this._RunActions=this._RunActions_Fast;this._DebugRunActions=this._DebugRunActions_Fast}}const subEvents=this._subEvents;for(let i=0,len=subEvents.length;ic.DebugCanRunFast());dd.canRunAllActionsFast=this._actions.every(a=>a.DebugCanRunFast());dd.canRunAllSubEventsFast=this._subEvents.every(s=>s.DebugCanRunFast());dd.canRunSelfFast=dd.canRunAllConditionsFast&&dd.canRunAllActionsFast&&dd.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let e=this;do{e._UpdateCanRunFast(); +e=e.GetParent()}while(e)}_IdentifyTopLevelGroup(){if(!this.IsGroup())return;let p=this.GetParent();this._isTopLevelGroup=true;while(p){if(!p.IsGroup()){this._isTopLevelGroup=false;break}p=p.GetParent()}}_IdentifySolModifiersIncludingParents(){const allObjectClasses=this._runtime.GetAllObjectClasses();if(this._solModifiers===allObjectClasses)this._solModifiersIncludingParents=allObjectClasses;else{this._solModifiersIncludingParents=C3.cloneArray(this._solModifiers);let p=this.GetParent();while(p){for(const o of p._solModifiers)this._AddParentSolModifier(o); +p=p.GetParent()}const eventSheetManager=this.GetEventSheetManager();this._solModifiers=eventSheetManager._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=eventSheetManager._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(!this.HasAnyTriggeredCondition())return;this._triggerParents=[];let p=this.GetParent();while(p){this._triggerParents.push(p);p=p.GetParent()}this._triggerParents.reverse()}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds= +true;if(this._parent)this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){if(!this._hasGotSolModifiersIncludingParents){this._hasGotSolModifiersIncludingParents=true;this._IdentifySolModifiersIncludingParents()}return this._solModifiersIncludingParents}HasSolModifier(objectClass){return this._solModifiers.includes(objectClass)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(p){this._scopeParent= +p}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(a){a= +!!a;if(!this._isGroup)throw new Error("not a group");if(this._isGroupActive===a)return;this._isGroupActive=a;for(const include of this._containedIncludes)include.UpdateActive();if(this._containedIncludes.length){const currentLayout=this._runtime.GetCurrentLayout();const mainEventSheet=currentLayout.GetEventSheet();if(mainEventSheet)mainEventSheet._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&& +this._scopeParent instanceof C3.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(i){i=Math.floor(i);if(i<0||i>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[i]}GetConditionByDebugIndex(i){return this.GetConditionAt(i)}IsFirstConditionOfType(cnd){let i=cnd.GetIndex();if(i===0)return true; +--i;for(;i>=0;--i)if(this._conditions[i].GetObjectClass()===cnd.GetObjectClass())return false;return true}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(i){i=Math.floor(i);if(i<0||i>=this._actions.length)throw new RangeError("invalid action index");return this._actions[i]}GetActionByDebugIndex(i){i=Math.floor(i);const ret=this._actions.find(a=>a.GetDebugIndex()===i);if(!ret)throw new RangeError("invalid action debug index");return ret}_HasActionIndex(i){i= +Math.floor(i);return i>=0&&ie instanceof C3.EventVariable)}RunPreTrigger(frame){frame.SetCurrentEvent(this);let isAnyTrue=false;const conditions=this._conditions;for(let i=0,len=conditions.length;i +0)if(isRecursive){const paramResults=parameters.map(p=>p.Get(0));eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults)}else this._scopeParent.EvaluateFunctionParameters(parameters);else if(isRecursive)eventSheetManager.GetLocalVarStack().Push()}RunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager= +runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);const frame=eventStack.Push(this);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId, +ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}*DebugRunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked){let ret;let asyncId;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const hasAnySolModifiers= +combinedSolModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);const frame=eventStack.Push(this);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this); +const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();yield*this._DebugRunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}RunAsMappedFunctionCall(paramResults,isCopyPicked){const solModifiers=this.GetSolModifiersIncludingParents(); +const hasAnySolModifiers=solModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame= +eventStack.Push(this);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);this._RunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(paramResults,isCopyPicked){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const solModifiers=this.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length> +0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame=eventStack.Push(this);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this); +yield*this._DebugRunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}RunAsExpressionFunctionCall(combinedSolModifiers,isCopyPicked,returnType,defaultReturnValue,...paramResults){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager(); +const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();if(paramResults.length>0)this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);const frame=eventStack.Push(this);frame.InitCallFunctionExpression(returnType,defaultReturnValue);eventStack.PushExpFunc(frame); +runtime.SetDebuggingEnabled(false);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}runtime.SetDebuggingEnabled(true);eventStack.Pop();eventStack.PopExpFunc();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers); +eventSheetManager._DecTriggerDepth();return ret||frame.GetFunctionReturnValue()}}; + +} + +// events/eventScript.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[];let hadUserScriptException=false; +C3.EventScript=class EventScript extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const runtime=eventSheet.GetRuntime();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;const userMethod=runtime.GetObjectReference(data[1]);this._func=userMethod;this._displayNumber=data[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber); +this._debugData=runtime.IsDebug()?{isBreakpoint:data[3][0],isBreakable:data[3][1]}:null}static Create(eventSheet,parent,data){return C3.New(C3.EventScript,eventSheet,parent,data)}_PostInit(){const userMethod=this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&& +this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b}IsElseBlock(){return false}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetSolModifiersIncludingParents(){if(this._parent)return this._parent.GetSolModifiersIncludingParents();else return EMPTY_SOL_MODIFIERS}Run(frame){frame.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(err){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`, +"font-size: 1.2em; font-weight: bold;",err);if(self.C3Debugger)self.C3Debugger._SetLastErrorScript(this);if(!hadUserScriptException){console.info(`%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()`,"font-weight: bold; text-decoration: underline","","font-weight: bold");hadUserScriptException=true}}}*DebugRun(frame){frame.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(frame)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&& +!this._runtime.DebugBreakNext()}static HadUserScriptException(){return hadUserScriptException}static SetHadUserScriptException(){hadUserScriptException=true}}; + +} + +// events/functionBlock.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.FunctionBlock=class FunctionBlock extends C3.DefendedBase{constructor(eventSheet,parent,data){super();this._eventSheet=eventSheet;this._runtime=eventSheet.GetRuntime();this._parent=parent;const funcData=data[1];this._functionName=funcData[0];this._returnType=funcData[1];this._functionParameters=funcData[2].map(paramData=>C3.EventVariable.Create(eventSheet,this,paramData));this._isEnabled=funcData[3];this._innerLocalVariables=[];this._isCopyPicked=funcData[5];this._isAsync=funcData[4];this._nextAsyncId= +0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=C3.EventBlock.Create(eventSheet,parent,data);this._eventBlock._SetScopeParent(this)}static Create(eventSheet,parent,data){return C3.New(C3.FunctionBlock,eventSheet,parent,data)}_PostInit(){for(const fp of this._functionParameters)fp._PostInit();this._eventBlock._PostInit(false)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(localVariable){this._innerLocalVariables.push(localVariable)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(parameters){const functionParameters= +this._functionParameters;for(let i=0,len=functionParameters.length;ip.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetReturnType(){return this._returnType}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null; +case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsCopyPicked(){return this._isCopyPicked}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const asyncId=this._nextAsyncId++;this._currentAsyncId=asyncId;let resolve;const promise=new Promise(r=>resolve=r);this._asyncMap.set(asyncId,{resolve,pauseCount:0});return[asyncId,promise]}MaybeFinishAsyncFunctionCall(asyncId){const info=this._asyncMap.get(asyncId);if(info.pauseCount===0){info.resolve();this._asyncMap.delete(asyncId)}this._currentAsyncId= +-1}PauseCurrentAsyncFunction(){const info=this._asyncMap.get(this._currentAsyncId);info.pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(asyncId){this._currentAsyncId=asyncId;const info=this._asyncMap.get(asyncId);info.pauseCount--}}; + +} + +// events/eventVariable.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[]; +C3.EventVariable=class EventVariable extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._localVarStack=eventSheetManager.GetLocalVarStack();this._name=data[1];this._type=data[2];this._initialValue=data[3];this._isStatic=!!data[4];this._isConstant=!!data[5];this._isFunctionParameter=parent instanceof +C3.FunctionBlock;this._sid=data[6];this._jsPropName=this._runtime.GetJsPropName(data[8]);this._scriptSetter=v=>this.SetValue(v);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;if(this.IsBoolean())this._value=this._value?1:0;if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this._localIndex=eventSheetManager._GetNextLocalVarIndex(this);eventSheetManager._RegisterEventVariable(this)}static Create(eventSheet, +parent,data){return C3.New(C3.EventVariable,eventSheet,parent,data)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const functionBlock=this._eventSheetManager.FindFirstFunctionBlockParent(this);if(functionBlock)functionBlock._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return this._type=== +0}IsString(){return this._type===1}IsBoolean(){return this._type===2}IsElseBlock(){return false}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}Run(frame){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return true}*DebugRun(frame){this.Run(frame)}SetValue(v){if(this.IsNumber()){if(typeof v!=="number")v=parseFloat(v)}else if(this.IsString()){if(typeof v!=="string")v=v.toString()}else if(this.IsBoolean())v= +v?1:0;if(this._hasSingleValue)this._value=v;else this._localVarStack.GetCurrent()[this._localIndex]=v}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let ret=this.GetValue();if(this.IsBoolean())ret=!!ret;return ret}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:false,enumerable:true,get:this._scriptGetter,set:this._scriptSetter}}}; + +} + +// events/eventInclude.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const EMPTY_SOL_MODIFIERS=[]; +C3.EventInclude=class EventInclude extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._includeSheet=null;this._includeSheetName=data[1];this._isActive=true}static Create(eventSheet,parent,data){return C3.New(C3.EventInclude,eventSheet,parent,data)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName); +this._eventSheet._AddShallowInclude(this);let p=this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup())p._AddContainedInclude(this);p=p.GetParent()}this.UpdateActive();if(this._runtime.IsDebug())this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetIncludeSheet(){return this._includeSheet}Run(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses(); +if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);this._includeSheet.Run();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}*DebugRun(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses();if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);yield*this._includeSheet.DebugRun();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}DebugCanRunFast(){return false}IsActive(){return this._isActive}UpdateActive(){let p= +this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup()&&!p.IsGroupActive()){this._isActive=false;return}p=p.GetParent()}this._isActive=true}}; + +} + +// events/expNode.js +{ +'use strict';const C3=self.C3;const assert=self.assert;C3.ExpNode=class ExpNode extends C3.DefendedBase{constructor(owner){super();this._owner=owner;this._runtime=owner.GetRuntime()}_PostInit(){}static CreateNode(owner,data){const type=data[0];const Classes=[BehaviorExpressionNode,ObjectExpressionNode,InstVarExpressionNode,EventVarExpNode,SystemExpressionExpNode,CallFunctionExpressionExpNode];return C3.New(Classes[type],owner,data)}}; +class SystemExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(data[1]);if(this._func===C3.Plugins.System.Exps.random||this._func===C3.Plugins.System.Exps.choose)this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}} +class CallFunctionExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._functionBlock=null;this._functionName=data[1];this._owner.SetVariesPerInstance()}_PostInit(){const eventSheetManager=this._runtime.GetEventSheetManager();this._functionBlock=eventSheetManager.GetFunctionBlockByName(this._functionName);this._functionName=null;const myEventBlock=this._owner.GetEventBlock();const callEventBlock=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...(new Set([...myEventBlock.GetSolModifiersIncludingParents(), +...callEventBlock.GetSolModifiersIncludingParents()]))];this._combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const functionBlock=this._functionBlock;if(functionBlock.IsEnabled()){const callEventBlock=functionBlock.GetEventBlock();return C3.EventBlock.prototype.RunAsExpressionFunctionCall.bind(callEventBlock,this._combinedSolModifiers,functionBlock.IsCopyPicked(),functionBlock.GetReturnType(),functionBlock.GetDefaultReturnValue())}else{const defaultReturnValue= +functionBlock.GetDefaultReturnValue();return()=>defaultReturnValue}}}function WrapIndex(index,len){if(index>=len)return index%len;else if(index<0){if(index<=-len)index%=len;if(index<0)index+=len;return index}else return index} +class ObjectExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._func=this._runtime.GetObjectReference(data[2]);this._returnsString=!!data[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}ExpObject_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len=== +0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}} +class InstVarExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._varIndex=data[3];this._returnsString=!!data[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const instances=this._objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);return instances[index]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);const inst=instances[index];const offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}ExpInstVar_InstExpr(instIndex){const objectClass=this._objectClass;const instances=objectClass.GetInstances(); +const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}} +class BehaviorExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2]);this._func=this._runtime.GetObjectReference(data[3]);this._returnsString=!!data[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}ExpBehavior_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}}class EventVarExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._eventVar=null;this._eventVarSid=data[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}; + +} + +// events/parameter.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.Parameter=class Parameter extends C3.DefendedBase{constructor(owner,type,index){super();this._owner=owner;this._index=index;this._type=type;this.Get=null;this._variesPerInstance=false;this._isConstant=false}static Create(owner,data,index){const type=data[0];const Classes=[ExpressionParameter,StringExpressionParameter,FileParameter,ComboParameter,ObjectParameter,LayerExpressionParameter,LayoutParameter,ExpressionParameter,ComboParameter,ComboParameter,InstVarParameter,EventVarParameter,FileParameter, +VariadicParameter,StringExpressionParameter,TimelineParameter,BooleanParameter,FunctionParameter,EaseParameter,TilemapBrushParameter,TemplateExpressionParameter];return C3.New(Classes[type],owner,type,index,data)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=true}_MaybeVaryFor(objectClass){if(this._variesPerInstance)return;if(!objectClass)return;if(!objectClass.GetPlugin().IsSingleGlobal())this._variesPerInstance=true}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}}; +function GetExpressionFunc(number){const ret=self.C3_ExpressionFuncs[number];if(!ret)throw new Error("invalid expression number");return ret} +class ExpressionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._solIndex=0;const expData=data[1];this._expressionNumber=expData[0];this._numberedNodes=[];this._expressionFunc=null;for(let i=1,len=expData.length;i=this._numberedNodes.length)throw new RangeError("invalid numbered node"); +return this._numberedNodes[i]}_PostInit(){for(const node of this._numberedNodes)node._PostInit();const func=GetExpressionFunc(this._expressionNumber);if(this._numberedNodes.length)this._expressionFunc=func(this);else this._expressionFunc=func}GetSolIndex(){return this._solIndex}GetExpression(solIndex){this._solIndex=solIndex;return this._expressionFunc()}} +class StringExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetStringExpression;if(type===14){this.GetEventBlock().SetAllSolModifiers();if(this._owner instanceof C3.Action)this.GetEventBlock().SetSolWriterAfterCnds()}}GetStringExpression(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();if(typeof ret==="string")return ret;else return""}_GetFastTriggerValue(){return GetExpressionFunc(this._expressionNumber)()}} +class LayerExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetLayer;this._isConstant=false}GetLayer(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();const layout=this.GetRuntime().GetCurrentLayout();return layout.GetLayer(ret)}} +class ComboParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._combo=data[1];this.Get=this.GetCombo;this._isConstant=true}GetCombo(){return this._combo}}class BooleanParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._bool=data[1];this.Get=this.GetBoolean;this._isConstant=true}GetBoolean(){return this._bool}} +class ObjectParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._objectClass=this.GetRuntime().GetObjectClassByIndex(data[1]);this.Get=this.GetObjectClass;const eventBlock=this.GetEventBlock();eventBlock._AddSolModifier(this._objectClass);if(this._owner instanceof C3.Action)eventBlock.SetSolWriterAfterCnds();else if(eventBlock.GetParent())eventBlock.GetParent().SetSolWriterAfterCnds();this._isConstant=true}GetObjectClass(){return this._objectClass}} +class LayoutParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(data[1]);this.Get=this.GetLayout;this._isConstant=true}GetLayout(){return this._layout}} +class TimelineParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(data[1]);this.Get=this.GetTimeline;this._isConstant=true}GetTimeline(){return this._timeline}}class FileParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._fileInfo=data[1];this.Get=this.GetFile;this._isConstant=true}GetFile(){return this._fileInfo}} +class InstVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._instVarIndex=data[1];const ownerObjectClass=this._owner.GetObjectClass();if(ownerObjectClass&&ownerObjectClass.IsFamily()){this.Get=this.GetFamilyInstanceVariable;this.SetVariesPerInstance()}else{this.Get=this.GetInstanceVariable;this._isConstant=true}}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(solIndex){solIndex=solIndex||0;const familyType=this._owner.GetObjectClass(); +const sol=familyType.GetCurrentSol();const instances=sol.GetInstances();let realType=null;if(instances.length)realType=instances[solIndex%instances.length].GetObjectClass();else if(sol.HasAnyElseInstances()){const elseInstances=sol.GetElseInstances();realType=elseInstances[solIndex%elseInstances.length].GetObjectClass()}else if(familyType.GetInstanceCount()>0){const familyInstances=familyType.GetInstances();realType=familyInstances[solIndex%familyInstances.length].GetObjectClass()}else return 0;return this._instVarIndex+ +realType.GetFamilyInstanceVariableOffset(familyType.GetFamilyIndex())}}class EventVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._eventVarSid=data[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=true}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}} +class FunctionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._functionBlockName=data[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=true}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}} +class VariadicParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._subParams=[];this._variadicRet=[];this._isConstant=true;for(let i=1,len=data.length;i0;this._isFastTrigger=data[3]===2;this._isLooping=!!data[4];this._isInverted=!!data[5];this._isStatic=!!data[6];this._sid=data[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._objectClass=null;this._behaviorType=null;this._behaviorIndex= +-1;this._systemPlugin=null;this.Run=noop;this.DebugRun=noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:data[8][0],canDebug:data[8][1]}:null;if(data[0]===-1)this._systemPlugin=this._runtime.GetSystemPlugin();else{this._objectClass=this._runtime.GetObjectClassByIndex(data[0]);if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex= +this._objectClass.GetBehaviorIndexByName(data[2])}if(this._eventBlock.GetParent())this._eventBlock.GetParent().SetSolWriterAfterCnds()}if(data.length===10){let paramData=data[9];for(let data of paramData){this._parameters.push(C3.Parameter.Create(this,data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(eventBlock,data, +index){return C3.New(C3.Condition,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance=true}if(this._isFastTrigger){this.Run=this._RunFastTrigger;this.DebugRun=this._DebugRunFastTrigger}else if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this._isStatic){this.Run= +this._RunStatic;this.DebugRun=this._DebugRunStatic}else{this.Run=this._RunObject;this.DebugRun=this._DebugRunObject}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin=this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const isInverted=this._isInverted;const parameters=this._parameters;if(parameters.length===0){const boundFunc=plugin._GetBoundACEMethod(func,bindThis);if(isInverted)this.Run=function RunSingleCnd_0param(){return C3.xor(boundFunc(),isInverted)};else this.Run=boundFunc}else if(parameters.length===1){const param0=parameters[0];if(!isInverted&¶m0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc= +plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_1param(){return C3.xor(boundFunc(param0.Get(0)),isInverted)}}}else if(parameters.length===2){const param0=parameters[0];const param1=parameters[1];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_2params(){return C3.xor(boundFunc(param0.Get(0), +param1.Get(0)),isInverted)}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func,bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_3params(){return C3.xor(boundFunc(param0.Get(0),param1.Get(0),param2.Get(0)),isInverted)}}}else this.Run= +fallbackMethod}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(b){this._debugData.isBreakpoint= +!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData=new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters,results);return C3.xor(this._func.apply(this._systemPlugin, +results),this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._systemPlugin,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunSingleGlobal(){const results=this._results;EvalParams(this._parameters,results);const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance(); +return C3.xor(this._func.apply(inst,results),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();let ret=this._func.apply(inst,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunFastTrigger(){return true}*_DebugRunFastTrigger(){if(this.IsBreakpoint()|| +this._runtime.DebugBreakNext())yield this;return true}_RunStatic(){const results=this._results;EvalParams(this._parameters,results);const ret=this._func.apply(this._behaviorType||this._objectClass,results);this._objectClass.ApplySolToContainer();return ret}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._behaviorType||this._objectClass, +results);if(C3.IsIterator(ret))ret=yield*ret;this._objectClass.ApplySolToContainer();return ret}else return this.Run()}_RunObject(){const parameters=this._parameters;const results=this._results;const sol=this._objectClass.GetCurrentSol();for(let i=0,len=parameters.length;i=0;const allInstances=objectClass.GetInstances(); +const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;sol.ClearArrays();for(let i=0,len=allInstances.length;i=0;const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;const solInstances=sol._GetOwnInstances();const solElseInstances=sol._GetOwnElseInstances();const isUsingElseInstances=isInOrBlock&&!this._eventBlock.IsFirstConditionOfType(this);const arr=isUsingElseInstances?solElseInstances:solInstances;let k=0;let isAnyTrue=false;for(let i=0, +len=arr.length;i=0;const results=this._results;const func=this._func;const isInverted=this._isInverted;for(let i=0,len=solInstances.length;i[arr[0].GetUID(),arr[1].GetUID(),arr[2]]);ex[k]=saveVal}return{"ex":ex}}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}if(!o)return;const runtime=this._runtime;const ex=o["ex"];if(ex){const map=this.GetSavedDataMap();map.clear(); +for(const [k,v]of Object.entries(ex)){let loadVal=v;if(k==="collmemory")loadVal=C3.New(C3.PairMap,v.map(arr=>[runtime.GetInstanceByUID(arr[0]),runtime.GetInstanceByUID(arr[1]),arr[2]]).filter(arr=>arr[0]&&arr[1]));map.set(k,loadVal)}}}}; + +} + +// events/action.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function EvalParams(parameters,results){for(let i=0,len=parameters.length;i=4?data[3]:-1;this._actionType=data.length>=5?data[4]&255:0;this._flags=data.length>=5?data[4]>>8:0;this._func=null;this._objectClass=null;this._behaviorType=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._callEventBlock=null;this.Run=noop;this.DebugRun= +noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;const isScript=data[0]===-3;const debugInfo=isScript?data[2]:data[5];this._debugData=runtime.IsDebug()||isScript?{isBreakpoint:debugInfo[0],canDebug:debugInfo[1],index:debugInfo[2]}:null;if(data[0]===-1){this._systemPlugin=runtime.GetSystemPlugin();this._func=runtime.GetObjectReference(data[1])}else if(data[0]===-2)this._callFunctionName=data[1];else if(isScript){const userMethod= +runtime.GetObjectReference(data[1]);this._func=userMethod;this.Run=this.RunUserScript;this.DebugRun=this.DebugRunUserScript;this._actionType=1}else{this._func=runtime.GetObjectReference(data[1]);this._objectClass=runtime.GetObjectClassByIndex(data[0]);if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2])}}if(data.length===7){const paramData=data[6];for(const data of paramData){this._parameters.push(C3.Parameter.Create(this, +data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}if(this.CanPickAnyObjectClass()){this._eventBlock.SetAllSolModifiers();this._eventBlock.SetSolWriterAfterCnds()}this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(eventBlock,data,index){return C3.New(C3.Action,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance= +true}if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._callFunctionName){this._SetCallFunctionRunMethod();this._callFunctionName=""}else if(this.Run===this.RunUserScript){const userMethod=this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}else if(this._behaviorType)if(this.IsAsync()){this.Run=this._RunBehavior_Async; +this.DebugRun=this._DebugRunBehavior_Async}else{this.Run=this._RunBehavior;this.DebugRun=this._DebugRunBehavior}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this.IsAsync()){this.Run=this._RunObject_Async;this.DebugRun=this._DebugRunObject_Async}else if(this.CallBeforeAfterHooks()){this.Run=this._RunObject_BeforeAfterHooks;this.DebugRun=this._DebugRunObject_BeforeAfterHooks}else if(!this._parameters.length){this.Run= +this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else if(this._parameters.every(p=>p.VariesPerInstance())){this.Run=this._RunObject_AllParamsVary;this.DebugRun=this._DebugRunObject_AllParamsVary}else if(this._anyParamVariesPerInstance){this.Run=this._RunObject_SomeParamsVary;this.DebugRun=this._DebugRunObject_SomeParamsVary}else if(this._parameters.every(p=>p.IsConstant())){EvalParams(this._parameters,this._results);this.Run=this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else{this.Run= +this._RunObject_ParamsDontVary;this.DebugRun=this._DebugRunObject_ParamsDontVary}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin=this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const eventSheetManager= +this._eventBlock.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(this._callFunctionName);if(functionBlock.IsEnabled()){const isCopyPicked=(this._flags&FLAG_COPYPICKED)!==0;this._callEventBlock=functionBlock.GetEventBlock();let combinedSolModifiers=[...(new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()]))];combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(combinedSolModifiers); +this.Run=C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,combinedSolModifiers,this._parameters,isCopyPicked);if(this._runtime.IsDebug()){const thiz=this;this.DebugRun=function*DebugRunCallFunction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz;const ret=yield*thiz._callEventBlock.DebugRunAsFunctionCall(combinedSolModifiers,thiz._parameters,isCopyPicked);return ret}}else this.DebugRun=noopGenerator}else{this.Run=noop;this.DebugRun=noopGenerator}}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const parameters=this._parameters;if(parameters.length===0)this.Run=plugin._GetBoundACEMethod(func,bindThis);else if(parameters.length===1){const param0=parameters[0];if(param0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_1param(){return boundFunc(param0.Get(0))}}}else if(parameters.length===2){const param0=parameters[0]; +const param1=parameters[1];if(param0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_2params(){return boundFunc(param0.Get(0),param1.Get(0))}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(param0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func, +bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_3params(){return boundFunc(param0.Get(0),param1.Get(0),param2.Get(0))}}}else this.Run=fallbackMethod}GetSID(){return this._sid}IsAsync(){return this._actionType===1}CanBailOut(){return this._actionType===2}CallBeforeAfterHooks(){return this._actionType===3}CanPickAnyObjectClass(){return(this._flags&FLAG_CANPICKANYOBJECTCLASS)!==0}HasReturnType(){return this.IsAsync()|| +this.CanBailOut()}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(b){this._debugData.isBreakpoint=!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData= +new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters,results);return this._func.apply(this._systemPlugin,results)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);const ret=yield*this._func.apply(this._systemPlugin,results);return ret}else return this.Run()}_RunSingleGlobal(){const results= +this._results;EvalParams(this._parameters,results);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);const ret=yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results);return ret}else return this.Run()}_RunObject_ParamsConst(){const results= +this._results;const instances=this._objectClass.GetCurrentSol().GetInstances();for(let i=0,len=instances.length;ilayout.GetWidth()||bbox.getTop()>layout.GetHeight()} +function PickDistance(which,x,y){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let wi=inst.GetWorldInfo();let pickme=inst;let dist2=C3.distanceSquared(wi.GetX(),wi.GetY(),x,y);for(let i=1,len=instances.length;idist2){dist2=d2;pickme=inst}}sol.PickOne(pickme);return true} +function SetX(x){const wi=this.GetWorldInfo();if(wi.GetX()===x)return;wi.SetX(x);wi.SetBboxChanged()}function SetY(y){const wi=this.GetWorldInfo();if(wi.GetY()===y)return;wi.SetY(y);wi.SetBboxChanged()}function SetPos(x,y){const wi=this.GetWorldInfo();if(wi.EqualsXY(x,y))return;wi.SetXY(x,y);wi.SetBboxChanged()} +function SetPosToObject(objectClass,imgPt){if(!objectClass)return;const inst=objectClass.GetPairedInstance(this._inst);if(!inst)return;const [x,y]=inst.GetImagePoint(imgPt);const wi=this.GetWorldInfo();if(wi.GetX()===x&&wi.GetY()===y)return;wi.SetXY(x,y);wi.SetBboxChanged()}function MoveForward(dist){if(dist===0)return;const wi=this.GetWorldInfo();wi.OffsetXY(wi.GetCosAngle()*dist,wi.GetSinAngle()*dist);wi.SetBboxChanged()} +function MoveAtAngle(a,dist){if(dist===0)return;const wi=this.GetWorldInfo();a=C3.toRadians(a);wi.OffsetXY(Math.cos(a)*dist,Math.sin(a)*dist);wi.SetBboxChanged()}function GetX(){return this.GetWorldInfo().GetX()}function GetY(){return this.GetWorldInfo().GetY()}function GetDt(){return this._runtime.GetDt(this._inst)}function CompareWidth(cmp,w){return C3.compare(this.GetWorldInfo().GetWidth(),cmp,w)}function CompareHeight(cmp,h){return C3.compare(this.GetWorldInfo().GetHeight(),cmp,h)} +function SetWidth(w){const wi=this.GetWorldInfo();if(wi.GetWidth()===w)return;wi.SetWidth(w);wi.SetBboxChanged()}function SetHeight(h){const wi=this.GetWorldInfo();if(wi.GetHeight()===h)return;wi.SetHeight(h);wi.SetBboxChanged()}function SetSize(w,h){const wi=this.GetWorldInfo();if(wi.GetWidth()===w&&wi.GetHeight()===h)return;wi.SetSize(w,h);wi.SetBboxChanged()}function GetWidth(){return this.GetWorldInfo().GetWidth()}function GetHeight(){return this.GetWorldInfo().GetHeight()} +function GetBboxLeft(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function GetBboxTop(){return this.GetWorldInfo().GetBoundingBox().getTop()}function GetBboxRight(){return this.GetWorldInfo().GetBoundingBox().getRight()}function GetBboxBottom(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function IsAngleWithin(within,a){return C3.angleDiff(this.GetWorldInfo().GetAngle(),C3.toRadians(a))<=C3.toRadians(within)} +function IsAngleClockwiseFrom(a){return C3.angleClockwise(this.GetWorldInfo().GetAngle(),C3.toRadians(a))}function IsBetweenAngles(a,b){const lower=C3.toRadians(a);const upper=C3.toRadians(b);const angle=this.GetWorldInfo().GetAngle();const obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)} +function SetAngle(a){const wi=this.GetWorldInfo();const newAngle=C3.clampAngle(C3.toRadians(a));if(isNaN(newAngle)||wi.GetAngle()===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function RotateClockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()+C3.toRadians(a));wi.SetBboxChanged()}function RotateCounterclockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()-C3.toRadians(a));wi.SetBboxChanged()} +function RotateTowardAngle(amt,target){const wi=this.GetWorldInfo();const a=wi.GetAngle();const newAngle=C3.angleRotate(a,C3.toRadians(target),C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function RotateTowardPosition(amt,x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const target=Math.atan2(dy,dx);const newAngle=C3.angleRotate(a,target,C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function SetTowardPosition(x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const newAngle=Math.atan2(dy,dx);if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function GetAngle(){return C3.toDegrees(this.GetWorldInfo().GetAngle())}function CompareOpacity(cmp,x){return C3.compare(C3.round6dp(this.GetWorldInfo().GetOpacity()*100),cmp,x)}function IsVisible(){return this.GetWorldInfo().IsVisible()} +function SetVisible(v){const wi=this.GetWorldInfo();if(v===2)v=!wi.IsVisible();else v=v!==0;if(wi.IsVisible()===v)return;wi.SetVisible(v);this._runtime.UpdateRender()}function SetOpacity(o){const newOpacity=C3.clamp(o/100,0,1);const wi=this.GetWorldInfo();if(wi.GetOpacity()===newOpacity)return;wi.SetOpacity(newOpacity);this._runtime.UpdateRender()} +function SetDefaultColor(rgb){tempColor.setFromRgbValue(rgb);const wi=this.GetWorldInfo();if(wi.GetUnpremultipliedColor().equalsIgnoringAlpha(tempColor))return;wi.SetUnpremultipliedColor(tempColor);this._runtime.UpdateRender()}function GetColor(){const c=this.GetWorldInfo().GetUnpremultipliedColor();return C3.PackRGBAEx(c.getR(),c.getG(),c.getB(),c.getA())}function GetOpacity(){return C3.round6dp(this.GetWorldInfo().GetOpacity()*100)} +function IsOnLayer(layer){if(!layer)return false;return this.GetWorldInfo().GetLayer()===layer} +function PickTopBottom(which){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let pickme=inst;for(let i=1,len=instances.length;ipickmeLayerIndex||instLayerIndex===pickmeLayerIndex&&instWi.GetZIndex()> +pickmeWi.GetZIndex())pickme=inst}else if(instLayerIndexCollMemory_RemoveInstance(collMemory,e.instance))}const lsol= +ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol();const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;lCollMemory_RemoveInstance(collMemory,e.instance))}const lsol=ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol(); +const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;l0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=new Set;for(let i=0,len=myInstances.length;i0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=[];for(let i=0,len=myInstances.length;ival){val=v;pickme=inst}}sol.PickOne(pickme);return true} +function PickByUID(uid){if(this._runtime.GetCurrentCondition().IsInverted())return PickByUID_Inverted(this,uid);else return PickByUID_Normal(this,uid)} +function PickByUID_Normal(objectClass,uid){const inst=objectClass.GetRuntime().GetInstanceByUID(uid);if(!inst)return false;const sol=objectClass.GetCurrentSol();if(!sol.IsSelectAll()&&!sol._GetOwnInstances().includes(inst))return false;if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass)){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}}else if(inst.GetObjectClass()===objectClass){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}return false} +function PickByUID_Inverted(objectClass,uid){const sol=objectClass.GetCurrentSol();if(sol.IsSelectAll()){sol._SetSelectAll(false);sol.ClearArrays();const instances=objectClass.GetInstances();for(let i=0,len=instances.length;iv.GetValue());if(functionBlock.IsAsync())this._asyncId=functionBlock.PauseCurrentAsyncFunction()}for(const objectClass of allObjectClasses){const sol=objectClass.GetCurrentSol();if(sol.IsSelectAll()&&!this._event.HasSolModifier(objectClass))continue;this._solModifiers.push(objectClass);this._sols.set(objectClass, +C3.New(C3.SolState,sol))}}InitTimer(seconds){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+seconds}InitSignal(tag){this._type="signal";this._Init();this._signalTag=tag.toLowerCase()}InitPromise(p){this._type="promise";this._Init();p.then(()=>this.SetSignalled()).catch(err=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",err);this.SetSignalled()})}IsTimer(){return this._type==="timer"}IsSignal(){return this._type=== +"signal"}IsPromise(){return this._type==="promise"}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=true}_ShouldRun(){if(this.IsTimer())return this._time<=this._eventSheetManager.GetRuntime().GetGameTime();else return this.IsSignalled()}_RestoreState(frame){frame._Restore(this._event,this._actIndex);for(const [objectClass,solState]of this._sols.entries()){const sol=objectClass.GetCurrentSol();solState._Restore(sol)}const callingFunctionBlock= +this._callingFunctionBlock;if(callingFunctionBlock){callingFunctionBlock.SetFunctionParameters(this._functionParameters);callingFunctionBlock._GetAllInnerLocalVariables().map((v,index)=>v.SetValue(this._functionInnerLocalVars[index]));if(callingFunctionBlock.IsAsync())callingFunctionBlock.ResumeAsyncFunction(this._asyncId)}}_Run(frame){this._RestoreState(frame);this._event._ResumeActionsAndSubEvents(frame);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId); +this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=true}async _DebugRun(frame){this._RestoreState(frame);for(const breakEventObject of this._event._DebugResumeActionsAndSubEvents(frame))await this._eventSheetManager.GetRuntime().DebugBreak(breakEventObject);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=true}ShouldRelease(){return this._shouldRelease}RemoveInstances(s){for(const solState of this._sols.values())solState.RemoveInstances(s)}_SaveToJson(){const sols= +{};const o={"t":this._time,"st":this._signalTag,"s":this._isSignalled,"ev":this._event.GetSID(),"sm":this._solModifiers.map(oc=>oc.GetSID()),"sols":sols};if(this._event._HasActionIndex(this._actIndex))o["act"]=this._event.GetActionAt(this._actIndex).GetSID();for(const [objectClass,solState]of this._sols)sols[objectClass.GetSID().toString()]=solState._SaveToJson();return o}static _CreateFromJson(eventSheetManager,o){const runtime=eventSheetManager.GetRuntime();const event=eventSheetManager.GetEventBlockBySID(o["ev"]); +if(!event)return null;let actIndex=0;if(o.hasOwnProperty("act")){const act=eventSheetManager.GetActionBySID(o["act"]);if(!act)return null;actIndex=act.GetIndex()}const sw=C3.New(C3.ScheduledWait,eventSheetManager);sw._time=o["t"];sw._type=sw._time===-1?"signal":"timer";sw._signalTag=o["st"];sw._isSignalled=o["s"];sw._event=event;sw._actIndex=actIndex;for(const sid of o["sm"]){const objectClass=runtime.GetObjectClassBySID(sid);if(objectClass)sw._solModifiers.push(objectClass)}for(const [sidStr,solData]of Object.entries(o["sols"])){const sid= +parseInt(sidStr,10);const objectClass=runtime.GetObjectClassBySID(sid);if(!objectClass)continue;const solState=C3.New(C3.SolState,null);solState._LoadFromJson(eventSheetManager,solData);sw._sols.set(objectClass,solState)}return sw}}; + +} + +// events/solState.js +{ +'use strict';const C3=self.C3; +C3.SolState=class SolState extends C3.DefendedBase{constructor(sol){super();this._objectClass=null;this._isSelectAll=true;this._instances=[];if(sol){this._objectClass=sol.GetObjectClass();this._isSelectAll=sol.IsSelectAll();C3.shallowAssignArray(this._instances,sol._GetOwnInstances())}}Release(){this._objectClass=null;C3.clearArray(this._instances)}_Restore(sol){sol._SetSelectAll(this._isSelectAll);C3.shallowAssignArray(sol._GetOwnInstances(),this._instances)}RemoveInstances(s){C3.arrayRemoveAllInSet(this._instances,s)}_SaveToJson(){return{"sa":this._isSelectAll, +"insts":this._instances.map(inst=>inst.GetUID())}}_LoadFromJson(eventSheetManager,o){const runtime=eventSheetManager.GetRuntime();this._isSelectAll=!!o["sa"];C3.clearArray(this._instances);for(const uid of o["insts"]){const inst=runtime.GetInstanceByUID(uid);if(inst)this._instances.push(inst)}}}; + +} + +// sdk/sdkPluginBase.js +{ +'use strict';const C3=self.C3;function GetNextParamMap(paramMap,param){let nextParamMap=paramMap.get(param);if(!nextParamMap){nextParamMap=new Map;paramMap.set(param,nextParamMap)}return nextParamMap} +C3.SDKPluginBase=class SDKPluginBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._isSingleGlobal=!!opts.isSingleGlobal;this._isWorldType=!!opts.isWorld;this._isRotatable=!!opts.isRotatable;this._mustPredraw=!!opts.mustPredraw;this._hasEffects=!!opts.hasEffects;this._supportsSceneGraph=!!opts.supportsSceneGraph;this._supportsMesh=!!opts.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=new Map;this._boundACEMethodCache_1param=new Map;this._boundACEMethodCache_2params= +new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(func,bindThis){if(!bindThis)throw new Error("missing 'this' binding"); +let ret=this._boundACEMethodCache.get(func);if(ret)return ret;ret=func.bind(bindThis);this._boundACEMethodCache.set(func,ret);return ret}_GetBoundACEMethod_1param(func,bindThis,param0){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_1param,func);let ret=param0map.get(param0);if(ret)return ret;ret=func.bind(bindThis,param0);param0map.set(param0,ret);return ret}_GetBoundACEMethod_2params(func,bindThis,param0,param1){if(!bindThis)throw new Error("missing 'this' binding"); +const param0map=GetNextParamMap(this._boundACEMethodCache_2params,func);const param1map=GetNextParamMap(param0map,param0);let ret=param1map.get(param1);if(ret)return ret;ret=func.bind(bindThis,param0,param1);param1map.set(param1,ret);return ret}_GetBoundACEMethod_3params(func,bindThis,param0,param1,param2){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_3params,func);const param1map=GetNextParamMap(param0map,param0);const param2map= +GetNextParamMap(param1map,param1);let ret=param2map.get(param2);if(ret)return ret;ret=func.bind(bindThis,param0,param1,param2);param2map.set(param2,ret);return ret}_SetSingleGlobalObjectClass(objectClass){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");this._singleGlobalObjectClass=objectClass}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin"); +return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}; + +} + +// sdk/sdkDOMPluginBase.js +{ +'use strict';const C3=self.C3; +C3.SDKDOMPluginBase=class SDKDOMPluginBase extends C3.SDKPluginBase{constructor(opts,DOM_COMPONENT_ID){super(opts);this._domComponentId=DOM_COMPONENT_ID;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",sdkInst=>sdkInst._OnElemFocused());this.AddElementMessageHandler("elem-blurred",sdkInst=>{if(sdkInst)sdkInst._OnElemBlurred()})}Release(){super.Release()}_AddElement(sdkInst){const elementId=this._nextElementId++;this._instMap.set(elementId,sdkInst);return elementId}_RemoveElement(elementId){this._instMap.delete(elementId)}AddElementMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,e=>{const sdkInst=this._instMap.get(e["elementId"]);func(sdkInst,e)})}}; + +} + +// sdk/sdkTypeBase.js +{ +'use strict';const C3=self.C3; +C3.SDKTypeBase=class SDKTypeBase extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._runtime=objectClass.GetRuntime();this._plugin=objectClass.GetPlugin()}Release(){this._objectClass=null;this._runtime=null;this._plugin=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(f){}BeforeRunAction(method){}AfterRunAction(method){}LoadTextures(renderer){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(renderer){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable, +additionalProperties){const e=C3.New(C3.Event,name,cancelable);e.objectClass=this;if(additionalProperties)Object.assign(e,additionalProperties);this.GetObjectClass().DispatchUserScriptEvent(e)}}; + +} + +// sdk/sdkInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKInstanceBase=class SDKInstanceBase extends C3.DefendedBase{constructor(inst,domComponentId){super();this._inst=inst;this._domComponentId=domComponentId;this._runtime=inst.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tickFunc=null;this._tick2Func=null;this._isTicking=false;this._isTicking2=false;this._disposables=null;this._wasReleased=false}Release(){this._wasReleased=true;this._StopTicking();this._StopTicking2();this._tickFunc= +null;this._tick2Func=null;if(this._disposables){this._disposables.Release();this._disposables=null}this._inst=null;this._runtime=null;this._objectClass=null;this._sdkType=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(method){return this._runtime.Trigger(method, +this._inst,null)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,null)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,null)}FastTrigger(method,value){return this._runtime.FastTrigger(method,this._inst,value)}DebugFastTrigger(method,value){return this._runtime.DebugFastTrigger(method,this._inst,value)}ScheduleTriggers(f){return this._runtime.ScheduleTriggers(f)}AddDOMMessageHandler(handler,func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId, +handler,func)}AddDOMMessageHandlers(list){for(const [handler,func]of list)this.AddDOMMessageHandler(handler,func)}PostToDOM(handler,data){this._runtime.PostComponentMessageToDOM(this._domComponentId,handler,data)}PostToDOMAsync(handler,data){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,handler,data)}_PostToDOMMaybeSync(handler,data){if(this._runtime.IsInWorker())this.PostToDOM(handler,data);else return window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event", +"component":this._domComponentId,"handler":handler,"data":data,"responseId":null})}Tick(){}Tick2(){}_StartTicking(){if(this._isTicking)return;if(!this._tickFunc)this._tickFunc=()=>this.Tick();this._runtime.Dispatcher().addEventListener("tick",this._tickFunc);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return;if(!this._tick2Func)this._tick2Func= +()=>this.Tick2();this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func);this._isTicking2=false}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset){if(offset===0)return;const value= +this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset)}SetPropertyColorOffsetValueByIndex(offset,r,g,b){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._inst.HasScriptInterface())return;const scriptInterface=this.GetScriptInterface(); +const e=C3.New(C3.Event,name,cancelable);e.instance=scriptInterface;if(additionalProperties)Object.assign(e,additionalProperties);scriptInterface.dispatchEvent(e)}}; + +} + +// sdk/sdkWorldInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKWorldInstanceBase=class SDKWorldInstanceBase extends C3.SDKInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._worldInfo=inst.GetWorldInfo();this._webglcontextlost_handler=null;this._webglcontextrestored_handler=null}Release(){if(this._webglcontextlost_handler){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("webglcontextlost",this._webglcontextlost_handler);dispatcher.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler); +this._webglcontextlost_handler=null;this._webglcontextrestored_handler=null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(this._webglcontextlost_handler)return;this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("webglcontextlost",this._webglcontextlost_handler);dispatcher.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return false}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known"); +const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetWidth();else;}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known");const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetHeight();else;}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){const imageInfo=this.GetCurrentImageInfo();if(imageInfo){const texture=imageInfo.GetTexture();if(texture)return[texture.GetWidth(),texture.GetHeight()]}return[100,100]}GetCurrentTexRect(){const imageInfo= +this.GetCurrentImageInfo();return imageInfo?imageInfo.GetTexRect():null}GetCurrentTexQuad(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.GetTexQuad():null}IsCurrentTexRotated(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.IsRotated():false}GetImagePoint(nameOrIndex){const wi=this._inst.GetWorldInfo();return[wi.GetX(),wi.GetY()]}LoadTilemapData(data,mapWidth,mapHeight){}TestPointOverlapTile(x,y){}RendersToOwnZPlane(){return true}}; + +} + +// sdk/sdkDOMInstanceBase.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect); +C3.SDKDOMInstanceBase=class SDKDOMInstanceBase extends C3.SDKWorldInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=true;this._elemHasFocus=false;this._autoFontSize=false;this._autoFontSizeOffset=-.2;this._lastRect=C3.New(C3.Rect,0,0,-1,-1);const canvasManager=this._runtime.GetCanvasManager();this._lastWindowWidth=canvasManager.GetLastWidth();this._lastWindowHeight=canvasManager.GetLastHeight();this._isPendingUpdateState= +false;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw new Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(handler,data){if(!data)data={};data["elementId"]=this._elementId;this.PostToDOM(handler,data)}_PostToDOMElementMaybeSync(handler,data){if(!data)data={};data["elementId"]=this._elementId; +return this._PostToDOMMaybeSync(handler,data)}PostToDOMElementAsync(handler,data){if(!data)data={};data["elementId"]=this._elementId;return this.PostToDOMAsync(handler,data)}CreateElement(data){if(!data)data={};const isVisible=this.GetWorldInfo().IsVisible();data["elementId"]=this._elementId;data["isVisible"]=isVisible;Object.assign(data,this.GetElementState());this._isElementShowing=!!data["isVisible"];this._PostToDOMMaybeSync("create",data);this._UpdatePosition(true)}SetElementVisible(v){v=!!v; +if(this._isElementShowing===v)return;this._isElementShowing=v;this.PostToDOMElement("set-visible",{"isVisible":v})}Tick(){this._UpdatePosition(false)}_ShouldPreserveElement(){const fullscreenMode=this._runtime.GetCanvasManager().GetFullscreenMode();return C3.Platform.OS==="Android"&&(fullscreenMode==="scale-inner"||fullscreenMode==="scale-outer"||fullscreenMode==="crop")}_UpdatePosition(first){const wi=this.GetWorldInfo();const layer=wi.GetLayer();const bbox=wi.GetBoundingBox();let [cleft,ctop]=layer.LayerToCanvasCss(bbox.getLeft(), +bbox.getTop());let [cright,cbottom]=layer.LayerToCanvasCss(bbox.getRight(),bbox.getBottom());const canvasManager=this._runtime.GetCanvasManager();const rightEdge=canvasManager.GetCssWidth();const bottomEdge=canvasManager.GetCssHeight();if(!wi.IsVisible()||!layer.IsVisible()){this.SetElementVisible(false);return}if(!this._ShouldPreserveElement()){if(cright<=0||cbottom<=0||cleft>=rightEdge||ctop>=bottomEdge){this.SetElementVisible(false);return}if(cleft<1)cleft=1;if(ctop<1)ctop=1;if(cright>=rightEdge)cright= +rightEdge-1;if(cbottom>=bottomEdge)cbottom=bottomEdge-1}tempRect.set(cleft,ctop,cright,cbottom);const curWinWidth=canvasManager.GetLastWidth();const curWinHeight=canvasManager.GetLastHeight();if(!first&&tempRect.equals(this._lastRect)&&this._lastWindowWidth===curWinWidth&&this._lastWindowHeight===curWinHeight){this.SetElementVisible(true);return}this._lastRect.copy(tempRect);this._lastWindowWidth=curWinWidth;this._lastWindowHeight=curWinHeight;this.SetElementVisible(true);let fontSize=null;if(this._autoFontSize)fontSize= +layer.GetDisplayScale()+this._autoFontSizeOffset;this.PostToDOMElement("update-position",{"left":Math.round(this._lastRect.getLeft())+canvasManager.GetCanvasClientX(),"top":Math.round(this._lastRect.getTop())+canvasManager.GetCanvasClientY(),"width":Math.round(this._lastRect.width()),"height":Math.round(this._lastRect.height()),"fontSize":fontSize})}FocusElement(){this._PostToDOMElementMaybeSync("focus",{"focus":true})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{"focus":false})}_OnElemFocused(){this._elemHasFocus= +true}_OnElemBlurred(){this._elemHasFocus=false}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(prop,val){this.PostToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(prop),"val":val})}SetElementAttribute(attribName,value){this.PostToDOMElement("set-attribute",{"name":attribName,"val":value})}RemoveElementAttribute(attribName){this.PostToDOMElement("remove-attribute",{"name":attribName})}UpdateElementState(){if(this._isPendingUpdateState)return;this._isPendingUpdateState=true;Promise.resolve().then(()=> +{this._isPendingUpdateState=false;this.PostToDOMElement("update-state",this.GetElementState())})}GetElementState(){}GetElementId(){return this._elementId}}; + +} + +// sdk/sdkBehaviorBase.js +{ +'use strict';const C3=self.C3;const IBehavior=self.IBehavior; +C3.SDKBehaviorBase=class SDKBehaviorBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._myObjectClasses=C3.New(C3.ArraySet);this._myInstances=C3.New(C3.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=opts.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(objectClass){this._myObjectClasses.Add(objectClass)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(inst){this._myInstances.Add(inst)}_RemoveInstance(inst){this._myInstances.Delete(inst)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(this._iBehavior===null){const CustomScriptClass= +this._scriptInterfaceClass;if(CustomScriptClass){this._iBehavior=new CustomScriptClass(this);if(!(this._iBehavior instanceof IBehavior))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new IBehavior(this)}return this._iBehavior}}; + +} + +// sdk/sdkBehaviorTypeBase.js +{ +'use strict';const C3=self.C3;C3.SDKBehaviorTypeBase=class SDKBehaviorTypeBase extends C3.DefendedBase{constructor(behaviorType){super();this._runtime=behaviorType.GetRuntime();this._behaviorType=behaviorType;this._objectClass=behaviorType.GetObjectClass();this._behavior=behaviorType.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._runtime=null;this._behaviorType=null;this._objectClass=null;this._behavior=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}; + +} + +// sdk/sdkBehaviorInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKBehaviorInstanceBase=class SDKBehaviorInstanceBase extends C3.DefendedBase{constructor(behInst,domComponentId){super();this._behInst=behInst;this._domComponentId=domComponentId;this._inst=behInst.GetObjectInstance();this._runtime=behInst.GetRuntime();this._behaviorType=behInst.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isTicking=false;this._isTicking2=false;this._isPostTicking=false;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking(); +if(this._disposables){this._disposables.Release();this._disposables=null}this._behInst=null;this._inst=null;this._runtime=null;this._behaviorType=null;this._sdkType=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(method){return this._runtime.Trigger(method, +this._inst,this._behaviorType)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,this._behaviorType)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){if(this._isTicking)return;this._runtime._AddBehInstToTick(this);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime._RemoveBehInstToTick(this);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return; +this._runtime._AddBehInstToTick2(this);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime._RemoveBehInstToTick2(this);this._isTicking2=false}IsTicking2(){return this._isTicking2}_StartPostTicking(){if(this._isPostTicking)return;this._runtime._AddBehInstToPostTick(this);this._isPostTicking=true}_StopPostTicking(){if(!this._isPostTicking)return;this._runtime._RemoveBehInstToPostTick(this);this._isPostTicking=false}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,func)}OnSpriteFrameChanged(prevFrame,nextFrame){}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset){if(offset===0)return;const value=this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset)}SetPropertyColorOffsetValueByIndex(index, +offsetR,offsetG,offsetB){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._behInst.HasScriptInterface())return;const scriptInterface=this.GetScriptInterface();const e=C3.New(C3.Event,name,cancelable);e.behaviorInstance=scriptInterface;e.instance=scriptInterface.instance;if(additionalProperties)Object.assign(e,additionalProperties); +scriptInterface.dispatchEvent(e)}}; + +} + +// objects/pluginManager.js +{ +'use strict';const C3=self.C3;C3.Plugins={};C3.Behaviors={}; +C3.PluginManager=class PluginManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._solidBehavior=null;this._jumpthruBehavior=null}CreatePlugin(pluginData){const Ctor=this._runtime.GetObjectReference(pluginData[0]);if(!Ctor)throw new Error("missing plugin");C3.AddCommonACEs(pluginData,Ctor);const plugin=C3.New(Ctor,{runtime:this._runtime,isSingleGlobal:pluginData[1], +isWorld:pluginData[2],isRotatable:pluginData[5],hasEffects:pluginData[8],mustPredraw:pluginData[9],supportsSceneGraph:pluginData[13],supportsMesh:pluginData[14]});plugin.OnCreate();this._allPlugins.push(plugin);this._pluginsByCtor.set(Ctor,plugin)}CreateSystemPlugin(){this._systemPlugin=C3.New(C3.Plugins.System,{runtime:this._runtime,isSingleGlobal:true});this._systemPlugin.OnCreate()}CreateBehavior(behaviorData){const Ctor=this._runtime.GetObjectReference(behaviorData[1]);if(!Ctor)throw new Error("missing behavior"); +const behavior=C3.New(Ctor,{runtime:this._runtime});behavior.OnCreate();this._allBehaviors.push(behavior);this._behaviorsByCtor.set(Ctor,behavior);if(!this._solidBehavior&&C3.Behaviors.solid&&behavior instanceof C3.Behaviors.solid)this._solidBehavior=behavior;else if(!this._jumpthruBehavior&&C3.Behaviors.jumpthru&&behavior instanceof C3.Behaviors.jumpthru)this._jumpthruBehavior=behavior}GetPluginByConstructorFunction(ctor){return this._pluginsByCtor.get(ctor)||null}HasBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.has(ctor)}GetBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.get(ctor)|| +null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}; + +} + +// objects/imageInfo.js +{ +'use strict';const C3=self.C3;const allImageInfos=new Set; +C3.ImageInfo=class ImageInfo extends C3.DefendedBase{constructor(){super();this._url="";this._size=0;this._offsetX=0;this._offsetY=0;this._width=0;this._height=0;this._isRotated=false;this._hasMetaData=false;this._imageAsset=null;this._textureState="";this._rcTex=C3.New(C3.Rect);this._quadTex=C3.New(C3.Quad);this._blobUrl="";this._iImageInfo=new self.IImageInfo(this);allImageInfos.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;allImageInfos.delete(this);this.ReleaseBlobURL()}static OnWebGLContextLost(){for(const imageInfo of allImageInfos){imageInfo._textureState= +"";imageInfo._rcTex.set(0,0,0,0);imageInfo._quadTex.setFromRect(imageInfo._rcTex)}}LoadData(imageData){this._url=imageData[0];this._size=imageData[1];this._offsetX=imageData[2];this._offsetY=imageData[3];this._width=imageData[4];this._height=imageData[5];this._isRotated=imageData[6];this._hasMetaData=true}LoadDynamicAsset(runtime,url){if(this._imageAsset)throw new Error("already loaded asset");this._url=url;const opts={};if(C3.IsAbsoluteURL(url))opts.loadPolicy="remote";this.LoadAsset(runtime,opts); +return this._imageAsset.Load()}ReplaceWith(otherImageInfo){if(otherImageInfo===this)throw new Error("cannot replace with self");this.ReleaseTexture();this._url=otherImageInfo._url;this._size=otherImageInfo._size;this._offsetX=otherImageInfo._offsetX;this._offsetY=otherImageInfo._offsetY;this._width=otherImageInfo._width;this._height=otherImageInfo._height;this._isRotated=otherImageInfo._isRotated;this._hasMetaData=otherImageInfo._hasMetaData;this._imageAsset=otherImageInfo._imageAsset;this._textureState= +otherImageInfo._textureState;this._rcTex=otherImageInfo._rcTex;this._quadTex=otherImageInfo._quadTex;this.ReleaseBlobURL()}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(runtime,opts){if(this._imageAsset)throw new Error("already got asset"); +opts=Object.assign({},opts,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=runtime.LoadImage(opts)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(renderer,opts){if(!this._imageAsset)throw new Error("no asset");if(this._textureState)throw new Error("already loaded texture");this._textureState="loading";const texture=await this._imageAsset.LoadStaticTexture(renderer,opts);if(!texture){this._textureState="";return null}this._textureState="loaded";if(!this._hasMetaData){this._width= +texture.GetWidth();this._height=texture.GetHeight();this._hasMetaData=true}const wr=this._isRotated?this._height:this._width;const hr=this._isRotated?this._width:this._height;this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+wr,this._offsetY+hr);this._rcTex.divide(texture.GetWidth(),texture.GetHeight());this._quadTex.setFromRect(this._rcTex);if(this._isRotated)this._quadTex.rotatePointsAnticlockwise();return texture}ReleaseTexture(){if(!this._textureState)return;if(this._imageAsset)this._imageAsset.ReleaseTexture(); +this._textureState="";this._rcTex.set(0,0,0,0);this._quadTex.setFromRect(this._rcTex)}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}GetIImageInfo(){return this._iImageInfo}async ExtractImageToCanvas(){const srcDrawable=await this._imageAsset.LoadToDrawable();const canvas=C3.CreateCanvas(this._width,this._height);const ctx=canvas.getContext("2d");if(this._isRotated){ctx.rotate(Math.PI/-2);ctx.translate(-this._height, +0);ctx.drawImage(srcDrawable,this._offsetX,this._offsetY,this._height,this._width,0,0,this._height,this._width)}else ctx.drawImage(srcDrawable,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return canvas}async ExtractImageToBlobURL(){if(this._blobUrl)return this._blobUrl;const canvas=await this.ExtractImageToCanvas();const blob=await C3.CanvasToBlob(canvas);this._blobUrl=URL.createObjectURL(blob);return this._blobUrl}ReleaseBlobURL(){if(this._blobUrl){URL.revokeObjectURL(this._blobUrl); +this._blobUrl=""}}}; + +} + +// objects/animationInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationInfo=class AnimationInfo extends C3.DefendedBase{constructor(animData){super();this._name=animData[0];this._speed=animData[1];this._isLooping=!!animData[2];this._repeatCount=animData[3];this._repeatTo=animData[4];this._isPingPong=!!animData[5];this._sid=animData[6];this._frames=animData[7].map(frameData=>C3.New(C3.AnimationFrameInfo,frameData));this._iAnimation=new self.IAnimation(this)}Release(){for(const f of this._frames)f.Release();C3.clearArray(this._frames)}LoadAllAssets(runtime){for(const f of this._frames)f.GetImageInfo().LoadAsset(runtime)}LoadAllTextures(renderer,opts){return Promise.all(this._frames.map(f=> +f.GetImageInfo().LoadStaticTexture(renderer,opts)))}ReleaseAllTextures(){for(const f of this._frames)f.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(i){i=Math.floor(i);if(i<0||i>=this._frames.length)throw new RangeError("invalid frame");return this._frames[i]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}GetIAnimation(){return this._iAnimation}}; + +} + +// objects/animationFrameInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationFrameInfo=class AnimationFrameInfo extends C3.DefendedBase{constructor(frameData){super();this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(frameData);this._duration=frameData[7];this._origin=C3.New(C3.Vector2,frameData[8],frameData[9]);this._imagePoints=frameData[10].map(data=>C3.New(C3.ImagePoint,this,data));this._imagePointsByName=new Map;for(const ip of this._imagePoints)this._imagePointsByName.set(ip.GetName().toLowerCase(),ip);this._collisionPoly=null;const polyPoints= +frameData[11];if(polyPoints.length>=6)this._collisionPoly=C3.New(C3.CollisionPoly,polyPoints);this._iAnimationFrame=new self.IAnimationFrame(this)}Release(){if(this._collisionPoly){this._collisionPoly.Release();this._collisionPoly=null}this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(name){return this._imagePointsByName.get(name.toLowerCase())|| +null}GetImagePointByIndex(index){index=Math.floor(index);if(index<0||index>=this._imagePoints.length)return null;return this._imagePoints[index]}GetImagePointCount(){return this._imagePoints.length}GetIAnimationFrame(){return this._iAnimationFrame}}; + +} + +// objects/imagePoint.js +{ +'use strict';const C3=self.C3;C3.ImagePoint=class ImagePoint extends C3.DefendedBase{constructor(afi,data){super();this._afi=afi;this._name=data[0];this._pos=C3.New(C3.Vector2,data[1],data[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}; + +} + +// objects/objectClass.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IObjectClass=self.IObjectClass;const assert=self.assert; +C3.ObjectClass=class ObjectClass extends C3.DefendedBase{constructor(runtime,index,data){super();const PluginCtor=runtime.GetObjectReference(data[1]);this._runtime=runtime;this._plugin=runtime.GetPluginManager().GetPluginByConstructorFunction(PluginCtor);this._sdkType=null;this._instSdkCtor=PluginCtor.Instance;this._index=index;this._sid=data[11];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[14]);this._isGlobal=!!data[9];this._isFamily=!!data[2];this._isOnLoaderLayout=!!data[10]; +this._instVars=data[3].map(arr=>({sid:arr[0],type:arr[1],name:arr[2],jsPropName:runtime.GetJsPropName(arr[3])}));this._behaviorsCount=data[4];this._effectsCount=data[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=C3.New(C3.SparseGrid,runtime.GetOriginalViewportWidth(),runtime.GetOriginalViewportHeight());this._anyCollisionCellChanged=true;this._anyInstanceParallaxed=false;this._familyMembers=null;this._familyMembersSet=null;this._familyIndex=-1;this._families= +null;this._familiesSet=null;this._familyInstVarMap=null;this._familyBehaviorMap=null;this._familyEffectMap=null;this._isInContainer=false;this._container=null;this._behaviorTypes=data[8].map(behaviorTypeData=>C3.BehaviorType.Create(this,behaviorTypeData));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=C3.New(C3.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained= +false;this._container=null;this._imageInfo=null;this._animations=null;this._animationsByName=null;this._animationsBySid=null;this._textureRefCount=0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=true;if(this._plugin.HasEffects())this._effectList=C3.New(C3.EffectList,this,data[12]);if(data[6]){this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(data[6])}if(data[7]){this._animations=data[7].map(animData=>C3.New(C3.AnimationInfo,animData));this._animationsByName= +new Map;this._animationsBySid=new Map;for(const anim of this._animations){this._animationsByName.set(anim.GetName().toLowerCase(),anim);this._animationsBySid.set(anim.GetSID(),anim)}}if(this._isFamily){this._familyMembers=[];this._familyMembersSet=new Set;this._familyIndex=this._runtime._GetNextFamilyIndex()}else{this._families=[];this._familiesSet=new Set;this._familyInstVarMap=[];this._familyBehaviorMap=[];this._familyEffectMap=[]}this._sdkType=C3.New(PluginCtor.Type,this,data[15]);this._iObjectClass= +null;this._instanceUserScriptClass=null;this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);const CustomScriptClass=this._sdkType.GetScriptInterfaceClass();if(CustomScriptClass){this._iObjectClass=new CustomScriptClass(this);if(!(this._iObjectClass instanceof IObjectClass))throw new TypeError("script interface class must derive from IObjectClass");}else this._iObjectClass=new IObjectClass(this);if(data[13]){const tilemapData=data[13];if(tilemapData){const tilePolyData=tilemapData[0];const maxTileIndex= +tilemapData[1];const brushData=tilemapData[2];this._sdkType.LoadTilemapData(tilePolyData,maxTileIndex,brushData)}}if(!this._runtime.UsesLoaderLayout()||this._isFamily||this._isOnLoaderLayout||!this._isWorldType)this.OnCreate();if(this._plugin.IsSingleGlobal()){this._plugin._SetSingleGlobalObjectClass(this);this._CreateSingleGlobalInstance(data)}}static Create(runtime,index,objectClassData){return C3.New(C3.ObjectClass,runtime,index,objectClassData)}Release(){if(this._imageInfo){this._imageInfo.Release(); +this._imageInfo=null}if(this._animations){for(const a of this._animations)a.Release();C3.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._container=null;this._runtime=null}_LoadFamily(familyData){for(let i=1,len=familyData.length;i0}LoadTextures(renderer){if(this._isFamily)return Promise.resolve();this._textureRefCount++;if(this._textureRefCount===1)return this._sdkType.LoadTextures(renderer)||Promise.resolve();else return Promise.resolve()}ReleaseTextures(){if(this._isFamily)return;this._textureRefCount--; +if(this._textureRefCount<0)throw new Error("released textures too many times");if(this._textureRefCount===0)this._sdkType.ReleaseTextures()}OnDynamicTextureLoadComplete(){if(this._isFamily)throw new Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(renderer){if(this._isFamily)return Promise.resolve();return this._sdkType.PreloadTexturesWithInstances(renderer)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(Ctor){return Ctor&& +this._usedBehaviorCtors.has(Ctor)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(iv=>iv.sid)}GetInstanceVariableIndexBySID(sid){return this._instVars.findIndex(iv=>iv.sid===sid)}GetInstanceVariableIndexByName(name){return this._instVars.findIndex(iv=>iv.name===name)}_GetAllInstanceVariableNames(){return this._instVars.map(iv=>iv.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(iv=>iv.jsPropName)}GetInstanceVariableType(i){i= +Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].type}GetInstanceVariableName(i){i=Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(name){return this._behaviorsByName.get(name.toLowerCase())|| +null}GetBehaviorIndexByName(name){const ret=this._behaviorNameToIndex.get(name.toLowerCase());if(typeof ret==="undefined")return-1;else return ret}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(i){this._defaultLayerIndex= +i}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(family){return this._familiesSet.has(family)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(objectType){return this._familyMembersSet.has(objectType)}GetFamilyBehaviorOffset(familyIndex){return this._familyBehaviorMap[familyIndex]}GetFamilyInstanceVariableOffset(familyIndex){return this._familyInstVarMap[familyIndex]}GetAnimationByName(name){if(!this._animations)throw new Error("no animations"); +return this._animationsByName.get(name.toLowerCase())||null}GetAnimationBySID(sid){if(!this._animations)throw new Error("no animations");return this._animationsBySid.get(sid)||null}GetFirstAnimationFrame(){if(!this._animations)throw new Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const firstFrameInfo=this.GetFirstAnimationFrame().GetImageInfo();return[firstFrameInfo.GetWidth(),firstFrameInfo.GetHeight()]}else if(this._imageInfo)return[this._imageInfo.GetWidth(), +this._imageInfo.GetHeight()];else return[100,100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw new Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;yield*this._runtime.instancesPendingCreateForObjectClass(this)}GetInstanceCount(){return this._instances.length}_AddInstance(inst){this._instances.push(inst)}_SetIIDsStale(){this._iidsStale= +true}_UpdateIIDs(){if(!this._iidsStale||this._isFamily)return;const instances=this._instances;let i=0;for(let len=instances.length;i0)return instances[inst.GetIID()% +instances.length];else return null}*allCorrespondingInstances(inst,objectClass){const myInstances=this.GetCurrentSol().GetInstances();const myInstanceCount=myInstances.length;const otherSol=objectClass.GetCurrentSol();const otherInstances=objectClass.GetCurrentSol().GetInstances();const otherInstanceCount=otherInstances.length;let index=inst.GetIID();if(objectClass.IsFamily()||!otherSol.IsSelectAll())index=otherInstances.indexOf(inst);const divisor=Math.ceil(myInstanceCount/otherInstanceCount);const remainder= +myInstanceCount%otherInstanceCount;let startIndex=0;let correspondCount=0;if(remainder===0||indexinst.SaveToJson())};if(this._savedData&&this._savedData.size)o["ex"]=C3.ToSuperJSON(this._savedData);return o}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}const ex=o["ex"];if(ex)this._savedData=C3.FromSuperJSON(ex);const existingInstances=this._instances;const loadInstances=o["instances"];for(let i=0,len=Math.min(existingInstances.length,loadInstances.length);io.IsWorldType())}}; + +} + +// objects/instance.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IInstance=self.IInstance;const EMPTY_ARRAY=[];let nextPuid=0;const savedDataMaps=new WeakMap;const unsavedDataMaps=new WeakMap;const FLAG_DESTROYED=1<<0;const FLAG_TILEMAP=1<<1;const FLAG_MUST_PREDRAW=1<<2;const FLAG_SOLID_ENABLED=1<<3;const FLAG_JUMPTHRU_ENABLED=1<<4;const FLAG_MUST_MITIGATE_Z_FIGHTING=1<<5;const FLAG_IS_DRAWING_WITH_EFFECTS=1<<6; +C3.Instance=class Instance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._objectType=opts.objectType;this._worldInfo=null;this._sdkInst=null;this._iScriptInterface=null;this._iid=0;this._uid=opts.uid;this._puid=nextPuid++;this._flags=0;this._instVarValues=EMPTY_ARRAY;this._behaviorInstances=EMPTY_ARRAY;const behaviorTypes=this._objectType.GetBehaviorTypesIncludingInherited();if(behaviorTypes.length>0)this._behaviorInstances=behaviorTypes.map((behaviorType,index)=> +C3.New(C3.BehaviorInstance,{runtime:this._runtime,behaviorType:behaviorType,instance:this,index}));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;const plugin=this.GetPlugin();if(plugin.MustPreDraw())this._flags|=FLAG_MUST_PREDRAW;if(plugin.IsWorldType()){this._worldInfo=C3.New(C3.WorldInfo,this,opts.layer);if(opts.worldData)this._worldInfo.Init(opts.worldData);else{this._worldInfo.InitNoData();const [width,height]=this._objectType.GetDefaultInstanceSize(); +this._worldInfo.SetSize(width,height);if(this.GetObjectClass().UsesEffects())this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}}if(opts.instVarData)this._LoadInstanceVariableData(opts.instVarData);else this._LoadDefaultInstanceVariables()}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}if(this._behaviorInstances.length>0){for(const behInst of this._behaviorInstances)behInst.Release();C3.clearArray(this._behaviorInstances)}this._sdkInst.Release(); +this._sdkInst=null;const savedData=savedDataMaps.get(this);if(savedData){savedData.clear();savedDataMaps.delete(this)}const unsavedData=unsavedDataMaps.get(this);if(unsavedData){unsavedData.clear();unsavedDataMaps.delete(this)}if(this._siblings)C3.clearArray(this._siblings);if(this._dispatcher){this._dispatcher.Release();this._dispatcher=null}this._runtime=null;this._objectType=null;if(this._instVarValues.length>0)C3.clearArray(this._instVarValues);if(this._worldInfo){this._worldInfo.Release();this._worldInfo= +null}}_LoadInstanceVariableData(instVarData){if(instVarData.length>0){this._instVarValues=[];C3.shallowAssignArray(this._instVarValues,instVarData)}}_LoadDefaultInstanceVariables(){const len=this._objectType.GetInstanceVariablesCount();if(len===0)return;this._instVarValues=[];const typeToInitValue=[0,0,""];for(let i=0;i{const objectClass=objectClass_||inst.GetObjectClass();const instSet=pickMap.get(objectClass);if(instSet)instSet.add(inst);else pickMap.set(objectClass,new Set([inst]))};addInst(this,createdObjectClass);if(this.IsInContainer())for(const s of this.siblings())addInst(s);if(includeHierarchy)for(const c of this.allChildren())addInst(c)}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw new Error("object does not support scene graph"); +}HasParent(){return this.GetParent()!==null}GetParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetParent();return parentWi?parentWi.GetInstance():null}GetTopParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetTopParent();return parentWi?parentWi.GetInstance():null}*parents(){const wi=this.GetWorldInfo();if(!wi)return;for(const parentWi of wi.parents())yield parentWi.GetInstance()}HasChild(child){if(!child)return false;for(const c of this.children())if(c=== +child)return true;return false}HasChildren(){const wi=this.GetWorldInfo();return wi?wi.HasChildren():false}GetChildrenOfObjectClass(objectClass){const wi=this.GetWorldInfo();if(!wi)return[];const objectClassName=objectClass.GetName();return wi.GetChildren().map(wi=>wi.GetInstance()).filter(i=>i.GetObjectClass().GetName()===objectClassName)}GetChildren(){const wi=this.GetWorldInfo();if(!wi)return[];return wi.GetChildren().map(wi=>wi.GetInstance())}*children(){const wi=this.GetWorldInfo();if(!wi)return; +for(const childWi of wi.children())yield childWi.GetInstance()}*allChildren(){const wi=this.GetWorldInfo();if(!wi)return;for(const childWi of wi.allChildren())yield childWi.GetInstance()}GetChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetChildCount():0}GetParentCount(){return[...this.parents()].length}GetAllChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetAllChildCount():0}GetChildAt(index){const wi=this.GetWorldInfo();if(!wi)return null;const childWi=wi.GetChildAt(index);return childWi? +childWi.GetInstance():null}AddChild(childInst,opts){this.VerifySupportsSceneGraph();childInst.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(childInst.GetWorldInfo(),opts||{})}RemoveChild(childInst){const wi=this.GetWorldInfo();if(!wi)return;wi.RemoveChild(childInst.GetWorldInfo())}GetDestroyWithParent(){const wi=this.GetWorldInfo();return wi?wi.GetDestroyWithParent():false}SetupInitialSceneGraphConnections(){const wi=this.GetWorldInfo();if(!wi)return;const childrenData=wi.GetSceneGraphChildrenExportData(); +if(!childrenData)return;for(const childData of childrenData){const child=this._runtime.GetInstanceByUID(childData[2]);if(child){const flags=childData[3];this.AddChild(child,{transformX:!!(flags>>0&1),transformY:!!(flags>>1&1),transformWidth:!!(flags>>2&1),transformHeight:!!(flags>>3&1),transformAngle:!!(flags>>4&1),destroyWithParent:!!(flags>>5&1),transformZElevation:!!(flags>>6&1)})}}}IsInContainer(){return this._siblings!==null}_AddSibling(inst){this._siblings.push(inst)}GetSiblings(){return this._siblings}HasSibling(objectClass){return!!this.GetSibling(objectClass)}GetSibling(objectClass){const siblings= +this.siblings();if(siblings===null||siblings.length===0)return false;for(const s of siblings)if(s.GetObjectClass()===objectClass)return s;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol().SetSinglePicked(s)}_PushSiblingsToSolInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushInstance(s)}_SetSiblingsToSolInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnInstances()[i]= +s}_PushSiblingsToSolElseInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushElseInstance(s)}_SetSiblingsToSolElseInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[i]=s}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(i){this._iid=i}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(ctor){if(!ctor)return null; +for(const behInst of this._behaviorInstances)if(behInst.GetBehavior()instanceof ctor)return behInst;return null}GetBehaviorSdkInstanceFromCtor(ctor){if(!ctor)return null;const behInst=this.GetBehaviorInstanceFromCtor(ctor);if(behInst)return behInst.GetSdkInstance();else return null}GetBehaviorIndexBySID(sid){const behaviorInstances=this._behaviorInstances;for(let i=0,len=behaviorInstances.length;i=instVarValues.length)throw new RangeError("invalid instance variable");return instVarValues[index]}_GetInstanceVariableValueUnchecked(index){return this._instVarValues[index]}_GetInstanceVariableTypedValue(index){const ret=this._instVarValues[index];if(this._objectType.GetInstanceVariableType(index)===0)return!!ret;else return ret}SetInstanceVariableValue(index,value){index=index|0;const instVarValues=this._instVarValues;if(index< +0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const type=this._objectType.GetInstanceVariableType(index);switch(type){case 0:instVarValues[index]=value?1:0;break;case 1:instVarValues[index]=typeof value==="number"?value:parseFloat(value);break;case 2:instVarValues[index]=typeof value==="string"?value:value.toString();break;default:throw new Error("unknown instance variable type");}}SetInstanceVariableOffset(index,offset){if(offset===0)return;index=index|0;const instVarValues= +this._instVarValues;if(index<0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const lastValue=instVarValues[index];if(typeof lastValue==="number")if(typeof offset==="number")instVarValues[index]+=offset;else instVarValues[index]+=parseFloat(offset);else if(typeof lastValue==="boolean")throw new Error("can not set offset of boolean variable");else if(typeof lastValue==="string")throw new Error("can not set offset of string variable");else throw new Error("unknown instance variable type"); +}GetSavedDataMap(){let ret=savedDataMaps.get(this);if(ret)return ret;ret=new Map;savedDataMaps.set(this,ret);return ret}GetUnsavedDataMap(){let ret=unsavedDataMaps.get(this);if(ret)return ret;ret=new Map;unsavedDataMaps.set(this,ret);return ret}_HasAnyCreateDestroyHandler(name){const objectType=this.GetObjectClass();if(objectType.UserScriptDispatcher().HasAnyHandlerFor(name))return true;for(const family of objectType.GetFamilies())if(family.UserScriptDispatcher().HasAnyHandlerFor(name))return true; +if(this._runtime.UserScriptDispatcher().HasAnyHandlerFor(name))return true;return false}_TriggerOnCreatedOnSelfAndRelated(){const instancesToTriggerOnCreated=new Set;instancesToTriggerOnCreated.add(this);const wi=this.GetWorldInfo();if(wi&&wi.HasChildren())for(const c of this.allChildren()){instancesToTriggerOnCreated.add(c);if(!c.IsInContainer())continue;for(const s of c.siblings())instancesToTriggerOnCreated.add(s)}if(this.IsInContainer())for(const s of this.siblings())instancesToTriggerOnCreated.add(s); +for(const instance of instancesToTriggerOnCreated.values())instance._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const objectType=this.GetObjectClass();const instCreateEvent=new C3.Event("instancecreate");instCreateEvent.instance=this.GetInterfaceClass();objectType.DispatchUserScriptEvent(instCreateEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instCreateEvent);this._runtime.DispatchUserScriptEvent(instCreateEvent)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated, +this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(isEndingLayout){if(this._iScriptInterface){const e=new C3.Event("destroy");e.isEndingLayout=isEndingLayout;this.DispatchUserScriptEvent(e)}if(!this._HasAnyCreateDestroyHandler("instancedestroy"))return;const objectType=this.GetObjectClass();const instDestroyEvent=new C3.Event("instancedestroy");instDestroyEvent.instance=this.GetInterfaceClass();instDestroyEvent.isEndingLayout= +isEndingLayout;objectType.DispatchUserScriptEvent(instDestroyEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instDestroyEvent);this._runtime.DispatchUserScriptEvent(instDestroyEvent)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(mode="full"){const o={};if(mode==="full")o["uid"]=this.GetUID();else o["c3"]=true;if(mode!=="visual-state"){const savedData=savedDataMaps.get(this);if(savedData&&savedData.size)o["ex"]=C3.ToSuperJSON(savedData); +if(this.GetTimeScale()!==-1)o["mts"]=this.GetTimeScale();if(this._objectType.GetInstanceVariablesCount()>0){const ivs={};const ivSids=this._objectType.GetInstanceVariableSIDs();for(let i=0,len=this._instVarValues.length;i=this._instVarValues.length)continue;let v=value;if(v===null)v=NaN;this._instVarValues[index]=v}}if(this.GetPlugin().IsWorldType()){const worldData= +o["w"];const layerSid=worldData["l"];if(this._worldInfo.GetLayer().GetSID()!==layerSid){const oldLayer=this._worldInfo.GetLayer();const newLayer=oldLayer.GetLayout().GetLayerBySID(layerSid);if(newLayer){this._worldInfo._SetLayer(newLayer);oldLayer._RemoveInstance(this,true);newLayer._AddInstance(this,true);newLayer.SetZIndicesChanged();this._worldInfo.SetBboxChanged()}else if(mode==="full")this._runtime.DestroyInstance(this)}this._worldInfo._LoadFromJson(worldData,mode)}if(mode!=="visual-state"){const behs= +o["behs"];if(behs)for(const [sidStr,data]of Object.entries(behs)){const sid=parseInt(sidStr,10);const index=this.GetBehaviorIndexBySID(sid);if(index<0||index>=this._behaviorInstances.length)continue;this._behaviorInstances[index].LoadFromJson(data)}}const ownData=o["data"];if(ownData)this._sdkInst.LoadFromJson(ownData,mode)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}_InitUserScriptInterface(){const DefaultScriptClass= +this._worldInfo?self.IWorldInstance:IInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const UserScriptClass=this._objectType._GetUserScriptInstanceClass();const ScriptInterfaceClass=UserScriptClass||SdkScriptClass||DefaultScriptClass;IInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IInstance._Init(null);if(SdkScriptClass&&!(this._iScriptInterface instanceof DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`); +if(UserScriptClass){const ExpectedBaseClass=SdkScriptClass||DefaultScriptClass;if(!(this._iScriptInterface instanceof ExpectedBaseClass))throw new TypeError(`setInstanceClass(): class '${UserScriptClass.name}' does not extend the right base class '${ExpectedBaseClass.name}'`);}return this._iScriptInterface}_GetInstVarsScriptDescriptor(instDescriptors){if(this._instVarValues.length===0)return;const varDescriptors={};const instVarJsPropNames=this._objectType._GetAllInstanceVariableJsPropNames();for(let i= +0,len=instVarJsPropNames.length;i0}GetChildren(){return this._children}_MaybeSortChildren(){if(!this.HasChildren())return;if(!this._tmpSceneGraphChildrenIndexes)return;if(this._children.length===1)return;this._children.sort((f,s)=>{const fIndex=this._tmpSceneGraphChildrenIndexes.get(f.GetInstance());const sIndex=this._tmpSceneGraphChildrenIndexes.get(s.GetInstance());if(C3.IsFiniteNumber(fIndex)&&C3.IsFiniteNumber(sIndex))return fIndex- +sIndex;return 0})}GetStartScaleX(){return this._startScaleX}SetStartScaleX(sx){this._startScaleX=sx}GetStartScaleY(){return this._startScaleY}SetStartScaleY(sy){this._startScaleY=sy}_GetStartWidth(){if(this._startWidth===0)return Number.EPSILON;return this._startWidth}_GetStartHeight(){if(this._startHeight===0)return Number.EPSILON;return this._startHeight}GetParentScaleX(){if(this._owner.GetTransformWithParentWidth()){const p=this._parent;let cw=p.GetWidth();let sw=p._GetSceneGraphInfo()._GetStartWidth(); +if(cw===0)cw=Number.EPSILON;if(sw===Number.EPSILON&&cw===Number.EPSILON)return 1;if(sw===Number.EPSILON&&cw!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+cw/sdkIntance.GetOriginalWidth()}return cw/sw}return 1}GetParentScaleY(){if(this._owner.GetTransformWithParentHeight()){const p=this._parent;let ch=p.GetHeight();let sh=p._GetSceneGraphInfo()._GetStartHeight();if(ch===0)ch=Number.EPSILON;if(sh===Number.EPSILON&&ch===Number.EPSILON)return 1; +if(sh===Number.EPSILON&&ch!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+ch/sdkIntance.GetOriginalHeight()}return ch/sh}return 1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(mode){return{"sw":this._startWidth,"sh":this._startHeight,"sx":this._startScaleX,"sy":this._startScaleY,"psa":this._parentStartAngle,"p":this._GetParentJson(mode),"c":this._GetChildrenJson(mode)}}_GetFlagsString(wi){let flagsStr="";if(wi.GetTransformWithParentX())flagsStr+= +"x";if(wi.GetTransformWithParentY())flagsStr+="y";if(wi.GetTransformWithParentWidth())flagsStr+="w";if(wi.GetTransformWithParentHeight())flagsStr+="h";if(wi.GetTransformWithParentAngle())flagsStr+="a";if(wi.GetTransformWithParentZElevation())flagsStr+="z";if(wi.GetDestroyWithParent())flagsStr+="d";return flagsStr}_GetParentJson(mode){if(!this._parent)return null;if(!this._parent.GetInstance()||this._parent.GetInstance().IsDestroyed())return null;return this._GetInstanceJson(this._parent,this._owner, +mode)}_GetChildrenJson(mode){return this._children.map(c=>{return this._GetInstanceJson(c,c,mode)})}_GetInstanceJson(wi,flagsSource,mode){const inst=wi.GetInstance();const ret={};ret["uid"]=inst.GetUID();ret["f"]=this._GetFlagsString(flagsSource);ret["offsets"]=flagsSource._SaveSceneGraphPropertiesToJson();if(mode==="state"){ret["oci"]=inst.GetObjectClass().GetIndex();ret["inst"]=inst.SaveToJson()}return ret}_LoadFromJson(o){this._startWidth=o["sw"];this._startHeight=o["sh"];this._startScaleX=o["sx"]; +this._startScaleY=o["sy"];this._parentStartAngle=o["psa"]}_SetTmpSceneGraphChildren(tmpSceneGraphChildren,tmpSceneGraphChildrenIndexes){this._tmpSceneGraphChildren=tmpSceneGraphChildren;this._tmpSceneGraphChildrenIndexes=tmpSceneGraphChildrenIndexes}_OnAfterLoad(o,opts){const owner=this._owner;const runtime=owner.GetRuntime();const processedExistingWis=new Set;if(o["p"]&&!this._parent){const parentUid=o["p"]["uid"];const parentInst=runtime.GetInstanceByUID(parentUid);if(opts&&!opts.ignoreMissingInstances); +if(parentInst){const parentWi=parentInst.GetWorldInfo();if(parentInst.HasChild(this._owner.GetInstance()))this._parent=parentWi;else{parentInst.AddChild(this._owner.GetInstance(),this._GetFlagsObj(o["p"]["f"]));if(!processedExistingWis.has(this._owner))this._owner._LoadSceneGraphPropertiesFromJson(o["p"]["offsets"]);processedExistingWis.add(this._owner);const pwi=parentInst.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}else if(C3.IsFiniteNumber(o["p"]["oci"])){const objectClass=runtime.GetObjectClassByIndex(o["p"]["oci"]); +const system=runtime.GetSystemPlugin();const parentInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true);if(opts&&!opts.ignoreMissingInstances);if(parentInstance){parentInstance.LoadFromJson(o["p"]["inst"]);const parentWi=parentInstance.GetWorldInfo();parentWi.GetLayer().SortAndAddInstancesByZIndex(parentInstance);parentInstance.AddChild(owner.GetInstance(),this._GetFlagsObj(o["p"]["f"]));const pwi=parentInstance.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}}const childInstances= +[];for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(childInst)childInstances.push(childInst)}let childIndex=0;for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(opts&&!opts.ignoreMissingInstances);if(childInst){if(this._tmpSceneGraphChildren&&this._tmpSceneGraphChildren[childIndex]){const existingChildIntance=this._tmpSceneGraphChildren[childIndex];if(existingChildIntance.GetObjectClass()!== +childInst.GetObjectClass()){childIndex++;continue}if(existingChildIntance.IsDestroyed()){childIndex++;continue}const newChildData=o["c"][childIndex];this._AddAndSetChildInstance(existingChildIntance.GetWorldInfo(),newChildData,processedExistingWis,false);childIndex++;continue}const objectClass=childInst.GetObjectClass();const childrenCount=this._GetInstancesOfObjectClassCount(childInstances,objectClass);const childrenOfClassCount=owner.GetInstance().GetChildrenOfObjectClass(objectClass).length;if(childrenCount=== +childrenOfClassCount){const existingChild=owner.GetInstance().GetChildAt(childIndex);const existingChildWi=existingChild.GetWorldInfo();if(existingChildWi){if(!processedExistingWis.has(existingChildWi))existingChildWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(existingChildWi)}childIndex++;continue}if(childInst.HasParent()){const childWi=this._CreateNewChildInstance(childData,opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis);childIndex++; +continue}this._AddAndSetChildInstance(childInst.GetWorldInfo(),childData,processedExistingWis)}else{const childWi=this._CreateNewChildInstance(childData,opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis)}childIndex++}}_GetFlagsObj(flagsString){const opts={};opts.transformX=flagsString.includes("x");opts.transformY=flagsString.includes("y");opts.transformWidth=flagsString.includes("w");opts.transformHeight=flagsString.includes("h");opts.transformAngle=flagsString.includes("a"); +opts.transformZElevation=flagsString.includes("z");opts.destroyWithParent=flagsString.includes("d");return opts}_CreateNewChildInstance(childData,opts){if(!C3.IsFiniteNumber(childData["oci"]))return;const owner=this._owner;const runtime=owner.GetRuntime();const objectClass=runtime.GetObjectClassByIndex(childData["oci"]);const system=runtime.GetSystemPlugin();const childInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true);if(opts&&!opts.ignoreMissingInstances);if(!childInstance)return; +childInstance.LoadFromJson(childData["inst"]);const childWi=childInstance.GetWorldInfo();childWi.GetLayer().SortAndAddInstancesByZIndex(childInstance);return childWi}_AddAndSetChildInstance(childWi,childData,processedExistingWis,setJson=true){const owner=this._owner;owner.AddChild(childWi,this._GetFlagsObj(childData["f"]));if(setJson){if(!processedExistingWis.has(childWi))childWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(childWi)}this._MaybeSortChildren()}_GetInstancesOfObjectClassCount(instances, +objectClass){return instances.filter(i=>i.GetObjectClass().GetName()===objectClass.GetName()).length}}; + +} + +// objects/worldInfo.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const bboxChangeEvent=C3.New(C3.Event,"bboxchange",false);const tempColor=C3.New(C3.Color,0,0,0,0);const tempCollisionPoly=C3.New(C3.CollisionPoly);const DEFAULT_COLOR=C3.New(C3.Color,1,1,1,1);const DEFAULT_RENDER_CELLS=C3.New(C3.Rect,0,0,-1,-1);const DEFAULT_COLLISION_CELLS=C3.New(C3.Rect,0,0,-1,-1); +const VALID_SET_MESH_POINT_MODES=new Set(["absolute","relative"]);const EMPTY_ARRAY=[];let enableUpdateRendererStateGroup=true;const FLAG_IS_VISIBLE=1<<0;const FLAG_BBOX_CHANGED=1<<1;const FLAG_ENABLE_BBOX_CHANGED_EVENT=1<<2;const FLAG_COLLISION_ENABLED=1<<3;const FLAG_COLLISION_CELL_CHANGED=1<<4;const FLAG_SOLID_FILTER_INCLUSIVE=1<<5;const FLAG_HAS_ANY_ACTIVE_EFFECT=1<<6;const FLAG_IS_ROTATABLE=1<<7;const FLAG_DESTROYED=1<<8;const FLAG_DESTROY_WITH_PARENT=1<<9; +const FLAG_TRANSFORM_WITH_PARENT_X=1<<10;const FLAG_TRANSFORM_WITH_PARENT_Y=1<<11;const FLAG_TRANSFORM_WITH_PARENT_W=1<<12;const FLAG_TRANSFORM_WITH_PARENT_H=1<<13;const FLAG_TRANSFORM_WITH_PARENT_A=1<<14;const FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION=1<<15;const MASK_ALL_SCENE_GRAPH_FLAGS=FLAG_DESTROY_WITH_PARENT|FLAG_TRANSFORM_WITH_PARENT_X|FLAG_TRANSFORM_WITH_PARENT_Y|FLAG_TRANSFORM_WITH_PARENT_W|FLAG_TRANSFORM_WITH_PARENT_H|FLAG_TRANSFORM_WITH_PARENT_A|FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION; +const FLAG_MESH_CHANGED=1<<16;const FLAG_PHYSICS_BODY_CHANGED=1<<17;const FLAG_SIN_COS_ANGLE_CHANGED=1<<18;const FLAG_USE_POINTS_SHADER_PROGRAM=1<<19;const FLAG_DRAW_BACK_FACE_ONLY=1<<20;const FLAG_DRAW_NON_BACK_FACES_ONLY=1<<21;const FLAG_BLEND_MODE_BIT_OFFSET=26;const FLAG_BLEND_MODE_MASK=31<=children.length)return null;return children[index]}_CreateSceneGraphInfo(parent){if(!this._sceneGraphInfo)this._sceneGraphInfo=C3.New(C3.SceneGraphInfo,this);if(parent)this._sceneGraphInfo.SetParent(parent)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){if(!this._sceneGraphInfo)return; +this._sceneGraphInfo.Release();this._sceneGraphInfo=null}_SetParent(parent){if(parent){parent._CreateSceneGraphInfo(null);this._CreateSceneGraphInfo(parent)}else{if(this._sceneGraphInfo)this._sceneGraphInfo.SetParent(null);if(!this.HasChildren())this._ReleaseSceneGraphInfo()}}_HasAnyParent(child){if(!this.HasParent())return false;const parent=this.GetParent();if(parent===child)return true;return parent._HasAnyParent(child)}_HasChildRecursive(child){if(this.HasChild(child))return true;for(const c of this.GetChildren())if(c._HasChildRecursive(child))return true; +return false}_AddChildToSceneGraphInfo(child){this._sceneGraphInfo.GetChildren().push(child)}_RemoveChildFromSceneGraphInfo(child){const children=this._sceneGraphInfo.GetChildren();const index=children.indexOf(child);if(index!==-1)children.splice(index,1);if(children.length===0&&!this.HasParent())this._ReleaseSceneGraphInfo();if(!child.HasChildren())child._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const data=sceneGraphExportDataMap.get(this);return data?data.childrenData:null}GetSceneGraphZIndexExportData(){const data= +sceneGraphExportDataMap.get(this);return data?data.zIndexData:NaN}GetSceneGraphZIndex(){const sceneGraphZIndex=sceneGraphZIndexMap.get(this);return C3.IsFiniteNumber(sceneGraphZIndex)?sceneGraphZIndex:NaN}SetSceneGraphZIndex(z){sceneGraphZIndexMap.set(this,z)}SetUsePointsShaderProgram(){this._SetFlag(FLAG_USE_POINTS_SHADER_PROGRAM,true);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(!enableUpdateRendererStateGroup)return;const renderer=this._runtime.GetRenderer();if(this._stateGroup)renderer.ReleaseStateGroup(this._stateGroup); +let shaderProgram;if((this._flags&FLAG_USE_POINTS_SHADER_PROGRAM)!==0)shaderProgram=renderer.GetPointsRenderingProgram()||"";else shaderProgram=renderer.GetTextureFillShaderProgram()||"";this._stateGroup=renderer.AcquireStateGroup(shaderProgram,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===DEFAULT_COLOR}SetBlendMode(bm){bm=bm|0;if(bm<0||bm>31)throw new RangeError("invalid blend mode"); +if(this.GetBlendMode()===bm)return;this._flags=this._flags&~FLAG_BLEND_MODE_MASK|bm<>FLAG_BLEND_MODE_BIT_OFFSET}_SetLayer(layer){this._layer=layer;if(this.GetZElevation()!==0)this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(z){this._zIndex=z|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(bit, +enable){if(enable)this._flags|=bit;else this._flags&=~bit}IsVisible(){return(this._flags&FLAG_IS_VISIBLE)!==0}SetVisible(v){this._SetFlag(FLAG_IS_VISIBLE,v)}IsCollisionEnabled(){return(this._flags&FLAG_COLLISION_ENABLED)!==0}SetCollisionEnabled(e){e=!!e;if(this.IsCollisionEnabled()===e)return;this._SetFlag(FLAG_COLLISION_ENABLED,e);if(e)this.SetBboxChanged();else this._RemoveFromCollisionCells()}SetSolidCollisionFilter(isInclusive,tags){this._SetFlag(FLAG_SOLID_FILTER_INCLUSIVE,isInclusive);if(this._solidFilterTags)this._solidFilterTags.clear(); +if(!tags.trim()){this._solidFilterTags=null;return}if(!this._solidFilterTags)this._solidFilterTags=new Set;for(const tag of tags.split(" "))if(tag)this._solidFilterTags.add(tag.toLowerCase())}IsSolidCollisionAllowed(solidTagSet){const isInclusive=(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;const filterTags=this._solidFilterTags;if(!solidTagSet||!filterTags)return!isInclusive;for(const tag of filterTags)if(solidTagSet.has(tag))return isInclusive;return!isInclusive}SetBboxChanged(){this._flags|=FLAG_BBOX_CHANGED| +FLAG_COLLISION_CELL_CHANGED|FLAG_MESH_CHANGED;this._objectClass._SetAnyCollisionCellChanged(true);this._runtime.UpdateRender();if(this._layer.UsesRenderCells()){this.CalculateBbox(this._boundingBox,this._boundingQuad,true);this._flags&=~FLAG_BBOX_CHANGED;this._UpdateRenderCell()}if((this._flags&FLAG_ENABLE_BBOX_CHANGED_EVENT)!==0)this._inst.Dispatcher().dispatchEvent(bboxChangeEvent);if(this._sceneGraphInfo!==null){const children=this._sceneGraphInfo.GetChildren();for(let i=0,len=children.length;i< +len;++i)children[i].SetBboxChanged()}}CalculateBbox(bbox,bquad,includeMesh){const x=this.GetX();const y=this.GetY();const w=this.GetWidth();const h=this.GetHeight();const a=this.GetAngle();bbox.setWH(x-this._ox*w,y-this._oy*h,w,h);if(includeMesh&&this.HasMesh())this._ExpandBboxForMesh(bbox);if(a===0)bquad.setFromRect(bbox);else{bbox.offset(-x,-y);bquad.setFromRotatedRectPrecalc(bbox,this.GetSinAngle(),this.GetCosAngle());bquad.offset(x,y);bquad.getBoundingBox(bbox)}bbox.normalize()}_UpdateBbox(){const flags= +this._flags;if((flags&FLAG_BBOX_CHANGED)!==0){this.CalculateBbox(this._boundingBox,this._boundingQuad,true);this._flags=flags&~FLAG_BBOX_CHANGED}}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(quad){const x=this.GetX();const y=this.GetY();const ox=Math.round(x)-x;const oy=Math.round(y)-y;if(ox===0&&oy===0)return quad;else{tempQuad.copy(quad);tempQuad.offset(ox,oy);return tempQuad}}OverwriteBoundingBox(box){this._boundingBox.copy(box); +this._boundingQuad.setFromRect(this._boundingBox);this._flags&=~FLAG_BBOX_CHANGED;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(e){this._SetFlag(FLAG_ENABLE_BBOX_CHANGED_EVENT,e)}IsBboxChangeEventEnabled(){return(this._flags&FLAG_ENABLE_BBOX_CHANGED_EVENT)!==0}IsInViewport(viewport,hasVanishingPointOutsideViewport,isOrthographic){if(hasVanishingPointOutsideViewport&&this.GetDepth()!==0)return this.IsInViewport3D(this.GetLayer()._GetViewFrustum());else return this.GetZElevation()=== +0||isOrthographic?viewport.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const layer=this.GetLayer();const totalZElevation=this.GetTotalZElevation();if(totalZElevation>=layer.GetCameraZ())return false;layer.GetViewportForZ(totalZElevation,tempRect);return tempRect.intersectsRect(this.GetBoundingBox())}IsInViewport3D(viewFrustum){const bbox=this.GetBoundingBox();const minX=bbox.getLeft();const maxX=bbox.getRight();const minY=bbox.getTop();const maxY= +bbox.getBottom();const minZ=this.GetTotalZElevation();const maxZ=minZ+this.GetDepth();return viewFrustum.ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ)}IsInViewport2(){const layer=this.GetLayer();if(layer.Has3DCamera())return this.IsInViewport3D(layer._GetViewFrustum());else{const layout=layer.GetLayout();return this.IsInViewport(layer.GetViewport(),layout.HasVanishingPointOutsideViewport(),layout.IsOrthographicProjection())}}_SetDrawBackFaceOnly(e){this._SetFlag(FLAG_DRAW_BACK_FACE_ONLY,e)}_SetDrawNonBackFacesOnly(e){this._SetFlag(FLAG_DRAW_NON_BACK_FACES_ONLY, +e)}IsDrawBackFaceOnly(){return(this._flags&FLAG_DRAW_BACK_FACE_ONLY)!==0}IsDrawNonBackFacesOnly(){return(this._flags&FLAG_DRAW_NON_BACK_FACES_ONLY)!==0}SetSourceCollisionPoly(poly){this._sourceCollisionPoly=poly;this._DiscardTransformedCollisionPoly();if(this.HasMesh())this._meshInfo.meshPoly=null}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return this._sourceCollisionPoly!==null||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(), +this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}return this._GetCustomTransformedCollisionPolyPrecalc(w,h,a,sina,cosa)}_GetCustomTransformedCollisionPolyPrecalc(w,h,a,sinA,cosA){let tpi=this._transformedPolyInfo;if(tpi===null){tpi={poly:C3.New(C3.CollisionPoly),width:NaN,height:NaN,angle:NaN};this._transformedPolyInfo=tpi}const transformedPoly=tpi.poly;if(tpi.width=== +w&&tpi.height===h&&tpi.angle===a)return transformedPoly;const sourcePoly=this._sourceCollisionPoly;if(this.HasMesh()){const ox=this.GetOriginX();const oy=this.GetOriginY();const sourceMesh=this.GetSourceMesh();let meshPoly=this._meshInfo.meshPoly;if(!meshPoly){if(sourcePoly){tempCollisionPoly.copy(sourcePoly);tempCollisionPoly.offset(ox,oy)}else tempCollisionPoly.setDefaultPoints();meshPoly=sourceMesh.InsertPolyMeshVertices(tempCollisionPoly);this._meshInfo.meshPoly=meshPoly}sourceMesh.TransformCollisionPoly(meshPoly, +transformedPoly);transformedPoly.offset(-ox,-oy);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else if(sourcePoly){transformedPoly.copy(sourcePoly);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else transformedPoly.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());tpi.width=w;tpi.height=h;tpi.angle=a;return transformedPoly}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(true);const tpi=this._transformedPolyInfo;if(tpi===null)return;tpi.width=NaN}CreateMesh(hsize,vsize){hsize= +Math.floor(hsize);vsize=Math.floor(vsize);if(!this.GetInstance().GetPlugin().SupportsMesh())throw new Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:C3.New(C3.Gfx.Mesh,hsize,vsize),transformedMesh:C3.New(C3.Gfx.Mesh,hsize,vsize),meshPoly:null}}HasMesh(){return this._meshInfo!==null}GetSourceMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(e){this._SetFlag(FLAG_MESH_CHANGED, +e)}IsMeshChanged(){return(this._flags&FLAG_MESH_CHANGED)!==0}SetPhysicsBodyChanged(e){this._SetFlag(FLAG_PHYSICS_BODY_CHANGED,e)}IsPhysicsBodyChanged(){return(this._flags&FLAG_PHYSICS_BODY_CHANGED)!==0}_ExpandBboxForMesh(bbox){const sourceMesh=this._meshInfo.sourceMesh;const minX=Math.min(sourceMesh.GetMinX(),0);const minY=Math.min(sourceMesh.GetMinY(),0);const maxX=Math.max(sourceMesh.GetMaxX(),1);const maxY=Math.max(sourceMesh.GetMaxY(),1);const w=bbox.width();const h=bbox.height();bbox.offsetLeft(minX* +w);bbox.offsetTop(minY*h);bbox.offsetRight((maxX-1)*w);bbox.offsetBottom((maxY-1)*h);this._depth=sourceMesh.GetMaxZ()}ReleaseMesh(){if(!this._meshInfo)return;this._meshInfo.sourceMesh.Release();this._meshInfo.transformedMesh.Release();this._meshInfo=null;this._DiscardTransformedCollisionPoly()}SetMeshPoint(col,row,opts){col=Math.floor(col);row=Math.floor(row);const mode=opts.mode||"absolute";if(!VALID_SET_MESH_POINT_MODES.has(mode))throw new Error("invalid mode");const isRelative=mode==="relative"; +let posx=opts.x;let posy=opts.y;const zElevation=opts.zElevation;let texu=typeof opts.u==="number"?opts.u:isRelative?0:-1;let texv=typeof opts.v==="number"?opts.v:isRelative?0:-1;if(!this.HasMesh())return false;const sourceMesh=this.GetSourceMesh();const p=sourceMesh.GetMeshPointAt(col,row);if(p===null)return false;let ret=false;if(typeof zElevation==="number"&&p.GetZElevation()!==zElevation){p.SetZElevation(zElevation);ret=true}if(isRelative){posx+=col/(sourceMesh.GetHSize()-1);posy+=row/(sourceMesh.GetVSize()- +1)}if(texu===-1&&!isRelative)texu=p.GetU();else{if(isRelative)texu+=col/(sourceMesh.GetHSize()-1);texu=C3.clamp(texu,0,1)}if(texv===-1&&!isRelative)texv=p.GetV();else{if(isRelative)texv+=row/(sourceMesh.GetVSize()-1);texv=C3.clamp(texv,0,1)}if(p.GetX()===posx&&p.GetY()===posy&&p.GetU()===texu&&p.GetV()===texv)return ret;p.SetX(posx);p.SetY(posy);p.SetU(texu);p.SetV(texv);this._DiscardTransformedCollisionPoly();return true}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(x,y){if(!this.GetBoundingBox().containsPoint(x, +y))return false;if(!this.GetBoundingQuad().containsPoint(x,y))return false;if(this.HasTilemap())return this._inst.GetSdkInstance().TestPointOverlapTile(x,y);if(!this.HasOwnCollisionPoly())return true;return this.GetTransformedCollisionPoly().containsPoint(x-this.GetX(),y-this.GetY())}_IsCollisionCellChanged(){return(this._flags&FLAG_COLLISION_CELL_CHANGED)!==0}_UpdateCollisionCell(){if(!this._IsCollisionCellChanged()||!this.IsCollisionEnabled()||(this._flags&FLAG_DESTROYED)!==0)return;const bbox= +this.GetBoundingBox();const grid=this._objectClass._GetCollisionCellGrid();const collisionCells=this._collisionCells;tempRect.set(grid.XToCell(bbox.getLeft()),grid.YToCell(bbox.getTop()),grid.XToCell(bbox.getRight()),grid.YToCell(bbox.getBottom()));if(collisionCells.equals(tempRect))return;const inst=this._inst;if(collisionCells===DEFAULT_COLLISION_CELLS){grid.Update(inst,null,tempRect);this._collisionCells=C3.New(C3.Rect,tempRect)}else{grid.Update(inst,collisionCells,tempRect);collisionCells.copy(tempRect)}this._flags&= +~FLAG_COLLISION_CELL_CHANGED}_RemoveFromCollisionCells(){const collisionCells=this._collisionCells;if(collisionCells===DEFAULT_COLLISION_CELLS)return;this._objectClass._GetCollisionCellGrid().Update(this._inst,collisionCells,null);this._collisionCells=DEFAULT_COLLISION_CELLS}_UpdateRenderCell(){const layer=this.GetLayer();if(!layer.UsesRenderCells()||(this._flags&FLAG_DESTROYED)!==0)return;const renderGrid=layer.GetRenderGrid();const bbox=this.GetBoundingBox();const renderCells=this._renderCells; +tempRect.set(renderGrid.XToCell(bbox.getLeft()),renderGrid.YToCell(bbox.getTop()),renderGrid.XToCell(bbox.getRight()),renderGrid.YToCell(bbox.getBottom()));if(renderCells.equals(tempRect))return;const inst=this._inst;if(renderCells===DEFAULT_RENDER_CELLS){renderGrid.Update(inst,null,tempRect);this._renderCells=C3.New(C3.Rect,tempRect)}else{renderGrid.Update(inst,renderCells,tempRect);renderCells.copy(tempRect)}layer.SetRenderListStale()}_RemoveFromRenderCells(){const renderCells=this._renderCells; +if(renderCells===DEFAULT_RENDER_CELLS)return;this.GetLayer().GetRenderGrid().Update(this._inst,renderCells,null);this._renderCells=DEFAULT_RENDER_CELLS}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const inst=this._inst;const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances.at(-1)===inst)return;layer._RemoveInstance(inst,false);layer._AddInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToBottom(){const inst=this._inst; +const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances[0]===inst)return;layer._RemoveInstance(inst,false);layer._PrependInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToLayer(layerMove){const inst=this._inst;const curLayer=this._layer;if(curLayer.GetLayout()!==layerMove.GetLayout())throw new Error("layer from different layout");if(layerMove===curLayer)return;curLayer._RemoveInstance(inst,true);this._SetLayer(layerMove);layerMove._AddInstance(inst, +true);this._runtime.UpdateRender()}ZOrderMoveAdjacentToInstance(otherInst,isAfter){const inst=this._inst;let didChangeLayer=false;const curLayer=this._layer;if(otherInst.GetUID()===inst.GetUID())return;const otherWi=otherInst.GetWorldInfo();if(!otherWi)throw new Error("expected world instance");const otherLayer=otherWi.GetLayer();if(curLayer.GetIndex()!==otherLayer.GetIndex()){curLayer._RemoveInstance(inst,true);this._SetLayer(otherLayer);otherLayer._AddInstance(inst,true);didChangeLayer=true}const didChangeZOrder= +otherLayer.MoveInstanceAdjacent(inst,otherInst,!!isAfter);if(didChangeLayer||didChangeZOrder)this._runtime.UpdateRender()}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(e){this._SetFlag(FLAG_HAS_ANY_ACTIVE_EFFECT,e)}HasAnyActiveEffect(){return(this._flags&FLAG_HAS_ANY_ACTIVE_EFFECT)!==0}_SaveToJson(mode){const o={"x":this.GetX(),"y":this.GetY(),"w":this.GetWidth(),"h":this.GetHeight(),"l":this.GetLayer().GetSID(),"zi":this.GetZIndex()};if(this.GetZElevation()!==0)o["ze"]= +this.GetZElevation();if(this.GetAngle()!==0)o["a"]=this.GetAngle();if(!this.HasDefaultColor())o["c"]=this._color.toJSON();if(this.GetOriginX()!==.5)o["oX"]=this.GetOriginX();if(this.GetOriginY()!==.5)o["oY"]=this.GetOriginY();if(this.GetBlendMode()!==0)o["bm"]=this.GetBlendMode();if(!this.IsVisible())o["v"]=this.IsVisible();if(!this.IsCollisionEnabled())o["ce"]=this.IsCollisionEnabled();if(this.IsBboxChangeEventEnabled())o["be"]=this.IsBboxChangeEventEnabled();if(this._instanceEffectList)o["fx"]= +this._instanceEffectList._SaveToJson();const isSolidFilterInclusive=(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;if(isSolidFilterInclusive)o["sfi"]=isSolidFilterInclusive;if(this._solidFilterTags)o["sft"]=[...this._solidFilterTags].join(" ");if(this._sceneGraphInfo&&mode!=="visual-state"){o["sgi"]=this._sceneGraphInfo._SaveToJson(mode);if(sceneGraphExportDataMap.has(this)){o["sgcd"]=sceneGraphExportDataMap.get(this).childrenData;o["sgzid"]=sceneGraphExportDataMap.get(this).zIndexData}}if(this.HasMesh())o["mesh"]= +this.GetSourceMesh().SaveToJson();return o}_SaveSceneGraphPropertiesToJson(){return{"x":this._x,"y":this._y,"z":this._zElevation,"w":this._w,"h":this._h,"a":this._a}}_LoadSceneGraphPropertiesFromJson(o){if(!o)return;this._x=o["x"];this._y=o["y"];this._zElevation=o["z"];this._w=o["w"];this._h=o["h"];this._a=o["a"];this._MarkSinCosAngleChanged();this.SetBboxChanged()}_SetupSceneGraphConnectionsOnChangeOfLayout(){this._ReleaseTmpSceneGraphInfo();this._ResetAllSceneGraphState();this._CreateSceneGraphInfo(null); +if(this._sceneGraphInfo)this._sceneGraphInfo._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren,this._tmpSceneGraphChildrenIndexes)}_OnBeforeLoad(mode){if(mode!=="visual-state")this._ResetAllSceneGraphState()}_LoadFromJson(o,mode){enableUpdateRendererStateGroup=false;this.SetX(o["x"]);this.SetY(o["y"]);this.SetWidth(o["w"]);this.SetHeight(o["h"]);this._SetZIndex(o["zi"]);this.SetZElevation(o.hasOwnProperty("ze")?o["ze"]:0);this.SetAngle(o.hasOwnProperty("a")?o["a"]:0);if(o.hasOwnProperty("c"))tempColor.setFromJSON(o["c"]); +else if(o.hasOwnProperty("o")){tempColor.copyRgb(this._color);tempColor.a=o["o"]}else tempColor.setRgba(1,1,1,1);this._SetColor(tempColor);this.SetOriginX(o.hasOwnProperty("oX")?o["oX"]:.5);this.SetOriginY(o.hasOwnProperty("oY")?o["oY"]:.5);this.SetBlendMode(o.hasOwnProperty("bm")?o["bm"]:0);this.SetVisible(o.hasOwnProperty("v")?o["v"]:true);this.SetCollisionEnabled(o.hasOwnProperty("ce")?o["ce"]:true);this.SetBboxChangeEventEnabled(o.hasOwnProperty("be")?o["be"]:false);this.SetSolidCollisionFilter(o.hasOwnProperty("sfi")? +o["sfi"]:false,o.hasOwnProperty("sft")?o["sft"]:"");if(this._instanceEffectList&&o.hasOwnProperty("fx"))this._instanceEffectList._LoadFromJson(o["fx"]);if(!o.hasOwnProperty("sgi")&&mode!=="visual-state")if(this._tmpSceneGraphChildren)for(const inst of this._tmpSceneGraphChildren)this._runtime.DestroyInstance(inst);if(o.hasOwnProperty("sgi")&&mode!=="visual-state"){this._CreateSceneGraphInfo(null);const sgi=this._sceneGraphInfo;const sgiData=o["sgi"];sgi._LoadFromJson(sgiData);sgi._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren, +this._tmpSceneGraphChildrenIndexes);needsSceneGraphAfterLoad.set(this,true);const runtimeDispatcher=this.GetRuntime().Dispatcher();const onAfterLoad=(e,opts)=>{runtimeDispatcher.removeEventListener("afterload",onAfterLoad);runtimeDispatcher.removeEventListener("afterloadinstance",onAfterLoadInstance);if((this._flags&FLAG_DESTROYED)===0){sgi._OnAfterLoad(sgiData,opts);sgi._SetTmpSceneGraphChildren(null,null);this._ReleaseTmpSceneGraphInfo();this.SetBboxChanged()}};const onAfterLoadInstance=e=>{if(e["instance"]!== +this.GetInstance())return;onAfterLoad(e,{ignoreMissingInstances:true})};runtimeDispatcher.addEventListener("afterload",onAfterLoad);runtimeDispatcher.addEventListener("afterloadinstance",onAfterLoadInstance);if(o["sgcd"]&&C3.IsFiniteNumber(o["sgzid"]))sceneGraphExportDataMap.set(this,{childrenData:o["sgcd"],zIndexData:o["sgzid"]})}if(o.hasOwnProperty("mesh")){const meshData=o["mesh"];this.CreateMesh(meshData["cols"],meshData["rows"]);this.GetSourceMesh().LoadFromJson(meshData)}else this.ReleaseMesh(); +this.SetBboxChanged();enableUpdateRendererStateGroup=true;this._UpdateRendererStateGroup()}}; + +} + +// objects/behaviorType.js +{ +'use strict';const C3=self.C3; +C3.BehaviorType=class BehaviorType extends C3.DefendedBase{constructor(objectClass,data){super();const runtime=objectClass.GetRuntime();const pluginManager=runtime.GetPluginManager();const BehaviorCtor=runtime.GetObjectReference(data[1]);if(!pluginManager.HasBehaviorByConstructorFunction(BehaviorCtor))pluginManager.CreateBehavior(data);this._runtime=runtime;this._objectClass=objectClass;this._behavior=pluginManager.GetBehaviorByConstructorFunction(BehaviorCtor);this._sdkType=null;this._instSdkCtor= +BehaviorCtor.Instance;this._sid=data[2];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[3]);this._sdkType=C3.New(BehaviorCtor.Type,this);this.OnCreate()}static Create(objectClass,behaviorTypeData){return C3.New(C3.BehaviorType,objectClass,behaviorTypeData)}Release(){this._runtime=null;this._behavior=null;this._sdkType.Release();this._sdkType=null;this._instSdkCtor=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}; + +} + +// objects/behaviorInstance.js +{ +'use strict';const C3=self.C3;const IBehaviorInstance=self.IBehaviorInstance; +C3.BehaviorInstance=class BehaviorInstance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._behaviorType=opts.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=opts.instance;this._index=opts.index;this._sdkInst=null;this._iScriptInterface=null;this._behavior._AddInstance(this._inst)}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}this._behavior._RemoveInstance(this._inst);this._sdkInst.Release(); +this._sdkInst=null;this._runtime=null;this._behaviorType=null;this._behavior=null;this._inst=null}_CreateSdkInstance(properties){if(this._sdkInst)throw new Error("already got sdk instance");this._sdkInst=C3.New(this._behaviorType.GetInstanceSdkCtor(),this,properties)}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(prevFrame, +nextFrame){this._sdkInst.OnSpriteFrameChanged(prevFrame,nextFrame)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(o){return this._sdkInst.LoadFromJson(o)}static SortByTickSequence(a,b){const instA=a.GetObjectInstance();const instB=b.GetObjectInstance();const typeIndexA=instA.GetObjectClass().GetIndex();const typeIndexB=instB.GetObjectClass().GetIndex();if(typeIndexA!==typeIndexB)return typeIndexA-typeIndexB;const seqA= +instA.GetPUID();const seqB=instB.GetPUID();if(seqA!==seqB)return seqA-seqB;return a.GetBehaviorInstance()._GetIndex()-b.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const DefaultScriptClass=IBehaviorInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const ScriptInterfaceClass=SdkScriptClass||DefaultScriptClass;IBehaviorInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IBehaviorInstance._Init(null);if(SdkScriptClass&&!(this._iScriptInterface instanceof +DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`);return this._iScriptInterface}GetScriptInterface(){return this._iScriptInterface||this._InitScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}}; + +} + +// objects/effectList.js +{ +'use strict';const C3=self.C3; +C3.EffectList=class EffectList extends C3.DefendedBase{constructor(owner,data){super();this._owner=owner;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._effectParamBuffers=[];this._preservesOpaqueness=true;for(const d of data){const et=C3.New(C3.EffectType,this,d,this._allEffectTypes.length);this._allEffectTypes.push(et);this._effectTypesByName.set(et.GetName().toLowerCase(),et);if(d.length>=3)this._effectParams.push(this._LoadSingleEffectParameters(et,d[2]))}this.GetRuntime()._AddEffectList(this)}Release(){for(const cpb of this._effectParamBuffers)cpb.Release(); +C3.clearArray(this._effectParamBuffers);C3.clearArray(this._allEffectTypes);C3.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();C3.clearArray(this._effectParams);this._owner=null}_InitRenderer(renderer){if(renderer.IsWebGPU()){this._effectParamBuffers=this._allEffectTypes.map(et=>{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null});this._UpdateAllEffectParamBuffers()}}PrependEffectTypes(arr){if(!arr.length)return; +this._allEffectTypes=arr.concat(this._allEffectTypes);for(const et of arr)this._effectTypesByName.set(et.GetName().toLowerCase(),et);for(let i=0,len=this._allEffectTypes.length;i0}GetEffectTypeByName(name){return this._effectTypesByName.get(name.toLowerCase())||null}GetEffectTypeByIndex(index){index=Math.floor(+index);if(index<0||index>=this._allEffectTypes.length)throw new RangeError("invalid effect type index"); +return this._allEffectTypes[index]}IsEffectIndexActive(index){return this.GetEffectTypeByIndex(index).IsActive()}SetEffectIndexActive(index,a){this.GetEffectTypeByIndex(index).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return this._activeEffectTypes.length>0}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false; +const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false;oldValue.copyRgb(value)}else{if(oldValue===value)return false;effectParams[paramIndex]=value}if(effectIndex({"name":et.GetName(),"active":et.IsActive(),"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}LoadFromJson(arr){for(const o of arr){const et=this.GetEffectTypeByName(o["name"]);if(!et)continue;et.SetActive(o["active"]);this._effectParams[et.GetIndex()]= +C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// objects/effectType.js +{ +'use strict';const C3=self.C3; +C3.EffectType=class EffectType extends C3.DefendedBase{constructor(effectList,data,index){super();this._effectList=effectList;this._id=data[0];this._name=data[1];this._index=index;this._shaderProgram=null;this._isActive=true}Release(){this._effectList=null;this._shaderProgram=null}Clone(effectListOwner){const ret=C3.New(C3.EffectType,effectListOwner,[this._id,this._name],-1);ret._shaderProgram=this._shaderProgram;ret._isActive=this._isActive;return ret}_InitRenderer(renderer){const shaderProgram=renderer.GetShaderProgramByName(this._id); +if(!shaderProgram)throw new Error("failed to find shader program '"+this._id+"'");this._shaderProgram=shaderProgram}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(i){this._index=i}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(a){this._isActive=!!a}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const ret=[];for(let i=0, +len=this._shaderProgram.GetParameterCount();i{const inst=effectChain.GetContentObject(); +const wi=inst.GetWorldInfo();renderer.SetColor(wi.GetPremultipliedColor());renderer.SetCurrentZ(wi.GetTotalZElevation());inst.Draw(renderer);renderer.SetCurrentZ(0)},getSourceTextureInfo:inst=>{const srcTexRect=inst.GetCurrentTexRect();const [srcWidth,srcHeight]=inst.GetCurrentSurfaceSize();return{srcTexRect,srcWidth,srcHeight}},getShaderParameters:index=>this._GetEffectChainShaderParametersForIndex(index)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=true;this._effectParams= +[];this._effectParamBuffers=[];if(inst.GetRuntime().GetRenderer().IsWebGPU())this._effectParamBuffers=this._effectList.GetAllEffectTypes().map(et=>{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null});for(let i=0,len=this._effectList.GetAllEffectTypes().length;i0;const isRotatedOrNegativeSizeInstance=wi.GetAngle()!==0||wi.GetWidth()<0||wi.GetHeight()<0;const isTexRotated=inst.IsCurrentTexRotated();if(!this._needsRebuildSteps&&isDefaultColor===this._wasDefaultColor&&is3D===this._was3D&&isRotatedOrNegativeSizeInstance===this._wasRotatedOrNegativeSize&&isTexRotated===this._wasTexRotated)return; +this._effectChain.BuildSteps(this._activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor||inst.MustPreDraw(),is3D,isSourceTextureRotated:isTexRotated,isRotatedOrNegativeSizeInstance});this._needsRebuildSteps=false;this._wasDefaultColor=isDefaultColor;this._was3D=is3D;this._wasRotatedOrNegativeSize=isRotatedOrNegativeSizeInstance;this._wasTexRotated=isTexRotated}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index< +this._effectParamBuffers.length)return this._effectParamBuffers[index];else return this._effectParams[index]}GetEffectParameter(effectIndex,paramIndex){if(effectIndex<0||effectIndex>=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams= +this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false;const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false;oldValue.copyRgb(value)}else{if(oldValue===value)return false;effectParams[paramIndex]=value}if(effectIndexet.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(i){return this._activeEffectFlags[i]}SetEffectIndexActive(i, +e){this._activeEffectFlags[i]=!!e}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(et=>({"name":et.GetName(),"active":this._activeEffectFlags[et.GetIndex()],"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}_LoadFromJson(arr){for(const o of arr){const et=this._effectList.GetEffectTypeByName(o["name"]);if(!et)continue;this._activeEffectFlags[et.GetIndex()]=o["active"];this._effectParams[et.GetIndex()]= +C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// collisions/collisionEngine.js +{ +'use strict';const C3=self.C3;const tempCandidates=[];const tileCollRectCandidates=[];const tempJumpthruRet=[];const tempPolyA=C3.New(C3.CollisionPoly);const tempPolyB=C3.New(C3.CollisionPoly);const tempQuad=C3.New(C3.Quad);const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);let tempPolyC=null;let tempRect3=null;let tempQuadB=null; +C3.CollisionEngine=class CollisionEngine extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._registeredCollisions=[];this._collisionCheckCount=0;this._collisionCheckSec=0;this._polyCheckCount=0;this._polyCheckSec=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=this._polyCheckCount;this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(a, +b){const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw||!bw)return;if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return;this._registeredCollisions.push([a,b])}AddRegisteredCollisionCandidates(inst,otherType,arr){for(const [a,b]of this._registeredCollisions){let otherInst=null;if(inst===a)otherInst=b;else if(inst===b)otherInst=a;else continue;if(!otherInst.BelongsToObjectClass(otherType))continue;if(!arr.includes(otherInst))arr.push(otherInst)}}CheckRegisteredCollision(a,b){if(!this._registeredCollisions.length)return false; +for(const [c,d]of this._registeredCollisions)if(a===c&&b===d||a===d&&b===c)return true;return false}ClearRegisteredCollisions(){C3.clearArray(this._registeredCollisions)}TestOverlap(a,b){if(!a||!b||a===b)return false;const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return false;this._collisionCheckCount++;const layerA=aw.GetLayer();const layerB=bw.GetLayer();const areLayerTransformsCompatible=layerA.IsTransformCompatibleWith(layerB);if(areLayerTransformsCompatible)return this._TestOverlap_SameLayers(aw, +bw);else return this._TestOverlap_DifferentLayers(aw,bw)}_TestOverlap_SameLayers(aw,bw){if(!aw.GetBoundingBox().intersectsRect(bw.GetBoundingBox()))return false;this._polyCheckCount++;if(!aw.GetBoundingQuad().intersectsQuad(bw.GetBoundingQuad()))return false;if(aw.HasTilemap()&&bw.HasTilemap())return false;if(aw.HasTilemap())return this.TestTilemapOverlap(aw,bw);else if(bw.HasTilemap())return this.TestTilemapOverlap(bw,aw);if(!aw.HasOwnCollisionPoly()&&!bw.HasOwnCollisionPoly())return true;const polyA= +aw.GetTransformedCollisionPoly();const polyB=bw.GetTransformedCollisionPoly();return polyA.intersectsPoly(polyB,bw.GetX()-aw.GetX(),bw.GetY()-aw.GetY())}_TestOverlap_DifferentLayers(aw,bw){const aIsTileMap=aw.HasTilemap();const bIsTileMap=bw.HasTilemap();if(aIsTileMap&&!bIsTileMap)return this.TestTilemapOverlapDifferentLayers(aw,bw);else if(bIsTileMap&&!aIsTileMap)return this.TestTilemapOverlapDifferentLayers(bw,aw);else if(!bIsTileMap&&!aIsTileMap){const layerA=aw.GetLayer();const layerB=bw.GetLayer(); +tempPolyA.copy(aw.GetTransformedCollisionPoly());tempPolyB.copy(bw.GetTransformedCollisionPoly());const ptsArrA=tempPolyA.pointsArr();for(let i=0,len=ptsArrA.length;i{let ret=interactiveLayersCache.get(layer);if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};if(sol.IsSelectAll()){if(!isInverted){sol._SetSelectAll(false); +C3.clearArray(sol._GetOwnInstances())}for(const inst of objectClass.GetInstances()){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();let containsPoint=false;if(isLayerInteractive(layer)&&wi.IsInViewport2()){const [lx,ly]=layer.CanvasCssToLayer(ptx,pty,wi.GetTotalZElevation());containsPoint=wi.ContainsPoint(lx,ly)}if(containsPoint)if(isInverted)return false;else sol._PushInstance(inst);else if(isOrBlock)sol._PushElseInstance(inst)}}else{let arr;let isPickingElseInstances=false;if(isOrBlock)if(this._runtime.IsCurrentConditionFirst()&& +!sol._GetOwnElseInstances().length&&sol._GetOwnInstances().length)arr=sol._GetOwnInstances();else{arr=sol._GetOwnElseInstances();isPickingElseInstances=true}else arr=sol._GetOwnInstances();let j=0;for(let i=0,len=arr.length;i0){const PI=Math.PI;this.hitNormal=C3.clampAngle(this.hitNormal+PI);this.normalX=-this.normalX;this.normalY=-this.normalY}}TestInstanceSegment(inst,sx1,sy1,sx2,sy2){const t=C3.rayIntersect(this.x1,this.y1,this.x2,this.y2, +sx1,sy1,sx2,sy2);if(t>=0&&t[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:rt=>this.ReleaseEffectCompositorRenderTarget(rt),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeStartFrame=0;this._gpuTimeEndFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer=null;this._layersGpuProfile=new Map;this._gpuCurUtilisation= +NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=C3.New(C3.Rect);this._snapshotUrl="";this._snapshotPromise=null;this._snapshotResolve=null;this._isPastingToDrawingCanvas=0;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=e=>this._loadingProgress=e.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFrameNumber=0;this._splashFadeInFinishTime=0;this._splashFadeOutStartTime= +0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(resolve=>this._splashDoneResolve=resolve)}_SetGPUPowerPreference(pref){this._gpuPreference=pref}_SetWebGPUEnabled(e){this._isWebGPUEnabled=!!e}_SetZAxisScale(s){this._zAxisScale=s}_SetFieldOfView(f){this._fieldOfView=f}async CreateCanvas(opts){this._canvas=opts["canvas"];this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",e=>this._OnWindowResize(e));this._runtime.AddDOMComponentMessageHandler("runtime", +"fullscreenchange",e=>this._OnFullscreenChange(e));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",e=>this._OnFullscreenError(e));this._canvas.addEventListener("webglcontextlost",e=>this._OnWebGLContextLost(e));this._canvas.addEventListener("webglcontextrestored",e=>this._OnWebGLContextRestored(e));this._isDocumentFullscreen=!!opts["isFullscreen"];const useWebGPU=navigator["gpu"]&&this._isWebGPUEnabled;let hasMajorPerformanceCaveat=false;if(useWebGPU)try{await this._InitWebGPUContext(true)}catch(err){this._webgpuRenderer= +null}if(!this.GetRenderer())try{await this._InitWebGLContext(true)}catch(err){this._webglRenderer=null}if(!this.GetRenderer())hasMajorPerformanceCaveat=true;if(!this.GetRenderer()&&useWebGPU)try{await this._InitWebGPUContext(false)}catch(err){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(false)}catch(err){this._webglRenderer=null}const renderer=this.GetRenderer();if(!renderer)throw new Error("failed to acquire a renderer - check WebGL or WebGPU is supported");renderer.SetHasMajorPerformanceCaveat(hasMajorPerformanceCaveat); +if(this._zAxisScale==="normalized")renderer.SetZAxisScaleNormalized();else{renderer.SetZAxisScaleRegular();renderer.SetFovY(this._fieldOfView)}this.SetSize(opts["windowInnerWidth"],opts["windowInnerHeight"],true);if(this._webgpuRenderer)await this._InitWebGPU();else if(this._webglRenderer)await this._InitWebGL();renderer.SetMipmapsEnabled(this._enableMipmaps);if(renderer.SupportsGPUProfiling())this._gpuLastUtilisation=0;for(const effectList of this._runtime._GetAllEffectLists()){for(const effectType of effectList.GetAllEffectTypes())effectType._InitRenderer(renderer); +effectList._InitRenderer(renderer);effectList.UpdateActiveEffects()}}async _InitWebGPUContext(failIfMajorPerformanceCaveat){const rendererOpts={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat,usesBackgroundBlending:this._runtime.UsesAnyBackgroundBlending(),canSampleBackbuffer:this._runtime.UsesAnyCrossSampling(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=C3.New(C3.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas, +rendererOpts)}async _InitWebGLContext(failIfMajorPerformanceCaveat){const rendererOpts={powerPreference:this._gpuPreference,enableGpuProfiling:true,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat};if(C3.Platform.OS==="Android"&&C3.Platform.BrowserEngine==="Chromium"&&C3.Platform.BrowserVersionNumber<75){console.warn("[Construct] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."); +rendererOpts.maxWebGLVersion=1}if(this._runtime.GetCompositingMode()==="standard")rendererOpts.alpha=true;else{rendererOpts.alpha=false;rendererOpts.lowLatency=true}this._webglRenderer=C3.New(C3.Gfx.WebGLRenderer,this._canvas,rendererOpts);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){data.src=data.wgsl;const vertexSrc=C3.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();promises.push(this._webgpuRenderer.CreateShaderProgram(data, +vertexSrc,id))}await Promise.all(promises)}}async _InitWebGL(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){data.src=data.glsl;const vertexSrc=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();promises.push(this._webglRenderer.CreateShaderProgram(data,vertexSrc,id))}await Promise.all(promises);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}if(this._webglRenderer.SupportsGPUProfiling())this._gpuFrameTimingsBuffer= +C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer)}Release(){this._runtime=null;this._webglRenderer=null;this._canvas=null}_OnWindowResize(e){const runtime=this._runtime;if(runtime.IsExportToVideo())return;const dpr=e["devicePixelRatio"];if(runtime.IsInWorker())self.devicePixelRatio=dpr;runtime._SetDevicePixelRatio(dpr);this._isDocumentFullscreen=!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"]);runtime.UpdateRender();const ev=new C3.Event("window-resize");ev.data=e;runtime.Dispatcher().dispatchEventAndWaitAsyncSequential(ev); +const ev2=new C3.Event("resize");ev2.cssWidth=this.GetCssWidth();ev2.cssHeight=this.GetCssHeight();ev2.deviceWidth=this.GetDeviceWidth();ev2.deviceHeight=this.GetDeviceHeight();runtime.DispatchUserScriptEvent(ev2);if(runtime.IsDebug()&&(runtime.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused()))runtime.Render()}_OnFullscreenChange(e){this._isDocumentFullscreen=!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}_OnFullscreenError(e){this._isDocumentFullscreen= +!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}SetSize(availableWidth,availableHeight,force=false){availableWidth=Math.floor(availableWidth);availableHeight=Math.floor(availableHeight);if(availableWidth<=0||availableHeight<=0)throw new Error("invalid size");if(this._windowInnerWidth===availableWidth&&this._windowInnerHeight===availableHeight&&!force)return;this._windowInnerWidth=availableWidth;this._windowInnerHeight=availableHeight;const fullscreenMode= +this.GetCurrentFullscreenMode();if(fullscreenMode==="letterbox-scale")this._CalculateLetterboxScale(availableWidth,availableHeight);else if(fullscreenMode==="letterbox-integer-scale")this._CalculateLetterboxIntegerScale(availableWidth,availableHeight);else if(fullscreenMode==="off")this._CalculateFixedSizeCanvas(availableWidth,availableHeight);else this._CalculateFullsizeCanvas(availableWidth,availableHeight);this._UpdateFullscreenScalingQuality(fullscreenMode);this._canvas.width=this._canvasDeviceWidth; +this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{"marginLeft":this._canvasCssOffsetX,"marginTop":this._canvasCssOffsetY,"styleWidth":this._canvasCssWidth,"styleHeight":this._canvasCssHeight,"displayScale":this.GetDisplayScale()});const renderer=this.GetRenderer();renderer.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,true);for(const rt of this._availableAdditionalRenderTargets)renderer.DeleteRenderTarget(rt);C3.clearArray(this._availableAdditionalRenderTargets); +renderer.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,this.GetDrawWidth()/this.GetDrawHeight());const layoutManager=this._runtime.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight= +this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth=availableHeight*originalAspectRatio;this._canvasCssWidth=Math.round(letterboxedWidth);this._canvasCssHeight=availableHeight;this._canvasCssOffsetX=Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=0}else{const letterboxedHeight=availableWidth/ +originalAspectRatio;this._canvasCssWidth=availableWidth;this._canvasCssHeight=Math.round(letterboxedHeight);this._canvasCssOffsetX=0;this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}this._canvasDeviceWidth=Math.round(this._canvasCssWidth*dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._runtime.SetViewportSize(originalViewportWidth,originalViewportHeight)}_CalculateLetterboxIntegerScale(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio(); +if(dpr!==1){availableWidth+=1;availableHeight+=1}const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight=this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;let intScale;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth=availableHeight*originalAspectRatio;intScale=letterboxedWidth*dpr/originalViewportWidth}else{const letterboxedHeight= +availableWidth/originalAspectRatio;intScale=letterboxedHeight*dpr/originalViewportHeight}if(intScale>1)intScale=Math.floor(intScale);else if(intScale<1)intScale=1/Math.ceil(1/intScale);this._canvasDeviceWidth=Math.round(originalViewportWidth*intScale);this._canvasDeviceHeight=Math.round(originalViewportHeight*intScale);this._canvasCssWidth=this._canvasDeviceWidth/dpr;this._canvasCssHeight=this._canvasDeviceHeight/dpr;this._canvasCssOffsetX=Math.max(Math.floor((availableWidth-this._canvasCssWidth)/ +2),0);this._canvasCssOffsetY=Math.max(Math.floor((availableHeight-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(originalViewportWidth,originalViewportHeight)}_CalculateFullsizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=availableWidth;this._canvasCssHeight=availableHeight;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._canvasCssOffsetX=0;this._canvasCssOffsetY= +0;const displayScale=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/displayScale,this._canvasCssHeight/displayScale)}_CalculateFixedSizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);if(this.IsDocumentFullscreen()){this._canvasCssOffsetX= +Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}else{this._canvasCssOffsetX=0;this._canvasCssOffsetY=0}this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(fullscreenMode){if(this._wantFullscreenScalingQuality==="high"){this._drawWidth=this._canvasDeviceWidth;this._drawHeight=this._canvasDeviceHeight;this._fullscreenScalingQuality="high"}else{let viewportWidth, +viewportHeight;if(this.GetCurrentFullscreenMode()==="off"){viewportWidth=this._runtime.GetViewportWidth();viewportHeight=this._runtime.GetViewportHeight()}else{viewportWidth=this._runtime.GetOriginalViewportWidth();viewportHeight=this._runtime.GetOriginalViewportHeight()}if(this._canvasDeviceWidthoriginalAspectRatio)this._drawHeight=this._drawWidth/currentAspectRatio}else if(fullscreenMode==="scale-outer"){const originalAspectRatio=viewportWidth/ +viewportHeight;const currentAspectRatio=this._windowInnerWidth/this._windowInnerHeight;if(currentAspectRatio>originalAspectRatio)this._drawWidth=this._drawHeight*currentAspectRatio;else if(currentAspectRatiooriginalAspectRatio||fullscreenMode==="scale-inner"&¤tAspectRatiort.IsCompatibleWithOptions(opts));let ret;if(useIndex!==-1){ret=arr[useIndex];arr.splice(useIndex,1)}else ret=this.GetRenderer().CreateRenderTarget(opts);this._usedAdditionalRenderTargets.add(ret);return ret}ReleaseAdditionalRenderTarget(renderTarget){if(!this._usedAdditionalRenderTargets.has(renderTarget))throw new Error("render target not in use");this._usedAdditionalRenderTargets.delete(renderTarget); +this._availableAdditionalRenderTargets.push(renderTarget)}GetEffectCompositorRenderTarget(){const opts={sampling:this._runtime.GetSampling()};if(this.GetCurrentFullscreenScalingQuality()==="low"){opts.width=this.GetDrawWidth();opts.height=this.GetDrawHeight()}return this.GetAdditionalRenderTarget(opts)}ReleaseEffectCompositorRenderTarget(renderTarget){this.ReleaseAdditionalRenderTarget(renderTarget)}*activeLayersGpuProfiles(){for(const layout of this._runtime.GetLayoutManager().runningLayouts())for(const layer of layout.GetLayers()){const p= +this._layersGpuProfile.get(layer);if(p)yield p}}GetLayerTimingsBuffer(layer){if(!this.GetRenderer().SupportsGPUProfiling())return null;let p=this._layersGpuProfile.get(layer);if(!p){p={name:layer.GetName(),timingsBuffer:C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0};this._layersGpuProfile.set(layer,p)}return p.timingsBuffer}_Update1sFrameRange(){const renderer=this.GetRenderer();if(!renderer.SupportsGPUProfiling())return;if(this._gpuTimeEndFrame===0){this._gpuTimeEndFrame= +renderer.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const p of this.activeLayersGpuProfiles())p.curUtilisation=NaN}}_UpdateTick(){if(this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling())this._UpdateTick_WebGL();if(this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling())this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(!isNaN(this._gpuCurUtilisation))return;this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame); +if(isNaN(this._gpuCurUtilisation))return;if(this._runtime.IsDebug())for(const p of this.activeLayersGpuProfiles()){p.curUtilisation=p.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame);if(isNaN(p.curUtilisation))return}this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const p of this.activeLayersGpuProfiles()){p.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame); +p.lastUtilisation=Math.min(p.curUtilisation,1)}self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(this._gpuTimeEndFrame===0)return;for(let frameNumber=this._gpuTimeStartFrame;frameNumber{this._snapshotResolve=resolve});return this._snapshotPromise}_MaybeTakeSnapshot(){if(!this._snapshotFormat)return;let canvas=this._canvas;const snapArea=this._snapshotArea;const x=C3.clamp(Math.floor(snapArea.getLeft()),0,canvas.width);const y=C3.clamp(Math.floor(snapArea.getTop()),0,canvas.height);let w=snapArea.width();if(w===0)w=canvas.width-x;else w=C3.clamp(Math.floor(w),0,canvas.width-x);let h= +snapArea.height();if(h===0)h=canvas.height-y;else h=C3.clamp(Math.floor(h),0,canvas.height-y);if((x!==0||y!==0||w!==canvas.width||h!==canvas.height)&&(w>0&&h>0)){canvas=C3.CreateCanvas(w,h);const ctx=canvas.getContext("2d");ctx.drawImage(this._canvas,x,y,w,h,0,0,w,h)}C3.CanvasToBlob(canvas,this._snapshotFormat,this._snapshotQuality).then(blob=>{if(this._snapshotUrl)URL.revokeObjectURL(this._snapshotUrl);this._snapshotUrl=URL.createObjectURL(blob);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)}); +this._snapshotFormat="";this._snapshotQuality=1}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(p){if(p)this._isPastingToDrawingCanvas++;else this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return this._isPastingToDrawingCanvas>0}InitLoadingScreen(loaderStyle){if(!this._webglRenderer)return;if(loaderStyle===2){this._percentText=C3.New(C3.Gfx.RendererText,this.GetRenderer());this._percentText.SetIsAsync(false);this._percentText.SetFontName("Arial");this._percentText.SetFontSize(16); +this._percentText.SetHorizontalAlignment("center");this._percentText.SetVerticalAlignment("center");this._percentText.SetSize(PERCENTTEXT_WIDTH,PERCENTTEXT_HEIGHT)}else if(loaderStyle===0){const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(loadingLogoAsset)loadingLogoAsset.LoadStaticTexture(this._webglRenderer).catch(err=>console.warn(`[C3 runtime] Failed to create texture for loading logo: `,err))}else if(loaderStyle===4){this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(tex=> +{if(this._splashState==="done")this._webglRenderer.DeleteTexture(tex);else this._splashTextures.logo=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(tex=>{if(this._splashState==="done")this._webglRenderer.DeleteTexture(tex);else this._splashTextures.powered=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(tex=>{if(this._splashState=== +"done")this._webglRenderer.DeleteTexture(tex);else this._splashTextures.website=tex}).catch(err=>console.warn("Failed to load splash image: ",err))}}async _LoadSvgSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString();const blob=await C3.FetchBlob(url);const drawable=await this._runtime.RasterSvgImage(blob,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(drawable,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString(); +const blob=await C3.FetchBlob(url);return await this._webglRenderer.CreateStaticTextureAsync(blob,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime=Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3)this.HideCordovaSplashScreen()}async EndLoadingScreen(){if(!this._webglRenderer)return; +this._loadingProgress=1;const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle===4)await this._splashDonePromise;this._splashDoneResolve=null;this._splashDonePromise=null;if(this._rafId!==-1){cancelAnimationFrame(this._rafId);this._rafId=-1}this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;if(this._percentText){this._percentText.Release();this._percentText=null}this._runtime.ReleaseLoadingLogoAsset();this._webglRenderer.Start(); +if(this._splashTextures.logo){this._webglRenderer.DeleteTexture(this._splashTextures.logo);this._splashTextures.logo=null}if(this._splashTextures.powered){this._webglRenderer.DeleteTexture(this._splashTextures.powered);this._splashTextures.powered=null}if(this._splashTextures.website){this._webglRenderer.DeleteTexture(this._splashTextures.website);this._splashTextures.website=null}this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame= +this._webglRenderer.GetFrameNumber();if(loaderStyle===3)this.HideCordovaSplashScreen()}_DrawLoadingScreen(){if(this._rafId===-1)return;const renderer=this._webglRenderer;if(!renderer)return;renderer.Start();this._rafId=-1;const hasHadError=this._runtime.GetAssetManager().HasHadErrorLoading();const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3){this.SetCssTransform(renderer);renderer.ClearRgba(0,0,0,0);renderer.ResetColor();renderer.SetTextureFillMode();renderer.SetTexture(null)}if(loaderStyle=== +0)this._DrawProgressBarAndLogoLoadingScreen(hasHadError);else if(loaderStyle===1)this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);else if(loaderStyle===2)this._DrawPercentTextLoadingScreen(hasHadError);else if(loaderStyle===3)C3.noop();else if(loaderStyle===4)this._DrawSplashLoadingScreen(hasHadError);else throw new Error("invalid loader style");renderer.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}_DrawPercentTextLoadingScreen(hasHadError){if(hasHadError)this._percentText.SetColorRgb(1, +0,0);else this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(this._loadingProgress*100)+"%");const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=PERCENTTEXT_WIDTH/2;const hh=PERCENTTEXT_HEIGHT/2;tempQuad.setRect(midX-hw,midY-hh,midX+hw,midY+hh);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(tempQuad,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(hasHadError,width,yOff){const renderer=this._webglRenderer; +const height=PROGRESSBAR_HEIGHT;renderer.SetColorFillMode();if(hasHadError)renderer.SetColorRgba(1,0,0,1);else renderer.SetColorRgba(.118,.565,1,1);const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=width/2;const hh=height/2;tempRect.setWH(midX-hw,midY-hh+yOff,Math.floor(width*this._loadingProgress),height);renderer.Rect(tempRect);tempRect.setWH(midX-hw,midY-hh+yOff,width,height);tempRect.offset(-.5,-.5);tempRect.inflate(.5,.5);renderer.SetColorRgba(0,0,0,1);renderer.LineRect2(tempRect); +tempRect.inflate(1,1);renderer.SetColorRgba(1,1,1,1);renderer.LineRect2(tempRect)}_DrawProgressBarAndLogoLoadingScreen(hasHadError){const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(!loadingLogoAsset){this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);return}const logoTexture=loadingLogoAsset.GetTexture();if(!logoTexture){this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);return}const logoW=logoTexture.GetWidth();const logoH=logoTexture.GetHeight();const midX= +this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=logoW/2;const hh=logoH/2;tempQuad.setRect(midX-hw,midY-hh,midX+hw,midY+hh);this._webglRenderer.SetTexture(logoTexture);this._webglRenderer.Quad(tempQuad);this._DrawProgressBarLoadingScreen(hasHadError,logoW,hh+16)}_DrawSplashLoadingScreen(hasHadError){const renderer=this._webglRenderer;const logoTex=this._splashTextures.logo;const poweredTex=this._splashTextures.powered;const websiteTex=this._splashTextures.website;const nowTime=Date.now(); +if(this._splashFrameNumber===0)this._loaderStartTime=nowTime;const allowQuickSplash=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova();const splashAfterFadeOutWait=allowQuickSplash?0:SPLASH_AFTER_FADEOUT_WAIT_TIME;const splashMinDisplayTime=allowQuickSplash?0:SPLASH_MIN_DISPLAY_TIME;let a=1;if(this._splashState==="fade-in")a=Math.min((nowTime-this._loaderStartTime)/SPLASH_FADE_DURATION,1);else if(this._splashState==="fade-out")a=Math.max(1-(nowTime-this._splashFadeOutStartTime)/ +SPLASH_FADE_DURATION,0);renderer.SetColorFillMode();renderer.SetColorRgba(.231*a,.251*a,.271*a,a);tempRect.set(0,0,this._canvasCssWidth,this._canvasCssHeight);renderer.Rect(tempRect);const w=Math.ceil(this._canvasCssWidth);const h=Math.ceil(this._canvasCssHeight);let drawW,drawH;if(this._canvasCssHeight>256){renderer.SetColorRgba(.302*a,.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a); +else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress;tempRect.setWH(w*.5-drawW/2,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(poweredTex){drawW=C3.clamp(h*.22,105,w*.6)*1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.2-drawH/2,drawW,drawH);renderer.SetTexture(poweredTex);renderer.Rect(tempRect)}if(logoTex){drawW=Math.min(h*.395,w*.95);drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.485-drawH/2,drawW,drawH); +renderer.SetTexture(logoTex);renderer.Rect(tempRect)}if(websiteTex){drawW=C3.clamp(h*.22,105,w*.6)*1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.868-drawH/2,drawW,drawH);renderer.SetTexture(websiteTex);renderer.Rect(tempRect)}}else{renderer.SetColorRgba(.302*a,.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a);else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress; +tempRect.setWH(w*.5-drawW/2,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(logoTex){drawW=h*.55;drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.45-drawH/2,drawW,drawH);renderer.SetTexture(logoTex);renderer.Rect(tempRect)}}this._splashFrameNumber++;if(this._splashState==="fade-in"&&nowTime-this._loaderStartTime>=SPLASH_FADE_DURATION&&this._splashFrameNumber>=2){this._splashState="wait";this._splashFadeInFinishTime=nowTime}if(this._splashState=== +"wait"&&nowTime-this._splashFadeInFinishTime>=splashMinDisplayTime&&this._loadingProgress>=1){this._splashState="fade-out";this._splashFadeOutStartTime=nowTime}if(this._splashState==="fade-out"&&nowTime-this._splashFadeOutStartTime>=SPLASH_FADE_DURATION+splashAfterFadeOutWait||allowQuickSplash&&this._loadingProgress>=1&&nowTime-this._loaderStartTime<500)this._splashDoneResolve()}}; + +} + +// runtime.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const DEFAULT_RUNTIME_OPTS={"messagePort":null,"runtimeBaseUrl":"","headless":false,"hasDom":true,"isInWorker":false,"useAudio":true,"projectData":"","exportType":""};let ife=true; +C3.Runtime=class C3Runtime extends C3.DefendedBase{constructor(opts){opts=Object.assign({},DEFAULT_RUNTIME_OPTS,opts);super();this._messagePort=opts["messagePort"];this._runtimeBaseUrl=opts["runtimeBaseUrl"];this._previewUrl=opts["previewUrl"];this._isHeadless=!!opts["headless"];this._hasDom=!!opts["hasDom"];this._isInWorker=!!opts["isInWorker"];ife=opts["ife"];this._useAudio=!!opts["useAudio"];this._exportType=opts["exportType"];this._isiOSCordova=!!opts["isiOSCordova"];this._isiOSWebView=!!opts["isiOSWebView"]; +this._isFBInstantAvailable=!!opts["isFBInstantAvailable"];this._opusWasmScriptUrl=opts["opusWasmScriptUrl"];this._opusWasmBinaryUrl=opts["opusWasmBinaryUrl"];this._isDebug=!!(this._exportType==="preview"&&opts["isDebug"]);this._breakpointsEnabled=this._isDebug;this._isDebugging=this._isDebug;this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=false;this._projectName="";this._projectVersion="";this._projectUniqueId="";this._appId= +"";this._originalViewportWidth=0;this._originalViewportHeight=0;this._devicePixelRatio=self.devicePixelRatio;this._parallaxXorigin=0;this._parallaxYorigin=0;this._viewportWidth=0;this._viewportHeight=0;this._loaderStyle=0;this._usesLoaderLayout=false;this._isLoading=true;this._usesAnyBackgroundBlending=false;this._usesAnyCrossSampling=false;this._usesAnyDepthSampling=false;this._loadingLogoAsset=null;this._assetManager=C3.New(C3.AssetManager,this,opts);this._layoutManager=C3.New(C3.LayoutManager, +this);this._eventSheetManager=C3.New(C3.EventSheetManager,this);this._pluginManager=C3.New(C3.PluginManager,this);this._collisionEngine=C3.New(C3.CollisionEngine,this);this._timelineManager=C3.New(C3.TimelineManager,this);this._transitionManager=C3.New(C3.TransitionManager,this);this._templateManager=C3.New(C3.TemplateManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack= +[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._hasPendingInstances=false;this._isFlushingPendingInstances=false;this._objectCount=0;this._nextUid=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=false;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear"; +this._isPixelRoundingEnabled=false;this._needRender=true;this._pauseOnBlur=false;this._isPausedOnBlur=false;this._exportToVideo=null;this._tickCallbacks={normal:timestamp=>{this._rafId=-1;this._ruafId=-1;this.Tick(timestamp)},tickOnly:timestamp=>{this._ruafId=-1;this.Tick(timestamp,false,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._rafId=-1;this._ruafId=-1;this._tickCount=0;this._tickCountNoSave=0;this._hasStarted=false;this._isInTick=false;this._hasStartedTicking=false;this._isLayoutFirstTick= +true;this._suspendCount=0;this._scheduleTriggersThrottle=new C3.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._startTime=0;this._lastTickTime=0;this._dt1=0;this._dt=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=C3.New(C3.KahanSum);this._gameTimeRaw=C3.New(C3.KahanSum);this._wallTime=C3.New(C3.KahanSum);this._instanceTimes=new Map;this._fpsFrameCount=-1;this._fpsLastTime=0;this._fps=0;this._mainThreadTimeCounter=0;this._mainThreadTime=0;this._isLoadingState=false; +this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._projectStorage=null;this._savegamesStorage=null;this._dispatcher=C3.New(C3.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._didRequestDeviceOrientationEvent=false;this._didRequestDeviceMotionEvent=false;this._isReadyToHandleEvents=false;this._waitingToHandleEvents=[];this._eventObjects={"pretick":C3.New(C3.Event,"pretick",false), +"tick":C3.New(C3.Event,"tick",false),"tick2":C3.New(C3.Event,"tick2",false),"instancedestroy":C3.New(C3.Event,"instancedestroy",false),"beforelayoutchange":C3.New(C3.Event,"beforelayoutchange",false),"layoutchange":C3.New(C3.Event,"layoutchange",false)};this._eventObjects["instancedestroy"].instance=null;this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick= +C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._jobScheduler=C3.New(C3.JobSchedulerRuntime,this,opts["jobScheduler"]);if(opts["canvas"])this._canvasManager=C3.New(C3.CanvasManager,this);this._messagePort.onmessage=e=>this["_OnMessageFromDOM"](e.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",e=>this._OnVisibilityChange(e));this.AddDOMComponentMessageHandler("runtime","opus-decode", +e=>this._WasmDecodeWebMOpus(e["arrayBuffer"]));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",e=>this._InvokeFunctionFromJS(e));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self["goToLastErrorScript"]);this.AddDOMComponentMessageHandler("runtime","offline-audio-render-completed",e=>this._OnOfflineAudioRenderCompleted(e));this._dispatcher.addEventListener("window-blur", +e=>this._OnWindowBlur(e));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._templateManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(opts){return C3.New(C3.Runtime,opts)}Release(){C3.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release(); +this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._templateManager.Release();this._templateManager=null;if(this._canvasManager){this._canvasManager.Release();this._canvasManager= +null}this._dispatcher.Release();this._dispatcher=null;this._tickEvent=null}["_OnMessageFromDOM"](data){const type=data["type"];if(type==="event")this._OnEventFromDOM(data);else if(type==="result")this._OnResultFromDOM(data);else throw new Error(`unknown message '${type}'`);}_OnEventFromDOM(e){if(!this._isReadyToHandleEvents){this._waitingToHandleEvents.push(e);return}const component=e["component"];const handler=e["handler"];const data=e["data"];const dispatchOpts=e["dispatchOpts"];const dispatchRuntimeEvent= +!!(dispatchOpts&&dispatchOpts["dispatchRuntimeEvent"]);const dispatchUserScriptEvent=!!(dispatchOpts&&dispatchOpts["dispatchUserScriptEvent"]);const responseId=e["responseId"];if(component==="runtime"){if(dispatchRuntimeEvent){const event=new C3.Event(handler);event.data=data;this._dispatcher.dispatchEventAndWaitAsyncSequential(event)}if(dispatchUserScriptEvent){const event=new C3.Event(handler,true);for(const [key,value]of Object.entries(data))event[key]=value;this.DispatchUserScriptEvent(event)}}const handlerMap= +this._domEventHandlers.get(component);if(!handlerMap){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM event handlers for component '${component}'`);return}const func=handlerMap.get(handler);if(!func){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM handler '${handler}' for component '${component}'`);return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!== +null)this._PostResultToDOM(responseId,false,""+err);return}if(responseId!==null)if(ret&&ret.then)ret.then(result=>this._PostResultToDOM(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToDOM(responseId,false,""+err)});else this._PostResultToDOM(responseId,true,ret)}_PostResultToDOM(responseId,isOk,result){this._messagePort.postMessage({"type":"result","responseId":responseId,"isOk":isOk,"result":result})}_OnResultFromDOM(data){const responseId= +data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=this._pendingResponsePromises.get(responseId);if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);this._pendingResponsePromises.delete(responseId)}AddDOMComponentMessageHandler(component,handler,func){let handlerMap=this._domEventHandlers.get(component);if(!handlerMap){handlerMap=new Map;this._domEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[Runtime] Component '${component}' already has handler '${handler}'`); +handlerMap.set(handler,func)}PostComponentMessageToDOM(component,handler,data,transfer){this._messagePort.postMessage({"type":"event","component":component,"handler":handler,"data":data,"responseId":null},transfer)}PostComponentMessageToDOMAsync(component,handler,data,transfer){const responseId=this._nextDomResponseId++;const ret=new Promise((resolve,reject)=>{this._pendingResponsePromises.set(responseId,{resolve,reject})});this._messagePort.postMessage({"type":"event","component":component,"handler":handler, +"data":data,"responseId":responseId},transfer);return ret}PostToDebugger(data){if(!this.IsDebug())throw new Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",data)}async Init(opts){if(this.IsDebug())await C3Debugger.Init(this);else if(self.C3Debugger)self.C3Debugger.InitPreview(this);const [o]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);await this._LoadDataJson(o);await this._InitialiseCanvas(opts); +if(!this.IsPreview())console.info("Made with Construct, the game and app creator :: https://www.construct.net");if(this.GetWebGLRenderer()){const webglRenderer=this.GetWebGLRenderer();console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${webglRenderer.GetWebGLVersionNumber()} [${webglRenderer.GetUnmaskedRenderer()}] (${webglRenderer.IsDesynchronized()?"desynchronized":"standard"} compositing)`)}else if(this.GetWebGPURenderer())console.info(`[C3 runtime] Hosted in ${this.IsInWorker()? +"worker":"DOM"}, rendering with experimental WebGPU`);if(this.GetRenderer().HasMajorPerformanceCaveat())console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=true;for(const e of this._waitingToHandleEvents)this._OnEventFromDOM(e);C3.clearArray(this._waitingToHandleEvents);if(this._canvasManager)this._canvasManager.StartLoadingScreen();for(const f of opts["runOnStartupFunctions"])this._additionalLoadPromises.push(this._RunOnStartupFunction(f)); +await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);C3.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading()){if(this._canvasManager)this._canvasManager.HideCordovaSplashScreen();return}if(this._canvasManager)await this._canvasManager.EndLoadingScreen();await this._dispatcher.dispatchEventAndWaitAsync(new C3.Event("beforeruntimestart"));await this.Start();this._messagePort.postMessage({"type":"runtime-ready"});return this}async _RunOnStartupFunction(f){try{await f(this._iRuntime)}catch(err){console.error("[C3 runtime] Error in runOnStartup function: ", +err)}}async _LoadDataJson(o){const projectData=o["project"];this._projectName=projectData[0];this._projectVersion=projectData[16];this._projectUniqueId=projectData[31];this._appId=projectData[38];const loadingLogoFilename=projectData[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!projectData[9];this._originalViewportWidth=this._viewportWidth=projectData[10];this._originalViewportHeight=this._viewportHeight=projectData[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin= +this._originalViewportHeight/2;this._compositingMode=projectData[36];this._framerateMode=projectData[37];if(this._compositingMode==="low-latency"&&this.IsAndroidWebView()&&C3.Platform.BrowserVersionNumber<=77){console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing.");this._compositingMode="standard"}this._uses3dFeatures=!!projectData[40];this._sampling=projectData[14]; +this._usesAnyBackgroundBlending=projectData[15];this._usesAnyCrossSampling=projectData[42];this._usesAnyDepthSampling=projectData[17];this._usesLoaderLayout=!!projectData[18];this._loaderStyle=projectData[19];this._nextUid=projectData[21];this._pauseOnBlur=projectData[22];const assetManager=this._assetManager;assetManager._SetFileStructure(projectData[45]);assetManager._SetAudioFiles(projectData[7],projectData[25]);assetManager._SetMediaSubfolder(projectData[8]);assetManager._SetFontsSubfolder(projectData[32]); +assetManager._SetIconsSubfolder(projectData[28]);assetManager._SetWebFonts(projectData[29]);if(this._loaderStyle===0){let url="";if(this.IsPreview()){if(assetManager._HasLocalUrlBlob(loadingLogoFilename))url=assetManager.GetLocalUrlAsBlobUrl(loadingLogoFilename)}else if(assetManager.GetFileStructure()==="flat")url=assetManager.GetIconsSubfolder()+loadingLogoFilename;else url=loadingLogoFilename;if(url)this._loadingLogoAsset=assetManager.LoadImage({url})}if(this._canvasManager){this._canvasManager.SetFullscreenMode(C3.CanvasManager._FullscreenModeNumberToString(projectData[12])); +this._canvasManager.SetFullscreenScalingQuality(projectData[23]?"high":"low");this._canvasManager.SetMipmapsEnabled(projectData[24]!==0);this._canvasManager._SetGPUPowerPreference(projectData[34]);this._canvasManager._SetTextureAnisotropy(projectData[41]);this._canvasManager._SetWebGPUEnabled(projectData[13]);this._canvasManager._SetZAxisScale(projectData[30]);this._canvasManager._SetFieldOfView(projectData[26])}const exportToVideoOpts=projectData[43];if(exportToVideoOpts)await this._LoadExportToVideoData(exportToVideoOpts); +this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(const pluginData of projectData[2])this._pluginManager.CreatePlugin(pluginData);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(const objectClassData of projectData[3]){const objectClass=C3.ObjectClass.Create(this,this._allObjectClasses.length,objectClassData);this._allObjectClasses.push(objectClass);this._objectClassesByName.set(objectClass.GetName().toLowerCase(), +objectClass);this._objectClassesBySid.set(objectClass.GetSID(),objectClass)}for(const familyData of projectData[4]){const familyType=this._allObjectClasses[familyData[0]];familyType._LoadFamily(familyData)}for(const containerData of projectData[27]){const containerTypes=containerData.map(index=>this._allObjectClasses[index]);this._allContainers.push(C3.New(C3.Container,this,containerTypes))}for(const objectClass of this._allObjectClasses)objectClass._OnAfterCreate();for(const layoutData of projectData[5])this._layoutManager.Create(layoutData); +const firstLayoutName=projectData[1];if(firstLayoutName){const firstLayout=this._layoutManager.GetLayoutByName(firstLayoutName);if(firstLayout)this._layoutManager.SetFirstLayout(firstLayout)}for(const timelineData of projectData[33])this._timelineManager.Create(timelineData);for(const transitionData of projectData[35])this._transitionManager.Create(transitionData);for(const templateInstanceData of projectData[44])this._templateManager.Create(templateInstanceData);if(!this._templateManager.HasTemplates()){this._templateManager.Release(); +this._templateManager=null}this._InitScriptInterfaces();for(const eventSheetData of projectData[6])this._eventSheetManager.Create(eventSheetData);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();C3.clearArray(this._objectReferenceTable);this.FlushPendingInstances();let targetOrientation="any";const orientations=projectData[20];if(orientations===1)targetOrientation="portrait";else if(orientations===2)targetOrientation="landscape";this.PostComponentMessageToDOM("runtime", +"set-target-orientation",{"targetOrientation":targetOrientation})}async _LoadExportToVideoData(exportToVideoOpts){const format=exportToVideoOpts["format"];if(format==="image-sequence")this._exportToVideo=new self.C3ExportToImageSequence(this,exportToVideoOpts);else if(format==="image-sequence-gif")this._exportToVideo=new self.C3ExportToGIF(this,exportToVideoOpts);else if(format==="webm")this._exportToVideo=new self.C3ExportToWebMVideo(this,exportToVideoOpts);else if(format==="mp4")this._exportToVideo= +new self.C3ExportToMP4Video(this,exportToVideoOpts);else;this._framerateMode="unlimited-frame";this._canvasManager.SetFullscreenMode("off");this._devicePixelRatio=1;self.devicePixelRatio=1;await this.PostComponentMessageToDOMAsync("runtime","set-exporting-to-video",{"message":this._exportToVideo.GetExportingMessageForPercent(0),"duration":this._exportToVideo.GetDuration()})}GetLoaderStyle(){return this._loaderStyle}IsExportToVideo(){return this._exportToVideo!==null}GetExportVideoDuration(){return this._exportToVideo.GetDuration()}GetExportVideoFramerate(){return this._exportToVideo.GetFramerate()}_InitExportToVideo(){return this._exportToVideo.Init({width:this._canvasManager.GetDeviceWidth(), +height:this._canvasManager.GetDeviceHeight()})}_ExportToVideoAddFrame(){const time=this._tickCount/this.GetExportVideoFramerate();return this._exportToVideo.AddFrame(this._canvasManager.GetCanvas(),time)}_ExportToVideoAddKeyframe(){if(this._exportToVideo)this._exportToVideo.AddKeyframe()}_OnOfflineAudioRenderCompleted(e){this._exportToVideo.OnOfflineAudioRenderCompleted(e)}_ExportToVideoFinish(){return this._exportToVideo.Finish()}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(promise){this._additionalLoadPromises.push(promise)}SetUsingCreatePromises(e){this._isUsingCreatePromises= +!!e}AddCreatePromise(promise){if(!this._isUsingCreatePromises)return;this._additionalCreatePromises.push(promise)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(el){this._allEffectLists.push(el)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(opts){if(!this._canvasManager)return;await this._canvasManager.CreateCanvas(opts);this._canvasManager.InitLoadingScreen(this._loaderStyle)}async _MaybeLoadOpusDecoder(){if(this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus"))return; +let wasmBlob=null;let wasmBuffer=null;try{if(this.IsiOSCordova()&&this._assetManager.IsFileProtocol())wasmBuffer=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl);else wasmBuffer=await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(err){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",err);return}if(wasmBuffer)this.AddJobWorkerBuffer(wasmBuffer,"opus-decoder-wasm");else this.AddJobWorkerBlob(wasmBlob,"opus-decoder-wasm"); +await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}async _WasmDecodeWebMOpus(arrayBuffer){const result=await this.AddJob("OpusDecode",{"arrayBuffer":arrayBuffer},[arrayBuffer]);return result}async Start(){this._hasStarted=true;this._startTime=Date.now();if(this._usesLoaderLayout){for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&!objectClass.IsOnLoaderLayout()&&objectClass.IsWorldType())objectClass.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading= +false;this._OnLoadFinished()})}else this._isLoading=false;this._assetManager.SetInitialLoadFinished();if(this.IsDebug())C3Debugger.RuntimeInit(ife);for(const layout of this._layoutManager.GetAllLayouts())layout._CreateGlobalNonWorlds();if(this.IsExportToVideo())await this._InitExportToVideo();const firstLayout=this._layoutManager.GetFirstLayout();await firstLayout._Load(null,this.GetRenderer());await firstLayout._StartRunning(true);this._fpsLastTime=performance.now();if(!this._usesLoaderLayout)this._OnLoadFinished(); +const state=await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking");if(state["isSuspended"]&&!this.IsExportToVideo())this._suspendCount++;else this.Tick()}_OnLoadFinished(){this.Trigger(C3.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(index){index=Math.floor(index);const objRefTable=this._objectReferenceTable;if(index<0||index>=objRefTable.length)throw new Error("invalid object reference");return objRefTable[index]}_LoadJsPropNameTable(){for(const entry of self.C3_JsPropNameTable){const propName= +C3.first(Object.keys(entry));this._jsPropNameTable.push(propName)}}GetJsPropName(index){index=Math.floor(index);const jsPropNameTable=this._jsPropNameTable;if(index<0||index>=jsPropNameTable.length)throw new Error("invalid prop reference");return jsPropNameTable[index]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetRuntimeBaseURL(){return this._runtimeBaseUrl}GetPreviewURL(){return this._previewUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return this.GetCurrentEventStackFrame().GetConditionIndex()=== +0}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(i){i=Math.floor(i);if(i<0||i>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[i]}GetObjectClassByName(name){return this._objectClassesByName.get(name.toLowerCase())||null}GetObjectClassBySID(sid){return this._objectClassesBySid.get(sid)||null}GetSingleGlobalObjectClassByCtor(ctor){const plugin= +this._pluginManager.GetPluginByConstructorFunction(ctor);if(!plugin)return null;return plugin.GetSingleGlobalObjectClass()}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;yield*objectClass.instances()}}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.runtime=this.GetIRuntime();const shouldTime=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine(); +if(shouldTime)C3Debugger.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);if(shouldTime)C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(w,h){if(this._originalViewportWidth===w&&this._originalViewportHeight===h)return;this._originalViewportWidth= +w;this._originalViewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(w,h){if(this._viewportWidth===w&&this._viewportHeight===h)return;this._viewportWidth=w;this._viewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}_SetDevicePixelRatio(r){if(this.IsExportToVideo())return; +this._devicePixelRatio=r}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){if(!this._canvasManager)return this._viewportWidth;return this._canvasManager.GetDrawWidth()}GetDrawHeight(){if(!this._canvasManager)return this._viewportHeight;return this._canvasManager.GetDrawHeight()}GetRenderScale(){if(!this._canvasManager)return 1;return this._canvasManager.GetRenderScale()}GetDisplayScale(){if(!this._canvasManager)return 1; +return this._canvasManager.GetDisplayScale()}GetEffectLayerScaleParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectLayerScaleParam()}GetEffectDevicePixelRatioParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectDevicePixelRatioParam()}GetCanvasClientX(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientX()}GetCanvasClientY(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientY()}GetCanvasCssWidth(){if(!this._canvasManager)return 0; +return this._canvasManager.GetCssWidth()}GetCanvasCssHeight(){if(!this._canvasManager)return 0;return this._canvasManager.GetCssHeight()}GetFullscreenMode(){if(!this._canvasManager)return"off";return this._canvasManager.GetFullscreenMode()}GetAdditionalRenderTarget(opts){if(!this._canvasManager)return null;return this._canvasManager.GetAdditionalRenderTarget(opts)}ReleaseAdditionalRenderTarget(renderTarget){if(!this._canvasManager)return;this._canvasManager.ReleaseAdditionalRenderTarget(renderTarget)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyCrossSampling(){return this._usesAnyCrossSampling}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}GetGPUUtilisation(){if(!this._canvasManager)return NaN; +return this._canvasManager.GetGPUUtilisation()}IsLinearSampling(){return this.GetSampling()!=="nearest"}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){if(this._loadingLogoAsset){this._loadingLogoAsset.Release();this._loadingLogoAsset=null}}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetTemplateManager(){return this._templateManager}GetAssetManager(){return this._assetManager}LoadImage(opts){return this._assetManager.LoadImage(opts)}CreateInstance(objectClass, +layer,x,y,createHierarchy,templateName){if(templateName&&this._templateManager){const templateData=this._templateManager.GetTemplateData(objectClass,templateName);if(templateData){const inst=this.CreateInstanceFromData(templateData,layer,false,x,y,false,createHierarchy,undefined,createHierarchy);this._templateManager.MapInstanceToTemplateName(inst,templateName);return inst}}return this.CreateInstanceFromData(objectClass,layer,false,x,y,false,createHierarchy,undefined,createHierarchy)}CreateInstanceFromData(instData_or_objectClass, +layer,isStartupInstance,x,y,skipSiblings,createHierarchy,previousInstance,creatingHierarchy){let instData=null;let objectClass=null;if(instData_or_objectClass instanceof C3.ObjectClass){objectClass=instData_or_objectClass;if(objectClass.IsFamily()){const members=objectClass.GetFamilyMembers();const i=Math.floor(this.Random()*members.length);objectClass=members[i]}instData=objectClass.GetDefaultInstanceData()}else{instData=instData_or_objectClass;objectClass=this.GetObjectClassByIndex(instData[1])}const isWorld= +objectClass.GetPlugin().IsWorldType();if(this._isLoading&&isWorld&&!objectClass.IsOnLoaderLayout())return null;const originalLayer=layer;if(!isWorld)layer=null;let uid;if(isStartupInstance&&!skipSiblings&&instData&&!this._instancesByUid.has(instData[2]))uid=instData[2];else uid=this._nextUid++;const worldData=instData?instData[0]:null;const inst=C3.New(C3.Instance,{runtime:this,objectType:objectClass,layer:layer,worldData,instVarData:instData?instData[3]:null,uid:uid});this._instancesByUid.set(uid, +inst);let wi=null;if(isWorld){wi=inst.GetWorldInfo();if(typeof x!=="undefined"&&typeof y!=="undefined"){wi.SetX(x);wi.SetY(y)}objectClass._SetAnyCollisionCellChanged(true)}if(layer){if(!creatingHierarchy)layer._AddInstance(inst,true);if(layer.GetParallaxX()!==1||layer.GetParallaxY()!==1)objectClass._SetAnyInstanceParallaxed(true);layer.GetLayout().MaybeLoadTexturesFor(objectClass)}this._objectCount++;let needsSiblingCreation=true;if(previousInstance){const previousObjectClass=previousInstance.GetObjectClass(); +if(previousObjectClass.IsInContainer()&&objectClass.IsInContainer()){const container=objectClass.GetContainer();const previousContainer=previousObjectClass.GetContainer();if(container===previousContainer)needsSiblingCreation=false}}if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&needsSiblingCreation){for(const containerType of objectClass.GetContainer().objectTypes()){if(containerType===objectClass)continue;const siblingInst=this.CreateInstanceFromData(containerType,originalLayer, +false,wi?wi.GetX():x,wi?wi.GetY():y,true,false,undefined,creatingHierarchy);inst._AddSibling(siblingInst)}for(const s of inst.siblings()){s._AddSibling(inst);for(const s2 of inst.siblings())if(s!==s2)s._AddSibling(s2)}}if(isWorld&&!isStartupInstance&&!!createHierarchy)this._CreateChildInstancesFromData(inst,worldData,wi,layer,x,y,creatingHierarchy);if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&!!createHierarchy)for(const sibling of inst.siblings()){const swi=sibling.GetWorldInfo(); +if(!swi)continue;const siblingPlugin=sibling.GetPlugin();const sWorldData=sibling.GetObjectClass().GetDefaultInstanceData()[0];if(siblingPlugin.IsWorldType())this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,swi.GetX(),swi.GetY(),creatingHierarchy);else this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,undefined,undefined,creatingHierarchy)}if(!skipSiblings&&!!createHierarchy){if(typeof x==="undefined")x=worldData[0];if(typeof y==="undefined")y=worldData[1];const pwi=wi.GetTopParent(); +const newX=x-wi.GetX()+pwi.GetX();const newY=y-wi.GetY()+pwi.GetY();pwi.SetXY(newX,newY)}objectClass._SetIIDsStale();const instPropertyData=instData?C3.cloneArray(instData[5]):null;const behPropertyData=instData?instData[4].map(bp=>C3.cloneArray(bp)):null;const hasTilemap=isWorld&&worldData&&worldData[13];if(hasTilemap)inst._SetHasTilemap();inst._CreateSdkInstance(instPropertyData,behPropertyData);if(hasTilemap){const tilemapData=worldData[13];inst.GetSdkInstance().LoadTilemapData(tilemapData[2], +tilemapData[0],tilemapData[1])}this._instancesPendingCreate.push(inst);this._hasPendingInstances=true;if(this.IsDebug())C3Debugger.InstanceCreated(inst);return inst}_CreateChildInstancesFromData(parentInstance,parentWorldData,parentWorldInfo,layer,x,y,creatingHierarchy){const parentZIndex=parentWorldInfo.GetSceneGraphZIndexExportData();const childrenData=parentWorldInfo.GetSceneGraphChildrenExportData();parentInstance.GetWorldInfo().SetSceneGraphZIndex(parentZIndex);if(!childrenData)return;if(typeof x=== +"undefined")x=parentWorldData[0];if(typeof y==="undefined")y=parentWorldData[1];const sceneGraphSiblings=new Set;const parentX=parentWorldData[0];const parentY=parentWorldData[1];for(const childData of childrenData){const childLayoutSID=childData[0];const childLayerIndex=childData[1];const childUID=childData[2];const childFlags=childData[3];const childIsInContainer=!!childData[4];const childZIndex=childData[5];const layout=this._layoutManager.GetLayoutBySID(childLayoutSID);const l=layout.GetLayer(childLayerIndex); +const childInstData=l.GetInitialInstanceData(childUID);const childObjectClass=this.GetObjectClassByIndex(childInstData[1]);const hasSibling=parentInstance.HasSibling(childObjectClass);const siblingProcessed=sceneGraphSiblings.has(childObjectClass);if(hasSibling&&!siblingProcessed&&childIsInContainer){const childInst=parentInstance.GetSibling(childObjectClass);const childX=x+childInstData[0][0]-parentX;const childY=y+childInstData[0][1]-parentY;childInst.GetWorldInfo().SetXY(childX,childY);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex); +parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>>4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1)});sceneGraphSiblings.add(childObjectClass)}else{const childX=x+childInstData[0][0]-parentX;const childY=y+childInstData[0][1]-parentY;const childInst=this.CreateInstanceFromData(childInstData,layer,false,childX,childY,false, +true,parentInstance,creatingHierarchy);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex);parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>>4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1)})}}}DestroyInstance(inst){if(this._instancesToReleaseAtEndOfTick.has(inst))return;const objectClass=inst.GetObjectClass();let s= +this._instancesPendingDestroy.get(objectClass);if(s){if(s.has(inst))return;s.add(inst)}else{s=new Set;s.add(inst);this._instancesPendingDestroy.set(objectClass,s)}if(this.IsDebug())C3Debugger.InstanceDestroyed(inst);inst._MarkDestroyed();this._hasPendingInstances=true;if(inst.IsInContainer())for(const s of inst.siblings())this.DestroyInstance(s);for(const c of inst.children())if(c.GetDestroyWithParent())this.DestroyInstance(c);if(!this._layoutManager.IsEndingLayout()&&!this._isLoadingState){const eventSheetManager= +this.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnDestroyed();eventSheetManager.BlockFlushingInstances(false)}inst._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}FlushPendingInstances(){if(!this._hasPendingInstances)return;this._isFlushingPendingInstances=true;this._FlushInstancesPendingCreate();this._FlushInstancesPendingDestroy();this._isFlushingPendingInstances=false;this._hasPendingInstances=false;this.UpdateRender()}_FlushInstancesPendingCreate(){for(const inst of this._instancesPendingCreate){const objectType= +inst.GetObjectClass();objectType._AddInstance(inst);for(const family of objectType.GetFamilies()){family._AddInstance(inst);family._SetIIDsStale()}}C3.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(true);for(const [objectClass,s]of this._instancesPendingDestroy.entries()){this._FlushInstancesPendingDestroyForObjectClass(objectClass,s);s.clear()}this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(false)}_FlushInstancesPendingDestroyForObjectClass(objectClass, +s){for(const inst of s){const instanceDestroyEvent=this._eventObjects["instancedestroy"];instanceDestroyEvent.instance=inst;this._dispatcher.dispatchEvent(instanceDestroyEvent);this._instancesByUid.delete(inst.GetUID());this._instanceTimes.delete(inst);const wi=inst.GetWorldInfo();if(wi){wi._RemoveFromCollisionCells();wi._RemoveFromRenderCells();wi._MarkDestroyed()}this._instancesToReleaseAtEndOfTick.add(inst);this._objectCount--}C3.arrayRemoveAllInSet(objectClass.GetInstances(),s);objectClass._SetIIDsStale(); +this._instancesToReleaseAffectedObjectClasses.add(objectClass);if(objectClass.GetInstances().length===0)objectClass._SetAnyInstanceParallaxed(false);for(const family of objectClass.GetFamilies()){C3.arrayRemoveAllInSet(family.GetInstances(),s);family._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(family)}if(objectClass.GetPlugin().IsWorldType()){const layers=new Set([...s].map(i=>i.GetWorldInfo().GetLayer()));for(const layer of layers)layer._RemoveAllInstancesInSet(s)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(objectClass){for(const inst of this._GetInstancesPendingCreate())if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass))yield inst}else if(inst.GetObjectClass()=== +objectClass)yield inst}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(uid,inst){this._instancesByUid.set(uid,inst)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(C3.New(C3.Event,"webglcontextlost"));this.SetSuspended(true);for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&objectClass.HasLoadedTextures())objectClass.ReleaseTextures();const runningLayout=this.GetMainRunningLayout();if(runningLayout)runningLayout._OnWebGLContextLost();C3.ImageInfo.OnWebGLContextLost(); +C3.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer());this._dispatcher.dispatchEvent(C3.New(C3.Event,"webglcontextrestored"));this.SetSuspended(false);this.UpdateRender()}_OnVisibilityChange(e){this.SetSuspended(e["hidden"])}_OnWindowBlur(e){if(!this.IsPreview()||!this._pauseOnBlur||C3.Platform.IsMobile)return;if(!e.data["parentHasFocus"]){this.SetSuspended(true);this._isPausedOnBlur=true}}_OnWindowFocus(){if(!this._isPausedOnBlur)return; +this.SetSuspended(false);this._isPausedOnBlur=false}_RequestAnimationFrame(){const tickCallbacks=this._tickCallbacks;if(this._framerateMode==="vsync"){if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.normal)}else if(this._framerateMode==="unlimited-tick"){if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.tickOnly);if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.renderOnly)}else if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.normal)}_CancelAnimationFrame(){if(this._rafId!== +-1){self.cancelAnimationFrame(this._rafId);this._rafId=-1}if(this._ruafId!==-1){C3.CancelUnlimitedAnimationFrame(this._ruafId);this._ruafId=-1}}IsSuspended(){return this._suspendCount>0}SetSuspended(s){if(this.IsExportToVideo())return;const wasSuspended=this.IsSuspended();this._suspendCount+=s?1:-1;if(this._suspendCount<0)this._suspendCount=0;const isSuspended=this.IsSuspended();if(!wasSuspended&&isSuspended){console.log("[Construct] Suspending");this._CancelAnimationFrame();this._dispatcher.dispatchEvent(C3.New(C3.Event, +"suspend"));this.Trigger(C3.Plugins.System.Cnds.OnSuspend,null,null)}else if(wasSuspended&&!isSuspended){console.log("[Construct] Resuming");const now=performance.now();this._lastTickTime=now;this._fpsLastTime=now;this._fpsFrameCount=0;this._fps=0;this._mainThreadTime=0;this._mainThreadTimeCounter=0;this._dispatcher.dispatchEvent(C3.New(C3.Event,"resume"));this.Trigger(C3.Plugins.System.Cnds.OnResume,null,null);if(!this.HitBreakpoint())this.Tick(now)}}_AddBehInstToTick(behSdkInst){this._behInstsToTick.Add(behSdkInst)}_AddBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Add(behSdkInst)}_AddBehInstToTick2(behSdkInst){this._behInstsToTick2.Add(behSdkInst)}_RemoveBehInstToTick(behSdkInst){this._behInstsToTick.Remove(behSdkInst)}_RemoveBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Remove(behSdkInst)}_RemoveBehInstToTick2(behSdkInst){this._behInstsToTick2.Remove(behSdkInst)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true); +for(const bi of this._behInstsToTick)bi.Tick();this._behInstsToTick.SetQueueingEnabled(false)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick)bi.PostTick();this._behInstsToPostTick.SetQueueingEnabled(false)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2)bi.Tick2();this._behInstsToTick2.SetQueueingEnabled(false)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true);for(const bi of this._behInstsToTick){const ret= +bi.Tick();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick.SetQueueingEnabled(false)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick){const ret=bi.PostTick();if(C3.IsIterator(ret))yield*ret}this._behInstsToPostTick.SetQueueingEnabled(false)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2){const ret=bi.Tick2();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick2.SetQueueingEnabled(false)}async Tick(timestamp, +isDebugStep,mode){this._hasStartedTicking=true;const isBackgroundWake=mode==="background-wake";const shouldRender=mode!=="background-wake"&&mode!=="skip-render";if(!this._hasStarted||this.IsSuspended()&&!isDebugStep&&!isBackgroundWake)return;const startTime=performance.now();this._isInTick=true;this._MeasureDt(timestamp||0);const beforePreTickRet=this.Step_BeforePreTick();if(this.IsDebugging())await beforePreTickRet;const pretickRet=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects["pretick"]); +if(pretickRet instanceof Promise)await pretickRet;const afterPreTickRet=this.Step_AfterPreTick();if(this.IsDebugging())await afterPreTickRet;if(this._NeedsHandleSaveOrLoad())await this._HandleSaveOrLoad();if(this.GetLayoutManager().IsPendingChangeMainLayout())await this._MaybeChangeLayout();const runEventsRet=this.Step_RunEventsEtc();if(this.IsDebugging())await runEventsRet;if(shouldRender)this.Render();if(this.IsExportToVideo()){await this._ExportToVideoAddFrame();if(this.GetGameTime()>=this.GetExportVideoDuration()){this._ExportToVideoFinish(); +return}}if(!this.IsSuspended()&&!isBackgroundWake)this._RequestAnimationFrame();this._tickCount++;this._tickCountNoSave++;this._isInTick=false;this._mainThreadTimeCounter+=performance.now()-startTime}async Step_BeforePreTick(){const eventSheetManager=this._eventSheetManager;const isDebug=this.IsDebug();this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true);this.PushCurrentLayout(this.GetMainRunningLayout());if(isDebug)C3Debugger.StartMeasuringTime();if(this.IsDebugging())await eventSheetManager.DebugRunScheduledWaits(); +else eventSheetManager.RunScheduledWaits();if(isDebug)C3Debugger.AddEventsTime();this.PopCurrentLayout();eventSheetManager.BlockFlushingInstances(false);this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true)}async Step_AfterPreTick(){const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const userScriptEventObjects=this._userScriptEventObjects;if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick()); +else this._BehaviorTick();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorPostTick());else this._BehaviorPostTick();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick"]);else dispatcher.dispatchEvent(eventObjects["tick"]);if(isDebug)C3Debugger.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(false);this.DispatchUserScriptEvent(userScriptEventObjects["tick"])}async Step_RunEventsEtc(){const eventSheetManager= +this._eventSheetManager;const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await eventSheetManager.DebugRunEvents(this._layoutManager);else eventSheetManager.RunEvents(this._layoutManager);if(isDebug)C3Debugger.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=false;eventSheetManager.BlockFlushingInstances(true); +if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick2());else this._BehaviorTick2();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick2"]);else dispatcher.dispatchEvent(eventObjects["tick2"]);if(isDebug)C3Debugger.AddPluginTickTime();eventSheetManager.BlockFlushingInstances(false);if(isDebugging)await eventSheetManager.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(this._instancesToReleaseAtEndOfTick.size=== +0)return;const dispatcher=this._dispatcher;dispatcher.SetDelayRemoveEventsEnabled(true);for(const objectClass of this._instancesToReleaseAffectedObjectClasses)objectClass.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const inst of this._instancesToReleaseAtEndOfTick)inst.Release();this._instancesToReleaseAtEndOfTick.clear();dispatcher.SetDelayRemoveEventsEnabled(false)}async _MaybeChangeLayout(){const layoutManager= +this.GetLayoutManager();let i=0;while(layoutManager.IsPendingChangeMainLayout()&&i++<10)await this._DoChangeLayout(layoutManager.GetPendingChangeMainLayout())}_MeasureDt(timestamp){let dtRaw=0;if(this.IsExportToVideo()){dtRaw=1/this.GetExportVideoFramerate();this._dt1=dtRaw}else if(this._lastTickTime!==0){const msDiff=Math.max(timestamp-this._lastTickTime,0);dtRaw=msDiff/1E3;if(dtRaw>.5)dtRaw=0;const maxDt1=1/this._minimumFramerate;this._dt1=Math.min(dtRaw,maxDt1)}this._lastTickTime=timestamp;this._dt= +this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(dtRaw*this._timeScale);this._wallTime.Add(this._dt1);for(const [inst,instTime]of this._instanceTimes)instTime.Add(this._dt1*inst.GetTimeScale());if(this._canvasManager)this._canvasManager._UpdateTick();if(timestamp-this._fpsLastTime>=1E3){this._fpsLastTime+=1E3;if(timestamp-this._fpsLastTime>=1E3)this._fpsLastTime=timestamp;this._fps=this._fpsFrameCount;this._fpsFrameCount=0;this._mainThreadTime=Math.min(this._mainThreadTimeCounter/ +1E3,1);this._mainThreadTimeCounter=0;if(this._canvasManager)this._canvasManager._Update1sFrameRange();this._collisionEngine._Update1sStats();if(this.IsDebug())C3Debugger.Update1sPerfStats()}this._fpsFrameCount++}_SetTrackingInstanceTime(inst,enable){if(enable){if(!this._instanceTimes.has(inst)){const instTime=C3.New(C3.KahanSum);instTime.Copy(this._gameTime);this._instanceTimes.set(inst,instTime)}}else this._instanceTimes.delete(inst)}_GetInstanceGameTime(inst){const instTime=this._instanceTimes.get(inst); +return instTime?instTime.Get():this.GetGameTime()}async _DoChangeLayout(changeToLayout){const dispatcher=this._dispatcher;const layoutManager=this.GetLayoutManager();const prevLayout=layoutManager.GetMainRunningLayout();await prevLayout._StopRunning();prevLayout._Unload(changeToLayout,this.GetRenderer());if(prevLayout===changeToLayout)this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();dispatcher.dispatchEvent(this._eventObjects["beforelayoutchange"]); +C3.Asyncify.SetHighThroughputMode(true);await changeToLayout._Load(prevLayout,this.GetRenderer());C3.Asyncify.SetHighThroughputMode(false);await changeToLayout._StartRunning(false);dispatcher.dispatchEvent(this._eventObjects["layoutchange"]);this.UpdateRender();this._isLayoutFirstTick=true;this.FlushPendingInstances();this._ExportToVideoAddKeyframe()}UpdateRender(){this._needRender=true}GetWebGLRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetWebGLRenderer()}GetWebGPURenderer(){if(!this._canvasManager)return null; +return this._canvasManager.GetWebGPURenderer()}GetRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetRenderer()}Render(){const canvasManager=this._canvasManager;if(!canvasManager||canvasManager.IsRendererContextLost())return;const renderer=this.GetRenderer();const supportsGPUProfiling=renderer.SupportsGPUProfiling();const isWebGLProfiling=supportsGPUProfiling&&renderer.IsWebGL();const isWebGPUProfiling=supportsGPUProfiling&&renderer.IsWebGPU();if(isWebGLProfiling)renderer.CheckForQueryResults(); +if(!this._needRender&&!this.IsExportToVideo()){renderer.IncrementFrameNumber();return}const layout=this._layoutManager.GetMainRunningLayout();renderer.Start();const isDebug=this.IsDebug();if(isDebug)C3Debugger.StartMeasuringTime();this._needRender=false;let webglFrameQuery=null;if(isWebGLProfiling){webglFrameQuery=canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery();renderer.StartQuery(webglFrameQuery)}let webgpuFrameTimings=null;if(isWebGPUProfiling){webgpuFrameTimings=renderer.StartFrameTiming((1+ +layout.GetLayerCount())*2);renderer.WriteTimestamp(0)}if(this.Uses3DFeatures()&&canvasManager.GetCurrentFullscreenScalingQuality()==="low")renderer.SetFixedSizeDepthBuffer(canvasManager.GetDrawWidth(),canvasManager.GetDrawHeight());else renderer.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),layout);if(webglFrameQuery)renderer.EndQuery(webglFrameQuery);if(isWebGPUProfiling){renderer.WriteTimestamp(1);this._canvasManager._AddWebGPUFrameTiming(webgpuFrameTimings)}renderer.Finish();if(isDebug){C3Debugger.AddDrawCallsTime(); +C3Debugger.UpdateInspectHighlight()}if(canvasManager)canvasManager._MaybeTakeSnapshot()}_Render(renderer,layout){renderer.SetTextureFillMode();renderer.SetAlphaBlend();renderer.SetColorRgba(1,1,1,1);renderer.SetRenderTarget(null);renderer.SetTexture(null);renderer.SetDepthEnabled(this.Uses3DFeatures());layout.Draw(renderer)}Trigger(method,inst,behaviorType){if(!this._hasStarted)return false;const isTopLevel=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let startTime=0;if(isTopLevel)startTime= +performance.now();const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._Trigger(this._layoutManager,method,inst,behaviorType);if(isTopLevel){const triggerTime=performance.now()-startTime;this._mainThreadTimeCounter+=triggerTime;if(isDebug)C3Debugger.AddTriggersTime(triggerTime)}if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugTrigger(method,inst,behaviorType){if(!this.IsDebug())return this.Trigger(method,inst,behaviorType);if(this.HitBreakpoint())throw new Error("called DebugTrigger() while stopped on breakpoint"); +if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw new Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType)}async TriggerAsync(method,inst,behaviorType){if(!this.IsDebugging())return this.Trigger(method,inst,behaviorType);if(!this._hasStarted)return false;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(method,inst,behaviorType);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(method, +inst,behaviorType);const startTime=performance.now();const iter=this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType);let result=iter.next();while(!result.done){await this.DebugBreak(result.value);result=iter.next()}if(!this.IsSuspended()&&!this._eventSheetManager.IsInTrigger()){await this._eventSheetManager.RunQueuedDebugTriggersAsync();if(this._hasStartedTicking&&!this._isInTick)this._RequestAnimationFrame()}this._mainThreadTimeCounter+=performance.now()-startTime; +return result.value}FastTrigger(method,inst,value){const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._FastTrigger(this._layoutManager,method,inst,value);if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugFastTrigger(method,inst,value){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,method,inst,value)}ScheduleTriggers(f){return this._scheduleTriggersThrottle.Add(f)}PushCurrentLayout(layout){this._currentLayoutStack.push(layout)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw new Error("layout stack empty"); +this._currentLayoutStack.pop()}GetCurrentLayout(){if(!this._currentLayoutStack.length)return this.GetMainRunningLayout();return this._currentLayoutStack.at(-1)}GetDt(inst){if(!inst||inst.GetTimeScale()===-1)return this._dt;return this._dt1*inst.GetTimeScale()}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(ts){if(isNaN(ts)||ts<0)ts=0;this._timeScale=ts}SetMinimumFramerate(fps){this._minimumFramerate=C3.clamp(fps,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(uid){if(this._isLoadingState)throw new Error("cannot call while loading state - wait until afterload event"); +return this._instancesByUid.get(uid)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;for(const inst of objectClass.GetInstances())this._instancesByUid.set(inst.GetUID(),inst)}}IsPreview(){return this._exportType==="preview"}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return this._exportType==="cordova"}IsAndroidWebView(){return C3.Platform.OS==="Android"&&(this._exportType=== +"cordova"||this._exportType==="playable-ad"||this._exportType==="instant-games")}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){return this.GetRenderer().GetZAxisScaleFactor(this.GetViewportHeight())}GetDefaultCameraZ(viewH){return this.GetRenderer().GetDefaultCameraZ(viewH|| +this.GetViewportHeight())}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(e){e=!!e;if(this._isPixelRoundingEnabled===e)return;this._isPixelRoundingEnabled=e;this.GetLayoutManager().SetAllLayerMVChanged();this.UpdateRender()}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(slotName){this._saveToSlotName=slotName}LoadFromSlot(slotName){this._loadFromSlotName=slotName}LoadFromJsonString(str){this._loadFromJson=str}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!!(this._saveToSlotName|| +this._loadFromSlotName||this._loadFromJson!==null)}async _HandleSaveOrLoad(){if(this._saveToSlotName){this.FlushPendingInstances();await this._DoSaveToSlot(this._saveToSlotName);this._ClearSaveOrLoad()}if(this._loadFromSlotName){await this._DoLoadFromSlot(this._loadFromSlotName);this._ClearSaveOrLoad();if(this.IsDebug())C3Debugger.StepIfPausedInDebugger()}if(this._loadFromJson!==null){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson);this._lastSaveJson=this._loadFromJson; +await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from JSON string: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null}_GetProjectStorage(){if(!this._projectStorage)this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(), +description:this.GetProjectName()});return this._projectStorage}_GetSavegamesStorage(){if(!this._savegamesStorage)this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()});return this._savegamesStorage}async _DoSaveToSlot(slotName){const saveJson=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(slotName,saveJson);console.log("[Construct] Saved state to storage ("+saveJson.length+" chars)");this._lastSaveJson= +saveJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to save state to storage: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(slotName){try{const loadJson=await this._GetSavegamesStorage().getItem(slotName);if(!loadJson)throw new Error("empty slot");console.log("[Construct] Loaded state from storage ("+loadJson.length+" chars)");await this._DoLoadFromJsonString(loadJson); +this._lastSaveJson=loadJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from storage: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const o={"c3save":true,"version":1,"rt":{"time":this.GetGameTime(),"timeRaw":this.GetGameTimeRaw(),"walltime":this.GetWallTime(),"timescale":this.GetTimeScale(),"tickcount":this.GetTickCount(),"next_uid":this._nextUid, +"running_layout":this.GetMainRunningLayout().GetSID(),"start_time_offset":Date.now()-this._startTime},"types":{},"layouts":{},"events":this._eventSheetManager._SaveToJson(),"timelines":this._timelineManager._SaveToJson(),"user_script_data":null};for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;o["types"][objectClass.GetSID().toString()]=objectClass._SaveToJson()}for(const layout of this._layoutManager.GetAllLayouts())o["layouts"][layout.GetSID().toString()]= +layout._SaveToJson();const saveEvent=this._CreateUserScriptEvent("save");saveEvent.saveData=null;await this.DispatchUserScriptEventAsyncWait(saveEvent);o["user_script_data"]=saveEvent.saveData;return JSON.stringify(o)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(jsonStr){const layoutManager=this.GetLayoutManager();const o=JSON.parse(jsonStr);if(o["c2save"])throw new Error("C2 saves are incompatible with C3 runtime");if(!o["c3save"])throw new Error("not valid C3 save data"); +if(o["version"]>1)throw new Error("C3 save data from future version");this._dispatcher.dispatchEvent(C3.New(C3.Event,"beforeload"));for(const inst of this.allInstances()){const objectClass=inst.GetObjectClass();if(objectClass.HasNoSaveBehavior())continue;inst._OnBeforeLoad()}const rt=o["rt"];this._gameTime.Set(rt["time"]);if(rt.hasOwnProperty("timeRaw"))this._gameTimeRaw.Set(rt["timeRaw"]);this._wallTime.Set(rt["walltime"]);this._timeScale=rt["timescale"];this._tickCount=rt["tickcount"];this._startTime= +Date.now()-rt["start_time_offset"];const layoutSid=rt["running_layout"];this._isLoadingState=true;let changedLayout=false;if(layoutSid!==this.GetMainRunningLayout().GetSID()){const changeToLayout=layoutManager.GetLayoutBySID(layoutSid);if(changeToLayout){await this._DoChangeLayout(changeToLayout);changedLayout=true}else return}for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()|| +objectClass.HasNoSaveBehavior())continue;objectClass._LoadFromJson(data)}this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=false;if(changedLayout){for(const inst of this.allInstances())inst.SetupInitialSceneGraphConnections();for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;objectClass._SetupSceneGraphConnectionsOnChangeOfLayout(data)}}this._nextUid= +rt["next_uid"];for(const [sidStr,data]of Object.entries(o["layouts"])){const sid=parseInt(sidStr,10);const layout=layoutManager.GetLayoutBySID(sid);if(!layout)continue;layout._LoadFromJson(data)}this._eventSheetManager._LoadFromJson(o["events"]);for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||!objectClass.IsInContainer())continue;for(const inst of objectClass.GetInstances()){const iid=inst.GetIID();for(const otherType of objectClass.GetContainer().objectTypes()){if(otherType=== +objectClass)continue;const otherInstances=otherType.GetInstances();if(iid<0||iid>=otherInstances.length)throw new Error("missing sibling instance");inst._AddSibling(otherInstances[iid])}}}this._timelineManager._LoadFromJson(o["timelines"]);layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(C3.New(C3.Event,"afterload"));const loadEvent=this._CreateUserScriptEvent("load");loadEvent.saveData=o["user_script_data"];await this.DispatchUserScriptEventAsyncWait(loadEvent); +this.UpdateRender()}async AddJobWorkerScripts(scripts){const loadUrls=await Promise.all(scripts.map(async url=>{const isCrossOrigin=C3.IsAbsoluteURL(url)&&(new URL(url)).origin!==location.origin;const isCordovaFileProtocol=this.IsCordova()&&this._assetManager.IsFileProtocol();if(isCrossOrigin||isCordovaFileProtocol||this.IsPreview()||this.GetExportType()==="playable-ad"){const blob=await this._assetManager.FetchBlob(url);return URL.createObjectURL(blob)}else if(C3.IsRelativeURL(url))return(new URL(url, +this._runtimeBaseUrl)).toString();else return url}));this._jobScheduler.ImportScriptsToJobWorkers(loadUrls)}AddJobWorkerBlob(blob,id){this._jobScheduler.SendBlobToJobWorkers(blob,id)}AddJobWorkerBuffer(buffer,id){this._jobScheduler.SendBufferToJobWorkers(buffer,id)}AddJob(type,params,transferables){return this._jobScheduler.AddJob(type,params,transferables)}BroadcastJob(type,params,transferables){return this._jobScheduler.BroadcastJob(type,params,transferables)}InvokeDownload(url,filename){this.PostComponentMessageToDOM("runtime", +"invoke-download",{"url":url,"filename":filename})}async RasterSvgImage(blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight,imageBitmapOpts){surfaceWidth=surfaceWidth||imageWidth;surfaceHeight=surfaceHeight||imageHeight;if(this.IsInWorker()){const result=await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{"blob":blob,"imageWidth":imageWidth,"imageHeight":imageHeight,"surfaceWidth":surfaceWidth,"surfaceHeight":surfaceHeight,"imageBitmapOpts":imageBitmapOpts});return result["imageBitmap"]}else{const canvas= +await self["C3_RasterSvgImageBlob"](blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight);if(imageBitmapOpts)return await self.createImageBitmap(canvas,imageBitmapOpts);else return canvas}}async GetSvgImageSize(blob){if(this.IsInWorker())return await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{"blob":blob});else return await self["C3_GetSvgImageSize"](blob)}RequestDeviceOrientationEvent(){if(this._didRequestDeviceOrientationEvent)return;this._didRequestDeviceOrientationEvent= +true;this.PostComponentMessageToDOM("runtime","enable-device-orientation")}RequestDeviceMotionEvent(){if(this._didRequestDeviceMotionEvent)return;this._didRequestDeviceMotionEvent=true;this.PostComponentMessageToDOM("runtime","enable-device-motion")}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(f){this._randomNumberCallback=f}_GetRemotePreviewStatusInfo(){const webglRenderer=this.GetWebGLRenderer();return{"fps":this.GetFPS(),"cpu":this.GetMainThreadTime(),"gpu":this.GetGPUUtilisation(), +"layout":this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"","renderer":webglRenderer?webglRenderer.GetUnmaskedRenderer():""}}HitBreakpoint(){if(!this.IsDebug())return false;return C3Debugger.HitBreakpoint()}DebugBreak(eventObject){if(!this.IsDebugging())return Promise.resolve();return C3Debugger.DebugBreak(eventObject)}DebugBreakNext(){if(!this.IsDebugging())return false;return C3Debugger.BreakNext()}SetDebugBreakpointsEnabled(e){this._breakpointsEnabled=!!e;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){if(d)this._debuggingDisabled--; +else this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&this._debuggingDisabled===0}IsCPUProfiling(){return this.IsDebug()&&C3Debugger.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&C3Debugger.IsGPUProfiling()}async DebugIterateAndBreak(iter){if(!iter)return;for(const breakEventObject of iter)await this.DebugBreak(breakEventObject)}DebugFireGeneratorEventAndBreak(event){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(event))}_InvokeFunctionFromJS(e){return this._eventSheetManager._InvokeFunctionFromJS(e["name"], +e["params"])}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(name){const e=C3.New(C3.Event,name,false);e.runtime=this._iRuntime;return e}_InitScriptInterfaces(){const objectDescriptors={};for(const objectClass of this._allObjectClasses)objectDescriptors[objectClass.GetJsPropName()]={value:objectClass.GetIObjectClass(),enumerable:true,writable:false};const objects=Object.create(Object.prototype,objectDescriptors);this._iRuntime=new self.IRuntime(this,objects);this._userScriptEventObjects= +{"tick":this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const globalVarDescriptors={};for(const globalVar of this.GetEventSheetManager().GetAllGlobalVariables())globalVarDescriptors[globalVar.GetJsPropName()]=globalVar._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(globalVarDescriptors)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(interface_,class_){this._interfaceMap.set(interface_,class_)}_UnwrapScriptInterface(interface_){return this._interfaceMap.get(interface_)}_UnwrapIObjectClass(iObjectClass){if(!(iObjectClass instanceof +self.IObjectClass))throw new TypeError("expected IObjectClass");const objectClass=this._UnwrapScriptInterface(iObjectClass);if(!objectClass||!(objectClass instanceof C3.ObjectClass))throw new Error("invalid IObjectClass");return objectClass}_UnwrapIWorldInstance(iinst){if(!(iinst instanceof self.IWorldInstance))throw new TypeError("expected IWorldInstance");const inst=this._UnwrapScriptInterface(iinst);if(!inst||!(inst instanceof C3.Instance))throw new Error("invalid IInstance");return inst}}; +self["C3_CreateRuntime"]=C3.Runtime.Create;self["C3_InitRuntime"]=(runtime,opts)=>runtime.Init(opts); + +} + +// workers/jobSchedulerRuntime.js +{ +'use strict';const C3=self.C3; +C3.JobSchedulerRuntime=class JobSchedulerRuntime extends C3.DefendedBase{constructor(runtime,data){super();this._runtime=runtime;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=data["inputPort"];data["outputPort"].onmessage=e=>this._OnJobWorkerMessage(e);this._maxNumWorkers=data["maxNumWorkers"];this._jobWorkerCount=1;this._isCreatingWorker=false;this._hadErrorCreatingWorker=false}async Init(){}ImportScriptsToJobWorkers(scripts){this._inputPort.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlobToJobWorkers(blob, +id){this._inputPort.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBufferToJobWorkers(buffer,id){this._inputPort.postMessage({"type":"_send_buffer","buffer":buffer,"id":id},[buffer])}AddJob(type,params,transferables,progressHandler,abortDisposable){if(!transferables)transferables=[];const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":false,"jobId":jobId,"params":params,"transferables":transferables};const promise=new Promise((resolve,reject)=>{this._jobPromises.set(jobId, +{resolve:resolve,progress:progressHandler,reject:reject,cancelled:false})});if(abortDisposable)abortDisposable.SetAction(()=>this._CancelJob(jobId));this._inputPort.postMessage(job,transferables);this._MaybeCreateExtraWorker();return promise}BroadcastJob(type,params,transferables){if(!transferables)transferables=[];const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":true,"jobId":jobId,"params":params,"transferables":transferables};this._inputPort.postMessage(job,transferables)}_CancelJob(jobId){const job= +this._jobPromises.get(jobId);if(job){job.cancelled=true;job.resolve=null;job.progress=null;job.reject=null;this._inputPort.postMessage({"type":"_cancel","jobId":jobId})}}_OnJobWorkerMessage(e){const msg=e.data;const type=msg["type"];const id=msg["jobId"];switch(type){case "result":this._OnJobResult(id,msg["result"]);break;case "progress":this._OnJobProgress(id,msg["progress"]);break;case "error":this._OnJobError(id,msg["error"]);break;case "ready":this._OnJobWorkerReady();break;default:throw new Error(`unknown message from worker '${type}'`); +}}_OnJobResult(jobId,result){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled)p.resolve(result);this._jobPromises.delete(jobId)}_OnJobProgress(jobId,progress){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled&&p.progress)p.progress(progress)}_OnJobError(jobId,error){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled)p.reject(error);this._jobPromises.delete(jobId)}_OnJobWorkerReady(){if(!this._isCreatingWorker)return; +this._isCreatingWorker=false;this._jobWorkerCount++;if(this._jobWorkerCount=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount)return;try{this._isCreatingWorker=true;const result=await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker");result["outputPort"].onmessage= +e=>this._OnJobWorkerMessage(e)}catch(err){this._hadErrorCreatingWorker=true;this._isCreatingWorker=false;console.error(`[Construct] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,err)}}}; + +} + +{ +self["C3_Shaders"] = {}; +self["C3_Shaders"]["grayscale"] = { + glsl: "varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float intensity;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float gray = front.r * 0.299 + front.g * 0.587 + front.b * 0.114;\ngl_FragColor = mix(front, vec4(gray, gray, gray, front.a), intensity);\n}", + wgsl: "%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\nstruct ShaderParams {\nintensity : f32\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\n@fragment\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4 = textureSample(textureFront, samplerFront, input.fragUV);\nvar gray : f32 = c3_grayscale(front.rgb);\nvar output : FragmentOutput;\noutput.color = mix(front, vec4(gray, gray, gray, front.a), shaderParams.intensity);\nreturn output;\n}", + blendsBackground: false, + usesDepth: false, + extendBoxHorizontal: 0, + extendBoxVertical: 0, + crossSampling: false, + mustPreDraw: false, + preservesOpaqueness: true, + animated: false, + parameters: [["intensity",0,"percent"]] +}; +self["C3_Shaders"]["warpobject"] = { + glsl: "#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform mediump vec2 srcStart;\nuniform mediump vec2 srcEnd;\nuniform mediump vec2 srcOriginStart;\nuniform mediump vec2 srcOriginEnd;\nuniform highmedp float seconds;\nuniform mediump vec2 pixelSize;\nuniform mediump float devicePixelRatio;\nuniform mediump float layerScale;\nuniform mediump float freqX;\nuniform mediump float freqY;\nuniform mediump float ampX;\nuniform mediump float ampY;\nuniform mediump float speedX;\nuniform mediump float speedY;\nvoid main(void)\n{\nmediump float _2pi = 2.0 * 3.14159265359;\nmediump vec2 srcOriginSize = srcOriginEnd - srcOriginStart;\nmediump vec2 n = ((vTex - srcOriginStart) / srcOriginSize);\nmediump vec2 p = vTex;\np.x += cos(n.y * _2pi * freqY + seconds * speedY * _2pi) * ampY * pixelSize.x * devicePixelRatio * layerScale;\np.y += sin(n.x * _2pi * freqX + seconds * speedX * _2pi) * ampX * pixelSize.y * devicePixelRatio * layerScale;\np = clamp(p, min(srcStart, srcEnd), max(srcStart, srcEnd));\ngl_FragColor = texture2D(samplerFront, p);\n}", + wgsl: "%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\nstruct ShaderParams {\nfreqX : f32,\nfreqY : f32,\nampX : f32,\nampY : f32,\nspeedX : f32,\nspeedY : f32\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3PARAMS_STRUCT%%\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\nconst pi2 : f32 = 6.283185307179586;\n@fragment\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar pixelSize : vec2 = c3_getPixelSize(textureFront);\nvar n : vec2 = c3_srcOriginToNorm(input.fragUV);\nvar p : vec2 = input.fragUV + vec2(\ncos(n.y * pi2 * shaderParams.freqY + c3Params.seconds * shaderParams.speedY * pi2) * shaderParams.ampY * pixelSize.x * c3Params.devicePixelRatio * c3Params.layerScale,\nsin(n.x * pi2 * shaderParams.freqX + c3Params.seconds * shaderParams.speedX * pi2) * shaderParams.ampX * pixelSize.y * c3Params.devicePixelRatio * c3Params.layerScale\n);\np = c3_clampToSrc(p);\nvar output : FragmentOutput;\noutput.color = textureSample(textureFront, samplerFront, p);\nreturn output;\n}", + blendsBackground: false, + usesDepth: false, + extendBoxHorizontal: 30, + extendBoxVertical: 30, + crossSampling: false, + mustPreDraw: false, + preservesOpaqueness: false, + animated: true, + parameters: [["freqX",0,"float"],["freqY",0,"float"],["ampX",0,"float"],["ampY",0,"float"],["speedX",0,"float"],["speedY",0,"float"]] +}; + +} + +{ +'use strict';{const C3=self.C3;let cacheRegex=null;let lastRegex="";let lastFlags="";let regexMatches=[];let lastMatchesStr="";let lastMatchesRegex="";let lastMatchesFlags="";const forEachStack=C3.New(C3.ArrayStack);function ForEachOrdered_SortInstances(a,b){const va=a[1];const vb=b[1];if(typeof va==="number"&&typeof vb==="number")return va-vb;else{const sa=""+va;const sb=""+vb;if(sasb)return 1;else return 0}}C3.Plugins.System=class SystemPlugin extends C3.SDKPluginBase{constructor(opts){super(opts); +this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingTotal=0;this._imagesLoadingComplete=0;this._functionMaps=new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(method){this._runtime.Trigger(method,null,null)}GetRegex(regex,flags){if(!cacheRegex||regex!==lastRegex||flags!==lastFlags){cacheRegex=new RegExp(regex,flags);lastRegex=regex;lastFlags=flags}cacheRegex.lastIndex= +0;return cacheRegex}GetRegexMatches(str,regex,flags){if(str===lastMatchesStr&®ex===lastMatchesRegex&&flags===lastMatchesFlags)return regexMatches;const cacheRegex=this.GetRegex(regex,flags);regexMatches=str.match(cacheRegex);lastMatchesStr=str;lastMatchesRegex=regex;lastMatchesFlags=flags;return regexMatches}async _LoadTexturesForObjectClasses(layout,objectClasses){if(!objectClasses.length)return;this._imagesLoadingTotal+=objectClasses.length;const promises=[];for(const oc of objectClasses)promises.push(layout.MaybeLoadTexturesFor(oc)); +await C3.PromiseAllWithProgress(promises,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;if(this._imagesLoadingComplete===this._imagesLoadingTotal){this._imagesLoadingComplete=0;this._imagesLoadingTotal=0;this._runtime.Trigger(C3.Plugins.System.Cnds.OnImageLoadingComplete,null,null)}}_UnloadTexturesForObjectClasses(layout,objectClasses){for(const oc of objectClasses)if(oc.GetInstanceCount()===0)layout.MaybeUnloadTexturesFor(oc)}_GetForEachStack(){return forEachStack}_Repeat(count){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetEnd(count);if(isSolModifierAfterCnds)for(let i=0;i=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>= +end&&!loop.IsStopped();--i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}*_DebugFor(name,start,end){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetName(name);loop.SetEnd(end);if(end=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>=end&&!loop.IsStopped();--i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame); +eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}_ForEach(objectClass){const eventSheetManager=this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds= +oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();const isInContainer=objectClass.IsInContainer();const sol=objectClass.GetCurrentSol();const instances=forEachStack.Push();C3.shallowAssignArray(instances,sol.GetInstances());loop.SetEnd(instances.length);if(isSolModifierAfterCnds)for(let i=0,len=instances.length;i=lastTime+thisSeconds){cndSavedData.set("Every_lastTime",lastTime+thisSeconds);if(curTime>=cndSavedData.get("Every_lastTime")+.04)cndSavedData.set("Every_lastTime",curTime);cndSavedData.set("Every_seconds",seconds);return true}else if(curTime=a&&x<=b},CompareVar(ev,cmp,val){return C3.compare(ev.GetValue(),cmp,val)},CompareBoolVar(ev){return!!ev.GetValue()}, +CompareTime(cmp,t){const gameTime=this._runtime.GetGameTime();if(cmp===0){const cnd=this._runtime.GetCurrentCondition();const cndSavedData=cnd.GetSavedDataMap();if(!cndSavedData.get("CompareTime_executed"))if(gameTime>=t){cndSavedData.set("CompareTime_executed",true);return true}return false}else return C3.compare(gameTime,cmp,t)},IsNaN(n){return isNaN(n)},AngleWithin(a1,within,a2){return C3.angleDiff(C3.toRadians(a1),C3.toRadians(a2))<=C3.toRadians(within)},IsClockwiseFrom(a1,a2){return C3.angleClockwise(C3.toRadians(a1), +C3.toRadians(a2))},IsBetweenAngles(a,la,ua){let angle=C3.toRadians(a);let lower=C3.toRadians(la);let upper=C3.toRadians(ua);let obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)},IsValueType(v,t){if(typeof v==="number")return t===0;else return t===1},EvaluateExpression(v){return!!v},PickByComparison(objectClass,exp,cmp,val){if(!objectClass)return false; +const forEachStack=this._GetForEachStack();const tempInstances=forEachStack.Push();const sol=objectClass.GetCurrentSol();C3.shallowAssignArray(tempInstances,sol.GetInstances());if(sol.IsSelectAll())C3.clearArray(sol._GetOwnElseInstances());const cnd=this._runtime.GetCurrentCondition();let k=0;for(let i=0,len=tempInstances.length;i=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer();return true},PickRandom(objectClass){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const index=Math.floor(this._runtime.Random()*instances.length);if(index>=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer();return true},PickAll(objectClass){if(!objectClass)return false; +if(!objectClass.GetInstanceCount())return false;const sol=objectClass.GetCurrentSol();sol._SetSelectAll(true);objectClass.ApplySolToContainer();return true},PickOverlappingPoint(objectClass,x,y){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const currentEvent=this._runtime.GetCurrentEvent();const isOrBlock=currentEvent.IsOrBlock();const isInverted=this._runtime.GetCurrentCondition().IsInverted();if(sol.IsSelectAll()){C3.shallowAssignArray(tmpPickArray, +instances);sol.ClearArrays();sol._SetSelectAll(false)}else if(isOrBlock){C3.shallowAssignArray(tmpPickArray,sol._GetOwnElseInstances());C3.clearArray(sol._GetOwnElseInstances())}else{C3.shallowAssignArray(tmpPickArray,sol._GetOwnInstances());C3.clearArray(sol._GetOwnInstances())}for(let i=0,len=tmpPickArray.length;i=0;--i){const inst=instancesPendingCreate[i];if(isFamily){if(inst.GetObjectClass().BelongsToFamily(objectClass)){pick=inst;break}}else if(inst.GetObjectClass()===objectClass){pick=inst;break}}if(!pick){const instances= +objectClass.GetInstances();if(instances.length)pick=instances.at(-1)}if(!pick)return false;const sol=objectClass.GetCurrentSol();sol.PickOne(pick);objectClass.ApplySolToContainer();return true},Repeat(count){if(this._runtime.IsDebugging())return this._DebugRepeat(count);else return this._Repeat(count)},While(){if(this._runtime.IsDebugging())return this._DebugWhile();else return this._While()},For(name,start,end){if(this._runtime.IsDebugging())return this._DebugFor(name,start,end);else return this._For(name, +start,end)},ForEach(objectClass){if(this._runtime.IsDebugging())return this._DebugForEach(objectClass);else return this._ForEach(objectClass)},ForEachOrdered(objectClass,expression,order){if(this._runtime.IsDebugging())return this._DebugForEachOrdered(objectClass,order);else return this._ForEachOrdered(objectClass,order)},LayerVisible(layer){return layer?layer.IsVisible():false},LayerInteractive(layer){return layer?layer.IsSelfAndParentsInteractive():false},LayerEmpty(layer){return layer?!layer.GetInstanceCount(): +false},LayerCmpOpacity(layer,cmp,o){if(!layer)return false;return C3.compare(layer.GetOpacity()*100,cmp,o)},OnImageLoadingComplete(){return true},IsLoadingImages(){return this._imagesLoadingTotal>0},TemplateExists(objectClass,template){const templateManager=this._runtime.GetTemplateManager();if(!templateManager)return false;if(!template)return false;return!!templateManager.GetTemplateData(objectClass,template)}}} +{const C3=self.C3;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}function SortInstancesByValue(a,b){return a[1]-b[1]}const tempZOrderList=[];const tempInstValues=[];const tempRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);C3.Plugins.System.Acts={SetVar(ev,x){ev.SetValue(x)},AddVar(ev,x){if(ev.IsNumber()&&typeof x!=="number")x=parseFloat(x);ev.SetValue(ev.GetValue()+x)}, +SubVar(ev,x){if(!ev.IsNumber())return;ev.SetValue(ev.GetValue()-x)},SetBoolVar(ev,x){ev.SetValue(!!x)},ToggleBoolVar(ev){ev.SetValue(!ev.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},CreateObject(objectClass,layer,x,y,createHierarchy,template){if(!objectClass||!layer)return;const inst=this._runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);const pickMap=new Map;inst.CollectInstancesToPick(pickMap,objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)},CreateObjectByName(objectClassName,layer,x,y,createHierarchy,template){if(!objectClassName||!layer)return;const objectClass=this._runtime.GetObjectClassByName(objectClassName); +if(!objectClass)return;C3.Plugins.System.Acts.CreateObject.call(this,objectClass,layer,x,y,createHierarchy,template)},RecreateInitialObjects(objectClass,x1,y1,x2,y2,sourceLayoutName,sourceLayerParam,offsetX,offsetY,createHierarchy){if(!objectClass)return;let sourceLayout=this._runtime.GetCurrentLayout();if(sourceLayoutName){const lookupLayout=this._runtime.GetLayoutManager().GetLayoutByName(sourceLayoutName);if(lookupLayout)sourceLayout=lookupLayout;else return}let sourceLayer=null;if(typeof sourceLayerParam!== +"number"||sourceLayerParam>=0){sourceLayer=sourceLayout.GetLayer(sourceLayerParam);if(!sourceLayer)return}tempRect.set(x1,y1,x2,y2);const allCreatedInstances=sourceLayout.RecreateInitialObjects(objectClass,tempRect,sourceLayer,offsetX,offsetY,createHierarchy);objectClass.GetCurrentSol().SetArrayPicked(allCreatedInstances);objectClass.ApplySolToContainer()},StopLoop(){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return;loopStack.GetCurrent().Stop()},SetGroupActive(groupName,a){const group= +this._runtime.GetEventSheetManager().GetEventGroupByName(groupName);if(!group)return;if(a===0)group.SetGroupActive(false);else if(a===1)group.SetGroupActive(true);else group.SetGroupActive(!group.IsGroupActive())},SetTimescale(ts){this._runtime.SetTimeScale(ts)},SetObjectTimescale(objectClass,ts){if(ts<0)ts=0;if(!objectClass)return;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.SetTimeScale(ts)},RestoreObjectTimescale(objectClass){if(!objectClass)return; +const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.RestoreTimeScale()},Wait(seconds){if(seconds<0)return;this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(seconds);return true},WaitForSignal(tag){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(tag);return true},WaitForPreviousActions(){const eventSheetManager=this._runtime.GetEventSheetManager();eventSheetManager.AddScheduledWait().InitPromise(eventSheetManager.GetPromiseForAllAsyncActions()); +return true},Signal(tag){const lowerTag=tag.toLowerCase();for(const w of this._runtime.GetEventSheetManager().scheduledWaits())if(w.IsSignal()&&w.GetSignalTag()===lowerTag)w.SetSignalled()},async SnapshotCanvas(format,quality,x,y,width,height){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;this.UpdateRender();await canvasManager.SnapshotCanvas(format===0?"image/png":"image/jpeg",quality/100,x,y,width,height);await this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnCanvasSnapshot, +null)},SetCanvasSize(w,h){if(w<=0||h<=0)return;this._runtime.SetViewportSize(w,h);this._runtime.GetCurrentLayout().BoundScrolling();const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true);else{this._runtime.SetOriginalViewportSize(w,h);canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)}this._runtime.UpdateRender()}, +SetFullscreenQuality(q){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")return;canvasManager.SetFullscreenScalingQuality(q!==0?"high":"low");canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)},SaveState(slot){this._runtime.SaveToSlot(slot)},LoadState(slot){this._runtime.LoadFromSlot(slot)},LoadStateJSON(jsonStr){this._runtime.LoadFromJsonString(jsonStr)},SetHalfFramerateMode(m){}, +ResetPersisted(){for(const layout of this._runtime.GetLayoutManager().GetAllLayouts())layout.ResetPersistData()},SetPixelRounding(m){this._runtime.SetPixelRoundingEnabled(m!==0)},SetMinimumFramerate(fps){this._runtime.SetMinimumFramerate(fps)},SortZOrderByInstVar(objectClass,instVar){if(!objectClass)return;const sol=objectClass.GetCurrentSol();const pickedInstances=sol.GetInstances();const zOrderList=tempZOrderList;const instValues=tempInstValues;const layout=this._runtime.GetCurrentLayout();const isFamily= +objectClass.IsFamily();const familyIndex=objectClass.GetFamilyIndex();for(let i=0,len=pickedInstances.length;i0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers); +else eventSheetManager.PushCleanSol(solModifiers);const paramResults=[];const callerFunctionBlock=eventSheetManager.FindFirstFunctionBlockParent(currentEvent);if(callerFunctionBlock){const callerParameters=callerFunctionBlock.GetFunctionParameters();for(let i=forwardParams,len=callerParameters.length;in)ret=n}return ret},clamp(x,l,u){return C3.clamp(x,l,u)},distance(x1,y1,x2,y2){return C3.distanceTo(x1,y1,x2,y2)},angle(x1,y1,x2,y2){return C3.toDegrees(C3.angleTo(x1,y1,x2,y2))},lerp(a,b,x){return C3.lerp(a,b,x)},unlerp(a,b,y){return C3.unlerp(a,b,y)},qarp(a,b,c,x){return C3.qarp(a,b,c,x)},cubic(a,b,c,d,x){return C3.cubic(a,b,c,d,x)},cosp(a,b,x){return C3.cosp(a,b,x)},anglediff(a, +b){return C3.toDegrees(C3.angleDiff(C3.toRadians(a),C3.toRadians(b)))},anglelerp(a,b,x){return C3.toDegrees(C3.angleLerp(C3.toRadians(a),C3.toRadians(b),x))},anglerotate(a,b,c){return C3.toDegrees(C3.angleRotate(C3.toRadians(a),C3.toRadians(b),C3.toRadians(c)))},setbit(n,b,v){n=n|0;b=b|0;v=v!==0?1:0;return n&~(1<=arr.length)return"";return arr[index]},tokencount(text,sep){if(typeof text!=="string"||typeof sep!=="string"||!text.length)return 0;return text.split(sep).length},find(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),"i"));else return-1},findcase(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),""));else return-1},replace(text,find,replace){if(typeof text=== +"string"&&typeof find==="string"&&typeof replace==="string")return text.replace(new RegExp(C3.EscapeRegex(find),"gi"),replace);else return typeof text==="string"?text:""},regexsearch(text,regex,flags){const cacheRegex=this.GetRegex(regex,flags);return text?text.search(cacheRegex):-1},regexreplace(text,regex,flags,replace){const cacheRegex=this.GetRegex(regex,flags);return text?text.replace(cacheRegex,replace):""},regexmatchcount(text,regex,flags){const matches=this.GetRegexMatches(text.toString(), +regex,flags);return matches?matches.length:0},regexmatchat(text,regex,flags,index){index=Math.floor(index);const matches=this.GetRegexMatches(text.toString(),regex,flags);if(!matches||index<0||index>=matches.length)return"";else return matches[index]},zeropad(n,d){let s=n<0?"-":"";if(n<0)n=-n;const zeroes=d-n.toString().length;s+="0".repeat(Math.max(zeroes,0));return s+n.toString()},urlencode(s){return encodeURIComponent(s)},urldecode(s){return decodeURIComponent(s)},dt(){return this._runtime._GetDtFast()}, +timescale(){return this._runtime.GetTimeScale()},wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()}, +windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()}, +layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},layoutangle(){return C3.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},vanishingpointx(){return this._runtime.GetCurrentLayout().GetVanishingPointX()*100},vanishingpointy(){return this._runtime.GetCurrentLayout().GetVanishingPointY()*100},viewportleft(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?layer.GetViewport3D().getLeft():0},viewporttop(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getTop():0},viewportright(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getRight():0},viewportbottom(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getBottom():0},viewportwidth(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().width():0},viewportheight(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().height():0},canvastolayerx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x,y)[0]:0},canvastolayery(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x, +y)[1]:0},layertocanvasx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x,y)[0]:0},layertocanvasy(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x,y)[1]:0},layerscale(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOwnScale():0},layerangle(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?C3.toDegrees(layer.GetOwnAngle()):0},layeropacity(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOpacity()*100:0},layerscalerate(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScaleRate():0},layerscrollx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScrollX():0},layerscrolly(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?layer.GetScrollY():0},layerparallaxx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxX()*100:0},layerparallaxy(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxY()*100:0},layerzelevation(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetZElevation():0},layerindex(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?layer.GetIndex():-1},canvassnapshot(){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return"";return canvasManager.GetCanvasSnapshotUrl()},loopindex(name){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return 0;if(name){const loop=loopStack.FindByName(name);return loop?loop.GetIndex():0}else return loopStack.GetCurrent().GetIndex()},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(name,str,...paramResults){const mapEntry=this._GetFunctionMap(name.toLowerCase(), +false);if(!mapEntry){console.warn(`[Construct] Call mapped function: map name '${name}' not found; returning 0`);return 0}let functionBlock=mapEntry.strMap.get(str.toLowerCase());if(!functionBlock)if(mapEntry.defaultFunc)functionBlock=mapEntry.defaultFunc;else{console.warn(`[Construct] Call mapped function: no function associated with map '${name}' string '${str}'; returning 0 (consider setting a default)`);return 0}const returnType=functionBlock.GetReturnType();const defaultReturnValue=functionBlock.GetDefaultReturnValue(); +if(returnType===0){console.warn(`[Construct] Call mapped function: map '${name}' string '${str}' has no return type so cannot be called from an expression; returning 0`);return 0}if(!functionBlock.IsEnabled())return defaultReturnValue;const runtime=this._runtime;const eventSheetManager=runtime.GetEventSheetManager();const currentEvent=eventSheetManager.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length>0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers); +else eventSheetManager.PushCleanSol(solModifiers);const calleeParameters=functionBlock.GetFunctionParameters();for(let i=paramResults.length,len=calleeParameters.length;i";else return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let ret=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage(); +return Math.round(100*ret/(1024*1024))/100},rgb(r,g,b){return C3.PackRGB(r,g,b)},rgbex(r,g,b){return C3.PackRGBEx(r/100,g/100,b/100)},rgba(r,g,b,a){return C3.PackRGBAEx(r/100,g/100,b/100,a/100)},rgbex255(r,g,b){return C3.PackRGBEx(r/255,g/255,b/255)},rgba255(r,g,b,a){return C3.PackRGBAEx(r/255,g/255,b/255,a/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()}, +currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Sprite=class SpritePlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;const spawnPickStack=[];C3.Plugins.Sprite.Type=class SpriteType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass);this._animations=objectClass.GetAnimations()}Release(){C3.clearArray(this._animations);super.Release()}OnCreate(){for(const a of this._animations)a.LoadAllAssets(this._runtime)}LoadTextures(renderer){const opts={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(a=>a.LoadAllTextures(renderer,opts)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const inst of this._objectClass.instancesIncludingPendingCreate())inst.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(doPick){C3.Plugins.Sprite.FinishCollisionCondition(this, +doPick)}BeforeRunAction(method){spawnPickStack.push({objectClass:null,createHierarchy:false,instances:[]})}_SpawnPickInstance(objectClass,inst,createHierarchy){const entry=spawnPickStack.at(-1);entry.objectClass=objectClass;entry.createHierarchy=createHierarchy;entry.instances.push(inst)}AfterRunAction(method){const entry=spawnPickStack.pop();const objectClass=entry.objectClass;const createHierarchy=entry.createHierarchy;if(!objectClass)return;const pickMap=new Map;for(const inst of entry.instances)inst.CollectInstancesToPick(pickMap, +objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const INITIAL_ANIMATION=1;const INITIAL_FRAME=2;const ENABLE_COLLISIONS=3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const tempVec2=C3.New(C3.Vector2);const FLAG_PLAYING_FORWARDS=1<<0;const FLAG_ANIMATION_PLAYING=1<<1;const FLAG_ANIMATION_TRIGGER=1<<2;C3.Plugins.Sprite.Instance=class SpriteInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);let initiallyVisible=true;let initialAnimation= +"";let initialFrame=0;let collisionEnabled=true;if(properties){initiallyVisible=!!properties[INITIALLY_VISIBLE];initialAnimation=properties[INITIAL_ANIMATION];initialFrame=properties[INITIAL_FRAME];collisionEnabled=properties[ENABLE_COLLISIONS]}this._currentAnimation=this._objectClass.GetAnimationByName(initialAnimation)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=C3.clamp(initialFrame,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex); +const initialImageInfo=this._currentAnimationFrame.GetImageInfo();this._currentTexture=initialImageInfo.GetTexture();this._currentRcTex=initialImageInfo.GetTexRect();this._currentQuadTex=initialImageInfo.GetTexQuad();this.HandleWebGLContextLoss();inst.SetFlag(FLAG_ANIMATION_PLAYING,true);inst.SetFlag(FLAG_PLAYING_FORWARDS,this._currentAnimation.GetSpeed()>=0);this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo(); +this._animationTimer=C3.New(C3.KahanSum);this._frameStartTime=0;this._animationRepeats=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=0;const wi=this.GetWorldInfo();this._bquadRef=wi.GetBoundingQuad();wi.SetVisible(initiallyVisible);wi.SetCollisionEnabled(collisionEnabled);wi.SetOriginX(this._currentAnimationFrame.GetOriginX());wi.SetOriginY(this._currentAnimationFrame.GetOriginY());wi.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly()); +wi.SetBboxChanged();if((this._objectClass.GetAnimationCount()!==1||this._objectClass.GetAnimations()[0].GetFrameCount()!==1)&&this._currentAnimationSpeed!==0)this._StartTicking()}Release(){this._currentAnimation=null;this._currentAnimationFrame=null;this._currentTexture=null;this._animationTimer=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return true}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(renderer){const texture= +this._currentTexture;if(texture===null)return;renderer.SetTexture(texture);const wi=this.GetWorldInfo();if(wi.HasMesh())this._DrawMesh(wi,renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=this._bquadRef;if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);renderer.Quad4(quad,this._currentQuadTex)}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad; +if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,this._currentQuadTex);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(FLAG_ANIMATION_PLAYING)}SetAnimationPlaying(e){this._inst.SetFlag(FLAG_ANIMATION_PLAYING,e)}IsPlayingForwards(){return this._inst.GetFlag(FLAG_PLAYING_FORWARDS)}SetPlayingForwards(e){this._inst.SetFlag(FLAG_PLAYING_FORWARDS, +e)}IsInAnimationTrigger(){return this._inst.GetFlag(FLAG_ANIMATION_TRIGGER)}SetInAnimationTrigger(e){this._inst.SetFlag(FLAG_ANIMATION_TRIGGER,e)}Tick(){if(this._changeAnimationName)this._DoChangeAnimation();if(this._changeAnimFrameIndex>=0)this._DoChangeAnimFrame();const currentAnimationSpeed=this._currentAnimationSpeed;if(!this.IsAnimationPlaying()||currentAnimationSpeed===0){this._StopTicking();return}const dt=this._runtime.GetDt(this._inst);this._animationTimer.Add(dt);const now=this.GetAnimationTime(); +const prevFrame=this._currentAnimationFrame;const currentFrameTime=prevFrame.GetDuration()/currentAnimationSpeed;if(now=frameCount)if(isPingPong){this.SetPlayingForwards(false);this._currentFrameIndex=frameCount-2}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(false);else this._currentFrameIndex=repeatTo}if(this._currentFrameIndex<0)if(isPingPong){this._currentFrameIndex=1;this.SetPlayingForwards(true);if(!isLooping){this._animationRepeats++; +if(this._animationRepeats>=repeatCount)this._FinishAnimation(true)}}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(true);else this._currentFrameIndex=repeatTo}this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,frameCount-1);const nextFrame=currentAnimation.GetFrameAt(this._currentFrameIndex);if(now>this._frameStartTime+nextFrame.GetDuration()/currentAnimationSpeed)this._frameStartTime=now;this._OnFrameChanged(prevFrame, +nextFrame)}_FinishAnimation(reverse){this._currentFrameIndex=reverse?0:this._currentAnimation.GetFrameCount()-1;this.SetAnimationPlaying(false);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(true);this.DispatchScriptEvent("animationend",false,{animationName:this._animTriggerName});this.Trigger(C3.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(false);this._animationRepeats=0}_OnFrameChanged(prevFrame, +nextFrame){if(prevFrame===nextFrame)return;const wi=this.GetWorldInfo();const prevImage=prevFrame.GetImageInfo();const nextImage=nextFrame.GetImageInfo();const oldW=prevImage.GetWidth();const oldH=prevImage.GetHeight();const newW=nextImage.GetWidth();const newH=nextImage.GetHeight();if(oldW!==newW)wi.SetWidth(wi.GetWidth()*(newW/oldW));if(oldH!==newH)wi.SetHeight(wi.GetHeight()*(newH/oldH));wi.SetOriginX(nextFrame.GetOriginX());wi.SetOriginY(nextFrame.GetOriginY());wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly()); +wi.SetBboxChanged();this._currentAnimationFrame=nextFrame;this._currentTexture=nextImage.GetTexture();this._currentRcTex=nextImage.GetTexRect();this._currentQuadTex=nextImage.GetTexQuad();const behaviorInstances=this.GetInstance().GetBehaviorInstances();for(let i=0,len=behaviorInstances.length;i=0);if(this._currentAnimationSpeed>0)this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(f){f= +C3.clamp(Math.floor(f),0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationRepeatTo=f}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const prevFrame=this._currentAnimationFrame;const animation=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";if(!animation)return;if(animation===this._currentAnimation&&this.IsAnimationPlaying())return;this._currentAnimation=animation;this.SetPlayingForwards(animation.GetSpeed()>= +0);this._currentAnimationSpeed=Math.abs(animation.GetSpeed());this._currentAnimationRepeatTo=animation.GetRepeatTo();this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1);if(this._changeAnimationFrom===1)this._currentFrameIndex=0;this.SetAnimationPlaying(true);this._frameStartTime=this.GetAnimationTime();const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(prevFrame,nextFrame)}_DoChangeAnimFrame(){const prevFrame= +this._currentAnimationFrame;const prevFrameIndex=this._currentFrameIndex;this._currentFrameIndex=C3.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;if(prevFrameIndex===this._currentFrameIndex)return;const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(prevFrame,nextFrame);this._frameStartTime=this.GetAnimationTime()}_UpdateCurrentTexture(){const curImageInfo=this._currentAnimationFrame.GetImageInfo(); +this._currentTexture=curImageInfo.GetTexture();this._currentRcTex=curImageInfo.GetTexRect();this._currentQuadTex=curImageInfo.GetTexQuad();this.GetWorldInfo().SetMeshChanged(true)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(nameOrIndex){const frame=this._currentAnimationFrame;const wi=this.GetWorldInfo();let ip=null;if(typeof nameOrIndex=== +"string")ip=frame.GetImagePointByName(nameOrIndex);else if(typeof nameOrIndex==="number")ip=frame.GetImagePointByIndex(nameOrIndex-1);else throw new TypeError("expected string or number");if(!ip)return[wi.GetX(),wi.GetY()];tempVec2.copy(ip.GetVec2());if(wi.HasMesh()){const [tx,ty]=wi.GetSourceMesh().TransformPoint(tempVec2.getX(),tempVec2.getY());tempVec2.set(tx,ty)}tempVec2.offset(-frame.GetOriginX(),-frame.GetOriginY());tempVec2.scale(wi.GetWidth(),wi.GetHeight());tempVec2.rotate(wi.GetAngle()); +tempVec2.offset(wi.GetX(),wi.GetY());return[tempVec2.getX(),tempVec2.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(index){index=Math.floor(index);const wi=this.GetWorldInfo();const poly=wi.GetTransformedCollisionPoly();const pointCount=poly.pointCount();if(index===pointCount)index=0;if(index<0||index>=pointCount)return[0,0];const pointsArr=poly.pointsArr();return[pointsArr[index*2+0]+wi.GetX(),pointsArr[index*2+1]+ +wi.GetY()]}GetDebuggerProperties(){const Acts=C3.Plugins.Sprite.Acts;const prefix="plugins.sprite.debugger.animation-properties";return[{title:prefix+".title",properties:[{name:prefix+".current-animation",value:this._currentAnimation.GetName(),onedit:v=>this.CallAction(Acts.SetAnim,v,0)},{name:prefix+".current-frame",value:this._currentFrameIndex,onedit:v=>this.CallAction(Acts.SetAnimFrame,v)},{name:prefix+".is-playing",value:this.IsAnimationPlaying(),onedit:v=>v?this.CallAction(Acts.StartAnim,0): +this.CallAction(Acts.StopAnim)},{name:prefix+".speed",value:this._currentAnimationSpeed,onedit:v=>this.CallAction(Acts.SetAnimSpeed,v)},{name:prefix+".repeats",value:this._animationRepeats,onedit:v=>this._animationRepeats=v}]}]}SaveToJson(){const o={"a":this._currentAnimation.GetSID()};if(this._frameStartTime!==0)o["fs"]=this._frameStartTime;const animTime=this.GetAnimationTime();if(animTime!==0)o["at"]=animTime;if(this._currentFrameIndex!==0)o["f"]=this._currentFrameIndex;if(this._currentAnimationSpeed!== +0)o["cas"]=this._currentAnimationSpeed;if(this._animationRepeats!==1)o["ar"]=this._animationRepeats;if(this._currentAnimationRepeatTo!==0)o["rt"]=this._currentAnimationRepeatTo;if(!this.IsAnimationPlaying())o["ap"]=this.IsAnimationPlaying();if(!this.IsPlayingForwards())o["af"]=this.IsPlayingForwards();const wi=this.GetWorldInfo();if(wi.IsCollisionEnabled())o["ce"]=wi.IsCollisionEnabled();return o}LoadFromJson(o){const anim=this.GetObjectClass().GetAnimationBySID(o["a"]);if(anim)this._currentAnimation= +anim;this._frameStartTime=o.hasOwnProperty("fs")?o["fs"]:0;this._animationTimer.Set(o.hasOwnProperty("at")?o["at"]:0);const frameIndex=o.hasOwnProperty("f")?o["f"]:0;this._currentFrameIndex=C3.clamp(frameIndex,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=o.hasOwnProperty("cas")?o["cas"]:0;this._animationRepeats=o.hasOwnProperty("ar")?o["ar"]:1;const repeatToIndex=o.hasOwnProperty("rt")?o["rt"]:0;this._currentAnimationRepeatTo=C3.clamp(repeatToIndex,0,this._currentAnimation.GetFrameCount()- +1);this.SetAnimationPlaying(o.hasOwnProperty("ap")?!!o["ap"]:true);this.SetPlayingForwards(o.hasOwnProperty("af")?!!o["af"]:true);const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._currentAnimationFrame=nextFrame;this._UpdateCurrentTexture();const wi=this.GetWorldInfo();wi.SetOriginX(nextFrame.GetOriginX());wi.SetOriginY(nextFrame.GetOriginY());wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly());wi.SetCollisionEnabled(!!o["ce"]);if(this.IsAnimationPlaying())this._StartTicking()}GetPropertyValueByIndex(index){const wi= +this.GetWorldInfo();switch(index){case ENABLE_COLLISIONS:return wi.IsCollisionEnabled();case INITIAL_FRAME:return C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(index,value){const wi=this.GetWorldInfo();switch(index){case ENABLE_COLLISIONS:wi.SetCollisionEnabled(!!value);break;case INITIAL_FRAME:this.SetAnimationPlaying(false);const totalFrames=this._currentAnimation.GetFrameCount()-1;const nextIndex=value=C3.clamp(value,0,totalFrames);const prevFrame= +this._currentAnimation.GetFrameAt(this._currentFrameIndex);const nextFrame=this._currentAnimation.GetFrameAt(nextIndex);this._OnFrameChanged(prevFrame,nextFrame);this._currentFrameIndex=C3.clamp(nextIndex,0,totalFrames);break}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const map=new WeakMap;const ANIM_FROM_MODES=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class ISpriteInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return map.get(this).GetImagePointCount()}getImagePointX(nameOrIndex){if(typeof nameOrIndex!== +"string"&&typeof nameOrIndex!=="number")throw new TypeError("expected string or number");return map.get(this).GetImagePoint(nameOrIndex)[0]}getImagePointY(nameOrIndex){if(typeof nameOrIndex!=="string"&&typeof nameOrIndex!=="number")throw new TypeError("expected string or number");return map.get(this).GetImagePoint(nameOrIndex)[1]}getImagePoint(nameOrIndex){if(typeof nameOrIndex!=="string"&&typeof nameOrIndex!=="number")throw new TypeError("expected string or number");return map.get(this).GetImagePoint(nameOrIndex)}getPolyPointCount(){return map.get(this).GetCollisionPolyPointCount()}getPolyPointX(index){C3X.RequireFiniteNumber(index); +return map.get(this).GetCollisionPolyPoint(index)[0]}getPolyPointY(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)[1]}getPolyPoint(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)}stopAnimation(){map.get(this).SetAnimationPlaying(false)}startAnimation(from="current-frame"){C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");map.get(this)._StartAnim(f)}setAnimation(name, +from="beginning"){C3X.RequireString(name);C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");const inst=map.get(this);if(!inst.GetObjectClass().GetAnimationByName(name))throw new Error(`animation name "${name}" does not exist`);inst._SetAnim(name,f)}getAnimation(name){C3X.RequireString(name);const a=map.get(this).GetObjectClass().GetAnimationByName(name);return a?a.GetIAnimation():null}get animation(){return map.get(this)._GetCurrentAnimation().GetIAnimation()}get animationName(){return map.get(this)._GetCurrentAnimationName()}set animationFrame(frameIndex){C3X.RequireFiniteNumber(frameIndex); +map.get(this)._SetAnimFrame(frameIndex)}get animationFrame(){return map.get(this)._GetAnimFrame()}set animationSpeed(s){C3X.RequireFiniteNumber(s);map.get(this)._SetAnimSpeed(s)}get animationSpeed(){return map.get(this)._GetAnimSpeed()}set animationRepeatToFrame(f){C3X.RequireFiniteNumber(f);map.get(this)._SetAnimRepeatToFrame(f)}get animationRepeatToFrame(){return map.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}setSolidCollisionFilter(isInclusive, +tags){C3X.RequireString(tags);map.get(this).GetWorldInfo().SetSolidCollisionFilter(!!isInclusive,tags)}}} +{const C3=self.C3;C3.Plugins.Sprite.Cnds={IsAnimPlaying(animName){return C3.equalsNoCase(this._GetCurrentAnimationName(),animName)},CompareFrame(cmp,frameNum){return C3.compare(this._currentFrameIndex,cmp,frameNum)},CompareAnimSpeed(cmp,x){return C3.compare(this._GetAnimSpeed(),cmp,x)},OnAnimFinished(animName){return C3.equalsNoCase(this._animTriggerName,animName)},OnAnyAnimFinished(){return true},OnFrameChanged(){return true},IsMirrored(){return this.GetWorldInfo().GetWidth()<0},IsFlipped(){return this.GetWorldInfo().GetHeight()< +0},OnURLLoaded(){return true},OnURLFailed(){return true},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}} +{const C3=self.C3;C3.Plugins.Sprite.Acts={Spawn(objectClass,layer,imgPt,createHierarchy){if(!objectClass||!layer)return;const [imgPtX,imgPtY]=this.GetImagePoint(imgPt);const inst=this._runtime.CreateInstance(objectClass,layer,imgPtX,imgPtY,createHierarchy);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);if(objectClass.GetPlugin().IsRotatable()){const instWi=inst.GetWorldInfo();instWi.SetAngle(this.GetWorldInfo().GetAngle());instWi.SetBboxChanged()}const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(objectClass!==this.GetObjectClass())this._sdkType._SpawnPickInstance(objectClass,inst,createHierarchy)},StopAnim(){this.SetAnimationPlaying(false)},StartAnim(from){this._StartAnim(from)},SetAnim(animName,from){this._SetAnim(animName,from)},SetAnimFrame(frameNum){this._SetAnimFrame(frameNum)},SetAnimSpeed(s){this._SetAnimSpeed(s)}, +SetAnimRepeatToFrame(f){this._SetAnimRepeatToFrame(f)},SetMirrored(m){const wi=this.GetWorldInfo();const oldW=wi.GetWidth();const newW=Math.abs(oldW)*(m===0?-1:1);if(oldW===newW)return;wi.SetWidth(newW);wi.SetBboxChanged()},SetFlipped(f){const wi=this.GetWorldInfo();const oldH=wi.GetHeight();const newH=Math.abs(oldH)*(f===0?-1:1);if(oldH===newH)return;wi.SetHeight(newH);wi.SetBboxChanged()},SetScale(s){const frame=this._currentAnimationFrame;const imageInfo=frame.GetImageInfo();const wi=this.GetWorldInfo(); +const mirrorFactor=wi.GetWidth()<0?-1:1;const flipFactor=wi.GetHeight()<0?-1:1;const newWidth=imageInfo.GetWidth()*s*mirrorFactor;const newHeight=imageInfo.GetHeight()*s*flipFactor;if(wi.GetWidth()!==newWidth||wi.GetHeight()!==newHeight){wi.SetSize(newWidth,newHeight);wi.SetBboxChanged()}},async LoadURL(url,resize,crossOrigin){const curAnimFrame=this._currentAnimationFrame;const curImageInfo=curAnimFrame.GetImageInfo();const wi=this.GetWorldInfo();const runtime=this._runtime;const sdkType=this._sdkType; +if(curImageInfo.GetURL()===url){if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}this.Trigger(C3.Plugins.Sprite.Cnds.OnURLLoaded);return}const imageInfo=C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(err){console.error("Load image from URL failed: ",err);this.Trigger(C3.Plugins.Sprite.Cnds.OnURLFailed); +return}curImageInfo.ReplaceWith(imageInfo);sdkType._UpdateAllCurrentTexture();runtime.UpdateRender();if(!this.WasReleased()){if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}await this.TriggerAsync(C3.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(e){this.GetWorldInfo().SetCollisionEnabled(e)},SetSolidCollisionFilter(mode,tags){this.GetWorldInfo().SetSolidCollisionFilter(mode===0,tags)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(imgpt){return this.GetImagePoint(imgpt)[0]},ImagePointY(imgpt){return this.GetImagePoint(imgpt)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()}, +ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(i){return this.GetCollisionPolyPoint(i)[0]},PolyPointYAt(i){return this.GetCollisionPolyPoint(i)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Keyboard=class KeyboardPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Keyboard.Type=class KeyboardType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let keyboardObjectType=null;function GetKeyboardSdkInstance(){return keyboardObjectType.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class IKeyboardObjectType extends self.IObjectClass{constructor(objectType){super(objectType);keyboardObjectType= +objectType;objectType.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(keyOrCode){const keyboardInst=GetKeyboardSdkInstance();if(typeof keyOrCode==="string")return keyboardInst.IsKeyDown(keyOrCode);else if(typeof keyOrCode==="number")return keyboardInst.IsKeyCodeDown(keyOrCode);else throw new TypeError("expected string or number");}}} +{const C3=self.C3;C3.Plugins.Keyboard.Instance=class KeyboardInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerString="";this._triggerTypedKey="";const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"keydown",e=>this._OnKeyDown(e.data)),C3.Disposable.From(rt,"keyup",e=>this._OnKeyUp(e.data)),C3.Disposable.From(rt,"window-blur", +()=>this._OnWindowOrKeyboardBlur()),C3.Disposable.From(rt,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];if(this._keysDownByString.has(keyString))return;this._keysDownByString.add(keyString);this._keysDownByWhich.add(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKey);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKey); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCode)}_OnKeyUp(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];this._keysDownByString.delete(keyString);this._keysDownByWhich.delete(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const which of this._keysDownByWhich){this._keysDownByWhich.delete(which);this._triggerWhich=which;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}this._keysDownByString.clear()}IsKeyDown(str){return this._keysDownByString.has(str)}IsKeyCodeDown(which){return this._keysDownByWhich.has(which)}SaveToJson(){return{"tk":this._triggerWhich, +"tkk":this._triggerTypedKey}}LoadFromJson(o){this._triggerWhich=o["tk"];if(o.hasOwnProperty("tkk"))this._triggerTypedKey=o["tkk"]}GetDebuggerProperties(){const prefix="plugins.keyboard";return[{title:prefix+".name",properties:[{name:prefix+".debugger.last-key-code",value:this._triggerWhich},{name:prefix+".debugger.last-key-string",value:C3.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:prefix+".debugger.last-typed-key",value:this._triggerTypedKey}]}]}}} +{const C3=self.C3;const LEFTRIGHT_KEY_STRINGS=["ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","MetaLeft","MetaRight"];C3.Plugins.Keyboard.Cnds={IsKeyDown(which){return this._keysDownByWhich.has(which)},OnKey(which){return this._triggerWhich===which},OnAnyKey(){return true},OnAnyKeyReleased(){return true},OnKeyReleased(which){return this._triggerWhich===which},IsKeyCodeDown(which){which=Math.floor(which);return this._keysDownByWhich.has(which)},OnKeyCode(which){return this._triggerWhich=== +which},OnKeyCodeReleased(which){return this._triggerWhich===which},OnLeftRightKeyPressed(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},OnLeftRightKeyReleased(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},IsLeftRightKeyDown(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._keysDownByString.has(keyString)}}}{const C3=self.C3;C3.Plugins.Keyboard.Acts={}} +{const C3=self.C3;function StringFromCharCode(kc){kc=Math.floor(kc);switch(kc){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del"; +case 91:return"left window key";case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2"; +case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(kc)}} +C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(kc){return StringFromCharCode(kc)},TypedKey(){return this._triggerTypedKey}}}; + +} + +{ +'use strict';{const C3=self.C3;const actionPromises=[];C3.Plugins.Audio=class AudioPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}_AddActionPromise(promise){actionPromises.push(promise)}static async WaitForAllActionPromises(){await Promise.all(actionPromises);C3.clearArray(actionPromises)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Audio.Type=class AudioType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function GetAudioDOMInterface(){if(self["C3Audio_DOMInterface"])return self["C3Audio_DOMInterface"];else throw new Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class IAudioObjectType extends self.IObjectClass{constructor(objectType){super(objectType)}get audioContext(){return GetAudioDOMInterface().GetAudioContext()}get destinationNode(){return GetAudioDOMInterface().GetDestinationNode()}}} +{const C3=self.C3;const DOM_COMPONENT_ID="audio";const LATENCY_HINTS=["interactive","balanced","playback"];C3.Plugins.Audio.Instance=class AudioInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst,DOM_COMPONENT_ID);this._nextPlayTime=0;this._triggerTag="";this._timeScaleMode=0;this._saveLoadMode=0;this._playInBackground=false;this._panningModel=1;this._distanceModel=1;this._listenerX=this._runtime.GetViewportWidth()/2;this._listenerY=this._runtime.GetViewportHeight()/2;this._listenerZ= +-600;this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=false;this._sampleRate=0;this._audioContextState="suspended";this._outputLatency=0;this._effectCount=new Map;this._preloadTotal=0;this._preloadCount=0;this._bufferMetadata=new Map;this._remoteUrls=new Map;let latencyHint="interactive";if(properties){this._timeScaleMode=properties[0];this._saveLoadMode=properties[1];this._playInBackground= +properties[2];latencyHint=LATENCY_HINTS[properties[3]];this._panningModel=properties[4];this._distanceModel=properties[5];this._listenerZ=-properties[6];this._referenceDistance=properties[7];this._maxDistance=properties[8];this._rolloffFactor=properties[9]}this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=[];this.AddDOMMessageHandlers([["state",e=>this._OnUpdateState(e)],["audiocontext-state",e=>this._OnAudioContextStateChanged(e)],["fxstate",e=>this._OnUpdateFxState(e)],["trigger", +e=>this._OnTrigger(e)],["buffer-metadata",e=>this._OnBufferMetadata(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",{"preloadList":this._runtime.GetAssetManager().GetAudioToPreload().map(o=> +({"originalUrl":o.originalUrl,"url":o.url,"type":o.type,"fileSize":o.fileSize})),"isiOSCordova":this._runtime.IsiOSCordova(),"isSafari":C3.Platform.Browser==="Safari","timeScaleMode":this._timeScaleMode,"latencyHint":latencyHint,"panningModel":this._panningModel,"distanceModel":this._distanceModel,"refDistance":this._referenceDistance,"maxDistance":this._maxDistance,"rolloffFactor":this._rolloffFactor,"listenerPos":[this._listenerX,this._listenerY,this._listenerZ]}).then(info=>{this._sampleRate=info["sampleRate"]; +this._audioContextState=info["audioContextState"];this._outputLatency=info["outputLatency"]}));this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_AddActionPromise(promise){this.GetPlugin()._AddActionPromise(promise)}_OnInstanceDestroyed(inst){if(this._listenerInst===inst)this._listenerInst=null}DbToLinearNoCap(x){return Math.pow(10,x/20)}DbToLinear(x){const v=this.DbToLinearNoCap(x);if(!isFinite(v))return 0;return Math.max(Math.min(v,1),0)}LinearToDbNoCap(x){return Math.log(x)/ +Math.log(10)*20}LinearToDb(x){return this.LinearToDbNoCap(Math.max(Math.min(x,1),0))}_OnSuspend(){if(this._playInBackground)return;this.PostToDOM("set-suspended",{"isSuspended":true})}_OnResume(){if(this._playInBackground)return;this.PostToDOM("set-suspended",{"isSuspended":false})}_OnUpdateState(e){const tickCount=e["tickCount"];this._outputLatency=e["outputLatency"];const preservePlaceholders=this._lastAIState.filter(ai=>ai.hasOwnProperty("placeholder")&&(ai["placeholder"]>tickCount||ai["placeholder"]=== +-1));this._lastAIState=e["audioInstances"];this._lastAnalysersData=e["analysers"];if(preservePlaceholders.length>0)C3.appendArray(this._lastAIState,preservePlaceholders)}_OnBufferMetadata(e){this._bufferMetadata.set(e["originalUrl"],{duration:e["duration"]})}_OnAudioContextStateChanged(e){this._audioContextState=e["audioContextState"]}GetAudioContextState(){if(this._runtime.IsExportToVideo())return"running";else return this._audioContextState}_OnUpdateFxState(e){this._lastFxState=e["fxstate"]}_GetFirstAudioStateByTag(tag){for(const a of this._lastAIState)if(C3.equalsNoCase(a["tag"], +tag))return a;return null}_IsTagPlaying(tag){return this._lastAIState.some(ai=>C3.equalsNoCase(tag,ai["tag"])&&ai["isPlaying"])}_MaybeMarkAsPlaying(originalUrl,tag,isMusic,isLooping,vol){if(this._IsTagPlaying(tag))return null;const bufferMeta=this._bufferMetadata.get(originalUrl);const state={"tag":tag,"duration":bufferMeta?bufferMeta.duration:0,"volume":vol,"isPlaying":true,"playbackTime":0,"playbackRate":1,"uid":-1,"bufferOriginalUrl":originalUrl,"bufferUrl":"","bufferType":"","isMusic":isMusic, +"isLooping":isLooping,"isMuted":false,"resumePosition":0,"pan":null,"placeholder":-1};this._lastAIState.push(state);return state}async _OnTrigger(e){const type=e["type"];this._triggerTag=e["tag"];const aiId=e["aiid"];if(type==="ended"){for(const aiState of this._lastAIState)if(aiState["aiid"]===aiId){aiState["isPlaying"]=false;break}await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnEnded)}else if(type==="fade-ended")await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const o={"timeScale":this._runtime.GetTimeScale(), +"gameTime":this._runtime.GetGameTimeRaw(),"instPans":this.GetInstancePans(),"tickCount":this._runtime.GetTickCountNoSave()};if(this._listenerInst){const wi=this._listenerInst.GetWorldInfo();this._listenerX=wi.GetX();this._listenerY=wi.GetY();o["listenerPos"]=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",o)}rotatePtAround(px,py,a,ox,oy){if(a===0)return[px,py];const sin_a=Math.sin(a);const cos_a=Math.cos(a);px-=ox;py-=oy;const left_sin_a=px*sin_a;const top_sin_a=py*sin_a;const left_cos_a= +px*cos_a;const top_cos_a=py*cos_a;px=left_cos_a-top_sin_a;py=top_cos_a+left_sin_a;px+=ox;py+=oy;return[px,py]}GetInstancePans(){return this._lastAIState.filter(ai=>ai["uid"]!==-1).map(ai=>this._runtime.GetInstanceByUID(ai["uid"])).filter(inst=>inst).map(inst=>{const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerX,this._listenerY);return{"uid":inst.GetUID(),"x":x,"y":y,"angle":wi.GetAngle()-layerAngle}})}GetAnalyserData(tag, +index){for(const o of this._lastAnalysersData)if(o.index===index&&C3.equalsNoCase(o.tag,tag))return o;return null}_IncrementEffectCount(tag){this._effectCount.set(tag,(this._effectCount.get(tag)||0)+1)}_ShouldSave(ai){if(ai.hasOwnProperty("placeholder"))return false;if(this._saveLoadMode===3)return false;else if(ai["isMusic"]&&this._saveLoadMode===1)return false;else if(!ai["isMusic"]&&this._saveLoadMode===2)return false;else return true}SaveToJson(){return{"isSilent":this._isSilent,"masterVolume":this._masterVolume, +"listenerZ":this._listenerZ,"listenerUid":this._listenerInst?this._listenerInst.GetUID():-1,"remoteUrls":[...this._remoteUrls.entries()],"playing":this._lastAIState.filter(ai=>this._ShouldSave(ai)),"effects":this._lastFxState,"analysers":this._lastAnalysersData}}LoadFromJson(o){this._isSilent=o["isSilent"];this._masterVolume=o["masterVolume"];this._listenerZ=o["listenerZ"];this._listenerInst=null;this._loadListenerUid=o["listenerUid"];this._remoteUrls.clear();if(o["remoteUrls"])for(const [k,v]of o["remoteUrls"])this._remoteUrls.set(k, +v);this._lastAIState=o["playing"];this._lastFxState=o["effects"];this._lastAnalysersData=o["analysers"]}_OnAfterLoad(){if(this._loadListenerUid!==-1){this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid);this._loadListenerUid=-1;if(this._listenerInst){const wi=this._listenerInst.GetWorldInfo();this._listenerX=wi.GetX();this._listenerY=wi.GetY()}}for(const ai of this._lastAIState){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(ai["bufferOriginalUrl"]);if(info){ai["bufferUrl"]= +info.url;ai["bufferType"]=info.type}else ai["bufferUrl"]=null}for(const fxChainData of Object.values(this._lastFxState))for(const fxData of fxChainData)if(fxData.hasOwnProperty("bufferOriginalUrl")){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(fxData["bufferOriginalUrl"]);if(info){fxData["bufferUrl"]=info.url;fxData["bufferType"]=info.type}}this.PostToDOM("load-state",{"saveLoadMode":this._saveLoadMode,"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTimeRaw(), +"listenerPos":[this._listenerX,this._listenerY,this._listenerZ],"isSilent":this._isSilent,"masterVolume":this._masterVolume,"playing":this._lastAIState.filter(ai=>ai["bufferUrl"]!==null),"effects":this._lastFxState})}GetDebuggerProperties(){const fxProps=[];for(const [tag,fxChainData]of Object.entries(this._lastFxState))fxProps.push({name:"$"+tag,value:fxChainData.map(d=>d["type"]).join(", ")});const prefix="plugins.audio.debugger";return[{title:prefix+".tag-effects",properties:fxProps},{title:prefix+ +".currently-playing",properties:[{name:prefix+".currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((s,index)=>({name:"$#"+index,value:`${s["bufferOriginalUrl"]} ("${s["tag"]}") ${Math.round(s["playbackTime"]*10)/10} / ${Math.round(s["duration"]*10)/10}`}))]}]}}} +{const C3=self.C3;C3.Plugins.Audio.Cnds={OnEnded(tag){return C3.equalsNoCase(this._triggerTag,tag)},OnFadeEnded(tag){return C3.equalsNoCase(this._triggerTag,tag)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return true},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const ai of this._lastAIState)if(ai["isPlaying"])return true;return false},IsTagPlaying(tag){return this._IsTagPlaying(tag)}}} +{const C3=self.C3;const FILTER_TYPES=["lowpass","highpass","bandpass","lowshelf","highshelf","peaking","notch","allpass"];C3.Plugins.Audio.Acts={Play(file,looping,vol,stereoPan,tag,startOffset){const ret=C3.Plugins.Audio.Acts._DoPlay.call(this,file,looping,vol,stereoPan,tag,startOffset);this._AddActionPromise(ret);return ret},async _DoPlay(file,looping,vol,stereoPan,tag,startOffset){if(this._isSilent)return;const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]); +if(!info)return;startOffset=startOffset?startOffset:0;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tag.toLowerCase(),isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":startOffset,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]= +this._runtime.GetTickCountNoSave()}},async PlayAtPosition(file,looping,vol,x,y,angle,innerAngle,outerAngle,outerGain,tag){if(this._isSilent)return;const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tag.toLowerCase(),isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type, +"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtObject(file,looping,vol,objectClass,innerAngle,outerAngle,outerGain,tag){if(this._isSilent)return; +if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerX,this._listenerY);const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tag.toLowerCase(), +isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"angle":wi.GetAngle()-layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]= +this._runtime.GetTickCountNoSave()}},async PlayByName(folder,filename,looping,vol,stereoPan,tag){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tag.toLowerCase(),isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename, +"url":info.url,"type":info.type,"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtPositionByName(folder,filename,looping,vol,x,y,angle,innerAngle,outerAngle,outerGain,tag){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)|| +this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tag.toLowerCase(),isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x, +"y":y,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtObjectByName(folder,filename,looping,vol,objectClass,innerAngle,outerAngle,outerGain,tag){if(this._isSilent)return;if(this._isSilent)return;if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo(); +const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerX,this._listenerY);const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tag.toLowerCase(),isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play", +{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tag":tag.toLowerCase(),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"angle":wi.GetAngle()-layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},SetLooping(tag, +looping){this.PostToDOM("set-looping",{"tag":tag.toLowerCase(),"isLooping":looping===0})},SetMuted(tag,muted){this.PostToDOM("set-muted",{"tag":tag.toLowerCase(),"isMuted":muted===0})},SetVolume(tag,vol){this.PostToDOM("set-volume",{"tag":tag.toLowerCase(),"vol":this.DbToLinear(vol)})},FadeVolume(tag,vol,duration,ending){this.PostToDOM("fade-volume",{"tag":tag.toLowerCase(),"vol":this.DbToLinear(vol),"duration":duration,"stopOnEnd":ending===0})},SetStereoPan(tag,p){this.PostToDOM("set-stereo-pan", +{"tag":tag.toLowerCase(),"p":C3.clamp(p/100,-1,1)})},async Preload(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},async PreloadByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase()); +if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},SetPlaybackRate(tag,rate){this.PostToDOM("set-playback-rate",{"tag":tag.toLowerCase(),"rate":Math.max(rate,0)})},Stop(tag){this.PostToDOM("stop",{"tag":tag.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(tag,state){this.PostToDOM("set-paused",{"tag":tag.toLowerCase(),"paused":state===0})},Seek(tag,pos){this.PostToDOM("seek", +{"tag":tag.toLowerCase(),"pos":pos})},SetSilent(s){if(s===2)s=this._isSilent?1:0;s=s===0;if(this._isSilent===s)return;this._isSilent=s;this.PostToDOM("set-silent",{"isSilent":s})},SetMasterVolume(vol){const mv=this.DbToLinear(vol);if(this._masterVolume===mv)return;this._masterVolume=mv;this.PostToDOM("set-master-volume",{"vol":mv})},AddFilterEffect(tag,type,freq,detune,q,gain,mix){tag=tag.toLowerCase();const typeStr=FILTER_TYPES[type];this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"filter", +"tag":tag,"params":[typeStr,freq,detune,q,gain,C3.clamp(mix/100,0,1)]})},AddDelayEffect(tag,delay,gain,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"delay","tag":tag,"params":[delay,this.DbToLinear(gain),C3.clamp(mix/100,0,1)]})},AddFlangerEffect(tag,delay,modulation,freq,feedback,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"flanger","tag":tag,"params":[delay/1E3,modulation/1E3,freq,feedback/100,C3.clamp(mix/ +100,0,1)]})},AddPhaserEffect(tag,freq,detune,q,mod,modfreq,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"phaser","tag":tag,"params":[freq,detune,q,mod,modfreq,C3.clamp(mix/100,0,1)]})},AddConvolutionEffect(tag,file,norm,mix){tag=tag.toLowerCase();const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"convolution","tag":tag,"bufferOriginalUrl":file[0], +"bufferUrl":info.url,"bufferType":info.type,"params":[norm===0,C3.clamp(mix/100,0,1)]})},AddGainEffect(tag,g){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"gain","tag":tag,"params":[this.DbToLinear(g)]})},AddStereoPanEffect(tag,g){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"stereopan","tag":tag,"params":[C3.clamp(g/100,-1,1)]})},AddMuteEffect(tag){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect", +{"type":"gain","tag":tag,"params":[0]})},AddTremoloEffect(tag,freq,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"tremolo","tag":tag,"params":[freq,C3.clamp(mix/100,0,1)]})},AddRingModEffect(tag,freq,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"ringmod","tag":tag,"params":[freq,C3.clamp(mix/100,0,1)]})},AddDistortionEffect(tag,threshold,headroom,drive,makeupgain,mix){tag=tag.toLowerCase();this._IncrementEffectCount(tag); +this.PostToDOM("add-effect",{"type":"distortion","tag":tag,"params":[this.DbToLinearNoCap(threshold),this.DbToLinearNoCap(headroom),drive,this.DbToLinearNoCap(makeupgain),C3.clamp(mix/100,0,1)]})},AddCompressorEffect(tag,threshold,knee,ratio,attack,release){tag=tag.toLowerCase();this._IncrementEffectCount(tag);this.PostToDOM("add-effect",{"type":"compressor","tag":tag,"params":[threshold,knee,ratio,attack/1E3,release/1E3]})},AddAnalyserEffect(tag,fftSize,smoothing){tag=tag.toLowerCase();this._IncrementEffectCount(tag); +this.PostToDOM("add-effect",{"type":"analyser","tag":tag,"params":[fftSize,smoothing]})},RemoveEffects(tag){tag=tag.toLowerCase();this._effectCount.set(tag,0);this.PostToDOM("remove-effects",{"tag":tag});this._lastFxState={}},SetEffectParameter(tag,index,param,value,ramp,time){this.PostToDOM("set-effect-param",{"tag":tag.toLowerCase(),"index":Math.floor(index),"param":param,"value":value,"ramp":ramp,"time":time})},SetListenerObject(objectClass){if(!objectClass)return;const inst=objectClass.GetFirstPicked(); +if(!inst||!inst.GetWorldInfo())return;this._listenerInst=inst},SetListenerZ(z){this._listenerZ=z},ScheduleNextPlay(t){this._nextPlayTime=Math.max(t,0)},UnloadAudio(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAudioByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase()); +if(!info)return;this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(url,type,name){this._remoteUrls.set(name.toLowerCase(),{url,type})}}} +{const C3=self.C3;C3.Plugins.Audio.Exps={Duration(tag){const a=this._GetFirstAudioStateByTag(tag);return a?a["duration"]:0},PlaybackTime(tag){const a=this._GetFirstAudioStateByTag(tag);return a?a["playbackTime"]:0},PlaybackRate(tag){const a=this._GetFirstAudioStateByTag(tag);return a?a["playbackRate"]:0},Volume(tag){const a=this._GetFirstAudioStateByTag(tag);return a?this.LinearToDb(a["volume"]):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(tag){return this._effectCount.get(tag.toLowerCase())|| +0},AnalyserFreqBinCount(tag,index){const o=this.GetAnalyserData(tag,Math.floor(index));return o?o["binCount"]:0},AnalyserFreqBinAt(tag,index,bin){const o=this.GetAnalyserData(tag,Math.floor(index));if(!o)return 0;bin=Math.floor(bin);if(bin<0||bin>=o["binCount"])return 0;return o["freqBins"][bin]},AnalyserPeakLevel(tag,index){const o=this.GetAnalyserData(tag,Math.floor(index));return o?o["peak"]:0},AnalyserRMSLevel(tag,index){const o=this.GetAnalyserData(tag,Math.floor(index));return o?o["rms"]:0}, +SampleRate(){return this._sampleRate},CurrentTime(){if(self["C3_GetAudioContextCurrentTime"])return self["C3_GetAudioContextCurrentTime"]();else return performance.now()/1E3},OutputLatency(){return this._outputLatency}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.TiledBg=class TiledBgPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;function WrapModeToStr(wrapMode){switch(wrapMode){case 0:return"clamp-to-edge";case 1:return"repeat";case 2:return"mirror-repeat"}return"repeat"}C3.Plugins.TiledBg.Type=class TiledBgType extends C3.SDKTypeBase{constructor(objectClass,exportData){super(objectClass);this._wrapX="repeat";this._wrapY="repeat";if(exportData){this._wrapX=WrapModeToStr(exportData[0]);this._wrapY=WrapModeToStr(exportData[1])}}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer, +{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const ORIGIN=1;const IMAGE_OFFSET_X=4;const IMAGE_OFFSET_Y=5;const IMAGE_SCALE_X=6;const IMAGE_SCALE_Y=7;const IMAGE_ANGLE=8;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const rcTex=C3.New(C3.Rect);const qTex=C3.New(C3.Quad);C3.Plugins.TiledBg.Instance=class TiledBgInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._imageOffsetX=0;this._imageOffsetY=0;this._imageScaleX=1;this._imageScaleY= +1;this._imageAngle=0;this._ownImageInfo=null;if(properties){this.GetWorldInfo().SetVisible(!!properties[INITIALLY_VISIBLE]);this._imageOffsetX=properties[IMAGE_OFFSET_X];this._imageOffsetY=properties[IMAGE_OFFSET_Y];this._imageScaleX=properties[IMAGE_SCALE_X];this._imageScaleY=properties[IMAGE_SCALE_Y];this._imageAngle=C3.toRadians(properties[IMAGE_ANGLE])}}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){if(this._ownImageInfo){this._ownImageInfo.Release();this._ownImageInfo=null}}CalculateTextureCoordsFor3DFace(areaWidth, +areaHeight,outQuad){const imageInfo=this.GetCurrentImageInfo();const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const imageAngle=this._imageAngle;rcTex.set(0,0,areaWidth/(imageWidth*this._imageScaleX),areaHeight/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(imageAngle===0)outQuad.setFromRect(rcTex);else outQuad.setFromRotatedRect(rcTex,-imageAngle)}Draw(renderer){const imageInfo= +this.GetCurrentImageInfo();const texture=imageInfo.GetTexture();if(texture===null)return;renderer.SetTexture(texture);const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const wi=this.GetWorldInfo();rcTex.set(0,0,wi.GetWidth()/(imageWidth*this._imageScaleX),wi.GetHeight()/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(wi.HasMesh())this._DrawMesh(wi, +renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=wi.GetBoundingQuad();if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);if(this._imageAngle===0)renderer.Quad3(quad,rcTex);else{qTex.setFromRotatedRect(rcTex,-this._imageAngle);renderer.Quad4(quad,qTex)}}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad;if(this._runtime.IsPixelRoundingEnabled())quad= +wi.PixelRoundQuad(quad);let texCoords=rcTex;if(this._imageAngle!==0){qTex.setFromRotatedRect(rcTex,-this._imageAngle);texCoords=qTex}transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,texCoords);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return true}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(true)}_SetImageOffsetX(x){if(this._imageOffsetX=== +x)return;this._imageOffsetX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(y){if(this._imageOffsetY===y)return;this._imageOffsetY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(x){if(this._imageScaleX===x)return;this._imageScaleX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(y){if(this._imageScaleY=== +y)return;this._imageScaleY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(a){if(this._imageAngle===a)return;this._imageAngle=a;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(index){switch(index){case IMAGE_OFFSET_X:return this._GetImageOffsetX();case IMAGE_OFFSET_Y:return this._GetImageOffsetY();case IMAGE_SCALE_X:return this._GetImageScaleX();case IMAGE_SCALE_Y:return this._GetImageScaleY(); +case IMAGE_ANGLE:return this._GetImageAngle()}}SetPropertyValueByIndex(index,value){switch(index){case IMAGE_OFFSET_X:this._SetImageOffsetX(value);break;case IMAGE_OFFSET_Y:this._SetImageOffsetY(value);break;case IMAGE_SCALE_X:this._SetImageScaleX(value);break;case IMAGE_SCALE_Y:this._SetImageScaleY(value);break;case IMAGE_ANGLE:this._SetImageAngle(value);break}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const map=new WeakMap;self.ITiledBackgroundInstance=class ITiledBackgroundInstance extends self.IWorldInstance{constructor(){super(); +map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageOffsetX(x)}get imageOffsetX(){return map.get(this)._GetImageOffsetX()}set imageOffsetY(y){C3X.RequireFiniteNumber(y);map.get(this)._SetImageOffsetY(y)}get imageOffsetY(){return map.get(this)._GetImageOffsetY()}set imageScaleX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageScaleX(x)}get imageScaleX(){return map.get(this)._GetImageScaleX()}set imageScaleY(y){C3X.RequireFiniteNumber(y); +map.get(this)._SetImageScaleY(y)}get imageScaleY(){return map.get(this)._GetImageScaleY()}set imageAngle(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(a)}get imageAngle(){return map.get(this)._GetImageAngle()}set imageAngleDegrees(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(C3.toRadians(a))}get imageAngleDegrees(){return C3.toDegrees(map.get(this)._GetImageAngle())}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}}} +{const C3=self.C3;C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return true},OnURLFailed(){return true}}} +{const C3=self.C3;C3.Plugins.TiledBg.Acts={SetImageOffsetX(x){this._SetImageOffsetX(x)},SetImageOffsetY(y){this._SetImageOffsetY(y)},SetImageScaleX(x){this._SetImageScaleX(x/100)},SetImageScaleY(y){this._SetImageScaleY(y/100)},SetImageAngle(a){this._SetImageAngle(C3.toRadians(a))},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},async LoadURL(url,crossOrigin){if(this._ownImageInfo&&this._ownImageInfo.GetURL()===url)return;const runtime=this._runtime;const imageInfo= +C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");if(this.WasReleased()){imageInfo.Release();return null}const texture=await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"});if(!texture)return}catch(err){console.error("Load image from URL failed: ",err);this.Trigger(C3.Plugins.TiledBg.Cnds.OnURLFailed);return}if(this.WasReleased()){imageInfo.Release(); +return}this._ReleaseOwnImage();this._ownImageInfo=imageInfo;runtime.UpdateRender();await this.TriggerAsync(C3.Plugins.TiledBg.Cnds.OnURLLoaded)}}}{const C3=self.C3;C3.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return this._imageScaleX*100},ImageScaleY(){return this._imageScaleY*100},ImageAngle(){return C3.toDegrees(this._imageAngle)}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Spritefont2=class SpriteFontPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Type=class SpriteFontType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass);this._spriteFont=C3.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(characterWidth,characterHeight, +characterSet,spacingData){const imageInfo=this.GetImageInfo();const sf=this._spriteFont;sf.SetWidth(imageInfo.GetWidth());sf.SetHeight(imageInfo.GetHeight());sf.SetCharacterWidth(characterWidth);sf.SetCharacterHeight(characterHeight);sf.SetCharacterSet(characterSet);sf.SetSpacingData(spacingData);sf.UpdateCharacterMap()}}} +{const C3=self.C3;const C3X=self.C3X;const TEXT=0;const ENABLE_BBCODE=1;const CHARACTER_WIDTH=2;const CHARACTER_HEIGHT=3;const CHARACTER_SET=4;const SPACING_DATA=5;const SCALE=6;const CHARACTER_SPACING=7;const LINE_HEIGHT=8;const HORIZONTAL_ALIGNMENT=9;const VERTICAL_ALIGNMENT=10;const WRAPPING=11;const INITIALLY_VISIBLE=12;const ORIGIN=13;const HORIZONTAL_ALIGNMENTS=["left","center","right"];const VERTICAL_ALIGNMENTS=["top","center","bottom"];const WORD_WRAP=0;const CHARACTER_WRAP=1;C3.Plugins.Spritefont2.Instance= +class SpriteFontInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._text="";this._enableBBcode=true;this._characterWidth=16;this._characterHeight=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";let spacingData="";this._characterScale=1;this._characterSpacing=0;this._lineHeight=0;this._horizontalAlign=0;this._verticalAlign=0;this._wrapByWord=true;this._spriteFontText=null;this._typewriterStartTime= +-1;this._typewriterEndTime=-1;this._typewriterLength=0;if(properties){this._text=properties[0];this._enableBBcode=properties[1];this._characterWidth=properties[2];this._characterHeight=properties[3];this._characterSet=properties[4];spacingData=properties[5];this._characterScale=properties[6];this._characterSpacing=properties[7];this._lineHeight=properties[8];this._horizontalAlign=properties[9];this._verticalAlign=properties[10];this._wrapByWord=properties[11]===0;const wi=this.GetWorldInfo();wi.SetVisible(properties[12])}this._sdkType.UpdateSettings(this._characterWidth, +this._characterHeight,this._characterSet,spacingData);this._spriteFontText=C3.New(self.SpriteFontText,this._sdkType.GetSpriteFont());const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._UpdateSettings();this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const sft=this._spriteFontText;if(!sft)return;sft.SetBBCodeEnabled(this._enableBBcode);sft.SetText(this._text); +sft.SetWordWrapMode(this._wrapByWord?"word":"character");sft.SetHorizontalAlign(HORIZONTAL_ALIGNMENTS[this._horizontalAlign]);sft.SetVerticalAlign(VERTICAL_ALIGNMENTS[this._verticalAlign]);sft.SetSpacing(this._characterSpacing);sft.SetLineHeight(this._lineHeight)}Draw(renderer){const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;renderer.SetTexture(texture);const wi=this.GetWorldInfo();let q=wi.GetBoundingQuad();const sft=this._spriteFontText;sft.SetScale(this._characterScale); +sft.SetSceneGraphScale(wi.GetSceneGraphScale());if(this._runtime.IsPixelRoundingEnabled())q=wi.PixelRoundQuad(q);sft.SetSize(wi.GetWidth(),wi.GetHeight());sft.GetSpriteFont().SetTexRect(imageInfo.GetTexRect());sft.SetColor(wi.GetUnpremultipliedColor());sft.Draw(renderer,q.getTlx(),q.getTly(),wi.GetAngle())}SaveToJson(){const ret={"t":this._text,"ebbc":this._enableBBcode,"csc":this._characterScale,"csp":this._characterSpacing,"lh":this._lineHeight,"ha":this._horizontalAlign,"va":this._verticalAlign, +"w":this._wrapByWord,"cw":this._sdkType.GetSpriteFont().GetCharacterWidth(),"ch":this._sdkType.GetSpriteFont().GetCharacterHeight(),"cs":this._sdkType.GetSpriteFont().GetCharacterSet(),"sd":this._sdkType.GetSpriteFont().GetSpacingData()};if(this._typewriterEndTime!==-1)ret["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime,"l":this._typewriterLength};return ret}LoadFromJson(o){this._CancelTypewriter();this._text=o["t"];this._enableBBcode=o["ebbc"];this._characterScale=o["csc"];this._characterSpacing= +o["csp"];this._lineHeight=o["lh"];this._horizontalAlign=o["ha"];this._verticalAlign=o["va"];this._wrapByWord=o["w"];if(o.hasOwnProperty("tw")){const tw=o["tw"];this._typewriterStartTime=tw["st"];this._typewriterEndTime=tw["en"];this._typewriterLength=o["l"]}const spriteFont=this._sdkType.GetSpriteFont();spriteFont.SetCharacterWidth(o["cw"]);spriteFont.SetCharacterHeight(o["ch"]);spriteFont.SetCharacterSet(o["cs"]);spriteFont.SetSpacingData(o["sd"]);this._UpdateSettings();if(this._typewriterEndTime!== +-1)this._StartTicking()}GetPropertyValueByIndex(index){switch(index){case TEXT:return this._text;case ENABLE_BBCODE:return this._enableBBcode;case CHARACTER_WIDTH:return this._sdkType.GetSpriteFont().GetCharacterWidth();case CHARACTER_HEIGHT:return this._sdkType.GetSpriteFont().GetCharacterHeight();case CHARACTER_SET:return this._sdkType.GetSpriteFont().GetCharacterSet();case SPACING_DATA:return this._sdkType.GetSpriteFont().GetSpacingData();case SCALE:return this._characterScale;case CHARACTER_SPACING:return this._characterSpacing; +case LINE_HEIGHT:return this._lineHeight;case HORIZONTAL_ALIGNMENT:return this._horizontalAlign;case VERTICAL_ALIGNMENT:return this._verticalAlign;case WRAPPING:return this._wrapByWord?CHARACTER_WRAP:WORD_WRAP}}SetPropertyValueByIndex(index,value){switch(index){case TEXT:if(this._text===value)return;this._text=value;this._UpdateSettings();break;case ENABLE_BBCODE:if(this._enableBBcode===!!value)return;this._enableBBcode=!!value;this._UpdateSettings();break;case CHARACTER_WIDTH:this._sdkType.GetSpriteFont().SetCharacterWidth(value); +break;case CHARACTER_HEIGHT:this._sdkType.GetSpriteFont().SetCharacterHeight(value);break;case CHARACTER_SET:this._sdkType.GetSpriteFont().SetCharacterSet(value);break;case SPACING_DATA:this._sdkType.GetSpriteFont().SetSpacingData(value);break;case SCALE:if(this._characterScale===value)return;this._characterScale=value;this._UpdateSettings();break;case CHARACTER_SPACING:if(this._characterSpacing===value)return;this._characterSpacing=value;this._UpdateSettings();break;case LINE_HEIGHT:if(this._lineHeight=== +value)return;this._lineHeight=value;this._UpdateSettings();break;case HORIZONTAL_ALIGNMENT:if(this._horizontalAlign===value)return;this._horizontalAlign=value;this._UpdateSettings();break;case VERTICAL_ALIGNMENT:if(this._verticalAlign===value)return;this._verticalAlign=value;this._UpdateSettings();break;case WRAPPING:if(this._wrapByWord===(value===WORD_WRAP))return;this._wrapByWord=value===WORD_WRAP;this._UpdateSettings();break}}_SetText(text){if(this._text===text)return;this._text=text;this._spriteFontText.SetText(text); +this._runtime.UpdateRender()}GetText(){return this._text}_StartTypewriter(text,duration){this._SetText(text);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+duration/this.GetInstance().GetActiveTimeScale();this._typewriterLength=C3.CountGraphemes(C3.BBString.StripAnyTags(text));this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength= +0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){if(this._typewriterEndTime===-1)return;this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}_SetScale(s){if(this._characterScale===s)return;this._characterScale=s;this._spriteFontText.SetScale(this._characterScale);this._runtime.UpdateRender()}_GetScale(){return this._characterScale}_SetCharacterSpacing(s){if(this._characterSpacing===s)return; +this._characterSpacing=s;this._spriteFontText.SetSpacing(this._characterSpacing);this._runtime.UpdateRender()}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(h){if(this._lineHeight===h)return;this._lineHeight=h;this._spriteFontText.SetLineHeight(this._lineHeight);this._runtime.UpdateRender()}_GetLineHeight(){return this._lineHeight}_SetHAlign(h){if(this._horizontalAlign===h)return;this._horizontalAlign=h;this._UpdateSettings();this._runtime.UpdateRender()}_GetHAlign(){return this._horizontalAlign}_SetVAlign(v){if(this._verticalAlign=== +v)return;this._verticalAlign=v;this._UpdateSettings();this._runtime.UpdateRender()}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(w){w=!!w;if(this._wrapByWord===w)return;this._wrapByWord=w;this._UpdateSettings();this._runtime.UpdateRender()}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._spriteFontText.SetScale(this._characterScale);return this._spriteFontText.GetTextWidth()}_GetTextHeight(){const wi= +this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._spriteFontText.SetScale(this._characterScale);return this._spriteFontText.GetTextHeight()}Tick(){const wallTime=this._runtime.GetWallTime();if(wallTime>=this._typewriterEndTime){this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}else{let displayLength=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,wallTime,0,this._typewriterLength); +displayLength=Math.floor(displayLength);if(displayLength!==this._spriteFontText.GetDrawMaxCharacterCount()){this._spriteFontText.SetDrawMaxCharacterCount(displayLength);this._runtime.UpdateRender()}}}GetDebuggerProperties(){const prefix="plugins.spritefont2";return[{title:prefix+".name",properties:[{name:prefix+".properties.text.name",value:this._text,onedit:v=>this._SetText(v)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const map=new WeakMap;const SCRIPT_HORIZONTAL_ALIGNMENTS= +new Map([["left",0],["center",1],["right",2]]);const SCRIPT_VERTICAL_ALIGNMENTS=new Map([["top",0],["center",1],["bottom",2]]);const SCRIPT_WRAP_MODES=new Map([["word",true],["character",false]]);self.ISpriteFontInstance=class ISpriteFontInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return map.get(this).GetText()}set text(str){C3X.RequireString(str);const inst=map.get(this);inst._CancelTypewriter();inst._SetText(str)}typewriterText(str, +duration){C3X.RequireString(str);C3X.RequireFiniteNumber(duration);const inst=map.get(this);inst._CancelTypewriter();inst._StartTypewriter(str,duration)}typewriterFinish(){map.get(this)._FinishTypewriter()}set characterScale(s){C3X.RequireFiniteNumber(s);map.get(this)._SetScale(s)}get characterScale(){return map.get(this)._GetScale()}set characterSpacing(s){C3X.RequireFiniteNumber(s);map.get(this)._SetCharacterSpacing(s)}get characterSpacing(){return map.get(this)._GetCharacterSpacing()}set lineHeight(lho){C3X.RequireFiniteNumber(lho); +map.get(this)._SetLineHeight(lho)}get lineHeight(){return map.get(this)._GetLineHeight()}set horizontalAlign(str){C3X.RequireString(str);const h=SCRIPT_HORIZONTAL_ALIGNMENTS.get(str);if(typeof h==="undefined")throw new Error("invalid mode");map.get(this)._SetHAlign(h)}get horizontalAlign(){return HORIZONTAL_ALIGNMENTS[map.get(this)._GetHAlign()]}set verticalAlign(str){C3X.RequireString(str);const v=SCRIPT_VERTICAL_ALIGNMENTS.get(str);if(typeof v==="undefined")throw new Error("invalid mode");map.get(this)._SetVAlign(v)}get verticalAlign(){return VERTICAL_ALIGNMENTS[map.get(this)._GetVAlign()]}set wordWrapMode(str){C3X.RequireString(str); +const isWrapByWord=SCRIPT_WRAP_MODES.get(str);if(typeof isWrapByWord==="undefined")throw new Error("invalid mode");map.get(this)._SetWrapByWord(isWrapByWord)}get wordWrapMode(){return map.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return map.get(this)._GetTextWidth()}get textHeight(){return map.get(this)._GetTextHeight()}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Cnds={CompareText(text,caseSensitive){if(caseSensitive)return this._text===text;else return C3.equalsNoCase(this._text,text)},IsRunningTypewriterText(){return this._typewriterEndTime!==-1},OnTypewriterTextFinished(){return true}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Acts={SetText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;this._SetText(param.toString())},AppendText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;param=param.toString();if(!param)return;this._SetText(this._text+param)},TypewriterText(param,duration){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/ +1E10;this._StartTypewriter(param.toString(),duration)},TypewriterFinish(){this._FinishTypewriter()},SetScale(s){this._SetScale(s)},SetCharacterSpacing(s){this._SetCharacterSpacing(s)},SetLineHeight(h){this._SetLineHeight(h)},SetCharacterWidth(chars,width){let didAnyChange=false;const spriteFont=this._sdkType.GetSpriteFont();for(const ch of chars)if(ch===" "){spriteFont.SetSpaceWidth(width);didAnyChange=true}else{const sfc=spriteFont.GetCharacter(ch);if(sfc){sfc.SetDisplayWidth(width);didAnyChange= +true}}if(didAnyChange)spriteFont.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},SetHAlign(h){this._SetHAlign(h)},SetVAlign(v){this._SetVAlign(v)},SetWrapping(w){this._SetWrapByWord(w===0)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Exps={CharacterWidth(ch){const sfc=this._sdkType.GetSpriteFont().GetCharacter(ch);if(sfc)return sfc.GetDisplayWidth();else return this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){if(this._enableBBcode)return C3.BBString.StripAnyTags(this._text); +else return this._text},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()}}}; + +} + +{ +'use strict';const C3=self.C3; +self.SpriteFontCharacter=class SpriteFontCharacter{constructor(spriteFont,char,x,y){let charWidth=spriteFont.GetCharacterWidth();let charHeight=spriteFont.GetCharacterHeight();this._spriteFont=spriteFont;this._char=char;this._pxRect=new C3.Rect(x,y,x+charWidth,y+charHeight);this._texRect=new C3.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._spriteFont=null;this._pxRect=null;this._texRect=null}_UpdateTexRect(){let w=this._spriteFont.GetWidth();let h=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect); +this._texRect.divide(w,h);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(w){this._displayWidth=w}GetDisplayWidth(){if(this._displayWidth<0)return this._spriteFont.GetCharacterWidth();else return this._displayWidth}}; + +} + +{ +'use strict';const C3=self.C3;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const tmpColor=new C3.Color;const VALID_HORIZ_ALIGNMENTS=new Set(["left","center","right"]);const VALID_VERT_ALIGNMENTS=new Set(["top","center","bottom"]);const VALID_WORD_WRAP_MODES=new Set(["word","character"]); +self.SpriteFontText=class SpriteFontText{constructor(spriteFont){this._spriteFont=spriteFont;this._cssWidth=0;this._cssHeight=0;this._text="";this._isBBcodeEnabled=false;this._bbString=null;this._wrappedText=C3.New(C3.WordWrap);this._wrapMode="word";this._wrapChanged=false;this._horizontalAlign="left";this._verticalAlign="top";this._scale=1;this._sceneGraphScale=1;this._spacing=0;this._lineHeight=0;this._color=C3.New(C3.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback= +(str,styles)=>this._MeasureText(str,styles);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._color=null;this._measureTextCallback=null;this._wrappedText.Clear();this._wrappedText=null;this._spriteFont=null;this._bbString=null}_MeasureText(chArr,styles){const scaleStyle=this._GetStyleTag(styles,"scale");const scale=(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle=this._GetStyleTag(styles,"scalex");const scaleX= +(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=this._GetStyleTag(styles,"scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const lineTotalHeight=this._spriteFont.GetCharacterHeight()*scaleY+this._lineHeight;const spriteFont=this.GetSpriteFont();const defaultCharWidth=spriteFont.GetCharacterWidth()*scaleX;const spacing=this.GetSpacing();if(spriteFont.HasAnyCustomWidths()){let strLen=0;let totalWidth=0;for(const ch of chArr){let charWidth=defaultCharWidth; +const sfc=spriteFont.GetCharacter(ch);if(sfc)charWidth=sfc.GetDisplayWidth()*scaleX;else if(ch===" ")charWidth=spriteFont.GetSpaceWidth()*scaleX;totalWidth+=charWidth;++strLen}return{width:totalWidth+strLen*spacing,height:lineTotalHeight}}else{const strLen=chArr.length;const spaceCount=Math.max(strLen,0);return{width:defaultCharWidth*strLen+spaceCount*spacing,height:lineTotalHeight}}}_SetWrapChanged(){this._wrapChanged=true;this._wrappedText.Clear()}SetSize(cssWidth,cssHeight){if(cssWidth<=0||cssHeight<= +0)return;if(this._cssWidth===cssWidth&&this._cssHeight===cssHeight)return;if(this._cssWidth!==cssWidth)this._SetWrapChanged();this._cssWidth=cssWidth;this._cssHeight=cssHeight}SetDrawMaxCharacterCount(n){this._drawMaxCharCount=Math.floor(n)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(styles,tag){for(let i=styles.length-1;i>=0;--i){const s=styles[i];if(s.tag===tag)return s}return null}_HasStyleTag(styles,tag){return!!this._GetStyleTag(styles,tag)}_MaybeWrapText(){if(!this._wrapChanged)return; +if(this._isBBcodeEnabled&&(!this._bbString||this._bbString.toString()!==this._text))this._bbString=new C3.BBString(this._text,{noEscape:true});const endOfLineMargin=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,endOfLineMargin);this._wrapChanged=false}Draw(renderer,offX,offY,angle){this._MaybeWrapText();this._drawCharCount=0;let penY=0;const lineSpaceHeight=this._lineHeight;const lines= +C3.cloneArray(this._wrappedText.GetLines());const sin_a=Math.sin(angle);const cos_a=Math.cos(angle);const linesTotalHeight=lines.reduce((a,v)=>a+v.height,0)-lineSpaceHeight;if(this._verticalAlign==="center")penY=Math.max(Math.floor(this._cssHeight/2-linesTotalHeight/2),0);else if(this._verticalAlign==="bottom")penY=Math.floor(this._cssHeight-linesTotalHeight);for(let i=0,len=lines.length;i0&&penY>this._cssHeight-(curLineTextHeight- +lineSpaceHeight))break;if(penY>=0)this._DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a);penY+=curLineTextHeight}}_DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a){const lineHeight=line.height;let penX=0;if(this._horizontalAlign==="center")penX=Math.max(Math.floor((this._cssWidth-line.width)/2),0);else if(this._horizontalAlign==="right")penX=Math.max(Math.floor(this._cssWidth-line.width),0);for(const frag of line.fragments){this._DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight); +penX+=frag.width}}_DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight){let chArr=frag.chArr;let fragWidth=frag.width;const styles=frag.styles;if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(chArr,styles).width}this._drawCharCount+=chArr.length}const backgroundStyle=this._GetStyleTag(styles,"background"); +if(C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle||this._HasStyleTag(styles,"hide"))return;const scaleStyle=this._GetStyleTag(styles,"scale");const scale=(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle=this._GetStyleTag(styles,"scalex");const scaleX=(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=this._GetStyleTag(styles,"scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const charHeight=this._spriteFont.GetCharacterHeight()* +scaleY;const lineSpaceHeight=this._lineHeight;penY+=lineHeight-lineSpaceHeight-charHeight;const offsetXStyle=this._GetStyleTag(styles,"offsetx");penX+=offsetXStyle?parseFloat(offsetXStyle.param):0;const offsetYStyle=this._GetStyleTag(styles,"offsety");penY+=offsetYStyle?parseFloat(offsetYStyle.param):0;if(backgroundStyle){renderer.SetColorFillMode();tmpColor.parseString(backgroundStyle.param);tmpColor.setA(1);renderer.SetColor(tmpColor);tmpRect.set(penX,penY,penX+fragWidth,penY+charHeight);if(tmpRect.getRight()> +this._cssWidth)tmpRect.setRight(this._cssWidth);tmpQuad.setFromRotatedRectPrecalc(tmpRect,sin_a,cos_a);tmpQuad.offset(offX,offY);renderer.Quad(tmpQuad);renderer.SetTextureFillMode()}const colorStyle=this._GetStyleTag(styles,"color");if(colorStyle){tmpColor.parseString(colorStyle.param);tmpColor.setA(this._color.getA())}else tmpColor.copy(this._color);const opacityStyle=this._GetStyleTag(styles,"opacity");if(opacityStyle)tmpColor.setA(tmpColor.getA()*parseFloat(opacityStyle.param)/100);tmpColor.premultiply(); +renderer.SetColor(tmpColor);const drawCharWidth=this._spriteFont.GetCharacterWidth()*scaleX;const endOfLineMargin=Math.abs(this.GetSpacing());for(const ch of chArr){const sfc=this._spriteFont.GetCharacter(ch);if(sfc){const layoutCharWidth=sfc.GetDisplayWidth()*scaleX;if(penX+layoutCharWidth>this._cssWidth+endOfLineMargin+1E-5)return;tmpRect.set(penX,penY,penX+drawCharWidth,penY+charHeight);tmpQuad.setFromRotatedRectPrecalc(tmpRect,sin_a,cos_a);tmpQuad.offset(offX,offY);renderer.Quad3(tmpQuad,sfc.GetTexRect()); +penX+=layoutCharWidth+this._spacing}else penX+=this._spriteFont.GetSpaceWidth()*scaleX+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(e){e=!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;this._SetWrapChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(text){if(this._text===text)return;this._text=text;this._SetWrapChanged()}SetWordWrapMode(w){if(!VALID_WORD_WRAP_MODES.has(w))throw new Error("invalid word wrap mode");if(this._wrapMode===w)return; +this._wrapMode=w;this._SetWrapChanged()}SetHorizontalAlign(a){if(!VALID_HORIZ_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._horizontalAlign=a}SetVerticalAlign(a){if(!VALID_VERT_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._verticalAlign=a}SetScale(s){if(this._scale===s)return;this._scale=s;this._SetWrapChanged()}GetScale(){return this._scale}SetSceneGraphScale(s){if(this._sceneGraphScale===s)return;this._sceneGraphScale=s;this._SetWrapChanged()}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(s){if(this._spacing=== +s)return;this._spacing=s;this._SetWrapChanged()}GetSpacing(){return this._spacing}SetLineHeight(h){this._lineHeight=h;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(o){o=C3.clamp(o,0,1);this._color.a=o}SetColor(c){if(this._color.equals(c))return;this._color.copy(c)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const lineTextHeight=this._spriteFont.GetCharacterHeight()*this._scale; +const lineSpaceHeight=this._lineHeight;const lineTotalHeight=lineTextHeight+lineSpaceHeight;return this._wrappedText.GetLineCount()*lineTotalHeight-lineSpaceHeight}}; + +} + +{ +'use strict';const C3=self.C3;const SpriteFontText=self.SpriteFontText;const DEFAULT_SPRITEFONT_OPTS={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""}; +self.SpriteFont=class SpriteFont{constructor(opts){opts=Object.assign({},DEFAULT_SPRITEFONT_OPTS,opts);if(opts.width<=0||opts.height<=0||opts.characterWidth<=0||opts.characterHeight<=0)throw new Error("invalid size");this._width=opts.width;this._height=opts.height;this._characterWidth=opts.characterWidth;this._characterHeight=opts.characterHeight;this._characterSet=opts.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=false;this._spaceWidth=-1;this._texRect=new C3.Rect(0, +0,1,1);this._characterMap=new Map;this._mapChanged=true;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;if(this._allTexts)this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let c of this._characterMap.values())c.Release();this._characterMap.clear()}_AddSpriteFontText(sft){this._allTexts.add(sft)}_RemoveSpriteFontText(sft){this._allTexts.delete(sft)}UpdateCharacterMap(){if(!this._mapChanged)return;this._ReleaseCharacters();let charSetArr= +C3.SplitGraphemes(this._characterSet);let cols=Math.floor(this._width/this._characterWidth);let rows=Math.floor(this._height/this._characterHeight);let last=cols*rows;for(let i=0,len=charSetArr.length;i=last)break;let char=charSetArr[i];if(this._characterMap.has(char))continue;let x=i%cols;let y=Math.floor(i/cols);this._characterMap.set(char,C3.New(self.SpriteFontCharacter,this,char,x*this._characterWidth,y*this._characterHeight))}this._hasAnyCustomWidths=false;this._spaceWidth=-1; +if(Array.isArray(this._spacingParsed))for(let entry of this._spacingParsed){if(!Array.isArray(entry))continue;if(entry.length!==2)continue;let charWidth=entry[0];let str=entry[1];if(typeof charWidth!=="number"||!isFinite(charWidth)||typeof str!=="string")continue;if(charWidth===this._characterWidth)continue;for(let ch of str){let sfc=this._characterMap.get(ch);if(sfc){sfc.SetDisplayWidth(charWidth);this._hasAnyCustomWidths=true}else if(ch===" "){this._spaceWidth=charWidth;this._hasAnyCustomWidths= +true}}}this._mapChanged=false;for(let sft of this._allTexts)sft._SetWrapChanged()}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=true;for(const sft of this._allTexts)sft._SetWrapChanged()}GetCharacter(ch){this.UpdateCharacterMap();return this._characterMap.get(ch)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._width===w)return;this._width=w;this._mapChanged=true}GetWidth(){return this._width}SetHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._height===h)return;this._height=h;this._mapChanged=true}GetHeight(){return this._height}SetTexRect(rc){if(this._texRect.equals(rc))return;this._texRect.copy(rc);for(const sfc of this._characterMap.values())sfc._UpdateTexRect()}GetTexRect(){return this._texRect}SetCharacterWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._characterWidth===w)return;this._characterWidth=w;this._mapChanged=true}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._characterHeight===h)return;this._characterHeight=h;this._mapChanged=true}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(s){if(this._characterSet===s)return;this._characterSet=s;this._mapChanged=true}GetCharacterSet(){return this._characterSet}SetSpacingData(s){if(this._spacingData===s)return;this._spacingData=s;this._mapChanged=true;this._spacingParsed=null;if(this._spacingData.length)try{this._spacingParsed=JSON.parse(this._spacingData)}catch(e){this._spacingParsed= +null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(w){if(w<0)w=-1;if(this._spaceWidth===w)return;this._spaceWidth=w;if(this._spaceWidth>=0)this._hasAnyCustomWidths=true}GetSpaceWidth(){if(this._spaceWidth<0)return this._characterWidth;else return this._spaceWidth}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Arr=class ArrayPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Arr.Type=class ArrayType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;function ResizeArray(arr,len,data){if(lenarr.length)if(typeof data==="function")for(let i=arr.length;iC3.MakeFilledArray(this._cy,()=>C3.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(x,y,z){x=Math.floor(x);y=Math.floor(y);z=Math.floor(z);if(x>=0&&x=0&&y=0&&z=0&&x=0&&y=0&&zC3.MakeFilledArray(h,()=>C3.MakeFilledArray(d,0)));for(let x=0;xC3.MakeFilledArray(d,0));for(let y=0;ythis.SetSize(v,this._cy,this._cz)},{name:propsPrefix+".height.name",value:this._cy,onedit:v=>this.SetSize(this._cx,v,this._cz)},{name:propsPrefix+".depth.name",value:this._cz,onedit:v=>this.SetSize(this._cx,this._cy,v)},{name:propsPrefix+".elements.name",value:this._cx*this._cy*this._cz}]}];const dataProps=[];if(this._cy=== +1&&this._cz===1)for(let x=0;xthis._arr[x][0][0]=v});else for(let x=0;x=0&&this._forDepth=0&&this._forDepth=0&&this._forDepthsb)return 1;else return 0}}C3.Plugins.Arr.Acts={Clear(v){const cx=this._cx;const cy=this._cy;const cz=this._cz;const arr=this._arr;for(let x=0;xC3.MakeFilledArray(cz,value));if(where===0)arr.push(add);else arr.unshift(add);this._cx++}else if(axis===1){for(let x=0;xCompareValues(a[0][0],b[0][0]));else if(axis===1)for(let x=0;xCompareValues(a[0],b[0]));else for(let x=0;x=cx)return;arr.splice(index,1);this._cx--}else if(axis===1){if(index>=cy)return;for(let x=0;x=cz)return;for(let x=0;xcx)return;arr.splice(index,0,C3.MakeFilledArray(cy,()=>C3.MakeFilledArray(cz,value)));this._cx++}else if(axis===1){if(index>cy)return;for(let x=0;xcz)return;for(let x=0;x=0;--x)if(arr[x][0][0]===v)return x;return-1},AsJSON(){return this.GetAsJsonString()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Mouse=class MousePlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Mouse.Type=class MouseType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IMouseObjectType}};let mouseObjectType=null;function GetMouseSdkInstance(){return mouseObjectType.GetSingleGlobalInstance().GetSdkInstance()}self.IMouseObjectType=class IMouseObjectType extends self.IObjectClass{constructor(objectType){super(objectType);mouseObjectType=objectType;objectType.GetRuntime()._GetCommonScriptInterfaces().mouse= +this}getMouseX(layerNameOrNumber){return GetMouseSdkInstance().GetMousePositionForLayer(layerNameOrNumber)[0]}getMouseY(layerNameOrNumber){return GetMouseSdkInstance().GetMousePositionForLayer(layerNameOrNumber)[1]}getMousePosition(layerNameOrNumber){return GetMouseSdkInstance().GetMousePositionForLayer(layerNameOrNumber)}isMouseButtonDown(button){return GetMouseSdkInstance().IsMouseButtonDown(button)}}} +{const C3=self.C3;const DOM_COMPONENT_ID="mouse";C3.Plugins.Mouse.Instance=class MouseInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst,DOM_COMPONENT_ID);this._buttonMap=[false,false,false];this._mouseXcanvas=0;this._mouseYcanvas=0;this._triggerButton=0;this._triggerType=0;this._triggerDir=0;this._wheelDeltaX=0;this._wheelDeltaY=0;this._wheelDeltaZ=0;this._hasPointerLock=false;this._movementX=0;this._movementY=0;this.AddDOMMessageHandlers([["pointer-lock-change",e=>this._OnPointerLockChange(e)], +["pointer-lock-error",e=>this._OnPointerLockError(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data)),C3.Disposable.From(rt,"dblclick",e=>this._OnDoubleClick(e.data)),C3.Disposable.From(rt,"wheel",e=>this._OnMouseWheel(e.data)),C3.Disposable.From(rt,"window-blur", +()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(e){if(e["pointerType"]!=="mouse")return;this._mouseXcanvas=e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerMove(e){this._movementX=e["movementX"];this._movementY=e["movementY"];this.Trigger(C3.Plugins.Mouse.Cnds.OnMovement);this._movementX=0;this._movementY=0;if(e["pointerType"]!=="mouse")return;this._mouseXcanvas= +e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerUp(e){if(e["pointerType"]!=="mouse")return;this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_CheckButtonChanges(lastButtons,buttons){this._CheckButtonChange(lastButtons,buttons,1,0);this._CheckButtonChange(lastButtons,buttons,4,1);this._CheckButtonChange(lastButtons,buttons,2,2)}_CheckButtonChange(lastButtons,buttons,checkButtonFlag, +resultButton){if(!(lastButtons&checkButtonFlag)&&buttons&checkButtonFlag)this._OnMouseDown(resultButton);else if(lastButtons&checkButtonFlag&&!(buttons&checkButtonFlag))this._OnMouseUp(resultButton)}_OnMouseDown(button){this._buttonMap[button]=true;this.Trigger(C3.Plugins.Mouse.Cnds.OnAnyClick);this._triggerButton=button;this._triggerType=0;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(button){if(!this._buttonMap[button])return;this._buttonMap[button]= +false;this._triggerButton=button;this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}_OnDoubleClick(e){this._triggerButton=e["button"];this._triggerType=1;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(e){this._triggerDir=e["deltaY"]<0?1:0;this._wheelDeltaX=e["deltaX"];this._wheelDeltaY=e["deltaY"];this._wheelDeltaZ=e["deltaZ"];this.Trigger(C3.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let i=0,len=this._buttonMap.length;i=0&&this._mouseYcanvas>=0&&this._mouseXcanvas({name:"$"+layer.GetName(),value:layer.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}} +{const C3=self.C3;C3.Plugins.Mouse.Cnds={OnClick(button,type){return this._triggerButton===button&&this._triggerType===type},OnAnyClick(){return true},IsButtonDown(button){return this._buttonMap[button]},OnRelease(button){return this._triggerButton===button},IsOverObject(objectClass){if(!this._IsMouseOverCanvas())return false;const cnd=this._runtime.GetCurrentCondition();const isInverted=cnd.IsInverted();const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return C3.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +mx,my,isInverted),isInverted)},OnObjectClicked(button,type,objectClass){if(button!==this._triggerButton||type!==this._triggerType)return false;if(!this._IsMouseOverCanvas())return false;const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,mx,my,false)},OnWheel(dir){return dir===2||this._triggerDir===dir},OnPointerLocked(){return true},OnPointerUnlocked(){return true},OnPointerLockError(){return true},HasPointerLock(){return this._hasPointerLock}, +OnMovement(){return true}}} +{const C3=self.C3;let lastSetCursor=null;const CURSOR_STYLES=["auto","pointer","text","crosshair","move","help","wait","none"];C3.Plugins.Mouse.Acts={SetCursor(c){const cursorStyle=CURSOR_STYLES[c];if(lastSetCursor===cursorStyle)return;lastSetCursor=cursorStyle;this.PostToDOM("cursor",cursorStyle)},SetCursorSprite(objectClass){if(C3.Platform.IsMobile||!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst)return;const wi=inst.GetWorldInfo();const imageInfo=inst.GetCurrentImageInfo(); +if(!wi||!imageInfo)return;if(lastSetCursor===imageInfo)return;lastSetCursor=imageInfo;imageInfo.ExtractImageToBlobURL().then(blobUrl=>{const cursorStyle=`url(${blobUrl}) ${Math.round(wi.GetOriginX()*imageInfo.GetWidth())} ${Math.round(wi.GetOriginY()*imageInfo.GetHeight())}, auto`;this.PostToDOM("cursor","");this.PostToDOM("cursor",cursorStyle)})},RequestPointerLock(){this._PostToDOMMaybeSync("request-pointer-lock")},ReleasePointerLock(){this.PostToDOM("release-pointer-lock")}}} +{const C3=self.C3;C3.Plugins.Mouse.Exps={X(layerParam){return this.GetMousePositionForLayer(layerParam)[0]},Y(layerParam){return this.GetMousePositionForLayer(layerParam)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas},MovementX(){return this._movementX},MovementY(){return this._movementY},WheelDeltaX(){return this._wheelDeltaX},WheelDeltaY(){return this._wheelDeltaY},WheelDeltaZ(){return this._wheelDeltaZ}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Particles=class ParticlesPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Particles.Type=class ParticlesType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const RATE=0;const SPRAY_CONE=1;const TYPE=2;const SPAWNOBJECTCLASS=3;const SPEED=4;const SIZE=5;const OPACITY=6;const GROW_RATE=7;const X_RANDOMISER=8;const Y_RANDOMISER=9;const INITIAL_SPEED_RANDOMISER=10;const SIZE_RANDOMISER=11;const GROW_RATE_RANDOMISER=12;const ACCELERATION=13;const GRAVITY=14;const ANGLE_RANDOMISER=15;const LIFE_SPEED_RANDOMISER=16;const OPACITY_RANDOMISER=17;const DESTROY_MODE=18;const TIMEOUT=19;const CONTINUOUS=0;const ONE_SHOT=1;const tempRect= +C3.New(C3.Rect);C3.Plugins.Particles.Instance=class ParticlesInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._isFirstTick=true;const pe=C3.New(self.ParticleEngine);this._particleEngine=pe;pe.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(inst,dx,dy,dSize,dAngle,dOpacity)=>this._OnParticleUpdate(inst,dx,dy,dSize,dAngle,dOpacity);this._particleDestroyCallback=inst=>this._OnParticleDestroy(inst);this._hasAnyDefaultParticle= +true;if(properties){pe.SetRate(properties[RATE]);pe.SetSprayCone(C3.toRadians(properties[SPRAY_CONE]));pe.SetSprayType(properties[TYPE]?"one-shot":"continuous-spray");this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(properties[SPAWNOBJECTCLASS]));pe.SetInitSpeed(properties[SPEED]);pe.SetInitSize(properties[SIZE]);pe.SetInitOpacity(properties[OPACITY]/100);pe.SetGrowRate(properties[GROW_RATE]);pe.SetInitXRandom(properties[X_RANDOMISER]);pe.SetInitYRandom(properties[Y_RANDOMISER]);pe.SetInitSpeedRandom(properties[INITIAL_SPEED_RANDOMISER]); +pe.SetInitSizeRandom(properties[SIZE_RANDOMISER]);pe.SetGrowRandom(properties[GROW_RATE_RANDOMISER]);pe.SetAcceleration(properties[ACCELERATION]);pe.SetGravity(properties[GRAVITY]);pe.SetLifeAngleRandom(properties[ANGLE_RANDOMISER]);pe.SetLifeSpeedRandom(properties[LIFE_SPEED_RANDOMISER]);pe.SetLifeOpacityRandom(properties[OPACITY_RANDOMISER]);pe.SetDestroyModeIndex(properties[DESTROY_MODE]);pe.SetTimeout(properties[TIMEOUT])}this._UpdateEngineParameters();if(this._spawnObjectClass)this._hasAnyDefaultParticle= +false;if(pe.GetSprayType()==="one-shot")pe.CreateOneShotSpray();else pe.SetSpraying(true);const wi=this.GetWorldInfo();wi.SetBboxChangeEventEnabled(true);this._inst.Dispatcher().addEventListener("bboxchange",()=>{wi.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});if(this.GetRuntime().GetRenderer().IsWebGPU())wi.SetUsePointsShaderProgram();this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad);this._StartTicking()}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload", +this._afterLoad);this._afterLoad=null;this._particleEngine.Release();this._particleEngine=null;this._particleUpdateCallback=null;this._particleDestroyCallback=null;super.Release()}GetParticleEngine(){return this._particleEngine}_SetRate(r){this._particleEngine.SetRate(r);if(this._particleEngine.GetSprayType()==="one-shot"&&this._isFirstTick)this._particleEngine.SetParticleCount(r)}_SetParticleObjectClass(objectClass){if(objectClass===this.GetObjectClass())objectClass=null;if(objectClass===this._spawnObjectClass)return; +this._spawnObjectClass=objectClass;this._particleEngine.onparticlecreate=objectClass?p=>this._OnParticleCreate(p):null;if(!this._spawnObjectClass)this._hasAnyDefaultParticle=true}_UpdateEngineParameters(){const pe=this._particleEngine;const wi=this.GetWorldInfo();pe.SetMasterOpacity(wi.GetOpacity());pe.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());pe.SetSpawnX(wi.GetX());pe.SetSpawnY(wi.GetY());pe.SetSpawnAngle(wi.GetAngle());pe.SetInitSizeScale(wi.GetSceneGraphScale())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(renderer){if(!this._hasAnyDefaultParticle)return; +const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;const wi=this.GetWorldInfo();const layer=wi.GetLayer();const viewport=tempRect;if(this._runtime.GetCanvasManager().IsPastingToDrawingCanvas())viewport.set(-Infinity,-Infinity,Infinity,Infinity);else if(layer.Has3DCamera())layer.CalculateViewport3D(wi.GetTotalZElevation(),viewport);else layer.GetViewportForZ(wi.GetTotalZElevation(),viewport);renderer.SetTexture(texture);const zScaleFactor=layer.Get2DScaleFactorToZ(wi.GetTotalZElevation()); +this._particleEngine.SetParticleScale(layer.GetRenderScale()*zScaleFactor);this._particleEngine.Draw(renderer,imageInfo.GetTexRect(),viewport,layer.Has3DCamera())}SaveToJson(){const pe=this._particleEngine;return{"r":pe.GetRate(),"sc":pe.GetSprayCone(),"st":pe.GetSprayType(),"isp":pe.GetInitSpeed(),"isz":pe.GetInitSize(),"io":pe.GetInitOpacity(),"gr":pe.GetGrowRate(),"xr":pe.GetInitXRandom(),"yr":pe.GetInitYRandom(),"spr":pe.GetInitSpeedRandom(),"szr":pe.GetInitSizeRandom(),"grnd":pe.GetGrowRandom(), +"acc":pe.GetAcceleration(),"g":pe.GetGravity(),"lar":pe.GetLifeAngleRandom(),"lsr":pe.GetLifeSpeedRandom(),"lor":pe.GetLifeOpacityRandom(),"dm":pe.GetDestroyModeIndex(),"to":pe.GetTimeout(),"s":pe.IsSpraying(),"pcc":pe._GetCreateCounter(),"ft":this._isFirstTick,"soc":this._spawnObjectClass?this._spawnObjectClass.GetSID():null,"p":pe.GetParticles().map(p=>p.toJSON())}}LoadFromJson(o,mode){const pe=this._particleEngine;pe.SetRate(o["r"]);pe.SetSprayCone(o["sc"]);pe.SetSprayType(o["st"]);pe.SetInitSpeed(o["isp"]); +pe.SetInitSize(o["isz"]);pe.SetInitOpacity(o["io"]);pe.SetGrowRate(o["gr"]);pe.SetInitXRandom(o["xr"]);pe.SetInitYRandom(o["yr"]);pe.SetInitSpeedRandom(o["spr"]);pe.SetInitSizeRandom(o["szr"]);pe.SetGrowRandom(o["grnd"]);pe.SetAcceleration(o["acc"]);pe.SetGravity(o["g"]);pe.SetLifeAngleRandom(o["lar"]);pe.SetLifeSpeedRandom(o["lsr"]);pe.SetLifeOpacityRandom(o["lor"]);pe.SetDestroyModeIndex(o["dm"]);pe.SetTimeout(o["to"]);pe.SetSpraying(o["s"]);pe._SetCreateCounter(o["pcc"]);this._isFirstTick=o["ft"]; +if(o.hasOwnProperty("soc")){const objectClass=this.GetRuntime().GetObjectClassBySID(o["soc"]);if(objectClass)this._SetParticleObjectClass(objectClass)}const particlesData=o["p"];pe.SetParticleCount(particlesData.length);const particles=pe.GetParticles();for(let i=0,len=particles.length;ipe.SetSpraying(v)},{name:propPrefix+".rate.name",value:pe.GetRate(),onedit:v=>pe.SetRate(v)},{name:propPrefix+".spray-cone.name",value:C3.toDegrees(pe.GetSprayCone()),onedit:v=>pe.SetSprayCone(C3.toRadians(v))},{name:propPrefix+".speed.name",value:pe.GetInitSpeed(),onedit:v=> +pe.SetInitSpeed(v)},{name:propPrefix+".size.name",value:pe.GetInitSize(),onedit:v=>pe.SetInitSize(v)},{name:propPrefix+".opacity.name",value:pe.GetInitOpacity(),onedit:v=>pe.SetInitOpacity(v)},{name:propPrefix+".grow-rate.name",value:pe.GetGrowRate(),onedit:v=>pe.SetGrowRate(v)},{name:propPrefix+".x-randomiser.name",value:pe.GetInitXRandom(),onedit:v=>pe.SetInitXRandom(v)},{name:propPrefix+".y-randomiser.name",value:pe.GetInitYRandom(),onedit:v=>pe.SetInitYRandom(v)},{name:propPrefix+".initial-speed-randomiser.name", +value:pe.GetInitSpeedRandom(),onedit:v=>pe.SetInitSpeedRandom(v)},{name:propPrefix+".size-randomiser.name",value:pe.GetInitSizeRandom(),onedit:v=>pe.SetInitSizeRandom(v)},{name:propPrefix+".grow-rate-randomiser.name",value:pe.GetGrowRandom(),onedit:v=>pe.SetGrowRandom(v)},{name:propPrefix+".acceleration.name",value:pe.GetAcceleration(),onedit:v=>pe.SetAcceleration(v)},{name:propPrefix+".gravity.name",value:pe.GetGravity(),onedit:v=>pe.SetGravity(v)},{name:propPrefix+".angle-randomiser.name",value:pe.GetLifeAngleRandom(), +onedit:v=>pe.SetLifeAngleRandom(v)},{name:propPrefix+".life-speed-randomiser.name",value:pe.GetLifeSpeedRandom(),onedit:v=>pe.SetLifeSpeedRandom(v)},{name:propPrefix+".opacity-randomiser.name",value:pe.GetLifeOpacityRandom(),onedit:v=>pe.SetLifeOpacityRandom(v)},{name:propPrefix+".timeout.name",value:pe.GetTimeout(),onedit:v=>pe.SetTimeout(v)}]}]}GetScriptInterfaceClass(){return self.IParticlesInstance}};const map=new WeakMap;function GetParticleEngine(iinst){return map.get(iinst).GetParticleEngine()} +self.IParticlesInstance=class IParticlesInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set isSpraying(s){GetParticleEngine(this).SetSpraying(!!s)}get isSpraying(){return GetParticleEngine(this).IsSpraying()}set rate(r){C3X.RequireFiniteNumber(r);map.get(this)._SetRate(r)}get rate(){return GetParticleEngine(this).GetRate()}set sprayCone(c){C3X.RequireFiniteNumber(c);GetParticleEngine(this).SetSprayCone(c)}get sprayCone(){return GetParticleEngine(this).GetSprayCone()}set initSpeed(s){C3X.RequireFiniteNumber(s); +GetParticleEngine(this).SetInitSpeed(s)}get initSpeed(){return GetParticleEngine(this).GetInitSpeed()}set initSize(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSize(s)}get initSize(){return GetParticleEngine(this).GetInitSize()}set initOpacity(o){C3X.RequireFiniteNumber(o);GetParticleEngine(this).SetInitOpacity(o)}get initOpacity(){return GetParticleEngine(this).GetInitOpacity()}set initXRandom(x){C3X.RequireFiniteNumber(x);GetParticleEngine(this).SetInitXRandom(x)}get initXRandom(){return GetParticleEngine(this).GetInitXRandom()}set initYRandom(y){C3X.RequireFiniteNumber(y); +GetParticleEngine(this).SetInitYRandom(y)}get initYRandom(){return GetParticleEngine(this).GetInitYRandom()}set initSpeedRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSpeedRandom(s)}get initSpeedRandom(){return GetParticleEngine(this).GetInitSpeedRandom()}set initSizeRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSizeRandom(s)}get initSizeRandom(){return GetParticleEngine(this).GetInitSizeRandom()}set initGrowRate(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetGrowRate(r)}get initGrowRate(){return GetParticleEngine(this).GetGrowRate()}set initGrowRandom(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetGrowRandom(r)}get initGrowRandom(){return GetParticleEngine(this).GetGrowRandom()}set acceleration(a){C3X.RequireFiniteNumber(a);GetParticleEngine(this).SetAcceleration(a)}get acceleration(){return GetParticleEngine(this).GetAcceleration()}set gravity(g){C3X.RequireFiniteNumber(g);GetParticleEngine(this).SetGravity(g)}get gravity(){return GetParticleEngine(this).GetGravity()}set lifeAngleRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeAngleRandom(r)}get lifeAngleRandom(){return GetParticleEngine(this).GetLifeAngleRandom()}set lifeSpeedRandom(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetLifeSpeedRandom(r)}get lifeSpeedRandom(){return GetParticleEngine(this).GetLifeSpeedRandom()}set lifeOpacityRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeOpacityRandom(r)}get lifeOpacityRandom(){return GetParticleEngine(this).GetLifeOpacityRandom()}set timeout(t){C3X.RequireFiniteNumber(t);GetParticleEngine(this).SetTimeout(t)}get timeout(){return GetParticleEngine(this).GetTimeout()}setParticleObjectClass(iObjectClass){const inst=map.get(this);if(iObjectClass)inst._SetParticleObjectClass(inst.GetRuntime()._UnwrapIObjectClass(iObjectClass)); +else inst._SetParticleObjectClass(null)}}}{const C3=self.C3;C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}}} +{const C3=self.C3;C3.Plugins.Particles.Acts={SetSpraying(s){this._particleEngine.SetSpraying(s!==0)},SetRate(r){this._SetRate(r)},SetParticleObject(objectClass){this._SetParticleObjectClass(objectClass)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(c){this._particleEngine.SetSprayCone(C3.toRadians(c))},SetInitSpeed(x){this._particleEngine.SetInitSpeed(x)},SetInitSize(x){this._particleEngine.SetInitSize(x)},SetInitOpacity(x){this._particleEngine.SetInitOpacity(x/100)},SetGrowRate(x){this._particleEngine.SetGrowRate(x)}, +SetXRandomiser(x){this._particleEngine.SetInitXRandom(x)},SetYRandomiser(x){this._particleEngine.SetInitYRandom(x)},SetSpeedRandomiser(x){this._particleEngine.SetInitSpeedRandom(x)},SetSizeRandomiser(x){this._particleEngine.SetInitSizeRandom(x)},SetGrowRateRandomiser(x){this._particleEngine.SetGrowRandom(x)},SetParticleAcc(x){this._particleEngine.SetAcceleration(x)},SetGravity(x){this._particleEngine.SetGravity(x)},SetAngleRandomiser(x){this._particleEngine.SetLifeAngleRandom(x)},SetLifeSpeedRandomiser(x){this._particleEngine.SetLifeSpeedRandom(x)}, +SetOpacityRandomiser(x){this._particleEngine.SetLifeOpacityRandom(x)},SetTimeout(x){this._particleEngine.SetTimeout(x)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return C3.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return this._particleEngine.GetInitOpacity()*100},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()}, +YRandom(){return this._particleEngine.GetInitYRandom()},InitSizeRandom(){return this._particleEngine.GetInitSizeRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()}, +ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}}}; + +} + +{ +'use strict';const C3=self.C3;const inactiveParticles=[];const MAX_RECYCLE_PARTICLES=1E3;const VALID_SPRAY_TYPES=new Set(["continuous-spray","one-shot"]);const DESTROY_MODES=["fade-to-invisible","timeout-expired","particle-stopped"]; +self.ParticleEngine=class ParticleEngine{constructor(){this._rate=0;this._sprayCone=0;this._sprayType="continuous-spray";this._isSpraying=false;this._masterOpacity=0;this._isPixelRounding=false;this._spawnX=0;this._spawnY=0;this._spawnAngle=0;this._initSpeed=0;this._initSize=0;this._initSizeScale=1;this._initOpacity=0;this._growRate=0;this._xRandom=0;this._yRandom=0;this._initSpeedRandom=0;this._initSizeRandom=0;this._growRandom=0;this._acceleration=0;this._gravity=0;this._lifeAngleRandom=0;this._lifeSpeedRandom= +0;this._lifeOpacityRandom=0;this._destroyMode=0;this._timeout=0;this._createCounter=0;this._particleScale=1;this.ononeshotfinish=null;this.onparticlecreate=null;this._particles=[];this._boundingBox=new C3.Rect;this._color=new C3.Color}Release(){this.Cancel();C3.clearArray(this._particles);this._particles=null;this.ononeshotfinish=null;this.onparticlecreate=null;this._boundingBox=null;this._boundingBox=null;this._color=null}Cancel(){const particles=this._particles;for(let i=0,len=particles.length;i< +len;++i)particles[i].Destroy();C3.appendArray(inactiveParticles,particles);C3.clearArray(particles);if(inactiveParticles.length>MAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES);this._isSpraying=false}CreateOneShotSpray(){for(let i=0,len=this._rate;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}else if(c>particles.length){const diff=c-particles.length;for(let i=0;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}_MaybeFinishOneShot(){if(this._sprayType==="one-shot"&&this._particles.length===0&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=false}}Draw(renderer,texRect,viewport,forceQuads){renderer.StartRenderingPoints(texRect);this._color.copy(renderer.GetColor()); +const particles=this._particles;for(let i=0,len=particles.length;i=1&&(engine.GetDestroyModeIndex()===2?this._speed>0:this._agerenderer.GetMaxPointSize()||scaledSizethis._OnPermissionResult(e));const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data,false)),C3.Disposable.From(rt, +"pointercancel",e=>this._OnPointerUp(e.data,true)),C3.Disposable.From(rt,"deviceorientation",e=>this._OnDeviceOrientation(e.data)),C3.Disposable.From(rt,"deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e.data)),C3.Disposable.From(rt,"devicemotion",e=>this._OnDeviceMotion(e.data)),C3.Disposable.From(rt,"tick2",e=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(e){if(e["pointerType"]==="mouse")if(this._useMouseInput)this._isMouseDown=true;else return; +const pointerId=e["pointerId"];if(this._touches.has(pointerId))return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();const nowTime=performance.now();const index=this._touches.size;this._triggerIndex=index;this._triggerId=pointerId;const touchInfo=C3.New(C3.Plugins.Touch.TouchInfo);touchInfo.Init(nowTime,x,y,pointerId,index);this._touches.set(pointerId,touchInfo);this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchStart); +this._curTouchX=x;this._curTouchY=y;this.Trigger(C3.Plugins.Touch.Cnds.OnTouchObject)}_OnPointerMove(e){if(e["pointerType"]==="mouse"&&!this._isMouseDown)return;const touchInfo=this._touches.get(e["pointerId"]);if(!touchInfo)return;const nowTime=performance.now();if(nowTime-touchInfo.GetTime()<2)return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();touchInfo.Update(nowTime,x,y,e["width"],e["height"],e["pressure"])}_OnPointerUp(e,isCancel){if(e["pointerType"]=== +"mouse")if(this._isMouseDown)this._isMouseDown=false;else return;const nowTime=performance.now();const pointerId=e["pointerId"];const touchInfo=this._touches.get(pointerId);if(!touchInfo)return;this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchEnd);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchEnd);if(!isCancel){const tap=touchInfo.ShouldTriggerTap(nowTime);if(tap==="single-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnTapGesture); +this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnTapGestureObject)}else if(tap==="double-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGestureObject)}}touchInfo.Release();this._touches.delete(pointerId)}_RequestPermission(type){this._PostToDOMMaybeSync("request-permission",{"type":type});return new Promise((resolve,reject)=> +{this._permissionPromises.push({type,resolve,reject})})}_OnPermissionResult(e){const isGranted=e["result"];const type=e["type"];this._triggerPermission=type;const toResolve=this._permissionPromises.filter(o=>o.type===type);for(const o of toResolve)o.resolve(isGranted?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(o=>o.type!==type);if(isGranted){this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionGranted);if(type===0)this._runtime.RequestDeviceOrientationEvent();else this._runtime.RequestDeviceMotionEvent()}else this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(e){if(typeof e["webkitCompassHeading"]=== +"number")this._orientCompassHeading=e["webkitCompassHeading"];else if(e["absolute"])this._orientCompassHeading=e["alpha"];this._orientAlpha=e["alpha"];this._orientBeta=e["beta"];this._orientGamma=e["gamma"]}_OnDeviceOrientationAbsolute(e){this._orientCompassHeading=e["alpha"]}_OnDeviceMotion(e){const acc=e["acceleration"];if(acc){this._accX=acc["x"];this._accY=acc["y"];this._accZ=acc["z"]}const withG=e["accelerationIncludingGravity"];if(withG){this._accWithGX=withG["x"];this._accWithGY=withG["y"]; +this._accWithGZ=withG["z"]}}_OnTick2(){const nowTime=performance.now();let index=0;for(const touchInfo of this._touches.values()){if(touchInfo.GetTime()<=nowTime-50)touchInfo._SetLastTime(nowTime);if(touchInfo.ShouldTriggerHold(nowTime)){this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this._getTouchIndex=index;this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGestureObject); +this._getTouchIndex=0}++index}}_GetTouchByIndex(index){index=Math.floor(index);for(const touchInfo of this._touches.values()){if(index===0)return touchInfo;--index}return null}_IsClientPosOnCanvas(touchX,touchY){return touchX>=0&&touchY>=0&&touchX({name:"$"+ti.GetId(),value:ti.GetX()+ +", "+ti.GetY()}))}]}}} +{const C3=self.C3;const tempArr=[];C3.Plugins.Touch.Cnds={OnTouchStart(){return true},OnTouchEnd(){return true},IsInTouch(){return this._touches.size>0},OnTouchObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},IsTouchingObject(objectClass){if(!objectClass)return false;const interactiveLayersCache=new Map; +const isLayerInteractive=layer=>{let ret=interactiveLayersCache.get(layer);if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();if(!isLayerInteractive(layer)||!wi.IsInViewport2())continue;for(const touchInfo of this._touches.values()){if(!this._IsClientPosOnCanvas(touchInfo.GetX(), +touchInfo.GetY()))continue;const [px,py]=layer.CanvasCssToLayer(touchInfo.GetX(),touchInfo.GetY(),wi.GetTotalZElevation());if(wi.ContainsPoint(px,py)){tempArr.push(inst);break}}}interactiveLayersCache.clear();if(tempArr.length){sol.SetArrayPicked(tempArr);objectClass.ApplySolToContainer();C3.clearArray(tempArr);return true}else return false},CompareTouchSpeed(index,cmp,s){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return false;return C3.compare(touchInfo.GetSpeed(),cmp,s)},OrientationSupported(){return true}, +MotionSupported(){return true},CompareOrientation(orientation,cmp,a){this._runtime.RequestDeviceOrientationEvent();let v=0;if(orientation===0)v=this._orientAlpha;else if(orientation===1)v=this._orientBeta;else v=this._orientGamma;return C3.compare(v,cmp,a)},CompareAcceleration(a,cmp,x){this._runtime.RequestDeviceMotionEvent();let v=0;if(a===0)v=this._accWithGX;else if(a===1)v=this._accWithGY;else if(a===2)v=this._accWithGZ;else if(a===3)v=this._accX;else if(a===4)v=this._accY;else v=this._accZ;return C3.compare(v, +cmp,x)},OnNthTouchStart(index){index=Math.floor(index);return index===this._triggerIndex},OnNthTouchEnd(index){index=Math.floor(index);return index===this._triggerIndex},HasNthTouch(index){index=Math.floor(index);return this._touches.size>=index+1},OnHoldGesture(){return true},OnTapGesture(){return true},OnDoubleTapGesture(){return true},OnHoldGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},OnDoubleTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnPermissionGranted(type){return this._triggerPermission===type},OnPermissionDenied(type){return this._triggerPermission===type}}}{const C3=self.C3;C3.Plugins.Touch.Acts={RequestPermission(type){this._RequestPermission(type)}}} +{const C3=self.C3;C3.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},Y(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XForID(id,layerParam){const touchInfo=this._touches.get(id);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YForID(id,layerParam){const touchInfo=this._touches.get(id); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},AbsoluteX(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteY(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYAt(index){const touchInfo=this._GetTouchByIndex(index); +if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetY();else return 0},SpeedAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetSpeed();else return 0},SpeedForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetSpeed();else return 0},AngleAt(index){const touchInfo= +this._GetTouchByIndex(index);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},AngleForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},Alpha(){this._runtime.RequestDeviceOrientationEvent();return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent(); +return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();return this._accX},AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ}, +TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetWidth();else return 0},HeightForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetHeight();else return 0},PressureForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetPressure();else return 0}}}; + +} + +{ +'use strict';const C3=self.C3;const GESTURE_HOLD_THRESHOLD=15;const GESTURE_HOLD_TIMEOUT=500;const GESTURE_TAP_TIMEOUT=333;const GESTURE_DOUBLETAP_THRESHOLD=25;let lastTapX=-1E3;let lastTapY=-1E3;let lastTapTime=-1E4; +C3.Plugins.Touch.TouchInfo=class TouchInfo extends C3.DefendedBase{constructor(){super();this._pointerId=0;this._startIndex=0;this._startTime=0;this._time=0;this._lastTime=0;this._startX=0;this._startY=0;this._x=0;this._y=0;this._lastX=0;this._lastY=0;this._width=0;this._height=0;this._pressure=0;this._hasTriggeredHold=false;this._isTooFarForHold=false}Release(){}Init(nowTime,x,y,id,index){this._pointerId=id;this._startIndex=index;this._time=nowTime;this._lastTime=nowTime;this._startTime=nowTime; +this._startX=x;this._startY=y;this._x=x;this._y=y;this._lastX=x;this._lastY=y}Update(nowTime,x,y,width,height,pressure){this._lastTime=this._time;this._time=nowTime;this._lastX=this._x;this._lastY=this._y;this._x=x;this._y=y;this._width=width;this._height=height;this._pressure=pressure;if(!this._isTooFarForHold&&C3.distanceTo(this._startX,this._startY,this._x,this._y)>=GESTURE_HOLD_THRESHOLD)this._isTooFarForHold=true}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(t){this._lastTime= +t}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const dist=C3.distanceTo(this._x,this._y,this._lastX,this._lastY);const dt=(this._time-this._lastTime)/1E3;if(dt>0)return dist/dt;else return 0}GetAngle(){return C3.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(nowTime){if(this._hasTriggeredHold)return false;if(nowTime-this._startTime>=GESTURE_HOLD_TIMEOUT&&!this._isTooFarForHold&& +C3.distanceTo(this._startX,this._startY,this._x,this._y)this._OnOnlineStateChanged(e)], +["backbutton",()=>this._OnBackButton()],["sw-message",e=>this._OnSWMessage(e)],["hashchange",e=>this._OnHashChange(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),C3.Disposable.From(rt,"window-resize",()=>this._OnWindowResize()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state", +{"exportType":this._runtime.GetExportType()}).then(data=>{this._initLocationStr=data["location"];this._isOnline=data["isOnline"];this._referrer=data["referrer"];this._docTitle=data["title"];this._isCookieEnabled=data["isCookieEnabled"];this._screenWidth=data["screenWidth"];this._screenHeight=data["screenHeight"];this._windowOuterWidth=data["windowOuterWidth"];this._windowOuterHeight=data["windowOuterHeight"];this._isConstructArcade=data["isConstructArcade"]}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(e){const isOnline= +!!e["isOnline"];if(this._isOnline===isOnline)return;this._isOnline=isOnline;if(this._isOnline)await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOnline);else await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOffline)}async _OnWindowResize(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(e){const messageType= +e["type"];if(messageType==="downloading-update")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateFound);else if(messageType==="update-ready"||messageType==="update-pending")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateReady);else if(messageType==="offline-ready")this.Trigger(C3.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(e){this._initLocationStr=e["location"];this.Trigger(C3.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){const prefix="plugins.browser.debugger";return[{title:"plugins.browser.name", +properties:[{name:prefix+".user-agent",value:navigator.userAgent},{name:prefix+".is-online",value:this._isOnline},{name:prefix+".is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}} +{const C3=self.C3;C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return true},OnOffline(){return true},OnResize(){return true},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return true},IsPortraitLandscape(p){const lastInnerWidth=this._runtime.GetCanvasManager().GetLastWidth();const lastInnerHeight=this._runtime.GetCanvasManager().GetLastHeight();const current=lastInnerWidth<=lastInnerHeight? +0:1;return current===p},OnUpdateFound(){return true},OnUpdateReady(){return true},OnOfflineReady(){return true},OnHashChange(){return true},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return true},OnPageVisible(){return true},HasJava(){return false},IsDownloadingUpdate(){return false},OnMenuButton(){return false},OnSearchButton(){return false},IsMetered(){return false},IsCharging(){return true},SupportsFullscreen(){return true}}} +{const C3=self.C3;const ORIENTATIONS=["portrait","landscape","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];C3.Plugins.Browser.Acts={Alert(message){this.PostToDOM("alert",{"message":message.toString()})},Close(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())self.C3Debugger.CloseWindow();else this.PostToDOM("close")},Focus(){this.PostToDOM("set-focus",{"isFocus":true})},Blur(){this.PostToDOM("set-focus",{"isFocus":false})},GoBack(){if(this._isConstructArcade)return; +this.PostToDOM("navigate",{"type":"back"})},GoForward(){if(this._isConstructArcade)return;this.PostToDOM("navigate",{"type":"forward"})},GoHome(){},Reload(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())this._runtime.PostToDebugger({"type":"reload"});else this.PostToDOM("navigate",{"type":"reload"})},GoToURL(url,target){this._PostToDOMMaybeSync("navigate",{"type":"url","url":url,"target":target,"exportType":this._runtime.GetExportType()})},GoToURLWindow(url,tag){this._PostToDOMMaybeSync("navigate", +{"type":"new-window","url":url,"tag":tag,"exportType":this._runtime.GetExportType()})},RequestFullScreen(mode,navUi){if(mode>=2)mode+=1;if(mode===6)mode=2;if(mode===1)mode=0;const modeStr=C3.CanvasManager._FullscreenModeNumberToString(mode);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(modeStr);this._PostToDOMMaybeSync("request-fullscreen",{"navUI":navUi})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(pattern){const arr=pattern.split(",");for(let i=0,len=arr.length;i< +len;++i)arr[i]=parseInt(arr[i],10);this._PostToDOMMaybeSync("vibrate",{"pattern":arr})},async InvokeDownload(url,filename){if(!url||!filename)return;const urlToDownload=await this._runtime.GetAssetManager().GetProjectFileUrl(url);this._runtime.InvokeDownload(urlToDownload,filename)},InvokeDownloadString(str,mimeType,filename){if(!filename)return;const dataUri=`data:${mimeType},${encodeURIComponent(str)}`;this._runtime.InvokeDownload(dataUri,filename)},ConsoleLog(type,msg){msg=msg.toString();if(type=== +0)console.log(msg);else if(type===1)console.warn(msg);else if(type===2)console.error(msg)},ConsoleGroup(name){console.group(name)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(jsStr){try{eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}},LockOrientation(o){o=Math.floor(o);if(o<0||o>=ORIENTATIONS.length)return;const orientation=ORIENTATIONS[o];this._PostToDOMMaybeSync("lock-orientation",{"orientation":orientation})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")}, +LoadStyleSheet(url){this._runtime.GetAssetManager().LoadStyleSheet(url)},async SetDocumentCSSStyle(propName,value,selector,type){await this.PostToDOMAsync("set-document-css-style",{"prop":C3.CSSToCamelCase(propName),"value":value,"selector":selector,"is-all":type!==0})},async GetDocumentCSSStyle(propName,selector,tag){const ret=await this.PostToDOMAsync("get-document-css-style",{"prop":propName,"selector":selector});if(ret["isOk"])this._cssStyleMap.set(tag.toLowerCase(),ret["result"].trim())},SetHash(h){this.PostToDOM("set-hash", +{"hash":h})}}} +{const C3=self.C3;C3.Plugins.Browser.Exps={URL(){if(this._runtime.IsInWorker())return this._initLocationStr;else return location.toString()},Protocol(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).protocol;else return location.protocol},Domain(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hostname;else return location.hostname},Port(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).port;else return location.port},PathName(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).pathname; +else return location.pathname},Hash(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hash;else return location.hash},QueryString(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).search;else return location.search},QueryParam(param){const search=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;const match=RegExp("[?&]"+param+"=([^&]*)").exec(search);if(match)return decodeURIComponent(match[1].replace(/\+/g," "));else return""}, +Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(jsStr){let result=0;try{result=eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}if(typeof result==="number"||typeof result==="string")return result;if(typeof result==="boolean")return result?1:0;else return 0},CSSStyleValue(tag){return this._cssStyleMap.get(tag)||""},Name(){return navigator.appName}, +Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const connection=navigator["connection"];if(connection)return connection["downlink"]||connection["downlinkMax"]||connection["bandwidth"]||Infinity;else return Infinity},ConnectionType(){const connection=navigator["connection"];if(connection)return connection["type"]||"unknown";else return"unknown"},DevicePixelRatio(){return self.devicePixelRatio}, +ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Text=class TextPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Text.Type=class TextType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}LoadTextures(renderer){}ReleaseTextures(){}}} +{const C3=self.C3;const C3X=self.C3X;const TEMP_COLOR_ARRAY=[0,0,0];const TEXT=0;const ENABLE_BBCODE=1;const FONT=2;const SIZE=3;const LINE_HEIGHT=4;const BOLD=5;const ITALIC=6;const COLOR=7;const HORIZONTAL_ALIGNMENT=8;const VERTICAL_ALIGNMENT=9;const WRAPPING=10;const INITIALLY_VISIBLE=11;const ORIGIN=12;const HORIZONTAL_ALIGNMENTS=["left","center","right"];const VERTICAL_ALIGNMENTS=["top","center","bottom"];const WORD_WRAP=0;const CHARACTER_WRAP=1;const tempRect=new C3.Rect;const tempQuad=new C3.Quad; +const tempColor=new C3.Color;C3.Plugins.Text.Instance=class TextInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._text="";this._enableBBcode=true;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isBold=false;this._isItalic=false;this._color=C3.New(C3.Color);this._horizontalAlign=0;this._verticalAlign=0;this._wrapByWord=true;this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;this._rendererText=C3.New(C3.Gfx.RendererText, +this._runtime.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(false);if(properties){this._text=properties[TEXT];this._enableBBcode=!!properties[ENABLE_BBCODE];this._faceName=properties[FONT];this._ptSize=properties[SIZE];this._lineHeightOffset=properties[LINE_HEIGHT];this._isBold=!!properties[BOLD];this._isItalic=!!properties[ITALIC];this._horizontalAlign=properties[HORIZONTAL_ALIGNMENT];this._verticalAlign=properties[VERTICAL_ALIGNMENT]; +this._wrapByWord=properties[WRAPPING]===WORD_WRAP;const v=properties[COLOR];this._color.setRgb(v[0],v[1],v[2]);this.GetWorldInfo().SetVisible(properties[INITIALLY_VISIBLE])}this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const rendererText=this._rendererText;rendererText.SetText(this._text);rendererText.SetBBCodeEnabled(this._enableBBcode);rendererText.SetFontName(this._faceName);rendererText.SetLineHeight(this._lineHeightOffset); +rendererText.SetBold(this._isBold);rendererText.SetItalic(this._isItalic);rendererText.SetColor(this._color);rendererText.SetHorizontalAlignment(HORIZONTAL_ALIGNMENTS[this._horizontalAlign]);rendererText.SetVerticalAlignment(VERTICAL_ALIGNMENTS[this._verticalAlign]);rendererText.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const wi=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(wi.GetSceneGraphScale());const layer=wi.GetLayer(); +const textZoom=layer.GetRenderScale()*layer.Get2DScaleFactorToZ(wi.GetTotalZElevation());this._rendererText.SetSize(wi.GetWidth(),wi.GetHeight(),textZoom)}Draw(renderer){const wi=this.GetWorldInfo();this._UpdateTextSize();const texture=this._rendererText.GetTexture();if(!texture)return;const layer=wi.GetLayer();if(wi.GetAngle()===0&&layer.GetAngle()===0&&wi.GetTotalZElevation()===0&&!wi.HasMesh()&&layer.RendersIn2DMode()){const quad=wi.GetBoundingQuad();const [dl,dt]=layer.LayerToDrawSurface(quad.getTlx(), +quad.getTly());const [dr,db]=layer.LayerToDrawSurface(quad.getBrx(),quad.getBry());const offX=dl-Math.round(dl);const offY=dt-Math.round(dt);tempRect.set(dl,dt,dr,db);tempRect.offset(-offX,-offY);tempQuad.setFromRect(tempRect);const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(renderer,rtWidth,rtHeight);renderer.SetTexture(texture);renderer.Quad3(tempQuad,this._rendererText.GetTexRect());layer._SetTransform(renderer)}else{renderer.SetTexture(texture); +if(wi.HasMesh())this._DrawMesh(wi,renderer);else this._DrawStandard(wi,renderer)}}_DrawStandard(wi,renderer){let quad=wi.GetBoundingQuad();if(this._runtime.IsPixelRoundingEnabled())quad=this._PixelRoundQuad(quad);renderer.Quad3(quad,this._rendererText.GetTexRect())}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad;if(this._runtime.IsPixelRoundingEnabled())quad=this._PixelRoundQuad(quad);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(), +quad,this._rendererText.GetTexRect());wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}_PixelRoundQuad(quad){const offX=quad.getTlx()-Math.round(quad.getTlx());const offY=quad.getTly()-Math.round(quad.getTly());if(offX===0&&offY===0)return quad;else{tempQuad.copy(quad);tempQuad.offset(-offX,-offY);return tempQuad}}GetCurrentSurfaceSize(){const texture=this._rendererText.GetTexture();if(texture)return[texture.GetWidth(),texture.GetHeight()];else return[100,100]}GetCurrentTexRect(){return this._rendererText.GetTexRect()}IsCurrentTexRotated(){return false}SaveToJson(){const o= +{"t":this._text,"c":this._color.toJSON(),"fn":this._faceName,"ps":this._ptSize};if(this._enableBBcode)o["bbc"]=this._enableBBcode;if(this._horizontalAlign!==0)o["ha"]=this._horizontalAlign;if(this._verticalAlign!==0)o["va"]=this._verticalAlign;if(!this._wrapByWord)o["wr"]=this._wrapByWord;if(this._lineHeightOffset!==0)o["lho"]=this._lineHeightOffset;if(this._isBold)o["b"]=this._isBold;if(this._isItalic)o["i"]=this._isItalic;if(this._typewriterEndTime!==-1)o["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime, +"l":this._typewriterLength};return o}LoadFromJson(o){this._CancelTypewriter();this._text=o["t"],this._color.setFromJSON(o["c"]);this._faceName=o["fn"],this._ptSize=o["ps"];this._enableBBcode=o.hasOwnProperty("bbc")?o["bbc"]:false;this._horizontalAlign=o.hasOwnProperty("ha")?o["ha"]:0;this._verticalAlign=o.hasOwnProperty("va")?o["va"]:0;this._wrapByWord=o.hasOwnProperty("wr")?o["wr"]:true;this._lineHeightOffset=o.hasOwnProperty("lho")?o["lho"]:0;this._isBold=o.hasOwnProperty("b")?o["b"]:false;this._isItalic= +o.hasOwnProperty("i")?o["i"]:false;if(o.hasOwnProperty("tw")){const tw=o["tw"];this._typewriterStartTime=tw["st"];this._typewriterEndTime=tw["en"];this._typewriterLength=tw["l"]}this._UpdateTextSettings();if(this._typewriterEndTime!==-1)this._StartTicking()}GetPropertyValueByIndex(index){switch(index){case TEXT:return this._text;case ENABLE_BBCODE:return this._enableBBcode;case FONT:return this._faceName;case SIZE:return this._ptSize;case LINE_HEIGHT:return this._lineHeightOffset;case BOLD:return this._isBold; +case ITALIC:return this._isItalic;case COLOR:TEMP_COLOR_ARRAY[0]=this._color.getR();TEMP_COLOR_ARRAY[1]=this._color.getG();TEMP_COLOR_ARRAY[2]=this._color.getB();return TEMP_COLOR_ARRAY;case HORIZONTAL_ALIGNMENT:return this._horizontalAlign;case VERTICAL_ALIGNMENT:return this._verticalAlign;case WRAPPING:return this._wrapByWord?CHARACTER_WRAP:WORD_WRAP}}SetPropertyValueByIndex(index,value){switch(index){case TEXT:if(this._text===value)return;this._text=value;this._UpdateTextSettings();break;case ENABLE_BBCODE:if(this._enableBBcode=== +!!value)return;this._enableBBcode=!!value;this._UpdateTextSettings();break;case FONT:if(this._faceName===value)return;this._faceName=value;this._UpdateTextSettings();break;case SIZE:if(this._ptSize===value)return;this._ptSize=value;this._UpdateTextSettings();break;case LINE_HEIGHT:if(this._lineHeightOffset===value)return;this._lineHeightOffset=value;this._UpdateTextSettings();break;case BOLD:if(this._isBold===!!value)return;this._isBold=!!value;this._UpdateTextSettings();break;case ITALIC:if(this._isItalic=== +!!value)return;this._isItalic=!!value;this._UpdateTextSettings();break;case COLOR:const c=this._color;const v=value;if(c.getR()===v[0]&&c.getG()===v[1]&&c.getB()===v[2])return;this._color.setRgb(v[0],v[1],v[2]);this._UpdateTextSettings();break;case HORIZONTAL_ALIGNMENT:if(this._horizontalAlign===value)return;this._horizontalAlign=value;this._UpdateTextSettings();break;case VERTICAL_ALIGNMENT:if(this._verticalAlign===value)return;this._verticalAlign=value;this._UpdateTextSettings();break;case WRAPPING:if(this._wrapByWord=== +(value===WORD_WRAP))return;this._wrapByWord=value===WORD_WRAP;this._UpdateTextSettings();break}}SetPropertyColorOffsetValueByIndex(index,r,g,b){if(r===0&&g===0&&b===0)return;switch(index){case COLOR:this._color.addRgb(r,g,b);this._UpdateTextSettings();break}}_SetText(text){if(this._text===text)return;this._text=text;this._rendererText.SetText(text);this._runtime.UpdateRender()}GetText(){return this._text}_StartTypewriter(text,duration){this._SetText(text);this._typewriterStartTime=this._runtime.GetWallTime(); +this._typewriterEndTime=this._typewriterStartTime+duration/this.GetInstance().GetActiveTimeScale();this._typewriterLength=C3.CountGraphemes(C3.BBString.StripAnyTags(text));this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){if(this._typewriterEndTime===-1)return;this._CancelTypewriter();this.Trigger(C3.Plugins.Text.Cnds.OnTypewriterTextFinished); +this._runtime.UpdateRender()}_SetFontFace(face){if(this._faceName===face)return;this._faceName=face;this._rendererText.SetFontName(face);this._runtime.UpdateRender()}_GetFontFace(){return this._faceName}_SetBold(b){b=!!b;if(this._isBold===b)return;this._isBold=b;this._rendererText.SetBold(b);this._runtime.UpdateRender()}_IsBold(){return this._isBold}_SetItalic(i){i=!!i;if(this._isItalic===i)return;this._isItalic=i;this._rendererText.SetItalic(i);this._runtime.UpdateRender()}_IsItalic(){return this._isItalic}_SetFontSize(size){if(this._ptSize=== +size)return;this._ptSize=size;this._runtime.UpdateRender()}_GetFontSize(){return this._ptSize}_SetFontColor(color){if(this._color.equalsIgnoringAlpha(color))return;this._color.copyRgb(color);this._rendererText.SetColor(this._color);this._runtime.UpdateRender()}_GetFontColor(){return this._color}_SetLineHeight(lho){if(this._lineHeightOffset===lho)return;this._lineHeightOffset=lho;this._UpdateTextSettings();this._runtime.UpdateRender()}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(h){if(this._horizontalAlign=== +h)return;this._horizontalAlign=h;this._UpdateTextSettings();this._runtime.UpdateRender()}_GetHAlign(){return this._horizontalAlign}_SetVAlign(v){if(this._verticalAlign===v)return;this._verticalAlign=v;this._UpdateTextSettings();this._runtime.UpdateRender()}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(w){w=!!w;if(this._wrapByWord===w)return;this._wrapByWord=w;this._UpdateTextSettings();this._runtime.UpdateRender()}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){this._UpdateTextSize(); +return this._rendererText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()}Tick(){const wallTime=this._runtime.GetWallTime();if(wallTime>=this._typewriterEndTime){this._CancelTypewriter();this.Trigger(C3.Plugins.Text.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}else{let displayLength=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,wallTime,0,this._typewriterLength);displayLength=Math.floor(displayLength);if(displayLength!== +this._rendererText.GetDrawMaxCharacterCount()){this._rendererText.SetDrawMaxCharacterCount(displayLength);this._runtime.UpdateRender()}}}GetDebuggerProperties(){const prefix="plugins.text";return[{title:prefix+".name",properties:[{name:prefix+".properties.text.name",value:this._text,onedit:v=>this._SetText(v)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const map=new WeakMap;const SCRIPT_HORIZONTAL_ALIGNMENTS=new Map([["left",0],["center",1],["right",2]]);const SCRIPT_VERTICAL_ALIGNMENTS= +new Map([["top",0],["center",1],["bottom",2]]);const SCRIPT_WRAP_MODES=new Map([["word",true],["character",false]]);self.ITextInstance=class ITextInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return map.get(this).GetText()}set text(str){C3X.RequireString(str);const inst=map.get(this);inst._CancelTypewriter();inst._SetText(str)}typewriterText(str,duration){C3X.RequireString(str);C3X.RequireFiniteNumber(duration);const inst= +map.get(this);inst._CancelTypewriter();inst._StartTypewriter(str,duration)}typewriterFinish(){map.get(this)._FinishTypewriter()}set fontFace(str){C3X.RequireString(str);map.get(this)._SetFontFace(str)}get fontFace(){return map.get(this)._GetFontFace()}set isBold(b){map.get(this)._SetBold(b)}get isBold(){return map.get(this)._IsBold()}set isItalic(i){map.get(this)._SetItalic(i)}get isItalic(){return map.get(this)._IsItalic()}set sizePt(pt){C3X.RequireFiniteNumber(pt);map.get(this)._SetFontSize(pt)}get sizePt(){return map.get(this)._GetFontSize()}set fontColor(arr){C3X.RequireArray(arr); +if(arr.length<3)throw new Error("expected 3 elements");tempColor.setRgb(arr[0],arr[1],arr[2]);map.get(this)._SetFontColor(tempColor)}get fontColor(){const c=map.get(this)._GetFontColor();return[c.getR(),c.getG(),c.getB()]}set lineHeight(lho){C3X.RequireFiniteNumber(lho);map.get(this)._SetLineHeight(lho)}get lineHeight(){return map.get(this)._GetLineHeight()}set horizontalAlign(str){C3X.RequireString(str);const h=SCRIPT_HORIZONTAL_ALIGNMENTS.get(str);if(typeof h==="undefined")throw new Error("invalid mode"); +map.get(this)._SetHAlign(h)}get horizontalAlign(){return HORIZONTAL_ALIGNMENTS[map.get(this)._GetHAlign()]}set verticalAlign(str){C3X.RequireString(str);const v=SCRIPT_VERTICAL_ALIGNMENTS.get(str);if(typeof v==="undefined")throw new Error("invalid mode");map.get(this)._SetVAlign(v)}get verticalAlign(){return VERTICAL_ALIGNMENTS[map.get(this)._GetVAlign()]}set wordWrapMode(str){C3X.RequireString(str);const isWrapByWord=SCRIPT_WRAP_MODES.get(str);if(typeof isWrapByWord==="undefined")throw new Error("invalid mode"); +map.get(this)._SetWrapByWord(isWrapByWord)}get wordWrapMode(){return map.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return map.get(this)._GetTextWidth()}get textHeight(){return map.get(this)._GetTextHeight()}}}{const C3=self.C3;C3.Plugins.Text.Cnds={CompareText(str,caseSensitive){if(caseSensitive)return this._text===str;else return C3.equalsNoCase(this._text,str)},IsRunningTypewriterText(){return this._typewriterEndTime!==-1},OnTypewriterTextFinished(){return true}}} +{const C3=self.C3;const tempColor=C3.New(C3.Color);C3.Plugins.Text.Acts={SetText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;this._SetText(param.toString())},AppendText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;param=param.toString();if(!param)return;this._SetText(this._text+param)},TypewriterText(param,duration){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param= +Math.round(param*1E10)/1E10;this._StartTypewriter(param.toString(),duration)},SetFontFace(face,style){let bold=false;let italic=false;switch(style){case 1:bold=true;break;case 2:italic=true;break;case 3:bold=true;italic=true;break}if(face===this._faceName&&bold===this._isBold&&italic===this._isItalic)return;this._SetFontFace(face);this._SetBold(bold);this._SetItalic(italic)},SetFontSize(size){this._SetFontSize(size)},SetFontColor(rgb){tempColor.setFromRgbValue(rgb);tempColor.clamp();this._SetFontColor(tempColor)}, +SetWebFont(familyName,cssUrl){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(lho){this._SetLineHeight(lho)},SetHAlign(h){this._SetHAlign(h)},SetVAlign(v){this._SetVAlign(v)},SetWrapping(w){this._SetWrapByWord(w===0)}}} +{const C3=self.C3;C3.Plugins.Text.Exps={Text(){return this._text},PlainText(){if(this._enableBBcode)return C3.BBString.StripAnyTags(this._text);else return this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Tween=class TweenBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Tween.Type=class TweenType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const ENABLED=0;NAMESPACE.Instance=class TweenInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._allowMultiple=false;this._enabled=true;if(properties){this._allowMultiple=false;this._enabled=!!properties[ENABLED]}this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._finishingTween=null;this._activeTweensJson=null;this._disabledTweensJson=null;this._waitingForReleaseTweensJson= +null;this._finishingTweenName="";if(this._enabled)this._StartTicking2();this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;if(this._finishingTween){this.ReleaseAndCompleteTween(this._finishingTween);this._finishingTween=null}this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null; +this._ReleaseWaitingTweens();this._waitingForReleaseTweens=null;super.Release()}SetEnabled(e){this._enabled=!!e;if(e)this._StartTicking2();else this._StopTicking2();for(const tween of this.AllTweens())if(e){if(this.IsInDisabledList(tween))tween.Resume()}else{if(tween.IsPlaying()||tween.IsScheduled())this.AddToDisabledList(tween);tween.Stop()}if(e)this.ClearDisabledList()}IsEnabled(){return this._enabled}AddToDisabledList(tween){this._disabledTweens.push(tween)}IsInDisabledList(tween){return this._disabledTweens.includes(tween)}ClearDisabledList(){C3.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const inst= +this.GetObjectInstance();if(!inst)return false;return!inst.IsDestroyed()}GetTween(tags,property,includeWaitingForRelease=false){const tweens=property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(!tweens||!tweens.length)return;for(const tween of tweens)if(tween.HasTags(tags))return tween}GetTweenIncludingWaitingForRelease(tags,property){return this.GetTween(tags,property,true)}*GetTweens(tags,property,includeWaitingForRelease=false){const tweens= +property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(tweens&&tweens.length)for(const tween of tweens)if(tween.HasTags(tags))yield tween}*GetTweensIncludingWaitingForRelease(tags,property){yield*this.GetTweens(tags,property,true)}PropertyTweens(property,includeWaitingForRelease){if(includeWaitingForRelease){let active=this._activeTweens.get(property);let waitingForRelease=this._waitingForReleaseTweens.get(property);if(!active)active=[];if(!waitingForRelease)waitingForRelease= +[];return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{let active=this._activeTweens.get(property);if(!active)active=[];return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweens(includeWaitingForRelease){if(includeWaitingForRelease){const active=[...this._activeTweens.values()].flat();const waitingForRelease=[...this._waitingForReleaseTweens.values()].flat();return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{const active=[...this._activeTweens.values()].flat(); +return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweensIncludingWaitingForRelease(){return this.AllTweens(true)}SaveToJson(){return{"s":false,"e":!!this._enabled,"at":this._SaveActiveTweensToJson(),"dt":this._SaveDisabledTweensToJson(),"wt":this._SaveWaitingForReleaseTweensToJson(),"ft":this._SaveFinishingTweenToJson()}}LoadFromJson(o){if(!o)return;this._activeTweensJson=o["at"];this._disabledTweensJson=o["dt"];this._waitingForReleaseTweensJson=o["wt"];this._finishingTweenName=o["ft"];this._allowMultiple= +false;this._enabled=!!o["e"]}_OnAfterLoad(e){const timelineManager=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,timelineManager);if(this._disabledTweensJson){C3.clearArray(this._disabledTweens);for(const tweenName of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,tweenName,timelineManager)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,timelineManager);this._finishingTween=this._GetTween(this._finishingTweenName, +timelineManager);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(restoreJson,map,timelineManager){if(!restoreJson)return;for(const property in restoreJson){let tweens=map.get(property);tweens?C3.clearArray(tweens):tweens=[];const tweensJson=restoreJson[property];for(const tweenJson of tweensJson){const success=this._PopulateTweenArray(tweens,tweenJson["name"],timelineManager);if(!success){const tween=C3.TweenState.Build({runtime:this.GetRuntime(),json:tweenJson});tween.AddCompletedCallback(tween=> +this._FinishTriggers(tween));timelineManager.AddScheduledTimeline(tween);this._PopulateTweenArray(tweens,tween,timelineManager)}else this._LoadTweenFromJson(tweenJson["name"],tweenJson,timelineManager)}map.set(property,tweens)}}_GetTween(name,timelineManager){return timelineManager.GetScheduledOrPlayingTimelineByName(name)}_PopulateTweenArray(collection,tweenOrName,timelineManager){if(typeof tweenOrName==="string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)return!!collection.push(tween)}else return!!collection.push(tweenOrName); +return false}_LoadTweenFromJson(tweenOrName,tweenJson,timelineManager){if(typeof tweenOrName==="string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)tween._LoadFromJson(tweenJson)}else tweenOrName._LoadFromJson(tweenJson)}_SaveActiveTweensToJson(){const ret={};for(const [property,tweens]of this._activeTweens)ret[property]=tweens.filter(t=>!t.IsReleased()).map(t=>t._SaveToJson());return ret}_SaveDisabledTweensToJson(){return this._disabledTweens.filter(t=>!t.IsReleased()).map(t=> +t.GetName())}_SaveWaitingForReleaseTweensToJson(){const ret={};for(const [property,tweens]of this._waitingForReleaseTweens)ret[property]=tweens.map(tween=>tween._SaveToJson());return ret}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(args){const propertyTracksConfig=NAMESPACE.Config.GetPropertyTracksConfig(args.property,args.startValue,args.endValue,args.ease,args.resultMode,this.GetObjectInstance());const tweenId= +NAMESPACE.Maps.GetPropertyFromIndex(args.property);if(!NAMESPACE.Maps.IsValueId(tweenId))this.ReleaseTweens(args.property);const tween=C3.TweenState.Build({runtime:this.GetRuntime(),id:tweenId,tags:args.tags,time:args.time,instance:this.GetObjectInstance(),releaseOnComplete:!!args.releaseOnComplete,loop:!!args.loop,pingPong:!!args.pingPong,initialValueMode:args.initialValueMode,propertyTracksConfig:propertyTracksConfig});tween.AddCompletedCallback(tween=>this._FinishTriggers(tween));this._AddTween(tween, +args.property);return tween}_MaybeRemoveFromActiveTweenMap(tween){const id=tween.GetId();if(this._activeTweens.has(id)){const tweenArray=this._activeTweens.get(id);if(tweenArray){const index=tweenArray.indexOf(tween);if(index!==-1)tweenArray.splice(index,1)}}}ReleaseTween(tween,complete=false){this._MaybeRemoveFromActiveTweenMap(tween);if(tween.IsReleased())return;if(this._IsInWaitingList(tween))return;tween.Stop(complete);this._AddToWaitingList(tween)}ReleaseTweens(indexProperty,complete=false){if(C3.IsFiniteNumber(indexProperty)){const stringProperty= +NAMESPACE.Maps.GetPropertyFromIndex(indexProperty);if(!this._activeTweens.has(stringProperty))return;const tweenArray=this._activeTweens.get(stringProperty);const finishingTween=this.GetFinishingTween();for(const tween of tweenArray){if(tween===finishingTween)continue;if(tween.IsReleased())continue;if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}C3.clearArray(tweenArray)}else{const finishingTween=this.GetFinishingTween();for(const tween of this.AllTweens()){if(tween=== +finishingTween)continue;if(tween.IsReleased())continue;if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}for(const property of this._activeTweens.keys()){C3.clearArray(this._activeTweens.get(property));this._activeTweens.delete(property)}this._activeTweens.clear()}}ReleaseAndCompleteTween(tween){this.ReleaseTween(tween,true)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,true)}GetPropertyValueByIndex(index){switch(index){case ENABLED:return this._enabled}}SetPropertyValueByIndex(index, +value){switch(index){case ENABLED:this._enabled=!!value;break}}_GetBehaviorType(tween){const instance=tween.GetInstance();const behaviorInstances=instance.GetBehaviorInstances();for(const behaviorInstance of behaviorInstances){const behaviorType=behaviorInstance.GetBehaviorType();if(behaviorType.GetInstanceSdkCtor()===this.constructor)return behaviorType}}Trigger(method,runtime,inst,behaviorType){if(this._runtime)return super.Trigger(method);else return runtime.Trigger(method,inst,behaviorType)}_FinishTriggers(tween){this._finishingTween= +tween;NAMESPACE.Cnds.SetFinishingTween(tween);let instance;let runtime;if(!this.GetRuntime()){instance=tween.GetInstance();if(!instance)return;if(instance&&instance.IsDestroyed())return;runtime=instance.GetRuntime();const behaviorType=this._GetBehaviorType(tween);this.Trigger(NAMESPACE.Cnds.OnTweensFinished,runtime,instance,behaviorType);this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished,runtime,instance,behaviorType);tween.Stop()}else{instance=this._inst;runtime=this._runtime;this.Trigger(NAMESPACE.Cnds.OnTweensFinished); +this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished);this.ReleaseTween(tween)}this._finishingTween=null;NAMESPACE.Cnds.SetFinishingTween(null);if(tween.GetDestroyInstanceOnComplete())runtime.DestroyInstance(instance)}_AddTween(tween,indexProperty){const stringProperty=NAMESPACE.Maps.GetPropertyFromIndex(indexProperty);if(!this._activeTweens.has(stringProperty))this._activeTweens.set(stringProperty,[]);const tweenArray=this._activeTweens.get(stringProperty);tweenArray.push(tween)}_AddToWaitingList(tween){const id= +tween.GetId();if(!this._waitingForReleaseTweens.has(id))this._waitingForReleaseTweens.set(id,[]);this._waitingForReleaseTweens.get(id).push(tween)}_IsInWaitingList(tween){const id=tween.GetId();if(!this._waitingForReleaseTweens.has(id))return false;return this._waitingForReleaseTweens.get(id).includes(tween)}_ReleaseWaitingTweens(){if(!this._waitingForReleaseTweens.size)return;for(const tweenArray of this._waitingForReleaseTweens.values()){for(const tween of tweenArray){if(tween.IsReleased())continue; +tween.Release()}C3.clearArray(tweenArray)}this._waitingForReleaseTweens.clear()}GetDebuggerProperties(){const prefix="behaviors.tween";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this.IsEnabled(),onedit:v=>this.SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.ITweenBehaviorInstance}}} +{const C3=self.C3;let finishingTween=null;C3.Behaviors.Tween.Cnds={SetFinishingTween(tween){finishingTween=tween},OnTweensFinished(tags){return finishingTween.HasTags(tags)},OnAnyTweensFinished(){return true},IsPlaying(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPlaying)},IsAnyPlaying(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false; +return tweens.some(C3.TweenState.IsPlaying)},IsPaused(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)},IsAnyPaused(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)}}} +{const C3=self.C3;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.Acts={SetEnabled(enable){this.SetEnabled(!!enable)},async TweenOneProperty(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.OneProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},async TweenTwoProperties(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.TwoProperties(this, +...args));if(tween.Play())await tween.GetPlayPromise()},async TweenValue(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.ValueProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},PauseTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Stop()},PauseAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Stop()}, +ResumeTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Resume()},ResumeAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Resume()},StopTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))this.ReleaseTween(tween)},StopAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())this.ReleaseTween(tween)}, +SetOnePropertyTweensEndValue(tags,property,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;const propertyName=C3.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues([propertyName]);tween.SetEndValue(endValue,propertyName)}},SetTwoPropertiesTweensEndValue(tags,property,endValueX,endValueY){if(!this.IsEnabled()||!this.IsInstanceValid())return;const properties=C3.Behaviors.Tween.Maps.GetRealProperties(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues(properties); +tween.SetEndValue(endValueX,properties[0]);tween.SetEndValue(endValueY,properties[1])}},SetValuePropertyTweensStartValue(tags,startValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value"))tween.SetStartValue(startValue,"value")},SetValuePropertyTweensEndValue(tags,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value")){tween.BeforeSetEndValues(["value"]);tween.SetEndValue(endValue,"value")}}, +SetTweensEase(tags,easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.GetTweens(tags))tween.SetEase(ease)},SetAllTweensEase(easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.AllTweens())tween.SetEase(ease)},SetTweensTime(tags,time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetTime(time)}, +SetAllTweensTime(time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetTime(time)},SetTweensPlaybackRate(tags,rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetPlaybackRate(rate)},SetAllTweensPlaybackRate(rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetPlaybackRate(rate)},SetTweensDestroyOnComplete(tags,destroyOnComplete){if(!this.IsEnabled()|| +!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)},SetAllTweensDestroyOnComplete(destroyOnComplete){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)}}} +{const C3=self.C3;C3.Behaviors.Tween.Exps={Time(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()},Progress(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()/tween.GetTotalTime()},Value(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags,"value");if(!tween)return 0;return tween.GetPropertyTrack("value").GetSourceAdapterValue()},Tags(){if(!this.GetFinishingTween())return"";return this.GetFinishingTween().GetStringTags()}}}; + +} + +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const PAIR_PROPERTIES=["position","size","scale"];const SINGLE_PROPERTIES=["offsetX","offsetY","offsetWidth","offsetHeight","offsetAngle","offsetOpacity","offsetColor","offsetZElevation","offsetScaleX","offsetScaleY"];const VALUE_PROPERTIES=["value"];const PROPERTY_INDEX_TO_NAME=[].concat(PAIR_PROPERTIES).concat(SINGLE_PROPERTIES).concat(VALUE_PROPERTIES); +const PROPERTY_PAIR_TO_REAL_PROPERTIES={"position":["offsetX","offsetY"],"size":["offsetWidth","offsetHeight"],"scale":["offsetScaleX","offsetScaleY"]};const ALL_REAL_PROPERTIES=Object.assign({},PROPERTY_INDEX_TO_NAME.reduce((o,key)=>Object.assign({},o,{[key]:[key]}),{}),PROPERTY_PAIR_TO_REAL_PROPERTIES); +C3.Behaviors.Tween.Maps=class Maps{constructor(){}static GetEases(){return[...Ease.GetRuntimeEaseNames()]}static GetEaseFromIndex(index){return[...Ease.GetRuntimeEaseNames()][index]}static GetPropertyFromIndex(index){return PROPERTY_INDEX_TO_NAME[index]}static GetPropertyIndexFromName(name){return PROPERTY_INDEX_TO_NAME.indexOf(name)}static GetPairPropertyFromIndex(index){return PAIR_PROPERTIES[index]}static GetSinglePropertyFromIndex(index){return SINGLE_PROPERTIES[index]}static GetValuePropertyFromIndex(index){return VALUE_PROPERTIES[index]}static GetPairProperties(pairId){return PROPERTY_PAIR_TO_REAL_PROPERTIES[pairId]}static GetRealProperties(id){if(C3.IsString(id))return ALL_REAL_PROPERTIES[id];else return ALL_REAL_PROPERTIES[PROPERTY_INDEX_TO_NAME[id]]}static IsPairId(id){return!!PROPERTY_PAIR_TO_REAL_PROPERTIES[id]}static IsColorId(id){return id=== +"offsetColor"}static IsAngleId(id){return id==="offsetAngle"}static IsOpacityId(id){return id==="offsetOpacity"}static IsValueId(id){return id==="value"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TWEEN_CONFIGURATIONS=new Map; +NAMESPACE.Config=class Config{constructor(){}static GetPropertyTracksConfig(property,startValue,endValue,ease,resultMode,instance){if(TWEEN_CONFIGURATIONS.size===0)this._CreateConfigObjects();const propertyType=NAMESPACE.PropertyTypes.Pick(property);let config=TWEEN_CONFIGURATIONS.get(propertyType);if(C3.IsFiniteNumber(property))property=NAMESPACE.Maps.GetPropertyFromIndex(property);return this._GetConfig(config,property,startValue,endValue,ease,resultMode,instance)}static TransformValue(property, +value){const configFunctionObject=C3.Behaviors.Tween.GetPropertyTracksConfig(property);return configFunctionObject.valueGetter(value)}static _CreateConfigObjects(){const types=NAMESPACE.PropertyTypes;const getters=NAMESPACE.ValueGetters;this._AddConfigObject(types.PAIR,this._GetPairConfig,getters._GetPropertyValue);this._AddConfigObject(types.COLOR,this._GetColorConfig,getters._GetColorPropertyValue);this._AddConfigObject(types.ANGLE,this._GetAngleConfig,getters._GetPropertyAngleValue);this._AddConfigObject(types.VALUE, +this._GetValueConfig,getters._GetPropertyValue);this._AddConfigObject(types.OTHER,this._GetCommonConfig,getters._GetPropertyValue)}static _AddConfigObject(name,configGetter,valueGetter){TWEEN_CONFIGURATIONS.set(name,this._CreateConfigObject(name,configGetter,valueGetter))}static _CreateConfigObject(name,configFunc,valueGetter){return{name:name,configFunc:configFunc,valueGetter:valueGetter}}static _GetConfig(config,property,startValue,endValue,ease,resultMode,instance){return config.configFunc(property, +config.valueGetter(startValue),config.valueGetter(endValue),ease,resultMode,instance)}static _GetPairConfig(property,startValues,endValues,ease,resultMode,instance){const properties=NAMESPACE.Maps.GetPairProperties(property);return properties.map((property,index)=>{return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValues[index],endValue:endValues[index],ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}})}static _GetColorConfig(property, +startValue,endValue,ease,resultMode,instance){if(C3.Plugins.Text&&instance.GetPlugin()instanceof C3.Plugins.Text)return{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode};else return{sourceId:"world-instance",property:property,type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetAngleConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"angle",valueType:"angle",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetCommonConfig(property,startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetValueConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"value",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const COMMON_FIXED_ARGS={resultMode:"absolute"};const COMMON_VARIABLE_ARGS=Object.assign({},COMMON_FIXED_ARGS,{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:false,pingPong:false});const ONE_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:0,endValue:0}); +const TWO_PROPERTIES_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]});const COLOR_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]});const VALUE_PROPERTY_ARGS=Object.assign({},ONE_PROPERTY_ARGS,{initialValueMode:"start-value"});const X=0;const Y=1;const R=0;const G=1;const B=2; +NAMESPACE.TweenArguments=class TweenArguments{constructor(){}static _SetCommonProperties(argsObject,tags,time,ease,destroyOnComplete,loop,pingPong){argsObject.tags=tags;argsObject.time=time;argsObject.ease=ease;argsObject.releaseOnComplete=destroyOnComplete;argsObject.loop=loop;argsObject.pingPong=pingPong}static OneProperty(inst,tags,property,endValue,time,ease,destroyOnComplete,loop,pingPong){const propertyName=typeof property==="string"?property:NAMESPACE.Maps.GetSinglePropertyFromIndex(property); +const args=NAMESPACE.Maps.IsColorId(propertyName)?COLOR_PROPERTY_ARGS:ONE_PROPERTY_ARGS;this._SetCommonProperties(args,tags,time,ease,destroyOnComplete,loop,pingPong);if(NAMESPACE.Maps.IsColorId(propertyName)){COLOR_PROPERTY_ARGS.endValue[R]=C3.GetRValue(endValue);COLOR_PROPERTY_ARGS.endValue[G]=C3.GetGValue(endValue);COLOR_PROPERTY_ARGS.endValue[B]=C3.GetBValue(endValue);COLOR_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName)}else if(NAMESPACE.Maps.IsOpacityId(propertyName))ONE_PROPERTY_ARGS.endValue= +endValue/100;else ONE_PROPERTY_ARGS.endValue=endValue;args.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName);return args}static TwoProperties(inst,tags,property,endValueX,endValueY,time,ease,destroyOnComplete,loop,pingPong){this._SetCommonProperties(TWO_PROPERTIES_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong);const pairName=typeof property==="string"?property:NAMESPACE.Maps.GetPairPropertyFromIndex(property);TWO_PROPERTIES_ARGS.endValue[X]=endValueX;TWO_PROPERTIES_ARGS.endValue[Y]= +endValueY;TWO_PROPERTIES_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(pairName);return TWO_PROPERTIES_ARGS}static ValueProperty(inst,tags,startValue,endValue,time,ease,destroyOnComplete,loop,pingPong){this._SetCommonProperties(VALUE_PROPERTY_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong);VALUE_PROPERTY_ARGS.startValue=startValue;VALUE_PROPERTY_ARGS.endValue=endValue;VALUE_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName("value");return VALUE_PROPERTY_ARGS}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TYPE_CHECK_OBJECTS=[]; +NAMESPACE.PropertyTypes=class PropertyTypes{constructor(){}static Pick(property){if(TYPE_CHECK_OBJECTS.length===0){const arr=TYPE_CHECK_OBJECTS;arr.push({checkFunc:NAMESPACE.Maps.IsPairId,result:this.PAIR});arr.push({checkFunc:NAMESPACE.Maps.IsColorId,result:this.COLOR});arr.push({checkFunc:NAMESPACE.Maps.IsAngleId,result:this.ANGLE});arr.push({checkFunc:NAMESPACE.Maps.IsValueId,result:this.VALUE});arr.push({checkFunc:()=>true,result:this.OTHER})}if(C3.IsFiniteNumber(property))property=C3.Behaviors.Tween.Maps.GetPropertyFromIndex(property); +for(const propertyTypeFunctionObject of TYPE_CHECK_OBJECTS)if(propertyTypeFunctionObject.checkFunc(property))return propertyTypeFunctionObject.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.ValueGetters=class ValueGetters{constructor(){}static _GetPropertyAngleValue(value){const r=C3.toRadians(parseFloat(value));return C3.clampAngle(r)}static _GetColorPropertyValue(value){return value.slice(0)}static _GetPropertyValue(value){return value}}; + +} + +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;const map=new WeakMap; +const TWEEN_PROPERTIES=new Map([["x",{name:"offsetX",type:"one"}],["y",{name:"offsetY",type:"one"}],["width",{name:"offsetWidth",type:"one"}],["height",{name:"offsetHeight",type:"one"}],["angle",{name:"offsetAngle",type:"one"}],["opacity",{name:"offsetOpacity",type:"one"}],["color",{name:"offsetColor",type:"color"}],["z-elevation",{name:"offsetZElevation",type:"one"}],["x-scale",{name:"offsetScaleX",type:"one"}],["y-scale",{name:"offsetScaleY",type:"one"}],["position",{name:"position",type:"two"}], +["size",{name:"size",type:"two"}],["scale",{name:"scale",type:"two"}],["value",{name:"value",type:"value"}]]);function getIndexForEase(ease){C3X.RequireString(ease);const easeInternalName=Ease.ToInternal(ease);let easeIndex;if(easeInternalName)easeIndex=Ease.GetIndexForEase(easeInternalName,null);else easeIndex=Ease.GetIndexForEase(ease,null);if(easeIndex===-1)throw new Error(`invalid ease name '${ease}'`);return easeIndex} +const TWEEN_OPTS={tags:"",destroyOnComplete:false,loop:false,pingPong:false,startValue:0};const I_TWEEN_OPTS={easeToIndexFunc:getIndexForEase}; +self.ITweenBehaviorInstance=class ITweenBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTween(prop,endValue,time,ease,opts){const inst=map.get(this);if(!inst.IsEnabled()||!inst.IsInstanceValid())return null;const info=TWEEN_PROPERTIES.get(prop);if(!info)throw new Error("invalid tween property");if(info.type==="one"||info.type==="value")C3X.RequireNumber(endValue);else{C3X.RequireArray(endValue);if(info.type==="two"){C3X.RequireNumber(endValue[0]); +C3X.RequireNumber(endValue[1])}else if(info.type==="color"){C3X.RequireNumber(endValue[0]);C3X.RequireNumber(endValue[1]);C3X.RequireNumber(endValue[2])}}if(prop==="angle")endValue=C3.toDegrees(endValue);else if(prop==="opacity")endValue*=100;else if(prop==="color")endValue=C3.PackRGBEx(endValue[0],endValue[1],endValue[2]);const easeIndex=getIndexForEase(ease);C3X.RequireFiniteNumber(time);opts=Object.assign({},TWEEN_OPTS,opts);if(info.type==="value")C3X.RequireNumber(opts.startValue);let tween;if(info.type=== +"one"||info.type==="color")tween=inst.CreateTween(NAMESPACE.TweenArguments.OneProperty(inst,opts.tags,info.name,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong));else if(info.type==="two")tween=inst.CreateTween(NAMESPACE.TweenArguments.TwoProperties(inst,opts.tags,info.name,endValue[0],endValue[1],time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong));else if(info.type==="value")tween=inst.CreateTween(NAMESPACE.TweenArguments.ValueProperty(inst,opts.tags, +opts.startValue,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong));if(!tween.Play())throw new Error("failed to start tween");return tween.GetITweenState(inst,I_TWEEN_OPTS)}*allTweens(){const inst=map.get(this);for(const tween of inst.AllTweens())yield tween.GetITweenState(inst,I_TWEEN_OPTS)}*tweensByTags(tags){C3X.RequireString(tags);const inst=map.get(this);for(const tween of inst.GetTweens(tags))yield tween.GetITweenState(inst,I_TWEEN_OPTS)}get isEnabled(){return map.get(this).IsEnabled()}set isEnabled(e){map.get(this).SetEnabled(e)}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Anchor=class AnchorBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Anchor.Type=class AnchorType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const ANCHOR_LEFT=0;const ANCHOR_TOP=1;const ANCHOR_RIGHT=2;const ANCHOR_BOTTOM=3;const ENABLE=4;C3.Behaviors.Anchor.Instance=class AnchorInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._anchorLeft=2;this._anchorTop=2;this._anchorRight=0;this._anchorBottom=0;this._isEnabled=true;const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop= +bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();if(properties){this._anchorLeft=properties[ANCHOR_LEFT];this._anchorTop=properties[ANCHOR_TOP];this._anchorRight=properties[ANCHOR_RIGHT];this._anchorBottom=properties[ANCHOR_BOTTOM];this._isEnabled=!!properties[ENABLE]}const rt= +this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"layoutchange",()=>this._OnLayoutChange()));if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"xl":this._xLeft,"yt":this._yTop,"xr":this._xRight,"yb":this._yBottom,"rd":this._rDiff,"bd":this._bDiff,"al":this._anchorLeft,"at":this._anchorTop,"ar":this._anchorRight,"ab":this._anchorBottom,"e":this._isEnabled}}LoadFromJson(o){this._xLeft=o["xl"];this._yTop=o["yt"];this._xRight= +o["xr"];this._yBottom=o["yb"];this._rDiff=o["rd"];this._bDiff=o["bd"];this._anchorLeft=o["al"];this._anchorTop=o["at"];this._anchorRight=o["ar"];this._anchorBottom=o["ab"];this._isEnabled=o["e"];if(this._isEnabled)this._StartTicking();else this._StopTicking()}_SetEnabled(e){if(this._isEnabled&&!e){this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop=bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()- +bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();this._isEnabled=true;this._StartTicking()}}_IsEnabled(){return this._isEnabled}_UpdatePosition(){if(!this._isEnabled)return;const wi=this._inst.GetWorldInfo();const viewport=wi.GetLayer().GetViewport();if(this._anchorLeft===0){const n=viewport.getLeft()+this._xLeft-wi.GetBoundingBox().getLeft(); +if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}else if(this._anchorLeft===1){const n=viewport.getRight()-this._xRight-wi.GetBoundingBox().getLeft();if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}if(this._anchorTop===0){const n=viewport.getTop()+this._yTop-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}else if(this._anchorTop===1){const n=viewport.getBottom()-this._yBottom-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}if(this._anchorRight===1){const n= +viewport.getRight()-this._rDiff-wi.GetBoundingBox().getRight();if(n!==0){wi.OffsetX(wi.GetOriginX()*n);wi.SetWidth(Math.max(wi.GetWidth()+n),0);wi.SetBboxChanged();this._rDiff=viewport.getRight()-wi.GetBoundingBox().getRight()}}if(this._anchorBottom===1){const n=viewport.getBottom()-this._bDiff-wi.GetBoundingBox().getBottom();if(n!==0){wi.OffsetY(wi.GetOriginY()*n);wi.SetHeight(Math.max(wi.GetHeight()+n,0));wi.SetBboxChanged();this._bDiff=viewport.getBottom()-wi.GetBoundingBox().getBottom()}}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(index){switch(index){case ANCHOR_LEFT:return this._anchorLeft; +case ANCHOR_TOP:return this._anchorTop;case ANCHOR_RIGHT:return this._anchorRight;case ANCHOR_BOTTOM:return this._anchorBottom;case ENABLE:return this._isEnabled}}SetPropertyValueByIndex(index,value){switch(index){case ANCHOR_LEFT:this._anchorLeft=value;break;case ANCHOR_TOP:this._anchorTop=value;break;case ANCHOR_RIGHT:this._anchorRight=value;break;case ANCHOR_BOTTOM:this._anchorBottom=value;break;case ENABLE:this._isEnabled=!!value;if(this._isEnabled)this._StartTicking();else this._StopTicking(); +break}}GetDebuggerProperties(){const prefix="behaviors.anchor";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.IAnchorBehaviorInstance}};const map=new WeakMap;self.IAnchorBehaviorInstance=class IAnchorBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get isEnabled(){return map.get(this)._IsEnabled()}set isEnabled(e){map.get(this)._SetEnabled(e)}}} +{const C3=self.C3;C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._IsEnabled()}}}{const C3=self.C3;C3.Behaviors.Anchor.Acts={SetEnabled(e){this._SetEnabled(e!==0)}}}{const C3=self.C3;C3.Behaviors.Anchor.Exps={}}; + +} + +{ +'use strict';{const C3=self.C3;const C3X=self.C3X;let tempVec2a=null;let tempVec2b=null;let vec2RecycleCache=[];let Box2D=null;let physicsBehavior=null;const PHYSICS_COLLISIONS_KEY="Physics_DisabledCollisions";function SetObjectTypeCollisionsEnabled(typeA,typeB,state){const savedA=typeA.GetSavedDataMap();const savedB=typeB.GetSavedDataMap();if(state){const setA=savedA.get(PHYSICS_COLLISIONS_KEY);if(setA)setA.delete(typeB.GetSID());const setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(setB)setB.delete(typeA.GetSID())}else{let setA= +savedA.get(PHYSICS_COLLISIONS_KEY);if(!setA){setA=new Set;savedA.set(PHYSICS_COLLISIONS_KEY,setA)}let setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(!setB){setB=new Set;savedB.set(PHYSICS_COLLISIONS_KEY,setB)}setA.add(typeB.GetSID());setB.add(typeA.GetSID())}}C3.Behaviors.Physics=class PhysicsBehavior extends C3.SDKBehaviorBase{constructor(opts){opts.scriptInterfaceClass=self.IPhysicsBehavior;super(opts);this._world=null;this._worldG=10;this._worldScale=.02;this._worldManifold=null;this._lastUpdateTick= +-1;this._steppingMode=1;this._velocityIterations=8;this._positionIterations=3;this._allCollisionsEnabled=true;this._runtime.AddLoadPromise(this._LoadBox2DWasm())}async _LoadBox2DWasm(){const box2dWasmUrl=await this._runtime.GetAssetManager().GetProjectFileUrl("box2d.wasm");await new Promise(resolve=>{self["Box2DWasmModule"]({"wasmBinaryFile":box2dWasmUrl}).then(box2d=>{Box2D=box2d;this._InitBox2DWorld();resolve()})})}_InitBox2DWorld(){const collisionEngine=this._runtime.GetCollisionEngine();tempVec2a= +C3.Behaviors.Physics.GetVec2(0,0);tempVec2b=C3.Behaviors.Physics.GetVec2(0,0);this._world=new Box2D["b2World"](C3.Behaviors.Physics.GetTempVec2A(0,this._worldG),true);const listener=new Box2D["JSContactListener"];listener["BeginContact"]=contactPtr=>{const contact=Box2D["wrapPointer"](contactPtr,Box2D["b2Contact"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureA"]()["GetBody"]());const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureB"]()["GetBody"]()); +collisionEngine.RegisterCollision(behA.GetObjectInstance(),behB.GetObjectInstance())};listener["EndContact"]=()=>{};listener["PreSolve"]=()=>{};listener["PostSolve"]=()=>{};this._world["SetContactListener"](listener);const filter=new Box2D["JSContactFilter"];filter["ShouldCollide"]=(fixAPtr,fixBPtr)=>{if(this._allCollisionsEnabled)return true;const fixtureA=Box2D["wrapPointer"](fixAPtr,Box2D["b2Fixture"]);const fixtureB=Box2D["wrapPointer"](fixBPtr,Box2D["b2Fixture"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureA["GetBody"]()); +const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureB["GetBody"]());const typeA=behA.GetObjectInstance().GetObjectClass();const typeB=behB.GetObjectInstance().GetObjectClass();const sidA=typeA.GetSID();const sidB=typeB.GetSID();const setA=typeA.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setA&&setA.has(sidB))return false;const setB=typeB.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setB&&setB.has(sidA))return false;return true};this._world["SetContactFilter"](filter);this._worldManifold= +new Box2D["b2WorldManifold"]}Release(){super.Release()}GetBox2D(){return Box2D}GetWorld(){return this._world}GetWorldScale(){return this._worldScale}GetSteppingMode(){return this._steppingMode}SetSteppingMode(m){this._steppingMode=m}SetLastUpdateTick(t){this._lastUpdateTick=t}GetLastUpdateTick(){return this._lastUpdateTick}SetVelocityIterations(v){this._velocityIterations=Math.max(v,1)}GetVelocityIterations(){return this._velocityIterations}SetPositionIterations(p){this._positionIterations=Math.max(p, +1)}GetPositionIterations(){return this._positionIterations}SetIterations(v,p){this.SetVelocityIterations(v);this.SetPositionIterations(p)}GetGravity(){return this._worldG}SetGravity(g){if(g===this._worldG)return;this._world["SetGravity"](C3.Behaviors.Physics.GetTempVec2A(0,g));this._worldG=g;this._WakeUpAllPhysicsBodies()}_WakeUpAllPhysicsBodies(){for(const inst of this.GetInstances()){const behInst=C3.Behaviors.Physics.Instance.LookupBehInstFromInst(inst);if(!behInst)continue;const body=behInst.GetBody(); +if(!body)continue;body["SetAwake"](true)}}DisableShouldCollideFastPath(){this._allCollisionsEnabled=false}SetCollisionsEnabled(typeA,typeB,state){state=!!state;if(!typeA||!typeB)return;if(typeB.IsFamily())for(const member of typeB.GetFamilyMembers())SetObjectTypeCollisionsEnabled(typeA,member,state);else SetObjectTypeCollisionsEnabled(typeA,typeB,state);this.DisableShouldCollideFastPath()}GetWorldManifold(){return this._worldManifold}static GetPhysicsCollisionKey(){return PHYSICS_COLLISIONS_KEY}static GetVec2(x, +y){if(vec2RecycleCache.length){const ret=vec2RecycleCache.pop();ret["set_x"](x);ret["set_y"](y);return ret}else{const b2Vec2=Box2D["b2Vec2"];return new b2Vec2(x,y)}}static FreeVec2(v){vec2RecycleCache.push(v)}static GetTempVec2A(x,y){tempVec2a["set_x"](x);tempVec2a["set_y"](y);return tempVec2a}static GetTempVec2B(x,y){tempVec2b["set_x"](x);tempVec2b["set_y"](y);return tempVec2b}static CreatePolygonShape(vertices){const b2PolygonShape=Box2D["b2PolygonShape"];const shape=new b2PolygonShape;const buffer= +Box2D["_malloc"](vertices.length*8);let offset=0;for(let i=0;i>2]=vertices[i]["get_x"]();Box2D["HEAPF32"][buffer+(offset+4)>>2]=vertices[i]["get_y"]();offset+=8}const ptr_wrapped=Box2D["wrapPointer"](buffer,Box2D["b2Vec2"]);shape["Set"](ptr_wrapped,vertices.length);Box2D["_free"](buffer);return shape}};const STEPPING_MODES=["fixed","variable"];self.IPhysicsBehavior=class IPhysicsBehavior extends self.IBehavior{constructor(behavior){super(behavior); +physicsBehavior=behavior}set worldGravity(g){C3X.RequireFiniteNumber(g);physicsBehavior.SetGravity(g)}get worldGravity(){return physicsBehavior.GetGravity()}set steppingMode(s){const i=STEPPING_MODES.indexOf(s);if(i<0)throw new Error("invalid stepping mode");physicsBehavior.SetSteppingMode(STEPPING_MODES[i])}get steppingMode(){return STEPPING_MODES[physicsBehavior.GetSteppingMode()]}set velocityIterations(v){C3X.RequireFiniteNumber(v);physicsBehavior.SetVelocityIterations(v)}get velocityIterations(){return physicsBehavior.GetVelocityIterations()}set positionIterations(p){C3X.RequireFiniteNumber(p); +physicsBehavior.SetPositionIterations(p)}get positionIterations(){return physicsBehavior.GetPositionIterations()}setCollisionsEnabled(iObjectClassA,iObjectClassB,state){const runtime=physicsBehavior.GetRuntime();const objectClassA=runtime._UnwrapIObjectClass(iObjectClassA);const objectClassB=runtime._UnwrapIObjectClass(iObjectClassB);state=!!state;physicsBehavior.SetCollisionsEnabled(objectClassA,objectClassB,state)}}}{const C3=self.C3;C3.Behaviors.Physics.Type=class PhysicsType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const assert=self.assert;const IMMOVABLE=0;const COLLISION_MASK=1;const PREVENT_ROTATION=2;const DENSITY=3;const FRICTION=4;const ELASTICITY=5;const LINEAR_DAMPING=6;const ANGULAR_DAMPING=7;const BULLET=8;const ENABLE=9;const body2beh=new WeakMap;const inst2beh=new WeakMap;const tileConvexPolyCache=new WeakMap;const TILE_FLIPPED_HORIZONTAL=-2147483648;const TILE_FLIPPED_VERTICAL=1073741824;const TILE_FLIPPED_DIAGONAL= +536870912;const TILE_FLAGS_MASK=3758096384;const TILE_ID_MASK=536870911;const GetTempVec2A=C3.Behaviors.Physics.GetTempVec2A;const GetTempVec2B=C3.Behaviors.Physics.GetTempVec2B;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);C3.Behaviors.Physics.Instance=class PhysicsInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);const behavior=this.GetBehavior();const wi=this.GetWorldInfo();this._box2d=behavior.GetBox2D();this._world=behavior.GetWorld(); +this._worldScale=behavior.GetWorldScale();this._isImmovable=false;this._collisionMask=0;this._preventRotation=false;this._density=1;this._friction=.5;this._restitution=.2;this._linearDamping=0;this._angularDamping=.01;this._isBullet=false;this._isEnabled=true;this._body=null;this._fixtures=[];this._myJoints=[];this._myCreatedJoints=[];this._joiningMe=new Set;this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle();this._lastWidth=0;this._lastHeight=0;this._lastTickOverride= +false;if(properties){this._isImmovable=!!properties[IMMOVABLE];this._collisionMask=properties[COLLISION_MASK];this._preventRotation=!!properties[PREVENT_ROTATION];this._density=properties[DENSITY];this._friction=properties[FRICTION];this._restitution=properties[ELASTICITY];this._linearDamping=properties[LINEAR_DAMPING];this._angularDamping=properties[ANGULAR_DAMPING];this._isBullet=!!properties[BULLET];this._isEnabled=!!properties[ENABLE]}const rt=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt, +"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"beforeload",()=>this._OnBeforeLoad()),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()));inst2beh.set(this._inst,this);if(this._isEnabled)this._StartTicking()}PostCreate(){this._CreateBody()}Release(){this._DestroyMyJoints();C3.clearArray(this._myCreatedJoints);this._joiningMe.clear();if(this._body){this._DestroyFixtures();this._world["DestroyBody"](this._body);this._body=null}super.Release()}_CreateFixture(fixDef){if(!this._body)return; +const fixture=this._body["CreateFixture"](fixDef);this._fixtures.push(fixture);return fixture}_DestroyFixtures(){if(!this._body)return;for(const fixture of this._fixtures)this._body["DestroyFixture"](fixture);C3.clearArray(this._fixtures)}_GetBoundingQuadExcludingMesh(){const wi=this.GetWorldInfo();if(wi.HasMesh()){wi.CalculateBbox(tempRect,tempQuad,false);return tempQuad}else return wi.GetBoundingQuad()}_Destroy(o){this._box2d["destroy"](o)}_CreateBody(){if(!this._isEnabled)return;const b2FixtureDef= +this._box2d["b2FixtureDef"];const b2BodyDef=this._box2d["b2BodyDef"];const wi=this.GetWorldInfo();if(!this._body){const bodyDef=new b2BodyDef;bodyDef["set_type"](this._isImmovable?0:2);const bquad=this._GetBoundingQuadExcludingMesh();bodyDef["set_position"](GetTempVec2B(bquad.midX()*this._worldScale,bquad.midY()*this._worldScale));bodyDef["set_angle"](wi.GetAngle());bodyDef["set_fixedRotation"](this._preventRotation);bodyDef["set_linearDamping"](this._linearDamping);bodyDef["set_angularDamping"](this._angularDamping); +bodyDef["set_bullet"](this._isBullet);this._body=this._world["CreateBody"](bodyDef);this._Destroy(bodyDef);body2beh.set(this._body,this)}this._DestroyFixtures();const fixDef=new b2FixtureDef;fixDef["set_density"](this._density);fixDef["set_friction"](this._friction);fixDef["set_restitution"](this._restitution);const hasPoly=wi.HasOwnCollisionPoly();let useCollisionMask=this._collisionMask;if(!hasPoly&&!this._inst.HasTilemap()&&useCollisionMask===0)useCollisionMask=1;const instW=Math.max(Math.abs(wi.GetWidth()), +1);const instH=Math.max(Math.abs(wi.GetHeight()),1);if(useCollisionMask===0)if(this._inst.HasTilemap())this._CreateTilemapFixtures(fixDef);else this._CreatePolygonFixture(fixDef,instW,instH);else if(useCollisionMask===1)this._CreateBoundingBoxFixture(fixDef,instW,instH);else this._CreateCircleFixture(fixDef,instW,instH);this._lastWidth=wi.GetWidth();this._lastHeight=wi.GetHeight();wi.SetPhysicsBodyChanged(false);this._Destroy(fixDef)}_CreateBoundingBoxFixture(fixDef,instW,instH){const b2PolygonShape= +this._box2d["b2PolygonShape"];const shape=new b2PolygonShape;shape["SetAsBox"](instW*this._worldScale*.5,instH*this._worldScale*.5);fixDef["set_shape"](shape);this._CreateFixture(fixDef);this._Destroy(shape)}_CreateCircleFixture(fixDef,instW,instH){const b2CircleShape=this._box2d["b2CircleShape"];const shape=new b2CircleShape;shape["set_m_radius"](Math.min(instW,instH)*this._worldScale*.5);fixDef["set_shape"](shape);this._CreateFixture(fixDef);this._Destroy(shape)}_CreatePolygonFixture(fixDef,instW, +instH){const wi=this.GetWorldInfo();const isMirrored=wi.GetWidth()<0;const isFlipped=wi.GetHeight()<0;const worldScale=this._worldScale;const angle=wi.GetAngle();if(angle!==0){wi.SetAngle(0);wi.SetBboxChanged()}const bquad=this._GetBoundingQuadExcludingMesh();const offX=bquad.midX()-wi.GetX();const offY=bquad.midY()-wi.GetY();if(angle!==0){wi.SetAngle(angle);wi.SetBboxChanged()}const transformedPoly=wi.GetCustomTransformedCollisionPoly(isMirrored?-instW:instW,isFlipped?-instH:instH,0);const ptsArr= +transformedPoly.pointsArr();const ptsCount=ptsArr.length/2;const arr=[];for(let i=0;i1/30)dt=1/30}const tickCount=runtime.GetTickCountNoSave();if(tickCount>behavior.GetLastUpdateTick()&&runtime.GetTimeScale()>0){const isDebug=this._runtime.IsDebug();let startTime=0;if(isDebug)startTime=performance.now();if(dt!==0)this._world["Step"](dt,behavior.GetVelocityIterations(),behavior.GetPositionIterations());this._world["ClearForces"](); +if(isDebug)self.C3Debugger.AddPhysicsTime(performance.now()-startTime);behavior.SetLastUpdateTick(tickCount)}this._UpdateBodyToMatchInstance(true)}_UpdateBodyToMatchInstance(isTickUpdate){const inst=this._inst;const wi=inst.GetWorldInfo();const worldScale=this._worldScale;if(wi.GetWidth()!==this._lastWidth||wi.GetHeight()!==this._lastHeight||wi.IsPhysicsBodyChanged())this._CreateBody();const body=this._body;const posChanged=wi.GetX()!==this._lastKnownX||wi.GetY()!==this._lastKnownY;const angleChanged= +wi.GetAngle()!==this._lastKnownAngle;if(posChanged){const bquad=this._GetBoundingQuadExcludingMesh();const newMidX=bquad.midX();const newMidY=bquad.midY();const diffX=newMidX-this._lastKnownX;const diffY=newMidY-this._lastKnownY;if(angleChanged)body["SetTransform"](GetTempVec2A(newMidX*worldScale,newMidY*worldScale),wi.GetAngle());else body["SetTransform"](GetTempVec2A(newMidX*worldScale,newMidY*worldScale),body["GetAngle"]());if(isTickUpdate){body["SetLinearVelocity"](GetTempVec2A(diffX,diffY)); +this._lastTickOverride=true}body["SetAwake"](true)}else if(isTickUpdate&&this._lastTickOverride){const bquad=this._GetBoundingQuadExcludingMesh();this._lastTickOverride=false;body["SetLinearVelocity"](GetTempVec2A(0,0));body["SetTransform"](GetTempVec2A(bquad.midX()*worldScale,bquad.midY()*worldScale),body["GetAngle"]())}if(!posChanged&&angleChanged){body["SetTransform"](body["GetPosition"](),wi.GetAngle());body["SetAwake"](true)}const pos=body["GetPosition"]();const newX=pos["get_x"]()/worldScale; +const newY=pos["get_y"]()/worldScale;const newAngle=body["GetAngle"]();if(newX!==wi.GetX()||newY!==wi.GetY()||newAngle!==wi.GetAngle()){wi.SetXY(newX,newY);wi.SetAngle(newAngle);wi.SetBboxChanged();const bquad=this._GetBoundingQuadExcludingMesh();const dx=bquad.midX()-wi.GetX();const dy=bquad.midY()-wi.GetY();if(dx!==0||dy!==0){wi.OffsetXY(-dx,-dy);wi.SetBboxChanged()}}this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle()}GetPropertyValueByIndex(index){switch(index){case PREVENT_ROTATION:return this._IsPreventRotate(); +case DENSITY:return this._GetDensity();case FRICTION:return this._GetFriction();case ELASTICITY:return this._GetElasticity();case LINEAR_DAMPING:return this._GetLinearDamping();case ANGULAR_DAMPING:return this._GetAngularDamping();case BULLET:return this._IsBullet();case ENABLE:return this._IsEnabled()}}SetPropertyValueByIndex(index,value){switch(index){case PREVENT_ROTATION:this._SetPreventRotate(value);break;case DENSITY:this._SetDensity(value);break;case FRICTION:this._SetFriction(value);break; +case ELASTICITY:this._SetElasticity(value);break;case LINEAR_DAMPING:this._SetLinearDamping(value);break;case ANGULAR_DAMPING:this._SetAngularDamping(value);break;case BULLET:this._SetBullet(value);break;case ENABLE:this._SetEnabled(value);break}}_SetEnabled(e){e=!!e;if(this._isEnabled&&!e){this._DestroyBody();this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){this._isEnabled=true;this._CreateBody();this._StartTicking()}}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const prefix= +"behaviors.physics";const props=[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)},{name:prefix+".properties.immovable.name",value:this._IsImmovable(),onedit:v=>this._SetImmovable(v)},{name:prefix+".properties.density.name",value:this._GetDensity(),onedit:v=>this._SetDensity(v)},{name:prefix+".properties.friction.name",value:this._GetFriction(),onedit:v=>this._SetFriction(v)},{name:prefix+".properties.elasticity.name",value:this._GetElasticity(),onedit:v=> +this._SetElasticity(v)},{name:prefix+".properties.linear-damping.name",value:this._GetLinearDamping(),onedit:v=>this._SetLinearDamping(v)},{name:prefix+".properties.angular-damping.name",value:this._GetAngularDamping(),onedit:v=>this._SetAngularDamping(v)}];if(this._isEnabled){props.push({name:prefix+".debugger.is-sleeping",value:this._IsSleeping()});props.push({name:prefix+".debugger.velocity-x",value:this._GetVelocityX(),onedit:v=>this._SetVelocity(v,this._GetVelocityY())});props.push({name:prefix+ +".debugger.velocity-y",value:this._GetVelocityY(),onedit:v=>this._SetVelocity(this._GetVelocityX(),v)});props.push({name:prefix+".debugger.angular-velocity",value:C3.toDegrees(this._GetAngularVelocity()),onedit:v=>this._SetAngularVelocity(C3.toRadians(v))});props.push({name:prefix+".debugger.mass",value:this._GetMass()})}return[{title:"$"+this.GetBehaviorType().GetName(),properties:props}]}_ApplyForce(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(fx,fy,x,y)}_ApplyForceToward(f, +px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyForceAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyForce(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyForce"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale),true)}_ApplyImpulse(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt); +this._DoApplyImpulse(fx,fy,x,y)}_ApplyImpulseToward(f,px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyImpulseAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyImpulse(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyLinearImpulse"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale), +true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_ApplyTorque(m){if(!this._isEnabled)return;this._body["ApplyTorque"](m,true)}_ApplyTorqueToAngle(m,a){const f=C3.angleClockwise(this.GetWorldInfo().GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_ApplyTorqueToPosition(m,x,y){const wi=this.GetWorldInfo();const a=C3.angleTo(wi.GetX(),wi.GetY(),x,y);const f=C3.angleClockwise(wi.GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_SetAngularVelocity(v){if(!this._isEnabled)return; +this._body["SetAngularVelocity"](v);this._body["SetAwake"](true)}_GetAngularVelocity(){return this._isEnabled?this._body["GetAngularVelocity"]():0}_SetVelocity(vx,vy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["SetLinearVelocity"](GetTempVec2A(vx*worldScale,vy*worldScale));this._body["SetAwake"](true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_GetVelocity(){if(!this._isEnabled)return[0,0];const worldScale= +this._worldScale;const vec=this._body["GetLinearVelocity"]();return[vec["get_x"]()/worldScale,vec["get_y"]()/worldScale]}_GetVelocityX(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_x"]()/this._worldScale:0}_GetVelocityY(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_y"]()/this._worldScale:0}_SetDensity(d){if(!this._isEnabled)return;if(this._density===d)return;this._density=d;for(const fixture of this._fixtures)fixture["SetDensity"](d);this._body["ResetMassData"]()}_GetDensity(){return this._isEnabled? +this._density:0}_SetFriction(f){if(!this._isEnabled)return;if(this._friction===f)return;this._friction=f;for(const fixture of this._fixtures)fixture["SetFriction"](f);for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(contact)contact["ResetFriction"]()}}_GetFriction(){return this._isEnabled?this._friction:0}_SetElasticity(e){if(!this._isEnabled)return;if(this._restitution=== +e)return;this._restitution=e;for(const fixture of this._fixtures)fixture["SetRestitution"](e)}_GetElasticity(){return this._isEnabled?this._restitution:0}_SetLinearDamping(ld){if(!this._isEnabled)return;if(this._linearDamping===ld)return;this._linearDamping=ld;this._body["SetLinearDamping"](ld)}_GetLinearDamping(){return this._isEnabled?this._linearDamping:0}_SetAngularDamping(ad){if(!this._isEnabled)return;if(this._angularDamping===ad)return;this._angularDamping=ad;this._body["SetAngularDamping"](ad)}_GetAngularDamping(){return this._isEnabled? +this._angularDamping:0}_SetImmovable(i){if(!this._isEnabled)return;i=!!i;if(this._isImmovable===i)return;this._isImmovable=i;this._body["SetType"](this._isImmovable?0:2);this._body["SetAwake"](true)}_IsImmovable(){return this._isImmovable}_SetPreventRotate(i){if(!this._isEnabled)return;i=!!i;if(this._preventRotation===i)return;this._preventRotation=i;this._body["SetFixedRotation"](this._preventRotation);this._body["SetAngularVelocity"](0);this._body["SetAwake"](true)}_IsPreventRotate(){return this._preventRotation}_SetBullet(i){if(!this._isEnabled)return; +i=!!i;if(this._isBullet===i)return;this._isBullet=i;this._body["SetBullet"](this._isBullet);this._body["SetAwake"](true)}_IsBullet(){return this._isBullet}_GetMass(){return this._isEnabled?this._body["GetMass"]()/this._worldScale:0}_GetCenterOfMassX(){return this._isEnabled?(this._body["GetPosition"]()["get_x"]()+this._body["GetLocalCenter"]()["get_x"]())/this._worldScale:0}_GetCenterOfMassY(){return this._isEnabled?(this._body["GetPosition"]()["get_y"]()+this._body["GetLocalCenter"]()["get_y"]())/ +this._worldScale:0}_GetCenterOfMass(){if(!this._isEnabled)return[0,0];const posVec=this._body["GetPosition"]();const centerVec=this._body["GetLocalCenter"]();const worldScale=this._worldScale;return[(posVec["get_x"]()+centerVec["get_x"]())/worldScale,(posVec["get_y"]()+centerVec["get_y"]())/worldScale]}_IsSleeping(){return this._isEnabled?!this._body["IsAwake"]():false}_GetContactCount(){if(!this._isEnabled)return 0;let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge= +contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold=contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();count+=pointCount}return count}_GetContactPositionAt(index){index=Math.floor(index);if(!this._isEnabled)return[0,0];let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold= +contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();if(index>=count&&index=px&&px>=x2-.1||x1-.1<=px&&px<=x2+.1;const b2=y1+.1>=py&&py>=y2-.1||y1-.1<=py&&py<=y2+.1;return b1&&b2&&b2Separator.isOnLine(px,py,x1,y1,x2,y2)};b2Separator.isOnLine=function(px,py,x1,y1,x2,y2){if(Math.abs(x2-x1)>.1){const a=(y2-y1)/(x2-x1);const possibleY=a*(px-x1)+y1;const diff=Math.abs(possibleY-py);return diff<.1}return Math.abs(px-x1)<.1}; +b2Separator.pointsMatch=function(x1,y1,x2,y2){return Math.abs(x2-x1)<.1&&Math.abs(y2-y1)<.1}; +b2Separator.Separate=function(verticesVec,objarea){const calced=b2Separator.calcShapes(verticesVec);let ret=[];for(let i=0,len=calced.length;i=objarea*.001)ret.push(poly);else for(let j=0,lenj=poly.length;j=n)return[];if(!b2Separator.isOnSegment(v2["get_x"](),v2["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p1["get_x"](),p1["get_y"]()))vec1.push(vec[k]);break}h=k;if(k-1<0)k=n-1;else k--}vec1.reverse();h=-1;k=i2;while(true){if(k!== +j1)vec2.push(vec[k]);else{if(h<0||h>=n)return[];if(k===j1&&!b2Separator.isOnSegment(v1["get_x"](),v1["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p2["get_x"](),p2["get_y"]()))vec2.push(vec[k]);break}h=k;if(k+1>n-1)k=0;else k++}queue.push(vec1,vec2);queue.shift();break}}if(isConvex)figsVec.push(queue.shift())}return figsVec}; +function SplitConvexPolysOver8Points(convexPolys){const ret=[];for(const arr of convexPolys)if(arr.length<=8)ret.push(arr);else ret.push.apply(ret,SplitConvexPoly(arr));return ret}function SplitConvexPoly(arr){const ret=[];ret.push(arr.splice(0,8));const first=ret[0][0];let last=ret[0][7];while(arr.length){const poly=arr.splice(0,Math.min(arr.length,6));let nextLast=poly.at(-1);poly.push(CloneVec2(first));poly.push(CloneVec2(last));ret.push(poly);last=nextLast}return ret}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Pin=class PinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Pin.Type=class PinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;C3.Behaviors.Pin.Instance=class PinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._pinDist=0;this._pinAngle=0;this._pinImagePoint=0;this._dx=0;this._dy=0;this._dWidth=0;this._dHeight=0;this._dAngle=0;this._dz=0;this._lastKnownAngle=0;this._destroy=false;if(properties)this._destroy=properties[0];const rt=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt, +"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",e=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(inst){if(inst){this._pinInst=inst;this._StartTicking2()}else{this._pinInst=null;this._StopTicking2()}}_Pin(objectClass,mode,propList){if(!objectClass)return;const otherInst=objectClass.GetFirstPicked(this._inst);if(!otherInst)return;this._mode=mode;this._SetPinInst(otherInst);const myWi=this._inst.GetWorldInfo();const otherWi= +otherInst.GetWorldInfo();if(this._mode==="properties"){const propSet=this._propSet;propSet.clear();for(const p of propList)propSet.add(p);this._dx=myWi.GetX()-otherWi.GetX();this._dy=myWi.GetY()-otherWi.GetY();this._dAngle=myWi.GetAngle()-otherWi.GetAngle();this._lastKnownAngle=myWi.GetAngle();this._dz=myWi.GetZElevation()-otherWi.GetZElevation();if(propSet.has("x")&&propSet.has("y")){this._pinAngle=C3.angleTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())-otherWi.GetAngle();this._pinDist= +C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}if(propSet.has("width-abs"))this._dWidth=myWi.GetWidth()-otherWi.GetWidth();else if(propSet.has("width-scale"))this._dWidth=myWi.GetWidth()/otherWi.GetWidth();if(propSet.has("height-abs"))this._dHeight=myWi.GetHeight()-otherWi.GetHeight();else if(propSet.has("height-scale"))this._dHeight=myWi.GetHeight()/otherWi.GetHeight()}else this._pinDist=C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}SaveToJson(){const propSet= +this._propSet;const mode=this._mode;const ret={"uid":this._pinInst?this._pinInst.GetUID():-1,"m":mode,"d":this._destroy};if(mode==="rope"||mode==="bar")ret["pd"]=this._pinDist;else if(mode==="properties"){ret["ps"]=[...this._propSet];if(propSet.has("imagepoint"))ret["ip"]=this._pinImagePoint;else if(propSet.has("x")&&propSet.has("y")){ret["pa"]=this._pinAngle;ret["pd"]=this._pinDist}else{if(propSet.has("x"))ret["dx"]=this._dx;if(propSet.has("y"))ret["dy"]=this._dy}if(propSet.has("angle")){ret["da"]= +this._dAngle;ret["lka"]=this._lastKnownAngle}if(propSet.has("width-abs")||propSet.has("width-scale"))ret["dw"]=this._dWidth;if(propSet.has("height-abs")||propSet.has("height-scale"))ret["dh"]=this._dHeight;if(propSet.has("z"))ret["dz"]=this._dz}return ret}LoadFromJson(o){const mode=o["m"];const propSet=this._propSet;propSet.clear();this._pinUid=o["uid"];if(typeof mode==="number"){this._LoadFromJson_Legacy(o);return}this._mode=mode;if(o.hasOwnProperty("d"))this._destroy=!!o["d"];if(mode==="rope"|| +mode==="bar")this._pinDist=o["pd"];else if(mode==="properties"){for(const p of o["ps"])propSet.add(p);if(propSet.has("imagepoint"))this._pinImagePoint=o["ip"];else if(propSet.has("x")&&propSet.has("y")){this._pinAngle=o["pa"];this._pinDist=o["pd"]}else{if(propSet.has("x"))this._dx=o["dx"];if(propSet.has("y"))this._dy=o["dy"]}if(propSet.has("angle")){this._dAngle=o["da"];this._lastKnownAngle=o["lka"]||0}if(propSet.has("width-abs")||propSet.has("width-scale"))this._dWidth=o["dw"];if(propSet.has("height-abs")|| +propSet.has("height-scale"))this._dHeight=o["dh"];if(propSet.has("z"))this._dz=o["dz"]}}_LoadFromJson_Legacy(o){const propSet=this._propSet;const myStartAngle=o["msa"];const theirStartAngle=o["tsa"];const pinAngle=o["pa"];const pinDist=o["pd"];const mode=o["m"];switch(mode){case 0:this._mode="properties";propSet.add("x").add("y").add("angle");this._pinAngle=pinAngle;this._pinDist=pinDist;this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 1:this._mode="properties";propSet.add("x").add("y"); +this._pinAngle=pinAngle;this._pinDist=pinDist;break;case 2:this._mode="properties";propSet.add("angle");this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 3:this._mode="rope";this._pinDist=o["pd"];break;case 4:this._mode="bar";this._pinDist=o["pd"];break}}_OnAfterLoad(){if(this._pinUid===-1)this._SetPinInst(null);else{this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid));this._pinUid=-1}}_OnInstanceDestroyed(inst){if(this._pinInst===inst){this._SetPinInst(null); +if(this._destroy)this._runtime.DestroyInstance(this._inst)}}Tick2(){const pinInst=this._pinInst;if(!pinInst)return;const pinWi=pinInst.GetWorldInfo();const myInst=this._inst;const myWi=myInst.GetWorldInfo();const mode=this._mode;let bboxChanged=false;if(mode==="rope"||mode==="bar"){const dist=C3.distanceTo(myWi.GetX(),myWi.GetY(),pinWi.GetX(),pinWi.GetY());if(dist>this._pinDist||mode==="bar"&&dist=this._duration}Update(){if(this.HasFinished())if(this._isRegular)this._current.Subtract(this._duration);else return true;return false}SaveToJson(){return{"c":this._current.Get(),"t":this._total.Get(),"d":this._duration,"r":this._isRegular,"p":this._isPaused}}LoadFromJson(o){this._current.Set(o["c"]);this._total.Set(o["t"]);this._duration=o["d"];this._isRegular=!!o["r"];this._isPaused= +!!o["p"]}};C3.Behaviors.Timer.Instance=class TimerInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._timers=new Map}Release(){this._timers.clear();super.Release()}_StartTimer(duration,name,isRegular){const timer=new C3.Behaviors.Timer.SingleTimer(0,0,duration,isRegular);this._timers.set(name.toLowerCase(),timer);this._UpdateTickState()}_StopTimer(name){this._timers.delete(name.toLowerCase());this._UpdateTickState()}_StopAllTimers(){this._timers.clear(); +this._UpdateTickState()}_IsTimerRunning(name){return this._timers.has(name.toLowerCase())}_GetTimerCurrentTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetCurrentTime():0}_GetTimerTotalTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetTotalTime():0}_GetTimerDuration(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetDuration():0}_HasTimerFinished(name){const timer=this._timers.get(name.toLowerCase());return timer? +timer.HasFinished():false}_SetTimerPaused(name,isPaused){const timer=this._timers.get(name.toLowerCase());if(timer)timer.SetPaused(isPaused)}_IsTimerPaused(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.IsPaused():false}_UpdateTickState(){if(this._timers.size>0){this._StartTicking();this._StartTicking2()}else{this._StopTicking();this._StopTicking2()}}SaveToJson(){const ret={};for(const [name,timer]of this._timers.entries())ret[name]=timer.SaveToJson();return ret}LoadFromJson(o){this._timers.clear(); +for(const [name,data]of Object.entries(o)){const timer=new C3.Behaviors.Timer.SingleTimer;timer.LoadFromJson(data);this._timers.set(name,timer)}this._UpdateTickState()}Tick(){const dt=this._runtime.GetDt(this._inst);for(const [name,timer]of this._timers)if(!timer.IsPaused()){timer.Add(dt);if(timer.HasFinished())this.DispatchScriptEvent("timer",false,{tag:name})}}Tick2(){for(const [name,timer]of this._timers.entries()){const shouldDelete=timer.Update();if(shouldDelete)this._timers.delete(name)}}GetDebuggerProperties(){return[{title:"behaviors.timer.debugger.timers", +properties:[...this._timers.entries()].map(entry=>({name:"$"+entry[0],value:`${Math.round(entry[1].GetCurrentTime()*10)/10} / ${Math.round(entry[1].GetDuration()*10)/10}`}))}]}GetScriptInterfaceClass(){return self.ITimerBehaviorInstance}};const map=new WeakMap;const VALID_TIMER_TYPES=["once","regular"];self.ITimerBehaviorInstance=class ITimerBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTimer(duration,name,type= +"once"){C3X.RequireFiniteNumber(duration);C3X.RequireString(name);const i=VALID_TIMER_TYPES.indexOf(type);if(i===-1)throw new Error("invalid type");map.get(this)._StartTimer(duration,name,i===1)}setTimerPaused(name,isPaused){C3X.RequireString(name);map.get(this)._SetTimerPaused(name,!!isPaused)}stopTimer(name){C3X.RequireString(name);map.get(this)._StopTimer(name)}stopAllTimers(){map.get(this)._StopAllTimers()}isTimerRunning(name){C3X.RequireString(name);return map.get(this)._IsTimerRunning(name)}isTimerPaused(name){C3X.RequireString(name); +return map.get(this)._IsTimerPaused(name)}getCurrentTime(name){C3X.RequireString(name);return map.get(this)._GetTimerCurrentTime(name)}getTotalTime(name){C3X.RequireString(name);return map.get(this)._GetTimerTotalTime(name)}getDuration(name){C3X.RequireString(name);return map.get(this)._GetTimerDuration(name)}hasFinished(name){C3X.RequireString(name);return map.get(this)._HasTimerFinished(name)}}} +{const C3=self.C3;C3.Behaviors.Timer.Cnds={OnTimer(name){return this._HasTimerFinished(name)},IsTimerRunning(name){return this._IsTimerRunning(name)},IsTimerPaused(name){return this._IsTimerPaused(name)}}}{const C3=self.C3;C3.Behaviors.Timer.Acts={StartTimer(duration,type,name){this._StartTimer(duration,name,type===1)},StopTimer(name){this._StopTimer(name)},StopAllTimers(){this._StopAllTimers()},PauseResumeTimer(name,state){this._SetTimerPaused(name,state===0)}}} +{const C3=self.C3;C3.Behaviors.Timer.Exps={CurrentTime(name){return this._GetTimerCurrentTime(name)},TotalTime(name){return this._GetTimerTotalTime(name)},Duration(name){return this._GetTimerDuration(name)}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Sin=class SinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Sin.Type=class SinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const MOVEMENT=0;const WAVE=1;const PERIOD=2;const PERIOD_RANDOM=3;const PERIOD_OFFSET=4;const PERIOD_OFFSET_RANDOM=5;const MAGNITUDE=6;const MAGNITUDE_RANDOM=7;const ENABLE=8;const HORIZONTAL=0;const VERTICAL=1;const SIZE=2;const WIDTH=3;const HEIGHT=4;const ANGLE=5;const OPACITY=6;const VALUE=7;const FORWARDS_BACKWARDS=8;const ZELEVATION=9;const SINE=0;const TRIANGLE=1;const SAWTOOTH=2;const REVERSE_SAWTOOTH=3;const SQUARE= +4;const _2pi=2*Math.PI;const _pi_2=Math.PI/2;const _3pi_2=3*Math.PI/2;const MOVEMENT_LOOKUP=[0,1,8,3,4,2,5,6,9,7];C3.Behaviors.Sin.Instance=class SinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._i=0;this._movement=0;this._wave=0;this._period=0;this._mag=0;this._isEnabled=true;this._basePeriod=0;this._basePeriodOffset=0;this._baseMag=0;this._periodRandom=0;this._periodOffsetRandom=0;this._magnitudeRandom=0;this._initialValue=0;this._initialValue2= +0;this._lastKnownValue=0;this._lastKnownValue2=0;this._ratio=0;if(properties){this._movement=MOVEMENT_LOOKUP[properties[MOVEMENT]];this._wave=properties[WAVE];this._periodRandom=this._runtime.Random()*properties[PERIOD_RANDOM];this._basePeriod=properties[PERIOD];this._period=properties[PERIOD];this._period+=this._periodRandom;this._basePeriodOffset=properties[PERIOD_OFFSET];if(this._period!==0){this._periodOffsetRandom=this._runtime.Random()*properties[PERIOD_OFFSET_RANDOM];this._i=properties[PERIOD_OFFSET]/ +this._period*_2pi;this._i+=this._periodOffsetRandom/this._period*_2pi}this._magnitudeRandom=this._runtime.Random()*properties[MAGNITUDE_RANDOM];this._baseMag=properties[MAGNITUDE];this._mag=properties[MAGNITUDE];this._mag+=this._magnitudeRandom;this._isEnabled=!!properties[ENABLE]}if(this._movement===ANGLE)this._mag=C3.toRadians(this._mag);this.Init();if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"i":this._i,"e":this._isEnabled,"mv":this._movement,"w":this._wave, +"p":this._period,"mag":this._mag,"iv":this._initialValue,"iv2":this._initialValue2,"r":this._ratio,"lkv":this._lastKnownValue,"lkv2":this._lastKnownValue2}}LoadFromJson(o){this._i=o["i"];this._SetEnabled(o["e"]);this._movement=o["mv"];this._wave=o["w"];this._period=o["p"];this._mag=o["mag"];this._initialValue=o["iv"];this._initialValue2=o["iv2"];this._ratio=o["r"];this._lastKnownValue=o["lkv"];this._lastKnownValue2=o["lkv2"]}Init(){const wi=this._inst.GetWorldInfo();switch(this._movement){case HORIZONTAL:this._initialValue= +wi.GetX();break;case VERTICAL:this._initialValue=wi.GetY();break;case SIZE:this._initialValue=wi.GetWidth();this._ratio=wi.GetHeight()/wi.GetWidth();break;case WIDTH:this._initialValue=wi.GetWidth();break;case HEIGHT:this._initialValue=wi.GetHeight();break;case ANGLE:this._initialValue=wi.GetAngle();break;case OPACITY:this._initialValue=wi.GetOpacity();break;case VALUE:this._initialValue=0;break;case FORWARDS_BACKWARDS:this._initialValue=wi.GetX();this._initialValue2=wi.GetY();break;case ZELEVATION:this._initialValue= +wi.GetZElevation();break;default:}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(x){x=x%_2pi;switch(this._wave){case SINE:return Math.sin(x);case TRIANGLE:if(x<=_pi_2)return x/_pi_2;else if(x<=_3pi_2)return 1-2*(x-_pi_2)/Math.PI;else return(x-_3pi_2)/_pi_2-1;case SAWTOOTH:return 2*x/_2pi-1;case REVERSE_SAWTOOTH:return-2*x/_2pi+1;case SQUARE:return xthis._SetEnabled(v)},{name:prefix+".properties.period.name",value:this._GetPeriod(),onedit:v=>this._SetPeriod(v)}, +{name:prefix+".properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:v=>this._SetMagnitude_ConvertAngle(v)},{name:prefix+".debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};const map=new WeakMap;const VALID_MOVEMENTS=["horizontal","vertical","size","width","height","angle","opacity","value-only","forwards-backwards","z-elevation"];const VALID_WAVES=["sine","triangle","sawtooth", +"reverse-sawtooth","square"];self.ISineBehaviorInstance=class ISineBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}set period(x){C3X.RequireFiniteNumber(x);map.get(this)._SetPeriod(x)}get period(){return map.get(this)._GetPeriod()}set magnitude(m){C3X.RequireFiniteNumber(m);map.get(this)._SetMagnitude(m)}get magnitude(){return map.get(this)._GetMagnitude()}set phase(p){map.get(this)._SetPhase(p)}get phase(){return map.get(this)._GetPhase()}set movement(m){C3X.RequireString(m); +const i=VALID_MOVEMENTS.indexOf(m);if(i===-1)throw new Error("invalid movement");map.get(this)._SetMovement(i)}get movement(){return VALID_MOVEMENTS[map.get(this)._GetMovement()]}set wave(w){C3X.RequireString(w);const i=VALID_WAVES.indexOf(w);if(i===-1)throw new Error("invalid wave");map.get(this)._SetWave(i)}get wave(){return VALID_WAVES[map.get(this)._GetWave()]}get value(){const inst=map.get(this);return inst.WaveFunc(inst._GetPhase())*inst._GetMagnitude()}updateInitialState(){map.get(this).Init()}set isEnabled(e){map.get(this)._SetEnabled(!!e)}get isEnabled(){return map.get(this)._IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(m){return this._GetMovement()===m},ComparePeriod(cmp,v){return C3.compare(this._GetPeriod(),cmp,v)},CompareMagnitude(cmp,v){return C3.compare(this._GetMagnitude_ConvertAngle(),cmp,v)},CompareWave(w){return this._GetWave()===w}}} +{const C3=self.C3;C3.Behaviors.Sin.Acts={SetEnabled(e){this._SetEnabled(e!==0)},SetPeriod(x){this._SetPeriod(x)},SetMagnitude(x){this._SetMagnitude_ConvertAngle(x)},SetMovement(m){this._SetMovement(m)},SetWave(w){this._wave=w},SetPhase(x){const _2pi=Math.PI*2;this._SetPhase(x*_2pi%_2pi)},UpdateInitialState(){this.Init()}}} +{const C3=self.C3;C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Fade=class FadeBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Fade.Type=class FadeType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const FADE_IN_TIME=0;const WAIT_TIME=1;const FADE_OUT_TIME=2;const DESTROY=3;const ACTIVE_AT_START=4;C3.Behaviors.Fade.Instance=class FadeInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._fadeInTime=0;this._waitTime=0;this._fadeOutTime=0;this._destroy=true;this._activeAtStart=true;this._setMaxOpacity=false;this._stage=0;this._stageTime=C3.New(C3.KahanSum);this._maxOpacity= +this._inst.GetWorldInfo().GetOpacity()||1;if(properties){this._fadeInTime=properties[FADE_IN_TIME];this._waitTime=properties[WAIT_TIME];this._fadeOutTime=properties[FADE_OUT_TIME];this._destroy=!!properties[DESTROY];this._activeAtStart=!!properties[ACTIVE_AT_START];this._stage=this._activeAtStart?0:3}if(this._activeAtStart)if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"fit":this._fadeInTime, +"wt":this._waitTime,"fot":this._fadeOutTime,"d":this._destroy,"s":this._stage,"st":this._stageTime.Get(),"mo":this._maxOpacity}}LoadFromJson(o){this._fadeInTime=o["fit"];this._waitTime=o["wt"];this._fadeOutTime=o["fot"];this._destroy=o["d"];this._stage=o["s"];this._stageTime.Set(o["st"]);this._maxOpacity=o["mo"]}Tick(){const dt=this._runtime.GetDt(this._inst);this._stageTime.Add(dt);const wi=this._inst.GetWorldInfo();if(this._stage===0){wi.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity); +this._runtime.UpdateRender();if(wi.GetOpacity()>=this._maxOpacity){wi.SetOpacity(this._maxOpacity);this._stage=1;this._stageTime.Reset();this.DispatchScriptEvent("fadeinend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeInEnd)}}if(this._stage===1)if(this._stageTime.Get()>=this._waitTime){this._stage=2;this._stageTime.Reset();this.DispatchScriptEvent("waitend");this.Trigger(C3.Behaviors.Fade.Cnds.OnWaitEnd)}if(this._stage===2)if(this._fadeOutTime!==0){wi.SetOpacity(this._maxOpacity-this._stageTime.Get()/ +this._fadeOutTime*this._maxOpacity);this._runtime.UpdateRender();if(wi.GetOpacity()<=0){this._stage=3;this._stageTime.Reset();this.DispatchScriptEvent("fadeoutend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeOutEnd);if(this._destroy)this._runtime.DestroyInstance(this._inst)}}}_StartFade(){if(!this._activeAtStart&&!this._setMaxOpacity){this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;this._setMaxOpacity=true}if(this._stage===3)this.Start()}_RestartFade(){this.Start()}Start(){this._stage=0; +this._stageTime.Reset();if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}}_SetFadeInTime(t){this._fadeInTime=Math.max(t,0)}_GetFadeInTime(){return this._fadeInTime}_SetWaitTime(t){this._waitTime=Math.max(t,0)}_GetWaitTime(){return this._waitTime}_SetFadeOutTime(t){this._fadeOutTime=Math.max(t,0)}_GetFadeOutTime(){return this._fadeOutTime}GetPropertyValueByIndex(index){switch(index){case FADE_IN_TIME:return this._GetFadeInTime(); +case WAIT_TIME:return this._GetWaitTime();case FADE_OUT_TIME:return this._GetFadeOutTime();case DESTROY:return this._destroy}}SetPropertyValueByIndex(index,value){switch(index){case FADE_IN_TIME:this._SetFadeInTime(value);break;case WAIT_TIME:this._SetWaitTime(value);break;case FADE_OUT_TIME:this._SetFadeOutTime(value);break;case DESTROY:this._destroy=!!value;break}}GetDebuggerProperties(){const prefix="behaviors.fade";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.fade-in-time.name", +value:this._GetFadeInTime(),onedit:v=>this._SetFadeInTime(v)},{name:prefix+".properties.wait-time.name",value:this._GetWaitTime(),onedit:v=>this._SetWaitTime(v)},{name:prefix+".properties.fade-out-time.name",value:this._GetFadeOutTime(),onedit:v=>this._SetFadeOutTime(v)},{name:prefix+".debugger.stage",value:[prefix+".debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}GetScriptInterfaceClass(){return self.IFadeBehaviorInstance}};const map=new WeakMap;self.IFadeBehaviorInstance=class IFadeBehaviorInstance extends IBehaviorInstance{constructor(){super(); +map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startFade(){map.get(this)._StartFade()}restartFade(){map.get(this)._RestartFade()}set fadeInTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeInTime(t)}get fadeInTime(){return map.get(this)._GetFadeInTime()}set waitTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetWaitTime(t)}get waitTime(){return map.get(this)._GetWaitTime()}set fadeOutTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeOutTime(t)}get fadeOutTime(){return map.get(this)._GetFadeOutTime()}}} +{const C3=self.C3;C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return true},OnFadeInEnd(){return true},OnWaitEnd(){return true}}}{const C3=self.C3;C3.Behaviors.Fade.Acts={StartFade(){this._StartFade()},RestartFade(){this._RestartFade()},SetFadeInTime(t){this._SetFadeInTime(t)},SetWaitTime(t){this._SetWaitTime(t)},SetFadeOutTime(t){this._SetFadeOutTime(t)}}}{const C3=self.C3;C3.Behaviors.Fade.Exps={FadeInTime(){return this._GetFadeInTime()},WaitTime(){return this._GetWaitTime()},FadeOutTime(){return this._GetFadeOutTime()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Bullet=class BulletBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Bullet.Type=class BulletType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const SPEED=0;const ACCELERATION=1;const GRAVITY=2;const BOUNCE_OFF_SOLIDS=3;const SET_ANGLE=4;const STEPPING=5;const ENABLE=6;C3.Behaviors.Bullet.Instance=class BulletInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);const wi=this.GetWorldInfo();this._speed=0;this._acc=0;this._g=0;this._bounceOffSolid=false;this._setAngle=false;this._isStepping=false;this._isEnabled=true;this._dx= +0;this._dy=0;this._lastX=wi.GetX();this._lastY=wi.GetY();this._lastKnownAngle=wi.GetAngle();this._travelled=0;this._stepSize=Math.min(Math.abs(wi.GetWidth()),Math.abs(wi.GetHeight())/2);this._stopStepping=false;if(properties){this._speed=properties[SPEED];this._acc=properties[ACCELERATION];this._g=properties[GRAVITY];this._bounceOffSolid=!!properties[BOUNCE_OFF_SOLIDS];this._setAngle=!!properties[SET_ANGLE];this._isStepping=!!properties[STEPPING];this._isEnabled=!!properties[ENABLE]}const a=wi.GetAngle(); +this._dx=Math.cos(a)*this._speed;this._dy=Math.sin(a)*this._speed;if(this._isEnabled){this._StartTicking();if(this._bounceOffSolid)this._StartPostTicking()}}Release(){super.Release()}SaveToJson(){const o={"dx":this._dx,"dy":this._dy,"lx":this._lastX,"ly":this._lastY,"lka":this._lastKnownAngle,"t":this._travelled};if(this._acc!==0)o["acc"]=this._acc;if(this._g!==0)o["g"]=this._g;if(this._isStepping)o["st"]=this._isStepping;if(!this._isEnabled)o["e"]=this._isEnabled;if(this._bounceOffSolid)o["bos"]= +this._bounceOffSolid;if(this._setAngle)o["sa"]=this._setAngle;return o}LoadFromJson(o){this._dx=o["dx"];this._dy=o["dy"];this._lastX=o["lx"];this._lastY=o["ly"];this._lastKnownAngle=o["lka"];this._travelled=o["t"];this._acc=o.hasOwnProperty("acc")?o["acc"]:0;this._g=o.hasOwnProperty("g")?o["g"]:0;this._isStepping=o.hasOwnProperty("st")?o["st"]:false;this._bounceOffSolid=o.hasOwnProperty("bos")?o["bos"]:false;this._setAngle=o.hasOwnProperty("sa")?o["sa"]:false;this._SetEnabled(o.hasOwnProperty("e")? +o["e"]:true)}Tick(){if(!this._isEnabled)return;const dt=this._runtime.GetDt(this._inst);const wi=this._inst.GetWorldInfo();if(wi.GetAngle()!==this._lastKnownAngle){const angle=wi.GetAngle();if(this._setAngle){const s=C3.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(angle)*s;this._dy=Math.sin(angle)*s}this._lastKnownAngle=angle}let xacc=0;let yacc=0;if(this._acc!==0){let s=C3.distanceTo(0,0,this._dx,this._dy);let a=0;if(this._dx===0&&this._dy===0)a=wi.GetAngle();else a=C3.angleTo(0,0,this._dx, +this._dy);s+=this._acc*dt;xacc=Math.cos(a)*this._acc;yacc=Math.sin(a)*this._acc;if(s<0){s=0;xacc=0;yacc=0}this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}if(this._g!==0){this._dy+=this._g*dt;yacc+=this._g}this._lastX=wi.GetX();this._lastY=wi.GetY();if(this._dx!==0||this._dy!==0){const mx=this._dx*dt+.5*xacc*dt*dt;const my=this._dy*dt+.5*yacc*dt*dt;const stepDist=C3.distanceTo(0,0,mx,my);this._MoveBy(mx,my,stepDist);this._travelled+=stepDist;if(this._setAngle&&(mx!==0||my!==0)){const a=C3.angleTo(0, +0,mx,my);wi.SetAngle(a);this._lastKnownAngle=wi.GetAngle()}wi.SetBboxChanged()}}_MoveBy(mx,my,stepDist){const wi=this.GetWorldInfo();if(!this._isStepping||stepDist<=this._stepSize){wi.OffsetXY(mx,my);wi.SetBboxChanged();if(this._isStepping)this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep);return}this._stopStepping=false;const startX=wi.GetX();const startY=wi.GetY();const endX=startX+mx;const endY=startY+my;const a=C3.angleTo(0,0,mx,my);const stepX=Math.cos(a)*this._stepSize;const stepY=Math.sin(a)*this._stepSize; +const stepCount=Math.floor(stepDist/this._stepSize);for(let i=1;i<=stepCount;++i){wi.SetXY(startX+stepX*i,startY+stepY*i);wi.SetBboxChanged();this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep);if(this._inst.IsDestroyed()||this._stopStepping)return}wi.SetXY(endX,endY);wi.SetBboxChanged();this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep)}PostTick(){if(!this._isEnabled||!this._bounceOffSolid||this._dx===0&&this._dy===0)return;const dt=this._runtime.GetDt(this._inst);const wi=this._inst.GetWorldInfo();const collisionEngine= +this._runtime.GetCollisionEngine();const bounceSolid=collisionEngine.TestOverlapSolid(this._inst);if(bounceSolid){collisionEngine.RegisterCollision(this._inst,bounceSolid);const s=C3.distanceTo(0,0,this._dx,this._dy);const bounceAngle=collisionEngine.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(bounceAngle)*s;this._dy=Math.sin(bounceAngle)*s;wi.OffsetXY(this._dx*dt,this._dy*dt);wi.SetBboxChanged();if(this._setAngle){wi.SetAngle(bounceAngle);this._lastKnownAngle=wi.GetAngle(); +wi.SetBboxChanged()}if(!collisionEngine.PushOutSolid(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30)))collisionEngine.PushOutSolidNearest(this._inst,100)}}GetPropertyValueByIndex(index){switch(index){case SPEED:return this._GetSpeed();case ACCELERATION:return this._GetAcceleration();case GRAVITY:return this._GetGravity();case SET_ANGLE:return this._setAngle;case STEPPING:return this._isStepping;case ENABLE:return this._IsEnabled()}}SetPropertyValueByIndex(index,value){switch(index){case SPEED:this._SetSpeed(value); +break;case ACCELERATION:this._acc=value;break;case GRAVITY:this._g=value;break;case SET_ANGLE:this._setAngle=!!value;break;case STEPPING:this._isStepping=!!value;break;case ENABLE:this._SetEnabled(!!value);break}}_SetSpeed(s){const a=C3.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}_GetSpeed(){return C3.round6dp(C3.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(a){this._acc=a}_GetAcceleration(){return this._acc}_SetGravity(g){this._g=g}_GetGravity(){return this._g}_SetAngleOfMotion(a){const s= +C3.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(a)*s;this._dy=Math.sin(a)*s}_GetAngleOfMotion(){return C3.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(b){b=!!b;if(this._bounceOffSolid===b)return;this._bounceOffSolid=b;if(this._isEnabled)if(this._bounceOffSolid)this._StartPostTicking();else this._StopPostTicking()}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(d){this._travelled=d}_GetDistanceTravelled(){return this._travelled}_SetEnabled(e){this._isEnabled=!!e; +if(this._isEnabled){this._StartTicking();if(this._bounceOffSolid)this._StartPostTicking()}else{this._StopTicking();this._StopPostTicking()}}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const prefix="behaviors.bullet";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".debugger.vector-x",value:this._dx,onedit:v=>this._dx=v},{name:prefix+".debugger.vector-y",value:this._dy,onedit:v=>this._dy=v},{name:prefix+".properties.speed.name",value:this._GetSpeed(),onedit:v=> +this._SetSpeed(v)},{name:prefix+".debugger.angle-of-motion",value:C3.toDegrees(this._GetAngleOfMotion())},{name:prefix+".properties.gravity.name",value:this._GetGravity(),onedit:v=>this._SetGravity(v)},{name:prefix+".properties.acceleration.name",value:this._GetAcceleration(),onedit:v=>this._SetAcceleration(v)},{name:prefix+".debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}}; +const map=new WeakMap;self.IBulletBehaviorInstance=class IBulletBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get speed(){return map.get(this)._GetSpeed()}set speed(s){C3X.RequireFiniteNumber(s);map.get(this)._SetSpeed(s)}get acceleration(){return map.get(this)._GetAcceleration()}set acceleration(a){C3X.RequireFiniteNumber(a);map.get(this)._SetAcceleration(a)}get gravity(){return map.get(this)._GetGravity()}set gravity(g){C3X.RequireFiniteNumber(g); +map.get(this)._SetGravity(g)}get angleOfMotion(){return map.get(this)._GetAngleOfMotion()}set angleOfMotion(a){C3X.RequireFiniteNumber(a);map.get(this)._SetAngleOfMotion(a)}get bounceOffSolids(){return map.get(this)._IsBounceOffSolids()}set bounceOffSolids(b){map.get(this)._SetBounceOffSolids(!!b)}get distanceTravelled(){return map.get(this)._GetDistanceTravelled()}set distanceTravelled(d){C3X.RequireFiniteNumber(d);map.get(this)._SetDistanceTravelled(d)}get isEnabled(){return map.get(this)._IsEnabled()}set isEnabled(e){map.get(this)._SetEnabled(e)}}} +{const C3=self.C3;C3.Behaviors.Bullet.Cnds={CompareSpeed(cmp,s){const speed=Math.hypot(this._dx,this._dy);return C3.compare(speed,cmp,s)},CompareTravelled(cmp,d){return C3.compare(this._GetDistanceTravelled(),cmp,d)},OnStep(){return true},IsEnabled(){return this._IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.Bullet.Acts={SetSpeed(s){this._SetSpeed(s)},SetAcceleration(a){this._SetAcceleration(a)},SetGravity(g){this._SetGravity(g)},SetAngleOfMotion(a){this._SetAngleOfMotion(C3.toRadians(a))},Bounce(objectClass){if(!objectClass)return;const otherInst=objectClass.GetFirstPicked(this._inst);if(!otherInst)return;const wi=this._inst.GetWorldInfo();const collisionEngine=this._runtime.GetCollisionEngine();const dt=this._runtime.GetDt(this._inst);const s=C3.distanceTo(0,0,this._dx, +this._dy);const bounceAngle=collisionEngine.CalculateBounceAngle(this._inst,this._lastX,this._lastY,otherInst);this._dx=Math.cos(bounceAngle)*s;this._dy=Math.sin(bounceAngle)*s;wi.OffsetXY(this._dx*dt,this._dy*dt);wi.SetBboxChanged();if(this._setAngle){wi.SetAngle(bounceAngle);this._lastKnownAngle=wi.GetAngle();wi.SetBboxChanged()}if(s!==0)if(this._bounceOffSolid){if(!collisionEngine.PushOutSolid(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30)))collisionEngine.PushOutSolidNearest(this._inst, +100)}else collisionEngine.PushOut(this._inst,this._dx/s,this._dy/s,Math.max(s*2.5*dt,30),otherInst)},SetBounceOffSolids(b){this._SetBounceOffSolids(b)},SetDistanceTravelled(d){this._SetDistanceTravelled(d)},SetEnabled(e){this._SetEnabled(e)},StopStepping(){this._stopStepping=true}}} +{const C3=self.C3;C3.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return C3.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.wrap=class WrapBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.wrap.Type=class WrapType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const MODE=0;const bound=new C3.Rect;C3.Behaviors.wrap.Instance=class WrapInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._mode=0;if(properties)this._mode=properties[MODE];this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"m":this._mode}}LoadFromJson(o){this._mode=o["m"]}Tick(){const wi=this._inst.GetWorldInfo();const layer=wi.GetLayer();const layout=layer.GetLayout();const bbox=wi.GetBoundingBox();if(this._mode=== +0)bound.set(0,0,layout.GetWidth(),layout.GetHeight());else bound.copy(layer.GetViewport());if(bbox.getRight()bound.getRight()){wi.SetX(bound.getLeft()+1-(bbox.getRight()-wi.GetX()));wi.SetBboxChanged()}else if(bbox.getBottom()bound.getBottom()){wi.SetY(bound.getTop()+1-(bbox.getBottom()- +wi.GetY()));wi.SetBboxChanged()}}GetPropertyValueByIndex(index){switch(index){case MODE:return this._mode}}SetPropertyValueByIndex(index,value){switch(index){case MODE:this._mode=value;break}}}}{const C3=self.C3;C3.Behaviors.wrap.Cnds={}}{const C3=self.C3;C3.Behaviors.wrap.Acts={}}{const C3=self.C3;C3.Behaviors.wrap.Exps={}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.scrollto=class ScrollToBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts);this._shakeMag=0;this._shakeStart=0;this._shakeEnd=0;this._shakeMode=0}Release(){super.Release()}SetShakeMagnitude(m){this._shakeMag=m}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(s){this._shakeStart=s}GetShakeStart(){return this._shakeStart}SetShakeEnd(s){this._shakeEnd=s}GetShakeEnd(){return this._shakeEnd}SetShakeMode(m){this._shakeMode=m}GetShakeMode(){return this._shakeMode}}} +{const C3=self.C3;C3.Behaviors.scrollto.Type=class ScrollToType extends C3.SDKBehaviorTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const ENABLE=0;C3.Behaviors.scrollto.Instance=class ScrollToInstance extends C3.SDKBehaviorInstanceBase{constructor(inst,properties){super(inst);this._isEnabled=true;if(properties)this._isEnabled=properties[ENABLE];if(this._isEnabled)this._StartTicking2()}Release(){super.Release()}SaveToJson(){const behavior=this.GetBehavior();return{"e":this._isEnabled,"smg":behavior.GetShakeMagnitude(),"ss":behavior.GetShakeStart(),"se":behavior.GetShakeEnd(),"smd":behavior.GetShakeMode()}}LoadFromJson(o){const behavior= +this.GetBehavior();behavior.SetShakeMagnitude(o["smg"]);behavior.SetShakeStart(o["ss"]);behavior.SetShakeEnd(o["se"]);behavior.SetShakeMode(o["smd"]);this._isEnabled=o["e"];if(this._isEnabled)this._StartTicking2();else this._StopTicking2()}_SetEnabled(e){this._isEnabled=!!e;if(this._isEnabled)this._StartTicking2();else this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(!this.IsEnabled())return;const dt=this._runtime.GetDt(this._inst);const behavior=this.GetBehavior();const allInstances= +behavior.GetInstances();let sumX=0;let sumY=0;let count=0;for(const inst of allInstances){const behInst=inst.GetBehaviorInstanceFromCtor(C3.Behaviors.scrollto);if(!behInst||!behInst.GetSdkInstance().IsEnabled())continue;const wi=inst.GetWorldInfo();sumX+=wi.GetX();sumY+=wi.GetY();++count}const layout=this._inst.GetWorldInfo().GetLayout();const now=this._runtime.GetGameTime();let offX=0;let offY=0;if(now>=behavior.GetShakeStart()&&nowthis._SetEnabled(v)}]}]}}}{const C3=self.C3;C3.Behaviors.scrollto.Cnds={IsEnabled(){return this.IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.scrollto.Acts={Shake(mag,dur,mode){const behavior=this.GetBehavior();behavior.SetShakeMagnitude(mag);behavior.SetShakeStart(this._runtime.GetGameTime());behavior.SetShakeEnd(this._runtime.GetGameTime()+dur);behavior.SetShakeMode(mode)},SetEnabled(e){this._SetEnabled(e!==0)}}}{const C3=self.C3;C3.Behaviors.scrollto.Exps={}}; + +} + +{ +"use strict"; +var C3 = self.C3; +{ + C3.Behaviors.skymen_Skymen_SpritefontDX = class Skymen_SpritefontDXBehavior extends C3.SDKBehaviorBase + { + constructor(opts) + { + super(opts); + } + + Release() + { + super.Release(); + } + }; +} +} + +{ +"use strict"; +var C3 = self.C3; +{ + C3.Behaviors.skymen_Skymen_SpritefontDX.Type = class Skymen_SpritefontDXType extends C3.SDKBehaviorTypeBase + { + constructor(objectClass) + { + super(objectClass); + } + + Release() + { + super.Release(); + } + + OnCreate() + {} + }; +} +} + +{ +"use strict"; +var C3 = self.C3; + +const easingNames = ["linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint", "easeInSine", "easeOutSine", "easeInOutSine", "easeInExpo", "easeOutExpo", "easeInOutExpo", "easeInCirc", "easeOutCirc", "easeInOutCirc", "easeOutBounce", "easeInBack", "easeOutBack", "easeInOutBack", "elastic", "swingFromTo", "swingFrom", "swingTo", "bounce", "bouncePast", "easeFromTo", "easeFrom", "easeTo"] + +var EasingFunctions = { + // no easing, no acceleration + "linear": function(t) + { + return t + }, + // accelerating from zero velocity + "easeInQuad": function(t) + { + return t * t + }, + // decelerating to zero velocity + "easeOutQuad": function(t) + { + return t * (2 - t) + }, + // acceleration until halfway, then deceleration + "easeInOutQuad": function(t) + { + return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t + }, + // accelerating from zero velocity + "easeInCubic": function(t) + { + return t * t * t + }, + // decelerating to zero velocity + "easeOutCubic": function(t) + { + return (--t) * t * t + 1 + }, + // acceleration until halfway, then deceleration + "easeInOutCubic": function(t) + { + return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1 + }, + // accelerating from zero velocity + "easeInQuart": function(t) + { + return t * t * t * t + }, + // decelerating to zero velocity + "easeOutQuart": function(t) + { + return 1 - (--t) * t * t * t + }, + // acceleration until halfway, then deceleration + "easeInOutQuart": function(t) + { + return t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t + }, + // accelerating from zero velocity + "easeInQuint": function(t) + { + return t * t * t * t * t + }, + // decelerating to zero velocity + "easeOutQuint": function(t) + { + return 1 + (--t) * t * t * t * t + }, + // acceleration until halfway, then deceleration + "easeInOutQuint": function(t) + { + return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t + }, + + "easeInSine": function(pos) + { + return -Math.cos(pos * (Math.PI / 2)) + 1; + }, + + "easeOutSine": function(pos) + { + return Math.sin(pos * (Math.PI / 2)); + }, + + "easeInOutSine": function(pos) + { + return (-0.5 * (Math.cos(Math.PI * pos) - 1)); + }, + + "easeInExpo": function(pos) + { + return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1)); + }, + + "easeOutExpo": function(pos) + { + return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1; + }, + + "easeInOutExpo": function(pos) + { + if (pos === 0) return 0; + if (pos === 1) return 1; + if ((pos /= 0.5) < 1) return 0.5 * Math.pow(2, 10 * (pos - 1)); + return 0.5 * (-Math.pow(2, -10 * --pos) + 2); + }, + + "easeInCirc": function(pos) + { + return -(Math.sqrt(1 - (pos * pos)) - 1); + }, + + "easeOutCirc": function(pos) + { + return Math.sqrt(1 - Math.pow((pos - 1), 2)); + }, + + "easeInOutCirc": function(pos) + { + if ((pos /= 0.5) < 1) return -0.5 * (Math.sqrt(1 - pos * pos) - 1); + return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1); + }, + + "easeOutBounce": function(pos) + { + if ((pos) < (1 / 2.75)) + { + return (7.5625 * pos * pos); + } + else if (pos < (2 / 2.75)) + { + return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); + } + else if (pos < (2.5 / 2.75)) + { + return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); + } + else + { + return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); + } + }, + + "easeInBack": function(pos) + { + var s = 1.70158; + return (pos) * pos * ((s + 1) * pos - s); + }, + + "easeOutBack": function(pos) + { + var s = 1.70158; + return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1; + }, + + "easeInOutBack": function(pos) + { + var s = 1.70158; + if ((pos /= 0.5) < 1) return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)); + return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2); + }, + + "elastic": function(pos) + { + return -1 * Math.pow(4, -8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1; + }, + + "swingFromTo": function(pos) + { + var s = 1.70158; + return ((pos /= 0.5) < 1) ? 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) : + 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2); + }, + + "swingFrom": function(pos) + { + var s = 1.70158; + return pos * pos * ((s + 1) * pos - s); + }, + + "swingTo": function(pos) + { + var s = 1.70158; + return (pos -= 1) * pos * ((s + 1) * pos + s) + 1; + }, + + "bounce": function(pos) + { + if (pos < (1 / 2.75)) + { + return (7.5625 * pos * pos); + } + else if (pos < (2 / 2.75)) + { + return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); + } + else if (pos < (2.5 / 2.75)) + { + return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); + } + else + { + return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); + } + }, + + "bouncePast": function(pos) + { + if (pos < (1 / 2.75)) + { + return (7.5625 * pos * pos); + } + else if (pos < (2 / 2.75)) + { + return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75); + } + else if (pos < (2.5 / 2.75)) + { + return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375); + } + else + { + return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375); + } + }, + + "easeFromTo": function(pos) + { + if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4); + return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2); + }, + + "easeFrom": function(pos) + { + return Math.pow(pos, 4); + }, + + "easeTo": function(pos) + { + return Math.pow(pos, 0.25); + } +} + +function cos(x) +{ + return Math.cos(x * Math.PI / 180); +} + +function sin(x) +{ + return Math.sin(x * Math.PI / 180); +} + +function random(x) +{ + return Math.random() * x; +} +var sdk_runtime; +function c3easing(time, name, magnitude = 1, duration = 1, pingpong = false) +{ + time = ((time % (duration * 2)) + duration * 2) % (duration * 2) + let transition = sdk_runtime._transitionManager._transitions.find(x=>x._name.toLowerCase()===name.toLowerCase()); + if (!transition) return 0; + let progress = pingpong && time % (duration * 2) > duration ? duration - (time % duration) : time % duration; + return transition.Interpolate(progress, 0, magnitude, duration); +} + +function hslToRgb(hue, saturation, lightness) +{ + // based on algorithm from http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB + if (hue == undefined) + { + return [0, 0, 0]; + } + + var chroma = (1 - Math.abs((2 * lightness) - 1)) * saturation; + var huePrime = hue / 60; + var secondComponent = chroma * (1 - Math.abs((huePrime % 2) - 1)); + + huePrime = Math.floor(huePrime); + var red; + var green; + var blue; + + if (huePrime === 0) + { + red = chroma; + green = secondComponent; + blue = 0; + } + else if (huePrime === 1) + { + red = secondComponent; + green = chroma; + blue = 0; + } + else if (huePrime === 2) + { + red = 0; + green = chroma; + blue = secondComponent; + } + else if (huePrime === 3) + { + red = 0; + green = secondComponent; + blue = chroma; + } + else if (huePrime === 4) + { + red = secondComponent; + green = 0; + blue = chroma; + } + else if (huePrime === 5) + { + red = chroma; + green = 0; + blue = secondComponent; + } + + var lightnessAdjustment = lightness - (chroma / 2); + red += lightnessAdjustment; + green += lightnessAdjustment; + blue += lightnessAdjustment; + + return [Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255)]; + +}; +var hsltorgb = hslToRgb; + +function colorToHex(color) +{ + if (color.startsWith("#")) + { + return color + } + if (color.startsWith("hsl")) + { + let[h, s, l] = color.split('(')[1].split(')')[0].split(',').map(x => { + return x.trim() + }) + color = 'rgb(' + hslToRgb(h, s / 100, l / 100).join(',') + ')' + } + if (color.startsWith("rgb")) + { + let[r, g, b] = color.split('(')[1].split(')')[0].split(',').map(x => { + x = parseInt(x.trim()).toString(16); + return (x.length == 1) ? "0" + x : x; + }) + return "#" + r + g + b + } +} +var colortohex = colorToHex; + +function lerpColor(a, b, x) +{ + return lerpHexColor(colorToHex(a), colorToHex(b), x) +} +var lerpcolor = lerpColor; + +function lerpHexColor(a, b, amount) +{ + + var ah = parseInt(a.replace(/#/g, ''), 16), + ar = ah >> 16, + ag = ah >> 8 & 0xff, + ab = ah & 0xff, + bh = parseInt(b.replace(/#/g, ''), 16), + br = bh >> 16, + bg = bh >> 8 & 0xff, + bb = bh & 0xff, + rr = ar + amount * (br - ar), + rg = ag + amount * (bg - ag), + rb = ab + amount * (bb - ab); + + return '#' + ((1 << 24) + (rr << 16) + (rg << 8) + rb | 0).toString(16).slice(1); +} +var lerphexcolor = lerpHexColor; + +function lerpUnlerp(minOutput, maxOutput, minInput, maxInput, x, clamp = false) +{ + if (clamp) + { + if (x > maxInput) x = maxInput + if (x < minInput) x = minInput + } + return minOutput + ((x - minInput) / (maxInput - minInput)) * (maxOutput - minOutput); +} +var lerpunlerp = lerpUnlerp; + +function unlerp(min, max, x, clamp = false) +{ + if (clamp) + { + if (x > max) x = max + if (x < min) x = min + } + if (min === max && x >= max) return 1 + return (x - min) / (max - min); +} + +function lerp(min, max, x) +{ + let a = typeof min + let b = typeof max + if (a === b) + { + if (a === "number") + { + return x * (max - min) + min; + } + else + { + return lerpColor(min, max, x) + } + } + else + { + if (a === "number") + { + max = parseFloat(max) + } + else + { + min = parseFloat(min) + } + return x * (max - min) + min; + } +} + +self.globalThis.SFDXUtilsFunctions = self.globalThis.SFDXUtilsFunctions || { + cos, sin, random, hslToRgb, hsltorgb, colorToHex, colortohex, lerpColor, lerpcolor, lerpHexColor, lerphexcolor, lerpUnlerp, lerpunlerp, unlerp, lerp, EasingFunctions, easingfunctions: EasingFunctions, c3easing +}; +{ + C3.Behaviors.skymen_Skymen_SpritefontDX.Instance = class Skymen_SpritefontDXInstance extends C3.SDKBehaviorInstanceBase + { + constructor(behInst, properties) + { + super(behInst); + sdk_runtime = this.GetRuntime(); + this.TWData = {} + this.TWTime = 0 + + if (properties) + { + this.TWParams = properties[0]; + this.TWParamsOBJ = this.parseTypewriterParams(this.TWParams); + this.TWEasing = properties[2].trim() !== ""? properties[2] : easingNames[properties[1]]; + + } + this.curTypedWidth = "" + this.curTypedHeight = "" + this.text = "" + this.lastKnown = "" + this.typewriterPaused = false; + this.typewriterActive = false; + this.LastLetterID = 0; + this.typePauseTime = 0; + this.typewriterTagData = []; + this.nextLetterTime = 0; + this.typewriterWait = false; + this.firstFrame = true; + this.animated = false; + this.SetTextCall = false; + this.scheduleMaxCharacterCount = null; + + this.linkedDictionnaryUID = -1 + this.parsedText = [] + this.AnimFunctions = {} + if (!this._inst._objectType._SFDXAliasFunctions) this._inst._objectType._SFDXAliasFunctions = {} + if (properties && properties[3]) { + [ + { + name: "wave", + params: "magnitude, frequency, length", + body: "magnitude * sin(t * frequency + i * length)" + }, + { + name: "swing", + params: "magnitude, frequency, length", + body: "magnitude * cos(t * frequency + i * length)" + }, + { + name: "shake", + params: "magnitude", + body: "random(magnitude)" + }, + ].forEach(defaultAlias => { + let {name, params, body} = defaultAlias; + this.DefineAlias(name, params, body); + }) + } + + this._StartTicking2() + + // Opt-in to getting calls to Tick() + // this._StartTicking(); + } + + + Release() + { + super.Release(); + } + + specialJSONstringify(obj) + { + var placeholder = '____PLACEHOLDER____'; + var fns = []; + var json = JSON.stringify(obj, function(key, value) + { + if (typeof value === 'function') + { + fns.push(value); + return placeholder; + } + return value; + }, 2); + json = json.replace(new RegExp('"' + placeholder + '"', 'g'), function(_) + { + return fns.shift(); + }); + return json; + }; + + specialJSONparse(str) + { + let val; + eval('val =' + str + ';'); + return val; + } + + SaveToJson() + { + return { + curTypedWidth: this.curTypedWidth, + curTypedHeight: this.curTypedHeight, + text: this.text, + typewriterPaused: this.typewriterPaused, + typewriterActive: this.typewriterActive, + LastLetterID: this.LastLetterID, + typePauseTime: this.typePauseTime, + nextLetterTime: this.nextLetterTime, + typewriterWait: this.typewriterWait, + firstFrame: this.firstFrame, + animated: this.animated, + SetTextCall: this.SetTextCall, + scheduleMaxCharacterCount: this.scheduleMaxCharacterCount, + lastKnown: this.lastKnown, + TWTime: this.TWTime, + TWEasing: this.TWEasing, + + typewriterTagData: JSON.stringify(this.typewriterTagData), + TWData: JSON.stringify(this.TWData), + TWParamsOBJ: JSON.stringify(this.TWParamsOBJ), + TWParams: JSON.stringify(this.TWParams), + + AnimFunctions: this.specialJSONstringify(this.AnimFunctions), + parsedText: this.specialJSONstringify(this.parsedText), + _SFDXAliasFunctions: this.specialJSONstringify(this._inst._objectType._SFDXAliasFunctions), + + linkedDictionnaryUID: this.linkedDictionnaryUID + }; + } + + LoadFromJson(o) + { + this.curTypedHeight = o.curTypedHeight + this.curTypedWidth = o.curTypedWidth + this.text = o.text + this.typewriterPaused = o.typewriterPaused + this.typewriterActive = o.typewriterActive + this.LastLetterID = o.LastLetterID + this.typePauseTime = o.typePauseTime + this.nextLetterTime = o.nextLetterTime + this.typewriterWait = o.typewriterWait + this.firstFrame = o.firstFrame + this.animated = o.animated + this.SetTextCall = o.SetTextCall + this.lastKnown = o.lastKnown + this.TWTime = o.TWTime + this.TWEasing = o.TWEasing + this.scheduleMaxCharacterCount = o.scheduleMaxCharacterCount + + this.typewriterTagData = JSON.parse(o.typewriterTagData) + this.TWData = JSON.parse(o.TWData) + this.TWParamsOBJ = JSON.parse(o.TWParamsOBJ) + this.TWParams = JSON.parse(o.TWParams) + + this.AnimFunctions = this.specialJSONparse(o.AnimFunctions) + this.parsedText = this.specialJSONparse(o.parsedText) + this._SFDXAliasFunctions = this.specialJSONparse(o._SFDXAliasFunctions) + + this.linkedDictionnaryUID = o.linkedDictionnaryUID + } + + parseTypewriterParams(params) + { + var paramsA = params.trim().split(';'); + var defaultParams = { + "value": {}, + "duration": { + "type": 5, + "fade": 10 + } + } + + paramsA.forEach(param => { + if (param.trim() === "") return; + var paramA = param.trim().split(' '); + let mode = paramA.shift().toLowerCase(); + if (mode.trim() === "" || paramA.length === 0) return; + let tag = paramA.shift().toLowerCase(); + if (tag.trim() === "" || paramA.length === 0) return; + let value = paramA.join(); + + if (this.isANumber(value)) value = parseFloat(value) + + switch (mode) + { + case "value": + defaultParams["value"][tag] = value + break; + case "duration": + switch (tag) + { + case "type": + defaultParams["duration"]["type"] = value + break; + case "fade": + defaultParams["duration"]["fade"] = value + break; + + default: + console.warn(tag + " is not a recognised typewriter parameter for " + mode + ".") + break; + } + break + default: + console.warn(mode + " is not a recognised typewriter parameter.") + break; + } + }); + + return defaultParams + } + + getDefault(tag) + { + switch (tag) + { + case "offsetx": + case "offsety": + return 0; + case "opacity": + return 100; + case "scale": + case "scalex": + case "scaley": + return 1; + case "color": + return (this._inst._sdkInst._color || this._inst._spriteFontText._color).toHexString(); + case "background": + return '#FFFFFF'; + case "size": + if (self.C3.Plugins.Text && this._inst._objectType._plugin instanceof self.C3.Plugins.Text) + { + return this._inst._sdkInst._ptSize; + } + default: + return 0; + } + } + + IsConditionalTag(tag) + { + return ["hide", "b", "i", "u", "s", "stroke"].includes(tag); + } + + GetTwEasingFunction() { + let transition = sdk_runtime._transitionManager._transitions.find(x=>x._name.toLowerCase() === this.TWEasing.toLowerCase()); + if (transition) { + return (pos) => { + //console.log(pos); + return transition.Interpolate(pos, 0, 1, 1.01); + } + } + if (EasingFunctions[this.TWEasing]) { + return EasingFunctions[this.TWEasing]; + } else { + return EasingFunctions["linear"]; + } + } + + Tick2() + { + //Check if dictionnary is linked after load + if (this.linkedDictionnaryUID != -1 && !this.linkedDictionnary) + { + this.linkedDictionnary = this._runtime.GetInstanceByUID(this.linkedDictionnaryUID) + } + + //If instance action Set Text is called + if (!this.SetTextCall && this.animated && this._inst._sdkInst._text != this.lastKnown) + { + this.animated = false; + } + + if (this.SetTextCall) this.SetTextCall = false + + if (this.animated) + { + const time = this._runtime.GetGameTime(); + var str = "" + var word = false + if (this.typewriterActive) + { + let id = 0 + this.parsedText.forEach(el => { + for (let i = 0; i < el[1].length; i++) + { + let tags = {} + + el[0].forEach(tag => { + if (typeof tag[1] === "function") tags[tag[0]] = tag[1](time, i) + else tags[tag[0]] = tag[1] + }) + + if (this.TWTime >= this.TWData.start[id][0] && this.TWData.data[id].hasOwnProperty("pause")) + { + this.typewriterPaused = true + delete this.TWData.data[id].pause; + this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwPause) + } + if (this.TWTime >= this.TWData.start[id][0] && this.TWData.data[id].hasOwnProperty("fn")) + { + let fnData = this.TWData.data[id].fn.split(' ') + let fnName = fnData.shift() + let fnParams = JSON.parse("[" + fnData.join(' ') + "]") || [] + self.c3_callFunction(fnName, fnParams) + delete this.TWData.data[id].fn; + } + + Object.keys(this.TWData.data[id]).forEach(tag => { + if (!tags.hasOwnProperty(tag)) + { + tags[tag] = this.getDefault(tag) + } + tags[tag] = lerp(this.TWData.data[id][tag], tags[tag], this.GetTwEasingFunction()(unlerp(this.TWData.start[id][0], this.TWData.start[id][1], this.TWTime, true))) + }) + + let end = "" + + Object.keys(tags).forEach(tag => { + if (!["wait", "fade", "type", "pause"].includes(tag)) + { + if (!this.IsConditionalTag(tag) || tags[tag]) + { + str += "[" + tag + "=" + tags[tag] + "]" + end = "[/" + tag + "]" + end + } + } + }) + + let innerText = "" + let tmp = el[1][i] + if (typeof tmp != "string") + { + innerText += tmp() + } + else + { + innerText = tmp + } + + str += innerText + end + + if (!this.typewriterPaused && this.TWTime >= this.TWData.start[id][0] && this.LastLetterID < id) + { + this.LastLetterID = id + this.LastLetter = this.getTextWithNoTags(str)[id]; + this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnLetterTyped) + word = true + this.curTypedWidth = str + } + + if (word) + { + this.curTypedHeight = str + if (el[1][i] === " ") word = false + } + + id++ + } + }) + this.SetDrawMaxCharacterCount(this.LastLetterID, str); + + if (this.TWTime >= this.TWData.start[this.TWData.start.length - 1][1]) + { + //TW END + this.SetDrawMaxCharacterCount(-1); + this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStop) + this.typewriterActive = false + } + + + if (!this.typewriterPaused) this.TWTime += this._runtime.GetDt(this._inst) + } + else + { + this.parsedText.forEach(el => { + if (el[0].length == 0) + { + let innerText = "" + let tmp = el[1] + if (typeof tmp != "string") + { + tmp.forEach(f => { + innerText += f() + }) + } + else + { + innerText = tmp + } + //console.log(innerText) + str += innerText + } + else + { + for (let i = 0; i < el[1].length; i++) + { + let end = "" + el[0].forEach(tag => { + let val + if (typeof tag[1] === "function") val = tag[1](time, i) + else val = tag[1] + if (!this.IsConditionalTag(tag[0]) || val) + { + str += "[" + tag[0] + "=" + val + "]" + end = "[/" + tag[0] + "]" + end + } + }) + let innerText = "" + let tmp = el[1][i] + if (typeof tmp != "string") + { + innerText += tmp() + } + else + { + innerText = tmp + } + str += innerText + end + } + } + }) + } + this.lastKnown = str + //console.log(str) + + this.SetText(str); + } + } + + GetNbNewlines(nb, text) + { + let tmp = this._inst._sdkInst._text; + this.SetText(text); + text = this.getTextWithNoTags(text); + text = text.slice(0, nb + 1); + let renderer = this.GetRendererText(); + let tmp2 = renderer.GetDrawMaxCharacterCount(); + renderer.SetDrawMaxCharacterCount(-1); + renderer._MaybeWrapText(); + let lines = C3.cloneArray(renderer._wrappedText.GetLines()); + renderer.SetDrawMaxCharacterCount(tmp2); + + let nbLines = 0; + if (lines.length > 1) { + let start = ""; + let prop = "text"; + lines[0].fragments.forEach(frag => { + if (prop === "text" && frag.hasOwnProperty("text")) { + start += frag.text; + } else { + prop = "chArr"; + start += frag.chArr.join(''); + } + }) + while (text.length > 0 && (text.startsWith(start) || start.startsWith(text))) + { + nbLines++; + lines.shift() + text = text.slice(start.length).trimStart(); + if (lines.length > 0) { + start = ""; + lines[0].fragments.forEach(frag => { + if (prop === "text") { + start += frag.text; + } else { + start += frag.chArr.join(''); + } + }) + } + } + } + + nbLines -= text === ""; + this.SetText(tmp); + + return nbLines; + } + + SetDrawMaxCharacterCount(nb, text = null) + { + this.scheduleMaxCharacterCount = null; + if (text) + { + nb += 1; + nb -= this.GetNbNewlines(nb, text); + } + this.scheduleMaxCharacterCount = nb; + } + + SetText(str) + { + this._inst._sdkInst.CallAction(this.GetSetTexttAct(), str); + if (this.scheduleMaxCharacterCount != null && this.scheduleMaxCharacterCount !== this.GetRendererText().GetDrawMaxCharacterCount()) + { + this.GetRendererText().SetDrawMaxCharacterCount(this.scheduleMaxCharacterCount); + this._runtime.UpdateRender(); + this.scheduleMaxCharacterCount = null; + } + } + + GetRendererText() { + if (self.C3.Plugins.Spritefont2 && this._inst._objectType._plugin instanceof self.C3.Plugins.Spritefont2) + { + return this._inst._sdkInst._spriteFontText; + } + else if (self.C3.Plugins.Text && this._inst._objectType._plugin instanceof self.C3.Plugins.Text) + { + return this._inst._sdkInst._webglText || this._inst._sdkInst._rendererText; + } + return null; + } + + GetSetTexttAct() { + if (self.C3.Plugins.Spritefont2 && this._inst._objectType._plugin instanceof self.C3.Plugins.Spritefont2) + { + return self.C3.Plugins.Spritefont2.Acts.SetText + } + else if (self.C3.Plugins.Text && this._inst._objectType._plugin instanceof self.C3.Plugins.Text) + { + return self.C3.Plugins.Text.Acts.SetText; + } + return null; + } + + Typewriter(text) + { + if (text === "") + { + this.SetText(""); + this.lastKnown = ""; + this.animated = false; + this.typewriterActive = false + return; + } + + this.SetTextCall = true + this.text = this.getTextWithNoTW(text) + this.parseText() + this.SetDrawMaxCharacterCount(0); + text = this.text + this.LastLetterID = -1; + this.typewriterActive = true + this.animated = true + this.typewriterPaused = false + this.TWTime = 0; + this.curTypedWidth = "" + this.curTypedHeight = "" + let pureText = this.getTextWithNoTags(this.text) + let start = 0; + this.TWData = { + start: [], + data: [] + } + for (let i = 0; i < pureText.length; i++) + { + var curData = {} + Object.assign(curData, this.TWParamsOBJ.value); + Object.assign(curData, this.TWParamsOBJ.duration); + for (let j = 0; j < this.typewriterTagData.length; j++) + { + let el = this.typewriterTagData[j] + if (el.id > i) break; + let data = el.data.split(' ') + let tag = data[0].toLowerCase() + if ((tag === "wait" || tag === "pause" || tag === "fn") && el.id != i) continue; + + if (tag === "fn") + { + data.shift() + curData[tag] = data.join(' ') + } else { + // try to eval as function + data.shift() + let tagFn = data.join(' ') + try { + curData[tag] = this.getAnimFunction(tagFn)() + } catch (e) { + if (this.isANumber(data[0])) curData[tag] = parseFloat(data[0]) + else curData[tag] = tagFn; + } + } + } + + let special = false + + if (curData.hasOwnProperty("wait")) + { + start += curData.wait + } + if (curData.hasOwnProperty("pause")) + { + start += curData.fade + } + this.TWData.start.push([start, start + curData.fade]) + + start += curData.type + this.TWData.data.push(curData); + } + this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStart) + } + + isAString(text) + { + var regex = /(["'])(\\?.)*?\1/g; //" + var match = regex.exec(text); + return match != null && match[0] === text; + } + + isANumber(text) + { + return parseFloat(text).toString() === text; + } + + GetBody(body) { + let utils = "let { " + Object.keys(self.globalThis.SFDXUtilsFunctions).join(',') + " } = globalThis.SFDXUtilsFunctions;" + body = utils + "return " + body + ";"; + return body; + } + + DefineAlias(name, params, body) + { + body = this.GetBody(body); + var arr = []; + if (params.trim() != "") + { + params = params.split(',').map(function(s) + { + return s.trim() + }); + arr = arr.concat([Function], params, ['t', 'i'], [body]); + } + else + { + arr = arr.concat([Function], ['t', 'i'], [body]); + } + var fn = new(Function.bind.apply(Function, arr))(); + //console.log(fn) + this._inst._objectType._SFDXAliasFunctions[name.toLowerCase().trim()] = fn; + } + + SkipTypewriterToNextPause(toEnd) + { + if (!this.typewriterActive) return; + + let i = 0; + while (i < this.TWData.start.length && this.TWTime > this.TWData.start[i][0]) + { + i++ + } + + while (i < this.TWData.data.length && (toEnd || !this.TWData.data[i].hasOwnProperty("pause"))) + { + if (this.TWData.data[i].hasOwnProperty("fn")) + { + let fnData = this.TWData.data[i].fn.split(' ') + let fnName = fnData.shift() + let fnParams = JSON.parse("[" + fnData.join(' ') + "]") || [] + self.c3_callFunction(fnName, fnParams) + } + i++ + } + + if (i === this.TWData.data.length) + { + this.SetDrawMaxCharacterCount(-1); + this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStop) + this.typewriterActive = false + } + else + { + this.TWTime = this.TWData.start[i][0] + } + } + + getTextWithNoTags(text) + { + let regex = /\[\/?((?!\/?tw|fn|text)[^\]]*)(=[^\]]*)?\]/gi; + text = text.replace(regex, ""); + regex = /\[\/?((?!\/?tw)[^\]]*)(=[^\]]*)?\]/gi; + var match; + while ((match = regex.exec(text)) !== null) + { + let str = text + let a = match[1].split('=') + let b = a[1] || "" + let c = b.split(' ') + let len = parseInt(c[1]) || 0 + let str2 = "" + for (let i = 0; i < len; i++) + { + str2 += "0" + } + text = text.replace(match[0], str2) + regex.lastIndex = 0; + } + return text; + } + + getTextWithNoTW(text) + { + let regex = /\[tw=([^\]]*)?\]/gi; + + var match; + var offset = 0 + this.typewriterTagData = [] + text = this.getVars(text) + + var noTag = this.getTextWithNoTags(text) + + while ((match = regex.exec(noTag)) !== null) + { + this.typewriterTagData.push( + { + data: match[1].trim(), + id: match.index - offset + }) + offset += match[0].length + } + return text.replace(regex, ""); + } + + getAnimFunction(tag) + { + if (!this.AnimFunctions.hasOwnProperty(tag)) + { + let regex = /^[\d\w]+(\([^()]*\))?$/g; + tag = tag.trim() + let found = regex.test(tag); + if (found) { + var arr = tag.split('(') + var name = arr[0].trim().toLowerCase() + found = this._inst._objectType._SFDXAliasFunctions.hasOwnProperty(name); + } + if (found) + { + var arr = tag.split('(') + var name = arr[0].trim().toLowerCase() + var fn = this._inst._objectType._SFDXAliasFunctions[name]; + + if (arr.length > 1) + { + var params = arr[1].slice(0, -1).split(',').map(function(s) + { + return s.trim() + });; + for (let i = 0; i < params.length; i++) + { + if (!isNaN(Number(params[i]))) + { + params[i] = Number(params[i]) + } + } + params.unshift(null) + this.AnimFunctions[tag] = fn.bind.apply(fn, params) + } + else + { + this.AnimFunctions[tag] = fn + } + + } + else + { + var arr = []; + arr = arr.concat([Function], ['t', 'i'], [this.GetBody(tag.toLowerCase())]); + this.AnimFunctions[tag] = new(Function.bind.apply(Function, arr))(); + } + } + return this.AnimFunctions[tag] + } + + parseText() + { + var res = []; + var stack = 0; + var currentTag = [] + var currentText = "" + var tagParam = false; + var self = this; + + if (typeof this.linkedDictionnary !== "undefined") + { + this.replaceVars() + } + this.SetDrawMaxCharacterCount(-1); + + var text = this.text + + var regex = /\[\/?((?!\/?sfdx|text|fn)[^\]]*)\]/gi //Matches for tags that are neither sfdx nor text + var match; + let sfdxAliases = ["sfdx", "anim", "typejuice", "juice", "animate", "animtext"]; //replace sfdx tag aliases with sfdx + while ((match = regex.exec(text)) !== null) + { + let str = text + if (!match[0].startsWith('[/')) + { + let a = match[1].split('=') + if (sfdxAliases.includes(a[0].toLowerCase())) { + text = text.replace(match[0], "[sfdx=" + a[1] + "]") + } else { + text = text.replace(match[0], "[sfdx=" + a[0] + " \"" + a[1] + "\"]") + } + } + else + { + text = text.replace(match[0], "[/sfdx]") + } + regex.lastIndex = 0; + } + + this.text = text + + for (let i = 0; i < text.length; i++) + { + if (tagParam) + { + if (text[i] === "]") + { + tagParam = false; + currentText = "" + } + else + { + currentTag[stack - 1] += text[i] + } + } + else + { + if (text.substring(i).toLowerCase().startsWith("[sfdx=")) + { + push(JSON.parse(JSON.stringify(currentTag)), currentText) + stack++; + currentTag.push(""); + tagParam = true; + i += 5 + } + else if (text.substring(i).toLowerCase().startsWith("[/sfdx]")) + { + //This is to prevent stack issues if people close sfdx tags that were never opened + if (stack > 0) { + stack--; + push(JSON.parse(JSON.stringify(currentTag)), currentText) + currentTag.pop(); + currentText = "" + } + i += 6 + } + else if (text.substring(i).toLowerCase().startsWith("[text=")) + { + push(JSON.parse(JSON.stringify(currentTag)), currentText) + currentText = "" + i += 6 + while (text[i] !== "]") + { + currentText += text[i] + i++ + } + let textParam = currentText.split(' ') + let obj = [] + let textName = textParam[0] + let length = parseInt(textParam[1]) || 0 + for (let i = 0; i < length; i++) + { + obj.push(this.getChar.bind(this, textName, i, false)) + } + push(JSON.parse(JSON.stringify(currentTag)), obj) + currentText = "" + } + else if (text.substring(i).toLowerCase().startsWith("[fn=")) + { + push(JSON.parse(JSON.stringify(currentTag)), currentText) + currentText = "" + i += 4 + while (text[i] !== "]") + { + currentText += text[i] + i++ + } + let textParam = currentText.split(' ') + let obj = [] + let textName = textParam[0] + let length = parseInt(textParam[1]) || 0 + for (let i = 0; i < length; i++) + { + obj.push(this.getChar.bind(this, textName, i, true)) + } + push(JSON.parse(JSON.stringify(currentTag)), obj) + currentText = "" + } + else + { + currentText += text[i] + } + } + } + + push(JSON.parse(JSON.stringify(currentTag)), currentText) + + function push(tag, text) + { + if (text == "") return + + var tagArray = [] + + tag.forEach(t => { + var arr = t.split(' ') + var firstTag = arr.shift(); + var tagfn = arr.join(' '); + var fn + if (self.isAString(tagfn)) + { + fn = tagfn.substring(1, tagfn.length - 1) + } + else + { + fn = self.getAnimFunction(tagfn); + } + + tagArray.push([firstTag, fn]) + }) + + res.push([tagArray, text]) + } + //console.log(res) + this.parsedText = res + } + + getChar(name, i, fn) + { + if (fn) + { + name = name.toLowerCase() + let str = self.c3_callFunction(name) || ""; + if (i < str.length) + { + return str[i] + } + else + { + return " " + } + } + else + { + name = name.toLowerCase() + if (this.linkedDictionnary.has(name)) + { + let val = this.linkedDictionnary.get(name) + return i < val.length ? val[i] : " " + } + else + { + return " " + } + } + } + + replaceVars() + { + this.text = this.getVars(this.text) + } + + getVars(text) + { + var regex = /\[(var|varfn)=([\d\w]+)\]/gi + var match; + while ((match = regex.exec(text)) !== null) + { + let isVar = match[1].trim().toLowerCase() === "var"; + let varName = match[2].toLowerCase(); + //console.log(match) + if (isVar) + { + if (this.linkedDictionnary.has(varName)) + { + text = text.replace(match[0], this.linkedDictionnary.get(varName)) + regex.lastIndex = 0; + } + } + else + { + let str = self.c3_callFunction(varName) || "" + text = text.replace(match[0], str) + regex.lastIndex = 0; + } + } + return text; + } + + _SetTwEasing(easing) { + this.TWEasing = easingNames[easing]; + } + + _C2StrToC3Str(text) { + let getParsed = (text) => { + var regex = /<([XYAO]) (-?\w+ ?-?\d* ?-?\d* ?-?\d*)>|<(C) (#?\w*)>|<(C) (\w+\(-?\d+\.?\d*%?, ?-?\d+\.?\d*%?, ?-?\d+\.?\d*%?,? ?-?\d*\.?\d*%?\))>/g; + return text.replace(regex,"") + } + + let parse = (text) => { + var regex = /<([XYAO]) (-?\w+ ?-?\d* ?-?\d* ?-?\d*)>|<(C) (#?\w*)>|<(C) (\w+\(-?\d+\.?\d*%?, ?-?\d+\.?\d*%?, ?-?\d+\.?\d*%?,? ?-?\d*\.?\d*%?\))>/g; + var str = text; + var m; + var offset = 0; + var data = []; + while ((m = regex.exec(str)) !== null) { + + var tempA = [] + tempA.push(m.index + offset); + var length = regex.lastIndex - m.index; + offset-=length + + m.forEach(function(match, groupIndex) { + if (groupIndex != 0) { + tempA.push(match); + } + }); + data.push(tempA); + } + + var parsedText = getParsed(text); + var curX = "None"; + var curY = "None"; + var curA = "None"; + var curO = "None"; + var curC = "None"; + var data2 = []; + var arrCounter = 0; + + for (var i = 0; i < data.length; i++) { + var cur = data[i]; + while(data2.length { + var colors = {"aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff", + "beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887", + "cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff", + "darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f", + "darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1", + "darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff", + "firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff", + "gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","green":"#008000","greenyellow":"#adff2f", + "honeydew":"#f0fff0","hotpink":"#ff69b4", + "indianred ":"#cd5c5c","indigo":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c", + "lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2", + "lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de", + "lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6", + "magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee", + "mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5", + "navajowhite":"#ffdead","navy":"#000080", + "oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6", + "palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080", + "rebeccapurple":"#663399","red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1", + "saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4", + "tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0", + "violet":"#ee82ee", + "wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5", + "yellow":"#ffff00","yellowgreen":"#9acd32"}; + + if (colors.hasOwnProperty(color.toLowerCase())) + return colors[color.toLowerCase()]; + return color; + } + + let arrEqual = (arr1, arr2) => { + return arr1.length === arr2.length && arr1.every((el,i)=>el===arr2[i]); + } + + let parseState = (state, tag) => { + let stateA = state.split(" "); + let stateValue = stateA.shift(); + if (stateA[0] === undefined) stateA.push(4) + if (stateA[1] === undefined) stateA.push(300) + if (stateA[2] === undefined) stateA.push(90) + switch (stateValue.toLowerCase()) { + case 'wave': + case 'angle': + return "wave(" + stateA.join(',') + ")" + case 'swing': + case 'angle2': + return "swing(" + stateA.join(',') + ")" + case 'shake': + return "shake(" + stateA[0] + ")" + } + if (tag.toLowerCase() === "color") { + let colorAsName = colourNameToHex(state); + return "colorToHex('" + colorAsName + "')" + } + return state; + } + + let c2ParsedToC3String = (text) => { + let data = parse(text); + let parsedText = getParsed(text); + let tagEquivalents = ["offsetx", "offsety", "angle", "opacity", "color"] + let str = ""; + let currentState = ["None", "None", "None", "None", "None"]; + data.forEach((curData, i) => { + if (!arrEqual(curData, currentState)) { + currentState.forEach(state=>{ + if (state.toLowerCase()!=="none") str+="[/sfdx]"; + }) + curData.forEach((state, i)=>{ + if (state.toLowerCase()!=="none") str+="[sfdx=" + tagEquivalents[i] + " " + parseState(state, tagEquivalents[i]) + "]"; + }) + currentState = curData; + } + str+=parsedText[i]; + }) + currentState.forEach(state=>{ + if (state.toLowerCase()!=="none") str+="[/sfdx]"; + }) + console.log(str) + return str; + } + + return c2ParsedToC3String(text); + } + }; +} +} + +{ +"use strict"; +{ + self.C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds = { + IsTyping() +{ + return this.typewriterActive && !this.typewriterPaused +}, + +OnLetterTyped() +{ + return true; +}, + +OnTwPause() +{ + return true; +}, + +OnTwResume() +{ + return true; +}, + +OnTwStart() +{ + return true; +}, + +OnTwStop() +{ + return true; +} + }; +} +} + +{ +"use strict"; +{ + self.C3.Behaviors.skymen_Skymen_SpritefontDX.Acts = { + SetAlias(name, params, body) +{ + this.DefineAlias(name, params, body); +}, + +SetText(text) +{ + this.text = text; + this.SetTextCall = true + this.parseText() + this.animated = true; +}, + +LinkDictionary(dictionary) +{ + this.linkedDictionnary = dictionary.GetInstanceByIID(0)._sdkInst.GetDataMap() + this.linkedDictionnaryUID = dictionary.GetInstanceByIID(0)._uid +}, + +PauseTw() +{ + this.typewriterPaused = true + this.Trigger(self.C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwPause) +}, + +ResumeTw() +{ + this.typewriterPaused = false + this.Trigger(self.C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwResume) +}, + +SetTwEasing(easing) +{ + this._SetTwEasing(easing); +}, + +SetTwParams(params) +{ + this.TWParams = params; + this.TWParamsOBJ = this.parseTypewriterParams(this.TWParams); +}, + +SkipTw(mode) +{ + this.SkipTypewriterToNextPause(mode === 0) +}, + +Typewrite(text) +{ + this.Typewriter(text) +}, + +SetTwEasingString(easing) +{ + this.TWEasing = easing; +} + }; +} +} + +{ +"use strict"; +{ + self.C3.Behaviors.skymen_Skymen_SpritefontDX.Exps = { + LastLetterIndex() +{ + return this.LastLetterID; +}, + +TypewriterEasing() +{ + return this.TWEasing; +}, + +TypewriterParams() +{ + return this.TWParams; +}, + +TypedTextWidth() +{ + let b + if (self.C3.Plugins.Spritefont2 && this._inst._objectType._plugin instanceof self.C3.Plugins.Spritefont2) + { + if (this.typewriterActive) + { + let a = this._inst._sdkInst._text; + this._inst._sdkInst.CallAction(self.C3.Plugins.Spritefont2.Acts.SetText, this.curTypedWidth) + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Spritefont2.Exps.TextWidth); + this._inst._sdkInst.CallAction(self.C3.Plugins.Spritefont2.Acts.SetText, a); + } + else + { + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Spritefont2.Exps.TextWidth); + } + } + else if (self.C3.Plugins.Text && this._inst._objectType._plugin instanceof self.C3.Plugins.Text) + { + if (this.typewriterActive) + { + let a = this._inst._sdkInst._text; + this._inst._sdkInst.CallAction(self.C3.Plugins.Text.Acts.SetText, this.curTypedWidth) + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Text.Exps.TextWidth); + this._inst._sdkInst.CallAction(self.C3.Plugins.Text.Acts.SetText, a); + } + else + { + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Text.Exps.TextWidth); + } + } + return b +}, + +TypedTextHeight() +{ + let b + if (self.C3.Plugins.Spritefont2 && this._inst._objectType._plugin instanceof self.C3.Plugins.Spritefont2) + { + if (this.typewriterActive) + { + let a = this._inst._sdkInst._text; + this._inst._sdkInst.CallAction(self.C3.Plugins.Spritefont2.Acts.SetText, this.curTypedHeight) + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Spritefont2.Exps.TextHeight); + this._inst._sdkInst.CallAction(self.C3.Plugins.Spritefont2.Acts.SetText, a); + } + else + { + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Spritefont2.Exps.TextHeight); + } + } + else if (self.C3.Plugins.Text && this._inst._objectType._plugin instanceof self.C3.Plugins.Text) + { + if (this.typewriterActive) + { + let a = this._inst._sdkInst._text; + this._inst._sdkInst.CallAction(self.C3.Plugins.Text.Acts.SetText, this.curTypedHeight) + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Text.Exps.TextHeight); + this._inst._sdkInst.CallAction(self.C3.Plugins.Text.Acts.SetText, a); + } + else + { + b = this._inst._sdkInst.CallExpression(self.C3.Plugins.Text.Exps.TextHeight); + } + } + return b +}, + +LastLetter() +{ + return this.LastLetter; +}, + +C2StrToC3Str(text) +{ + return this._C2StrToC3Str(text); +} + }; +} +} + +{ +const C3 = self.C3; +self.C3_GetObjectRefTable = function () { + return [ + C3.Plugins.Sprite, + C3.Behaviors.Tween, + C3.Behaviors.Anchor, + C3.Behaviors.Physics, + C3.Behaviors.Pin, + C3.Behaviors.Timer, + C3.Plugins.Keyboard, + C3.Plugins.Audio, + C3.Plugins.TiledBg, + C3.Plugins.Spritefont2, + C3.Behaviors.Sin, + C3.Plugins.Arr, + C3.Plugins.Mouse, + C3.Plugins.Particles, + C3.Plugins.Touch, + C3.Plugins.Browser, + C3.Behaviors.Fade, + C3.Behaviors.Bullet, + C3.Behaviors.wrap, + C3.Behaviors.scrollto, + C3.Behaviors.skymen_Skymen_SpritefontDX, + C3.Plugins.Text, + C3.Plugins.System.Cnds.IsGroupActive, + C3.Plugins.Sprite.Acts.SetPos, + C3.Plugins.Sprite.Exps.ImagePointX, + C3.Plugins.Sprite.Exps.ImagePointY, + C3.Plugins.System.Cnds.OnLayoutStart, + C3.Behaviors.Physics.Acts.CreateLimitedRevoluteJoint, + C3.Behaviors.Physics.Acts.SetSteppingMode, + C3.Behaviors.Pin.Acts.Pin, + C3.Plugins.Sprite.Cnds.CompareInstanceVar, + C3.Plugins.System.Cnds.CompareVar, + C3.Plugins.Sprite.Cnds.IsOverlapping, + C3.Plugins.System.Cnds.TriggerOnce, + C3.Plugins.Sprite.Acts.Spawn, + C3.Plugins.Particles.Acts.SetRate, + C3.Plugins.Particles.Acts.SetOpacity, + C3.Plugins.Particles.Acts.SetEffect, + C3.Behaviors.Physics.Acts.ApplyForce, + C3.Behaviors.Physics.Exps.VelocityX, + C3.Plugins.Sprite.Cnds.CompareX, + C3.Plugins.Sprite.Acts.SetInstanceVar, + C3.Plugins.System.Exps.random, + C3.Plugins.Sprite.Cnds.CompareY, + C3.Behaviors.Physics.Acts.SetAngularVelocity, + C3.Plugins.System.Exps.dt, + C3.Plugins.Sprite.Cnds.IsBetweenAngles, + C3.Plugins.System.Cnds.Else, + C3.Plugins.Sprite.Acts.AddInstanceVar, + C3.Plugins.Sprite.Acts.SubInstanceVar, + C3.Plugins.Sprite.Acts.SetDefaultColor, + C3.Plugins.Sprite.Exps.ColorValue, + C3.Plugins.Sprite.Acts.SetAngle, + C3.Plugins.Sprite.Exps.Angle, + C3.Plugins.System.Exps.anglelerp, + C3.Plugins.Sprite.Cnds.CompareFrame, + C3.Plugins.Audio.Acts.Play, + C3.Plugins.Sprite.Acts.SetAnimFrame, + C3.Behaviors.Bullet.Acts.SetEnabled, + C3.Behaviors.Bullet.Acts.SetAngleOfMotion, + C3.Behaviors.Physics.Acts.ApplyForceToward, + C3.Plugins.System.Cnds.Compare, + C3.Plugins.System.Acts.SetVar, + C3.Behaviors.Timer.Cnds.IsTimerRunning, + C3.Behaviors.Timer.Acts.StartTimer, + C3.Behaviors.Physics.Acts.SetVelocity, + C3.Plugins.Sprite.Exps.X, + C3.Plugins.Sprite.Acts.SetX, + C3.Plugins.Sprite.Acts.SetScale, + C3.Plugins.System.Exps.min, + C3.Plugins.System.Exps.max, + C3.Plugins.Sprite.Exps.Y, + C3.Plugins.Sprite.Cnds.OnCollision, + C3.Behaviors.Physics.Cnds.CompareVelocity, + C3.Plugins.Audio.Cnds.IsTagPlaying, + C3.Behaviors.Physics.Acts.ApplyImpulseAtAngle, + C3.Plugins.Arr.Acts.SetSize, + C3.Plugins.Arr.Acts.Clear, + C3.Plugins.Sprite.Cnds.OnCreated, + C3.Behaviors.Bullet.Acts.SetSpeed, + C3.Behaviors.Bullet.Exps.Speed, + C3.Plugins.Sprite.Acts.Destroy, + C3.Plugins.Sprite.Cnds.OnDestroyed, + C3.Plugins.System.Exps.viewporttop, + C3.Plugins.System.Exps.viewportleft, + C3.Plugins.System.Exps.viewportright, + C3.Plugins.Sprite.Acts.ZMoveToObject, + C3.Behaviors.Tween.Acts.TweenTwoProperties, + C3.Behaviors.Tween.Acts.TweenOneProperty, + C3.Plugins.System.Exps.rgbex255, + C3.Behaviors.Physics.Exps.VelocityY, + C3.Behaviors.Physics.Exps.AngularVelocity, + C3.Plugins.Browser.Cnds.OnResize, + C3.Plugins.System.Acts.Wait, + C3.Plugins.TiledBg.Acts.SetY, + C3.Plugins.TiledBg.Acts.SetWidth, + C3.Plugins.TiledBg.Acts.SetHeight, + C3.Plugins.System.Exps.viewportbottom, + C3.Plugins.TiledBg.Exps.Y, + C3.Plugins.TiledBg.Acts.SetX, + C3.Plugins.System.Exps.int, + C3.Plugins.System.Cnds.While, + C3.Plugins.Sprite.Exps.AnimationFrameCount, + C3.Plugins.System.Exps.choose, + C3.Plugins.Sprite.Acts.SetVisible, + C3.Behaviors.Timer.Cnds.OnTimer, + C3.Plugins.Touch.Cnds.IsTouchingObject, + C3.Plugins.Keyboard.Cnds.IsKeyDown, + C3.Plugins.Sprite.Acts.SetSize, + C3.Plugins.Audio.Acts.PlayByName, + C3.Plugins.Sprite.Exps.AnimationFrame, + C3.Plugins.Audio.Acts.SetPlaybackRate, + C3.Plugins.System.Exps.timescale, + C3.Plugins.Spritefont2.Cnds.CompareInstanceVar, + C3.Plugins.Spritefont2.Acts.SetVisible, + C3.Plugins.Spritefont2.Acts.SetText, + C3.Behaviors.Timer.Acts.StopTimer, + C3.Plugins.Spritefont2.Acts.Destroy, + C3.Plugins.System.Acts.SetTimescale, + C3.Plugins.System.Acts.SetObjectTimescale, + C3.Behaviors.Tween.Acts.StopAllTweens, + C3.Plugins.System.Acts.AddVar, + C3.Plugins.Sprite.Acts.AddChild, + C3.Plugins.System.Acts.ResetPersisted, + C3.Plugins.System.Acts.RestartLayout, + C3.Plugins.System.Acts.SetLayoutScale, + C3.Plugins.System.Exps.layoutscale, + C3.Plugins.Spritefont2.Acts.SetScale, + C3.Plugins.Spritefont2.Acts.SetDefaultColor, + C3.Behaviors.Tween.Cnds.IsPlaying, + C3.Plugins.System.Acts.SetLayerOpacity, + C3.Behaviors.Tween.Exps.Value, + C3.Behaviors.Tween.Cnds.OnTweensFinished, + C3.Plugins.Audio.Acts.Stop, + C3.Behaviors.Tween.Acts.TweenValue, + C3.Plugins.System.Acts.SetLayerVisible, + C3.Plugins.Sprite.Acts.MoveToLayer, + C3.Plugins.Spritefont2.Acts.MoveToLayer, + C3.Plugins.System.Acts.CreateObject, + C3.Plugins.TiledBg.Acts.SetSize, + C3.Plugins.Sprite.Acts.SetCollisions, + C3.Behaviors.Physics.Acts.RemoveJoints, + C3.Behaviors.Physics.Acts.SetLinearDamping, + C3.Behaviors.Physics.Acts.SetAngularDamping, + C3.Behaviors.Physics.Acts.SetFriction, + C3.Behaviors.Physics.Acts.SetElasticity, + C3.Plugins.System.Cnds.EvaluateExpression, + C3.Plugins.Spritefont2.Exps.Count, + C3.Behaviors.skymen_Skymen_SpritefontDX.Acts.Typewrite, + C3.Plugins.System.Acts.Scroll, + C3.Plugins.Sprite.Acts.MoveToTop, + C3.Plugins.System.Acts.RecreateInitialObjects, + C3.Plugins.Sprite.Acts.SetPosToObject, + C3.Plugins.System.Exps.len, + C3.Plugins.TiledBg.Acts.Destroy, + C3.Plugins.TiledBg.Acts.SetDefaultColor, + C3.Plugins.Particles.Acts.Destroy, + C3.Plugins.System.Acts.SetLayerBackground, + C3.Plugins.Sprite.Acts.SetY, + C3.Plugins.Sprite.Acts.SetAnim, + C3.Plugins.Spritefont2.Cnds.OnDestroyed, + C3.Plugins.Sprite.Exps.ImageWidth, + C3.Plugins.Sprite.Exps.ImageHeight, + C3.Behaviors.Sin.Acts.SetEnabled, + C3.Plugins.TiledBg.Acts.SetImageOffsetY, + C3.Plugins.TiledBg.Exps.ImageOffsetY, + C3.Plugins.Touch.Cnds.OnTouchObject, + C3.Plugins.Audio.Acts.SetMasterVolume, + C3.Plugins.Sprite.Cnds.IsVisible, + C3.Plugins.Audio.Acts.SetSilent, + C3.Plugins.Touch.Cnds.OnTouchEnd, + C3.Plugins.System.Cnds.PickAll, + C3.Plugins.Audio.Acts.StopAll, + C3.Plugins.System.Acts.ResetGlobals, + C3.Behaviors.Tween.Cnds.IsAnyPlaying, + C3.Plugins.Audio.Acts.Seek, + C3.Behaviors.Fade.Acts.StartFade, + C3.Behaviors.Tween.Cnds.OnAnyTweensFinished, + C3.Plugins.Mouse.Cnds.IsOverObject, + C3.Plugins.System.Cnds.EveryTick, + C3.Plugins.Sprite.Acts.StopAnim, + C3.Plugins.Sprite.Exps.Width, + C3.Plugins.Sprite.Exps.Height, + C3.Plugins.Mouse.Acts.SetCursor, + C3.Plugins.System.Acts.GoToLayout, + C3.Plugins.Browser.Acts.GoToURLWindow, + C3.Plugins.Mouse.Cnds.OnObjectClicked, + C3.ScriptsInEvents["Gamemonitize-Js_Event1_Act1"], + C3.Plugins.Browser.Acts.ConsoleLog + ]; +}; +self.C3_JsPropNameTable = [ + {hover: 0}, + {Tween: 0}, + {Anchor: 0}, + {BoxingRandom: 0}, + {moreGames_BoxingRandom: 0}, + {SocceRandom_N: 0}, + {StickArchersBattle_N: 0}, + {BasketRandom_N: 0}, + {VolleyRandom_N: 0}, + {var: 0}, + {adjust: 0}, + {Physics: 0}, + {Pin: 0}, + {landPhysics: 0}, + {which: 0}, + {first: 0}, + {angular: 0}, + {jump: 0}, + {moreJump: 0}, + {Timer: 0}, + {body: 0}, + {Keyboard: 0}, + {playerLine: 0}, + {head: 0}, + {headLine: 0}, + {Audio: 0}, + {groundCollision: 0}, + {rightShoe: 0}, + {hair: 0}, + {rightShort: 0}, + {tshirt: 0}, + {playerShadow: 0}, + {snow: 0}, + {pause: 0}, + {groundTile: 0}, + {groundLine: 0}, + {whiteLine: 0}, + {TPG: 0}, + {scoreBG: 0}, + {fontWonder: 0}, + {fenceTile: 0}, + {grassTile: 0}, + {Sine: 0}, + {cloudTile: 0}, + {buildingTile: 0}, + {Array: 0}, + {head3: 0}, + {body3: 0}, + {Mouse: 0}, + {ko: 0}, + {p3Collision: 0}, + {p1Collision: 0}, + {head2: 0}, + {body2: 0}, + {p2Collision: 0}, + {head4: 0}, + {body4: 0}, + {p4Collision: 0}, + {night: 0}, + {starTile: 0}, + {snowParticle: 0}, + {Touch: 0}, + {buttonRight: 0}, + {buttonLeft: 0}, + {tutorial: 0}, + {pauseButtons: 0}, + {Browser: 0}, + {Fade: 0}, + {fadeOut: 0}, + {titleBG: 0}, + {title: 0}, + {cpu: 0}, + {startButton: 0}, + {moreButton: 0}, + {startButton2: 0}, + {hitfx: 0}, + {basketText: 0}, + {game_bg: 0}, + {introtwporg: 0}, + {play_intro_btn: 0}, + {groundTileSnow: 0}, + {buildingTile2: 0}, + {buildingTile3: 0}, + {startX: 0}, + {titleChars: 0}, + {groundTilePlaj: 0}, + {seaTile: 0}, + {mountain: 0}, + {seaWhite: 0}, + {have: 0}, + {ready: 0}, + {ang: 0}, + {arm: 0}, + {arm2: 0}, + {arm3: 0}, + {arm4: 0}, + {grassLineTile: 0}, + {groundTileIndoor: 0}, + {indoorBGTile: 0}, + {indoorBGTile2: 0}, + {font: 0}, + {indoorBGTile3: 0}, + {armBiz: 0}, + {indoorTitle: 0}, + {snowTile: 0}, + {Bullet: 0}, + {Wrap: 0}, + {shark: 0}, + {sidePhysics: 0}, + {sideHitFx: 0}, + {bombTimer: 0}, + {ScrollTo: 0}, + {shaker: 0}, + {expo: 0}, + {armSkin: 0}, + {smokeTile: 0}, + {beach: 0}, + {tpg2: 0}, + {ballHitScore: 0}, + {grassTile2: 0}, + {tpgBeach: 0}, + {zeplin: 0}, + {soundButton: 0}, + {onArm: 0}, + {glow1: 0}, + {dust: 0}, + {onArm2: 0}, + {glow2: 0}, + {pcAim: 0}, + {AnimateText: 0}, + {fontWonder2: 0}, + {Text: 0}, + {fireFist: 0}, + {fireFist2: 0}, + {rocketTrail: 0}, + {hakem: 0}, + {box: 0}, + {boxingCubuk: 0}, + {boxingCubukLine: 0}, + {boxingGround: 0}, + {dumbel: 0}, + {direk: 0}, + {cup: 0}, + {kum: 0}, + {kumShadow: 0}, + {black: 0}, + {fligran: 0}, + {player: 0}, + {skin: 0}, + {tiles: 0}, + {line: 0}, + {startButtons: 0}, + {groundPortrait: 0}, + {roket1: 0}, + {roket2: 0}, + {upArrow: 0}, + {speed: 0}, + {angularMaxRND: 0}, + {angularMinRND: 0}, + {wooble: 0}, + {angularSub: 0}, + {snowSlip: 0}, + {P1Control: 0}, + {P2Control: 0}, + {p1Score: 0}, + {p2Score: 0}, + {goal: 0}, + {CPU: 0}, + {biz: 0}, + {sustain: 0}, + {gravity: 0}, + {jumpforce: 0}, + {active: 0}, + {velX: 0}, + {velAng: 0}, + {team1: 0}, + {team2: 0}, + {screenWidth: 0}, + {screenHeight: 0}, + {rnd: 0}, + {who: 0}, + {x1: 0}, + {x2: 0}, + {force: 0}, + {divideSmooth: 0}, + {angularOffset: 0}, + {jumpPower: 0}, + {jumpAddForce: 0}, + {angularForce: 0}, + {bombBall: 0}, + {timeScaler: 0}, + {rndChar: 0}, + {rndType: 0}, + {rndPlace: 0}, + {rndArm: 0}, + {startText: 0}, + {waitText: 0}, + {sound: 0}, + {temp: 0}, + {menu: 0}, + {ballStartDir: 0}, + {access_token: 0}, + {refURL: 0}, + {webSite: 0}, + {gameName: 0} +]; +} + +{ + +const C3 = self.C3; + +function unaryminus(n) +{ + return (typeof n === "number" ? -n : n); +} + +function bothNumbers(a, b) +{ + return typeof a === "number" && typeof b === "number"; +} + +function add(l, r) +{ + if (bothNumbers(l, r)) + return l + r; + else + return l; +} + +function subtract(l, r) +{ + if (bothNumbers(l, r)) + return l - r; + else + return l; +} + +function multiply(l, r) +{ + if (bothNumbers(l, r)) + return l * r; + else + return l; +} + +function divide(l, r) +{ + if (bothNumbers(l, r)) + return l / r; + else + return l; +} + +function mod(l, r) +{ + if (bothNumbers(l, r)) + return l % r; + else + return l; +} + +function pow(l, r) +{ + if (bothNumbers(l, r)) + return Math.pow(l, r); + else + return l; +} + +function and(l, r) +{ + if (typeof l === "string" || typeof r === "string") + { + // & with either side string does string concatenation + let lstr, rstr; + + if (typeof l === "number") + lstr = (Math.round(l * 1e10) / 1e10).toString(); + else + lstr = l; + + if (typeof r === "number") + rstr = (Math.round(r * 1e10) / 1e10).toString(); + else + rstr = r; + + return lstr + rstr; + } + else + { + // & with neither side a string does logical AND + return (l && r ? 1 : 0); + } +} + +function or(l, r) +{ + if (bothNumbers(l, r)) + return (l || r ? 1 : 0); + else + return l; +} + +self.C3_ExpressionFuncs = [ + () => "P1", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject("arm1"); + }, + () => "head", + () => -8, + () => 8, + () => 0, + () => "Game", + () => 3, + () => 50, + () => 1, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() * 2); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(1); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => f0(v1.GetValue(), v2.GetValue()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => (f0(v1.GetValue(), v2.GetValue()) * (-1)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => v0.GetValue(); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (v0.GetValue() * (-1)); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar(); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.lerp(n0.ExpInstVar(), 0, (f1() / v2.GetValue())); + }, + () => -10, + () => 10, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() * f1()) * v2.GetValue()); + }, + () => "Control P1", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(2); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpInstVar() + n1.ExpObject()) + 45); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (((90 + (90 - n0.ExpInstVar())) + n1.ExpObject()) - 45); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const n2 = p._GetNode(2); + const f3 = p._GetNode(3).GetBoundMethod(); + return () => f0(n1.ExpObject(), n2.ExpObject(), (f3() * 20)); + }, + () => "", + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 180); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (v0.GetValue() * f1()); + }, + () => 45, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpInstVar() + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpInstVar() - v1.GetValue()); + }, + () => "wait", + () => 0.3, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((-5) * (n0.ExpObject() - n1.ExpObject(1))); + }, + () => "Skin P1", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(6); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => f0(f1(0.2, (1 - ((n2.ExpObject() - n3.ExpObject()) / 150))), 1); + }, + () => "P3", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => (f0(v1.GetValue(), v2.GetValue()) * n3.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => ((f0(v1.GetValue(), v2.GetValue()) * (-1)) * n3.ExpInstVar()); + }, + () => "Control P3", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpObject() - 45) - (225 + (225 - n1.ExpInstVar()))); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpObject() - n1.ExpInstVar()) - 45); + }, + () => "Skin P3", + () => "Create", + () => 100, + () => "boxhit", + () => 0.5, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => (C3.toDegrees(C3.angleTo(n0.ExpObject(), n1.ExpObject(), n2.ExpObject(), n3.ExpObject())) - 180); + }, + () => "Ball", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpInstVar() * n1.ExpBehavior()); + }, + () => 135, + () => -5, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0("Game"); + }, + () => "disappear", + () => 0.2, + () => "color", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 0, 0); + }, + () => 0.15, + () => "Players", + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.clamp(n0.ExpBehavior(), ((-1) * v1.GetValue()), v2.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => C3.clamp(n0.ExpBehavior(), (-100), 100); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior(); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpBehavior() * 3) + n1.ExpBehavior()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => ((n0.ExpBehavior() * 3) + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() / 2); + }, + () => "General", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0("BG"); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("BG") - f1("BG")) + 100); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + return () => ((f0("BG") - n1.ExpObject()) + 100); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0("BG") - 50); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => f0(f1(8)); + }, + () => 2, + () => 4, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + return () => f0(n1.ExpObject()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + return () => f0(f1(138, 72, 54), f2(255, 216, 60), f3(39, 39, 39)); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + return () => f0(f1(255, 225, 188), f2(143, 98, 87), f3(246, 202, 159), f4(214, 169, 124)); + }, + () => "Control", + () => "stop", + () => "hitwait", + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (n0.ExpObject() - f1("UI")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("UI") - f1("UI")); + }, + p => { + const n0 = p._GetNode(0); + return () => ((((n0.ExpObject()) === (2) ? 1 : 0)) ? ("spring") : ("woosh")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(); + }, + () => "jump1", + () => "jump2", + () => "Goal", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + return () => (v0.GetValue() + v1.GetValue()); + }, + () => "ters", + () => 0.1, + p => { + const n0 = p._GetNode(0); + return () => (1 + n0.ExpObject()); + }, + () => "blink1", + () => 1.3, + () => 0.01, + () => 5, + () => "blue", + () => "red", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => C3.lerp(f0(), 1.5, f1()); + }, + () => 1.2, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 200, 37); + }, + () => "blink2", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 255, 255); + }, + () => "End", + () => "OPOutOver", + () => "OP", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutOver"); + }, + () => 60, + () => "menu", + () => "music", + () => "sound", + () => "Op", + () => "Top", + () => 26, + () => 290, + () => 27, + () => 21, + () => 55, + () => -160, + () => 39, + () => "appear", + () => 145, + () => 85, + () => 113, + () => 204, + () => "CPU", + () => "nojump", + () => "jump", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0.05, 0.3); + }, + () => 40, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0.01, 0.2); + }, + () => "Box", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(100, (-100)); + }, + () => 0.8, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(50, 100); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (v0.GetValue() * (-10)); + }, + () => -200, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (v0.GetValue() * 10); + }, + () => 200, + p => { + const n0 = p._GetNode(0); + return () => ((n0.ExpObject()) === (0) ? 1 : 0); + }, + () => "UI", + () => 25, + () => "3", + () => "2", + () => "1", + () => "0", + () => "goal", + () => "Bonus", + () => 6, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(1, (-1)); + }, + () => 95, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("Top") - f1("Top")) * 2); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0(0, 0, f1(f2(2, 1, 3))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0(0, f1(f2(3))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 1, 2); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((((v0.GetValue()) === (0) ? 1 : 0)) ? (f1(0, 0, 0, 1, 2)) : (0)); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => ((f0(0, 1)) === (0) ? 1 : 0); + }, + () => 190, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => and("create", f0(1, 2, 3)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SHORT ARM"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "LONG ARM"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "[color=#ea323c]ROCKET PUNCH![/color]"); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "FASTER"); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(195, 148, 89); + }, + () => 150, + () => 180, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(100, 100, 100); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SNOW"); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(230, 230, 230); + }, + () => -281492157629439, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 228, 228); + }, + () => 250, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(229, 229, 229); + }, + () => 263, + () => 140, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(162, 226, 253); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(246, 252, 254); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "BIG HEAD"); + }, + () => 1.5, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 3); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 0.001); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "SMALL HEAD"); + }, + () => 0.6, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() + ((((f1(v2.GetValue())) > (0) ? 1 : 0)) ? (" + ") : (""))) + "BUSINESS"); + }, + () => "Animation 2", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(149, 149, 149); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(93, 93, 93); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + return () => ((0.5 + (v0.GetValue() * 0.3)) * v1.GetValue()); + }, + () => "refsoc", + () => "show", + () => "Effect", + () => "move", + () => "move2", + () => 450, + () => "shrink", + () => "bup", + () => 0.05, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (n0.ExpObject() - (5 * f1())); + }, + () => -999, + () => 70, + () => 0.4, + () => 115, + () => 175, + () => 235, + () => "Menu", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() - n1.ExpObject()); + }, + () => "size", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(30); + }, + () => "OPOutMenu", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar_Family(); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutMenu"); + }, + () => 1.15, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + n1.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("Top") - f1("Top")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 10); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 4); + }, + () => "xScale", + () => 0.06, + () => "yScale", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://3kh0.github.io/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "NewWindow", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://3kh0.github.io/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://3kh0.github.io/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://3kh0.github.io/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => ((("https://3kh0.github.io/" + v0.GetValue()) + v1.GetValue()) + v2.GetValue()); + }, + () => "You Called Inside C3- Ad Started", + () => "You Called Inside C3- Ad Error", + () => "You Called Inside C3- Ad Closed - Pause 0", + () => "You Called Inside C3- Ad Closed - Pause 1" +]; + + +} + diff --git a/boxingrandom/scripts/dispatchworker.js b/boxingrandom/scripts/dispatchworker.js new file mode 100644 index 00000000..ff5fbed9 --- /dev/null +++ b/boxingrandom/scripts/dispatchworker.js @@ -0,0 +1,10 @@ +'use strict';self.inputPort=null;self.jobQueue=[];self.jobWorkers=[];self.sentBlobs=[];self.sentBuffers=[];self.importedScripts=[];self.lastBroadcasts=new Map; +class JobWorker{constructor(port,number){this._port=port;this._number=number;this._isReady=false;this._isBusy=false;this._port.onmessage=e=>this._OnMessage(e.data)}ImportScripts(scripts){this._port.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlob(blob,id){this._port.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBuffer(buffer,id){this._port.postMessage({"type":"_send_buffer","buffer":buffer,"id":id})}SendJob(job){if(this._isBusy||!this._isReady)throw new Error("cannot take job"); +this._isBusy=true;this._port.postMessage(job,job["transferables"])}_InitBroadcast(job){this._port.postMessage(job,job["transferables"])}SendReady(){this._port.postMessage({"type":"_ready"})}IsReady(){return this._isReady}_OnReady(){this._isReady=true;this.MaybeStartNextJob()}IsBusy(){return this._isBusy}GetNumber(){return this._number}_OnMessage(msg){const type=msg["type"];switch(type){case "ready":this._OnReady();return;case "done":this._OnJobDone();return;default:console.error("unknown message from worker '"+ +type+"'");return}}_OnJobDone(){this._isBusy=false;this.MaybeStartNextJob()}MaybeStartNextJob(){if(this._isBusy||!this._isReady)return;const i=this._FindAvailableJob();if(i===-1)return;const job=self.jobQueue[i];const isBroadcast=job["isBroadcast"];if(isBroadcast){job["doneFlags"][this._number]=true;if(job["doneFlags"].every(x=>x))self.jobQueue.splice(i,1)}else self.jobQueue.splice(i,1);this.SendJob(job)}_FindAvailableJob(){for(let i=0,len=self.jobQueue.length;i{const msg=e.data;const type=msg["type"];if(type==="_init"){self.inputPort=msg["in-port"];self.inputPort.onmessage=OnInputPortMessage}else if(type==="_addJobWorker")AddJobWorker(msg["port"])}); +function OnInputPortMessage(e){const msg=e.data;const type=msg["type"];if(type==="_cancel"){CancelJob(msg.jobId);return}else if(type==="_import_scripts"){const scripts=msg["scripts"];for(const w of self.jobWorkers)w.ImportScripts(scripts);self.importedScripts.push(scripts);return}else if(type==="_send_blob"){const blob=msg["blob"];const id=msg["id"];for(const w of self.jobWorkers)w.SendBlob(blob,id);self.sentBlobs.push([blob,id]);return}else if(type==="_send_buffer"){const buffer=msg["buffer"];const id= +msg["id"];for(const w of self.jobWorkers)w.SendBuffer(buffer,id);self.sentBuffers.push([buffer,id]);return}else if(type==="_no_more_workers"){self.sentBlobs.length=0;self.sentBuffers.length=0;self.importedScripts.length=0;self.lastBroadcasts.clear();return}else if(type==="_testMessageChannel"){self.jobWorkers[0].TestMessageChannel();return}self.jobQueue.push(msg);if(msg["isBroadcast"]){msg["doneFlags"]=(new Array(self.jobWorkers.length)).fill(false);msg["transferables"]=[];self.lastBroadcasts.set(msg["type"], +msg)}for(const w of self.jobWorkers)w.MaybeStartNextJob()}; diff --git a/boxingrandom/scripts/jobworker.js b/boxingrandom/scripts/jobworker.js new file mode 100644 index 00000000..cca88063 --- /dev/null +++ b/boxingrandom/scripts/jobworker.js @@ -0,0 +1,9 @@ +'use strict';self.dispatchPort=null;self.outputPort=null;self.workerNumber=-1;self.activeJobId=null;self.sentBlobs=new Map;self.sentBuffers=new Map;self.JobHandlers={}; +function FlipImageData(data,width,height){const stride=width*4;const tempRow=new Uint8Array(stride);const imageBuffer=data.buffer;for(let topY=0,len=Math.floor(height/2);topY{const msg=e.data;const type=msg["type"];switch(type){case "init":self.workerNumber=msg["number"];self.dispatchPort=msg["dispatch-port"];self.dispatchPort.onmessage=OnDispatchWorkerMessage;self.outputPort=msg["output-port"];return;case "terminate":self.close();return;default:console.error("unknown message '"+type+"'");return}});function SendReady(){self.dispatchPort.postMessage({"type":"ready"});self.outputPort.postMessage({"type":"ready"})} +function SendError(isBroadcast,e){if(!isBroadcast)self.outputPort.postMessage({"type":"error","jobId":self.activeJobId,"error":e.toString()});SendDone()}function SendResult(isBroadcast,ret){if(!isBroadcast){const transferables=ret.transferables||[];self.outputPort.postMessage({"type":"result","jobId":self.activeJobId,"result":ret.result},transferables)}SendDone()}function SendDone(){self.activeJobId=null;self.dispatchPort.postMessage({"type":"done"})} +function SendProgress(val){self.outputPort.postMessage({"type":"progress","jobId":self.activeJobId,"progress":val})} +function OnDispatchWorkerMessage(e){const msg=e.data;const type=msg["type"];if(type==="_import_scripts"){importScripts(...msg["scripts"]);return}else if(type==="_send_blob"){self.sentBlobs.set(msg["id"],msg["blob"]);return}else if(type==="_send_buffer"){self.sentBuffers.set(msg["id"],msg["buffer"]);return}else if(type==="_testMessageChannel"){self.outputPort.postMessage({"type":"_testMessageChannelOk"});return}else if(type==="_ready"){SendReady();return}const jobId=msg["jobId"];const isBroadcast= +msg["isBroadcast"];const params=msg["params"];let ret;self.activeJobId=jobId;if(!self.JobHandlers.hasOwnProperty(type)){console.error(`no handler for message type '${type}'`);return}try{ret=self.JobHandlers[type](params)}catch(e){SendError(isBroadcast,"Exception in job handler: "+e);return}if(ret&&ret.then)ret.then(asyncRet=>SendResult(isBroadcast,asyncRet)).catch(err=>SendError(isBroadcast,"Rejection in job handler: "+err));else SendResult(isBroadcast,ret)}; diff --git a/boxingrandom/scripts/main.js b/boxingrandom/scripts/main.js new file mode 100644 index 00000000..33ba6403 --- /dev/null +++ b/boxingrandom/scripts/main.js @@ -0,0 +1,267 @@ +'use strict';{window.DOMHandler=class DOMHandler{constructor(iRuntime,componentId){this._iRuntime=iRuntime;this._componentId=componentId;this._hasTickCallback=false;this._tickCallback=()=>this.Tick()}Attach(){}PostToRuntime(handler,data,dispatchOpts,transferables){this._iRuntime.PostToRuntimeComponent(this._componentId,handler,data,dispatchOpts,transferables)}PostToRuntimeAsync(handler,data,dispatchOpts,transferables){return this._iRuntime.PostToRuntimeComponentAsync(this._componentId,handler,data, +dispatchOpts,transferables)}_PostToRuntimeMaybeSync(name,data,dispatchOpts){if(this._iRuntime.UsesWorker())this.PostToRuntime(name,data,dispatchOpts);else this._iRuntime._GetLocalRuntime()["_OnMessageFromDOM"]({"type":"event","component":this._componentId,"handler":name,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null})}AddRuntimeMessageHandler(handler,func){this._iRuntime.AddRuntimeComponentMessageHandler(this._componentId,handler,func)}AddRuntimeMessageHandlers(list){for(const [handler, +func]of list)this.AddRuntimeMessageHandler(handler,func)}GetRuntimeInterface(){return this._iRuntime}GetComponentID(){return this._componentId}_StartTicking(){if(this._hasTickCallback)return;this._iRuntime._AddRAFCallback(this._tickCallback);this._hasTickCallback=true}_StopTicking(){if(!this._hasTickCallback)return;this._iRuntime._RemoveRAFCallback(this._tickCallback);this._hasTickCallback=false}Tick(){}};window.RateLimiter=class RateLimiter{constructor(callback,interval){this._callback=callback; +this._interval=interval;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false}SetCanRunImmediate(c){this._canRunImmediate=!!c}Call(){if(this._timerId!==-1)return;const nowTime=Date.now();const timeSinceLastCall=nowTime-this._lastCallTime;const interval=this._interval;if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc, +Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;this._callback();this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._lastCallTime=Date.now()}_OnTimer(){this._timerId=-1;this._lastCallTime=Date.now();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._timerCallFunc=null}}}; + + +'use strict';{window.DOMElementHandler=class DOMElementHandler extends self.DOMHandler{constructor(iRuntime,componentId){super(iRuntime,componentId);this._elementMap=new Map;this._autoAttach=true;this.AddRuntimeMessageHandlers([["create",e=>this._OnCreate(e)],["destroy",e=>this._OnDestroy(e)],["set-visible",e=>this._OnSetVisible(e)],["update-position",e=>this._OnUpdatePosition(e)],["update-state",e=>this._OnUpdateState(e)],["focus",e=>this._OnSetFocus(e)],["set-css-style",e=>this._OnSetCssStyle(e)], +["set-attribute",e=>this._OnSetAttribute(e)],["remove-attribute",e=>this._OnRemoveAttribute(e)]]);this.AddDOMElementMessageHandler("get-element",elem=>elem)}SetAutoAttach(e){this._autoAttach=!!e}AddDOMElementMessageHandler(handler,func){this.AddRuntimeMessageHandler(handler,e=>{const elementId=e["elementId"];const elem=this._elementMap.get(elementId);return func(elem,e)})}_OnCreate(e){const elementId=e["elementId"];const elem=this.CreateElement(elementId,e);this._elementMap.set(elementId,elem);elem.style.boxSizing= +"border-box";if(!e["isVisible"])elem.style.display="none";const focusElem=this._GetFocusElement(elem);focusElem.addEventListener("focus",e=>this._OnFocus(elementId));focusElem.addEventListener("blur",e=>this._OnBlur(elementId));if(this._autoAttach)document.body.appendChild(elem)}CreateElement(elementId,e){throw new Error("required override");}DestroyElement(elem){}_OnDestroy(e){const elementId=e["elementId"];const elem=this._elementMap.get(elementId);this.DestroyElement(elem);if(this._autoAttach)elem.parentElement.removeChild(elem); +this._elementMap.delete(elementId)}PostToRuntimeElement(handler,elementId,data){if(!data)data={};data["elementId"]=elementId;this.PostToRuntime(handler,data)}_PostToRuntimeElementMaybeSync(handler,elementId,data){if(!data)data={};data["elementId"]=elementId;this._PostToRuntimeMaybeSync(handler,data)}_OnSetVisible(e){if(!this._autoAttach)return;const elem=this._elementMap.get(e["elementId"]);elem.style.display=e["isVisible"]?"":"none"}_OnUpdatePosition(e){if(!this._autoAttach)return;const elem=this._elementMap.get(e["elementId"]); +elem.style.left=e["left"]+"px";elem.style.top=e["top"]+"px";elem.style.width=e["width"]+"px";elem.style.height=e["height"]+"px";const fontSize=e["fontSize"];if(fontSize!==null)elem.style.fontSize=fontSize+"em"}_OnUpdateState(e){const elem=this._elementMap.get(e["elementId"]);this.UpdateState(elem,e)}UpdateState(elem,e){throw new Error("required override");}_GetFocusElement(elem){return elem}_OnFocus(elementId){this.PostToRuntimeElement("elem-focused",elementId)}_OnBlur(elementId){this.PostToRuntimeElement("elem-blurred", +elementId)}_OnSetFocus(e){const elem=this._GetFocusElement(this._elementMap.get(e["elementId"]));if(e["focus"])elem.focus();else elem.blur()}_OnSetCssStyle(e){const elem=this._elementMap.get(e["elementId"]);const prop=e["prop"];const val=e["val"];if(prop.startsWith("--"))elem.style.setProperty(prop,val);else elem.style[prop]=val}_OnSetAttribute(e){const elem=this._elementMap.get(e["elementId"]);elem.setAttribute(e["name"],e["val"])}_OnRemoveAttribute(e){const elem=this._elementMap.get(e["elementId"]); +elem.removeAttribute(e["name"])}GetElementById(elementId){return this._elementMap.get(elementId)}}}; + + +'use strict';{const isiOSLike=/(iphone|ipod|ipad|macos|macintosh|mac os x)/i.test(navigator.userAgent);const isAndroid=/android/i.test(navigator.userAgent);let resolveCounter=0;function AddScript(url){const elem=document.createElement("script");elem.async=false;elem.type="module";if(url.isStringSrc)return new Promise(resolve=>{const resolveName="c3_resolve_"+resolveCounter;++resolveCounter;self[resolveName]=resolve;elem.textContent=url.str+`\n\nself["${resolveName}"]();`;document.head.appendChild(elem)}); +else return new Promise((resolve,reject)=>{elem.onload=resolve;elem.onerror=reject;elem.src=url;document.head.appendChild(elem)})}let didCheckWorkerModuleSupport=false;let isWorkerModuleSupported=false;function SupportsWorkerTypeModule(){if(!didCheckWorkerModuleSupport){try{new Worker("blob://",{get type(){isWorkerModuleSupported=true}})}catch(e){}didCheckWorkerModuleSupport=true}return isWorkerModuleSupported}let tmpAudio=new Audio;const supportedAudioFormats={"audio/webm; codecs=opus":!!tmpAudio.canPlayType("audio/webm; codecs=opus"), +"audio/ogg; codecs=opus":!!tmpAudio.canPlayType("audio/ogg; codecs=opus"),"audio/webm; codecs=vorbis":!!tmpAudio.canPlayType("audio/webm; codecs=vorbis"),"audio/ogg; codecs=vorbis":!!tmpAudio.canPlayType("audio/ogg; codecs=vorbis"),"audio/mp4":!!tmpAudio.canPlayType("audio/mp4"),"audio/mpeg":!!tmpAudio.canPlayType("audio/mpeg")};tmpAudio=null;async function BlobToString(blob){const arrayBuffer=await BlobToArrayBuffer(blob);const textDecoder=new TextDecoder("utf-8");return textDecoder.decode(arrayBuffer)} +function BlobToArrayBuffer(blob){return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsArrayBuffer(blob)})}const queuedArrayBufferReads=[];let activeArrayBufferReads=0;const MAX_ARRAYBUFFER_READS=8;window["RealFile"]=window["File"];const domHandlerClasses=[];const runtimeEventHandlers=new Map;const pendingResponsePromises=new Map;let nextResponseId=0;const runOnStartupFunctions=[];self.runOnStartup= +function runOnStartup(f){if(typeof f!=="function")throw new Error("runOnStartup called without a function");runOnStartupFunctions.push(f)};const WEBVIEW_EXPORT_TYPES=new Set(["cordova","playable-ad","instant-games"]);function IsWebViewExportType(exportType){return WEBVIEW_EXPORT_TYPES.has(exportType)}let isWrapperFullscreen=false;window.RuntimeInterface=class RuntimeInterface{constructor(opts){this._useWorker=opts.useWorker;this._messageChannelPort=null;this._runtimeBaseUrl="";this._scriptFolder= +opts.scriptFolder;this._workerScriptURLs={};this._worker=null;this._localRuntime=null;this._domHandlers=[];this._runtimeDomHandler=null;this._canvas=null;this._isExportingToVideo=false;this._exportToVideoDuration=0;this._jobScheduler=null;this._rafId=-1;this._rafFunc=()=>this._OnRAFCallback();this._rafCallbacks=[];this._exportType=opts.exportType;this._isFileProtocol=location.protocol.substr(0,4)==="file";if(this._useWorker&&(typeof OffscreenCanvas==="undefined"||!navigator["userActivation"]||!SupportsWorkerTypeModule()))this._useWorker= +false;if(this._exportType==="playable-ad"||this._exportType==="instant-games")this._useWorker=false;if(this._exportType==="cordova"&&this._useWorker)if(isAndroid){const chromeVer=/Chrome\/(\d+)/i.exec(navigator.userAgent);if(!chromeVer||!(parseInt(chromeVer[1],10)>=90))this._useWorker=false}else this._useWorker=false;this._localFileBlobs=null;this._localFileStrings=null;if(this._exportType==="html5"&&!window.isSecureContext)console.warn("[Construct] Warning: the browser indicates this is not a secure context. Some features may be unavailable. Use secure (HTTPS) hosting to ensure all features are available."); +this.AddRuntimeComponentMessageHandler("runtime","cordova-fetch-local-file",e=>this._OnCordovaFetchLocalFile(e));this.AddRuntimeComponentMessageHandler("runtime","create-job-worker",e=>this._OnCreateJobWorker(e));if(this._exportType==="cordova")document.addEventListener("deviceready",()=>this._Init(opts));else this._Init(opts)}Release(){this._CancelAnimationFrame();if(this._messageChannelPort){this._messageChannelPort.onmessage=null;this._messageChannelPort=null}if(this._worker){this._worker.terminate(); +this._worker=null}if(this._localRuntime){this._localRuntime.Release();this._localRuntime=null}if(this._canvas){this._canvas.parentElement.removeChild(this._canvas);this._canvas=null}}GetCanvas(){return this._canvas}GetRuntimeBaseURL(){return this._runtimeBaseUrl}UsesWorker(){return this._useWorker}GetExportType(){return this._exportType}IsFileProtocol(){return this._isFileProtocol}GetScriptFolder(){return this._scriptFolder}IsiOSCordova(){return isiOSLike&&this._exportType==="cordova"}IsiOSWebView(){const ua= +navigator.userAgent;return isiOSLike&&IsWebViewExportType(this._exportType)||navigator["standalone"]||/crios\/|fxios\/|edgios\//i.test(ua)}IsAndroid(){return isAndroid}IsAndroidWebView(){return isAndroid&&IsWebViewExportType(this._exportType)}async _Init(opts){if(this._exportType==="macos-wkwebview")this._SendWrapperMessage({"type":"ready"});if(this._exportType==="playable-ad"){this._localFileBlobs=self["c3_base64files"];this._localFileStrings={};await this._ConvertDataUrisToBlobs();for(let i=0,len= +opts.engineScripts.length;ithis["_OnMessageFromRuntime"](e.data);if(window["c3_addPortMessageHandler"])window["c3_addPortMessageHandler"](e=>this._OnMessageFromDebugger(e));this._jobScheduler=new self.JobSchedulerDOM(this);await this._jobScheduler.Init();if(typeof window["StatusBar"]=== +"object")window["StatusBar"]["hide"]();if(typeof window["AndroidFullScreen"]==="object")try{await new Promise((resolve,reject)=>{window["AndroidFullScreen"]["immersiveMode"](resolve,reject)})}catch(err){console.error("Failed to enter Android immersive mode: ",err)}if(this._useWorker)await this._InitWorker(opts,messageChannel.port2);else await this._InitDOM(opts,messageChannel.port2)}_GetWorkerURL(url){let ret;if(this._workerScriptURLs.hasOwnProperty(url))ret=this._workerScriptURLs[url];else if(url.endsWith("/workermain.js")&& +this._workerScriptURLs.hasOwnProperty("workermain.js"))ret=this._workerScriptURLs["workermain.js"];else if(this._exportType==="playable-ad"&&this._localFileBlobs.hasOwnProperty(url))ret=this._localFileBlobs[url];else ret=url;if(ret instanceof Blob)ret=URL.createObjectURL(ret);return ret}async CreateWorker(url,baseUrl,workerOpts){if(url.startsWith("blob:"))return new Worker(url,workerOpts);if(this._exportType==="cordova"&&this._isFileProtocol){let filePath="";if(workerOpts.isC3MainWorker)filePath= +url;else filePath=this._scriptFolder+url;const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filePath);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return new Worker(URL.createObjectURL(blob),workerOpts)}const absUrl=new URL(url,baseUrl);const isCrossOrigin=location.origin!==absUrl.origin;if(isCrossOrigin){const response=await fetch(absUrl);if(!response.ok)throw new Error("failed to fetch worker script");const blob=await response.blob();return new Worker(URL.createObjectURL(blob), +workerOpts)}else return new Worker(absUrl,workerOpts)}_GetWindowInnerWidth(){return Math.max(window.innerWidth,1)}_GetWindowInnerHeight(){return Math.max(window.innerHeight,1)}_GetCommonRuntimeOptions(opts){return{"runtimeBaseUrl":this._runtimeBaseUrl,"previewUrl":location.href,"windowInnerWidth":this._GetWindowInnerWidth(),"windowInnerHeight":this._GetWindowInnerHeight(),"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen(),"projectData":opts.projectData, +"previewImageBlobs":window["cr_previewImageBlobs"]||this._localFileBlobs,"previewProjectFileBlobs":window["cr_previewProjectFileBlobs"],"previewProjectFileSWUrls":window["cr_previewProjectFiles"],"swClientId":window.cr_swClientId||"","exportType":opts.exportType,"isDebug":(new URLSearchParams(self.location.search)).has("debug"),"ife":!!self.ife,"jobScheduler":this._jobScheduler.GetPortData(),"supportedAudioFormats":supportedAudioFormats,"opusWasmScriptUrl":window["cr_opusWasmScriptUrl"]||this._scriptFolder+ +"opus.wasm.js","opusWasmBinaryUrl":window["cr_opusWasmBinaryUrl"]||this._scriptFolder+"opus.wasm.wasm","isFileProtocol":this._isFileProtocol,"isiOSCordova":this.IsiOSCordova(),"isiOSWebView":this.IsiOSWebView(),"isFBInstantAvailable":typeof self["FBInstant"]!=="undefined"}}async _InitWorker(opts,port2){const workerMainUrl=this._GetWorkerURL(opts.workerMainUrl);if(this._exportType==="preview"){this._worker=new Worker("previewworker.js",{type:"module",name:"Runtime"});await new Promise((resolve,reject)=> +{const messageHandler=e=>{this._worker.removeEventListener("message",messageHandler);if(e.data&&e.data["type"]==="ok")resolve();else reject()};this._worker.addEventListener("message",messageHandler);this._worker.postMessage({"type":"construct-worker-init","import":(new URL(workerMainUrl,this._runtimeBaseUrl)).toString()})})}else this._worker=await this.CreateWorker(workerMainUrl,this._runtimeBaseUrl,{type:"module",name:"Runtime",isC3MainWorker:true});this._canvas=document.createElement("canvas"); +this._canvas.style.display="none";const offscreenCanvas=this._canvas["transferControlToOffscreen"]();document.body.appendChild(this._canvas);window["c3canvas"]=this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();let workerDependencyScripts=opts.workerDependencyScripts||[];let engineScripts=opts.engineScripts;workerDependencyScripts=await Promise.all(workerDependencyScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));engineScripts=await Promise.all(engineScripts.map(url=> +this._MaybeGetCordovaScriptURL(url)));if(this._exportType==="cordova")for(let i=0,len=opts.projectScripts.length;inew C(this));this._FindRuntimeDOMHandler();this._runtimeDomHandler._EnableWindowResizeEvent();self["c3_callFunction"]=(name,params)=>this._runtimeDomHandler._InvokeFunctionFromJS(name, +params);if(this._exportType==="preview")self["goToLastErrorScript"]=()=>this.PostToRuntimeComponent("runtime","go-to-last-error-script")}async _InitDOM(opts,port2){this._canvas=document.createElement("canvas");this._canvas.style.display="none";document.body.appendChild(this._canvas);window["c3canvas"]=this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();this._domHandlers=domHandlerClasses.map(C=>new C(this));this._FindRuntimeDOMHandler();let engineScripts=opts.engineScripts.map(url=> +typeof url==="string"?(new URL(url,this._runtimeBaseUrl)).toString():url);if(Array.isArray(opts.workerDependencyScripts))engineScripts.unshift(...opts.workerDependencyScripts);engineScripts=await Promise.all(engineScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));await Promise.all(engineScripts.map(url=>AddScript(url)));const scriptsStatus=self["C3_ProjectScriptsStatus"];const mainProjectScript=opts.mainProjectScript;const allProjectScripts=opts.projectScripts;for(let [originalUrl,loadUrl]of allProjectScripts){if(!loadUrl)loadUrl= +originalUrl;if(originalUrl===mainProjectScript)try{loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl);if(this._exportType==="preview"&&!scriptsStatus[originalUrl])this._ReportProjectMainScriptError(originalUrl,"main script did not run to completion")}catch(err){this._ReportProjectMainScriptError(originalUrl,err)}else if(originalUrl==="scriptsInEvents.js"||originalUrl.endsWith("/scriptsInEvents.js")){loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl)}}if(this._exportType=== +"preview"&&typeof self.C3.ScriptsInEvents!=="object"){this._RemoveLoadingMessage();const msg="Failed to load JavaScript code used in events. Check all your JavaScript code has valid syntax.";console.error("[C3 runtime] "+msg);alert(msg);return}const runtimeOpts=Object.assign(this._GetCommonRuntimeOptions(opts),{"isInWorker":false,"messagePort":port2,"canvas":this._canvas,"runOnStartupFunctions":runOnStartupFunctions});this._runtimeDomHandler._EnableWindowResizeEvent();this._OnBeforeCreateRuntime(); +this._localRuntime=self["C3_CreateRuntime"](runtimeOpts);await self["C3_InitRuntime"](this._localRuntime,runtimeOpts)}_ReportProjectMainScriptError(url,err){this._RemoveLoadingMessage();console.error(`[Preview] Failed to load project main script (${url}): `,err);alert(`Failed to load project main script (${url}). Check all your JavaScript code has valid syntax. Press F12 and check the console for error details.`)}_OnBeforeCreateRuntime(){this._RemoveLoadingMessage()}_RemoveLoadingMessage(){const loadingElem= +window.cr_previewLoadingElem;if(loadingElem){loadingElem.parentElement.removeChild(loadingElem);window.cr_previewLoadingElem=null}}async _OnCreateJobWorker(e){const outputPort=await this._jobScheduler._CreateJobWorker();return{"outputPort":outputPort,"transferables":[outputPort]}}_GetLocalRuntime(){if(this._useWorker)throw new Error("not available in worker mode");return this._localRuntime}PostToRuntimeComponent(component,handler,data,dispatchOpts,transferables){this._messageChannelPort.postMessage({"type":"event", +"component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null},transferables)}PostToRuntimeComponentAsync(component,handler,data,dispatchOpts,transferables){const responseId=nextResponseId++;const ret=new Promise((resolve,reject)=>{pendingResponsePromises.set(responseId,{resolve,reject})});this._messageChannelPort.postMessage({"type":"event","component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":responseId},transferables); +return ret}["_OnMessageFromRuntime"](data){const type=data["type"];if(type==="event")return this._OnEventFromRuntime(data);else if(type==="result")this._OnResultFromRuntime(data);else if(type==="runtime-ready")this._OnRuntimeReady();else if(type==="alert-error"){this._RemoveLoadingMessage();alert(data["message"])}else if(type==="creating-runtime")this._OnBeforeCreateRuntime();else throw new Error(`unknown message '${type}'`);}_OnEventFromRuntime(e){const component=e["component"];const handler=e["handler"]; +const data=e["data"];const responseId=e["responseId"];const handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){console.warn(`[DOM] No event handlers for component '${component}'`);return}const func=handlerMap.get(handler);if(!func){console.warn(`[DOM] No handler '${handler}' for component '${component}'`);return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!==null)this._PostResultToRuntime(responseId,false, +""+err);return}if(responseId===null)return ret;else if(ret&&ret.then)ret.then(result=>this._PostResultToRuntime(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToRuntime(responseId,false,""+err)});else this._PostResultToRuntime(responseId,true,ret)}_PostResultToRuntime(responseId,isOk,result){let transferables;if(result&&result["transferables"])transferables=result["transferables"];this._messageChannelPort.postMessage({"type":"result", +"responseId":responseId,"isOk":isOk,"result":result},transferables)}_OnResultFromRuntime(data){const responseId=data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=pendingResponsePromises.get(responseId);if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);pendingResponsePromises.delete(responseId)}AddRuntimeComponentMessageHandler(component,handler,func){let handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){handlerMap=new Map; +runtimeEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[DOM] Component '${component}' already has handler '${handler}'`);handlerMap.set(handler,func)}static AddDOMHandlerClass(Class){if(domHandlerClasses.includes(Class))throw new Error("DOM handler already added");domHandlerClasses.push(Class)}_FindRuntimeDOMHandler(){for(const dh of this._domHandlers)if(dh.GetComponentID()==="runtime"){this._runtimeDomHandler=dh;return}throw new Error("cannot find runtime DOM handler"); +}_OnMessageFromDebugger(e){this.PostToRuntimeComponent("debugger","message",e)}_OnRuntimeReady(){for(const h of this._domHandlers)h.Attach()}static IsDocumentFullscreen(){return!!(document["fullscreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||isWrapperFullscreen)}static _SetWrapperIsFullscreenFlag(f){isWrapperFullscreen=!!f}async GetRemotePreviewStatusInfo(){return await this.PostToRuntimeComponentAsync("runtime","get-remote-preview-status-info")}_AddRAFCallback(f){this._rafCallbacks.push(f); +this._RequestAnimationFrame()}_RemoveRAFCallback(f){const i=this._rafCallbacks.indexOf(f);if(i===-1)throw new Error("invalid callback");this._rafCallbacks.splice(i,1);if(!this._rafCallbacks.length)this._CancelAnimationFrame()}_RequestAnimationFrame(){if(this._rafId===-1&&this._rafCallbacks.length)this._rafId=requestAnimationFrame(this._rafFunc)}_CancelAnimationFrame(){if(this._rafId!==-1){cancelAnimationFrame(this._rafId);this._rafId=-1}}_OnRAFCallback(){this._rafId=-1;for(const f of this._rafCallbacks)f(); +this._RequestAnimationFrame()}TryPlayMedia(mediaElem){this._runtimeDomHandler.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._runtimeDomHandler.RemovePendingPlay(mediaElem)}_PlayPendingMedia(){this._runtimeDomHandler._PlayPendingMedia()}SetSilent(s){this._runtimeDomHandler.SetSilent(s)}IsAudioFormatSupported(typeStr){return!!supportedAudioFormats[typeStr]}async _WasmDecodeWebMOpus(arrayBuffer){const result=await this.PostToRuntimeComponentAsync("runtime","opus-decode",{"arrayBuffer":arrayBuffer}, +null,[arrayBuffer]);return new Float32Array(result)}SetIsExportingToVideo(duration){this._isExportingToVideo=true;this._exportToVideoDuration=duration}IsExportingToVideo(){return this._isExportingToVideo}GetExportToVideoDuration(){return this._exportToVideoDuration}IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"}IsRelativeURL(url){return!this.IsAbsoluteURL(url)}async _MaybeGetCordovaScriptURL(url){if(this._exportType==="cordova"&&(url.startsWith("file:")|| +this._isFileProtocol&&this.IsRelativeURL(url))){let filename=url;if(filename.startsWith(this._runtimeBaseUrl))filename=filename.substr(this._runtimeBaseUrl.length);const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filename);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return URL.createObjectURL(blob)}else return url}async _OnCordovaFetchLocalFile(e){const filename=e["filename"];switch(e["as"]){case "text":return await this.CordovaFetchLocalFileAsText(filename); +case "buffer":return await this.CordovaFetchLocalFileAsArrayBuffer(filename);default:throw new Error("unsupported type");}}_GetPermissionAPI(){const api=window["cordova"]&&window["cordova"]["plugins"]&&window["cordova"]["plugins"]["permissions"];if(typeof api!=="object")throw new Error("Permission API is not loaded");return api}_MapPermissionID(api,permission){const permissionID=api[permission];if(typeof permissionID!=="string")throw new Error("Invalid permission name");return permissionID}_HasPermission(id){const api= +this._GetPermissionAPI();return new Promise((resolve,reject)=>api["checkPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}_RequestPermission(id){const api=this._GetPermissionAPI();return new Promise((resolve,reject)=>api["requestPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}async RequestPermissions(permissions){if(this.GetExportType()!=="cordova")return true;if(this.IsiOSCordova())return true;for(const id of permissions){const alreadyGranted= +await this._HasPermission(id);if(alreadyGranted)continue;const granted=await this._RequestPermission(id);if(granted===false)return false}return true}async RequirePermissions(...permissions){if(await this.RequestPermissions(permissions)===false)throw new Error("Permission not granted");}CordovaFetchLocalFile(filename){const path=window["cordova"]["file"]["applicationDirectory"]+"www/"+filename;return new Promise((resolve,reject)=>{window["resolveLocalFileSystemURL"](path,entry=>{entry["file"](resolve, +reject)},reject)})}async CordovaFetchLocalFileAsText(filename){const file=await this.CordovaFetchLocalFile(filename);return await BlobToString(file)}_CordovaMaybeStartNextArrayBufferRead(){if(!queuedArrayBufferReads.length)return;if(activeArrayBufferReads>=MAX_ARRAYBUFFER_READS)return;activeArrayBufferReads++;const job=queuedArrayBufferReads.shift();this._CordovaDoFetchLocalFileAsAsArrayBuffer(job.filename,job.successCallback,job.errorCallback)}CordovaFetchLocalFileAsArrayBuffer(filename){return new Promise((resolve, +reject)=>{queuedArrayBufferReads.push({filename:filename,successCallback:result=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();resolve(result)},errorCallback:err=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();reject(err)}});this._CordovaMaybeStartNextArrayBufferRead()})}async _CordovaDoFetchLocalFileAsAsArrayBuffer(filename,successCallback,errorCallback){try{const file=await this.CordovaFetchLocalFile(filename);const arrayBuffer=await BlobToArrayBuffer(file); +successCallback(arrayBuffer)}catch(err){errorCallback(err)}}_SendWrapperMessage(o){if(this._exportType==="windows-webview2")window["chrome"]["webview"]["postMessage"](JSON.stringify(o));else if(this._exportType==="macos-wkwebview")window["webkit"]["messageHandlers"]["C3Wrapper"]["postMessage"](JSON.stringify(o));else throw new Error("cannot send wrapper message");}async _ConvertDataUrisToBlobs(){const promises=[];for(const [filename,data]of Object.entries(this._localFileBlobs))promises.push(this._ConvertDataUriToBlobs(filename, +data));await Promise.all(promises)}async _ConvertDataUriToBlobs(filename,data){if(typeof data==="object"){this._localFileBlobs[filename]=new Blob([data["str"]],{"type":data["type"]});this._localFileStrings[filename]=data["str"]}else{let blob=await this._FetchDataUri(data);if(!blob)blob=this._DataURIToBinaryBlobSync(data);this._localFileBlobs[filename]=blob}}async _FetchDataUri(dataUri){try{const response=await fetch(dataUri);return await response.blob()}catch(err){console.warn("Failed to fetch a data: URI. Falling back to a slower workaround. This is probably because the Content Security Policy unnecessarily blocked it. Allow data: URIs in your CSP to avoid this.", +err);return null}}_DataURIToBinaryBlobSync(datauri){const o=this._ParseDataURI(datauri);return this._BinaryStringToBlob(o.data,o.mime_type)}_ParseDataURI(datauri){const comma=datauri.indexOf(",");if(comma<0)throw new URIError("expected comma in data: uri");const typepart=datauri.substring(5,comma);const datapart=datauri.substring(comma+1);const typearr=typepart.split(";");const mimetype=typearr[0]||"";const encoding1=typearr[1];const encoding2=typearr[2];let decodeddata;if(encoding1==="base64"||encoding2=== +"base64")decodeddata=atob(datapart);else decodeddata=decodeURIComponent(datapart);return{mime_type:mimetype,data:decodeddata}}_BinaryStringToBlob(binstr,mime_type){let len=binstr.length;let len32=len>>2;let a8=new Uint8Array(len);let a32=new Uint32Array(a8.buffer,0,len32);let i,j;for(i=0,j=0;i{const styleLink=document.createElement("link");styleLink.onload=()=>resolve(styleLink);styleLink.onerror=err=>reject(err);styleLink.rel="stylesheet";styleLink.href=cssUrl;document.head.appendChild(styleLink)})}function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})}async function BlobToImage(blob){const blobUrl= +URL.createObjectURL(blob);try{return await FetchImage(blobUrl)}finally{URL.revokeObjectURL(blobUrl)}}function BlobToString(blob){return new Promise((resolve,reject)=>{let fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsText(blob)})}async function BlobToSvgImage(blob,width,height){if(!/firefox/i.test(navigator.userAgent))return await BlobToImage(blob);let str=await BlobToString(blob);const parser=new DOMParser;const doc=parser.parseFromString(str, +"image/svg+xml");const rootElem=doc.documentElement;if(rootElem.hasAttribute("width")&&rootElem.hasAttribute("height")){const widthStr=rootElem.getAttribute("width");const heightStr=rootElem.getAttribute("height");if(!widthStr.includes("%")&&!heightStr.includes("%"))return await BlobToImage(blob)}rootElem.setAttribute("width",width+"px");rootElem.setAttribute("height",height+"px");const serializer=new XMLSerializer;str=serializer.serializeToString(doc);blob=new Blob([str],{type:"image/svg+xml"}); +return await BlobToImage(blob)}function IsInContentEditable(el){do{if(el.parentNode&&el.hasAttribute("contenteditable"))return true;el=el.parentNode}while(el);return false}const keyboardInputElementTagNames=new Set(["input","textarea","datalist","select"]);function IsKeyboardInputElement(elem){return keyboardInputElementTagNames.has(elem.tagName.toLowerCase())||IsInContentEditable(elem)}const canvasOrDocTags=new Set(["canvas","body","html"]);function PreventDefaultOnCanvasOrDoc(e){const tagName=e.target.tagName.toLowerCase(); +if(canvasOrDocTags.has(tagName))e.preventDefault()}function BlockWheelZoom(e){if(e.metaKey||e.ctrlKey)e.preventDefault()}self["C3_GetSvgImageSize"]=async function(blob){const img=await BlobToImage(blob);if(img.width>0&&img.height>0)return[img.width,img.height];else{img.style.position="absolute";img.style.left="0px";img.style.top="0px";img.style.visibility="hidden";document.body.appendChild(img);const rc=img.getBoundingClientRect();document.body.removeChild(img);return[rc.width,rc.height]}};self["C3_RasterSvgImageBlob"]= +async function(blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight){const img=await BlobToSvgImage(blob,imageWidth,imageHeight);const canvas=document.createElement("canvas");canvas.width=surfaceWidth;canvas.height=surfaceHeight;const ctx=canvas.getContext("2d");ctx.drawImage(img,0,0,imageWidth,imageHeight);return canvas};let isCordovaPaused=false;document.addEventListener("pause",()=>isCordovaPaused=true);document.addEventListener("resume",()=>isCordovaPaused=false);function ParentHasFocus(){try{return window.parent&& +window.parent.document.hasFocus()}catch(err){return false}}function KeyboardIsVisible(){const elem=document.activeElement;if(!elem)return false;const tagName=elem.tagName.toLowerCase();const inputTypes=new Set(["email","number","password","search","tel","text","url"]);if(tagName==="textarea")return true;if(tagName==="input")return inputTypes.has(elem.type.toLowerCase()||"text");return IsInContentEditable(elem)}const DOM_COMPONENT_ID="runtime";const HANDLER_CLASS=class RuntimeDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime, +DOM_COMPONENT_ID);this._isFirstSizeUpdate=true;this._enableWindowResizeEvent=false;this._simulatedResizeTimerId=-1;this._targetOrientation="any";this._attachedDeviceOrientationEvent=false;this._attachedDeviceMotionEvent=false;this._debugHighlightElem=null;this._isExportToVideo=false;this._exportVideoProgressMessage="";this._exportVideoUpdateTimerId=-1;this._pointerRawUpdateRateLimiter=null;this._lastPointerRawUpdateEvent=null;this._pointerRawMovementX=0;this._pointerRawMovementY=0;this._enableAndroidVKDetection= +false;this._lastWindowWidth=iRuntime._GetWindowInnerWidth();this._lastWindowHeight=iRuntime._GetWindowInnerHeight();this._virtualKeyboardHeight=0;this._vkTranslateYOffset=0;iRuntime.AddRuntimeComponentMessageHandler("canvas","update-size",e=>this._OnUpdateCanvasSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","invoke-download",e=>this._OnInvokeDownload(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","raster-svg-image",e=>this._OnRasterSvgImage(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"get-svg-image-size",e=>this._OnGetSvgImageSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","set-target-orientation",e=>this._OnSetTargetOrientation(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","register-sw",()=>this._OnRegisterSW());iRuntime.AddRuntimeComponentMessageHandler("runtime","post-to-debugger",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","go-to-script",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"before-start-ticking",()=>this._OnBeforeStartTicking());iRuntime.AddRuntimeComponentMessageHandler("runtime","debug-highlight",e=>this._OnDebugHighlight(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","enable-device-orientation",()=>this._AttachDeviceOrientationEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","enable-device-motion",()=>this._AttachDeviceMotionEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","add-stylesheet",e=>this._OnAddStylesheet(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"script-create-worker",e=>this._OnScriptCreateWorker(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","alert",e=>this._OnAlert(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","hide-cordova-splash",()=>this._OnHideCordovaSplash());iRuntime.AddRuntimeComponentMessageHandler("runtime","set-exporting-to-video",e=>this._SetExportingToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","export-to-video-progress",e=>this._OnExportVideoProgress(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"exported-to-video",e=>this._OnExportedToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","exported-to-image-sequence",e=>this._OnExportedToImageSequence(e));const allowDefaultContextMenuTagNames=new Set(["input","textarea","datalist"]);window.addEventListener("contextmenu",e=>{const t=e.target;const name=t.tagName.toLowerCase();if(!allowDefaultContextMenuTagNames.has(name)&&!IsInContentEditable(t))e.preventDefault()});const canvas=iRuntime.GetCanvas();window.addEventListener("selectstart", +PreventDefaultOnCanvasOrDoc);window.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc);canvas.addEventListener("selectstart",PreventDefaultOnCanvasOrDoc);canvas.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc);window.addEventListener("touchstart",PreventDefaultOnCanvasOrDoc,{"passive":false});if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc,{"passive":false});canvas.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc)}else canvas.addEventListener("touchstart", +PreventDefaultOnCanvasOrDoc);this._mousePointerLastButtons=0;window.addEventListener("mousedown",e=>{if(e.button===1)e.preventDefault()});window.addEventListener("mousewheel",BlockWheelZoom,{"passive":false});window.addEventListener("wheel",BlockWheelZoom,{"passive":false});window.addEventListener("resize",()=>this._OnWindowResize());window.addEventListener("fullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("webkitfullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("mozfullscreenchange", +()=>this._OnFullscreenChange());window.addEventListener("fullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("webkitfullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("mozfullscreenerror",e=>this._OnFullscreenError(e));if(iRuntime.IsiOSWebView())if(window["visualViewport"]){let lastVisualViewportHeight=Infinity;window["visualViewport"].addEventListener("resize",()=>{const curVisualViewportHeight=window["visualViewport"].height;if(curVisualViewportHeight>lastVisualViewportHeight)document.scrollingElement.scrollTop= +0;lastVisualViewportHeight=curVisualViewportHeight})}else window.addEventListener("focusout",()=>{if(!KeyboardIsVisible())document.scrollingElement.scrollTop=0});self["C3WrapperOnMessage"]=msg=>this._OnWrapperMessage(msg);this._mediaPendingPlay=new Set;this._mediaRemovedPendingPlay=new WeakSet;this._isSilent=false}_OnBeforeStartTicking(){self.setTimeout(()=>{this._enableAndroidVKDetection=true},1E3);if(this._iRuntime.GetExportType()==="cordova"){document.addEventListener("pause",()=>this._OnVisibilityChange(true)); +document.addEventListener("resume",()=>this._OnVisibilityChange(false))}else document.addEventListener("visibilitychange",()=>this._OnVisibilityChange(document.hidden));return{"isSuspended":!!(document.hidden||isCordovaPaused)}}Attach(){window.addEventListener("focus",()=>this._PostRuntimeEvent("window-focus"));window.addEventListener("blur",()=>{this._PostRuntimeEvent("window-blur",{"parentHasFocus":ParentHasFocus()});this._mousePointerLastButtons=0});window.addEventListener("focusin",e=>{if(IsKeyboardInputElement(e.target))this._PostRuntimeEvent("keyboard-blur")}); +window.addEventListener("keydown",e=>this._OnKeyEvent("keydown",e));window.addEventListener("keyup",e=>this._OnKeyEvent("keyup",e));window.addEventListener("dblclick",e=>this._OnMouseEvent("dblclick",e,DISPATCH_RUNTIME_AND_SCRIPT));window.addEventListener("wheel",e=>this._OnMouseWheelEvent("wheel",e));if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",e=>{this._HandlePointerDownFocus(e);this._OnPointerEvent("pointerdown",e)});if(this._iRuntime.UsesWorker()&&typeof window["onpointerrawupdate"]!== +"undefined"&&self===self.top){this._pointerRawUpdateRateLimiter=new self.RateLimiter(()=>this._DoSendPointerRawUpdate(),5);this._pointerRawUpdateRateLimiter.SetCanRunImmediate(true);window.addEventListener("pointerrawupdate",e=>this._OnPointerRawUpdate(e))}else window.addEventListener("pointermove",e=>this._OnPointerEvent("pointermove",e));window.addEventListener("pointerup",e=>this._OnPointerEvent("pointerup",e));window.addEventListener("pointercancel",e=>this._OnPointerEvent("pointercancel",e))}else{window.addEventListener("mousedown", +e=>{this._HandlePointerDownFocus(e);this._OnMouseEventAsPointer("pointerdown",e)});window.addEventListener("mousemove",e=>this._OnMouseEventAsPointer("pointermove",e));window.addEventListener("mouseup",e=>this._OnMouseEventAsPointer("pointerup",e));window.addEventListener("touchstart",e=>{this._HandlePointerDownFocus(e);this._OnTouchEvent("pointerdown",e)});window.addEventListener("touchmove",e=>this._OnTouchEvent("pointermove",e));window.addEventListener("touchend",e=>this._OnTouchEvent("pointerup", +e));window.addEventListener("touchcancel",e=>this._OnTouchEvent("pointercancel",e))}const playFunc=()=>this._PlayPendingMedia();window.addEventListener("pointerup",playFunc,true);window.addEventListener("touchend",playFunc,true);window.addEventListener("click",playFunc,true);window.addEventListener("keydown",playFunc,true);window.addEventListener("gamepadconnected",playFunc,true);if(this._iRuntime.IsAndroid()&&!this._iRuntime.IsAndroidWebView()&&navigator["virtualKeyboard"]){navigator["virtualKeyboard"]["overlaysContent"]= +true;navigator["virtualKeyboard"].addEventListener("geometrychange",()=>{this._OnAndroidVirtualKeyboardChange(this._GetWindowInnerHeight(),navigator["virtualKeyboard"]["boundingRect"]["height"])})}}_OnAndroidVirtualKeyboardChange(windowHeight,vkHeight){document.body.style.transform="";this._vkTranslateYOffset=0;if(vkHeight>0){const activeElement=document.activeElement;if(activeElement){const rc=activeElement.getBoundingClientRect();const rcMidY=(rc.top+rc.bottom)/2;const targetY=(windowHeight-vkHeight)/ +2;let shiftY=rcMidY-targetY;if(shiftY>vkHeight)shiftY=vkHeight;if(shiftY<0)shiftY=0;if(shiftY>0){document.body.style.transform=`translateY(${-shiftY}px)`;this._vkTranslateYOffset=shiftY}}}}_PostRuntimeEvent(name,data){this.PostToRuntime(name,data||null,DISPATCH_RUNTIME_ONLY)}_GetWindowInnerWidth(){return this._iRuntime._GetWindowInnerWidth()}_GetWindowInnerHeight(){return this._iRuntime._GetWindowInnerHeight()}_EnableWindowResizeEvent(){this._enableWindowResizeEvent=true;this._lastWindowWidth=this._iRuntime._GetWindowInnerWidth(); +this._lastWindowHeight=this._iRuntime._GetWindowInnerHeight()}_OnWindowResize(){if(this._isExportToVideo)return;if(!this._enableWindowResizeEvent)return;const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();if(this._iRuntime.IsAndroidWebView())if(this._enableAndroidVKDetection)if(this._lastWindowWidth===width&&height0){this._virtualKeyboardHeight=0;this._OnAndroidVirtualKeyboardChange(height,this._virtualKeyboardHeight)}this._lastWindowWidth=width;this._lastWindowHeight=height}else{this._lastWindowWidth=width;this._lastWindowHeight=height}this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()});if(this._iRuntime.IsiOSWebView()){if(this._simulatedResizeTimerId!== +-1)clearTimeout(this._simulatedResizeTimerId);this._OnSimulatedResize(width,height,0)}}_ScheduleSimulatedResize(width,height,count){if(this._simulatedResizeTimerId!==-1)clearTimeout(this._simulatedResizeTimerId);this._simulatedResizeTimerId=setTimeout(()=>this._OnSimulatedResize(width,height,count),48)}_OnSimulatedResize(originalWidth,originalHeight,count){const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();this._simulatedResizeTimerId=-1;if(width!=originalWidth||height!= +originalHeight)this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()});else if(count<10)this._ScheduleSimulatedResize(width,height,count+1)}_OnSetTargetOrientation(e){this._targetOrientation=e["targetOrientation"]}_TrySetTargetOrientation(){const orientation=this._targetOrientation;if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=> +console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result=screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result=screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ", +err)}}_OnFullscreenChange(){if(this._isExportToVideo)return;const isDocFullscreen=RuntimeInterface.IsDocumentFullscreen();if(isDocFullscreen&&this._targetOrientation!=="any")this._TrySetTargetOrientation();this.PostToRuntime("fullscreenchange",{"isFullscreen":isDocFullscreen,"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnFullscreenError(e){console.warn("[Construct] Fullscreen request failed: ",e);this.PostToRuntime("fullscreenerror",{"isFullscreen":RuntimeInterface.IsDocumentFullscreen(), +"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnVisibilityChange(isHidden){if(isHidden)this._iRuntime._CancelAnimationFrame();else this._iRuntime._RequestAnimationFrame();this.PostToRuntime("visibilitychange",{"hidden":isHidden})}_OnKeyEvent(name,e){if(e.key==="Backspace")PreventDefaultOnCanvasOrDoc(e);if(this._isExportToVideo)return;const code=KEY_CODE_ALIASES.get(e.code)||e.code;this._PostToRuntimeMaybeSync(name,{"code":code,"key":e.key,"which":e.which,"repeat":e.repeat, +"altKey":e.altKey,"ctrlKey":e.ctrlKey,"metaKey":e.metaKey,"shiftKey":e.shiftKey,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseWheelEvent(name,e){if(this._isExportToVideo)return;this.PostToRuntime(name,{"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"deltaX":e.deltaX,"deltaY":e.deltaY,"deltaZ":e.deltaZ,"deltaMode":e.deltaMode,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseEvent(name,e,opts){if(this._isExportToVideo)return; +if(IsCompatibilityMouseEvent(e))return;this._PostToRuntimeMaybeSync(name,{"button":e.button,"buttons":e.buttons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"timeStamp":e.timeStamp},opts)}_OnMouseEventAsPointer(name,e){if(this._isExportToVideo)return;if(IsCompatibilityMouseEvent(e))return;const pointerId=1;const lastButtons=this._mousePointerLastButtons;if(name==="pointerdown"&& +lastButtons!==0)name="pointermove";else if(name==="pointerup"&&e.buttons!==0)name="pointermove";this._PostToRuntimeMaybeSync(name,{"pointerId":pointerId,"pointerType":"mouse","button":e.button,"buttons":e.buttons,"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"width":0,"height":0,"pressure":0,"tangentialPressure":0,"tiltX":0,"tiltY":0,"twist":0, +"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT);this._mousePointerLastButtons=e.buttons;this._OnMouseEvent(e.type,e,DISPATCH_SCRIPT_ONLY)}_OnPointerEvent(name,e){if(this._isExportToVideo)return;if(this._pointerRawUpdateRateLimiter&&name!=="pointermove")this._pointerRawUpdateRateLimiter.Reset();let lastButtons=0;if(e.pointerType==="mouse")lastButtons=this._mousePointerLastButtons;this._PostToRuntimeMaybeSync(name,{"pointerId":e.pointerId,"pointerType":e.pointerType,"button":e.button,"buttons":e.buttons, +"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":(e.movementX||0)+this._pointerRawMovementX,"movementY":(e.movementY||0)+this._pointerRawMovementY,"width":e.width||0,"height":e.height||0,"pressure":e.pressure||0,"tangentialPressure":e["tangentialPressure"]||0,"tiltX":e.tiltX||0,"tiltY":e.tiltY||0,"twist":e["twist"]||0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT);this._pointerRawMovementX= +0;this._pointerRawMovementY=0;if(e.pointerType==="mouse"){let mouseEventName="mousemove";if(name==="pointerdown")mouseEventName="mousedown";else if(name==="pointerup")mouseEventName="mouseup";this._OnMouseEvent(mouseEventName,e,DISPATCH_SCRIPT_ONLY);this._mousePointerLastButtons=e.buttons}}_OnPointerRawUpdate(e){if(this._lastPointerRawUpdateEvent){this._pointerRawMovementX+=this._lastPointerRawUpdateEvent.movementX||0;this._pointerRawMovementY+=this._lastPointerRawUpdateEvent.movementY||0}this._lastPointerRawUpdateEvent= +e;this._pointerRawUpdateRateLimiter.Call()}_DoSendPointerRawUpdate(){this._OnPointerEvent("pointermove",this._lastPointerRawUpdateEvent);this._lastPointerRawUpdateEvent=null}_OnTouchEvent(fireName,e){if(this._isExportToVideo)return;for(let i=0,len=e.changedTouches.length;ithis._OnDeviceOrientation(e));window.addEventListener("deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e))}_AttachDeviceMotionEvent(){if(this._attachedDeviceMotionEvent)return; +this._attachedDeviceMotionEvent=true;window.addEventListener("devicemotion",e=>this._OnDeviceMotion(e))}_OnDeviceOrientation(e){if(this._isExportToVideo)return;this.PostToRuntime("deviceorientation",{"absolute":!!e["absolute"],"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp,"webkitCompassHeading":e["webkitCompassHeading"],"webkitCompassAccuracy":e["webkitCompassAccuracy"]},DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceOrientationAbsolute(e){if(this._isExportToVideo)return; +this.PostToRuntime("deviceorientationabsolute",{"absolute":!!e["absolute"],"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceMotion(e){if(this._isExportToVideo)return;let accProp=null;const acc=e["acceleration"];if(acc)accProp={"x":acc["x"]||0,"y":acc["y"]||0,"z":acc["z"]||0};let withGProp=null;const withG=e["accelerationIncludingGravity"];if(withG)withGProp={"x":withG["x"]||0,"y":withG["y"]||0,"z":withG["z"]||0};let rotationRateProp= +null;const rotationRate=e["rotationRate"];if(rotationRate)rotationRateProp={"alpha":rotationRate["alpha"]||0,"beta":rotationRate["beta"]||0,"gamma":rotationRate["gamma"]||0};this.PostToRuntime("devicemotion",{"acceleration":accProp,"accelerationIncludingGravity":withGProp,"rotationRate":rotationRateProp,"interval":e["interval"],"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnUpdateCanvasSize(e){const runtimeInterface=this.GetRuntimeInterface();if(runtimeInterface.IsExportingToVideo())return; +const canvas=runtimeInterface.GetCanvas();canvas.style.width=e["styleWidth"]+"px";canvas.style.height=e["styleHeight"]+"px";canvas.style.marginLeft=e["marginLeft"]+"px";canvas.style.marginTop=e["marginTop"]+"px";document.documentElement.style.setProperty("--construct-scale",e["displayScale"]);if(this._isFirstSizeUpdate){canvas.style.display="";this._isFirstSizeUpdate=false}}_OnInvokeDownload(e){const url=e["url"];const filename=e["filename"];const a=document.createElement("a");const body=document.body; +a.textContent=filename;a.href=url;a.download=filename;body.appendChild(a);a.click();body.removeChild(a)}async _OnRasterSvgImage(e){const blob=e["blob"];const imageWidth=e["imageWidth"];const imageHeight=e["imageHeight"];const surfaceWidth=e["surfaceWidth"];const surfaceHeight=e["surfaceHeight"];const imageBitmapOpts=e["imageBitmapOpts"];const canvas=await self["C3_RasterSvgImageBlob"](blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight);let ret;if(imageBitmapOpts)ret=await createImageBitmap(canvas, +imageBitmapOpts);else ret=await createImageBitmap(canvas);return{"imageBitmap":ret,"transferables":[ret]}}async _OnGetSvgImageSize(e){return await self["C3_GetSvgImageSize"](e["blob"])}async _OnAddStylesheet(e){await AddStyleSheet(e["url"])}_PlayPendingMedia(){const mediaToTryPlay=[...this._mediaPendingPlay];this._mediaPendingPlay.clear();if(!this._isSilent)for(const mediaElem of mediaToTryPlay){const playRet=mediaElem.play();if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}}TryPlayMedia(mediaElem){if(typeof mediaElem.play!== +"function")throw new Error("missing play function");this._mediaRemovedPendingPlay.delete(mediaElem);let playRet;try{playRet=mediaElem.play()}catch(err){this._mediaPendingPlay.add(mediaElem);return}if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}RemovePendingPlay(mediaElem){this._mediaPendingPlay.delete(mediaElem);this._mediaRemovedPendingPlay.add(mediaElem)}SetSilent(s){this._isSilent=!!s}_OnHideCordovaSplash(){if(navigator["splashscreen"]&& +navigator["splashscreen"]["hide"])navigator["splashscreen"]["hide"]()}_OnDebugHighlight(e){const show=e["show"];if(!show){if(this._debugHighlightElem)this._debugHighlightElem.style.display="none";return}if(!this._debugHighlightElem){this._debugHighlightElem=document.createElement("div");this._debugHighlightElem.id="inspectOutline";document.body.appendChild(this._debugHighlightElem)}const elem=this._debugHighlightElem;elem.style.display="";elem.style.left=e["left"]-1+"px";elem.style.top=e["top"]-1+ +"px";elem.style.width=e["width"]+2+"px";elem.style.height=e["height"]+2+"px";elem.textContent=e["name"]}_OnRegisterSW(){if(window["C3_RegisterSW"])window["C3_RegisterSW"]()}_OnPostToDebugger(data){if(!window["c3_postToMessagePort"])return;data["from"]="runtime";window["c3_postToMessagePort"](data)}_InvokeFunctionFromJS(name,params){return this.PostToRuntimeAsync("js-invoke-function",{"name":name,"params":params})}_OnScriptCreateWorker(e){const url=e["url"];const opts=e["opts"];const port2=e["port2"]; +const worker=new Worker(url,opts);worker.postMessage({"type":"construct-worker-init","port2":port2},[port2])}_OnAlert(e){alert(e["message"])}_OnWrapperMessage(msg){if(msg==="entered-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._OnFullscreenChange()}else if(msg==="exited-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._OnFullscreenChange()}else console.warn("Unknown wrapper message: ",msg)}_SetExportingToVideo(e){this._isExportToVideo=true;const headerElem= +document.createElement("h1");headerElem.id="exportToVideoMessage";headerElem.textContent=e["message"];document.body.prepend(headerElem);document.body.classList.add("exportingToVideo");this.GetRuntimeInterface().GetCanvas().style.display="";this._iRuntime.SetIsExportingToVideo(e["duration"])}_OnExportVideoProgress(e){this._exportVideoProgressMessage=e["message"];if(this._exportVideoUpdateTimerId===-1)this._exportVideoUpdateTimerId=setTimeout(()=>this._DoUpdateExportVideoProgressMessage(),250)}_DoUpdateExportVideoProgressMessage(){this._exportVideoUpdateTimerId= +-1;const headerElem=document.getElementById("exportToVideoMessage");if(headerElem)headerElem.textContent=this._exportVideoProgressMessage}_OnExportedToVideo(e){window.c3_postToMessagePort({"type":"exported-video","blob":e["blob"],"time":e["time"]})}_OnExportedToImageSequence(e){window.c3_postToMessagePort({"type":"exported-image-sequence","blobArr":e["blobArr"],"time":e["time"],"gif":e["gif"]})}};RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; + + +'use strict';{const DISPATCH_WORKER_SCRIPT_NAME="dispatchworker.js";const JOB_WORKER_SCRIPT_NAME="jobworker.js";self.JobSchedulerDOM=class JobSchedulerDOM{constructor(runtimeInterface){this._runtimeInterface=runtimeInterface;this._baseUrl=runtimeInterface.GetRuntimeBaseURL();if(runtimeInterface.GetExportType()==="preview")this._baseUrl+="workers/";else this._baseUrl+=runtimeInterface.GetScriptFolder();this._maxNumWorkers=Math.min(navigator.hardwareConcurrency||2,16);this._dispatchWorker=null;this._jobWorkers= +[];this._inputPort=null;this._outputPort=null}_GetWorkerScriptFolder(){if(this._runtimeInterface.GetExportType()==="playable-ad")return this._runtimeInterface.GetScriptFolder();else return""}async Init(){if(this._hasInitialised)throw new Error("already initialised");this._hasInitialised=true;const dispatchWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+DISPATCH_WORKER_SCRIPT_NAME);this._dispatchWorker=await this._runtimeInterface.CreateWorker(dispatchWorkerScriptUrl, +this._baseUrl,{name:"DispatchWorker"});const messageChannel=new MessageChannel;this._inputPort=messageChannel.port1;this._dispatchWorker.postMessage({"type":"_init","in-port":messageChannel.port2},[messageChannel.port2]);this._outputPort=await this._CreateJobWorker()}async _CreateJobWorker(){const number=this._jobWorkers.length;const jobWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+JOB_WORKER_SCRIPT_NAME);const jobWorker=await this._runtimeInterface.CreateWorker(jobWorkerScriptUrl, +this._baseUrl,{name:"JobWorker"+number});const dispatchChannel=new MessageChannel;const outputChannel=new MessageChannel;this._dispatchWorker.postMessage({"type":"_addJobWorker","port":dispatchChannel.port1},[dispatchChannel.port1]);jobWorker.postMessage({"type":"init","number":number,"dispatch-port":dispatchChannel.port2,"output-port":outputChannel.port2},[dispatchChannel.port2,outputChannel.port2]);this._jobWorkers.push(jobWorker);return outputChannel.port1}GetPortData(){return{"inputPort":this._inputPort, +"outputPort":this._outputPort,"maxNumWorkers":this._maxNumWorkers}}GetPortTransferables(){return[this._inputPort,this._outputPort]}}}; + + +'use strict';{if(window["C3_IsSupported"]){const enableWorker=false;window["c3_runtimeInterface"]=new self.RuntimeInterface({useWorker:enableWorker,workerMainUrl:"workermain.js",engineScripts:["scripts/c3runtime.js"],projectScripts:[["scripts/project/scriptsInEvents.js"]],mainProjectScript:"",scriptFolder:"scripts/",workerDependencyScripts:[],exportType:"html5"})}}; +'use strict';{const R_TO_D=180/Math.PI;const DOM_COMPONENT_ID="audio";self.AudioDOMHandler=class AudioDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._audioContext=null;this._destinationNode=null;this._hasUnblocked=false;this._hasAttachedUnblockEvents=false;this._unblockFunc=()=>this._UnblockAudioContext();this._audioBuffers=[];this._audioInstances=[];this._lastAudioInstance=null;this._lastPlayedTag="";this._loadedAudioUrls=new Set;this._lastTickCount= +-1;this._pendingTags=new Map;this._masterVolume=1;this._isSilent=false;this._timeScaleMode=0;this._timeScale=1;this._gameTime=0;this._panningModel="HRTF";this._distanceModel="inverse";this._refDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._lastListenerPos=[0,0,0];this._playMusicAsSound=false;this._hasAnySoftwareDecodedMusic=false;this._supportsWebMOpus=this._iRuntime.IsAudioFormatSupported("audio/webm; codecs=opus");this._effects=new Map;this._analysers=new Set;this._isPendingPostFxState= +false;this._hasStartedOfflineRender=false;this._microphoneTag="";this._microphoneSource=null;self["C3Audio_OnMicrophoneStream"]=(localMediaStream,tag)=>this._OnMicrophoneStream(localMediaStream,tag);this._destMediaStreamNode=null;self["C3Audio_GetOutputStream"]=()=>this._OnGetOutputStream();self["C3Audio_DOMInterface"]=this;this.AddRuntimeMessageHandlers([["create-audio-context",e=>this._CreateAudioContext(e)],["play",e=>this._Play(e)],["stop",e=>this._Stop(e)],["stop-all",()=>this._StopAll()],["set-paused", +e=>this._SetPaused(e)],["set-volume",e=>this._SetVolume(e)],["fade-volume",e=>this._FadeVolume(e)],["set-master-volume",e=>this._SetMasterVolume(e)],["set-muted",e=>this._SetMuted(e)],["set-silent",e=>this._SetSilent(e)],["set-looping",e=>this._SetLooping(e)],["set-playback-rate",e=>this._SetPlaybackRate(e)],["set-stereo-pan",e=>this._SetStereoPan(e)],["seek",e=>this._Seek(e)],["preload",e=>this._Preload(e)],["unload",e=>this._Unload(e)],["unload-all",()=>this._UnloadAll()],["set-suspended",e=>this._SetSuspended(e)], +["add-effect",e=>this._AddEffect(e)],["set-effect-param",e=>this._SetEffectParam(e)],["remove-effects",e=>this._RemoveEffects(e)],["tick",e=>this._OnTick(e)],["load-state",e=>this._OnLoadState(e)],["offline-render-audio",e=>this._OnOfflineRenderAudio(e)],["offline-render-finish",()=>this._OnOfflineRenderFinish()]])}async _CreateAudioContext(e){if(e["isiOSCordova"]||e["isSafari"])this._playMusicAsSound=true;this._timeScaleMode=e["timeScaleMode"];this._panningModel=["equalpower","HRTF","soundfield"][e["panningModel"]]; +this._distanceModel=["linear","inverse","exponential"][e["distanceModel"]];this._refDistance=e["refDistance"];this._maxDistance=e["maxDistance"];this._rolloffFactor=e["rolloffFactor"];if(this._iRuntime.IsExportingToVideo()){this._playMusicAsSound=true;const sampleRate=48E3;this._audioContext=new OfflineAudioContext({"numberOfChannels":2,"sampleRate":sampleRate,"length":Math.ceil(this._iRuntime.GetExportToVideoDuration()*sampleRate)})}else{const opts={"latencyHint":e["latencyHint"]};if(!this.SupportsWebMOpus())opts["sampleRate"]= +48E3;if(typeof AudioContext!=="undefined")this._audioContext=new AudioContext(opts);else if(typeof webkitAudioContext!=="undefined")this._audioContext=new webkitAudioContext(opts);else throw new Error("Web Audio API not supported");this._AttachUnblockEvents();this._audioContext.onstatechange=()=>{if(this._audioContext.state!=="running")this._AttachUnblockEvents();this.PostToRuntime("audiocontext-state",{"audioContextState":this._audioContext.state})}}this._destinationNode=this._audioContext["createGain"](); +this._destinationNode["connect"](this._audioContext["destination"]);const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]);this._audioContext["listener"]["setOrientation"](0,0,1,0,-1,0);self["C3_GetAudioContextCurrentTime"]=()=>this.GetAudioCurrentTime();try{await Promise.all(e["preloadList"].map(o=>this._GetAudioBuffer(o["originalUrl"], +o["url"],o["type"],false)))}catch(err){console.error("[Construct] Preloading sounds failed: ",err)}return{"sampleRate":this._audioContext["sampleRate"],"audioContextState":this._audioContext.state,"outputLatency":this._audioContext["outputLatency"]||0}}_AttachUnblockEvents(){if(this._hasAttachedUnblockEvents)return;this._hasUnblocked=false;window.addEventListener("pointerup",this._unblockFunc,true);window.addEventListener("touchend",this._unblockFunc,true);window.addEventListener("click",this._unblockFunc, +true);window.addEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=true}_DetachUnblockEvents(){if(!this._hasAttachedUnblockEvents)return;this._hasUnblocked=true;window.removeEventListener("pointerup",this._unblockFunc,true);window.removeEventListener("touchend",this._unblockFunc,true);window.removeEventListener("click",this._unblockFunc,true);window.removeEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=false}_UnblockAudioContext(){if(this._hasUnblocked)return; +const audioContext=this._audioContext;if(audioContext["state"]==="suspended"&&audioContext["resume"])audioContext["resume"]();const buffer=audioContext["createBuffer"](1,220,22050);const source=audioContext["createBufferSource"]();source["buffer"]=buffer;source["connect"](audioContext["destination"]);source["start"](0);if(audioContext["state"]==="running")this._DetachUnblockEvents()}GetAudioContext(){return this._audioContext}GetAudioCurrentTime(){return this._audioContext["currentTime"]}GetDestinationNode(){return this._destinationNode}GetDestinationForTag(tag){const fxChain= +this._effects.get(tag.toLowerCase());if(fxChain)return fxChain[0].GetInputNode();else return this.GetDestinationNode()}AddEffectForTag(tag,effect){tag=tag.toLowerCase();let fxChain=this._effects.get(tag);if(!fxChain){fxChain=[];this._effects.set(tag,fxChain)}effect._SetIndex(fxChain.length);effect._SetTag(tag);fxChain.push(effect);this._ReconnectEffects(tag)}_ReconnectEffects(tag){let destNode=this.GetDestinationNode();const fxChain=this._effects.get(tag);if(fxChain&&fxChain.length){destNode=fxChain[0].GetInputNode(); +for(let i=0,len=fxChain.length;i{const audioBuffer=this._audioContext["createBuffer"](1,rawAudio.length,48E3);const channelBuffer=audioBuffer["getChannelData"](0);channelBuffer.set(rawAudio); +return audioBuffer});else return new Promise((resolve,reject)=>{this._audioContext["decodeAudioData"](audioData,resolve,reject)})}TryPlayMedia(mediaElem){this._iRuntime.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._iRuntime.RemovePendingPlay(mediaElem)}ReleaseInstancesForBuffer(buffer){let j=0;for(let i=0,len=this._audioInstances.length;iresolve=r);info={pendingCount:0,promise,resolve};this._pendingTags.set(tag,info)}info.pendingCount++}_RemovePendingTag(tag){const info= +this._pendingTags.get(tag);if(!info)throw new Error("expected pending tag");info.pendingCount--;if(info.pendingCount===0){info.resolve();this._pendingTags.delete(tag)}}TagReady(tag){if(!tag)tag=this._lastPlayedTag;const info=this._pendingTags.get(tag);if(info)return info.promise;else return Promise.resolve()}_MaybeStartTicking(){if(this._analysers.size>0){this._StartTicking();return}for(const ai of this._audioInstances)if(ai.IsActive()){this._StartTicking();return}}Tick(){for(const a of this._analysers)a.Tick(); +const currentTime=this.GetAudioCurrentTime();for(const ai of this._audioInstances)ai.Tick(currentTime);const instStates=this._audioInstances.filter(a=>a.IsActive()).map(a=>a.GetState());this.PostToRuntime("state",{"tickCount":this._lastTickCount,"outputLatency":this._audioContext["outputLatency"]||0,"audioInstances":instStates,"analysers":[...this._analysers].map(a=>a.GetData())});if(instStates.length===0&&this._analysers.size===0)this._StopTicking()}PostTrigger(type,tag,aiid){this.PostToRuntime("trigger", +{"type":type,"tag":tag,"aiid":aiid})}async _Play(e){const originalUrl=e["originalUrl"];const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];const tag=e["tag"];const isLooping=e["isLooping"];const volume=e["vol"];const position=e["pos"];const panning=e["panning"];const stereoPan=e["stereoPan"];let startTime=e["off"];if(startTime>0&&!e["trueClock"])if(this._audioContext["getOutputTimestamp"]){const outputTimestamp=this._audioContext["getOutputTimestamp"]();startTime=startTime-outputTimestamp["performanceTime"]/ +1E3+outputTimestamp["contextTime"]}else startTime=startTime-performance.now()/1E3+this._audioContext["currentTime"];this._lastPlayedTag=tag;this._AddPendingTag(tag);try{this._lastAudioInstance=await this._GetAudioInstance(originalUrl,url,type,tag,isMusic);if(panning){this._lastAudioInstance.SetPannerEnabled(true);this._lastAudioInstance.SetPan(panning["x"],panning["y"],panning["angle"],panning["innerAngle"],panning["outerAngle"],panning["outerGain"]);if(panning.hasOwnProperty("uid"))this._lastAudioInstance.SetUID(panning["uid"])}else if(typeof stereoPan=== +"number"&&stereoPan!==0){this._lastAudioInstance.SetStereoPannerEnabled(true);this._lastAudioInstance.SetStereoPan(stereoPan)}else{this._lastAudioInstance.SetPannerEnabled(false);this._lastAudioInstance.SetStereoPannerEnabled(false)}this._lastAudioInstance.Play(isLooping,volume,position,startTime)}catch(err){console.error("[Construct] Audio: error starting playback: ",err);return}finally{this._RemovePendingTag(tag)}this._StartTicking()}_Stop(e){const tag=e["tag"];for(const ai of this.audioInstancesByTag(tag))ai.Stop()}_StopAll(){for(const ai of this._audioInstances)ai.Stop()}_SetPaused(e){const tag= +e["tag"];const paused=e["paused"];for(const ai of this.audioInstancesByTag(tag))if(paused)ai.Pause();else ai.Resume();this._MaybeStartTicking()}_SetVolume(e){const tag=e["tag"];const vol=e["vol"];for(const ai of this.audioInstancesByTag(tag))ai.SetVolume(vol)}_SetStereoPan(e){const tag=e["tag"];const p=e["p"];for(const ai of this.audioInstancesByTag(tag)){ai.SetStereoPannerEnabled(true);ai.SetStereoPan(p)}}async _FadeVolume(e){const tag=e["tag"];const vol=e["vol"];const duration=e["duration"];const stopOnEnd= +e["stopOnEnd"];await this.TagReady(tag);for(const ai of this.audioInstancesByTag(tag))ai.FadeVolume(vol,duration,stopOnEnd);this._MaybeStartTicking()}_SetMasterVolume(e){this._masterVolume=e["vol"];this._destinationNode["gain"]["value"]=this._masterVolume}_SetMuted(e){const tag=e["tag"];const isMuted=e["isMuted"];for(const ai of this.audioInstancesByTag(tag))ai.SetMuted(isMuted)}_SetSilent(e){this._isSilent=e["isSilent"];this._iRuntime.SetSilent(this._isSilent);for(const ai of this._audioInstances)ai._UpdateMuted()}_SetLooping(e){const tag= +e["tag"];const isLooping=e["isLooping"];for(const ai of this.audioInstancesByTag(tag))ai.SetLooping(isLooping)}async _SetPlaybackRate(e){const tag=e["tag"];const rate=e["rate"];await this.TagReady(tag);for(const ai of this.audioInstancesByTag(tag))ai.SetPlaybackRate(rate)}async _Seek(e){const tag=e["tag"];const pos=e["pos"];await this.TagReady(tag);for(const ai of this.audioInstancesByTag(tag))ai.Seek(pos)}async _Preload(e){const originalUrl=e["originalUrl"];const url=e["url"];const type=e["type"]; +const isMusic=e["isMusic"];try{await this._GetAudioInstance(originalUrl,url,type,"",isMusic)}catch(err){console.error("[Construct] Audio: error preloading: ",err)}}async _Unload(e){const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];const buffer=await this._GetAudioBuffer("",url,type,isMusic,true);if(!buffer)return;buffer.Release();const i=this._audioBuffers.indexOf(buffer);if(i!==-1)this._audioBuffers.splice(i,1)}_UnloadAll(){for(const buffer of this._audioBuffers)buffer.Release(); +this._audioBuffers.length=0}_SetSuspended(e){const isSuspended=e["isSuspended"];if(!isSuspended&&this._audioContext["resume"])this._audioContext["resume"]();for(const ai of this._audioInstances)ai.SetSuspended(isSuspended);if(isSuspended&&this._audioContext["suspend"])this._audioContext["suspend"]()}_OnTick(e){this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];this._lastTickCount=e["tickCount"];if(this._timeScaleMode!==0)for(const ai of this._audioInstances)ai._UpdatePlaybackRate();const listenerPos= +e["listenerPos"];if(listenerPos&&(this._lastListenerPos[0]!==listenerPos[0]||this._lastListenerPos[1]!==listenerPos[1]||this._lastListenerPos[2]!==listenerPos[2])){this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2])}for(const instPan of e["instPans"]){const uid=instPan["uid"];for(const ai of this._audioInstances)if(ai.GetUID()===uid)ai.SetPanXYA(instPan["x"], +instPan["y"],instPan["angle"])}}async _AddEffect(e){const type=e["type"];const tag=e["tag"];const params=e["params"];let effect;if(type==="filter")effect=new self.C3AudioFilterFX(this,...params);else if(type==="delay")effect=new self.C3AudioDelayFX(this,...params);else if(type==="convolution"){let buffer=null;try{buffer=await this._GetAudioBuffer(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"],false)}catch(err){console.log("[Construct] Audio: error loading convolution: ",err);return}effect= +new self.C3AudioConvolveFX(this,buffer.GetAudioBuffer(),...params);effect._SetBufferInfo(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"])}else if(type==="flanger")effect=new self.C3AudioFlangerFX(this,...params);else if(type==="phaser")effect=new self.C3AudioPhaserFX(this,...params);else if(type==="gain")effect=new self.C3AudioGainFX(this,...params);else if(type==="stereopan")effect=new self.C3AudioStereoPanFX(this,...params);else if(type==="tremolo")effect=new self.C3AudioTremoloFX(this,...params); +else if(type==="ringmod")effect=new self.C3AudioRingModFX(this,...params);else if(type==="distortion")effect=new self.C3AudioDistortionFX(this,...params);else if(type==="compressor")effect=new self.C3AudioCompressorFX(this,...params);else if(type==="analyser")effect=new self.C3AudioAnalyserFX(this,...params);else throw new Error("invalid effect type");this.AddEffectForTag(tag,effect);this._PostUpdatedFxState()}_SetEffectParam(e){const tag=e["tag"];const index=e["index"];const param=e["param"];const value= +e["value"];const ramp=e["ramp"];const time=e["time"];const fxChain=this._effects.get(tag);if(!fxChain||index<0||index>=fxChain.length)return;fxChain[index].SetParam(param,value,ramp,time);this._PostUpdatedFxState()}_RemoveEffects(e){const tag=e["tag"].toLowerCase();const fxChain=this._effects.get(tag);if(!fxChain||!fxChain.length)return;for(const effect of fxChain)effect.Release();this._effects.delete(tag);this._ReconnectEffects(tag)}_AddAnalyser(analyser){this._analysers.add(analyser);this._MaybeStartTicking()}_RemoveAnalyser(analyser){this._analysers.delete(analyser)}_PostUpdatedFxState(){if(this._isPendingPostFxState)return; +this._isPendingPostFxState=true;Promise.resolve().then(()=>this._DoPostUpdatedFxState())}_DoPostUpdatedFxState(){const fxstate={};for(const [tag,fxChain]of this._effects)fxstate[tag]=fxChain.map(e=>e.GetState());this.PostToRuntime("fxstate",{"fxstate":fxstate});this._isPendingPostFxState=false}async _OnLoadState(e){const saveLoadMode=e["saveLoadMode"];if(saveLoadMode!==3){const keepAudioInstances=[];for(const ai of this._audioInstances)if(ai.IsMusic()&&saveLoadMode===1||!ai.IsMusic()&&saveLoadMode=== +2)keepAudioInstances.push(ai);else ai.Release();this._audioInstances=keepAudioInstances}for(const fxChain of this._effects.values())for(const effect of fxChain)effect.Release();this._effects.clear();this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]); +this._isSilent=e["isSilent"];this._iRuntime.SetSilent(this._isSilent);this._masterVolume=e["masterVolume"];this._destinationNode["gain"]["value"]=this._masterVolume;const promises=[];for(const fxChainData of Object.values(e["effects"]))promises.push(Promise.all(fxChainData.map(d=>this._AddEffect(d))));await Promise.all(promises);await Promise.all(e["playing"].map(d=>this._LoadAudioInstance(d,saveLoadMode)));this._MaybeStartTicking()}async _LoadAudioInstance(d,saveLoadMode){if(saveLoadMode===3)return; +const originalUrl=d["bufferOriginalUrl"];const url=d["bufferUrl"];const type=d["bufferType"];const isMusic=d["isMusic"];const tag=d["tag"];const isLooping=d["isLooping"];const volume=d["volume"];const position=d["playbackTime"];if(isMusic&&saveLoadMode===1)return;if(!isMusic&&saveLoadMode===2)return;let ai=null;try{ai=await this._GetAudioInstance(originalUrl,url,type,tag,isMusic)}catch(err){console.error("[Construct] Audio: error loading audio state: ",err);return}ai.LoadPanState(d["pan"]);ai.LoadStereoPanState(d["stereoPan"]); +ai.Play(isLooping,volume,position,0);if(!d["isPlaying"])ai.Pause();ai._LoadAdditionalState(d)}_OnMicrophoneStream(localMediaStream,tag){if(this._microphoneSource)this._microphoneSource["disconnect"]();this._microphoneTag=tag.toLowerCase();this._microphoneSource=this._audioContext["createMediaStreamSource"](localMediaStream);this._microphoneSource["connect"](this.GetDestinationForTag(this._microphoneTag))}_OnGetOutputStream(){if(!this._destMediaStreamNode){this._destMediaStreamNode=this._audioContext["createMediaStreamDestination"](); +this._destinationNode["connect"](this._destMediaStreamNode)}return this._destMediaStreamNode["stream"]}async _OnOfflineRenderAudio(e){try{const time=e["time"];const suspendPromise=this._audioContext["suspend"](time);if(!this._hasStartedOfflineRender){this._audioContext["startRendering"]().then(buffer=>this._OnOfflineRenderCompleted(buffer)).catch(err=>this._OnOfflineRenderError(err));this._hasStartedOfflineRender=true}else this._audioContext["resume"]();await suspendPromise}catch(err){this._OnOfflineRenderError(err)}}_OnOfflineRenderFinish(){this._audioContext["resume"]()}_OnOfflineRenderCompleted(buffer){const channelArrayBuffers= +[];for(let i=0,len=buffer["numberOfChannels"];ithis._reachedCanPlayThrough= +true);this._outNode=this.GetAudioContext()["createGain"]();this._mediaSourceNode=null;this._audioElem.addEventListener("canplay",()=>{if(this._loadResolve){this._loadState="loaded";this._loadResolve();this._loadResolve=null;this._loadReject=null}if(this._mediaSourceNode||!this._audioElem)return;this._mediaSourceNode=this.GetAudioContext()["createMediaElementSource"](this._audioElem);this._mediaSourceNode["connect"](this._outNode)});this.onended=null;this._audioElem.addEventListener("ended",()=>{if(this.onended)this.onended()}); +this._audioElem.addEventListener("error",e=>this._OnError(e))}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._outNode["disconnect"]();this._outNode=null;this._mediaSourceNode["disconnect"]();this._mediaSourceNode=null;if(this._audioElem&&!this._audioElem.paused)this._audioElem.pause();this.onended=null;this._audioElem=null;super.Release()}_Load(){this._loadState="loading";return new Promise((resolve,reject)=>{this._loadResolve=resolve;this._loadReject=reject;this._audioElem.src= +this._url})}_OnError(e){console.error(`[Construct] Audio '${this._url}' error: `,e);if(this._loadReject){this._loadState="failed";this._loadReject(e);this._loadResolve=null;this._loadReject=null}}IsLoaded(){const ret=this._audioElem["readyState"]>=4;if(ret)this._reachedCanPlayThrough=true;return ret||this._reachedCanPlayThrough}IsLoadedAndDecoded(){return this.IsLoaded()}GetAudioElement(){return this._audioElem}GetOutputNode(){return this._outNode}GetDuration(){return this._audioElem["duration"]}}}; +'use strict';{self.C3WebAudioBuffer=class C3WebAudioBuffer extends self.C3AudioBuffer{constructor(audioDomHandler,originalUrl,url,type,isMusic,needsSoftwareDecode){super(audioDomHandler,originalUrl,url,type,isMusic);this._api="webaudio";this._audioData=null;this._audioBuffer=null;this._needsSoftwareDecode=!!needsSoftwareDecode}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._audioData=null;this._audioBuffer=null;super.Release()}async _Fetch(){if(this._audioData)return this._audioData; +const iRuntime=this._audioDomHandler.GetRuntimeInterface();if(iRuntime.GetExportType()==="cordova"&&iRuntime.IsRelativeURL(this._url)&&iRuntime.IsFileProtocol())this._audioData=await iRuntime.CordovaFetchLocalFileAsArrayBuffer(this._url);else{const response=await fetch(this._url);if(!response.ok)throw new Error(`error fetching audio data: ${response.status} ${response.statusText}`);this._audioData=await response.arrayBuffer()}}async _Decode(){if(this._audioBuffer)return this._audioBuffer;this._audioBuffer= +await this._audioDomHandler.DecodeAudioData(this._audioData,this._needsSoftwareDecode);this._audioData=null}async _Load(){try{this._loadState="loading";await this._Fetch();await this._Decode();this._loadState="loaded"}catch(err){this._loadState="failed";console.error(`[Construct] Failed to load audio '${this._url}': `,err)}}IsLoaded(){return!!(this._audioData||this._audioBuffer)}IsLoadedAndDecoded(){return!!this._audioBuffer}GetAudioBuffer(){return this._audioBuffer}GetDuration(){return this._audioBuffer? +this._audioBuffer["duration"]:0}}}; +'use strict';{let nextAiId=0;self.C3AudioInstance=class C3AudioInstance{constructor(audioDomHandler,buffer,tag){this._audioDomHandler=audioDomHandler;this._buffer=buffer;this._tag=tag;this._aiId=nextAiId++;this._gainNode=this.GetAudioContext()["createGain"]();this._gainNode["connect"](this.GetDestinationNode());this._pannerNode=null;this._isPannerEnabled=false;this._pannerPosition=[0,0,0];this._pannerOrientation=[0,0,0];this._pannerConeParams=[0,0,0];this._stereoPannerNode=null;this._isStereoPannerEnabled= +false;this._stereoPan=0;this._isStopped=true;this._isPaused=false;this._resumeMe=false;this._isLooping=false;this._volume=1;this._isMuted=false;this._playbackRate=1;const timeScaleMode=this._audioDomHandler.GetTimeScaleMode();this._isTimescaled=timeScaleMode===1&&!this.IsMusic()||timeScaleMode===2;this._instUid=-1;this._fadeEndTime=-1;this._stopOnFadeEnd=false}Release(){this._audioDomHandler=null;this._buffer=null;if(this._pannerNode){this._pannerNode["disconnect"]();this._pannerNode=null}if(this._stereoPannerNode){this._stereoPannerNode["disconnect"](); +this._stereoPannerNode=null}this._gainNode["disconnect"]();this._gainNode=null}GetAudioContext(){return this._audioDomHandler.GetAudioContext()}GetDestinationNode(){return this._audioDomHandler.GetDestinationForTag(this._tag)}GetCurrentTime(){if(this._isTimescaled)return this._audioDomHandler.GetGameTime();else return performance.now()/1E3}GetOriginalUrl(){return this._buffer.GetOriginalUrl()}GetUrl(){return this._buffer.GetUrl()}GetContentType(){return this._buffer.GetContentType()}GetBuffer(){return this._buffer}IsMusic(){return this._buffer.IsMusic()}SetTag(tag){this._tag= +tag}GetTag(){return this._tag}GetAiId(){return this._aiId}HasEnded(){}CanBeRecycled(){}IsPlaying(){return!this._isStopped&&!this._isPaused&&!this.HasEnded()}IsActive(){return!this._isStopped&&!this.HasEnded()}GetPlaybackTime(){}GetDuration(applyPlaybackRate){let ret=this._buffer.GetDuration();if(applyPlaybackRate)ret/=this._playbackRate||.001;return ret}Play(isLooping,vol,seekPos,scheduledTime){}Stop(){}Pause(){}IsPaused(){return this._isPaused}Resume(){}SetVolume(v){this._volume=v;this._gainNode["gain"]["cancelScheduledValues"](0); +this._fadeEndTime=-1;this._gainNode["gain"]["value"]=this.GetOutputVolume()}FadeVolume(vol,duration,stopOnEnd){if(this.IsMuted())return;const gainParam=this._gainNode["gain"];gainParam["cancelScheduledValues"](0);const currentTime=this._audioDomHandler.GetAudioCurrentTime();const endTime=currentTime+duration;gainParam["setValueAtTime"](gainParam["value"],currentTime);gainParam["linearRampToValueAtTime"](vol,endTime);this._volume=vol;this._fadeEndTime=endTime;this._stopOnFadeEnd=stopOnEnd}_UpdateVolume(){this.SetVolume(this._volume)}Tick(currentTime){if(this._fadeEndTime!== +-1&¤tTime>=this._fadeEndTime){this._fadeEndTime=-1;if(this._stopOnFadeEnd)this.Stop();this._audioDomHandler.PostTrigger("fade-ended",this._tag,this._aiId)}}GetOutputVolume(){const ret=this._volume;return isFinite(ret)?ret:0}SetMuted(m){m=!!m;if(this._isMuted===m)return;this._isMuted=m;this._UpdateMuted()}IsMuted(){return this._isMuted}IsSilent(){return this._audioDomHandler.IsSilent()}_UpdateMuted(){}SetLooping(l){}IsLooping(){return this._isLooping}SetPlaybackRate(r){if(this._playbackRate=== +r)return;this._playbackRate=r;this._UpdatePlaybackRate()}_UpdatePlaybackRate(){}GetPlaybackRate(){return this._playbackRate}Seek(pos){}SetSuspended(s){}SetPannerEnabled(e){e=!!e;if(this._isPannerEnabled===e)return;this._isPannerEnabled=e;if(this._isPannerEnabled){this.SetStereoPannerEnabled(false);if(!this._pannerNode){this._pannerNode=this.GetAudioContext()["createPanner"]();this._pannerNode["panningModel"]=this._audioDomHandler.GetPanningModel();this._pannerNode["distanceModel"]=this._audioDomHandler.GetDistanceModel(); +this._pannerNode["refDistance"]=this._audioDomHandler.GetReferenceDistance();this._pannerNode["maxDistance"]=this._audioDomHandler.GetMaxDistance();this._pannerNode["rolloffFactor"]=this._audioDomHandler.GetRolloffFactor()}this._gainNode["disconnect"]();this._gainNode["connect"](this._pannerNode);this._pannerNode["connect"](this.GetDestinationNode())}else{this._pannerNode["disconnect"]();this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetPan(x,y,angle,innerAngle, +outerAngle,outerGain){if(!this._isPannerEnabled)return;this.SetPanXYA(x,y,angle);const toDegrees=self.AudioDOMHandler.ToDegrees;if(this._pannerConeParams[0]!==toDegrees(innerAngle)){this._pannerConeParams[0]=toDegrees(innerAngle);this._pannerNode["coneInnerAngle"]=toDegrees(innerAngle)}if(this._pannerConeParams[1]!==toDegrees(outerAngle)){this._pannerConeParams[1]=toDegrees(outerAngle);this._pannerNode["coneOuterAngle"]=toDegrees(outerAngle)}if(this._pannerConeParams[2]!==outerGain){this._pannerConeParams[2]= +outerGain;this._pannerNode["coneOuterGain"]=outerGain}}SetPanXYA(x,y,angle){if(!this._isPannerEnabled)return;const pos=this._pannerPosition;const orient=this._pannerOrientation;const cosa=Math.cos(angle);const sina=Math.sin(angle);if(pos[0]!==x||pos[1]!==y||pos[2]!==0){pos[0]=x;pos[1]=y;pos[2]=0;this._pannerNode["setPosition"](...pos)}if(orient[0]!==cosa||orient[1]!==sina||orient[2]!==0){orient[0]=cosa;orient[1]=sina;orient[2]=0;this._pannerNode["setOrientation"](...orient)}}SetStereoPannerEnabled(e){e= +!!e;if(this._isStereoPannerEnabled===e)return;this._isStereoPannerEnabled=e;if(this._isStereoPannerEnabled){this.SetPannerEnabled(false);this._stereoPannerNode=this.GetAudioContext()["createStereoPanner"]();this._gainNode["disconnect"]();this._gainNode["connect"](this._stereoPannerNode);this._stereoPannerNode["connect"](this.GetDestinationNode())}else{this._stereoPannerNode["disconnect"]();this._stereoPannerNode=null;this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetStereoPan(p){if(!this._isStereoPannerEnabled)return; +if(this._stereoPan===p)return;this._stereoPannerNode["pan"]["value"]=p;this._stereoPan=p}SetUID(uid){this._instUid=uid}GetUID(){return this._instUid}GetResumePosition(){}Reconnect(toNode){const outNode=this._stereoPannerNode||this._pannerNode||this._gainNode;outNode["disconnect"]();outNode["connect"](toNode)}GetState(){return{"aiid":this.GetAiId(),"tag":this._tag,"duration":this.GetDuration(),"volume":this._volume,"isPlaying":this.IsPlaying(),"playbackTime":this.GetPlaybackTime(),"playbackRate":this.GetPlaybackRate(), +"uid":this._instUid,"bufferOriginalUrl":this.GetOriginalUrl(),"bufferUrl":"","bufferType":this.GetContentType(),"isMusic":this.IsMusic(),"isLooping":this.IsLooping(),"isMuted":this.IsMuted(),"resumePosition":this.GetResumePosition(),"pan":this.GetPanState(),"stereoPan":this.GetStereoPanState()}}_LoadAdditionalState(d){this.SetPlaybackRate(d["playbackRate"]);this.SetMuted(d["isMuted"])}GetPanState(){if(!this._pannerNode)return null;const pn=this._pannerNode;return{"pos":this._pannerPosition,"orient":this._pannerOrientation, +"cia":pn["coneInnerAngle"],"coa":pn["coneOuterAngle"],"cog":pn["coneOuterGain"],"uid":this._instUid}}LoadPanState(d){if(!d){this.SetPannerEnabled(false);return}this.SetPannerEnabled(true);const pn=this._pannerNode;const panPos=d["pos"];this._pannerPosition[0]=panPos[0];this._pannerPosition[1]=panPos[1];this._pannerPosition[2]=panPos[2];const panOrient=d["orient"];this._pannerOrientation[0]=panOrient[0];this._pannerOrientation[1]=panOrient[1];this._pannerOrientation[2]=panOrient[2];pn["setPosition"](...this._pannerPosition); +pn["setOrientation"](...this._pannerOrientation);this._pannerConeParams[0]=d["cia"];this._pannerConeParams[1]=d["coa"];this._pannerConeParams[2]=d["cog"];pn["coneInnerAngle"]=d["cia"];pn["coneOuterAngle"]=d["coa"];pn["coneOuterGain"]=d["cog"];this._instUid=d["uid"]}GetStereoPanState(){if(this._stereoPannerNode)return this._stereoPan;else return null}LoadStereoPanState(p){if(typeof p!=="number"){this.SetStereoPannerEnabled(false);return}this.SetStereoPannerEnabled(true);this.SetStereoPan(p)}}}; +'use strict';{self.C3Html5AudioInstance=class C3Html5AudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tag){super(audioDomHandler,buffer,tag);this._buffer.GetOutputNode()["connect"](this._gainNode);this._buffer.onended=()=>this._OnEnded()}Release(){this.Stop();this._buffer.GetOutputNode()["disconnect"]();super.Release()}GetAudioElement(){return this._buffer.GetAudioElement()}_OnEnded(){this._isStopped=true;this._instUid=-1;this._audioDomHandler.PostTrigger("ended",this._tag, +this._aiId)}HasEnded(){return this.GetAudioElement()["ended"]}CanBeRecycled(){if(this._isStopped)return true;return this.HasEnded()}GetPlaybackTime(){let ret=this.GetAudioElement()["currentTime"];if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){const audioElem=this.GetAudioElement();if(audioElem.playbackRate!==1)audioElem.playbackRate=1;if(audioElem.loop!==isLooping)audioElem.loop=isLooping;this.SetVolume(vol);if(audioElem.muted)audioElem.muted= +false;if(audioElem.currentTime!==seekPos)try{audioElem.currentTime=seekPos}catch(err){console.warn(`[Construct] Exception seeking audio '${this._buffer.GetUrl()}' to position '${seekPos}': `,err)}this._audioDomHandler.TryPlayMedia(audioElem);this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1}Stop(){const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isStopped=true;this._isPaused= +false;this._instUid=-1}Pause(){if(this._isPaused||this._isStopped||this.HasEnded())return;const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isPaused=true}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._isPaused=false}_UpdateMuted(){this.GetAudioElement().muted=this._isMuted||this.IsSilent()}SetLooping(l){l=!!l;if(this._isLooping=== +l)return;this._isLooping=l;this.GetAudioElement().loop=l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();try{this.GetAudioElement()["playbackRate"]=r}catch(err){console.warn(`[Construct] Unable to set playback rate '${r}':`,err)}}Seek(pos){if(this._isStopped||this.HasEnded())return;try{this.GetAudioElement()["currentTime"]=pos}catch(err){console.warn(`[Construct] Error seeking audio to '${pos}': `,err)}}GetResumePosition(){return this.GetPlaybackTime()}SetSuspended(s){if(s)if(this.IsPlaying()){this.GetAudioElement()["pause"](); +this._resumeMe=true}else this._resumeMe=false;else if(this._resumeMe){this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._resumeMe=false}}}}; +'use strict';{self.C3WebAudioInstance=class C3WebAudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tag){super(audioDomHandler,buffer,tag);this._bufferSource=null;this._onended_handler=e=>this._OnEnded(e);this._hasPlaybackEnded=true;this._activeSource=null;this._playStartTime=0;this._playFromSeekPos=0;this._resumePosition=0;this._muteVol=1}Release(){this.Stop();this._ReleaseBufferSource();this._onended_handler=null;super.Release()}_ReleaseBufferSource(){if(this._bufferSource)this._bufferSource["disconnect"](); +this._bufferSource=null;this._activeSource=null}_OnEnded(e){if(this._isPaused||this._resumeMe)return;if(e.target!==this._activeSource)return;this._hasPlaybackEnded=true;this._isStopped=true;this._instUid=-1;this._ReleaseBufferSource();this._audioDomHandler.PostTrigger("ended",this._tag,this._aiId)}HasEnded(){if(!this._isStopped&&this._bufferSource&&this._bufferSource["loop"])return false;if(this._isPaused)return false;return this._hasPlaybackEnded}CanBeRecycled(){if(!this._bufferSource||this._isStopped)return true; +return this.HasEnded()}GetPlaybackTime(){let ret=0;if(this._isPaused)ret=this._resumePosition;else ret=this._playFromSeekPos+(this.GetCurrentTime()-this._playStartTime)*this._playbackRate;if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){this._muteVol=1;this.SetVolume(vol);this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode); +this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=isLooping;this._bufferSource["start"](scheduledTime,seekPos);this._hasPlaybackEnded=false;this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1;this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=seekPos}Stop(){if(this._bufferSource)try{this._bufferSource["stop"](0)}catch(err){}this._isStopped=true;this._isPaused=false;this._instUid=-1}Pause(){if(this._isPaused|| +this._isStopped||this.HasEnded())return;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%=this.GetDuration();this._isPaused=true;this._bufferSource["stop"](0)}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]= +this._onended_handler;this._bufferSource["loop"]=this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0,this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._isPaused=false}GetOutputVolume(){return super.GetOutputVolume()*this._muteVol}_UpdateMuted(){this._muteVol=this._isMuted||this.IsSilent()?0:1;this._UpdateVolume()}SetLooping(l){l=!!l;if(this._isLooping===l)return;this._isLooping=l;if(this._bufferSource)this._bufferSource["loop"]= +l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();if(this._bufferSource)this._bufferSource["playbackRate"]["value"]=r}Seek(pos){if(this._isStopped||this.HasEnded())return;if(this._isPaused)this._resumePosition=pos;else{this.Pause();this._resumePosition=pos;this.Resume()}}GetResumePosition(){return this._resumePosition}SetSuspended(s){if(s)if(this.IsPlaying()){this._resumeMe=true;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%= +this.GetDuration();this._bufferSource["stop"](0)}else this._resumeMe=false;else if(this._resumeMe){this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0, +this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._resumeMe=false}}_LoadAdditionalState(d){super._LoadAdditionalState(d);this._resumePosition=d["resumePosition"]}}}; +'use strict';{class AudioFXBase{constructor(audioDomHandler){this._audioDomHandler=audioDomHandler;this._audioContext=audioDomHandler.GetAudioContext();this._index=-1;this._tag="";this._type="";this._params=null}Release(){this._audioContext=null}_SetIndex(i){this._index=i}GetIndex(){return this._index}_SetTag(t){this._tag=t}GetTag(){return this._tag}CreateGain(){return this._audioContext["createGain"]()}GetInputNode(){}ConnectTo(node){}SetAudioParam(ap,value,ramp,time){ap["cancelScheduledValues"](0); +if(time===0){ap["value"]=value;return}const curTime=this._audioContext["currentTime"];time+=curTime;switch(ramp){case 0:ap["setValueAtTime"](value,time);break;case 1:ap["setValueAtTime"](ap["value"],curTime);ap["linearRampToValueAtTime"](value,time);break;case 2:ap["setValueAtTime"](ap["value"],curTime);ap["exponentialRampToValueAtTime"](value,time);break}}GetState(){return{"type":this._type,"tag":this._tag,"params":this._params}}}self.C3AudioFilterFX=class C3AudioFilterFX extends AudioFXBase{constructor(audioDomHandler, +type,freq,detune,q,gain,mix){super(audioDomHandler);this._type="filter";this._params=[type,freq,detune,q,gain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]=type;this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._filterNode["gain"]["vlaue"]= +gain;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value= +Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break;case 1:this._params[1]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[2]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[3]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 4:this._params[4]=value; +this.SetAudioParam(this._filterNode["gain"],value,ramp,time);break}}};self.C3AudioDelayFX=class C3AudioDelayFX extends AudioFXBase{constructor(audioDomHandler,delayTime,delayGain,mix){super(audioDomHandler);this._type="delay";this._params=[delayTime,delayGain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._mainNode=this.CreateGain();this._delayNode=this._audioContext["createDelay"](delayTime); +this._delayNode["delayTime"]["value"]=delayTime;this._delayGainNode=this.CreateGain();this._delayGainNode["gain"]["value"]=delayGain;this._inputNode["connect"](this._mainNode);this._inputNode["connect"](this._dryNode);this._mainNode["connect"](this._wetNode);this._mainNode["connect"](this._delayNode);this._delayNode["connect"](this._delayGainNode);this._delayGainNode["connect"](this._mainNode)}Release(){this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();this._mainNode["disconnect"](); +this._delayNode["disconnect"]();this._delayGainNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[2]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 4:this._params[1]=DbToLinear(value);this.SetAudioParam(this._delayGainNode["gain"],DbToLinear(value),ramp,time);break;case 5:this._params[0]=value;this.SetAudioParam(this._delayNode["delayTime"],value,ramp,time);break}}};self.C3AudioConvolveFX=class C3AudioConvolveFX extends AudioFXBase{constructor(audioDomHandler,buffer,normalize,mix){super(audioDomHandler);this._type="convolution";this._params=[normalize,mix];this._bufferOriginalUrl="";this._bufferUrl="";this._bufferType= +"";this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._convolveNode=this._audioContext["createConvolver"]();this._convolveNode["normalize"]=normalize;this._convolveNode["buffer"]=buffer;this._inputNode["connect"](this._convolveNode);this._inputNode["connect"](this._dryNode);this._convolveNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._convolveNode["disconnect"](); +this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break}}_SetBufferInfo(bufferOriginalUrl, +bufferUrl,bufferType){this._bufferOriginalUrl=bufferOriginalUrl;this._bufferUrl=bufferUrl;this._bufferType=bufferType}GetState(){const ret=super.GetState();ret["bufferOriginalUrl"]=this._bufferOriginalUrl;ret["bufferUrl"]="";ret["bufferType"]=this._bufferType;return ret}};self.C3AudioFlangerFX=class C3AudioFlangerFX extends AudioFXBase{constructor(audioDomHandler,delay,modulation,freq,feedback,mix){super(audioDomHandler);this._type="flanger";this._params=[delay,modulation,freq,feedback,mix];this._inputNode= +this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._feedbackNode=this.CreateGain();this._feedbackNode["gain"]["value"]=feedback;this._delayNode=this._audioContext["createDelay"](delay+modulation);this._delayNode["delayTime"]["value"]=delay;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]= +modulation;this._inputNode["connect"](this._delayNode);this._inputNode["connect"](this._dryNode);this._delayNode["connect"](this._wetNode);this._delayNode["connect"](this._feedbackNode);this._feedbackNode["connect"](this._delayNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._delayNode["delayTime"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._delayNode["disconnect"]();this._oscNode["disconnect"]();this._oscGainNode["disconnect"](); +this._dryNode["disconnect"]();this._wetNode["disconnect"]();this._feedbackNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[4]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 6:this._params[1]=value/1E3;this.SetAudioParam(this._oscGainNode["gain"],value/1E3,ramp,time);break;case 7:this._params[2]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break;case 8:this._params[3]=value/100;this.SetAudioParam(this._feedbackNode["gain"],value/100,ramp,time);break}}};self.C3AudioPhaserFX=class C3AudioPhaserFX extends AudioFXBase{constructor(audioDomHandler,freq,detune,q,modulation,modfreq,mix){super(audioDomHandler);this._type= +"phaser";this._params=[freq,detune,q,modulation,modfreq,mix];this._inputNode=this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]="allpass";this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._oscNode=this._audioContext["createOscillator"](); +this._oscNode["frequency"]["value"]=modfreq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]=modulation;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._filterNode["frequency"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._oscNode["disconnect"](); +this._oscGainNode["disconnect"]();this._dryNode["disconnect"]();this._wetNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 1:this._params[0]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[1]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[2]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 6:this._params[3]=value;this.SetAudioParam(this._oscGainNode["gain"],value,ramp,time);break;case 7:this._params[4]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp, +time);break}}};self.C3AudioGainFX=class C3AudioGainFX extends AudioFXBase{constructor(audioDomHandler,g){super(audioDomHandler);this._type="gain";this._params=[g];this._node=this.CreateGain();this._node["gain"]["value"]=g}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 4:this._params[0]=DbToLinear(value); +this.SetAudioParam(this._node["gain"],DbToLinear(value),ramp,time);break}}};self.C3AudioStereoPanFX=class C3AudioStereoPanFX extends AudioFXBase{constructor(audioDomHandler,p){super(audioDomHandler);this._type="stereopan";this._params=[p];this._node=this._audioContext["createStereoPanner"]();this._node["pan"]["value"]=p}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp, +time){value=Math.min(Math.max(value/100,-1),1);switch(param){case 9:this._params[0]=value;this.SetAudioParam(this._node["pan"],value,ramp,time);break}}};self.C3AudioTremoloFX=class C3AudioTremoloFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="tremolo";this._params=[freq,mix];this._node=this.CreateGain();this._node["gain"]["value"]=1-mix/2;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode= +this.CreateGain();this._oscGainNode["gain"]["value"]=mix/2;this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._node["gain"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"]();this._oscGainNode["disconnect"]();this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/ +100,1),0);this._params[1]=value;this.SetAudioParam(this._node["gain"],1-value/2,ramp,time);this.SetAudioParam(this._oscGainNode["gain"],value/2,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioRingModFX=class C3AudioRingModFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="ringmod";this._params=[freq,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]= +mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._ringNode=this.CreateGain();this._ringNode["gain"]["value"]=0;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscNode["connect"](this._ringNode["gain"]);this._oscNode["start"](0);this._inputNode["connect"](this._ringNode);this._inputNode["connect"](this._dryNode);this._ringNode["connect"](this._wetNode)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"](); +this._ringNode["disconnect"]();this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioDistortionFX=class C3AudioDistortionFX extends AudioFXBase{constructor(audioDomHandler,threshold,headroom,drive,makeupgain,mix){super(audioDomHandler);this._type="distortion";this._params=[threshold,headroom,drive,makeupgain,mix];this._inputNode=this.CreateGain();this._preGain=this.CreateGain();this._postGain=this.CreateGain();this._SetDrive(drive,makeupgain);this._wetNode= +this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._waveShaper=this._audioContext["createWaveShaper"]();this._curve=new Float32Array(65536);this._GenerateColortouchCurve(threshold,headroom);this._waveShaper.curve=this._curve;this._inputNode["connect"](this._preGain);this._inputNode["connect"](this._dryNode);this._preGain["connect"](this._waveShaper);this._waveShaper["connect"](this._postGain);this._postGain["connect"](this._wetNode)}Release(){this._inputNode["disconnect"](); +this._preGain["disconnect"]();this._waveShaper["disconnect"]();this._postGain["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}_SetDrive(drive,makeupgain){if(drive<.01)drive=.01;this._preGain["gain"]["value"]=drive;this._postGain["gain"]["value"]=Math.pow(1/drive,.6)*makeupgain}_GenerateColortouchCurve(threshold,headroom){const n=65536;const n2=n/2;for(let i=0;ithis._OnChangeCursorStyle(e)],["request-pointer-lock",()=>this._OnRequestPointerLock()],["release-pointer-lock",()=>this._OnReleasePointerLock()]]);document.addEventListener("pointerlockchange",e=>this._OnPointerLockChange());document.addEventListener("pointerlockerror",e=>this._OnPointerLockError())}_OnChangeCursorStyle(e){document.documentElement.style.cursor= +e}_OnRequestPointerLock(){this._iRuntime.GetCanvas().requestPointerLock()}_OnReleasePointerLock(){document.exitPointerLock()}_OnPointerLockChange(){this.PostToRuntime("pointer-lock-change",{"has-pointer-lock":!!document.pointerLockElement})}_OnPointerLockError(){this.PostToRuntime("pointer-lock-error",{"has-pointer-lock":!!document.pointerLockElement})}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{const DOM_COMPONENT_ID="touch";const HANDLER_CLASS=class TouchDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this.AddRuntimeMessageHandler("request-permission",e=>this._OnRequestPermission(e))}async _OnRequestPermission(e){const type=e["type"];let result=true;if(type===0)result=await this._RequestOrientationPermission();else if(type===1)result=await this._RequestMotionPermission();this.PostToRuntime("permission-result",{"type":type,"result":result})}async _RequestOrientationPermission(){if(!self["DeviceOrientationEvent"]|| +!self["DeviceOrientationEvent"]["requestPermission"])return true;try{const state=await self["DeviceOrientationEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request orientation permission: ",err);return false}}async _RequestMotionPermission(){if(!self["DeviceMotionEvent"]||!self["DeviceMotionEvent"]["requestPermission"])return true;try{const state=await self["DeviceMotionEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request motion permission: ", +err);return false}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{function elemsForSelector(selector,isAll){if(!selector)return[document.documentElement];else if(isAll)return Array.from(document.querySelectorAll(selector));else{const e=document.querySelector(selector);return e?[e]:[]}}function noop(){}const DOM_COMPONENT_ID="browser";const HANDLER_CLASS=class BrowserDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._exportType="";this.AddRuntimeMessageHandlers([["get-initial-state",e=>this._OnGetInitialState(e)], +["ready-for-sw-messages",()=>this._OnReadyForSWMessages()],["alert",e=>this._OnAlert(e)],["close",()=>this._OnClose()],["set-focus",e=>this._OnSetFocus(e)],["vibrate",e=>this._OnVibrate(e)],["lock-orientation",e=>this._OnLockOrientation(e)],["unlock-orientation",()=>this._OnUnlockOrientation()],["navigate",e=>this._OnNavigate(e)],["request-fullscreen",e=>this._OnRequestFullscreen(e)],["exit-fullscreen",()=>this._OnExitFullscreen()],["set-hash",e=>this._OnSetHash(e)],["set-document-css-style",e=>this._OnSetDocumentCSSStyle(e)], +["get-document-css-style",e=>this._OnGetDocumentCSSStyle(e)]]);window.addEventListener("online",()=>this._OnOnlineStateChanged(true));window.addEventListener("offline",()=>this._OnOnlineStateChanged(false));window.addEventListener("hashchange",()=>this._OnHashChange());document.addEventListener("backbutton",()=>this._OnCordovaBackButton())}_OnGetInitialState(e){this._exportType=e["exportType"];return{"location":location.toString(),"isOnline":!!navigator.onLine,"referrer":document.referrer,"title":document.title, +"isCookieEnabled":!!navigator.cookieEnabled,"screenWidth":screen.width,"screenHeight":screen.height,"windowOuterWidth":window.outerWidth,"windowOuterHeight":window.outerHeight,"isConstructArcade":typeof window["is_scirra_arcade"]!=="undefined"}}_OnReadyForSWMessages(){if(!window["C3_RegisterSW"]||!window["OfflineClientInfo"])return;window["OfflineClientInfo"]["SetMessageCallback"](e=>this.PostToRuntime("sw-message",e["data"]))}_OnOnlineStateChanged(isOnline){this.PostToRuntime("online-state",{"isOnline":isOnline})}_OnCordovaBackButton(){this.PostToRuntime("backbutton")}GetNWjsWindow(){if(this._exportType=== +"nwjs")return nw["Window"]["get"]();else return null}_OnAlert(e){alert(e["message"])}_OnClose(){if(navigator["app"]&&navigator["app"]["exitApp"])navigator["app"]["exitApp"]();else if(navigator["device"]&&navigator["device"]["exitApp"])navigator["device"]["exitApp"]();else window.close()}_OnSetFocus(e){const isFocus=e["isFocus"];if(this._exportType==="nwjs"){const win=this.GetNWjsWindow();if(isFocus)win["focus"]();else win["blur"]()}else if(isFocus)window.focus();else window.blur()}_OnVibrate(e){if(navigator["vibrate"])navigator["vibrate"](e["pattern"])}_OnLockOrientation(e){const orientation= +e["orientation"];if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=>console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result=screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result= +screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ",err)}}_OnUnlockOrientation(){try{if(screen["orientation"]&&screen["orientation"]["unlock"])screen["orientation"]["unlock"]();else if(screen["unlockOrientation"])screen["unlockOrientation"]();else if(screen["webkitUnlockOrientation"])screen["webkitUnlockOrientation"]();else if(screen["mozUnlockOrientation"])screen["mozUnlockOrientation"](); +else if(screen["msUnlockOrientation"])screen["msUnlockOrientation"]()}catch(err){}}_OnNavigate(e){const type=e["type"];if(type==="back")if(navigator["app"]&&navigator["app"]["backHistory"])navigator["app"]["backHistory"]();else window.history.back();else if(type==="forward")window.history.forward();else if(type==="reload")location.reload();else if(type==="url"){const url=e["url"];const target=e["target"];const exportType=e["exportType"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url, +"_system");else if(exportType==="preview"||exportType==="windows-webview2")window.open(url,"_blank");else if(!this._isConstructArcade)if(target===2)window.top.location=url;else if(target===1)window.parent.location=url;else window.location=url}else if(type==="new-window"){const url=e["url"];const tag=e["tag"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url,"_system");else window.open(url,tag)}}_OnRequestFullscreen(e){if(this._exportType==="windows-webview2"|| +this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen","fullscreen":true})}else{const opts={"navigationUI":"auto"};const navUI=e["navUI"];if(navUI===1)opts["navigationUI"]="hide";else if(navUI===2)opts["navigationUI"]="show";const elem=document.documentElement;let ret;if(elem["requestFullscreen"])ret=elem["requestFullscreen"](opts);else if(elem["mozRequestFullScreen"])ret=elem["mozRequestFullScreen"](opts); +else if(elem["msRequestFullscreen"])ret=elem["msRequestFullscreen"](opts);else if(elem["webkitRequestFullScreen"])if(typeof Element["ALLOW_KEYBOARD_INPUT"]!=="undefined")ret=elem["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]);else ret=elem["webkitRequestFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnExitFullscreen(){if(this._exportType==="windows-webview2"||this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen", +"fullscreen":false})}else{let ret;if(document["exitFullscreen"])ret=document["exitFullscreen"]();else if(document["mozCancelFullScreen"])ret=document["mozCancelFullScreen"]();else if(document["msExitFullscreen"])ret=document["msExitFullscreen"]();else if(document["webkitCancelFullScreen"])ret=document["webkitCancelFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnSetHash(e){location.hash=e["hash"]}_OnHashChange(){this.PostToRuntime("hashchange",{"location":location.toString()})}_OnSetDocumentCSSStyle(e){const prop= +e["prop"];const value=e["value"];const selector=e["selector"];const isAll=e["is-all"];try{const arr=elemsForSelector(selector,isAll);for(const e of arr)if(prop.startsWith("--"))e.style.setProperty(prop,value);else e.style[prop]=value}catch(err){console.warn("[Browser] Failed to set style: ",err)}}_OnGetDocumentCSSStyle(e){const prop=e["prop"];const selector=e["selector"];try{const elem=document.querySelector(selector);if(elem){const computedStyle=window.getComputedStyle(elem);return{"isOk":true,"result":computedStyle.getPropertyValue(prop)}}else return{"isOk":false}}catch(err){console.warn("[Browser] Failed to get style: ", +err);return{"isOk":false}}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; diff --git a/boxingrandom/scripts/offlineclient.js b/boxingrandom/scripts/offlineclient.js new file mode 100644 index 00000000..8a6145d1 --- /dev/null +++ b/boxingrandom/scripts/offlineclient.js @@ -0,0 +1,2 @@ +'use strict';{class OfflineClient{constructor(){this._broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel("offline");this._queuedMessages=[];this._onMessageCallback=null;if(this._broadcastChannel)this._broadcastChannel.onmessage=e=>this._OnBroadcastChannelMessage(e)}_OnBroadcastChannelMessage(e){if(this._onMessageCallback){this._onMessageCallback(e);return}this._queuedMessages.push(e)}SetMessageCallback(f){this._onMessageCallback=f;for(let e of this._queuedMessages)this._onMessageCallback(e); +this._queuedMessages.length=0}}window.OfflineClientInfo=new OfflineClient}; diff --git a/boxingrandom/scripts/project/scriptsInEvents.js b/boxingrandom/scripts/project/scriptsInEvents.js new file mode 100644 index 00000000..5969165a --- /dev/null +++ b/boxingrandom/scripts/project/scriptsInEvents.js @@ -0,0 +1,16 @@ + + + +const scriptsInEvents = { + + async ["Gamemonitize-Js_Event1_Act1"](runtime, localVars) + { + if (typeof sdk !== 'undefined' && sdk.showBanner !== 'undefined') { + sdk.showBanner(); + } + } + +}; + +self.C3.ScriptsInEvents = scriptsInEvents; + diff --git a/boxingrandom/scripts/register-sw.js b/boxingrandom/scripts/register-sw.js new file mode 100644 index 00000000..f152b5ff --- /dev/null +++ b/boxingrandom/scripts/register-sw.js @@ -0,0 +1 @@ +'use strict';{window.C3_RegisterSW=async function C3_RegisterSW(){if(!navigator.serviceWorker)return;try{const reg=await navigator.serviceWorker.register("sw.js",{scope:"./"});console.info("Registered service worker on "+reg.scope)}catch(err){console.warn("Failed to register service worker: ",err)}}}; diff --git a/boxingrandom/scripts/supportcheck.js b/boxingrandom/scripts/supportcheck.js new file mode 100644 index 00000000..886cbc95 --- /dev/null +++ b/boxingrandom/scripts/supportcheck.js @@ -0,0 +1,5 @@ +'use strict';(function(){var isKasperskyScriptInjected=!!document.querySelector('script[src*="kaspersky"]');var tmpCanvas=document.createElement("canvas");var hasWebGL=!!tmpCanvas.getContext("webgl");var missingFeatures=[];if(!hasWebGL)missingFeatures.push("WebGL");if(typeof WebAssembly==="undefined")missingFeatures.push("WebAssembly");if(!("noModule"in HTMLScriptElement.prototype))missingFeatures.push("JavaScript Modules");if(missingFeatures.length===0&&!isKasperskyScriptInjected)window["C3_IsSupported"]= +true;else{var msgWrap=document.createElement("div");msgWrap.id="notSupportedWrap";document.body.appendChild(msgWrap);var msgTitle=document.createElement("h2");msgTitle.id="notSupportedTitle";if(isKasperskyScriptInjected)msgTitle.textContent="Kaspersky Internet Security broke this export";else msgTitle.textContent="Software update needed";msgWrap.appendChild(msgTitle);var msgBody=document.createElement("p");msgBody.className="notSupportedMessage";var msgText="This content is not supported because your device's software appears to be out-of-date. "; +var ua=navigator.userAgent;if(/android/i.test(ua))msgText+='

On Android, fix this by making sure the
Android System Webview app has updates enabled and is up-to-date.';else if(/iphone|ipad|ipod/i.test(ua)){msgText+="Alternatively if Lockdown mode is enabled, try turning it off to view this content.";msgText+="

Note: using the iOS simulator requires Xcode 12+. Otherwise try testing on a real device instead."}else if(/msie/i.test(ua)|| +/trident/i.test(ua)||/edge\//i.test(ua))msgText+="

Note: Internet Explorer and the legacy Edge browser are not supported. Try using Chrome or Firefox instead.";else if(isKasperskyScriptInjected)msgText="It appears a script was added to this export by Kaspersky software. This prevents the exported project from working. Try disabling Kaspersky and exporting again.";else msgText+= +"Try installing any available software updates. Alternatively try on a different device.";msgText+="

Missing features: "+missingFeatures.join(", ")+"
User agent: "+navigator.userAgent+"
";msgBody.innerHTML=msgText;msgWrap.appendChild(msgBody)}})(); diff --git a/boxingrandom/style.css b/boxingrandom/style.css new file mode 100644 index 00000000..a2b79828 --- /dev/null +++ b/boxingrandom/style.css @@ -0,0 +1,64 @@ +html, body { + padding: 0; + margin: 0; + overflow: hidden; + + background: #000000; + color: white; +} + +html, body, canvas { + touch-action: none; + touch-action-delay: none; +} + +#notSupportedWrap { + margin: 2em auto 1em auto; + width: 75%; + max-width: 45em; + border: 2px solid #aaa; + border-radius: 1em; + padding: 2em; + background-color: #f0f0f0; + font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; + color: black; +} + +#notSupportedTitle { + font-size: 1.8em; +} + +.notSupportedMessage { + font-size: 1.2em; +} + +.notSupportedMessage em { + color: #888; +} + +/* bbcode styles */ +.bbCodeH1 { + font-size: 2em; + font-weight: bold; +} + +.bbCodeH2 { + font-size: 1.5em; + font-weight: bold; +} + +.bbCodeH3 { + font-size: 1.25em; + font-weight: bold; +} + +.bbCodeH4 { + font-size: 1.1em; + font-weight: bold; +} + +.bbCodeItem::before { + content: " • "; +} + + diff --git a/boxingrandom/sw.js b/boxingrandom/sw.js new file mode 100644 index 00000000..f50e1731 --- /dev/null +++ b/boxingrandom/sw.js @@ -0,0 +1,15 @@ +'use strict';const OFFLINE_DATA_FILE="offline.json";const CACHE_NAME_PREFIX="c3offline";const BROADCASTCHANNEL_NAME="offline";const CONSOLE_PREFIX="[SW] ";const LAZYLOAD_KEYNAME="";const broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel(BROADCASTCHANNEL_NAME);function PostBroadcastMessage(o){if(!broadcastChannel)return;setTimeout(()=>broadcastChannel.postMessage(o),3E3)}function Broadcast(type){PostBroadcastMessage({"type":type})} +function BroadcastDownloadingUpdate(version){PostBroadcastMessage({"type":"downloading-update","version":version})}function BroadcastUpdateReady(version){PostBroadcastMessage({"type":"update-ready","version":version})}function IsUrlInLazyLoadList(url,lazyLoadList){if(!lazyLoadList)return false;try{for(const lazyLoadRegex of lazyLoadList)if((new RegExp(lazyLoadRegex)).test(url))return true}catch(err){console.error(CONSOLE_PREFIX+"Error matching in lazy-load list: ",err)}return false} +function WriteLazyLoadListToStorage(lazyLoadList){if(typeof localforage==="undefined")return Promise.resolve();else return localforage.setItem(LAZYLOAD_KEYNAME,lazyLoadList)}function ReadLazyLoadListFromStorage(){if(typeof localforage==="undefined")return Promise.resolve([]);else return localforage.getItem(LAZYLOAD_KEYNAME)}function GetCacheBaseName(){return CACHE_NAME_PREFIX+"-"+self.registration.scope}function GetCacheVersionName(version){return GetCacheBaseName()+"-v"+version} +async function GetAvailableCacheNames(){const cacheNames=await caches.keys();const cacheBaseName=GetCacheBaseName();return cacheNames.filter(n=>n.startsWith(cacheBaseName))}async function IsUpdatePending(){const availableCacheNames=await GetAvailableCacheNames();return availableCacheNames.length>=2} +async function GetMainPageUrl(){const allClients=await clients.matchAll({includeUncontrolled:true,type:"window"});for(const c of allClients){let url=c.url;if(url.startsWith(self.registration.scope))url=url.substring(self.registration.scope.length);if(url&&url!=="/"){if(url.startsWith("?"))url="/"+url;return url}}return""} +function fetchWithBypass(request,bypassCache){if(typeof request==="string")request=new Request(request);if(bypassCache)return fetch(request.url,{headers:request.headers,mode:request.mode,credentials:request.credentials,redirect:request.redirect,cache:"no-store"});else return fetch(request)} +async function CreateCacheFromFileList(cacheName,fileList,bypassCache){const responses=await Promise.all(fileList.map(url=>fetchWithBypass(url,bypassCache)));let allOk=true;for(const response of responses)if(!response.ok){allOk=false;console.error(CONSOLE_PREFIX+"Error fetching '"+response.url+"' ("+response.status+" "+response.statusText+")")}if(!allOk)throw new Error("not all resources were fetched successfully");const cache=await caches.open(cacheName);try{return await Promise.all(responses.map((response, +i)=>cache.put(fileList[i],response)))}catch(err){console.error(CONSOLE_PREFIX+"Error writing cache entries: ",err);caches.delete(cacheName);throw err;}} +async function UpdateCheck(isFirst){try{const response=await fetchWithBypass(OFFLINE_DATA_FILE,true);if(!response.ok)throw new Error(OFFLINE_DATA_FILE+" responded with "+response.status+" "+response.statusText);const data=await response.json();const version=data.version;const fileList=data.fileList;const lazyLoadList=data.lazyLoad;const currentCacheName=GetCacheVersionName(version);const cacheExists=await caches.has(currentCacheName);if(cacheExists){const isUpdatePending=await IsUpdatePending();if(isUpdatePending){console.log(CONSOLE_PREFIX+ +"Update pending");Broadcast("update-pending")}else{console.log(CONSOLE_PREFIX+"Up to date");Broadcast("up-to-date")}return}const mainPageUrl=await GetMainPageUrl();fileList.unshift("./");if(mainPageUrl&&fileList.indexOf(mainPageUrl)===-1)fileList.unshift(mainPageUrl);console.log(CONSOLE_PREFIX+"Caching "+fileList.length+" files for offline use");if(isFirst)Broadcast("downloading");else BroadcastDownloadingUpdate(version);if(lazyLoadList)await WriteLazyLoadListToStorage(lazyLoadList);await CreateCacheFromFileList(currentCacheName, +fileList,!isFirst);const isUpdatePending=await IsUpdatePending();if(isUpdatePending){console.log(CONSOLE_PREFIX+"All resources saved, update ready");BroadcastUpdateReady(version)}else{console.log(CONSOLE_PREFIX+"All resources saved, offline support ready");Broadcast("offline-ready")}}catch(err){console.warn(CONSOLE_PREFIX+"Update check failed: ",err)}}self.addEventListener("install",event=>{event.waitUntil(UpdateCheck(true).catch(()=>null))}); +async function GetCacheNameToUse(availableCacheNames,doUpdateCheck){if(availableCacheNames.length===1||!doUpdateCheck)return availableCacheNames[0];const allClients=await clients.matchAll();if(allClients.length>1)return availableCacheNames[0];const latestCacheName=availableCacheNames[availableCacheNames.length-1];console.log(CONSOLE_PREFIX+"Updating to new version");await Promise.all(availableCacheNames.slice(0,-1).map(c=>caches.delete(c)));return latestCacheName} +async function HandleFetch(event,doUpdateCheck){const availableCacheNames=await GetAvailableCacheNames();if(!availableCacheNames.length)return fetch(event.request);const useCacheName=await GetCacheNameToUse(availableCacheNames,doUpdateCheck);const cache=await caches.open(useCacheName);const cachedResponse=await cache.match(event.request);if(cachedResponse)return cachedResponse;const result=await Promise.all([fetch(event.request),ReadLazyLoadListFromStorage()]);const fetchResponse=result[0];const lazyLoadList= +result[1];if(IsUrlInLazyLoadList(event.request.url,lazyLoadList))try{await cache.put(event.request,fetchResponse.clone())}catch(err){console.warn(CONSOLE_PREFIX+"Error caching '"+event.request.url+"': ",err)}return fetchResponse} +self.addEventListener("fetch",event=>{if((new URL(event.request.url)).origin!==location.origin)return;const doUpdateCheck=event.request.mode==="navigate";const responsePromise=HandleFetch(event,doUpdateCheck);if(doUpdateCheck)event.waitUntil(responsePromise.then(()=>UpdateCheck(false)));event.respondWith(responsePromise)}); diff --git a/commodoreclicker/LICENSE b/commodoreclicker/LICENSE new file mode 100644 index 00000000..e4ae0356 --- /dev/null +++ b/commodoreclicker/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Two9A + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/commodoreclicker/README.md b/commodoreclicker/README.md new file mode 100644 index 00000000..b19443aa --- /dev/null +++ b/commodoreclicker/README.md @@ -0,0 +1,49 @@ +Commodore Clicker +================= + +A JavaScript incremental game which drives the clock of a Commodore 64 emulation. Or at least, that's the eventual goal. +[Play the game here.](http://c64clicker.com/) + +Usage +----- + +The emulated C64 boots into the incremental game, but this can be interrupted in the usual manner of hitting Run/Stop + Restore. After interruption, the game can be restarted using the statement: SYS 49152 + +A joystick is plugged into port 2 of the C64, and its directions are mapped to the arrow keys. The joystick is used in-game to allow movement of the sprite. Alt is the Fire key, but this is not used in-game at this time. + +The keyboard corresponds to that of a British C64, and is mapped in similar fashion to VICE's mapping. The following keys are non-obvious mappings: + +* F1, F2, F3, F4 are mapped to the C64's F1, F3, F5, F7. Shift-F1 is the C64's F2, and so on. +* Escape is Run/Stop; F8 is Restore. +* Tab is the C64's Control; the host's Control maps to the Commodore key. + +Key map entries not mentioned here are documented in the CIA emulation. + +Credits +------- + +Libraries included: + +* [BigInteger, by Matthew Crumley and John Tobey](http://silentmatt.com/biginteger/) +* [jQuery.PowerTip, by Steven Benner](http://stevenbenner.github.com/jquery-powertip/) +* [Require.js, by the Dojo Foundation](http://github.com/jrburke/requirejs) +* [jQuery-Ajax-Blob-ArrayBuffer, by Christopher Keefer](https://gist.github.com/SaneMethod/7548768) +* [JSZip, by Stuart Knightley](https://github.com/Stuk/jszip) +* And, of course, jQuery. + +Test ROMs included: + +* [Klaus Dormann's 6502 functional tests](https://github.com/redline6561/cl-6502/blob/b0087903/tests/6502_functional_test.a65) + +Resources that have been infinitely useful: + +* [The C64 memory map](http://sta.c64.org/cbm64mem.html) +* [The VIC-II For Beginners series, by actraiser, 2013](http://dustlayer.com/vic-ii/2013/4/22/when-visibility-matters) +* ["The MOS 6567/6569 video controller and its application in the Commodore 64", by Christian Bauer, 1996](http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt) +* ["Documentation for the NMOS 65xx instruction set", by John West and Marko Makela, 1994](http://www.zimmers.net/anonftp/pub/cbm/documents/chipdata/64doc) +* [6502 opcode matrix, by Graham/Oxyron, 2012](http://www.oxyron.de/html/opcodes02.html) +* [Opcode pseudocode from VICE, compiled at Nesdev](http://nesdev.com/6502.txt) +* ["Internals of BRK/IRQ/NMI/RESET on a MOS 6502", by Michael Steil, 2010](http://www.pagetable.com/?p=410) +* [CIA register map, on the C64 Wiki](http://www.c64-wiki.com/index.php/CIA) +* [Kernal/BASIC disassembly, by Marko Makela, 1994](http://www.ffd2.com/fridge/docs/c64-diss.html) +* ["How the VIC/64 Serial Bus Works", by Jim Butterfield, 1983](ftp://ftp.zimmers.net/pub/cbm/programming/serial-bus.pdf) diff --git a/commodoreclicker/css/index.css b/commodoreclicker/css/index.css new file mode 100644 index 00000000..8e2fb1b3 --- /dev/null +++ b/commodoreclicker/css/index.css @@ -0,0 +1,321 @@ +* { + margin: 0; + padding: 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; +} + +body { + background: black; + color: white; + font-family: Arial, sans-serif; +} + +.head { + margin: 15px 0; +} + +.head h1 { + margin: 0 auto; + width: 776px; + height: 90px; + background: url(/img/cclicker.png) no-repeat top left; + text-indent: -9999px; + font-size: 1px; +} + +.head h1 a { + text-decoration: none; + text-indent: -9999px; + display: block; + width: 776px; + height: 90px; +} + +#about { + display: none; +} + +.content { + clear: both; + margin: 0 auto; + width: 840px; +} + +.screen { + width: 504px; + padding-top: 36px; + position: relative; +} + +#screen { + width: 504px; + height: 312px; + padding: 1px; + border: 5px solid #c8ad7f; + border-radius: 5px 5px 5px 5px; +} + +.status { + list-style: none inside; + margin: 10px 0; + color: #bbb; +} + +.status span { + font-weight: bold; +} + +.cursor_x { + height: 8px; + width: 1px; + position: absolute; + top: 28px; + left: 6px; + background: #c8ad7f; +} + +.cursor_y { + width: 8px; + height: 1px; + position: absolute; + top: 42px; + left: -8px; + background: #c8ad7f; +} + +.sidebar { + float: right; + width: 320px; +} + +.topbar { + width: 840px; + margin: 0 auto; +} + +.joystick { + float: right; + width: 100px; + height: 100px; + position: relative; + margin-top: 10px; +} +.joystick.hidden { + display: none; +} + +.joystick .active { + background: #c8ad7f; + color: black; + font-weight: bold; +} + +#joy_left, #joy_right { + position: absolute; + top: 35px; + height: 20px; + padding: 5px; + line-height: 20px; + border: 2px solid #c8ad7f; + border-radius: 5px 5px 5px 5px; +} + +#joy_left { + left: 0; + width: 55px; + border-right: 0; +} +#joy_right { + right: 0; + width: 53px; + text-align: right; + border-left: 0; +} + +#joy_up, #joy_down { + position: absolute; + left: 35px; + width: 20px; + padding: 5px; + text-align: center; + border: 2px solid #c8ad7f; + border-radius: 5px 5px 5px 5px; +} + +#joy_up { + top: 0; + border-bottom: 0; + height: 55px; +} +#joy_down { + bottom: 0; + height: 53px; + line-height: 90px; + border-top: 0; +} + +#joy_fire { + display: none; +} + +#bank { + text-align: center; + font-size: 30px; +} + +#cps { + text-align: center; + font-size: 22px; + margin: 8px 0; +} + +#click { + text-align: center; + font-size: 26px; + width: 250px; + background: #5d594f; + border-radius: 13px 13px 13px 13px; + margin: 10px 360px 10px 230px; + padding: 12px; + cursor: pointer; +} +.joystick.hidden ~ #click { + margin: 10px auto; +} + +#reset { + cursor: pointer; + text-decoration: underline; +} + +.tabs { + list-style: none inside; + padding-top: 10px; +} + +.tabs li { + background: #5d594f; + color: white; + padding: 8px; + border-radius: 8px 8px 0 0; + display: inline; + cursor: pointer; +} + +.tabs li.active { + background: #c8ad7f; + color: black; +} + +.itemlists { + border: 5px solid #c8ad7f; + border-radius: 0 0 5px 5px; + padding: 5px; + margin-top: 7px; + height: 305px; + overflow: auto; +} + +.itemlists ul { + list-style: none inside; +} + +.itemlists li { + background: #444; + border: 5px solid #5d594f; + border-radius: 8px 8px 8px 8px; + color: #999; + padding: 8px; + margin: 8px; + cursor: pointer; + display: none; +} + +.itemlists li.active { + display: block; +} + +.itemlists li.available { + background: #bbb; + border-color: #c8ad7f; + color: #000; +} + +.itemlists li span { + display: block; +} + +.foot { + clear: both; + text-align: center; + padding-top: 2em; + color: #bbb; +} + +a { + color: #ddd; +} + +p { + margin-bottom: 1em; +} + +body.quarterscreen .content { + width: 966px; +} +body.quarterscreen .screen { + width: 630px; +} +body.quarterscreen #screen { + width: 630px; + height: 390px; +} +body.quarterscreen .itemlists { + height: 383px; +} +body.quarterscreen .disk { + width: 622px; +} + +.disk { + width: 496px; + border: 5px solid #c8ad7f; + border-radius: 5px 5px 5px 5px; + padding: 5px; + line-height: 25px; +} +.disk.hidden { + display: none; +} +.disk .disk_drive { + font-weight: bold; + float: left; + padding-bottom: 4px; +} +.disk #disk_files { + margin-left: 10px; +} +.disk #disk_power { + width: 20px; + height: 25px; + background: #300; + float: right; +} +.disk #disk_power.disk_on { + background: #c33; +} +.disk .disk_bar { + clear: both; + height: 25px; + width: 100%; + border: 1px solid #c8ad7f; +} +.disk #disk_progress { + background: #c8ad7f; + display: block; + height: 25px; +} diff --git a/commodoreclicker/css/jquery.powertip-yellow.css b/commodoreclicker/css/jquery.powertip-yellow.css new file mode 100644 index 00000000..ffa32540 --- /dev/null +++ b/commodoreclicker/css/jquery.powertip-yellow.css @@ -0,0 +1,96 @@ +/* PowerTip Plugin */ +#powerTip { + cursor: default; + background-color: #ffffb4; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 2px 1px rgba(255, 255, 255, 0.8) inset, 0 -2px 2px #fafa6e inset; + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 2px 1px rgba(255, 255, 255, 0.8) inset, 0 -2px 2px #fafa6e inset; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 2px 1px rgba(255, 255, 255, 0.8) inset, 0 -2px 2px #fafa6e inset; + border: 1px solid #fafa50; + border-radius: 6px; + color: #000000; + display: none; + padding: 10px; + position: absolute; + max-width: 90%; + z-index: 2147483647; +} +#powerTip:before { + content: ""; + position: absolute; +} +#powerTip.n:before, #powerTip.s:before { + border-right: 5px solid transparent; + border-left: 5px solid transparent; + left: 50%; + margin-left: -5px; +} +#powerTip.e:before, #powerTip.w:before { + border-bottom: 5px solid transparent; + border-top: 5px solid transparent; + margin-top: -5px; + top: 50%; +} +#powerTip.n:before { + border-top: 10px solid #fafa50; + border-top: 10px solid rgba(250, 250, 80, 0.8); + bottom: -10px; +} +#powerTip.e:before { + border-right: 10px solid #fafa50; + border-right: 10px solid rgba(250, 250, 80, 0.8); + left: -10px; +} +#powerTip.s:before { + border-bottom: 10px solid #fafa50; + border-bottom: 10px solid rgba(250, 250, 80, 0.8); + top: -10px; +} +#powerTip.w:before { + border-left: 10px solid #fafa50; + border-left: 10px solid rgba(250, 250, 80, 0.8); + right: -10px; +} +#powerTip.ne:before, #powerTip.se:before { + border-right: 10px solid transparent; + border-left: 0; + left: 10px; +} +#powerTip.nw:before, #powerTip.sw:before { + border-left: 10px solid transparent; + border-right: 0; + right: 10px; +} +#powerTip.ne:before, #powerTip.nw:before { + border-top: 10px solid #fafa50; + border-top: 10px solid rgba(250, 250, 80, 0.8); + bottom: -10px; +} +#powerTip.se:before, #powerTip.sw:before { + border-bottom: 10px solid #fafa50; + border-bottom: 10px solid rgba(250, 250, 80, 0.8); + top: -10px; +} +#powerTip.nw-alt:before, #powerTip.ne-alt:before, +#powerTip.sw-alt:before, #powerTip.se-alt:before { + border-top: 10px solid #fafa50; + border-top: 10px solid rgba(250, 250, 80, 0.8); + bottom: -10px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + left: 10px; +} +#powerTip.ne-alt:before { + left: auto; + right: 10px; +} +#powerTip.sw-alt:before, #powerTip.se-alt:before { + border-top: none; + border-bottom: 10px solid #fafa50; + border-bottom: 10px solid rgba(250, 250, 80, 0.8); + bottom: auto; + top: -10px; +} +#powerTip.se-alt:before { + left: auto; + right: 10px; +} diff --git a/commodoreclicker/img/cclicker.png b/commodoreclicker/img/cclicker.png new file mode 100644 index 00000000..a086694d Binary files /dev/null and b/commodoreclicker/img/cclicker.png differ diff --git a/commodoreclicker/index.html b/commodoreclicker/index.html new file mode 100644 index 00000000..86eaf9e2 --- /dev/null +++ b/commodoreclicker/index.html @@ -0,0 +1,71 @@ + + + + Commodore Clicker + + + + + + +
+

Commodore Clicker

+
+

Render the screen of a Commodore 64 pixel by pixel, and unleash the graphical prowess of the greatest computer of the 80s!

+

Purchase oscillators to kick-start the computer's clock, using the pixels you've built up; buy upgrades to power up your clicking, and to start special graphical effects.

+ This is not a full simulation of a C64. Not yet, anyways. +
+
+
+
+
U
+
L
+
R
+
D
+
Fire
+
+
 
+
 
+
Reticulating splines...
+
+
+ +
+ +
+
+ +
    +
  • Frame: , raster:
  • +
  • Clock speed:
  • +
  • Rendering:
  • +
+
Hard Reset
+
+
+
+ Developed by Imran Nazar, 2014. Now on GitHub. +
+ + diff --git a/commodoreclicker/js/c64/cia.js b/commodoreclicker/js/c64/cia.js new file mode 100644 index 00000000..9cc4b233 --- /dev/null +++ b/commodoreclicker/js/c64/cia.js @@ -0,0 +1,500 @@ +define(function() { + return { + JOY_UP: 1, + JOY_DOWN: 2, + JOY_LEFT: 4, + JOY_RIGHT: 8, + JOY_FIRE: 16, + + IEC_ID: 255, + + timers: [], + CNTPIN: null, + CNTPIN_prev: null, + vicBank: null, + + IRQ: null, + IRM: null, + + currJoyPort: null, + currJoyState: null, + + registers: [ + // CIA1: peripherals/IRQ + [ + 0, // Port A + 0, // Port B + 0, // Port A direction + 0, // Port B direction + 0, // Timer A low byte + 0, // Timer A high byte + 0, // Timer B low byte + 0, // Timer B high byte + 0, // RTC tenth-of-sec + 0, // RTC sec + 0, // RTC min + 0, // RTC hour + 0, // Shift register + 0, // IRQ source + 0, // Timer A control + 0 // Timer B control + ], + + // CIA2: RS232/NMI + [ + 0, // Port A + 0, // Port B + 0, // Port A direction + 0, // Port B direction + 0, // Timer A low byte + 0, // Timer A high byte + 0, // Timer B low byte + 0, // Timer B high byte + 0, // RTC tenth-of-sec + 0, // RTC sec + 0, // RTC min + 0, // RTC hour + 0, // Shift register + 0, // NMI source + 0, // Timer A control + 0 // Timer B control + ] + ], + + keysPressed: null, + keymap: { + 27: 63, // Esc: Run/Stop + 112: 4, // F1: F1 + 113: 5, // F2: F3 + 114: 6, // F3: F5 + 115: 3, // F4: F7 + 116: 54, // F5: Arrow Up + 117: 48, // F6: Pound + 118: 51, // F7: Home + 119: 'NMI', // F8: Restore + + 192: 57, // `: Arrow Left + 49: 56, // 1: 1 + 50: 59, // 2: 2 + 51: 8, // 3: 3 + 52: 11, // 4: 4 + 53: 16, // 5: 5 + 54: 19, // 6: 6 + 55: 24, // 7: 7 + 56: 27, // 8: 8 + 57: 32, // 9: 9 + 48: 35, // 0: 0 + 189: 40, // -: + + 187: 43, // =: - + 8: 0, // Bksp: Del + + 9: 58, // Tab: Control + 81: 62, // Q: Q + 87: 9, // W: W + 69: 14, // E: E + 82: 17, // R: R + 84: 22, // T: T + 89: 25, // Y: Y + 85: 30, // U: U + 73: 33, // I: I + 79: 38, // O: O + 80: 41, // P: P + 219: 46, // [: @ + 221: 49, // ]: * + 220: 53, // \: = + + 65: 10, // A: A + 83: 13, // S: S + 68: 18, // D: D + 70: 21, // F: F + 71: 26, // G: G + 72: 29, // H: H + 74: 34, // J: J + 75: 37, // K: K + 76: 42, // L: L + 186: 45, // ;: : + 222: 50, // ': ; + 13: 1, // Enter: Return + + 16: 15, // Shift: Left Shift + 90: 12, // Z: Z + 88: 23, // X: X + 67: 20, // C: C + 86: 31, // V: V + 66: 28, // B: B + 78: 39, // N: N + 77: 36, // M: M + 188: 47, // ,: , + 190: 44, // .: . + 191: 55, // /: / + + 17: 61, // Ctrl: C= + 91: 7, // Left Win: Cursor Down + 32: 60, // Space: Space + 93: 2, // Right Win: Cursor Right + 18: 'FIRE', // Alt: Joystick Fire + 37: 'L', // Left: Joystick Left + 38: 'U', // Up: Joystick Up + 39: 'R', // Right: Joystick Right + 40: 'D' // Down: Joystick Down + }, + + io_r: function(addr) { + var i, j, chip = (addr & 0x0100) ? 1 : 0; + addr &= 0x0F; + switch (addr) { + case 0: // Port A + if (chip) { + this.registers[1][0] &= 0xFC; + this.registers[1][0] |= (3 - this.vicBank); + } else { + for (i = 7; i >= 0; i--) { + j = 1 << i; + if (this.currJoyPort == addr) { + this.registers[0][addr] &= (255 - j); + this.registers[0][addr] |= (this.currJoyState & j); + } + } + } + break; + case 1: // Port B + if (chip) { + // TODO: RS232 + } else { + this.registers[0][1] = 255; + for (i = 0; i < this.keysPressed.length; i++) { + j = this.keysPressed[i] >> 3; + if (!(this.registers[0][0] & (1 << j))) { + // Keyboard column is cleared, clear row + j = this.keysPressed[i] & 7; + this.registers[0][1] &= (255 - (1 << j)); + } + } + for (i = 7; i >= 0; i--) { + j = 1 << i; + if (this.currJoyPort == addr) { + this.registers[0][addr] &= (255 - j); + this.registers[0][addr] |= (this.currJoyState & j); + } + } + } + break; + case 4: // Timer A lo + this.registers[chip][addr] = this.timers[chip][0].value & 255; + break; + case 5: // Timer A hi + this.registers[chip][addr] = this.timers[chip][0].value >> 8; + break; + case 7: // Timer B lo + this.registers[chip][addr] = this.timers[chip][1].value & 255; + break; + case 8: // Timer B hi + this.registers[chip][addr] = this.timers[chip][1].value >> 8; + break; + case 13: // IRQ + this.registers[chip][addr] = this.IRQ[chip]; + this.IRQ[chip] = 0; + break; + } + return this.registers[chip][addr]; + }, + io_w: function(addr, val) { + var prevRunning, i, j, chip = (addr & 0x0100) ? 1 : 0; + addr &= 0x0F; + val &= 255; + + switch (addr) { + case 0: + if (chip) { + this.vicBank = (3 - (val & 3)); + this.owner.IEC[val & 8 ? 'pulldown' : 'release'](this.IEC_ID, 'ATN'); + this.owner.IEC[val & 16 ? 'pulldown' : 'release'](this.IEC_ID, 'CLK'); + this.owner.IEC[val & 32 ? 'pulldown' : 'release'](this.IEC_ID, 'DATA'); + } + break; + case 4: // Timer A lo latch + this.timers[chip][0].latch &= 0xFF00; + this.timers[chip][0].latch |= val; + return; + case 5: // Timer A hi latch + this.timers[chip][0].latch &= 0x00FF + this.timers[chip][0].latch |= (val << 8); + return; + case 6: // Timer B lo latch + this.timers[chip][1].latch &= 0xFF00; + this.timers[chip][1].latch |= val; + return; + case 7: // Timer B hi latch + this.timers[chip][1].latch &= 0x00FF; + this.timers[chip][1].latch |= (val << 8); + return; + case 13: // IRM + if (val & 31) { + this.IRM[chip] = (val & 31) ^ ((val & 128) ? 0 : 31); + } + break; + case 14: // Timer A control + prevRunning = this.timers[chip][0].running; + this.timers[chip][0].running = !!(val & 1); + this.timers[chip][0].oneshot = !!(val & 8); + this.timers[chip][0].latchroll = !(val & 16); + this.timers[chip][0].mode = (val & 32) >> 5; + if (!this.timers[chip][0].running) { + this.timers[chip][0].latch &= 255; + } + if (!prevRunning && this.timers[chip][0].running) { + this.timers[chip][0].value = this.timers[chip][0].latch; + } + break; + case 15: // Timer B control + prevRunning = this.timers[chip][1].running; + this.timers[chip][1].running = !!(val & 1); + this.timers[chip][1].oneshot = !!(val & 8); + this.timers[chip][1].latchroll = !(val & 16); + this.timers[chip][1].mode = (val & 96) >> 5; + if (!this.timers[chip][1].running) { + this.timers[chip][1].latch &= 255; + } + if (!prevRunning && this.timers[chip][1].running) { + this.timers[chip][1].value = this.timers[chip][1].latch; + } + break; + } + + this.registers[chip][addr] = val & 255; + }, + handlers: { + keydown: function(e) { + var i, k = this.keymap[e.keyCode]; + if (k === undefined) { + return; + } + + e.preventDefault(); + switch (k) { + case 'L': + $('#joy_left').addClass('active'); + this.currJoyState &= (255 - this.JOY_LEFT); + break; + case 'U': + $('#joy_up').addClass('active'); + this.currJoyState &= (255 - this.JOY_UP); + break; + case 'R': + $('#joy_right').addClass('active'); + this.currJoyState &= (255 - this.JOY_RIGHT); + break; + case 'D': + $('#joy_down').addClass('active'); + this.currJoyState &= (255 - this.JOY_DOWN); + break; + case 'FIRE': + $('#joy_fire').addClass('active'); + this.currJoyState &= (255 - this.JOY_FIRE); + break; + case 'NMI': + this.owner.IEC.signal('RESET'); + this.owner.CPU.signal('NMI'); + break; + default: + i = this.keysPressed.indexOf(k); + if (i == -1) { + this.keysPressed.push(k); + } + break; + } + }, + keyup: function(e) { + var i, k = this.keymap[e.keyCode]; + if (k === undefined) { + return; + } + + e.preventDefault(); + switch (k) { + case 'L': + $('#joy_left').removeClass('active'); + this.currJoyState |= this.JOY_LEFT; + break; + case 'U': + $('#joy_up').removeClass('active'); + this.currJoyState |= this.JOY_UP; + break; + case 'R': + $('#joy_right').removeClass('active'); + this.currJoyState |= this.JOY_RIGHT; + break; + case 'D': + $('#joy_down').removeClass('active'); + this.currJoyState |= this.JOY_DOWN; + break; + case 'FIRE': + $('#joy_fire').removeClass('active'); + this.currJoyState |= this.JOY_FIRE; + break; + case 'NMI': + break; + default: + i = this.keysPressed.indexOf(k); + if (i >= 0) { + this.keysPressed.splice(i, 1); + } + break; + } + } + }, + getState: function() { + var t = [], i, j; + for (i = 0; i < 2; i++) { + t[i] = []; + for (j = 0; j < 2; j++) { + t[i][j] = $.extend({}, this.timers[i][j]) + } + } + return { + CIA1: this.registers[0].slice(0), + CIA2: this.registers[1].slice(0), + timers: t + } + }, + setState: function(state) { + var t = [], i, j; + for (i = 0; i < 2; i++) { + t[i] = []; + for (j = 0; j < 2; j++) { + t[i][j] = $.extend({}, state.timers[i][j]) + } + } + for (i in state.CIA1) { + this.io_w(i, state.CIA1[i]); + } + for (i in state.CIA2) { + this.io_w(0x0100 | i, state.CIA2[i]); + } + this.registers[0][this.currJoyPort] &= 0xE0; + this.registers[0][this.currJoyPort] |= this.currJoyState; + + this.registers[1][0] &= 0x3F; + if (!this.owner.IEC.check('CLK')) { + this.registers[1][0] |= 0x40; + } + if (!this.owner.IEC.check('DATA')) { + this.registers[1][0] |= 0x80; + } + this.timers = t; + }, + step: function() { + this.CNTPIN_prev = this.CNTPIN; + + var i, j, timer, dec; + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + timer = this.timers[i][j]; + if (timer.running) { + if (timer.value == 0) { + timer.underflowed = true; + if (timer.oneshot) { + timer.running = false; + } else { + timer.value = timer.latchroll ? timer.latch : 65535; + } + if (j) { + this.IRQ[i] |= 0x02; + if (this.IRM[i] & 2) { + this.IRQ[i] |= 0x80; + this.owner.CPU.signal('INT'); + } + } else { + this.IRQ[i] |= 0x01; + if (this.IRM[i] & 1) { + this.IRQ[i] |= 0x80; + this.owner.CPU.signal('INT'); + } + } + } else { + timer.underflowed = false; + switch (j * 4 + timer.mode) { + // Timer A: clock + case 0: + dec = true; + break; + // Timer A: positive slope on CNT + case 1: + dec = this.CNTPIN && !this.CNTPIN_prev; + break; + + // Timer B: clock + case 4: + dec = true; + break; + // Timer B: positive slope on CNT + case 5: + dec = this.CNTPIN && !this.CNTPIN_prev; + break; + // Timer B: A underflow + case 6: + dec = this.timers[i][0].underflowed; + break; + // Timer B: A underflow and +ve slope on CNT + case 7: + dec = this.timers[i][0].underflowed && this.CNTPIN && !this.CNTPIN_prev; + break; + } + if (dec) { + timer.value--; + } + } + } + } + } + + this.registers[1][0] &= 0x3F; + if (!this.owner.IEC.check('CLK')) { + this.registers[1][0] |= 0x40; + } + if (!this.owner.IEC.check('DATA')) { + this.registers[1][0] |= 0x80; + } + }, + reset: function() { + // All pins are pulled high on the data ports + this.registers[0][0] = 255; + this.registers[0][1] = 255; + this.registers[1][0] = 255; + this.registers[1][1] = 255; + + this.currJoyPort = 0; + this.currJoyState = 31; + this.CNTPIN = false; + this.CNTPIN_prev = false; + this.IRQ = [0,0]; + this.IRM = [0,0]; + this.keysPressed = []; + this.vicBank = 0; + this.owner.IEC.register(this.IEC_ID); + + var i, j; + this.timers.length = 0; + for (i = 0; i < 2; i++) { + this.timers[i] = []; + for (j = 0; j < 2; j++) { + this.timers[i][j] = { + mode: 0, + running: false, + underflowed: false, + oneshot: false, + latchroll: false, + latch: 0, + value: 0 + }; + } + } + }, + init: function() { + this.reset(); + $(document) + .on('keydown', this.handlers.keydown.bind(this)) + .on('keyup', this.handlers.keyup.bind(this)); + } + }; +}); diff --git a/commodoreclicker/js/c64/cpu.js b/commodoreclicker/js/c64/cpu.js new file mode 100644 index 00000000..eb4d1054 --- /dev/null +++ b/commodoreclicker/js/c64/cpu.js @@ -0,0 +1,1228 @@ +define(function() { + return { + VECTOR_INT: 0xFFFE, + VECTOR_RESET: 0xFFFC, + VECTOR_NMI: 0xFFFA, + + clock: null, + printedTo: null, + + curOp: [], + curCycle: null, + reg: null, + halted: null, + signalled: null, + util: { + setFlag: function(flag, cond) { + if (cond) { + this.reg.P |= flag; + } else { + this.reg.P &= (255 - flag); + } + }, + setNZ: function(val) { + if (val & 128) { + this.reg.P |= this.flags.N; + } else { + this.reg.P &= (255 - this.flags.N); + } + + if (val == 0) { + this.reg.P |= this.flags.Z; + } else { + this.reg.P &= (255 - this.flags.Z); + } + }, + branch: function(flag, val) { + if ((this.reg.P & flag) == val) { + this.reg.PC = this.reg.addr; + if (!this.reg.tmp4) { + this.reg.tmp4 = 1; + return false; + } else if ((this.reg.addr & 0xFF00) != (this.reg.tmp1 & 0xFF00)) { + if (this.reg.tmp4 == 1) { + this.reg.tmp4 = 2; + return false; + } + } + } + return true; + }, + push: function(val) { + this.owner.MMU.w(this.reg.S + 0x0100, val); + this.reg.S = (this.reg.S - 1) & 0x00FF; + }, + pop: function() { + this.reg.S = (this.reg.S + 1) & 0x00FF; + return this.owner.MMU.r(this.reg.S + 0x0100); + }, + interrupt: function(vector, brk_flag, reset_flag) { + // This gets a bit messy, handling all the int types: + // BRK changes PC, and sets the B flag + // RESET doesn't push PC, and doesn't set I + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + return false; + case 1: + this.reg.tmp4 = reset_flag ? 3 : 2; + if (!brk_flag) { + // Rewind the changes made in previous cycles + this.reg.PC = (this.reg.PC - 2) & 0xFFFF; + } + if (!reset_flag) { + this.util.push.call(this, this.reg.PC >> 8); + } + return false; + case 2: + this.reg.tmp4 = 3; + if (!reset_flag) { + this.util.push.call(this, this.reg.PC & 255); + } + return false; + case 3: + this.reg.tmp4 = 4; + if (reset_flag) { + return false; + } + if (brk_flag) { + this.reg.P |= this.flags.B; + } else { + this.reg.P &= (255 - this.flags.B); + } + this.util.push.call(this, this.reg.P); + if (reset_flag) { + this.reg.P &= (255 - this.flags.I); + } else { + this.reg.P |= this.flags.I; + } + return false; + case 4: + this.reg.tmp4 = 5; + this.reg.addr = this.owner.MMU.r(vector); + return false; + case 5: + this.reg.addr += (this.owner.MMU.r(vector + 1) << 8); + this.reg.PC = this.reg.addr; + } + return true; + } + }, + ops: { + ADC: function() { + var res = this.reg.operand + this.reg.A + ((this.reg.P & this.flags.C) ? 1 : 0); + if (this.reg.P & this.flags.D) { + this.util.setFlag.call(this, this.flags.Z, (res & 255) == 0); + if ((this.reg.operand & 15) + (this.reg.A & 15) + ((this.reg.P & this.flags.C) ? 1 : 0) > 9) { + res += 6; + } + this.util.setFlag.call(this, this.flags.N, res & 128); + this.util.setFlag.call(this, this.flags.V, + (!((this.reg.A ^ this.reg.operand) & 128)) && + ((this.reg.A ^ res) & 128) + ); + if (res > 0x99) { + res += 0x60; + } + this.util.setFlag.call(this, this.flags.C, res > 0x99); + } else { + this.util.setNZ.call(this, res & 255); + this.util.setFlag.call(this, this.flags.V, + (!((this.reg.A ^ this.reg.operand) & 128)) && + ((this.reg.A ^ res) & 128) + ); + this.util.setFlag.call(this, this.flags.C, res > 255); + } + + this.reg.A = res & 255; + return true; + }, + AHX: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + ALR: function() { + // TODO: Undocumented + return true; + }, + ANC: function() { + // TODO: Undocumented + return true; + }, + AND: function() { + this.reg.A = (this.reg.A & this.reg.operand) & 255; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + ARR: function() { + // TODO: Undocumented + return true; + }, + ASL: function() { + this.reg.writeflag = true; + this.util.setFlag.call(this, this.flags.C, this.reg.operand & 128); + this.reg.operand = (this.reg.operand << 1) & 255; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + AXS: function() { + // TODO: Undocumented + return true; + }, + BCC: function() { + return this.util.branch.call(this, this.flags.C, 0); + }, + BCS: function() { + return this.util.branch.call(this, this.flags.C, this.flags.C); + }, + BEQ: function() { + return this.util.branch.call(this, this.flags.Z, this.flags.Z); + }, + BIT: function() { + this.util.setFlag.call(this, this.flags.N, this.reg.operand & 128); + this.util.setFlag.call(this, this.flags.V, this.reg.operand & 64); + this.util.setFlag.call(this, this.flags.Z, (this.reg.operand & this.reg.A) == 0); + return true; + }, + BMI: function() { + return this.util.branch.call(this, this.flags.N, this.flags.N); + }, + BNE: function() { + return this.util.branch.call(this, this.flags.Z, 0); + }, + BPL: function() { + return this.util.branch.call(this, this.flags.N, 0); + }, + BRK: function() { + return this.util.interrupt.call(this, this.VECTOR_INT, true); + }, + BVC: function() { + return this.util.branch.call(this, this.flags.V, 0); + }, + BVS: function() { + return this.util.branch.call(this, this.flags.V, this.flags.V); + }, + CLC: function() { + this.reg.P &= (255 - this.flags.C); + return true; + }, + CLD: function() { + this.reg.P &= (255 - this.flags.D); + return true; + }, + CLI: function() { + this.reg.P &= (255 - this.flags.I); + return true; + }, + CLV: function() { + this.reg.P &= (255 - this.flags.V); + return true; + }, + CMP: function() { + var res = (this.reg.A - this.reg.operand) & 511; + this.util.setFlag.call(this, this.flags.C, res < 256); + this.util.setNZ.call(this, res & 255); + return true; + }, + CPX: function() { + var res = (this.reg.X - this.reg.operand) & 511; + this.util.setFlag.call(this, this.flags.C, res < 256); + this.util.setNZ.call(this, res & 255); + return true; + }, + CPY: function() { + var res = (this.reg.Y - this.reg.operand) & 511; + this.util.setFlag.call(this, this.flags.C, res < 256); + this.util.setNZ.call(this, res & 255); + return true; + }, + DCP: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + DEC: function() { + this.reg.writeflag = true; + this.reg.operand = (this.reg.operand - 1) & 255; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + DEX: function() { + this.reg.X = (this.reg.X - 1) & 255; + this.util.setNZ.call(this, this.reg.X); + return true; + }, + DEY: function() { + this.reg.Y = (this.reg.Y - 1) & 255; + this.util.setNZ.call(this, this.reg.Y); + return true; + }, + EOR: function() { + this.reg.A = (this.reg.A ^ this.reg.operand) & 255; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + HLT: function() { + this.halted = true; + return true; + }, + INC: function() { + this.reg.writeflag = true; + this.reg.operand = (this.reg.operand + 1) & 255; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + INT: function() { + return this.util.interrupt.call(this, this.VECTOR_INT); + }, + INX: function() { + this.reg.X = (this.reg.X + 1) & 255; + this.util.setNZ.call(this, this.reg.X); + return true; + }, + INY: function() { + this.reg.Y = (this.reg.Y + 1) & 255; + this.util.setNZ.call(this, this.reg.Y); + return true; + }, + ISC: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + JMP: function() { + this.reg.PC = this.reg.addr; + return true; + }, + JSR: function() { + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + this.reg.tmp3 = (this.reg.PC - 1) & 0xFFFF; + this.util.push.call(this, this.reg.tmp3 >> 8); + return false; + case 1: + this.reg.tmp4 = 2; + this.util.push.call(this, this.reg.tmp3 & 255); + return false; + case 2: + this.reg.PC = this.reg.addr; + } + return true; + }, + LAS: function() { + // TODO: Undocumented + return true; + }, + LAX: function() { + // TODO: Undocumented + return true; + }, + LDA: function() { + this.reg.A = this.reg.operand; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + LDX: function() { + this.reg.X = this.reg.operand; + this.util.setNZ.call(this, this.reg.X); + return true; + }, + LDY: function() { + this.reg.Y = this.reg.operand; + this.util.setNZ.call(this, this.reg.Y); + return true; + }, + LSR: function() { + this.reg.writeflag = true; + this.util.setFlag.call(this, this.flags.C, this.reg.operand & 1); + this.reg.operand >>= 1; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + NMI: function() { + return this.util.interrupt.call(this, this.VECTOR_NMI); + }, + NOP: function() { + // lol + return true; + }, + ORA: function() { + this.reg.A = (this.reg.A | this.reg.operand) & 255; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + PHA: function() { + if (!this.reg.tmp3) { + this.reg.tmp3 = 1; + return false; + } + this.util.push.call(this, this.reg.A); + return true; + }, + PHP: function() { + if (!this.reg.tmp3) { + this.reg.tmp3 = 1; + return false; + } + this.util.push.call(this, this.reg.P); + return true; + }, + PLA: function() { + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + return false; + case 1: + this.reg.tmp4 = 2; + return false; + case 2: + this.reg.A = this.util.pop.call(this); + this.util.setNZ.call(this, this.reg.A); + } + return true; + }, + PLP: function() { + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + return false; + case 1: + this.reg.tmp4 = 2; + return false; + case 2: + this.reg.P = this.util.pop.call(this); + } + return true; + }, + RLA: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + ROL: function() { + this.reg.writeflag = true; + this.reg.operand <<= 1; + if (this.reg.P & this.flags.C) { + this.reg.operand |= 1; + } + this.util.setFlag.call(this, this.flags.C, this.reg.operand & 256); + this.reg.operand &= 255; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + ROR: function() { + this.reg.writeflag = true; + if (this.reg.P & this.flags.C) { + this.reg.operand |= 256; + } + this.util.setFlag.call(this, this.flags.C, this.reg.operand & 1); + this.reg.operand >>= 1; + this.util.setNZ.call(this, this.reg.operand); + return true; + }, + RRA: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + RST: function() { + return this.util.interrupt.call(this, this.VECTOR_RESET, false, true); + }, + RTI: function() { + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + return false; + case 1: + this.reg.tmp4 = 2; + return false; + case 2: + this.reg.tmp4 = 3; + this.reg.P = this.util.pop.call(this); + return false; + case 3: + this.reg.tmp4 = 4; + this.reg.addr = this.util.pop.call(this); + return false; + case 4: + this.reg.addr += (this.util.pop.call(this) << 8); + this.reg.PC = this.reg.addr; + } + return true; + }, + RTS: function() { + switch (this.reg.tmp4) { + case null: + this.reg.tmp4 = 1; + return false; + case 1: + this.reg.tmp4 = 2; + return false; + case 2: + this.reg.tmp4 = 3; + this.reg.addr = this.util.pop.call(this); + return false; + case 3: + this.reg.tmp4 = 4; + this.reg.addr += (this.util.pop.call(this) << 8); + return false; + case 4: + this.reg.PC = (this.reg.addr + 1) & 0xFFFF; + } + return true; + }, + SAX: function() { + // TODO: Undocumented + return true; + }, + SBC: function() { + var res = this.reg.A - this.reg.operand - ((this.reg.P & this.flags.C) ? 0 : 1); + this.util.setNZ.call(this, res & 255); + this.util.setFlag.call(this, this.flags.V, + ((this.reg.A ^ this.reg.operand) & 128) && + ((this.reg.A ^ res) & 128) + ); + if (this.reg.P & this.flags.D) { + if ((this.reg.A & 15) - ((this.reg.P & this.flags.C) ? 0 : 1) < (this.reg.operand & 15)) { + res -= 6; + } + if (res > 0x99) { + res -= 0x60; + } + } + this.util.setFlag.call(this, this.flags.C, !(res & 256)); + this.reg.A = res & 255; + return true; + }, + SEC: function() { + this.reg.P |= this.flags.C; + return true; + }, + SED: function() { + this.reg.P |= this.flags.D; + return true; + }, + SEI: function() { + this.reg.P |= this.flags.I; + return true; + }, + SHX: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + SHY: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + SLO: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + SRE: function() { + this.reg.writeflag = true; + // TODO: Undocumented + return true; + }, + STA: function() { + this.reg.writeflag = true; + this.reg.writeonly = true; + this.reg.operand = this.reg.A; + return true; + }, + STX: function() { + this.reg.writeflag = true; + this.reg.writeonly = true; + this.reg.operand = this.reg.X; + return true; + }, + STY: function() { + this.reg.writeflag = true; + this.reg.writeonly = true; + this.reg.operand = this.reg.Y; + return true; + }, + TAS: function() { + // TODO: Undocumented + return true; + }, + TAX: function() { + this.reg.X = this.reg.A; + this.util.setNZ.call(this, this.reg.X); + return true; + }, + TAY: function() { + this.reg.Y = this.reg.A; + this.util.setNZ.call(this, this.reg.Y); + return true; + }, + TSX: function() { + this.reg.X = this.reg.S; + this.util.setNZ.call(this, this.reg.X); + return true; + }, + TXA: function() { + this.reg.A = this.reg.X; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + TXS: function() { + this.reg.S = this.reg.X; + return true; + }, + TYA: function() { + this.reg.A = this.reg.Y; + this.util.setNZ.call(this, this.reg.A); + return true; + }, + XAA: function() { + // TODO: Undocumented + return true; + } + }, + addr: { + imp: function() { + // Nothing to do except suck up 1 cycle + return true; + }, + imp_w: function() { + return true; + }, + acc: function() { + this.reg.operand = this.reg.A; + return true; + }, + acc_w: function() { + this.reg.A = this.reg.operand; + return true; + }, + imm: function() { + if (this.curOp.length == 1) { + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.operand = this.curOp[1]; + } + return true; + }, + imm_w: function() { + return true; + }, + z: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.addr = this.curOp[1]; + return false; + case 2: + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + z_w: function() { + if (!this.reg.writeonly && this.curCycle < 5) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + zx: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + if (this.reg.addr === null) { + this.reg.tmp1 += this.reg.X; + this.reg.addr = this.reg.tmp1 & 0xFF; + return false; + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + zx_w: function() { + if (!this.reg.writeonly && this.curCycle < 6) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + zy: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + if (this.reg.addr === null) { + this.reg.tmp1 += this.reg.Y; + this.reg.addr = this.reg.tmp1 & 0xFF; + return false; + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + zy_w: function() { + if (!this.reg.writeonly && this.curCycle < 6) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + abs: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.addr = (this.curOp[2] << 8) + this.reg.tmp1; + if ( + this.map[this.curOp[0]][0] == 'JMP' || + this.map[this.curOp[0]][0] == 'JSR' + ) { + // Operand not required + return true; + } + return false; + case 3: + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + abs_w: function() { + if (!this.reg.writeonly && this.curCycle < 6) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + abx: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp2 = (this.curOp[2] << 8) + this.reg.tmp1; + return false; + case 3: + if (this.reg.addr === null) { + this.reg.addr = (this.reg.tmp2 + this.reg.X) & 0xFFFF; + if ((this.reg.tmp2 & 0xFF00) != (this.reg.addr & 0xFF00)) { + // Page boundary, add a cycle + return false; + } + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + abx_w: function() { + if (this.curCycle < (this.reg.writeonly ? 5 : 7)) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + aby: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp2 = (this.curOp[2] << 8) + this.reg.tmp1; + return false; + case 3: + if (this.reg.addr === null) { + this.reg.addr = (this.reg.tmp2 + this.reg.Y) & 0xFFFF; + if ((this.reg.tmp2 & 0xFF00) != (this.reg.addr & 0xFF00)) { + // Page boundary, add a cycle + return false; + } + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + aby_w: function() { + if (this.curCycle < (this.reg.writeonly ? 5 : 7)) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + ind: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp2 = (this.curOp[2] << 8) + this.reg.tmp1; + return false; + case 3: + if (this.reg.tmp3 === null) { + this.reg.tmp3 = this.owner.MMU.r(this.reg.tmp2); + return false; + } + if (this.reg.addr === null) { + this.reg.addr = (this.owner.MMU.r(this.reg.tmp2 + 1) << 8) + this.reg.tmp3; + } + return true; + } + }, + ind_w: function() { + // No such thing as a write here + return true; + }, + rel: function() { + if (this.curOp.length == 1) { + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.reg.PC; + return false; + } + + this.reg.operand = this.curOp[1]; + this.reg.addr = (this.curOp[1] & 128) + ? -(256 - this.curOp[1]) + : this.curOp[1]; + this.reg.addr += this.reg.tmp1; + return true; + }, + rel_w: function() { + // No such thing as a write here + return true; + }, + izx: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + if (this.reg.tmp2 === null) { + // Redundant fetch + this.reg.tmp2 = this.owner.MMU.r(this.reg.tmp1); + this.reg.tmp1 = (this.reg.tmp1 + this.reg.X) & 0xFF; + return false; + } + if (this.reg.tmp3 === null) { + this.reg.tmp3 = this.owner.MMU.r(this.reg.tmp1); + return false; + } + if (this.reg.addr === null) { + this.reg.addr = (this.owner.MMU.r((this.reg.tmp1 + 1) & 0xFF) << 8) + this.reg.tmp3; + return false; + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + izx_w: function() { + if (this.curCycle < (this.reg.writeonly ? 6 : 8)) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + }, + izy: function() { + switch (this.curOp.length) { + case 1: + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.reg.tmp1 = this.curOp[1]; + return false; + case 2: + if (this.reg.tmp2 === null) { + this.reg.tmp2 = this.owner.MMU.r(this.reg.tmp1); + return false; + } + if (this.reg.tmp3 === null) { + this.reg.tmp3 = (this.owner.MMU.r((this.reg.tmp1 + 1) & 0xFF) << 8) + this.reg.tmp2; + return false; + } + if (this.reg.addr === null) { + this.reg.addr = (this.reg.tmp3 + this.reg.Y) & 0xFFFF; + if ((this.reg.tmp3 & 0xFF00) != (this.reg.addr & 0xFF00)) { + // Page boundary crossed + return false; + } + } + if (this.reg.operand === null) { + this.reg.operand = this.owner.MMU.r(this.reg.addr); + } + return true; + } + }, + izy_w: function() { + if (this.curCycle < (this.reg.writeonly ? 6 : 8)) { + return false; + } + this.owner.MMU.w(this.reg.addr, this.reg.operand); + return true; + } + }, + disasmHandlers: { + imp: function(op) { + return ''; + }, + acc: function(op) { + return 'a'; + }, + imm: function(op) { + return '#$' + this.pad(op[1], '0', 2); + }, + z: function(op) { + return '$' + this.pad(op[1], '0', 2); + }, + zx: function(op) { + return '$' + this.pad(op[1], '0', 2) + ',x'; + }, + zy: function(op) { + return '$' + this.pad(op[1], '0', 2) + ',y'; + }, + abs: function(op) { + return '$' + this.pad(op[1] + (op[2] << 8), '000', 4); + }, + abx: function(op) { + return '$' + this.pad(op[1] + (op[2] << 8), '000', 4) + ',x'; + }, + aby: function(op) { + return '$' + this.pad(op[1] + (op[2] << 8), '000', 4) + ',y'; + }, + ind: function(op) { + return '($' + this.pad(op[1] + (op[2] << 8), '000', 4) + ')'; + }, + rel: function(op) { + if (this.reg.addr) { + return '$' + this.pad(this.reg.addr, '000', 4); + } else { + if (op[1] & 128) { + return '-' + (((~op[1]) + 1) & 127); + } else { + return '+' + op[1]; + } + } + }, + izy: function(op) { + return '($' + this.pad(op[1], '0', 2) + '),Y'; + }, + izx: function(op) { + return '($' + this.pad(op[1], '0', 2) + ',X)'; + } + }, + map: [ + ['BRK','imp',1,7],['ORA','izx',2,6],['HLT','imp',1,2],['SLO','izx',2,8], + ['NOP','z', 2,3],['ORA','z', 2,3],['ASL','z', 2,5],['SLO','z', 2,5], + ['PHP','imp',1,3],['ORA','imm',2,2],['ASL','acc',1,2],['ANC','imm',2,2], + ['NOP','abs',3,4],['ORA','abs',3,4],['ASL','abs',3,6],['SLO','abs',3,6], + + ['BPL','rel',2,2],['ORA','izy',2,5],['HLT','imp',1,2],['SLO','izy',2,8], + ['NOP','zx', 2,4],['ORA','zx', 2,4],['ASL','zx', 2,6],['SLO','zx', 2,6], + ['CLC','imp',1,2],['ORA','aby',3,4],['NOP','imp',1,2],['SLO','aby',3,7], + ['NOP','abx',3,4],['ORA','abx',3,4],['ASL','abx',3,7],['SLO','abx',3,7], + + ['JSR','abs',3,6],['AND','izx',2,6],['HLT','imp',1,2],['RLA','izx',2,8], + ['BIT','z' ,2,3],['AND','z' ,2,3],['ROL','z', 2,5],['RLA','z', 2,5], + ['PLP','imp',1,4],['AND','imm',2,2],['ROL','acc',1,2],['ANC','imm',2,2], + ['BIT','abs',3,4],['AND','abs',3,4],['ROL','abs',3,6],['RLA','abs',3,6], + + ['BMI','rel',2,2],['AND','izy',2,5],['HLT','imp',1,2],['RLA','izy',2,8], + ['NOP','zx', 2,4],['AND','zx', 2,4],['ROL','zx', 2,6],['RLA','zx', 2,6], + ['SEC','imp',1,2],['AND','aby',3,4],['NOP','imp',1,2],['RLA','aby',3,7], + ['NOP','abx',3,4],['AND','abx',3,4],['ROL','abx',3,7],['RLA','abx',3,7], + + ['RTI','imp',1,6],['EOR','izx',2,6],['HLT','imp',1,2],['SRE','izx',2,8], + ['NOP','z', 2,3],['EOR','z', 2,3],['LSR','z', 2,5],['SRE','z', 2,5], + ['PHA','imp',1,3],['EOR','imm',2,2],['LSR','acc',1,2],['ALR','imm',2,2], + ['JMP','abs',3,3],['EOR','abs',3,4],['LSR','abs',3,6],['SRE','abs',3,6], + + ['BVC','rel',2,2],['EOR','izy',2,5],['HLT','imp',1,2],['SRE','izy',2,8], + ['NOP','zx', 2,4],['EOR','zx', 2,4],['LSR','zx', 2,6],['SRE','zx', 2,6], + ['CLI','imp',1,2],['EOR','aby',3,4],['NOP','imp',1,2],['SRE','aby',3,7], + ['NOP','abx',3,4],['EOR','abx',3,4],['LSR','abx',3,7],['SRE','abx',3,7], + + ['RTS','imp',1,6],['ADC','izx',2,6],['HLT','imp',1,2],['RRA','izx',2,8], + ['NOP','z', 2,3],['ADC','z', 2,3],['ROR','z', 2,5],['RRA','z', 2,5], + ['PLA','imp',1,4],['ADC','imm',2,2],['ROR','acc',1,2],['ARR','imm',2,2], + ['JMP','ind',3,5],['ADC','abs',3,4],['ROR','abs',3,6],['RRA','abs',3,6], + + ['BVS','rel',2,2],['ADC','izy',2,5],['HLT','imp',1,2],['RRA','izy',2,8], + ['NOP','zx', 2,4],['ADC','zx', 2,4],['ROR','zx', 2,6],['RRA','zx', 2,6], + ['SEI','imp',1,2],['ADC','aby',3,4],['NOP','imp',1,2],['RRA','aby',3,7], + ['NOP','abx',3,4],['ADC','abx',3,4],['ROR','abx',3,7],['RRA','abx',3,7], + + ['NOP','imm',2,2],['STA','izx',2,6],['NOP','imm',2,2],['SAX','izx',2,6], + ['STY','z', 2,3],['STA','z', 2,3],['STX','z', 2,3],['SAX','z', 2,3], + ['DEY','imp',1,2],['NOP','imm',2,2],['TXA','imp',1,2],['XAA','imm',2,2], + ['STY','abs',3,4],['STA','abs',3,4],['STX','abs',3,4],['SAX','abs',3,4], + + ['BCC','rel',2,2],['STA','izy',2,6],['HLT','imp',1,2],['AHX','izy',2,6], + ['STY','zx', 2,4],['STA','zx', 2,4],['STX','zy', 2,4],['SAX','zy', 2,4], + ['TYA','imp',1,2],['STA','aby',3,5],['TXS','imp',1,2],['TAS','aby',3,5], + ['SHY','abx',3,5],['STA','abx',3,5],['SHX','abx',3,5],['AHX','abx',3,5], + + ['LDY','imm',2,2],['LDA','izx',2,6],['LDX','imm',2,2],['LAX','izx',2,6], + ['LDY','z', 2,3],['LDA','z', 2,3],['LDX','z', 2,3],['LAX','z', 2,3], + ['TAY','imp',1,2],['LDA','imm',2,2],['TAX','imp',1,2],['LAX','imm',2,2], + ['LDY','abs',3,4],['LDA','abs',3,4],['LDX','abs',3,4],['LAX','abs',3,4], + + ['BCS','rel',2,2],['LDA','izy',2,5],['HLT','imp',1,2],['LAX','izy',2,5], + ['LDY','zx', 2,4],['LDA','zx', 2,4],['LDX','zy', 2,4],['LAX','zy', 2,4], + ['CLV','imp',1,2],['LDA','aby',3,4],['TSX','imp',1,2],['LAS','aby',3,4], + ['LDY','abx',3,4],['LDA','abx',3,4],['LDX','aby',3,4],['LAX','aby',3,4], + + ['CPY','imm',2,2],['CMP','izx',2,6],['NOP','imm',2,2],['DCP','izx',2,8], + ['CPY','z', 2,3],['CMP','z', 2,3],['DEC','z', 2,5],['DCP','z', 2,5], + ['INY','imp',1,2],['CMP','imm',2,2],['DEX','imp',1,2],['AXS','imm',2,2], + ['CPY','abs',3,4],['CMP','abs',3,4],['DEC','abs',3,6],['DCP','abs',3,6], + + ['BNE','rel',2,2],['CMP','izy',2,5],['HLT','imp',1,2],['DCP','izy',2,8], + ['NOP','zx', 2,4],['CMP','zx', 2,4],['DEC','zx', 2,6],['DCP','zx', 2,6], + ['CLD','imp',1,2],['CMP','aby',3,4],['NOP','imp',1,2],['DCP','aby',3,7], + ['NOP','abx',3,4],['CMP','abx',3,4],['DEC','abx',3,7],['DCP','abx',3,7], + + ['CPX','imm',2,2],['SBC','izx',2,6],['NOP','imm',1,2],['ISC','izx',2,8], + ['CPX','z', 2,3],['SBC','z', 2,3],['INC','z', 2,5],['ISC','z', 2,5], + ['INX','imp',1,2],['SBC','imm',2,2],['NOP','imp',1,2],['SBC','imm',2,2], + ['CPX','abs',3,4],['SBC','abs',3,4],['INC','abs',3,6],['ISC','abs',3,6], + + ['BEQ','rel',2,2],['SBC','izy',2,5],['HLT','imp',1,2],['ISC','izy',2,8], + ['NOP','zx', 2,4],['SBC','zx', 2,4],['INC','zx', 2,6],['ISC','zx', 2,6], + ['SED','imp',1,2],['SBC','aby',3,4],['NOP','imp',1,2],['ISC','aby',3,7], + ['NOP','abx',3,4],['SBC','abx',3,4],['INC','abx',3,7],['ISC','abx',3,7], + + ['INT','imp',1,7],['RST','imp',1,6],['NMI','imp',1,7] + ], + flags: { + N: 128, + V: 64, + B: 16, + D: 8, + I: 4, + Z: 2, + C: 1 + }, + interruptSignals: { + 'INT': 256, + 'RST': 257, + 'NMI': 258 + }, + step: function() { + this.clock++; + + var op; // [opcode, addr, size, time] + if (this.halted) { + return; + } + if (this.owner.MMU.busLock) { + if (this.owner.game.debug) { + console.log('BUS LOCK: ' + this.owner.MMU.busLock); + } + this.owner.MMU.busLock--; + return; + } + if (this.clock == 1) { + this.signal('RST'); + } + + this.curCycle++; + if (this.curOp.length == 0) { + this.reg.origPC = this.reg.PC; + if (this.signalled && !(this.reg.P & this.flags.I)) { + this.curOp.push(this.signalled); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + this.signalled = null; + } else { + this.curOp.push(this.owner.MMU.r(this.reg.PC)); + this.reg.PC = (this.reg.PC + 1) & 0xFFFF; + } + } else { + op = this.map[this.curOp[0]]; + if (this.addr[op[1]].call(this)) { + if (!this.reg.operated) { + this.reg.operated = this.ops[op[0]].call(this); + } + if (this.reg.operated) { + if (this.owner.game.debug && !this.reg.printed) { + if (this.clock > this.printedTo) { + this.reg.printed = true; + console.log(this.debugString()); + this.printedTo = this.clock; + } + } + if (this.reg.writeflag) { + if (this.addr[op[1] + '_w'].call(this)) { + this.resetOp(); + } + } else { + this.resetOp(); + } + } + } + } + }, + disasm: function(pc, len) { + len = len || 64; + var i = 0, j, op = [], prevPC; + + do { + prevPC = pc; + op.length = 0; + op.push(this.owner.MMU.r(pc++)); + + for (j = 1; j < this.map[op[0]][2]; j++) { + op.push(this.owner.MMU.r(pc++)); + } + + i += op.length; + console.warn([ + this.pad(prevPC, '000', 4), + this.map[op[0]][0], + this.disasmHandlers[this.map[op[0]][1]].call(this, op).toUpperCase() + ].join(' ')); + } while (i < len); + }, + debugString: function() { + var i, opcodes = '', + operand = this.disasmHandlers[this.map[this.curOp[0]][1]].call(this, this.curOp).toUpperCase(); + + for (i = 0; i < this.curOp.length; i++) { + opcodes += this.pad(this.curOp[i], '0', 2, true); + opcodes += ' '; + } + while (opcodes.length < 12) { + opcodes += ' '; + } + while (operand.length < 10) { + operand += ' '; + } + + return [ + '.C:' + this.pad(this.reg.origPC, '000', 4), + ' ' + opcodes, + this.map[this.curOp[0]][0], operand, '-', + "A:" + this.pad(this.reg.A, '0', 2, true), + "X:" + this.pad(this.reg.X, '0', 2, true), + "Y:" + this.pad(this.reg.Y, '0', 2, true), + "S:" + this.pad(this.reg.S, '0', 2), + ( + ((this.reg.P & this.flags.N) ? 'N' : '.') + + ((this.reg.P & this.flags.V) ? 'V' : '.') + + '-' + + ((this.reg.P & this.flags.B) ? 'B' : '.') + + ((this.reg.P & this.flags.D) ? 'D' : '.') + + ((this.reg.P & this.flags.I) ? 'I' : '.') + + ((this.reg.P & this.flags.Z) ? 'Z' : '.') + + ((this.reg.P & this.flags.C) ? 'C' : '.') + ), ' ', + this.clock + ].join(' '); + }, + pad: function(val, padder, len, upper) { + return (padder + val.toString(16))[upper ? 'toUpperCase' : 'toLowerCase']().slice(-len); + }, + signal: function(line) { + this.signalled = this.interruptSignals[line] || null; + }, + getState: function() { + return { + clock: this.clock, + curOp: this.curOp.slice(0), + curCycle: 0 + this.curCycle, + reg: $.extend({}, this.reg) + }; + }, + setState: function(state) { + this.clock = state.clock; + this.curOp = state.curOp.slice(0); + this.curCycle = state.curCycle; + this.reg = $.extend({}, state.reg); + }, + reset: function() { + this.reg = { + PC: 0, + A: 0, + X: 0, + Y: 0, + S: 0, + P: 0x20, + + // Might be useful for intermediate addressing steps + operated: false, + writeflag: false, + writeonly: false, + printed: false, + operand: null, + origPC: null, + addr: null, + tmp1: null, + tmp2: null, + tmp3: null, + tmp4: null + }; + this.clock = 0; + this.printedTo = 0; + this.halted = false; + this.resetOp(); + }, + resetOp: function() { + this.curOp.length = 0; + this.curCycle = 0; + this.reg.operated = false; + this.reg.writeflag = false; + this.reg.writeonly = false; + this.reg.printed = false; + this.reg.operand = null; + this.reg.origPC = null; + this.reg.addr = null; + this.reg.tmp1 = null; + this.reg.tmp2 = null; + this.reg.tmp3 = null; + this.reg.tmp4 = null; + }, + init: function() { + this.reset(); + } + }; +}); diff --git a/commodoreclicker/js/c64/disk.js b/commodoreclicker/js/c64/disk.js new file mode 100644 index 00000000..720d7572 --- /dev/null +++ b/commodoreclicker/js/c64/disk.js @@ -0,0 +1,486 @@ +define(function() { + return { + IEC_ID: 8, + iec: { + state: null, + statetime: null, + eoi: null, + prevclk: null, + prevatn: null, + data: null, + bitpos: null, + dataready: null, + datalast: null + }, + + listening: false, + talking: false, + currCommand: null, + currChannel: null, + currFilename: [], + currFileEntry: null, + currFilePos: null, + + diskData: null, + directory: [], + sectorPositions: [ + 0, 21, 42, 63, 84, + 105, 126, 147, 168, 189, + 210, 231, 252, 273, 294, + 315, 336, 357, 376, 395, + 414, 433, 452, 471, 490, + 508, 526, 544, 562, 580, + 598, 615, 632, 649, 666 + ], + + load: function(data) { + this.diskData = new Uint8Array(data); + var i, j, pos, track, sector, content, res, file; + + // Ignore the BAM for now, since we can't save + + // Read the directory + track = 18; sector = 1; + do { + res = this.readSector(track, sector, true); + track = res.nextTrack; + sector = res.nextSector; + content = res.content; + + for (i = 0; i < 8; i++) { + pos = i * 32; + file = { + type: content[pos + 2] & 15, + locked: !!(content[pos + 2] & 64), + closed: !!(content[pos + 2] & 128), + startTrack: content[pos + 3], + startSector: content[pos + 4], + name: new Uint8Array(16), + sectorCount: content[pos + 30] + (content[pos + 31] * 256) + }; + + // We have to assume the size is valid, but it shouldn't + // be egregiously oversized + file.length = file.sectorCount * 254; + if (file.sectorCount < 1024) { + file.data = new Uint8Array(file.length); + } + + for (j = 0; j < 16; j++) { + if (content[pos + 5 + j] != 0xA0) { + file.name[j] = content[pos + 5 + j]; + } + } + + if (file.startTrack) { + this.directory.push(file); + } + } + } while (track); + + for (i = 0; i < this.directory.length; i++) { + track = this.directory[i].startTrack; + sector = this.directory[i].startSector; + pos = 0; + do { + res = this.readSector(track, sector); + track = res.nextTrack; + sector = res.nextSector; + + for (j = 0; j < 254; j++) { + this.directory[i].data[pos++] = res.content[j]; + } + } while (track); + } + }, + readSector: function(track, sector, padTop) { + var pos = (this.sectorPositions[track - 1] + sector) * 256; + var i, len, content = [], nextTrack, nextSector; + + nextTrack = this.diskData[pos++]; + nextSector = this.diskData[pos++]; + if (padTop) { + pos -= 2; + len = 256; + } else { + len = 254; + } + for (i = 0; i < len; i++, pos++) { + content[i] = this.diskData[pos]; + } + + return { + nextTrack: nextTrack, + nextSector: nextSector, + content: content + }; + }, + + command: function() { + switch (this.iec.data & 0xF0) { + case 0x20: + if ((this.iec.data & 0x0F) == this.IEC_ID) { + this.listening = true; + this.currCommand = ''; + } + break; + case 0x30: + this.listening = false; + this.currCommand = ''; + break; + case 0x40: + if ((this.iec.data & 0x0F) == this.IEC_ID) { + this.talking = true; + } + break; + case 0x50: + this.talking = false; + break; + case 0x60: + // DATA + this.currCommand = 'DATA'; + if (this.talking) { + // Sending a file to the computer; which file? + if (this.currFilename.length == 1 && this.currFilename[0] == 42) { + // *: Load first file + this.currFileEntry = 0; + } else { + this.currFileEntry = -1; + for (i = 0; i < this.directory.length; i++) { + for (j = 0, m = 0; j < this.currFilename.length; j++) { + if (this.currFilename[j] == this.directory[i].name[j]) { + m++; + } + } + if (m == this.currFilename.length) { + this.currFileEntry = i; + break; + } + } + + // If still -1, the file was not found + } + } + break; + case 0xE0: + // CLOSE + this.currCommand = 'CLOSE'; + break; + case 0xF0: + // OPEN + if (this.listening) { + this.currCommand = 'OPEN'; + this.currChannel = this.iec.data & 0x0F; + this.currFilename.length = 0; + this.currFilePos = 0; + } + break; + } + }, + recv: function() { + var i, j, m; + switch (this.currCommand) { + case 'OPEN': + this.currFilename.push(this.iec.data); + break; + } + }, + send: function() { + if (this.talking) { + // Sending file data (if the file exists) + if ( + this.currFileEntry !== null && this.currFileEntry != -1 && + this.currFilePos < this.directory[this.currFileEntry].length + ) { + this.iec.dataready = true; + this.iec.data = this.directory[this.currFileEntry].data[this.currFilePos++]; + this.iec.datalast = (this.currFilePos == this.directory[this.currFileEntry].length); + } else { + this.iec.dataready = false; + } + } + }, + getFileProgress: function() { + if (this.talking) { + if ( + this.currFileEntry !== null && this.currFileEntry != -1 && + this.currFilePos < this.directory[this.currFileEntry].length + ) { + return (this.currFilePos * 100) / this.directory[this.currFileEntry].length; + } + } + + return 0; + }, + getState: function() { + return { + iec: $.extend({}, this.iec), + listening: this.listening, + talking: this.talking, + currCommand: this.currCommand, + currChannel: this.currChannel, + currFilename: this.currFilename.slice(0), + currFilePos: this.currFilePos + }; + }, + setState: function(state) { + this.iec = $.extend({}, state.iec); + this.listening = state.listening; + this.talking = state.talking; + this.currCommand = state.currCommand; + this.currChannel = state.currChannel; + this.currFilename = state.currFilename.slice(0); + this.currFilePos = state.currFilePos; + }, + step: function() { + var val, prevState = this.iec.state; + this.iec.statetime++; + + if (!this.iec.prevatn && this.owner.IEC.check('ATN')) { + // Hey! Hey disk! Hey disk, hey! + this.iec.prevatn = true; + this.iec.state = 16; + this.iec.statetime = 0; + return; + } + + switch (this.iec.state) { + // Initial state: waiting for talker + case 0: + if (this.iec.prevclk && !this.owner.IEC.check('CLK')) { + // Talker has indicated Ready to Send + // We should indicate Ready to Listen + this.owner.IEC.log(this.IEC_ID, 'received Ready-to-send'); + this.iec.state = 1; + } + break; + + // About to indicate ready-to-listen + case 1: + if (this.iec.statetime >= 60) { + this.owner.IEC.log(this.IEC_ID, 'indicates Ready-to-listen'); + this.owner.IEC.release(this.IEC_ID, 'DATA'); + if (this.owner.IEC.check('DATA')) { + // DATA is still pulled after we released it + // Talker is indicating it wishes to turnaround + this.owner.IEC.log(this.IEC_ID, 'received turnaround'); + this.iec.state = 6; + this.owner.IEC.pulldown(this.IEC_ID, 'CLK'); + } else { + this.iec.state = 2; + } + } + break; + + // Awaiting data and/or EOI + case 2: + if (this.owner.IEC.check('CLK')) { + // Talker will proceed to send + this.owner.IEC.log(this.IEC_ID, 'awaiting data'); + this.iec.prevclk = true; + this.iec.state = 3; + this.iec.data = 0; + this.iec.bitpos = 0; + } else if (!this.iec.eoi && this.iec.statetime >= 200) { + // Over 200us have passed without CLK going high + // Talker is indicating End of Indicator + this.owner.IEC.log(this.IEC_ID, 'entering EOI'); + this.owner.IEC.pulldown(this.IEC_ID, 'DATA'); + this.iec.state = 7; + } + break; + + // Data reception + case 3: + if (this.iec.prevclk && !this.owner.IEC.check('CLK')) { + // CLK rising edge, pull a bit + // Note that data levels are reversed + val = this.owner.IEC.check('DATA') + ? 0 + : (1 << this.iec.bitpos); + this.owner.IEC.log(this.IEC_ID, 'got bit '+val); + this.iec.data |= val; + } else if (!this.iec.prevclk && this.owner.IEC.check('CLK')) { + // CLK falling edge, advance a bit + this.iec.bitpos++; + this.owner.IEC.log(this.IEC_ID, 'advancing'); + if (this.iec.bitpos == 8) { + // Data is complete + this.owner.IEC.log(this.IEC_ID, 'received data '+this.iec.data); + this.iec.state = 4; + } + } + this.iec.prevclk = this.owner.IEC.check('CLK'); + break; + + // End-of-byte ack + case 4: + if (this.iec.statetime >= 60) { + // Acknowledge end of data, act thereon + this.owner.IEC.pulldown(this.IEC_ID, 'DATA'); + this.iec.state = 5; + + if (this.owner.IEC.check('ATN')) { + // Command issued + this.owner.IEC.log(this.IEC_ID, 'command '+this.iec.data); + this.command(); + } else { + this.owner.IEC.log(this.IEC_ID, 'data '+this.iec.data); + this.recv(); + } + } + break; + + // Post-byte timeout + case 5: + if (this.iec.statetime >= 20) { + this.iec.state = 0; + } + break; + + // Post-turnaround timeout + case 6: + if (this.iec.statetime >= 80) { + this.owner.IEC.log(this.IEC_ID, 'turned around'); + this.owner.IEC.release(this.IEC_ID, 'DATA'); + this.iec.state = 8; + } + break; + + // EOI ack + case 7: + if (this.iec.statetime >= 60) { + // EOI has been acknowledged for 60us, await data + this.owner.IEC.log(this.IEC_ID, 'acknowledged EOI'); + this.owner.IEC.release(this.IEC_ID, 'DATA'); + this.iec.state = 2; + this.iec.eoi = true; + } + break; + + case 8: + if (this.iec.statetime >= 60) { + this.send(); + if (this.iec.dataready) { + // Ready to send, await acknowledgement + this.owner.IEC.log(this.IEC_ID, 'ready to send'); + this.owner.IEC.release(this.IEC_ID, 'CLK'); + this.iec.state = 9; + } + } + break; + case 9: + this.iec.dataready = false; + if (!this.owner.IEC.check('DATA')) { + // Ack'd, indicate EOI if necessary + if (this.iec.datalast) { + // Refuse to start data until EOI ack'd + this.owner.IEC.log(this.IEC_ID, 'awaiting EOI ack'); + this.iec.state = 14; + this.iec.bitpos = 0; + } else { + // Ready to fire + if (this.iec.statetime >= 80) { + this.owner.IEC.log(this.IEC_ID, 'sending byte '+this.currFilePos + ' of '+this.directory[0].length); + this.owner.IEC.pulldown(this.IEC_ID, 'CLK'); + this.iec.state = 10; + this.iec.bitpos = 0; + } + } + } + break; + case 10: + // Sending one bit + this.iec.datalast = false; + if (this.iec.statetime >= 60) { + val = (this.iec.data & (1 << this.iec.bitpos)); + this.owner.IEC.log(this.IEC_ID, 'sending '+val+' at bit '+this.iec.bitpos); + this.owner.IEC[val ? 'release' : 'pulldown'](this.IEC_ID, 'DATA'); + this.iec.state = 11; + this.iec.bitpos++; + } + break; + case 11: + // Bit ready for latching + if (this.iec.statetime >= 60) { + this.owner.IEC.release(this.IEC_ID, 'CLK'); + this.iec.state = 12; + } + break; + case 12: + // Signalling end of bit + if (this.iec.statetime >= 60) { + this.owner.IEC.pulldown(this.IEC_ID, 'CLK'); + this.owner.IEC.release(this.IEC_ID, 'DATA'); + this.iec.state = (this.iec.bitpos < 8) ? 10 : 13; + } + break; + case 13: + if (this.iec.statetime >= 20) { + if (this.owner.IEC.check('DATA')) { + this.owner.IEC.log(this.IEC_ID, 'byte acknowledged'); + this.iec.state = 8; + if (this.currFilePos == this.directory[0].length) { + // Turnaround back to listening + this.owner.IEC.log(this.IEC_ID, 'turning back around'); + this.owner.IEC.release(this.IEC_ID, 'CLK'); + this.owner.IEC.pulldown(this.IEC_ID, 'DATA'); + this.iec.state = 0; + } + } + } + break; + case 14: + // EOI handshake, step 1: data high + if (this.owner.IEC.check('DATA')) { + this.iec.state = 15; + } + break; + case 15: + // EOI handshake, step 2: data low again + if (!this.owner.IEC.check('DATA')) { + this.owner.IEC.pulldown(this.IEC_ID, 'CLK'); + this.iec.state = 10; + this.iec.bitpos = 0; + } + break; + + // ATN pulled down by the computer + case 16: + if (this.iec.statetime >= 60) { + this.atnReset(); + } + break; + } + + if (this.iec.state != prevState) { + this.iec.statetime = 0; + } + this.iec.prevatn = this.owner.IEC.check('ATN'); + this.iec.prevclk = this.owner.IEC.check('CLK'); + }, + atnReset: function() { + this.owner.IEC.register(this.IEC_ID); + this.owner.IEC.pulldown(this.IEC_ID, 'DATA'); + this.iec.state = 0; + this.iec.statetime = 0; + this.iec.eoi = false; + this.iec.data = 0; + this.iec.bitpos = 0; + this.iec.dataready = false; + this.iec.datalast = false; + }, + reset: function() { + this.atnReset(); + this.iec.prevclk = true; + this.listening = false; + this.talking = false; + this.currCommand = null; + this.currChannel = null; + this.currFilename.length = 0; + //this.directory.length = 0; + }, + init: function() { + } + }; +}); diff --git a/commodoreclicker/js/c64/iec.js b/commodoreclicker/js/c64/iec.js new file mode 100644 index 00000000..8b9873a8 --- /dev/null +++ b/commodoreclicker/js/c64/iec.js @@ -0,0 +1,63 @@ +define(function() { + return { + lines: {}, + devices: [], + + register: function(device) { + if (!this.lines[device]) { + this.devices.push(device); + } + this.lines[device] = { + ATN: false, + CLK: false, + DATA: false + }; + }, + log: function(device, str) { + if (this.owner.game.debug) { + console.log('[IEC] {'+this.owner.CPU.clock+'} Device '+device+' '+str); + } + }, + pulldown: function(device, line) { + if (!this.lines[device][line]) { + this.log(device, 'pulling down '+line); + } + this.lines[device][line] = true; + }, + release: function(device, line) { + if (this.lines[device][line]) { + this.log(device, 'releasing '+line); + } + this.lines[device][line] = false; + }, + check: function(line) { + for (var i = 0; i < this.devices.length; i++) { + if (this.lines[this.devices[i]][line]) { + return true; + } + } + return false; + }, + getState: function() { + return $.extend({}, this.lines); + }, + setState: function(state) { + this.lines = $.extend({}, state); + }, + signal: function(line) { + if (line == 'RESET') { + this.owner.DISK.reset(); + } + }, + reset: function() { + var i; + this.lines = {}; + for (i in this.devices) { + this.register(this.devices[i]); + } + }, + init: function() { + this.lines = {}; + } + }; +}); diff --git a/commodoreclicker/js/c64/main.js b/commodoreclicker/js/c64/main.js new file mode 100644 index 00000000..56231600 --- /dev/null +++ b/commodoreclicker/js/c64/main.js @@ -0,0 +1,182 @@ +define([ + 'c64/vic', + 'c64/mmu', + 'c64/cpu', + 'c64/iec', + 'c64/cia', + 'c64/disk', + 'thirdparty/jquery-ajax-blob-arraybuffer', + 'thirdparty/jszip/dist/jszip.min' +], function(VIC, MMU, CPU, IEC, CIA, DISK, blob, JSZip) { + var C64 = { + MMU: MMU, + CPU: CPU, + IEC: IEC, + CIA: CIA, + DISK: DISK, + VIC: VIC + }; + for (var i in C64) { + if (C64.hasOwnProperty(i)) { + C64[i].owner = C64; + C64[i].init.call(C64[i]); + } + } + C64.reset = function() { + C64.MMU.reset(); + C64.CPU.reset(); + C64.IEC.reset(); + C64.CIA.reset(); + C64.DISK.reset(); + C64.VIC.reset(); + C64.saveFrame(0, 1); + }; + + C64.savedFrames = {}; + C64.saveFrame = function(frame, numFrames) { + if (C64.savedFrames[frame]) { + return; + } + if (numFrames > 2) { + numFrames = 2; + } + C64.savedFrames[frame] = { + MMU: C64.MMU.getState(), + CPU: C64.CPU.getState(), + IEC: C64.IEC.getState(), + CIA: C64.CIA.getState(), + DISK: C64.DISK.getState(), + VIC: C64.VIC.getState() + }; + for (i in C64.savedFrames) { + if (i > 0 && i < (frame - numFrames)) { + delete C64.savedFrames[i]; + } + } + }; + C64.restoreFrame = function(frame) { + if (!C64.savedFrames[frame]) { + frame = 0; + } + for (i in C64.savedFrames[frame]) { + C64[i].setState(C64.savedFrames[frame][i]); + } + }; + C64.dropFrame = function(frame) { + if (C64.savedFrames[frame]) { + delete C64.savedFrames[frame]; + } + }; + + C64.loadPrg = function(prg) { + var promise = $.Deferred(); + + $.ajax({ + url: prg, + dataType: 'arraybuffer', + beforeSend: function(xhr) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + }).done(function(data) { + var content = new Uint8Array(data); + var pc = content[0] + (content[1] * 256); + for (var i = 2; i < content.length; i++) { + this.MMU.ram[pc+i] = content[i]; + } + this.CPU.reg.PC = pc; + promise.resolve(); + }.bind(this)); + + return promise; + }; + + C64.loadDisk = function(d64) { + var promise = $.Deferred(); + + $.ajax({ + url: d64, + dataType: 'arraybuffer', + beforeSend: function(xhr) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + }).done(function(data) { + this.dropFrame(0); + this.CPU.reset(); + this.MMU.reset(); + this.IEC.reset(); + this.CIA.reset(); + this.DISK.reset(); + this.VIC.reset(); + + this.VIC.renderPixels(this.VIC.sizes.FRAME_SIZE * 10); + + for (var i = 0; i < 65536; i++) { + this.MMU.ram[i] = DISK.loadDump[i]; + } + this.CPU.reg.A = 0x00; + this.CPU.reg.X = 0x0C; + this.CPU.reg.Y = 0x26; + this.CPU.reg.PC = 0xE168; + this.CPU.reg.S = 0xE9; + + this.DISK.load(data); + this.saveFrame(0, 1); + promise.resolve(); + }.bind(this)); + + return promise; + }; + + C64.loadGame = function() { + var promise = $.Deferred(); + + $.ajax({ + url: '/rom/game.zip', + dataType: 'arraybuffer', + beforeSend: function(xhr) { + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + } + }).done(function(data) { + this.dropFrame(0); + this.CPU.reset(); + this.MMU.reset(); + + var i, zip = new JSZip(); + zip.load(data); + + var kernal = zip.file('kernal.rom').asUint8Array(), + basic = zip.file('basic.rom').asUint8Array(), + game = zip.file('game.bin').asUint8Array(), + loadDump = zip.file('loadram.bin').asUint8Array(); + + for (var i = 0; i < kernal.length; i++) { + this.MMU.romKernal[i] = kernal[i]; + } + for (var i = 0; i < basic.length; i++) { + this.MMU.romBasic[i] = basic[i]; + } + for (var i = 0; i < game.length; i++) { + this.MMU.ram[0xC000 + i] = game[i]; + } + + DISK.loadDump = new Uint8Array(loadDump); + + this.IEC.reset(); + this.CIA.reset(); + this.DISK.reset(); + this.VIC.reset(); + + this.VIC.renderPixels(this.VIC.sizes.FRAME_SIZE * 10); + this.CPU.reg.PC = 0xC000; + + this.VIC.backContext.fillStyle = 'black'; + this.VIC.backContext.fillRect(0, 0, this.VIC.sizes.RASTER_LENGTH, this.VIC.sizes.RASTER_COUNT); + this.saveFrame(0, 1); + promise.resolve(); + }.bind(this)); + + return promise; + }; + + return C64; +}); diff --git a/commodoreclicker/js/c64/mmu.js b/commodoreclicker/js/c64/mmu.js new file mode 100644 index 00000000..a5634750 --- /dev/null +++ b/commodoreclicker/js/c64/mmu.js @@ -0,0 +1,269 @@ +define(function() { + return { + busLock: null, + vicBank: null, + CHAREN: null, + HIRAM: null, + LORAM: null, + + ram: null, + romBasic: null, + romKernal: null, + charRom: null, + + r: function(addr) { + switch (addr & 0xF000) { + case 0x0000: + case 0x1000: + case 0x2000: + case 0x3000: + case 0x4000: + case 0x5000: + case 0x6000: + case 0x7000: + case 0x8000: + case 0x9000: + return this.ram[addr]; + case 0xA000: + case 0xB000: + return (this.LORAM && this.HIRAM) + ? this.romBasic[addr & 0x1FFF] + : this.ram[addr]; + case 0xC000: + return this.ram[addr]; + case 0xD000: + return (this.LORAM || this.HIRAM) + ? (this.CHAREN + ? this.io_r(addr & 0x0FFF) + : this.charRom[addr & 0x0FFF]) + : this.ram[addr]; + case 0xE000: + case 0xF000: + return this.HIRAM + ? this.romKernal[addr & 0x1FFF] + : this.ram[addr]; + } + }, + w: function(addr, val) { + if (addr == 0x0001) { + this.CHAREN = !!(val & 4); + this.HIRAM = !!(val & 2); + this.LORAM = !!(val & 1); + } else if ((addr & 0xF000) == 0xD000 && this.CHAREN) { + this.io_w(addr & 0x0FFF, val); + } + this.ram[addr] = val; + }, + io_r: function(addr) { + switch (addr & 0xF00) { + case 0x000: + case 0x100: + case 0x200: + case 0x300: + return this.owner.VIC.io_r(addr); + case 0x800: + case 0x900: + case 0xA00: + case 0xB00: + return this.owner.VIC.colorRam[addr & 0x03FF]; + case 0xC00: + case 0xD00: + return this.owner.CIA.io_r(addr); + case 0xE00: + if ((addr & 0x00FF) == 0) { + return ( + (this.owner.game.effects.rasterbars ? 1 : 0) + + (this.owner.game.effects.scrollshake ? 2 : 0) + + (this.owner.game.effects.sprite ? 4 : 0) + + (this.owner.game.effects.doublesprite ? 8 : 0) + ); + } + break; + } + return 0; + }, + io_w: function(addr, val) { + switch (addr & 0xF00) { + case 0x000: + case 0x100: + case 0x200: + case 0x300: + this.owner.VIC.io_w(addr, val); + break; + case 0x800: + case 0x900: + case 0xA00: + case 0xB00: + if ((addr & 0x03FF) >= 1000) { + return; + } + this.owner.VIC.colorRam[addr & 0x03FF] = val & 15; + break; + case 0xC00: + case 0xD00: + this.owner.CIA.io_w(addr, val); + break; + } + }, + getState: function() { + return { + ram: new Uint8Array(this.ram), + busLock: this.busLock + 0 + }; + }, + setState: function(state) { + this.ram = new Uint8Array(state.ram); + this.busLock = 0 + state.busLock; + }, + reset: function() { + this.busLock = 0; + this.vicBank = 0; + this.CHAREN = true; + this.HIRAM = true; + this.LORAM = true; + }, + init: function() { + var i, j; + + this.ram = new Uint8Array(65536); + this.romBasic = new Uint8Array(8192); + this.romKernal = new Uint8Array(8192); + this.charRom = new Uint8Array(4096); + + this.reset(); + for (i = 0, j = this.charRomSrc.match(/.{2}/g); i < 4096; i++) { + this.charRom[i] = parseInt(j[i], 16); + } + }, + charRomSrc: [ + '3c666e6e60623c00183c667e666666007c66667c66667c003c66606060663c00', + '786c6666666c78007e60607860607e007e606078606060003c66606e66663c00', + '6666667e666666003c18181818183c001e0c0c0c0c6c3800666c7870786c6600', + '6060606060607e0063777f6b6363630066767e7e6e6666003c66666666663c00', + '7c66667c606060003c666666663c0e007c66667c786c66003c66603c06663c00', + '7e181818181818006666666666663c0066666666663c18006363636b7f776300', + '66663c183c6666006666663c181818007e060c1830607e003c30303030303c00', + '0c12307c3062fc003c0c0c0c0c0c3c0000183c7e181818180010307f7f301000', + '0000000000000000181818180000180066666600000000006666ff66ff666600', + '183e603c067c180062660c18306646003c663c3867663f00060c180000000000', + '0c18303030180c0030180c0c0c18300000663cff3c6600000018187e18180000', + '00000000001818300000007e0000000000000000001818000003060c18306000', + '3c666e7666663c001818381818187e003c66060c30607e003c66061c06663c00', + '060e1e667f0606007e607c0606663c003c66607c66663c007e660c1818181800', + '3c66663c66663c003c66663e06663c0000001800001800000000180000181830', + '0e18306030180e0000007e007e00000070180c060c1870003c66060c18001800', + '000000ffff000000081c3e7f7f1c3e001818181818181818000000ffff000000', + '0000ffff0000000000ffff000000000000000000ffff00003030303030303030', + '0c0c0c0c0c0c0c0c000000e0f038181818181c0f07000000181838f0e0000000', + 'c0c0c0c0c0c0ffffc0e070381c0e070303070e1c3870e0c0ffffc0c0c0c0c0c0', + 'ffff030303030303003c7e7e7e7e3c000000000000ffff00367f7f7f3e1c0800', + '6060606060606060000000070f1c1818c3e77e3c3c7ee7c3003c7e66667e3c00', + '1818666618183c000606060606060606081c3e7f3e1c0800181818ffff181818', + 'c0c03030c0c0303018181818181818180000033e76363600ff7f3f1f0f070301', + '0000000000000000f0f0f0f0f0f0f0f000000000ffffffffff00000000000000', + '00000000000000ffc0c0c0c0c0c0c0c0cccc3333cccc33330303030303030303', + '00000000cccc3333fffefcf8f0e0c08003030303030303031818181f1f181818', + '000000000f0f0f0f1818181f1f000000000000f8f8181818000000000000ffff', + '0000001f1f181818181818ffff000000000000ffff181818181818f8f8181818', + 'c0c0c0c0c0c0c0c0e0e0e0e0e0e0e0e00707070707070707ffff000000000000', + 'ffffff00000000000000000000ffffff030303030303ffff00000000f0f0f0f0', + '0f0f0f0f00000000181818f8f8000000f0f0f0f000000000f0f0f0f00f0f0f0f', + 'c39991919f99c3ffe7c39981999999ff83999983999983ffc3999f9f9f99c3ff', + '87939999999387ff819f9f879f9f81ff819f9f879f9f9fffc3999f919999c3ff', + '99999981999999ffc3e7e7e7e7e7c3ffe1f3f3f3f393c7ff9993878f879399ff', + '9f9f9f9f9f9f81ff9c8880949c9c9cff99898181919999ffc39999999999c3ff', + '839999839f9f9fffc399999999c3f1ff83999983879399ffc3999fc3f999c3ff', + '81e7e7e7e7e7e7ff999999999999c3ff9999999999c3e7ff9c9c9c9480889cff', + '9999c3e7c39999ff999999c3e7e7e7ff81f9f3e7cf9f81ffc3cfcfcfcfcfc3ff', + 'f3edcf83cf9d03ffc3f3f3f3f3f3c3ffffe7c381e7e7e7e7ffefcf8080cfefff', + 'ffffffffffffffffe7e7e7e7ffffe7ff999999ffffffffff99990099009999ff', + 'e7c19fc3f983e7ff9d99f3e7cf99b9ffc399c3c79899c0fff9f3e7ffffffffff', + 'f3e7cfcfcfe7f3ffcfe7f3f3f3e7cfffff99c300c399ffffffe7e781e7e7ffff', + 'ffffffffffe7e7cfffffff81ffffffffffffffffffe7e7fffffcf9f3e7cf9fff', + 'c39991899999c3ffe7e7c7e7e7e781ffc399f9f3cf9f81ffc399f9e3f999c3ff', + 'f9f1e19980f9f9ff819f83f9f999c3ffc3999f839999c3ff8199f3e7e7e7e7ff', + 'c39999c39999c3ffc39999c1f999c3ffffffe7ffffe7ffffffffe7ffffe7e7cf', + 'f1e7cf9fcfe7f1ffffff81ff81ffffff8fe7f3f9f3e78fffc399f9f3e7ffe7ff', + 'ffffff0000fffffff7e3c18080e3c1ffe7e7e7e7e7e7e7e7ffffff0000ffffff', + 'ffff0000ffffffffff0000ffffffffffffffffff0000ffffcfcfcfcfcfcfcfcf', + 'f3f3f3f3f3f3f3f3ffffff1f0fc7e7e7e7e7e3f0f8ffffffe7e7c70f1fffffff', + '3f3f3f3f3f3f00003f1f8fc7e3f1f8fcfcf8f1e3c78f1f3f00003f3f3f3f3f3f', + '0000fcfcfcfcfcfcffc381818181c3ffffffffffff0000ffc9808080c1e3f7ff', + '9f9f9f9f9f9f9f9ffffffff8f0e3e7e73c1881c3c381183cffc381999981c3ff', + 'e7e79999e7e7c3fff9f9f9f9f9f9f9f9f7e3c180c1e3f7ffe7e7e70000e7e7e7', + '3f3fcfcf3f3fcfcfe7e7e7e7e7e7e7e7fffffcc189c9c9ff0080c0e0f0f8fcfe', + 'ffffffffffffffff0f0f0f0f0f0f0f0fffffffff0000000000ffffffffffffff', + 'ffffffffffffff003f3f3f3f3f3f3f3f3333cccc3333ccccfcfcfcfcfcfcfcfc', + 'ffffffff3333cccc000103070f1f3f7ffcfcfcfcfcfcfcfce7e7e7e0e0e7e7e7', + 'fffffffff0f0f0f0e7e7e7e0e0ffffffffffff0707e7e7e7ffffffffffff0000', + 'ffffffe0e0e7e7e7e7e7e70000ffffffffffff0000e7e7e7e7e7e70707e7e7e7', + '3f3f3f3f3f3f3f3f1f1f1f1f1f1f1f1ff8f8f8f8f8f8f8f80000ffffffffffff', + '000000ffffffffffffffffffff000000fcfcfcfcfcfc0000ffffffff0f0f0f0f', + 'f0f0f0f0ffffffffe7e7e70707ffffff0f0f0f0fffffffff0f0f0f0ff0f0f0f0', + '3c666e6e60623c0000003c063e663e000060607c66667c0000003c6060603c00', + '0006063e66663e0000003c667e603c00000e183e1818180000003e66663e067c', + '0060607c666666000018003818183c00000600060606063c0060606c786c6600', + '0038181818183c000000667f7f6b630000007c666666660000003c6666663c00', + '00007c66667c606000003e66663e060600007c666060600000003e603c067c00', + '00187e1818180e000000666666663e0000006666663c18000000636b7f3e3600', + '0000663c183c660000006666663e0c7800007e0c18307e003c30303030303c00', + '0c12307c3062fc003c0c0c0c0c0c3c0000183c7e181818180010307f7f301000', + '0000000000000000181818180000180066666600000000006666ff66ff666600', + '183e603c067c180062660c18306646003c663c3867663f00060c180000000000', + '0c18303030180c0030180c0c0c18300000663cff3c6600000018187e18180000', + '00000000001818300000007e0000000000000000001818000003060c18306000', + '3c666e7666663c001818381818187e003c66060c30607e003c66061c06663c00', + '060e1e667f0606007e607c0606663c003c66607c66663c007e660c1818181800', + '3c66663c66663c003c66663e06663c0000001800001800000000180000181830', + '0e18306030180e0000007e007e00000070180c060c1870003c66060c18001800', + '000000ffff000000183c667e666666007c66667c66667c003c66606060663c00', + '786c6666666c78007e60607860607e007e606078606060003c66606e66663c00', + '6666667e666666003c18181818183c001e0c0c0c0c6c3800666c7870786c6600', + '6060606060607e0063777f6b6363630066767e7e6e6666003c66666666663c00', + '7c66667c606060003c666666663c0e007c66667c786c66003c66603c06663c00', + '7e181818181818006666666666663c0066666666663c18006363636b7f776300', + '66663c183c6666006666663c181818007e060c1830607e00181818ffff181818', + 'c0c03030c0c0303018181818181818183333cccc3333cccc3399cc663399cc66', + '0000000000000000f0f0f0f0f0f0f0f000000000ffffffffff00000000000000', + '00000000000000ffc0c0c0c0c0c0c0c0cccc3333cccc33330303030303030303', + '00000000cccc3333cc993366cc99336603030303030303031818181f1f181818', + '000000000f0f0f0f1818181f1f000000000000f8f8181818000000000000ffff', + '0000001f1f181818181818ffff000000000000ffff181818181818f8f8181818', + 'c0c0c0c0c0c0c0c0e0e0e0e0e0e0e0e00707070707070707ffff000000000000', + 'ffffff00000000000000000000ffffff0103066c7870600000000000f0f0f0f0', + '0f0f0f0f00000000181818f8f8000000f0f0f0f000000000f0f0f0f00f0f0f0f', + 'c39991919f99c3ffffffc3f9c199c1ffff9f9f83999983ffffffc39f9f9fc3ff', + 'fff9f9c19999c1ffffffc399819fc3fffff1e7c1e7e7e7ffffffc19999c1f983', + 'ff9f9f83999999ffffe7ffc7e7e7c3fffff9fff9f9f9f9c3ff9f9f93879399ff', + 'ffc7e7e7e7e7c3ffffff998080949cffffff8399999999ffffffc3999999c3ff', + 'ffff839999839f9fffffc19999c1f9f9ffff83999f9f9fffffffc19fc3f983ff', + 'ffe781e7e7e7f1ffffff99999999c1ffffff999999c3e7ffffff9c9480c1c9ff', + 'ffff99c3e7c399ffffff999999c1f387ffff81f3e7cf81ffc3cfcfcfcfcfc3ff', + 'f3edcf83cf9d03ffc3f3f3f3f3f3c3ffffe7c381e7e7e7e7ffefcf8080cfefff', + 'ffffffffffffffffe7e7e7e7ffffe7ff999999ffffffffff99990099009999ff', + 'e7c19fc3f983e7ff9d99f3e7cf99b9ffc399c3c79899c0fff9f3e7ffffffffff', + 'f3e7cfcfcfe7f3ffcfe7f3f3f3e7cfffff99c300c399ffffffe7e781e7e7ffff', + 'ffffffffffe7e7cfffffff81ffffffffffffffffffe7e7fffffcf9f3e7cf9fff', + 'c39991899999c3ffe7e7c7e7e7e781ffc399f9f3cf9f81ffc399f9e3f999c3ff', + 'f9f1e19980f9f9ff819f83f9f999c3ffc3999f839999c3ff8199f3e7e7e7e7ff', + 'c39999c39999c3ffc39999c1f999c3ffffffe7ffffe7ffffffffe7ffffe7e7cf', + 'f1e7cf9fcfe7f1ffffff81ff81ffffff8fe7f3f9f3e78fffc399f9f3e7ffe7ff', + 'ffffff0000ffffffe7c39981999999ff83999983999983ffc3999f9f9f99c3ff', + '87939999999387ff819f9f879f9f81ff819f9f879f9f9fffc3999f919999c3ff', + '99999981999999ffc3e7e7e7e7e7c3ffe1f3f3f3f393c7ff9993878f879399ff', + '9f9f9f9f9f9f81ff9c8880949c9c9cff99898181919999ffc39999999999c3ff', + '839999839f9f9fffc399999999c3f1ff83999983879399ffc3999fc3f999c3ff', + '81e7e7e7e7e7e7ff999999999999c3ff9999999999c3e7ff9c9c9c9480889cff', + '9999c3e7c39999ff999999c3e7e7e7ff81f9f3e7cf9f81ffe7e7e70000e7e7e7', + '3f3fcfcf3f3fcfcfe7e7e7e7e7e7e7e7cccc3333cccc3333cc663399cc663399', + 'ffffffffffffffff0f0f0f0f0f0f0f0fffffffff0000000000ffffffffffffff', + 'ffffffffffffff003f3f3f3f3f3f3f3f3333cccc3333ccccfcfcfcfcfcfcfcfc', + 'ffffffff3333cccc3366cc993366cc99fcfcfcfcfcfcfcfce7e7e7e0e0e7e7e7', + 'fffffffff0f0f0f0e7e7e7e0e0ffffffffffff0707e7e7e7ffffffffffff0000', + 'ffffffe0e0e7e7e7e7e7e70000ffffffffffff0000e7e7e7e7e7e70707e7e7e7', + '3f3f3f3f3f3f3f3f1f1f1f1f1f1f1f1ff8f8f8f8f8f8f8f80000ffffffffffff', + '000000ffffffffffffffffffff000000fefcf993878f9fffffffffff0f0f0f0f', + 'f0f0f0f0ffffffffe7e7e70707ffffff0f0f0f0fffffffff0f0f0f0ff0f0f0f0' + ].join('') + }; +}); diff --git a/commodoreclicker/js/c64/vic.js b/commodoreclicker/js/c64/vic.js new file mode 100644 index 00000000..e3e8bce1 --- /dev/null +++ b/commodoreclicker/js/c64/vic.js @@ -0,0 +1,886 @@ +define(function() { + return { + colorRam: null, + curLineScr: null, + curLineCol: null, + curLineSpr: null, + spriteRasters: [], + rasterModes: [], + + backCanvas: null, + backContext: null, + renderedFrames: {}, + frames: null, + thisFrame: null, + + SCREENPTR: null, + CHARPTR: null, + IRM: null, + RSEL: null, + CSEL: null, + DISPLAY: null, + HIRES: null, + EXTCOLOR : null, + MULTICOLOR: null, + XSCROLL: null, + YSCROLL: null, + BORDER: null, + BG0: null, + BG1: null, + BG2: null, + BG3: null, + RASTER: null, + RASTERHIT: null, + + VC: null, + VCBASE: null, + RC: null, + BADLINEEN: null, + IDLE: null, + + stateVars: [ + 'SCREENPTR', 'CHARPTR', 'IRM', 'RSEL', 'CSEL', + 'DISPLAY', 'HIRES', 'EXTCOLOR', 'MULTICOLOR', + 'XSCROLL', 'YSCROLL', 'BORDER', 'BG0', 'BG1', + 'BG2', 'BG3', 'RASTER', 'RASTERHIT', + 'VC', 'VCBASE', 'RC', 'BADLINEEN', 'IDLE' + ], + + SPR: null, + + r: function(addr) { + switch (this.owner.MMU.vicBank) { + case 0: + if (addr >= 0x1000 && addr < 0x2000) { + return this.owner.MMU.charRom[addr & 0x0FFF]; + } else { + return this.owner.MMU.ram[addr & 0x3FFF]; + } + case 1: + return this.owner.MMU.ram[addr & 0x3FFF]; + case 2: + if (addr >= 0x9000 && addr < 0xA000) { + return this.owner.MMU.charRom[addr & 0x0FFF]; + } else { + return this.owner.MMU.ram[addr & 0x3FFF]; + } + case 3: + return this.owner.MMU.ram[addr & 0x3FFF]; + } + }, + w: function(addr, val) { + // The VIC doesn't write to memory! + }, + io_r: function(addr) { + addr &= 63; + switch (addr) { + case 17: // FLAGS1 + this.registers[addr] = (this.RASTER & 256) ? + (this.registers[addr] | 128) : + (this.registers[addr] & 127); + break; + case 18: // RASTER + this.registers[addr] = this.RASTER & 255; + break; + } + return (this.registers[addr] !== undefined) ? this.registers[addr] : 0; + }, + io_w: function(addr, val) { + var i, x; + addr &= 63; + switch (addr) { + case 0: // SPRX0 + case 2: // SPRX1 + case 4: // SPRX2 + case 6: // SPRX3 + case 8: // SPRX4 + case 10: // SPRX5 + case 12: // SPRX6 + case 14: // SPRX7 + // X-coords are "real", as opposed to the register mapped + // coordinate system, which is 68 pixels indented + x = this.SPR[addr >> 1].x - this.sizes.HBLL - this.sizes.BORDER + 24; + x = (x & 256) + val; + this.SPR[addr >> 1].x = x + this.sizes.HBLL + this.sizes.BORDER - 24; + break; + case 1: // SPRY0 + case 3: // SPRY1 + case 5: // SPRY2 + case 7: // SPRY3 + case 9: // SPRY4 + case 11: // SPRY5 + case 13: // SPRY6 + case 15: // SPRY7 + // Y-coords are "real", as opposed to the register mapped + // coordinate system, which is 29 rasters indented + this.SPR[addr >> 1].y = val + this.sizes.VBLT + 12; + this.fillSpriteRasters(); + break; + case 16: // SPRXHI + for (i = 0; i < 8; i++) { + x = this.SPR[i].x - this.sizes.HBLL - this.sizes.BORDER + 24; + x = (x & 255) + ((val & (1 << i)) ? 256 : 0); + this.SPR[i].x = x + this.sizes.HBLL + this.sizes.BORDER - 24; + } + break; + case 17: // FLAGS1 + this.YSCROLL = val & 7; + this.RSEL = !!(val & 8); + this.DISPLAY = !!(val & 16); + this.HIRES = !!(val & 32); + this.EXTCOLOR = !!(val & 64); + if (val & 128) { + this.RASTERHIT |= 256; + } else { + this.RASTERHIT &= 255; + } + if (this.RSEL) { + this.sizes.BORDERV = 42; + this.sizes.HEIGHT = 200; + } else { + this.sizes.BORDERV = 46; + this.sizes.HEIGHT = 192; + } + this.fillRasterModes(); + break; + case 18: // RASTER + this.RASTERHIT = (this.RASTERHIT & 256) | val; + break; + case 19: // LPX and + case 20: // LPY not supported + break; + case 21: // SPREN + for (i = 0; i < 8; i++) { + this.SPR[i].on = !!(val & (1 << i)); + } + this.fillSpriteRasters(); + break; + case 22: // FLAGS2 + this.XSCROLL = val & 7; + this.CSEL = !!(val & 8); + this.MULTICOLOR = !!(val & 16); + if (this.CSEL) { + this.sizes.BORDERL = 42; + this.sizes.BORDERR = 42; + this.sizes.WIDTH = 320; + } else { + this.sizes.BORDERL = 49; + this.sizes.BORDERR = 51; + this.sizes.WIDTH = 304; + } + break; + case 23: // SPRDBLY + for (i = 0; i < 8; i++) { + this.SPR[i].double_y = !!(val & (1 << i)); + } + this.fillSpriteRasters(); + break; + case 24: // POINTERS + this.SCREENPTR = (val & 240) >> 4; + this.CHARPTR = (val & 14) >> 1; + break; + case 25: // IRQ clears when written + this.registers[addr] = 0; + return; + case 26: // IRM + this.IRM = val; + break; + case 27: // SPROVER + for (i = 0; i < 8; i++) { + this.SPR[i].below_bg = !!(val & (1 << i)); + } + break; + case 28: // SPRMM + for (i = 0; i < 8; i++) { + this.SPR[i].multicolor = !!(val & (1 << i)); + } + break; + case 29: // SPRDBLX + for (i = 0; i < 8; i++) { + this.SPR[i].double_x = !!(val & (1 << i)); + } + break; + case 30: // SPRCOLL and + case 31: // SPRBGCOLL are readonly + break; + case 32: // BORDER + this.BORDER = val & 15; + break; + case 33: // BG0 + this.BG0 = val & 15; + break; + case 34: // BG1 + this.BG1 = val & 15; + break; + case 35: // BG2 + this.BG2 = val & 15; + break; + case 36: // BG3 + this.BG3 = val & 15; + break; + case 37: // SPRMM0 + this.SPRMM0 = val & 15; + break; + case 38: // SPRMM1 + this.SPRMM1 = val & 15; + break; + case 39: // SPRC0 + case 40: // SPRC1 + case 41: // SPRC2 + case 42: // SPRC3 + case 43: // SPRC4 + case 44: // SPRC5 + case 45: // SPRC6 + case 46: // SPRC7 + this.SPR[addr - 39].col = val & 15; + break; + } + + if (this.registers[addr] !== undefined) { + this.registers[addr] = val; + } + }, + renderPixels: function(pixels, skipFrames) { + var i = 0, j, k, p; + var x = 0, y = 0, pos = 0, row = 0, loc = 0; + var sx, cx, px, py, pixel, pixmode, mode = 0, badline, + left_border, right_border, + left_hbl = this.sizes.HBLL, + right_hbl = this.sizes.RASTER_LENGTH - this.sizes.HBLR, + top_border = this.sizes.VBLT + this.sizes.BORDER, + bottom_border = this.sizes.VBLT + this.sizes.BORDER + this.sizes.HEIGHT_ORIG, + locBase = this.SCREENPTR * 1024, + charBase = this.CHARPTR * 2048; + + if (skipFrames) { + this.frames += (0|(pixels / this.sizes.FRAME_SIZE)); + pixels %= this.sizes.FRAME_SIZE; + } + + y = 0|(this.thisFrame / this.sizes.RASTER_LENGTH); + x = this.thisFrame % this.sizes.RASTER_LENGTH; + pos = this.thisFrame * 4; + if (y >= top_border && y < bottom_border) { + j = this.sizes.RASTER_LENGTH * 8; + } + + var imageData = this.backContext.getImageData(0, 0, this.sizes.RASTER_LENGTH, this.sizes.RASTER_COUNT); + this.RASTER = y; + + if (pixels) do { + left_border = this.sizes.HBLL + this.sizes.BORDERL; + right_border = this.sizes.RASTER_LENGTH - this.sizes.BORDERR - this.sizes.HBLR; + + // "A badline condition can only occur if the DISPLAY bit + // has been set for at least one cycle in line 48" + if (y == 48 && this.DISPLAY) { + this.BADLINEEN = true; + } + + // Badline condition + badline = this.BADLINE; + this.BADLINE = this.BADLINEEN && + (y >= 48 && y <= 247) && + ((y & 7) == this.YSCROLL); + if (this.BADLINE != badline) { + this.IDLE = false; + } + + if (y >= 48 && y <= 247) { + switch (x) { + // Cycle 14: load VC, reset RC on badlines + case 112: + this.VC = this.VCBASE; + if (this.BADLINE) { + this.RC = 0; + } + break; + + // Cycles 15-54: Load line, tick VC along + case 120: case 128: case 136: case 144: case 152: + case 160: case 168: case 176: case 184: case 192: + case 200: case 208: case 216: case 224: case 232: + case 240: case 248: case 256: case 264: case 272: + case 280: case 288: case 296: case 304: case 312: + case 320: case 328: case 336: case 344: case 352: + case 360: case 368: case 376: case 384: case 392: + case 400: case 408: case 416: case 424: case 432: + if (this.BADLINE) { + this.owner.MMU.busLock++; + j = 0|((x - 120) / 8); + this.curLineScr[j] = this.r(locBase + this.VC); + this.curLineCol[j] = this.colorRam[this.VC]; + } + this.VC = (this.VC + 1) & 1023; + break; + + // Cycle 58: Tick RC, save VC if last char line + case 464: + if (this.RC == 7) { + this.VCBASE = this.VC; + if (!this.BADLINE) { + this.IDLE = true; + } + } + if (!this.IDLE) { + this.RC = (this.RC + 1) & 7; + } + break; + } + } + + if (y >= top_border && y < bottom_border) { + sx = x - this.sizes.HBLL - this.sizes.BORDER - this.XSCROLL; + cx = sx & 7; + } + + // Sprite data read, locks the bus for 2 phi-1's per sprite + // Starts at HBL on the previous line + if (y < 255) { + if (x > right_hbl) { + y++; + for (j = 0; j < this.spriteRasters[y].length; j++) { + this.owner.MMU.busLock += 2; + k = this.spriteRasters[y][j]; + p = this.r(locBase + 1016 + k); + py = y - this.SPR[k].y; + if (this.SPR[k].double_y) { + py >>= 1; + } + py = p * 64 + py * 3; + + this.curLineSpr[k * 3 + 0] = this.r(py + 0); + this.curLineSpr[k * 3 + 1] = this.r(py + 1); + this.curLineSpr[k * 3 + 2] = this.r(py + 2); + } + y--; + } + } + + // BUGBUG: This obviously doesn't allow for hyperscreen + switch (this.rasterModes[y]) { + // VBlank + case 1: + pixel = ((y&4) ^ (x&4)) ? 15 : 12; + break; + + // HBlank/border + case 2: + if (x < left_hbl || x >= right_hbl) { + pixel = ((y&4) ^ (x&4)) ? 15 : 12; + } else { + pixel = this.BORDER; + } + break; + + // HBlank/border/screen data + case 3: + if (x < left_hbl || x >= right_hbl) { + pixel = ((y&4) ^ (x&4)) ? 15 : 12; + } else if ((!this.BADLINEEN) || x < left_border || x >= right_border) { + pixel = this.BORDER; + } else { + // Background + pixel = -1; + + // Sprites wot live below the text + for (j = 7; j >= 0; j--) { + if (this.SPR[j].on && this.SPR[j].below_bg) { + px = this.SPR[j].x + (this.SPR[j].double_x ? 48 : 24); + py = this.SPR[j].y + (this.SPR[j].double_y ? 42 : 21); + if ( + x >= this.SPR[j].x && x < px && + y >= this.SPR[j].y && y < py + ) { + p = x - this.SPR[j].x; + if (this.SPR[j].double_x) { + p >>= 1; + } + if (this.curLineSpr[j * 3 + (p >> 3)] & this.bitPositions[p & 7]) { + pixel = this.SPR[j].col; + } + } + } + } + + // Text + if (y >= top_border && y < bottom_border) { + pixmode = + (this.EXTCOLOR ? 4 : 0) | + (this.HIRES ? 2 : 0) | + (this.MULTICOLOR ? 1 : 0); + switch (pixmode) { + case 0: + // Standard text mode + j = this.r(this.IDLE + ? 0x3FFF + : (charBase + this.curLineScr[sx >> 3] * 8 + this.RC) + ); + if (j & this.bitPositions[cx]) { + pixel = this.curLineCol[sx >> 3]; + } else if (pixel == -1) { + pixel = this.BG0; + } + break; + + case 1: + // Multicolor text mode + j = this.r(this.IDLE + ? 0x3FFF + : (charBase + this.curLineScr[sx >> 3] * 8 + this.RC) + ); + if (this.curLineCol[sx >> 3] & 8) { + cx &= 6; + k = ((j & this.bitPositions[cx]) ? 2 : 0) | + ((j & this.bitPositions[cx+1]) ? 1 : 0); + if (k == 3) { + pixel = this.curLineCol[sx >> 3] & 7; + } else if (pixel == -1) { + switch (k) { + case 0: + pixel = this.BG0; + break; + case 1: + pixel = this.BG1; + break; + case 2: + pixel = this.BG2; + break; + } + } + } else { + if (j & this.bitPositions[cx]) { + pixel = this.curLineCol[sx >> 3] & 7; + } else if (pixel == -1) { + pixel = this.BG0; + } + } + break; + + case 2: + // Bitmap mode + j = this.r(this.IDLE + ? 0x3FFF + : ((charBase & 8192) + (this.VC * 8) + this.RC) + ); + pixel = this.curLineScr[sx >> 3]; + if (j & this.bitPositions[cx]) { + pixel >>= 4; + } + pixel &= 15; + break; + + case 3: + // Multicolor bitmap mode + j = this.r(this.IDLE + ? 0x3FFF + : ((charBase & 8192) + (this.VC * 8) + this.RC) + ); + cx &= 6; + k = ((j & this.bitPositions[cx]) ? 2 : 0) | + ((j & this.bitPositions[cx+1]) ? 1 : 0); + switch (k) { + case 0: + if (pixel == -1) { + pixel = this.BG0; + } + break; + case 1: + pixel = this.curLineScr[sx >> 3] >> 4; + break; + case 2: + pixel = this.curLineScr[sx >> 3]; + break; + case 3: + pixel = this.curLineCol[sx >> 3]; + break; + } + pixel &= 15; + break; + + case 4: + // Extended-color text mode + j = this.r(this.IDLE + ? 0x3FFF + : (charBase + (this.curLineScr[sx >> 3] & 63) * 8 + this.RC) + ); + if (j & this.bitPositions[cx]) { + pixel = this.curLineCol[sx >> 3]; + } else if (pixel == -1) { + switch (this.curLineScr[sx >> 3] & 192) { + case 0: + pixel = this.BG0; + break; + case 64: + pixel = this.BG1; + break; + case 128: + pixel = this.BG2; + break; + case 192: + pixel = this.BG3; + break; + } + } + break; + + // Cases 5, 6, 7 are invalid modes + case 5: + case 6: + case 7: + break; + } + } + + // Sprites above the text + for (j = 7; j >= 0; j--) { + if (this.SPR[j].on && !this.SPR[j].below_bg) { + px = this.SPR[j].x + (this.SPR[j].double_x ? 48 : 24); + py = this.SPR[j].y + (this.SPR[j].double_y ? 42 : 21); + if ( + x >= this.SPR[j].x && x < px && + y >= this.SPR[j].y && y < py + ) { + p = x - this.SPR[j].x; + if (this.SPR[j].double_x) { + p >>= 1; + } + if (this.curLineSpr[j * 3 + (p >> 3)] & this.bitPositions[p & 7]) { + pixel = this.SPR[j].col; + } + } + } + } + } + break; + } + + if (pixel == -1) { + // Rendering failed, probably an invalid mode + pixel = 0; + } + + pixel = this.colors[0 | pixel]; + imageData.data[pos++] = pixel[0]; + imageData.data[pos++] = pixel[1]; + imageData.data[pos++] = pixel[2]; + imageData.data[pos++] = 0xFF; + + x++; i++; this.thisFrame++; + if (x == this.sizes.RASTER_LENGTH) { + x = 0; + y++; + this.RASTER++; + + if (y == this.sizes.RASTER_COUNT) { + y = 0; + this.backContext.putImageData(imageData, 0, 0); + this.owner.saveFrame(++this.frames, 10); + this.thisFrame = 0; + this.RASTER = 0; + this.VCBASE = 0; + this.BADLINEEN = false; + this.RC = 0; + pos = 0; + row = 0; + loc = 0; + + // Bit of a hack... + for (j = 0; j < 40; j++) { + this.curLineScr[j] = 32; + } + } + + if ((this.IRM & 1) && this.RASTERHIT == y) { + this.registers[this.rg.IRQ] |= 0x81; + this.owner.CPU.signal('INT'); + } + } + + if (!(this.thisFrame & 7)) { + this.owner.CIA.step(); + this.owner.DISK.step(); + this.owner.CPU.step(); + } + } while (i < pixels); + + this.backContext.putImageData(imageData, 0, 0); + + // Determine which mode we ended up at + switch (this.rasterModes[y]) { + case 1: + mode = 1; + break; + case 2: + mode = (x < 50 || x >= right_hbl) ? 2 : 3; + break; + case 3: + mode = (x < left_hbl || x >= right_hbl) ? + 2 : + (x < left_border || x >= right_border || !this.DISPLAY) ? + 3 : + 4 ; + break; + } + + return { + mode: mode, + frames: this.frames, + thisFrame: this.thisFrame + }; + }, + getState: function() { + var i, ret = { + image: this.backContext.getImageData(0, 0, this.sizes.RASTER_LENGTH, this.sizes.RASTER_COUNT), + colorRam: new Uint8Array(this.colorRam), + registers: this.registers.slice(0), + spriteRasters: this.spriteRasters.slice(0), + rasterModes: this.rasterModes.slice(0), + SPR: this.SPR.slice(0), + frames: this.frames, + thisFrame: this.thisFrame + }; + for (i in this.stateVars) { + ret[this.stateVars[i]] = this[this.stateVars[i]]; + } + return ret; + }, + setState: function(state) { + this.backContext.putImageData(state.image, 0, 0); + this.colorRam = new Uint8Array(state.colorRam); + this.spriteRasters = state.spriteRasters.slice(0); + this.rasterModes = state.rasterModes.slice(0); + this.SPR = state.SPR.slice(0); + this.frames = state.frames; + this.thisFrame = state.thisFrame; + for (i in state.registers) { + this.registers[i] = state.registers[i]; + } + for (i in this.stateVars) { + this[this.stateVars[i]] = state[this.stateVars[i]]; + } + }, + fillRasterModes: function() { + var i, j; + for (i = 0, j = 0; i < this.sizes.VBLT; i++, j++) { + this.rasterModes[j] = 1; + } + for (i = 0; i < this.sizes.BORDERV; i++, j++) { + this.rasterModes[j] = 2; + } + for (i = 0; i < this.sizes.HEIGHT; i++, j++) { + this.rasterModes[j] = 3; + } + for (i = 0; i < this.sizes.BORDERV; i++, j++) { + this.rasterModes[j] = 2; + } + for (i = 0; i < this.sizes.VBLB; i++, j++) { + this.rasterModes[j] = 1; + } + }, + fillSpriteRasters: function() { + var i, j, k; + for (i = 0; i < this.sizes.RASTER_COUNT; i++) { + this.spriteRasters[i].length = 0; + } + for (i = 0; i < 8; i++) { + if (this.SPR[i].on) { + k = this.SPR[i].double_y ? 42 : 21; + for (j = this.SPR[i].y; j < (this.SPR[i].y + k) && j < this.sizes.RASTER_COUNT; j++) { + this.spriteRasters[j].push(i); + } + } + } + }, + reset: function() { + var i, j; + for (i = 0; i < 8; i++) { + this.SPR[i] = { + x: this.sizes.HBLL + this.sizes.BORDER - 24, + y: 0, + col: 0, + on: false, + double_x: false, + double_y: false, + multicolor: false, + below_bg: false, + hit: false, + hit_bg: false + }; + } + for (i = 0; i < this.sizes.RASTER_COUNT; i++) { + this.spriteRasters[i] = []; + } + this.fillRasterModes(); + + this.renderedFrames = {}; + this.backContext.fillStyle = 'black'; + this.backContext.fillRect(0, 0, this.sizes.RASTER_LENGTH, this.sizes.RASTER_COUNT); + this.frames = 0; + this.thisFrame = 0; + this.VC = 0; + this.RC = 0; + this.VCBASE = 0; + this.BADLINEEN = false; + this.IDLE = true; + }, + init: function() { + this.sizes.RASTER_LENGTH = this.sizes.HBLL + this.sizes.BORDERL + this.sizes.WIDTH + this.sizes.BORDERR + this.sizes.HBLR; + this.sizes.RASTER_COUNT = this.sizes.VBLT + this.sizes.BORDERV + this.sizes.HEIGHT + this.sizes.BORDERV + this.sizes.VBLB; + this.sizes.FRAME_SIZE = this.sizes.RASTER_LENGTH * this.sizes.RASTER_COUNT; + + this.colorRam = new Uint8Array(1000); + this.curLineScr = new Uint8Array(40); + this.curLineCol = new Uint8Array(40); + this.curLineSpr = new Uint8Array(24); + this.SPR = []; + + this.backCanvas = document.createElement('canvas'); + this.backCanvas.width = this.sizes.RASTER_LENGTH; + this.backCanvas.height = this.sizes.RASTER_COUNT; + this.backContext = this.backCanvas.getContext('2d'); + + this.reset(); + }, + + registers: [ + 0, // Sprite 0: X + 0, // Sprite 0: Y + 0, // Sprite 1: X + 0, // Sprite 1: Y + 0, // Sprite 2: X + 0, // Sprite 2: Y + 0, // Sprite 3: X + 0, // Sprite 3: Y + 0, // Sprite 4: X + 0, // Sprite 4: Y + 0, // Sprite 5: X + 0, // Sprite 5: Y + 0, // Sprite 6: X + 0, // Sprite 6: Y + 0, // Sprite 7: X + 0, // Sprite 7: Y + 0, // Sprite X coordinate MSBs + 0, // Flags One + 0, // Current raster + 0, // Light pen X + 0, // Light pen Y + 0, // Sprite enable flags + 0, // Flags Two + 0, // Sprite Y-double flags + 0, // Pointers + 0, // Interrupt flags + 0, // Interrupt enables + 0, // Sprite priority + 0, // Sprite multicolor flags + 0, // Sprite X-double flags + 0, // Sprite-sprite collision + 0, // Sprite-bg collision + 0, // Color: border + 0, // Color: BG 0 + 0, // Color: BG 1 + 0, // Color: BG 2 + 0, // Color: BG 3 + 0, // Color: Sprite multi 0 + 0, // Color: Sprite multi 1 + 0, // Color: Sprite 0 + 0, // Color: Sprite 1 + 0, // Color: Sprite 2 + 0, // Color: Sprite 3 + 0, // Color: Sprite 4 + 0, // Color: Sprite 5 + 0, // Color: Sprite 6 + 0 // Color: Sprite 7 + ], + + rg: { + SPRX0: 0, + SPRY0: 1, + SPRX1: 2, + SPRY1: 3, + SPRX2: 4, + SPRY2: 5, + SPRX3: 6, + SPRY3: 7, + SPRX4: 8, + SPRY4: 9, + SPRX5: 10, + SPRY5: 11, + SPRX6: 12, + SPRY6: 13, + SPRX7: 14, + SPRY7: 15, + SPRXHI: 16, + FLAGS1: 17, + RASTER: 18, + LPX: 19, + LPY: 20, + SPREN: 21, + FLAGS2: 22, + SPRDBLY: 23, + POINTERS: 24, + IRQ: 25, + IRM: 26, + SPROVER: 27, + SPRMM: 28, + SPRDBLX: 29, + SPRCOLL: 30, + SPRBGCOLL:31, + BORDER: 32, + BG0: 33, + BG1: 34, + BG2: 35, + BG3: 36, + SPRMM0: 37, + SPRMM1: 38, + SPRC0: 39, + SPRC1: 40, + SPRC2: 41, + SPRC3: 42, + SPRC4: 43, + SPRC5: 44, + SPRC6: 45, + SPRC7: 46 + }, + sizes: { + HBLL: 78, + HBLR: 22, + VBLT: 9, + VBLB: 19, + BORDER: 42, + BORDERV: 42, + BORDERL: 42, + BORDERR: 42, + WIDTH: 320, + HEIGHT: 200, + WIDTH_ORIG: 320, + HEIGHT_ORIG: 200 + }, + colors: [ + [0x00, 0x00, 0x00], // black + [0xFF, 0xFF, 0xFF], // white + [0x68, 0x37, 0x2B], // red + [0x70, 0xA4, 0xB2], // cyan + [0x6F, 0x3D, 0x86], // magenta + [0x58, 0x8D, 0x43], // green + [0x35, 0x28, 0x79], // blue + [0xB8, 0xC7, 0x6F], // yellow + [0x6F, 0x4F, 0x25], // orange + [0x43, 0x39, 0x00], // brown + [0x9A, 0x67, 0x59], // light red + [0x44, 0x44, 0x44], // grey 1 + [0x6C, 0x6C, 0x6C], // grey 2 + [0x9A, 0xD2, 0x84], // light green + [0x6C, 0x5E, 0xB5], // light blue + [0x95, 0x95, 0x95] // grey 3 + ], + bitPositions: [128, 64, 32, 16, 8, 4, 2, 1], + endpointStrings: [ + 'Offline', + 'Vertical blanking', + 'Horizontal blanking', + 'Border', + 'Screen' + ] + }; +}); diff --git a/commodoreclicker/js/main.js b/commodoreclicker/js/main.js new file mode 100644 index 00000000..f6a562f8 --- /dev/null +++ b/commodoreclicker/js/main.js @@ -0,0 +1,718 @@ +requirejs.config({ + baseUrl: 'js', + packages: ['c64'], + paths: { + jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min' + }, + shim: { + 'thirdparty/jquery.powertip.min': { + deps: ['jquery'] + }, + 'thirdparty/jquery.nodoubletapzoom': { + deps: ['jquery'] + } + } +}); +require([ + 'jquery', + 'c64', + 'thirdparty/domReady', + 'thirdparty/biginteger', + 'thirdparty/jquery.powertip.min', + 'thirdparty/jquery.nodoubletapzoom' +], function($, C64, domReady, bigint, powertip) { + VIC = C64.VIC; + window.CClicker = { + FPS: 40, + debug: false, + + bank: null, + stepBank: null, + prevStepBank: null, + produced: null, + spent: null, + maxPrice: null, + clickPower: null, + cps: null, + cps_div: null, + cps_step: null, + step_prev: null, + currPeriodStr: null, + cursorMultiplier: null, + + units: [{ + name: 'Water clock', + description: "Drip pixels onto the screen. It's a slow process. (+1/s)", + cps: 1, + displayAt: 0, + basePrice: 64 + },{ + name: 'Hamster wheel', + description: "Hamsters never get tired, as we all know. (+8/s)", + cps: 8, + displayAt: 256, + basePrice: 504 + },{ + name: 'Relay', + description: "A somewhat loud electromagnetic clicker. (+32/s)", + cps: 32, + displayAt: 2048, + basePrice: 4032, + },{ + name: 'RC oscillator', + description: "At least it's quieter. (+128/s)", + cps: 128, + displayAt: 8192, + basePrice: 24192 + },{ + name: '555 timer', + description: "Electronics! Transistors! Other good things! (+504/s)", + cps: 504, + displayAt: 65536, + basePrice: 157248 + },{ + name: 'Phase-locked loop', + description: "An accurate oscillator is a rare thing. (+4 lines/s)", + cps: 2016, + displayAt: 262144, + basePrice: 1048576 + },{ + name: 'Coal crystal', + description: "It's a crystal, that must be better. (+16 lines/s)", + cps: 8064, + displayAt: 2097152, + basePrice: 4194304 + },{ + name: 'Graphite crystal', + description: "I knew there was something wrong with coal. (+78 lines/s)", + cps: 39312, + displayAt: 8388608, + basePrice: 24772608 + },{ + name: 'Quartz crystal', + description: "Used in watches, with good reason. (+1 frame/s)", + cps: 157248, + displayAt: 67108864, + basePrice: 134217728 + }], + + upgrades: [{ + name: 'Doubleclick', + description: "What it says on the tin. (+1px per click)", + power: 1, + displayAt: 0, + price: 64 + },{ + name: 'Multi-touch', + description: "It's like two fingers are clicking. (+4px per click)", + power: 4, + displayAt: 128, + price: 256 + },{ + name: 'Bouncy fingers', + description: "Adds springs to the mouse button. (+16px per click)", + power: 16, + displayAt: 1024, + price: 2048 + },{ + name: 'Multibyte click', + description: "An extra-wide mouse button. (+64px per click)", + power: 64, + displayAt: 8192, + price: 16384 + },{ + name: 'Raster-click', + description: "All hail his Noodliness. No, hold on... (+1 line per click)", + power: 504, + displayAt: 32768, + price: 157248 + },{ + name: 'Raster-bars', + description: "LOADING... (random border color every 12 lines)", + effect_main: 'rasterbars', + displayAt: 80000, + price: 157248 + },{ + name: 'If I had a million pixels', + description: "I'd click two lines at the same time, man. (+2 lines per click)", + power: 1008, + displayAt: 157248, + price: 1048576 + },{ + name: '[C64 intensifies]', + description: "Oh Lord there's a quake! (random character offset per frame)", + effect_main: 'scrollshake', + displayAt: 1048576, + price: 1572840 + },{ + name: 'Sanyo TV', + description: "It's ever so slightly bigger. (+25% screen size)", + effect_main: 'quarterscreen', + displayAt: 2097152, + price: 3144960 + },{ + name: 'A sprite', + description: "It might be a ball, I guess? (+1 sprite)", + effect_main: 'sprite', + displayAt: 2097152, + price: 4194304 + },{ + name: 'Foam finger', + description: "It's a bit... big, isn't it? (+8 lines per click)", + power: 4032, + displayAt: 2097152, + price: 8388608 + },{ + name: 'Double-size sprites', + description: "In both directions, even! (X- and Y- doubling of sprites)", + effect_main: 'doublesprite', + displayAt: 10485760, + price: 16777216 + },{ + name: 'Foam hand', + description: "All the fingers, at once. (+40 lines per click)", + power: 20160, + displayAt: 10485760, + price: 50331648 + },{ + name: '1541 disk drive', + description: "Load games into the C64! With no guarantee that any of them'll work!", + effect_main: 'disk', + displayAt: 33554432, + price: 50331648 + }], + + options: [{ + name: 'Reduce FPS', + code: 'low_fps', + description: "If your computer's burning up, drop the rendering to 1 frame per second.", + set: false + },{ + name: 'Hide joystick', + code: 'joystick_hidden', + description: "For reference, the joystick is plugged into port 2.", + set: false + }], + + frontCanvas: null, + frontContext: null, + intervals: null, + effects: { + rasterbars: false, + scrollshake: false, + quarterscreen: false, + sprite: false, + doublesprite: false, + disk: false + }, + available_disks: { + "Effects": { + 'test' : "The simplest BASIC program", + 'sorex' : "359-Char Scroller by Sorex/WotW, 2010", + 'testscreen': "Test Screen by Dariusz/Alpha Flight, 2007", + 'raster2' : "A basic BASIC ISR by Zirias, 2014", + '69uasr' : "Stable Raster by Hokuto Force, 2012", + 'truth' : "The Truth by The Dreams, 2003", + 'microture' : "Microture by cult and Padua, 2009", + '1dnoise' : "1D Noise by Cruzer/CML Sports, 2010", + '32bfuzzy' : "32 Bytes Fuzzy Logic by RasterDream, 2012", + 'flag' : "Norwegian Flag by TWW/Creators, 2014" + }, + "Demos": { + 'colorsplits': "Color Splits by Wisdom/Phobia, 1993" + } + }, + thread: null, + + reset: function() { + this.cps = BigInteger(0); + this.bank = BigInteger(0); + this.prevStepBank = BigInteger(0); + this.produced = BigInteger(0); + this.spent = BigInteger(0); + this.maxPrice = BigInteger(0); + this.clickPower = BigInteger(1); + this.cps_step = 0; + this.cps_div = 0; + this.cursorMultiplier = 1; + this.step_prev = new Date(); + + var i; + for (i in this.units) { + this.units[i].currPrice = BigInteger(this.units[i].basePrice); + this.units[i].count = 0; + if (this.maxPrice.compare(this.units[i].basePrice) < 0) { + this.maxPrice = BigInteger(this.units[i].basePrice); + } + } + for (i in this.upgrades) { + this.upgrades[i].purchased = false; + if (this.maxPrice.compare(this.upgrades[i].price) < 0) { + this.maxPrice = BigInteger(this.upgrades[i].price); + } + } + for (i in this.options) { + this.options[i].set = false; + this.optionHandlers[this.options[i].code].call(this, true); + } + for (i in this.effects) { + this.effects[i] = false; + this.effectHandlers[i].call(this, true); + } + + this.renderItems(); + this.showTab('units'); + + C64.reset(); + + $('#click').html('Loading BASIC...'); + C64.loadGame().done(function(){ + $('#click').html('Render '); + $('#pixels_per_click').text(this.pluralize(this.clickPower.toString(), 'pixel')); + }.bind(this)); + }, + loadDisk: function(d64) { + $('#click').html('Loading BASIC...'); + C64.loadDisk(d64).done(function(){ + $('#click').html('Render '); + $('#pixels_per_click').text(this.pluralize(this.clickPower.toString(), 'pixel')); + }.bind(this)); + }, + inc: function(amt) { + this.bank = this.bank.add(amt); + this.produced = this.produced.add(amt); + VIC.renderPixels(this.bank.subtract(this.prevStepBank).toJSValue()); + this.prevStepBank = BigInteger(this.bank); + }, + dec: function(amt) { + this.bank = this.bank.subtract(amt); + this.spent = this.spent.add(amt); + C64.restoreFrame(this.bank.divide(VIC.sizes.FRAME_SIZE).toJSValue()); + VIC.renderPixels(this.bank.modPow(BigInteger(1), VIC.sizes.FRAME_SIZE).toJSValue()); + this.prevStepBank = BigInteger(this.bank); + }, + click: function() { + this.inc(this.clickPower); + }, + stepCalc: function() { + var now = new Date(), + elapsed = Math.floor((now.getTime() - this.step_prev.getTime()) / 1000); + if (elapsed > 1) { + this.inc(this.cps.multiply(elapsed)); + } else if (this.cps_step > (this.FPS / 2)) { + this.inc(Math.round(this.cps_step * this.cps_div)); + } else { + this.inc(this.cps); + } + this.cps_step = 0; + this.prevStepBank = BigInteger(this.bank); + this.step_prev = now; + }, + stepDraw: function() { + var bank, cps_amt, i, j; + + this.cps_step++; + cps_amt = (0.0 + this.cps_step) * this.cps_div; + if (this.bank.compare(1073741824) < 0) { + bank = this.bank.toJSValue() + cps_amt; + bank = BigInteger(bank); + } else { + bank = this.bank.add(cps_amt); + } + + var ret = VIC.renderPixels(bank.subtract(this.prevStepBank).toJSValue()); + this.prevStepBank = BigInteger(bank); + + var $item; + for (i in this.units) { + $item = $('li#unit' + i); + if (this.units[i].count || bank.compare(this.units[i].displayAt) >= 0) { + $item.addClass('active'); + } else { + $item.removeClass('active'); + } + if (bank.compare(this.units[i].currPrice) >= 0) { + $item.addClass('available'); + } else { + $item.removeClass('available'); + } + $item.find('.count').text(this.units[i].count.toString()); + $item.find('.price').text(this.pluralize(this.units[i].currPrice.toString(), 'pixel')); + } + for (i in this.upgrades) { + $item = $('li#upgrade' + i); + if ( + this.upgrades[i].purchased || + bank.compare(this.upgrades[i].displayAt) < 0 + ) { + $item.removeClass('active'); + } else { + $item.addClass('active'); + } + if ( + !this.upgrades[i].purchased && + bank.compare(this.upgrades[i].price) >= 0 + ) { + $item.addClass('available'); + } else { + $item.removeClass('available'); + } + } + for (i in this.options) { + $item = $('li#option' + i); + if (this.options[i].set) { + $item.addClass('available'); + } else { + $item.removeClass('available'); + } + } + + i = 0|(ret.thisFrame / VIC.sizes.RASTER_LENGTH); + j = 0|(ret.thisFrame % VIC.sizes.RASTER_LENGTH); + + $('#bank').text(this.pluralize(bank.toString(), 'pixel')); + $('#pixels_per_click').text(this.pluralize(this.clickPower.toString(), 'pixel')); + $('#clock').text(this.pluralize(this.cps.divide(8).toString(), 'Hz', false)); + $('#cps').text(this.pluralize(this.cps.toString(), 'pixel') + '/s'); + $('#curframe').text(ret.frames - 10); + $('#curraster').text(i); + $('#curperiod').text(VIC.endpointStrings[ret.mode]); + $('.cursor_x').css('left', j * this.cursorMultiplier + 6); + $('.cursor_y').css('top', i * this.cursorMultiplier + 42); + + if (C64.DISK.talking) { + $('#disk_power').addClass('disk_on'); + $('#disk_progress').css('width', ( + 0|($('.disk_bar').width() * C64.DISK.getFileProgress() / 100) + ) + 'px'); + } else { + $('#disk_power').removeClass('disk_on'); + $('#disk_progress').css('width', 0); + } + + this.frontContext.drawImage(VIC.backCanvas, 0, 0); + }, + showTab: function(rel) { + $('ul.tabs li').removeClass('active'); + $('ul.tabs li[rel="' + rel + '"]').addClass('active'); + $('.itemlists > ul').hide(); + $('.itemlists > ul.' + rel).show(); + }, + buy: function($item) { + var i = $item.attr('id').match(/\d+$/); + if (i) { + i = i[0]; + } else { + return; + } + + if ($item.parent().is('.units')) { + if (this.bank.compare(this.units[i].currPrice) < 0) { + // How did we get here again? + return; + } + this.dec(this.units[i].currPrice); + this.cps = this.cps.add(this.units[i].cps); + if (this.cps.compare(1048576) < 0) { + this.cps_div = this.cps.toJSValue() / this.FPS; + } else { + this.cps_div = this.cps.divide(this.FPS).toJSValue(); + } + this.units[i].count++; + this.units[i].currPrice = this.units[i].currPrice.multiply(5).divide(4); + if (this.maxPrice.compare(this.units[i].currPrice) < 0) { + this.maxPrice = this.units[i].currPrice; + } + $item.find('.count').text(this.units[i].count); + $item.find('.price').text(this.pluralize(this.units[i].currPrice.toString(), 'pixel')); + } else if ($item.parent().is('.upgrades')) { + if (this.bank.compare(this.upgrades[i].price) < 0) { + return; + } + this.dec(this.upgrades[i].price); + if (this.upgrades[i].power) { + this.clickPower = this.clickPower.add(this.upgrades[i].power); + } else if (this.upgrades[i].effect_vic) { + VIC.effects[this.upgrades[i].effect_vic] = true; + } else if (this.upgrades[i].effect_main) { + this.effects[this.upgrades[i].effect_main] = true; + this.effectHandlers[this.upgrades[i].effect_main].call(this); + } + this.upgrades[i].purchased = true; + $item.removeClass('active'); + } else if ($item.parent().is('.options')) { + this.options[i].set = !this.options[i].set; + this.optionHandlers[this.options[i].code].call(this, !this.options[i].set); + if (this.options[i].set) { + $item.addClass('available'); + } else { + $item.removeClass('available'); + } + } + }, + renderItems: function() { + var i; + $('.itemlists ul').empty(); + for (i in this.units) { + $('ul.units').append([ + '
  • ', + '', this.units[i].name, '', + '', + this.units[i].count ? this.units[i].count : 'None', + '', + '', + this.pluralize(this.units[i].currPrice.toString(), 'pixel'), + '', + '
  • ' + ].join('')); + } + for (i in this.upgrades) { + if (!this.upgrades[i].purchased) { + $('ul.upgrades').append([ + '
  • ', + '', this.upgrades[i].name, '', + '', + this.pluralize(this.upgrades[i].price, 'pixel'), + '', + '
  • ' + ].join('')); + } + } + for (i in this.options) { + $('ul.options').append([ + '
  • ', + '', this.options[i].name, '', + '
  • ' + ].join('')); + } + $('.itemlists li').off('click').on('click', function(e) { + this.buy($(e.target).closest('li')); + return false; + }.bind(this)).powerTip(); + }, + effectHandlers: { + rasterbars: function(disable) {}, + scrollshake: function(disable) {}, + sprite: function(disable) {}, + doublesprite: function(disable) {}, + quarterscreen: function(disable) { + if (disable) { + $('body').removeClass('quarterscreen'); + this.cursorMultiplier = 1; + } else { + $('body').addClass('quarterscreen'); + this.cursorMultiplier = 1.25; + } + }, + disk: function(disable) { + if (disable) { + $('.disk').addClass('hidden'); + } else { + $('.disk').removeClass('hidden'); + } + } + }, + optionHandlers: { + low_fps: function(disable) { + if (disable) { + this.FPS = 40; + } else { + this.FPS = 1; + } + this.cps_step = 0; + if (this.cps.compare(1048576) < 0) { + this.cps_div = this.cps.toJSValue() / this.FPS; + } else { + this.cps_div = this.cps.divide(this.FPS).toJSValue(); + } + clearInterval(this.intervals.step); + this.intervals.step = setInterval(this.stepDraw.bind(this), 1000 / this.FPS); + }, + joystick_hidden: function(disable) { + $('.joystick')[disable ? 'removeClass' : 'addClass']('hidden'); + } + }, + init: function() { + // Polyfill courtesy of Mozilla + if (!Function.prototype.bind) { + Function.prototype.bind = function(oThis) { + if (typeof this !== 'function') { + // closest thing possible to the ECMAScript 5 + // internal IsCallable function + throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); + } + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function() {}, + fBound = function() { + return fToBind.apply(this instanceof fNOP && oThis + ? this + : oThis, + aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + }; + } + + this.C64 = C64; + this.C64.game = this; + + this.frontCanvas = document.getElementById('screen'); + this.frontCanvas.width = VIC.sizes.RASTER_LENGTH; + this.frontCanvas.height = VIC.sizes.RASTER_COUNT; + this.frontContext = this.frontCanvas.getContext('2d'); + + this.intervals = { + step: setInterval(this.stepDraw.bind(this), 1000 / this.FPS), + calc: setInterval(this.stepCalc.bind(this), 1000), + save: setInterval(this.save.bind(this), 5000) + }; + + this.reset(); + this.load(); + this.renderItems(); + this.prevStepBank = this.bank.divide(VIC.sizes.FRAME_SIZE).multiply(VIC.sizes.FRAME_SIZE); + + $('.head h1 a').on('mouseenter', function(e) { + if (!$(this).data('powertip')) { + $(this).data('powertip', $('#about').html()).powerTip({ + manual: true, + placement: 's' + }); + } + $(this).powerTip('show', e); + }).on('mouseleave', function() { + $(this).powerTip('hide'); + }); + $('#click').on('click', this.click.bind(this)).nodoubletapzoom(); + $('.tabs li').on('click', function(e) { + this.showTab($(e.target).attr('rel')); + return false; + }.bind(this)); + $('#reset').on('click', function(e) { + if (confirm("You're sure you want to wipe your game progress?")) { + this.wipe(); + } + return false; + }.bind(this)); + + $('select#disk_files').html(''); + for (var i in this.available_disks) { + var options = ''; + for (var j in this.available_disks[i]) { + options += (''); + } + $('select#disk_files').append( + '' + options + '' + ); + } + $('select#disk_files').on('change', function() { + var disk = $('select#disk_files').val(); + if (disk) { + this.loadDisk('/rom/' + disk + '.d64'); + } + $('select#disk_files').val('null'); + }.bind(this)); + }, + load: function() { + if (!window.localStorage['c64click.bank']) { + // First run! + return; + } + + this.FPS = parseInt(window.localStorage['c64click.FPS']) || 40; + this.debug = !!(0|window.localStorage['c64click.debug']); + var i, vars = ['bank', 'cps', 'clickPower', 'produced', 'spent']; + for (i in vars) { + this[vars[i]] = BigInteger(window.localStorage['c64click.' + vars[i]]); + } + if (this.cps.compare(1048576) < 0) { + this.cps_div = this.cps.toJSValue() / this.FPS; + } else { + this.cps_div = this.cps.divide(this.FPS).toJSValue(); + } + VIC.BORDER = 0|window.localStorage['c64click.VIC.border']; + VIC.BG0 = 0|window.localStorage['c64click.VIC.background']; + for (i in VIC.effects) { + VIC.effects[i] = !!(0|window.localStorage['c64click.VIC.effects.' + i]); + } + for (i in this.effects) { + this.effects[i] = !!(0|window.localStorage['c64click.effects.' + i]); + this.effectHandlers[i].call(this, !this.effects[i]); + } + for (i in this.units) { + this.units[i].currPrice = BigInteger(window.localStorage['c64click.units.' + i + '.currPrice']); + this.units[i].count = 0|window.localStorage['c64click.units.' + i + '.count']; + } + for (i in this.upgrades) { + this.upgrades[i].purchased = !!(0|window.localStorage['c64click.upgrades.' + i + '.purchased']); + } + for (i in this.options) { + this.options[i].set = !!(0|window.localStorage['c64click.options.' + i + '.set']); + this.optionHandlers[this.options[i].code].call(this, !this.options[i].set); + } + }, + save: function() { + var i, state = { + 'FPS': this.FPS, + 'debug': this.debug ? 1 : 0, + 'bank': this.bank.toString(), + 'cps': this.cps.toString(), + 'clickPower': this.clickPower.toString(), + 'produced': this.produced.toString(), + 'spent': this.spent.toString() + }; + state['VIC.border'] = VIC.BORDER; + state['VIC.background'] = VIC.BG0; + for (i in VIC.effects) { + state['VIC.effects.' + i] = VIC.effects[i] ? 1 : 0; + } + for (i in this.effects) { + state['effects.' + i] = this.effects[i] ? 1 : 0; + } + for (i in this.units) { + state['units.' + i + '.currPrice'] = this.units[i].currPrice.toString(); + state['units.' + i + '.count'] = 0|this.units[i].count; + } + for (i in this.upgrades) { + state['upgrades.' + i + '.purchased'] = this.upgrades[i].purchased ? 1 : 0; + } + for (i in this.options) { + state['options.' + i + '.set'] = this.options[i].set ? 1 : 0; + } + + for (i in state) { + window.localStorage['c64click.' + i] = state[i]; + } + }, + wipe: function() { + window.localStorage.clear(); + this.reset(); + }, + setDebug: function(flag) { + this.debug = !!flag; + }, + pluralize: function(num, str, doPlural) { + if (doPlural === undefined) { + doPlural = true; + } + return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + + " " + str + + ((num == '1' || !doPlural) ? '' : 's'); + } + }; + + domReady(CClicker.init.bind(CClicker)); +}); + +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-38513874-3', 'auto'); +ga('send', 'pageview'); diff --git a/commodoreclicker/js/thirdparty/biginteger.js b/commodoreclicker/js/thirdparty/biginteger.js new file mode 100644 index 00000000..b8811059 --- /dev/null +++ b/commodoreclicker/js/thirdparty/biginteger.js @@ -0,0 +1,1619 @@ +/* + JavaScript BigInteger library version 0.9 + http://silentmatt.com/biginteger/ + + Copyright (c) 2009 Matthew Crumley + Copyright (c) 2010,2011 by John Tobey + Licensed under the MIT license. + + Support for arbitrary internal representation base was added by + Vitaly Magerya. +*/ + +/* + File: biginteger.js + + Exports: + + +*/ +(function(exports) { +"use strict"; +/* + Class: BigInteger + An arbitrarily-large integer. + + objects should be considered immutable. None of the "built-in" + methods modify *this* or their arguments. All properties should be + considered private. + + All the methods of instances can be called "statically". The + static versions are convenient if you don't already have a + object. + + As an example, these calls are equivalent. + + > BigInteger(4).multiply(5); // returns BigInteger(20); + > BigInteger.multiply(4, 5); // returns BigInteger(20); + + > var a = 42; + > var a = BigInteger.toJSValue("0b101010"); // Not completely useless... +*/ + +var CONSTRUCT = {}; // Unique token to call "private" version of constructor + +/* + Constructor: BigInteger() + Convert a value to a . + + Although is the constructor for objects, it is + best not to call it as a constructor. If *n* is a object, it is + simply returned as-is. Otherwise, is equivalent to + without a radix argument. + + > var n0 = BigInteger(); // Same as + > var n1 = BigInteger("123"); // Create a new with value 123 + > var n2 = BigInteger(123); // Create a new with value 123 + > var n3 = BigInteger(n2); // Return n2, unchanged + + The constructor form only takes an array and a sign. *n* must be an + array of numbers in little-endian order, where each digit is between 0 + and BigInteger.base. The second parameter sets the sign: -1 for + negative, +1 for positive, or 0 for zero. The array is *not copied and + may be modified*. If the array contains only zeros, the sign parameter + is ignored and is forced to zero. + + > new BigInteger([5], -1): create a new BigInteger with value -5 + + Parameters: + + n - Value to convert to a . + + Returns: + + A value. + + See Also: + + , +*/ +function BigInteger(n, s, token) { + if (token !== CONSTRUCT) { + if (n instanceof BigInteger) { + return n; + } + else if (typeof n === "undefined") { + return ZERO; + } + return BigInteger.parse(n); + } + + n = n || []; // Provide the nullary constructor for subclasses. + while (n.length && !n[n.length - 1]) { + --n.length; + } + this._d = n; + this._s = n.length ? (s || 1) : 0; +} + +BigInteger._construct = function(n, s) { + return new BigInteger(n, s, CONSTRUCT); +}; + +// Base-10 speedup hacks in parse, toString, exp10 and log functions +// require base to be a power of 10. 10^7 is the largest such power +// that won't cause a precision loss when digits are multiplied. +var BigInteger_base = 10000000; +var BigInteger_base_log10 = 7; + +BigInteger.base = BigInteger_base; +BigInteger.base_log10 = BigInteger_base_log10; + +var ZERO = new BigInteger([], 0, CONSTRUCT); +// Constant: ZERO +// 0. +BigInteger.ZERO = ZERO; + +var ONE = new BigInteger([1], 1, CONSTRUCT); +// Constant: ONE +// 1. +BigInteger.ONE = ONE; + +var M_ONE = new BigInteger(ONE._d, -1, CONSTRUCT); +// Constant: M_ONE +// -1. +BigInteger.M_ONE = M_ONE; + +// Constant: _0 +// Shortcut for . +BigInteger._0 = ZERO; + +// Constant: _1 +// Shortcut for . +BigInteger._1 = ONE; + +/* + Constant: small + Array of from 0 to 36. + + These are used internally for parsing, but useful when you need a "small" + . + + See Also: + + , , <_0>, <_1> +*/ +BigInteger.small = [ + ZERO, + ONE, + /* Assuming BigInteger_base > 36 */ + new BigInteger( [2], 1, CONSTRUCT), + new BigInteger( [3], 1, CONSTRUCT), + new BigInteger( [4], 1, CONSTRUCT), + new BigInteger( [5], 1, CONSTRUCT), + new BigInteger( [6], 1, CONSTRUCT), + new BigInteger( [7], 1, CONSTRUCT), + new BigInteger( [8], 1, CONSTRUCT), + new BigInteger( [9], 1, CONSTRUCT), + new BigInteger([10], 1, CONSTRUCT), + new BigInteger([11], 1, CONSTRUCT), + new BigInteger([12], 1, CONSTRUCT), + new BigInteger([13], 1, CONSTRUCT), + new BigInteger([14], 1, CONSTRUCT), + new BigInteger([15], 1, CONSTRUCT), + new BigInteger([16], 1, CONSTRUCT), + new BigInteger([17], 1, CONSTRUCT), + new BigInteger([18], 1, CONSTRUCT), + new BigInteger([19], 1, CONSTRUCT), + new BigInteger([20], 1, CONSTRUCT), + new BigInteger([21], 1, CONSTRUCT), + new BigInteger([22], 1, CONSTRUCT), + new BigInteger([23], 1, CONSTRUCT), + new BigInteger([24], 1, CONSTRUCT), + new BigInteger([25], 1, CONSTRUCT), + new BigInteger([26], 1, CONSTRUCT), + new BigInteger([27], 1, CONSTRUCT), + new BigInteger([28], 1, CONSTRUCT), + new BigInteger([29], 1, CONSTRUCT), + new BigInteger([30], 1, CONSTRUCT), + new BigInteger([31], 1, CONSTRUCT), + new BigInteger([32], 1, CONSTRUCT), + new BigInteger([33], 1, CONSTRUCT), + new BigInteger([34], 1, CONSTRUCT), + new BigInteger([35], 1, CONSTRUCT), + new BigInteger([36], 1, CONSTRUCT) +]; + +// Used for parsing/radix conversion +BigInteger.digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); + +/* + Method: toString + Convert a to a string. + + When *base* is greater than 10, letters are upper case. + + Parameters: + + base - Optional base to represent the number in (default is base 10). + Must be between 2 and 36 inclusive, or an Error will be thrown. + + Returns: + + The string representation of the . +*/ +BigInteger.prototype.toString = function(base) { + base = +base || 10; + if (base < 2 || base > 36) { + throw new Error("illegal radix " + base + "."); + } + if (this._s === 0) { + return "0"; + } + if (base === 10) { + var str = this._s < 0 ? "-" : ""; + str += this._d[this._d.length - 1].toString(); + for (var i = this._d.length - 2; i >= 0; i--) { + var group = this._d[i].toString(); + while (group.length < BigInteger_base_log10) group = '0' + group; + str += group; + } + return str; + } + else { + var numerals = BigInteger.digits; + base = BigInteger.small[base]; + var sign = this._s; + + var n = this.abs(); + var digits = []; + var digit; + + while (n._s !== 0) { + var divmod = n.divRem(base); + n = divmod[0]; + digit = divmod[1]; + // TODO: This could be changed to unshift instead of reversing at the end. + // Benchmark both to compare speeds. + digits.push(numerals[digit.valueOf()]); + } + return (sign < 0 ? "-" : "") + digits.reverse().join(""); + } +}; + +// Verify strings for parsing +BigInteger.radixRegex = [ + /^$/, + /^$/, + /^[01]*$/, + /^[012]*$/, + /^[0-3]*$/, + /^[0-4]*$/, + /^[0-5]*$/, + /^[0-6]*$/, + /^[0-7]*$/, + /^[0-8]*$/, + /^[0-9]*$/, + /^[0-9aA]*$/, + /^[0-9abAB]*$/, + /^[0-9abcABC]*$/, + /^[0-9a-dA-D]*$/, + /^[0-9a-eA-E]*$/, + /^[0-9a-fA-F]*$/, + /^[0-9a-gA-G]*$/, + /^[0-9a-hA-H]*$/, + /^[0-9a-iA-I]*$/, + /^[0-9a-jA-J]*$/, + /^[0-9a-kA-K]*$/, + /^[0-9a-lA-L]*$/, + /^[0-9a-mA-M]*$/, + /^[0-9a-nA-N]*$/, + /^[0-9a-oA-O]*$/, + /^[0-9a-pA-P]*$/, + /^[0-9a-qA-Q]*$/, + /^[0-9a-rA-R]*$/, + /^[0-9a-sA-S]*$/, + /^[0-9a-tA-T]*$/, + /^[0-9a-uA-U]*$/, + /^[0-9a-vA-V]*$/, + /^[0-9a-wA-W]*$/, + /^[0-9a-xA-X]*$/, + /^[0-9a-yA-Y]*$/, + /^[0-9a-zA-Z]*$/ +]; + +/* + Function: parse + Parse a string into a . + + *base* is optional but, if provided, must be from 2 to 36 inclusive. If + *base* is not provided, it will be guessed based on the leading characters + of *s* as follows: + + - "0x" or "0X": *base* = 16 + - "0c" or "0C": *base* = 8 + - "0b" or "0B": *base* = 2 + - else: *base* = 10 + + If no base is provided, or *base* is 10, the number can be in exponential + form. For example, these are all valid: + + > BigInteger.parse("1e9"); // Same as "1000000000" + > BigInteger.parse("1.234*10^3"); // Same as 1234 + > BigInteger.parse("56789 * 10 ** -2"); // Same as 567 + + If any characters fall outside the range defined by the radix, an exception + will be thrown. + + Parameters: + + s - The string to parse. + base - Optional radix (default is to guess based on *s*). + + Returns: + + a instance. +*/ +BigInteger.parse = function(s, base) { + // Expands a number in exponential form to decimal form. + // expandExponential("-13.441*10^5") === "1344100"; + // expandExponential("1.12300e-1") === "0.112300"; + // expandExponential(1000000000000000000000000000000) === "1000000000000000000000000000000"; + function expandExponential(str) { + str = str.replace(/\s*[*xX]\s*10\s*(\^|\*\*)\s*/, "e"); + + return str.replace(/^([+\-])?(\d+)\.?(\d*)[eE]([+\-]?\d+)$/, function(x, s, n, f, c) { + c = +c; + var l = c < 0; + var i = n.length + c; + x = (l ? n : f).length; + c = ((c = Math.abs(c)) >= x ? c - x + l : 0); + var z = (new Array(c + 1)).join("0"); + var r = n + f; + return (s || "") + (l ? r = z + r : r += z).substr(0, i += l ? z.length : 0) + (i < r.length ? "." + r.substr(i) : ""); + }); + } + + s = s.toString(); + if (typeof base === "undefined" || +base === 10) { + s = expandExponential(s); + } + + var prefixRE; + if (typeof base === "undefined") { + prefixRE = '0[xcb]'; + } + else if (base == 16) { + prefixRE = '0x'; + } + else if (base == 8) { + prefixRE = '0c'; + } + else if (base == 2) { + prefixRE = '0b'; + } + else { + prefixRE = ''; + } + var parts = new RegExp('^([+\\-]?)(' + prefixRE + ')?([0-9a-z]*)(?:\\.\\d*)?$', 'i').exec(s); + if (parts) { + var sign = parts[1] || "+"; + var baseSection = parts[2] || ""; + var digits = parts[3] || ""; + + if (typeof base === "undefined") { + // Guess base + if (baseSection === "0x" || baseSection === "0X") { // Hex + base = 16; + } + else if (baseSection === "0c" || baseSection === "0C") { // Octal + base = 8; + } + else if (baseSection === "0b" || baseSection === "0B") { // Binary + base = 2; + } + else { + base = 10; + } + } + else if (base < 2 || base > 36) { + throw new Error("Illegal radix " + base + "."); + } + + base = +base; + + // Check for digits outside the range + if (!(BigInteger.radixRegex[base].test(digits))) { + throw new Error("Bad digit for radix " + base); + } + + // Strip leading zeros, and convert to array + digits = digits.replace(/^0+/, "").split(""); + if (digits.length === 0) { + return ZERO; + } + + // Get the sign (we know it's not zero) + sign = (sign === "-") ? -1 : 1; + + // Optimize 10 + if (base == 10) { + var d = []; + while (digits.length >= BigInteger_base_log10) { + d.push(parseInt(digits.splice(digits.length-BigInteger.base_log10, BigInteger.base_log10).join(''), 10)); + } + d.push(parseInt(digits.join(''), 10)); + return new BigInteger(d, sign, CONSTRUCT); + } + + // Do the conversion + var d = ZERO; + base = BigInteger.small[base]; + var small = BigInteger.small; + for (var i = 0; i < digits.length; i++) { + d = d.multiply(base).add(small[parseInt(digits[i], 36)]); + } + return new BigInteger(d._d, sign, CONSTRUCT); + } + else { + throw new Error("Invalid BigInteger format: " + s); + } +}; + +/* + Function: add + Add two . + + Parameters: + + n - The number to add to *this*. Will be converted to a . + + Returns: + + The numbers added together. + + See Also: + + , , , +*/ +BigInteger.prototype.add = function(n) { + if (this._s === 0) { + return BigInteger(n); + } + + n = BigInteger(n); + if (n._s === 0) { + return this; + } + if (this._s !== n._s) { + n = n.negate(); + return this.subtract(n); + } + + var a = this._d; + var b = n._d; + var al = a.length; + var bl = b.length; + var sum = new Array(Math.max(al, bl) + 1); + var size = Math.min(al, bl); + var carry = 0; + var digit; + + for (var i = 0; i < size; i++) { + digit = a[i] + b[i] + carry; + sum[i] = digit % BigInteger_base; + carry = (digit / BigInteger_base) | 0; + } + if (bl > al) { + a = b; + al = bl; + } + for (i = size; carry && i < al; i++) { + digit = a[i] + carry; + sum[i] = digit % BigInteger_base; + carry = (digit / BigInteger_base) | 0; + } + if (carry) { + sum[i] = carry; + } + + for ( ; i < al; i++) { + sum[i] = a[i]; + } + + return new BigInteger(sum, this._s, CONSTRUCT); +}; + +/* + Function: negate + Get the additive inverse of a . + + Returns: + + A with the same magnatude, but with the opposite sign. + + See Also: + + +*/ +BigInteger.prototype.negate = function() { + return new BigInteger(this._d, (-this._s) | 0, CONSTRUCT); +}; + +/* + Function: abs + Get the absolute value of a . + + Returns: + + A with the same magnatude, but always positive (or zero). + + See Also: + + +*/ +BigInteger.prototype.abs = function() { + return (this._s < 0) ? this.negate() : this; +}; + +/* + Function: subtract + Subtract two . + + Parameters: + + n - The number to subtract from *this*. Will be converted to a . + + Returns: + + The *n* subtracted from *this*. + + See Also: + + , , , +*/ +BigInteger.prototype.subtract = function(n) { + if (this._s === 0) { + return BigInteger(n).negate(); + } + + n = BigInteger(n); + if (n._s === 0) { + return this; + } + if (this._s !== n._s) { + n = n.negate(); + return this.add(n); + } + + var m = this; + // negative - negative => -|a| - -|b| => -|a| + |b| => |b| - |a| + if (this._s < 0) { + m = new BigInteger(n._d, 1, CONSTRUCT); + n = new BigInteger(this._d, 1, CONSTRUCT); + } + + // Both are positive => a - b + var sign = m.compareAbs(n); + if (sign === 0) { + return ZERO; + } + else if (sign < 0) { + // swap m and n + var t = n; + n = m; + m = t; + } + + // a > b + var a = m._d; + var b = n._d; + var al = a.length; + var bl = b.length; + var diff = new Array(al); // al >= bl since a > b + var borrow = 0; + var i; + var digit; + + for (i = 0; i < bl; i++) { + digit = a[i] - borrow - b[i]; + if (digit < 0) { + digit += BigInteger_base; + borrow = 1; + } + else { + borrow = 0; + } + diff[i] = digit; + } + for (i = bl; i < al; i++) { + digit = a[i] - borrow; + if (digit < 0) { + digit += BigInteger_base; + } + else { + diff[i++] = digit; + break; + } + diff[i] = digit; + } + for ( ; i < al; i++) { + diff[i] = a[i]; + } + + return new BigInteger(diff, sign, CONSTRUCT); +}; + +(function() { + function addOne(n, sign) { + var a = n._d; + var sum = a.slice(); + var carry = true; + var i = 0; + + while (true) { + var digit = (a[i] || 0) + 1; + sum[i] = digit % BigInteger_base; + if (digit <= BigInteger_base - 1) { + break; + } + ++i; + } + + return new BigInteger(sum, sign, CONSTRUCT); + } + + function subtractOne(n, sign) { + var a = n._d; + var sum = a.slice(); + var borrow = true; + var i = 0; + + while (true) { + var digit = (a[i] || 0) - 1; + if (digit < 0) { + sum[i] = digit + BigInteger_base; + } + else { + sum[i] = digit; + break; + } + ++i; + } + + return new BigInteger(sum, sign, CONSTRUCT); + } + + /* + Function: next + Get the next (add one). + + Returns: + + *this* + 1. + + See Also: + + , + */ + BigInteger.prototype.next = function() { + switch (this._s) { + case 0: + return ONE; + case -1: + return subtractOne(this, -1); + // case 1: + default: + return addOne(this, 1); + } + }; + + /* + Function: prev + Get the previous (subtract one). + + Returns: + + *this* - 1. + + See Also: + + , + */ + BigInteger.prototype.prev = function() { + switch (this._s) { + case 0: + return M_ONE; + case -1: + return addOne(this, -1); + // case 1: + default: + return subtractOne(this, 1); + } + }; +})(); + +/* + Function: compareAbs + Compare the absolute value of two . + + Calling is faster than calling twice, then . + + Parameters: + + n - The number to compare to *this*. Will be converted to a . + + Returns: + + -1, 0, or +1 if *|this|* is less than, equal to, or greater than *|n|*. + + See Also: + + , +*/ +BigInteger.prototype.compareAbs = function(n) { + if (this === n) { + return 0; + } + + if (!(n instanceof BigInteger)) { + if (!isFinite(n)) { + return(isNaN(n) ? n : -1); + } + n = BigInteger(n); + } + + if (this._s === 0) { + return (n._s !== 0) ? -1 : 0; + } + if (n._s === 0) { + return 1; + } + + var l = this._d.length; + var nl = n._d.length; + if (l < nl) { + return -1; + } + else if (l > nl) { + return 1; + } + + var a = this._d; + var b = n._d; + for (var i = l-1; i >= 0; i--) { + if (a[i] !== b[i]) { + return a[i] < b[i] ? -1 : 1; + } + } + + return 0; +}; + +/* + Function: compare + Compare two . + + Parameters: + + n - The number to compare to *this*. Will be converted to a . + + Returns: + + -1, 0, or +1 if *this* is less than, equal to, or greater than *n*. + + See Also: + + , , , +*/ +BigInteger.prototype.compare = function(n) { + if (this === n) { + return 0; + } + + n = BigInteger(n); + + if (this._s === 0) { + return -n._s; + } + + if (this._s === n._s) { // both positive or both negative + var cmp = this.compareAbs(n); + return cmp * this._s; + } + else { + return this._s; + } +}; + +/* + Function: isUnit + Return true iff *this* is either 1 or -1. + + Returns: + + true if *this* compares equal to or . + + See Also: + + , , , , , + , +*/ +BigInteger.prototype.isUnit = function() { + return this === ONE || + this === M_ONE || + (this._d.length === 1 && this._d[0] === 1); +}; + +/* + Function: multiply + Multiply two . + + Parameters: + + n - The number to multiply *this* by. Will be converted to a + . + + Returns: + + The numbers multiplied together. + + See Also: + + , , , +*/ +BigInteger.prototype.multiply = function(n) { + // TODO: Consider adding Karatsuba multiplication for large numbers + if (this._s === 0) { + return ZERO; + } + + n = BigInteger(n); + if (n._s === 0) { + return ZERO; + } + if (this.isUnit()) { + if (this._s < 0) { + return n.negate(); + } + return n; + } + if (n.isUnit()) { + if (n._s < 0) { + return this.negate(); + } + return this; + } + if (this === n) { + return this.square(); + } + + var r = (this._d.length >= n._d.length); + var a = (r ? this : n)._d; // a will be longer than b + var b = (r ? n : this)._d; + var al = a.length; + var bl = b.length; + + var pl = al + bl; + var partial = new Array(pl); + var i; + for (i = 0; i < pl; i++) { + partial[i] = 0; + } + + for (i = 0; i < bl; i++) { + var carry = 0; + var bi = b[i]; + var jlimit = al + i; + var digit; + for (var j = i; j < jlimit; j++) { + digit = partial[j] + bi * a[j - i] + carry; + carry = (digit / BigInteger_base) | 0; + partial[j] = (digit % BigInteger_base) | 0; + } + if (carry) { + digit = partial[j] + carry; + carry = (digit / BigInteger_base) | 0; + partial[j] = digit % BigInteger_base; + } + } + return new BigInteger(partial, this._s * n._s, CONSTRUCT); +}; + +// Multiply a BigInteger by a single-digit native number +// Assumes that this and n are >= 0 +// This is not really intended to be used outside the library itself +BigInteger.prototype.multiplySingleDigit = function(n) { + if (n === 0 || this._s === 0) { + return ZERO; + } + if (n === 1) { + return this; + } + + var digit; + if (this._d.length === 1) { + digit = this._d[0] * n; + if (digit >= BigInteger_base) { + return new BigInteger([(digit % BigInteger_base)|0, + (digit / BigInteger_base)|0], 1, CONSTRUCT); + } + return new BigInteger([digit], 1, CONSTRUCT); + } + + if (n === 2) { + return this.add(this); + } + if (this.isUnit()) { + return new BigInteger([n], 1, CONSTRUCT); + } + + var a = this._d; + var al = a.length; + + var pl = al + 1; + var partial = new Array(pl); + for (var i = 0; i < pl; i++) { + partial[i] = 0; + } + + var carry = 0; + for (var j = 0; j < al; j++) { + digit = n * a[j] + carry; + carry = (digit / BigInteger_base) | 0; + partial[j] = (digit % BigInteger_base) | 0; + } + if (carry) { + partial[j] = carry; + } + + return new BigInteger(partial, 1, CONSTRUCT); +}; + +/* + Function: square + Multiply a by itself. + + This is slightly faster than regular multiplication, since it removes the + duplicated multiplcations. + + Returns: + + > this.multiply(this) + + See Also: + +*/ +BigInteger.prototype.square = function() { + // Normally, squaring a 10-digit number would take 100 multiplications. + // Of these 10 are unique diagonals, of the remaining 90 (100-10), 45 are repeated. + // This procedure saves (N*(N-1))/2 multiplications, (e.g., 45 of 100 multiplies). + // Based on code by Gary Darby, Intellitech Systems Inc., www.DelphiForFun.org + + if (this._s === 0) { + return ZERO; + } + if (this.isUnit()) { + return ONE; + } + + var digits = this._d; + var length = digits.length; + var imult1 = new Array(length + length + 1); + var product, carry, k; + var i; + + // Calculate diagonal + for (i = 0; i < length; i++) { + k = i * 2; + product = digits[i] * digits[i]; + carry = (product / BigInteger_base) | 0; + imult1[k] = product % BigInteger_base; + imult1[k + 1] = carry; + } + + // Calculate repeating part + for (i = 0; i < length; i++) { + carry = 0; + k = i * 2 + 1; + for (var j = i + 1; j < length; j++, k++) { + product = digits[j] * digits[i] * 2 + imult1[k] + carry; + carry = (product / BigInteger_base) | 0; + imult1[k] = product % BigInteger_base; + } + k = length + i; + var digit = carry + imult1[k]; + carry = (digit / BigInteger_base) | 0; + imult1[k] = digit % BigInteger_base; + imult1[k + 1] += carry; + } + + return new BigInteger(imult1, 1, CONSTRUCT); +}; + +/* + Function: quotient + Divide two and truncate towards zero. + + throws an exception if *n* is zero. + + Parameters: + + n - The number to divide *this* by. Will be converted to a . + + Returns: + + The *this* / *n*, truncated to an integer. + + See Also: + + , , , , +*/ +BigInteger.prototype.quotient = function(n) { + return this.divRem(n)[0]; +}; + +/* + Function: divide + Deprecated synonym for . +*/ +BigInteger.prototype.divide = BigInteger.prototype.quotient; + +/* + Function: remainder + Calculate the remainder of two . + + throws an exception if *n* is zero. + + Parameters: + + n - The remainder after *this* is divided *this* by *n*. Will be + converted to a . + + Returns: + + *this* % *n*. + + See Also: + + , +*/ +BigInteger.prototype.remainder = function(n) { + return this.divRem(n)[1]; +}; + +/* + Function: divRem + Calculate the integer quotient and remainder of two . + + throws an exception if *n* is zero. + + Parameters: + + n - The number to divide *this* by. Will be converted to a . + + Returns: + + A two-element array containing the quotient and the remainder. + + > a.divRem(b) + + is exactly equivalent to + + > [a.quotient(b), a.remainder(b)] + + except it is faster, because they are calculated at the same time. + + See Also: + + , +*/ +BigInteger.prototype.divRem = function(n) { + n = BigInteger(n); + if (n._s === 0) { + throw new Error("Divide by zero"); + } + if (this._s === 0) { + return [ZERO, ZERO]; + } + if (n._d.length === 1) { + return this.divRemSmall(n._s * n._d[0]); + } + + // Test for easy cases -- |n1| <= |n2| + switch (this.compareAbs(n)) { + case 0: // n1 == n2 + return [this._s === n._s ? ONE : M_ONE, ZERO]; + case -1: // |n1| < |n2| + return [ZERO, this]; + } + + var sign = this._s * n._s; + var a = n.abs(); + var b_digits = this._d; + var b_index = b_digits.length; + var digits = n._d.length; + var quot = []; + var guess; + + var part = new BigInteger([], 0, CONSTRUCT); + part._s = 1; + + while (b_index) { + part._d.unshift(b_digits[--b_index]); + + if (part.compareAbs(n) < 0) { + quot.push(0); + continue; + } + if (part._s === 0) { + guess = 0; + } + else { + var xlen = part._d.length, ylen = a._d.length; + var highx = part._d[xlen-1]*BigInteger_base + part._d[xlen-2]; + var highy = a._d[ylen-1]*BigInteger_base + a._d[ylen-2]; + if (part._d.length > a._d.length) { + // The length of part._d can either match a._d length, + // or exceed it by one. + highx = (highx+1)*BigInteger_base; + } + guess = Math.ceil(highx/highy); + } + do { + var check = a.multiplySingleDigit(guess); + if (check.compareAbs(part) <= 0) { + break; + } + guess--; + } while (guess); + + quot.push(guess); + if (!guess) { + continue; + } + var diff = part.subtract(check); + part._d = diff._d.slice(); + if (part._d.length === 0) { + part._s = 0; + } + } + + return [new BigInteger(quot.reverse(), sign, CONSTRUCT), + new BigInteger(part._d, this._s, CONSTRUCT)]; +}; + +// Throws an exception if n is outside of (-BigInteger.base, -1] or +// [1, BigInteger.base). It's not necessary to call this, since the +// other division functions will call it if they are able to. +BigInteger.prototype.divRemSmall = function(n) { + var r; + n = +n; + if (n === 0) { + throw new Error("Divide by zero"); + } + + var n_s = n < 0 ? -1 : 1; + var sign = this._s * n_s; + n = Math.abs(n); + + if (n < 1 || n >= BigInteger_base) { + throw new Error("Argument out of range"); + } + + if (this._s === 0) { + return [ZERO, ZERO]; + } + + if (n === 1 || n === -1) { + return [(sign === 1) ? this.abs() : new BigInteger(this._d, sign, CONSTRUCT), ZERO]; + } + + // 2 <= n < BigInteger_base + + // divide a single digit by a single digit + if (this._d.length === 1) { + var q = new BigInteger([(this._d[0] / n) | 0], 1, CONSTRUCT); + r = new BigInteger([(this._d[0] % n) | 0], 1, CONSTRUCT); + if (sign < 0) { + q = q.negate(); + } + if (this._s < 0) { + r = r.negate(); + } + return [q, r]; + } + + var digits = this._d.slice(); + var quot = new Array(digits.length); + var part = 0; + var diff = 0; + var i = 0; + var guess; + + while (digits.length) { + part = part * BigInteger_base + digits[digits.length - 1]; + if (part < n) { + quot[i++] = 0; + digits.pop(); + diff = BigInteger_base * diff + part; + continue; + } + if (part === 0) { + guess = 0; + } + else { + guess = (part / n) | 0; + } + + var check = n * guess; + diff = part - check; + quot[i++] = guess; + if (!guess) { + digits.pop(); + continue; + } + + digits.pop(); + part = diff; + } + + r = new BigInteger([diff], 1, CONSTRUCT); + if (this._s < 0) { + r = r.negate(); + } + return [new BigInteger(quot.reverse(), sign, CONSTRUCT), r]; +}; + +/* + Function: isEven + Return true iff *this* is divisible by two. + + Note that is even. + + Returns: + + true if *this* is even, false otherwise. + + See Also: + + +*/ +BigInteger.prototype.isEven = function() { + var digits = this._d; + return this._s === 0 || digits.length === 0 || (digits[0] % 2) === 0; +}; + +/* + Function: isOdd + Return true iff *this* is not divisible by two. + + Returns: + + true if *this* is odd, false otherwise. + + See Also: + + +*/ +BigInteger.prototype.isOdd = function() { + return !this.isEven(); +}; + +/* + Function: sign + Get the sign of a . + + Returns: + + * -1 if *this* < 0 + * 0 if *this* == 0 + * +1 if *this* > 0 + + See Also: + + , , , , +*/ +BigInteger.prototype.sign = function() { + return this._s; +}; + +/* + Function: isPositive + Return true iff *this* > 0. + + Returns: + + true if *this*.compare() == 1. + + See Also: + + , , , , , +*/ +BigInteger.prototype.isPositive = function() { + return this._s > 0; +}; + +/* + Function: isNegative + Return true iff *this* < 0. + + Returns: + + true if *this*.compare() == -1. + + See Also: + + , , , , , +*/ +BigInteger.prototype.isNegative = function() { + return this._s < 0; +}; + +/* + Function: isZero + Return true iff *this* == 0. + + Returns: + + true if *this*.compare() == 0. + + See Also: + + , , , , +*/ +BigInteger.prototype.isZero = function() { + return this._s === 0; +}; + +/* + Function: exp10 + Multiply a by a power of 10. + + This is equivalent to, but faster than + + > if (n >= 0) { + > return this.multiply(BigInteger("1e" + n)); + > } + > else { // n <= 0 + > return this.quotient(BigInteger("1e" + -n)); + > } + + Parameters: + + n - The power of 10 to multiply *this* by. *n* is converted to a + javascipt number and must be no greater than + (0x7FFFFFFF), or an exception will be thrown. + + Returns: + + *this* * (10 ** *n*), truncated to an integer if necessary. + + See Also: + + , +*/ +BigInteger.prototype.exp10 = function(n) { + n = +n; + if (n === 0) { + return this; + } + if (Math.abs(n) > Number(MAX_EXP)) { + throw new Error("exponent too large in BigInteger.exp10"); + } + if (n > 0) { + var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT); + + for (; n >= BigInteger_base_log10; n -= BigInteger_base_log10) { + k._d.unshift(0); + } + if (n == 0) + return k; + k._s = 1; + k = k.multiplySingleDigit(Math.pow(10, n)); + return (this._s < 0 ? k.negate() : k); + } else if (-n >= this._d.length*BigInteger_base_log10) { + return ZERO; + } else { + var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT); + + for (n = -n; n >= BigInteger_base_log10; n -= BigInteger_base_log10) { + k._d.shift(); + } + return (n == 0) ? k : k.divRemSmall(Math.pow(10, n))[0]; + } +}; + +/* + Function: pow + Raise a to a power. + + In this implementation, 0**0 is 1. + + Parameters: + + n - The exponent to raise *this* by. *n* must be no greater than + (0x7FFFFFFF), or an exception will be thrown. + + Returns: + + *this* raised to the *nth* power. + + See Also: + + +*/ +BigInteger.prototype.pow = function(n) { + if (this.isUnit()) { + if (this._s > 0) { + return this; + } + else { + return BigInteger(n).isOdd() ? this : this.negate(); + } + } + + n = BigInteger(n); + if (n._s === 0) { + return ONE; + } + else if (n._s < 0) { + if (this._s === 0) { + throw new Error("Divide by zero"); + } + else { + return ZERO; + } + } + if (this._s === 0) { + return ZERO; + } + if (n.isUnit()) { + return this; + } + + if (n.compareAbs(MAX_EXP) > 0) { + throw new Error("exponent too large in BigInteger.pow"); + } + var x = this; + var aux = ONE; + var two = BigInteger.small[2]; + + while (n.isPositive()) { + if (n.isOdd()) { + aux = aux.multiply(x); + if (n.isUnit()) { + return aux; + } + } + x = x.square(); + n = n.quotient(two); + } + + return aux; +}; + +/* + Function: modPow + Raise a to a power (mod m). + + Because it is reduced by a modulus, is not limited by + like . + + Parameters: + + exponent - The exponent to raise *this* by. Must be positive. + modulus - The modulus. + + Returns: + + *this* ^ *exponent* (mod *modulus*). + + See Also: + + , +*/ +BigInteger.prototype.modPow = function(exponent, modulus) { + var result = ONE; + var base = this; + + while (exponent.isPositive()) { + if (exponent.isOdd()) { + result = result.multiply(base).remainder(modulus); + } + + exponent = exponent.quotient(BigInteger.small[2]); + if (exponent.isPositive()) { + base = base.square().remainder(modulus); + } + } + + return result; +}; + +/* + Function: log + Get the natural logarithm of a as a native JavaScript number. + + This is equivalent to + + > Math.log(this.toJSValue()) + + but handles values outside of the native number range. + + Returns: + + log( *this* ) + + See Also: + + +*/ +BigInteger.prototype.log = function() { + switch (this._s) { + case 0: return -Infinity; + case -1: return NaN; + default: // Fall through. + } + + var l = this._d.length; + + if (l*BigInteger_base_log10 < 30) { + return Math.log(this.valueOf()); + } + + var N = Math.ceil(30/BigInteger_base_log10); + var firstNdigits = this._d.slice(l - N); + return Math.log((new BigInteger(firstNdigits, 1, CONSTRUCT)).valueOf()) + (l - N) * Math.log(BigInteger_base); +}; + +/* + Function: valueOf + Convert a to a native JavaScript integer. + + This is called automatically by JavaScipt to convert a to a + native value. + + Returns: + + > parseInt(this.toString(), 10) + + See Also: + + , +*/ +BigInteger.prototype.valueOf = function() { + return parseInt(this.toString(), 10); +}; + +/* + Function: toJSValue + Convert a to a native JavaScript integer. + + This is the same as valueOf, but more explicitly named. + + Returns: + + > parseInt(this.toString(), 10) + + See Also: + + , +*/ +BigInteger.prototype.toJSValue = function() { + return parseInt(this.toString(), 10); +}; + +var MAX_EXP = BigInteger(0x7FFFFFFF); +// Constant: MAX_EXP +// The largest exponent allowed in and (0x7FFFFFFF or 2147483647). +BigInteger.MAX_EXP = MAX_EXP; + +(function() { + function makeUnary(fn) { + return function(a) { + return fn.call(BigInteger(a)); + }; + } + + function makeBinary(fn) { + return function(a, b) { + return fn.call(BigInteger(a), BigInteger(b)); + }; + } + + function makeTrinary(fn) { + return function(a, b, c) { + return fn.call(BigInteger(a), BigInteger(b), BigInteger(c)); + }; + } + + (function() { + var i, fn; + var unary = "toJSValue,isEven,isOdd,sign,isZero,isNegative,abs,isUnit,square,negate,isPositive,toString,next,prev,log".split(","); + var binary = "compare,remainder,divRem,subtract,add,quotient,divide,multiply,pow,compareAbs".split(","); + var trinary = ["modPow"]; + + for (i = 0; i < unary.length; i++) { + fn = unary[i]; + BigInteger[fn] = makeUnary(BigInteger.prototype[fn]); + } + + for (i = 0; i < binary.length; i++) { + fn = binary[i]; + BigInteger[fn] = makeBinary(BigInteger.prototype[fn]); + } + + for (i = 0; i < trinary.length; i++) { + fn = trinary[i]; + BigInteger[fn] = makeTrinary(BigInteger.prototype[fn]); + } + + BigInteger.exp10 = function(x, n) { + return BigInteger(x).exp10(n); + }; + })(); +})(); + +exports.BigInteger = BigInteger; +})(typeof exports !== 'undefined' ? exports : this); diff --git a/commodoreclicker/js/thirdparty/domReady.js b/commodoreclicker/js/thirdparty/domReady.js new file mode 100644 index 00000000..2b541220 --- /dev/null +++ b/commodoreclicker/js/thirdparty/domReady.js @@ -0,0 +1,129 @@ +/** + * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * Available via the MIT or new BSD license. + * see: http://github.com/requirejs/domReady for details + */ +/*jslint */ +/*global require: false, define: false, requirejs: false, + window: false, clearInterval: false, document: false, + self: false, setInterval: false */ + + +define(function () { + 'use strict'; + + var isTop, testDiv, scrollIntervalId, + isBrowser = typeof window !== "undefined" && window.document, + isPageLoaded = !isBrowser, + doc = isBrowser ? document : null, + readyCalls = []; + + function runCallbacks(callbacks) { + var i; + for (i = 0; i < callbacks.length; i += 1) { + callbacks[i](doc); + } + } + + function callReady() { + var callbacks = readyCalls; + + if (isPageLoaded) { + //Call the DOM ready callbacks + if (callbacks.length) { + readyCalls = []; + runCallbacks(callbacks); + } + } + } + + /** + * Sets the page as loaded. + */ + function pageLoaded() { + if (!isPageLoaded) { + isPageLoaded = true; + if (scrollIntervalId) { + clearInterval(scrollIntervalId); + } + + callReady(); + } + } + + if (isBrowser) { + if (document.addEventListener) { + //Standards. Hooray! Assumption here that if standards based, + //it knows about DOMContentLoaded. + document.addEventListener("DOMContentLoaded", pageLoaded, false); + window.addEventListener("load", pageLoaded, false); + } else if (window.attachEvent) { + window.attachEvent("onload", pageLoaded); + + testDiv = document.createElement('div'); + try { + isTop = window.frameElement === null; + } catch (e) {} + + //DOMContentLoaded approximation that uses a doScroll, as found by + //Diego Perini: http://javascript.nwbox.com/IEContentLoaded/, + //but modified by other contributors, including jdalton + if (testDiv.doScroll && isTop && window.external) { + scrollIntervalId = setInterval(function () { + try { + testDiv.doScroll(); + pageLoaded(); + } catch (e) {} + }, 30); + } + } + + //Check if document already complete, and if so, just trigger page load + //listeners. Latest webkit browsers also use "interactive", and + //will fire the onDOMContentLoaded before "interactive" but not after + //entering "interactive" or "complete". More details: + //http://dev.w3.org/html5/spec/the-end.html#the-end + //http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded + //Hmm, this is more complicated on further use, see "firing too early" + //bug: https://github.com/requirejs/domReady/issues/1 + //so removing the || document.readyState === "interactive" test. + //There is still a window.onload binding that should get fired if + //DOMContentLoaded is missed. + if (document.readyState === "complete") { + pageLoaded(); + } + } + + /** START OF PUBLIC API **/ + + /** + * Registers a callback for DOM ready. If DOM is already ready, the + * callback is called immediately. + * @param {Function} callback + */ + function domReady(callback) { + if (isPageLoaded) { + callback(doc); + } else { + readyCalls.push(callback); + } + return domReady; + } + + domReady.version = '2.0.1'; + + /** + * Loader Plugin API method + */ + domReady.load = function (name, req, onLoad, config) { + if (config.isBuild) { + onLoad(null); + } else { + domReady(onLoad); + } + }; + + /** END OF PUBLIC API **/ + + return domReady; +}); diff --git a/commodoreclicker/js/thirdparty/jquery-ajax-blob-arraybuffer.js b/commodoreclicker/js/thirdparty/jquery-ajax-blob-arraybuffer.js new file mode 100644 index 00000000..f1535452 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jquery-ajax-blob-arraybuffer.js @@ -0,0 +1,55 @@ +/** + * Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2 + * within the comfortable framework of the jquery ajax request, with full support for promises. + * + * Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list + * of potential transports (so it gets first dibs if the request passes the conditions within to provide the + * ajax transport, preventing the standard transport from hogging the request), and the * indicates that + * potentially any request with any dataType might want to use the transports provided herein. + * + * Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer - + * otherwise jquery will try (and fail) to convert the blob or buffer into a query string. + */ +$.ajaxTransport("+*", function(options, originalOptions, jqXHR){ + // Test for the conditions that mean we can/want to send/receive blobs or arraybuffers - we need XMLHttpRequest + // level 2 (so feature-detect against window.FormData), feature detect against window.Blob or window.ArrayBuffer, + // and then check to see if the dataType is blob/arraybuffer or the data itself is a Blob/ArrayBuffer + if (window.FormData && ((options.dataType && (options.dataType == 'blob' || options.dataType == 'arraybuffer')) + || (options.data && ((window.Blob && options.data instanceof Blob) + || (window.ArrayBuffer && options.data instanceof ArrayBuffer))) + )) + { + return { + /** + * Return a transport capable of sending and/or receiving blobs - in this case, we instantiate + * a new XMLHttpRequest and use it to actually perform the request, and funnel the result back + * into the jquery complete callback (such as the success function, done blocks, etc.) + * + * @param headers + * @param completeCallback + */ + send: function(headers, completeCallback){ + var xhr = new XMLHttpRequest(), + url = options.url || window.location.href, + type = options.type || 'GET', + dataType = options.dataType || 'text', + data = options.data || null, + async = options.async || true; + + xhr.addEventListener('load', function(){ + var res = {}; + + res[dataType] = xhr.response; + completeCallback(xhr.status, xhr.statusText, res, xhr.getAllResponseHeaders()); + }); + + xhr.open(type, url, async); + xhr.responseType = dataType; + xhr.send(data); + }, + abort: function(){ + jqXHR.abort(); + } + }; + } +}); diff --git a/commodoreclicker/js/thirdparty/jquery.nodoubletapzoom.js b/commodoreclicker/js/thirdparty/jquery.nodoubletapzoom.js new file mode 100644 index 00000000..e3a4b100 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jquery.nodoubletapzoom.js @@ -0,0 +1,21 @@ +/* + Prevent double-tap to zoom on touch-capable devices + John Sundstrom, adapted by Wouter Konecny + http://stackoverflow.com/questions/10614481 +*/ +(function($) { + $.fn.nodoubletapzoom = function() { + $(this).bind('touchstart', function preventZoom(e) { + var t2 = e.timeStamp + , t1 = $(this).data('lastTouch') || t2 + , dt = t2 - t1 + , fingers = e.originalEvent.touches.length; + $(this).data('lastTouch', t2); + if (!dt || dt > 500 || fingers > 1) return; // not double-tap + + e.preventDefault(); // double tap - prevent the zoom + // also synthesize click events we just swallowed up + $(this).trigger('click'); + }); + }; +})(jQuery); diff --git a/commodoreclicker/js/thirdparty/jquery.powertip.min.js b/commodoreclicker/js/thirdparty/jquery.powertip.min.js new file mode 100644 index 00000000..40874ae2 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jquery.powertip.min.js @@ -0,0 +1,8 @@ +/*! + PowerTip - v1.2.0 - 2013-04-03 + http://stevenbenner.github.com/jquery-powertip/ + Copyright (c) 2013 Steven Benner (http://stevenbenner.com/). + Released under MIT license. + https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt +*/ +(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(){var t=this;t.top="auto",t.left="auto",t.right="auto",t.bottom="auto",t.set=function(o,n){e.isNumeric(n)&&(t[o]=Math.round(n))}}function o(e,t,o){function n(n,i){r(),e.data(v)||(n?(i&&e.data(m,!0),o.showTip(e)):(P.tipOpenImminent=!0,l=setTimeout(function(){l=null,s()},t.intentPollInterval)))}function i(n){r(),P.tipOpenImminent=!1,e.data(v)&&(e.data(m,!1),n?o.hideTip(e):(P.delayInProgress=!0,l=setTimeout(function(){l=null,o.hideTip(e),P.delayInProgress=!1},t.closeDelay)))}function s(){var i=Math.abs(P.previousX-P.currentX),s=Math.abs(P.previousY-P.currentY),r=i+s;t.intentSensitivity>r?o.showTip(e):(P.previousX=P.currentX,P.previousY=P.currentY,n())}function r(){l=clearTimeout(l),P.delayInProgress=!1}function a(){o.resetPosition(e)}var l=null;this.show=n,this.hide=i,this.cancel=r,this.resetPosition=a}function n(){function e(e,i,r,a,l){var p,c=i.split("-")[0],u=new t;switch(p=s(e)?n(e,c):o(e,c),i){case"n":u.set("left",p.left-r/2),u.set("bottom",P.windowHeight-p.top+l);break;case"e":u.set("left",p.left+l),u.set("top",p.top-a/2);break;case"s":u.set("left",p.left-r/2),u.set("top",p.top+l);break;case"w":u.set("top",p.top-a/2),u.set("right",P.windowWidth-p.left+l);break;case"nw":u.set("bottom",P.windowHeight-p.top+l),u.set("right",P.windowWidth-p.left-20);break;case"nw-alt":u.set("left",p.left),u.set("bottom",P.windowHeight-p.top+l);break;case"ne":u.set("left",p.left-20),u.set("bottom",P.windowHeight-p.top+l);break;case"ne-alt":u.set("bottom",P.windowHeight-p.top+l),u.set("right",P.windowWidth-p.left);break;case"sw":u.set("top",p.top+l),u.set("right",P.windowWidth-p.left-20);break;case"sw-alt":u.set("left",p.left),u.set("top",p.top+l);break;case"se":u.set("left",p.left-20),u.set("top",p.top+l);break;case"se-alt":u.set("top",p.top+l),u.set("right",P.windowWidth-p.left)}return u}function o(e,t){var o,n,i=e.offset(),s=e.outerWidth(),r=e.outerHeight();switch(t){case"n":o=i.left+s/2,n=i.top;break;case"e":o=i.left+s,n=i.top+r/2;break;case"s":o=i.left+s/2,n=i.top+r;break;case"w":o=i.left,n=i.top+r/2;break;case"nw":o=i.left,n=i.top;break;case"ne":o=i.left+s,n=i.top;break;case"sw":o=i.left,n=i.top+r;break;case"se":o=i.left+s,n=i.top+r}return{top:n,left:o}}function n(e,t){function o(){d.push(p.matrixTransform(u))}var n,i,s,r,a=e.closest("svg")[0],l=e[0],p=a.createSVGPoint(),c=l.getBBox(),u=l.getScreenCTM(),f=c.width/2,w=c.height/2,d=[],h=["nw","n","ne","e","se","s","sw","w"];if(p.x=c.x,p.y=c.y,o(),p.x+=f,o(),p.x+=f,o(),p.y+=w,o(),p.y+=w,o(),p.x-=f,o(),p.x-=f,o(),p.y-=w,o(),d[0].y!==d[1].y||d[0].x!==d[7].x)for(i=Math.atan2(u.b,u.a)*O,s=Math.ceil((i%360-22.5)/45),1>s&&(s+=8);s--;)h.push(h.shift());for(r=0;d.length>r;r++)if(h[r]===t){n=d[r];break}return{top:n.y+P.scrollTop,left:n.x+P.scrollLeft}}this.compute=e}function i(o){function i(e){e.data(v,!0),O.queue(function(t){s(e),t()})}function s(e){var t;if(e.data(v)){if(P.isTipOpen)return P.isClosing||r(P.activeHover),O.delay(100).queue(function(t){s(e),t()}),void 0;e.trigger("powerTipPreRender"),t=p(e),t&&(O.empty().append(t),e.trigger("powerTipRender"),P.activeHover=e,P.isTipOpen=!0,O.data(g,o.mouseOnToPopup),o.followMouse?a():(b(e),P.isFixedTipOpen=!0),O.fadeIn(o.fadeInTime,function(){P.desyncTimeout||(P.desyncTimeout=setInterval(H,500)),e.trigger("powerTipOpen")}))}}function r(e){P.isClosing=!0,P.activeHover=null,P.isTipOpen=!1,P.desyncTimeout=clearInterval(P.desyncTimeout),e.data(v,!1),e.data(m,!1),O.fadeOut(o.fadeOutTime,function(){var n=new t;P.isClosing=!1,P.isFixedTipOpen=!1,O.removeClass(),n.set("top",P.currentY+o.offset),n.set("left",P.currentX+o.offset),O.css(n),e.trigger("powerTipClose")})}function a(){if(!P.isFixedTipOpen&&(P.isTipOpen||P.tipOpenImminent&&O.data(T))){var e,n,i=O.outerWidth(),s=O.outerHeight(),r=new t;r.set("top",P.currentY+o.offset),r.set("left",P.currentX+o.offset),e=c(r,i,s),e!==I.none&&(n=u(e),1===n?e===I.right?r.set("left",P.windowWidth-i):e===I.bottom&&r.set("top",P.scrollTop+P.windowHeight-s):(r.set("left",P.currentX-i-o.offset),r.set("top",P.currentY-s-o.offset))),O.css(r)}}function b(t){var n,i;o.smartPlacement?(n=e.fn.powerTip.smartPlacementLists[o.placement],e.each(n,function(e,o){var n=c(y(t,o),O.outerWidth(),O.outerHeight());return i=o,n===I.none?!1:void 0})):(y(t,o.placement),i=o.placement),O.addClass(i)}function y(e,n){var i,s,r=0,a=new t;a.set("top",0),a.set("left",0),O.css(a);do i=O.outerWidth(),s=O.outerHeight(),a=k.compute(e,n,i,s,o.offset),O.css(a);while(5>=++r&&(i!==O.outerWidth()||s!==O.outerHeight()));return a}function H(){var e=!1;!P.isTipOpen||P.isClosing||P.delayInProgress||(P.activeHover.data(v)===!1||P.activeHover.is(":disabled")?e=!0:l(P.activeHover)||P.activeHover.is(":focus")||P.activeHover.data(m)||(O.data(g)?l(O)||(e=!0):e=!0),e&&r(P.activeHover))}var k=new n,O=e("#"+o.popupId);0===O.length&&(O=e("
    ",{id:o.popupId}),0===d.length&&(d=e("body")),d.append(O)),o.followMouse&&(O.data(T)||(f.on("mousemove",a),w.on("scroll",a),O.data(T,!0))),o.mouseOnToPopup&&O.on({mouseenter:function(){O.data(g)&&P.activeHover&&P.activeHover.data(h).cancel()},mouseleave:function(){P.activeHover&&P.activeHover.data(h).hide()}}),this.showTip=i,this.hideTip=r,this.resetPosition=b}function s(e){return window.SVGElement&&e[0]instanceof SVGElement}function r(){P.mouseTrackingActive||(P.mouseTrackingActive=!0,e(function(){P.scrollLeft=w.scrollLeft(),P.scrollTop=w.scrollTop(),P.windowWidth=w.width(),P.windowHeight=w.height()}),f.on("mousemove",a),w.on({resize:function(){P.windowWidth=w.width(),P.windowHeight=w.height()},scroll:function(){var e=w.scrollLeft(),t=w.scrollTop();e!==P.scrollLeft&&(P.currentX+=e-P.scrollLeft,P.scrollLeft=e),t!==P.scrollTop&&(P.currentY+=t-P.scrollTop,P.scrollTop=t)}}))}function a(e){P.currentX=e.pageX,P.currentY=e.pageY}function l(e){var t=e.offset(),o=e[0].getBoundingClientRect(),n=o.right-o.left,i=o.bottom-o.top;return P.currentX>=t.left&&P.currentX<=t.left+n&&P.currentY>=t.top&&P.currentY<=t.top+i}function p(t){var o,n,i=t.data(y),s=t.data(H),r=t.data(k);return i?(e.isFunction(i)&&(i=i.call(t[0])),n=i):s?(e.isFunction(s)&&(s=s.call(t[0])),s.length>0&&(n=s.clone(!0,!0))):r&&(o=e("#"+r),o.length>0&&(n=o.html())),n}function c(e,t,o){var n=P.scrollTop,i=P.scrollLeft,s=n+P.windowHeight,r=i+P.windowWidth,a=I.none;return(n>e.top||n>Math.abs(e.bottom-P.windowHeight)-o)&&(a|=I.top),(e.top+o>s||Math.abs(e.bottom-P.windowHeight)>s)&&(a|=I.bottom),(i>e.left||e.right+t>r)&&(a|=I.left),(e.left+t>r||i>e.right)&&(a|=I.right),a}function u(e){for(var t=0;e;)e&=e-1,t++;return t}var f=e(document),w=e(window),d=e("body"),h="displayController",v="hasActiveHover",m="forcedOpen",T="hasMouseMove",g="mouseOnToPopup",b="originalTitle",y="powertip",H="powertipjq",k="powertiptarget",O=180/Math.PI,P={isTipOpen:!1,isFixedTipOpen:!1,isClosing:!1,tipOpenImminent:!1,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:!1,delayInProgress:!1,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0},I={none:0,top:1,bottom:2,left:4,right:8};e.fn.powerTip=function(t,n){if(!this.length)return this;if("string"===e.type(t)&&e.powerTip[t])return e.powerTip[t].call(this,this,n);var s=e.extend({},e.fn.powerTip.defaults,t),a=new i(s);return r(),this.each(function(){var t,n=e(this),i=n.data(y),r=n.data(H),l=n.data(k);n.data(h)&&e.powerTip.destroy(n),t=n.attr("title"),i||l||r||!t||(n.data(y,t),n.data(b,t),n.removeAttr("title")),n.data(h,new o(n,s,a))}),s.manual||this.on({"mouseenter.powertip":function(t){e.powerTip.show(this,t)},"mouseleave.powertip":function(){e.powerTip.hide(this)},"focus.powertip":function(){e.powerTip.show(this)},"blur.powertip":function(){e.powerTip.hide(this,!0)},"keydown.powertip":function(t){27===t.keyCode&&e.powerTip.hide(this,!0)}}),this},e.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:!1,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:!1,offset:10,mouseOnToPopup:!1,manual:!1},e.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]},e.powerTip={show:function(t,o){return o?(a(o),P.previousX=o.pageX,P.previousY=o.pageY,e(t).data(h).show()):e(t).first().data(h).show(!0,!0),t},reposition:function(t){return e(t).first().data(h).resetPosition(),t},hide:function(t,o){return t?e(t).first().data(h).hide(o):P.activeHover&&P.activeHover.data(h).hide(!0),t},destroy:function(t){return e(t).off(".powertip").each(function(){var t=e(this),o=[b,h,v,m];t.data(b)&&(t.attr("title",t.data(b)),o.push(y)),t.removeData(o)}),t}},e.powerTip.showTip=e.powerTip.show,e.powerTip.closeTip=e.powerTip.hide}); \ No newline at end of file diff --git a/commodoreclicker/js/thirdparty/jszip/.gitignore b/commodoreclicker/js/thirdparty/jszip/.gitignore new file mode 100644 index 00000000..972cdc6f --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/.gitignore @@ -0,0 +1,4 @@ +*~ +node_modules +sauce_connect.log +.c9revisions \ No newline at end of file diff --git a/commodoreclicker/js/thirdparty/jszip/.jshintignore b/commodoreclicker/js/thirdparty/jszip/.jshintignore new file mode 100644 index 00000000..f05b1f26 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/.jshintignore @@ -0,0 +1,2 @@ +node_modules +test diff --git a/commodoreclicker/js/thirdparty/jszip/.jshintrc b/commodoreclicker/js/thirdparty/jszip/.jshintrc new file mode 100644 index 00000000..0f34a5f1 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/.jshintrc @@ -0,0 +1,12 @@ +{ + "undef": true, + "strict": true, + "sub": true, + + "globals": { + "TextEncoder": false, + "TextDecoder": false + }, + "browser": true, + "node": true +} diff --git a/commodoreclicker/js/thirdparty/jszip/.npmignore b/commodoreclicker/js/thirdparty/jszip/.npmignore new file mode 100644 index 00000000..03046662 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/.npmignore @@ -0,0 +1,9 @@ +_config.yml +bower.json +component.json +dist +docs +documentation +Gruntfile.js +index.html +test diff --git a/commodoreclicker/js/thirdparty/jszip/.travis.yml b/commodoreclicker/js/thirdparty/jszip/.travis.yml new file mode 100644 index 00000000..07c06246 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: +- '0.10' +script: npm run $COMMAND +env: + matrix: + - COMMAND=test-node + - COMMAND=test-browser + global: + - secure: MhA8GHU42X3GWTUMaqdZVvarx4BMjhQCUGNi3kvuD/iCmKVb7gMwj4jbds7AcJdsCRsRk8bBGzZs/E7HidBJMPDa5DhgLKy9EV1s42JlHq8lVzbJeWIGgrtyJvhVUkGRy2OJjnDSgh3U6elkQmvDn74jreSQc6m/yGoPFF1nqq8= + - secure: qREw6aUu2DnB+2reMuHgygSkumRiJvt7Z5Fz4uEVoraqbe65e4PGhtzypr9uIgCN43vxS2D5tAIeDbfid5VQrWFUQnrC9O5Z5qgVPsKN94zZ1tvYurXI4wRlAg58nNjkfGXWhLI3VUjjDTp5gYcMqgfe5hpEFYUPnUQkKGnaqAk= diff --git a/commodoreclicker/js/thirdparty/jszip/CHANGES.md b/commodoreclicker/js/thirdparty/jszip/CHANGES.md new file mode 100644 index 00000000..04b353f4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/CHANGES.md @@ -0,0 +1,63 @@ +--- +title: Changelog +layout: default +section: main +--- + +### v2.4.0 2014-07-24 +- update pako to 0.2.5 (see [#156](https://github.com/Stuk/jszip/issues/156)). +- make JSZip work in a Firefox addon context (see [#151](https://github.com/Stuk/jszip/issues/151)). +- add an option (`createFolders`) to control the subfolder generation (see [#154](https://github.com/Stuk/jszip/issues/154)). +- allow `Buffer` polyfill in the browser (see [#139](https://github.com/Stuk/jszip/issues/139)). + +### v2.3.0 2014-06-18 +- don't generate subfolders (see [#130](https://github.com/Stuk/jszip/issues/130)). +- add comment support (see [#134](https://github.com/Stuk/jszip/issues/134)). +- on `ZipObject#options`, the attributes `date` and `dir` have been deprecated and are now on `ZipObject` (see [the upgrade guide](http://stuk.github.io/jszip/documentation/upgrade_guide.html)). +- on `ZipObject#options`, the attributes `base64` and `binary` have been deprecated (see [the upgrade guide](http://stuk.github.io/jszip/documentation/upgrade_guide.html)). +- deprecate internal functions exposed in the public API (see [#123](https://github.com/Stuk/jszip/issues/123)). +- improve UTF-8 support (see [#142](https://github.com/Stuk/jszip/issues/142)). + +### v2.2.2, 2014-05-01 + - update pako to v0.2.1, fix an error when decompressing some files (see [#126](https://github.com/Stuk/jszip/issues/126)). + +### v2.2.1, 2014-04-23 + - fix unreadable generated file on Windows 8 (see [#112](https://github.com/Stuk/jszip/issues/112)). + - replace zlibjs with pako. + +### v2.2.0, 2014-02-25 + - make the `new` operator optional before the `JSZip` constructor (see [#93](https://github.com/Stuk/jszip/pull/93)). + - update zlibjs to v0.2.0. + +### v2.1.1, 2014-02-13 + - use the npm package for zlib.js instead of the github url. + +### v2.1.0, 2014-02-06 + - split the files and use Browserify to generate the final file (see [#74](https://github.com/Stuk/jszip/pull/74)) + - packaging change : instead of 4 files (jszip.js, jszip-load.js, jszip-inflate.js, jszip-deflate.js) we now have 2 files : dist/jszip.js and dist/jszip.min.js + - add component/bower support + - rename variable: 'byte' is a reserved word (see [#76](https://github.com/Stuk/jszip/pull/76)) + - add support for the unicode path extra field (see [#82](https://github.com/Stuk/jszip/pull/82)) + - ensure that the generated files have a header with the licenses (see [#80](https://github.com/Stuk/jszip/pull/80)) + +# v2.0.0, 2013-10-20 + + - `JSZipBase64` has been renamed to `JSZip.base64`. + - The `data` attribute on the object returned by `zip.file(name)` has been removed. Use `asText()`, `asBinary()`, `asUint8Array()`, `asArrayBuffer()` or `asNodeBuffer()`. + + - [Fix issue with Android browser](https://github.com/Stuk/jszip/pull/60) + + - The compression/decompression methods now give their input type with the `compressInputType` and `uncompressInputType` attributes. + - Lazily decompress data when needed and [improve performance in general](https://github.com/Stuk/jszip/pull/56) + - [Add support for `Buffer` in Node.js](https://github.com/Stuk/jszip/pull/57). + - Package for CommonJS/npm. + +### v1.0.1, 2013-03-04 + + - Fixed an issue when generating a compressed zip file with empty files or folders, see #33. + - With bad data (null or undefined), asText/asBinary/asUint8Array/asArrayBuffer methods now return an empty string, see #36. + +# v1.0.0, 2013-02-14 + +- First release after a long period without version. + diff --git a/commodoreclicker/js/thirdparty/jszip/Gruntfile.js b/commodoreclicker/js/thirdparty/jszip/Gruntfile.js new file mode 100644 index 00000000..b52d7c86 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/Gruntfile.js @@ -0,0 +1,130 @@ +/*jshint node: true */ +module.exports = function(grunt) { + var browsers = [{ + browserName: "iphone", + platform: "OS X 10.8", + version: "6" + }, { + browserName: "android", + platform: "Linux", + version: "4.0" + }, { + browserName: "firefox", + platform: "XP" + }, { + browserName: "chrome", + platform: "XP" + }, { + browserName: "internet explorer", + platform: "WIN8", + version: "10" + }, { + browserName: "internet explorer", + platform: "VISTA", + version: "9" + }, { + browserName: "internet explorer", + platform: "Windows 7", + version: "8" + }, { + browserName: "internet explorer", + platform: "XP", + version: "7" + }, { + browserName: "opera", + platform: "Windows 2008", + version: "12" + }, { + browserName: "safari", + platform: "OS X 10.8", + version: "6" + }]; + + var tags = []; + if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") { + tags.push("pr" + process.env.TRAVIS_PULL_REQUEST); + } else if (process.env.TRAVIS_BRANCH) { + tags.push(process.env.TRAVIS_BRANCH); + } + + grunt.initConfig({ + connect: { + server: { + options: { + base: "", + port: 9999 + } + } + }, + 'saucelabs-qunit': { + all: { + options: { + urls: ["http://127.0.0.1:9999/test/index.html"], + tunnelTimeout: 5, + build: process.env.TRAVIS_JOB_ID, + concurrency: 3, + browsers: browsers, + testname: "qunit tests", + tags: tags + } + } + }, + jshint: { + options: { + jshintrc: "./.jshintrc" + }, + all: ['./lib/*.js'] + }, + browserify: { + all: { + files: { + 'dist/jszip.js': ['lib/index.js'] + }, + options: { + bundleOptions: { + standalone: 'JSZip', + insertGlobalVars : { + Buffer: function () { + // instead of the full polyfill, we just use the raw value + // (or undefined). + return '(typeof Buffer !== "undefined" ? Buffer : undefined)'; + } + } + }, + postBundleCB: function(err, src, done) { + // add the license + var license = require('fs').readFileSync('lib/license_header.js'); + // remove the source mapping of zlib.js, see #75 + var srcWithoutSourceMapping = src.replace(/\/\/@ sourceMappingURL=raw..flate.min.js.map/g, ''); + done(err, license + srcWithoutSourceMapping); + } + } + } + }, + uglify: { + options: { + report: 'gzip', + mangle: true, + preserveComments: 'some' + }, + all: { + src: 'dist/jszip.js', + dest: 'dist/jszip.min.js' + } + } + }); + + grunt.loadNpmTasks("grunt-saucelabs"); + grunt.loadNpmTasks("grunt-contrib-connect"); + grunt.loadNpmTasks('grunt-browserify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + + if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) { + grunt.registerTask("test", ["connect", "saucelabs-qunit"]); + } else { + grunt.registerTask("test", []); + } + grunt.registerTask("build", ["browserify", "uglify"]); + grunt.registerTask("default", ["jshint", "build"]); +}; diff --git a/commodoreclicker/js/thirdparty/jszip/LICENSE.markdown b/commodoreclicker/js/thirdparty/jszip/LICENSE.markdown new file mode 100644 index 00000000..c0b10c09 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/LICENSE.markdown @@ -0,0 +1,651 @@ +JSZip is dual licensed. You may use it under the MIT license *or* the GPLv3 +license. + +The MIT License +=============== + +Copyright (c) 2009-2014 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +GPL version 3 +============= + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS diff --git a/commodoreclicker/js/thirdparty/jszip/README.markdown b/commodoreclicker/js/thirdparty/jszip/README.markdown new file mode 100644 index 00000000..5cfa5dd7 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/README.markdown @@ -0,0 +1,41 @@ +JSZip +===== + +A library for creating, reading and editing .zip files with Javascript, with a +lovely and simple API. + +See http://stuartk.com/jszip for all the documentation. + +```javascript +var zip = new JSZip(); + +zip.file("Hello.txt", "Hello World\n"); + +var img = zip.folder("images"); +img.file("smile.gif", imgData, {base64: true}); + +var content = zip.generate({type:"blob"}); + +// see FileSaver.js +saveAs(content, "example.zip"); + +/* +Results in a zip containing +Hello.txt +images/ + smile.gif +*/ +``` + +Test status +----------- + +[![Build Status](https://api.travis-ci.org/Stuk/jszip.svg?branch=master)](http://travis-ci.org/Stuk/jszip) + +[![Selenium Test Status](https://saucelabs.com/browser-matrix/jszip.svg)](https://saucelabs.com/u/jszip) + +License +------- + +JSZip is dual-licensed. You may use it under the MIT license *or* the GPLv3 +license. See [LICENSE.markdown](LICENSE.markdown). diff --git a/commodoreclicker/js/thirdparty/jszip/_config.yml b/commodoreclicker/js/thirdparty/jszip/_config.yml new file mode 100644 index 00000000..b1959a18 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/_config.yml @@ -0,0 +1,25 @@ +# will be overwritten by github, see https://help.github.com/articles/using-jekyll-with-pages +safe: true +lsi: false +pygments: true +source: ./ +# /overwritten + +baseurl: /jszip + +layouts: ./documentation/_layouts +permalink: none +exclude: ['bin', 'README.md', 'node_modules'] + +markdown: redcarpet +redcarpet: + extensions: [ + 'no_intra_emphasis', + 'fenced_code_blocks', + 'autolink', + 'strikethrough', + 'superscript', + 'with_toc_data', + 'tables', + 'hardwrap' + ] diff --git a/commodoreclicker/js/thirdparty/jszip/bower.json b/commodoreclicker/js/thirdparty/jszip/bower.json new file mode 100644 index 00000000..92d6f7ed --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/bower.json @@ -0,0 +1,23 @@ +{ + "name": "jszip", + "version": "2.4.0", + "homepage": "http://stuartk.com/jszip", + "authors": [ + "Stuart Knightley " + ], + "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip", + "main": "dist/jszip.js", + "keywords": [ + "zip", + "deflate", + "inflate" + ], + "license": "MIT or GPLv3", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/commodoreclicker/js/thirdparty/jszip/component.json b/commodoreclicker/js/thirdparty/jszip/component.json new file mode 100644 index 00000000..46c2f0fe --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/component.json @@ -0,0 +1,16 @@ +{ + "name": "jszip", + "repo": "Stuk/jszip", + "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip", + "version": "2.4.0", + "keywords": [ + "zip", + "deflate", + "inflate" + ], + "main": "dist/jszip.js", + "license": "MIT or GPLv3", + "scripts": [ + "dist/jszip.js" + ] +} diff --git a/commodoreclicker/js/thirdparty/jszip/dist/jszip.js b/commodoreclicker/js/thirdparty/jszip/dist/jszip.js new file mode 100644 index 00000000..51ef5da7 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/dist/jszip.js @@ -0,0 +1,8982 @@ +/*! + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2014 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE +*/ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSZip=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } + else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); + + } + + return output; +}; + +// public method for decoding +exports.decode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = _keyStr.indexOf(input.charAt(i++)); + enc2 = _keyStr.indexOf(input.charAt(i++)); + enc3 = _keyStr.indexOf(input.charAt(i++)); + enc4 = _keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + return output; + +}; + +},{}],2:[function(_dereq_,module,exports){ +'use strict'; +function CompressedObject() { + this.compressedSize = 0; + this.uncompressedSize = 0; + this.crc32 = 0; + this.compressionMethod = null; + this.compressedContent = null; +} + +CompressedObject.prototype = { + /** + * Return the decompressed content in an unspecified format. + * The format will depend on the decompressor. + * @return {Object} the decompressed content. + */ + getContent: function() { + return null; // see implementation + }, + /** + * Return the compressed content in an unspecified format. + * The format will depend on the compressed conten source. + * @return {Object} the compressed content. + */ + getCompressedContent: function() { + return null; // see implementation + } +}; +module.exports = CompressedObject; + +},{}],3:[function(_dereq_,module,exports){ +'use strict'; +exports.STORE = { + magic: "\x00\x00", + compress: function(content) { + return content; // no compression + }, + uncompress: function(content) { + return content; // no compression + }, + compressInputType: null, + uncompressInputType: null +}; +exports.DEFLATE = _dereq_('./flate'); + +},{"./flate":8}],4:[function(_dereq_,module,exports){ +'use strict'; + +var utils = _dereq_('./utils'); + +var table = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +]; + +/** + * + * Javascript crc32 + * http://www.webtoolkit.info/ + * + */ +module.exports = function crc32(input, crc) { + if (typeof input === "undefined" || !input.length) { + return 0; + } + + var isArray = utils.getTypeOf(input) !== "string"; + + if (typeof(crc) == "undefined") { + crc = 0; + } + var x = 0; + var y = 0; + var b = 0; + + crc = crc ^ (-1); + for (var i = 0, iTop = input.length; i < iTop; i++) { + b = isArray ? input[i] : input.charCodeAt(i); + y = (crc ^ b) & 0xFF; + x = table[y]; + crc = (crc >>> 8) ^ x; + } + + return crc ^ (-1); +}; +// vim: set shiftwidth=4 softtabstop=4: + +},{"./utils":21}],5:[function(_dereq_,module,exports){ +'use strict'; +var utils = _dereq_('./utils'); + +function DataReader(data) { + this.data = null; // type : see implementation + this.length = 0; + this.index = 0; +} +DataReader.prototype = { + /** + * Check that the offset will not go too far. + * @param {string} offset the additional offset to check. + * @throws {Error} an Error if the offset is out of bounds. + */ + checkOffset: function(offset) { + this.checkIndex(this.index + offset); + }, + /** + * Check that the specifed index will not be too far. + * @param {string} newIndex the index to check. + * @throws {Error} an Error if the index is out of bounds. + */ + checkIndex: function(newIndex) { + if (this.length < newIndex || newIndex < 0) { + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); + } + }, + /** + * Change the index. + * @param {number} newIndex The new index. + * @throws {Error} if the new index is out of the data. + */ + setIndex: function(newIndex) { + this.checkIndex(newIndex); + this.index = newIndex; + }, + /** + * Skip the next n bytes. + * @param {number} n the number of bytes to skip. + * @throws {Error} if the new index is out of the data. + */ + skip: function(n) { + this.setIndex(this.index + n); + }, + /** + * Get the byte at the specified index. + * @param {number} i the index to use. + * @return {number} a byte. + */ + byteAt: function(i) { + // see implementations + }, + /** + * Get the next number with a given byte size. + * @param {number} size the number of bytes to read. + * @return {number} the corresponding number. + */ + readInt: function(size) { + var result = 0, + i; + this.checkOffset(size); + for (i = this.index + size - 1; i >= this.index; i--) { + result = (result << 8) + this.byteAt(i); + } + this.index += size; + return result; + }, + /** + * Get the next string with a given byte size. + * @param {number} size the number of bytes to read. + * @return {string} the corresponding string. + */ + readString: function(size) { + return utils.transformTo("string", this.readData(size)); + }, + /** + * Get raw data without conversion, bytes. + * @param {number} size the number of bytes to read. + * @return {Object} the raw data, implementation specific. + */ + readData: function(size) { + // see implementations + }, + /** + * Find the last occurence of a zip signature (4 bytes). + * @param {string} sig the signature to find. + * @return {number} the index of the last occurence, -1 if not found. + */ + lastIndexOfSignature: function(sig) { + // see implementations + }, + /** + * Get the next date. + * @return {Date} the date. + */ + readDate: function() { + var dostime = this.readInt(4); + return new Date( + ((dostime >> 25) & 0x7f) + 1980, // year + ((dostime >> 21) & 0x0f) - 1, // month + (dostime >> 16) & 0x1f, // day + (dostime >> 11) & 0x1f, // hour + (dostime >> 5) & 0x3f, // minute + (dostime & 0x1f) << 1); // second + } +}; +module.exports = DataReader; + +},{"./utils":21}],6:[function(_dereq_,module,exports){ +'use strict'; +exports.base64 = false; +exports.binary = false; +exports.dir = false; +exports.createFolders = false; +exports.date = null; +exports.compression = null; +exports.comment = null; + +},{}],7:[function(_dereq_,module,exports){ +'use strict'; +var utils = _dereq_('./utils'); + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2binary = function(str) { + return utils.string2binary(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Uint8Array = function(str) { + return utils.transformTo("uint8array", str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.uint8Array2String = function(array) { + return utils.transformTo("string", array); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Blob = function(str) { + var buffer = utils.transformTo("arraybuffer", str); + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.arrayBuffer2Blob = function(buffer) { + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.transformTo = function(outputType, input) { + return utils.transformTo(outputType, input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.getTypeOf = function(input) { + return utils.getTypeOf(input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.checkSupport = function(type) { + return utils.checkSupport(type); +}; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; + + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.pretty = function(str) { + return utils.pretty(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.findCompression = function(compressionMethod) { + return utils.findCompression(compressionMethod); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.isRegExp = function (object) { + return utils.isRegExp(object); +}; + + +},{"./utils":21}],8:[function(_dereq_,module,exports){ +'use strict'; +var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); + +var pako = _dereq_("pako"); +exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; +exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; + +exports.magic = "\x08\x00"; +exports.compress = function(input) { + return pako.deflateRaw(input); +}; +exports.uncompress = function(input) { + return pako.inflateRaw(input); +}; + +},{"pako":24}],9:[function(_dereq_,module,exports){ +'use strict'; + +var base64 = _dereq_('./base64'); + +/** +Usage: + zip = new JSZip(); + zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); + zip.folder("images").file("smile.gif", base64Data, {base64: true}); + zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); + zip.remove("tempfile"); + + base64zip = zip.generate(); + +**/ + +/** + * Representation a of zip file in js + * @constructor + * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). + * @param {Object=} options the options for creating this objects (optional). + */ +function JSZip(data, options) { + // if this constructor is used without `new`, it adds `new` before itself: + if(!(this instanceof JSZip)) return new JSZip(data, options); + + // object containing the files : + // { + // "folder/" : {...}, + // "folder/data.txt" : {...} + // } + this.files = {}; + + this.comment = null; + + // Where we are in the hierarchy + this.root = ""; + if (data) { + this.load(data, options); + } + this.clone = function() { + var newObj = new JSZip(); + for (var i in this) { + if (typeof this[i] !== "function") { + newObj[i] = this[i]; + } + } + return newObj; + }; +} +JSZip.prototype = _dereq_('./object'); +JSZip.prototype.load = _dereq_('./load'); +JSZip.support = _dereq_('./support'); +JSZip.defaults = _dereq_('./defaults'); + +/** + * @deprecated + * This namespace will be removed in a future version without replacement. + */ +JSZip.utils = _dereq_('./deprecatedPublicUtils'); + +JSZip.base64 = { + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + encode : function(input) { + return base64.encode(input); + }, + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + decode : function(input) { + return base64.decode(input); + } +}; +JSZip.compressions = _dereq_('./compressions'); +module.exports = JSZip; + +},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(_dereq_,module,exports){ +'use strict'; +var base64 = _dereq_('./base64'); +var ZipEntries = _dereq_('./zipEntries'); +module.exports = function(data, options) { + var files, zipEntries, i, input; + options = options || {}; + if (options.base64) { + data = base64.decode(data); + } + + zipEntries = new ZipEntries(data, options); + files = zipEntries.files; + for (i = 0; i < files.length; i++) { + input = files[i]; + this.file(input.fileName, input.decompressed, { + binary: true, + optimizedBinaryString: true, + date: input.date, + dir: input.dir, + comment : input.fileComment.length ? input.fileComment : null, + createFolders: options.createFolders + }); + } + if (zipEntries.zipComment.length) { + this.comment = zipEntries.zipComment; + } + + return this; +}; + +},{"./base64":1,"./zipEntries":22}],11:[function(_dereq_,module,exports){ +(function (Buffer){ +'use strict'; +module.exports = function(data, encoding){ + return new Buffer(data, encoding); +}; +module.exports.test = function(b){ + return Buffer.isBuffer(b); +}; +}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) +},{}],12:[function(_dereq_,module,exports){ +'use strict'; +var Uint8ArrayReader = _dereq_('./uint8ArrayReader'); + +function NodeBufferReader(data) { + this.data = data; + this.length = this.data.length; + this.index = 0; +} +NodeBufferReader.prototype = new Uint8ArrayReader(); + +/** + * @see DataReader.readData + */ +NodeBufferReader.prototype.readData = function(size) { + this.checkOffset(size); + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = NodeBufferReader; + +},{"./uint8ArrayReader":18}],13:[function(_dereq_,module,exports){ +'use strict'; +var support = _dereq_('./support'); +var utils = _dereq_('./utils'); +var crc32 = _dereq_('./crc32'); +var signature = _dereq_('./signature'); +var defaults = _dereq_('./defaults'); +var base64 = _dereq_('./base64'); +var compressions = _dereq_('./compressions'); +var CompressedObject = _dereq_('./compressedObject'); +var nodeBuffer = _dereq_('./nodeBuffer'); +var utf8 = _dereq_('./utf8'); +var StringWriter = _dereq_('./stringWriter'); +var Uint8ArrayWriter = _dereq_('./uint8ArrayWriter'); + +/** + * Returns the raw data of a ZipObject, decompress the content if necessary. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getRawData = function(file) { + if (file._data instanceof CompressedObject) { + file._data = file._data.getContent(); + file.options.binary = true; + file.options.base64 = false; + + if (utils.getTypeOf(file._data) === "uint8array") { + var copy = file._data; + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + file._data = new Uint8Array(copy.length); + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + if (copy.length !== 0) { + file._data.set(copy, 0); + } + } + } + return file._data; +}; + +/** + * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getBinaryData = function(file) { + var result = getRawData(file), + type = utils.getTypeOf(result); + if (type === "string") { + if (!file.options.binary) { + // unicode text ! + // unicode string => binary string is a painful process, check if we can avoid it. + if (support.nodebuffer) { + return nodeBuffer(result, "utf-8"); + } + } + return file.asBinary(); + } + return result; +}; + +/** + * Transform this._data into a string. + * @param {function} filter a function String -> String, applied if not null on the result. + * @return {String} the string representing this._data. + */ +var dataToString = function(asUTF8) { + var result = getRawData(this); + if (result === null || typeof result === "undefined") { + return ""; + } + // if the data is a base64 string, we decode it before checking the encoding ! + if (this.options.base64) { + result = base64.decode(result); + } + if (asUTF8 && this.options.binary) { + // JSZip.prototype.utf8decode supports arrays as input + // skip to array => string step, utf8decode will do it. + result = out.utf8decode(result); + } + else { + // no utf8 transformation, do the array => string step. + result = utils.transformTo("string", result); + } + + if (!asUTF8 && !this.options.binary) { + result = utils.transformTo("string", out.utf8encode(result)); + } + return result; +}; +/** + * A simple object representing a file in the zip file. + * @constructor + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data + * @param {Object} options the options of the file + */ +var ZipObject = function(name, data, options) { + this.name = name; + this.dir = options.dir; + this.date = options.date; + this.comment = options.comment; + + this._data = data; + this.options = options; + + /* + * This object contains initial values for dir and date. + * With them, we can check if the user changed the deprecated metadata in + * `ZipObject#options` or not. + */ + this._initialMetadata = { + dir : options.dir, + date : options.date + }; +}; + +ZipObject.prototype = { + /** + * Return the content as UTF8 string. + * @return {string} the UTF8 string. + */ + asText: function() { + return dataToString.call(this, true); + }, + /** + * Returns the binary content. + * @return {string} the content as binary. + */ + asBinary: function() { + return dataToString.call(this, false); + }, + /** + * Returns the content as a nodejs Buffer. + * @return {Buffer} the content as a Buffer. + */ + asNodeBuffer: function() { + var result = getBinaryData(this); + return utils.transformTo("nodebuffer", result); + }, + /** + * Returns the content as an Uint8Array. + * @return {Uint8Array} the content as an Uint8Array. + */ + asUint8Array: function() { + var result = getBinaryData(this); + return utils.transformTo("uint8array", result); + }, + /** + * Returns the content as an ArrayBuffer. + * @return {ArrayBuffer} the content as an ArrayBufer. + */ + asArrayBuffer: function() { + return this.asUint8Array().buffer; + } +}; + +/** + * Transform an integer into a string in hexadecimal. + * @private + * @param {number} dec the number to convert. + * @param {number} bytes the number of bytes to generate. + * @returns {string} the result. + */ +var decToHex = function(dec, bytes) { + var hex = "", + i; + for (i = 0; i < bytes; i++) { + hex += String.fromCharCode(dec & 0xff); + dec = dec >>> 8; + } + return hex; +}; + +/** + * Merge the objects passed as parameters into a new one. + * @private + * @param {...Object} var_args All objects to merge. + * @return {Object} a new object with the data of the others. + */ +var extend = function() { + var result = {}, i, attr; + for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers + for (attr in arguments[i]) { + if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { + result[attr] = arguments[i][attr]; + } + } + } + return result; +}; + +/** + * Transforms the (incomplete) options from the user into the complete + * set of options to create a file. + * @private + * @param {Object} o the options from the user. + * @return {Object} the complete set of options. + */ +var prepareFileAttrs = function(o) { + o = o || {}; + if (o.base64 === true && (o.binary === null || o.binary === undefined)) { + o.binary = true; + } + o = extend(o, defaults); + o.date = o.date || new Date(); + if (o.compression !== null) o.compression = o.compression.toUpperCase(); + + return o; +}; + +/** + * Add a file in the current folder. + * @private + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file + * @param {Object} o the options of the file + * @return {Object} the new file. + */ +var fileAdd = function(name, data, o) { + // be sure sub folders exist + var dataType = utils.getTypeOf(data), + parent; + + o = prepareFileAttrs(o); + + if (o.createFolders && (parent = parentFolder(name))) { + folderAdd.call(this, parent, true); + } + + if (o.dir || data === null || typeof data === "undefined") { + o.base64 = false; + o.binary = false; + data = null; + } + else if (dataType === "string") { + if (o.binary && !o.base64) { + // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask + if (o.optimizedBinaryString !== true) { + // this is a string, not in a base64 format. + // Be sure that this is a correct "binary string" + data = utils.string2binary(data); + } + } + } + else { // arraybuffer, uint8array, ... + o.base64 = false; + o.binary = true; + + if (!dataType && !(data instanceof CompressedObject)) { + throw new Error("The data of '" + name + "' is in an unsupported format !"); + } + + // special case : it's way easier to work with Uint8Array than with ArrayBuffer + if (dataType === "arraybuffer") { + data = utils.transformTo("uint8array", data); + } + } + + var object = new ZipObject(name, data, o); + this.files[name] = object; + return object; +}; + +/** + * Find the parent folder of the path. + * @private + * @param {string} path the path to use + * @return {string} the parent folder, or "" + */ +var parentFolder = function (path) { + if (path.slice(-1) == '/') { + path = path.substring(0, path.length - 1); + } + var lastSlash = path.lastIndexOf('/'); + return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; +}; + +/** + * Add a (sub) folder in the current folder. + * @private + * @param {string} name the folder's name + * @param {boolean=} [createFolders] If true, automatically create sub + * folders. Defaults to false. + * @return {Object} the new folder. + */ +var folderAdd = function(name, createFolders) { + // Check the name ends with a / + if (name.slice(-1) != "/") { + name += "/"; // IE doesn't like substr(-1) + } + + createFolders = (typeof createFolders !== 'undefined') ? createFolders : false; + + // Does this folder already exist? + if (!this.files[name]) { + fileAdd.call(this, name, null, { + dir: true, + createFolders: createFolders + }); + } + return this.files[name]; +}; + +/** + * Generate a JSZip.CompressedObject for a given zipOject. + * @param {ZipObject} file the object to read. + * @param {JSZip.compression} compression the compression to use. + * @return {JSZip.CompressedObject} the compressed result. + */ +var generateCompressedObjectFrom = function(file, compression) { + var result = new CompressedObject(), + content; + + // the data has not been decompressed, we might reuse things ! + if (file._data instanceof CompressedObject) { + result.uncompressedSize = file._data.uncompressedSize; + result.crc32 = file._data.crc32; + + if (result.uncompressedSize === 0 || file.dir) { + compression = compressions['STORE']; + result.compressedContent = ""; + result.crc32 = 0; + } + else if (file._data.compressionMethod === compression.magic) { + result.compressedContent = file._data.getCompressedContent(); + } + else { + content = file._data.getContent(); + // need to decompress / recompress + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + } + else { + // have uncompressed data + content = getBinaryData(file); + if (!content || content.length === 0 || file.dir) { + compression = compressions['STORE']; + content = ""; + } + result.uncompressedSize = content.length; + result.crc32 = crc32(content); + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + + result.compressedSize = result.compressedContent.length; + result.compressionMethod = compression.magic; + + return result; +}; + +/** + * Generate the various parts used in the construction of the final zip file. + * @param {string} name the file name. + * @param {ZipObject} file the file content. + * @param {JSZip.CompressedObject} compressedObject the compressed object. + * @param {number} offset the current offset from the start of the zip file. + * @return {object} the zip parts. + */ +var generateZipParts = function(name, file, compressedObject, offset) { + var data = compressedObject.compressedContent, + utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), + comment = file.comment || "", + utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), + useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, + useUTF8ForComment = utfEncodedComment.length !== comment.length, + o = file.options, + dosTime, + dosDate, + extraFields = "", + unicodePathExtraField = "", + unicodeCommentExtraField = "", + dir, date; + + + // handle the deprecated options.dir + if (file._initialMetadata.dir !== file.dir) { + dir = file.dir; + } else { + dir = o.dir; + } + + // handle the deprecated options.date + if(file._initialMetadata.date !== file.date) { + date = file.date; + } else { + date = o.date; + } + + // date + // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html + + dosTime = date.getHours(); + dosTime = dosTime << 6; + dosTime = dosTime | date.getMinutes(); + dosTime = dosTime << 5; + dosTime = dosTime | date.getSeconds() / 2; + + dosDate = date.getFullYear() - 1980; + dosDate = dosDate << 4; + dosDate = dosDate | (date.getMonth() + 1); + dosDate = dosDate << 5; + dosDate = dosDate | date.getDate(); + + if (useUTF8ForFileName) { + // set the unicode path extra field. unzip needs at least one extra + // field to correctly handle unicode path, so using the path is as good + // as any other information. This could improve the situation with + // other archive managers too. + // This field is usually used without the utf8 flag, with a non + // unicode path in the header (winrar, winzip). This helps (a bit) + // with the messy Windows' default compressed folders feature but + // breaks on p7zip which doesn't seek the unicode path extra field. + // So for now, UTF-8 everywhere ! + unicodePathExtraField = + // Version + decToHex(1, 1) + + // NameCRC32 + decToHex(crc32(utfEncodedFileName), 4) + + // UnicodeName + utfEncodedFileName; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x70" + + // size + decToHex(unicodePathExtraField.length, 2) + + // content + unicodePathExtraField; + } + + if(useUTF8ForComment) { + + unicodeCommentExtraField = + // Version + decToHex(1, 1) + + // CommentCRC32 + decToHex(this.crc32(utfEncodedComment), 4) + + // UnicodeName + utfEncodedComment; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x63" + + // size + decToHex(unicodeCommentExtraField.length, 2) + + // content + unicodeCommentExtraField; + } + + var header = ""; + + // version needed to extract + header += "\x0A\x00"; + // general purpose bit flag + // set bit 11 if utf8 + header += (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; + // compression method + header += compressedObject.compressionMethod; + // last mod file time + header += decToHex(dosTime, 2); + // last mod file date + header += decToHex(dosDate, 2); + // crc-32 + header += decToHex(compressedObject.crc32, 4); + // compressed size + header += decToHex(compressedObject.compressedSize, 4); + // uncompressed size + header += decToHex(compressedObject.uncompressedSize, 4); + // file name length + header += decToHex(utfEncodedFileName.length, 2); + // extra field length + header += decToHex(extraFields.length, 2); + + + var fileRecord = signature.LOCAL_FILE_HEADER + header + utfEncodedFileName + extraFields; + + var dirRecord = signature.CENTRAL_FILE_HEADER + + // version made by (00: DOS) + "\x14\x00" + + // file header (common to file and central directory) + header + + // file comment length + decToHex(utfEncodedComment.length, 2) + + // disk number start + "\x00\x00" + + // internal file attributes TODO + "\x00\x00" + + // external file attributes + (dir === true ? "\x10\x00\x00\x00" : "\x00\x00\x00\x00") + + // relative offset of local header + decToHex(offset, 4) + + // file name + utfEncodedFileName + + // extra field + extraFields + + // file comment + utfEncodedComment; + + return { + fileRecord: fileRecord, + dirRecord: dirRecord, + compressedObject: compressedObject + }; +}; + + +// return the actual prototype of JSZip +var out = { + /** + * Read an existing zip and merge the data in the current JSZip object. + * The implementation is in jszip-load.js, don't forget to include it. + * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load + * @param {Object} options Options for loading the stream. + * options.base64 : is the stream in base64 ? default : false + * @return {JSZip} the current JSZip object + */ + load: function(stream, options) { + throw new Error("Load method is not defined. Is the file jszip-load.js included ?"); + }, + + /** + * Filter nested files/folders with the specified function. + * @param {Function} search the predicate to use : + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + * @return {Array} An array of matching elements. + */ + filter: function(search) { + var result = [], + filename, relativePath, file, fileClone; + for (filename in this.files) { + if (!this.files.hasOwnProperty(filename)) { + continue; + } + file = this.files[filename]; + // return a new object, don't let the user mess with our internal objects :) + fileClone = new ZipObject(file.name, file._data, extend(file.options)); + relativePath = filename.slice(this.root.length, filename.length); + if (filename.slice(0, this.root.length) === this.root && // the file is in the current root + search(relativePath, fileClone)) { // and the file matches the function + result.push(fileClone); + } + } + return result; + }, + + /** + * Add a file to the zip file, or search a file. + * @param {string|RegExp} name The name of the file to add (if data is defined), + * the name of the file to find (if no data) or a regex to match files. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded + * @param {Object} o File options + * @return {JSZip|Object|Array} this JSZip object (when adding a file), + * a file (when searching by string) or an array of files (when searching by regex). + */ + file: function(name, data, o) { + if (arguments.length === 1) { + if (utils.isRegExp(name)) { + var regexp = name; + return this.filter(function(relativePath, file) { + return !file.dir && regexp.test(relativePath); + }); + } + else { // text + return this.filter(function(relativePath, file) { + return !file.dir && relativePath === name; + })[0] || null; + } + } + else { // more than one argument : we have data ! + name = this.root + name; + fileAdd.call(this, name, data, o); + } + return this; + }, + + /** + * Add a directory to the zip file, or search. + * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. + * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. + */ + folder: function(arg) { + if (!arg) { + return this; + } + + if (utils.isRegExp(arg)) { + return this.filter(function(relativePath, file) { + return file.dir && arg.test(relativePath); + }); + } + + // else, name is a new folder + var name = this.root + arg; + var newFolder = folderAdd.call(this, name); + + // Allow chaining by returning a new object with this folder as the root + var ret = this.clone(); + ret.root = newFolder.name; + return ret; + }, + + /** + * Delete a file, or a directory and all sub-files, from the zip + * @param {string} name the name of the file to delete + * @return {JSZip} this JSZip object + */ + remove: function(name) { + name = this.root + name; + var file = this.files[name]; + if (!file) { + // Look for any folders + if (name.slice(-1) != "/") { + name += "/"; + } + file = this.files[name]; + } + + if (file && !file.dir) { + // file + delete this.files[name]; + } else { + // maybe a folder, delete recursively + var kids = this.filter(function(relativePath, file) { + return file.name.slice(0, name.length) === name; + }); + for (var i = 0; i < kids.length; i++) { + delete this.files[kids[i].name]; + } + } + + return this; + }, + + /** + * Generate the complete zip file + * @param {Object} options the options to generate the zip file : + * - base64, (deprecated, use type instead) true to generate base64. + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file + */ + generate: function(options) { + options = extend(options || {}, { + base64: true, + compression: "STORE", + type: "base64", + comment: null + }); + + utils.checkSupport(options.type); + + var zipData = [], + localDirLength = 0, + centralDirLength = 0, + writer, i, + utfEncodedComment = utils.transformTo("string", this.utf8encode(options.comment || this.comment || "")); + + // first, generate all the zip parts. + for (var name in this.files) { + if (!this.files.hasOwnProperty(name)) { + continue; + } + var file = this.files[name]; + + var compressionName = file.options.compression || options.compression.toUpperCase(); + var compression = compressions[compressionName]; + if (!compression) { + throw new Error(compressionName + " is not a valid compression method !"); + } + + var compressedObject = generateCompressedObjectFrom.call(this, file, compression); + + var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); + localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; + centralDirLength += zipPart.dirRecord.length; + zipData.push(zipPart); + } + + var dirEnd = ""; + + // end of central dir signature + dirEnd = signature.CENTRAL_DIRECTORY_END + + // number of this disk + "\x00\x00" + + // number of the disk with the start of the central directory + "\x00\x00" + + // total number of entries in the central directory on this disk + decToHex(zipData.length, 2) + + // total number of entries in the central directory + decToHex(zipData.length, 2) + + // size of the central directory 4 bytes + decToHex(centralDirLength, 4) + + // offset of start of central directory with respect to the starting disk number + decToHex(localDirLength, 4) + + // .ZIP file comment length + decToHex(utfEncodedComment.length, 2) + + // .ZIP file comment + utfEncodedComment; + + + // we have all the parts (and the total length) + // time to create a writer ! + var typeName = options.type.toLowerCase(); + if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { + writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); + }else{ + writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); + } + + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].fileRecord); + writer.append(zipData[i].compressedObject.compressedContent); + } + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].dirRecord); + } + + writer.append(dirEnd); + + var zip = writer.finalize(); + + + + switch(options.type.toLowerCase()) { + // case "zip is an Uint8Array" + case "uint8array" : + case "arraybuffer" : + case "nodebuffer" : + return utils.transformTo(options.type.toLowerCase(), zip); + case "blob" : + return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); + // case "zip is a string" + case "base64" : + return (options.base64) ? base64.encode(zip) : zip; + default : // case "string" : + return zip; + } + + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + crc32: function (input, crc) { + return crc32(input, crc); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8encode: function (string) { + return utils.transformTo("string", utf8.utf8encode(string)); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8decode: function (input) { + return utf8.utf8decode(input); + } +}; +module.exports = out; + +},{"./base64":1,"./compressedObject":2,"./compressions":3,"./crc32":4,"./defaults":6,"./nodeBuffer":11,"./signature":14,"./stringWriter":16,"./support":17,"./uint8ArrayWriter":19,"./utf8":20,"./utils":21}],14:[function(_dereq_,module,exports){ +'use strict'; +exports.LOCAL_FILE_HEADER = "PK\x03\x04"; +exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; +exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; +exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; +exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; +exports.DATA_DESCRIPTOR = "PK\x07\x08"; + +},{}],15:[function(_dereq_,module,exports){ +'use strict'; +var DataReader = _dereq_('./dataReader'); +var utils = _dereq_('./utils'); + +function StringReader(data, optimizedBinaryString) { + this.data = data; + if (!optimizedBinaryString) { + this.data = utils.string2binary(this.data); + } + this.length = this.data.length; + this.index = 0; +} +StringReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +StringReader.prototype.byteAt = function(i) { + return this.data.charCodeAt(i); +}; +/** + * @see DataReader.lastIndexOfSignature + */ +StringReader.prototype.lastIndexOfSignature = function(sig) { + return this.data.lastIndexOf(sig); +}; +/** + * @see DataReader.readData + */ +StringReader.prototype.readData = function(size) { + this.checkOffset(size); + // this will work because the constructor applied the "& 0xff" mask. + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = StringReader; + +},{"./dataReader":5,"./utils":21}],16:[function(_dereq_,module,exports){ +'use strict'; + +var utils = _dereq_('./utils'); + +/** + * An object to write any content to a string. + * @constructor + */ +var StringWriter = function() { + this.data = []; +}; +StringWriter.prototype = { + /** + * Append any content to the current string. + * @param {Object} input the content to add. + */ + append: function(input) { + input = utils.transformTo("string", input); + this.data.push(input); + }, + /** + * Finalize the construction an return the result. + * @return {string} the generated string. + */ + finalize: function() { + return this.data.join(""); + } +}; + +module.exports = StringWriter; + +},{"./utils":21}],17:[function(_dereq_,module,exports){ +(function (Buffer){ +'use strict'; +exports.base64 = true; +exports.array = true; +exports.string = true; +exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; +// contains true if JSZip can read/generate nodejs Buffer, false otherwise. +// Browserify will provide a Buffer implementation for browsers, which is +// an augmented Uint8Array (i.e., can be used as either Buffer or U8). +exports.nodebuffer = typeof Buffer !== "undefined"; +// contains true if JSZip can read/generate Uint8Array, false otherwise. +exports.uint8array = typeof Uint8Array !== "undefined"; + +if (typeof ArrayBuffer === "undefined") { + exports.blob = false; +} +else { + var buffer = new ArrayBuffer(0); + try { + exports.blob = new Blob([buffer], { + type: "application/zip" + }).size === 0; + } + catch (e) { + try { + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + exports.blob = builder.getBlob('application/zip').size === 0; + } + catch (e) { + exports.blob = false; + } + } +} + +}).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) +},{}],18:[function(_dereq_,module,exports){ +'use strict'; +var DataReader = _dereq_('./dataReader'); + +function Uint8ArrayReader(data) { + if (data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + } +} +Uint8ArrayReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +Uint8ArrayReader.prototype.byteAt = function(i) { + return this.data[i]; +}; +/** + * @see DataReader.lastIndexOfSignature + */ +Uint8ArrayReader.prototype.lastIndexOfSignature = function(sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3); + for (var i = this.length - 4; i >= 0; --i) { + if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { + return i; + } + } + + return -1; +}; +/** + * @see DataReader.readData + */ +Uint8ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. + return new Uint8Array(0); + } + var result = this.data.subarray(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = Uint8ArrayReader; + +},{"./dataReader":5}],19:[function(_dereq_,module,exports){ +'use strict'; + +var utils = _dereq_('./utils'); + +/** + * An object to write any content to an Uint8Array. + * @constructor + * @param {number} length The length of the array. + */ +var Uint8ArrayWriter = function(length) { + this.data = new Uint8Array(length); + this.index = 0; +}; +Uint8ArrayWriter.prototype = { + /** + * Append any content to the current array. + * @param {Object} input the content to add. + */ + append: function(input) { + if (input.length !== 0) { + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + input = utils.transformTo("uint8array", input); + this.data.set(input, this.index); + this.index += input.length; + } + }, + /** + * Finalize the construction an return the result. + * @return {Uint8Array} the generated array. + */ + finalize: function() { + return this.data; + } +}; + +module.exports = Uint8ArrayWriter; + +},{"./utils":21}],20:[function(_dereq_,module,exports){ +'use strict'; + +var utils = _dereq_('./utils'); +var support = _dereq_('./support'); +var nodeBuffer = _dereq_('./nodeBuffer'); + +/** + * The following functions come from pako, from pako/lib/utils/strings + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new Array(256); +for (var i=0; i<256; i++) { + _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); +} +_utf8len[254]=_utf8len[254]=1; // Invalid sequence start + +// convert string to array (typed, when possible) +var string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + if (support.uint8array) { + buf = new Uint8Array(buf_len); + } else { + buf = new Array(buf_len); + } + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +var utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +// convert array to string +var buf2string = function (buf) { + var str, i, out, c, c_len; + var len = buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + // shrinkBuf(utf16buf, out) + if (utf16buf.length !== out) { + if(utf16buf.subarray) { + utf16buf = utf16buf.subarray(0, out); + } else { + utf16buf.length = out; + } + } + + // return String.fromCharCode.apply(null, utf16buf); + return utils.applyFromCharCode(utf16buf); +}; + + +// That's all for the pako functions. + + +/** + * Transform a javascript string into an array (typed if possible) of bytes, + * UTF-8 encoded. + * @param {String} str the string to encode + * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. + */ +exports.utf8encode = function utf8encode(str) { + if (support.nodebuffer) { + return nodeBuffer(str, "utf-8"); + } + + return string2buf(str); +}; + + +/** + * Transform a bytes array (or a representation) representing an UTF-8 encoded + * string into a javascript string. + * @param {Array|Uint8Array|Buffer} buf the data de decode + * @return {String} the decoded string. + */ +exports.utf8decode = function utf8decode(buf) { + if (support.nodebuffer) { + return utils.transformTo("nodebuffer", buf).toString("utf-8"); + } + + buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); + + // return buf2string(buf); + // Chrome prefers to work with "small" chunks of data + // for the method buf2string. + // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. + var result = [], k = 0, len = buf.length, chunk = 65536; + while (k < len) { + var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); + if (support.uint8array) { + result.push(buf2string(buf.subarray(k, nextBoundary))); + } else { + result.push(buf2string(buf.slice(k, nextBoundary))); + } + k = nextBoundary; + } + return result.join(""); + +}; +// vim: set shiftwidth=4 softtabstop=4: + +},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(_dereq_,module,exports){ +'use strict'; +var support = _dereq_('./support'); +var compressions = _dereq_('./compressions'); +var nodeBuffer = _dereq_('./nodeBuffer'); +/** + * Convert a string to a "binary string" : a string containing only char codes between 0 and 255. + * @param {string} str the string to transform. + * @return {String} the binary string. + */ +exports.string2binary = function(str) { + var result = ""; + for (var i = 0; i < str.length; i++) { + result += String.fromCharCode(str.charCodeAt(i) & 0xff); + } + return result; +}; +exports.arrayBuffer2Blob = function(buffer) { + exports.checkSupport("blob"); + + try { + // Blob constructor + return new Blob([buffer], { + type: "application/zip" + }); + } + catch (e) { + + try { + // deprecated, browser only, old way + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + return builder.getBlob('application/zip'); + } + catch (e) { + + // well, fuck ?! + throw new Error("Bug : can't construct the Blob."); + } + } + + +}; +/** + * The identity function. + * @param {Object} input the input. + * @return {Object} the same input. + */ +function identity(input) { + return input; +} + +/** + * Fill in an array with a string. + * @param {String} str the string to use. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. + */ +function stringToArrayLike(str, array) { + for (var i = 0; i < str.length; ++i) { + array[i] = str.charCodeAt(i) & 0xFF; + } + return array; +} + +/** + * Transform an array-like object to a string. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ +function arrayLikeToString(array) { + // Performances notes : + // -------------------- + // String.fromCharCode.apply(null, array) is the fastest, see + // see http://jsperf.com/converting-a-uint8array-to-a-string/2 + // but the stack is limited (and we can get huge arrays !). + // + // result += String.fromCharCode(array[i]); generate too many strings ! + // + // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 + var chunk = 65536; + var result = [], + len = array.length, + type = exports.getTypeOf(array), + k = 0, + canUseApply = true; + try { + switch(type) { + case "uint8array": + String.fromCharCode.apply(null, new Uint8Array(0)); + break; + case "nodebuffer": + String.fromCharCode.apply(null, nodeBuffer(0)); + break; + } + } catch(e) { + canUseApply = false; + } + + // no apply : slow and painful algorithm + // default browser on android 4.* + if (!canUseApply) { + var resultStr = ""; + for(var i = 0; i < array.length;i++) { + resultStr += String.fromCharCode(array[i]); + } + return resultStr; + } + while (k < len && chunk > 1) { + try { + if (type === "array" || type === "nodebuffer") { + result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + } + else { + result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + } + k += chunk; + } + catch (e) { + chunk = Math.floor(chunk / 2); + } + } + return result.join(""); +} + +exports.applyFromCharCode = arrayLikeToString; + + +/** + * Copy the data from an array-like to an other array-like. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. + */ +function arrayLikeToArrayLike(arrayFrom, arrayTo) { + for (var i = 0; i < arrayFrom.length; i++) { + arrayTo[i] = arrayFrom[i]; + } + return arrayTo; +} + +// a matrix containing functions to transform everything into everything. +var transform = {}; + +// string to ? +transform["string"] = { + "string": identity, + "array": function(input) { + return stringToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["string"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return stringToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": function(input) { + return stringToArrayLike(input, nodeBuffer(input.length)); + } +}; + +// array to ? +transform["array"] = { + "string": arrayLikeToString, + "array": identity, + "arraybuffer": function(input) { + return (new Uint8Array(input)).buffer; + }, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// arraybuffer to ? +transform["arraybuffer"] = { + "string": function(input) { + return arrayLikeToString(new Uint8Array(input)); + }, + "array": function(input) { + return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); + }, + "arraybuffer": identity, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(new Uint8Array(input)); + } +}; + +// uint8array to ? +transform["uint8array"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return input.buffer; + }, + "uint8array": identity, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// nodebuffer to ? +transform["nodebuffer"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["nodebuffer"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return arrayLikeToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": identity +}; + +/** + * Transform an input into any type. + * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. + * If no output type is specified, the unmodified input will be returned. + * @param {String} outputType the output type. + * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. + * @throws {Error} an Error if the browser doesn't support the requested output type. + */ +exports.transformTo = function(outputType, input) { + if (!input) { + // undefined, null, etc + // an empty string won't harm. + input = ""; + } + if (!outputType) { + return input; + } + exports.checkSupport(outputType); + var inputType = exports.getTypeOf(input); + var result = transform[inputType][outputType](input); + return result; +}; + +/** + * Return the type of the input. + * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. + * @param {Object} input the input to identify. + * @return {String} the (lowercase) type of the input. + */ +exports.getTypeOf = function(input) { + if (typeof input === "string") { + return "string"; + } + if (Object.prototype.toString.call(input) === "[object Array]") { + return "array"; + } + if (support.nodebuffer && nodeBuffer.test(input)) { + return "nodebuffer"; + } + if (support.uint8array && input instanceof Uint8Array) { + return "uint8array"; + } + if (support.arraybuffer && input instanceof ArrayBuffer) { + return "arraybuffer"; + } +}; + +/** + * Throw an exception if the type is not supported. + * @param {String} type the type to check. + * @throws {Error} an Error if the browser doesn't support the requested type. + */ +exports.checkSupport = function(type) { + var supported = support[type.toLowerCase()]; + if (!supported) { + throw new Error(type + " is not supported by this browser"); + } +}; +exports.MAX_VALUE_16BITS = 65535; +exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 + +/** + * Prettify a string read as binary. + * @param {string} str the string to prettify. + * @return {string} a pretty string. + */ +exports.pretty = function(str) { + var res = '', + code, i; + for (i = 0; i < (str || "").length; i++) { + code = str.charCodeAt(i); + res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); + } + return res; +}; + +/** + * Find a compression registered in JSZip. + * @param {string} compressionMethod the method magic to find. + * @return {Object|null} the JSZip compression object, null if none found. + */ +exports.findCompression = function(compressionMethod) { + for (var method in compressions) { + if (!compressions.hasOwnProperty(method)) { + continue; + } + if (compressions[method].magic === compressionMethod) { + return compressions[method]; + } + } + return null; +}; +/** +* Cross-window, cross-Node-context regular expression detection +* @param {Object} object Anything +* @return {Boolean} true if the object is a regular expression, +* false otherwise +*/ +exports.isRegExp = function (object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; +}; + + +},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(_dereq_,module,exports){ +'use strict'; +var StringReader = _dereq_('./stringReader'); +var NodeBufferReader = _dereq_('./nodeBufferReader'); +var Uint8ArrayReader = _dereq_('./uint8ArrayReader'); +var utils = _dereq_('./utils'); +var sig = _dereq_('./signature'); +var ZipEntry = _dereq_('./zipEntry'); +var support = _dereq_('./support'); +var jszipProto = _dereq_('./object'); +// class ZipEntries {{{ +/** + * All the entries in the zip file. + * @constructor + * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntries(data, loadOptions) { + this.files = []; + this.loadOptions = loadOptions; + if (data) { + this.load(data); + } +} +ZipEntries.prototype = { + /** + * Check that the reader is on the speficied signature. + * @param {string} expectedSignature the expected signature. + * @throws {Error} if it is an other signature. + */ + checkSignature: function(expectedSignature) { + var signature = this.reader.readString(4); + if (signature !== expectedSignature) { + throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + } + }, + /** + * Read the end of the central directory. + */ + readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2); + this.diskWithCentralDirStart = this.reader.readInt(2); + this.centralDirRecordsOnThisDisk = this.reader.readInt(2); + this.centralDirRecords = this.reader.readInt(2); + this.centralDirSize = this.reader.readInt(4); + this.centralDirOffset = this.reader.readInt(4); + + this.zipCommentLength = this.reader.readInt(2); + // warning : the encoding depends of the system locale + // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. + // On a windows machine, this field is encoded with the localized windows code page. + this.zipComment = this.reader.readString(this.zipCommentLength); + // To get consistent behavior with the generation part, we will assume that + // this is utf8 encoded. + this.zipComment = jszipProto.utf8decode(this.zipComment); + }, + /** + * Read the end of the Zip 64 central directory. + * Not merged with the method readEndOfCentral : + * The end of central can coexist with its Zip64 brother, + * I don't want to read the wrong number of bytes ! + */ + readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8); + this.versionMadeBy = this.reader.readString(2); + this.versionNeeded = this.reader.readInt(2); + this.diskNumber = this.reader.readInt(4); + this.diskWithCentralDirStart = this.reader.readInt(4); + this.centralDirRecordsOnThisDisk = this.reader.readInt(8); + this.centralDirRecords = this.reader.readInt(8); + this.centralDirSize = this.reader.readInt(8); + this.centralDirOffset = this.reader.readInt(8); + + this.zip64ExtensibleData = {}; + var extraDataSize = this.zip64EndOfCentralSize - 44, + index = 0, + extraFieldId, + extraFieldLength, + extraFieldValue; + while (index < extraDataSize) { + extraFieldId = this.reader.readInt(2); + extraFieldLength = this.reader.readInt(4); + extraFieldValue = this.reader.readString(extraFieldLength); + this.zip64ExtensibleData[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Read the end of the Zip 64 central directory locator. + */ + readBlockZip64EndOfCentralLocator: function() { + this.diskWithZip64CentralDirStart = this.reader.readInt(4); + this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); + this.disksCount = this.reader.readInt(4); + if (this.disksCount > 1) { + throw new Error("Multi-volumes zip are not supported"); + } + }, + /** + * Read the local files, based on the offset read in the central part. + */ + readLocalFiles: function() { + var i, file; + for (i = 0; i < this.files.length; i++) { + file = this.files[i]; + this.reader.setIndex(file.localHeaderOffset); + this.checkSignature(sig.LOCAL_FILE_HEADER); + file.readLocalPart(this.reader); + file.handleUTF8(); + } + }, + /** + * Read the central directory. + */ + readCentralDir: function() { + var file; + + this.reader.setIndex(this.centralDirOffset); + while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) { + file = new ZipEntry({ + zip64: this.zip64 + }, this.loadOptions); + file.readCentralPart(this.reader); + this.files.push(file); + } + }, + /** + * Read the end of central directory. + */ + readEndOfCentral: function() { + var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); + if (offset === -1) { + throw new Error("Corrupted zip : can't find end of central directory"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.CENTRAL_DIRECTORY_END); + this.readBlockEndOfCentral(); + + + /* extract from the zip spec : + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + */ + if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { + this.zip64 = true; + + /* + Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from + the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents + all numbers as 64-bit double precision IEEE 754 floating point numbers. + So, we have 53bits for integers and bitwise operations treat everything as 32bits. + see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators + and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 + */ + + // should look for a zip64 EOCD locator + offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + if (offset === -1) { + throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + this.readBlockZip64EndOfCentralLocator(); + + // now the zip64 EOCD record + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + this.readBlockZip64EndOfCentral(); + } + }, + prepareReader: function(data) { + var type = utils.getTypeOf(data); + if (type === "string" && !support.uint8array) { + this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString); + } + else if (type === "nodebuffer") { + this.reader = new NodeBufferReader(data); + } + else { + this.reader = new Uint8ArrayReader(utils.transformTo("uint8array", data)); + } + }, + /** + * Read a zip file and create ZipEntries. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. + */ + load: function(data) { + this.prepareReader(data); + this.readEndOfCentral(); + this.readCentralDir(); + this.readLocalFiles(); + } +}; +// }}} end of ZipEntries +module.exports = ZipEntries; + +},{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(_dereq_,module,exports){ +'use strict'; +var StringReader = _dereq_('./stringReader'); +var utils = _dereq_('./utils'); +var CompressedObject = _dereq_('./compressedObject'); +var jszipProto = _dereq_('./object'); +// class ZipEntry {{{ +/** + * An entry in the zip file. + * @constructor + * @param {Object} options Options of the current file. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntry(options, loadOptions) { + this.options = options; + this.loadOptions = loadOptions; +} +ZipEntry.prototype = { + /** + * say if the file is encrypted. + * @return {boolean} true if the file is encrypted, false otherwise. + */ + isEncrypted: function() { + // bit 1 is set + return (this.bitFlag & 0x0001) === 0x0001; + }, + /** + * say if the file has utf-8 filename/comment. + * @return {boolean} true if the filename/comment is in utf-8, false otherwise. + */ + useUTF8: function() { + // bit 11 is set + return (this.bitFlag & 0x0800) === 0x0800; + }, + /** + * Prepare the function used to generate the compressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @return {Function} the callback to get the compressed content (the type depends of the DataReader class). + */ + prepareCompressedContent: function(reader, from, length) { + return function() { + var previousIndex = reader.index; + reader.setIndex(from); + var compressedFileData = reader.readData(length); + reader.setIndex(previousIndex); + + return compressedFileData; + }; + }, + /** + * Prepare the function used to generate the uncompressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @param {JSZip.compression} compression the compression used on this file. + * @param {number} uncompressedSize the uncompressed size to expect. + * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class). + */ + prepareContent: function(reader, from, length, compression, uncompressedSize) { + return function() { + + var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); + var uncompressedFileData = compression.uncompress(compressedFileData); + + if (uncompressedFileData.length !== uncompressedSize) { + throw new Error("Bug : uncompressed data size mismatch"); + } + + return uncompressedFileData; + }; + }, + /** + * Read the local part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readLocalPart: function(reader) { + var compression, localExtraFieldsLength; + + // we already know everything from the central dir ! + // If the central dir data are false, we are doomed. + // On the bright side, the local part is scary : zip64, data descriptors, both, etc. + // The less data we get here, the more reliable this should be. + // Let's skip the whole header and dash to the data ! + reader.skip(22); + // in some zip created on windows, the filename stored in the central dir contains \ instead of /. + // Strangely, the filename here is OK. + // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes + // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... + // Search "unzip mismatching "local" filename continuing with "central" filename version" on + // the internet. + // + // I think I see the logic here : the central directory is used to display + // content and the local directory is used to extract the files. Mixing / and \ + // may be used to display \ to windows users and use / when extracting the files. + // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 + this.fileNameLength = reader.readInt(2); + localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir + this.fileName = reader.readString(this.fileNameLength); + reader.skip(localExtraFieldsLength); + + if (this.compressedSize == -1 || this.uncompressedSize == -1) { + throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)"); + } + + compression = utils.findCompression(this.compressionMethod); + if (compression === null) { // no compression found + throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + this.fileName + ")"); + } + this.decompressed = new CompressedObject(); + this.decompressed.compressedSize = this.compressedSize; + this.decompressed.uncompressedSize = this.uncompressedSize; + this.decompressed.crc32 = this.crc32; + this.decompressed.compressionMethod = this.compressionMethod; + this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression); + this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); + + // we need to compute the crc32... + if (this.loadOptions.checkCRC32) { + this.decompressed = utils.transformTo("string", this.decompressed.getContent()); + if (jszipProto.crc32(this.decompressed) !== this.crc32) { + throw new Error("Corrupted zip : CRC32 mismatch"); + } + } + }, + + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readCentralPart: function(reader) { + this.versionMadeBy = reader.readString(2); + this.versionNeeded = reader.readInt(2); + this.bitFlag = reader.readInt(2); + this.compressionMethod = reader.readString(2); + this.date = reader.readDate(); + this.crc32 = reader.readInt(4); + this.compressedSize = reader.readInt(4); + this.uncompressedSize = reader.readInt(4); + this.fileNameLength = reader.readInt(2); + this.extraFieldsLength = reader.readInt(2); + this.fileCommentLength = reader.readInt(2); + this.diskNumberStart = reader.readInt(2); + this.internalFileAttributes = reader.readInt(2); + this.externalFileAttributes = reader.readInt(4); + this.localHeaderOffset = reader.readInt(4); + + if (this.isEncrypted()) { + throw new Error("Encrypted zip are not supported"); + } + + this.fileName = reader.readString(this.fileNameLength); + this.readExtraFields(reader); + this.parseZIP64ExtraField(reader); + this.fileComment = reader.readString(this.fileCommentLength); + + // warning, this is true only for zip with madeBy == DOS (plateform dependent feature) + this.dir = this.externalFileAttributes & 0x00000010 ? true : false; + }, + /** + * Parse the ZIP64 extra field and merge the info in the current ZipEntry. + * @param {DataReader} reader the reader to use. + */ + parseZIP64ExtraField: function(reader) { + + if (!this.extraFields[0x0001]) { + return; + } + + // should be something, preparing the extra reader + var extraReader = new StringReader(this.extraFields[0x0001].value); + + // I really hope that these 64bits integer can fit in 32 bits integer, because js + // won't let us have more. + if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { + this.uncompressedSize = extraReader.readInt(8); + } + if (this.compressedSize === utils.MAX_VALUE_32BITS) { + this.compressedSize = extraReader.readInt(8); + } + if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { + this.localHeaderOffset = extraReader.readInt(8); + } + if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { + this.diskNumberStart = extraReader.readInt(4); + } + }, + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readExtraFields: function(reader) { + var start = reader.index, + extraFieldId, + extraFieldLength, + extraFieldValue; + + this.extraFields = this.extraFields || {}; + + while (reader.index < start + this.extraFieldsLength) { + extraFieldId = reader.readInt(2); + extraFieldLength = reader.readInt(2); + extraFieldValue = reader.readString(extraFieldLength); + + this.extraFields[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Apply an UTF8 transformation if needed. + */ + handleUTF8: function() { + if (this.useUTF8()) { + this.fileName = jszipProto.utf8decode(this.fileName); + this.fileComment = jszipProto.utf8decode(this.fileComment); + } else { + var upath = this.findExtraFieldUnicodePath(); + if (upath !== null) { + this.fileName = upath; + } + var ucomment = this.findExtraFieldUnicodeComment(); + if (ucomment !== null) { + this.fileComment = ucomment; + } + } + }, + + /** + * Find the unicode path declared in the extra field, if any. + * @return {String} the unicode path, null otherwise. + */ + findExtraFieldUnicodePath: function() { + var upathField = this.extraFields[0x7075]; + if (upathField) { + var extraReader = new StringReader(upathField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the filename changed, this field is out of date. + if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(upathField.length - 5)); + } + return null; + }, + + /** + * Find the unicode comment declared in the extra field, if any. + * @return {String} the unicode comment, null otherwise. + */ + findExtraFieldUnicodeComment: function() { + var ucommentField = this.extraFields[0x6375]; + if (ucommentField) { + var extraReader = new StringReader(ucommentField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the comment changed, this field is out of date. + if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5)); + } + return null; + } +}; +module.exports = ZipEntry; + +},{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(_dereq_,module,exports){ +// Top level file is just a mixin of submodules & constants +'use strict'; + +var assign = _dereq_('./lib/utils/common').assign; + +var deflate = _dereq_('./lib/deflate'); +var inflate = _dereq_('./lib/inflate'); +var constants = _dereq_('./lib/zlib/constants'); + +var pako = {}; + +assign(pako, deflate, inflate, constants); + +module.exports = pako; +},{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(_dereq_,module,exports){ +'use strict'; + + +var zlib_deflate = _dereq_('./zlib/deflate.js'); +var utils = _dereq_('./utils/common'); +var strings = _dereq_('./utils/strings'); +var msg = _dereq_('./zlib/messages'); +var zstream = _dereq_('./zlib/zstream'); + + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + +var Z_NO_FLUSH = 0; +var Z_FINISH = 4; + +var Z_OK = 0; +var Z_STREAM_END = 1; + +var Z_DEFAULT_COMPRESSION = -1; + +var Z_DEFAULT_STRATEGY = 0; + +var Z_DEFLATED = 8; + +/* ===========================================================================*/ + + +/** + * class Deflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[deflate]], + * [[deflateRaw]] and [[gzip]]. + **/ + +/* internal + * Deflate.chunks -> Array + * + * Chunks of output data, if [[Deflate#onData]] not overriden. + **/ + +/** + * Deflate.result -> Uint8Array|Array + * + * Compressed result, generated by default [[Deflate#onData]] + * and [[Deflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Deflate#push]] with `Z_FINISH` / `true` param). + **/ + +/** + * Deflate.err -> Number + * + * Error code after deflate finished. 0 (Z_OK) on success. + * You will not need it in real life, because deflate errors + * are possible only on wrong options or bad `onData` / `onEnd` + * custom handlers. + **/ + +/** + * Deflate.msg -> String + * + * Error message, if [[Deflate.err]] != 0 + **/ + + +/** + * new Deflate(options) + * - options (Object): zlib deflate options. + * + * Creates new deflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `level` + * - `windowBits` + * - `memLevel` + * - `strategy` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw deflate + * - `gzip` (Boolean) - create gzip wrapper + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * - `header` (Object) - custom header for gzip + * - `text` (Boolean) - true if compressed data believed to be text + * - `time` (Number) - modification time, unix timestamp + * - `os` (Number) - operation system code + * - `extra` (Array) - array of bytes with extra data (max 65536) + * - `name` (String) - file name (binary string) + * - `comment` (String) - comment (binary string) + * - `hcrc` (Boolean) - true if header crc should be added + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var deflate = new pako.Deflate({ level: 3}); + * + * deflate.push(chunk1, false); + * deflate.push(chunk2, true); // true -> last chunk + * + * if (deflate.err) { throw new Error(deflate.err); } + * + * console.log(deflate.result); + * ``` + **/ +var Deflate = function(options) { + + this.options = utils.assign({ + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY, + to: '' + }, options || {}); + + var opt = this.options; + + if (opt.raw && (opt.windowBits > 0)) { + opt.windowBits = -opt.windowBits; + } + + else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { + opt.windowBits += 16; + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new zstream(); + this.strm.avail_out = 0; + + var status = zlib_deflate.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy + ); + + if (status !== Z_OK) { + throw new Error(msg[status]); + } + + if (opt.header) { + zlib_deflate.deflateSetHeader(this.strm, opt.header); + } +}; + +/** + * Deflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|String): input data. Strings will be converted to + * utf8 byte sequence. + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with + * new compressed chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That flush internal pending buffers and call + * [[Deflate#onEnd]]. + * + * On fail call [[Deflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * array format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ +Deflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + + if (this.ended) { return false; } + + _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // If we need to compress text, change encoding to utf8. + strm.input = strings.string2buf(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ + + if (status !== Z_STREAM_END && status !== Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) { + if (this.options.to === 'string') { + this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); + + // Finalize on the last chunk. + if (_mode === Z_FINISH) { + status = zlib_deflate.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK; + } + + return true; +}; + + +/** + * Deflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ +Deflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); +}; + + +/** + * Deflate#onEnd(status) -> Void + * - status (Number): deflate status. 0 (Z_OK) on success, + * other if not. + * + * Called once after you tell deflate that input stream complete + * or error happenned. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ +Deflate.prototype.onEnd = function(status) { + // On success - join + if (status === Z_OK) { + if (this.options.to === 'string') { + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; + + +/** + * deflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * Compress `data` with deflate alrorythm and `options`. + * + * Supported options are: + * + * - level + * - windowBits + * - memLevel + * - strategy + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be "binary string" + * (each char code [0..255]) + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); + * + * console.log(pako.deflate(data)); + * ``` + **/ +function deflate(input, options) { + var deflator = new Deflate(options); + + deflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (deflator.err) { throw deflator.msg; } + + return deflator.result; +} + + +/** + * deflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ +function deflateRaw(input, options) { + options = options || {}; + options.raw = true; + return deflate(input, options); +} + + +/** + * gzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to compress. + * - options (Object): zlib deflate options. + * + * The same as [[deflate]], but create gzip wrapper instead of + * deflate one. + **/ +function gzip(input, options) { + options = options || {}; + options.gzip = true; + return deflate(input, options); +} + + +exports.Deflate = Deflate; +exports.deflate = deflate; +exports.deflateRaw = deflateRaw; +exports.gzip = gzip; +},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(_dereq_,module,exports){ +'use strict'; + + +var zlib_inflate = _dereq_('./zlib/inflate.js'); +var utils = _dereq_('./utils/common'); +var strings = _dereq_('./utils/strings'); +var c = _dereq_('./zlib/constants'); +var msg = _dereq_('./zlib/messages'); +var zstream = _dereq_('./zlib/zstream'); +var gzheader = _dereq_('./zlib/gzheader'); + + +/** + * class Inflate + * + * Generic JS-style wrapper for zlib calls. If you don't need + * streaming behaviour - use more simple functions: [[inflate]] + * and [[inflateRaw]]. + **/ + +/* internal + * inflate.chunks -> Array + * + * Chunks of output data, if [[Inflate#onData]] not overriden. + **/ + +/** + * Inflate.result -> Uint8Array|Array|String + * + * Uncompressed result, generated by default [[Inflate#onData]] + * and [[Inflate#onEnd]] handlers. Filled after you push last chunk + * (call [[Inflate#push]] with `Z_FINISH` / `true` param). + **/ + +/** + * Inflate.err -> Number + * + * Error code after inflate finished. 0 (Z_OK) on success. + * Should be checked if broken data possible. + **/ + +/** + * Inflate.msg -> String + * + * Error message, if [[Inflate.err]] != 0 + **/ + + +/** + * new Inflate(options) + * - options (Object): zlib inflate options. + * + * Creates new inflator instance with specified params. Throws exception + * on bad params. Supported options: + * + * - `windowBits` + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information on these. + * + * Additional options, for internal needs: + * + * - `chunkSize` - size of generated data chunks (16K by default) + * - `raw` (Boolean) - do raw inflate + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * By default, when no options set, autodetect deflate/gzip data format via + * wrapper header. + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) + * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); + * + * var inflate = new pako.Inflate({ level: 3}); + * + * inflate.push(chunk1, false); + * inflate.push(chunk2, true); // true -> last chunk + * + * if (inflate.err) { throw new Error(inflate.err); } + * + * console.log(inflate.result); + * ``` + **/ +var Inflate = function(options) { + + this.options = utils.assign({ + chunkSize: 16384, + windowBits: 0, + to: '' + }, options || {}); + + var opt = this.options; + + // Force window size for `raw` data, if not set directly, + // because we have no header for autodetect. + if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { opt.windowBits = -15; } + } + + // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate + if ((opt.windowBits >= 0) && (opt.windowBits < 16) && + !(options && options.windowBits)) { + opt.windowBits += 32; + } + + // Gzip header has no info about windows size, we can do autodetect only + // for deflate. So, if window size not set, force it to max when gzip possible + if ((opt.windowBits > 15) && (opt.windowBits < 48)) { + // bit 3 (16) -> gzipped data + // bit 4 (32) -> autodetect gzip/deflate + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; + } + } + + this.err = 0; // error code, if happens (0 = Z_OK) + this.msg = ''; // error message + this.ended = false; // used to avoid multiple onEnd() calls + this.chunks = []; // chunks of compressed data + + this.strm = new zstream(); + this.strm.avail_out = 0; + + var status = zlib_inflate.inflateInit2( + this.strm, + opt.windowBits + ); + + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + + this.header = new gzheader(); + + zlib_inflate.inflateGetHeader(this.strm, this.header); +}; + +/** + * Inflate#push(data[, mode]) -> Boolean + * - data (Uint8Array|Array|String): input data + * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. + * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. + * + * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with + * new output chunks. Returns `true` on success. The last data block must have + * mode Z_FINISH (or `true`). That flush internal pending buffers and call + * [[Inflate#onEnd]]. + * + * On fail call [[Inflate#onEnd]] with error code and return false. + * + * We strongly recommend to use `Uint8Array` on input for best speed (output + * format is detected automatically). Also, don't skip last param and always + * use the same type in your code (boolean or number). That will improve JS speed. + * + * For regular `Array`-s make sure all elements are [0..255]. + * + * ##### Example + * + * ```javascript + * push(chunk, false); // push one of data chunks + * ... + * push(chunk, true); // push last chunk + * ``` + **/ +Inflate.prototype.push = function(data, mode) { + var strm = this.strm; + var chunkSize = this.options.chunkSize; + var status, _mode; + var next_out_utf8, tail, utf8str; + + if (this.ended) { return false; } + _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); + + // Convert data if needed + if (typeof data === 'string') { + // Only binary strings can be decompressed on practice + strm.input = strings.binstring2buf(data); + } else { + strm.input = data; + } + + strm.next_in = 0; + strm.avail_in = strm.input.length; + + do { + if (strm.avail_out === 0) { + strm.output = new utils.Buf8(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + + status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ + + if (status !== c.Z_STREAM_END && status !== c.Z_OK) { + this.onEnd(status); + this.ended = true; + return false; + } + + if (strm.next_out) { + if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) { + + if (this.options.to === 'string') { + + next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + + tail = strm.next_out - next_out_utf8; + utf8str = strings.buf2string(strm.output, next_out_utf8); + + // move tail + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } + + this.onData(utf8str); + + } else { + this.onData(utils.shrinkBuf(strm.output, strm.next_out)); + } + } + } + } while ((strm.avail_in > 0) && status !== c.Z_STREAM_END); + + if (status === c.Z_STREAM_END) { + _mode = c.Z_FINISH; + } + // Finalize on the last chunk. + if (_mode === c.Z_FINISH) { + status = zlib_inflate.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === c.Z_OK; + } + + return true; +}; + + +/** + * Inflate#onData(chunk) -> Void + * - chunk (Uint8Array|Array|String): ouput data. Type of array depends + * on js engine support. When string output requested, each chunk + * will be string. + * + * By default, stores data blocks in `chunks[]` property and glue + * those in `onEnd`. Override this handler, if you need another behaviour. + **/ +Inflate.prototype.onData = function(chunk) { + this.chunks.push(chunk); +}; + + +/** + * Inflate#onEnd(status) -> Void + * - status (Number): inflate status. 0 (Z_OK) on success, + * other if not. + * + * Called once after you tell inflate that input stream complete + * or error happenned. By default - join collected chunks, + * free memory and fill `results` / `err` properties. + **/ +Inflate.prototype.onEnd = function(status) { + // On success - join + if (status === c.Z_OK) { + if (this.options.to === 'string') { + // Glue & convert here, until we teach pako to send + // utf8 alligned strings to onData + this.result = this.chunks.join(''); + } else { + this.result = utils.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; + + +/** + * inflate(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Decompress `data` with inflate/ungzip and `options`. Autodetect + * format via wrapper header by default. That's why we don't provide + * separate `ungzip` method. + * + * Supported options are: + * + * - windowBits + * + * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) + * for more information. + * + * Sugar (options): + * + * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify + * negative windowBits implicitly. + * - `to` (String) - if equal to 'string', then result will be converted + * from utf8 to utf16 (javascript) string. When string output requested, + * chunk length can differ from `chunkSize`, depending on content. + * + * + * ##### Example: + * + * ```javascript + * var pako = require('pako') + * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) + * , output; + * + * try { + * output = pako.inflate(input); + * } catch (err) + * console.log(err); + * } + * ``` + **/ +function inflate(input, options) { + var inflator = new Inflate(options); + + inflator.push(input, true); + + // That will never happens, if you don't cheat with options :) + if (inflator.err) { throw inflator.msg; } + + return inflator.result; +} + + +/** + * inflateRaw(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * The same as [[inflate]], but creates raw data, without wrapper + * (header and adler32 crc). + **/ +function inflateRaw(input, options) { + options = options || {}; + options.raw = true; + return inflate(input, options); +} + + +/** + * ungzip(data[, options]) -> Uint8Array|Array|String + * - data (Uint8Array|Array|String): input data to decompress. + * - options (Object): zlib inflate options. + * + * Just shortcut to [[inflate]], because it autodetects format + * by header.content. Done for convenience. + **/ + + +exports.Inflate = Inflate; +exports.inflate = inflate; +exports.inflateRaw = inflateRaw; +exports.ungzip = inflate; + +},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(_dereq_,module,exports){ +'use strict'; + + +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + + +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof(source) !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (source.hasOwnProperty(p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs+len), dest_offs); + return; + } + // Fallback to ordinary array + for(var i=0; i= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); +} +_utf8len[254]=_utf8len[254]=1; // Invalid sequence start + + +// convert string to array (typed, when possible) +exports.string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + buf = new utils.Buf8(buf_len); + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Helper (used in 2 places) +function buf2binstring(buf, len) { + // use fallback for big arrays to avoid stack overflow + if (len < 65537) { + if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { + return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); + } + } + + var result = ''; + for(var i=0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; +} + + +// Convert byte array to binary string +exports.buf2binstring = function(buf) { + return buf2binstring(buf, buf.length); +}; + + +// Convert binary string (typed, when possible) +exports.binstring2buf = function(str) { + var buf = new utils.Buf8(str.length); + for(var i=0, len=buf.length; i < len; i++) { + buf[i] = str.charCodeAt(i); + } + return buf; +}; + + +// convert array to string +exports.buf2string = function (buf, max) { + var i, out, c, c_len; + var len = max || buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + return buf2binstring(utf16buf, out); +}; + + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +exports.utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +},{"./common":27}],29:[function(_dereq_,module,exports){ +'use strict'; + +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It doesn't worth to make additional optimizationa as in original. +// Small size is preferable. + +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0 + , s2 = ((adler >>> 16) & 0xffff) |0 + , n = 0; + + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; +} + + +module.exports = adler32; +},{}],30:[function(_dereq_,module,exports){ +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + 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, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + 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, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; +},{}],31:[function(_dereq_,module,exports){ +'use strict'; + +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. + + +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; + + for(var n =0; n < 256; n++){ + c = n; + for(var k =0; k < 8; k++){ + c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; +} + +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); + + +function crc32(crc, buf, len, pos) { + var t = crcTable + , end = pos + len; + + crc = crc ^ (-1); + + for (var i = pos; i < end; i++ ) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + + +module.exports = crc32; +},{}],32:[function(_dereq_,module,exports){ +'use strict'; + +var utils = _dereq_('../utils/common'); +var trees = _dereq_('./trees'); +var adler32 = _dereq_('./adler32'); +var crc32 = _dereq_('./crc32'); +var msg = _dereq_('./messages'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +var Z_NO_FLUSH = 0; +var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +//var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + +/* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; +var Z_DEFAULT_COMPRESSION = -1; + + +var Z_FILTERED = 1; +var Z_HUFFMAN_ONLY = 2; +var Z_RLE = 3; +var Z_FIXED = 4; +var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + + +/* The deflate compression method */ +var Z_DEFLATED = 8; + +/*============================================================================*/ + + +var MAX_MEM_LEVEL = 9; +/* Maximum value for memLevel in deflateInit2 */ +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_MEM_LEVEL = 8; + + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ +var LITERALS = 256; +/* number of literal bytes 0..255 */ +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ +var D_CODES = 30; +/* number of distance codes */ +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ +var HEAP_SIZE = 2*L_CODES + 1; +/* maximum heap size */ +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + +var PRESET_DICT = 0x20; + +var INIT_STATE = 42; +var EXTRA_STATE = 69; +var NAME_STATE = 73; +var COMMENT_STATE = 91; +var HCRC_STATE = 103; +var BUSY_STATE = 113; +var FINISH_STATE = 666; + +var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ +var BS_BLOCK_DONE = 2; /* block flush performed */ +var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ +var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + +var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + +function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; +} + +function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); +} + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ +function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +} + + +function flush_block_only (s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +} + + +function put_byte(s, b) { + s.pending_buf[s.pending++] = b; +} + + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; +} + + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ +function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; +} + + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +} + + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH-1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH-1)) ? s.strstart : MIN_MATCH-1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH-1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size-MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1- s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length-1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH-1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH-1 ? s.strstart : MIN_MATCH-1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; +} + + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +var Config = function (good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +}; + +var configuration_table; + +configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ +]; + + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +} + + +function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2*D_CODES+1) * 2); + this.bl_tree = new utils.Buf16((2*BL_CODES+1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS+1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2*L_CODES+1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2*L_CODES+1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ +} + + +function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; +} + + +function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; +} + + +function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; +} + + +function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + s.d_buf = s.lit_bufsize >> 1; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); +} + +function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); +} + + +function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg){ + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; +} + +function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state + */ +//function deflateCopy(dest, source) { +// +//} + +exports.deflateInit = deflateInit; +exports.deflateInit2 = deflateInit2; +exports.deflateReset = deflateReset; +exports.deflateResetKeep = deflateResetKeep; +exports.deflateSetHeader = deflateSetHeader; +exports.deflate = deflate; +exports.deflateEnd = deflateEnd; +exports.deflateInfo = 'pako deflate (from Nodeca project)'; + +/* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ +},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(_dereq_,module,exports){ +'use strict'; + + +function GZheader() { + /* true if compressed data believed to be text */ + this.text = 0; + /* modification time */ + this.time = 0; + /* extra flags (not used when writing a gzip file) */ + this.xflags = 0; + /* operating system */ + this.os = 0; + /* pointer to extra field or Z_NULL if none */ + this.extra = null; + /* extra field length (valid if extra != Z_NULL) */ + this.extra_len = 0; // Actually, we don't need it in JS, + // but leave for few code modifications + + // + // Setup limits is not necessary because in js we should not preallocate memory + // for inflate use constant limit in 65536 bytes + // + + /* space at extra (only when reading header) */ + // this.extra_max = 0; + /* pointer to zero-terminated file name or Z_NULL */ + this.name = ''; + /* space at name (only when reading header) */ + // this.name_max = 0; + /* pointer to zero-terminated comment or Z_NULL */ + this.comment = ''; + /* space at comment (only when reading header) */ + // this.comm_max = 0; + /* true if there was or will be a header crc */ + this.hcrc = 0; + /* true when done reading gzip header (not used when writing a gzip file) */ + this.done = false; +} + +module.exports = GZheader; +},{}],34:[function(_dereq_,module,exports){ +'use strict'; + +// See state defs from inflate.js +var BAD = 30; /* got a data error -- remain here until reset */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 + + On return, state.mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ +module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + var window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; + + + var input, output; // JS specific, because we have no pointers + + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; +}; + +},{}],35:[function(_dereq_,module,exports){ +'use strict'; + + +var utils = _dereq_('../utils/common'); +var adler32 = _dereq_('./adler32'); +var crc32 = _dereq_('./crc32'); +var inflate_fast = _dereq_('./inffast'); +var inflate_table = _dereq_('./inftrees'); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + +/* The deflate compression method */ +var Z_DEFLATED = 8; + + +/* STATES ====================================================================*/ +/* ===========================================================================*/ + + +var HEAD = 1; /* i: waiting for magic header */ +var FLAGS = 2; /* i: waiting for method and flags (gzip) */ +var TIME = 3; /* i: waiting for modification time (gzip) */ +var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ +var EXLEN = 5; /* i: waiting for extra length (gzip) */ +var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ +var NAME = 7; /* i: waiting for end of file name (gzip) */ +var COMMENT = 8; /* i: waiting for end of comment (gzip) */ +var HCRC = 9; /* i: waiting for header crc (gzip) */ +var DICTID = 10; /* i: waiting for dictionary check value */ +var DICT = 11; /* waiting for inflateSetDictionary() call */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ +var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ +var STORED = 14; /* i: waiting for stored size (length and complement) */ +var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ +var COPY = 16; /* i/o: waiting for input or output to copy stored block */ +var TABLE = 17; /* i: waiting for dynamic block table lengths */ +var LENLENS = 18; /* i: waiting for code length code lengths */ +var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ +var LEN_ = 20; /* i: same as LEN below, but only first time in */ +var LEN = 21; /* i: waiting for length/lit/eob code */ +var LENEXT = 22; /* i: waiting for length extra bits */ +var DIST = 23; /* i: waiting for distance code */ +var DISTEXT = 24; /* i: waiting for distance extra bits */ +var MATCH = 25; /* o: waiting for output space to copy string */ +var LIT = 26; /* o: waiting for output space to write literal */ +var CHECK = 27; /* i: waiting for 32-bit check value */ +var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ +var DONE = 29; /* finished check, done -- remain here until reset */ +var BAD = 30; /* got a data error -- remain here until reset */ +var MEM = 31; /* got an inflate() memory error -- remain here until reset */ +var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ + +/* ===========================================================================*/ + + + +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_WBITS = MAX_WBITS; + + +function ZSWAP32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); +} + + +function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ + + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ + + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ + + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ + + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ + + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ +} + +function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + +} + +function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +} + +function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; +} + +function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); +} + + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +var virgin = true; + +var lenfix, distfix; // We have no pointers in JS, so keep tables separate + +function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {bits: 9}); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {bits: 5}); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +} + + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window,src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window,src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window,src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; +} + +function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more conveniend processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0 /*crc32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = ZSWAP32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = {bits: state.lenbits}; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = {bits: state.lenbits}; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = {bits: state.distbits}; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) -1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) -1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' insdead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, ZSWAP32 returns signed too + if ((state.flags ? hold : ZSWAP32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; +} + +function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; +} + +function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; +} + + +exports.inflateReset = inflateReset; +exports.inflateReset2 = inflateReset2; +exports.inflateResetKeep = inflateResetKeep; +exports.inflateInit = inflateInit; +exports.inflateInit2 = inflateInit2; +exports.inflate = inflate; +exports.inflateEnd = inflateEnd; +exports.inflateGetHeader = inflateGetHeader; +exports.inflateInfo = 'pako inflate (from Nodeca project)'; + +/* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ +},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(_dereq_,module,exports){ +'use strict'; + + +var utils = _dereq_('../utils/common'); + +var MAXBITS = 15; +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +var lbase = [ /* Length codes 257..285 base */ + 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 +]; + +var lext = [ /* Length codes 257..285 extra */ + 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 +]; + +var dbase = [ /* Distance codes 0..29 base */ + 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 +]; + +var dext = [ /* Distance codes 0..29 extra */ + 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 +]; + +module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) +{ + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + var i=0; + /* process all codes and make table entries */ + for (;;) { + i++; + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; +}; + +},{"../utils/common":27}],37:[function(_dereq_,module,exports){ +'use strict'; + +module.exports = { + '2': 'need dictionary', /* Z_NEED_DICT 2 */ + '1': 'stream end', /* Z_STREAM_END 1 */ + '0': '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; +},{}],38:[function(_dereq_,module,exports){ +'use strict'; + + +var utils = _dereq_('../utils/common'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; +var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +var Z_BINARY = 0; +var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + +/*============================================================================*/ + + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + +var STORED_BLOCK = 0; +var STATIC_TREES = 1; +var DYN_TREES = 2; +/* The three kinds of block type */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +/* The minimum and maximum match lengths */ + +// From deflate.h +/* =========================================================================== + * Internal compression state. + */ + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ + +var LITERALS = 256; +/* number of literal bytes 0..255 */ + +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ + +var D_CODES = 30; +/* number of distance codes */ + +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ + +var HEAP_SIZE = 2*L_CODES + 1; +/* maximum heap size */ + +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var Buf_size = 16; +/* size of bit buffer in bi_buf */ + + +/* =========================================================================== + * Constants + */ + +var MAX_BL_BITS = 7; +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +var END_BLOCK = 256; +/* end of block literal code */ + +var REP_3_6 = 16; +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +var REPZ_3_10 = 17; +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +var REPZ_11_138 = 18; +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + +var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + +var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + +var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + +var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 +var static_ltree = new Array((L_CODES+2) * 2); +zero(static_ltree); +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +var static_dtree = new Array(D_CODES * 2); +zero(static_dtree); +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +var _dist_code = new Array(DIST_CODE_LEN); +zero(_dist_code); +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +var _length_code = new Array(MAX_MATCH-MIN_MATCH+1); +zero(_length_code); +/* length code for each normalized match length (0 == MIN_MATCH) */ + +var base_length = new Array(LENGTH_CODES); +zero(base_length); +/* First normalized length for each code (0 = MIN_MATCH) */ + +var base_dist = new Array(D_CODES); +zero(base_dist); +/* First normalized distance for each code (0 = distance of 1) */ + + +var StaticTreeDesc = function (static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; +}; + + +var static_l_desc; +var static_d_desc; +var static_bl_desc; + + +var TreeDesc = function(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ +}; + + + +function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +} + + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +function put_short (s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; +} + + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } +} + + +function send_code(s, c, tree) { + send_bits(s, tree[c*2]/*.Code*/, tree[c*2 + 1]/*.Len*/); +} + + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +} + + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +} + + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max]*2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max+1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n*2 +1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n*2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n-base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n*2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m*2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m*2 + 1]/*.Len*/)*tree[m*2]/*.Freq*/; + tree[m*2 + 1]/*.Len*/ = bits; + } + n--; + } + } +} + + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ +{ + var next_code = new Array(MAX_BITS+1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n*2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n*2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n*2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n*2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n*2 + 1]/*.Len*/ = 5; + static_dtree[n*2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc =new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; +} + + +/* =========================================================================== + * Initialize a new block. + */ +function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; +} + + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +function bi_windup(s) +{ + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +function smaller(tree, n, m, depth) { + var _n2 = n*2; + var _m2 = m*2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); +} + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ +{ + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j+1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; +} + + +// inlined manually +// var SMALLEST = 1; + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ +{ + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx*2] << 8) | (s.pending_buf[s.d_buf + lx*2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); +} + + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n*2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node*2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n*2 + 1]/*.Dad*/ = tree[m*2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); +} + + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code+1)*2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n+1)*2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6*2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10*2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138*2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n+1)*2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count-11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex]*2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3*(max_blindex+1) + 5+5+4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; +} + + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank]*2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes-1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes-1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n*2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + + +var static_init_done = false; + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +function _tr_init(s) +{ + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); +} + + +/* =========================================================================== + * Send a stored block + */ +function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+(last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ +} + + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +function _tr_align(s) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +} + + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len+3+7) >>> 3; + static_lenb = (s.static_len+3+7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len+4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES<<1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES<<1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code+1, s.d_desc.max_code+1, max_blindex+1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc*2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc]+LITERALS+1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +exports._tr_init = _tr_init; +exports._tr_stored_block = _tr_stored_block; +exports._tr_flush_block = _tr_flush_block; +exports._tr_tally = _tr_tally; +exports._tr_align = _tr_align; +},{"../utils/common":27}],39:[function(_dereq_,module,exports){ +'use strict'; + + +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} + +module.exports = ZStream; +},{}]},{},[9]) +(9) +}); diff --git a/commodoreclicker/js/thirdparty/jszip/dist/jszip.min.js b/commodoreclicker/js/thirdparty/jszip/dist/jszip.min.js new file mode 100644 index 00000000..767d8c11 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/dist/jszip.min.js @@ -0,0 +1,14 @@ +/*! + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2014 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE +*/ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.JSZip=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);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g>2,g=(3&b)<<4|c>>4,h=(15&c)<<2|e>>6,i=63&e,isNaN(c)?h=i=64:isNaN(e)&&(i=64),j=j+d.charAt(f)+d.charAt(g)+d.charAt(h)+d.charAt(i);return j},c.decode=function(a){var b,c,e,f,g,h,i,j="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k>4,c=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(b),64!=h&&(j+=String.fromCharCode(c)),64!=i&&(j+=String.fromCharCode(e));return j}},{}],2:[function(a,b){"use strict";function c(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}c.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=c},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\x00\x00",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":8}],4:[function(a,b){"use strict";var c=a("./utils"),d=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var e="string"!==c.getTypeOf(a);"undefined"==typeof b&&(b=0);var f=0,g=0,h=0;b=-1^b;for(var i=0,j=a.length;j>i;i++)h=e?a[i]:a.charCodeAt(i),g=255&(b^h),f=d[g],b=b>>>8^f;return-1^b}},{"./utils":21}],5:[function(a,b){"use strict";function c(){this.data=null,this.length=0,this.index=0}var d=a("./utils");c.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.lengtha)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return d.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=c},{"./utils":21}],6:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!1,c.date=null,c.compression=null,c.comment=null},{}],7:[function(a,b,c){"use strict";var d=a("./utils");c.string2binary=function(a){return d.string2binary(a)},c.string2Uint8Array=function(a){return d.transformTo("uint8array",a)},c.uint8Array2String=function(a){return d.transformTo("string",a)},c.string2Blob=function(a){var b=d.transformTo("arraybuffer",a);return d.arrayBuffer2Blob(b)},c.arrayBuffer2Blob=function(a){return d.arrayBuffer2Blob(a)},c.transformTo=function(a,b){return d.transformTo(a,b)},c.getTypeOf=function(a){return d.getTypeOf(a)},c.checkSupport=function(a){return d.checkSupport(a)},c.MAX_VALUE_16BITS=d.MAX_VALUE_16BITS,c.MAX_VALUE_32BITS=d.MAX_VALUE_32BITS,c.pretty=function(a){return d.pretty(a)},c.findCompression=function(a){return d.findCompression(a)},c.isRegExp=function(a){return d.isRegExp(a)}},{"./utils":21}],8:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("pako");c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\x00",c.compress=function(a){return e.deflateRaw(a)},c.uncompress=function(a){return e.inflateRaw(a)}},{pako:24}],9:[function(a,b){"use strict";function c(a,b){return this instanceof c?(this.files={},this.comment=null,this.root="",a&&this.load(a,b),void(this.clone=function(){var a=new c;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a})):new c(a,b)}var d=a("./base64");c.prototype=a("./object"),c.prototype.load=a("./load"),c.support=a("./support"),c.defaults=a("./defaults"),c.utils=a("./deprecatedPublicUtils"),c.base64={encode:function(a){return d.encode(a)},decode:function(a){return d.decode(a)}},c.compressions=a("./compressions"),b.exports=c},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(a,b){"use strict";var c=a("./base64"),d=a("./zipEntries");b.exports=function(a,b){var e,f,g,h;for(b=b||{},b.base64&&(a=c.decode(a)),f=new d(a,b),e=f.files,g=0;gc;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},t=function(){var a,b,c={};for(a=0;a0?a.substring(0,b):""},x=function(a,b){return"/"!=a.slice(-1)&&(a+="/"),b="undefined"!=typeof b?b:!1,this.files[a]||v.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},y=function(a,b){var c,f=new j;return a._data instanceof j?(f.uncompressedSize=a._data.uncompressedSize,f.crc32=a._data.crc32,0===f.uncompressedSize||a.dir?(b=i.STORE,f.compressedContent="",f.crc32=0):a._data.compressionMethod===b.magic?f.compressedContent=a._data.getCompressedContent():(c=a._data.getContent(),f.compressedContent=b.compress(d.transformTo(b.compressInputType,c)))):(c=p(a),(!c||0===c.length||a.dir)&&(b=i.STORE,c=""),f.uncompressedSize=c.length,f.crc32=e(c),f.compressedContent=b.compress(d.transformTo(b.compressInputType,c))),f.compressedSize=f.compressedContent.length,f.compressionMethod=b.magic,f},z=function(a,b,c,g){var h,i,j,k,m=(c.compressedContent,d.transformTo("string",l.utf8encode(b.name))),n=b.comment||"",o=d.transformTo("string",l.utf8encode(n)),p=m.length!==b.name.length,q=o.length!==n.length,r=b.options,t="",u="",v="";j=b._initialMetadata.dir!==b.dir?b.dir:r.dir,k=b._initialMetadata.date!==b.date?b.date:r.date,h=k.getHours(),h<<=6,h|=k.getMinutes(),h<<=5,h|=k.getSeconds()/2,i=k.getFullYear()-1980,i<<=4,i|=k.getMonth()+1,i<<=5,i|=k.getDate(),p&&(u=s(1,1)+s(e(m),4)+m,t+="up"+s(u.length,2)+u),q&&(v=s(1,1)+s(this.crc32(o),4)+o,t+="uc"+s(v.length,2)+v);var w="";w+="\n\x00",w+=p||q?"\x00\b":"\x00\x00",w+=c.compressionMethod,w+=s(h,2),w+=s(i,2),w+=s(c.crc32,4),w+=s(c.compressedSize,4),w+=s(c.uncompressedSize,4),w+=s(m.length,2),w+=s(t.length,2);var x=f.LOCAL_FILE_HEADER+w+m+t,y=f.CENTRAL_FILE_HEADER+"\x00"+w+s(o.length,2)+"\x00\x00\x00\x00"+(j===!0?"\x00\x00\x00":"\x00\x00\x00\x00")+s(g,4)+m+t+o;return{fileRecord:x,dirRecord:y,compressedObject:c}},A={load:function(){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(a){var b,c,d,e,f=[];for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],e=new r(d.name,d._data,t(d.options)),c=b.slice(this.root.length,b.length),b.slice(0,this.root.length)===this.root&&a(c,e)&&f.push(e));return f},file:function(a,b,c){if(1===arguments.length){if(d.isRegExp(a)){var e=a;return this.filter(function(a,b){return!b.dir&&e.test(a)})}return this.filter(function(b,c){return!c.dir&&b===a})[0]||null}return a=this.root+a,v.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(d.isRegExp(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=x.call(this,b),e=this.clone();return e.root=c.name,e},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!=a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f;return-1},c.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./dataReader":5}],19:[function(a,b){"use strict";var c=a("./utils"),d=function(a){this.data=new Uint8Array(a),this.index=0};d.prototype={append:function(a){0!==a.length&&(a=c.transformTo("uint8array",a),this.data.set(a,this.index),this.index+=a.length)},finalize:function(){return this.data}},b.exports=d},{"./utils":21}],20:[function(a,b,c){"use strict";for(var d=a("./utils"),e=a("./support"),f=a("./nodeBuffer"),g=new Array(256),h=0;256>h;h++)g[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;g[254]=g[254]=1;var i=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=e.uint8array?new Uint8Array(i):new Array(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(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},j=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 0>c?b:0===c?b:c+g[a[c]]>b?c:b},k=function(a){var b,c,e,f,h=a.length,i=new Array(2*h);for(c=0,b=0;h>b;)if(e=a[b++],128>e)i[c++]=e;else if(f=g[e],f>4)i[c++]=65533,b+=f-1;else{for(e&=2===f?31:3===f?15:7;f>1&&h>b;)e=e<<6|63&a[b++],f--;f>1?i[c++]=65533:65536>e?i[c++]=e:(e-=65536,i[c++]=55296|e>>10&1023,i[c++]=56320|1023&e)}return i.length!==c&&(i.subarray?i=i.subarray(0,c):i.length=c),d.applyFromCharCode(i)};c.utf8encode=function(a){return e.nodebuffer?f(a,"utf-8"):i(a)},c.utf8decode=function(a){if(e.nodebuffer)return d.transformTo("nodebuffer",a).toString("utf-8");a=d.transformTo(e.uint8array?"uint8array":"array",a);for(var b=[],c=0,f=a.length,g=65536;f>c;){var h=j(a,Math.min(c+g,f));b.push(e.uint8array?k(a.subarray(c,h)):k(a.slice(c,h))),c=h}return b.join("")}},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(a,b,c){"use strict";function d(a){return a}function e(a,b){for(var c=0;cg&&b>1;)try{d.push("array"===f||"nodebuffer"===f?String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e))):String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(i){b=Math.floor(b/2)}return d.join("")}function g(a,b){for(var c=0;cb?"0":"")+b.toString(16).toUpperCase();return d},c.findCompression=function(a){for(var b in i)if(i.hasOwnProperty(b)&&i[b].magic===a)return i[b];return null},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(a,b){"use strict";function c(a,b){this.files=[],this.loadOptions=b,a&&this.load(a)}var d=a("./stringReader"),e=a("./nodeBufferReader"),f=a("./uint8ArrayReader"),g=a("./utils"),h=a("./signature"),i=a("./zipEntry"),j=a("./support"),k=a("./object");c.prototype={checkSignature:function(a){var b=this.reader.readString(4);if(b!==a)throw new Error("Corrupted zip or bug : unexpected signature ("+g.pretty(b)+", expected "+g.pretty(a)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength),this.zipComment=k.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;d>e;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readString(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=g.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==n)throw new Error(j[c]);b.header&&g.deflateSetHeader(this.strm,b.header) +};s.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?m:l,e.input="string"==typeof a?i.string2buf(a):a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new h.Buf8(f),e.next_out=0,e.avail_out=f),c=g.deflate(e,d),c!==o&&c!==n)return this.onEnd(c),this.ended=!0,!1;(0===e.avail_out||0===e.avail_in&&d===m)&&this.onData("string"===this.options.to?i.buf2binstring(h.shrinkBuf(e.output,e.next_out)):h.shrinkBuf(e.output,e.next_out))}while((e.avail_in>0||0===e.avail_out)&&c!==o);return d===m?(c=g.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===n):!0},s.prototype.onData=function(a){this.chunks.push(a)},s.prototype.onEnd=function(a){a===n&&(this.result="string"===this.options.to?this.chunks.join(""):h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=s,c.deflate=d,c.deflateRaw=e,c.gzip=f},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(a,b,c){"use strict";function d(a,b){var c=new m(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}var f=a("./zlib/inflate.js"),g=a("./utils/common"),h=a("./utils/strings"),i=a("./zlib/constants"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=a("./zlib/gzheader"),m=function(a){this.options=g.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 k,this.strm.avail_out=0;var c=f.inflateInit2(this.strm,b.windowBits);if(c!==i.Z_OK)throw new Error(j[c]);this.header=new l,f.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,b){var c,d,e,j,k,l=this.strm,m=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?i.Z_FINISH:i.Z_NO_FLUSH,l.input="string"==typeof a?h.binstring2buf(a):a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new g.Buf8(m),l.next_out=0,l.avail_out=m),c=f.inflate(l,i.Z_NO_FLUSH),c!==i.Z_STREAM_END&&c!==i.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0===l.avail_out||c===i.Z_STREAM_END||0===l.avail_in&&d===i.Z_FINISH)&&("string"===this.options.to?(e=h.utf8border(l.output,l.next_out),j=l.next_out-e,k=h.buf2string(l.output,e),l.next_out=j,l.avail_out=m-j,j&&g.arraySet(l.output,l.output,e,j,0),this.onData(k)):this.onData(g.shrinkBuf(l.output,l.next_out)))}while(l.avail_in>0&&c!==i.Z_STREAM_END);return c===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(c=f.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===i.Z_OK):!0},m.prototype.onData=function(a){this.chunks.push(a)},m.prototype.onEnd=function(a){a===i.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):g.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=m,c.inflate=d,c.inflateRaw=e,c.ungzip=d},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[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;d>f;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;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;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;d>f;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)},{}],28:[function(a,b,c){"use strict";function d(a,b){if(65537>b&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;b>d;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;256>j;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=new e.Buf8(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(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;d>c;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;h>c;)if(f=a[c++],128>f)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&h>c;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:65536>f?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 0>c?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":27}],29:[function(a,b){"use strict";function c(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=c},{}],30:[function(a,b){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}},{}],31:[function(a,b){"use strict";function c(){for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function d(a,b,c,d){var f=e,g=d+c;a=-1^a;for(var h=d;g>h;h++)a=a>>>8^f[255&(a^b[h])];return-1^a}var e=c();b.exports=d},{}],32:[function(a,b,c){"use strict";function d(a,b){return a.msg=G[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(C.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){D._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,C.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=E(a.adler,b,e,c):2===a.state.wrap&&(a.adler=F(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-jb?a.strstart-(a.w_size-jb):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ib,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&m>f);if(d=ib-(m-f),f=m-ib,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-jb)){C.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=hb)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===H)return sb;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return sb;if(a.strstart-a.block_start>=a.w_size-jb&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?sb:sb}function o(a,b){for(var c,d;;){if(a.lookahead=hb&&(a.ins_h=(a.ins_h<=hb)if(d=D._tr_tally(a,a.strstart-a.match_start,a.match_length-hb),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=hb){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<=hb&&(a.ins_h=(a.ins_h<4096)&&(a.match_length=hb-1)),a.prev_length>=hb&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-hb,d=D._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-hb),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<=hb&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ib;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&f>e);a.match_length=ib-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=hb?(c=D._tr_tally(a,1,a.match_length-hb),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===H)return sb;break}if(a.match_length=0,c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function s(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=B[a.level].max_lazy,a.good_match=B[a.level].good_length,a.nice_match=B[a.level].nice_length,a.max_chain_length=B[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=hb-1,a.match_available=0,a.ins_h=0}function t(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*fb),this.dyn_dtree=new C.Buf16(2*(2*db+1)),this.bl_tree=new C.Buf16(2*(2*eb+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(gb+1),this.heap=new C.Buf16(2*cb+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*cb+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function u(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=X,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?lb:qb,a.adler=2===b.wrap?0:1,b.last_flush=H,D._tr_init(b),M):d(a,O)}function v(a){var b=u(a);return b===M&&s(a.state),b}function w(a,b){return a&&a.state?2!==a.state.wrap?O:(a.state.gzhead=b,M):O}function x(a,b,c,e,f,g){if(!a)return O;var h=1;if(b===R&&(b=6),0>e?(h=0,e=-e):e>15&&(h=2,e-=16),1>f||f>Z||c!==Y||8>e||e>15||0>b||b>9||0>g||g>V)return d(a,O);8===e&&(e=9);var i=new t;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,v(a)}function y(a,b){return x(a,b,Y,$,_,W)}function z(a,b){var c,h,k,l;if(!a||!a.state||b>L||0>b)return a?d(a,O):O;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===rb&&b!==K)return d(a,0===a.avail_out?Q:O);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===lb)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=F(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=mb):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,wb),h.status=qb);else{var m=Y+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=T||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=kb),m+=31-m%31,h.status=qb,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===mb)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=nb)}else h.status=nb;if(h.status===nb)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindexk&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=ob)}else h.status=ob;if(h.status===ob)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindexk&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=pb)}else h.status=pb;if(h.status===pb&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=qb)):h.status=qb),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,M}else if(0===a.avail_in&&e(b)<=e(c)&&b!==K)return d(a,Q);if(h.status===rb&&0!==a.avail_in)return d(a,Q);if(0!==a.avail_in||0!==h.lookahead||b!==H&&h.status!==rb){var o=h.strategy===T?r(h,b):h.strategy===U?q(h,b):B[h.level].func(h,b);if((o===ub||o===vb)&&(h.status=rb),o===sb||o===ub)return 0===a.avail_out&&(h.last_flush=-1),M;if(o===tb&&(b===I?D._tr_align(h):b!==L&&(D._tr_stored_block(h,0,0,!1),b===J&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,M}return b!==K?M:h.wrap<=0?N:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?M:N)}function A(a){var b;return a&&a.state?(b=a.state.status,b!==lb&&b!==mb&&b!==nb&&b!==ob&&b!==pb&&b!==qb&&b!==rb?d(a,O):(a.state=null,b===qb?d(a,P):M)):O}var B,C=a("../utils/common"),D=a("./trees"),E=a("./adler32"),F=a("./crc32"),G=a("./messages"),H=0,I=1,J=3,K=4,L=5,M=0,N=1,O=-2,P=-3,Q=-5,R=-1,S=1,T=2,U=3,V=4,W=0,X=2,Y=8,Z=9,$=15,_=8,ab=29,bb=256,cb=bb+1+ab,db=30,eb=19,fb=2*cb+1,gb=15,hb=3,ib=258,jb=ib+hb+1,kb=32,lb=42,mb=69,nb=73,ob=91,pb=103,qb=113,rb=666,sb=1,tb=2,ub=3,vb=4,wb=3,xb=function(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e};B=[new xb(0,0,0,0,n),new xb(4,4,8,4,o),new xb(4,5,16,8,o),new xb(4,6,32,32,o),new xb(4,4,16,16,p),new xb(8,16,32,32,p),new xb(8,16,128,128,p),new xb(8,32,128,256,p),new xb(32,128,258,1024,p),new xb(32,258,258,4096,p)],c.deflateInit=y,c.deflateInit2=x,c.deflateReset=v,c.deflateResetKeep=u,c.deflateSetHeader=w,c.deflate=z,c.deflateEnd=A,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(a,b){"use strict";function c(){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=c},{}],34:[function(a,b){"use strict";var c=30,d=12;b.exports=function(a,b){var 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;e=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=e.dmax,l=e.wsize,m=e.whave,n=e.wnext,o=e.window,p=e.hold,q=e.bits,r=e.lencode,s=e.distcode,t=(1<q&&(p+=B[f++]<>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<q&&(p+=B[f++]<>>=w,q-=w),15>q&&(p+=B[f++]<>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<q&&(p+=B[f++]<q&&(p+=B[f++]<k){a.msg="invalid distance too far back",e.mode=c;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&e.sane){a.msg="invalid distance too far back",e.mode=c;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),e.hold=p,e.bits=q}},{}],35:[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 r.Buf16(320),this.work=new r.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=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(ob),b.distcode=b.distdyn=new r.Buf32(pb),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,rb)}function k(a){if(sb){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(;256>b;)a.lens[b++]=9;for(;280>b;)a.lens[b++]=7;for(;288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sb=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<=f.wsize?(r.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),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.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.whaven;){if(0===i)break a;i--,m+=e[g++]<>>8&255,c.check=t(c.check,Bb,2,0),m=0,n=0,c.mode=L;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=lb;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=lb;break}if(m>>>=4,n-=4,wb=(15&m)+8,0===c.wbits)c.wbits=wb;else if(wb>c.wbits){a.msg="invalid window size",c.mode=lb;break}c.dmax=1<n;){if(0===i)break a;i--,m+=e[g++]<>8&1),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0,c.mode=M;case M:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<>>8&255,Bb[2]=m>>>16&255,Bb[3]=m>>>24&255,c.check=t(c.check,Bb,4,0)),m=0,n=0,c.mode=N;case N:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<>8),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wb=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wb)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wb=e[g+q++],c.head&&wb&&c.length<65536&&(c.head.name+=String.fromCharCode(wb));while(wb&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wb)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wb=e[g+q++],c.head&&wb&&c.length<65536&&(c.head.comment+=String.fromCharCode(wb));while(wb&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wb)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<>>=7&n,n-=7&n,c.mode=ib;break}for(;3>n;){if(0===i)break a;i--,m+=e[g++]<>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=bb,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=lb}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<>>16^65535)){a.msg="invalid stored block lengths",c.mode=lb;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;14>n;){if(0===i)break a;i--,m+=e[g++]<>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=lb;break}c.have=0,c.mode=_;case _:for(;c.haven;){if(0===i)break a;i--,m+=e[g++]<>>=3,n-=3}for(;c.have<19;)c.lens[Cb[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,yb={bits:c.lenbits},xb=v(w,c.lens,0,19,c.lencode,0,c.work,yb),c.lenbits=yb.bits,xb){a.msg="invalid code lengths set",c.mode=lb;break}c.have=0,c.mode=ab;case ab:for(;c.have>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<sb)m>>>=qb,n-=qb,c.lens[c.have++]=sb;else{if(16===sb){for(zb=qb+2;zb>n;){if(0===i)break a;i--,m+=e[g++]<>>=qb,n-=qb,0===c.have){a.msg="invalid bit length repeat",c.mode=lb;break}wb=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sb){for(zb=qb+3;zb>n;){if(0===i)break a;i--,m+=e[g++]<>>=qb,n-=qb,wb=0,q=3+(7&m),m>>>=3,n-=3}else{for(zb=qb+7;zb>n;){if(0===i)break a;i--,m+=e[g++]<>>=qb,n-=qb,wb=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=lb;break}for(;q--;)c.lens[c.have++]=wb}}if(c.mode===lb)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=lb;break}if(c.lenbits=9,yb={bits:c.lenbits},xb=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,yb),c.lenbits=yb.bits,xb){a.msg="invalid literal/lengths set",c.mode=lb;break}if(c.distbits=6,c.distcode=c.distdyn,yb={bits:c.distbits},xb=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,yb),c.distbits=yb.bits,xb){a.msg="invalid distances set",c.mode=lb;break}if(c.mode=bb,b===B)break a;case bb:c.mode=cb;case cb: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,u(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===V&&(c.back=-1);break}for(c.back=0;Ab=c.lencode[m&(1<>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<>tb)],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=tb+qb);){if(0===i)break a;i--,m+=e[g++]<>>=tb,n-=tb,c.back+=tb}if(m>>>=qb,n-=qb,c.back+=qb,c.length=sb,0===rb){c.mode=hb;break}if(32&rb){c.back=-1,c.mode=V;break}if(64&rb){a.msg="invalid literal/length code",c.mode=lb;break}c.extra=15&rb,c.mode=db;case db:if(c.extra){for(zb=c.extra;zb>n;){if(0===i)break a;i--,m+=e[g++]<>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=eb;case eb:for(;Ab=c.distcode[m&(1<>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<>tb)],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=tb+qb);){if(0===i)break a;i--,m+=e[g++]<>>=tb,n-=tb,c.back+=tb}if(m>>>=qb,n-=qb,c.back+=qb,64&rb){a.msg="invalid distance code",c.mode=lb;break}c.offset=sb,c.extra=15&rb,c.mode=fb;case fb:if(c.extra){for(zb=c.extra;zb>n;){if(0===i)break a;i--,m+=e[g++]<>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=lb;break}c.mode=gb;case gb:if(0===j)break a; +if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=lb;break}q>c.wnext?(q-=c.wnext,ob=c.wsize-q):ob=c.wnext-q,q>c.length&&(q=c.length),pb=c.window}else pb=f,ob=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pb[ob++];while(--q);0===c.length&&(c.mode=cb);break;case hb:if(0===j)break a;f[h++]=c.length,j--,c.mode=cb;break;case ib:if(c.wrap){for(;32>n;){if(0===i)break a;i--,m|=e[g++]<n;){if(0===i)break a;i--,m+=e[g++]<=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[n+E]]++;for(H=C,G=d;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;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;d>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===g||1!==G))return-1;for(Q[1]=0,D=1;d>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[n+E]&&(r[Q[b[n+E]]++]=E);if(a===g?(N=R=r,y=19):a===h?(N=j,O-=257,R=k,S-=257,y=256):(N=l,R=m,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<e||a===i&&L>f)return 1;for(var T=0;;){T++,z=D-J,r[E]y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[n+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<e||a===i&&L>f)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":27}],37:[function(a,b){"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"}},{}],38:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a){return 256>a?gb[a]:gb[256+(a>>>7)]}function f(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function g(a,b,c){a.bi_valid>V-c?(a.bi_buf|=b<>V-a.bi_valid,a.bi_valid+=c-V):(a.bi_buf|=b<>>=1,c<<=1;while(--b>0);return c>>>1}function j(a){16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function k(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;U>=f;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;T>c;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function l(a,b,c){var d,e,f=new Array(U+1),g=0;for(d=1;U>=d;d++)f[d]=g=g+c[d-1]<<1;for(e=0;b>=e;e++){var h=a[2*e+1];0!==h&&(a[2*e]=i(f[h]++,h))}}function m(){var a,b,c,d,e,f=new Array(U+1);for(c=0,d=0;O-1>d;d++)for(ib[d]=c,a=0;a<1<<_[d];a++)hb[c++]=d;for(hb[c-1]=d,e=0,d=0;16>d;d++)for(jb[d]=e,a=0;a<1<>=7;R>d;d++)for(jb[d]=e<<7,a=0;a<1<=b;b++)f[b]=0;for(a=0;143>=a;)eb[2*a+1]=8,a++,f[8]++;for(;255>=a;)eb[2*a+1]=9,a++,f[9]++;for(;279>=a;)eb[2*a+1]=7,a++,f[7]++;for(;287>=a;)eb[2*a+1]=8,a++,f[8]++;for(l(eb,Q+1,f),a=0;R>a;a++)fb[2*a+1]=5,fb[2*a]=i(a,5);kb=new nb(eb,_,P+1,Q,U),lb=new nb(fb,ab,0,R,U),mb=new nb(new Array(0),bb,0,S,W)}function n(a){var b;for(b=0;Q>b;b++)a.dyn_ltree[2*b]=0;for(b=0;R>b;b++)a.dyn_dtree[2*b]=0;for(b=0;S>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*X]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function o(a){a.bi_valid>8?f(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function p(a,b,c,d){o(a),d&&(f(a,c),f(a,~c)),E.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function q(a,b,c,d){var e=2*b,f=2*c;return a[e]c;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=2>j?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)r(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],r(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,r(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],k(a,b),l(f,j,a.bl_count)}function u(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;c>=d;d++)e=g,g=b[2*(d+1)+1],++hh?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*Y]++):10>=h?a.bl_tree[2*Z]++:a.bl_tree[2*$]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function v(a,b,c){var d,e,f=-1,i=b[1],j=0,k=7,l=4;for(0===i&&(k=138,l=3),d=0;c>=d;d++)if(e=i,i=b[2*(d+1)+1],!(++jj){do h(a,e,a.bl_tree);while(0!==--j)}else 0!==e?(e!==f&&(h(a,e,a.bl_tree),j--),h(a,Y,a.bl_tree),g(a,j-3,2)):10>=j?(h(a,Z,a.bl_tree),g(a,j-3,3)):(h(a,$,a.bl_tree),g(a,j-11,7));j=0,f=e,0===i?(k=138,l=3):e===i?(k=6,l=3):(k=7,l=4)}}function w(a){var b;for(u(a,a.dyn_ltree,a.l_desc.max_code),u(a,a.dyn_dtree,a.d_desc.max_code),t(a,a.bl_desc),b=S-1;b>=3&&0===a.bl_tree[2*cb[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function x(a,b,c,d){var e;for(g(a,b-257,5),g(a,c-1,5),g(a,d-4,4),e=0;d>e;e++)g(a,a.bl_tree[2*cb[e]+1],3);v(a,a.dyn_ltree,b-1),v(a,a.dyn_dtree,c-1)}function y(a){var b,c=4093624447;for(b=0;31>=b;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return G;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return H;for(b=32;P>b;b++)if(0!==a.dyn_ltree[2*b])return H;return G}function z(a){pb||(m(),pb=!0),a.l_desc=new ob(a.dyn_ltree,kb),a.d_desc=new ob(a.dyn_dtree,lb),a.bl_desc=new ob(a.bl_tree,mb),a.bi_buf=0,a.bi_valid=0,n(a)}function A(a,b,c,d){g(a,(J<<1)+(d?1:0),3),p(a,b,c,!0)}function B(a){g(a,K<<1,3),h(a,X,eb),j(a)}function C(a,b,c,d){var e,f,h=0;a.level>0?(a.strm.data_type===I&&(a.strm.data_type=y(a)),t(a,a.l_desc),t(a,a.d_desc),h=w(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,e>=f&&(e=f)):e=f=c+5,e>=c+4&&-1!==b?A(a,b,c,d):a.strategy===F||f===e?(g(a,(K<<1)+(d?1:0),3),s(a,eb,fb)):(g(a,(L<<1)+(d?1:0),3),x(a,a.l_desc.max_code+1,a.d_desc.max_code+1,h+1),s(a,a.dyn_ltree,a.dyn_dtree)),n(a),d&&o(a)}function D(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(hb[c]+P+1)]++,a.dyn_dtree[2*e(b)]++),a.last_lit===a.lit_bufsize-1}var E=a("../utils/common"),F=4,G=0,H=1,I=2,J=0,K=1,L=2,M=3,N=258,O=29,P=256,Q=P+1+O,R=30,S=19,T=2*Q+1,U=15,V=16,W=7,X=256,Y=16,Z=17,$=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ab=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],bb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],cb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],db=512,eb=new Array(2*(Q+2));d(eb);var fb=new Array(2*R);d(fb);var gb=new Array(db);d(gb);var hb=new Array(N-M+1);d(hb);var ib=new Array(O);d(ib);var jb=new Array(R);d(jb);var kb,lb,mb,nb=function(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length},ob=function(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b},pb=!1;c._tr_init=z,c._tr_stored_block=A,c._tr_flush_block=C,c._tr_tally=D,c._tr_align=B},{"../utils/common":27}],39:[function(a,b){"use strict";function c(){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=c},{}]},{},[9])(9)}); \ No newline at end of file diff --git a/commodoreclicker/js/thirdparty/jszip/docs/APPNOTE.TXT b/commodoreclicker/js/thirdparty/jszip/docs/APPNOTE.TXT new file mode 100644 index 00000000..e658f958 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/docs/APPNOTE.TXT @@ -0,0 +1,3217 @@ +File: APPNOTE.TXT - .ZIP File Format Specification +Version: 6.3.2 +Revised: September 28, 2007 +Copyright (c) 1989 - 2007 PKWARE Inc., All Rights Reserved. + +The use of certain technological aspects disclosed in the current +APPNOTE is available pursuant to the below section entitled +"Incorporating PKWARE Proprietary Technology into Your Product". + +I. Purpose +---------- + +This specification is intended to define a cross-platform, +interoperable file storage and transfer format. Since its +first publication in 1989, PKWARE has remained committed to +ensuring the interoperability of the .ZIP file format through +publication and maintenance of this specification. We trust that +all .ZIP compatible vendors and application developers that have +adopted and benefited from this format will share and support +this commitment to interoperability. + +II. Contacting PKWARE +--------------------- + + PKWARE, Inc. + 648 N. Plankinton Avenue, Suite 220 + Milwaukee, WI 53203 + +1-414-289-9788 + +1-414-289-9789 FAX + zipformat@pkware.com + +III. Disclaimer +--------------- + +Although PKWARE will attempt to supply current and accurate +information relating to its file formats, algorithms, and the +subject programs, the possibility of error or omission cannot +be eliminated. PKWARE therefore expressly disclaims any warranty +that the information contained in the associated materials relating +to the subject programs and/or the format of the files created or +accessed by the subject programs and/or the algorithms used by +the subject programs, or any other matter, is current, correct or +accurate as delivered. Any risk of damage due to any possible +inaccurate information is assumed by the user of the information. +Furthermore, the information relating to the subject programs +and/or the file formats created or accessed by the subject +programs and/or the algorithms used by the subject programs is +subject to change without notice. + +If the version of this file is marked as a NOTIFICATION OF CHANGE, +the content defines an Early Feature Specification (EFS) change +to the .ZIP file format that may be subject to modification prior +to publication of the Final Feature Specification (FFS). This +document may also contain information on Planned Feature +Specifications (PFS) defining recognized future extensions. + +IV. Change Log +-------------- + +Version Change Description Date +------- ------------------ ---------- +5.2 -Single Password Symmetric Encryption 06/02/2003 + storage + +6.1.0 -Smartcard compatibility 01/20/2004 + -Documentation on certificate storage + +6.2.0 -Introduction of Central Directory 04/26/2004 + Encryption for encrypting metadata + -Added OS/X to Version Made By values + +6.2.1 -Added Extra Field placeholder for 04/01/2005 + POSZIP using ID 0x4690 + + -Clarified size field on + "zip64 end of central directory record" + +6.2.2 -Documented Final Feature Specification 01/06/2006 + for Strong Encryption + + -Clarifications and typographical + corrections + +6.3.0 -Added tape positioning storage 09/29/2006 + parameters + + -Expanded list of supported hash algorithms + + -Expanded list of supported compression + algorithms + + -Expanded list of supported encryption + algorithms + + -Added option for Unicode filename + storage + + -Clarifications for consistent use + of Data Descriptor records + + -Added additional "Extra Field" + definitions + +6.3.1 -Corrected standard hash values for 04/11/2007 + SHA-256/384/512 + +6.3.2 -Added compression method 97 09/28/2007 + + -Documented InfoZIP "Extra Field" + values for UTF-8 file name and + file comment storage + +V. General Format of a .ZIP file +-------------------------------- + + Files stored in arbitrary order. Large .ZIP files can span multiple + volumes or be split into user-defined segment sizes. All values + are stored in little-endian byte order unless otherwise specified. + + Overall .ZIP file format: + + [local file header 1] + [file data 1] + [data descriptor 1] + . + . + . + [local file header n] + [file data n] + [data descriptor n] + [archive decryption header] + [archive extra data record] + [central directory] + [zip64 end of central directory record] + [zip64 end of central directory locator] + [end of central directory record] + + + A. Local file header: + + local file header signature 4 bytes (0x04034b50) + version needed to extract 2 bytes + general purpose bit flag 2 bytes + compression method 2 bytes + last mod file time 2 bytes + last mod file date 2 bytes + crc-32 4 bytes + compressed size 4 bytes + uncompressed size 4 bytes + file name length 2 bytes + extra field length 2 bytes + + file name (variable size) + extra field (variable size) + + B. File data + + Immediately following the local header for a file + is the compressed or stored data for the file. + The series of [local file header][file data][data + descriptor] repeats for each file in the .ZIP archive. + + C. Data descriptor: + + crc-32 4 bytes + compressed size 4 bytes + uncompressed size 4 bytes + + This descriptor exists only if bit 3 of the general + purpose bit flag is set (see below). It is byte aligned + and immediately follows the last byte of compressed data. + This descriptor is used only when it was not possible to + seek in the output .ZIP file, e.g., when the output .ZIP file + was standard output or a non-seekable device. For ZIP64(tm) format + archives, the compressed and uncompressed sizes are 8 bytes each. + + When compressing files, compressed and uncompressed sizes + should be stored in ZIP64 format (as 8 byte values) when a + files size exceeds 0xFFFFFFFF. However ZIP64 format may be + used regardless of the size of a file. When extracting, if + the zip64 extended information extra field is present for + the file the compressed and uncompressed sizes will be 8 + byte values. + + Although not originally assigned a signature, the value + 0x08074b50 has commonly been adopted as a signature value + for the data descriptor record. Implementers should be + aware that ZIP files may be encountered with or without this + signature marking data descriptors and should account for + either case when reading ZIP files to ensure compatibility. + When writing ZIP files, it is recommended to include the + signature value marking the data descriptor record. When + the signature is used, the fields currently defined for + the data descriptor record will immediately follow the + signature. + + An extensible data descriptor will be released in a future + version of this APPNOTE. This new record is intended to + resolve conflicts with the use of this record going forward, + and to provide better support for streamed file processing. + + When the Central Directory Encryption method is used, the data + descriptor record is not required, but may be used. If present, + and bit 3 of the general purpose bit field is set to indicate + its presence, the values in fields of the data descriptor + record should be set to binary zeros. + + D. Archive decryption header: + + The Archive Decryption Header is introduced in version 6.2 + of the ZIP format specification. This record exists in support + of the Central Directory Encryption Feature implemented as part of + the Strong Encryption Specification as described in this document. + When the Central Directory Structure is encrypted, this decryption + header will precede the encrypted data segment. The encrypted + data segment will consist of the Archive extra data record (if + present) and the encrypted Central Directory Structure data. + The format of this data record is identical to the Decryption + header record preceding compressed file data. If the central + directory structure is encrypted, the location of the start of + this data record is determined using the Start of Central Directory + field in the Zip64 End of Central Directory record. Refer to the + section on the Strong Encryption Specification for information + on the fields used in the Archive Decryption Header record. + + + E. Archive extra data record: + + archive extra data signature 4 bytes (0x08064b50) + extra field length 4 bytes + extra field data (variable size) + + The Archive Extra Data Record is introduced in version 6.2 + of the ZIP format specification. This record exists in support + of the Central Directory Encryption Feature implemented as part of + the Strong Encryption Specification as described in this document. + When present, this record immediately precedes the central + directory data structure. The size of this data record will be + included in the Size of the Central Directory field in the + End of Central Directory record. If the central directory structure + is compressed, but not encrypted, the location of the start of + this data record is determined using the Start of Central Directory + field in the Zip64 End of Central Directory record. + + + F. Central directory structure: + + [file header 1] + . + . + . + [file header n] + [digital signature] + + File header: + + central file header signature 4 bytes (0x02014b50) + version made by 2 bytes + version needed to extract 2 bytes + general purpose bit flag 2 bytes + compression method 2 bytes + last mod file time 2 bytes + last mod file date 2 bytes + crc-32 4 bytes + compressed size 4 bytes + uncompressed size 4 bytes + file name length 2 bytes + extra field length 2 bytes + file comment length 2 bytes + disk number start 2 bytes + internal file attributes 2 bytes + external file attributes 4 bytes + relative offset of local header 4 bytes + + file name (variable size) + extra field (variable size) + file comment (variable size) + + Digital signature: + + header signature 4 bytes (0x05054b50) + size of data 2 bytes + signature data (variable size) + + With the introduction of the Central Directory Encryption + feature in version 6.2 of this specification, the Central + Directory Structure may be stored both compressed and encrypted. + Although not required, it is assumed when encrypting the + Central Directory Structure, that it will be compressed + for greater storage efficiency. Information on the + Central Directory Encryption feature can be found in the section + describing the Strong Encryption Specification. The Digital + Signature record will be neither compressed nor encrypted. + + G. Zip64 end of central directory record + + zip64 end of central dir + signature 4 bytes (0x06064b50) + size of zip64 end of central + directory record 8 bytes + version made by 2 bytes + version needed to extract 2 bytes + number of this disk 4 bytes + number of the disk with the + start of the central directory 4 bytes + total number of entries in the + central directory on this disk 8 bytes + total number of entries in the + central directory 8 bytes + size of the central directory 8 bytes + offset of start of central + directory with respect to + the starting disk number 8 bytes + zip64 extensible data sector (variable size) + + The value stored into the "size of zip64 end of central + directory record" should be the size of the remaining + record and should not include the leading 12 bytes. + + Size = SizeOfFixedFields + SizeOfVariableData - 12. + + The above record structure defines Version 1 of the + zip64 end of central directory record. Version 1 was + implemented in versions of this specification preceding + 6.2 in support of the ZIP64 large file feature. The + introduction of the Central Directory Encryption feature + implemented in version 6.2 as part of the Strong Encryption + Specification defines Version 2 of this record structure. + Refer to the section describing the Strong Encryption + Specification for details on the version 2 format for + this record. + + Special purpose data may reside in the zip64 extensible data + sector field following either a V1 or V2 version of this + record. To ensure identification of this special purpose data + it must include an identifying header block consisting of the + following: + + Header ID - 2 bytes + Data Size - 4 bytes + + The Header ID field indicates the type of data that is in the + data block that follows. + + Data Size identifies the number of bytes that follow for this + data block type. + + Multiple special purpose data blocks may be present, but each + must be preceded by a Header ID and Data Size field. Current + mappings of Header ID values supported in this field are as + defined in APPENDIX C. + + H. Zip64 end of central directory locator + + zip64 end of central dir locator + signature 4 bytes (0x07064b50) + number of the disk with the + start of the zip64 end of + central directory 4 bytes + relative offset of the zip64 + end of central directory record 8 bytes + total number of disks 4 bytes + + I. End of central directory record: + + end of central dir signature 4 bytes (0x06054b50) + number of this disk 2 bytes + number of the disk with the + start of the central directory 2 bytes + total number of entries in the + central directory on this disk 2 bytes + total number of entries in + the central directory 2 bytes + size of the central directory 4 bytes + offset of start of central + directory with respect to + the starting disk number 4 bytes + .ZIP file comment length 2 bytes + .ZIP file comment (variable size) + + J. Explanation of fields: + + version made by (2 bytes) + + The upper byte indicates the compatibility of the file + attribute information. If the external file attributes + are compatible with MS-DOS and can be read by PKZIP for + DOS version 2.04g then this value will be zero. If these + attributes are not compatible, then this value will + identify the host system on which the attributes are + compatible. Software can use this information to determine + the line record format for text files etc. The current + mappings are: + + 0 - MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems) + 1 - Amiga 2 - OpenVMS + 3 - UNIX 4 - VM/CMS + 5 - Atari ST 6 - OS/2 H.P.F.S. + 7 - Macintosh 8 - Z-System + 9 - CP/M 10 - Windows NTFS + 11 - MVS (OS/390 - Z/OS) 12 - VSE + 13 - Acorn Risc 14 - VFAT + 15 - alternate MVS 16 - BeOS + 17 - Tandem 18 - OS/400 + 19 - OS/X (Darwin) 20 thru 255 - unused + + The lower byte indicates the ZIP specification version + (the version of this document) supported by the software + used to encode the file. The value/10 indicates the major + version number, and the value mod 10 is the minor version + number. + + version needed to extract (2 bytes) + + The minimum supported ZIP specification version needed to + extract the file, mapped as above. This value is based on + the specific format features a ZIP program must support to + be able to extract the file. If multiple features are + applied to a file, the minimum version should be set to the + feature having the highest value. New features or feature + changes affecting the published format specification will be + implemented using higher version numbers than the last + published value to avoid conflict. + + Current minimum feature versions are as defined below: + + 1.0 - Default value + 1.1 - File is a volume label + 2.0 - File is a folder (directory) + 2.0 - File is compressed using Deflate compression + 2.0 - File is encrypted using traditional PKWARE encryption + 2.1 - File is compressed using Deflate64(tm) + 2.5 - File is compressed using PKWARE DCL Implode + 2.7 - File is a patch data set + 4.5 - File uses ZIP64 format extensions + 4.6 - File is compressed using BZIP2 compression* + 5.0 - File is encrypted using DES + 5.0 - File is encrypted using 3DES + 5.0 - File is encrypted using original RC2 encryption + 5.0 - File is encrypted using RC4 encryption + 5.1 - File is encrypted using AES encryption + 5.1 - File is encrypted using corrected RC2 encryption** + 5.2 - File is encrypted using corrected RC2-64 encryption** + 6.1 - File is encrypted using non-OAEP key wrapping*** + 6.2 - Central directory encryption + 6.3 - File is compressed using LZMA + 6.3 - File is compressed using PPMd+ + 6.3 - File is encrypted using Blowfish + 6.3 - File is encrypted using Twofish + + + * Early 7.x (pre-7.2) versions of PKZIP incorrectly set the + version needed to extract for BZIP2 compression to be 50 + when it should have been 46. + + ** Refer to the section on Strong Encryption Specification + for additional information regarding RC2 corrections. + + *** Certificate encryption using non-OAEP key wrapping is the + intended mode of operation for all versions beginning with 6.1. + Support for OAEP key wrapping should only be used for + backward compatibility when sending ZIP files to be opened by + versions of PKZIP older than 6.1 (5.0 or 6.0). + + + Files compressed using PPMd should set the version + needed to extract field to 6.3, however, not all ZIP + programs enforce this and may be unable to decompress + data files compressed using PPMd if this value is set. + + When using ZIP64 extensions, the corresponding value in the + zip64 end of central directory record should also be set. + This field should be set appropriately to indicate whether + Version 1 or Version 2 format is in use. + + general purpose bit flag: (2 bytes) + + Bit 0: If set, indicates that the file is encrypted. + + (For Method 6 - Imploding) + Bit 1: If the compression method used was type 6, + Imploding, then this bit, if set, indicates + an 8K sliding dictionary was used. If clear, + then a 4K sliding dictionary was used. + Bit 2: If the compression method used was type 6, + Imploding, then this bit, if set, indicates + 3 Shannon-Fano trees were used to encode the + sliding dictionary output. If clear, then 2 + Shannon-Fano trees were used. + + (For Methods 8 and 9 - Deflating) + Bit 2 Bit 1 + 0 0 Normal (-en) compression option was used. + 0 1 Maximum (-exx/-ex) compression option was used. + 1 0 Fast (-ef) compression option was used. + 1 1 Super Fast (-es) compression option was used. + + (For Method 14 - LZMA) + Bit 1: If the compression method used was type 14, + LZMA, then this bit, if set, indicates + an end-of-stream (EOS) marker is used to + mark the end of the compressed data stream. + If clear, then an EOS marker is not present + and the compressed data size must be known + to extract. + + Note: Bits 1 and 2 are undefined if the compression + method is any other. + + Bit 3: If this bit is set, the fields crc-32, compressed + size and uncompressed size are set to zero in the + local header. The correct values are put in the + data descriptor immediately following the compressed + data. (Note: PKZIP version 2.04g for DOS only + recognizes this bit for method 8 compression, newer + versions of PKZIP recognize this bit for any + compression method.) + + Bit 4: Reserved for use with method 8, for enhanced + deflating. + + Bit 5: If this bit is set, this indicates that the file is + compressed patched data. (Note: Requires PKZIP + version 2.70 or greater) + + Bit 6: Strong encryption. If this bit is set, you should + set the version needed to extract value to at least + 50 and you must also set bit 0. If AES encryption + is used, the version needed to extract value must + be at least 51. + + Bit 7: Currently unused. + + Bit 8: Currently unused. + + Bit 9: Currently unused. + + Bit 10: Currently unused. + + Bit 11: Language encoding flag (EFS). If this bit is set, + the filename and comment fields for this file + must be encoded using UTF-8. (see APPENDIX D) + + Bit 12: Reserved by PKWARE for enhanced compression. + + Bit 13: Used when encrypting the Central Directory to indicate + selected data values in the Local Header are masked to + hide their actual values. See the section describing + the Strong Encryption Specification for details. + + Bit 14: Reserved by PKWARE. + + Bit 15: Reserved by PKWARE. + + compression method: (2 bytes) + + (see accompanying documentation for algorithm + descriptions) + + 0 - The file is stored (no compression) + 1 - The file is Shrunk + 2 - The file is Reduced with compression factor 1 + 3 - The file is Reduced with compression factor 2 + 4 - The file is Reduced with compression factor 3 + 5 - The file is Reduced with compression factor 4 + 6 - The file is Imploded + 7 - Reserved for Tokenizing compression algorithm + 8 - The file is Deflated + 9 - Enhanced Deflating using Deflate64(tm) + 10 - PKWARE Data Compression Library Imploding (old IBM TERSE) + 11 - Reserved by PKWARE + 12 - File is compressed using BZIP2 algorithm + 13 - Reserved by PKWARE + 14 - LZMA (EFS) + 15 - Reserved by PKWARE + 16 - Reserved by PKWARE + 17 - Reserved by PKWARE + 18 - File is compressed using IBM TERSE (new) + 19 - IBM LZ77 z Architecture (PFS) + 97 - WavPack compressed data + 98 - PPMd version I, Rev 1 + + date and time fields: (2 bytes each) + + The date and time are encoded in standard MS-DOS format. + If input came from standard input, the date and time are + those at which compression was started for this data. + If encrypting the central directory and general purpose bit + flag 13 is set indicating masking, the value stored in the + Local Header will be zero. + + CRC-32: (4 bytes) + + The CRC-32 algorithm was generously contributed by + David Schwaderer and can be found in his excellent + book "C Programmers Guide to NetBIOS" published by + Howard W. Sams & Co. Inc. The 'magic number' for + the CRC is 0xdebb20e3. The proper CRC pre and post + conditioning is used, meaning that the CRC register + is pre-conditioned with all ones (a starting value + of 0xffffffff) and the value is post-conditioned by + taking the one's complement of the CRC residual. + If bit 3 of the general purpose flag is set, this + field is set to zero in the local header and the correct + value is put in the data descriptor and in the central + directory. When encrypting the central directory, if the + local header is not in ZIP64 format and general purpose + bit flag 13 is set indicating masking, the value stored + in the Local Header will be zero. + + compressed size: (4 bytes) + uncompressed size: (4 bytes) + + The size of the file compressed and uncompressed, + respectively. When a decryption header is present it will + be placed in front of the file data and the value of the + compressed file size will include the bytes of the decryption + header. If bit 3 of the general purpose bit flag is set, + these fields are set to zero in the local header and the + correct values are put in the data descriptor and + in the central directory. If an archive is in ZIP64 format + and the value in this field is 0xFFFFFFFF, the size will be + in the corresponding 8 byte ZIP64 extended information + extra field. When encrypting the central directory, if the + local header is not in ZIP64 format and general purpose bit + flag 13 is set indicating masking, the value stored for the + uncompressed size in the Local Header will be zero. + + file name length: (2 bytes) + extra field length: (2 bytes) + file comment length: (2 bytes) + + The length of the file name, extra field, and comment + fields respectively. The combined length of any + directory record and these three fields should not + generally exceed 65,535 bytes. If input came from standard + input, the file name length is set to zero. + + disk number start: (2 bytes) + + The number of the disk on which this file begins. If an + archive is in ZIP64 format and the value in this field is + 0xFFFF, the size will be in the corresponding 4 byte zip64 + extended information extra field. + + internal file attributes: (2 bytes) + + Bits 1 and 2 are reserved for use by PKWARE. + + The lowest bit of this field indicates, if set, that + the file is apparently an ASCII or text file. If not + set, that the file apparently contains binary data. + The remaining bits are unused in version 1.0. + + The 0x0002 bit of this field indicates, if set, that a + 4 byte variable record length control field precedes each + logical record indicating the length of the record. The + record length control field is stored in little-endian byte + order. This flag is independent of text control characters, + and if used in conjunction with text data, includes any + control characters in the total length of the record. This + value is provided for mainframe data transfer support. + + external file attributes: (4 bytes) + + The mapping of the external attributes is + host-system dependent (see 'version made by'). For + MS-DOS, the low order byte is the MS-DOS directory + attribute byte. If input came from standard input, this + field is set to zero. + + relative offset of local header: (4 bytes) + + This is the offset from the start of the first disk on + which this file appears, to where the local header should + be found. If an archive is in ZIP64 format and the value + in this field is 0xFFFFFFFF, the size will be in the + corresponding 8 byte zip64 extended information extra field. + + file name: (Variable) + + The name of the file, with optional relative path. + The path stored should not contain a drive or + device letter, or a leading slash. All slashes + should be forward slashes '/' as opposed to + backwards slashes '\' for compatibility with Amiga + and UNIX file systems etc. If input came from standard + input, there is no file name field. If encrypting + the central directory and general purpose bit flag 13 is set + indicating masking, the file name stored in the Local Header + will not be the actual file name. A masking value consisting + of a unique hexadecimal value will be stored. This value will + be sequentially incremented for each file in the archive. See + the section on the Strong Encryption Specification for details + on retrieving the encrypted file name. + + extra field: (Variable) + + This is for expansion. If additional information + needs to be stored for special needs or for specific + platforms, it should be stored here. Earlier versions + of the software can then safely skip this file, and + find the next file or header. This field will be 0 + length in version 1.0. + + In order to allow different programs and different types + of information to be stored in the 'extra' field in .ZIP + files, the following structure should be used for all + programs storing data in this field: + + header1+data1 + header2+data2 . . . + + Each header should consist of: + + Header ID - 2 bytes + Data Size - 2 bytes + + Note: all fields stored in Intel low-byte/high-byte order. + + The Header ID field indicates the type of data that is in + the following data block. + + Header ID's of 0 thru 31 are reserved for use by PKWARE. + The remaining ID's can be used by third party vendors for + proprietary usage. + + The current Header ID mappings defined by PKWARE are: + + 0x0001 Zip64 extended information extra field + 0x0007 AV Info + 0x0008 Reserved for extended language encoding data (PFS) + (see APPENDIX D) + 0x0009 OS/2 + 0x000a NTFS + 0x000c OpenVMS + 0x000d UNIX + 0x000e Reserved for file stream and fork descriptors + 0x000f Patch Descriptor + 0x0014 PKCS#7 Store for X.509 Certificates + 0x0015 X.509 Certificate ID and Signature for + individual file + 0x0016 X.509 Certificate ID for Central Directory + 0x0017 Strong Encryption Header + 0x0018 Record Management Controls + 0x0019 PKCS#7 Encryption Recipient Certificate List + 0x0065 IBM S/390 (Z390), AS/400 (I400) attributes + - uncompressed + 0x0066 Reserved for IBM S/390 (Z390), AS/400 (I400) + attributes - compressed + 0x4690 POSZIP 4690 (reserved) + + Third party mappings commonly used are: + + + 0x07c8 Macintosh + 0x2605 ZipIt Macintosh + 0x2705 ZipIt Macintosh 1.3.5+ + 0x2805 ZipIt Macintosh 1.3.5+ + 0x334d Info-ZIP Macintosh + 0x4341 Acorn/SparkFS + 0x4453 Windows NT security descriptor (binary ACL) + 0x4704 VM/CMS + 0x470f MVS + 0x4b46 FWKCS MD5 (see below) + 0x4c41 OS/2 access control list (text ACL) + 0x4d49 Info-ZIP OpenVMS + 0x4f4c Xceed original location extra field + 0x5356 AOS/VS (ACL) + 0x5455 extended timestamp + 0x554e Xceed unicode extra field + 0x5855 Info-ZIP UNIX (original, also OS/2, NT, etc) + 0x6375 Info-ZIP Unicode Comment Extra Field + 0x6542 BeOS/BeBox + 0x7075 Info-ZIP Unicode Path Extra Field + 0x756e ASi UNIX + 0x7855 Info-ZIP UNIX (new) + 0xa220 Microsoft Open Packaging Growth Hint + 0xfd4a SMS/QDOS + + Detailed descriptions of Extra Fields defined by third + party mappings will be documented as information on + these data structures is made available to PKWARE. + PKWARE does not guarantee the accuracy of any published + third party data. + + The Data Size field indicates the size of the following + data block. Programs can use this value to skip to the + next header block, passing over any data blocks that are + not of interest. + + Note: As stated above, the size of the entire .ZIP file + header, including the file name, comment, and extra + field should not exceed 64K in size. + + In case two different programs should appropriate the same + Header ID value, it is strongly recommended that each + program place a unique signature of at least two bytes in + size (and preferably 4 bytes or bigger) at the start of + each data area. Every program should verify that its + unique signature is present, in addition to the Header ID + value being correct, before assuming that it is a block of + known type. + + -Zip64 Extended Information Extra Field (0x0001): + + The following is the layout of the zip64 extended + information "extra" block. If one of the size or + offset fields in the Local or Central directory + record is too small to hold the required data, + a Zip64 extended information record is created. + The order of the fields in the zip64 extended + information record is fixed, but the fields will + only appear if the corresponding Local or Central + directory record field is set to 0xFFFF or 0xFFFFFFFF. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (ZIP64) 0x0001 2 bytes Tag for this "extra" block type + Size 2 bytes Size of this "extra" block + Original + Size 8 bytes Original uncompressed file size + Compressed + Size 8 bytes Size of compressed data + Relative Header + Offset 8 bytes Offset of local header record + Disk Start + Number 4 bytes Number of the disk on which + this file starts + + This entry in the Local header must include BOTH original + and compressed file size fields. If encrypting the + central directory and bit 13 of the general purpose bit + flag is set indicating masking, the value stored in the + Local Header for the original file size will be zero. + + + -OS/2 Extra Field (0x0009): + + The following is the layout of the OS/2 attributes "extra" + block. (Last Revision 09/05/95) + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (OS/2) 0x0009 2 bytes Tag for this "extra" block type + TSize 2 bytes Size for the following data block + BSize 4 bytes Uncompressed Block Size + CType 2 bytes Compression type + EACRC 4 bytes CRC value for uncompress block + (var) variable Compressed block + + The OS/2 extended attribute structure (FEA2LIST) is + compressed and then stored in it's entirety within this + structure. There will only ever be one "block" of data in + VarFields[]. + + -NTFS Extra Field (0x000a): + + The following is the layout of the NTFS attributes + "extra" block. (Note: At this time the Mtime, Atime + and Ctime values may be used on any WIN32 system.) + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (NTFS) 0x000a 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of the total "extra" block + Reserved 4 bytes Reserved for future use + Tag1 2 bytes NTFS attribute tag value #1 + Size1 2 bytes Size of attribute #1, in bytes + (var.) Size1 Attribute #1 data + . + . + . + TagN 2 bytes NTFS attribute tag value #N + SizeN 2 bytes Size of attribute #N, in bytes + (var.) SizeN Attribute #N data + + For NTFS, values for Tag1 through TagN are as follows: + (currently only one set of attributes is defined for NTFS) + + Tag Size Description + ----- ---- ----------- + 0x0001 2 bytes Tag for attribute #1 + Size1 2 bytes Size of attribute #1, in bytes + Mtime 8 bytes File last modification time + Atime 8 bytes File last access time + Ctime 8 bytes File creation time + + -OpenVMS Extra Field (0x000c): + + The following is the layout of the OpenVMS attributes + "extra" block. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (VMS) 0x000c 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of the total "extra" block + CRC 4 bytes 32-bit CRC for remainder of the block + Tag1 2 bytes OpenVMS attribute tag value #1 + Size1 2 bytes Size of attribute #1, in bytes + (var.) Size1 Attribute #1 data + . + . + . + TagN 2 bytes OpenVMS attribute tag value #N + SizeN 2 bytes Size of attribute #N, in bytes + (var.) SizeN Attribute #N data + + Rules: + + 1. There will be one or more of attributes present, which + will each be preceded by the above TagX & SizeX values. + These values are identical to the ATR$C_XXXX and + ATR$S_XXXX constants which are defined in ATR.H under + OpenVMS C. Neither of these values will ever be zero. + + 2. No word alignment or padding is performed. + + 3. A well-behaved PKZIP/OpenVMS program should never produce + more than one sub-block with the same TagX value. Also, + there will never be more than one "extra" block of type + 0x000c in a particular directory record. + + -UNIX Extra Field (0x000d): + + The following is the layout of the UNIX "extra" block. + Note: all fields are stored in Intel low-byte/high-byte + order. + + Value Size Description + ----- ---- ----------- + (UNIX) 0x000d 2 bytes Tag for this "extra" block type + TSize 2 bytes Size for the following data block + Atime 4 bytes File last access time + Mtime 4 bytes File last modification time + Uid 2 bytes File user ID + Gid 2 bytes File group ID + (var) variable Variable length data field + + The variable length data field will contain file type + specific data. Currently the only values allowed are + the original "linked to" file names for hard or symbolic + links, and the major and minor device node numbers for + character and block device nodes. Since device nodes + cannot be either symbolic or hard links, only one set of + variable length data is stored. Link files will have the + name of the original file stored. This name is NOT NULL + terminated. Its size can be determined by checking TSize - + 12. Device entries will have eight bytes stored as two 4 + byte entries (in little endian format). The first entry + will be the major device number, and the second the minor + device number. + + -PATCH Descriptor Extra Field (0x000f): + + The following is the layout of the Patch Descriptor "extra" + block. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (Patch) 0x000f 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of the total "extra" block + Version 2 bytes Version of the descriptor + Flags 4 bytes Actions and reactions (see below) + OldSize 4 bytes Size of the file about to be patched + OldCRC 4 bytes 32-bit CRC of the file to be patched + NewSize 4 bytes Size of the resulting file + NewCRC 4 bytes 32-bit CRC of the resulting file + + Actions and reactions + + Bits Description + ---- ---------------- + 0 Use for auto detection + 1 Treat as a self-patch + 2-3 RESERVED + 4-5 Action (see below) + 6-7 RESERVED + 8-9 Reaction (see below) to absent file + 10-11 Reaction (see below) to newer file + 12-13 Reaction (see below) to unknown file + 14-15 RESERVED + 16-31 RESERVED + + Actions + + Action Value + ------ ----- + none 0 + add 1 + delete 2 + patch 3 + + Reactions + + Reaction Value + -------- ----- + ask 0 + skip 1 + ignore 2 + fail 3 + + Patch support is provided by PKPatchMaker(tm) technology and is + covered under U.S. Patents and Patents Pending. The use or + implementation in a product of certain technological aspects set + forth in the current APPNOTE, including those with regard to + strong encryption, patching, or extended tape operations requires + a license from PKWARE. Please contact PKWARE with regard to + acquiring a license. + + -PKCS#7 Store for X.509 Certificates (0x0014): + + This field contains information about each of the certificates + files may be signed with. When the Central Directory Encryption + feature is enabled for a ZIP file, this record will appear in + the Archive Extra Data Record, otherwise it will appear in the + first central directory record and will be ignored in any + other record. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (Store) 0x0014 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of the store data + TData TSize Data about the store + + + -X.509 Certificate ID and Signature for individual file (0x0015): + + This field contains the information about which certificate in + the PKCS#7 store was used to sign a particular file. It also + contains the signature data. This field can appear multiple + times, but can only appear once per certificate. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (CID) 0x0015 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of data that follows + TData TSize Signature Data + + -X.509 Certificate ID and Signature for central directory (0x0016): + + This field contains the information about which certificate in + the PKCS#7 store was used to sign the central directory structure. + When the Central Directory Encryption feature is enabled for a + ZIP file, this record will appear in the Archive Extra Data Record, + otherwise it will appear in the first central directory record. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (CDID) 0x0016 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of data that follows + TData TSize Data + + -Strong Encryption Header (0x0017): + + Value Size Description + ----- ---- ----------- + 0x0017 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of data that follows + Format 2 bytes Format definition for this record + AlgID 2 bytes Encryption algorithm identifier + Bitlen 2 bytes Bit length of encryption key + Flags 2 bytes Processing flags + CertData TSize-8 Certificate decryption extra field data + (refer to the explanation for CertData + in the section describing the + Certificate Processing Method under + the Strong Encryption Specification) + + + -Record Management Controls (0x0018): + + Value Size Description + ----- ---- ----------- +(Rec-CTL) 0x0018 2 bytes Tag for this "extra" block type + CSize 2 bytes Size of total extra block data + Tag1 2 bytes Record control attribute 1 + Size1 2 bytes Size of attribute 1, in bytes + Data1 Size1 Attribute 1 data + . + . + . + TagN 2 bytes Record control attribute N + SizeN 2 bytes Size of attribute N, in bytes + DataN SizeN Attribute N data + + + -PKCS#7 Encryption Recipient Certificate List (0x0019): + + This field contains information about each of the certificates + used in encryption processing and it can be used to identify who is + allowed to decrypt encrypted files. This field should only appear + in the archive extra data record. This field is not required and + serves only to aide archive modifications by preserving public + encryption key data. Individual security requirements may dictate + that this data be omitted to deter information exposure. + + Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + (CStore) 0x0019 2 bytes Tag for this "extra" block type + TSize 2 bytes Size of the store data + TData TSize Data about the store + + TData: + + Value Size Description + ----- ---- ----------- + Version 2 bytes Format version number - must 0x0001 at this time + CStore (var) PKCS#7 data blob + + + -MVS Extra Field (0x0065): + + The following is the layout of the MVS "extra" block. + Note: Some fields are stored in Big Endian format. + All text is in EBCDIC format unless otherwise specified. + + Value Size Description + ----- ---- ----------- + (MVS) 0x0065 2 bytes Tag for this "extra" block type + TSize 2 bytes Size for the following data block + ID 4 bytes EBCDIC "Z390" 0xE9F3F9F0 or + "T4MV" for TargetFour + (var) TSize-4 Attribute data (see APPENDIX B) + + + -OS/400 Extra Field (0x0065): + + The following is the layout of the OS/400 "extra" block. + Note: Some fields are stored in Big Endian format. + All text is in EBCDIC format unless otherwise specified. + + Value Size Description + ----- ---- ----------- + (OS400) 0x0065 2 bytes Tag for this "extra" block type + TSize 2 bytes Size for the following data block + ID 4 bytes EBCDIC "I400" 0xC9F4F0F0 or + "T4MV" for TargetFour + (var) TSize-4 Attribute data (see APPENDIX A) + + + Third-party Mappings: + + -ZipIt Macintosh Extra Field (long) (0x2605): + + The following is the layout of the ZipIt extra block + for Macintosh. The local-header and central-header versions + are identical. This block must be present if the file is + stored MacBinary-encoded and it should not be used if the file + is not stored MacBinary-encoded. + + Value Size Description + ----- ---- ----------- + (Mac2) 0x2605 Short tag for this extra block type + TSize Short total data size for this block + "ZPIT" beLong extra-field signature + FnLen Byte length of FileName + FileName variable full Macintosh filename + FileType Byte[4] four-byte Mac file type string + Creator Byte[4] four-byte Mac creator string + + + -ZipIt Macintosh Extra Field (short, for files) (0x2705): + + The following is the layout of a shortened variant of the + ZipIt extra block for Macintosh (without "full name" entry). + This variant is used by ZipIt 1.3.5 and newer for entries of + files (not directories) that do not have a MacBinary encoded + file. The local-header and central-header versions are identical. + + Value Size Description + ----- ---- ----------- + (Mac2b) 0x2705 Short tag for this extra block type + TSize Short total data size for this block (12) + "ZPIT" beLong extra-field signature + FileType Byte[4] four-byte Mac file type string + Creator Byte[4] four-byte Mac creator string + fdFlags beShort attributes from FInfo.frFlags, + may be omitted + 0x0000 beShort reserved, may be omitted + + + -ZipIt Macintosh Extra Field (short, for directories) (0x2805): + + The following is the layout of a shortened variant of the + ZipIt extra block for Macintosh used only for directory + entries. This variant is used by ZipIt 1.3.5 and newer to + save some optional Mac-specific information about directories. + The local-header and central-header versions are identical. + + Value Size Description + ----- ---- ----------- + (Mac2c) 0x2805 Short tag for this extra block type + TSize Short total data size for this block (12) + "ZPIT" beLong extra-field signature + frFlags beShort attributes from DInfo.frFlags, may + be omitted + View beShort ZipIt view flag, may be omitted + + + The View field specifies ZipIt-internal settings as follows: + + Bits of the Flags: + bit 0 if set, the folder is shown expanded (open) + when the archive contents are viewed in ZipIt. + bits 1-15 reserved, zero; + + + -FWKCS MD5 Extra Field (0x4b46): + + The FWKCS Contents_Signature System, used in + automatically identifying files independent of file name, + optionally adds and uses an extra field to support the + rapid creation of an enhanced contents_signature: + + Header ID = 0x4b46 + Data Size = 0x0013 + Preface = 'M','D','5' + followed by 16 bytes containing the uncompressed file's + 128_bit MD5 hash(1), low byte first. + + When FWKCS revises a .ZIP file central directory to add + this extra field for a file, it also replaces the + central directory entry for that file's uncompressed + file length with a measured value. + + FWKCS provides an option to strip this extra field, if + present, from a .ZIP file central directory. In adding + this extra field, FWKCS preserves .ZIP file Authenticity + Verification; if stripping this extra field, FWKCS + preserves all versions of AV through PKZIP version 2.04g. + + FWKCS, and FWKCS Contents_Signature System, are + trademarks of Frederick W. Kantor. + + (1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer + Science and RSA Data Security, Inc., April 1992. + ll.76-77: "The MD5 algorithm is being placed in the + public domain for review and possible adoption as a + standard." + + + -Info-ZIP Unicode Comment Extra Field (0x6375): + + Stores the UTF-8 version of the file comment as stored in the + central directory header. (Last Revision 20070912) + + Value Size Description + ----- ---- ----------- + (UCom) 0x6375 Short tag for this extra block type ("uc") + TSize Short total data size for this block + Version 1 byte version of this extra field, currently 1 + ComCRC32 4 bytes Comment Field CRC32 Checksum + UnicodeCom Variable UTF-8 version of the entry comment + + Currently Version is set to the number 1. If there is a need + to change this field, the version will be incremented. Changes + may not be backward compatible so this extra field should not be + used if the version is not recognized. + + The ComCRC32 is the standard zip CRC32 checksum of the File Comment + field in the central directory header. This is used to verify that + the comment field has not changed since the Unicode Comment extra field + was created. This can happen if a utility changes the File Comment + field but does not update the UTF-8 Comment extra field. If the CRC + check fails, this Unicode Comment extra field should be ignored and + the File Comment field in the header should be used instead. + + The UnicodeCom field is the UTF-8 version of the File Comment field + in the header. As UnicodeCom is defined to be UTF-8, no UTF-8 byte + order mark (BOM) is used. The length of this field is determined by + subtracting the size of the previous fields from TSize. If both the + File Name and Comment fields are UTF-8, the new General Purpose Bit + Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate + both the header File Name and Comment fields are UTF-8 and, in this + case, the Unicode Path and Unicode Comment extra fields are not + needed and should not be created. Note that, for backward + compatibility, bit 11 should only be used if the native character set + of the paths and comments being zipped up are already in UTF-8. It is + expected that the same file comment storage method, either general + purpose bit 11 or extra fields, be used in both the Local and Central + Directory Header for a file. + + + -Info-ZIP Unicode Path Extra Field (0x7075): + + Stores the UTF-8 version of the file name field as stored in the + local header and central directory header. (Last Revision 20070912) + + Value Size Description + ----- ---- ----------- + (UPath) 0x7075 Short tag for this extra block type ("up") + TSize Short total data size for this block + Version 1 byte version of this extra field, currently 1 + NameCRC32 4 bytes File Name Field CRC32 Checksum + UnicodeName Variable UTF-8 version of the entry File Name + + Currently Version is set to the number 1. If there is a need + to change this field, the version will be incremented. Changes + may not be backward compatible so this extra field should not be + used if the version is not recognized. + + The NameCRC32 is the standard zip CRC32 checksum of the File Name + field in the header. This is used to verify that the header + File Name field has not changed since the Unicode Path extra field + was created. This can happen if a utility renames the File Name but + does not update the UTF-8 path extra field. If the CRC check fails, + this UTF-8 Path Extra Field should be ignored and the File Name field + in the header should be used instead. + + The UnicodeName is the UTF-8 version of the contents of the File Name + field in the header. As UnicodeName is defined to be UTF-8, no UTF-8 + byte order mark (BOM) is used. The length of this field is determined + by subtracting the size of the previous fields from TSize. If both + the File Name and Comment fields are UTF-8, the new General Purpose + Bit Flag, bit 11 (Language encoding flag (EFS)), can be used to + indicate that both the header File Name and Comment fields are UTF-8 + and, in this case, the Unicode Path and Unicode Comment extra fields + are not needed and should not be created. Note that, for backward + compatibility, bit 11 should only be used if the native character set + of the paths and comments being zipped up are already in UTF-8. It is + expected that the same file name storage method, either general + purpose bit 11 or extra fields, be used in both the Local and Central + Directory Header for a file. + + + -Microsoft Open Packaging Growth Hint (0xa220): + + Value Size Description + ----- ---- ----------- + 0xa220 Short tag for this extra block type + TSize Short size of Sig + PadVal + Padding + Sig Short verification signature (A028) + PadVal Short Initial padding value + Padding variable filled with NULL characters + + + file comment: (Variable) + + The comment for this file. + + number of this disk: (2 bytes) + + The number of this disk, which contains central + directory end record. If an archive is in ZIP64 format + and the value in this field is 0xFFFF, the size will + be in the corresponding 4 byte zip64 end of central + directory field. + + + number of the disk with the start of the central + directory: (2 bytes) + + The number of the disk on which the central + directory starts. If an archive is in ZIP64 format + and the value in this field is 0xFFFF, the size will + be in the corresponding 4 byte zip64 end of central + directory field. + + total number of entries in the central dir on + this disk: (2 bytes) + + The number of central directory entries on this disk. + If an archive is in ZIP64 format and the value in + this field is 0xFFFF, the size will be in the + corresponding 8 byte zip64 end of central + directory field. + + total number of entries in the central dir: (2 bytes) + + The total number of files in the .ZIP file. If an + archive is in ZIP64 format and the value in this field + is 0xFFFF, the size will be in the corresponding 8 byte + zip64 end of central directory field. + + size of the central directory: (4 bytes) + + The size (in bytes) of the entire central directory. + If an archive is in ZIP64 format and the value in + this field is 0xFFFFFFFF, the size will be in the + corresponding 8 byte zip64 end of central + directory field. + + offset of start of central directory with respect to + the starting disk number: (4 bytes) + + Offset of the start of the central directory on the + disk on which the central directory starts. If an + archive is in ZIP64 format and the value in this + field is 0xFFFFFFFF, the size will be in the + corresponding 8 byte zip64 end of central + directory field. + + .ZIP file comment length: (2 bytes) + + The length of the comment for this .ZIP file. + + .ZIP file comment: (Variable) + + The comment for this .ZIP file. ZIP file comment data + is stored unsecured. No encryption or data authentication + is applied to this area at this time. Confidential information + should not be stored in this section. + + zip64 extensible data sector (variable size) + + (currently reserved for use by PKWARE) + + + K. Splitting and Spanning ZIP files + + Spanning is the process of segmenting a ZIP file across + multiple removable media. This support has typically only + been provided for DOS formatted floppy diskettes. + + File splitting is a newer derivative of spanning. + Splitting follows the same segmentation process as + spanning, however, it does not require writing each + segment to a unique removable medium and instead supports + placing all pieces onto local or non-removable locations + such as file systems, local drives, folders, etc... + + A key difference between spanned and split ZIP files is + that all pieces of a spanned ZIP file have the same name. + Since each piece is written to a separate volume, no name + collisions occur and each segment can reuse the original + .ZIP file name given to the archive. + + Sequence ordering for DOS spanned archives uses the DOS + volume label to determine segment numbers. Volume labels + for each segment are written using the form PKBACK#xxx, + where xxx is the segment number written as a decimal + value from 001 - nnn. + + Split ZIP files are typically written to the same location + and are subject to name collisions if the spanned name + format is used since each segment will reside on the same + drive. To avoid name collisions, split archives are named + as follows. + + Segment 1 = filename.z01 + Segment n-1 = filename.z(n-1) + Segment n = filename.zip + + The .ZIP extension is used on the last segment to support + quickly reading the central directory. The segment number + n should be a decimal value. + + Spanned ZIP files may be PKSFX Self-extracting ZIP files. + PKSFX files may also be split, however, in this case + the first segment must be named filename.exe. The first + segment of a split PKSFX archive must be large enough to + include the entire executable program. + + Capacities for split archives are as follows. + + Maximum number of segments = 4,294,967,295 - 1 + Maximum .ZIP segment size = 4,294,967,295 bytes + Minimum segment size = 64K + Maximum PKSFX segment size = 2,147,483,647 bytes + + Segment sizes may be different however by convention, all + segment sizes should be the same with the exception of the + last, which may be smaller. Local and central directory + header records must never be split across a segment boundary. + When writing a header record, if the number of bytes remaining + within a segment is less than the size of the header record, + end the current segment and write the header at the start + of the next segment. The central directory may span segment + boundaries, but no single record in the central directory + should be split across segments. + + Spanned/Split archives created using PKZIP for Windows + (V2.50 or greater), PKZIP Command Line (V2.50 or greater), + or PKZIP Explorer will include a special spanning + signature as the first 4 bytes of the first segment of + the archive. This signature (0x08074b50) will be + followed immediately by the local header signature for + the first file in the archive. + + A special spanning marker may also appear in spanned/split + archives if the spanning or splitting process starts but + only requires one segment. In this case the 0x08074b50 + signature will be replaced with the temporary spanning + marker signature of 0x30304b50. Split archives can + only be uncompressed by other versions of PKZIP that + know how to create a split archive. + + The signature value 0x08074b50 is also used by some + ZIP implementations as a marker for the Data Descriptor + record. Conflict in this alternate assignment can be + avoided by ensuring the position of the signature + within the ZIP file to determine the use for which it + is intended. + + L. General notes: + + 1) All fields unless otherwise noted are unsigned and stored + in Intel low-byte:high-byte, low-word:high-word order. + + 2) String fields are not null terminated, since the + length is given explicitly. + + 3) The entries in the central directory may not necessarily + be in the same order that files appear in the .ZIP file. + + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + +VI. Explanation of compression methods +-------------------------------------- + +UnShrinking - Method 1 +---------------------- + +Shrinking is a Dynamic Ziv-Lempel-Welch compression algorithm +with partial clearing. The initial code size is 9 bits, and +the maximum code size is 13 bits. Shrinking differs from +conventional Dynamic Ziv-Lempel-Welch implementations in several +respects: + +1) The code size is controlled by the compressor, and is not + automatically increased when codes larger than the current + code size are created (but not necessarily used). When + the decompressor encounters the code sequence 256 + (decimal) followed by 1, it should increase the code size + read from the input stream to the next bit size. No + blocking of the codes is performed, so the next code at + the increased size should be read from the input stream + immediately after where the previous code at the smaller + bit size was read. Again, the decompressor should not + increase the code size used until the sequence 256,1 is + encountered. + +2) When the table becomes full, total clearing is not + performed. Rather, when the compressor emits the code + sequence 256,2 (decimal), the decompressor should clear + all leaf nodes from the Ziv-Lempel tree, and continue to + use the current code size. The nodes that are cleared + from the Ziv-Lempel tree are then re-used, with the lowest + code value re-used first, and the highest code value + re-used last. The compressor can emit the sequence 256,2 + at any time. + +Expanding - Methods 2-5 +----------------------- + +The Reducing algorithm is actually a combination of two +distinct algorithms. The first algorithm compresses repeated +byte sequences, and the second algorithm takes the compressed +stream from the first algorithm and applies a probabilistic +compression method. + +The probabilistic compression stores an array of 'follower +sets' S(j), for j=0 to 255, corresponding to each possible +ASCII character. Each set contains between 0 and 32 +characters, to be denoted as S(j)[0],...,S(j)[m], where m<32. +The sets are stored at the beginning of the data area for a +Reduced file, in reverse order, with S(255) first, and S(0) +last. + +The sets are encoded as { N(j), S(j)[0],...,S(j)[N(j)-1] }, +where N(j) is the size of set S(j). N(j) can be 0, in which +case the follower set for S(j) is empty. Each N(j) value is +encoded in 6 bits, followed by N(j) eight bit character values +corresponding to S(j)[0] to S(j)[N(j)-1] respectively. If +N(j) is 0, then no values for S(j) are stored, and the value +for N(j-1) immediately follows. + +Immediately after the follower sets, is the compressed data +stream. The compressed data stream can be interpreted for the +probabilistic decompression as follows: + +let Last-Character <- 0. +loop until done + if the follower set S(Last-Character) is empty then + read 8 bits from the input stream, and copy this + value to the output stream. + otherwise if the follower set S(Last-Character) is non-empty then + read 1 bit from the input stream. + if this bit is not zero then + read 8 bits from the input stream, and copy this + value to the output stream. + otherwise if this bit is zero then + read B(N(Last-Character)) bits from the input + stream, and assign this value to I. + Copy the value of S(Last-Character)[I] to the + output stream. + + assign the last value placed on the output stream to + Last-Character. +end loop + +B(N(j)) is defined as the minimal number of bits required to +encode the value N(j)-1. + +The decompressed stream from above can then be expanded to +re-create the original file as follows: + +let State <- 0. + +loop until done + read 8 bits from the input stream into C. + case State of + 0: if C is not equal to DLE (144 decimal) then + copy C to the output stream. + otherwise if C is equal to DLE then + let State <- 1. + + 1: if C is non-zero then + let V <- C. + let Len <- L(V) + let State <- F(Len). + otherwise if C is zero then + copy the value 144 (decimal) to the output stream. + let State <- 0 + + 2: let Len <- Len + C + let State <- 3. + + 3: move backwards D(V,C) bytes in the output stream + (if this position is before the start of the output + stream, then assume that all the data before the + start of the output stream is filled with zeros). + copy Len+3 bytes from this position to the output stream. + let State <- 0. + end case +end loop + +The functions F,L, and D are dependent on the 'compression +factor', 1 through 4, and are defined as follows: + +For compression factor 1: + L(X) equals the lower 7 bits of X. + F(X) equals 2 if X equals 127 otherwise F(X) equals 3. + D(X,Y) equals the (upper 1 bit of X) * 256 + Y + 1. +For compression factor 2: + L(X) equals the lower 6 bits of X. + F(X) equals 2 if X equals 63 otherwise F(X) equals 3. + D(X,Y) equals the (upper 2 bits of X) * 256 + Y + 1. +For compression factor 3: + L(X) equals the lower 5 bits of X. + F(X) equals 2 if X equals 31 otherwise F(X) equals 3. + D(X,Y) equals the (upper 3 bits of X) * 256 + Y + 1. +For compression factor 4: + L(X) equals the lower 4 bits of X. + F(X) equals 2 if X equals 15 otherwise F(X) equals 3. + D(X,Y) equals the (upper 4 bits of X) * 256 + Y + 1. + +Imploding - Method 6 +-------------------- + +The Imploding algorithm is actually a combination of two distinct +algorithms. The first algorithm compresses repeated byte +sequences using a sliding dictionary. The second algorithm is +used to compress the encoding of the sliding dictionary output, +using multiple Shannon-Fano trees. + +The Imploding algorithm can use a 4K or 8K sliding dictionary +size. The dictionary size used can be determined by bit 1 in the +general purpose flag word; a 0 bit indicates a 4K dictionary +while a 1 bit indicates an 8K dictionary. + +The Shannon-Fano trees are stored at the start of the compressed +file. The number of trees stored is defined by bit 2 in the +general purpose flag word; a 0 bit indicates two trees stored, a +1 bit indicates three trees are stored. If 3 trees are stored, +the first Shannon-Fano tree represents the encoding of the +Literal characters, the second tree represents the encoding of +the Length information, the third represents the encoding of the +Distance information. When 2 Shannon-Fano trees are stored, the +Length tree is stored first, followed by the Distance tree. + +The Literal Shannon-Fano tree, if present is used to represent +the entire ASCII character set, and contains 256 values. This +tree is used to compress any data not compressed by the sliding +dictionary algorithm. When this tree is present, the Minimum +Match Length for the sliding dictionary is 3. If this tree is +not present, the Minimum Match Length is 2. + +The Length Shannon-Fano tree is used to compress the Length part +of the (length,distance) pairs from the sliding dictionary +output. The Length tree contains 64 values, ranging from the +Minimum Match Length, to 63 plus the Minimum Match Length. + +The Distance Shannon-Fano tree is used to compress the Distance +part of the (length,distance) pairs from the sliding dictionary +output. The Distance tree contains 64 values, ranging from 0 to +63, representing the upper 6 bits of the distance value. The +distance values themselves will be between 0 and the sliding +dictionary size, either 4K or 8K. + +The Shannon-Fano trees themselves are stored in a compressed +format. The first byte of the tree data represents the number of +bytes of data representing the (compressed) Shannon-Fano tree +minus 1. The remaining bytes represent the Shannon-Fano tree +data encoded as: + + High 4 bits: Number of values at this bit length + 1. (1 - 16) + Low 4 bits: Bit Length needed to represent value + 1. (1 - 16) + +The Shannon-Fano codes can be constructed from the bit lengths +using the following algorithm: + +1) Sort the Bit Lengths in ascending order, while retaining the + order of the original lengths stored in the file. + +2) Generate the Shannon-Fano trees: + + Code <- 0 + CodeIncrement <- 0 + LastBitLength <- 0 + i <- number of Shannon-Fano codes - 1 (either 255 or 63) + + loop while i >= 0 + Code = Code + CodeIncrement + if BitLength(i) <> LastBitLength then + LastBitLength=BitLength(i) + CodeIncrement = 1 shifted left (16 - LastBitLength) + ShannonCode(i) = Code + i <- i - 1 + end loop + +3) Reverse the order of all the bits in the above ShannonCode() + vector, so that the most significant bit becomes the least + significant bit. For example, the value 0x1234 (hex) would + become 0x2C48 (hex). + +4) Restore the order of Shannon-Fano codes as originally stored + within the file. + +Example: + + This example will show the encoding of a Shannon-Fano tree + of size 8. Notice that the actual Shannon-Fano trees used + for Imploding are either 64 or 256 entries in size. + +Example: 0x02, 0x42, 0x01, 0x13 + + The first byte indicates 3 values in this table. Decoding the + bytes: + 0x42 = 5 codes of 3 bits long + 0x01 = 1 code of 2 bits long + 0x13 = 2 codes of 4 bits long + + This would generate the original bit length array of: + (3, 3, 3, 3, 3, 2, 4, 4) + + There are 8 codes in this table for the values 0 thru 7. Using + the algorithm to obtain the Shannon-Fano codes produces: + + Reversed Order Original +Val Sorted Constructed Code Value Restored Length +--- ------ ----------------- -------- -------- ------ +0: 2 1100000000000000 11 101 3 +1: 3 1010000000000000 101 001 3 +2: 3 1000000000000000 001 110 3 +3: 3 0110000000000000 110 010 3 +4: 3 0100000000000000 010 100 3 +5: 3 0010000000000000 100 11 2 +6: 4 0001000000000000 1000 1000 4 +7: 4 0000000000000000 0000 0000 4 + +The values in the Val, Order Restored and Original Length columns +now represent the Shannon-Fano encoding tree that can be used for +decoding the Shannon-Fano encoded data. How to parse the +variable length Shannon-Fano values from the data stream is beyond +the scope of this document. (See the references listed at the end of +this document for more information.) However, traditional decoding +schemes used for Huffman variable length decoding, such as the +Greenlaw algorithm, can be successfully applied. + +The compressed data stream begins immediately after the +compressed Shannon-Fano data. The compressed data stream can be +interpreted as follows: + +loop until done + read 1 bit from input stream. + + if this bit is non-zero then (encoded data is literal data) + if Literal Shannon-Fano tree is present + read and decode character using Literal Shannon-Fano tree. + otherwise + read 8 bits from input stream. + copy character to the output stream. + otherwise (encoded data is sliding dictionary match) + if 8K dictionary size + read 7 bits for offset Distance (lower 7 bits of offset). + otherwise + read 6 bits for offset Distance (lower 6 bits of offset). + + using the Distance Shannon-Fano tree, read and decode the + upper 6 bits of the Distance value. + + using the Length Shannon-Fano tree, read and decode + the Length value. + + Length <- Length + Minimum Match Length + + if Length = 63 + Minimum Match Length + read 8 bits from the input stream, + add this value to Length. + + move backwards Distance+1 bytes in the output stream, and + copy Length characters from this position to the output + stream. (if this position is before the start of the output + stream, then assume that all the data before the start of + the output stream is filled with zeros). +end loop + +Tokenizing - Method 7 +--------------------- + +This method is not used by PKZIP. + +Deflating - Method 8 +-------------------- + +The Deflate algorithm is similar to the Implode algorithm using +a sliding dictionary of up to 32K with secondary compression +from Huffman/Shannon-Fano codes. + +The compressed data is stored in blocks with a header describing +the block and the Huffman codes used in the data block. The header +format is as follows: + + Bit 0: Last Block bit This bit is set to 1 if this is the last + compressed block in the data. + Bits 1-2: Block type + 00 (0) - Block is stored - All stored data is byte aligned. + Skip bits until next byte, then next word = block + length, followed by the ones compliment of the block + length word. Remaining data in block is the stored + data. + + 01 (1) - Use fixed Huffman codes for literal and distance codes. + Lit Code Bits Dist Code Bits + --------- ---- --------- ---- + 0 - 143 8 0 - 31 5 + 144 - 255 9 + 256 - 279 7 + 280 - 287 8 + + Literal codes 286-287 and distance codes 30-31 are + never used but participate in the huffman construction. + + 10 (2) - Dynamic Huffman codes. (See expanding Huffman codes) + + 11 (3) - Reserved - Flag a "Error in compressed data" if seen. + +Expanding Huffman Codes +----------------------- +If the data block is stored with dynamic Huffman codes, the Huffman +codes are sent in the following compressed format: + + 5 Bits: # of Literal codes sent - 256 (256 - 286) + All other codes are never sent. + 5 Bits: # of Dist codes - 1 (1 - 32) + 4 Bits: # of Bit Length codes - 3 (3 - 19) + +The Huffman codes are sent as bit lengths and the codes are built as +described in the implode algorithm. The bit lengths themselves are +compressed with Huffman codes. There are 19 bit length codes: + + 0 - 15: Represent bit lengths of 0 - 15 + 16: Copy the previous bit length 3 - 6 times. + The next 2 bits indicate repeat length (0 = 3, ... ,3 = 6) + Example: Codes 8, 16 (+2 bits 11), 16 (+2 bits 10) will + expand to 12 bit lengths of 8 (1 + 6 + 5) + 17: Repeat a bit length of 0 for 3 - 10 times. (3 bits of length) + 18: Repeat a bit length of 0 for 11 - 138 times (7 bits of length) + +The lengths of the bit length codes are sent packed 3 bits per value +(0 - 7) in the following order: + + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 + +The Huffman codes should be built as described in the Implode algorithm +except codes are assigned starting at the shortest bit length, i.e. the +shortest code should be all 0's rather than all 1's. Also, codes with +a bit length of zero do not participate in the tree construction. The +codes are then used to decode the bit lengths for the literal and +distance tables. + +The bit lengths for the literal tables are sent first with the number +of entries sent described by the 5 bits sent earlier. There are up +to 286 literal characters; the first 256 represent the respective 8 +bit character, code 256 represents the End-Of-Block code, the remaining +29 codes represent copy lengths of 3 thru 258. There are up to 30 +distance codes representing distances from 1 thru 32k as described +below. + + Length Codes + ------------ + Extra Extra Extra Extra + Code Bits Length Code Bits Lengths Code Bits Lengths Code Bits Length(s) + ---- ---- ------ ---- ---- ------- ---- ---- ------- ---- ---- --------- + 257 0 3 265 1 11,12 273 3 35-42 281 5 131-162 + 258 0 4 266 1 13,14 274 3 43-50 282 5 163-194 + 259 0 5 267 1 15,16 275 3 51-58 283 5 195-226 + 260 0 6 268 1 17,18 276 3 59-66 284 5 227-257 + 261 0 7 269 2 19-22 277 4 67-82 285 0 258 + 262 0 8 270 2 23-26 278 4 83-98 + 263 0 9 271 2 27-30 279 4 99-114 + 264 0 10 272 2 31-34 280 4 115-130 + + Distance Codes + -------------- + Extra Extra Extra Extra + Code Bits Dist Code Bits Dist Code Bits Distance Code Bits Distance + ---- ---- ---- ---- ---- ------ ---- ---- -------- ---- ---- -------- + 0 0 1 8 3 17-24 16 7 257-384 24 11 4097-6144 + 1 0 2 9 3 25-32 17 7 385-512 25 11 6145-8192 + 2 0 3 10 4 33-48 18 8 513-768 26 12 8193-12288 + 3 0 4 11 4 49-64 19 8 769-1024 27 12 12289-16384 + 4 1 5,6 12 5 65-96 20 9 1025-1536 28 13 16385-24576 + 5 1 7,8 13 5 97-128 21 9 1537-2048 29 13 24577-32768 + 6 2 9-12 14 6 129-192 22 10 2049-3072 + 7 2 13-16 15 6 193-256 23 10 3073-4096 + +The compressed data stream begins immediately after the +compressed header data. The compressed data stream can be +interpreted as follows: + +do + read header from input stream. + + if stored block + skip bits until byte aligned + read count and 1's compliment of count + copy count bytes data block + otherwise + loop until end of block code sent + decode literal character from input stream + if literal < 256 + copy character to the output stream + otherwise + if literal = end of block + break from loop + otherwise + decode distance from input stream + + move backwards distance bytes in the output stream, and + copy length characters from this position to the output + stream. + end loop +while not last block + +if data descriptor exists + skip bits until byte aligned + read crc and sizes +endif + +Enhanced Deflating - Method 9 +----------------------------- + +The Enhanced Deflating algorithm is similar to Deflate but +uses a sliding dictionary of up to 64K. Deflate64(tm) is supported +by the Deflate extractor. + +BZIP2 - Method 12 +----------------- + +BZIP2 is an open-source data compression algorithm developed by +Julian Seward. Information and source code for this algorithm +can be found on the internet. + +LZMA - Method 14 (EFS) +---------------------- + +LZMA is a block-oriented, general purpose data compression algorithm +developed and maintained by Igor Pavlov. It is a derivative of LZ77 +that utilizes Markov chains and a range coder. Information and +source code for this algorithm can be found on the internet. Consult +with the author of this algorithm for information on terms or +restrictions on use. + +Support for LZMA within the ZIP format is defined as follows: + +The Compression method field within the ZIP Local and Central +Header records will be set to the value 14 to indicate data was +compressed using LZMA. + +The Version needed to extract field within the ZIP Local and +Central Header records will be set to 6.3 to indicate the +minimum ZIP format version supporting this feature. + +File data compressed using the LZMA algorithm must be placed +immediately following the Local Header for the file. If a +standard ZIP encryption header is required, it will follow +the Local Header and will precede the LZMA compressed file +data segment. The location of LZMA compressed data segment +within the ZIP format will be as shown: + + [local header file 1] + [encryption header file 1] + [LZMA compressed data segment for file 1] + [data descriptor 1] + [local header file 2] + +The encryption header and data descriptor records may +be conditionally present. The LZMA Compressed Data Segment +will consist of an LZMA Properties Header followed by the +LZMA Compressed Data as shown: + + [LZMA properties header for file 1] + [LZMA compressed data for file 1] + +The LZMA Compressed Data will be stored as provided by the +LZMA compression library. Compressed size, uncompressed +size and other file characteristics about the file being +compressed must be stored in standard ZIP storage format. + +The LZMA Properties Header will store specific data required to +decompress the LZMA compressed Data. This data is set by the +LZMA compression engine using the function WriteCoderProperties() +as documented within the LZMA SDK. + +Storage fields for the property information within the LZMA +Properties Header are as follows: + + LZMA Version Information 2 bytes + LZMA Properties Size 2 bytes + LZMA Properties Data variable, defined by "LZMA Properties Size" + +LZMA Version Information - this field identifies which version of + the LZMA SDK was used to compress a file. The first byte will + store the major version number of the LZMA SDK and the second + byte will store the minor number. + +LZMA Properties Size - this field defines the size of the remaining + property data. Typically this size should be determined by the + version of the SDK. This size field is included as a convenience + and to help avoid any ambiguity should it arise in the future due + to changes in this compression algorithm. + +LZMA Property Data - this variable sized field records the required + values for the decompressor as defined by the LZMA SDK. The + data stored in this field should be obtained using the + WriteCoderProperties() in the version of the SDK defined by + the "LZMA Version Information" field. + +The layout of the "LZMA Properties Data" field is a function of the +LZMA compression algorithm. It is possible that this layout may be +changed by the author over time. The data layout in version 4.32 +of the LZMA SDK defines a 5 byte array that uses 4 bytes to store +the dictionary size in little-endian order. This is preceded by a +single packed byte as the first element of the array that contains +the following fields: + + PosStateBits + LiteralPosStateBits + LiteralContextBits + +Refer to the LZMA documentation for a more detailed explanation of +these fields. + +Data compressed with method 14, LZMA, may include an end-of-stream +(EOS) marker ending the compressed data stream. This marker is not +required, but its use is highly recommended to facilitate processing +and implementers should include the EOS marker whenever possible. +When the EOS marker is used, general purpose bit 1 must be set. If +general purpose bit 1 is not set, the EOS marker is not present. + +WavPack - Method 97 +------------------- + +Information describing the use of compression method 97 is +provided by WinZIP International, LLC. This method relies on the +open source WavPack audio compression utility developed by David Bryant. +Information on WavPack is available at www.wavpack.com. Please consult +with the author of this algorithm for information on terms and +restrictions on use. + +WavPack data for a file begins immediately after the end of the +local header data. This data is the output from WavPack compression +routines. Within the ZIP file, the use of WavPack compression is +indicated by setting the compression method field to a value of 97 +in both the local header and the central directory header. The Version +needed to extract and version made by fields use the same values as are +used for data compressed using the Deflate algorithm. + +An implementation note for storing digital sample data when using +WavPack compression within ZIP files is that all of the bytes of +the sample data should be compressed. This includes any unused +bits up to the byte boundary. An example is a 2 byte sample that +uses only 12 bits for the sample data with 4 unused bits. If only +12 bits are passed as the sample size to the WavPack routines, the 4 +unused bits will be set to 0 on extraction regardless of their original +state. To avoid this, the full 16 bits of the sample data size +should be provided. + +PPMd - Method 98 +---------------- + +PPMd is a data compression algorithm developed by Dmitry Shkarin +which includes a carryless rangecoder developed by Dmitry Subbotin. +This algorithm is based on predictive phrase matching on multiple +order contexts. Information and source code for this algorithm +can be found on the internet. Consult with the author of this +algorithm for information on terms or restrictions on use. + +Support for PPMd within the ZIP format currently is provided only +for version I, revision 1 of the algorithm. Storage requirements +for using this algorithm are as follows: + +Parameters needed to control the algorithm are stored in the two +bytes immediately preceding the compressed data. These bytes are +used to store the following fields: + +Model order - sets the maximum model order, default is 8, possible + values are from 2 to 16 inclusive + +Sub-allocator size - sets the size of sub-allocator in MB, default is 50, + possible values are from 1MB to 256MB inclusive + +Model restoration method - sets the method used to restart context + model at memory insufficiency, values are: + + 0 - restarts model from scratch - default + 1 - cut off model - decreases performance by as much as 2x + 2 - freeze context tree - not recommended + +An example for packing these fields into the 2 byte storage field is +illustrated below. These values are stored in Intel low-byte/high-byte +order. + +wPPMd = (Model order - 1) + + ((Sub-allocator size - 1) << 4) + + (Model restoration method << 12) + + +VII. Traditional PKWARE Encryption +---------------------------------- + +The following information discusses the decryption steps +required to support traditional PKWARE encryption. This +form of encryption is considered weak by today's standards +and its use is recommended only for situations with +low security needs or for compatibility with older .ZIP +applications. + +Decryption +---------- + +PKWARE is grateful to Mr. Roger Schlafly for his expert contribution +towards the development of PKWARE's traditional encryption. + +PKZIP encrypts the compressed data stream. Encrypted files must +be decrypted before they can be extracted. + +Each encrypted file has an extra 12 bytes stored at the start of +the data area defining the encryption header for that file. The +encryption header is originally set to random values, and then +itself encrypted, using three, 32-bit keys. The key values are +initialized using the supplied encryption password. After each byte +is encrypted, the keys are then updated using pseudo-random number +generation techniques in combination with the same CRC-32 algorithm +used in PKZIP and described elsewhere in this document. + +The following is the basic steps required to decrypt a file: + +1) Initialize the three 32-bit keys with the password. +2) Read and decrypt the 12-byte encryption header, further + initializing the encryption keys. +3) Read and decrypt the compressed data stream using the + encryption keys. + +Step 1 - Initializing the encryption keys +----------------------------------------- + +Key(0) <- 305419896 +Key(1) <- 591751049 +Key(2) <- 878082192 + +loop for i <- 0 to length(password)-1 + update_keys(password(i)) +end loop + +Where update_keys() is defined as: + +update_keys(char): + Key(0) <- crc32(key(0),char) + Key(1) <- Key(1) + (Key(0) & 000000ffH) + Key(1) <- Key(1) * 134775813 + 1 + Key(2) <- crc32(key(2),key(1) >> 24) +end update_keys + +Where crc32(old_crc,char) is a routine that given a CRC value and a +character, returns an updated CRC value after applying the CRC-32 +algorithm described elsewhere in this document. + +Step 2 - Decrypting the encryption header +----------------------------------------- + +The purpose of this step is to further initialize the encryption +keys, based on random data, to render a plaintext attack on the +data ineffective. + +Read the 12-byte encryption header into Buffer, in locations +Buffer(0) thru Buffer(11). + +loop for i <- 0 to 11 + C <- buffer(i) ^ decrypt_byte() + update_keys(C) + buffer(i) <- C +end loop + +Where decrypt_byte() is defined as: + +unsigned char decrypt_byte() + local unsigned short temp + temp <- Key(2) | 2 + decrypt_byte <- (temp * (temp ^ 1)) >> 8 +end decrypt_byte + +After the header is decrypted, the last 1 or 2 bytes in Buffer +should be the high-order word/byte of the CRC for the file being +decrypted, stored in Intel low-byte/high-byte order. Versions of +PKZIP prior to 2.0 used a 2 byte CRC check; a 1 byte CRC check is +used on versions after 2.0. This can be used to test if the password +supplied is correct or not. + +Step 3 - Decrypting the compressed data stream +---------------------------------------------- + +The compressed data stream can be decrypted as follows: + +loop until done + read a character into C + Temp <- C ^ decrypt_byte() + update_keys(temp) + output Temp +end loop + + +VIII. Strong Encryption Specification +------------------------------------- + +The Strong Encryption technology defined in this specification is +covered under a pending patent application. The use or implementation +in a product of certain technological aspects set forth in the current +APPNOTE, including those with regard to strong encryption, patching, +or extended tape operations requires a license from PKWARE. Portions +of this Strong Encryption technology are available for use at no charge. +Contact PKWARE for licensing terms and conditions. Refer to section II +of this APPNOTE (Contacting PKWARE) for information on how to +contact PKWARE. + +Version 5.x of this specification introduced support for strong +encryption algorithms. These algorithms can be used with either +a password or an X.509v3 digital certificate to encrypt each file. +This format specification supports either password or certificate +based encryption to meet the security needs of today, to enable +interoperability between users within both PKI and non-PKI +environments, and to ensure interoperability between different +computing platforms that are running a ZIP program. + +Password based encryption is the most common form of encryption +people are familiar with. However, inherent weaknesses with +passwords (e.g. susceptibility to dictionary/brute force attack) +as well as password management and support issues make certificate +based encryption a more secure and scalable option. Industry +efforts and support are defining and moving towards more advanced +security solutions built around X.509v3 digital certificates and +Public Key Infrastructures(PKI) because of the greater scalability, +administrative options, and more robust security over traditional +password based encryption. + +Most standard encryption algorithms are supported with this +specification. Reference implementations for many of these +algorithms are available from either commercial or open source +distributors. Readily available cryptographic toolkits make +implementation of the encryption features straight-forward. +This document is not intended to provide a treatise on data +encryption principles or theory. Its purpose is to document the +data structures required for implementing interoperable data +encryption within the .ZIP format. It is strongly recommended that +you have a good understanding of data encryption before reading +further. + +The algorithms introduced in Version 5.0 of this specification +include: + + RC2 40 bit, 64 bit, and 128 bit + RC4 40 bit, 64 bit, and 128 bit + DES + 3DES 112 bit and 168 bit + +Version 5.1 adds support for the following: + + AES 128 bit, 192 bit, and 256 bit + + +Version 6.1 introduces encryption data changes to support +interoperability with Smartcard and USB Token certificate storage +methods which do not support the OAEP strengthening standard. + +Version 6.2 introduces support for encrypting metadata by compressing +and encrypting the central directory data structure to reduce information +leakage. Information leakage can occur in legacy ZIP applications +through exposure of information about a file even though that file is +stored encrypted. The information exposed consists of file +characteristics stored within the records and fields defined by this +specification. This includes data such as a files name, its original +size, timestamp and CRC32 value. + +Version 6.3 introduces support for encrypting data using the Blowfish +and Twofish algorithms. These are symmetric block ciphers developed +by Bruce Schneier. Blowfish supports using a variable length key from +32 to 448 bits. Block size is 64 bits. Implementations should use 16 +rounds and the only mode supported within ZIP files is CBC. Twofish +supports key sizes 128, 192 and 256 bits. Block size is 128 bits. +Implementations should use 16 rounds and the only mode supported within +ZIP files is CBC. Information and source code for both Blowfish and +Twofish algorithms can be found on the internet. Consult with the author +of these algorithms for information on terms or restrictions on use. + +Central Directory Encryption provides greater protection against +information leakage by encrypting the Central Directory structure and +by masking key values that are replicated in the unencrypted Local +Header. ZIP compatible programs that cannot interpret an encrypted +Central Directory structure cannot rely on the data in the corresponding +Local Header for decompression information. + +Extra Field records that may contain information about a file that should +not be exposed should not be stored in the Local Header and should only +be written to the Central Directory where they can be encrypted. This +design currently does not support streaming. Information in the End of +Central Directory record, the Zip64 End of Central Directory Locator, +and the Zip64 End of Central Directory records are not encrypted. Access +to view data on files within a ZIP file with an encrypted Central Directory +requires the appropriate password or private key for decryption prior to +viewing any files, or any information about the files, in the archive. + +Older ZIP compatible programs not familiar with the Central Directory +Encryption feature will no longer be able to recognize the Central +Directory and may assume the ZIP file is corrupt. Programs that +attempt streaming access using Local Headers will see invalid +information for each file. Central Directory Encryption need not be +used for every ZIP file. Its use is recommended for greater security. +ZIP files not using Central Directory Encryption should operate as +in the past. + +This strong encryption feature specification is intended to provide for +scalable, cross-platform encryption needs ranging from simple password +encryption to authenticated public/private key encryption. + +Encryption provides data confidentiality and privacy. It is +recommended that you combine X.509 digital signing with encryption +to add authentication and non-repudiation. + + +Single Password Symmetric Encryption Method: +------------------------------------------- + +The Single Password Symmetric Encryption Method using strong +encryption algorithms operates similarly to the traditional +PKWARE encryption defined in this format. Additional data +structures are added to support the processing needs of the +strong algorithms. + +The Strong Encryption data structures are: + +1. General Purpose Bits - Bits 0 and 6 of the General Purpose bit +flag in both local and central header records. Both bits set +indicates strong encryption. Bit 13, when set indicates the Central +Directory is encrypted and that selected fields in the Local Header +are masked to hide their actual value. + + +2. Extra Field 0x0017 in central header only. + + Fields to consider in this record are: + + Format - the data format identifier for this record. The only + value allowed at this time is the integer value 2. + + AlgId - integer identifier of the encryption algorithm from the + following range + + 0x6601 - DES + 0x6602 - RC2 (version needed to extract < 5.2) + 0x6603 - 3DES 168 + 0x6609 - 3DES 112 + 0x660E - AES 128 + 0x660F - AES 192 + 0x6610 - AES 256 + 0x6702 - RC2 (version needed to extract >= 5.2) + 0x6720 - Blowfish + 0x6721 - Twofish + 0x6801 - RC4 + 0xFFFF - Unknown algorithm + + Bitlen - Explicit bit length of key + + 32 - 448 bits + + Flags - Processing flags needed for decryption + + 0x0001 - Password is required to decrypt + 0x0002 - Certificates only + 0x0003 - Password or certificate required to decrypt + + Values > 0x0003 reserved for certificate processing + + +3. Decryption header record preceding compressed file data. + + -Decryption Header: + + Value Size Description + ----- ---- ----------- + IVSize 2 bytes Size of initialization vector (IV) + IVData IVSize Initialization vector for this file + Size 4 bytes Size of remaining decryption header data + Format 2 bytes Format definition for this record + AlgID 2 bytes Encryption algorithm identifier + Bitlen 2 bytes Bit length of encryption key + Flags 2 bytes Processing flags + ErdSize 2 bytes Size of Encrypted Random Data + ErdData ErdSize Encrypted Random Data + Reserved1 4 bytes Reserved certificate processing data + Reserved2 (var) Reserved for certificate processing data + VSize 2 bytes Size of password validation data + VData VSize-4 Password validation data + VCRC32 4 bytes Standard ZIP CRC32 of password validation data + + IVData - The size of the IV should match the algorithm block size. + The IVData can be completely random data. If the size of + the randomly generated data does not match the block size + it should be complemented with zero's or truncated as + necessary. If IVSize is 0,then IV = CRC32 + Uncompressed + File Size (as a 64 bit little-endian, unsigned integer value). + + Format - the data format identifier for this record. The only + value allowed at this time is the integer value 3. + + AlgId - integer identifier of the encryption algorithm from the + following range + + 0x6601 - DES + 0x6602 - RC2 (version needed to extract < 5.2) + 0x6603 - 3DES 168 + 0x6609 - 3DES 112 + 0x660E - AES 128 + 0x660F - AES 192 + 0x6610 - AES 256 + 0x6702 - RC2 (version needed to extract >= 5.2) + 0x6720 - Blowfish + 0x6721 - Twofish + 0x6801 - RC4 + 0xFFFF - Unknown algorithm + + Bitlen - Explicit bit length of key + + 32 - 448 bits + + Flags - Processing flags needed for decryption + + 0x0001 - Password is required to decrypt + 0x0002 - Certificates only + 0x0003 - Password or certificate required to decrypt + + Values > 0x0003 reserved for certificate processing + + ErdData - Encrypted random data is used to store random data that + is used to generate a file session key for encrypting + each file. SHA1 is used to calculate hash data used to + derive keys. File session keys are derived from a master + session key generated from the user-supplied password. + If the Flags field in the decryption header contains + the value 0x4000, then the ErdData field must be + decrypted using 3DES. If the value 0x4000 is not set, + then the ErdData field must be decrypted using AlgId. + + + Reserved1 - Reserved for certificate processing, if value is + zero, then Reserved2 data is absent. See the explanation + under the Certificate Processing Method for details on + this data structure. + + Reserved2 - If present, the size of the Reserved2 data structure + is located by skipping the first 4 bytes of this field + and using the next 2 bytes as the remaining size. See + the explanation under the Certificate Processing Method + for details on this data structure. + + VSize - This size value will always include the 4 bytes of the + VCRC32 data and will be greater than 4 bytes. + + VData - Random data for password validation. This data is VSize + in length and VSize must be a multiple of the encryption + block size. VCRC32 is a checksum value of VData. + VData and VCRC32 are stored encrypted and start the + stream of encrypted data for a file. + + +4. Useful Tips + +Strong Encryption is always applied to a file after compression. The +block oriented algorithms all operate in Cypher Block Chaining (CBC) +mode. The block size used for AES encryption is 16. All other block +algorithms use a block size of 8. Two ID's are defined for RC2 to +account for a discrepancy found in the implementation of the RC2 +algorithm in the cryptographic library on Windows XP SP1 and all +earlier versions of Windows. It is recommended that zero length files +not be encrypted, however programs should be prepared to extract them +if they are found within a ZIP file. + +A pseudo-code representation of the encryption process is as follows: + +Password = GetUserPassword() +MasterSessionKey = DeriveKey(SHA1(Password)) +RD = CryptographicStrengthRandomData() +For Each File + IV = CryptographicStrengthRandomData() + VData = CryptographicStrengthRandomData() + VCRC32 = CRC32(VData) + FileSessionKey = DeriveKey(SHA1(IV + RD) + ErdData = Encrypt(RD,MasterSessionKey,IV) + Encrypt(VData + VCRC32 + FileData, FileSessionKey,IV) +Done + +The function names and parameter requirements will depend on +the choice of the cryptographic toolkit selected. Almost any +toolkit supporting the reference implementations for each +algorithm can be used. The RSA BSAFE(r), OpenSSL, and Microsoft +CryptoAPI libraries are all known to work well. + + +Single Password - Central Directory Encryption: +----------------------------------------------- + +Central Directory Encryption is achieved within the .ZIP format by +encrypting the Central Directory structure. This encapsulates the metadata +most often used for processing .ZIP files. Additional metadata is stored for +redundancy in the Local Header for each file. The process of concealing +metadata by encrypting the Central Directory does not protect the data within +the Local Header. To avoid information leakage from the exposed metadata +in the Local Header, the fields containing information about a file are masked. + +Local Header: + +Masking replaces the true content of the fields for a file in the Local +Header with false information. When masked, the Local Header is not +suitable for streaming access and the options for data recovery of damaged +archives is reduced. Extra Data fields that may contain confidential +data should not be stored within the Local Header. The value set into +the Version needed to extract field should be the correct value needed to +extract the file without regard to Central Directory Encryption. The fields +within the Local Header targeted for masking when the Central Directory is +encrypted are: + + Field Name Mask Value + ------------------ --------------------------- + compression method 0 + last mod file time 0 + last mod file date 0 + crc-32 0 + compressed size 0 + uncompressed size 0 + file name (variable size) Base 16 value from the + range 1 - 0xFFFFFFFFFFFFFFFF + represented as a string whose + size will be set into the + file name length field + +The Base 16 value assigned as a masked file name is simply a sequentially +incremented value for each file starting with 1 for the first file. +Modifications to a ZIP file may cause different values to be stored for +each file. For compatibility, the file name field in the Local Header +should never be left blank. As of Version 6.2 of this specification, +the Compression Method and Compressed Size fields are not yet masked. +Fields having a value of 0xFFFF or 0xFFFFFFFF for the ZIP64 format +should not be masked. + +Encrypting the Central Directory: + +Encryption of the Central Directory does not include encryption of the +Central Directory Signature data, the Zip64 End of Central Directory +record, the Zip64 End of Central Directory Locator, or the End +of Central Directory record. The ZIP file comment data is never +encrypted. + +Before encrypting the Central Directory, it may optionally be compressed. +Compression is not required, but for storage efficiency it is assumed +this structure will be compressed before encrypting. Similarly, this +specification supports compressing the Central Directory without +requiring that it also be encrypted. Early implementations of this +feature will assume the encryption method applied to files matches the +encryption applied to the Central Directory. + +Encryption of the Central Directory is done in a manner similar to +that of file encryption. The encrypted data is preceded by a +decryption header. The decryption header is known as the Archive +Decryption Header. The fields of this record are identical to +the decryption header preceding each encrypted file. The location +of the Archive Decryption Header is determined by the value in the +Start of the Central Directory field in the Zip64 End of Central +Directory record. When the Central Directory is encrypted, the +Zip64 End of Central Directory record will always be present. + +The layout of the Zip64 End of Central Directory record for all +versions starting with 6.2 of this specification will follow the +Version 2 format. The Version 2 format is as follows: + +The leading fixed size fields within the Version 1 format for this +record remain unchanged. The record signature for both Version 1 +and Version 2 will be 0x06064b50. Immediately following the last +byte of the field known as the Offset of Start of Central +Directory With Respect to the Starting Disk Number will begin the +new fields defining Version 2 of this record. + +New fields for Version 2: + +Note: all fields stored in Intel low-byte/high-byte order. + + Value Size Description + ----- ---- ----------- + Compression Method 2 bytes Method used to compress the + Central Directory + Compressed Size 8 bytes Size of the compressed data + Original Size 8 bytes Original uncompressed size + AlgId 2 bytes Encryption algorithm ID + BitLen 2 bytes Encryption key length + Flags 2 bytes Encryption flags + HashID 2 bytes Hash algorithm identifier + Hash Length 2 bytes Length of hash data + Hash Data (variable) Hash data + +The Compression Method accepts the same range of values as the +corresponding field in the Central Header. + +The Compressed Size and Original Size values will not include the +data of the Central Directory Signature which is compressed or +encrypted. + +The AlgId, BitLen, and Flags fields accept the same range of values +the corresponding fields within the 0x0017 record. + +Hash ID identifies the algorithm used to hash the Central Directory +data. This data does not have to be hashed, in which case the +values for both the HashID and Hash Length will be 0. Possible +values for HashID are: + + Value Algorithm + ------ --------- + 0x0000 none + 0x0001 CRC32 + 0x8003 MD5 + 0x8004 SHA1 + 0x8007 RIPEMD160 + 0x800C SHA256 + 0x800D SHA384 + 0x800E SHA512 + +When the Central Directory data is signed, the same hash algorithm +used to hash the Central Directory for signing should be used. +This is recommended for processing efficiency, however, it is +permissible for any of the above algorithms to be used independent +of the signing process. + +The Hash Data will contain the hash data for the Central Directory. +The length of this data will vary depending on the algorithm used. + +The Version Needed to Extract should be set to 62. + +The value for the Total Number of Entries on the Current Disk will +be 0. These records will no longer support random access when +encrypting the Central Directory. + +When the Central Directory is compressed and/or encrypted, the +End of Central Directory record will store the value 0xFFFFFFFF +as the value for the Total Number of Entries in the Central +Directory. The value stored in the Total Number of Entries in +the Central Directory on this Disk field will be 0. The actual +values will be stored in the equivalent fields of the Zip64 +End of Central Directory record. + +Decrypting and decompressing the Central Directory is accomplished +in the same manner as decrypting and decompressing a file. + +Certificate Processing Method: +----------------------------- + +The Certificate Processing Method of for ZIP file encryption +defines the following additional data fields: + +1. Certificate Flag Values + +Additional processing flags that can be present in the Flags field of both +the 0x0017 field of the central directory Extra Field and the Decryption +header record preceding compressed file data are: + + 0x0007 - reserved for future use + 0x000F - reserved for future use + 0x0100 - Indicates non-OAEP key wrapping was used. If this + this field is set, the version needed to extract must + be at least 61. This means OAEP key wrapping is not + used when generating a Master Session Key using + ErdData. + 0x4000 - ErdData must be decrypted using 3DES-168, otherwise use the + same algorithm used for encrypting the file contents. + 0x8000 - reserved for future use + + +2. CertData - Extra Field 0x0017 record certificate data structure + +The data structure used to store certificate data within the section +of the Extra Field defined by the CertData field of the 0x0017 +record are as shown: + + Value Size Description + ----- ---- ----------- + RCount 4 bytes Number of recipients. + HashAlg 2 bytes Hash algorithm identifier + HSize 2 bytes Hash size + SRList (var) Simple list of recipients hashed public keys + + + RCount This defines the number intended recipients whose + public keys were used for encryption. This identifies + the number of elements in the SRList. + + HashAlg This defines the hash algorithm used to calculate + the public key hash of each public key used + for encryption. This field currently supports + only the following value for SHA-1 + + 0x8004 - SHA1 + + HSize This defines the size of a hashed public key. + + SRList This is a variable length list of the hashed + public keys for each intended recipient. Each + element in this list is HSize. The total size of + SRList is determined using RCount * HSize. + + +3. Reserved1 - Certificate Decryption Header Reserved1 Data: + + Value Size Description + ----- ---- ----------- + RCount 4 bytes Number of recipients. + + RCount This defines the number intended recipients whose + public keys were used for encryption. This defines + the number of elements in the REList field defined below. + + +4. Reserved2 - Certificate Decryption Header Reserved2 Data Structures: + + + Value Size Description + ----- ---- ----------- + HashAlg 2 bytes Hash algorithm identifier + HSize 2 bytes Hash size + REList (var) List of recipient data elements + + + HashAlg This defines the hash algorithm used to calculate + the public key hash of each public key used + for encryption. This field currently supports + only the following value for SHA-1 + + 0x8004 - SHA1 + + HSize This defines the size of a hashed public key + defined in REHData. + + REList This is a variable length of list of recipient data. + Each element in this list consists of a Recipient + Element data structure as follows: + + + Recipient Element (REList) Data Structure: + + Value Size Description + ----- ---- ----------- + RESize 2 bytes Size of REHData + REKData + REHData HSize Hash of recipients public key + REKData (var) Simple key blob + + + RESize This defines the size of an individual REList + element. This value is the combined size of the + REHData field + REKData field. REHData is defined by + HSize. REKData is variable and can be calculated + for each REList element using RESize and HSize. + + REHData Hashed public key for this recipient. + + REKData Simple Key Blob. The format of this data structure + is identical to that defined in the Microsoft + CryptoAPI and generated using the CryptExportKey() + function. The version of the Simple Key Blob + supported at this time is 0x02 as defined by + Microsoft. + +Certificate Processing - Central Directory Encryption: +------------------------------------------------------ + +Central Directory Encryption using Digital Certificates will +operate in a manner similar to that of Single Password Central +Directory Encryption. This record will only be present when there +is data to place into it. Currently, data is placed into this +record when digital certificates are used for either encrypting +or signing the files within a ZIP file. When only password +encryption is used with no certificate encryption or digital +signing, this record is not currently needed. When present, this +record will appear before the start of the actual Central Directory +data structure and will be located immediately after the Archive +Decryption Header if the Central Directory is encrypted. + +The Archive Extra Data record will be used to store the following +information. Additional data may be added in future versions. + +Extra Data Fields: + +0x0014 - PKCS#7 Store for X.509 Certificates +0x0016 - X.509 Certificate ID and Signature for central directory +0x0019 - PKCS#7 Encryption Recipient Certificate List + +The 0x0014 and 0x0016 Extra Data records that otherwise would be +located in the first record of the Central Directory for digital +certificate processing. When encrypting or compressing the Central +Directory, the 0x0014 and 0x0016 records must be located in the +Archive Extra Data record and they should not remain in the first +Central Directory record. The Archive Extra Data record will also +be used to store the 0x0019 data. + +When present, the size of the Archive Extra Data record will be +included in the size of the Central Directory. The data of the +Archive Extra Data record will also be compressed and encrypted +along with the Central Directory data structure. + +Certificate Processing Differences: + +The Certificate Processing Method of encryption differs from the +Single Password Symmetric Encryption Method as follows. Instead +of using a user-defined password to generate a master session key, +cryptographically random data is used. The key material is then +wrapped using standard key-wrapping techniques. This key material +is wrapped using the public key of each recipient that will need +to decrypt the file using their corresponding private key. + +This specification currently assumes digital certificates will follow +the X.509 V3 format for 1024 bit and higher RSA format digital +certificates. Implementation of this Certificate Processing Method +requires supporting logic for key access and management. This logic +is outside the scope of this specification. + +OAEP Processing with Certificate-based Encryption: + +OAEP stands for Optimal Asymmetric Encryption Padding. It is a +strengthening technique used for small encoded items such as decryption +keys. This is commonly applied in cryptographic key-wrapping techniques +and is supported by PKCS #1. Versions 5.0 and 6.0 of this specification +were designed to support OAEP key-wrapping for certificate-based +decryption keys for additional security. + +Support for private keys stored on Smartcards or Tokens introduced +a conflict with this OAEP logic. Most card and token products do +not support the additional strengthening applied to OAEP key-wrapped +data. In order to resolve this conflict, versions 6.1 and above of this +specification will no longer support OAEP when encrypting using +digital certificates. + +Versions of PKZIP available during initial development of the +certificate processing method set a value of 61 into the +version needed to extract field for a file. This indicates that +non-OAEP key wrapping is used. This affects certificate encryption +only, and password encryption functions should not be affected by +this value. This means values of 61 may be found on files encrypted +with certificates only, or on files encrypted with both password +encryption and certificate encryption. Files encrypted with both +methods can safely be decrypted using the password methods documented. + +IX. Change Process +------------------ + +In order for the .ZIP file format to remain a viable definition, this +specification should be considered as open for periodic review and +revision. Although this format was originally designed with a +certain level of extensibility, not all changes in technology +(present or future) were or will be necessarily considered in its +design. If your application requires new definitions to the +extensible sections in this format, or if you would like to +submit new data structures, please forward your request to +zipformat@pkware.com. All submissions will be reviewed by the +ZIP File Specification Committee for possible inclusion into +future versions of this specification. Periodic revisions +to this specification will be published to ensure interoperability. +We encourage comments and feedback that may help improve clarity +or content. + +X. Incorporating PKWARE Proprietary Technology into Your Product +---------------------------------------------------------------- + +PKWARE is committed to the interoperability and advancement of the +.ZIP format. PKWARE offers a free license for certain technological +aspects described above under certain restrictions and conditions. +However, the use or implementation in a product of certain technological +aspects set forth in the current APPNOTE, including those with regard to +strong encryption, patching, or extended tape operations requires a +license from PKWARE. Please contact PKWARE with regard to acquiring +a license. + +XI. Acknowledgements +--------------------- + +In addition to the above mentioned contributors to PKZIP and PKUNZIP, +I would like to extend special thanks to Robert Mahoney for suggesting +the extension .ZIP for this software. + +XII. References +--------------- + + Fiala, Edward R., and Greene, Daniel H., "Data compression with + finite windows", Communications of the ACM, Volume 32, Number 4, + April 1989, pages 490-505. + + Held, Gilbert, "Data Compression, Techniques and Applications, + Hardware and Software Considerations", John Wiley & Sons, 1987. + + Huffman, D.A., "A method for the construction of minimum-redundancy + codes", Proceedings of the IRE, Volume 40, Number 9, September 1952, + pages 1098-1101. + + Nelson, Mark, "LZW Data Compression", Dr. Dobbs Journal, Volume 14, + Number 10, October 1989, pages 29-37. + + Nelson, Mark, "The Data Compression Book", M&T Books, 1991. + + Storer, James A., "Data Compression, Methods and Theory", + Computer Science Press, 1988 + + Welch, Terry, "A Technique for High-Performance Data Compression", + IEEE Computer, Volume 17, Number 6, June 1984, pages 8-19. + + Ziv, J. and Lempel, A., "A universal algorithm for sequential data + compression", Communications of the ACM, Volume 30, Number 6, + June 1987, pages 520-540. + + Ziv, J. and Lempel, A., "Compression of individual sequences via + variable-rate coding", IEEE Transactions on Information Theory, + Volume 24, Number 5, September 1978, pages 530-536. + + +APPENDIX A - AS/400 Extra Field (0x0065) Attribute Definitions +-------------------------------------------------------------- + +Field Definition Structure: + + a. field length including length 2 bytes + b. field code 2 bytes + c. data x bytes + +Field Code Description + 4001 Source type i.e. CLP etc + 4002 The text description of the library + 4003 The text description of the file + 4004 The text description of the member + 4005 x'F0' or 0 is PF-DTA, x'F1' or 1 is PF_SRC + 4007 Database Type Code 1 byte + 4008 Database file and fields definition + 4009 GZIP file type 2 bytes + 400B IFS code page 2 bytes + 400C IFS Creation Time 4 bytes + 400D IFS Access Time 4 bytes + 400E IFS Modification time 4 bytes + 005C Length of the records in the file 2 bytes + 0068 GZIP two words 8 bytes + +APPENDIX B - z/OS Extra Field (0x0065) Attribute Definitions +------------------------------------------------------------ + +Field Definition Structure: + + a. field length including length 2 bytes + b. field code 2 bytes + c. data x bytes + +Field Code Description + 0001 File Type 2 bytes + 0002 NonVSAM Record Format 1 byte + 0003 Reserved + 0004 NonVSAM Block Size 2 bytes Big Endian + 0005 Primary Space Allocation 3 bytes Big Endian + 0006 Secondary Space Allocation 3 bytes Big Endian + 0007 Space Allocation Type1 byte flag + 0008 Modification Date Retired with PKZIP 5.0 + + 0009 Expiration Date Retired with PKZIP 5.0 + + 000A PDS Directory Block Allocation 3 bytes Big Endian binary value + 000B NonVSAM Volume List variable + 000C UNIT Reference Retired with PKZIP 5.0 + + 000D DF/SMS Management Class 8 bytes EBCDIC Text Value + 000E DF/SMS Storage Class 8 bytes EBCDIC Text Value + 000F DF/SMS Data Class 8 bytes EBCDIC Text Value + 0010 PDS/PDSE Member Info. 30 bytes + 0011 VSAM sub-filetype 2 bytes + 0012 VSAM LRECL 13 bytes EBCDIC "(num_avg num_max)" + 0013 VSAM Cluster Name Retired with PKZIP 5.0 + + 0014 VSAM KSDS Key Information 13 bytes EBCDIC "(num_length num_position)" + 0015 VSAM Average LRECL 5 bytes EBCDIC num_value padded with blanks + 0016 VSAM Maximum LRECL 5 bytes EBCDIC num_value padded with blanks + 0017 VSAM KSDS Key Length 5 bytes EBCDIC num_value padded with blanks + 0018 VSAM KSDS Key Position 5 bytes EBCDIC num_value padded with blanks + 0019 VSAM Data Name 1-44 bytes EBCDIC text string + 001A VSAM KSDS Index Name 1-44 bytes EBCDIC text string + 001B VSAM Catalog Name 1-44 bytes EBCDIC text string + 001C VSAM Data Space Type 9 bytes EBCDIC text string + 001D VSAM Data Space Primary 9 bytes EBCDIC num_value left-justified + 001E VSAM Data Space Secondary 9 bytes EBCDIC num_value left-justified + 001F VSAM Data Volume List variable EBCDIC text list of 6-character Volume IDs + 0020 VSAM Data Buffer Space 8 bytes EBCDIC num_value left-justified + 0021 VSAM Data CISIZE 5 bytes EBCDIC num_value left-justified + 0022 VSAM Erase Flag 1 byte flag + 0023 VSAM Free CI % 3 bytes EBCDIC num_value left-justified + 0024 VSAM Free CA % 3 bytes EBCDIC num_value left-justified + 0025 VSAM Index Volume List variable EBCDIC text list of 6-character Volume IDs + 0026 VSAM Ordered Flag 1 byte flag + 0027 VSAM REUSE Flag 1 byte flag + 0028 VSAM SPANNED Flag 1 byte flag + 0029 VSAM Recovery Flag 1 byte flag + 002A VSAM WRITECHK Flag 1 byte flag + 002B VSAM Cluster/Data SHROPTS 3 bytes EBCDIC "n,y" + 002C VSAM Index SHROPTS 3 bytes EBCDIC "n,y" + 002D VSAM Index Space Type 9 bytes EBCDIC text string + 002E VSAM Index Space Primary 9 bytes EBCDIC num_value left-justified + 002F VSAM Index Space Secondary 9 bytes EBCDIC num_value left-justified + 0030 VSAM Index CISIZE 5 bytes EBCDIC num_value left-justified + 0031 VSAM Index IMBED 1 byte flag + 0032 VSAM Index Ordered Flag 1 byte flag + 0033 VSAM REPLICATE Flag 1 byte flag + 0034 VSAM Index REUSE Flag 1 byte flag + 0035 VSAM Index WRITECHK Flag 1 byte flag Retired with PKZIP 5.0 + + 0036 VSAM Owner 8 bytes EBCDIC text string + 0037 VSAM Index Owner 8 bytes EBCDIC text string + 0038 Reserved + 0039 Reserved + 003A Reserved + 003B Reserved + 003C Reserved + 003D Reserved + 003E Reserved + 003F Reserved + 0040 Reserved + 0041 Reserved + 0042 Reserved + 0043 Reserved + 0044 Reserved + 0045 Reserved + 0046 Reserved + 0047 Reserved + 0048 Reserved + 0049 Reserved + 004A Reserved + 004B Reserved + 004C Reserved + 004D Reserved + 004E Reserved + 004F Reserved + 0050 Reserved + 0051 Reserved + 0052 Reserved + 0053 Reserved + 0054 Reserved + 0055 Reserved + 0056 Reserved + 0057 Reserved + 0058 PDS/PDSE Member TTR Info. 6 bytes Big Endian + 0059 PDS 1st LMOD Text TTR 3 bytes Big Endian + 005A PDS LMOD EP Rec # 4 bytes Big Endian + 005B Reserved + 005C Max Length of records 2 bytes Big Endian + 005D PDSE Flag 1 byte flag + 005E Reserved + 005F Reserved + 0060 Reserved + 0061 Reserved + 0062 Reserved + 0063 Reserved + 0064 Reserved + 0065 Last Date Referenced 4 bytes Packed Hex "yyyymmdd" + 0066 Date Created 4 bytes Packed Hex "yyyymmdd" + 0068 GZIP two words 8 bytes + 0071 Extended NOTE Location 12 bytes Big Endian + 0072 Archive device UNIT 6 bytes EBCDIC + 0073 Archive 1st Volume 6 bytes EBCDIC + 0074 Archive 1st VOL File Seq# 2 bytes Binary + +APPENDIX C - Zip64 Extensible Data Sector Mappings (EFS) +-------------------------------------------------------- + + -Z390 Extra Field: + + The following is the general layout of the attributes for the + ZIP 64 "extra" block for extended tape operations. Portions of + this extended tape processing technology is covered under a + pending patent application. The use or implementation in a + product of certain technological aspects set forth in the + current APPNOTE, including those with regard to strong encryption, + patching or extended tape operations, requires a license from + PKWARE. Please contact PKWARE with regard to acquiring a license. + + + Note: some fields stored in Big Endian format. All text is + in EBCDIC format unless otherwise specified. + + Value Size Description + ----- ---- ----------- + (Z390) 0x0065 2 bytes Tag for this "extra" block type + Size 4 bytes Size for the following data block + Tag 4 bytes EBCDIC "Z390" + Length71 2 bytes Big Endian + Subcode71 2 bytes Enote type code + FMEPos 1 byte + Length72 2 bytes Big Endian + Subcode72 2 bytes Unit type code + Unit 1 byte Unit + Length73 2 bytes Big Endian + Subcode73 2 bytes Volume1 type code + FirstVol 1 byte Volume + Length74 2 bytes Big Endian + Subcode74 2 bytes FirstVol file sequence + FileSeq 2 bytes Sequence + +APPENDIX D - Language Encoding (EFS) +------------------------------------ + +The ZIP format has historically supported only the original IBM PC character +encoding set, commonly referred to as IBM Code Page 437. This limits storing +file name characters to only those within the original MS-DOS range of values +and does not properly support file names in other character encodings, or +languages. To address this limitation, this specification will support the +following change. + +If general purpose bit 11 is unset, the file name and comment should conform +to the original ZIP character encoding. If general purpose bit 11 is set, the +filename and comment must support The Unicode Standard, Version 4.1.0 or +greater using the character encoding form defined by the UTF-8 storage +specification. The Unicode Standard is published by the The Unicode +Consortium (www.unicode.org). UTF-8 encoded data stored within ZIP files +is expected to not include a byte order mark (BOM). + +Applications may choose to supplement this file name storage through the use +of the 0x0008 Extra Field. Storage for this optional field is currently +undefined, however it will be used to allow storing extended information +on source or target encoding that may further assist applications with file +name, or file content encoding tasks. Please contact PKWARE with any +requirements on how this field should be used. + +The 0x0008 Extra Field storage may be used with either setting for general +purpose bit 11. Examples of the intended usage for this field is to store +whether "modified-UTF-8" (JAVA) is used, or UTF-8-MAC. Similarly, other +commonly used character encoding (code page) designations can be indicated +through this field. Formalized values for use of the 0x0008 record remain +undefined at this time. The definition for the layout of the 0x0008 field +will be published when available. Use of the 0x0008 Extra Field provides +for storing data within a ZIP file in an encoding other than IBM Code +Page 437 or UTF-8. + +General purpose bit 11 will not imply any encoding of file content or +password. Values defining character encoding for file content or +password must be stored within the 0x0008 Extended Language Encoding +Extra Field. + +Ed Gordon of the Info-ZIP group has defined a pair of "extra field" records +that can be used to store UTF-8 file name and file comment fields. These +records can be used for cases when the general purpose bit 11 method +for storing UTF-8 data in the standard file name and comment fields is +not desirable. A common case for this alternate method is if backward +compatibility with older programs is required. + +Definitions for the record structure of these fields are included above +in the section on 3rd party mappings for "extra field" records. These +records are identified by Header ID's 0x6375 (Info-ZIP Unicode Comment +Extra Field) and 0x7075 (Info-ZIP Unicode Path Extra Field). + +The choice of which storage method to use when writing a ZIP file is left +to the implementation. Developers should expect that a ZIP file may +contain either method and should provide support for reading data in +either format. Use of general purpose bit 11 reduces storage requirements +for file name data by not requiring additional "extra field" data for +each file, but can result in older ZIP programs not being able to extract +files. Use of the 0x6375 and 0x7075 records will result in a ZIP file +that should always be readable by older ZIP programs, but requires more +storage per file to write file name and/or file comment fields. + + + + diff --git a/commodoreclicker/js/thirdparty/jszip/docs/ZIP spec.txt b/commodoreclicker/js/thirdparty/jszip/docs/ZIP spec.txt new file mode 100644 index 00000000..bb1485e3 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/docs/ZIP spec.txt @@ -0,0 +1,66 @@ +Here are the notes I made while working through the ZIP file specification. + +For each file: + + local file header signature 4 bytes (0x04034b50) + version needed to extract 2 bytes + general purpose bit flag 2 bytes + compression method 2 bytes + last mod file time 2 bytes + last mod file date 2 bytes + crc-32 4 bytes + compressed size 4 bytes + uncompressed size 4 bytes + file name length 2 bytes + extra field length 2 bytes + +|sig |v |g |c |t |d |crc |csz |usz |n |x | + PK.. ## 00 00 ?? ?? xxxx ???? ???? ?? 00 + + +Central directory: + + central file header signature 4 bytes (0x02014b50) + version made by 2 bytes + version needed to extract 2 bytes * + general purpose bit flag 2 bytes * + compression method 2 bytes * + last mod file time 2 bytes * + last mod file date 2 bytes * + crc-32 4 bytes * + compressed size 4 bytes * + uncompressed size 4 bytes * + file name length 2 bytes * + extra field length 2 bytes * + file comment length 2 bytes + disk number start 2 bytes + internal file attributes 2 bytes + external file attributes 4 bytes + relative offset of local header 4 bytes + + file name (variable size) + extra field (variable size) + file comment (variable size) + +|sig |vm|vx|g |c |d |t |crc |csz |usz |n |x |cm|dn|ia|xa |roff| + PK.. ## ## 00 00 ?? ?? xxxx ???? ???? ?? 00 00 00 00 xxxx ???? + +End of central directory: + + end of central dir signature 4 bytes (0x06054b50) + number of this disk 2 bytes + number of the disk with the + start of the central directory 2 bytes + total number of entries in the + central directory on this disk 2 bytes + total number of entries in + the central directory 2 bytes + size of the central directory 4 bytes + offset of start of central + directory with respect to + the starting disk number 4 bytes + .ZIP file comment length 2 bytes + .ZIP file comment (variable size) + +|sig |n1|n2|e |ne|size|off |cm| + PK.. 00 00 ?? ?? ???? ???? 00 diff --git a/commodoreclicker/js/thirdparty/jszip/docs/references.txt b/commodoreclicker/js/thirdparty/jszip/docs/references.txt new file mode 100644 index 00000000..9aab1820 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/docs/references.txt @@ -0,0 +1,18 @@ +Zip format +---------- +http://www.pkware.com/support/zip-application-note +http://www.xxcopy.com/xxcopy06.htm + +Data URL +-------- +https://developer.mozilla.org/en/The_data_URL_scheme +http://msdn.microsoft.com/en-us/library/cc848897(VS.85).aspx +http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/ + +http://www.motobit.com/util/base64-decoder-encoder.asp + +Saving files +------------ +http://msdn.microsoft.com/en-us/library/ms536676(VS.85).aspx +http://msdn.microsoft.com/en-us/library/ms536419(VS.85).aspx +http://msdn.microsoft.com/en-us/library/ms537418(VS.85).aspx diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/_layouts/default.html b/commodoreclicker/js/thirdparty/jszip/documentation/_layouts/default.html new file mode 100644 index 00000000..d1694cf4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/_layouts/default.html @@ -0,0 +1,158 @@ + + + + + + + + {{page.title}} + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + {% if page.section and page.fullpage != true %} +
    + + {% endif %} +
    +

    {{page.title}}

    + + + + + {{content}} + + + + +
    +
    +
    + + + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip.md new file mode 100644 index 00000000..1eb759cf --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip.md @@ -0,0 +1,15 @@ +--- +title: "JSZip API" +layout: default +section: api +--- + +An instance of JSZip represents a set of files. You can add them, remove them, +modify them. You can also import an existing zip file or generate one. + +### Attributes + +attribute name | type | description +---------------------|-------------|------------- +`files` | object | the [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html)s inside the zip with the name as key. See [file(name)]({{site.baseurl}}/documentation/api_jszip/file_name.html). +`comment` | string | the comment of the zip file. diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor.md new file mode 100644 index 00000000..55647379 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor.md @@ -0,0 +1,23 @@ +--- +title: "new JSZip() or JSZip()" +layout: default +section: api +--- + +__Description__ : Create a new JSZip instance. + +__Arguments__ : None + +__Returns__ : A new JSZip. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +// same as +var zip = JSZip(); +``` diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor_load.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor_load.md new file mode 100644 index 00000000..4e6f7ed5 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/constructor_load.md @@ -0,0 +1,22 @@ +--- +title: "new JSZip(data [,options]) or JSZip(data [,options])" +layout: default +section: api +--- + +This is a shortcut for + +```js +var zip = new JSZip(); +zip.load(data, options); +``` + +Please see the documentation of [load]({{site.baseurl}}/documentation/api_jszip/load.html). + +__Example__ + +```js +var zip = new JSZip(data, options); +// same as +var zip = JSZip(data, options); +``` diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_data.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_data.md new file mode 100644 index 00000000..e3e1d697 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_data.md @@ -0,0 +1,70 @@ +--- +title: "file(name, data [,options])" +layout: default +section: api +--- + +__Description__ : Add (or update) a file to the zip file. + +__Arguments__ + +name | type | description +--------------------|---------|------------ +name | string | the name of the file. You can specify folders in the name : the folder separator is a forward slash ("/"). +data | String/ArrayBuffer/Uint8Array/Buffer | the content of the file. +options | object | the options. + +Content of `options` : + +name | type | default | description +------------|---------|---------|------------ +base64 | boolean | `false` | set to `true` if the data is base64 encoded. For example image data from a `` element. Plain text and HTML do not need this option. +binary | boolean | `false` | set to `true` if the data should be treated as raw content, `false` if this is a text. If base64 is used, this defaults to `true`, if the data is not a string, this will be set to `true`. +date | date | the current date | the last modification date. +compression | string | null | If set, specifies compression method to use for this specific file. If not, the default file compression will be used, see [generate(options)]({{site.baseurl}}/documentation/api_jszip/generate.html). +comment | string | null | The comment for this file. +optimizedBinaryString | boolean | `false` | Set to true if (and only if) the input is a "binary string" and has already been prepared with a 0xFF mask. +createFolders | boolean | `false` | Set to true if folders in the file path should be automatically created, otherwise there will only be virtual folders that represent the path to the file. + +You shouldn't update the data given to this method : it is kept as it so any +update will impact the stored data. + +__Returns__ : The current JSZip object, for chaining. + +__Throws__ : An exception if the data is not in a supported format. + + + +__Example__ + +```js +zip.file("Hello.txt", "Hello World\n"); + +// base64 +zip.file("smile.gif", "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=", {base64: true}); +// from an ajax call with xhr.responseType = 'arraybuffer' +zip.file("smile.gif", arraybufferFromXhr); +// or on nodejs +zip.file("smile.gif", fs.readFileSync("smile.gif")); + +zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); +zip.file("folder/file.txt", "file in folder"); + +zip.file("animals.txt", "dog,platypus\n").file("people.txt", "james,sebastian\n"); + +// result : Hello.txt, smile.gif, Xmas.txt, animals.txt, people.txt, +// folder/, folder/file.txt +// In the above case, the "folder" folder will not have a 'D'irectory attribute or Method property. The +// folder only exists as part of the path to "file.txt". + +zip.file("folder/file.txt", "file in folder", {createFolders: true}); +// In this case, the "folder" folder WILL have a 'D'irectory attribute and a Method property of "store". +// It will exist whether or not "file.txt" is present. +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_name.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_name.md new file mode 100644 index 00000000..88b6d43c --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_name.md @@ -0,0 +1,46 @@ +--- +title: "file(name)" +layout: default +section: api +--- + +__Description__ : Get a file with the specified name. You can specify folders +in the name : the folder separator is a forward slash ("/"). + +__Arguments__ + +name | type | description +-----|--------|------------- +name | string | the name of the file. + +__Returns__ : An instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html) representing +the file if any, `null` otherwise. + +__Throws__ : Nothing. + + + +__Examples__ + +```js +var zip = new JSZip(); +zip.file("file.txt", "content"); + +zip.file("file.txt").name // "file.txt" +zip.file("file.txt").asText() // "content" +zip.file("file.txt").options.dir // false + +// utf8 example +var zip = new JSZip(zipFromAjaxWithUTF8); +zip.file("amount.txt").asText() // "€15" +zip.file("amount.txt").asArrayBuffer() // an ArrayBuffer containing €15 encoded as utf8 +zip.file("amount.txt").asUint8Array() // an Uint8Array containing €15 encoded as utf8 + +// with folders +zip.folder("sub").file("file.txt", "content"); +zip.file("sub/file.txt"); // the file +// or +zip.folder("sub").file("file.txt") // the file +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_regex.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_regex.md new file mode 100644 index 00000000..5dd24163 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/file_regex.md @@ -0,0 +1,49 @@ +--- +title: "file(regex)" +layout: default +section: api +--- + +__Description__ : Search a file in the current folder and subfolders with a +[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). +The regex is tested against the relative filename. + +__Arguments__ + +name | type | description +------|--------|------------ +regex | RegExp | the regex to use. + +__Returns__ : An array of matching files (an empty array if none matched). Each +maching file is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.file("file1.txt", "content"); +zip.file("file2.txt", "content"); + +zip.file(/file/); // array of size 2 + +// example with a relative path : +var folder = zip.folder("sub"); +folder + .file("file3.txt", "content") // relative path from folder : file3.txt + .file("file4.txt", "content"); // relative path from folder : file4.txt + +folder.file(/file/); // array of size 2 +folder.file(/^file/); // array of size 2, the relative paths start with file + +// arrays contain objects in the form: +// {name: "file2.txt", dir: false, asText : function () {...}, ...} +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/filter.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/filter.md new file mode 100644 index 00000000..3afc435b --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/filter.md @@ -0,0 +1,43 @@ +--- +title: "filter(predicate)" +layout: default +section: api +--- + +__Description__ : Filter nested files/folders with the specified function. + +__Arguments__ + +name | type | description +----------|----------|------------ +predicate | function | the predicate to use. + +The predicate has the following signature : `function (relativePath, file) {...}` : + +name | type | description +-------------|-----------|------------ +relativePath | string | the filename and its path, reliatively to the current folder. +file | ZipObject | the file being tested. See [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +The predicate must return true if the file should be included, false otherwise. + + +__Returns__ : An array of matching ZipObject. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip().folder("dir"); +zip.file("readme.txt", "content"); +zip.filter(function (relativePath, file){ + // relativePath == "readme.txt" + // file = {name:"dir/readme.txt",options:{...},asText:function} + return true/false; +}); +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_data.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_data.md new file mode 100644 index 00000000..3cd0c091 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_data.md @@ -0,0 +1,31 @@ +--- +title: "folder(name)" +layout: default +section: api +--- + +__Description__ : Add a directory to the zip file. + +__Arguments__ + +name | type | description +-----|--------|------------ +name | string | the name of the directory. + +__Returns__ : A new JSZip (for chaining), with the new folder as root. + +__Throws__ : Nothing. + + + +__Example__ + +```js +zip.folder("images"); +zip.folder("css").file("style.css", "body {background: #FF0000}"); +// or specify an absolute path (using forward slashes) +zip.file("css/font.css", "body {font-family: sans-serif}") + +// result : images/, css/, css/style.css, css/font.css +``` + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_regex.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_regex.md new file mode 100644 index 00000000..8d9e0213 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/folder_regex.md @@ -0,0 +1,40 @@ +--- +title: "folder(regex)" +layout: default +section: api +--- + +__Description__ : Search a subdirectory in the current directory with a +[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions). +The regex is tested against the relative path. + +__Arguments__ + +name | type | description +------|--------|------------ +regex | RegExp | the regex to use. + +__Returns__ : An array of matching folders (an empty array if none matched). +Each maching folder is an instance of [ZipObject]({{site.baseurl}}/documentation/api_zipobject.html). + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.folder("home/Pierre/videos"); +zip.folder("home/Pierre/photos"); +zip.folder("home/Jean/videos"); +zip.folder("home/Jean/photos"); + +zip.folder(/videos/); // array of size 2 + +zip.folder("home/Jean").folder(/^vid/); // array of 1 +``` + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/generate.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/generate.md new file mode 100644 index 00000000..6623f923 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/generate.md @@ -0,0 +1,63 @@ +--- +title: "generate(options)" +layout: default +section: api +--- + +__Description__ : Generates the complete zip file. + +__Arguments__ + +name | type | default | description +--------------------|---------|---------|------------ +options | object | | the options to generate the zip file : +options.base64 | boolean | false | **deprecated**, use `type` instead. If `type` is not used, set to `false` to get the result as a raw byte string, `true` to encode it as base64. +options.compression | string | `STORE` (no compression) | the default file compression method to use. Available methods are `STORE` and `DEFLATE`. You can also provide your own compression method. +options.type | string | `base64` | The type of zip to return, see below for the other types. +options.comment | string | | The comment to use for the zip file. + +Possible values for `type` : + +* `base64` (default) : the result will be a string, the binary in a base64 form. +* `string` : the result will be a string in "binary" form, using 1 byte per char (2 bytes). +* `uint8array` : the result will be a Uint8Array containing the zip. This requires a compatible browser. +* `arraybuffer` : the result will be a ArrayBuffer containing the zip. This requires a compatible browser. +* `blob` : the result will be a Blob containing the zip. This requires a compatible browser. +* `nodebuffer` : the result will be a nodejs Buffer containing the zip. This requires nodejs. + +Note : when using type = "uint8array", "arraybuffer" or "blob", be sure to +check if the browser supports it (you can use [`JSZip.support`]({{site.baseurl}}/documentation/api_jszip/support.html)). + +Note for the `comment` option : the zip format has no flag or field to give the +encoding of this field and JSZip will use UTF-8. With non ASCII characters you +might get encoding issues if the file archiver doesn't use UTF-8 to decode the +comment. + +If not set, JSZip will use the field `comment` on its `options`. + +__Returns__ : The generated zip file. + +__Throws__ : An exception if the asked `type` is not available in the browser, +see [JSZip.support]({{site.baseurl}}/documentation/api_jszip/support.html). + + + +__Example__ + +```js +var content = zip.generate({type:"blob"}); +// see FileSaver.js +saveAs(content, "hello.zip"); +``` + +```js +var content = zip.generate({type:"base64"}); +location.href="data:application/zip;base64,"+content; +``` + +```js +var content = zip.generate({type:"nodebuffer"}); +require("fs").writeFile("hello.zip", content, function(err){/*...*/}); +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/load.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/load.md new file mode 100644 index 00000000..a2f54ad1 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/load.md @@ -0,0 +1,81 @@ +--- +title: "load(data [, options])" +layout: default +section: api +--- + +__Description__ : Read an existing zip and merge the data in the current JSZip +object at the current folder level. This technique has some limitations, see +[here]({{site.baseurl}}/documentation/limitations.html). + +__Arguments__ + +name | type | description +-------------------|--------|------------ +data | String/ArrayBuffer/Uint8Array/Buffer | the zip file +options | object | the options to load the zip file + +Content of `options` : + +name | type | default | description +------------------------------|---------|---------|------------ +options.base64 | boolean | false | set to `true` if the data is base64 encoded, `false` for binary. +options.checkCRC32 | boolean | false | set to `true` if the read data should be checked against its CRC32. +options.optimizedBinaryString | boolean | false | set to true if (and only if) the input is a string and has already been prepared with a 0xFF mask. +options.createFolders | boolean | false | set to true to create folders in the file path automatically. Leaving it false will result in only virtual folders (i.e. folders that merely represent part of the file path) being created. + +You shouldn't update the data given to this method : it is kept as it so any +update will impact the stored data. + +Zip features supported by this method : + +* Compression (DEFLATE supported) +* zip with data descriptor +* ZIP64 +* UTF8 in file name, UTF8 in file content + +Zip features not (yet) supported : + +* password protected zip +* multi-volume zip + +__Returns__ : The current JSZip object. + +__Throws__ : An exception if the loaded data is not valid zip data or if it +uses features (multi volume, password protected, etc). + + + +__Example__ + +```js +var zip = new JSZip(); +zip.load(zipDataFromXHR); +``` + +```js +require("fs").readFile("hello.zip", function (err, data) { + if (err) throw err; + var zip = new JSZip(); + zip.load(data); +} +``` + +Using sub folders : + +```js +var zip = new JSZip(); +zip.folder("subfolder").load(data); +// the content of data will be loaded in subfolder/ +``` + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/remove.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/remove.md new file mode 100644 index 00000000..af7aa78c --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/remove.md @@ -0,0 +1,37 @@ +--- +title: "remove(name)" +layout: default +section: api +--- + +__Description__ : Delete a file or folder (recursively). + +__Arguments__ + +name | type | description +-----|--------|------------ +name | string | the name of the file/folder to delete. + +__Returns__ : The current JSZip object. + +__Throws__ : Nothing. + + + +__Example__ + +```js +var zip = new JSZip(); +zip.file("Hello.txt", "Hello World\n"); +zip.file("temp.txt", "nothing").remove("temp.txt"); +// result : Hello.txt + +zip.folder("css").file("style.css", "body {background: #FF0000}"); +zip.remove("css"); +//result : empty zip +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/support.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/support.md new file mode 100644 index 00000000..73d076f2 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_jszip/support.md @@ -0,0 +1,16 @@ +--- +title: "JSZip.support" +layout: default +section: api +--- + +If the browser supports them, JSZip can take advantage of some "new" features : +ArrayBuffer, Blob, Uint8Array. To know if JSZip can use them, you can check the +JSZip.support object. It contains the following boolean properties : + +* `arraybuffer` : true if JSZip can read and generate ArrayBuffer, false otherwise. +* `uint8array` : true if JSZip can read and generate Uint8Array, false otherwise. +* `blob` : true if JSZip can generate Blob, false otherwise. +* `nodebuffer` : true if JSZip can read and generate nodejs Buffer, false otherwise. + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/api_zipobject.md b/commodoreclicker/js/thirdparty/jszip/documentation/api_zipobject.md new file mode 100644 index 00000000..0078be54 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/api_zipobject.md @@ -0,0 +1,35 @@ +--- +title: "ZipObject API" +layout: default +section: api +--- + +This represents an entry in the zip file. If the entry comes from an existing +archive previously [loaded]({{site.baseurl}}/documentation/api_jszip/load.html), the content +will be automatically decompressed/converted first. + +### Attributes + +attribute name | type | description +----------------------------|-------------|------------- +`name` | string | the absolute path of the file +`dir` | boolean | true if this is a directory +`date` | date | the last modification date +`comment` | string | the comment for this file +`options` | object | the options of the file. The available options are : +`options.base64` | boolean | **Deprecated**, see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.binary` | boolean | **Deprecated**, see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.dir` | boolean | **Deprecated**, use `dir`. True if this is a directory +`options.date` | date | **Deprecated**, use `date`. See [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) +`options.compression` | compression | see [file(name, data [,options])]({{site.baseurl}}/documentation/api_jszip/file_data.html) + + +### Getters + +method | return type | description +------------------|---------------|------------- +`asText()` | string | the content as an unicode string. +`asBinary()` | string | the content as binary string. +`asArrayBuffer()` | ArrayBuffer | need a [compatible browser]({{site.baseurl}}/documentation/api_jszip/support.html). +`asUint8Array()` | Uint8Array | need a [compatible browser]({{site.baseurl}}/documentation/api_jszip/support.html). +`asNodeBuffer()` | nodejs Buffer | need [nodejs]({{site.baseurl}}/documentation/api_jszip/support.html). diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/contributing.md b/commodoreclicker/js/thirdparty/jszip/documentation/contributing.md new file mode 100644 index 00000000..f1b5dd32 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/contributing.md @@ -0,0 +1,62 @@ +--- +title: Contributing +layout: default +section: main +--- + + +### Download the sources + +You should create a [Github](https://github.com/) account and +[fork the repository](https://help.github.com/articles/fork-a-repo) (you will +need one to create the pull request). + +If you just want the get the source code, you can use git and do +`git clone https://github.com/Stuk/jszip.git` to get the sources. You can also +download the latest sources [here](https://github.com/Stuk/jszip/archive/master.zip). + +### Building the project + +#### Code + +The dependencies are handled by npm, the first step is to run +`npm install` to get the dependencies. +JSZip uses Grunt to handle the build, [see here to install its CLI](http://gruntjs.com/getting-started). + +Here are the interesting build commands : + +* `grunt` will generate the final js file in dist/ and the minified version. +* `npm run test-node` will run the tests in nodejs. +* `npm run test-browser` will the tests in some browsers using SauceLabs, see + below. +* `npm run test` will run the tests in nodejs and in the browser. +* `npm run lint` will use jshint the check the source code. + +#### Documentation + +The documentation uses jekyll on gh-pages. To render the documentation, you +need to [install jekyll](http://jekyllrb.com/docs/installation/) and then run +`jekyll serve --baseurl ''`. + +### Testing the project + +To test JSZip in nodejs, use `npm run test-node`. + +To test JSZip in a browser, you can open the file `test/index.html` in the +browser you want to test. Don't forget to update the dist/ files with `grunt`. + +You can also test JSZip in a lot of browsers at once with +[SauceLabs](https://saucelabs.com/). You will need a SauceLabs account and two +variables into your environment. On linux, just use + +```bash +export SAUCE_USERNAME=your-saucelabs-username +export SAUCE_ACCESS_KEY=your-saucelabs-access-key +``` + +before running the `npm run test-browser` command. + +### Merging the changes + +If you have tested bug fixes or new features, you can open a +[pull request](https://help.github.com/articles/using-pull-requests) on Github. diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/css/main.css b/commodoreclicker/js/thirdparty/jszip/documentation/css/main.css new file mode 100644 index 00000000..f2a368c9 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/css/main.css @@ -0,0 +1,24 @@ +ul.nav ul { + list-style:none; + margin: 0; + padding: 0 0 0 25px; +} + +#downloader_application form { + margin-bottom: 10px; +} + +#downloader_application ul { + list-style-type: none; +} + +.browser_support th { + border-bottom-width: 3px !important; +} + +.support_ie {border-bottom-color: #0275BA !important;} +.support_ff {border-bottom-color: #DF7215 !important;} +.support_sf {border-bottom-color: #43B3E9 !important;} +.support_cr {border-bottom-color: #39B642 !important;} +.support_op {border-bottom-color: #C42122 !important;} +.support_nd {border-bottom-color: #8CC84B !important;} diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/css/pygments.css b/commodoreclicker/js/thirdparty/jszip/documentation/css/pygments.css new file mode 100644 index 00000000..2086339a --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/css/pygments.css @@ -0,0 +1,64 @@ +/* Generated with : + * pygmentize -S default -f html > pygments.css + */ +.hll { background-color: #ffffcc } +.c { color: #408080; font-style: italic } /* Comment */ +.err { border: 1px solid #FF0000 } /* Error */ +.k { color: #008000; font-weight: bold } /* Keyword */ +.o { color: #666666 } /* Operator */ +.cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.cp { color: #BC7A00 } /* Comment.Preproc */ +.c1 { color: #408080; font-style: italic } /* Comment.Single */ +.cs { color: #408080; font-style: italic } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #888888 } /* Generic.Output */ +.gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0044DD } /* Generic.Traceback */ +.kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #008000 } /* Keyword.Pseudo */ +.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #B00040 } /* Keyword.Type */ +.m { color: #666666 } /* Literal.Number */ +.s { color: #BA2121 } /* Literal.String */ +.na { color: #7D9029 } /* Name.Attribute */ +.nb { color: #008000 } /* Name.Builtin */ +.nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.no { color: #880000 } /* Name.Constant */ +.nd { color: #AA22FF } /* Name.Decorator */ +.ni { color: #999999; font-weight: bold } /* Name.Entity */ +.ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.nf { color: #0000FF } /* Name.Function */ +.nl { color: #A0A000 } /* Name.Label */ +.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.nt { color: #008000; font-weight: bold } /* Name.Tag */ +.nv { color: #19177C } /* Name.Variable */ +.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #666666 } /* Literal.Number.Float */ +.mh { color: #666666 } /* Literal.Number.Hex */ +.mi { color: #666666 } /* Literal.Number.Integer */ +.mo { color: #666666 } /* Literal.Number.Oct */ +.sb { color: #BA2121 } /* Literal.String.Backtick */ +.sc { color: #BA2121 } /* Literal.String.Char */ +.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #BA2121 } /* Literal.String.Double */ +.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.sh { color: #BA2121 } /* Literal.String.Heredoc */ +.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.sx { color: #008000 } /* Literal.String.Other */ +.sr { color: #BB6688 } /* Literal.String.Regex */ +.s1 { color: #BA2121 } /* Literal.String.Single */ +.ss { color: #19177C } /* Literal.String.Symbol */ +.bp { color: #008000 } /* Name.Builtin.Pseudo */ +.vc { color: #19177C } /* Name.Variable.Class */ +.vg { color: #19177C } /* Name.Variable.Global */ +.vi { color: #19177C } /* Name.Variable.Instance */ +.il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples.md b/commodoreclicker/js/thirdparty/jszip/documentation/examples.md new file mode 100644 index 00000000..01d6e2d0 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples.md @@ -0,0 +1,115 @@ +--- +title: "How to use JSZip" +layout: default +section: example +--- + +An instance of JSZip represents a set of files. You can add them, remove them, +modify them. You can also import an existing zip file or generate one. + +### Getting the object + +#### In a browser + +For a browser, there are two interesting files : `dist/jszip.js` and +`dist/jszip.min.js` (include just one). + +If you use an AMD loader (RequireJS for example) JSZip will register itself : +you just have to put the js file at the right place, or configure the loader +(see [here for RequireJS](http://requirejs.org/docs/api.html#config-paths)). + +Without any loader, JSZip will declare in the global scope a variable named `JSZip`. + +#### In nodejs + +In nodejs, you can `require` it : + +```js +var JSZip = require("jszip"); +``` + +### Basic manipulations + +The first step is to create an instance of JSZip : + +```js +var zip = new JSZip(); +``` + +On this instance, we can add (and update) files and folders with +`.file(name, content)` and `.folder(name)`. +They return the current JSZip instance so you can chain the calls. + +```js +// create a file +zip.file("hello.txt", "Hello[p my)6cxsw2q"); +// oops, cat on keyboard. Fixing ! +zip.file("hello.txt", "Hello World\n"); + +// create a file and a folder +zip.file("nested/hello.txt", "Hello World\n"); +// same as +zip.folder("nested").file("hello.txt", "Hello World\n"); +``` + +With `.folder(name)`, the returned object has a different root : if you add files +on this object, you will put them in the created subfolder. This is just a +view, the added files will also be in the "root" object. + +```js +var photoZip = zip.folder("photos"); +// this call will create photos/README +photoZip.file("README", "a folder with photos"); +``` + +You can access the file content with `.file(name)` and +[its getters]({{site.baseurl}}/documentation/api_zipobject.html) : + +```js +zip.file("hello.txt").asText(); // "Hello World\n" + +if (JSZip.support.uint8array) { + zip.file("hello.txt").asUint8Array(); // Uint8Array { 0=72, 1=101, 2=108, more...} +} +``` + +You can also remove files or folders with `.remove(name)` : + +```js +zip.remove("photos/README"); +zip.remove("photos"); +// same as +zip.remove("photos"); // by removing the folder, you also remove its content. +``` + +### Generate a zip file + +With `.generate(options)` you can generate a zip file (not a real file but its +representation in memory). Check +[this page]({{site.baseurl}}/documentation/howto/write_zip.html) for more +informations on how to write / give the file to the user. + +```js +var content = null; +if (JSZip.support.uint8array) { + content = zip.generate({type : "uint8array"}); +} else { + content = zip.generate({type : "string"}); +} +``` + +### Read a zip file + +With `.load(data)` you can load a zip file. Check +[this page]({{site.baseurl}}/documentation/howto/read_zip.html) to see how to +do properly (it's more tricky that it seems). + +```js +var new_zip = new JSZip(); +// more files ! +new_zip.load(content); + +// you now have every files contained in the loaded zip +new_zip.file("hello.txt").asText(); // "Hello World\n" +``` + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples/download-zip-file.html b/commodoreclicker/js/thirdparty/jszip/documentation/examples/download-zip-file.html new file mode 100644 index 00000000..869a54e0 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples/download-zip-file.html @@ -0,0 +1,59 @@ +--- +title: "Download the generated zip file" +layout: default +section: example +--- + +

    Tip : check the source of the page !

    +

    The FileSaver API

    +
    + Works on firefox, chrome , opera >= 15 and IE >= 10 (but NOT in compatibility view).
    + +
    +

    The data URL

    +
    + Does not work in IE, has restrictions on the length.
    + +
    + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.html b/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.html new file mode 100644 index 00000000..e3589dbe --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.html @@ -0,0 +1,58 @@ +--- +title: "Mini app : Downloader" +layout: default +section: example +--- + +

    Tip : check the source of the page !

    + +

    + This mini application let you choose the files you want in a list, download + them, zip them and give the result to the user. +

    +

    + This demo requires a recent browser, see + the howto. +

    + + + +
    +

    Please select your files

    +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    + + +
    + +

    + + +
    + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.js b/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.js new file mode 100644 index 00000000..13903ccd --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples/downloader.js @@ -0,0 +1,89 @@ +jQuery(function ($) { + "use strict"; + + /** + * Reset the message. + */ + function resetMessage () { + $("#result") + .removeClass() + .text(""); + } + /** + * show a successful message. + * @param {String} text the text to show. + */ + function showMessage(text) { + resetMessage(); + $("#result") + .addClass("alert alert-success") + .text(text); + } + /** + * show an error message. + * @param {String} text the text to show. + */ + function showError(text) { + resetMessage(); + $("#result") + .addClass("alert alert-danger") + .text(text); + } + + /** + * Fetch the content, add it to the JSZip object + * and use a jQuery deferred to hold the result. + * @param {String} url the url of the content to fetch. + * @param {String} filename the filename to use in the JSZip object. + * @param {JSZip} zip the JSZip instance. + * @return {jQuery.Deferred} the deferred containing the data. + */ + function deferredAddZip(url, filename, zip) { + var deferred = $.Deferred(); + JSZipUtils.getBinaryContent(url, function (err, data) { + if(err) { + deferred.reject(err); + } else { + zip.file(filename, data, {binary:true}); + deferred.resolve(data); + } + }); + return deferred; + } + + if(!JSZip.support.blob) { + showError("This demo works only with a recent browser !"); + return; + } + + var $form = $("#download_form").on("submit", function () { + + resetMessage(); + + var zip = new JSZip(); + var deferreds = []; + + // find every checked item + $(this).find(":checked").each(function () { + var $this = $(this); + var url = $this.data("url"); + var filename = url.replace(/.*\//g, ""); + deferreds.push(deferredAddZip(url, filename, zip)); + }); + + // when everything has been downloaded, we can trigger the dl + $.when.apply($, deferreds).done(function () { + var blob = zip.generate({type:"blob"}); + + // see FileSaver.js + saveAs(blob, "example.zip"); + + showMessage("done !"); + }).fail(function (err) { + showError(err); + }); + return false; + }); +}); + +// vim: set shiftwidth=4 softtabstop=4: diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples/get-binary-files-ajax.html b/commodoreclicker/js/thirdparty/jszip/documentation/examples/get-binary-files-ajax.html new file mode 100644 index 00000000..ee7594e4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples/get-binary-files-ajax.html @@ -0,0 +1,43 @@ +--- +title: "Get a file with an ajax call" +layout: default +section: example +--- + +

    Tip : check the source of the page !

    + +

    With JSZipUtils

    +
    + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/examples/read-local-file-api.html b/commodoreclicker/js/thirdparty/jszip/documentation/examples/read-local-file-api.html new file mode 100644 index 00000000..da307c22 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/examples/read-local-file-api.html @@ -0,0 +1,87 @@ +--- +title: "Reading a local file with the File API" +layout: default +section: example +--- + +

    Choose the local(s) zip file(s)

    +

    Note : your browser will process the zip file, don't choose a file too big !

    +
    + + + + + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/faq.md b/commodoreclicker/js/thirdparty/jszip/documentation/faq.md new file mode 100644 index 00000000..57059e29 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/faq.md @@ -0,0 +1,19 @@ +--- +title: "Frequently Asked Questions" +layout: default +section: main +--- + +### "Corrupted zip or bug : unexpected signature" + +If you are sure that the zip file is correct, that error often comes from a +corrupted content. An ajax request, if not prepared correctly, will try to +decode the binary content as a text and corrupt it. See +[this page]({{site.baseurl}}/documentation/howto/read_zip.html). + +### My browser crashes / becomes unresponsive / never finish the execution + +That happens if you try to handle to much data. If possible, try again with a +small (some KB) zip file to see if your code is correct. See +[this page]({{site.baseurl}}/documentation/limitations.html) for more +informations. diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/howto/read_zip.md b/commodoreclicker/js/thirdparty/jszip/documentation/howto/read_zip.md new file mode 100644 index 00000000..48a52407 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/howto/read_zip.md @@ -0,0 +1,152 @@ +--- +title: "How to read a file" +layout: default +section: example +--- + +This page explains how to read an existing zip file or add a existing file into +the zip file. + + +### In the browser + +#### AJAX request + +Getting binary data with an ajax request is hard (mainly because of IE <= 9). +The easy way is to use [JSZipUtils.getBinaryContent](https://github.com/stuk/jszip-utils). +With JSZipUtils.getBinaryContent, you can do the following (see the +documentation for more examples) : + +```js +JSZipUtils.getBinaryContent('path/to/content.zip', function(err, data) { + if(err) { + throw err; // or handle err + } + + var zip = new JSZip(data); +}); +``` + +
    + +If you need to adapt an existing solution to what getBinaryContent does, here +are the details. When doing a XHR request (level 1, without setting the +`responseType`) the browser will try to interpret the response as a string and +decode it from its charset. To avoid this on Firefox/Chrome/Opera, you need to +set mime type : `xhr.overrideMimeType("text/plain; charset=x-user-defined");`. +On IE <= 9, this is harder. The overrideMimeType trick doesn't work so we need +to use [vbscript](http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest) +and non standard attributes. +On IE > 9, overrideMimeType doesn't work but xhr2 does. + +With [xhr 2](http://caniuse.com/xhr2), you can just set the responseType +attribute : `xhr.responseType = "arraybuffer";`. With this, the browser will +return an ArrayBuffer. + +#### Local files + +If the browser supports the [FileReader API](http://caniuse.com/filereader), +you can use it to read a zip file. JSZip can read ArrayBuffer, so you can use +`FileReader.readAsArrayBuffer(Blob)`, see this [example]({{site.baseurl}}/documentation/examples/read-local-file-api.html). + +### In nodejs + +JSZip can read Buffers so you can do the following : + +#### Local file + +```js +"use strict"; + +var fs = require("fs"); +var JSZip = require("jszip"); + +// read a zip file +fs.readFile("test.zip", function(err, data) { + if (err) throw err; + var zip = new JSZip(data); +}); + +// read a file and add it to a zip +fs.readFile("picture.png", function(err, data) { + if (err) throw err; + var zip = new JSZip(); + zip.file("picture.png", data); +}); +``` + +#### Remote file + +There are a lot of nodejs libraries doing http requests, from the built-in +[http](http://nodejs.org/docs/latest/api/http.html) to the +[npm packages](https://www.npmjs.org/browse/keyword/http). Here are two +examples, one with the default http API, the other with +[request](https://github.com/mikeal/request) (but you're free to use your +favorite library !). If possible, download the file as a Buffer (you will get +better performances). If it's not possible, you can fallback to a binary string +(the option is likely to be `encoding : "binary"`). + +##### With http : + +```js +"use strict"; + +var http = require("http"); +var url = require("url"); +var JSZip = require("jszip"); + +var req = http.get(url.parse("http://localhost/.../file.zip"), function (res) { + if (res.statusCode !== 200) { + console.log(res.statusCode); + // handle error + return; + } + var data = [], dataLen = 0; + + // don't set the encoding, it will break everything ! + // or, if you must, set it to null. In that case the chunk will be a string. + + res.on("data", function (chunk) { + data.push(chunk); + dataLen += chunk.length; + }); + + res.on("end", function () { + var buf = new Buffer(dataLen); + for (var i=0,len=data.length,pos=0; i + +#### Deprecated google gears + +[Franz Buchinger](http://www.picurl.org/blog/author/franz/) has written a +brilliant tutorial on [using JSZip with Google Gears](http://www.picurl.org/blog/2009/11/22/creating-zip-archives-with-gears) +([part 2](http://www.picurl.org/blog/2009/11/29/gearszipper-part2-adding-support-for-real-files-and-canvas-elements/)). +If you want to let your Gears users download several files at once I really +recommend having a look at some of his [examples](http://picurl.org/gears/zipper/). + + + +### In nodejs + +JSZip can generate Buffers so you can do the following : + +```js +var fs = require("fs"); +var JSZip = require("jszip"); + +var zip = new JSZip(); +// zip.file("file", content); +// ... and other manipulations + +var buffer = zip.generate({type:"nodebuffer"}); + +fs.writeFile("test.zip", buffer, function(err) { + if (err) throw err; +}); +``` + + diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/limitations.md b/commodoreclicker/js/thirdparty/jszip/documentation/limitations.md new file mode 100644 index 00000000..62db22e5 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/limitations.md @@ -0,0 +1,73 @@ +--- +title: "Limitations of JSZip" +layout: default +section: limitations +fullpage: true +--- + +### Not supported features + +All the features of zip files are not supported. Classic zip files will work +but encrypted zip, multi-volume, etc are not supported and the load() method +will throw an `Error`. + + +### ZIP64 and 32bit integers + +ZIP64 files can be loaded, but only if the zip file is not "too big". ZIP64 uses 64bits integers +but Javascript represents all numbers as +[64-bit double precision IEEE 754 floating point numbers](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf) +(see section 8.5). So, we have 53bits for integers and +[bitwise operations treat everything as 32bits](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators). +So if all the 64bits integers can fit into 32 bits integers, everything will be +fine. If it's not the case, you will have other problems anyway (see next +limitation). + +### Performance issues + +An other limitation comes from the browser (and the machine running the +browser). A compressed zip file of 10MB is "easily" opened by firefox / chrome +/ opera / IE10+ but will crash older IE. Also keep in mind that strings in +javascript are encoded in UTF-16 : a 10MB ascii text file will take 20MB of +memory. + +If you're having performance issues, please consider the following : + +* Don't use IE <= 9. Everything is better with typed arrays. +* Use typed arrays (Uint8Array, ArrayBuffer, etc) if possible : + * If you generate a zip file, you should use `type:"uint8array"` + (or blob, arraybuffer, nodebuffer). + * If you load the file from an ajax call, ask your XHR an ArrayBuffer. + Loading a string is asking for troubles. +* Don't use compression (see below). +* If you want to get the content of an ASCII file as a string, consider using + `asBinary()` instead of `asText()`. The transformation + "binary string" -> "unicode string" is a consuming process. + +Note about compression : +When reading a file, JSZip will store the content without decompressing it. +When generating a compressed file, JSZip will reuse if possible compressed +content : + +* If you read a zip file compressed with DEFLATE and call `generate` with the + DEFLATE compression, JSZip won't call the compression algorithms (same with + STORE everywhere.) +* If you read a zip file compressed with DEFLATE and call `generate` with the + STORE compression, JSZip will have to decompress everything. + +On IE <=9, typed arrays are not supported and the compression algorithm +will fallback on arrays. In that case, JSZip needs to convert the binary string +into an array, DEFLATE it and convert the result into a binary string. +You don't want that to happen. + +### The output zip will differ from the input zip + +Reading and generating a zip file won't give you back the same file. +Some data are discarded (file metadata) and other are added (subfolders). + +### Encodings support + +JSZip only supports utf8 : if the names of the files inside the zip are not in +utf8 (or ASCII), they won't be interpreted correctly. If the content is a text +not encoded with utf8 (or ASCII), the `asText()` method won't decode it +correctly. diff --git a/commodoreclicker/js/thirdparty/jszip/documentation/upgrade_guide.md b/commodoreclicker/js/thirdparty/jszip/documentation/upgrade_guide.md new file mode 100644 index 00000000..1dfac9c7 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/documentation/upgrade_guide.md @@ -0,0 +1,57 @@ +--- +title: Upgrade Guide +layout: default +section: main +--- + +### From 2.2.2 to 2.3.0 + +* On `ZipObject#options`, the attributes `date` and `dir` have been + deprecated and are now on `ZipObject`. +* On `ZipObject#options`, the attributes `base64` and `binary` have been + deprecated. +* `JSZip.base64`, `JSZip.prototype.crc32`, `JSZip.prototype.utf8decode`, + `JSZip.prototype.utf8encode` and `JSZip.utils` have been deprecated. + +```js +// deprecated +zip.file("test.txt").options.date +zip.file("test.txt").options.dir +// new API +zip.file("test.txt").date +zip.file("test.txt").dir +``` + + +### From 2.0.0 to 2.1.0 + +* The packaging changed : instead of loading jszip.js, jszip-load.js, + jszip-inflate.js, jszip-deflate.js, just include dist/jszip.js or + dist/jszip.min.js. + For AMD loader users : JSZip now registers itself. You just have to put the + file at the right place or configure your loader. + + +### From 1.x to 2.x + +* `JSZipBase64` has been renamed to `JSZip.base64`. +* The `data` attribute doesn't exist anymore : + use the getters `asText()`, `asBinary()`, etc +* The compression/decompression methods now give their input type with the + `compressInputType` and `uncompressInputType` attributes. + +Example for the data attribute : + +```js +// before +zip.file("test.txt").data; +zip.files["test.txt"].data; +zip.file("image.png").data; +zip.files["image.png"].data; + +// after +zip.file("test.txt").asText(); +zip.files["test.txt"].asText(); +zip.file("image.png").asBinary(); +zip.files["image.png"].asBinary(); +``` diff --git a/commodoreclicker/js/thirdparty/jszip/index.html b/commodoreclicker/js/thirdparty/jszip/index.html new file mode 100644 index 00000000..abdd2067 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/index.html @@ -0,0 +1,169 @@ +--- +title: JSZip +layout: default +section: main +--- + +
    +
    + +JSZip is a javascript library for creating, reading and editing .zip files, with a +lovely and simple API. + +
    +
    +

    + Current version : v2.4.0 +

    +

    + License : JSZip is dual-licensed. You may use it under the + MIT license or the GPLv3 license. See + LICENSE.markdown. +

    +
    + +
    +
    + +

    Example

    + + + + + + +
    +
    + +

    Installation

    + +

    + With npm : npm install jszip +

    +

    + With bower : bower install Stuk/jszip +

    +

    + With component : component install Stuk/jszip +

    +

    + Manually : download JSZip + and include the file dist/jszip.js or dist/jszip.min.js +

    +
    +

    + Installed ? Great ! You can now check our + guides and examples ! +

    +
    +
    + +

    Support

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OperaFirefoxSafariChromeInternet ExplorerNode.js
    YesYesYesYesYesYes
    Tested with the latest versionTested with 3.0 / 3.6 / latest versionTested with the latest versionTested with the latest versionTested with IE 6 / 7 / 8 / 9 / 10Tested with node.js 0.8 and 0.10
    + +

    Getting help

    + +

    +Having trouble ? We'd like to help ! +

    +
      +
    • + Try the FAQ, it has + answers to common questions. +
    • +
    • + If you're looking for informations about a specific method, try the + documentation. +
    • +
    • + Check the + examples. +
    • +
    • + Report bugs in our + Bug tracker. +
    • +
    + +

    Test status

    + +
    +
    Travis build :
    +
    + + + +
    +
    Saucelabs build :
    +
    + + + +
    +
    Live tests :
    +
    + See for yourself ! +
    +
    diff --git a/commodoreclicker/js/thirdparty/jszip/lib/base64.js b/commodoreclicker/js/thirdparty/jszip/lib/base64.js new file mode 100644 index 00000000..13b48634 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/base64.js @@ -0,0 +1,70 @@ +'use strict'; +// private property +var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + + +// public method for encoding +exports.encode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } + else if (isNaN(chr3)) { + enc4 = 64; + } + + output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); + + } + + return output; +}; + +// public method for decoding +exports.decode = function(input, utf8) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + while (i < input.length) { + + enc1 = _keyStr.indexOf(input.charAt(i++)); + enc2 = _keyStr.indexOf(input.charAt(i++)); + enc3 = _keyStr.indexOf(input.charAt(i++)); + enc4 = _keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output = output + String.fromCharCode(chr1); + + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + + } + + return output; + +}; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/compressedObject.js b/commodoreclicker/js/thirdparty/jszip/lib/compressedObject.js new file mode 100644 index 00000000..d6de504e --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/compressedObject.js @@ -0,0 +1,28 @@ +'use strict'; +function CompressedObject() { + this.compressedSize = 0; + this.uncompressedSize = 0; + this.crc32 = 0; + this.compressionMethod = null; + this.compressedContent = null; +} + +CompressedObject.prototype = { + /** + * Return the decompressed content in an unspecified format. + * The format will depend on the decompressor. + * @return {Object} the decompressed content. + */ + getContent: function() { + return null; // see implementation + }, + /** + * Return the compressed content in an unspecified format. + * The format will depend on the compressed conten source. + * @return {Object} the compressed content. + */ + getCompressedContent: function() { + return null; // see implementation + } +}; +module.exports = CompressedObject; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/compressions.js b/commodoreclicker/js/thirdparty/jszip/lib/compressions.js new file mode 100644 index 00000000..d9219e6d --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/compressions.js @@ -0,0 +1,13 @@ +'use strict'; +exports.STORE = { + magic: "\x00\x00", + compress: function(content) { + return content; // no compression + }, + uncompress: function(content) { + return content; // no compression + }, + compressInputType: null, + uncompressInputType: null +}; +exports.DEFLATE = require('./flate'); diff --git a/commodoreclicker/js/thirdparty/jszip/lib/crc32.js b/commodoreclicker/js/thirdparty/jszip/lib/crc32.js new file mode 100644 index 00000000..48d4a4a4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/crc32.js @@ -0,0 +1,102 @@ +'use strict'; + +var utils = require('./utils'); + +var table = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +]; + +/** + * + * Javascript crc32 + * http://www.webtoolkit.info/ + * + */ +module.exports = function crc32(input, crc) { + if (typeof input === "undefined" || !input.length) { + return 0; + } + + var isArray = utils.getTypeOf(input) !== "string"; + + if (typeof(crc) == "undefined") { + crc = 0; + } + var x = 0; + var y = 0; + var b = 0; + + crc = crc ^ (-1); + for (var i = 0, iTop = input.length; i < iTop; i++) { + b = isArray ? input[i] : input.charCodeAt(i); + y = (crc ^ b) & 0xFF; + x = table[y]; + crc = (crc >>> 8) ^ x; + } + + return crc ^ (-1); +}; +// vim: set shiftwidth=4 softtabstop=4: diff --git a/commodoreclicker/js/thirdparty/jszip/lib/dataReader.js b/commodoreclicker/js/thirdparty/jszip/lib/dataReader.js new file mode 100644 index 00000000..22e8cb38 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/dataReader.js @@ -0,0 +1,107 @@ +'use strict'; +var utils = require('./utils'); + +function DataReader(data) { + this.data = null; // type : see implementation + this.length = 0; + this.index = 0; +} +DataReader.prototype = { + /** + * Check that the offset will not go too far. + * @param {string} offset the additional offset to check. + * @throws {Error} an Error if the offset is out of bounds. + */ + checkOffset: function(offset) { + this.checkIndex(this.index + offset); + }, + /** + * Check that the specifed index will not be too far. + * @param {string} newIndex the index to check. + * @throws {Error} an Error if the index is out of bounds. + */ + checkIndex: function(newIndex) { + if (this.length < newIndex || newIndex < 0) { + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); + } + }, + /** + * Change the index. + * @param {number} newIndex The new index. + * @throws {Error} if the new index is out of the data. + */ + setIndex: function(newIndex) { + this.checkIndex(newIndex); + this.index = newIndex; + }, + /** + * Skip the next n bytes. + * @param {number} n the number of bytes to skip. + * @throws {Error} if the new index is out of the data. + */ + skip: function(n) { + this.setIndex(this.index + n); + }, + /** + * Get the byte at the specified index. + * @param {number} i the index to use. + * @return {number} a byte. + */ + byteAt: function(i) { + // see implementations + }, + /** + * Get the next number with a given byte size. + * @param {number} size the number of bytes to read. + * @return {number} the corresponding number. + */ + readInt: function(size) { + var result = 0, + i; + this.checkOffset(size); + for (i = this.index + size - 1; i >= this.index; i--) { + result = (result << 8) + this.byteAt(i); + } + this.index += size; + return result; + }, + /** + * Get the next string with a given byte size. + * @param {number} size the number of bytes to read. + * @return {string} the corresponding string. + */ + readString: function(size) { + return utils.transformTo("string", this.readData(size)); + }, + /** + * Get raw data without conversion, bytes. + * @param {number} size the number of bytes to read. + * @return {Object} the raw data, implementation specific. + */ + readData: function(size) { + // see implementations + }, + /** + * Find the last occurence of a zip signature (4 bytes). + * @param {string} sig the signature to find. + * @return {number} the index of the last occurence, -1 if not found. + */ + lastIndexOfSignature: function(sig) { + // see implementations + }, + /** + * Get the next date. + * @return {Date} the date. + */ + readDate: function() { + var dostime = this.readInt(4); + return new Date( + ((dostime >> 25) & 0x7f) + 1980, // year + ((dostime >> 21) & 0x0f) - 1, // month + (dostime >> 16) & 0x1f, // day + (dostime >> 11) & 0x1f, // hour + (dostime >> 5) & 0x3f, // minute + (dostime & 0x1f) << 1); // second + } +}; +module.exports = DataReader; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/defaults.js b/commodoreclicker/js/thirdparty/jszip/lib/defaults.js new file mode 100644 index 00000000..67ce2a69 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/defaults.js @@ -0,0 +1,8 @@ +'use strict'; +exports.base64 = false; +exports.binary = false; +exports.dir = false; +exports.createFolders = false; +exports.date = null; +exports.compression = null; +exports.comment = null; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/deprecatedPublicUtils.js b/commodoreclicker/js/thirdparty/jszip/lib/deprecatedPublicUtils.js new file mode 100644 index 00000000..0c6b9b8e --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/deprecatedPublicUtils.js @@ -0,0 +1,105 @@ +'use strict'; +var utils = require('./utils'); + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2binary = function(str) { + return utils.string2binary(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Uint8Array = function(str) { + return utils.transformTo("uint8array", str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.uint8Array2String = function(array) { + return utils.transformTo("string", array); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.string2Blob = function(str) { + var buffer = utils.transformTo("arraybuffer", str); + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.arrayBuffer2Blob = function(buffer) { + return utils.arrayBuffer2Blob(buffer); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.transformTo = function(outputType, input) { + return utils.transformTo(outputType, input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.getTypeOf = function(input) { + return utils.getTypeOf(input); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.checkSupport = function(type) { + return utils.checkSupport(type); +}; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; + +/** + * @deprecated + * This value will be removed in a future version without replacement. + */ +exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; + + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.pretty = function(str) { + return utils.pretty(str); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.findCompression = function(compressionMethod) { + return utils.findCompression(compressionMethod); +}; + +/** + * @deprecated + * This function will be removed in a future version without replacement. + */ +exports.isRegExp = function (object) { + return utils.isRegExp(object); +}; + diff --git a/commodoreclicker/js/thirdparty/jszip/lib/flate.js b/commodoreclicker/js/thirdparty/jszip/lib/flate.js new file mode 100644 index 00000000..58c117fe --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/flate.js @@ -0,0 +1,14 @@ +'use strict'; +var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); + +var pako = require("pako"); +exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; +exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; + +exports.magic = "\x08\x00"; +exports.compress = function(input) { + return pako.deflateRaw(input); +}; +exports.uncompress = function(input) { + return pako.inflateRaw(input); +}; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/index.js b/commodoreclicker/js/thirdparty/jszip/lib/index.js new file mode 100644 index 00000000..96c3389d --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/index.js @@ -0,0 +1,79 @@ +'use strict'; + +var base64 = require('./base64'); + +/** +Usage: + zip = new JSZip(); + zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); + zip.folder("images").file("smile.gif", base64Data, {base64: true}); + zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); + zip.remove("tempfile"); + + base64zip = zip.generate(); + +**/ + +/** + * Representation a of zip file in js + * @constructor + * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional). + * @param {Object=} options the options for creating this objects (optional). + */ +function JSZip(data, options) { + // if this constructor is used without `new`, it adds `new` before itself: + if(!(this instanceof JSZip)) return new JSZip(data, options); + + // object containing the files : + // { + // "folder/" : {...}, + // "folder/data.txt" : {...} + // } + this.files = {}; + + this.comment = null; + + // Where we are in the hierarchy + this.root = ""; + if (data) { + this.load(data, options); + } + this.clone = function() { + var newObj = new JSZip(); + for (var i in this) { + if (typeof this[i] !== "function") { + newObj[i] = this[i]; + } + } + return newObj; + }; +} +JSZip.prototype = require('./object'); +JSZip.prototype.load = require('./load'); +JSZip.support = require('./support'); +JSZip.defaults = require('./defaults'); + +/** + * @deprecated + * This namespace will be removed in a future version without replacement. + */ +JSZip.utils = require('./deprecatedPublicUtils'); + +JSZip.base64 = { + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + encode : function(input) { + return base64.encode(input); + }, + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + decode : function(input) { + return base64.decode(input); + } +}; +JSZip.compressions = require('./compressions'); +module.exports = JSZip; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/license_header.js b/commodoreclicker/js/thirdparty/jszip/lib/license_header.js new file mode 100644 index 00000000..b156bc76 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/license_header.js @@ -0,0 +1,11 @@ +/*! + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2014 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/master/LICENSE +*/ diff --git a/commodoreclicker/js/thirdparty/jszip/lib/load.js b/commodoreclicker/js/thirdparty/jszip/lib/load.js new file mode 100644 index 00000000..5b5f0953 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/load.js @@ -0,0 +1,29 @@ +'use strict'; +var base64 = require('./base64'); +var ZipEntries = require('./zipEntries'); +module.exports = function(data, options) { + var files, zipEntries, i, input; + options = options || {}; + if (options.base64) { + data = base64.decode(data); + } + + zipEntries = new ZipEntries(data, options); + files = zipEntries.files; + for (i = 0; i < files.length; i++) { + input = files[i]; + this.file(input.fileName, input.decompressed, { + binary: true, + optimizedBinaryString: true, + date: input.date, + dir: input.dir, + comment : input.fileComment.length ? input.fileComment : null, + createFolders: options.createFolders + }); + } + if (zipEntries.zipComment.length) { + this.comment = zipEntries.zipComment; + } + + return this; +}; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/nodeBuffer.js b/commodoreclicker/js/thirdparty/jszip/lib/nodeBuffer.js new file mode 100644 index 00000000..84694f6a --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/nodeBuffer.js @@ -0,0 +1,7 @@ +'use strict'; +module.exports = function(data, encoding){ + return new Buffer(data, encoding); +}; +module.exports.test = function(b){ + return Buffer.isBuffer(b); +}; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/nodeBufferReader.js b/commodoreclicker/js/thirdparty/jszip/lib/nodeBufferReader.js new file mode 100644 index 00000000..223bd0b9 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/nodeBufferReader.js @@ -0,0 +1,20 @@ +'use strict'; +var Uint8ArrayReader = require('./uint8ArrayReader'); + +function NodeBufferReader(data) { + this.data = data; + this.length = this.data.length; + this.index = 0; +} +NodeBufferReader.prototype = new Uint8ArrayReader(); + +/** + * @see DataReader.readData + */ +NodeBufferReader.prototype.readData = function(size) { + this.checkOffset(size); + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = NodeBufferReader; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/object.js b/commodoreclicker/js/thirdparty/jszip/lib/object.js new file mode 100644 index 00000000..c0bde644 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/object.js @@ -0,0 +1,768 @@ +'use strict'; +var support = require('./support'); +var utils = require('./utils'); +var crc32 = require('./crc32'); +var signature = require('./signature'); +var defaults = require('./defaults'); +var base64 = require('./base64'); +var compressions = require('./compressions'); +var CompressedObject = require('./compressedObject'); +var nodeBuffer = require('./nodeBuffer'); +var utf8 = require('./utf8'); +var StringWriter = require('./stringWriter'); +var Uint8ArrayWriter = require('./uint8ArrayWriter'); + +/** + * Returns the raw data of a ZipObject, decompress the content if necessary. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getRawData = function(file) { + if (file._data instanceof CompressedObject) { + file._data = file._data.getContent(); + file.options.binary = true; + file.options.base64 = false; + + if (utils.getTypeOf(file._data) === "uint8array") { + var copy = file._data; + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + file._data = new Uint8Array(copy.length); + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + if (copy.length !== 0) { + file._data.set(copy, 0); + } + } + } + return file._data; +}; + +/** + * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it. + * @param {ZipObject} file the file to use. + * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. + */ +var getBinaryData = function(file) { + var result = getRawData(file), + type = utils.getTypeOf(result); + if (type === "string") { + if (!file.options.binary) { + // unicode text ! + // unicode string => binary string is a painful process, check if we can avoid it. + if (support.nodebuffer) { + return nodeBuffer(result, "utf-8"); + } + } + return file.asBinary(); + } + return result; +}; + +/** + * Transform this._data into a string. + * @param {function} filter a function String -> String, applied if not null on the result. + * @return {String} the string representing this._data. + */ +var dataToString = function(asUTF8) { + var result = getRawData(this); + if (result === null || typeof result === "undefined") { + return ""; + } + // if the data is a base64 string, we decode it before checking the encoding ! + if (this.options.base64) { + result = base64.decode(result); + } + if (asUTF8 && this.options.binary) { + // JSZip.prototype.utf8decode supports arrays as input + // skip to array => string step, utf8decode will do it. + result = out.utf8decode(result); + } + else { + // no utf8 transformation, do the array => string step. + result = utils.transformTo("string", result); + } + + if (!asUTF8 && !this.options.binary) { + result = utils.transformTo("string", out.utf8encode(result)); + } + return result; +}; +/** + * A simple object representing a file in the zip file. + * @constructor + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data + * @param {Object} options the options of the file + */ +var ZipObject = function(name, data, options) { + this.name = name; + this.dir = options.dir; + this.date = options.date; + this.comment = options.comment; + + this._data = data; + this.options = options; + + /* + * This object contains initial values for dir and date. + * With them, we can check if the user changed the deprecated metadata in + * `ZipObject#options` or not. + */ + this._initialMetadata = { + dir : options.dir, + date : options.date + }; +}; + +ZipObject.prototype = { + /** + * Return the content as UTF8 string. + * @return {string} the UTF8 string. + */ + asText: function() { + return dataToString.call(this, true); + }, + /** + * Returns the binary content. + * @return {string} the content as binary. + */ + asBinary: function() { + return dataToString.call(this, false); + }, + /** + * Returns the content as a nodejs Buffer. + * @return {Buffer} the content as a Buffer. + */ + asNodeBuffer: function() { + var result = getBinaryData(this); + return utils.transformTo("nodebuffer", result); + }, + /** + * Returns the content as an Uint8Array. + * @return {Uint8Array} the content as an Uint8Array. + */ + asUint8Array: function() { + var result = getBinaryData(this); + return utils.transformTo("uint8array", result); + }, + /** + * Returns the content as an ArrayBuffer. + * @return {ArrayBuffer} the content as an ArrayBufer. + */ + asArrayBuffer: function() { + return this.asUint8Array().buffer; + } +}; + +/** + * Transform an integer into a string in hexadecimal. + * @private + * @param {number} dec the number to convert. + * @param {number} bytes the number of bytes to generate. + * @returns {string} the result. + */ +var decToHex = function(dec, bytes) { + var hex = "", + i; + for (i = 0; i < bytes; i++) { + hex += String.fromCharCode(dec & 0xff); + dec = dec >>> 8; + } + return hex; +}; + +/** + * Merge the objects passed as parameters into a new one. + * @private + * @param {...Object} var_args All objects to merge. + * @return {Object} a new object with the data of the others. + */ +var extend = function() { + var result = {}, i, attr; + for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers + for (attr in arguments[i]) { + if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { + result[attr] = arguments[i][attr]; + } + } + } + return result; +}; + +/** + * Transforms the (incomplete) options from the user into the complete + * set of options to create a file. + * @private + * @param {Object} o the options from the user. + * @return {Object} the complete set of options. + */ +var prepareFileAttrs = function(o) { + o = o || {}; + if (o.base64 === true && (o.binary === null || o.binary === undefined)) { + o.binary = true; + } + o = extend(o, defaults); + o.date = o.date || new Date(); + if (o.compression !== null) o.compression = o.compression.toUpperCase(); + + return o; +}; + +/** + * Add a file in the current folder. + * @private + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file + * @param {Object} o the options of the file + * @return {Object} the new file. + */ +var fileAdd = function(name, data, o) { + // be sure sub folders exist + var dataType = utils.getTypeOf(data), + parent; + + o = prepareFileAttrs(o); + + if (o.createFolders && (parent = parentFolder(name))) { + folderAdd.call(this, parent, true); + } + + if (o.dir || data === null || typeof data === "undefined") { + o.base64 = false; + o.binary = false; + data = null; + } + else if (dataType === "string") { + if (o.binary && !o.base64) { + // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask + if (o.optimizedBinaryString !== true) { + // this is a string, not in a base64 format. + // Be sure that this is a correct "binary string" + data = utils.string2binary(data); + } + } + } + else { // arraybuffer, uint8array, ... + o.base64 = false; + o.binary = true; + + if (!dataType && !(data instanceof CompressedObject)) { + throw new Error("The data of '" + name + "' is in an unsupported format !"); + } + + // special case : it's way easier to work with Uint8Array than with ArrayBuffer + if (dataType === "arraybuffer") { + data = utils.transformTo("uint8array", data); + } + } + + var object = new ZipObject(name, data, o); + this.files[name] = object; + return object; +}; + +/** + * Find the parent folder of the path. + * @private + * @param {string} path the path to use + * @return {string} the parent folder, or "" + */ +var parentFolder = function (path) { + if (path.slice(-1) == '/') { + path = path.substring(0, path.length - 1); + } + var lastSlash = path.lastIndexOf('/'); + return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; +}; + +/** + * Add a (sub) folder in the current folder. + * @private + * @param {string} name the folder's name + * @param {boolean=} [createFolders] If true, automatically create sub + * folders. Defaults to false. + * @return {Object} the new folder. + */ +var folderAdd = function(name, createFolders) { + // Check the name ends with a / + if (name.slice(-1) != "/") { + name += "/"; // IE doesn't like substr(-1) + } + + createFolders = (typeof createFolders !== 'undefined') ? createFolders : false; + + // Does this folder already exist? + if (!this.files[name]) { + fileAdd.call(this, name, null, { + dir: true, + createFolders: createFolders + }); + } + return this.files[name]; +}; + +/** + * Generate a JSZip.CompressedObject for a given zipOject. + * @param {ZipObject} file the object to read. + * @param {JSZip.compression} compression the compression to use. + * @return {JSZip.CompressedObject} the compressed result. + */ +var generateCompressedObjectFrom = function(file, compression) { + var result = new CompressedObject(), + content; + + // the data has not been decompressed, we might reuse things ! + if (file._data instanceof CompressedObject) { + result.uncompressedSize = file._data.uncompressedSize; + result.crc32 = file._data.crc32; + + if (result.uncompressedSize === 0 || file.dir) { + compression = compressions['STORE']; + result.compressedContent = ""; + result.crc32 = 0; + } + else if (file._data.compressionMethod === compression.magic) { + result.compressedContent = file._data.getCompressedContent(); + } + else { + content = file._data.getContent(); + // need to decompress / recompress + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + } + else { + // have uncompressed data + content = getBinaryData(file); + if (!content || content.length === 0 || file.dir) { + compression = compressions['STORE']; + content = ""; + } + result.uncompressedSize = content.length; + result.crc32 = crc32(content); + result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content)); + } + + result.compressedSize = result.compressedContent.length; + result.compressionMethod = compression.magic; + + return result; +}; + +/** + * Generate the various parts used in the construction of the final zip file. + * @param {string} name the file name. + * @param {ZipObject} file the file content. + * @param {JSZip.CompressedObject} compressedObject the compressed object. + * @param {number} offset the current offset from the start of the zip file. + * @return {object} the zip parts. + */ +var generateZipParts = function(name, file, compressedObject, offset) { + var data = compressedObject.compressedContent, + utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), + comment = file.comment || "", + utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), + useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, + useUTF8ForComment = utfEncodedComment.length !== comment.length, + o = file.options, + dosTime, + dosDate, + extraFields = "", + unicodePathExtraField = "", + unicodeCommentExtraField = "", + dir, date; + + + // handle the deprecated options.dir + if (file._initialMetadata.dir !== file.dir) { + dir = file.dir; + } else { + dir = o.dir; + } + + // handle the deprecated options.date + if(file._initialMetadata.date !== file.date) { + date = file.date; + } else { + date = o.date; + } + + // date + // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html + + dosTime = date.getHours(); + dosTime = dosTime << 6; + dosTime = dosTime | date.getMinutes(); + dosTime = dosTime << 5; + dosTime = dosTime | date.getSeconds() / 2; + + dosDate = date.getFullYear() - 1980; + dosDate = dosDate << 4; + dosDate = dosDate | (date.getMonth() + 1); + dosDate = dosDate << 5; + dosDate = dosDate | date.getDate(); + + if (useUTF8ForFileName) { + // set the unicode path extra field. unzip needs at least one extra + // field to correctly handle unicode path, so using the path is as good + // as any other information. This could improve the situation with + // other archive managers too. + // This field is usually used without the utf8 flag, with a non + // unicode path in the header (winrar, winzip). This helps (a bit) + // with the messy Windows' default compressed folders feature but + // breaks on p7zip which doesn't seek the unicode path extra field. + // So for now, UTF-8 everywhere ! + unicodePathExtraField = + // Version + decToHex(1, 1) + + // NameCRC32 + decToHex(crc32(utfEncodedFileName), 4) + + // UnicodeName + utfEncodedFileName; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x70" + + // size + decToHex(unicodePathExtraField.length, 2) + + // content + unicodePathExtraField; + } + + if(useUTF8ForComment) { + + unicodeCommentExtraField = + // Version + decToHex(1, 1) + + // CommentCRC32 + decToHex(this.crc32(utfEncodedComment), 4) + + // UnicodeName + utfEncodedComment; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x63" + + // size + decToHex(unicodeCommentExtraField.length, 2) + + // content + unicodeCommentExtraField; + } + + var header = ""; + + // version needed to extract + header += "\x0A\x00"; + // general purpose bit flag + // set bit 11 if utf8 + header += (useUTF8ForFileName || useUTF8ForComment) ? "\x00\x08" : "\x00\x00"; + // compression method + header += compressedObject.compressionMethod; + // last mod file time + header += decToHex(dosTime, 2); + // last mod file date + header += decToHex(dosDate, 2); + // crc-32 + header += decToHex(compressedObject.crc32, 4); + // compressed size + header += decToHex(compressedObject.compressedSize, 4); + // uncompressed size + header += decToHex(compressedObject.uncompressedSize, 4); + // file name length + header += decToHex(utfEncodedFileName.length, 2); + // extra field length + header += decToHex(extraFields.length, 2); + + + var fileRecord = signature.LOCAL_FILE_HEADER + header + utfEncodedFileName + extraFields; + + var dirRecord = signature.CENTRAL_FILE_HEADER + + // version made by (00: DOS) + "\x14\x00" + + // file header (common to file and central directory) + header + + // file comment length + decToHex(utfEncodedComment.length, 2) + + // disk number start + "\x00\x00" + + // internal file attributes TODO + "\x00\x00" + + // external file attributes + (dir === true ? "\x10\x00\x00\x00" : "\x00\x00\x00\x00") + + // relative offset of local header + decToHex(offset, 4) + + // file name + utfEncodedFileName + + // extra field + extraFields + + // file comment + utfEncodedComment; + + return { + fileRecord: fileRecord, + dirRecord: dirRecord, + compressedObject: compressedObject + }; +}; + + +// return the actual prototype of JSZip +var out = { + /** + * Read an existing zip and merge the data in the current JSZip object. + * The implementation is in jszip-load.js, don't forget to include it. + * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load + * @param {Object} options Options for loading the stream. + * options.base64 : is the stream in base64 ? default : false + * @return {JSZip} the current JSZip object + */ + load: function(stream, options) { + throw new Error("Load method is not defined. Is the file jszip-load.js included ?"); + }, + + /** + * Filter nested files/folders with the specified function. + * @param {Function} search the predicate to use : + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + * @return {Array} An array of matching elements. + */ + filter: function(search) { + var result = [], + filename, relativePath, file, fileClone; + for (filename in this.files) { + if (!this.files.hasOwnProperty(filename)) { + continue; + } + file = this.files[filename]; + // return a new object, don't let the user mess with our internal objects :) + fileClone = new ZipObject(file.name, file._data, extend(file.options)); + relativePath = filename.slice(this.root.length, filename.length); + if (filename.slice(0, this.root.length) === this.root && // the file is in the current root + search(relativePath, fileClone)) { // and the file matches the function + result.push(fileClone); + } + } + return result; + }, + + /** + * Add a file to the zip file, or search a file. + * @param {string|RegExp} name The name of the file to add (if data is defined), + * the name of the file to find (if no data) or a regex to match files. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded + * @param {Object} o File options + * @return {JSZip|Object|Array} this JSZip object (when adding a file), + * a file (when searching by string) or an array of files (when searching by regex). + */ + file: function(name, data, o) { + if (arguments.length === 1) { + if (utils.isRegExp(name)) { + var regexp = name; + return this.filter(function(relativePath, file) { + return !file.dir && regexp.test(relativePath); + }); + } + else { // text + return this.filter(function(relativePath, file) { + return !file.dir && relativePath === name; + })[0] || null; + } + } + else { // more than one argument : we have data ! + name = this.root + name; + fileAdd.call(this, name, data, o); + } + return this; + }, + + /** + * Add a directory to the zip file, or search. + * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. + * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. + */ + folder: function(arg) { + if (!arg) { + return this; + } + + if (utils.isRegExp(arg)) { + return this.filter(function(relativePath, file) { + return file.dir && arg.test(relativePath); + }); + } + + // else, name is a new folder + var name = this.root + arg; + var newFolder = folderAdd.call(this, name); + + // Allow chaining by returning a new object with this folder as the root + var ret = this.clone(); + ret.root = newFolder.name; + return ret; + }, + + /** + * Delete a file, or a directory and all sub-files, from the zip + * @param {string} name the name of the file to delete + * @return {JSZip} this JSZip object + */ + remove: function(name) { + name = this.root + name; + var file = this.files[name]; + if (!file) { + // Look for any folders + if (name.slice(-1) != "/") { + name += "/"; + } + file = this.files[name]; + } + + if (file && !file.dir) { + // file + delete this.files[name]; + } else { + // maybe a folder, delete recursively + var kids = this.filter(function(relativePath, file) { + return file.name.slice(0, name.length) === name; + }); + for (var i = 0; i < kids.length; i++) { + delete this.files[kids[i].name]; + } + } + + return this; + }, + + /** + * Generate the complete zip file + * @param {Object} options the options to generate the zip file : + * - base64, (deprecated, use type instead) true to generate base64. + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file + */ + generate: function(options) { + options = extend(options || {}, { + base64: true, + compression: "STORE", + type: "base64", + comment: null + }); + + utils.checkSupport(options.type); + + var zipData = [], + localDirLength = 0, + centralDirLength = 0, + writer, i, + utfEncodedComment = utils.transformTo("string", this.utf8encode(options.comment || this.comment || "")); + + // first, generate all the zip parts. + for (var name in this.files) { + if (!this.files.hasOwnProperty(name)) { + continue; + } + var file = this.files[name]; + + var compressionName = file.options.compression || options.compression.toUpperCase(); + var compression = compressions[compressionName]; + if (!compression) { + throw new Error(compressionName + " is not a valid compression method !"); + } + + var compressedObject = generateCompressedObjectFrom.call(this, file, compression); + + var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength); + localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize; + centralDirLength += zipPart.dirRecord.length; + zipData.push(zipPart); + } + + var dirEnd = ""; + + // end of central dir signature + dirEnd = signature.CENTRAL_DIRECTORY_END + + // number of this disk + "\x00\x00" + + // number of the disk with the start of the central directory + "\x00\x00" + + // total number of entries in the central directory on this disk + decToHex(zipData.length, 2) + + // total number of entries in the central directory + decToHex(zipData.length, 2) + + // size of the central directory 4 bytes + decToHex(centralDirLength, 4) + + // offset of start of central directory with respect to the starting disk number + decToHex(localDirLength, 4) + + // .ZIP file comment length + decToHex(utfEncodedComment.length, 2) + + // .ZIP file comment + utfEncodedComment; + + + // we have all the parts (and the total length) + // time to create a writer ! + var typeName = options.type.toLowerCase(); + if(typeName==="uint8array"||typeName==="arraybuffer"||typeName==="blob"||typeName==="nodebuffer") { + writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length); + }else{ + writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length); + } + + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].fileRecord); + writer.append(zipData[i].compressedObject.compressedContent); + } + for (i = 0; i < zipData.length; i++) { + writer.append(zipData[i].dirRecord); + } + + writer.append(dirEnd); + + var zip = writer.finalize(); + + + + switch(options.type.toLowerCase()) { + // case "zip is an Uint8Array" + case "uint8array" : + case "arraybuffer" : + case "nodebuffer" : + return utils.transformTo(options.type.toLowerCase(), zip); + case "blob" : + return utils.arrayBuffer2Blob(utils.transformTo("arraybuffer", zip)); + // case "zip is a string" + case "base64" : + return (options.base64) ? base64.encode(zip) : zip; + default : // case "string" : + return zip; + } + + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + crc32: function (input, crc) { + return crc32(input, crc); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8encode: function (string) { + return utils.transformTo("string", utf8.utf8encode(string)); + }, + + /** + * @deprecated + * This method will be removed in a future version without replacement. + */ + utf8decode: function (input) { + return utf8.utf8decode(input); + } +}; +module.exports = out; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/signature.js b/commodoreclicker/js/thirdparty/jszip/lib/signature.js new file mode 100644 index 00000000..4ee817b8 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/signature.js @@ -0,0 +1,7 @@ +'use strict'; +exports.LOCAL_FILE_HEADER = "PK\x03\x04"; +exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; +exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; +exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; +exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; +exports.DATA_DESCRIPTOR = "PK\x07\x08"; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/stringReader.js b/commodoreclicker/js/thirdparty/jszip/lib/stringReader.js new file mode 100644 index 00000000..895331e4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/stringReader.js @@ -0,0 +1,36 @@ +'use strict'; +var DataReader = require('./dataReader'); +var utils = require('./utils'); + +function StringReader(data, optimizedBinaryString) { + this.data = data; + if (!optimizedBinaryString) { + this.data = utils.string2binary(this.data); + } + this.length = this.data.length; + this.index = 0; +} +StringReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +StringReader.prototype.byteAt = function(i) { + return this.data.charCodeAt(i); +}; +/** + * @see DataReader.lastIndexOfSignature + */ +StringReader.prototype.lastIndexOfSignature = function(sig) { + return this.data.lastIndexOf(sig); +}; +/** + * @see DataReader.readData + */ +StringReader.prototype.readData = function(size) { + this.checkOffset(size); + // this will work because the constructor applied the "& 0xff" mask. + var result = this.data.slice(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = StringReader; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/stringWriter.js b/commodoreclicker/js/thirdparty/jszip/lib/stringWriter.js new file mode 100644 index 00000000..45db5484 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/stringWriter.js @@ -0,0 +1,30 @@ +'use strict'; + +var utils = require('./utils'); + +/** + * An object to write any content to a string. + * @constructor + */ +var StringWriter = function() { + this.data = []; +}; +StringWriter.prototype = { + /** + * Append any content to the current string. + * @param {Object} input the content to add. + */ + append: function(input) { + input = utils.transformTo("string", input); + this.data.push(input); + }, + /** + * Finalize the construction an return the result. + * @return {string} the generated string. + */ + finalize: function() { + return this.data.join(""); + } +}; + +module.exports = StringWriter; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/support.js b/commodoreclicker/js/thirdparty/jszip/lib/support.js new file mode 100644 index 00000000..b9bbb1f5 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/support.js @@ -0,0 +1,34 @@ +'use strict'; +exports.base64 = true; +exports.array = true; +exports.string = true; +exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; +// contains true if JSZip can read/generate nodejs Buffer, false otherwise. +// Browserify will provide a Buffer implementation for browsers, which is +// an augmented Uint8Array (i.e., can be used as either Buffer or U8). +exports.nodebuffer = typeof Buffer !== "undefined"; +// contains true if JSZip can read/generate Uint8Array, false otherwise. +exports.uint8array = typeof Uint8Array !== "undefined"; + +if (typeof ArrayBuffer === "undefined") { + exports.blob = false; +} +else { + var buffer = new ArrayBuffer(0); + try { + exports.blob = new Blob([buffer], { + type: "application/zip" + }).size === 0; + } + catch (e) { + try { + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + exports.blob = builder.getBlob('application/zip').size === 0; + } + catch (e) { + exports.blob = false; + } + } +} diff --git a/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayReader.js b/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayReader.js new file mode 100644 index 00000000..ce8d1a8b --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayReader.js @@ -0,0 +1,47 @@ +'use strict'; +var DataReader = require('./dataReader'); + +function Uint8ArrayReader(data) { + if (data) { + this.data = data; + this.length = this.data.length; + this.index = 0; + } +} +Uint8ArrayReader.prototype = new DataReader(); +/** + * @see DataReader.byteAt + */ +Uint8ArrayReader.prototype.byteAt = function(i) { + return this.data[i]; +}; +/** + * @see DataReader.lastIndexOfSignature + */ +Uint8ArrayReader.prototype.lastIndexOfSignature = function(sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3); + for (var i = this.length - 4; i >= 0; --i) { + if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { + return i; + } + } + + return -1; +}; +/** + * @see DataReader.readData + */ +Uint8ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. + return new Uint8Array(0); + } + var result = this.data.subarray(this.index, this.index + size); + this.index += size; + return result; +}; +module.exports = Uint8ArrayReader; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayWriter.js b/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayWriter.js new file mode 100644 index 00000000..405397f7 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/uint8ArrayWriter.js @@ -0,0 +1,36 @@ +'use strict'; + +var utils = require('./utils'); + +/** + * An object to write any content to an Uint8Array. + * @constructor + * @param {number} length The length of the array. + */ +var Uint8ArrayWriter = function(length) { + this.data = new Uint8Array(length); + this.index = 0; +}; +Uint8ArrayWriter.prototype = { + /** + * Append any content to the current array. + * @param {Object} input the content to add. + */ + append: function(input) { + if (input.length !== 0) { + // with an empty Uint8Array, Opera fails with a "Offset larger than array size" + input = utils.transformTo("uint8array", input); + this.data.set(input, this.index); + this.index += input.length; + } + }, + /** + * Finalize the construction an return the result. + * @return {Uint8Array} the generated array. + */ + finalize: function() { + return this.data; + } +}; + +module.exports = Uint8ArrayWriter; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/utf8.js b/commodoreclicker/js/thirdparty/jszip/lib/utf8.js new file mode 100644 index 00000000..8cc16b47 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/utf8.js @@ -0,0 +1,207 @@ +'use strict'; + +var utils = require('./utils'); +var support = require('./support'); +var nodeBuffer = require('./nodeBuffer'); + +/** + * The following functions come from pako, from pako/lib/utils/strings + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new Array(256); +for (var i=0; i<256; i++) { + _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); +} +_utf8len[254]=_utf8len[254]=1; // Invalid sequence start + +// convert string to array (typed, when possible) +var string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + if (support.uint8array) { + buf = new Uint8Array(buf_len); + } else { + buf = new Array(buf_len); + } + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +var utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +// convert array to string +var buf2string = function (buf) { + var str, i, out, c, c_len; + var len = buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + // shrinkBuf(utf16buf, out) + if (utf16buf.length !== out) { + if(utf16buf.subarray) { + utf16buf = utf16buf.subarray(0, out); + } else { + utf16buf.length = out; + } + } + + // return String.fromCharCode.apply(null, utf16buf); + return utils.applyFromCharCode(utf16buf); +}; + + +// That's all for the pako functions. + + +/** + * Transform a javascript string into an array (typed if possible) of bytes, + * UTF-8 encoded. + * @param {String} str the string to encode + * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. + */ +exports.utf8encode = function utf8encode(str) { + if (support.nodebuffer) { + return nodeBuffer(str, "utf-8"); + } + + return string2buf(str); +}; + + +/** + * Transform a bytes array (or a representation) representing an UTF-8 encoded + * string into a javascript string. + * @param {Array|Uint8Array|Buffer} buf the data de decode + * @return {String} the decoded string. + */ +exports.utf8decode = function utf8decode(buf) { + if (support.nodebuffer) { + return utils.transformTo("nodebuffer", buf).toString("utf-8"); + } + + buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); + + // return buf2string(buf); + // Chrome prefers to work with "small" chunks of data + // for the method buf2string. + // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. + var result = [], k = 0, len = buf.length, chunk = 65536; + while (k < len) { + var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); + if (support.uint8array) { + result.push(buf2string(buf.subarray(k, nextBoundary))); + } else { + result.push(buf2string(buf.slice(k, nextBoundary))); + } + k = nextBoundary; + } + return result.join(""); + +}; +// vim: set shiftwidth=4 softtabstop=4: diff --git a/commodoreclicker/js/thirdparty/jszip/lib/utils.js b/commodoreclicker/js/thirdparty/jszip/lib/utils.js new file mode 100644 index 00000000..1e3bb5b6 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/utils.js @@ -0,0 +1,325 @@ +'use strict'; +var support = require('./support'); +var compressions = require('./compressions'); +var nodeBuffer = require('./nodeBuffer'); +/** + * Convert a string to a "binary string" : a string containing only char codes between 0 and 255. + * @param {string} str the string to transform. + * @return {String} the binary string. + */ +exports.string2binary = function(str) { + var result = ""; + for (var i = 0; i < str.length; i++) { + result += String.fromCharCode(str.charCodeAt(i) & 0xff); + } + return result; +}; +exports.arrayBuffer2Blob = function(buffer) { + exports.checkSupport("blob"); + + try { + // Blob constructor + return new Blob([buffer], { + type: "application/zip" + }); + } + catch (e) { + + try { + // deprecated, browser only, old way + var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + return builder.getBlob('application/zip'); + } + catch (e) { + + // well, fuck ?! + throw new Error("Bug : can't construct the Blob."); + } + } + + +}; +/** + * The identity function. + * @param {Object} input the input. + * @return {Object} the same input. + */ +function identity(input) { + return input; +} + +/** + * Fill in an array with a string. + * @param {String} str the string to use. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. + */ +function stringToArrayLike(str, array) { + for (var i = 0; i < str.length; ++i) { + array[i] = str.charCodeAt(i) & 0xFF; + } + return array; +} + +/** + * Transform an array-like object to a string. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ +function arrayLikeToString(array) { + // Performances notes : + // -------------------- + // String.fromCharCode.apply(null, array) is the fastest, see + // see http://jsperf.com/converting-a-uint8array-to-a-string/2 + // but the stack is limited (and we can get huge arrays !). + // + // result += String.fromCharCode(array[i]); generate too many strings ! + // + // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 + var chunk = 65536; + var result = [], + len = array.length, + type = exports.getTypeOf(array), + k = 0, + canUseApply = true; + try { + switch(type) { + case "uint8array": + String.fromCharCode.apply(null, new Uint8Array(0)); + break; + case "nodebuffer": + String.fromCharCode.apply(null, nodeBuffer(0)); + break; + } + } catch(e) { + canUseApply = false; + } + + // no apply : slow and painful algorithm + // default browser on android 4.* + if (!canUseApply) { + var resultStr = ""; + for(var i = 0; i < array.length;i++) { + resultStr += String.fromCharCode(array[i]); + } + return resultStr; + } + while (k < len && chunk > 1) { + try { + if (type === "array" || type === "nodebuffer") { + result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + } + else { + result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + } + k += chunk; + } + catch (e) { + chunk = Math.floor(chunk / 2); + } + } + return result.join(""); +} + +exports.applyFromCharCode = arrayLikeToString; + + +/** + * Copy the data from an array-like to an other array-like. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. + */ +function arrayLikeToArrayLike(arrayFrom, arrayTo) { + for (var i = 0; i < arrayFrom.length; i++) { + arrayTo[i] = arrayFrom[i]; + } + return arrayTo; +} + +// a matrix containing functions to transform everything into everything. +var transform = {}; + +// string to ? +transform["string"] = { + "string": identity, + "array": function(input) { + return stringToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["string"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return stringToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": function(input) { + return stringToArrayLike(input, nodeBuffer(input.length)); + } +}; + +// array to ? +transform["array"] = { + "string": arrayLikeToString, + "array": identity, + "arraybuffer": function(input) { + return (new Uint8Array(input)).buffer; + }, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// arraybuffer to ? +transform["arraybuffer"] = { + "string": function(input) { + return arrayLikeToString(new Uint8Array(input)); + }, + "array": function(input) { + return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); + }, + "arraybuffer": identity, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodeBuffer(new Uint8Array(input)); + } +}; + +// uint8array to ? +transform["uint8array"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return input.buffer; + }, + "uint8array": identity, + "nodebuffer": function(input) { + return nodeBuffer(input); + } +}; + +// nodebuffer to ? +transform["nodebuffer"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["nodebuffer"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return arrayLikeToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": identity +}; + +/** + * Transform an input into any type. + * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. + * If no output type is specified, the unmodified input will be returned. + * @param {String} outputType the output type. + * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. + * @throws {Error} an Error if the browser doesn't support the requested output type. + */ +exports.transformTo = function(outputType, input) { + if (!input) { + // undefined, null, etc + // an empty string won't harm. + input = ""; + } + if (!outputType) { + return input; + } + exports.checkSupport(outputType); + var inputType = exports.getTypeOf(input); + var result = transform[inputType][outputType](input); + return result; +}; + +/** + * Return the type of the input. + * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. + * @param {Object} input the input to identify. + * @return {String} the (lowercase) type of the input. + */ +exports.getTypeOf = function(input) { + if (typeof input === "string") { + return "string"; + } + if (Object.prototype.toString.call(input) === "[object Array]") { + return "array"; + } + if (support.nodebuffer && nodeBuffer.test(input)) { + return "nodebuffer"; + } + if (support.uint8array && input instanceof Uint8Array) { + return "uint8array"; + } + if (support.arraybuffer && input instanceof ArrayBuffer) { + return "arraybuffer"; + } +}; + +/** + * Throw an exception if the type is not supported. + * @param {String} type the type to check. + * @throws {Error} an Error if the browser doesn't support the requested type. + */ +exports.checkSupport = function(type) { + var supported = support[type.toLowerCase()]; + if (!supported) { + throw new Error(type + " is not supported by this browser"); + } +}; +exports.MAX_VALUE_16BITS = 65535; +exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 + +/** + * Prettify a string read as binary. + * @param {string} str the string to prettify. + * @return {string} a pretty string. + */ +exports.pretty = function(str) { + var res = '', + code, i; + for (i = 0; i < (str || "").length; i++) { + code = str.charCodeAt(i); + res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); + } + return res; +}; + +/** + * Find a compression registered in JSZip. + * @param {string} compressionMethod the method magic to find. + * @return {Object|null} the JSZip compression object, null if none found. + */ +exports.findCompression = function(compressionMethod) { + for (var method in compressions) { + if (!compressions.hasOwnProperty(method)) { + continue; + } + if (compressions[method].magic === compressionMethod) { + return compressions[method]; + } + } + return null; +}; +/** +* Cross-window, cross-Node-context regular expression detection +* @param {Object} object Anything +* @return {Boolean} true if the object is a regular expression, +* false otherwise +*/ +exports.isRegExp = function (object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; +}; + diff --git a/commodoreclicker/js/thirdparty/jszip/lib/zipEntries.js b/commodoreclicker/js/thirdparty/jszip/lib/zipEntries.js new file mode 100644 index 00000000..842b58a6 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/zipEntries.js @@ -0,0 +1,203 @@ +'use strict'; +var StringReader = require('./stringReader'); +var NodeBufferReader = require('./nodeBufferReader'); +var Uint8ArrayReader = require('./uint8ArrayReader'); +var utils = require('./utils'); +var sig = require('./signature'); +var ZipEntry = require('./zipEntry'); +var support = require('./support'); +var jszipProto = require('./object'); +// class ZipEntries {{{ +/** + * All the entries in the zip file. + * @constructor + * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntries(data, loadOptions) { + this.files = []; + this.loadOptions = loadOptions; + if (data) { + this.load(data); + } +} +ZipEntries.prototype = { + /** + * Check that the reader is on the speficied signature. + * @param {string} expectedSignature the expected signature. + * @throws {Error} if it is an other signature. + */ + checkSignature: function(expectedSignature) { + var signature = this.reader.readString(4); + if (signature !== expectedSignature) { + throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + } + }, + /** + * Read the end of the central directory. + */ + readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2); + this.diskWithCentralDirStart = this.reader.readInt(2); + this.centralDirRecordsOnThisDisk = this.reader.readInt(2); + this.centralDirRecords = this.reader.readInt(2); + this.centralDirSize = this.reader.readInt(4); + this.centralDirOffset = this.reader.readInt(4); + + this.zipCommentLength = this.reader.readInt(2); + // warning : the encoding depends of the system locale + // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. + // On a windows machine, this field is encoded with the localized windows code page. + this.zipComment = this.reader.readString(this.zipCommentLength); + // To get consistent behavior with the generation part, we will assume that + // this is utf8 encoded. + this.zipComment = jszipProto.utf8decode(this.zipComment); + }, + /** + * Read the end of the Zip 64 central directory. + * Not merged with the method readEndOfCentral : + * The end of central can coexist with its Zip64 brother, + * I don't want to read the wrong number of bytes ! + */ + readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8); + this.versionMadeBy = this.reader.readString(2); + this.versionNeeded = this.reader.readInt(2); + this.diskNumber = this.reader.readInt(4); + this.diskWithCentralDirStart = this.reader.readInt(4); + this.centralDirRecordsOnThisDisk = this.reader.readInt(8); + this.centralDirRecords = this.reader.readInt(8); + this.centralDirSize = this.reader.readInt(8); + this.centralDirOffset = this.reader.readInt(8); + + this.zip64ExtensibleData = {}; + var extraDataSize = this.zip64EndOfCentralSize - 44, + index = 0, + extraFieldId, + extraFieldLength, + extraFieldValue; + while (index < extraDataSize) { + extraFieldId = this.reader.readInt(2); + extraFieldLength = this.reader.readInt(4); + extraFieldValue = this.reader.readString(extraFieldLength); + this.zip64ExtensibleData[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Read the end of the Zip 64 central directory locator. + */ + readBlockZip64EndOfCentralLocator: function() { + this.diskWithZip64CentralDirStart = this.reader.readInt(4); + this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); + this.disksCount = this.reader.readInt(4); + if (this.disksCount > 1) { + throw new Error("Multi-volumes zip are not supported"); + } + }, + /** + * Read the local files, based on the offset read in the central part. + */ + readLocalFiles: function() { + var i, file; + for (i = 0; i < this.files.length; i++) { + file = this.files[i]; + this.reader.setIndex(file.localHeaderOffset); + this.checkSignature(sig.LOCAL_FILE_HEADER); + file.readLocalPart(this.reader); + file.handleUTF8(); + } + }, + /** + * Read the central directory. + */ + readCentralDir: function() { + var file; + + this.reader.setIndex(this.centralDirOffset); + while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) { + file = new ZipEntry({ + zip64: this.zip64 + }, this.loadOptions); + file.readCentralPart(this.reader); + this.files.push(file); + } + }, + /** + * Read the end of central directory. + */ + readEndOfCentral: function() { + var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); + if (offset === -1) { + throw new Error("Corrupted zip : can't find end of central directory"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.CENTRAL_DIRECTORY_END); + this.readBlockEndOfCentral(); + + + /* extract from the zip spec : + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + */ + if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { + this.zip64 = true; + + /* + Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from + the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents + all numbers as 64-bit double precision IEEE 754 floating point numbers. + So, we have 53bits for integers and bitwise operations treat everything as 32bits. + see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators + and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 + */ + + // should look for a zip64 EOCD locator + offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + if (offset === -1) { + throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + this.readBlockZip64EndOfCentralLocator(); + + // now the zip64 EOCD record + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + this.readBlockZip64EndOfCentral(); + } + }, + prepareReader: function(data) { + var type = utils.getTypeOf(data); + if (type === "string" && !support.uint8array) { + this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString); + } + else if (type === "nodebuffer") { + this.reader = new NodeBufferReader(data); + } + else { + this.reader = new Uint8ArrayReader(utils.transformTo("uint8array", data)); + } + }, + /** + * Read a zip file and create ZipEntries. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. + */ + load: function(data) { + this.prepareReader(data); + this.readEndOfCentral(); + this.readCentralDir(); + this.readLocalFiles(); + } +}; +// }}} end of ZipEntries +module.exports = ZipEntries; diff --git a/commodoreclicker/js/thirdparty/jszip/lib/zipEntry.js b/commodoreclicker/js/thirdparty/jszip/lib/zipEntry.js new file mode 100644 index 00000000..4e324f75 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/lib/zipEntry.js @@ -0,0 +1,279 @@ +'use strict'; +var StringReader = require('./stringReader'); +var utils = require('./utils'); +var CompressedObject = require('./compressedObject'); +var jszipProto = require('./object'); +// class ZipEntry {{{ +/** + * An entry in the zip file. + * @constructor + * @param {Object} options Options of the current file. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntry(options, loadOptions) { + this.options = options; + this.loadOptions = loadOptions; +} +ZipEntry.prototype = { + /** + * say if the file is encrypted. + * @return {boolean} true if the file is encrypted, false otherwise. + */ + isEncrypted: function() { + // bit 1 is set + return (this.bitFlag & 0x0001) === 0x0001; + }, + /** + * say if the file has utf-8 filename/comment. + * @return {boolean} true if the filename/comment is in utf-8, false otherwise. + */ + useUTF8: function() { + // bit 11 is set + return (this.bitFlag & 0x0800) === 0x0800; + }, + /** + * Prepare the function used to generate the compressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @return {Function} the callback to get the compressed content (the type depends of the DataReader class). + */ + prepareCompressedContent: function(reader, from, length) { + return function() { + var previousIndex = reader.index; + reader.setIndex(from); + var compressedFileData = reader.readData(length); + reader.setIndex(previousIndex); + + return compressedFileData; + }; + }, + /** + * Prepare the function used to generate the uncompressed content from this ZipFile. + * @param {DataReader} reader the reader to use. + * @param {number} from the offset from where we should read the data. + * @param {number} length the length of the data to read. + * @param {JSZip.compression} compression the compression used on this file. + * @param {number} uncompressedSize the uncompressed size to expect. + * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class). + */ + prepareContent: function(reader, from, length, compression, uncompressedSize) { + return function() { + + var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent()); + var uncompressedFileData = compression.uncompress(compressedFileData); + + if (uncompressedFileData.length !== uncompressedSize) { + throw new Error("Bug : uncompressed data size mismatch"); + } + + return uncompressedFileData; + }; + }, + /** + * Read the local part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readLocalPart: function(reader) { + var compression, localExtraFieldsLength; + + // we already know everything from the central dir ! + // If the central dir data are false, we are doomed. + // On the bright side, the local part is scary : zip64, data descriptors, both, etc. + // The less data we get here, the more reliable this should be. + // Let's skip the whole header and dash to the data ! + reader.skip(22); + // in some zip created on windows, the filename stored in the central dir contains \ instead of /. + // Strangely, the filename here is OK. + // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes + // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... + // Search "unzip mismatching "local" filename continuing with "central" filename version" on + // the internet. + // + // I think I see the logic here : the central directory is used to display + // content and the local directory is used to extract the files. Mixing / and \ + // may be used to display \ to windows users and use / when extracting the files. + // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 + this.fileNameLength = reader.readInt(2); + localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir + this.fileName = reader.readString(this.fileNameLength); + reader.skip(localExtraFieldsLength); + + if (this.compressedSize == -1 || this.uncompressedSize == -1) { + throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize == -1 || uncompressedSize == -1)"); + } + + compression = utils.findCompression(this.compressionMethod); + if (compression === null) { // no compression found + throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + this.fileName + ")"); + } + this.decompressed = new CompressedObject(); + this.decompressed.compressedSize = this.compressedSize; + this.decompressed.uncompressedSize = this.uncompressedSize; + this.decompressed.crc32 = this.crc32; + this.decompressed.compressionMethod = this.compressionMethod; + this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression); + this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize); + + // we need to compute the crc32... + if (this.loadOptions.checkCRC32) { + this.decompressed = utils.transformTo("string", this.decompressed.getContent()); + if (jszipProto.crc32(this.decompressed) !== this.crc32) { + throw new Error("Corrupted zip : CRC32 mismatch"); + } + } + }, + + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readCentralPart: function(reader) { + this.versionMadeBy = reader.readString(2); + this.versionNeeded = reader.readInt(2); + this.bitFlag = reader.readInt(2); + this.compressionMethod = reader.readString(2); + this.date = reader.readDate(); + this.crc32 = reader.readInt(4); + this.compressedSize = reader.readInt(4); + this.uncompressedSize = reader.readInt(4); + this.fileNameLength = reader.readInt(2); + this.extraFieldsLength = reader.readInt(2); + this.fileCommentLength = reader.readInt(2); + this.diskNumberStart = reader.readInt(2); + this.internalFileAttributes = reader.readInt(2); + this.externalFileAttributes = reader.readInt(4); + this.localHeaderOffset = reader.readInt(4); + + if (this.isEncrypted()) { + throw new Error("Encrypted zip are not supported"); + } + + this.fileName = reader.readString(this.fileNameLength); + this.readExtraFields(reader); + this.parseZIP64ExtraField(reader); + this.fileComment = reader.readString(this.fileCommentLength); + + // warning, this is true only for zip with madeBy == DOS (plateform dependent feature) + this.dir = this.externalFileAttributes & 0x00000010 ? true : false; + }, + /** + * Parse the ZIP64 extra field and merge the info in the current ZipEntry. + * @param {DataReader} reader the reader to use. + */ + parseZIP64ExtraField: function(reader) { + + if (!this.extraFields[0x0001]) { + return; + } + + // should be something, preparing the extra reader + var extraReader = new StringReader(this.extraFields[0x0001].value); + + // I really hope that these 64bits integer can fit in 32 bits integer, because js + // won't let us have more. + if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { + this.uncompressedSize = extraReader.readInt(8); + } + if (this.compressedSize === utils.MAX_VALUE_32BITS) { + this.compressedSize = extraReader.readInt(8); + } + if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { + this.localHeaderOffset = extraReader.readInt(8); + } + if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { + this.diskNumberStart = extraReader.readInt(4); + } + }, + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readExtraFields: function(reader) { + var start = reader.index, + extraFieldId, + extraFieldLength, + extraFieldValue; + + this.extraFields = this.extraFields || {}; + + while (reader.index < start + this.extraFieldsLength) { + extraFieldId = reader.readInt(2); + extraFieldLength = reader.readInt(2); + extraFieldValue = reader.readString(extraFieldLength); + + this.extraFields[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Apply an UTF8 transformation if needed. + */ + handleUTF8: function() { + if (this.useUTF8()) { + this.fileName = jszipProto.utf8decode(this.fileName); + this.fileComment = jszipProto.utf8decode(this.fileComment); + } else { + var upath = this.findExtraFieldUnicodePath(); + if (upath !== null) { + this.fileName = upath; + } + var ucomment = this.findExtraFieldUnicodeComment(); + if (ucomment !== null) { + this.fileComment = ucomment; + } + } + }, + + /** + * Find the unicode path declared in the extra field, if any. + * @return {String} the unicode path, null otherwise. + */ + findExtraFieldUnicodePath: function() { + var upathField = this.extraFields[0x7075]; + if (upathField) { + var extraReader = new StringReader(upathField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the filename changed, this field is out of date. + if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(upathField.length - 5)); + } + return null; + }, + + /** + * Find the unicode comment declared in the extra field, if any. + * @return {String} the unicode comment, null otherwise. + */ + findExtraFieldUnicodeComment: function() { + var ucommentField = this.extraFields[0x6375]; + if (ucommentField) { + var extraReader = new StringReader(ucommentField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the comment changed, this field is out of date. + if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) { + return null; + } + + return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5)); + } + return null; + } +}; +module.exports = ZipEntry; diff --git a/commodoreclicker/js/thirdparty/jszip/package.json b/commodoreclicker/js/thirdparty/jszip/package.json new file mode 100644 index 00000000..7bb7db69 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/package.json @@ -0,0 +1,53 @@ +{ + "name": "jszip", + "version": "2.4.0", + "author": "Stuart Knightley ", + "description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip", + "scripts": { + "test": "npm run test-node && npm run test-browser", + "test-node": "cd test && qunit -c node.js -t test.js", + "test-browser": "grunt build && grunt test", + "lint": "grunt jshint" + }, + "contributors": [ + { + "name": "Franz Buchinger" + }, + { + "name": "António Afonso" + }, + { + "name": "David Duponchel" + }, + { + "name": "yiminghe" + } + ], + "main": "./lib/index", + "repository": { + "type": "git", + "url": "https://github.com/Stuk/jszip.git" + }, + "keywords": [ + "zip", + "deflate", + "inflate" + ], + "devDependencies": { + "qunit": "~0.6.3", + "grunt": "~0.4.1", + "grunt-cli": "~0.1.9", + "grunt-saucelabs": "~7.0.0", + "grunt-contrib-connect": "~0.7.1", + "jshint": "~2.5.1", + "browserify": "~4.1.4", + "grunt-browserify": "~2.1.0", + "grunt-contrib-jshint": "~0.10.0", + "grunt-contrib-uglify": "~0.4.0", + "jszip-utils": "~0.0.2" + }, + "dependencies":{ + "pako": "~0.2.5" + }, + "license": "MIT or GPLv3" +} diff --git a/commodoreclicker/js/thirdparty/jszip/test/browser-test-utils.js b/commodoreclicker/js/thirdparty/jszip/test/browser-test-utils.js new file mode 100644 index 00000000..963524fb --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/browser-test-utils.js @@ -0,0 +1,5 @@ +var JSZipTestUtils = { + loadZipFile : function (name, callback) { + JSZipUtils.getBinaryContent(name + "?_=" + ( new Date() ).getTime(), callback); + } +}; diff --git a/commodoreclicker/js/thirdparty/jszip/test/index.html b/commodoreclicker/js/thirdparty/jszip/test/index.html new file mode 100644 index 00000000..82ef3b0f --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/index.html @@ -0,0 +1,75 @@ + + + + +JSZip Testing + + + + + + + + + + + + + + + + + + + +
    +
    + + + + diff --git a/commodoreclicker/js/thirdparty/jszip/test/jquery-1.8.3.min.js b/commodoreclicker/js/thirdparty/jszip/test/jquery-1.8.3.min.js new file mode 100644 index 00000000..83589daa --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/jquery-1.8.3.min.js @@ -0,0 +1,2 @@ +/*! jQuery v1.8.3 jquery.com | jquery.org/license */ +(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
    a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
    t
    ",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
    ",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
    ",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

    ",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
    ","
    "]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
    ").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); \ No newline at end of file diff --git a/commodoreclicker/js/thirdparty/jszip/test/node.js b/commodoreclicker/js/thirdparty/jszip/test/node.js new file mode 100644 index 00000000..61139d67 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/node.js @@ -0,0 +1,9 @@ +var fs = require("fs"); + +global.JSZip = require("../lib/index"); + +global.JSZipTestUtils = { + loadZipFile: function(name, callback) { + fs.readFile(name, "binary", callback); + } +}; diff --git a/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.css b/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.css new file mode 100644 index 00000000..d7fc0c8e --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.css @@ -0,0 +1,244 @@ +/** + * QUnit v1.11.0 - A JavaScript Unit Testing Framework + * + * http://qunitjs.com + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +/** Font Family and Sizes */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { + font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; +} + +#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } +#qunit-tests { font-size: smaller; } + + +/** Resets */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { + margin: 0; + padding: 0; +} + + +/** Header */ + +#qunit-header { + padding: 0.5em 0 0.5em 1em; + + color: #8699a4; + background-color: #0d3349; + + font-size: 1.5em; + line-height: 1em; + font-weight: normal; + + border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + -webkit-border-top-right-radius: 5px; + -webkit-border-top-left-radius: 5px; +} + +#qunit-header a { + text-decoration: none; + color: #c2ccd1; +} + +#qunit-header a:hover, +#qunit-header a:focus { + color: #fff; +} + +#qunit-testrunner-toolbar label { + display: inline-block; + padding: 0 .5em 0 .1em; +} + +#qunit-banner { + height: 5px; +} + +#qunit-testrunner-toolbar { + padding: 0.5em 0 0.5em 2em; + color: #5E740B; + background-color: #eee; + overflow: hidden; +} + +#qunit-userAgent { + padding: 0.5em 0 0.5em 2.5em; + background-color: #2b81af; + color: #fff; + text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; +} + +#qunit-modulefilter-container { + float: right; +} + +/** Tests: Pass/Fail */ + +#qunit-tests { + list-style-position: inside; +} + +#qunit-tests li { + padding: 0.4em 0.5em 0.4em 2.5em; + border-bottom: 1px solid #fff; + list-style-position: inside; +} + +#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { + display: none; +} + +#qunit-tests li strong { + cursor: pointer; +} + +#qunit-tests li a { + padding: 0.5em; + color: #c2ccd1; + text-decoration: none; +} +#qunit-tests li a:hover, +#qunit-tests li a:focus { + color: #000; +} + +#qunit-tests li .runtime { + float: right; + font-size: smaller; +} + +.qunit-assert-list { + margin-top: 0.5em; + padding: 0.5em; + + background-color: #fff; + + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.qunit-collapsed { + display: none; +} + +#qunit-tests table { + border-collapse: collapse; + margin-top: .2em; +} + +#qunit-tests th { + text-align: right; + vertical-align: top; + padding: 0 .5em 0 0; +} + +#qunit-tests td { + vertical-align: top; +} + +#qunit-tests pre { + margin: 0; + white-space: pre-wrap; + word-wrap: break-word; +} + +#qunit-tests del { + background-color: #e0f2be; + color: #374e0c; + text-decoration: none; +} + +#qunit-tests ins { + background-color: #ffcaca; + color: #500; + text-decoration: none; +} + +/*** Test Counts */ + +#qunit-tests b.counts { color: black; } +#qunit-tests b.passed { color: #5E740B; } +#qunit-tests b.failed { color: #710909; } + +#qunit-tests li li { + padding: 5px; + background-color: #fff; + border-bottom: none; + list-style-position: inside; +} + +/*** Passing Styles */ + +#qunit-tests li li.pass { + color: #3c510c; + background-color: #fff; + border-left: 10px solid #C6E746; +} + +#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } +#qunit-tests .pass .test-name { color: #366097; } + +#qunit-tests .pass .test-actual, +#qunit-tests .pass .test-expected { color: #999999; } + +#qunit-banner.qunit-pass { background-color: #C6E746; } + +/*** Failing Styles */ + +#qunit-tests li li.fail { + color: #710909; + background-color: #fff; + border-left: 10px solid #EE5757; + white-space: pre; +} + +#qunit-tests > li:last-child { + border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-bottom-left-radius: 5px; +} + +#qunit-tests .fail { color: #000000; background-color: #EE5757; } +#qunit-tests .fail .test-name, +#qunit-tests .fail .module-name { color: #000000; } + +#qunit-tests .fail .test-actual { color: #EE5757; } +#qunit-tests .fail .test-expected { color: green; } + +#qunit-banner.qunit-fail { background-color: #EE5757; } + + +/** Result */ + +#qunit-testresult { + padding: 0.5em 0.5em 0.5em 2.5em; + + color: #2b81af; + background-color: #D2E0E6; + + border-bottom: 1px solid white; +} +#qunit-testresult .module-name { + font-weight: bold; +} + +/** Fixture */ + +#qunit-fixture { + position: absolute; + top: -10000px; + left: -10000px; + width: 1000px; + height: 1000px; +} diff --git a/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.js b/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.js new file mode 100644 index 00000000..302545f4 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/qunit-1.11.0.js @@ -0,0 +1,2152 @@ +/** + * QUnit v1.11.0 - A JavaScript Unit Testing Framework + * + * http://qunitjs.com + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + +(function( window ) { + +var QUnit, + assert, + config, + onErrorFnPrev, + testId = 0, + fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + // Keep a local reference to Date (GH-283) + Date = window.Date, + defined = { + setTimeout: typeof window.setTimeout !== "undefined", + sessionStorage: (function() { + var x = "qunit-test-string"; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch( e ) { + return false; + } + }()) + }, + /** + * Provides a normalized error string, correcting an issue + * with IE 7 (and prior) where Error.prototype.toString is + * not properly implemented + * + * Based on http://es5.github.com/#x15.11.4.4 + * + * @param {String|Error} error + * @return {String} error message + */ + errorString = function( error ) { + var name, message, + errorString = error.toString(); + if ( errorString.substring( 0, 7 ) === "[object" ) { + name = error.name ? error.name.toString() : "Error"; + message = error.message ? error.message.toString() : ""; + if ( name && message ) { + return name + ": " + message; + } else if ( name ) { + return name; + } else if ( message ) { + return message; + } else { + return "Error"; + } + } else { + return errorString; + } + }, + /** + * Makes a clone of an object using only Array or Object as base, + * and copies over the own enumerable properties. + * + * @param {Object} obj + * @return {Object} New object with only the own properties (recursively). + */ + objectValues = function( obj ) { + // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. + /*jshint newcap: false */ + var key, val, + vals = QUnit.is( "array", obj ) ? [] : {}; + for ( key in obj ) { + if ( hasOwn.call( obj, key ) ) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + }; + +function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; +} + +Test.count = 0; + +Test.prototype = { + init: function() { + var a, b, li, + tests = id( "qunit-tests" ); + + if ( tests ) { + b = document.createElement( "strong" ); + b.innerHTML = this.nameHtml; + + // `a` initialized at top of scope + a = document.createElement( "a" ); + a.innerHTML = "Rerun"; + a.href = QUnit.url({ testNumber: this.testNumber }); + + li = document.createElement( "li" ); + li.appendChild( b ); + li.appendChild( a ); + li.className = "running"; + li.id = this.id = "qunit-test-output" + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( this.module !== config.previousModule ) { + if ( config.previousModule ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + config.previousModule = this.module; + config.moduleStats = { all: 0, bad: 0 }; + runLoggingCallbacks( "moduleStart", QUnit, { + name: this.module + }); + } else if ( config.autorun ) { + runLoggingCallbacks( "moduleStart", QUnit, { + name: this.module + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {} + }, this.moduleTestEnvironment ); + + this.started = +new Date(); + runLoggingCallbacks( "testStart", QUnit, { + name: this.testName, + module: this.module + }); + + // allow utility functions to access the current test environment + // TODO why?? + QUnit.current_testEnvironment = this.testEnvironment; + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment ); + } catch( e ) { + QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + var running = id( "qunit-testresult" ); + + if ( running ) { + running.innerHTML = "Running:
    " + this.nameHtml; + } + + if ( this.async ) { + QUnit.stop(); + } + + this.callbackStarted = +new Date(); + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + } catch( e ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + + QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + if ( typeof this.callbackRuntime === "undefined" ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + } + this.testEnvironment.teardown.call( this.testEnvironment ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment ); + } catch( e ) { + QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected === null ) { + QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); + } else if ( this.expected !== null && this.expected !== this.assertions.length ) { + QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); + } else if ( this.expected === null && !this.assertions.length ) { + QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); + } + + var i, assertion, a, b, time, li, ol, + test = this, + good = 0, + bad = 0, + tests = id( "qunit-tests" ); + + this.runtime = +new Date() - this.started; + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( "ol" ); + ol.className = "qunit-assert-list"; + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( "li" ); + li.className = assertion.result ? "pass" : "fail"; + li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); + } else { + sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); + } + } + + if ( bad === 0 ) { + addClass( ol, "qunit-collapsed" ); + } + + // `b` initialized at top of scope + b = document.createElement( "strong" ); + b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; + + addEvent(b, "click", function() { + var next = b.parentNode.lastChild, + collapsed = hasClass( next, "qunit-collapsed" ); + ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); + }); + + addEvent(b, "dblclick", function( e ) { + var target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === "strong" ) { + window.location = QUnit.url({ testNumber: test.testNumber }); + } + }); + + // `time` initialized at top of scope + time = document.createElement( "span" ); + time.className = "runtime"; + time.innerHTML = this.runtime + " ms"; + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? "fail" : "pass"; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( time ); + li.appendChild( ol ); + + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( "testDone", QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + duration: this.runtime + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + var bad, + test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + } +}; + +// Root QUnit object. +// `QUnit` initialized at top of scope +QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + var test, + nameHtml = "" + escapeText( testName ) + ""; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; + } + + test = new Test({ + nameHtml: nameHtml, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ) + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + // QUnit hasn't been initialized yet. + // Note: RequireJS (et al) may delay onLoad + if ( config.semaphore === undefined ) { + QUnit.begin(function() { + // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first + setTimeout(function() { + QUnit.start( count ); + }); + }); + return; + } + + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); + return; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + window.setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = window.setTimeout(function() { + QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + } +}; + +// `assert` initialized at top of scope +// Asssert helpers +// All of these must either call QUnit.push() or manually do: +// - runLoggingCallbacks( "log", .. ); +// - config.current.assertions.push({ .. }); +// We attach it to the QUnit object *after* we expose the public API, +// otherwise `assert` will become a global variable in browsers (#341). +assert = { + /** + * Asserts rough true-ish result. + * @name ok + * @function + * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); + */ + ok: function( result, msg ) { + if ( !config.current ) { + throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + result = !!result; + + var source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: msg + }; + + msg = escapeText( msg || (result ? "okay" : "failed" ) ); + msg = "" + msg + ""; + + if ( !result ) { + source = sourceFromStacktrace( 2 ); + if ( source ) { + details.source = source; + msg += "
    Source:
    " + escapeText( source ) + "
    "; + } + } + runLoggingCallbacks( "log", QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg + }); + }, + + /** + * Assert that the first two arguments are equal, with an optional message. + * Prints out both actual and expected values. + * @name equal + * @function + * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); + */ + equal: function( actual, expected, message ) { + /*jshint eqeqeq:false */ + QUnit.push( expected == actual, actual, expected, message ); + }, + + /** + * @name notEqual + * @function + */ + notEqual: function( actual, expected, message ) { + /*jshint eqeqeq:false */ + QUnit.push( expected != actual, actual, expected, message ); + }, + + /** + * @name propEqual + * @function + */ + propEqual: function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name notPropEqual + * @function + */ + notPropEqual: function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name deepEqual + * @function + */ + deepEqual: function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name notDeepEqual + * @function + */ + notDeepEqual: function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name strictEqual + * @function + */ + strictEqual: function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, + + /** + * @name notStrictEqual + * @function + */ + notStrictEqual: function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + "throws": function( block, expected, message ) { + var actual, + expectedOutput = expected, + ok = false; + + // 'expected' is optional + if ( typeof expected === "string" ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + expectedOutput = null; + // expected is a regexp + } else if ( QUnit.objectType( expected ) === "regexp" ) { + ok = expected.test( errorString( actual ) ); + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + expectedOutput = null; + ok = true; + } + + QUnit.push( ok, actual, expectedOutput, message ); + } else { + QUnit.pushFailure( message, null, 'No exception was thrown.' ); + } + } +}; + +/** + * @deprecate since 1.8.0 + * Kept assertion helpers in root for backwards compatibility. + */ +extend( QUnit, assert ); + +/** + * @deprecated since 1.9.0 + * Kept root "raises()" for backwards compatibility. + * (Note that we don't introduce assert.raises). + */ +QUnit.raises = assert[ "throws" ]; + +/** + * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 + * Kept to avoid TypeErrors for undefined methods. + */ +QUnit.equals = function() { + QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); +}; +QUnit.same = function() { + QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); +}; + +// We want access to the constructor's prototype +(function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +}()); + +/** + * Config object: Maintain internal state + * Later exposed as QUnit.config + * `config` initialized at top of scope + */ +config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: "noglobals", + label: "Check for Globals", + tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." + }, + { + id: "notrycatch", + label: "No try-catch", + tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." + } + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] +}; + +// Export global variables, unless an 'exports' object exists, +// in that case we assume we're in CommonJS (dealt with on the bottom of the script) +if ( typeof exports === "undefined" ) { + extend( window, QUnit ); + + // Expose QUnit object + window.QUnit = QUnit; +} + +// Initialize more QUnit.config and QUnit.urlParams +(function() { + var i, + location = window.location || { search: "", protocol: "file:" }, + params = location.search.slice( 1 ).split( "&" ), + length = params.length, + urlParams = {}, + current; + + if ( params[ 0 ] ) { + for ( i = 0; i < length; i++ ) { + current = params[ i ].split( "=" ); + current[ 0 ] = decodeURIComponent( current[ 0 ] ); + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; + urlParams[ current[ 0 ] ] = current[ 1 ]; + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === "file:"; +}()); + +// Extend QUnit object, +// these after set here because they should not be exposed as global functions +extend( QUnit, { + assert: assert, + + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: { all: 0, bad: 0 }, + moduleStats: { all: 0, bad: 0 }, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: "", + queue: [], + semaphore: 1 + }); + + var tests, banner, result, + qunit = id( "qunit" ); + + if ( qunit ) { + qunit.innerHTML = + "

    " + escapeText( document.title ) + "

    " + + "

    " + + "
    " + + "

    " + + "
      "; + } + + tests = id( "qunit-tests" ); + banner = id( "qunit-banner" ); + result = id( "qunit-testresult" ); + + if ( tests ) { + tests.innerHTML = ""; + } + + if ( banner ) { + banner.className = ""; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( "p" ); + result.id = "qunit-testresult"; + result.className = "result"; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = "Running...
       "; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + reset: function() { + var fixture = id( "qunit-fixture" ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); + triggerEvent: function( elem, type, event ) { + if ( document.createEvent ) { + event = document.createEvent( "MouseEvents" ); + event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( "on" + type ); + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) === type; + }, + + objectType: function( obj ) { + if ( typeof obj === "undefined" ) { + return "undefined"; + // consider: typeof null === object + } + if ( obj === null ) { + return "null"; + } + + var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), + type = match && match[1] || ""; + + switch ( type ) { + case "Number": + if ( isNaN(obj) ) { + return "nan"; + } + return "number"; + case "String": + case "Boolean": + case "Array": + case "Date": + case "RegExp": + case "Function": + return type.toLowerCase(); + } + if ( typeof obj === "object" ) { + return "object"; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); + } + + var output, source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected + }; + + message = escapeText( message ) || ( result ? "okay" : "failed" ); + message = "" + message + ""; + output = message; + + if ( !result ) { + expected = escapeText( QUnit.jsDump.parse(expected) ); + actual = escapeText( QUnit.jsDump.parse(actual) ); + output += ""; + + if ( actual !== expected ) { + output += ""; + output += ""; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += ""; + } + + output += "
      Expected:
      " + expected + "
      Result:
      " + actual + "
      Diff:
      " + QUnit.diff( expected, actual ) + "
      Source:
      " + escapeText( source ) + "
      "; + } + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + + var output, + details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message + }; + + message = escapeText( message ) || "error"; + message = "" + message + ""; + output = message; + + output += ""; + + if ( actual ) { + output += ""; + } + + if ( source ) { + details.source = source; + output += ""; + } + + output += "
      Result:
      " + escapeText( actual ) + "
      Source:
      " + escapeText( source ) + "
      "; + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + var key, + querystring = "?"; + + for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } + querystring += encodeURIComponent( key ) + "=" + + encodeURIComponent( params[ key ] ) + "&"; + } + return window.location.protocol + "//" + window.location.host + + window.location.pathname + querystring.slice( 0, -1 ); + }, + + extend: extend, + id: id, + addEvent: addEvent + // load, equiv, jsDump, diff: Attached later +}); + +/** + * @deprecated: Created for backwards compatibility with test runner that set the hook function + * into QUnit.{hook}, instead of invoking it and passing the hook function. + * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. + * Doing this allows us to tell if the following methods have been overwritten on the actual + * QUnit object. + */ +extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( "begin" ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( "done" ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( "log" ), + + // testStart: { name } + testStart: registerLoggingCallback( "testStart" ), + + // testDone: { name, failed, passed, total, duration } + testDone: registerLoggingCallback( "testDone" ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( "moduleStart" ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( "moduleDone" ) +}); + +if ( typeof document === "undefined" || document.readyState === "complete" ) { + config.autorun = true; +} + +QUnit.load = function() { + runLoggingCallbacks( "begin", QUnit, {} ); + + // Initialize the config, saving the execution queue + var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, + urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, + numModules = 0, + moduleFilterHtml = "", + urlConfigHtml = "", + oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === "string" ) { + val = { + id: val, + label: val, + tooltip: "[no tooltip available]" + }; + } + config[ val.id ] = QUnit.urlParams[ val.id ]; + urlConfigHtml += ""; + } + + moduleFilterHtml += ""; + + // `userAgent` initialized at top of scope + userAgent = id( "qunit-userAgent" ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( "qunit-header" ); + if ( banner ) { + banner.innerHTML = "" + banner.innerHTML + " "; + } + + // `toolbar` initialized at top of scope + toolbar = id( "qunit-testrunner-toolbar" ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( "input" ); + filter.type = "checkbox"; + filter.id = "qunit-filter-pass"; + + addEvent( filter, "click", function() { + var tmp, + ol = document.getElementById( "qunit-tests" ); + + if ( filter.checked ) { + ol.className = ol.className + " hidepass"; + } else { + tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; + ol.className = tmp.replace( / hidepass /, " " ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); + } else { + sessionStorage.removeItem( "qunit-filter-passed-tests" ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = document.getElementById( "qunit-tests" ); + ol.className = ol.className + " hidepass"; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( "label" ); + label.setAttribute( "for", "qunit-filter-pass" ); + label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); + label.innerHTML = "Hide passed tests"; + toolbar.appendChild( label ); + + urlConfigCheckboxesContainer = document.createElement("span"); + urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; + urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); + // For oldIE support: + // * Add handlers to the individual elements instead of the container + // * Use "click" instead of "change" + // * Fallback from event.target to event.srcElement + addEvents( urlConfigCheckboxes, "click", function( event ) { + var params = {}, + target = event.target || event.srcElement; + params[ target.name ] = target.checked ? true : undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigCheckboxesContainer ); + + if (numModules > 1) { + moduleFilter = document.createElement( 'span' ); + moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter.lastChild, "change", function() { + var selectBox = moduleFilter.getElementsByTagName("select")[0], + selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( "qunit-fixture" ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } +}; + +addEvent( window, "load", QUnit.load ); + +// `onErrorFnPrev` initialized at top of scope +// Preserve other handlers +onErrorFnPrev = window.onerror; + +// Cover uncaught exceptions +// Returning true will surpress the default browser handler, +// returning false will let it run. +window.onerror = function ( error, filePath, linerNr ) { + var ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not surpressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ":" + linerNr ); + } else { + QUnit.test( "global failure", extend( function() { + QUnit.pushFailure( error, filePath + ":" + linerNr ); + }, { validTest: validTest } ) ); + } + return false; + } + + return ret; +}; + +function done() { + config.autorun = true; + + // Log the last module results + if ( config.currentModule ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.currentModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + + var i, key, + banner = id( "qunit-banner" ), + tests = id( "qunit-tests" ), + runtime = +new Date() - config.started, + passed = config.stats.all - config.stats.bad, + html = [ + "Tests completed in ", + runtime, + " milliseconds.
      ", + "", + passed, + " assertions of ", + config.stats.all, + " passed, ", + config.stats.bad, + " failed." + ].join( "" ); + + if ( banner ) { + banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); + } + + if ( tests ) { + id( "qunit-testresult" ).innerHTML = html; + } + + if ( config.altertitle && typeof document !== "undefined" && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? "\u2716" : "\u2714" ), + document.title.replace( /^[\u2714\u2716] /i, "" ) + ].join( " " ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( "qunit-test-" ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( "done", QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime + }); +} + +/** @return Boolean: true if this test should be ran */ +function validTest( test ) { + var include, + filter = config.filter && config.filter.toLowerCase(), + module = config.module && config.module.toLowerCase(), + fullName = (test.module + ": " + test.testName).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber ) { + return test.testNumber === config.testNumber; + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== "!"; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; +} + +// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) +// Later Safari and IE10 are supposed to support error.stack as well +// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack +function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + var stack, include, i; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( "\n" )[ offset + 3 ]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( "\n" ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[ i ].indexOf( fileName ) !== -1 ) { + break; + } + include.push( stack[ i ] ); + } + if ( include.length ) { + return include.join( "\n" ); + } + } + return stack[ offset ]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ":" + e.line; + } +} +function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } +} + +/** + * Escape text for attribute or text content. + */ +function escapeText( s ) { + if ( !s ) { + return ""; + } + s = s + ""; + // Both single quotes and double quotes (for attributes) + return s.replace( /['"<>&]/g, function( s ) { + switch( s ) { + case '\'': + return '''; + case '"': + return '"'; + case '<': + return '<'; + case '>': + return '>'; + case '&': + return '&'; + } + }); +} + +function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } +} + +function process( last ) { + function next() { + process( last ); + } + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + window.setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } +} + +function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( var key in window ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } +} + +function checkPollution() { + var newGlobals, + deletedGlobals, + old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); + } +} + +// returns a new Array with the elements that are in a but not in b +function diff( a, b ) { + var i, j, + result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; +} + +function extend( a, b ) { + for ( var prop in b ) { + if ( b[ prop ] === undefined ) { + delete a[ prop ]; + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== "constructor" || a !== window ) { + a[ prop ] = b[ prop ]; + } + } + + return a; +} + +/** + * @param {HTMLElement} elem + * @param {string} type + * @param {Function} fn + */ +function addEvent( elem, type, fn ) { + // Standards-based browsers + if ( elem.addEventListener ) { + elem.addEventListener( type, fn, false ); + // IE + } else { + elem.attachEvent( "on" + type, fn ); + } +} + +/** + * @param {Array|NodeList} elems + * @param {string} type + * @param {Function} fn + */ +function addEvents( elems, type, fn ) { + var i = elems.length; + while ( i-- ) { + addEvent( elems[i], type, fn ); + } +} + +function hasClass( elem, name ) { + return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; +} + +function addClass( elem, name ) { + if ( !hasClass( elem, name ) ) { + elem.className += (elem.className ? " " : "") + name; + } +} + +function removeClass( elem, name ) { + var set = " " + elem.className + " "; + // Class name may appear multiple times + while ( set.indexOf(" " + name + " ") > -1 ) { + set = set.replace(" " + name + " " , " "); + } + // If possible, trim it for prettiness, but not neccecarily + elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); +} + +function id( name ) { + return !!( typeof document !== "undefined" && document && document.getElementById ) && + document.getElementById( name ); +} + +function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks( key, scope, args ) { + var i, callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[ key ].call(scope, args ); + } else { + callbacks = config[ key ]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[ i ].call( scope, args ); + } + } +} + +// Test for equality any JavaScript type. +// Author: Philippe Rathé +QUnit.equiv = (function() { + + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + var prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { + return callbacks[ prop ].apply( callbacks, args ); + } else { + return callbacks[ prop ]; // or undefined + } + } + } + + // the real equiv function + var innerEquiv, + // stack to decide between skip/abort functions + callers = [], + // stack to avoiding loops from circular referencing + parents = [], + + getProto = Object.getPrototypeOf || function ( obj ) { + return obj.__proto__; + }, + callbacks = (function () { + + // for string, boolean, number and null + function useStrictEquality( b, a ) { + /*jshint eqeqeq:false */ + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotaion VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + "string": useStrictEquality, + "boolean": useStrictEquality, + "number": useStrictEquality, + "null": useStrictEquality, + "undefined": useStrictEquality, + + "nan": function( b ) { + return isNaN( b ); + }, + + "date": function( b, a ) { + return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); + }, + + "regexp": function( b, a ) { + return QUnit.objectType( b ) === "regexp" && + // the regex itself + a.source === b.source && + // and its modifers + a.global === b.global && + // (gmi) ... + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline && + a.sticky === b.sticky; + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + "function": function() { + var caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== "undefined"; + }, + + "array": function( b, a ) { + var i, j, len, loop; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== "array" ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + loop = true;// dont rewalk array + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + return false; + } + } + parents.pop(); + return true; + }, + + "object": function( b, a ) { + var i, j, loop, + // Default to true + eq = true, + aProperties = [], + bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + // track reference to avoid circular references + parents.push( a ); + + for ( i in a ) { // be strict: don't ensures hasOwnProperty + // and go deep + loop = false; + for ( j = 0; j < parents.length; j++ ) { + if ( parents[j] === a[i] ) { + // don't go down the same path twice + loop = true; + } + } + aProperties.push(i); // collect a's properties + + if (!loop && !innerEquiv( a[i], b[i] ) ) { + eq = false; + break; + } + } + + callers.pop(); // unstack, we are done + parents.pop(); + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + } + }; + }()); + + innerEquiv = function() { // can take multiple arguments + var args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === "undefined" || + typeof b === "undefined" || + QUnit.objectType(a) !== QUnit.objectType(b) ) { + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [ b, a ]); + } + + // apply transition with (1..n) arguments + }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); + }; + + return innerEquiv; +}()); + +/** + * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | + * http://flesler.blogspot.com Licensed under BSD + * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 + * + * @projectDescription Advanced and extensible data dumping for Javascript. + * @version 1.0.0 + * @author Ariel Flesler + * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} + */ +QUnit.jsDump = (function() { + function quote( str ) { + return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; + } + function literal( o ) { + return o + ""; + } + function join( pre, arr, post ) { + var s = jsDump.separator(), + base = jsDump.indent(), + inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( "," + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [ pre, inner + arr, base + post ].join(s); + } + function array( arr, stack ) { + var i = arr.length, ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i] , undefined , stack); + } + this.down(); + return join( "[", ret, "]" ); + } + + var reName = /^function (\w+)/, + jsDump = { + // type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { + stack = stack || [ ]; + var inStack, res, + parser = this.parsers[ type || this.typeOf(obj) ]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack !== -1 ) { + return "recursion(" + (inStack - stack.length) + ")"; + } + if ( type === "function" ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + return ( type === "string" ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + var type; + if ( obj === null ) { + type = "null"; + } else if ( typeof obj === "undefined" ) { + type = "undefined"; + } else if ( QUnit.is( "regexp", obj) ) { + type = "regexp"; + } else if ( QUnit.is( "date", obj) ) { + type = "date"; + } else if ( QUnit.is( "function", obj) ) { + type = "function"; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { + type = "window"; + } else if ( obj.nodeType === 9 ) { + type = "document"; + } else if ( obj.nodeType ) { + type = "node"; + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { + type = "array"; + } else if ( obj.constructor === Error.prototype.constructor ) { + type = "error"; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? "
      " : "\n" : this.HTML ? " " : " "; + }, + // extra can be a number, shortcut for increasing-calling-decreasing + indent: function( extra ) { + if ( !this.multiline ) { + return ""; + } + var chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); + } + return new Array( this._depth_ + (extra||0) ).join(chr); + }, + up: function( a ) { + this._depth_ += a || 1; + }, + down: function( a ) { + this._depth_ -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + _depth_: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + window: "[Window]", + document: "[Document]", + error: function(error) { + return "Error(\"" + error.message + "\")"; + }, + unknown: "[Unknown]", + "null": "null", + "undefined": "undefined", + "function": function( fn ) { + var ret = "function", + // functions never have name in IE + name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if ( name ) { + ret += " " + name; + } + ret += "( "; + + ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); + return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); + }, + array: array, + nodelist: array, + "arguments": array, + object: function( map, stack ) { + var ret = [ ], keys, key, val, i; + QUnit.jsDump.up(); + keys = []; + for ( key in map ) { + keys.push( key ); + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[ i ]; + val = map[ key ]; + ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( "{", ret, "}" ); + }, + node: function( node ) { + var len, i, val, + open = QUnit.jsDump.HTML ? "<" : "<", + close = QUnit.jsDump.HTML ? ">" : ">", + tag = node.nodeName.toLowerCase(), + ret = open + tag, + attrs = node.attributes; + + if ( attrs ) { + for ( i = 0, len = attrs.length; i < len; i++ ) { + val = attrs[i].nodeValue; + // IE6 includes all attributes in .attributes, even ones not explicitly set. + // Those have values like undefined, null, 0, false, "" or "inherit". + if ( val && val !== "inherit" ) { + ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if ( node.nodeType === 3 || node.nodeType === 4 ) { + ret += node.nodeValue; + } + + return ret + open + "/" + tag + close; + }, + // function calls it internally, it's the arguments part of the function + functionArgs: function( fn ) { + var args, + l = fn.length; + + if ( !l ) { + return ""; + } + + args = new Array(l); + while ( l-- ) { + // 97 is 'a' + args[l] = String.fromCharCode(97+l); + } + return " " + args.join( ", " ) + " "; + }, + // object calls it internally, the key part of an item in a map + key: quote, + // function calls it internally, it's the content of the function + functionCode: "[code]", + // node calls it internally, it's an html attribute value + attribute: quote, + string: quote, + date: quote, + regexp: literal, + number: literal, + "boolean": literal + }, + // if true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + // indentation unit + indentChar: " ", + // if true, items in a collection, are separated by a \n, else just a space. + multiline: true + }; + + return jsDump; +}()); + +// from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * Released under the MIT license. + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + * + * Usage: QUnit.diff(expected, actual) + * + * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" + */ +QUnit.diff = (function() { + /*jshint eqeqeq:false, eqnull:true */ + function diff( o, n ) { + var i, + ns = {}, + os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( !hasOwn.call( ns, n[i] ) ) { + ns[ n[i] ] = { + rows: [], + o: null + }; + } + ns[ n[i] ].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( !hasOwn.call( os, o[i] ) ) { + os[ o[i] ] = { + rows: [], + n: null + }; + } + os[ o[i] ].rows.push( i ); + } + + for ( i in ns ) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ ns[i].rows[0] ] = { + text: n[ ns[i].rows[0] ], + row: os[i].rows[0] + }; + o[ os[i].rows[0] ] = { + text: o[ os[i].rows[0] ], + row: ns[i].rows[0] + }; + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && + n[ i + 1 ] == o[ n[i].row + 1 ] ) { + + n[ i + 1 ] = { + text: n[ i + 1 ], + row: n[i].row + 1 + }; + o[ n[i].row + 1 ] = { + text: o[ n[i].row + 1 ], + row: i + 1 + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && + n[ i - 1 ] == o[ n[i].row - 1 ]) { + + n[ i - 1 ] = { + text: n[ i - 1 ], + row: n[i].row - 1 + }; + o[ n[i].row - 1 ] = { + text: o[ n[i].row - 1 ], + row: i - 1 + }; + } + } + + return { + o: o, + n: n + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, "" ); + n = n.replace( /\s+$/, "" ); + + var i, pre, + str = "", + out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), + oSpace = o.match(/\s+/g), + nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [ " " ]; + } + else { + oSpace.push( " " ); + } + + if ( nSpace == null ) { + nSpace = [ " " ]; + } + else { + nSpace.push( " " ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += "" + out.o[i] + oSpace[i] + ""; + } + } + else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += "" + out.o[n] + oSpace[n] + ""; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += "" + out.n[i] + nSpace[i] + ""; + } + else { + // `pre` initialized at top of scope + pre = ""; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += "" + out.o[n] + oSpace[n] + ""; + } + str += " " + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; +}()); + +// for CommonJS enviroments, export everything +if ( typeof exports !== "undefined" ) { + extend( exports, QUnit ); +} + +// get at whatever the global object is, like window in browsers +}( (function() {return this;}.call()) )); diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/all.7zip.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/all.7zip.zip new file mode 100644 index 00000000..a7a6c5f5 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/all.7zip.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/all.windows.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/all.windows.zip new file mode 100644 index 00000000..97b8ab93 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/all.windows.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/all.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/all.zip new file mode 100644 index 00000000..808eeb0e Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/all.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/archive_comment.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/archive_comment.zip new file mode 100644 index 00000000..40ab733f Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/archive_comment.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/backslash.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/backslash.zip new file mode 100644 index 00000000..a63d7b3b Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/backslash.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.ods b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.ods new file mode 100644 index 00000000..77988bda Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.ods differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.xlsx b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.xlsx new file mode 100644 index 00000000..b592785c Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/AntarcticaTemps.xlsx differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Franz Kafka - The Metamorphosis.epub b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Franz Kafka - The Metamorphosis.epub new file mode 100644 index 00000000..b7b7a207 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Franz Kafka - The Metamorphosis.epub differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Outlook2007_Calendar.xps b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Outlook2007_Calendar.xps new file mode 100644 index 00000000..1cfdf773 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/complex_files/Outlook2007_Calendar.xps differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/data_descriptor.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/data_descriptor.zip new file mode 100644 index 00000000..e8841811 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/data_descriptor.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/deflate.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/deflate.zip new file mode 100644 index 00000000..a6c7cbc9 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/deflate.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/encrypted.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/encrypted.zip new file mode 100644 index 00000000..632a988b Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/encrypted.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/extra_attributes.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/extra_attributes.zip new file mode 100644 index 00000000..1bae7120 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/extra_attributes.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/folder.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/folder.zip new file mode 100644 index 00000000..c06e26a7 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/folder.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/image.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/image.zip new file mode 100644 index 00000000..b5217b98 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/image.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/bad_offset.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/bad_offset.zip new file mode 100644 index 00000000..cb76f863 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/bad_offset.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/compression.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/compression.zip new file mode 100644 index 00000000..b180d37a Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/compression.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/crc32.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/crc32.zip new file mode 100644 index 00000000..667401c4 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/invalid/crc32.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/nested.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/nested.zip new file mode 100644 index 00000000..892a3233 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/nested.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/nested_data_descriptor.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/nested_data_descriptor.zip new file mode 100644 index 00000000..b70ba4b0 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/nested_data_descriptor.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/nested_zip64.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/nested_zip64.zip new file mode 100644 index 00000000..85860c37 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/nested_zip64.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/pile_of_poo.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/pile_of_poo.zip new file mode 100644 index 00000000..1ff8df8c Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/pile_of_poo.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/slashes_and_izarc.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/slashes_and_izarc.zip new file mode 100644 index 00000000..328b52ad Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/slashes_and_izarc.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/store.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/store.zip new file mode 100644 index 00000000..761b9194 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/store.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/subfolder.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/subfolder.zip new file mode 100644 index 00000000..333057e6 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/subfolder.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/text.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/text.zip new file mode 100644 index 00000000..a08fcacd Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/text.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/utf8.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/utf8.zip new file mode 100644 index 00000000..363133b0 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/utf8.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/utf8_in_name.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/utf8_in_name.zip new file mode 100644 index 00000000..32ecb71b Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/utf8_in_name.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/winrar_utf8_in_name.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/winrar_utf8_in_name.zip new file mode 100644 index 00000000..5dfdf857 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/winrar_utf8_in_name.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/ref/zip64.zip b/commodoreclicker/js/thirdparty/jszip/test/ref/zip64.zip new file mode 100644 index 00000000..a997177b Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/ref/zip64.zip differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/smile.gif b/commodoreclicker/js/thirdparty/jszip/test/smile.gif new file mode 100644 index 00000000..dd8c0192 Binary files /dev/null and b/commodoreclicker/js/thirdparty/jszip/test/smile.gif differ diff --git a/commodoreclicker/js/thirdparty/jszip/test/test.js b/commodoreclicker/js/thirdparty/jszip/test/test.js new file mode 100644 index 00000000..22745d52 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/test/test.js @@ -0,0 +1,1281 @@ +'use strict'; +//var JSZip = require('../lib'); +function similar(actual, expected, mistakes) { + // actual is the generated zip, expected is what we got from the xhr. + // Be sure to have a well formatted string + expected = JSZip.utils.string2binary(expected); + + if (actual.length !== expected.length) { + mistakes -= Math.abs((actual.length||0) - (expected.length||0)); + } + + for (var i = 0; i < Math.min(actual.length, expected.length); i++) { + if (actual.charAt(i) !== expected.charAt(i)) { + mistakes--; + } + } + + if (mistakes < 0) + return false; + else + return true; +} + +/** + * bytes -> JSZip -> bytes + */ +function reload(bytesStream) { + return new JSZip(bytesStream, {checkCRC32:true}).generate({type:"string"}); +} + +// cache for files +var refZips = {}; + +function testZipFile(testName, zipName, testFunction) { + test(testName, function () { + if (refZips[zipName]) { + testFunction.call(this, refZips[zipName]); + } else { + stop(); + JSZipTestUtils.loadZipFile(zipName, function (err, file) { + if (QUnit.config.semaphore) { + start(); + } + + if(err) { + ok(false, err); + return; + } + + file = JSZip.utils.transformTo("string", file); + refZips[zipName] = file; + testFunction.call(this, file); + }); + } + }); +} + + + + +test("JSZip", function(){ + ok(JSZip, "JSZip exists"); + + var zip = new JSZip(); + ok(zip instanceof JSZip, "Constructor works"); + + var zipNoNew = JSZip(); + ok(zipNoNew instanceof JSZip, "Constructor adds `new` before itself where necessary"); +}); + +QUnit.module("Essential"); // {{{ + +test("JSZip.utils.transformTo", function () { + var supportedArgs = ['string', 'array']; + if (JSZip.support.arraybuffer) { + supportedArgs.push("arraybuffer"); + } + if (JSZip.support.uint8array) { + supportedArgs.push("uint8array"); + } + if (JSZip.support.nodebuffer) { + supportedArgs.push("nodebuffer"); + } + + var txt = 'test text !'; + + for (var i = 0; i < supportedArgs.length; i++) { + for (var j = 0; j < supportedArgs.length; j++) { + var step1 = JSZip.utils.transformTo(supportedArgs[i], txt); + var step2 = JSZip.utils.transformTo(supportedArgs[j], step1); + var result = JSZip.utils.transformTo("string", step2); + equal(result, txt, "The transformation string -> " + supportedArgs[i] + " -> " + supportedArgs[j] + " -> string works"); + } + } +}); + +testZipFile("Zip text file !", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + /* + Expected differing bytes: + 2 version number + 4 date/time + 4 central dir version numbers + 4 central dir date/time + 4 external file attributes + + 18 Total + */ + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + +testZipFile("Add a file to overwrite", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "hello ?"); + zip.file("Hello.txt", "Hello World\n"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + /* + Expected differing bytes: + 2 version number + 4 date/time + 4 central dir version numbers + 4 central dir date/time + 4 external file attributes + + 18 Total + */ + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); + }); + +// zip -X -0 utf8.zip amount.txt +testZipFile("Zip text file with UTF-8 characters", "ref/utf8.zip", function(expected) { + var zip = new JSZip(); + zip.file("amount.txt", "€15\n"); + var actual = zip.generate({type:"string"}); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); + }); + +// zip -X -0 utf8_in_name.zip €15.txt +testZipFile("Zip text file with UTF-8 characters in filename", "ref/utf8_in_name.zip", function(expected) { + var zip = new JSZip(); + zip.file("€15.txt", "€15\n"); + var actual = zip.generate({type:"string"}); + + // zip doesn't generate a strange file like us (utf8 flag AND unicode path extra field) + // if one of the files has more data than the other, the bytes are no more aligned and the + // error count goes through the roof. The parsing is checked on a other test so I'll + // comment this one for now. + // ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); + }); + +// zip -X -0 pile_of_poo.zip Iñtërnâtiônàlizætiøn☃💩.txt +testZipFile("Zip text file and UTF-8, Pile Of Poo test", "ref/pile_of_poo.zip", function(expected) { + var zip = new JSZip(); + // this is the string "Iñtërnâtiônàlizætiøn☃💩", + // see http://mathiasbynens.be/notes/javascript-unicode + // but escaped, to avoid troubles + // thanks http://mothereff.in/js-escapes#1I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n%E2%98%83%F0%9F%92%A9 + var text = 'I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\u2603\uD83D\uDCA9'; + zip.file(text + ".txt", text + "\n"); + var actual = zip.generate({type:"string"}); + + equal(reload(actual), actual, "Generated ZIP can be parsed"); + + ok(new JSZip(expected).file(text + ".txt"), "JSZip finds the unicode file name on the external file"); + ok(new JSZip(actual).file(text + ".txt"), "JSZip finds the unicode file name on its own file"); + var textFromExpected = new JSZip(expected).file(text + ".txt").asText(); + var textFromActual = new JSZip(actual).file(text + ".txt").asText(); + + equal(textFromExpected, text + "\n", "JSZip can decode the external file"); + equal(textFromActual, text + "\n", "JSZip can decode its own file"); +}); + +testZipFile("Zip text file with date", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n", {date : new Date("July 17, 2009 14:36:57")}); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + /* + Expected differing bytes: + 2 version number + 4 central dir version numbers + 4 external file attributes + + 10 Total + */ + ok(similar(actual, expected, 10) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + + +testZipFile("Zip image file", "ref/image.zip", function(expected) { + var zip = new JSZip(); + zip.file("smile.gif", "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=", {base64: true}); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + +test("Zip folder() shouldn't throw an exception", function(expected) { + var zip = new JSZip(); + try { + zip.folder(); + ok(true, "no exception thrown"); + } catch (e) { + ok(false, e.message||e); + } +}); + +testZipFile("Zip empty folder", "ref/folder.zip", function(expected) { + var zip = new JSZip(); + zip.folder("folder"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + +testZipFile("Zip text, folder and image", "ref/all.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + zip.folder("images").file("smile.gif", "R0lGODdhBQAFAIACAAAAAP/eACwAAAAABQAFAAACCIwPkWerClIBADs=", {base64: true}); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + /* + Expected differing bytes: + 2 version number + 4 date/time + 4 central dir version numbers + 4 central dir date/time + 4 external file attributes + + 18 * 3 files + 54 Total + */ + + ok(similar(actual, expected, 54) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + +test("Finding a file", function() { + var zip = new JSZip(); + zip.file("Readme", "Hello World!\n"); + zip.file("Readme.French", "Bonjour tout le monde!\n"); + zip.file("Readme.Pirate", "Ahoy m'hearty!\n"); + + equal(zip.file("Readme.French").asText(), "Bonjour tout le monde!\n", "Exact match found"); + equal(zip.file("Readme.Deutch"), null, "Match exactly nothing"); + equal(zip.file(/Readme\../).length, 2, "Match regex free text"); + equal(zip.file(/pirate/i).length, 1, "Match regex 1 result"); +}); + +testZipFile("Finding a file : modifying the result doesn't alter the zip", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + zip.file("Hello.txt").name = "Hello2.txt"; + zip.file("Hello.txt").dir = true; + // these changes won't be used + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +test("Finding a file (text search) with a relative folder", function() { + var zip = new JSZip(); + zip.folder("files/default").file("Readme", "Hello World!\n"); + zip.folder("files/translation").file("Readme.French", "Bonjour tout le monde!\n"); + zip.folder("files").folder("translation").file("Readme.Pirate", "Ahoy m'hearty!\n"); + + equal(zip.file("files/translation/Readme.French").asText(), "Bonjour tout le monde!\n", "finding file with the full path"); + equal(zip.folder("files").file("translation/Readme.French").asText(), "Bonjour tout le monde!\n", "finding file with a relative path"); + equal(zip.folder("files/translation").file("Readme.French").asText(), "Bonjour tout le monde!\n", "finding file with a relative path"); +}); + +test("Finding files (regex) with a relative folder", function() { + var zip = new JSZip(); + zip.folder("files/default").file("Readme", "Hello World!\n"); + zip.folder("files/translation").file("Readme.French", "Bonjour tout le monde!\n"); + zip.folder("files").folder("translation").file("Readme.Pirate", "Ahoy m'hearty!\n"); + + equal(zip.file(/Readme/).length, 3, "match files in subfolders"); + equal(zip.folder("files/translation").file(/Readme/).length, 2, "regex match only in subfolders"); + equal(zip.folder("files").folder("translation").file(/Readme/).length, 2, "regex match only in subfolders"); + equal(zip.folder("files/translation").file(/pirate/i).length, 1, "regex match only in subfolders"); + equal(zip.folder("files/translation").file(/^readme/i).length, 2, "regex match only with the relative path"); + equal(zip.folder("files/default").file(/pirate/i).length, 0, "regex match only in subfolders"); +}); + +test("Finding folders", function () { + var zip = new JSZip(); + zip.folder("root/").folder("sub1/"); + zip.folder("root/sub2/subsub1"); + + equal(zip.folder(/sub2\/$/).length, 0, "unique result"); + equal(zip.folder(/sub1/).length, 2, "multiple results"); + equal(zip.folder(/root/).length, 3, "match on whole path"); +}); + +test("Finding folders with relative path", function () { + var zip = new JSZip(); + zip.folder("root/").folder("sub1/"); + zip.folder("root/sub2/subsub1"); + var root = zip.folder("root/sub2"); + + equal(root.folder(/sub2\/$/).length, 0, "current folder is not matched"); + equal(root.folder(/sub1/).length, 1, "sub folder is matched"); + equal(root.folder(/^subsub1/).length, 1, "relative folder path is used"); + equal(root.folder(/root/).length, 0, "parent folder is not matched"); +}); + +function zipObjectsAssertions(zipObject) { + var date = new Date("July 17, 2009 14:36:57"); + + equal(zipObject.name, "Hello.txt", "ZipObject#name is here"); + + equal(zipObject.comment, "my comment", "ZipObject#comment is here"); + + // the zip date has a 2s resolution + var delta = Math.abs(zipObject.date.getTime() - date.getTime()); + ok(delta < 2000/* ms */, date, "ZipObject#date is here"); + var deltaOptions = Math.abs(zipObject.options.date.getTime() - date.getTime()); + ok(deltaOptions < 2000/* ms */, date, "ZipObject#options.date is here (deprecated API)"); +} +test("ZipObject attributes", function () { + var date = new Date("July 17, 2009 14:36:57"); + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n", {comment:"my comment", date:date}); + zipObjectsAssertions(zip.file("Hello.txt")); + zipObjectsAssertions(zip.files["Hello.txt"]); + var reloaded = new JSZip(zip.generate({base64:false})); + zipObjectsAssertions(reloaded.file("Hello.txt")); + zipObjectsAssertions(reloaded.files["Hello.txt"]); +}); +test("generate uses updated ZipObject date attribute", function () { + var date = new Date("July 17, 2009 14:36:57"); + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n", {comment:"my comment"}); // date = now + zip.files["Hello.txt"].date = date; + var reloaded = new JSZip(zip.generate({type:"string"})); + zipObjectsAssertions(reloaded.file("Hello.txt")); + zipObjectsAssertions(reloaded.files["Hello.txt"]); +}); +test("generate uses updated ZipObject options.date attribute (deprecated)", function () { + var date = new Date("July 17, 2009 14:36:57"); + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n", {comment:"my comment"}); // date = now + zip.files["Hello.txt"].options.date = date; + var reloaded = new JSZip(zip.generate({type:"string"})); + zipObjectsAssertions(reloaded.file("Hello.txt")); + zipObjectsAssertions(reloaded.files["Hello.txt"]); +}); + +// }}} module Essential + +QUnit.module("More advanced"); // {{{ + +testZipFile("Delete file", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Remove.txt", "This file should be deleted\n"); + zip.file("Hello.txt", "Hello World\n"); + zip.remove("Remove.txt"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + +}); + +testZipFile("Delete file in folder", "ref/folder.zip", function(expected) { + var zip = new JSZip(); + zip.folder("folder").file("Remove.txt", "This folder and file should be deleted\n"); + zip.remove("folder/Remove.txt"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("Delete file in folder, with a relative path", "ref/folder.zip", function(expected) { + var zip = new JSZip(); + var folder = zip.folder("folder"); + folder.file("Remove.txt", "This folder and file should be deleted\n"); + folder.remove("Remove.txt"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("Delete folder", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); + zip.file("Hello.txt", "Hello World\n"); + zip.remove("remove"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("Delete folder with a final /", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); + zip.file("Hello.txt", "Hello World\n"); + zip.remove("remove/"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("Delete unknown path", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + zip.remove("unknown_file"); + zip.remove("unknown_folder/Hello.txt"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("Delete nested folders", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.folder("remove").file("Remove.txt", "This folder and file should be deleted\n"); + zip.folder("remove/second").file("Sub.txt", "This should be removed"); + zip.file("remove/second/another.txt", "Another file"); + zip.file("Hello.txt", "Hello World\n"); + zip.remove("remove"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + +}); + +testZipFile("Delete nested folders from relative path", "ref/folder.zip", function(expected) { + var zip = new JSZip(); + zip.folder("folder"); + zip.folder("folder/1/2/3"); + zip.folder("folder").remove("1"); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(actual), actual, "Generated ZIP can be parsed"); +}); + +testZipFile("add file: from XHR (with bytes > 255)", "ref/text.zip", function(textZip) { + var zip = new JSZip(); + zip.file("text.zip", textZip, {binary:true}); + var actual = zip.generate({base64:false}); + + equal(reload(actual), actual, "high-order byte is discarded and won't mess up the result"); +}); + +function testFileDataGetters (opts) { + if (typeof opts.rawData === "undefined") { + opts.rawData = opts.textData; + } + _actualTestFileDataGetters.asText(opts); + _actualTestFileDataGetters.asBinary(opts); + _actualTestFileDataGetters.asArrayBuffer(opts); + _actualTestFileDataGetters.asUint8Array(opts); + _actualTestFileDataGetters.asNodeBuffer(opts); + + var reload = function () { + return { + name : "reloaded, " + opts.name, + // no check of crc32, we want to test the CompressedObject code. + zip : new JSZip(opts.zip.generate({type:"string"}, {checkCRC32:false})), + textData : opts.textData, + rawData : opts.rawData + }; + }; + + _actualTestFileDataGetters.asText(reload()); + _actualTestFileDataGetters.asBinary(reload()); + _actualTestFileDataGetters.asArrayBuffer(reload()); + _actualTestFileDataGetters.asUint8Array(reload()); + _actualTestFileDataGetters.asNodeBuffer(reload()); +} + +var _actualTestFileDataGetters = { + asText : function (opts) { + equal(opts.zip.file("file.txt").asText(), opts.textData, opts.name + " : asText()"); + }, + asBinary : function (opts) { + equal(opts.zip.file("file.txt").asBinary(), opts.rawData, opts.name + " : asBinary()"); + }, + asArrayBuffer : function (opts) { + if (JSZip.support.arraybuffer) { + var buffer = opts.zip.file("file.txt").asArrayBuffer(); + ok(buffer instanceof ArrayBuffer, opts.name + " : the result is a instance of ArrayBuffer"); + var actual = JSZip.utils.transformTo("string", buffer); + equal(actual, opts.rawData, opts.name + " : asArrayBuffer()"); + } else { + try { + opts.zip.file("file.txt").asArrayBuffer(); + ok(false, "no exception thrown"); + } catch (e) { + ok(e.message.match("not supported by this browser"), opts.name + " : the error message is useful"); + } + } + }, + asUint8Array : function (opts) { + if (JSZip.support.uint8array) { + var bufferView = opts.zip.file("file.txt").asUint8Array(); + ok(bufferView instanceof Uint8Array, opts.name + " : the result is a instance of Uint8Array"); + var actual = JSZip.utils.transformTo("string", bufferView); + equal(actual, opts.rawData, opts.name + " : asUint8Array()"); + } else { + try { + opts.zip.file("file.txt").asUint8Array(); + ok(false, "no exception thrown"); + } catch (e) { + ok(e.message.match("not supported by this browser"), opts.name + " : the error message is useful"); + } + } + }, + asNodeBuffer : function (opts) { + if (JSZip.support.nodebuffer) { + var buffer = opts.zip.file("file.txt").asNodeBuffer(); + ok(buffer instanceof Buffer, opts.name + " : the result is a instance of Buffer"); + var actual = JSZip.utils.transformTo("string", buffer); + equal(actual, opts.rawData, opts.name + " : .asNodeBuffer()"); + } else { + try { + opts.zip.file("file.txt").asNodeBuffer(); + ok(false, "no exception thrown"); + } catch (e) { + ok(e.message.match("not supported by this browser"), opts.name + " : the error message is useful"); + } + } + } +}; + +test("add file: file(name, undefined)", function() { + var zip = new JSZip(), undef; + zip.file("file.txt", undef); + testFileDataGetters({name : "undefined", zip : zip, textData : ""}); + zip = new JSZip(); + zip.file("file.txt", undef, {binary:true}); + testFileDataGetters({name : "undefined", zip : zip, textData : ""}); + zip = new JSZip(); + zip.file("file.txt", undef, {base64:true}); + testFileDataGetters({name : "undefined", zip : zip, textData : ""}); +}); + +test("add file: file(name, null)", function() { + var zip = new JSZip(); + zip.file("file.txt", null); + testFileDataGetters({name : "null", zip : zip, textData : ""}); + zip = new JSZip(); + zip.file("file.txt", null, {binary:true}); + testFileDataGetters({name : "null", zip : zip, textData : ""}); + zip = new JSZip(); + zip.file("file.txt", null, {base64:true}); + testFileDataGetters({name : "null", zip : zip, textData : ""}); +}); + +test("add file: file(name, stringAsText)", function() { + var zip = new JSZip(); + zip.file("file.txt", "€15\n", {binary:false}); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", "test\r\ntest\r\n", {binary:false}); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); +}); + +test("add file: file(name, stringAsBinary)", function() { + var zip = new JSZip(); + zip.file("file.txt", "\xE2\x82\xAC15\n", {binary:true}); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", "test\r\ntest\r\n", {binary:true}); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); +}); + +test("add file: file(name, base64)", function() { + var zip = new JSZip(); + zip.file("file.txt", "4oKsMTUK", {base64:true}); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", "dGVzdA0KdGVzdA0K", {base64:true}); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); +}); + +test("add file: file(name, unsupported)", function() { + var zip = new JSZip(); + try { + zip.file("test.txt", new Date()); + ok(false, "An unsupported object was added, but no exception thrown"); + } catch(e) { + ok(e.message.match("unsupported format"), "the error message is useful"); + } + if (JSZip.support.blob) { + var blob = zip.generate({type:"blob"}); + try { + zip.file("test.txt", blob); + ok(false, "An blob was added, but no exception thrown"); + } catch(e) { + ok(e.message.match("unsupported format"), "the error message is useful"); + } + } +}); + +if (JSZip.support.uint8array) { + test("add file: file(name, Uint8Array)", function() { + var str2array = function (str) { + var array = new Uint8Array(str.length); + for(var i = 0; i < str.length; i++) { + array[i] = str.charCodeAt(i); + } + return array; + }; + var zip = new JSZip(); + zip.file("file.txt", str2array("\xE2\x82\xAC15\n")); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", str2array("test\r\ntest\r\n")); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); + zip = new JSZip(); + zip.file("file.txt", str2array("")); + testFileDataGetters({name : "empty content", zip : zip, textData : ""}); + }); +} + +if (JSZip.support.arraybuffer) { + test("add file: file(name, ArrayBuffer)", function() { + var str2buffer = function (str) { + var array = new Uint8Array(str.length); + for(var i = 0; i < str.length; i++) { + array[i] = str.charCodeAt(i); + } + return array.buffer; + }; + var zip = new JSZip(); + zip.file("file.txt", str2buffer("\xE2\x82\xAC15\n")); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", str2buffer("test\r\ntest\r\n")); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); + zip = new JSZip(); + zip.file("file.txt", str2buffer("")); + testFileDataGetters({name : "empty content", zip : zip, textData : ""}); + }); +} + +if (JSZip.support.nodebuffer) { + test("add file: file(name, Buffer)", function() { + var str2buffer = function (str) { + var array = new Buffer(str.length); + for(var i = 0; i < str.length; i++) { + array[i] = str.charCodeAt(i); + } + return array; + }; + var zip = new JSZip(); + zip.file("file.txt", str2buffer("\xE2\x82\xAC15\n")); + testFileDataGetters({name : "utf8", zip : zip, textData : "€15\n", rawData : "\xE2\x82\xAC15\n"}); + zip = new JSZip(); + zip.file("file.txt", str2buffer("test\r\ntest\r\n")); + testFileDataGetters({name : "\\r\\n", zip : zip, textData : "test\r\ntest\r\n"}); + zip = new JSZip(); + zip.file("file.txt", str2buffer("")); + testFileDataGetters({name : "empty content", zip : zip, textData : ""}); + }); +} + +testZipFile("generate : base64:false. Deprecated, but it still works", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var actual = zip.generate({base64:false}); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("generate : base64:true. Deprecated, but it still works", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var content = zip.generate({base64:true}); + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("generate : type:string", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var actual = zip.generate({type:"string"}); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +testZipFile("generate : type:base64", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var content = zip.generate({type:"base64"}); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +if (JSZip.support.uint8array) { + testZipFile("generate : type:uint8array", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var array = zip.generate({type:"uint8array"}); + ok(array instanceof Uint8Array, "The result is a instance of Uint8Array"); + equal(array.length, expected.length); + + var actual = JSZip.utils.transformTo("string", array); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + }); +} else { + testZipFile("generate : type:uint8array", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + try { + var blob = zip.generate({type:"uint8array"}); + ok(false, "Uint8Array is not supported, but no exception thrown"); + } catch(e) { + ok(e.message.match("not supported by this browser"), "the error message is useful"); + } + }); +} + +if (JSZip.support.arraybuffer) { + testZipFile("generate : type:arraybuffer", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var buffer = zip.generate({type:"arraybuffer"}); + ok(buffer instanceof ArrayBuffer, "The result is a instance of ArrayBuffer"); + + var actual = JSZip.utils.transformTo("string", buffer); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + }); +} else { + testZipFile("generate : type:arraybuffer", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + try { + var blob = zip.generate({type:"arraybuffer"}); + ok(false, "ArrayBuffer is not supported, but no exception thrown"); + } catch(e) { + ok(e.message.match("not supported by this browser"), "the error message is useful"); + } + }); +} + +if (JSZip.support.nodebuffer) { + testZipFile("generate : type:nodebuffer", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var buffer = zip.generate({type:"nodebuffer"}); + ok(buffer instanceof Buffer, "The result is a instance of ArrayBuffer"); + + var actual = ""; + for (var i = 0; i < buffer.length; i++) { + actual += String.fromCharCode(buffer[i]); + } + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + }); +} else { + testZipFile("generate : type:nodebuffer", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + try { + var blob = zip.generate({type:"nodebuffer"}); + ok(false, "Buffer is not supported, but no exception thrown"); + } catch(e) { + ok(e.message.match("not supported by this browser"), "the error message is useful"); + } + }); +} + +if (JSZip.support.blob) { + testZipFile("generate : type:blob", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var blob = zip.generate({type:"blob"}); + ok(blob instanceof Blob, "The result is a instance of Blob"); + equal(blob.type, "application/zip"); + equal(blob.size, expected.length); + }); +} else { + testZipFile("generate : type:blob", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + try { + var blob = zip.generate({type:"blob"}); + ok(false, "Blob is not supported, but no exception thrown"); + } catch(e) { + ok(e.message.match("not supported by this browser"), "the error message is useful"); + } + }); +} + +test("Filtering a zip", function() { + var zip = new JSZip(); + zip.file("1.txt", "1\n"); + zip.file("2.txt", "2\n"); + zip.file("3.log", "3\n"); + var result = zip.filter(function (relativeFilename, file){ + return relativeFilename.indexOf(".txt") != -1; + }); + equal(result.length, 2, "filter has filtered"); + ok(result[0].name.indexOf(".txt") != -1, "filter has filtered the good file"); + ok(result[1].name.indexOf(".txt") != -1, "filter has filtered the good file"); +}); + +test("Filtering a zip from a relative path", function() { + var zip = new JSZip(); + zip.file("foo/1.txt", "1\n"); + zip.file("foo/2.txt", "2\n"); + zip.file("foo/3.log", "3\n"); + zip.file("1.txt", "1\n"); + zip.file("2.txt", "2\n"); + zip.file("3.log", "3\n"); + + var result = zip.folder("foo").filter(function (relativeFilename, file) { + return relativeFilename.indexOf("3") != -1; + }); + equal(result.length, 1, "filter has filtered"); + equal(result[0].name, "foo/3.log", "filter has filtered the good file"); +}); + +test("Filtering a zip : the full path is still accessible", function() { + var zip = new JSZip(); + zip.file("foo/1.txt", "1\n"); + zip.file("foo/2.txt", "2\n"); + zip.file("foo/3.log", "3\n"); + zip.file("1.txt", "1\n"); + zip.file("2.txt", "2\n"); + zip.file("3.log", "3\n"); + + var result = zip.folder("foo").filter(function (relativeFilename, file) { + return file.name.indexOf("3") != -1; + }); + equal(result.length, 1, "the filter only match files/folders in the current folder"); + equal(result[0].name, "foo/3.log", "filter has filtered the good file"); +}); + +testZipFile("Filtering a zip : the filter function can't alter the data", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + zip.filter(function (relativeFilename, file) { + file.name = "bye.txt"; + file.data = "good bye"; + file.dir = true; + }); + var content = zip.generate(); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); + +}); + +testZipFile("STORE is the default method", "ref/text.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n"); + var content = zip.generate({compression:'STORE'}); + + var actual = JSZip.base64.decode(content); + + // no difference with the "Zip text file" test. + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +// zip -0 -X store.zip Hello.txt +testZipFile("STORE doesn't compress", "ref/store.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "This a looong file : we need to see the difference between the different compression methods.\n"); + var content = zip.generate({compression:'STORE'}); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +// zip -6 -X deflate.zip Hello.txt +testZipFile("DEFLATE compress", "ref/deflate.zip", function(expected) { + var zip = new JSZip(); + zip.file("Hello.txt", "This a looong file : we need to see the difference between the different compression methods.\n"); + var content = zip.generate({compression:'DEFLATE'}); + + var actual = JSZip.base64.decode(content); + + ok(similar(actual, expected, 18) , "Generated ZIP matches reference ZIP"); +}); + +test("Lazy decompression works", function () { + var zip = new JSZip(); + zip.folder("test/").file("Hello.txt", "hello !"); + + var expected = zip.generate({type:"string", compression:"STORE"}); + + zip = new JSZip(expected); // lazy + equal(zip.generate({type:"string", compression:"STORE"}), expected, "Reloading file, same compression"); + + zip = new JSZip(zip.generate({type:"string", compression:"DEFLATE"})); + zip = new JSZip(zip.generate({type:"string", compression:"STORE"})); + + var zipData = zip.generate({type:"string", compression:"STORE"}); + equal(zipData, expected, "Reloading file, different compression"); + + // check CRC32 + new JSZip(zipData, {checkCRC32:true}).generate({type:"string"}); +}); + +test("Empty files / folders are not compressed", function() { + var zip = new JSZip(); + zip.file("Hello.txt", "This a looong file : we need to see the difference between the different compression methods.\n"); + zip.folder("folder").file("empty", ""); + + var deflateCount = 0, emptyDeflateCount = 0; + var oldDeflateCompress = JSZip.compressions.DEFLATE.compress; + JSZip.compressions.DEFLATE.compress = function (str) { + deflateCount++; + if (!str) { + emptyDeflateCount++; + } + return str; + }; + zip.generate({compression:'DEFLATE'}); + + equal(deflateCount, 1, "The file has been compressed"); + equal(emptyDeflateCount, 0, "The file without content and the folder has not been compressed."); + + JSZip.compressions.DEFLATE.compress = oldDeflateCompress; +}); + +test("unknown compression throws an exception", function () { + var zip = new JSZip().file("file.txt", "test"); + try { + zip.generate({compression:'MAYBE'}); + ok(false, "no exception"); + } catch (e) { + ok(true, "an exception were thrown"); + } +}); +// }}} More advanced + +QUnit.module("Load file, not supported features"); // {{{ + +// zip -0 -X -e encrypted.zip Hello.txt +testZipFile("basic encryption", "ref/encrypted.zip", function(file) { + try { + var zip = new JSZip(file); + ok(false, "Encryption is not supported, but no exception were thrown"); + } catch(e) { + equal(e.message, "Encrypted zip are not supported", "the error message is useful"); + } +}); +// }}} Load file, not supported features + +QUnit.module("Load file, corrupted zip"); // {{{ + +testZipFile("bad compression method", "ref/invalid/compression.zip", function(file) { + try { + var zip = new JSZip(file); + ok(false, "no exception were thrown"); + } catch(e) { + ok(e.message.match("Corrupted zip"), "the error message is useful"); + } +}); + +testZipFile("invalid crc32 but no check", "ref/invalid/crc32.zip", function(file) { + try { + var zip = new JSZip(file, {checkCRC32:false}); + ok(true, "no exception were thrown"); + } catch(e) { + ok(false, "An exception were thrown but the check should have been disabled."); + } +}); + +testZipFile("invalid crc32", "ref/invalid/crc32.zip", function(file) { + try { + var zip = new JSZip(file, {checkCRC32:true}); + ok(false, "no exception were thrown"); + } catch(e) { + ok(e.message.match("Corrupted zip"), "the error message is useful"); + } +}); + +testZipFile("bad offset", "ref/invalid/bad_offset.zip", function(file) { + try { + var zip = new JSZip(file); + ok(false, "no exception were thrown"); + } catch(e) { + ok(e.message.match("Corrupted zip"), "the error message is useful"); + } +}); +// }}} Load file, corrupted zip + +QUnit.module("Load file"); // {{{ + +testZipFile("load(string) works", "ref/all.zip", function(file) { + ok(typeof file === "string"); + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); +}); + +testZipFile("load(string) handles bytes > 255", "ref/all.zip", function(file) { + // the method used to load zip with ajax will remove the extra bits. + // adding extra bits :) + var updatedFile = ""; + for (var i = 0; i < file.length; i++) { + updatedFile += String.fromCharCode((file.charCodeAt(i) & 0xff) + 0x4200); + } + var zip = new JSZip(updatedFile); + + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); +}); + +if (JSZip.support.arraybuffer) { + testZipFile("load(ArrayBuffer) works", "ref/all.zip", function(fileAsString) { + var file = new ArrayBuffer(fileAsString.length); + var bufferView = new Uint8Array(file); + for( var i = 0; i < fileAsString.length; ++i ) { + bufferView[i] = fileAsString.charCodeAt(i); + } + + ok(file instanceof ArrayBuffer); + + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + equal(new JSZip(file).file("Hello.txt").asArrayBuffer().byteLength, 12, "don't get the original buffer"); + equal(new JSZip(file).file("Hello.txt").asUint8Array().buffer.byteLength, 12, "don't get a view of the original buffer"); + + equal(new JSZip(file).file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); + }); +} + +if (JSZip.support.nodebuffer) { + testZipFile("load(Buffer) works", "ref/all.zip", function(fileAsString) { + var file = new Buffer(fileAsString.length); + for( var i = 0; i < fileAsString.length; ++i ) { + file[i] = fileAsString.charCodeAt(i); + } + + equal(new JSZip(file).file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); + }); +} + +if (JSZip.support.uint8array) { + testZipFile("load(Uint8Array) works", "ref/all.zip", function(fileAsString) { + var file = new Uint8Array(fileAsString.length); + for( var i = 0; i < fileAsString.length; ++i ) { + file[i] = fileAsString.charCodeAt(i); + } + + ok(file instanceof Uint8Array); + + // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array. + // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file). + equal(new JSZip(file).file("Hello.txt").asArrayBuffer().byteLength, 12, "don't get the original buffer"); + equal(new JSZip(file).file("Hello.txt").asUint8Array().buffer.byteLength, 12, "don't get a view of the original buffer"); + + equal(new JSZip(file).file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); + }); +} + +// zip -6 -X deflate.zip Hello.txt +testZipFile("zip with DEFLATE", "ref/deflate.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "This a looong file : we need to see the difference between the different compression methods.\n", "the zip was correctly read."); +}); + +// zip -0 -X -z -c archive_comment.zip Hello.txt +testZipFile("read zip with comment", "ref/archive_comment.zip", function(file) { + var zip = new JSZip(file); + equal(zip.comment, "file comment", "the archive comment was correctly read."); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); + equal(zip.file("Hello.txt").comment, "entry comment", "the entry comment was correctly read."); +}); +testZipFile("generate zip with comment", "ref/archive_comment.zip", function(file) { + var zip = new JSZip(); + zip.file("Hello.txt", "Hello World\n", {comment:"entry comment"}); + var generated = zip.generate({type:"string", comment:"file comment"}); + ok(similar(generated, file, 18) , "Generated ZIP matches reference ZIP"); + equal(reload(generated), generated, "Generated ZIP can be parsed"); +}); + +// zip -0 extra_attributes.zip Hello.txt +testZipFile("zip with extra attributes", "ref/extra_attributes.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); +}); + +// use -fz to force use of Zip64 format +// zip -fz -0 zip64.zip Hello.txt +testZipFile("zip 64", "ref/zip64.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); +}); + +// use -fd to force data descriptors as if streaming +// zip -fd -0 data_descriptor.zip Hello.txt +testZipFile("zip with data descriptor", "ref/data_descriptor.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); +}); + +// combo of zip64 and data descriptors : +// zip -fz -fd -0 data_descriptor_zip64.zip Hello.txt +// this generate a corrupted zip file :( +// TODO : find how to get the two features + +// zip -0 -X zip_within_zip.zip Hello.txt && zip -0 -X nested.zip Hello.txt zip_within_zip.zip +testZipFile("nested zip", "ref/nested.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hello.txt").asText(), "Hello World\n", "the zip was correctly read."); + var nested = new JSZip(zip.file("zip_within_zip.zip").asBinary()); + equal(nested.file("Hello.txt").asText(), "Hello World\n", "the inner zip was correctly read."); +}); + +// zip -fd -0 nested_data_descriptor.zip data_descriptor.zip +testZipFile("nested zip with data descriptors", "ref/nested_data_descriptor.zip", function(file) { + var zip = new JSZip(file); + var nested = new JSZip(zip.file("data_descriptor.zip").asBinary()); + equal(nested.file("Hello.txt").asText(), "Hello World\n", "the inner zip was correctly read."); +}); + +// zip -fz -0 nested_zip64.zip zip64.zip +testZipFile("nested zip 64", "ref/nested_zip64.zip", function(file) { + var zip = new JSZip(file); + var nested = new JSZip(zip.file("zip64.zip").asBinary()); + equal(nested.file("Hello.txt").asText(), "Hello World\n", "the inner zip was correctly read."); +}); + +// nested zip 64 with data descriptors +// zip -fz -fd -0 nested_data_descriptor_zip64.zip data_descriptor_zip64.zip +// this generate a corrupted zip file :( +// TODO : find how to get the two features + +// zip -X -0 utf8_in_name.zip €15.txt +testZipFile("Zip text file with UTF-8 characters in filename", "ref/utf8_in_name.zip", function(file) { + var zip = new JSZip(file); + ok(zip.file("€15.txt") !== null, "the utf8 file is here."); + equal(zip.file("€15.txt").asText(), "€15\n", "the utf8 content was correctly read (with file().asText)."); + equal(zip.files["€15.txt"].asText(), "€15\n", "the utf8 content was correctly read (with files[].astext)."); +}); + +// Created with winrar +// winrar will replace the euro symbol with a '_' but set the correct unicode path in an extra field. +testZipFile("Zip text file with UTF-8 characters in filename and windows compatibility", "ref/winrar_utf8_in_name.zip", function(file) { + var zip = new JSZip(file); + ok(zip.file("€15.txt") !== null, "the utf8 file is here."); + equal(zip.file("€15.txt").asText(), "€15\n", "the utf8 content was correctly read (with file().asText)."); + equal(zip.files["€15.txt"].asText(), "€15\n", "the utf8 content was correctly read (with files[].astext)."); +}); + +// zip backslash.zip -0 -X Hel\\lo.txt +testZipFile("Zip text file with backslash in filename", "ref/backslash.zip", function(file) { + var zip = new JSZip(file); + equal(zip.file("Hel\\lo.txt").asText(), "Hello World\n", "the utf8 content was correctly read."); +}); + +// use izarc to generate a zip file on windows +testZipFile("Zip text file from windows with \\ in central dir", "ref/slashes_and_izarc.zip", function(file) { + var zip = new JSZip(file); + equal(zip.folder("test").file("Hello.txt").asText(), "Hello world\r\n", "the content was correctly read."); +}); + +test("A folder stays a folder", function () { + var zip = new JSZip(); + zip.folder("folder/"); + ok(zip.files['folder/'].dir, "the folder is marked as a folder"); + ok(zip.files['folder/'].options.dir, "the folder is marked as a folder, deprecated API"); + var reloaded = new JSZip(zip.generate({base64:false})); + ok(reloaded.files['folder/'].dir, "the folder is marked as a folder"); + ok(reloaded.files['folder/'].options.dir, "the folder is marked as a folder, deprecated API"); +}); + +// }}} Load file + +QUnit.module("Load complex files"); // {{{ + +if (QUnit.urlParams.complexfiles) { + + // http://www.feedbooks.com/book/8/the-metamorphosis + testZipFile("Franz Kafka - The Metamorphosis.epub", "ref/complex_files/Franz Kafka - The Metamorphosis.epub", function(file) { + var zip = new JSZip(file); + equal(zip.filter(function(){return true;}).length, 26, "the zip contains the good number of elements."); + equal(zip.file("mimetype").asText(), "application/epub+zip\r\n", "the zip was correctly read."); + // the .ncx file tells us that the first chapter is in the main0.xml file. + ok(zip.file("OPS/main0.xml").asText().indexOf("One morning, as Gregor Samsa was waking up from anxious dreams") !== -1, "the zip was correctly read."); + }); + + // a showcase in http://msdn.microsoft.com/en-us/windows/hardware/gg463429 + testZipFile("Outlook2007_Calendar.xps", "ref/complex_files/Outlook2007_Calendar.xps", function(file) { + var zip = new JSZip(file); + // the zip file contains 15 entries. + equal(zip.filter(function(){return true;}).length, 15, "the zip contains the good number of elements."); + ok(zip.file("[Content_Types].xml").asText().indexOf("application/vnd.ms-package.xps-fixeddocument+xml") !== -1, "the zip was correctly read."); + }); + + // Same test as above, but with createFolders option set to true + testZipFile("Outlook2007_Calendar.xps", "ref/complex_files/Outlook2007_Calendar.xps", function(file) { + var zip = new JSZip(file, {createFolders: true}); + // the zip file contains 15 entries, but we get 23 when creating all the sub-folders. + equal(zip.filter(function(){return true;}).length, 23, "the zip contains the good number of elements."); + ok(zip.file("[Content_Types].xml").asText().indexOf("application/vnd.ms-package.xps-fixeddocument+xml") !== -1, "the zip was correctly read."); + }); + + // an example file in http://cheeso.members.winisp.net/srcview.aspx?dir=js-unzip + // the data come from http://www.antarctica.ac.uk/met/READER/upper_air/ + testZipFile("AntarcticaTemps.xlsx", "ref/complex_files/AntarcticaTemps.xlsx", function(file) { + var zip = new JSZip(file); + // the zip file contains 17 entries. + equal(zip.filter(function(){return true;}).length, 17, "the zip contains the good number of elements."); + ok(zip.file("[Content_Types].xml").asText().indexOf("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml") !== -1, "the zip was correctly read."); + }); + + // Same test as above, but with createFolders option set to true + testZipFile("AntarcticaTemps.xlsx", "ref/complex_files/AntarcticaTemps.xlsx", function(file) { + var zip = new JSZip(file, {createFolders: true}); + // the zip file contains 16 entries, but we get 27 when creating all the sub-folders. + equal(zip.filter(function(){return true;}).length, 27, "the zip contains the good number of elements."); + ok(zip.file("[Content_Types].xml").asText().indexOf("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml") !== -1, "the zip was correctly read."); + }); + + // same as two up, but in the Open Document format + testZipFile("AntarcticaTemps.ods", "ref/complex_files/AntarcticaTemps.ods", function (file) { + var zip = new JSZip(file); + // the zip file contains 20 entries. + equal(zip.filter(function () {return true;}).length, 20, "the zip contains the good number of elements."); + ok(zip.file("META-INF/manifest.xml").asText().indexOf("application/vnd.oasis.opendocument.spreadsheet") !== -1, "the zip was correctly read."); + }); + + // same as above, but in the Open Document format + testZipFile("AntarcticaTemps.ods", "ref/complex_files/AntarcticaTemps.ods", function (file) { + var zip = new JSZip(file, {createFolders: true}); + // the zip file contains 19 entries, but we get 27 when creating all the sub-folders. + equal(zip.filter(function () {return true;}).length, 27, "the zip contains the good number of elements."); + ok(zip.file("META-INF/manifest.xml").asText().indexOf("application/vnd.oasis.opendocument.spreadsheet") !== -1, "the zip was correctly read."); + }); +} +// }}} Load complex files + + +// enforcing Stuk's coding style +// vim: set shiftwidth=3 softtabstop=3: diff --git a/commodoreclicker/js/thirdparty/jszip/vendor/FileSaver.js b/commodoreclicker/js/thirdparty/jszip/vendor/FileSaver.js new file mode 100644 index 00000000..112efb07 --- /dev/null +++ b/commodoreclicker/js/thirdparty/jszip/vendor/FileSaver.js @@ -0,0 +1,247 @@ +/*! FileSaver.js + * A saveAs() FileSaver implementation. + * 2014-01-24 + * + * By Eli Grey, http://eligrey.com + * License: X11/MIT + * See LICENSE.md + */ + +/*global self */ +/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ + +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ + +var saveAs = saveAs + // IE 10+ (native saveAs) + || (typeof navigator !== "undefined" && + navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator)) + // Everyone else + || (function(view) { + "use strict"; + // IE <10 is explicitly unsupported + if (typeof navigator !== "undefined" && + /MSIE [1-9]\./.test(navigator.userAgent)) { + return; + } + var + doc = view.document + // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet + , get_URL = function() { + return view.URL || view.webkitURL || view; + } + , URL = view.URL || view.webkitURL || view + , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") + , can_use_save_link = !view.externalHost && "download" in save_link + , click = function(node) { + var event = doc.createEvent("MouseEvents"); + event.initMouseEvent( + "click", true, false, view, 0, 0, 0, 0, 0 + , false, false, false, false, 0, null + ); + node.dispatchEvent(event); + } + , webkit_req_fs = view.webkitRequestFileSystem + , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem + , throw_outside = function(ex) { + (view.setImmediate || view.setTimeout)(function() { + throw ex; + }, 0); + } + , force_saveable_type = "application/octet-stream" + , fs_min_size = 0 + , deletion_queue = [] + , process_deletion_queue = function() { + var i = deletion_queue.length; + while (i--) { + var file = deletion_queue[i]; + if (typeof file === "string") { // file is an object URL + URL.revokeObjectURL(file); + } else { // file is a File + file.remove(); + } + } + deletion_queue.length = 0; // clear queue + } + , dispatch = function(filesaver, event_types, event) { + event_types = [].concat(event_types); + var i = event_types.length; + while (i--) { + var listener = filesaver["on" + event_types[i]]; + if (typeof listener === "function") { + try { + listener.call(filesaver, event || filesaver); + } catch (ex) { + throw_outside(ex); + } + } + } + } + , FileSaver = function(blob, name) { + // First try a.download, then web filesystem, then object URLs + var + filesaver = this + , type = blob.type + , blob_changed = false + , object_url + , target_view + , get_object_url = function() { + var object_url = get_URL().createObjectURL(blob); + deletion_queue.push(object_url); + return object_url; + } + , dispatch_all = function() { + dispatch(filesaver, "writestart progress write writeend".split(" ")); + } + // on any filesys errors revert to saving with object URLs + , fs_error = function() { + // don't create more object URLs than needed + if (blob_changed || !object_url) { + object_url = get_object_url(blob); + } + if (target_view) { + target_view.location.href = object_url; + } else { + window.open(object_url, "_blank"); + } + filesaver.readyState = filesaver.DONE; + dispatch_all(); + } + , abortable = function(func) { + return function() { + if (filesaver.readyState !== filesaver.DONE) { + return func.apply(this, arguments); + } + }; + } + , create_if_not_found = {create: true, exclusive: false} + , slice + ; + filesaver.readyState = filesaver.INIT; + if (!name) { + name = "download"; + } + if (can_use_save_link) { + object_url = get_object_url(blob); + // FF for Android has a nasty garbage collection mechanism + // that turns all objects that are not pure javascript into 'deadObject' + // this means `doc` and `save_link` are unusable and need to be recreated + // `view` is usable though: + doc = view.document; + save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"); + save_link.href = object_url; + save_link.download = name; + var event = doc.createEvent("MouseEvents"); + event.initMouseEvent( + "click", true, false, view, 0, 0, 0, 0, 0 + , false, false, false, false, 0, null + ); + save_link.dispatchEvent(event); + filesaver.readyState = filesaver.DONE; + dispatch_all(); + return; + } + // Object and web filesystem URLs have a problem saving in Google Chrome when + // viewed in a tab, so I force save with application/octet-stream + // http://code.google.com/p/chromium/issues/detail?id=91158 + if (view.chrome && type && type !== force_saveable_type) { + slice = blob.slice || blob.webkitSlice; + blob = slice.call(blob, 0, blob.size, force_saveable_type); + blob_changed = true; + } + // Since I can't be sure that the guessed media type will trigger a download + // in WebKit, I append .download to the filename. + // https://bugs.webkit.org/show_bug.cgi?id=65440 + if (webkit_req_fs && name !== "download") { + name += ".download"; + } + if (type === force_saveable_type || webkit_req_fs) { + target_view = view; + } + if (!req_fs) { + fs_error(); + return; + } + fs_min_size += blob.size; + req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) { + fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) { + var save = function() { + dir.getFile(name, create_if_not_found, abortable(function(file) { + file.createWriter(abortable(function(writer) { + writer.onwriteend = function(event) { + target_view.location.href = file.toURL(); + deletion_queue.push(file); + filesaver.readyState = filesaver.DONE; + dispatch(filesaver, "writeend", event); + }; + writer.onerror = function() { + var error = writer.error; + if (error.code !== error.ABORT_ERR) { + fs_error(); + } + }; + "writestart progress write abort".split(" ").forEach(function(event) { + writer["on" + event] = filesaver["on" + event]; + }); + writer.write(blob); + filesaver.abort = function() { + writer.abort(); + filesaver.readyState = filesaver.DONE; + }; + filesaver.readyState = filesaver.WRITING; + }), fs_error); + }), fs_error); + }; + dir.getFile(name, {create: false}, abortable(function(file) { + // delete file if it already exists + file.remove(); + save(); + }), abortable(function(ex) { + if (ex.code === ex.NOT_FOUND_ERR) { + save(); + } else { + fs_error(); + } + })); + }), fs_error); + }), fs_error); + } + , FS_proto = FileSaver.prototype + , saveAs = function(blob, name) { + return new FileSaver(blob, name); + } + ; + FS_proto.abort = function() { + var filesaver = this; + filesaver.readyState = filesaver.DONE; + dispatch(filesaver, "abort"); + }; + FS_proto.readyState = FS_proto.INIT = 0; + FS_proto.WRITING = 1; + FS_proto.DONE = 2; + + FS_proto.error = + FS_proto.onwritestart = + FS_proto.onprogress = + FS_proto.onwrite = + FS_proto.onabort = + FS_proto.onerror = + FS_proto.onwriteend = + null; + + view.addEventListener("unload", process_deletion_queue, false); + saveAs.unload = function() { + process_deletion_queue(); + view.removeEventListener("unload", process_deletion_queue, false); + }; + return saveAs; +}( + typeof self !== "undefined" && self + || typeof window !== "undefined" && window + || this.content +)); +// `self` is undefined in Firefox for Android content script context +// while `this` is nsIContentFrameMessageManager +// with an attribute `content` that corresponds to the window + +if (typeof module !== "undefined") module.exports = saveAs; diff --git a/commodoreclicker/js/thirdparty/require.js b/commodoreclicker/js/thirdparty/require.js new file mode 100644 index 00000000..be103a74 --- /dev/null +++ b/commodoreclicker/js/thirdparty/require.js @@ -0,0 +1,36 @@ +/* + RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details +*/ +var requirejs,require,define; +(function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&& +(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= +this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f); +if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval", +"fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b, +a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p, +nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b, +a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild= +!0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!== +e&&(!("."===k||".."===k)||1e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): +(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= +O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| +(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); diff --git a/commodoreclicker/rom/1dnoise.d64 b/commodoreclicker/rom/1dnoise.d64 new file mode 100644 index 00000000..42f52efc Binary files /dev/null and b/commodoreclicker/rom/1dnoise.d64 differ diff --git a/commodoreclicker/rom/32bfuzzy.d64 b/commodoreclicker/rom/32bfuzzy.d64 new file mode 100644 index 00000000..6e12de9f Binary files /dev/null and b/commodoreclicker/rom/32bfuzzy.d64 differ diff --git a/commodoreclicker/rom/6502test.bin b/commodoreclicker/rom/6502test.bin new file mode 100644 index 00000000..0763778a Binary files /dev/null and b/commodoreclicker/rom/6502test.bin differ diff --git a/commodoreclicker/rom/69uasr.d64 b/commodoreclicker/rom/69uasr.d64 new file mode 100644 index 00000000..ce59c4cc Binary files /dev/null and b/commodoreclicker/rom/69uasr.d64 differ diff --git a/commodoreclicker/rom/basic.rom b/commodoreclicker/rom/basic.rom new file mode 100644 index 00000000..9e06923a Binary files /dev/null and b/commodoreclicker/rom/basic.rom differ diff --git a/commodoreclicker/rom/colorsplits.d64 b/commodoreclicker/rom/colorsplits.d64 new file mode 100644 index 00000000..e67f5950 Binary files /dev/null and b/commodoreclicker/rom/colorsplits.d64 differ diff --git a/commodoreclicker/rom/game.asm b/commodoreclicker/rom/game.asm new file mode 100644 index 00000000..87a0cea8 --- /dev/null +++ b/commodoreclicker/rom/game.asm @@ -0,0 +1,257 @@ +.code + +GAMEFLAGS = $DE00 +SPR_X_LO = $10 +SPR_X_HI = $11 +SPR_Y = $12 +SCR_RAM = $13 +COL_RAM = $15 +SCR_RAM2 = $15 +RASTER_LO = $17 +RASTER_HI = $18 +RASTERBAR = $19 +SCROLLPOS = $1A +BGCOL = $1B + +TMP0 = $30 +TMP1 = $31 + +reset: + ;--- VIC setup -------------------------------------------------------- + sei + lda #$1b ; Standard text mode + sta TMP1 + lda #$0f ; Enable all interrupts + sta $d01a + lda #44 ; Interrupt at line 300 + sta $d012 ; (within vblank) + sta RASTER_LO + lda #1 + sta RASTER_HI ; And store 304 for the IRQ + lda #0 + sta RASTERBAR ; Start off with no rasterbars + + lda #handler_raster + sta $0315 + + ;--- CIA interrupt setup ---------------------------------------------- + lda #$7f + sta $dc0d + sta $dd0d ; Disable interrupts on both CIAs + lda $dc0d + lda $dd0d ; Acknowledge interrupts on both CIAs + + cli ; Turn interrupts back on + + ;--- Sprite loading --------------------------------------------------- + ldx #62 +sprlp: + lda sprdata, x + sta $3fc0, x + dex + bne sprlp + + lda #$ff ; Set pointer for sprite 0 + sta $07f8 + lda #$80 ; Set sprite 0 X and Y + sta $d000 + sta $d001 + sta SPR_X_LO + sta SPR_Y + lda #0 + sta SPR_X_HI + lda #$07 ; Sprite 0 is yellow + sta $d027 + + ;--- We're done, spin forever ----------------------------------------- + jmp * + +;-------------------------------------------------------------------------- +; Raster interrupt handler! +handler_raster: + pla + pla ; Pop Y and X off the stack + dec $d019 ; Acknowledge + + ;--- Check if this was the CIA interrupting --------------------------- + lda $dc0d + bne handler_cia + + ;--- Change the border color ------------------------------------------ +raster_bars: + lda $d020 + adc RASTERBAR + sta $d020 + + ;--- Increment raster trap point by 12 -------------------------------- +raster_inc: + lda $d012 + adc #12 ; (Carry is cleared above) + sta RASTER_LO + sta $d012 ; And write to VIC + lda RASTER_HI ; 16-bit addition + adc #0 + sta RASTER_HI + ror ; Again, carry is clear, so + ror ; this rotates bit 0 to bit 7 + ora TMP1 ; Set the original VIC flags + sta $d011 + + rol + bcc raster_notop ; If the high bit is 1, + lda RASTER_LO + cmp #50 ; and the low byte is + bcc raster_notop ; >= 44 or so, then + lda #1 + sta $d012 + sta RASTER_LO + lda #0 + sta RASTER_HI ; Go back to the top (line 1) + lda TMP1 + sta $d011 + bne vbl_frame ; Skip over to do the per-frame work + +raster_notop: + pla + rti ; Leaving the handler early! + + ;--- CIA handler (within relative-jump range of the top of handler) --- +handler_cia: + lda GAMEFLAGS + and #16 ; Bit 4 of GAMEFLAGS + beq cia_end ; is "background change on" + lda BGCOL + adc #3 + sta BGCOL + sta $d021 ; Change the background color +cia_end: + pla + rti ; Leaving the handler + + ;--- Per-frame events: scrollshake ------------------------------------ +vbl_frame: + txa + pha + + lda GAMEFLAGS + and #1 ; Bit 0 of GAMEFLAGS + beq vbl_shake ; is "rasterbars on" + lda #3 ; If it's on, we'll add 3 to + sta RASTERBAR ; the color every 12 lines + +vbl_shake: + lda GAMEFLAGS + and #2 ; Bit 1 of GAMEFLAGS + beq vbl_kb ; is "scrollshake on" + lda SCROLLPOS + clc + adc #$1b ; Add 3 to Y, and 5 to X + sta SCROLLPOS ; to simulate "random" + tax + + lda $d016 + and #$f8 ; Mask off and save the + sta TMP0 ; top 5 bits of D016 + txa + and #7 ; Mask in the X component + ora TMP0 ; And tack them together + sta $d016 + + lda $d011 + and #$f8 ; Do the same for D011 + sta TMP0 + txa + lsr ; This time, push the + lsr ; Y component into place + lsr ; before we do the masking + and #7 ; of the bottom 3 bits + ora TMP0 ; Tack them together too + sta $d011 + and #$7f + sta TMP1 + + ;--- Per-frame events: Move sprite by joystick direction -------------- +vbl_kb: + ldx $dc00 ; Get Joy2's status + +vbl_kb_up: + txa + and #1 ; Check bit 0 (UP) + bne vbl_kb_down + dec SPR_Y ; If it's set, move up + +vbl_kb_down: + txa + and #2 ; Check bit 1 (DOWN) + bne vbl_kb_right + inc SPR_Y ; If it's set, move down + +vbl_kb_right: + txa + and #8 ; Check bit 3 (RIGHT) + bne vbl_kb_left + lda SPR_X_LO ; If it's set, perform a + clc ; 16-bit addition of 1 + adc #1 ; and mask it down to 0-511 + sta SPR_X_LO + lda SPR_X_HI + adc #0 + and #1 + sta SPR_X_HI + +vbl_kb_left: + txa + and #4 ; Check bit 2 (LEFT) + bne vbl_kb_end + lda SPR_X_LO ; If it's set, perform a + clc ; 16-bit subtraction of 1 + sbc #1 ; and mask it down to 0-511 + sta SPR_X_LO + lda SPR_X_HI + sbc #0 + and #1 + sta SPR_X_HI + +vbl_kb_end: + lda SPR_X_LO ; Positions have been determined, + sta $d000 ; set them + lda SPR_X_HI ; We don't worry about the X-pos + sta $d010 ; of any other sprites + ldx SPR_Y + stx $d001 + + ;--- Per-frame events: Check if sprite is enabled --------------------- +vbl_spr: + lda GAMEFLAGS + tax + and #4 ; Bit 2 of GAMEFLAGS + beq vbl_sprdbl ; is "sprite on" + lda #1 + sta $d015 +vbl_sprdbl: + txa + and #8 ; Bit 3 of GAMEFLAGS + beq raster_end ; is "sprite doubled" + lda #1 + sta $d017 + sta $d01d + + ;--- End of handler: we skipped to here for mid-frame rasters --------- +raster_end: + pla + tax +raster_endx: + pla + rti + +;-------------------------------------------------------------------------- +sprdata: + .byt 0, 126, 0, 3, 255, 192, 7, 255, 224 + .byt 31, 255, 248, 31, 255, 248, 63, 255, 252 + .byt 127, 255, 254, 127, 254, 254, 255, 253, 255 + .byt 255, 251, 255, 255, 247, 255, 255, 239, 255 + .byt 255, 223, 255, 127, 191, 254, 127, 127, 254 + .byt 63, 255, 252, 31, 255, 248, 31, 255, 248 + .byt 7, 255, 224, 3, 255, 192, 0, 126, 0 diff --git a/commodoreclicker/rom/game.bin b/commodoreclicker/rom/game.bin new file mode 100644 index 00000000..1612604c Binary files /dev/null and b/commodoreclicker/rom/game.bin differ diff --git a/commodoreclicker/rom/game.zip b/commodoreclicker/rom/game.zip new file mode 100644 index 00000000..4c544e6e Binary files /dev/null and b/commodoreclicker/rom/game.zip differ diff --git a/commodoreclicker/rom/kernal.rom b/commodoreclicker/rom/kernal.rom new file mode 100644 index 00000000..2ac152b8 Binary files /dev/null and b/commodoreclicker/rom/kernal.rom differ diff --git a/commodoreclicker/rom/loadram.bin b/commodoreclicker/rom/loadram.bin new file mode 100644 index 00000000..5428d853 Binary files /dev/null and b/commodoreclicker/rom/loadram.bin differ diff --git a/commodoreclicker/rom/microture.d64 b/commodoreclicker/rom/microture.d64 new file mode 100644 index 00000000..a9164cba Binary files /dev/null and b/commodoreclicker/rom/microture.d64 differ diff --git a/commodoreclicker/rom/raster2.d64 b/commodoreclicker/rom/raster2.d64 new file mode 100644 index 00000000..ba4d3257 Binary files /dev/null and b/commodoreclicker/rom/raster2.d64 differ diff --git a/commodoreclicker/rom/sorex.d64 b/commodoreclicker/rom/sorex.d64 new file mode 100644 index 00000000..ae8a6435 Binary files /dev/null and b/commodoreclicker/rom/sorex.d64 differ diff --git a/commodoreclicker/rom/test.d64 b/commodoreclicker/rom/test.d64 new file mode 100644 index 00000000..73b0c7f8 Binary files /dev/null and b/commodoreclicker/rom/test.d64 differ diff --git a/commodoreclicker/rom/testscreen.d64 b/commodoreclicker/rom/testscreen.d64 new file mode 100644 index 00000000..39ad5de1 Binary files /dev/null and b/commodoreclicker/rom/testscreen.d64 differ diff --git a/commodoreclicker/rom/truth.d64 b/commodoreclicker/rom/truth.d64 new file mode 100644 index 00000000..9ac59e4c Binary files /dev/null and b/commodoreclicker/rom/truth.d64 differ diff --git a/commodoreclicker/test.jpg b/commodoreclicker/test.jpg new file mode 100644 index 00000000..c45bad2e Binary files /dev/null and b/commodoreclicker/test.jpg differ diff --git a/dogeminer/css/cupertino/jquery-ui-1.10.4.custom.min.css b/dogeminer/css/cupertino/jquery-ui-1.10.4.custom.min.css new file mode 100644 index 00000000..b72bdb73 --- /dev/null +++ b/dogeminer/css/cupertino/jquery-ui-1.10.4.custom.min.css @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.10.4 - 2014-06-25 +* http://jqueryui.com +* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande%2CLucida%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=%23deedf7&bgTextureHeader=highlight_soft&bgImgOpacityHeader=100&borderColorHeader=%23aed0ea&fcHeader=%23222222&iconColorHeader=%2372a7cf&bgColorContent=%23f2f5f7&bgTextureContent=highlight_hard&bgImgOpacityContent=100&borderColorContent=%23dddddd&fcContent=%23362b36&iconColorContent=%2372a7cf&bgColorDefault=%23d7ebf9&bgTextureDefault=glass&bgImgOpacityDefault=80&borderColorDefault=%23aed0ea&fcDefault=%232779aa&iconColorDefault=%233d80b3&bgColorHover=%23e4f1fb&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=%2374b2e2&fcHover=%230070a3&iconColorHover=%232694e8&bgColorActive=%233baae3&bgTextureActive=glass&bgImgOpacityActive=50&borderColorActive=%232694e8&fcActive=%23ffffff&iconColorActive=%23ffffff&bgColorHighlight=%23a5d0ea&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=25&borderColorHighlight=%2373aeda&fcHighlight=%23363636&iconColorHighlight=%232e83ff&bgColorError=%23cd0a0a&bgTextureError=flat&bgImgOpacityError=15&borderColorError=%23cd0a0a&fcError=%23ffffff&iconColorError=%23ffffff&bgColorOverlay=%23eeeeee&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=%23000000&bgTextureShadow=highlight_hard&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted #000}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;min-height:0}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:active,.ui-button:hover,.ui-button:link,.ui-button:visited{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-icons-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-icons-only .ui-button-icon-primary,.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary{left:.5em}.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner,input.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-next,.ui-datepicker .ui-datepicker-prev{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-next-hover,.ui-datepicker .ui-datepicker-prev-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-next span,.ui-datepicker .ui-datepicker-prev span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td a,.ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0 0;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:0}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:400}.ui-menu .ui-menu-item a.ui-state-active,.ui-menu .ui-menu-item a.ui-state-focus{font-weight:400;margin:-1px}.ui-menu .ui-state-disabled{font-weight:400;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("images/animated-overlay.gif");height:100%;opacity:.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:0 0;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0 0}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#f2f5f7 url("images/ui-bg_highlight-hard_100_f2f5f7_1x100.png") 50% top repeat-x;color:#362b36}.ui-widget-content a{color:#362b36}.ui-widget-header{border:1px solid #aed0ea;background:#deedf7 url("images/ui-bg_highlight-soft_100_deedf7_1x100.png") 50% 50% repeat-x;color:#222;font-weight:700}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #aed0ea;background:#d7ebf9 url("images/ui-bg_glass_80_d7ebf9_1x400.png") 50% 50% repeat-x;font-weight:700;color:#2779aa}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#2779aa;text-decoration:none}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{border:1px solid #74b2e2;background:#e4f1fb url("images/ui-bg_glass_100_e4f1fb_1x400.png") 50% 50% repeat-x;font-weight:700;color:#0070a3}.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#0070a3;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #2694e8;background:#3baae3 url("images/ui-bg_glass_50_3baae3_1x400.png") 50% 50% repeat-x;font-weight:700;color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #73aeda;background:#a5d0ea url("images/ui-bg_highlight-soft_25_a5d0ea_1x100.png") 50% top repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#cd0a0a url("images/ui-bg_flat_15_cd0a0a_40x100.png") 50% 50% repeat-x;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_3d80b3_256x240.png")}.ui-state-focus .ui-icon,.ui-state-hover .ui-icon{background-image:url("images/ui-icons_2694e8_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-left,.ui-corner-tl,.ui-corner-top{border-top-left-radius:6px}.ui-corner-all,.ui-corner-right,.ui-corner-top,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bl,.ui-corner-bottom,.ui-corner-left{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-br,.ui-corner-right{border-bottom-right-radius:6px}.ui-widget-overlay{background:#eee url("images/ui-bg_diagonals-thick_90_eeeeee_40x40.png") 50% 50% repeat;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#000 url("images/ui-bg_highlight-hard_70_000000_1x100.png") 50% top repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px} diff --git a/dogeminer/css/main-v1-0-2-bs.css b/dogeminer/css/main-v1-0-2-bs.css new file mode 100644 index 00000000..22ee0c4c --- /dev/null +++ b/dogeminer/css/main-v1-0-2-bs.css @@ -0,0 +1 @@ +article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%}button,html,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:1em 40px}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre;white-space:pre-wrap;overflow-wrap:break-word}q{quotes:none}q:after,q:before{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ol,nav ul{list-style:none;list-style-image:none}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:silver solid 1px;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{box-sizing:content-box}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}.animated{animation-duration:1s;animation-fill-mode:both}.animated.infinite{animation-iteration-count:infinite}.animated.hinge{animation-duration:2s}.animated.bounceIn,.animated.bounceOut,.animated.flipOutX,.animated.flipOutY{animation-duration:.75s}@keyframes bounce{20%,53%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1);transform:translate3d(0,0,0)}40%,43%{animation-timing-function:cubic-bezier(0.755,0.05,0.855,0.06);transform:translate3d(0,-30px,0)}70%{animation-timing-function:cubic-bezier(0.755,0.05,0.855,0.06);transform:translate3d(0,-15px,0)}90%{transform:translate3d(0,-4px,0)}}.bounce{animation-name:bounce;transform-origin:center bottom}@keyframes flash{50%,from,to{opacity:1}25%,75%{opacity:0}}.flash{animation-name:flash}@keyframes pulse{from{transform:scale3d(1,1,1)}50%{transform:scale3d(1.05,1.05,1.05)}to{transform:scale3d(1,1,1)}}.pulse{animation-name:pulse}@keyframes rubberBand{from{transform:scale3d(1,1,1)}30%{transform:scale3d(1.25,.75,1)}40%{transform:scale3d(.75,1.25,1)}50%{transform:scale3d(1.15,.85,1)}65%{transform:scale3d(.95,1.05,1)}75%{transform:scale3d(1.05,.95,1)}to{transform:scale3d(1,1,1)}}.rubberBand{animation-name:rubberBand}@keyframes shake{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-10px,0,0)}20%,40%,60%,80%{transform:translate3d(10px,0,0)}}.shake{animation-name:shake}@keyframes swing{20%{transform:rotate3d(0,0,1,15deg)}40%{transform:rotate3d(0,0,1,-10deg)}60%{transform:rotate3d(0,0,1,5deg)}80%{transform:rotate3d(0,0,1,-5deg)}to{transform:rotate3d(0,0,1,0deg)}}.swing{transform-origin:top center;animation-name:swing}@keyframes tada{from{transform:scale3d(1,1,1)}10%,20%{transform:scale3d(.9,.9,.9) rotate3d(0,0,1,-3deg)}30%,50%,70%,90%{transform:scale3d(1.1,1.1,1.1) rotate3d(0,0,1,3deg)}40%,60%,80%{transform:scale3d(1.1,1.1,1.1) rotate3d(0,0,1,-3deg)}to{transform:scale3d(1,1,1)}}.tada{animation-name:tada}@keyframes wobble{from{transform:none}15%{transform:translate3d(-25%,0,0) rotate3d(0,0,1,-5deg)}30%{transform:translate3d(20%,0,0) rotate3d(0,0,1,3deg)}45%{transform:translate3d(-15%,0,0) rotate3d(0,0,1,-3deg)}60%{transform:translate3d(10%,0,0) rotate3d(0,0,1,2deg)}75%{transform:translate3d(-5%,0,0) rotate3d(0,0,1,-1deg)}to{transform:none}}.wobble{animation-name:wobble}@keyframes jello{11.1%,from,to{transform:none}22.2%{transform:skewX(-12.5deg) skewY(-12.5deg)}33.3%{transform:skewX(6.25deg) skewY(6.25deg)}44.4%{transform:skewX(-3.125deg) skewY(-3.125deg)}55.5%{transform:skewX(1.5625deg) skewY(1.5625deg)}66.6%{transform:skewX(-.78125deg) skewY(-.78125deg)}77.7%{transform:skewX(.39063deg) skewY(.39063deg)}88.8%{transform:skewX(-.19531deg) skewY(-.19531deg)}}.jello{animation-name:jello;transform-origin:center}@keyframes bounceIn{20%,40%,60%,80%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1)}0%{opacity:0;transform:scale3d(.3,.3,.3)}20%{transform:scale3d(1.1,1.1,1.1)}40%{transform:scale3d(.9,.9,.9)}60%{opacity:1;transform:scale3d(1.03,1.03,1.03)}80%{transform:scale3d(.97,.97,.97)}to{opacity:1;transform:scale3d(1,1,1)}}.bounceIn{animation-name:bounceIn}@keyframes bounceInDown{60%,75%,90%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}.bounceInDown{animation-name:bounceInDown}@keyframes bounceInLeft{60%,75%,90%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}.bounceInLeft{animation-name:bounceInLeft}@keyframes bounceInRight{60%,75%,90%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1)}from{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}.bounceInRight{animation-name:bounceInRight}@keyframes bounceInUp{60%,75%,90%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1)}from{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translate3d(0,0,0)}}.bounceInUp{animation-name:bounceInUp}@keyframes bounceOut{20%{transform:scale3d(.9,.9,.9)}50%,55%{opacity:1;transform:scale3d(1.1,1.1,1.1)}to{opacity:0;transform:scale3d(.3,.3,.3)}}.bounceOut{animation-name:bounceOut}@keyframes bounceOutDown{20%{transform:translate3d(0,10px,0)}40%,45%{opacity:1;transform:translate3d(0,-20px,0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.bounceOutDown{animation-name:bounceOutDown}@keyframes bounceOutLeft{20%{opacity:1;transform:translate3d(20px,0,0)}to{opacity:0;transform:translate3d(-2000px,0,0)}}.bounceOutLeft{animation-name:bounceOutLeft}@keyframes bounceOutRight{20%{opacity:1;transform:translate3d(-20px,0,0)}to{opacity:0;transform:translate3d(2000px,0,0)}}.bounceOutRight{animation-name:bounceOutRight}@keyframes bounceOutUp{20%{transform:translate3d(0,-10px,0)}40%,45%{opacity:1;transform:translate3d(0,20px,0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}.bounceOutUp{animation-name:bounceOutUp}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.fadeIn{animation-name:fadeIn}@keyframes fadeInDown{from{opacity:0;transform:translate3d(0,-100%,0)}to{opacity:1;transform:none}}.fadeInDown{animation-name:fadeInDown}@keyframes fadeInDownBig{from{opacity:0;transform:translate3d(0,-2000px,0)}to{opacity:1;transform:none}}.fadeInDownBig{animation-name:fadeInDownBig}@keyframes fadeInLeft{from{opacity:0;transform:translate3d(-100%,0,0)}to{opacity:1;transform:none}}.fadeInLeft{animation-name:fadeInLeft}@keyframes fadeInLeftBig{from{opacity:0;transform:translate3d(-2000px,0,0)}to{opacity:1;transform:none}}.fadeInLeftBig{animation-name:fadeInLeftBig}@keyframes fadeInRight{from{opacity:0;transform:translate3d(100%,0,0)}to{opacity:1;transform:none}}.fadeInRight{animation-name:fadeInRight}@keyframes fadeInRightBig{from{opacity:0;transform:translate3d(2000px,0,0)}to{opacity:1;transform:none}}.fadeInRightBig{animation-name:fadeInRightBig}@keyframes fadeInUp{from{opacity:0;transform:translate3d(0,100%,0)}to{opacity:1;transform:none}}.fadeInUp{animation-name:fadeInUp}@keyframes fadeInUpBig{from{opacity:0;transform:translate3d(0,2000px,0)}to{opacity:1;transform:none}}.fadeInUpBig{animation-name:fadeInUpBig}@keyframes fadeOut{from{opacity:1}to{opacity:0}}.fadeOut{animation-name:fadeOut}@keyframes fadeOutDown{from{opacity:1}to{opacity:0;transform:translate3d(0,100%,0)}}.fadeOutDown{animation-name:fadeOutDown}@keyframes fadeOutDownBig{from{opacity:1}to{opacity:0;transform:translate3d(0,2000px,0)}}.fadeOutDownBig{animation-name:fadeOutDownBig}@keyframes fadeOutLeft{from{opacity:1}to{opacity:0;transform:translate3d(-100%,0,0)}}.fadeOutLeft{animation-name:fadeOutLeft}@keyframes fadeOutLeftBig{from{opacity:1}to{opacity:0;transform:translate3d(-2000px,0,0)}}.fadeOutLeftBig{animation-name:fadeOutLeftBig}@keyframes fadeOutRight{from{opacity:1}to{opacity:0;transform:translate3d(100%,0,0)}}.fadeOutRight{animation-name:fadeOutRight}@keyframes fadeOutRightBig{from{opacity:1}to{opacity:0;transform:translate3d(2000px,0,0)}}.fadeOutRightBig{animation-name:fadeOutRightBig}@keyframes fadeOutUp{from{opacity:1}to{opacity:0;transform:translate3d(0,-100%,0)}}.fadeOutUp{animation-name:fadeOutUp}@keyframes fadeOutUpBig{from{opacity:1}to{opacity:0;transform:translate3d(0,-2000px,0)}}.fadeOutUpBig{animation-name:fadeOutUpBig}@keyframes flip{from{transform:perspective(400px) rotate3d(0,1,0,-360deg);animation-timing-function:ease-out}40%{transform:perspective(400px) translate3d(0,0,150px) rotate3d(0,1,0,-190deg);animation-timing-function:ease-out}50%{transform:perspective(400px) translate3d(0,0,150px) rotate3d(0,1,0,-170deg);animation-timing-function:ease-in}80%{transform:perspective(400px) scale3d(.95,.95,.95);animation-timing-function:ease-in}to{transform:perspective(400px);animation-timing-function:ease-in}}.animated.flip{backface-visibility:visible;animation-name:flip}@keyframes flipInX{from{transform:perspective(400px) rotate3d(1,0,0,90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotate3d(1,0,0,-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotate3d(1,0,0,10deg);opacity:1}80%{transform:perspective(400px) rotate3d(1,0,0,-5deg)}to{transform:perspective(400px)}}.flipInX{backface-visibility:visible!important;animation-name:flipInX}@keyframes flipInY{from{transform:perspective(400px) rotate3d(0,1,0,90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotate3d(0,1,0,-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotate3d(0,1,0,10deg);opacity:1}80%{transform:perspective(400px) rotate3d(0,1,0,-5deg)}to{transform:perspective(400px)}}.flipInY{backface-visibility:visible!important;animation-name:flipInY}@keyframes flipOutX{from{transform:perspective(400px)}30%{transform:perspective(400px) rotate3d(1,0,0,-20deg);opacity:1}to{transform:perspective(400px) rotate3d(1,0,0,90deg);opacity:0}}.flipOutX{animation-name:flipOutX;backface-visibility:visible!important}@keyframes flipOutY{from{transform:perspective(400px)}30%{transform:perspective(400px) rotate3d(0,1,0,-15deg);opacity:1}to{transform:perspective(400px) rotate3d(0,1,0,90deg);opacity:0}}.flipOutY{backface-visibility:visible!important;animation-name:flipOutY}@keyframes lightSpeedIn{from{transform:translate3d(100%,0,0) skewX(-30deg);opacity:0}60%{transform:skewX(20deg);opacity:1}80%{transform:skewX(-5deg);opacity:1}to{transform:none;opacity:1}}.lightSpeedIn{animation-name:lightSpeedIn;animation-timing-function:ease-out}@keyframes lightSpeedOut{from{opacity:1}to{transform:translate3d(100%,0,0) skewX(30deg);opacity:0}}.lightSpeedOut{animation-name:lightSpeedOut;animation-timing-function:ease-in}@keyframes rotateIn{from{transform-origin:center;transform:rotate3d(0,0,1,-200deg);opacity:0}to{transform-origin:center;transform:none;opacity:1}}.rotateIn{animation-name:rotateIn}@keyframes rotateInDownLeft{from{transform-origin:left bottom;transform:rotate3d(0,0,1,-45deg);opacity:0}to{transform-origin:left bottom;transform:none;opacity:1}}.rotateInDownLeft{animation-name:rotateInDownLeft}@keyframes rotateInDownRight{from{transform-origin:right bottom;transform:rotate3d(0,0,1,45deg);opacity:0}to{transform-origin:right bottom;transform:none;opacity:1}}.rotateInDownRight{animation-name:rotateInDownRight}@keyframes rotateInUpLeft{from{transform-origin:left bottom;transform:rotate3d(0,0,1,45deg);opacity:0}to{transform-origin:left bottom;transform:none;opacity:1}}.rotateInUpLeft{animation-name:rotateInUpLeft}@keyframes rotateInUpRight{from{transform-origin:right bottom;transform:rotate3d(0,0,1,-90deg);opacity:0}to{transform-origin:right bottom;transform:none;opacity:1}}.rotateInUpRight{animation-name:rotateInUpRight}@keyframes rotateOut{from{transform-origin:center;opacity:1}to{transform-origin:center;transform:rotate3d(0,0,1,200deg);opacity:0}}.rotateOut{animation-name:rotateOut}@keyframes rotateOutDownLeft{from{transform-origin:left bottom;opacity:1}to{transform-origin:left bottom;transform:rotate3d(0,0,1,45deg);opacity:0}}.rotateOutDownLeft{animation-name:rotateOutDownLeft}@keyframes rotateOutDownRight{from{transform-origin:right bottom;opacity:1}to{transform-origin:right bottom;transform:rotate3d(0,0,1,-45deg);opacity:0}}.rotateOutDownRight{animation-name:rotateOutDownRight}@keyframes rotateOutUpLeft{from{transform-origin:left bottom;opacity:1}to{transform-origin:left bottom;transform:rotate3d(0,0,1,-45deg);opacity:0}}.rotateOutUpLeft{animation-name:rotateOutUpLeft}@keyframes rotateOutUpRight{from{transform-origin:right bottom;opacity:1}to{transform-origin:right bottom;transform:rotate3d(0,0,1,90deg);opacity:0}}.rotateOutUpRight{animation-name:rotateOutUpRight}@keyframes hinge{0%{transform-origin:top left;animation-timing-function:ease-in-out}20%,60%{transform:rotate3d(0,0,1,80deg);transform-origin:top left;animation-timing-function:ease-in-out}40%,80%{transform:rotate3d(0,0,1,60deg);transform-origin:top left;animation-timing-function:ease-in-out;opacity:1}to{transform:translate3d(0,700px,0);opacity:0}}.hinge{animation-name:hinge}@keyframes rollIn{from{opacity:0;transform:translate3d(-100%,0,0) rotate3d(0,0,1,-120deg)}to{opacity:1;transform:none}}.rollIn{animation-name:rollIn}@keyframes rollOut{from{opacity:1}to{opacity:0;transform:translate3d(100%,0,0) rotate3d(0,0,1,120deg)}}.rollOut{animation-name:rollOut}@keyframes zoomIn{from{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}.zoomIn{animation-name:zoomIn}@keyframes zoomInDown{from{opacity:0;transform:scale3d(.1,.1,.1) translate3d(0,-1000px,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}60%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(0,60px,0);animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomInDown{animation-name:zoomInDown}@keyframes zoomInLeft{from{opacity:0;transform:scale3d(.1,.1,.1) translate3d(-1000px,0,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}60%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(10px,0,0);animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomInLeft{animation-name:zoomInLeft}@keyframes zoomInRight{from{opacity:0;transform:scale3d(.1,.1,.1) translate3d(1000px,0,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}60%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(-10px,0,0);animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomInRight{animation-name:zoomInRight}@keyframes zoomInUp{from{opacity:0;transform:scale3d(.1,.1,.1) translate3d(0,1000px,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}60%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(0,-60px,0);animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomInUp{animation-name:zoomInUp}@keyframes zoomOut{from{opacity:1}50%{opacity:0;transform:scale3d(.3,.3,.3)}to{opacity:0}}.zoomOut{animation-name:zoomOut}@keyframes zoomOutDown{40%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(0,-60px,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}to{opacity:0;transform:scale3d(.1,.1,.1) translate3d(0,2000px,0);transform-origin:center bottom;animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomOutDown{animation-name:zoomOutDown}@keyframes zoomOutLeft{40%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(42px,0,0)}to{opacity:0;transform:scale(.1) translate3d(-2000px,0,0);transform-origin:left center}}.zoomOutLeft{animation-name:zoomOutLeft}@keyframes zoomOutRight{40%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(-42px,0,0)}to{opacity:0;transform:scale(.1) translate3d(2000px,0,0);transform-origin:right center}}.zoomOutRight{animation-name:zoomOutRight}@keyframes zoomOutUp{40%{opacity:1;transform:scale3d(.475,.475,.475) translate3d(0,60px,0);animation-timing-function:cubic-bezier(0.55,0.055,0.675,0.19)}to{opacity:0;transform:scale3d(.1,.1,.1) translate3d(0,-2000px,0);transform-origin:center bottom;animation-timing-function:cubic-bezier(0.175,0.885,0.32,1)}}.zoomOutUp{animation-name:zoomOutUp}@keyframes slideInDown{from{transform:translate3d(0,-100%,0);visibility:visible}to{transform:translate3d(0,0,0)}}.slideInDown{animation-name:slideInDown}@keyframes slideInLeft{from{transform:translate3d(-100%,0,0);visibility:visible}to{transform:translate3d(0,0,0)}}.slideInLeft{animation-name:slideInLeft}@keyframes slideInRight{from{transform:translate3d(100%,0,0);visibility:visible}to{transform:translate3d(0,0,0)}}.slideInRight{animation-name:slideInRight}@keyframes slideInUp{from{transform:translate3d(0,100%,0);visibility:visible}to{transform:translate3d(0,0,0)}}.slideInUp{animation-name:slideInUp}@keyframes slideOutDown{from{transform:translate3d(0,0,0)}to{visibility:hidden;transform:translate3d(0,100%,0)}}.slideOutDown{animation-name:slideOutDown}@keyframes slideOutLeft{from{transform:translate3d(0,0,0)}to{visibility:hidden;transform:translate3d(-100%,0,0)}}.slideOutLeft{animation-name:slideOutLeft}@keyframes slideOutRight{from{transform:translate3d(0,0,0)}to{visibility:hidden;transform:translate3d(100%,0,0)}}.slideOutRight{animation-name:slideOutRight}@keyframes slideOutUp{from{transform:translate3d(0,0,0)}to{visibility:hidden;transform:translate3d(0,-100%,0)}}.slideOutUp{animation-name:slideOutUp}.hand{background-image:url(../img/hands.png);background-repeat:no-repeat;display:block}.hand-hand1{width:86px;height:110px;background-position:-5px -5px}.hand-hand2{width:86px;height:110px;background-position:-101px -5px}.level1{background-image:url(../img/level1.png);background-repeat:no-repeat;display:block}.level1-base10{width:140px;height:92px;background-position:-5px -5px}.level1-base11{width:140px;height:92px;background-position:-155px -5px}.level1-base12{width:140px;height:92px;background-position:-305px -5px}.level1-base13{width:140px;height:92px;background-position:-455px -5px}.level1-base14{width:140px;height:92px;background-position:-605px -5px}.level1-base15{width:140px;height:92px;background-position:-755px -5px}.level1-base20{width:140px;height:92px;background-position:-905px -5px}.level1-base21{width:140px;height:92px;background-position:-1055px -5px}.level1-base22{width:140px;height:92px;background-position:-1205px -5px}.level1-base23{width:140px;height:92px;background-position:-1355px -5px}.level1-base24{width:140px;height:92px;background-position:-1505px -5px}.level1-base25{width:140px;height:92px;background-position:-5px -107px}.level1-baseupgrade0{width:60px;height:60px;background-position:-1655px -5px}.level1-baseupgrade1{width:60px;height:60px;background-position:-1655px -75px}.level1-baseupgrade2{width:60px;height:60px;background-position:-155px -145px}.level1-baseupgrade3{width:60px;height:60px;background-position:-225px -145px}.level1-baseupgrade4{width:60px;height:60px;background-position:-295px -145px}.level1-bonuscoin{width:200px;height:210px;background-position:-365px -145px}.level1-clickupgrade0{width:60px;height:60px;background-position:-575px -145px}.level1-clickupgrade1{width:60px;height:60px;background-position:-645px -145px}.level1-clickupgrade2{width:60px;height:60px;background-position:-715px -145px}.level1-clickupgrade3{width:60px;height:60px;background-position:-785px -145px}.level1-clickupgrade4{width:60px;height:60px;background-position:-855px -145px}.level1-clickupgrade5{width:60px;height:60px;background-position:-925px -145px}.level1-doge_mine1u0{width:398px;height:305px;background-position:-995px -107px}.level1-doge_mine1u1{width:398px;height:305px;background-position:-5px -422px}.level1-doge_mine1u2{width:398px;height:305px;background-position:-413px -422px}.level1-doge_mine1u2---Copy{width:398px;height:305px;background-position:-821px -422px}.level1-doge_mine1u3{width:398px;height:305px;background-position:-1229px -422px}.level1-doge_mine1u4{width:398px;height:305px;background-position:-5px -737px}.level1-doge_mine1u5{width:398px;height:305px;background-position:-413px -737px}.level1-doge_mine1u6{width:398px;height:305px;background-position:-821px -737px}.level1-doge_mine2u0{width:398px;height:305px;background-position:-1229px -737px}.level1-doge_mine2u1{width:398px;height:305px;background-position:-5px -1052px}.level1-doge_mine2u2{width:398px;height:305px;background-position:-413px -1052px}.level1-doge_mine2u3{width:398px;height:305px;background-position:-821px -1052px}.level1-doge_mine2u4{width:398px;height:305px;background-position:-1229px -1052px}.level1-doge_mine2u5{width:398px;height:305px;background-position:-5px -1367px}.level1-doge_mine2u6{width:398px;height:305px;background-position:-413px -1367px}.level1-extraupgrade0{width:60px;height:60px;background-position:-1403px -145px}.level1-extraupgrade1{width:60px;height:60px;background-position:-1473px -145px}.level1-extraupgrade2{width:60px;height:60px;background-position:-1543px -145px}.level1-extraupgrade3{width:60px;height:60px;background-position:-1613px -145px}.level1-extraupgrade4{width:60px;height:60px;background-position:-1683px -145px}.level1-extraupgrade5{width:60px;height:60px;background-position:-5px -215px}.level1-extraupgrade6{width:60px;height:60px;background-position:-75px -215px}.level1-kennels10{width:100px;height:91px;background-position:-145px -215px}.level1-kennels11{width:100px;height:91px;background-position:-255px -215px}.level1-kennels12{width:100px;height:91px;background-position:-575px -215px}.level1-kennels13{width:100px;height:91px;background-position:-685px -215px}.level1-kennels14{width:100px;height:91px;background-position:-795px -215px}.level1-kennels15{width:100px;height:91px;background-position:-1403px -215px}.level1-kennels16{width:100px;height:91px;background-position:-1513px -215px}.level1-kennels20{width:100px;height:91px;background-position:-1623px -215px}.level1-kennels21{width:100px;height:91px;background-position:-5px -316px}.level1-kennels22{width:100px;height:91px;background-position:-115px -316px}.level1-kennels23{width:100px;height:91px;background-position:-225px -316px}.level1-kennels24{width:100px;height:91px;background-position:-575px -316px}.level1-kennels25{width:100px;height:91px;background-position:-685px -316px}.level1-kennels26{width:100px;height:91px;background-position:-795px -316px}.level1-kennelsupgrade0{width:60px;height:60px;background-position:-905px -215px}.level1-kennelsupgrade1{width:60px;height:60px;background-position:-905px -316px}.level1-kennelsupgrade2{width:60px;height:60px;background-position:-1403px -316px}.level1-kennelsupgrade3{width:60px;height:60px;background-position:-1473px -316px}.level1-kennelsupgrade4{width:60px;height:60px;background-position:-1543px -316px}.level1-kennelsupgrade5{width:60px;height:60px;background-position:-1613px -316px}.level1-kitten10{width:110px;height:70px;background-position:-1637px -386px}.level1-kitten11{width:110px;height:70px;background-position:-1637px -466px}.level1-kitten12{width:110px;height:70px;background-position:-1637px -546px}.level1-kitten13{width:110px;height:70px;background-position:-1637px -626px}.level1-kitten14{width:110px;height:70px;background-position:-1637px -706px}.level1-kitten15{width:110px;height:70px;background-position:-1637px -786px}.level1-kitten16{width:110px;height:70px;background-position:-1637px -866px}.level1-kitten20{width:110px;height:70px;background-position:-1637px -946px}.level1-kitten21{width:110px;height:70px;background-position:-1637px -1026px}.level1-kitten22{width:110px;height:70px;background-position:-1637px -1106px}.level1-kitten23{width:110px;height:70px;background-position:-1637px -1186px}.level1-kitten24{width:110px;height:70px;background-position:-1637px -1266px}.level1-kitten25{width:110px;height:70px;background-position:-1637px -1346px}.level1-kitten26{width:110px;height:70px;background-position:-821px -1426px}.level1-kittensupgrade0{width:60px;height:60px;background-position:-1683px -316px}.level1-kittensupgrade1{width:60px;height:60px;background-position:-941px -1426px}.level1-kittensupgrade2{width:60px;height:60px;background-position:-1011px -1426px}.level1-kittensupgrade3{width:60px;height:60px;background-position:-1081px -1426px}.level1-kittensupgrade4{width:60px;height:60px;background-position:-1151px -1426px}.level1-kittensupgrade5{width:60px;height:60px;background-position:-1221px -1426px}.level1-rig10{width:150px;height:89px;background-position:-1291px -1367px}.level1-rig11{width:150px;height:89px;background-position:-1451px -1367px}.level1-rig12{width:150px;height:89px;background-position:-1611px -1426px}.level1-rig13{width:150px;height:89px;background-position:-821px -1525px}.level1-rig14{width:150px;height:89px;background-position:-981px -1525px}.level1-rig15{width:150px;height:89px;background-position:-1141px -1525px}.level1-rig16{width:150px;height:89px;background-position:-1301px -1525px}.level1-rig20{width:150px;height:89px;background-position:-1461px -1525px}.level1-rig21{width:150px;height:89px;background-position:-821px -1624px}.level1-rig22{width:150px;height:89px;background-position:-981px -1624px}.level1-rig23{width:150px;height:89px;background-position:-1141px -1624px}.level1-rig24{width:150px;height:89px;background-position:-1301px -1624px}.level1-rig25{width:150px;height:89px;background-position:-1461px -1624px}.level1-rig26{width:150px;height:89px;background-position:-1725px -5px}.level1-rig6{width:150px;height:89px;background-position:-1753px -104px}.level1-rigupgrade0{width:60px;height:60px;background-position:-1753px -203px}.level1-rigupgrade1{width:60px;height:60px;background-position:-1823px -203px}.level1-rigupgrade2{width:60px;height:60px;background-position:-1753px -273px}.level1-rigupgrade3{width:60px;height:60px;background-position:-1823px -273px}.level1-rigupgrade4{width:60px;height:60px;background-position:-1757px -343px}.level1-rigupgrade5{width:60px;height:60px;background-position:-1827px -343px}.level1-rocket10{width:80px;height:140px;background-position:-1757px -413px}.level1-rocket11{width:80px;height:140px;background-position:-1847px -413px}.level1-rocket12{width:80px;height:140px;background-position:-1757px -563px}.level1-rocket13{width:80px;height:140px;background-position:-1847px -563px}.level1-rocket14{width:80px;height:140px;background-position:-1757px -713px}.level1-rocket15{width:80px;height:140px;background-position:-1847px -713px}.level1-rocket20{width:80px;height:140px;background-position:-1757px -863px}.level1-rocket21{width:80px;height:140px;background-position:-1847px -863px}.level1-rocket22{width:80px;height:140px;background-position:-1757px -1013px}.level1-rocket23{width:80px;height:140px;background-position:-1847px -1013px}.level1-rocket24{width:80px;height:140px;background-position:-1757px -1163px}.level1-rocket25{width:80px;height:140px;background-position:-1847px -1163px}.level1-rocketupgrade0{width:60px;height:60px;background-position:-1757px -1313px}.level1-rocketupgrade1{width:60px;height:60px;background-position:-1827px -1313px}.level1-rocketupgrade2{width:60px;height:60px;background-position:-1771px -1383px}.level1-rocketupgrade3{width:60px;height:60px;background-position:-1841px -1383px}.level1-rocketupgrade4{width:60px;height:60px;background-position:-1771px -1453px}.level1-shibe0{width:50px;height:51px;background-position:-1841px -1453px}.level1-shibe1{width:50px;height:51px;background-position:-1841px -1514px}.level1-shibe2{width:50px;height:51px;background-position:-1621px -1575px}.level1-shibe20{width:50px;height:51px;background-position:-1681px -1575px}.level1-shibe21{width:50px;height:51px;background-position:-1741px -1575px}.level1-shibe22{width:50px;height:51px;background-position:-1801px -1575px}.level1-shibe23{width:50px;height:51px;background-position:-1861px -1575px}.level1-shibe24{width:50px;height:51px;background-position:-1621px -1636px}.level1-shibe25{width:50px;height:51px;background-position:-1681px -1636px}.level1-shibe26{width:50px;height:51px;background-position:-1741px -1636px}.level1-shibe27{width:50px;height:51px;background-position:-1801px -1636px}.level1-shibe3{width:50px;height:51px;background-position:-1861px -1636px}.level1-shibe4{width:50px;height:51px;background-position:-5px -1697px}.level1-shibe5{width:50px;height:51px;background-position:-65px -1697px}.level1-shibe6{width:50px;height:51px;background-position:-125px -1697px}.level1-shibe7{width:50px;height:51px;background-position:-185px -1697px}.level1-shibeupgrade0{width:60px;height:60px;background-position:-245px -1697px}.level1-shibeupgrade1{width:60px;height:60px;background-position:-315px -1697px}.level1-shibeupgrade2{width:60px;height:60px;background-position:-385px -1697px}.level1-shibeupgrade3{width:60px;height:60px;background-position:-455px -1697px}.level1-shibeupgrade4{width:59px;height:60px;background-position:-525px -1697px}.level1-shibeupgrade5{width:59px;height:60px;background-position:-594px -1697px}.level1-shibeupgrade6{width:59px;height:60px;background-position:-663px -1697px}.level2{background-image:url(../img/level2.png?5);background-repeat:no-repeat;display:block}.level2-base10{width:140px;height:92px;background-position:-5px -5px}.level2-base11{width:140px;height:92px;background-position:-155px -5px}.level2-base12{width:140px;height:92px;background-position:-305px -5px}.level2-base13{width:140px;height:92px;background-position:-455px -5px}.level2-base20{width:140px;height:92px;background-position:-605px -5px}.level2-base21{width:140px;height:92px;background-position:-755px -5px}.level2-base22{width:140px;height:92px;background-position:-905px -5px}.level2-base23{width:140px;height:92px;background-position:-1055px -5px}.level2-baseupgrade0{width:60px;height:60px;background-position:-1205px -5px}.level2-baseupgrade1{width:60px;height:60px;background-position:-1205px -75px}.level2-baseupgrade2{width:60px;height:60px;background-position:-5px -145px}.level2-clickupgrade0{width:60px;height:60px;background-position:-75px -145px}.level2-clickupgrade1{width:60px;height:60px;background-position:-145px -145px}.level2-clickupgrade2{width:60px;height:60px;background-position:-215px -145px}.level2-doge_mine1u0{width:398px;height:305px;background-position:-285px -107px}.level2-doge_mine1u1{width:398px;height:305px;background-position:-693px -107px}.level2-doge_mine1u2{width:398px;height:305px;background-position:-5px -422px}.level2-doge_mine1u3{width:398px;height:305px;background-position:-413px -422px}.level2-doge_mine2u0{width:398px;height:305px;background-position:-821px -422px}.level2-doge_mine2u1{width:398px;height:305px;background-position:-5px -737px}.level2-doge_mine2u2{width:398px;height:305px;background-position:-413px -737px}.level2-doge_mine2u3{width:398px;height:305px;background-position:-821px -737px}.level2-extraupgrade0{width:60px;height:60px;background-position:-1101px -145px}.level2-extraupgrade1{width:60px;height:60px;background-position:-1171px -145px}.level2-extraupgrade2{width:60px;height:60px;background-position:-5px -215px}.level2-kennels10{width:100px;height:91px;background-position:-75px -215px}.level2-kennels11{width:100px;height:91px;background-position:-1101px -215px}.level2-kennels12{width:100px;height:91px;background-position:-5px -316px}.level2-kennels13{width:100px;height:91px;background-position:-115px -316px}.level2-kennels20{width:100px;height:91px;background-position:-1101px -316px}.level2-kennels21{width:100px;height:91px;background-position:-5px -1052px}.level2-kennels22{width:100px;height:91px;background-position:-115px -1052px}.level2-kennels23{width:100px;height:91px;background-position:-225px -1052px}.level2-kennelsupgrade0{width:60px;height:60px;background-position:-185px -215px}.level2-kennelsupgrade1{width:60px;height:60px;background-position:-1211px -215px}.level2-kennelsupgrade2{width:60px;height:60px;background-position:-1211px -285px}.level2-kitten10{width:110px;height:70px;background-position:-335px -1052px}.level2-kitten11{width:110px;height:70px;background-position:-455px -1052px}.level2-kitten12{width:110px;height:70px;background-position:-575px -1052px}.level2-kitten13{width:110px;height:70px;background-position:-695px -1052px}.level2-kitten20{width:110px;height:70px;background-position:-815px -1052px}.level2-kitten21{width:110px;height:70px;background-position:-935px -1052px}.level2-kitten22{width:110px;height:70px;background-position:-1055px -1052px}.level2-kitten23{width:110px;height:70px;background-position:-1175px -1052px}.level2-kittensupgrade0{width:60px;height:60px;background-position:-1229px -355px}.level2-kittensupgrade1{width:60px;height:60px;background-position:-1229px -425px}.level2-kittensupgrade2{width:60px;height:60px;background-position:-1229px -495px}.level2-rig10{width:150px;height:89px;background-position:-335px -1132px}.level2-rig11{width:150px;height:89px;background-position:-495px -1132px}.level2-rig12{width:150px;height:89px;background-position:-655px -1132px}.level2-rig13{width:150px;height:89px;background-position:-815px -1132px}.level2-rig20{width:150px;height:89px;background-position:-975px -1132px}.level2-rig21{width:150px;height:89px;background-position:-1135px -1132px}.level2-rig22{width:150px;height:89px;background-position:-1275px -5px}.level2-rig23{width:150px;height:89px;background-position:-1275px -104px}.level2-rigupgrade0{width:60px;height:60px;background-position:-1281px -203px}.level2-rigupgrade1{width:60px;height:60px;background-position:-1351px -203px}.level2-rigupgrade2{width:60px;height:60px;background-position:-1281px -273px}.level2-rocket10{width:80px;height:140px;background-position:-1351px -273px}.level2-rocket11{width:80px;height:140px;background-position:-1299px -423px}.level2-rocket12{width:80px;height:140px;background-position:-1229px -573px}.level2-rocket13{width:80px;height:140px;background-position:-1319px -573px}.level2-rocket20{width:80px;height:140px;background-position:-1229px -723px}.level2-rocket21{width:80px;height:140px;background-position:-1319px -723px}.level2-rocket22{width:80px;height:140px;background-position:-1229px -873px}.level2-rocket23{width:80px;height:140px;background-position:-1319px -873px}.level2-rocketupgrade0{width:60px;height:60px;background-position:-1389px -423px}.level2-rocketupgrade1{width:60px;height:60px;background-position:-1389px -493px}.level2-rocketupgrade2{width:60px;height:60px;background-position:-1295px -1023px}.level2-shibe0{width:50px;height:51px;background-position:-1409px -563px}.level2-shibe1{width:50px;height:51px;background-position:-1409px -624px}.level2-shibe2{width:50px;height:51px;background-position:-1409px -685px}.level2-shibe20{width:50px;height:51px;background-position:-1409px -746px}.level2-shibe21{width:50px;height:51px;background-position:-1409px -807px}.level2-shibe22{width:50px;height:51px;background-position:-1409px -868px}.level2-shibe23{width:50px;height:51px;background-position:-1409px -929px}.level2-shibe3{width:50px;height:51px;background-position:-1409px -990px}.level2-shibeupgrade0{width:60px;height:60px;background-position:-1365px -1051px}.level2-shibeupgrade1{width:60px;height:60px;background-position:-1295px -1121px}.level2-shibeupgrade2{width:60px;height:60px;background-position:-1365px -1121px}.level3{background-image:url(../img/level3.png);background-repeat:no-repeat;display:block}.level3-base10{width:140px;height:92px;background-position:-5px -5px}.level3-base11{width:140px;height:92px;background-position:-155px -5px}.level3-base12{width:140px;height:92px;background-position:-305px -5px}.level3-base13{width:140px;height:92px;background-position:-455px -5px}.level3-base20{width:140px;height:92px;background-position:-605px -5px}.level3-base21{width:140px;height:92px;background-position:-755px -5px}.level3-base22{width:140px;height:92px;background-position:-905px -5px}.level3-base23{width:140px;height:92px;background-position:-1055px -5px}.level3-baseupgrade0{width:60px;height:60px;background-position:-1205px -5px}.level3-baseupgrade1{width:60px;height:60px;background-position:-1205px -75px}.level3-baseupgrade2{width:60px;height:60px;background-position:-5px -145px}.level3-clickupgrade0{width:60px;height:60px;background-position:-75px -145px}.level3-clickupgrade1{width:60px;height:60px;background-position:-145px -145px}.level3-clickupgrade2{width:60px;height:60px;background-position:-215px -145px}.level3-doge_mine1u0{width:398px;height:305px;background-position:-285px -107px}.level3-doge_mine1u1{width:398px;height:305px;background-position:-693px -107px}.level3-doge_mine1u2{width:398px;height:305px;background-position:-5px -422px}.level3-doge_mine1u3{width:398px;height:305px;background-position:-413px -422px}.level3-doge_mine2u0{width:398px;height:305px;background-position:-821px -422px}.level3-doge_mine2u1{width:398px;height:305px;background-position:-5px -737px}.level3-doge_mine2u2{width:398px;height:305px;background-position:-413px -737px}.level3-doge_mine2u3{width:398px;height:305px;background-position:-821px -737px}.level3-extraupgrade0{width:60px;height:60px;background-position:-1101px -145px}.level3-extraupgrade1{width:60px;height:60px;background-position:-1171px -145px}.level3-extraupgrade2{width:60px;height:60px;background-position:-5px -215px}.level3-kennels10{width:100px;height:91px;background-position:-75px -215px}.level3-kennels11{width:100px;height:91px;background-position:-1101px -215px}.level3-kennels12{width:100px;height:91px;background-position:-5px -316px}.level3-kennels13{width:100px;height:91px;background-position:-115px -316px}.level3-kennels20{width:100px;height:91px;background-position:-1101px -316px}.level3-kennels21{width:100px;height:91px;background-position:-5px -1052px}.level3-kennels22{width:100px;height:91px;background-position:-115px -1052px}.level3-kennels23{width:100px;height:91px;background-position:-225px -1052px}.level3-kennelsupgrade0{width:60px;height:60px;background-position:-185px -215px}.level3-kennelsupgrade1{width:60px;height:60px;background-position:-1211px -215px}.level3-kennelsupgrade2{width:60px;height:60px;background-position:-1211px -285px}.level3-kitten10{width:110px;height:70px;background-position:-335px -1052px}.level3-kitten11{width:110px;height:70px;background-position:-455px -1052px}.level3-kitten12{width:110px;height:70px;background-position:-575px -1052px}.level3-kitten13{width:110px;height:70px;background-position:-695px -1052px}.level3-kitten20{width:110px;height:70px;background-position:-815px -1052px}.level3-kitten21{width:110px;height:70px;background-position:-935px -1052px}.level3-kitten22{width:110px;height:70px;background-position:-1055px -1052px}.level3-kitten23{width:110px;height:70px;background-position:-1175px -1052px}.level3-kittensupgrade0{width:60px;height:60px;background-position:-1229px -355px}.level3-kittensupgrade1{width:60px;height:60px;background-position:-1229px -425px}.level3-kittensupgrade2{width:60px;height:60px;background-position:-1229px -495px}.level3-rig10{width:150px;height:89px;background-position:-335px -1132px}.level3-rig11{width:150px;height:89px;background-position:-495px -1132px}.level3-rig12{width:150px;height:89px;background-position:-655px -1132px}.level3-rig13{width:150px;height:89px;background-position:-815px -1132px}.level3-rig20{width:150px;height:89px;background-position:-975px -1132px}.level3-rig21{width:150px;height:89px;background-position:-1135px -1132px}.level3-rig22{width:150px;height:89px;background-position:-1275px -5px}.level3-rig23{width:150px;height:89px;background-position:-1275px -104px}.level3-rigupgrade0{width:60px;height:60px;background-position:-1281px -203px}.level3-rigupgrade1{width:60px;height:60px;background-position:-1351px -203px}.level3-rigupgrade2{width:60px;height:60px;background-position:-1281px -273px}.level3-rocket10{width:80px;height:140px;background-position:-1351px -273px}.level3-rocket11{width:80px;height:140px;background-position:-1299px -423px}.level3-rocket12{width:80px;height:140px;background-position:-1229px -573px}.level3-rocket13{width:80px;height:140px;background-position:-1319px -573px}.level3-rocket20{width:80px;height:140px;background-position:-1229px -723px}.level3-rocket21{width:80px;height:140px;background-position:-1319px -723px}.level3-rocket22{width:80px;height:140px;background-position:-1229px -873px}.level3-rocket23{width:80px;height:140px;background-position:-1319px -873px}.level3-rocketupgrade0{width:60px;height:60px;background-position:-1389px -423px}.level3-rocketupgrade1{width:60px;height:60px;background-position:-1389px -493px}.level3-rocketupgrade2{width:60px;height:60px;background-position:-1295px -1023px}.level3-shibe0{width:50px;height:51px;background-position:-1409px -563px}.level3-shibe1{width:50px;height:51px;background-position:-1409px -624px}.level3-shibe2{width:50px;height:51px;background-position:-1409px -685px}.level3-shibe20{width:50px;height:51px;background-position:-1409px -746px}.level3-shibe21{width:50px;height:51px;background-position:-1409px -807px}.level3-shibe22{width:50px;height:51px;background-position:-1409px -868px}.level3-shibe23{width:50px;height:51px;background-position:-1409px -929px}.level3-shibe3{width:50px;height:51px;background-position:-1409px -990px}.level3-shibeupgrade0{width:60px;height:60px;background-position:-1365px -1051px}.level3-shibeupgrade1{width:60px;height:60px;background-position:-1295px -1121px}.level3-shibeupgrade2{width:60px;height:60px;background-position:-1365px -1121px}@keyframes quickbounce{10%,43%,70%,from,to{animation-timing-function:cubic-bezier(0.215,0.61,0.355,1);transform:translate3d(0,0,0)}30%,33%{animation-timing-function:cubic-bezier(0.755,0.05,0.855,0.06);transform:translate3d(0,-30px,0)}60%{animation-timing-function:cubic-bezier(0.755,0.05,0.855,0.06);transform:translate3d(0,-15px,0)}80%{transform:translate3d(0,-4px,0)}}.quickbounce{animation-name:quickbounce;transform-origin:center bottom}@keyframes rightshake{from,to{transform:translate3d(0,0,0)}20%,60%{transform:translate3d(5px,0,0)}40%,80%{transform:translate3d(-5px,0,0)}}.rightshake{animation-name:rightshake}@keyframes leftshake{from,to{transform:translate3d(0,0,0)}20%,60%{transform:translate3d(-5px,0,0)}40%,80%{transform:translate3d(5px,0,0)}}.leftshake{animation-name:leftshake}@keyframes upshake1{from,to{transform:translate3d(0,0,0)}20%,60%{transform:translate3d(0,-5px,0)}40%,80%{transform:translate3d(0,5px,0)}}.upshake1{animation-name:upshake1}@keyframes upshake2{from,to{transform:translate3d(0,0,0)}20%,60%{transform:translate3d(0,-2px,0)}40%,80%{transform:translate3d(0,2px,0)}}.upshake2{animation-name:upshake2}@keyframes upshake3{from,to{transform:translate3d(0,0,0)}50%{transform:translate3d(0,-8px,0)}}.upshake3{animation-name:upshake3}@keyframes upshake4{from,to{transform:translate3d(0,0,0)}50%{transform:translate3d(0,-5px,0)}}.upshake4{animation-name:upshake4}@keyframes upshake5{from,to{transform:translate3d(0,0,0)}50%{transform:translate3d(0,5px,0)}}.upshake5{animation-name:upshake5}@keyframes upshake6{from,to{transform:translate3d(0,0,0)}50%{transform:translate3d(0,3px,0)}}.upshake6{animation-name:upshake6}@keyframes minipulse{0%{transform:scale3d(1,1,1)}35%{transform:scale3d(1.3,1.3,1.3)}80%{transform:scale3d(1,1,1)}}.minipulse{animation-name:minipulse}@keyframes micropulse{0%{transform:scale3d(1,1,1)}35%{transform:scale3d(1.15,1.15,1.15)}80%{transform:scale3d(1,1,1)}}.micropulse{animation-name:micropulse}@keyframes nanopulse{0%{transform:scale3d(1,1,1)}35%{transform:scale3d(1.1,1.1,1.1)}80%{transform:scale3d(1,1,1)}}.nanopulse{animation-name:nanopulse}body,html{position:absolute;width:100%;height:100%;left:0;top:0;overflow:hidden}body{background-size:cover}.gpurender{transform:translateZ(0);transform:translate3d(0,0,0);backface-visibility:hidden}.gpurender-children *{transform:translateZ(0);transform:translate3d(0,0,0);backface-visibility:hidden}button,html,input,select,textarea{color:#222}::-moz-selection{background:#8e8674;text-shadow:none}::selection{background:#8e8674;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,img,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.browsehappy{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}header .byline{color:orange;text-align:center;vertical-align:middle;position:relative;top:-20px}.newsline{color:#111;text-align:center;vertical-align:middle}.coinstext{position:absolute;display:block;text-align:center;width:100%;z-index:0;top:0;left:0;height:100%}.helpheader{position:relative;top:-30px}.tenpadding{padding:10px}.helps{position:relative;width:48%;height:200px;float:left;margin-left:10px}.inlineheader{position:relative;display:inline}.upgrade{position:relative;width:520px;float:left;margin-left:10px}.desc{font-size:90%}.disabledopacity{opacity:.5}.noselect{user-select:none}#FacebookLikeContainer span{height:19px}#FacebookLikeContainer iframe{height:19px}#medialinks{position:absolute;top:10px;left:10px;z-index:50}#showhidebutton{position:absolute;top:83px;height:17px;width:130px}#buttontext{position:relative;top:-17px;font-size:.7em;display:block;margin-top:7px}#showhidediv{position:absolute;left:0;top:0;height:110px}#social-tooltip{color:#000;background:#feeebd;border:#d19405 solid 1px;width:270px;padding:10px 20px;top:17px;left:10px;z-index:10;position:absolute;font-size:14px;font-style:normal;border-radius:3px;box-shadow:2px 2px 2px #999;cursor:pointer}#social-tooltip b{width:15px;height:15px;margin-left:0;margin-top:-19px;display:block;position:absolute;transform:rotate(-45deg);background:#feeebd;border-top:1px solid #d19405;border-right:1px solid #d19405}.bob{animation-name:Bob}@keyframes Bob{25%{transform:translateY(-4px)}75%{transform:translateY(4px)}100%{transform:translateY(0)}}@keyframes pulseAndColor{0%{transform:scale3d(1,1,1);color:#4c3000}50%{transform:scale3d(1.05,1.05,1.05);color:#ff3516}100%{transform:scale3d(1,1,1);color:#4c3000}}.pulseAndColor{animation-name:pulseAndColor}.pulseAndColor .ui-button-text{padding:.1em 1em .1em 2.1em!important}#fb1{position:absolute;left:0;top:0}#twt1{position:absolute;left:0;top:29px}#twt2{position:relative;top:28px;width:145px}#twitter-widget-1{width:145px!important;height:25px!important}#gplay{position:relative;top:75px}*,body{font-family:comic sans,comic sans ms,chalkboard,chalkboardse-regular,averia libre,marker felt,purisa,urw chancery l,sans-serif}.small{font-size:70%;font-family:Arial}#superwrapper{overflow:visible;position:relative;margin:0 0 0 140px;padding:10px;width:1392px}#wrapper{overflow:hidden;position:relative;opacity:.9;width:765px;height:703px;top:0;left:0}#wrapper header{position:absolute;top:0;left:0;width:100%;z-index:2}#achievementwindow{position:absolute;width:800px;left:20px;top:500px}#achievementwrapper{position:relative;width:800px;left:20px;top:500px}#pops{position:absolute;left:0;top:0;z-index:10000;pointer-events:none}.allpops{position:absolute;height:100px;width:200px;font-size:20px;text-align:center}.pop{font-weight:700;color:#ba9f33}.popmoon{font-weight:700;color:#ecf0f1;text-shadow:1px 1px 6px #969696}.popmars{font-weight:700;color:#e7674c;text-shadow:1px 1px 6px #969696}@keyframes popOut{0%{opacity:1}75%{opacity:1}100%{opacity:0;transform:translate3d(0,-100%,0)}}.popOut{animation-name:popOut;transition-timing-function:cubic-bezier(0.075,0.82,0.165,1)}#news{position:absolute;text-align:center;width:99%;top:17%;z-index:2;overflow:hidden;height:60px;line-height:60px}#news span{position:relative;display:inline-block;vertical-align:middle;line-height:normal;width:100%}#tabs{overflow:hidden;position:absolute;opacity:.9;width:600px;height:717px;top:10px;right:0;font-size:95%}.help{position:relative;top:-45px}#footer{opacity:.9;margin:10px auto 0;overflow:auto;width:1420px}#minerwrapper{position:absolute;width:100%;height:100%}#miner{width:390px;height:305px;position:absolute;margin-left:auto;left:24%;top:28%;margin-right:auto;cursor:pointer;z-index:1;outline:0}#mined{font-size:125%;position:absolute;width:100%;top:21.5%;white-space:nowrap}#mined strong div{display:inline}#persec{position:absolute;width:100%;top:27%}#persec div{display:inline}#random{position:absolute;z-index:3}#BG{height:100%;width:100%;background-image:url(../img/bg/bg1.jpg);background-size:100% 100%!important;position:absolute;z-index:-1;top:0;left:0}#BG2{height:100%;width:100%;position:absolute;z-index:-2;background-image:url(../img/bg/bg1.jpg);background-size:100% 100%!important;top:0;left:0}.lowestbg{z-index:-5}#helperwrapper{position:absolute;left:55%;top:200px}#helperwrapper2{position:absolute;left:-100px;top:150px}#shibesdiv{position:absolute;left:100px;top:50px}#basesdiv div,#kennelsdiv div,#kittensdiv div,#rigsdiv div,#rocketsdiv div,#shibesdiv div,.hover-helper div{z-index:1;transform:translateZ(0);box-shadow:0 0 1px transparent;backface-visibility:hidden;transition-duration:.3s;transition-property:transform}#basesdiv div:hover,#kennelsdiv div:hover,#kittensdiv div:hover,#rigsdiv div:hover,#rocketsdiv div:hover,#shibesdiv div:hover,.hover-helper div:hover{transform:scale(1.3);z-index:100}#kennelsdiv{position:absolute;left:100px;top:50px}#kittensdiv{position:absolute;left:100px;top:50px}#rocketsdiv{position:absolute;left:100px}#basesdiv{position:absolute;left:100px}#rigsdiv{position:absolute;left:430px;top:20px}.clickupgradezzzz{position:absolute;width:80px;height:90px}#tabs .ui-tabs-nav .ui-icon{display:inline-block}.ui-effects-transfer{border:green dotted 2px}.achievement{z-index:30000;padding:10px}#achiwrapper{overflow-y:scroll;overflow-x:hidden;height:600px}.shadow{text-shadow:1px 1px #bbb}.adsbygoogletext{font-size:80%}.no-close .ui-dialog-titlebar-close{display:none}.toprightimg{position:absolute;top:0;right:0}#moondialog{display:none}#flyingrocket{background-image:url(../img/flyingrocket.png);position:relative;background-repeat:no-repeat;height:500px;width:187px;left:-600px;transform:rotate(60deg);z-index:10}.rightsiderocket{transform:rotate(-60deg)!important}.flyingdoge{background-image:url(../img/FlyingDoge.png);background-repeat:no-repeat;display:block}.bonuscoinsmall{background-image:url(../img/bonuscoin_small.png);background-repeat:no-repeat;display:block}.introcontainer{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#333;opacity:.7;z-index:150}#statstab p{margin:0}.delay-1{animation-delay:.1s}.duration-1{animation-duration:.1s}.delay-2{animation-delay:.2s}.duration-2{animation-duration:.2s}.delay-3{animation-delay:.3s}.duration-3{animation-duration:.3s}.delay-4{animation-delay:.4s}.duration-4{animation-duration:.4s}.delay-5{animation-delay:.5s}.duration-5{animation-duration:.5s}.delay-6{animation-delay:.6s}.duration-6{animation-duration:.6s}.delay-7{animation-delay:.7s}.duration-7{animation-duration:.7s}.delay-8{animation-delay:.8s}.duration-8{animation-duration:.8s}.delay-9{animation-delay:.9s}.duration-9{animation-duration:.9s}.delay-10{animation-delay:1s}.duration-10{animation-duration:1s}.delay-11{animation-delay:1.1s}.duration-11{animation-duration:1.1s}.delay-12{animation-delay:1.2s}.duration-12{animation-duration:1.2s}.delay-13{animation-delay:1.3s}.duration-13{animation-duration:1.3s}.delay-14{animation-delay:1.4s}.duration-14{animation-duration:1.4s}.delay-15{animation-delay:1.5s}.duration-15{animation-duration:1.5s}.delay-16{animation-delay:1.6s}.duration-16{animation-duration:1.6s}.delay-17{animation-delay:1.7s}.duration-17{animation-duration:1.7s}.delay-18{animation-delay:1.8s}.duration-18{animation-duration:1.8s}.delay-19{animation-delay:1.9s}.duration-19{animation-duration:1.9s}.delay-20{animation-delay:2s}.duration-20{animation-duration:2s}.delay-21{animation-delay:2.1s}.duration-21{animation-duration:2.1s}.delay-22{animation-delay:2.2s}.duration-22{animation-duration:2.2s}.delay-23{animation-delay:2.3s}.duration-23{animation-duration:2.3s}.delay-24{animation-delay:2.4s}.duration-24{animation-duration:2.4s}.delay-25{animation-delay:2.5s}.duration-25{animation-duration:2.5s}.delay-26{animation-delay:2.6s}.duration-26{animation-duration:2.6s}.delay-27{animation-delay:2.7s}.duration-27{animation-duration:2.7s}.delay-28{animation-delay:2.8s}.duration-28{animation-duration:2.8s}.delay-29{animation-delay:2.9s}.duration-29{animation-duration:2.9s}.delay-30{animation-delay:3s}.duration-30{animation-duration:3s}.delay-31{animation-delay:3.1s}.duration-31{animation-duration:3.1s}.delay-32{animation-delay:3.2s}.duration-32{animation-duration:3.2s}.delay-33{animation-delay:3.3s}.duration-33{animation-duration:3.3s}.delay-34{animation-delay:3.4s}.duration-34{animation-duration:3.4s}.delay-35{animation-delay:3.5s}.duration-35{animation-duration:3.5s}.delay-36{animation-delay:3.6s}.duration-36{animation-duration:3.6s}.delay-37{animation-delay:3.7s}.duration-37{animation-duration:3.7s}.delay-38{animation-delay:3.8s}.duration-38{animation-duration:3.8s}.delay-39{animation-delay:3.9s}.duration-39{animation-duration:3.9s}.delay-40{animation-delay:4s}.duration-40{animation-duration:4s}.delay-41{animation-delay:4.1s}.duration-41{animation-duration:4.1s}.delay-42{animation-delay:4.2s}.duration-42{animation-duration:4.2s}.delay-43{animation-delay:4.3s}.duration-43{animation-duration:4.3s}.delay-44{animation-delay:4.4s}.duration-44{animation-duration:4.4s}.delay-45{animation-delay:4.5s}.duration-45{animation-duration:4.5s}.delay-46{animation-delay:4.6s}.duration-46{animation-duration:4.6s}.delay-47{animation-delay:4.7s}.duration-47{animation-duration:4.7s}.delay-48{animation-delay:4.8s}.duration-48{animation-duration:4.8s}.delay-49{animation-delay:4.9s}.duration-49{animation-duration:4.9s}.delay-50{animation-delay:5s}.duration-50{animation-duration:5s}.delay-51{animation-delay:5.1s}.duration-51{animation-duration:5.1s}.delay-52{animation-delay:5.2s}.duration-52{animation-duration:5.2s}.delay-53{animation-delay:5.3s}.duration-53{animation-duration:5.3s}.delay-54{animation-delay:5.4s}.duration-54{animation-duration:5.4s}.delay-55{animation-delay:5.5s}.duration-55{animation-duration:5.5s}.delay-56{animation-delay:5.6s}.duration-56{animation-duration:5.6s}.delay-57{animation-delay:5.7s}.duration-57{animation-duration:5.7s}.delay-58{animation-delay:5.8s}.duration-58{animation-duration:5.8s}.delay-59{animation-delay:5.9s}.duration-59{animation-duration:5.9s}.delay-60{animation-delay:6s}.duration-60{animation-duration:6s}.delay-61{animation-delay:6.1s}.duration-61{animation-duration:6.1s}.delay-62{animation-delay:6.2s}.duration-62{animation-duration:6.2s}.delay-63{animation-delay:6.3s}.duration-63{animation-duration:6.3s}.delay-64{animation-delay:6.4s}.duration-64{animation-duration:6.4s}.delay-65{animation-delay:6.5s}.duration-65{animation-duration:6.5s}.delay-66{animation-delay:6.6s}.duration-66{animation-duration:6.6s}.delay-67{animation-delay:6.7s}.duration-67{animation-duration:6.7s}.delay-68{animation-delay:6.8s}.duration-68{animation-duration:6.8s}.delay-69{animation-delay:6.9s}.duration-69{animation-duration:6.9s}.delay-70{animation-delay:7s}.duration-70{animation-duration:7s}.delay-71{animation-delay:7.1s}.duration-71{animation-duration:7.1s}.delay-72{animation-delay:7.2s}.duration-72{animation-duration:7.2s}.delay-73{animation-delay:7.3s}.duration-73{animation-duration:7.3s}.delay-74{animation-delay:7.4s}.duration-74{animation-duration:7.4s}.delay-75{animation-delay:7.5s}.duration-75{animation-duration:7.5s}.delay-76{animation-delay:7.6s}.duration-76{animation-duration:7.6s}.delay-77{animation-delay:7.7s}.duration-77{animation-duration:7.7s}.delay-78{animation-delay:7.8s}.duration-78{animation-duration:7.8s}.delay-79{animation-delay:7.9s}.duration-79{animation-duration:7.9s}.delay-80{animation-delay:8s}.duration-80{animation-duration:8s}.delay-81{animation-delay:8.1s}.duration-81{animation-duration:8.1s}.delay-82{animation-delay:8.2s}.duration-82{animation-duration:8.2s}.delay-83{animation-delay:8.3s}.duration-83{animation-duration:8.3s}.delay-84{animation-delay:8.4s}.duration-84{animation-duration:8.4s}.delay-85{animation-delay:8.5s}.duration-85{animation-duration:8.5s}.delay-86{animation-delay:8.6s}.duration-86{animation-duration:8.6s}.delay-87{animation-delay:8.7s}.duration-87{animation-duration:8.7s}.delay-88{animation-delay:8.8s}.duration-88{animation-duration:8.8s}.delay-89{animation-delay:8.9s}.duration-89{animation-duration:8.9s}.delay-90{animation-delay:9s}.duration-90{animation-duration:9s}.delay-91{animation-delay:9.1s}.duration-91{animation-duration:9.1s}.delay-92{animation-delay:9.2s}.duration-92{animation-duration:9.2s}.delay-93{animation-delay:9.3s}.duration-93{animation-duration:9.3s}.delay-94{animation-delay:9.4s}.duration-94{animation-duration:9.4s}.delay-95{animation-delay:9.5s}.duration-95{animation-duration:9.5s}.delay-96{animation-delay:9.6s}.duration-96{animation-duration:9.6s}.delay-97{animation-delay:9.7s}.duration-97{animation-duration:9.7s}.delay-98{animation-delay:9.8s}.duration-98{animation-duration:9.8s}.delay-99{animation-delay:9.9s}.duration-99{animation-duration:9.9s}.delay-100{animation-delay:10s}.duration-100{animation-duration:10s}#introscreen{z-index:151;position:absolute;overflow:hidden;top:30px;left:0;right:0;width:1200px;height:700px;margin-left:auto;margin-right:auto;display:block}#introscreen .first-part h1{display:block;text-align:center;margin-top:60px}#introscreen .first-part p{color:orange;text-align:center;vertical-align:middle;position:relative;font-size:24px;margin-bottom:0}#introscreen .first-part .intro-doge{display:block;text-align:center;margin-left:auto;margin-right:auto;margin-top:0}#introscreen .first-part #loading-indicator{position:absolute;width:100%;display:block;text-align:center;margin-top:0;margin-left:auto;margin-right:auto}#introscreen .first-part #loading-indicator .loadingwrap{width:100%;text-align:center;position:absolute;margin-left:auto;margin-right:auto;font-weight:700}#introscreen .first-part #loading-indicator .loadingwrap div{display:inline;margin:-2px}#introscreen .first-part #loading-indicator #loadingwhat{margin-top:40px;position:absolute;width:100%;text-align:center;margin-left:auto;margin-right:auto;font-size:16px}#introscreen .first-part #loading-indicator .l{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:0s}#introscreen .first-part #loading-indicator .o{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:.21875s}#introscreen .first-part #loading-indicator .a{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:.4375s}#introscreen .first-part #loading-indicator .d{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:.65625s}#introscreen .first-part #loading-indicator .i{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:875ms}#introscreen .first-part #loading-indicator .n{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:1.09375s}#introscreen .first-part #loading-indicator .g{animation:shrinkgrow 1.75s ease-in-out infinite;animation-delay:1.3125s}@keyframes shrinkgrow{0%{transform:scale(0)}12.5%{transform:scale(1)}25%{transform:scale(1)}33%{transform:scale(0)}100%{transform:scale(0)}}#introscreen .first-part #start-playing{font-size:36px;margin-left:auto;margin-right:auto;margin-top:40px}#introscreen .first-part .cookies-consent{margin-top:30px;max-width:70%;margin-left:auto;margin-right:auto;font-size:14px}#introscreen .first-part .cookies-long h3{text-align:left;margin-top:15px;margin-bottom:10px}#introscreen .first-part .cookies-long h4{text-align:left;margin-top:10px;margin-bottom:0;font-size:16px}#introscreen .first-part .cookies-long p{font-size:12px;color:#383838;text-align:left;margin-top:5px;margin-bottom:0}#introscreen .first-part .cookies-long ul{margin-top:5px;margin-bottom:5px}#introscreen .first-part .cookies-long li,#introscreen .first-part .cookies-long ul{font-size:12px;text-align:left}#introscreen .first-part .cookies-long li a,#introscreen .first-part .cookies-long ul a{color:#666}#introscreen .first-part .cookies-long button{border:none;padding:.7em 2em;border:#d19405 solid 1px;background:#fece2f;color:#4c3000;font-size:1em;letter-spacing:1px;text-transform:uppercase;cursor:pointer;display:inline-block;margin-top:10px;border-radius:8px;font-weight:600}#introscreen .first-part .cookies-long button:hover{background:#ffdd57}#introscreen .first-part .md-trigger{cursor:pointer}#introscreen .first-part .md-modal{position:absolute;left:1%;max-width:99%;z-index:200000;visibility:hidden;backface-visibility:hidden}#introscreen .first-part .md-show{visibility:visible}#introscreen .first-part .md-overlay{position:fixed;width:100%;height:100%;visibility:hidden;top:0;left:0;z-index:1000;opacity:0;background:rgb(253,224,176,.95);transition:all .3s}#introscreen .first-part .md-show~.md-overlay{opacity:1;visibility:visible}#introscreen .first-part .md-effect-1 .md-content{transform:scale(.7);opacity:0;transition:all .3s}#introscreen .first-part .md-show.md-effect-1 .md-content{transform:scale(1);opacity:1}#introscreen .second-part h2{font-size:36px;margin-top:60px}#introscreen .second-part h3{font-size:32px;margin-top:20px}#introscreen .second-part #second-part-button{font-size:32px;margin-right:auto;margin-left:auto;margin-top:100px}#introscreen .second-part .intro-rocket-shake{animation-duration:.75s;animation-delay:0s}#introscreen .second-part:after{content:"";background-image:url(../img/themoon.png?2);background-repeat:no-repeat;position:absolute;display:block;top:100px;right:-145px;margin:0;width:500px;height:500px;z-index:50;animation-name:moon;animation-duration:120s;animation-iteration-count:infinite;animation-delay:0s}#introscreen .third-part h3{font-size:32px;margin-top:60px;margin-bottom:20px;font-weight:400}#introscreen .third-part h4{font-size:28px;margin-top:10px;margin-bottom:10px;font-weight:400}#introscreen .third-part h2{font-size:30px}#introscreen .third-part h5{margin-top:60px;margin-bottom:20px;font-size:26px;font-weight:400}#introscreen .third-part #tutminer{display:block;margin-left:auto;margin-right:auto;width:390px;height:305px;cursor:pointer;position:relative}#introscreen .third-part #third-part-button{display:block;font-size:32px;margin-right:auto;margin-left:auto;margin-top:15px}#introscreen .third-part .third-part-doge{position:absolute;width:100%;height:100%}#introscreen .third-part .third-part-shop{position:absolute;width:100%;height:100%}#introscreen .third-part .third-part-shop #last-part-button{font-size:32px;margin-top:60px}#introscreen .third-part .hand{z-index:250;position:absolute;left:45%;top:40%}#introscreen .third-part .hand-clicking{top:41%}#introscreen .third-part .wowcontainer{position:absolute;width:30%;height:10%;left:35%;top:15%;z-index:251;margin-left:auto;margin-right:auto;display:block}#introscreen .third-part .space-maker{position:relative;height:10%;display:block;margin-left:auto;margin-right:auto}#introscreen .third-part .miniwowcontainer{position:absolute;width:17%;height:50%;left:42%;top:-20%;z-index:251;margin-left:auto;margin-right:auto;display:block}#introscreen .third-part .shibes-example{position:absolute;width:15%;height:5%;left:42%;margin-left:auto;margin-right:auto;display:block;margin-top:20px}#introscreen .third-part .shibes-example span{z-index:250}#introscreen .first-part,#introscreen .second-part,#introscreen .third-part{position:absolute;top:0;left:0;width:100%;height:100%;text-align:center}.nodelay{animation-delay:0s!important}@keyframes moon{from{animation-delay:0s!important}to{animation-delay:0s!important}}@keyframes ROTATE{from{transform:scale(1) rotate(0)}to{transform:scale(1) rotate(360deg)}}.ui-icon-volume-on{transform:scale(1.5)}.ui-icon-volume-off{transform:scale(1.5)}.ir{background-color:transparent;border:0;overflow:hidden}.ir:before{content:"";display:block;width:0;height:150%}.hidden{display:none!important;visibility:hidden}.nothidden{display:block!important}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:after,.clearfix:before{content:" ";display:table}.clearfix:after{clear:both}#supermegacontainer{position:relative}#sideadlol{position:absolute;top:32px;right:-310px;max-width:300px;max-height:600px;width:100%;height:100%}#footeradlol{position:relative;margin:0 auto;max-height:125px;max-width:980px;padding-top:15px;width:100%;height:100%}.footer-txt{position:absolute;top:-2px;left:15%}.side-txt{position:absolute;top:-22px;left:0}.footer-reddit{position:absolute;left:0;top:10px;display:inline-block;height:90px;width:728px}@media screen and (min-width:2035px){#superwrapper{margin:0 auto}}@media screen and (max-width:1864px){#sideadlol{right:-170px;max-width:160px;width:100%;height:100%}}@media screen and (max-width:1765px){#superwrapper{margin:0 0 0 125px}}@media screen and (max-width:1710px){#superwrapper{margin:0 0 0 60px}}@media screen and (max-width:1648px){#superwrapper{margin:0}}@media screen and (max-width:1584px){#superwrapper{width:1320px}#wrapper{width:710px}#tabs{width:586px}}@media screen and (max-width:1512px){#sideadlol{right:-130px;max-width:120px;width:100%;height:100%}}@media screen and (max-height:865px){#footeradlol{max-height:90px}#footeradlol{position:fixed;left:15%}#sideadlol{position:fixed;right:10px}}@media screen and (max-width:1473px){#wrapper{transform-origin:top left;transform:scale(.7) translateZ(0);backface-visibility:hidden}#tabs{transform-origin:top left;transform:scale(.7) translateZ(0);backface-visibility:hidden}#superwrapper{width:1098px;overflow:hidden;position:absolute}#sideadlol{position:absolute;right:40px;top:22px}.side-txt{font-size:60%!important;top:-13px!important}.footer-txt{font-size:60%!important;left:0}#footeradlol{max-height:90px;max-width:728px;padding-top:15px;position:absolute;bottom:120px;margin:0;left:0;width:100%;height:100%}#achievementwindow{top:400px}#introscreen{top:10px;width:90%;height:90%;max-height:585px}#introscreen .first-part h1{margin:.3em 0}#introscreen .first-part p{margin:.3em 0}#introscreen .first-part .cookies-consent{margin-top:6px}#introscreen .first-part #start-playing{margin-top:-5px}#introscreen .second-part h2{margin-top:30px}#introscreen .third-part h3{margin-top:25px}#introscreen .third-part h2{margin:0}#introscreen .third-part #tutminer{margin-top:-30px}#introscreen .third-part #third-part-button{margin-top:20px}#introscreen .third-part .hand{top:35%}#introscreen .third-part .hand-clicking{top:36%}}@media screen and (max-width:1083px),screen and (max-height:620px){#superwrapper{width:1063px}#wrapper{transform:scale(.65) translateZ(0)}#tabs{transform:scale(.65) translateZ(0)}#footeradlol{bottom:160px;padding-top:13px}#sideadlol{right:65px;top:30px}}.pbar{border-radius:5px;background:#fff;border:#aaa solid 1px;overflow:hidden;height:15px;text-align:right;font-size:70%}.pbar div{background-image:url(../img/pbar-ani.gif);border-right:1px solid #aaa}.floatleft{position:relative;float:left}.floatright{position:relative;float:right} diff --git a/dogeminer/css/mars-theme/jquery-ui-1.10.4.custom.min.css b/dogeminer/css/mars-theme/jquery-ui-1.10.4.custom.min.css new file mode 100644 index 00000000..da71aecd --- /dev/null +++ b/dogeminer/css/mars-theme/jquery-ui-1.10.4.custom.min.css @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.10.4 - 2015-01-08 +* http://jqueryui.com +* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=8px&bgColorHeader=%237b3125&bgTextureHeader=gloss_wave&bgImgOpacityHeader=45&borderColorHeader=%23bb8481&fcHeader=%23d4c7c7&iconColorHeader=%23bb8481&bgColorContent=%236d1116&bgTextureContent=highlight_soft&bgImgOpacityContent=25&borderColorContent=%237b3125&fcContent=%23d4c7c7&iconColorContent=%23bb8481&bgColorDefault=%236d1116&bgTextureDefault=gloss_wave&bgImgOpacityDefault=60&borderColorDefault=%237b3125&fcDefault=%23d4c7c7&iconColorDefault=%23bb8481&bgColorHover=%237b3125&bgTextureHover=gloss_wave&bgImgOpacityHover=70&borderColorHover=%237b3125&fcHover=%23d4c7c7&iconColorHover=%23bb8481&bgColorActive=%23bb8481&bgTextureActive=inset_soft&bgImgOpacityActive=30&borderColorActive=%237b3125&fcActive=%23d4c7c7&iconColorActive=%23d4c7c7&bgColorHighlight=%23d4c7c7&bgTextureHighlight=gloss_wave&bgImgOpacityHighlight=90&borderColorHighlight=%236d1116&fcHighlight=%237b3125&iconColorHighlight=%23bb8481&bgColorError=%23d4c7c7&bgTextureError=diagonals_medium&bgImgOpacityError=20&borderColorError=%236d1116&fcError=%237b3125&iconColorError=%23bb8481&bgColorOverlay=%23bb8481&bgTextureOverlay=flat&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=%23cccccc&bgTextureShadow=flat&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted #000}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;min-height:0}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:active,.ui-button:hover,.ui-button:link,.ui-button:visited{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-icons-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-icons-only .ui-button-icon-primary,.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary{left:.5em}.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner,input.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-next,.ui-datepicker .ui-datepicker-prev{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-next-hover,.ui-datepicker .ui-datepicker-prev-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-next span,.ui-datepicker .ui-datepicker-prev span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td a,.ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0 0;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:0}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:400}.ui-menu .ui-menu-item a.ui-state-active,.ui-menu .ui-menu-item a.ui-state-focus{font-weight:400;margin:-1px}.ui-menu .ui-state-disabled{font-weight:400;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("images/animated-overlay.gif");height:100%;opacity:.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:0 0;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0 0}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Segoe UI,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Segoe UI,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #7b3125;background:#6d1116 url("images/ui-bg_highlight-soft_25_6d1116_1x100.png") 50% top repeat-x;color:#d4c7c7}.ui-widget-content a{color:#d4c7c7}.ui-widget-header{border:1px solid #bb8481;background:#7b3125 url("images/ui-bg_gloss-wave_45_7b3125_500x100.png") 50% 50% repeat-x;color:#d4c7c7;font-weight:700}.ui-widget-header a{color:#d4c7c7}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #7b3125;background:#6d1116 url("images/ui-bg_gloss-wave_60_6d1116_500x100.png") 50% 50% repeat-x;font-weight:700;color:#d4c7c7}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#d4c7c7;text-decoration:none}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{border:1px solid #7b3125;background:#7b3125 url("images/ui-bg_gloss-wave_70_7b3125_500x100.png") 50% 50% repeat-x;font-weight:700;color:#d4c7c7}.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#d4c7c7;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #7b3125;background:#bb8481 url("images/ui-bg_inset-soft_30_bb8481_1x100.png") 50% 50% repeat-x;font-weight:700;color:#d4c7c7}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#d4c7c7;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #6d1116;background:#d4c7c7 url("images/ui-bg_gloss-wave_90_d4c7c7_500x100.png") 50% top repeat-x;color:#7b3125}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#7b3125}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #6d1116;background:#d4c7c7 url("images/ui-bg_diagonals-medium_20_d4c7c7_40x40.png") 50% 50% repeat;color:#7b3125}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#7b3125}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#7b3125}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-state-focus .ui-icon,.ui-state-hover .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_d4c7c7_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_bb8481_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-left,.ui-corner-tl,.ui-corner-top{border-top-left-radius:8px}.ui-corner-all,.ui-corner-right,.ui-corner-top,.ui-corner-tr{border-top-right-radius:8px}.ui-corner-all,.ui-corner-bl,.ui-corner-bottom,.ui-corner-left{border-bottom-left-radius:8px}.ui-corner-all,.ui-corner-bottom,.ui-corner-br,.ui-corner-right{border-bottom-right-radius:8px}.ui-widget-overlay{background:#bb8481 url("images/ui-bg_flat_50_bb8481_40x100.png") 50% 50% repeat-x;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#ccc url("images/ui-bg_flat_30_cccccc_40x100.png") 50% 50% repeat-x;opacity:.6;filter:Alpha(Opacity=60);border-radius:8px} diff --git a/dogeminer/css/sunny/jquery-ui-1.10.4.custom.min.css b/dogeminer/css/sunny/jquery-ui-1.10.4.custom.min.css new file mode 100644 index 00000000..39ab7fad --- /dev/null +++ b/dogeminer/css/sunny/jquery-ui-1.10.4.custom.min.css @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.10.4 - 2014-02-07 +* http://jqueryui.com +* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=8px&bgColorHeader=817865&bgTextureHeader=gloss_wave&bgImgOpacityHeader=45&borderColorHeader=494437&fcHeader=ffffff&iconColorHeader=fadc7a&bgColorContent=feeebd&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=8e846b&fcContent=383838&iconColorContent=d19405&bgColorDefault=fece2f&bgTextureDefault=gloss_wave&bgImgOpacityDefault=60&borderColorDefault=d19405&fcDefault=4c3000&iconColorDefault=3d3d3d&bgColorHover=ffdd57&bgTextureHover=gloss_wave&bgImgOpacityHover=70&borderColorHover=a45b13&fcHover=381f00&iconColorHover=bd7b00&bgColorActive=ffffff&bgTextureActive=inset_soft&bgImgOpacityActive=30&borderColorActive=655e4e&fcActive=0074c7&iconColorActive=eb990f&bgColorHighlight=fff9e5&bgTextureHighlight=gloss_wave&bgImgOpacityHighlight=90&borderColorHighlight=eeb420&fcHighlight=1f1f1f&iconColorHighlight=ed9f26&bgColorError=d34d17&bgTextureError=diagonals_medium&bgImgOpacityError=20&borderColorError=ffb73d&fcError=ffffff&iconColorError=ffe180&bgColorOverlay=5c5c5c&bgTextureOverlay=flat&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=cccccc&bgTextureShadow=flat&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after,.ui-helper-clearfix:before{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted #000}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;min-height:0}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:active,.ui-button:hover,.ui-button:link,.ui-button:visited{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-icons-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-icons-only .ui-button-icon-primary,.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary{left:.5em}.ui-button-icons-only .ui-button-icon-secondary,.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner,input.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-next,.ui-datepicker .ui-datepicker-prev{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-next-hover,.ui-datepicker .ui-datepicker-prev-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-next span,.ui-datepicker .ui-datepicker-prev span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td a,.ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:0 0;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:0}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;width:100%;list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;min-height:0;font-weight:400}.ui-menu .ui-menu-item a.ui-state-active,.ui-menu .ui-menu-item a.ui-state-focus{font-weight:400;margin:-1px}.ui-menu .ui-state-disabled{font-weight:400;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("images/animated-overlay.gif");height:100%;opacity:.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:0 0;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:0 0}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Segoe UI,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget button,.ui-widget input,.ui-widget select,.ui-widget textarea{font-family:Segoe UI,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #8e846b;background:#feeebd url(images/ui-bg_highlight-soft_100_feeebd_1x100.png) 50% top repeat-x;color:#383838}.ui-widget-content a{color:#383838}.ui-widget-header{border:1px solid #494437;background:#817865 url(images/ui-bg_gloss-wave_45_817865_500x100.png) 50% 50% repeat-x;color:#fff;font-weight:700}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d19405;background:#fece2f url(images/ui-bg_gloss-wave_60_fece2f_500x100.png) 50% 50% repeat-x;font-weight:700;color:#4c3000}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#4c3000;text-decoration:none}.ui-state-focus,.ui-state-hover,.ui-widget-content .ui-state-focus,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-focus,.ui-widget-header .ui-state-hover{border:1px solid #a45b13;background:#ffdd57 url(images/ui-bg_gloss-wave_70_ffdd57_500x100.png) 50% 50% repeat-x;font-weight:700;color:#381f00}.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#381f00;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #655e4e;background:#fff url(images/ui-bg_inset-soft_30_ffffff_1x100.png) 50% 50% repeat-x;font-weight:700;color:#0074c7}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#0074c7;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #eeb420;background:#fff9e5 url(images/ui-bg_gloss-wave_90_fff9e5_500x100.png) 50% top repeat-x;color:#1f1f1f}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#1f1f1f}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ffb73d;background:#d34d17 url(images/ui-bg_diagonals-medium_20_d34d17_40x40.png) 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url(images/ui-icons_d19405_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_fadc7a_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_3d3d3d_256x240.png)}.ui-state-focus .ui-icon,.ui-state-hover .ui-icon{background-image:url(images/ui-icons_bd7b00_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_eb990f_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_ed9f26_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_ffe180_256x240.png)}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-left,.ui-corner-tl,.ui-corner-top{border-top-left-radius:8px}.ui-corner-all,.ui-corner-right,.ui-corner-top,.ui-corner-tr{border-top-right-radius:8px}.ui-corner-all,.ui-corner-bl,.ui-corner-bottom,.ui-corner-left{border-bottom-left-radius:8px}.ui-corner-all,.ui-corner-bottom,.ui-corner-br,.ui-corner-right{border-bottom-right-radius:8px}.ui-widget-overlay{background:#5c5c5c url(images/ui-bg_flat_50_5c5c5c_40x100.png) 50% 50% repeat-x;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#ccc url(images/ui-bg_flat_30_cccccc_40x100.png) 50% 50% repeat-x;opacity:.6;filter:Alpha(Opacity=60);border-radius:8px} diff --git a/dogeminer/favicon.ico b/dogeminer/favicon.ico new file mode 100644 index 00000000..96039432 Binary files /dev/null and b/dogeminer/favicon.ico differ diff --git a/dogeminer/img/achi/placeholder.png b/dogeminer/img/achi/placeholder.png new file mode 100644 index 00000000..673b97fc Binary files /dev/null and b/dogeminer/img/achi/placeholder.png differ diff --git a/dogeminer/img/bg/bg001.jpg b/dogeminer/img/bg/bg001.jpg new file mode 100644 index 00000000..8a18cacf Binary files /dev/null and b/dogeminer/img/bg/bg001.jpg differ diff --git a/dogeminer/img/bg/bg002.jpg b/dogeminer/img/bg/bg002.jpg new file mode 100644 index 00000000..426d16b3 Binary files /dev/null and b/dogeminer/img/bg/bg002.jpg differ diff --git a/dogeminer/img/bg/bg003.jpg b/dogeminer/img/bg/bg003.jpg new file mode 100644 index 00000000..9f543feb Binary files /dev/null and b/dogeminer/img/bg/bg003.jpg differ diff --git a/dogeminer/img/bg/bg1.jpg b/dogeminer/img/bg/bg1.jpg new file mode 100644 index 00000000..fea1a3e3 Binary files /dev/null and b/dogeminer/img/bg/bg1.jpg differ diff --git a/dogeminer/img/bg/bg101.jpg b/dogeminer/img/bg/bg101.jpg new file mode 100644 index 00000000..424b896d Binary files /dev/null and b/dogeminer/img/bg/bg101.jpg differ diff --git a/dogeminer/img/bg/bg102.jpg b/dogeminer/img/bg/bg102.jpg new file mode 100644 index 00000000..b75f31aa Binary files /dev/null and b/dogeminer/img/bg/bg102.jpg differ diff --git a/dogeminer/img/bg/bg103.jpg b/dogeminer/img/bg/bg103.jpg new file mode 100644 index 00000000..06240b80 Binary files /dev/null and b/dogeminer/img/bg/bg103.jpg differ diff --git a/dogeminer/img/bg/bg104.jpg b/dogeminer/img/bg/bg104.jpg new file mode 100644 index 00000000..54b18230 Binary files /dev/null and b/dogeminer/img/bg/bg104.jpg differ diff --git a/dogeminer/img/bg/bg105.jpg b/dogeminer/img/bg/bg105.jpg new file mode 100644 index 00000000..9ea53ce4 Binary files /dev/null and b/dogeminer/img/bg/bg105.jpg differ diff --git a/dogeminer/img/bg/bg2.jpg b/dogeminer/img/bg/bg2.jpg new file mode 100644 index 00000000..25fad87d Binary files /dev/null and b/dogeminer/img/bg/bg2.jpg differ diff --git a/dogeminer/img/bg/bg3.jpg b/dogeminer/img/bg/bg3.jpg new file mode 100644 index 00000000..135cc91b Binary files /dev/null and b/dogeminer/img/bg/bg3.jpg differ diff --git a/dogeminer/img/bg/bg4.jpg b/dogeminer/img/bg/bg4.jpg new file mode 100644 index 00000000..c0369804 Binary files /dev/null and b/dogeminer/img/bg/bg4.jpg differ diff --git a/dogeminer/img/bg/bg5.jpg b/dogeminer/img/bg/bg5.jpg new file mode 100644 index 00000000..0178c8dc Binary files /dev/null and b/dogeminer/img/bg/bg5.jpg differ diff --git a/dogeminer/img/bg/bg6.jpg b/dogeminer/img/bg/bg6.jpg new file mode 100644 index 00000000..20b7bc45 Binary files /dev/null and b/dogeminer/img/bg/bg6.jpg differ diff --git a/dogeminer/img/bg/bg7.jpg b/dogeminer/img/bg/bg7.jpg new file mode 100644 index 00000000..b08955ca Binary files /dev/null and b/dogeminer/img/bg/bg7.jpg differ diff --git a/dogeminer/img/bg/bg8.jpg b/dogeminer/img/bg/bg8.jpg new file mode 100644 index 00000000..b30b3b0b Binary files /dev/null and b/dogeminer/img/bg/bg8.jpg differ diff --git a/dogeminer/img/bg/bg9.jpg b/dogeminer/img/bg/bg9.jpg new file mode 100644 index 00000000..813abf3e Binary files /dev/null and b/dogeminer/img/bg/bg9.jpg differ diff --git a/dogeminer/img/dogecoin-d.png b/dogeminer/img/dogecoin-d.png new file mode 100644 index 00000000..47765801 Binary files /dev/null and b/dogeminer/img/dogecoin-d.png differ diff --git a/dogeminer/img/dogeminer_300x300.png b/dogeminer/img/dogeminer_300x300.png new file mode 100644 index 00000000..59638c7f Binary files /dev/null and b/dogeminer/img/dogeminer_300x300.png differ diff --git a/dogeminer/img/empty.png b/dogeminer/img/empty.png new file mode 100644 index 00000000..faac9324 Binary files /dev/null and b/dogeminer/img/empty.png differ diff --git a/dogeminer/img/flyingrocket.png b/dogeminer/img/flyingrocket.png new file mode 100644 index 00000000..03481d10 Binary files /dev/null and b/dogeminer/img/flyingrocket.png differ diff --git a/dogeminer/img/level1.png b/dogeminer/img/level1.png new file mode 100644 index 00000000..1d3657d7 Binary files /dev/null and b/dogeminer/img/level1.png differ diff --git a/dogeminer/img/level2.png b/dogeminer/img/level2.png new file mode 100644 index 00000000..2de5d46f Binary files /dev/null and b/dogeminer/img/level2.png differ diff --git a/dogeminer/img/level3.png b/dogeminer/img/level3.png new file mode 100644 index 00000000..21463d64 Binary files /dev/null and b/dogeminer/img/level3.png differ diff --git a/dogeminer/index.html b/dogeminer/index.html new file mode 100644 index 00000000..9b4d429a --- /dev/null +++ b/dogeminer/index.html @@ -0,0 +1,909 @@ + + + + + + + + + + + + Doge Miner + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + +
      +

      Welcome to Dogecoin DOGEMINER

      +

      The Dogecoin Mining Simulator

      +
      + +
      +
      +
      L
      +
      O
      +
      A
      +
      D
      +
      I
      +
      N
      +
      G
      +
      +
      + +
      + + +
      + + + +
      + + +
      + + +
      +
      +
      +

      + Dogecoin + DOGEMINER +

      + + + + + +
      + LOCATION:
      + + EARTH + +
      + TARGET:
      + + MOON + +
      + LAUNCH STATUS:
      + 0% +
      +
      +
      00:00:00
      +
      + +
      + +
      +
       
      + +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +

      Dogecoins: 0

      +
      +
      +

      Dogecoins per sec: 0

      +
      +
      +
      +
      +
      +
      + +
      + + +
      +
      +

      Get help:

      + +
      +
      +
      + +

      Mining Shibe

      +

      +
      + +
      +
      + Very kind shibe to mine much dogecoin.
      +
      +
      + +
      + +
      +
      + +

      Doge Kennels

      +

      +
      + +
      +
      + Wow very efficiency, entire kennels to mine dogecoin.
      +
      + +
      + +
      +
      + +

      Slave Kittens

      +

      +
      + +
      +
      + Kittens to post cute videos to the internet for dogecoin.
      +
      + +
      + +
      +
      + +

      Space Rocket

      +

      +
      + +
      +
      + A rocket to fly to the moon to find more dogecoin.
      +
      + +
      + +
      +
      + +

      Moon Base

      +

      +
      + +
      +
      + A base on the moon to extract much dogecoin.
      +
      + +
      + +
      +
      + +

      Time Machine Mining Rig

      +

      +
      + +
      +
      + Mines into the future where infinite dogecoins exist.
      +
      + +
      +
      +
      +
      + +
      +

      Get upgrades:

      +
      +
      +
      +
      + +
      +

      Achievements:

      +
      +
      +
      +
      + +
      +

      Statistics:

      +
      + Refresh
      +
      +
      +

      Achievements unlocked (total):

      +

      Total time played:

      +

      Bonus coins grabbed:

      +

      Total clicks:

      +
      + +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +

      +

       

      +

      +

      +

      +

      +

      +

      +

       

      +

      +
      +
      +
      +
      +
      + +
      +

      Settings:

      +
      + Reset game
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + + +
      +
      + +
      +
      + +
      +
      + Export Save
      +
      + Import Save
      +
      + Switch location +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + Hi:) +
      + + + + + + diff --git a/dogeminer/js/main.js b/dogeminer/js/main.js new file mode 100644 index 00000000..0075a168 --- /dev/null +++ b/dogeminer/js/main.js @@ -0,0 +1 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(e){"use strict";$((function(){function t(){return++Ve>=Fe.length?Fe[Ve=0]:Fe[Ve]}function r(e){return e||(e=Ke),e[Math.floor(t()*e.length)]}function o(e){return e||(e=qe),e[Math.floor(t()*e.length)]}function a(e){return e||(e=Qe),e[Math.floor(t()*e.length)]}function i(e){return e||(e=Xe),e[Math.floor(t()*e.length)]}function s(e){return e||(e=Ze),e[Math.floor(t()*e.length)]}function l(e){switch(e){case 1:return{costtitle:"The Moon",currcolor:"#a48032",currentmusic:"earthmusic",currlocation:"EARTH",dogefix:["wow","such "+r(),"very "+r(),"much "+r(),"wow","such "+r(),"very "+r(),"much "+r(),"so "+r(),"many "+r(),"want "+r(),"wow","amaze","10/10","10/10 "+r(),"to the moon!"],fundtext:"Moon Fund",imgArr:new Array("./img/bg/bg1.jpg","./img/bg/bg2.jpg","./img/bg/bg3.jpg","./img/bg/bg4.jpg","./img/bg/bg5.jpg","./img/bg/bg6.jpg","./img/bg/bg7.jpg","./img/bg/bg8.jpg","./img/bg/bg9.jpg"),imgArrlvl:new Array("./img/level1.png"),kittenfix:["i can haz "+o(),"oh my "+o(),"mjau","mjau "+o(),"cam?","i iz cute?","purrrrrr","yes master doge","why no kittencoin?","plz "+o(),"u want pussy?","rate me","txt me"],launchcost:5e10,modifier:"",modifier_small:"",newslinecolor:"#111111",nextcolor:"#b2b2b2",nextlocation:"MOON",popclass:"pop",theme:"css/sunny/jquery-ui-1.10.4.custom.min.css",upgrades:{clickups:[],shibeups:[],kennelsups:[],kittensups:[],rocketups:[],baseups:[],rigups:[],extraups:[]}};case 2:return{costtitle:"Mars",currcolor:"#b2b2b2",currentmusic:"moonmusic",currlocation:"MOON",dogefix:["wow","such "+a(),"very "+a(),"much "+a(),"wow","such "+a(),"very "+a(),"much "+a(),"so "+a(),"many "+a(),"want "+a(),"wow","amaze","10/10","10/10 "+a(),"on the moon!"],fundtext:"Mars Fund",imgArr:new Array("./img/bg/bg001.jpg","./img/bg/bg002.jpg?2","./img/bg/bg003.jpg","./img/bg/bg5.jpg"),imgArrlvl:new Array("./img/level2.png"),kittenfix:["wow","such "+a(),"very "+a(),"much "+a(),"wow","such "+a(),"very "+a(),"much "+a(),"so "+a(),"many "+a(),"want "+a(),"wow","amaze","10/10","10/10 "+a(),"to the moon!"],launchcost:5e10,modifier:"Billion",modifier_small:"B",newslinecolor:"#111111",nextcolor:"#c87645",nextlocation:"MARS",popclass:"popmoon",theme:"css/cupertino/jquery-ui-1.10.4.custom.min.css",upgrades:{clickups:[],shibeups:[],kennelsups:[],kittensups:[],rocketups:[],baseups:[],rigups:[],extraups:[]}};case 3:return{costtitle:"????",currcolor:"#c87645",currentmusic:"marsmusic",currlocation:"MARS",dogefix:["wow","such "+i(),"very "+i(),"much "+i(),"wow","such "+i(),"very "+i(),"much "+i(),"so "+i(),"many "+i(),"want "+i(),"wow","amaze","10/10","10/10 "+i(),"on the mars!"],fundtext:"???? Fund",imgArr:new Array("./img/bg/bg101.jpg","./img/bg/bg102.jpg","./img/bg/bg103.jpg","./img/bg/bg104.jpg","./img/bg/bg105.jpg"),imgArrlvl:new Array("./img/level3.png"),kittenfix:["i can haz "+s(),"oh my "+s(),"mjau","mjau "+s(),"house?","i iz music?","purrrrrr","yes master DJ","why no kittenzcoin?","plz "+s(),"u want kittenz bby?","rate me","txt me"],launchcost:1e21,modifier:"Trillion",modifier_small:"T",newslinecolor:"#DADADA",nextcolor:"#DAC2A0",nextlocation:"????",popclass:"popmars",theme:"css/mars-theme/jquery-ui-1.10.4.custom.min.css",upgrades:{clickups:[],shibeups:[],kennelsups:[],kittensups:[],rocketups:[],baseups:[],rigups:[],extraups:[]}}}}function u(e,n){var r=Math.floor(25*t()-10)-30,o=Math.floor(25*t()-10)+200;requestAnimationFrame((function(){var t=$('
      '+n+"
      ");$(t).appendTo("#"+e).one(lt,(function(){requestAnimationFrame((function(){$(t).remove()}))}))}))}function d(){pe(),requestAnimationFrame((function(){Be.html(X(tt.clicks))})),soundManager.setup({url:"swf/",flashVersion:9,preferFlash:!1,onready:Ce,ontimeout:function(){nt.canhandlesounds=!1}}),!_()&&tt.level<2?(me(),$(".first-part").addClass("animated zoomOutDown"),$(".first-part").one(lt,(function(){$(this).hide()})),$(".second-part").addClass("animated zoomInDown"),$(".second-part").show(),$(".second-part").one(lt,(function(){$(".intro-rocket").one(lt,(function(){$(".intro-rocket").attr("class","intro-rocket animated shake infinite nodelay duration-8")}))}))):c()}function c(){(function(){window.setInterval((function(){se(),O(),function(){var e=$e.find("span.random-text");if(e.length>50){var t=!0;e.each((function(){t&&$(this).remove(),t=!t}))}}()}),1e4),window.setInterval((function(){document.title=X(tt.currentlevel().coins)+" Dogecoins - "+nt.currentlevel().currlocation+" - DOGEMINER",function(){var e="";nt.progress=Math.floor(tt.currentlevel().coins/nt.currentlevel().launchcost*100),nt.progress>100&&(nt.progress=100),function(e,t){requestAnimationFrame((function(){var n=e*t.width()/100;t.find("div").animate({width:n},500).html(nt.currentlevel().nextlocation+" FUND: "+e+"% ")}))}(nt.progress,$("#progressBar")),e=nt.progress+"%",tt.maxlevel>tt.level?(we(),Vt=!1,Ft=!1,$("#progressBar").hide("scale",null,500,null),$("#launchbutton").hide("scale",null,500,null),e="COMPLETE"):tt.level==nt.gamemaxlevel?(we(),Vt=!1,Ft=!1,$("#progressBar").hide("scale",null,500,null),$("#launchbutton").hide("scale",null,500,null),e="????"):nt.progress>=100?($("#progressBar").hide("scale",null,500,null),$("#launchbutton").show("scale",null,500,null),function(){function e(t){soundManager.getSoundById(t).play({onfinish:function(){Vt&&e(t)}})}!Ft&&$t&&(Vt=!0,Ft=!0,e("alert"))}()):nt.progress>19&&nt.progress<100?($("#progressBar").show("scale",null,500,null),$("#launchbutton").hide("scale",null,500,null),we(),Vt=!1,Ft=!1):nt.progress<10&&(we(),Vt=!1,Ft=!1,$("#launchbutton").hide("scale",null,500,null),$("#progressBar").hide("scale",null,500,null)),requestAnimationFrame((function(){$("#progress").html(e)}))}(),function(){for(var e,t,n=0;n=t.amount&&xe(e),"time"==t.type&&void 0===t.type2&&tt.timeplayed>=t.amount&&xe(e),"coins"==t.type&&"time"===t.type2&&t.level==tt.level&&tt.currentlevel().coins>=t.amount&&tt.timeplayed=t.amount&&xe(e),"shibes"==t.type&&"time"===t.type2&&t.level==tt.level&&tt.currentlevel().shibes>=t.amount&&tt.timeplayed<=t.amount2&&xe(e),"shibes"==t.type&&"kennels"===t.type2&&t.level==tt.level&&tt.currentlevel().shibes>=t.amount&&tt.currentlevel().kennels>=t.amount2&&xe(e),"kennels"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().kennels>=t.amount&&xe(e),"kennels"==t.type&&"time"===t.type2&&t.level==tt.level&&tt.currentlevel().kennels>=t.amount&&tt.timeplayed<=t.amount2&&xe(e),"kittens"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().kittens>=t.amount&&xe(e),"rockets"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().rockets>=t.amount&&xe(e),"rockets"==t.type&&"bases"===t.type2&&t.level==tt.level&&tt.currentlevel().rockets>=t.amount&&bases>=t.amount2&&xe(e),"bases"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().bases>=t.amount&&xe(e),"rigs"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().rigs>=t.amount&&xe(e),"clickups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().clickupslevel>=t.amount&&xe(e),"shibeups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().shibeupslevel>=t.amount&&xe(e),"kennelsups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().kennelsupslevel>=t.amount&&xe(e),"kittensups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().kittensupslevel>=t.amount&&xe(e),"rocketups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().rocketupslevel>=t.amount&&xe(e),"baseups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().baseupslevel>=t.amount&&xe(e),"rigups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().rigupslevel>=t.amount&&xe(e),"extraups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().extraupslevel>=t.amount&&xe(e),"clicks"==t.type&&"time"===t.type2&&tt.currentlevel().clicks>=t.amount&&tt.timeplayed=t.amount&&xe(e),"bonuscoins"==t.type&&void 0===t.type2&&tt.bonuscoins>=t.amount&&xe(e),"anyups"==t.type&&void 0===t.type2&&t.level==tt.level&&(tt.currentlevel().clickupslevel>0||tt.currentlevel().shibeupslevel>0||tt.currentlevel().kennelsupslevel>0||tt.currentlevel().kittensupslevel>0||tt.currentlevel().rocketupslevel>0||tt.currentlevel().baseupslevel>0||tt.currentlevel().rigupslevel>0||tt.currentlevel().extraupslevel>0)&&xe(e),"allups"==t.type&&void 0===t.type2&&t.level==tt.level&&tt.currentlevel().clickupslevel==nt.currentlevel().upgrades.clickups.length&&tt.currentlevel().shibeupslevel==nt.currentlevel().upgrades.shibeups.length&&tt.currentlevel().kennelsupslevel==nt.currentlevel().upgrades.kennelsups.length&&tt.currentlevel().kittensupslevel==nt.currentlevel().upgrades.kittensups.length&&tt.currentlevel().rocketupslevel==nt.currentlevel().upgrades.rocketups.length&&tt.currentlevel().baseupslevel==nt.currentlevel().upgrades.baseups.length&&tt.currentlevel().rigupslevel==nt.currentlevel().upgrades.rigups.length&&tt.currentlevel().extraupslevel==nt.currentlevel().upgrades.extraups.length&&xe(e),"level"==t.type&&void 0===t.type2&&t.level==tt.level&&xe(e)}(),function(){for(var e=0;e13&&_t.length>0&&vt.currentstr!=_t[0]&&(vt.currentstr=_t.shift(),J()),vt.hasrunfor>120&&Ge.hasClass(gt)&&Ge.attr("class",ft),tt.animate&&function(){function e(e){setTimeout((function(){!function(e){nt.helperanimations.rigs&&requestAnimationFrame((function(){var t=e;nt.helperanimations.dontanimatethis!=t?t.attr("class","level"+tt.level+" level"+tt.level+"-rig1"+tt.currentlevel().rigupslevel):I()}))}(e)}),3e3)}nt.helperanimations.rigs&&requestAnimationFrame((function(){for(var n=0;nt()){var r="#rign"+n,o=$(r);nt.helperanimations.dontanimatethis!=r&&o.attr("class","level"+tt.level+" level"+tt.level+"-rig2"+tt.currentlevel().rigupslevel),e(o)}}}))}()}),1e3),window.setInterval((function(){W()}),25);var e=12e4;window.setInterval((function(){var e=t();.22>e?_e():e>.22&&.28>e&&fe()}),e),p()})(),ot=!1,at=!1,$(".introcontainer").fadeOut().remove(),$("#introscreen").removeClass("zoomInDown"),$("#introscreen").addClass("zoomOutDown"),requestAnimationFrame((function(){$("#sideadlol").addClass("animated delay-30 fadeIn"),$("#footeradlol").addClass("animated delay-30 fadeIn"),$("#sideadlol").attr("style",""),$("#footeradlol").attr("style",""),setTimeout((function(){(adsbygoogle=window.adsbygoogle||[]).push({}),(adsbygoogle=window.adsbygoogle||[]).push({})}),1e3)})),$("#introscreen").one(lt,(function(){$(this).remove()})),it=!1,_(!0)}function p(){setTimeout((function(){tt.animate&&(nt.helperanimations.shibes&&requestAnimationFrame((function(){for(var e=0;et()&&te(r(nt.currentlevel().dogefix),o,Math.max(8,12*t()+1),"-"+(5*t()+15)+"px")}})),nt.helperanimations.kennels&&requestAnimationFrame((function(){for(var e=0;et()&&te(r(nt.currentlevel().dogefix),o,Math.max(8,15*t()+1),"-"+(5*t()+20)+"px")}})),nt.helperanimations.kittens&&requestAnimationFrame((function(){for(var e=0;et()&&te(o(nt.currentlevel().kittenfix),r,Math.max(8,15*t()+1),"-"+(5*t()+14)+"px")}})),nt.helperanimations.rockets&&requestAnimationFrame((function(){for(var e=0;et()&&te("to the "+nt.currentlevel().nextlocation.toLowerCase(),r,Math.max(8,15*t()+1),"-"+(5*t()+2)+"px")}})),nt.helperanimations.bases&&requestAnimationFrame((function(){for(var e=0;et()&&te(r(nt.currentlevel().dogefix),o,Math.max(8,15*t()+1),"-"+(5*t()+2)+"px")}})),setTimeout((function(){j(),A(),R(),V(),F()}),200*nt.speedvar)),function(){if(nt.started&&!it){null===nt.lasttime&&(nt.lasttime=new Date);var e=(new Date).getTime()-nt.lasttime.getTime();tt.timeplayed+=e/1e3,nt.lasttime=new Date;var t=Math.floor(tt.timeplayed%60),n=Math.floor(tt.timeplayed/60%60),r=Math.floor(tt.timeplayed/3600);t=P(t,2),n=P(n,2),r=P(r,2),Je.html(r+":"+n+":"+t)}tt.timeplayed>10&&!dt&&($("#showhidediv").addClass("animated fadeInDown duration-10"),dt=!0)}(),p()}),500*nt.speedvar)}function m(){$(".hand").removeClass("hand-hand1").addClass("hand-hand2 hand-clicking"),new u("tutminer","+1"),$("#tutminer").removeClass("level1-doge_mine1u0").addClass("level1-doge_mine2u0"),function(){if(t()>.6){var e=$(".wowcontainer");te(r(nt.currentlevel().dogefix),e,Math.max(12,25*t()+10))}}(),ot&&setTimeout((function(){$(".hand").removeClass("hand-hand2 hand-clicking").addClass("hand-hand1"),$("#tutminer").removeClass("level1-doge_mine2u0").addClass("level1-doge_mine1u0"),ot&&setTimeout((function(){m()}),300)}),150)}function h(){$(".shibes-example").children().removeClass("level1 level1-shibe0 level1-shibe20 level1-shibe"+st+" level1-shibe2"+st).addClass("level1 level1-shibe2"+st),function(){if(t()>.8){var e=$(".miniwowcontainer");te(r(nt.currentlevel().dogefix),e,Math.max(10,10*t()+6))}}(),at&&setTimeout((function(){$(".shibes-example").children().removeClass("level1 level1-shibe0 level1-shibe20 level1-shibe"+st+" level1-shibe2"+st).addClass("level1 level1-shibe"+st),at&&setTimeout((function(){h()}),600)}),250)}function _(e){if(!e){var t=localStorage.getItem("dogeminer-tutorial");return JSON.parse(t)}localStorage.setItem("dogeminer-tutorial",JSON.stringify(!0))}function g(e,t,n,r,o,a){this.name=e,this.desc=t,this.cost=n,this.strength=r,this.shoptitle=void 0===o?e:o,this.shopdesc=void 0===a?t:a}function f(){1==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=2+.1*U()),2==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=100+.105*U()),3==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=5e4+.109*U()),4==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=9e7+.12*U()),5==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=9e8+.13*U()),6==tt.currentlevel().clickupslevel&&(tt.currentlevel().clickstrength=9e9+.14*U())}function v(){var e="";nt.currentlevel().upgrades.clickups.length>tt.currentlevel().clickupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.clickups[tt.currentlevel().clickupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.clickups[tt.currentlevel().clickupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.clickups[tt.currentlevel().clickupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.shibeups.length>tt.currentlevel().shibeupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.kennelsups.length>tt.currentlevel().kennelsupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.kittensups.length>tt.currentlevel().kittensupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.rocketups.length>tt.currentlevel().rocketupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.baseups.length>tt.currentlevel().baseupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.rigups.length>tt.currentlevel().rigupslevel+1&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel+1].name+" - Cost: "+X(nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel+1].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel+1].desc+'
      ',e+="
      "),nt.currentlevel().upgrades.extraups.length>tt.currentlevel().extraupslevel&&(e+='
      ',e+='',e+='
      '+nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel].name+" - Cost: "+X(nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel].cost)+" "+nt.currentlevel().modifier_small+' doge.
      '+nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel].desc+'
      ',e+="
      "),$("#upgradewrapper").html(e),$("#upgradeclicks").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradeshibes").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradekennels").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradekittens").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgraderockets").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradebases").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgraderigs").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradeextras").button({icons:{primary:"ui-icon-circle-arrow-n"}}),$("#upgradeclicks").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgradeshibes").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgradekennels").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgradekittens").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgraderockets").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgradebases").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgraderigs").attr("disabled",!0).addClass("ui-state-disabled"),$("#upgradeextras").attr("disabled",!0).addClass("ui-state-disabled"),$("#clickupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#shibeupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#kennelsupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#kittensupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#rocketupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#baseupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#rigupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),$("#extraupgradediv").attr("disabled",!0).addClass("ui-state-disabled"),nt.upgradesloaded||($("#upgradewrapper").on("click","#upgradeclicks",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.clickups[tt.currentlevel().clickupslevel+1].cost&&(hideIt("blind","#clickupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.clickups[tt.currentlevel().clickupslevel+1].cost,tt.currentlevel().clickupslevel++,W(),f(),Q(),function(e){requestAnimationFrame((function(){$("#miner").addClass("animated "+e)}))}("flash"),y(),ne(),Me())})),$("#upgradewrapper").on("click","#upgradeshibes",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel+1].cost&&(hideIt("blind","#shibeupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel+1].cost,tt.currentlevel().shibeupslevel++,W(),tt.currentlevel().shibestrength=nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel].strength,G(),M(),ke(),f(),j(),b("#shibesdiv","tada","shibes"),y(),ne())})),$("#upgradewrapper").on("click","#upgradekennels",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel+1].cost&&(hideIt("blind","#kennelsupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel+1].cost,tt.currentlevel().kennelsupslevel++,W(),tt.currentlevel().kennelstrength=nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel].strength,G(),M(),ke(),f(),y(),A(),b("#kennelsdiv","tada","kennels"),ne())})),$("#upgradewrapper").on("click","#upgradekittens",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel+1].cost&&(hideIt("blind","#kittensupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel+1].cost,tt.currentlevel().kittensupslevel++,W(),tt.currentlevel().kittenstrength=nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel].strength,G(),M(),ke(),f(),y(),R(),b("#kittensdiv","tada","kittens"),ne())})),$("#upgradewrapper").on("click","#upgraderockets",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel+1].cost&&(hideIt("blind","#rocketupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel+1].cost,tt.currentlevel().rocketupslevel++,W(),tt.currentlevel().rocketstrength=nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel].strength,G(),M(),ke(),f(),y(),V(),ne())})),$("#upgradewrapper").on("click","#upgradebases",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel+1].cost&&(hideIt("blind","#baseupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel+1].cost,tt.currentlevel().baseupslevel++,W(),tt.currentlevel().basestrength=nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel].strength,G(),M(),ke(),f(),y(),F(),b("#basesdiv","tada","bases"),ne())})),$("#upgradewrapper").on("click","#upgraderigs",(function(){tt.currentlevel().coins>=nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel+1].cost&&(hideIt("blind","#rigupgradediv",200),tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel+1].cost,tt.currentlevel().rigupslevel++,W(),tt.currentlevel().rigstrength=nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel].strength,G(),M(),ke(),f(),y(),nt.helperanimations.rigs&&requestAnimationFrame((function(){for(var e=0;e=nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel].cost&&(tt.currentlevel().coins=tt.currentlevel().coins-nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel].cost,tt.currentlevel().extraupslevel++,W(),tt.currentlevel().extrastrength=nt.currentlevel().upgrades.extraups[tt.currentlevel().extraupslevel-1].strength,G(),ke(),f(),y(),Me(),ne())})),nt.upgradesloaded=!0)}function y(){setTimeout((function(){v()}),200)}function b(e,t,n){nt.helperanimations[n]=!1,requestAnimationFrame((function(){$(e).children().addClass("animated "+t).one(lt,(function(){nt.helperanimations[n]=!0}))}))}function M(){requestAnimationFrame((function(){$("#shibesimage").attr("class","level"+tt.level+" level"+tt.level+"-shibe"+tt.currentlevel().shibeupslevel),$("#shibesname").html(nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel].shoptitle),$("#shibesdesc").html(nt.currentlevel().upgrades.shibeups[tt.currentlevel().shibeupslevel].shopdesc),$("#kennelsimage").attr("class","level"+tt.level+" level"+tt.level+"-kennels1"+tt.currentlevel().kennelsupslevel),$("#kennelsname").html(nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel].shoptitle),$("#kennelsdesc").html(nt.currentlevel().upgrades.kennelsups[tt.currentlevel().kennelsupslevel].shopdesc),$("#kittensimage").attr("class","level"+tt.level+" level"+tt.level+"-kitten1"+tt.currentlevel().kittensupslevel),$("#kittensname").html(nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel].shoptitle),$("#kittensdesc").html(nt.currentlevel().upgrades.kittensups[tt.currentlevel().kittensupslevel].shopdesc),$("#rocketsimage").attr("class","level"+tt.level+" level"+tt.level+"-rocket1"+tt.currentlevel().rocketupslevel),$("#rocketsname").html(nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel].shoptitle),$("#rocketsdesc").html(nt.currentlevel().upgrades.rocketups[tt.currentlevel().rocketupslevel].shopdesc),$("#basesimage").attr("class","level"+tt.level+" level"+tt.level+"-base1"+tt.currentlevel().baseupslevel),$("#basesname").html(nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel].shoptitle),$("#basesdesc").html(nt.currentlevel().upgrades.baseups[tt.currentlevel().baseupslevel].shopdesc),$("#rigsimage").attr("class","level"+tt.level+" level"+tt.level+"-rig1"+tt.currentlevel().rigupslevel),$("#rigsname").html(nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel].shoptitle),$("#rigsdesc").html(nt.currentlevel().upgrades.rigups[tt.currentlevel().rigupslevel].shopdesc)}))}function k(e,t){requestAnimationFrame((function(){$(e).addClass(t).one(lt,(function(){requestAnimationFrame((function(){$(e).removeClass(t)}))}))}))}function w(){tt.sounds?($("#muteicon").removeClass("ui-icon-volume-on"),$("#muteicon").addClass("ui-icon-volume-off"),tt.sounds=!1,soundManager.mute()):($("#muteicon").removeClass("ui-icon-volume-off"),$("#muteicon").addClass("ui-icon-volume-on"),De(),tt.sounds=!0,soundManager.unmute()),$("#sounds").prop("checked",tt.sounds)}function D(e){e.html("")}function L(e,t,n,r){requestAnimationFrame((function(){e.append('
      '),$("#"+t).one(lt,(function(){$(this).removeClass(ut)}))}))}function T(e,n){if(void 0!==e||tt.currentlevel().shibes=2&&$("#level3tab").find("a").html("MARS"),$(".stats-achis").html(Ut.length+" / "+Wt.length),$(".stats-timeplayed").html(function(e){var t=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600);return t=P(t,2),n=P(n,2),(r=P(r,2))+":"+n+":"+t}(tt.timeplayed)),$(".stats-bonuscoins").html(tt.bonuscoins),$(".stats-clicks").html(tt.clicks);var e=$("#stats1"),t=$("#stats2"),n=$("#stats3");e.find(".stats-coins").html("Dogecoins mined: "+Z(tt.level1.alltimecoins,0)+""),e.find(".stats-shibes").html(nt.level1.upgrades.shibeups[tt.level1.shibeupslevel].shoptitle+"s: "+X(tt.level1.shibes)+""),e.find(".stats-kennels").html(nt.level1.upgrades.kennelsups[tt.level1.kennelsupslevel].shoptitle+": "+X(tt.level1.kennels)+""),e.find(".stats-kittens").html(nt.level1.upgrades.kittensups[tt.level1.kittensupslevel].shoptitle+": "+X(tt.level1.kittens)+""),e.find(".stats-rockets").html(nt.level1.upgrades.rocketups[tt.level1.rocketupslevel].shoptitle+"s: "+X(tt.level1.rockets)+""),e.find(".stats-bases").html(nt.level1.upgrades.baseups[tt.level1.baseupslevel].shoptitle+"s: "+X(tt.level1.bases)+""),e.find(".stats-rigs").html(nt.level1.upgrades.rigups[tt.level1.rigupslevel].shoptitle+"s: "+X(tt.level1.rigs)+""),e.find(".stats-upgrades").html("Upgrades bought: "+(tt.level1.clickupslevel+tt.level1.shibeupslevel+tt.level1.kennelsupslevel+tt.level1.kittensupslevel+tt.level1.rocketupslevel+tt.level1.baseupslevel+tt.level1.rigupslevel+tt.level1.extraupslevel)+" / "+(nt.level1.upgrades.clickups.length+nt.level1.upgrades.shibeups.length+nt.level1.upgrades.kennelsups.length+nt.level1.upgrades.kittensups.length+nt.level1.upgrades.rocketups.length+nt.level1.upgrades.baseups.length+nt.level1.upgrades.rigups.length+nt.level1.upgrades.extraups.length-7)+""),tt.maxlevel>1&&(t.find(".stats-coins").html("Dogecoins mined: "+Z(tt.level2.alltimecoins,0)+""),t.find(".stats-shibes").html(nt.level2.upgrades.shibeups[tt.level2.shibeupslevel].shoptitle+"s: "+X(tt.level2.shibes)+""),t.find(".stats-kennels").html(nt.level2.upgrades.kennelsups[tt.level2.kennelsupslevel].shoptitle+": "+X(tt.level2.kennels)+""),t.find(".stats-kittens").html(nt.level2.upgrades.kittensups[tt.level2.kittensupslevel].shoptitle+": "+X(tt.level2.kittens)+""),t.find(".stats-rockets").html(nt.level2.upgrades.rocketups[tt.level2.rocketupslevel].shoptitle+"s: "+X(tt.level2.rockets)+""),t.find(".stats-bases").html(nt.level2.upgrades.baseups[tt.level2.baseupslevel].shoptitle+"s: "+X(tt.level2.bases)+""),t.find(".stats-rigs").html(nt.level2.upgrades.rigups[tt.level2.rigupslevel].shoptitle+"s: "+X(tt.level2.rigs)+""),t.find(".stats-upgrades").html("Upgrades bought: "+(tt.level2.clickupslevel+tt.level2.shibeupslevel+tt.level2.kennelsupslevel+tt.level2.kittensupslevel+tt.level2.rocketupslevel+tt.level2.baseupslevel+tt.level2.rigupslevel+tt.level2.extraupslevel)+" / "+(nt.level2.upgrades.clickups.length+nt.level2.upgrades.shibeups.length+nt.level2.upgrades.kennelsups.length+nt.level2.upgrades.kittensups.length+nt.level2.upgrades.rocketups.length+nt.level2.upgrades.baseups.length+nt.level2.upgrades.rigups.length+nt.level2.upgrades.extraups.length-7)+"")),tt.maxlevel>2&&(n.find(".stats-coins").html("Dogecoins mined: "+Z(tt.level3.alltimecoins,0)+""),n.find(".stats-shibes").html(nt.level3.upgrades.shibeups[tt.level3.shibeupslevel].shoptitle+"s: "+X(tt.level3.shibes)+""),n.find(".stats-kennels").html(nt.level3.upgrades.kennelsups[tt.level3.kennelsupslevel].shoptitle+": "+X(tt.level3.kennels)+""),n.find(".stats-kittens").html(nt.level3.upgrades.kittensups[tt.level3.kittensupslevel].shoptitle+": "+X(tt.level3.kittens)+""),n.find(".stats-rockets").html(nt.level3.upgrades.rocketups[tt.level3.rocketupslevel].shoptitle+"s: "+X(tt.level3.rockets)+""),n.find(".stats-bases").html(nt.level3.upgrades.baseups[tt.level3.baseupslevel].shoptitle+"s: "+X(tt.level3.bases)+""),n.find(".stats-rigs").html(nt.level3.upgrades.rigups[tt.level3.rigupslevel].shoptitle+"s: "+X(tt.level3.rigs)+""),n.find(".stats-upgrades").html("Upgrades bought: "+(tt.level3.clickupslevel+tt.level3.shibeupslevel+tt.level3.kennelsupslevel+tt.level3.kittensupslevel+tt.level3.rocketupslevel+tt.level3.baseupslevel+tt.level3.rigupslevel+tt.level3.extraupslevel)+" / "+(nt.level3.upgrades.clickups.length+nt.level3.upgrades.shibeups.length+nt.level3.upgrades.kennelsups.length+nt.level3.upgrades.kittensups.length+nt.level3.upgrades.rocketups.length+nt.level3.upgrades.baseups.length+nt.level3.upgrades.rigups.length+nt.level3.upgrades.extraups.length-7)+"")),$("#statstab").tabs({active:tt.level-1})}}function I(){mt?(nt.helperanimations.dontanimatethis="",mt=!mt):mt=!mt}function j(){nt.helperanimations.shibes&&requestAnimationFrame((function(){for(var e=0;ent.howmanyuplasttime&&$("#upgradetab").addClass(e).one(lt,(function(){$(this).removeClass(e)})),nt.howmanyshop>nt.howmanyshoplasttime&&$("#shoptab").addClass(e).one(lt,(function(){$(this).removeClass(e)})),nt.howmanyuplasttime=nt.howmanyup,nt.howmanyshoplasttime=nt.howmanyshop}))}(),nt.musicloaded&&nt.started&&!it&&De()}function U(){return(tt.currentlevel().shibes*tt.currentlevel().shibestrength+tt.currentlevel().kennels*tt.currentlevel().kennelstrength+tt.currentlevel().kittens*tt.currentlevel().kittenstrength+tt.currentlevel().rockets*tt.currentlevel().rocketstrength+tt.currentlevel().bases*tt.currentlevel().basestrength+tt.currentlevel().rigs*tt.currentlevel().rigstrength)*tt.currentlevel().extrastrength*nt.bonuspercent}function G(){nt.persec=(tt.currentlevel().shibes*tt.currentlevel().shibestrength+tt.currentlevel().kennels*tt.currentlevel().kennelstrength+tt.currentlevel().kittens*tt.currentlevel().kittenstrength+tt.currentlevel().rockets*tt.currentlevel().rocketstrength+tt.currentlevel().bases*tt.currentlevel().basestrength+tt.currentlevel().rigs*tt.currentlevel().rigstrength)*tt.currentlevel().extrastrength*nt.bonuspercent}function B(e,t){this.str=t,this.cond=e,this.shown=!1,ht.push(this)}function z(e){_t.push(e),_t.length>3&&_t.shift()}function J(){vt.hasrunfor=0,Ge.hasClass(gt)?Ge.attr("class",ft).one(lt,(function(){Ge.html(vt.currentstr),Ge.attr("class",gt)})):(Ge.html(vt.currentstr),Ge.attr("class",gt))}function K(){ht=[],_t=[],1==tt.level&&(new B((function(){return tt.currentlevel().coins>0&&!0===nt.started}),"You are a poor, but happy shibe."),new B((function(){return tt.currentlevel().coins>29&&0===tt.currentlevel().shibes&&0===tt.currentlevel().kennels}),"Consider buying shibes to help you mine ->"),new B((function(){return tt.currentlevel().coins<200&&tt.currentlevel().shibes>0}),"The shibes are eager to help!"),new B((function(){return tt.currentlevel().coins>=200}),"Your efforts are paying off."),new B((function(){return tt.currentlevel().coins>=350}),"Young shibes look up to you."),new B((function(){return tt.currentlevel().coins>=1e3}),"Your dogecoins brings all the shibes to the yard."),new B((function(){return tt.currentlevel().coins>=4e3}),"Wow, much coins!"),new B((function(){return tt.currentlevel().coins>=7300}),"Rumour about your Dogecoin Empire is spreading."),new B((function(){return tt.currentlevel().coins>=8e3}),"Vegeta, what does the shibe say about his doge level?"),new B((function(){return tt.currentlevel().coins>=9001}),"Its over 9000!!!!!!!"),new B((function(){return tt.currentlevel().coins>=14e3}),"Your mining operation has alerted several governments."),new B((function(){return tt.currentlevel().coins>=31e3}),"Shibes from all around the world marvel at your glorious dogecoins."),new B((function(){return tt.currentlevel().coins>=1e5&&0===tt.currentlevel().rockets}),"TO THE MOON!"),new B((function(){return tt.currentlevel().rockets>0&&tt.currentlevel().coins<13e4}),"TO THE MOON!"),new B((function(){return tt.currentlevel().rockets>1&&tt.currentlevel().coins<2e5}),"Most nations of Earth have adopted dogecoin as their official currency."),new B((function(){return tt.currentlevel().coins>=5e5}),"The joy of dogecoin has made politicians better people and as a result marijuana has been legalized all over the world."),new B((function(){return 0===tt.currentlevel().bases&&tt.currentlevel().rockets>2}),"Scientists believe the interior of the moon consists solely of dogecoins."),new B((function(){return tt.currentlevel().coins>=1e6}),"It ain't easy being a dogeillionaire, but you pull it off."),new B((function(){return tt.currentlevel().coins>=2e6}),"Scientists believe the interior of the moon consists solely of dogecoins."),new B((function(){return tt.currentlevel().bases>0&&tt.currentlevel().coins<1e7}),"Your moon base mining operations are ludicrously profitable."),new B((function(){return tt.currentlevel().bases>4&&tt.currentlevel().coins<15e6}),"Reports say the moon has shrunk in size. In response, dogecoin entrepreneurs start planting trees on the moon to compensate."),new B((function(){return tt.currentlevel().coins>=15e6&&0===tt.currentlevel().rigs}),"Rumour has it doge went back to the future to invent dogecoin in the past."),new B((function(){return tt.currentlevel().coins>=35e6&&0===tt.currentlevel().rigs}),"Time travel is suggested by top scientists to be a possibility."),new B((function(){return tt.currentlevel().coins>=45e6&&0===tt.currentlevel().rigs}),"Dogecoin becomes the worlds #1 currency. All nations unite in using dogecoin."),new B((function(){return tt.currentlevel().coins>=65e6&&0===tt.currentlevel().rigs}),"The invention of time travel is here. It may damage the universe as we know it. It is also quite expensive."),new B((function(){return tt.currentlevel().coins>=9e7&&0===tt.currentlevel().rigs}),"World peace is established thanks to dogecoin. The world thanks you."),new B((function(){return tt.currentlevel().coins>=999999999&&0===tt.currentlevel().rigs}),"You are now wealthy enough to afford the worlds first time machine."),new B((function(){return tt.currentlevel().rigs>0&&tt.currentlevel().coins<999999999}),"No one could predict this."),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<999999999}),"First contact with aliens from outer space. As president of the united dogecoin nations, you are the first to greet them."),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<3999999999}),"Alien worlds start adopting dogecoin as their main currency. Trading between worlds is done with dogecoins only."),new B((function(){return tt.currentlevel().coins>=4999999999}),"Wars break out in the galaxy, but because of your heavy influence, you talk them down."),new B((function(){return tt.currentlevel().coins>=9999999999}),"Because of your heavy resolve, dogecoin has united the entire known universe."),new B((function(){return tt.currentlevel().coins>=99999999999999}),"Are you still here?"),new B((function(){return tt.currentlevel().coins>=999999999999999}),"All life in the universe cease to exist. Only dogecoin remain."),new B((function(){return tt.currentlevel().coins>=0xe35fa9319ffff}),"It is time to stop playing. You won. Give up."),new B((function(){return tt.currentlevel().coins>=6999999999999999}),"Good thing you didn't give up, or you wouldn't see this. Internet high five!"),new B((function(){return tt.currentlevel().coins>=8999999999999999}),"If Snoop was here, he would be so proud."),new B((function(){return tt.currentlevel().coins>=2e16}),"Good game."),new B((function(){return tt.currentlevel().coins>=3e16}),"This is the last text."),new B((function(){return tt.currentlevel().coins>=4e16}),":P"),new B((function(){return tt.currentlevel().coins>=7e16}),"You are now wealthy enough to afford some time off."),new B((function(){return tt.currentlevel().coins>=6e17}),"You know this game doesn't end, right? Ever."),new B((function(){return tt.currentlevel().coins>=9e17}),"Because of your enormous amounts of dogecoin, the universe has imploded."),new B((function(){return tt.currentlevel().coins>=13e17}),"A new big bang-event has occured. It is being named the Doge-bang."),new B((function(){return tt.currentlevel().coins>=2e18}),"The new universe just invented dogecoin."),new B((function(){return tt.currentlevel().coins>=1e19}),"Dogecoin is now the universal currency in all universes."),new B((function(){return tt.currentlevel().coins>=2e19}),"The end. Maybe.")),2==tt.level&&(new B((function(){return tt.currentlevel().coins>=0}),"So blue, very gray. Such moon!"),new B((function(){return tt.currentlevel().coins>=200}),"Mining on the moon is quite an endeavour, thanks Obama!"),new B((function(){return tt.currentlevel().coins>=350}),"To the moon? No, ON the moon!!"),new B((function(){return tt.currentlevel().coins>=1e3}),"A new McDonalds just opened.... on the moon."),new B((function(){return tt.currentlevel().coins>=4e3}),"The japanese are spearheading their own dogecoin space program."),new B((function(){return tt.currentlevel().coins>=7300}),"Your mining operations are slowly carving out a doge-shape on the moon."),new B((function(){return tt.currentlevel().coins>=8e3}),"Chicken is an excellent source of protein."),new B((function(){return tt.currentlevel().coins>=9001}),"It's over 9000 Billion!"),new B((function(){return tt.currentlevel().coins>=14e3}),"The Shiba Inu dog breed was originally bred to flush birds and small game, and was occasionally used to hunt wild boar."),new B((function(){return tt.currentlevel().coins>=31e3}),"A tribal war faction of the Space-Pirateers is causing trouble in the northern dogecoin sector."),new B((function(){return tt.currentlevel().coins>=1e5&&0===tt.currentlevel().rockets}),"Get a Lander Shibe to explore the rest of the solar system ->"),new B((function(){return tt.currentlevel().rockets>0&&tt.currentlevel().coins<13e4}),"Yay such explorer! Your Lander Shibe is slowly exploring all celestial bodies in the solar system."),new B((function(){return tt.currentlevel().rockets>1&&tt.currentlevel().coins<2e5}),"The Lander Shibe tried landing on one of Venus' moons, but Venus doesn't have any moons!"),new B((function(){return tt.currentlevel().coins>=5e5}),"Did you know that Jupiter is the largest planet in the solar system? Lander Shibe knows. He was there."),new B((function(){return 0===tt.currentlevel().bases&&tt.currentlevel().rockets>2}),"After exploring the solar system, Lander Shibe believes that Mars has the highest amount of dogecoin hidden below it's crust."),new B((function(){return tt.currentlevel().coins>=1e6}),"Before horses, the Dothraki used to ride dogs into battle. They were called the Dogeraki."),new B((function(){return tt.currentlevel().coins>=2e6}),"Every charity in the solar system is now using dogecoin to give to those in need."),new B((function(){return tt.currentlevel().bases>0&&tt.currentlevel().coins<1e7}),"Your Mars base mining operations are ludicrously profitable. Even more so than the old moon base mining operations."),new B((function(){return tt.currentlevel().bases>4&&tt.currentlevel().coins<15e6}),"Because of heavy mining, the atmosphere on Mars has slowly started to become breathable to humans (and doges)."),new B((function(){return tt.currentlevel().coins>=15e6&&0===tt.currentlevel().rigs}),"A dog-like intelligent alien race from the Andromeda galaxy came by to get your autograph."),new B((function(){return tt.currentlevel().coins>=35e6&&0===tt.currentlevel().rigs}),"Dogebility drives are slowly being theorized as possible by top (and bottom) scientists."),new B((function(){return tt.currentlevel().coins>=45e6&&0===tt.currentlevel().rigs}),'The invention of the Dogebility-drive is now considered a bigger event than "The Fappening".'),new B((function(){return tt.currentlevel().coins>=65e6&&0===tt.currentlevel().rigs}),"Dogebility-tests have proven to be inconclusive. The full power of such a drive could tear a hole in the space-time continuum."),new B((function(){return tt.currentlevel().coins>=9e7&&0===tt.currentlevel().rigs}),"Mars is now habitable. The world owes you and has created a statue of Doge twice the size of the statue of liberty in your honor."),new B((function(){return tt.currentlevel().coins>=999999999&&0===tt.currentlevel().rigs}),"You are now wealthy enough to afford the Infinite Dogebility Drive. Results not known."),new B((function(){return tt.currentlevel().rigs>0&&tt.currentlevel().coins<999999999}),"The Dogebility drive has proven to be man and doge's greatest accomplishment. Ever. It's better than coffee."),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<999999999}),"The Universe is ripe for the taking, thanks to multiple Dogebility drive ships. But you only want more dogecoins."),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<3999999999}),"The amount of dogecoin mined by you has made the Guinness Book of Records unreadable."),new B((function(){return tt.currentlevel().coins>=4999999999}),"You have more influence on the universe than Yoda."),new B((function(){return tt.currentlevel().coins>=9999999999}),"The future is unknown.")),3==tt.level&&(new B((function(){return tt.currentlevel().coins>=0&&!0===nt.started}),"Mars landing successful. Commencing rave party."),new B((function(){return tt.currentlevel().coins>29&&0===tt.currentlevel().shibes&&0===tt.currentlevel().kennels}),"Consider buying rave shibes to help you mine ->"),new B((function(){return tt.currentlevel().coins>=200}),"This planet is red and water is wet. These are facts."),new B((function(){return tt.currentlevel().coins>=350}),"Sifting through some mars dust, you discovered a cure for cancer. You didn't know this, and promply tossed it away."),new B((function(){return tt.currentlevel().coins>=1e3}),"Having conquered local space travel, you delve deep into other fields such as biology and eastern-european house music."),new B((function(){return tt.currentlevel().coins>=4e3}),"Mining for dogecoin on Mars isn't normal. But on meth it is."),new B((function(){return tt.currentlevel().coins>=7300}),"Russia is attempting to annex parts of the moon."),new B((function(){return tt.currentlevel().coins>=8e3}),"The 2025 alliance of the US and North Korea successfully stopped Russia from annexing the moon."),new B((function(){return tt.currentlevel().coins>=9001}),"It's over 9000 ... TRILLION! Holy batman!"),new B((function(){return tt.currentlevel().coins>=14e3}),"You know nothing, Doge Snow. Get well soon."),new B((function(){return tt.currentlevel().coins>=31e3}),"Shibes from all around the galaxy marvel at your glorious, glorious dogecoins."),new B((function(){return tt.currentlevel().coins>=1e5&&0===tt.currentlevel().rockets}),"TO THE ????"),new B((function(){return tt.currentlevel().rockets>0&&tt.currentlevel().coins<13e4}),"TO THE ????"),new B((function(){return tt.currentlevel().rockets>1&&tt.currentlevel().coins<2e5}),"Most nations of Earth have adopted dogecoin as their official currency of wow."),new B((function(){return tt.currentlevel().coins>=5e5}),"What's up? Well, it's a direction away from the center of gravity of a celestial object. That's up."),new B((function(){return 0===tt.currentlevel().bases&&tt.currentlevel().rockets>2}),"To believe the interior of Mars consists MOSTLY of dogecoins would be silly. It consists ONLY of dogecoin."),new B((function(){return tt.currentlevel().coins>=1e6}),"You used to be a poor and happy shibe, now look at you. You're rich and happy! Yay!"),new B((function(){return tt.currentlevel().bases>0&&tt.currentlevel().coins<1e7}),"Your space bass rave operations are ludicrously profitable. Like, really profitable."),new B((function(){return tt.currentlevel().bases>4&&tt.currentlevel().coins<15e6}),"Neighbouring planets are complaining about the loud music. You wonder how they can hear it. Space."),new B((function(){return tt.currentlevel().coins>=15e6&&0===tt.currentlevel().rigs}),"Hint: If you are cold and don't have warm clothes, go stand in a corner. They are usually 90 degrees."),new B((function(){return tt.currentlevel().coins>=35e6&&0===tt.currentlevel().rigs}),"Life Pro Tip: While driving, you can open beer bottles with your seat belt."),new B((function(){return tt.currentlevel().coins>=45e6&&0===tt.currentlevel().rigs}),"To mine dogecoin, or not to mine dogecoin. That is... not even a question lol! :)"),new B((function(){return tt.currentlevel().coins>=65e6&&0===tt.currentlevel().rigs}),"The first scientifically created galaxy exploring creatures are being researched."),new B((function(){return tt.currentlevel().coins>=9e7&&0===tt.currentlevel().rigs}),"What if it looks like a cow? Is there a cow level?"),new B((function(){return tt.currentlevel().coins>=999999999&&0===tt.currentlevel().rigs}),"The first prototypes of galaxy exploring creatures are completed. It's a time traveling T-Rex with lasers. FREAKIN SWEET!"),new B((function(){return tt.currentlevel().rigs>0&&tt.currentlevel().coins<999999999}),"Has science gone too far?!"),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<999999999}),"Turns out other galaxies are also made up out of dogecoin. Surprise!"),new B((function(){return tt.currentlevel().rigs>1&&tt.currentlevel().coins<3999999999}),"Indexing galaxies: 6 indexed out of a total of 691,481,631,239,020,420,010,240,571,111,866."),new B((function(){return tt.currentlevel().coins>=4999999999}),"We require additional galaxy exploring time travel t-rexes."),new B((function(){return tt.currentlevel().coins>=9999999999}),"It seems you have been living two lives, Mr Doge. In one, you are wow. In the other... such wow."),new B((function(){return tt.currentlevel().coins>=99999999999999}),"Are you STILL here? Okay. Please like and share. For science."),new B((function(){return tt.currentlevel().coins>=999999999999999}),"Mmph mmhh mpph. -The sound of your enemies."),new B((function(){return tt.currentlevel().coins>=0xe35fa9319ffff}),"You just lost the game. ... Just kidding."),new B((function(){return tt.currentlevel().coins>=6999999999999999}),"You just won the game. ... Just kidding."),new B((function(){return tt.currentlevel().coins>=8999999999999999}),"If Snoop was here, he would be even prouder than the proudest snoopelisnoop."),new B((function(){return tt.currentlevel().coins>=2e16}),"Thank you for playing."),new B((function(){return tt.currentlevel().coins>=3e16}),"This is the last text."),new B((function(){return tt.currentlevel().coins>=4e16}),"xD"),new B((function(){return tt.currentlevel().coins>=6e17}),"You know this game doesn't end, right? Ever. Ever ever. Maybe. No. Ever.")),new B((function(){return tt.bonuscoins>9||tt.bonuscoins>49||tt.bonuscoins>99||tt.bonuscoins>999}),"Wow, you have collected "+X(tt.bonuscoins)+" Bonus Coins! Such hero!")}function q(){kt=!1,requestAnimationFrame((function(){Mt.attr("class",""),nt.animatecoins=!1}))}function Q(){requestAnimationFrame((function(){$("#miner").attr("class","level"+tt.level+" level"+tt.level+"-doge_mine1u"+tt.currentlevel().clickupslevel),$e.removeClass("noselect")}))}function X(e){var t="";for(var n in e=((e=ee(e=Math.floor(e)))+"").split("").reverse())n%3==0&&n>0&&(t=","+t),t=e[n]+t;return t}function Z(e,t){var n="";if(!isFinite(e))return"Infinity";if(e=Math.round(1e7*e)/1e7,t>0){var r=e-Math.floor(e),o=(r=Math.round(1e7*r)/1e7)?1:0;r=(r.toString()+"0000000").slice(2,2+t),0===parseInt(r)&&(o=0),n=Z(Math.floor(e))+(o?"."+r:"")}else for(var a in e=((e=ee(e=Math.floor(e)))+"").split("").reverse())a%3==0&&a>0&&(n=","+n),n=e[a]+n;return n}function ee(e){var t;return Math.abs(e)<1?(t=parseInt(e.toString().split("e-")[1]))&&(e*=Math.pow(10,t-1),e="0."+new Array(t).join("0")+e.toString().substring(2)):(t=parseInt(e.toString().split("+")[1]))>20&&(t-=20,e/=Math.pow(10,t),e+=new Array(t+1).join("0")),e}function te(e,n,r,o,a){var i,s;i=void 0!==o?o:100*t()+"%",s=void 0!==a?a:100*t()+"%",$(''+e+"").appendTo(n).one(lt,(function(){$(this).attr("class","noselect animated fadeOut duration-6 random-text delay-10").one(lt,(function(){$(this).remove()}))}))}function ne(e){if(!nt.dontsave)if(!0===e)tt.maxlevel=tt.maxlevel+1,tt.maxlevel>3&&(tt.maxlevel=3),ne();else{var t=re();localStorage.setItem("dogeminer2015",t),function(){for(var e=[],t=0;t'+nt.currentlevel().currlocation+""),$("#nextlocation").html(''+nt.currentlevel().nextlocation+""),G(),W(),C(),$("#shibesdiv").html(""),$("#kennelsdiv").html(""),$("#kittensdiv").html(""),$("#rocketsdiv").html(""),$("#basesdiv").html(""),$("#rigsdiv").html(""),function(){var e=$("#shibesdiv");D(e);for(var t=0;t0?$("#shibes").html(" - "+tt.currentlevel().shibes):$("#shibes").html(""),tt.currentlevel().kennels>0?$("#kennels").html(" - "+tt.currentlevel().kennels):$("#kennels").html(""),tt.currentlevel().kittens>0?$("#kittens").html(" - "+tt.currentlevel().kittens):$("#kittens").html(""),tt.currentlevel().rockets>0?$("#rockets").html(" - "+tt.currentlevel().rockets):$("#rockets").html(""),tt.currentlevel().bases>0?$("#bases").html(" - "+tt.currentlevel().bases):$("#bases").html(""),tt.currentlevel().rigs>0?$("#rigs").html(" - "+tt.currentlevel().rigs):$("#rigs").html(""),v(),K(),Q(),tt.sounds?soundManager.unmute():soundManager.mute(),tt.sounds?($("#muteicon").removeClass("ui-icon-volume-off"),$("#muteicon").addClass("ui-icon-volume-on")):($("#muteicon").removeClass("ui-icon-volume-on"),$("#muteicon").addClass("ui-icon-volume-off")),$("#sounds").prop("checked",tt.sounds),$("#sounds2").prop("checked",tt.sounds2),$("#music").prop("checked",tt.music),$("#clickeffects").prop("checked",tt.ceffects),$("#backgroundanims").prop("checked",tt.bganim),$("#animations").prop("checked",tt.animate),$("#timeplayed").html("00:00:00"),Lt=1,Tt=nt.currentlevel().imgArr[0],tt.maxlevel=Dt.length-1?Lt=0:Lt++,Tt=Dt[Lt],$("#BG2").css("background",'transparent url("'+Tt+'") no-repeat'),$("#BG").attr("class","gpurender animated fadeOut duration-40")):(St=1,Lt>=Dt.length-1?Lt=0:Lt++,Tt=Dt[Lt],$("#BG").css("background",'transparent url("'+Tt+'") no-repeat'),$("#BG").attr("class","gpurender animated fadeIn duration-40")))}function _e(){if(nt.started&&!it){var e=$("
      ").css({width:"200px",height:"210px",id:"bonuscoin",cursor:"pointer"});e.addClass("noselect level1 level1-bonuscoin");var n=(t()*($("#wrapper").width()-400)).toFixed(),r=(t()*($("#wrapper").height()-400)).toFixed();e.attr("id","bonuscoin"),e.css({position:"absolute",left:n+"px",top:r+"px","z-index":"5",display:"none"}).appendTo($e).fadeIn(400).effect("bounce",null,3e3,null).delay(1).fadeOut(300,(function(){$(this).remove(),ye()})),Rt=!0,soundManager.getSoundById("coinappear").play({volume:33,onfinish:function(){!function(){function e(t){soundManager.getSoundById(t).play({volume:33,onfinish:function(){Rt&&e(t)}})}Rt&&e("coinloop")}()}})}}function ge(){nt.bonusactive=!0,nt.bonuspercent=1.5,nt.bonuspercentnice=50,nt.speedvar=.5;f(),G(),O(),clearTimeout(Et),Et=setTimeout((function(){nt.bonusactive=!1,nt.bonuspercent=1,nt.bonuspercentnice=0,nt.speedvar=1,G(),f(),O()}),6e4)}function fe(){if(nt.started&&!it){var e=$("
      ").css({width:"175px",height:"169px",id:"flyingdoge",cursor:"pointer"});e.addClass("noselect flyingdoge");var n=$(document).width()+200;e.attr("id","flyingdoge"),e.css({position:"absolute",left:"-400px",top:"5px","z-index":"5",display:"none"}).appendTo("#superwrapper").fadeIn(100,function e(n){0!==$("#flyingdoge").length&&(n?function(){var e=$("#flyingdoge").offset();if(e.left<$(document).width()-200){var t=$("
      ").css({width:"100px",height:"100px",id:"flyingcoin",cursor:"pointer"});t.addClass("noselect bonuscoinsmall");var n=e.left+50,r=e.top+90,o=$("#superwrapper").height()+100;t.attr("id","flyingcoin"),t.css({position:"absolute",left:n+"px",top:r+"px","z-index":"4",display:"none"}).appendTo("body").fadeIn(10).animate({top:"+="+o},3e3,(function(){})).delay(1).fadeOut(50,(function(){$(this).remove()}))}}():soundManager.play("flyingdoge"),setTimeout((function(){e(!0)}),500+800*t()))}(!1)).animate({left:"+="+n},6e3,(function(){})).delay(1).fadeOut(300,(function(){soundManager.stop("flyingdoge"),$(this).remove()}))}}function ve(){nt.bonusactive=!0,nt.bonuspercent=nt.bonuspercent+.2,nt.bonuspercentnice=nt.bonuspercentnice+20,nt.speedvar=nt.speedvar-.15,nt.speedvar<.2&&(nt.speedvar=.2);f(),G(),O(),clearTimeout(Et),Et=setTimeout((function(){nt.bonusactive=!1,nt.bonuspercent=1,nt.bonuspercentnice=0,nt.speedvar=1,G(),f(),O()}),12e4)}function ye(){Rt=!1,soundManager.stop("coinloop")}function be(){Rt=!1,soundManager.play("cointaken")}function Me(){soundManager.stop("chaching"),soundManager.play("chaching")}function ke(){soundManager.stop("chaching"),soundManager.play("chaching")}function we(){Vt=!1}function De(){1==tt.level&&tt.sounds&&tt.music&&!nt.musicactive&&!nt.loading_new_level&&(soundManager.getSoundById("musicintro").play({volume:33,onfinish:function(){Le()}}),nt.musicactive=!0);2!=tt.level&&3!=tt.level||tt.sounds&&tt.music&&!nt.musicactive&&Ye()}function Le(){soundManager.stop("musicintro"),soundManager.stop("earthmusic"),soundManager.stop("moonmusic"),soundManager.stop("marsmusic"),function e(t){tt.sounds&&tt.music&&soundManager.getSoundById(t).play({volume:33,onfinish:function(){tt.sounds&&tt.music&&e(t)}})}(nt.currentlevel().currentmusic)}function Te(){soundManager.stop("musicintro"),soundManager.stop("earthmusic"),soundManager.stop("moonmusic"),soundManager.stop("marsmusic"),nt.playingmusic=!1,nt.musicactive=!1}function Ye(){nt.loading_new_level||(nt.musicactive=!0,Le())}function Ee(e,t,n,r,o,a){this.id=e,this.name=t,this.desc=n,this.img=r,this.cond=o,this.date=a,Wt.push(this)}function Se(e,t,n,r,o){this.level=e,this.type=t,this.amount=n,this.type2=r,this.amount2=o}function xe(e){wt&&!function(e){for(var t=!1,n=0;n

      Achievement earned

      '+e.name+"

      "}),e.date=Re().format("YYYY-MM-DD, HH:mm:ss"),Ut.push(e),Ne())}function Ne(){for(var e="",t=Ut.length-1;t>=0;t--)e+='
      ',e+='',e+='
      '+Ut[t].name+'
      '+Ut[t].desc+"
      Unlocked on: "+Ut[t].date+"
      ",e+="
      ";$("#achiwrapper").html(e)}function Ce(){soundManager.createSound({id:"coinappear",url:"snd/general/Goldencoin_appear.mp3",autoLoad:!0,autoPlay:!1,onload:function(){}}),soundManager.createSound({id:"coinloop",url:"snd/general/Goldencoin_loop_optimized.mp3",autoLoad:!0,autoPlay:!1,onload:function(){}}),soundManager.createSound({id:"cointaken",url:"snd/general/Goldencoin_taken.mp3",autoLoad:!0,autoPlay:!1}),soundManager.createSound({id:"achievementunlocked",url:"snd/general/Achievement_unlocked.mp3",autoLoad:!0,autoPlay:!1,onload:function(){}}),soundManager.createSound({id:"chaching",url:"snd/general/chaching.mp3",autoLoad:!0,autoPlay:!1,onload:function(){}}),soundManager.createSound({id:"alert",url:"snd/general/alert.mp3",autoLoad:!0,autoPlay:!1,onload:function(){$t=!0}}),soundManager.createSound({id:"flyingdoge",url:"snd/general/flyingdoge.mp3",autoLoad:!0,autoPlay:!1,onload:function(){}}),Pt=soundManager.createSound({url:"snd/general/pickaxe_1.mp3",autoLoad:!0,autoPlay:!1,volume:75}),Ht=soundManager.createSound({url:"snd/general/pickaxe_2.mp3",autoLoad:!0,autoPlay:!1,volume:75}),It=soundManager.createSound({url:"snd/general/pickaxe_3.mp3",autoLoad:!0,autoPlay:!1,volume:75}),jt=soundManager.createSound({url:"snd/general/pickaxe_4.mp3",autoLoad:!0,autoPlay:!1,volume:75}),At=soundManager.createSound({url:"snd/general/pickaxe_5.mp3",autoLoad:!0,autoPlay:!1,volume:75}),Ot=new Array(Pt,Ht,It,jt,At),new Ee(1,"The First 1K","Get 1,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e3)),new Ee(2,"It's Over Nine Thousand!","Get over 9,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",9001)),new Ee(3,"One Hundred Thousand Dogecoins","Get 100,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e5)),new Ee(293932,"Dogeillionaire","Get 1,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e6)),new Ee(4,"Money-Maker!","Get 50,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",5e6)),new Ee(5,"Cash Cow? More Like Cash Doge!","Get 100,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e8)),new Ee(6,"Slumdogeillionaire","Get 500,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",5e8)),new Ee(7,"One Billion Dogecoins","Get 1,000,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e9)),new Ee(8,"Fifty Billion Dogecoins","Get 50,000,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",5e10)),new Ee(9,"One Hundred Billion Dogecoins","Get 100,000,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e11)),new Ee(10,"One Trillion Dogecoins","Get 1,000,000,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e12)),new Ee(11,"One Quadrillion Dogecoins","Get 1,000,000,000,000,000 dogecoins.","img/achi/placeholder.png",new Se(1,"coins",1e15)),new Ee(12,"One Quintillion Dogecoins","Get 1,000,000,000,000,000,000 dogecoins. I'm not even mad, that's amazing.","img/achi/placeholder.png",new Se(1,"coins",1e18)),new Ee(13,"One Sextillion Dogecoins","Get 1,000,000,000,000,000,000,000 dogecoins. Is such a thing even possible?","img/achi/placeholder.png",new Se(1,"coins",1e21)),new Ee(14,"One Septillion Dogecoins","Get 1,000,000,000,000,000,000,000,000 dogecoins. I think someone is cheating.","img/achi/placeholder.png",new Se(1,"coins",1e24)),new Ee(100,"It's a party!","Get 10 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",10)),new Ee(101,"Fifty Mining Shibes","Get 50 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",50)),new Ee(102,"One Hundred Mining Shibes","Get 100 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",100)),new Ee(103,"Five Hundred Mining Shibes","Get 500 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",500)),new Ee(104,"One Thousand Mining Shibes","Get 1,000 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",1e3)),new Ee(105,"1337-Krew","Get 1,337 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",1337)),new Ee(106,"5,000 Mining Shibes","Get 5,000 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",5e3)),new Ee(107,"10,000 Mining Shibes","Get 10,000 Mining Shibes.","img/achi/placeholder.png",new Se(1,"shibes",1e4)),new Ee(200,"Woof Woof","Get 10 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",10)),new Ee(201,"Fifty Doge Kennels","Get 50 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",50)),new Ee(202,"One Hundred Doge Kennels","Get 100 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",100)),new Ee(203,"Five Hundred Doge Kennels","Get 500 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",500)),new Ee(204,"One Thousand Doge Kennels","Get 1000 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",1e3)),new Ee(205,"1337-Krew #2","Get 1337 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",1337)),new Ee(206,"5,000 Doge Kennels","Get 5,000 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",5e3)),new Ee(207,"10,000 Doge Kennels","Get 10,000 Doge Kennels.","img/achi/placeholder.png",new Se(1,"kennels",1e4)),new Ee(300,"Mjau","Get 10 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",10)),new Ee(301,"Fifty Slave Kittens","Get 50 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",50)),new Ee(302,"One Hundred Slave Kittens","Get 100 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",100)),new Ee(303,"Five Hundred Slave Kittens","Get 500 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",500)),new Ee(304,"One Thousand Slave Kittens","Get 1000 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",1e3)),new Ee(305,"1337-Krew #3","Get 1337 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",1337)),new Ee(306,"5,000 Slave Kittens","Get 5,000 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",5e3)),new Ee(307,"10,000 Slave Kittens","Get 10,000 Slave Kittens.","img/achi/placeholder.png",new Se(1,"kittens",1e4)),new Ee(399,"First Doge In Space","Get a Space Rocket.","img/achi/placeholder.png",new Se(1,"rockets",1)),new Ee(400,"Space, The Final Frontier","Get 10 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",10)),new Ee(401,"Fifty Space Rockets","Get 50 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",50)),new Ee(402,"One Hundred Space Rockets","Get 100 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",100)),new Ee(403,"Five Hundred Space Rockets","Get 500 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",500)),new Ee(404,"One Thousand Space Rockets","Get 1000 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",1e3)),new Ee(405,"1337-Krew #4","Get 1337 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",1337)),new Ee(406,"5,000 Space Rockets","Get 5,000 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",5e3)),new Ee(407,"10,000 Space Rockets","Get 10,000 Space Rockets.","img/achi/placeholder.png",new Se(1,"rockets",1e4)),new Ee(500,"Moon Miner","Get 10 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",10)),new Ee(501,"Fifty Moon Bases","Get 50 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",50)),new Ee(502,"One Hundred Moon Bases","Get 100 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",100)),new Ee(503,"Five Hundred Moon Bases","Get 500 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",500)),new Ee(504,"One Thousand Moon Bases","Get 1000 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",1e3)),new Ee(505,"1337-Krew #5","Get 1337 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",1337)),new Ee(506,"5,000 Moon Bases","Get 5,000 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",5e3)),new Ee(507,"10,000 Moon Bases","Get 10,000 Moon Bases.","img/achi/placeholder.png",new Se(1,"bases",1e4)),new Ee(600,"Time Traveller","Get 10 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",10)),new Ee(601,"Fifty Time Machines","Get 50 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",50)),new Ee(602,"One Hundred Time Machines","Get 100 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",100)),new Ee(603,"Five Hundred Time Machines","Get 500 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",500)),new Ee(604,"One Thousand Time Machines","Get 1000 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",1e3)),new Ee(605,"1337-Krew #6","Get 1337 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",1337)),new Ee(606,"5,000 Time Machines","Get 5,000 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",5e3)),new Ee(607,"10,000 Time Machines","Get 10,000 Time Machines.","img/achi/placeholder.png",new Se(1,"rigs",1e4)),new Ee(700,"My First Upgrade","Purchase an upgrade.","img/achi/placeholder.png",new Se(1,"anyups",0)),new Ee(701,"Mining Enthusiast","Get all pickaxe upgrades.","img/achi/placeholder.png",new Se(1,"clickups",nt.currentlevel().upgrades.clickups.length)),new Ee(702,"Gotta Upgrade 'Em All","Get every upgrade.","img/achi/placeholder.png",new Se(1,"allups",0)),new Ee(703,"My Dogecoins Brings All The Shibes To The Yard","Get all Mining Shibe upgrades.","img/achi/placeholder.png",new Se(1,"shibeups",nt.currentlevel().upgrades.shibeups.length)),new Ee(704,"Maximum Efficiency Kennels","Get all Doge Kennels upgrades.","img/achi/placeholder.png",new Se(1,"kennelsups",nt.currentlevel().upgrades.kennelsups.length)),new Ee(705,"Kittens Are Also Good At Something","Get all Slave Kittens upgrades.","img/achi/placeholder.png",new Se(1,"kittensups",nt.currentlevel().upgrades.kittensups.length)),new Ee(706,"Maximum Warp","Get all Space Rocket upgrades.","img/achi/placeholder.png",new Se(1,"rocketups",nt.currentlevel().upgrades.rocketups.length)),new Ee(707,"Space Man","Get all Moon Base upgrades.","img/achi/placeholder.png",new Se(1,"baseups",nt.currentlevel().upgrades.baseups.length)),new Ee(708,"What Year Is It?","Get all Time Machine Mining Rig upgrades.","img/achi/placeholder.png",new Se(1,"rigups",nt.currentlevel().upgrades.rigups.length)),new Ee(709,"Well That Was Expensive","Get all % increase upgrades.","img/achi/placeholder.png",new Se(1,"extraups",nt.currentlevel().upgrades.extraups.length)),new Ee(800,"Bonus Time","Grabbed a golden dogecoin for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",1)),new Ee(801,"Much Bonus","Grab 5 golden dogecoins for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",5)),new Ee(802,"Bonustravaganza","Grab 10 golden dogecoins for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",10)),new Ee(803,"I Got Luck, Persistence Or Both","Grab 25 golden dogecoins for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",25)),new Ee(804,"I Love You","Grab 50 golden dogecoins for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",50)),new Ee(805,"My Time Played Must Be Really High","Grab 100 golden dogecoins for bonus income.","img/achi/placeholder.png",new Se(0,"bonuscoins",100)),new Ee(900,"Time Flies By","Play for an hour.","img/achi/placeholder.png",new Se(0,"time",3600)),new Ee(901,"I Hope You Took Breaks","Play for five hours.","img/achi/placeholder.png",new Se(0,"time",18e3)),new Ee(902,"Why Am I Still Playing","Play for 24 hours.","img/achi/placeholder.png",new Se(0,"time",86400)),new Ee(903,"24/7","Play for 7 days.","img/achi/placeholder.png",new Se(0,"time",604800)),new Ee(904,"I'm Awesome","Play for two weeks.","img/achi/placeholder.png",new Se(0,"time",1209600)),new Ee(905,"I'm Crazy","Play for a month.","img/achi/placeholder.png",new Se(0,"time",2592e3)),new Ee(906,"I Don't Have A Life","Play for six months.","img/achi/placeholder.png",new Se(0,"time",15552e3)),new Ee(907,"The Insane","Play for a year. You are special.","img/achi/placeholder.png",new Se(0,"time",31104e3)),new Ee(1e3,"Click Click Boom","Click a thousand times.","img/achi/placeholder.png",new Se(0,"clicks",1e3)),new Ee(1001,"Really Good At Clicking","Click 10,000 times.","img/achi/placeholder.png",new Se(0,"clicks",1e4)),new Ee(1002,"I've Seen Things You People Wouldn't Believe","Click 100,000 times.","img/achi/placeholder.png",new Se(0,"clicks",1e5)),new Ee(1003,"A Million Clicks Baby","Click 1,000,000 times.","img/achi/placeholder.png",new Se(0,"clicks",1e6)),new Ee(1004,"Ten Million Clicks","Click 10,000,000 times.","img/achi/placeholder.png",new Se(0,"clicks",1e7)),new Ee(1005,"One Hundred Million Clicks","Click 100,000,000 times.","img/achi/placeholder.png",new Se(0,"clicks",1e8)),new Ee(2001,"Next Level Gaming","Gone to the moon.","img/achi/placeholder.png",new Se(2,"level",0)),new Ee(2100,"Lets Get It Started","Get 10 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",10)),new Ee(2101,"Fifty Moon Shibes","Get 50 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",50)),new Ee(2102,"One Hundred Moon Shibes","Get 100 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",100)),new Ee(2103,"Five Hundred Moon Shibes","Get 500 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",500)),new Ee(2104,"One Thousand Moon Shibes","Get 1,000 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",1e3)),new Ee(2105,"1337-MoonKrew","Get 1,337 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",1337)),new Ee(2106,"5,000 Moon Shibes","Get 5,000 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",5e3)),new Ee(2107,"10,000 Moon Shibes","Get 10,000 Moon Shibes.","img/achi/placeholder.png",new Se(2,"shibes",1e4)),new Ee(2200,"Vroom Vroom","Get 10 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",10)),new Ee(2201,"Fifty Doge Cars","Get 50 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",50)),new Ee(2202,"One Hundred Doge Cars","Get 100 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",100)),new Ee(2203,"Five Hundred Doge Cars","Get 500 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",500)),new Ee(2204,"One Thousand Doge Cars","Get 1000 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",1e3)),new Ee(2205,"1337-MoonKrew #2","Get 1337 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",1337)),new Ee(2206,"5,000 Doge Cars","Get 5,000 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",5e3)),new Ee(2207,"10,000 Doge Cars","Get 10,000 Doge Cars.","img/achi/placeholder.png",new Se(2,"kennels",1e4)),new Ee(2300,"Mjau","Get 10 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",10)),new Ee(2301,"Fifty Suit Shibes","Get 50 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",50)),new Ee(2302,"One Hundred Suit Shibes","Get 100 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",100)),new Ee(2303,"Five Hundred Suit Shibes","Get 500 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",500)),new Ee(2304,"One Thousand Suit Shibes","Get 1000 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",1e3)),new Ee(2305,"1337-MoonKrew #3","Get 1337 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",1337)),new Ee(2306,"5,000 Suit Shibes","Get 5,000 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",5e3)),new Ee(2307,"10,000 Suit Shibes","Get 10,000 Suit Shibes.","img/achi/placeholder.png",new Se(2,"kittens",1e4)),new Ee(2399,"Exploratory Doge","Get a Lander Shibe.","img/achi/placeholder.png",new Se(2,"rockets",1)),new Ee(2400,"Landing To Victory","Get 10 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",10)),new Ee(2401,"Fifty Lander Shibes","Get 50 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",50)),new Ee(2402,"One Hundred Lander Shibes","Get 100 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",100)),new Ee(2403,"Five Hundred Lander Shibes","Get 500 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",500)),new Ee(2404,"One Thousand Lander Shibes","Get 1000 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",1e3)),new Ee(2405,"1337-MoonKrew #4","Get 1337 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",1337)),new Ee(2406,"5,000 Lander Shibes","Get 5,000 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",5e3)),new Ee(2407,"10,000 Lander Shibes","Get 10,000 Lander Shibes.","img/achi/placeholder.png",new Se(2,"rockets",1e4)),new Ee(2500,"Mars Miner","Get 10 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",10)),new Ee(2501,"Fifty Mars Bases","Get 50 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",50)),new Ee(2502,"One Hundred Mars Bases","Get 100 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",100)),new Ee(2503,"Five Hundred Mars Bases","Get 500 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",500)),new Ee(2504,"One Thousand Mars Bases","Get 1000 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",1e3)),new Ee(2505,"1337-MoonKrew #5","Get 1337 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",1337)),new Ee(2506,"5,000 Mars Bases","Get 5,000 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",5e3)),new Ee(2507,"10,000 Mars Bases","Get 10,000 Mars Bases.","img/achi/placeholder.png",new Se(2,"bases",1e4)),new Ee(2600,"Universe Traveller","Get 10 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",10)),new Ee(2601,"Fifty Infinite Dogebility Drives","Get 50 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",50)),new Ee(2602,"One Hundred Infinite Dogebility Drives","Get 100 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",100)),new Ee(2603,"Five Hundred Infinite Dogebility Drives","Get 500 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",500)),new Ee(2604,"One Thousand Infinite Dogebility Drives","Get 1000 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",1e3)),new Ee(2605,"1337-MoonKrew #6","Get 1337 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",1337)),new Ee(2606,"5,000 Infinite Dogebility Drives","Get 5,000 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",5e3)),new Ee(2607,"10,000 Infinite Dogebility Drives","Get 10,000 Infinite Dogebility Drives.","img/achi/placeholder.png",new Se(2,"rigs",1e4)),new Ee(2700,"My First Upgrade On The Moon","Purchase an upgrade on the Moon.","img/achi/placeholder.png",new Se(2,"anyups",0)),new Ee(2701,"Mining Extraordinaire","Get all pickaxe upgrades on the Moon.","img/achi/placeholder.png",new Se(2,"clickups",nt.currentlevel().upgrades.clickups.length)),new Ee(2702,"I Think We're Done Here","Get every upgrade on the Moon.","img/achi/placeholder.png",new Se(2,"allups",0)),new Ee(2703,"Moon Shibes... ASSEMBLE!","Get all Moon Shibe upgrades.","img/achi/placeholder.png",new Se(2,"shibeups",nt.currentlevel().upgrades.shibeups.length)),new Ee(2704,"Vroom Vroom Mtrfkr","Get all Doge Car upgrades.","img/achi/placeholder.png",new Se(2,"kennelsups",nt.currentlevel().upgrades.kennelsups.length)),new Ee(2705,"A suite, a shower, a shave... and the feel of a suit","Get all Suit Shibes upgrades.","img/achi/placeholder.png",new Se(2,"kittensups",nt.currentlevel().upgrades.kittensups.length)),new Ee(2706,"Lander Flander","Get all Lander Shibe upgrades.","img/achi/placeholder.png",new Se(2,"rocketups",nt.currentlevel().upgrades.rocketups.length)),new Ee(2707,"Mars Man","Get all Mars Base upgrades.","img/achi/placeholder.png",new Se(2,"baseups",nt.currentlevel().upgrades.baseups.length)),new Ee(2708,"What Universe Is It?","Get all Infinite Dogebility Drive upgrades.","img/achi/placeholder.png",new Se(2,"rigups",nt.currentlevel().upgrades.rigups.length)),new Ee(2709,"Max Percent","Get all % increase upgrades.","img/achi/placeholder.png",new Se(2,"extraups",nt.currentlevel().upgrades.extraups.length)),new Ee(3001,"What Took Me So Long","Gone to Mars.","img/achi/placeholder.png",new Se(3,"level",0)),new Ee(3100,"It's a rave!","Get 10 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",10)),new Ee(3101,"Fifty Party Shibes","Get 50 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",50)),new Ee(3102,"One Hundred Party Shibes","Get 100 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",100)),new Ee(3103,"Five Hundred Party Shibes","Get 500 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",500)),new Ee(3104,"One Thousand Party Shibes","Get 1,000 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",1e3)),new Ee(3105,"1337-MarsKrew","Get 1,337 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",1337)),new Ee(3106,"5,000 Party Shibes","Get 5,000 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",5e3)),new Ee(3107,"10,000 Party Shibes","Get 10,000 Party Shibes.","img/achi/placeholder.png",new Se(3,"shibes",1e4)),new Ee(3200,"Such Curious","Get 10 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",10)),new Ee(3201,"Fifty CuriosiDoges","Get 50 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",50)),new Ee(3202,"One Hundred CuriosiDoges","Get 100 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",100)),new Ee(3203,"Five Hundred CuriosiDoges","Get 500 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",500)),new Ee(3204,"One Thousand CuriosiDoges","Get 1000 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",1e3)),new Ee(3205,"1337-MarsKrew #2","Get 1337 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",1337)),new Ee(3206,"5,000 CuriosiDoges","Get 5,000 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",5e3)),new Ee(3207,"10,000 CuriosiDoges","Get 10,000 CuriosiDoges.","img/achi/placeholder.png",new Se(3,"kennels",1e4)),new Ee(3300,"Mjau","Get 10 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",10)),new Ee(3301,"Fifty DJ Kittenz","Get 50 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",50)),new Ee(3302,"One Hundred DJ Kittenz","Get 100 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",100)),new Ee(3303,"Five Hundred DJ Kittenz","Get 500 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",500)),new Ee(3304,"One Thousand DJ Kittenz","Get 1000 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",1e3)),new Ee(3305,"1337-MarsKrew #3","Get 1337 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",1337)),new Ee(3306,"5,000 DJ Kittenz","Get 5,000 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",5e3)),new Ee(3307,"10,000 DJ Kittenz","Get 10,000 DJ Kittenz.","img/achi/placeholder.png",new Se(3,"kittens",1e4)),new Ee(3399,"Space Funk Activated","Get a Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",1)),new Ee(3400,"Music Will Save Us","Get 10 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",10)),new Ee(3401,"Fifty Space Bass","Get 50 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",50)),new Ee(3402,"One Hundred Space Bass","Get 100 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",100)),new Ee(3403,"Five Hundred Space Bass","Get 500 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",500)),new Ee(3404,"One Thousand Space Bass","Get 1000 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",1e3)),new Ee(3405,"1337-MarsKrew #4","Get 1337 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",1337)),new Ee(3406,"5,000 Space Bass","Get 5,000 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",5e3)),new Ee(3407,"10,000 Space Bass","Get 10,000 Space Bass.","img/achi/placeholder.png",new Se(3,"rockets",1e4)),new Ee(3500,"Meta Miner","Get 10 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",10)),new Ee(3501,"Fifty Meta Shibes","Get 50 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",50)),new Ee(3502,"One Hundred Meta Shibes","Get 100 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",100)),new Ee(3503,"Five Hundred Meta Shibes","Get 500 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",500)),new Ee(3504,"One Thousand Meta Shibes","Get 1000 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",1e3)),new Ee(3505,"1337-MarsKrew #5","Get 1337 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",1337)),new Ee(3506,"5,000 Meta Shibes","Get 5,000 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",5e3)),new Ee(3507,"10,000 Meta Shibes","Get 10,000 Meta Shibes.","img/achi/placeholder.png",new Se(3,"bases",1e4)),new Ee(3600,"Life Found A Way","Get 10 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",10)),new Ee(3601,"Fifty Time Travel T-Rexes","Get 50 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",50)),new Ee(3602,"One Hundred Time Travel T-Rexes","Get 100 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",100)),new Ee(3603,"Five Hundred Time Travel T-Rexes","Get 500 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",500)),new Ee(3604,"One Thousand Time Travel T-Rexes","Get 1000 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",1e3)),new Ee(3605,"1337-MarsKrew #6","Get 1337 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",1337)),new Ee(3606,"5,000 Time Travel T-Rexes","Get 5,000 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",5e3)),new Ee(3607,"10,000 Time Travel T-Rexes","Get 10,000 Time Travel T-Rexes.","img/achi/placeholder.png",new Se(3,"rigs",1e4)),new Ee(3700,"Mars Has Upgrades For Me","Purchase an upgrade on Mars.","img/achi/placeholder.png",new Se(3,"anyups",0)),new Ee(3701,"Phenomenal Mining","Get all pickaxe upgrades on Mars.","img/achi/placeholder.png",new Se(3,"clickups",nt.currentlevel().upgrades.clickups.length)),new Ee(3702,"Rare Feat","Get every upgrade on Mars.","img/achi/placeholder.png",new Se(3,"allups",0)),new Ee(3703,"Party On Dude","Get all Party Shibe upgrades.","img/achi/placeholder.png",new Se(3,"shibeups",nt.currentlevel().upgrades.shibeups.length)),new Ee(3704,"Curiosity","Get all CuriosiDoges upgrades.","img/achi/placeholder.png",new Se(3,"kennelsups",nt.currentlevel().upgrades.kennelsups.length)),new Ee(3705,"Chika Chika Wa Wa","Get all DJ Kittenz upgrades.","img/achi/placeholder.png",new Se(3,"kittensups",nt.currentlevel().upgrades.kittensups.length)),new Ee(3706,"The Bass Is Strong With This One","Get all Space Bass upgrades.","img/achi/placeholder.png",new Se(3,"rocketups",nt.currentlevel().upgrades.rocketups.length)),new Ee(3707,"Meta Man","Get all Meta Shibe upgrades.","img/achi/placeholder.png",new Se(3,"baseups",nt.currentlevel().upgrades.baseups.length)),new Ee(3708,"Welcome... to Jurassic Bark.","Get all Time Travel T-Rex upgrades.","img/achi/placeholder.png",new Se(3,"rigups",nt.currentlevel().upgrades.rigups.length)),new Ee(3709,"I'm Giving Her All She's Got Captain","Get all % increase upgrades.","img/achi/placeholder.png",new Se(3,"extraups",nt.currentlevel().upgrades.extraups.length)),function(){var e=localStorage.getItem("achis");if(null!==e){e=JSON.parse(e);for(var t=0;t0&&(e=2),tt.level3.alltimecoins>0&&(e=3),e}();t>1&&(t>tt.level?(e=!0,Pe(tt.level+1)):tt.level==t&&(e=!0,Pe(1))),e||alert("According to our records, you have not visited any other locations. The cost to launch to the moon is 50 BILLION dogecoin! It will launch YOU to the moon (not your helpers).")}function Pe(e){nt.persec=0,nt.dontsave=!0,nt.achievementsenabled=!1,tt.level=e,ie(),nt.achievementsenabled=!0,nt.dontsave=!1}function He(){function e(){switch(n){case 0:var r="";r+='
      ',r+='
      (Sound recommended)
      ',$("#extracontainer").append(r),$("#moondialog2").dialog({dialogClass:"no-close",show:{effect:"slide",duration:2e3,direction:"left"},hide:{effect:"slide",duration:2e3,direction:"right"},minHeight:500,minWidth:600,resizable:!1,draggable:!1,modal:!0,closeOnEscape:!1}),$("#quickmute2").click((function(){sounds?($("#muteicon2").removeClass("ui-icon-volume-on"),$("#muteicon2").addClass("ui-icon-volume-off"),$("#muteicon3").removeClass("ui-icon-volume-on"),$("#muteicon3").addClass("ui-icon-volume-off")):($("#muteicon2").removeClass("ui-icon-volume-off"),$("#muteicon2").addClass("ui-icon-volume-on"),$("#muteicon3").removeClass("ui-icon-volume-off"),$("#muteicon3").addClass("ui-icon-volume-on")),w()}));break;case 2:$("#moontext2").append("
      WE CHOOSE TO GO TO THE MOON");break;case 4:$("#moontext2").append("
      NOT BECAUSE IT IS EASY");break;case 6:$("#moontext2").append("
      BUT BECAUSE IT IS WOW");break;case 8:$("#moontext2").append("
      BECAUSE THAT WOW");break;case 10:$("#moontext2").append("
      WILL SERVE TO ORGANIZE");break;case 12:$("#moontext2").append("
      A NATION OF SHIBES");break;case 13:$("#moontext2").append("
      OF OUR DOGEMINING SKILLS");break;case 14:$("#moondialog2").dialog("close")}15>++n?setTimeout((function(){e()}),1e3):t()}function t(){function e(){$("#moondialog2").dialog("destroy"),$("#moondialog").dialog("destroy"),$("#extracontainer").empty()}switch(r){case 0:break;case 1:$("#moontext").append("
      Ignition sequence start.");break;case 3:$("#moontext").append("
      6...");break;case 4:$("#moontext").append("
      5...");break;case 5:$("#moontext").append("
      4...");break;case 6:$("#moontext").append("
      3...");break;case 7:$("#moontext").append("
      2...");break;case 8:$("#moontext").append("
      1...");break;case 9:(function(){function e(e,n,r,o){e.css(n),e.animate(r,o,"easeInQuad",t)}function t(){$("#flyingrocket").css({display:"none"}),$("#flyingrocket").remove()}var n=$(document).width(),r=$(document).height();$("#flyingrocket").removeClass("rightsiderocket"),e($("#flyingrocket"),{left:-600,top:r/2},{left:n-300,top:-600},3500)})(),$("#moontext").append("
      0."),$("#moondialog").trigger("startRumble"),$("#moondialog2").dialog("destroy").remove()}13>++r?setTimeout((function(){t()}),1100):setTimeout((function(){pe(),$("#moondialog").trigger("stopRumble"),$("#moondialog").dialog("close"),$("#tabs").tabs("option","active",0),$("#supermegacontainer").show("shake",null,1e3,e),tt.maxlevel<2&&(tt.maxlevel=2),Pe(2),nt.loading_new_level=!1}),3500)}console.log("Levels.js: Loading level 2!"),nt.loading_new_level=!0,$("#supermegacontainer").hide("fade",null,1e3,(function(){var t="";t+='
      ',t+='
      Preparing to launch, please wait...
      (Sound recommended)
      ',t+='
      ',$("#extracontainer").append(t),$("#moondialog").dialog({dialogClass:"no-close",show:{effect:"blind",duration:1e3},hide:{effect:"explode",duration:1e3},minHeight:400,minWidth:600,resizable:!1,draggable:!1,modal:!1,closeOnEscape:!1}),$("#moondialog").jrumble(),$("#quickmute3").click((function(){sounds?($("#muteicon2").removeClass("ui-icon-volume-on"),$("#muteicon2").addClass("ui-icon-volume-off"),$("#muteicon3").removeClass("ui-icon-volume-on"),$("#muteicon3").addClass("ui-icon-volume-off")):($("#muteicon2").removeClass("ui-icon-volume-off"),$("#muteicon2").addClass("ui-icon-volume-on"),$("#muteicon3").removeClass("ui-icon-volume-off"),$("#muteicon3").addClass("ui-icon-volume-on")),w()})),nt.canhandlesounds?soundManager.createSound({id:"moon-launch",url:"snd/general/launch.mp3",autoLoad:!0,autoPlay:!1,onload:function(){soundManager.play("moon-launch"),e()}}):e()})),me(),Te(),$("#BG").css("opacity",0),$("#BG").css("background-image",'url("./img/bg/bg001.jpg")'),$("#BG2").css("background-image",'url("./img/bg/bg001.jpg")'),Lt=1,soundManager.getSoundById("moonmusic").load();var n=0,r=0}function Ie(){function e(){switch(n){case 0:var r="";r+='
      ',r+='
      (Sound recommended)
      ',$("#extracontainer").append(r),$("#moondialog2").dialog({dialogClass:"no-close",show:{effect:"slide",duration:2e3,direction:"left"},hide:{effect:"slide",duration:2e3,direction:"right"},minHeight:500,minWidth:600,resizable:!1,draggable:!1,modal:!0,closeOnEscape:!1}),$("#quickmute2").click((function(){sounds?($("#muteicon2").removeClass("ui-icon-volume-on"),$("#muteicon2").addClass("ui-icon-volume-off"),$("#muteicon3").removeClass("ui-icon-volume-on"),$("#muteicon3").addClass("ui-icon-volume-off")):($("#muteicon2").removeClass("ui-icon-volume-off"),$("#muteicon2").addClass("ui-icon-volume-on"),$("#muteicon3").removeClass("ui-icon-volume-off"),$("#muteicon3").addClass("ui-icon-volume-on")),w()}));break;case 2:$("#moontext2").append("
      WE CHOOSE TO GO TO MARS");break;case 4:$("#moontext2").append("
      NOT BECAUSE IT IS EASY");break;case 6:$("#moontext2").append("
      BUT BECAUSE IT IS WOW");break;case 8:$("#moontext2").append("
      BECAUSE THAT WOW");break;case 10:$("#moontext2").append("
      WILL SERVE ORGANIZE");break;case 11:$("#moontext2").append("
      A SOLAR SYSTEM OF SHIBES");break;case 14:$("#moontext2").append("
      OF OUR DOGEMINING SKILLS"),$("#moondialog2").dialog("close")}15>++n?setTimeout((function(){e()}),1e3):t()}function t(){function e(){$("#moondialog2").dialog("destroy"),$("#moondialog").dialog("destroy"),$("#extracontainer").empty()}switch(r){case 0:break;case 1:$("#moontext").append("
      Ignition sequence start.");break;case 2:$("#moontext").append("
      6...");break;case 3:$("#moontext").append("
      5...");break;case 4:$("#moontext").append("
      4...");break;case 5:$("#moontext").append("
      3...");break;case 6:$("#moontext").append("
      2...");break;case 7:$("#moontext").append("
      1...");break;case 8:(function(){function e(e,n,r,o){e.css(n),e.animate(r,o,"easeInQuad",t)}function t(){$("#flyingrocket").css({display:"none"}),$("#flyingrocket").remove()}var n=$(document).width(),r=$(document).height();$("#flyingrocket").addClass("rightsiderocket"),e($("#flyingrocket"),{left:n+600,top:r/2+100},{left:100,top:-600},3500)})(),$("#moontext").append("
      0."),$("#moondialog").trigger("startRumble"),$("#moondialog2").dialog("destroy").remove()}13>++r?setTimeout((function(){t()}),1100):setTimeout((function(){pe(),$("#moondialog").trigger("stopRumble"),$("#moondialog").dialog("close"),$("#stylesheet").attr({href:"css/mars-theme/jquery-ui-1.10.4.custom.min.css"}),$("#tabs").tabs("option","active",0),$("#supermegacontainer").show("shake",null,1e3,e),tt.maxlevel<3&&(tt.maxlevel=3),Pe(3),nt.loading_new_level=!1}),3500)}console.log("Levels.js: Loading level 3!"),nt.loading_new_level=!0,$("#supermegacontainer").hide("fade",null,1e3,(function(){$("#extracontainer").empty();var t="";t+='
      ',t+='
      Preparing to launch, please wait...
      (Sound recommended)
      ',t+='
      ',$("#extracontainer").append(t),$("#moondialog").dialog({dialogClass:"no-close",show:{effect:"blind",duration:1e3},hide:{effect:"explode",duration:1e3},minHeight:400,minWidth:600,resizable:!1,draggable:!1,modal:!1,closeOnEscape:!1}),$("#moondialog").jrumble(),$("#quickmute3").click((function(){sounds?($("#muteicon2").removeClass("ui-icon-volume-on"),$("#muteicon2").addClass("ui-icon-volume-off"),$("#muteicon3").removeClass("ui-icon-volume-on"),$("#muteicon3").addClass("ui-icon-volume-off")):($("#muteicon2").removeClass("ui-icon-volume-off"),$("#muteicon2").addClass("ui-icon-volume-on"),$("#muteicon3").removeClass("ui-icon-volume-off"),$("#muteicon3").addClass("ui-icon-volume-on")),w()})),nt.canhandlesounds?soundManager.createSound({id:"mars-launch",url:"snd/general/launch_mars.mp3",autoLoad:!0,autoPlay:!1,onload:function(){soundManager.play("mars-launch"),e()}}):e()})),me(),Te(),$("#BG").css("background-image",'url("./img/bg/bg103.jpg")'),$("#BG2").css("background-image",'url("./img/bg/bg103.jpg")'),soundManager.getSoundById("marsmusic").load();var n=0,r=0}e.env.NODE_ENV="production";for(var je=n(2),Ae=n(34),Re=n(172),Ve=1e6,Fe=[];Ve--;)Fe.push(Math.random());var $e=$("body"),We=$("#mined strong"),Ue=($(".mined-modifier"),$(".mined-persec")),Ge=$("#news").find("span"),Be=$("#howmanyclicksbro"),ze=$("#miner"),Je=$("#timeplayed"),Ke=($e.append('
      ').children(".such.overlay.noselect").css({position:"fixed",left:0,right:0,top:0,bottom:0,pointerEvents:"none",overflow:"hidden"}),$.extend(["mine","wow","mining","coins","v rich","mining","doge help","coins","yay","dogecoin","pickaxe","master miner","10/10"],Ke)),qe=$.extend(["chezburgr","plz","milk","coins?","doge cool guy","kitten help","no worry","master doge","so heavy","camera","2/10"],qe),Qe=$.extend(["mine","wow","mining","coins","v rich","mining","doge help","coins","yay","dogecoin","pickaxe","master miner","10/10"],Qe),Xe=($.extend(["mine","wow","mining","coins","v rich","mining","doge help","coins","yay","dogecoin","pickaxe","master miner","10/10"],Qe),$.extend(["mine","wow","rave","coins","v rich","raving","doge dance","coins","yay","party","dogecoin","glowstick","master raver","10/10"],Xe)),Ze=$.extend(["mine","wow","mining","coins","v rich","mining","doge help","coins","yay","dogecoin","pickaxe","master miner","10/10"],Xe),et=3,tt={animate:!0,bganim:!0,bonuscoins:0,ceffects:!0,clicks:0,currentlevel:function(){return 1==tt.level?tt.level1:2==tt.level?tt.level2:3==tt.level?tt.level3:void 0},level1:{alltimecoins:0,basecost:1e6,bases:0,basestrength:5e3,baseupslevel:0,clickstrength:1,clickupslevel:0,coins:0,extrastrength:1,extraupslevel:0,kennelcost:400,kennels:0,kennelstrength:3.5,kennelsupslevel:0,kittencost:6e3,kittens:0,kittenstrength:13,kittensupslevel:0,rigcost:999999999,rigs:0,rigstrength:549215,rigupslevel:0,rocketcost:1e5,rockets:0,rocketstrength:109,rocketupslevel:0,shibecost:10,shibes:0,shibestrength:.25,shibeupslevel:0},level2:{alltimecoins:0,basecost:1e6,bases:0,basestrength:5e3,baseupslevel:0,clickstrength:1,clickupslevel:0,coins:0,extrastrength:1,extraupslevel:0,kennelcost:400,kennels:0,kennelstrength:3.5,kennelsupslevel:0,kittencost:6e3,kittens:0,kittenstrength:13,kittensupslevel:0,rigcost:999999999,rigs:0,rigstrength:549215,rigupslevel:0,rocketcost:1e5,rockets:0,rocketstrength:109,rocketupslevel:0,shibecost:10,shibes:0,shibestrength:.25,shibeupslevel:0},level3:{alltimecoins:0,basecost:1e6,bases:0,basestrength:5e3,baseupslevel:0,clickstrength:1,clickupslevel:0,coins:0,extrastrength:1,extraupslevel:0,kennelcost:400,kennels:0,kennelstrength:3.5,kennelsupslevel:0,kittencost:6e3,kittens:0,kittenstrength:13,kittensupslevel:0,rigcost:999999999,rigs:0,rigstrength:549215,rigupslevel:0,rocketcost:1e5,rockets:0,rocketstrength:109,rocketupslevel:0,shibecost:10,shibes:0,shibestrength:.25,shibeupslevel:0},level:1,maxlevel:1,music:!0,sounds2:!0,sounds:!0,timeplayed:0,version:3},nt={achievementsenabled:!1,animations:{shopitem:"animated flash duration-5"},animatecoins:!1,animatecoinstimeout:!1,before:null,bonusactive:!1,bonuspercent:1,bonuspercentnice:0,buybuttons:{buyshibe:$("#buyshibe"),buykitten:$("#buykitten"),buykennel:$("#buykennel"),buyrocket:$("#buyrocket"),buybase:$("#buybase"),buyrig:$("#buyrig")},canhandlesounds:!0,clickcheck:null,currentlevel:function(){return 1==tt.level?nt.level1:2==tt.level?nt.level2:3==tt.level?nt.level3:void 0},dontsave:!1,gamemaxlevel:3,helperanimations:{shibes:!0,kennels:!0,kittens:!0,rockets:!0,bases:!0,rigs:!0,dontanimatethis:""},helpersettings:{max_visible_shibes:31,max_visible_kennels:13,max_visible_kittens:7,max_visible_rockets:15,max_visible_bases:9,max_visible_rigs:4},howmanyup:0,howmanyuplasttime:50,howmanyshop:0,howmanyshoplasttime:50,lastclick:null,lasttime:null,level1:l(1),level2:l(2),level3:l(3),loading_new_level:!1,marsmusicloaded:!1,moonmusicloaded:!1,musicloaded:!1,persec:0,progress:0,speedvar:1,started:!1,upgradesloaded:!1};$.cookie.json=!0;var rt=$(".such.overlay");nt.level1.upgrades.clickups.push(new g("Pickaxe","Regular pickaxe.",0)),nt.level1.upgrades.clickups.push(new g("Stronger Pickaxe","Upgrade the pickaxe.",500)),nt.level1.upgrades.clickups.push(new g("Golden Pickaxe","Replace the pickaxe with a golden pickaxe. Kids, this doesn't work in real life, but doge is magic. ",12e4)),nt.level1.upgrades.clickups.push(new g("TARPIS",'Replace the pickaxe with a top secret prototype self-conscious super-pickaxe known as the "Time And Relative Pickaxe In Space".',8e7)),nt.level1.upgrades.clickups.push(new g("GPU-Pickaxe","Replace the pickaxe with a graphics card on a stick. This increases mining yield substantially.",85e9)),nt.level1.upgrades.clickups.push(new g("Rocket Power","Add a rocket to the pickaxe for extreme mining.",95e14)),nt.level1.upgrades.clickups.push(new g("Space Doge","Give Doge a space helmet. It's wise to have when on the moon.",666e16)),nt.level1.upgrades.shibeups.push(new g("","",0,.25,"Mining Shibe","Very kind shibe to mine much dogecoin.")),nt.level1.upgrades.shibeups.push(new g("Euphoria","Replace the Mining Shibe helmets with fedoras for increased tipping.",1800,1.75,"Enlightened Shibe","Very enlightened shibe to mine much dogecoin.")),nt.level1.upgrades.shibeups.push(new g("Golden Pickaxes","Replace the Mining Shibe pickaxes with golden pickaxes.",12e4,25,"Golden Shibes","Very enlightened shibe to mine much dogecoin. With golden pickaxes.")),nt.level1.upgrades.shibeups.push(new g("Salary Raise","Raise the Mining Shibes salaries which will lead to better work ethics.",2e7,250,"Happy Shibe","Very happy shibe to mine much dogecoin.")),nt.level1.upgrades.shibeups.push(new g("Rapper Shibes","Rapper Shibes bring da bling!",95e7,1100,"Rapper Shibe","Rapper shibe bring da bling!")),nt.level1.upgrades.shibeups.push(new g("Snoop Doge","Snoop doesn't even have to mine, he's just true.",55e9,6500,"Snoop Doge","Very true shibe.")),nt.level1.upgrades.shibeups.push(new g("Snoop Lion","The next evolution of Snoop.",725e14,58085045040,"Snoop Lion","Even truer shibe. Much true!")),nt.level1.upgrades.shibeups.push(new g("Lion In Space","A lion without a space helmet would look weird in space.",1925e14,958085045040,"Space Lion","The bravest of shibes.")),nt.level1.upgrades.kennelsups.push(new g("","",0,3.5,"Doge Kennels","Wow very efficiency, entire kennels to mine dogecoin.")),nt.level1.upgrades.kennelsups.push(new g("More Axes","Supply the kennels with more pickaxes to use for mining.",2400,4.75,"Axequipped Kennels","Wow very efficiency, entire kennels to mine dogecoin. With many axes.")),nt.level1.upgrades.kennelsups.push(new g("Paint Job","Repaint the kennels to a more friendlier color. Much happy.",21e4,32,"Pink Kennels","Wow very efficiency, entire kennels to mine dogecoin. With style.")),nt.level1.upgrades.kennelsups.push(new g("Micro-Rockets","Attach micro-rockets to the kennels. To the moon!",25e5,400,"Rocket Kennels","WOOOW very efficiency, entire kennels to mine dogecoin with ROCKET POWER!")),nt.level1.upgrades.kennelsups.push(new g("Release the Doge","Who let the doge out?",125e7,1800,"Free Running Doges","Wow very freedom, free running doges mine much more dogecoin than not free running doges!")),nt.level1.upgrades.kennelsups.push(new g("Jet Packs","Supply the kennels with jet packs.",95e9,8500,"Jet-Pack Doges","Equipped with jet packs, doges travel at almost light speed to mine much dogecoin!")),nt.level1.upgrades.kennelsups.push(new g("Safety First","Give the Jet-Pack-Doges space helmets. For safety.",725e14,98085045040,"Space Doges","Equipped with jet packs AND space helmets, doges travel at almost light speed to mine much dogecoin in space!")),nt.level1.upgrades.kittensups.push(new g("","",0,13,"Slave Kittens","Kittens to post cute videos to the internet for dogecoin.")),nt.level1.upgrades.kittensups.push(new g("High Quality Pussy","Upgrade the kittens webcam to HD.",8e4,44,"Slave Kittens HD","Kittens to post cute HD videos to the internet for dogecoin.")),nt.level1.upgrades.kittensups.push(new g("More Kittens","Increase the cute-level with more kittens.",12e5,240,"Slave Kittens HD x 3","Many kittens to post cute HD videos to the internet for dogecoin.")),nt.level1.upgrades.kittensups.push(new g("High-Speed Interwebs","Connects the kittens PC to the global Doge Fiber network.",15e6,900,"Slave Kittens HD+Doge Fiber","Many kittens to post cute HD videos to the internet for dogecoin. With doge fiber speed!")),nt.level1.upgrades.kittensups.push(new g("Intelligence","Enlighten the kittens.",155e7,2400,"Enlightened Kittens","Enlightened kittens to post cute HD videos to the internet for dogecoin.")),nt.level1.upgrades.kittensups.push(new g("Stock Kittens","Teach the kittens how to effectively trade in dogecoin stocks.",95e8,12337,"Investment Kittens","Stock kittens to invest much dogecoin in dogecoin for much dogecoin profit.")),nt.level1.upgrades.kittensups.push(new g("Catstronaut","Give the kittens space helmets. It helps them feel safe.",45e16,55045045040,"Space-Proof Kittens","Space Kittens to invest much dogecoin in dogecoin for much dogecoin profit. In space.")),nt.level1.upgrades.rocketups.push(new g("","",0,109,"Space Rocket","A rocket to fly to the moon to find more dogecoin.")),nt.level1.upgrades.rocketups.push(new g("Blue-Flame","Upgrade the rocket engine with blue-flame rockets.",45e4,218,"Blue-Flame Rocket","A blue flame rocket to fly to the moon to find more dogecoin.")),nt.level1.upgrades.rocketups.push(new g("Warp Drive","Upgrade the rocket with a warp drive engine for near-instant travel to the moon.",8e6,1201,"Warp Rocket","A warp drive rocket to travel to the moon to find much dogecoin.")),nt.level1.upgrades.rocketups.push(new g("Hull Upgrade","Upgrade the hull of the Space Rocket. Shiny.",98e6,5180,"Shiny Rocket","A shiny space rocket to find much dogecoin in space.")),nt.level1.upgrades.rocketups.push(new g("Olie Upgrade","Lets all go to the moon together, okay? Upgrade to cartoon-style doge rocket.",34e8,15180,"Olie Rocket","Awesome rocket for doge to travel to the moon to find much dogecoin.")),nt.level1.upgrades.rocketups.push(new g("Space Helmets","Give Pilot-Doge a space helmet to increase time spent in space.",55e16,95045045040,"Space-Olie Rocket","Awesome rocket for space doge to travel to the moon to find dogecoin.")),nt.level1.upgrades.baseups.push(new g("","",0,5e3,"Moon Base","A base on the moon to extract much dogecoin.")),nt.level1.upgrades.baseups.push(new g("Excavator Assistance","Add a doge-excavator to assist the moon base.",8e6,9001,"Moon Base + Excavator","A base on the moon to extract much dogecoin. With added excavator support.")),nt.level1.upgrades.baseups.push(new g("More Axes v2","Add axes to the moon base.",99e6,16e3,"Moon Base + Excavator + Axes","A base on the moon to extract much dogecoin. With added axes & excavator support.")),nt.level1.upgrades.baseups.push(new g("Doge Star","Upgrade the moon base to a MOON base.",42e7,66e3,"Moon Sized Base","A base the size of a moon to mine much dogecoin.")),nt.level1.upgrades.baseups.push(new g("That's Gold Jerry!","Turn the Doge Star into a Golden Doge Star.",65e8,225e3,"Golden Moon Sized Base","A golden base the size of a moon to mine much more dogecoin.")),nt.level1.upgrades.baseups.push(new g("Doge Gate","Place a Doge Gate on the moon for instant dogecoin travel between the moon and earth.",95e16,175045045040,"Doge Gate","A space doge gate to transfer dogecoin through worm holes in space.")),nt.level1.upgrades.rigups.push(new g("","",0,549215,"Time Machine Mining Rig","Mines into the future where infinite dogecoins exist.")),nt.level1.upgrades.rigups.push(new g("Roads?","Where doge is going, he doesn't need roads. Give the Time Machine Mining Rig flight capabilities.",88e8,1598430,"Flying Time Machine Mining Rig","Mines into the future where infinite dogecoins exist. While flying.")),nt.level1.upgrades.rigups.push(new g("Bling Bling","Paints the Time Machine Mining Rig golden. This increases its mining yield, it's science.",32e9,10984300,"Golden Flying Time Machine Mining Rig","Yep.")),nt.level1.upgrades.rigups.push(new g("TARDogeIS","Replace the Time Machine Mining Rig with the Time and Relative Doge in Space.",1337e9,420420420,"TARDogeIS","Time and Relative Doge in Space exists everywhere at the same time.")),nt.level1.upgrades.rigups.push(new g("Swagdis","Add rockets and a spoiler to the Time and Relative Doge in Space.",9e14,4204204204,"Swagdis","A TARDogeIS with some swag.")),nt.level1.upgrades.rigups.push(new g("Black Hole","Extremely hard to control, but unpredictably profitable.",825e16,0xeefb39227a0ac,"Black Hole","Extremely hard to control black hole to unpredictably mine much dogecoin.")),nt.level1.upgrades.rigups.push(new g("Green Hole","The black hole wasn't black, but the green one is green.",425e18,99204204204204210,"Green Hole","Extremely hard to control green hole to unpredictably mine much dogecoin.")),nt.level1.upgrades.extraups.push(new g("Bronze Doge Fortune","Increase dogecoin income by +5%",25e3,1.05)),nt.level1.upgrades.extraups.push(new g("Silver Doge Fortune","Increase dogecoin income by +15%",65e4,1.15)),nt.level1.upgrades.extraups.push(new g("Golden Doge Fortune","Increase dogecoin income by +50%",6e10,1.5)),nt.level1.upgrades.extraups.push(new g("Snoop Fortune","Increase dogecoin income by 100%",420420420420,2)),nt.level1.upgrades.extraups.push(new g("Sagan of the Universe","Increase dogecoin income by 125%",420420420420420,2.25)),nt.level1.upgrades.extraups.push(new g("Coinminator","Do you even mine? Increase dogecoin income by 150%",925e16,2.5)),nt.level1.upgrades.extraups.push(new g("Kirk of the Mountain","Increase dogecoin income by 300%",666e18,4)),nt.level2.upgrades.clickups.push(new g("Pickaxe","Regular pickaxe.",0)),nt.level2.upgrades.clickups.push(new g("Lollipaxe","Recent studies have shown that sugar is the most destructive force of nature ever. Whats made out of sugar?",500)),nt.level2.upgrades.clickups.push(new g("Cod of Duty","It's the famous CoD of Duty! Updated pickaxe.",12e4)),nt.level2.upgrades.clickups.push(new g("The Dangerous Game","Do you want to play the dangerous game? This is how you play the dangerous game. Updated pickaxe.",8e7)),nt.level2.upgrades.shibeups.push(new g("","",0,.25,"Moon Shibe","Astronaut moon shibes to mine much dogecoin.")),nt.level2.upgrades.shibeups.push(new g("Suit Up","Give the Moon Shibe a full space suit to wear. Very safer.",1800,1.75,"Suited Moon Shibe","Astronaut moon shibes to mine much dogecoin (with space suit!).")),nt.level2.upgrades.shibeups.push(new g("Head-Mounted Pickaxes","Put Micro-Pickaxes (c) on the helmet of the Moon Shibe.",12e4,34,"Upgraded Moon Shibe","Astronaut moon shibes to mine much dogecoin. With Micro-Pickaxes (c).")),nt.level2.upgrades.shibeups.push(new g("Gold-Suit Up","Replace the Moon Shibes space suit with a golden space suit.",2e7,300,"Golden Moon Shibe","Golden moon shibes to mine much dogecoin. Shiny!")),nt.level2.upgrades.kennelsups.push(new g("","",0,3.5,"Doge Car","Wow! Much fast doge car with such doge driver. Very Wise. How it mines no one knows.")),nt.level2.upgrades.kennelsups.push(new g("Shade Miner","Give the Doge Driver of the Doge Car some cool shades.",2400,6.75,"Cool Doge Car","Wow! Much fast doge car with such COOL doge driver. Very Wise.")),nt.level2.upgrades.kennelsups.push(new g("Tank","Replace the Doge Car wheels with tank tracks, for better traction on the moon.",21e4,60,"Tank Doge Car","Much traction doge car with such COOL doge driver. Very Wise.")),nt.level2.upgrades.kennelsups.push(new g("Roof Miner","Attack a giant GPU-Pickaxe to the roof of the Doge Car",25e5,420,"Tank-Axe Doge Car","WOW mining tanky doge car mines bestest dogecoin. Very Wise.")),nt.level2.upgrades.kittensups.push(new g("","",0,13,"Suit Shibe","Cool spacesuited shibe to find very hidden dogecoin to mine.")),nt.level2.upgrades.kittensups.push(new g("Gold-Axe Up","Replace the Suit Shibe regular pickaxe with a golden pickaxe.",8e4,44,"Suit Shibe","Cool spacesuited shibe to find very hidden dogecoin to mine. Now with golden pickaxe.")),nt.level2.upgrades.kittensups.push(new g("GPU-Axe Up","Replace the Suit Shibe golden pickaxe with a GPU-pickaxe.",12e5,248,"Suit Shibe","Cool spacesuited shibe to find very hidden dogecoin to mine. Now with GPU-pickaxe.")),nt.level2.upgrades.kittensups.push(new g("Not Even An Axe","Replace the Suit Shibe GPU-pickaxe with a rocket. Yep.",15e6,910,"Danger Suit Shibe","Dangerous spacesuited shibe to find very hidden dogecoin to mine. What.")),nt.level2.upgrades.rocketups.push(new g("","",0,109,"Lander Shibe","Lander shibe explores other planets and moons in the solar system in pursuit of dogecoin.")),nt.level2.upgrades.rocketups.push(new g("Candy-Lander Shibe","Upgrade the Lander Shibe to a Candy-Lander Shibe.",45e4,218,"Candy-Lander Shibe","Candy-Lander shibe explores other planets and moons in the solar system in pursuit of dogecoin.")),nt.level2.upgrades.rocketups.push(new g("Double-Lander Shibe","Upgrade the Lander Shibe to a Double-Lander Shibe.",8e6,1201,"Double-Lander Shibe","Double-Lander shibe explores other planets and moons in the solar system in pursuit of dogecoin.")),nt.level2.upgrades.rocketups.push(new g("Triple-Lander Shibe","Upgrade the Double-Lander Shibe to a Triple-Lander Shibe.",98e6,5180,"Triple-Lander Shibe","Triple-Lander shibe explores other planets and moons in the solar system in pursuit of dogecoin.")),nt.level2.upgrades.baseups.push(new g("","",0,5e3,"Mars Base","A base on Mars to mine ludicrous amounts of dogecoin.")),nt.level2.upgrades.baseups.push(new g("Double Mars Base","Double the amount of Mars bases with smaller bases. They are more efficient. ",8e6,9001,"Double Mars Bases","Two bases on Mars to mine ludicrous amounts of dogecoin.")),nt.level2.upgrades.baseups.push(new g("Quad Mars Base","Quadruple the amount of Mars bases.",99e6,16e3,"Quad Mars Bases","Four bases on Mars to mine ludicrous amounts of dogecoin.")),nt.level2.upgrades.baseups.push(new g("Shit-ton of bases","Get a lot of Mars Bases.",42e7,66e3,"Many Mars Bases","A lot of bases on Mars to mine very silly amounts of dogecoin.")),nt.level2.upgrades.rigups.push(new g("","",0,549215,"Infinite Dogebility Drive","A ship that can instantaneously travel to any place in the universe instantly. Result? Many dogecoin.")),nt.level2.upgrades.rigups.push(new g("Delivery Service","The Infinite Dogebility Drive ship will now deliver packages across the universe in exchange for more dogecoin.",88e8,1598500,"Infinite Delivery Drive","A ship that can instantaneously deliver packages to any place in the universe instantly. Result? Amazon.")),nt.level2.upgrades.rigups.push(new g("Hire a crew","Hire a crew to help Doge travel the stars. Crew consists of 1 friendly Kerbal.",32e9,10984300,"Infinite Delivery Crew","A crew on a ship that can instantaneously deliver packages to any place in the universe instantly.")),nt.level2.upgrades.rigups.push(new g("Upside Doge","Silly Doge drives his ship upside down.",1337e9,420420420,"Upside Doge Crew","An upside down ship that can instantaneously deliver packages to any place in the universe instantly.")),nt.level2.upgrades.extraups.push(new g("Bronze Doge Fortune","Increase dogecoin income by +5%",25e3,1.05)),nt.level2.upgrades.extraups.push(new g("Silver Doge Fortune","Increase dogecoin income by +15%",65e4,1.15)),nt.level2.upgrades.extraups.push(new g("Golden Doge Fortune","Increase dogecoin income by +50%",6e10,1.5)),nt.level3.upgrades.clickups.push(new g("Pickaxe","Regular pickaxe.",0)),nt.level3.upgrades.clickups.push(new g("Green Glowstick","Apparently the Green Glowstick is cooler than the blue!",500)),nt.level3.upgrades.clickups.push(new g("Party Popper","This pickaxe is guaranteed to pop the party!",12e4)),nt.level3.upgrades.clickups.push(new g("F.E.L.P.S.","The new F.E.L.P.S follows most dogecoin. Get the coins by smashing gamer.",8e7)),nt.level3.upgrades.shibeups.push(new g("","",0,.25,"Party Shibe","Cool space rave party shibes to rave much dogecoin.")),nt.level3.upgrades.shibeups.push(new g("Proper Raving","Give the Rave Shibe some glowsticks instead of pickaxes.",1800,1.75,"Rave Shibe","Cool space rave party shibes to rave much dogecoin. With glowsticks.")),nt.level3.upgrades.shibeups.push(new g("Dual-Wielding Ravers","Additional glowsticks for Rave Shibes.",12e4,34,"DW Rave Shibe","Cool space rave party shibes to rave much dogecoin.")),nt.level3.upgrades.shibeups.push(new g("Ecstasy Shibe","Give the shibes ecstasy pills for harder raving. Don't try this at home.",2e7,300,"Ecstasy Shibe","Cool space rave party shibes on E to rave much dogecoin.")),nt.level3.upgrades.kennelsups.push(new g("","",0,3.5,"CuriousiDoge","Much curious Doge to explore Mars riches.")),nt.level3.upgrades.kennelsups.push(new g("Party Mode","Engage party mode for CuriosiDoge.",2400,6.75,"CuriousiDoge [P]","Much curious Doge to explore Mars riches. Party mode.")),nt.level3.upgrades.kennelsups.push(new g("Party Hydra","The Party Hydra upgrade gives CuriosiDoge a lot more head.",21e4,60,"CuriousiDoge [PH]","Much curious Doge to explore Mars riches. Party hydra.")),nt.level3.upgrades.kennelsups.push(new g("Rocket Mode","Replace CuriosiDoge wheels with rockets. Much more curiousi-able.",25e5,420,"CuriousiDoge [RPH]","Much curious Doge to explore Mars riches. Rocket party hydra.")),nt.level3.upgrades.kittensups.push(new g("","",0,13,"DJ Kittenz","Very music creation. DJ Kittenz specialize in house music.")),nt.level3.upgrades.kittensups.push(new g("D.I.S.C.O.","It's disco time.",8e4,44,"DJ Kittenz","Very music creation. DJ Kittenz now specialize in disco music.")),nt.level3.upgrades.kittensups.push(new g("Swag Upgrade","Give DJ Kittenz some fresh swag.",12e5,248,"DJ Kittenz","Very music creation. DJ Kittenz now specialize in disco music.")),nt.level3.upgrades.kittensups.push(new g("Wash-Oops","Accidentally color DJ Kittenz swag purple in the washer.",15e6,910,"DJ Kittenz","Very music creation. DJ Kittenz now specialize in disco music.")),nt.level3.upgrades.rocketups.push(new g("","",0,109,"Space Bass","A super-duper secret prototype space bass in space. Such vibrate.")),nt.level3.upgrades.rocketups.push(new g("Golden Bass","Give the Space Bass the Golden Bass upgrade for extra bling.",45e4,218,"Space Bass","A super-duper secret prototype space bass in space. Such vibrate.")),nt.level3.upgrades.rocketups.push(new g("Space Bass Doge","It comes wif two sub woofers.",8e6,1201,"Space Bass Doge","It comes wif two sub woofers.")),nt.level3.upgrades.rocketups.push(new g("Bringa Da Bling","Give Space Bass Doge some bling to show off!",98e6,5180,"Space Bass Doge","It comes wif two sub woofers.")),nt.level3.upgrades.baseups.push(new g("","",0,5e3,"Meta Shibe","Meta shibe plays Dogeminer while you play dogeminer, dude. So meta.")),nt.level3.upgrades.baseups.push(new g("Toshibe","Upgrade Meta Shibes PC to a Toshibe model.",8e6,9001,"Meta Shibe","Meta shibe helps you mine while you mine, dawg.")),nt.level3.upgrades.baseups.push(new g("Meta Raver","Meta Shibe also likes to rave. Phat glasses upgrade.",99e6,16e3,"MetaRave Shibe","Meta shibe helps you mine while you mine, dawg.")),nt.level3.upgrades.baseups.push(new g("Blazing Fast","Meta Shibe wants to blaze it.",42e7,66e3,"MetaBlaze Shibe","Meta shibe helps you mine while you mine, dawg.")),nt.level3.upgrades.rigups.push(new g("","",0,549215,"Time Travel T-Rex","Such timetravel. Very scary. Rawr.")),nt.level3.upgrades.rigups.push(new g("Freakin Lazorz","Equip the Time Travel T-Rex with freakin lazorz, man.",88e8,1598500,"Time Travel Laser T-Rex","Such timetravel. Very scary. Rawr.")),nt.level3.upgrades.rigups.push(new g("Rocketrex","Rocket upgrade for T-Rex. Because faster time travel.",32e9,10984300,"Rocket Boosted Time Travel Laser T-Rex","Such timetravel. Very scary. Rawr.")),nt.level3.upgrades.rigups.push(new g("More Rocket","More rocket for Time Travel T-Rex. Pffsssiuuue.",1337e9,420420420,"More Rocket Boosted Time Travel Laser T-Rex","Such timetravel. Very scary. Rawr.")),nt.level3.upgrades.extraups.push(new g("Bronze Doge Fortune","Increase dogecoin income by +5%",25e3,1.05)),nt.level3.upgrades.extraups.push(new g("Silver Doge Fortune","Increase dogecoin income by +15%",65e4,1.15)),nt.level3.upgrades.extraups.push(new g("Golden Doge Fortune","Increase dogecoin income by +50%",6e10,1.5)),C(),v(),se(),$("#start-playing").button(),$("#second-part-button").button(),$("#third-part-button").button(),$("#last-part-button").button();var ot=!1,at=!1,it=!0,st=0,lt="webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";le()&&$("#start-playing").find("span").text("CONTINUE"),$("#start-playing").click((function(){d()})),$("#second-part-button").click((function(){$(".intro-rocket").removeClass("shake infinite nodelay duration-8").addClass("bounceOutUp nodelay duration-15"),$(".intro-rocket").one(lt,(function(){$(".second-part").removeClass("animated zoomInDown"),$(".second-part").addClass("animated zoomOutDown"),$(".third-part").addClass("animated zoomInDown"),$(".third-part").show(),$(".hand").one(lt,(function(){$(".hand").removeClass("animated bounceInDown"),ot=!0,m()}))}))})),$("#third-part-button").click((function(){ot=!1,$(".third-part .third-part-doge").addClass("animated fadeOutLeft duration-5"),$(".third-part-doge").one(lt,(function(){$(this).hide(),$(".third-part-shop").addClass("animated fadeInRight duration-5"),$(".third-part-shop").show(),$(".third-part-shop").one(lt,(function(){at=!0,h(),$("#upgraded-example").one(lt,(function(){st=4,$(".shibes-example").children().attr("class","animated tada level1 level1-shibe1")}))}))}))})),$("#last-part-button").click((function(){c()})),$(window).on("load",(function(){$("#loading-indicator").addClass("animated flipOutX duration-5").one(lt,(function(){$("#start-playing").addClass("animated fadeInDown duration-5").attr("style","visibility:visible;"),$("#start-playing").show(),$(this).remove()}))})),$("#progressBar").hide(),$("#launchbutton").hide(),$("#tipsbutton").click((function(){$("#tipsmodal").dialog("open")})),$("#tipsmodal").dialog({autoOpen:!1,show:{effect:"fade",duration:500},hide:{effect:"fade",duration:500},width:600,modal:!0}),$("#savemodal").dialog({autoOpen:!1,show:{effect:"fade",duration:200},hide:{effect:"fade",duration:200},minHeight:500,minWidth:600}),$("#buyshibe").click((function(){tt.currentlevel().coins>=tt.currentlevel().shibecost&&(tt.currentlevel().shibes++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().shibecost,tt.currentlevel().shibecost=Math.ceil(1.1*tt.currentlevel().shibecost),$("#shibes").html(" - "+tt.currentlevel().shibes),k("#shibesimage",nt.animations.shopitem),G(),W(),C(),T(),f(),ne(),Me())})),$("#buykennel").click((function(){tt.currentlevel().coins>=tt.currentlevel().kennelcost&&(tt.currentlevel().kennels++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().kennelcost,tt.currentlevel().kennelcost=Math.ceil(1.1*tt.currentlevel().kennelcost),$("#kennels").html(" - "+tt.currentlevel().kennels),k("#kennelsimage",nt.animations.shopitem),G(),W(),C(),Y(),f(),ne(),Me())})),$("#buykitten").click((function(){tt.currentlevel().coins>=tt.currentlevel().kittencost&&(tt.currentlevel().kittens++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().kittencost,tt.currentlevel().kittencost=Math.ceil(1.1*tt.currentlevel().kittencost),$("#kittens").html(" - "+tt.currentlevel().kittens),k("#kittensimage",nt.animations.shopitem),G(),W(),C(),E(),f(),ne(),Me())})),$("#buyrocket").click((function(){tt.currentlevel().coins>=tt.currentlevel().rocketcost&&(tt.currentlevel().rockets++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().rocketcost,tt.currentlevel().rocketcost=Math.ceil(1.1*tt.currentlevel().rocketcost),$("#rockets").html(" - "+tt.currentlevel().rockets),k("#rocketsimage",nt.animations.shopitem),G(),W(),C(),S(),f(),ne(),Me())})),$("#buybase").click((function(){tt.currentlevel().coins>=tt.currentlevel().basecost&&(tt.currentlevel().bases++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().basecost,tt.currentlevel().basecost=Math.ceil(1.1*tt.currentlevel().basecost),$("#bases").html(" - "+tt.currentlevel().bases),k("#basesimage",nt.animations.shopitem),G(),W(),C(),x(),f(),ne(),Me())})),$("#buyrig").click((function(){tt.currentlevel().coins>=tt.currentlevel().rigcost&&(tt.currentlevel().rigs++,tt.currentlevel().coins=tt.currentlevel().coins-tt.currentlevel().rigcost,tt.currentlevel().rigcost=Math.ceil(1.1*tt.currentlevel().rigcost),$("#rigs").html(" - "+tt.currentlevel().rigs),k("#rigsimage",nt.animations.shopitem),G(),W(),C(),N(),f(),ne(),Me())})),$("#restartbutton").click((function(){confirm("Are you sure you want to RESET the game? This deletes your save.")&&(nt.dontsave=!0,oe(),confirm("Save removed. The page will now refresh.")?setTimeout((function(){location.reload()}),10):nt.dontsave=!1)})),$("#clickeffects").click((function(){$("#clickeffects").is(":checked")?tt.ceffects=!0:tt.ceffects=!1})),$("#animations").click((function(){$("#animations").is(":checked")?tt.animate=!0:tt.animate=!1})),$("#backgroundanims").click((function(){$("#backgroundanims").is(":checked")?tt.bganim=!0:tt.bganim=!1})),$("#sounds").click((function(){w()})),$("#sounds2").click((function(){$("#sounds2").is(":checked")?tt.sounds2=!0:tt.sounds2=!1})),$("#music").click((function(){$("#music").is(":checked")?(tt.music=!0,De()):(tt.music=!1,Te())})),$("#quickmute").click((function(){w()})),$("#showhidebutton").click((function(){function e(){$("#social-tooltip").hasClass(o)&&$("#social-tooltip").attr("class",r).one(lt,(function(){$(this).css("display","none")}))}var t="animated fadeOutUp duration-5",n="animated fadeInDown duration-10",r="animated fadeOutUp duration-10",o="animated bob infinite duration-35",a=$("#showhidediv");a.hasClass(t)?(e(),a.attr("class","animated fadeInDown duration-5")):(a.attr("class",t),$("#social-tooltip").attr("class",n).css("display","block").one(lt,(function(){$(this).removeClass(n).addClass(o),$(this).click((function(){e()})),setTimeout((function(){e()}),5e3)})))})),$("#stats").click((function(){H()}));for(var ut="animated bounceIn",dt=!1,ct=nt.helpersettings.max_visible_rockets+1,pt=[];ct--;)pt.push("animated upshake"+Math.floor(6*t()+1)+" infinite");var mt=!1,ht=[],_t=[];K();var gt="animated slideInRight duration-5",ft="animated slideOutLeft duration-5",vt={hasrunfor:0,currentstr:"Click on Doge to start mining!"};J(),vt.hasrunfor=20;var yt="",bt=!1;$("#miner").on("mousedown touchstart",(function(e){e.preventDefault(),"mousedown"===e.type&&tt.sounds2&&Ot[Math.floor(5*t())].play(),function(){if(Ct=!1,null===nt.lastclick||void 0===nt.lastclick)nt.lastclick=new Date;else{nt.clickcheck=new Date,50>nt.clickcheck.getTime()-nt.lastclick.getTime()&&(Ct=!0)}return nt.lastclick=new Date,Ct}()||(tt.clicks++,!1===nt.started&&(nt.started=!0),bt=!!tt.ceffects&&t()<.33,yt=tt.ceffects?" animated pulse duration-1":"",requestAnimationFrame((function(){bt&&te(r(nt.currentlevel().dogefix),rt,Math.max(24,50*t()+20)),Be.html(X(tt.clicks)),$e.addClass("noselect"),ze.attr("class","level"+tt.level+" level"+tt.level+"-doge_mine2u"+tt.currentlevel().clickupslevel+yt)})),function(){if(tt.ceffects){new u("miner","+"+Z(Math.floor(tt.currentlevel().clickstrength*nt.bonuspercent),2)+nt.currentlevel().modifier_small)}}(),tt.currentlevel().alltimecoins=tt.currentlevel().alltimecoins+tt.currentlevel().clickstrength*nt.bonuspercent*tt.currentlevel().extrastrength,tt.currentlevel().coins=tt.currentlevel().coins+tt.currentlevel().clickstrength*nt.bonuspercent*tt.currentlevel().extrastrength,nt.animatecoins=!1,clearTimeout(nt.animatecoinstimeout),nt.animatecoins=!0,kt||(kt=!0,requestAnimationFrame((function(){Mt.attr("class",tt.currentlevel().coins>99999?"animated nanopulse duration-1":tt.currentlevel().coins>999?"animated micropulse duration-1":"animated minipulse duration-1"),setTimeout(q,150)}))))})),$("#miner").on("mouseup touchend mouseupoutside touchendoutside mouseout",(function(){Q()}));var Mt=$("#mined"),kt=!1,wt=!1,Dt=(new Array("./img/level1.png"),[]);1==tt.level?Dt=new Array("./img/bg/bg1.jpg","./img/bg/bg2.jpg","./img/bg/bg3.jpg","./img/bg/bg4.jpg","./img/bg/bg5.jpg","./img/bg/bg6.jpg","./img/bg/bg7.jpg","./img/bg/bg8.jpg","./img/bg/bg9.jpg"):2==tt.level?Dt=new Array("./img/bg/bg001.jpg","./img/bg/bg002.jpg?2","./img/bg/bg003.jpg"):3==tt.level&&(Dt=new Array("./img/bg/bg101.jpg","./img/bg/bg102.jpg","./img/bg/bg103.jpg","./img/bg/bg104.jpg","./img/bg/bg105.jpg"));var Lt=1,Tt=Dt[0];$(document).ready((function(){$("#launchbutton").text("LAUNCH"),$(".shopbutton").button({icons:{primary:"ui-icon-cart"}}),$("#clickeffects").button(),$("#animations").button(),$("#backgroundanims").button(),$("#sounds").button(),$("#sounds2").button(),$("#music").button(),$("#restartbutton").button(),$("#toggle").button(),$("#stats").button(),$("#tabs").tabs(),$("#showhidebutton").button(),$("#launchbutton").button({icons:{primary:"ui-icon-alert"}}),$("#exportsave").button(),$("#importsave").button(),$("#achievementswitch").button(),$("#switchlevel").button(),$("#statstab").tabs({active:tt.level-1})}));var Yt,Et,St=1;$e.on("mousedown","#bonuscoin",(function(){new u("miner","Bonus activated for 60 seconds!"),ye(),be(),tt.bonuscoins++,$("#bonuscoin").delay(50).fadeOut(100).remove(),$(".ui-effects-wrapper").remove(),ge()})),$e.on("mousedown","#flyingcoin",(function(){new u("miner","Special bonus acquired! +20%"),be(),tt.bonuscoins++,$(this).delay(50).fadeOut(100).remove(),ve()}));var xt=[],Nt="38,38,40,40,37,39,37,39,66,65";$(document).keydown((function(e){xt.push(e.keyCode),xt.toString().indexOf(Nt)>=0&&($(document).unbind("keydown",arguments.callee),$.getScript("http://www.cornify.com/js/cornify.js",(function(){cornify_add(),$(document).keydown(cornify_add),soundManager.createSound({id:"BigDoge",url:"snd/BigDoge.mp3",autoLoad:!0,autoPlay:!0}),xt=[]}))),xt.length>1e3&&(xt=[])}));var Ct,Ot,Pt,Ht,It,jt,At,Rt=!1,Vt=!1,Ft=!1,$t=!1,Wt=[],Ut=[];$.noty.defaults={layout:"center",theme:"defaultTheme",type:"success",text:"html",dismissQueue:!0,template:'
      ',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:200},timeout:4e3,force:!1,modal:!1,maxVisible:1,killer:!1,closeWith:["click"],callback:{onShow:function(){soundManager.stop("achievementunlocked"),soundManager.play("achievementunlocked")},afterShow:function(){},onClose:function(){$("#achievementwindow").effect("transfer",{to:"#achitab",className:"ui-effects-transfer noselect"},500,null)},afterClose:function(){var e="animated bounce duration-5 delay-2";$("#achitab").addClass(e).one(lt,(function(){$(this).removeClass(e)}))}},buttons:!1},$("#launchbutton").click((function(){nt.progress=Math.floor(tt.currentlevel().coins/nt.currentlevel().launchcost*100),nt.progress>=100&&($("#launchbutton").hide(),we(),3==tt.level&&alert("GOOD JOB! But your ???? is in another castle. (Aka it doesnt exist yet... Sorry!) Check the facebook page for news on updates :o)"),2==tt.level&&Ie(),1==tt.level&&He())})),$("#exportsave").click((function(){var e=re(),t='

      Copy and save this:


      Please note that achievements are currently not saved with this string.

      ";$("#savemodal").html(t),$("#savemodal").dialog("open")})),$("#importsave").click((function(){$("#savemodal").html('

      Input your save here:


      '),$("#loadbutton").button(),$("#loadbutton").click((function(){nt.achievementsenabled=!1;var e=$("#loadstring").val();e=Base64.decode(e),ae(!0,JSON.parse(e)),$("#savemodal").dialog("close")})),$("#savemodal").dialog("open")})),$("#switchlevel").click((function(){Oe()})),$("#achievementswitch").click((function(){nt.achievementsenabled=!nt.achievementsenabled}));var Gt=!1;if("localhost"==window.location.host&&(Gt=!0,console.log("#### Dev mode activated")),Gt){nt.achievementsenabled=!1,function(){var e=document.createElement("script");e.onload=function(){var e=new Stats;e.domElement.style.cssText="position:fixed;left:0;top:0;z-index:10000",document.body.appendChild(e.domElement),requestAnimationFrame((function t(){e.update(),requestAnimationFrame(t)}))},e.src="//rawgit.com/mrdoob/stats.js/master/build/stats.min.js",document.head.appendChild(e)}(),"#skip"==window.location.hash&&(setTimeout((function(){d()}),10),setTimeout((function(){c()}),50));$(document).keydown((function(e){65==e.which&&(new u("miner","+TRIPLED COINS"),tt.currentlevel().coins=3*tt.currentlevel().coins),68==e.which&&(new u("miner","-DISABLED SAVES"),nt.dontsave=!0),83==e.which&&(new u("miner","+ENABLED SAVES"),nt.dontsave=!1),66==e.which&&(new u("miner","+SPAWNED BONUS STUFF"),_e(),fe()),82==e.which&&(new u("miner","-REMOVED SAVES"),oe())}))}var Bt=je.createClass({displayName:"Dogecoins",getInitialState:function(){return{data:0}},componentDidMount:function(){this.setCoins(),setInterval(this.setCoins,this.props.pollInterval)},setCoins:function(){this.setState({data:X(Math.round(tt.currentlevel().coins,0))+" "+nt.currentlevel().modifier})},render:function(){return je.createElement("div",null,this.state.data)}}),zt=je.createClass({displayName:"Persec",getInitialState:function(){return{data:0,bonus:!1,bonuspercentnice:0}},componentDidMount:function(){this.setPersec(),setInterval(this.setPersec,this.props.pollInterval)},setPersec:function(){this.setState({data:Z(nt.persec,1)+" "+nt.currentlevel().modifier,bonus:nt.bonusactive,bonuspercentnice:nt.bonuspercentnice})},render:function(){return this.state.bonus?je.createElement("div",null,je.createElement("strong",null,this.state.data,je.createElement(Jt,{data:this.state.bonuspercentnice}))):je.createElement("div",null,this.state.data)}}),Jt=je.createClass({displayName:"Bonus",divStyle:{color:"#FF4136"},render:function(){return je.createElement("div",null,"! (",je.createElement("span",{style:this.divStyle},"+",this.props.data,"% bonus"),")")}});Ae.render(je.createElement(Bt,{data:X(Math.round(tt.currentlevel().coins,0)),pollInterval:50}),We[0]),Ae.render(je.createElement(zt,{data:Z(nt.persec,1),pollInterval:100}),Ue[0])}))}).call(t,n(1))},function(e,t){function n(){u&&i&&(u=!1,i.length?l=i.concat(l):d=-1,l.length&&r())}function r(){if(!u){var e=setTimeout(n);u=!0;for(var t=l.length;t;){for(i=l,l=[];++d1)for(var n=1;nn;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var a,i,s=n(e),l=1;l1){for(var M=Array(b),k=0;b>k;k++)M[k]=arguments[k+2];u.children=M}if(e&&e.defaultProps){var w=e.defaultProps;for(l in w)void 0===u[l]&&(u[l]=w[l])}if("production"!==t.env.NODE_ENV&&(p||f)&&(void 0===u.$$typeof||u.$$typeof!==h)){var D="function"==typeof e?e.displayName||e.name||"Unknown":e;p&&a(u,D),f&&i(u,D)}return g(e,p,f,v,y,d.current,u)},g.createFactory=function(e){var t=g.createElement.bind(null,e);return t.type=e,t},g.cloneAndReplaceKey=function(e,t){return g(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},g.cloneElement=function(e,n,a){var i,s,l=u({},e.props),p=e.key,h=e.ref,f=e._self,v=e._source,y=e._owner;if(null!=n)for(i in"production"!==t.env.NODE_ENV&&"production"!==t.env.NODE_ENV&&c(null==n.__proto__||n.__proto__===Object.prototype,"React.cloneElement(...): Expected props argument to be a plain object. Properties defined in its prototype chain will be ignored."),r(n)&&(h=n.ref,y=d.current),o(n)&&(p=""+n.key),e.type&&e.type.defaultProps&&(s=e.type.defaultProps),n)m.call(n,i)&&!_.hasOwnProperty(i)&&(void 0===n[i]&&void 0!==s?l[i]=s[i]:l[i]=n[i]);var b=arguments.length-2;if(1===b)l.children=a;else if(b>1){for(var M=Array(b),k=0;b>k;k++)M[k]=arguments[k+2];l.children=M}return g(e.type,p,h,f,v,y,l)},g.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===h},g.REACT_ELEMENT_TYPE=h,e.exports=g}).call(t,n(1))},function(e,t){"use strict";e.exports={current:null}},function(e,t,n){(function(t){"use strict";var r=n(12);"production"!==t.env.NODE_ENV&&function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];var o=0,a="Warning: "+e.replace(/%s/g,(function(){return n[o++]}));"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}};r=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var r=arguments.length,o=Array(r>2?r-2:0),a=2;r>a;a++)o[a-2]=arguments[a];e.apply(void 0,[n].concat(o))}}}(),e.exports=r}).call(t,n(1))},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){(function(t){"use strict";var n=!1;if("production"!==t.env.NODE_ENV)try{Object.defineProperty({},"x",{get:function(){}}),n=!0}catch(e){}e.exports=n}).call(t,n(1))},function(e,t,n){(function(t){"use strict";function r(e,t){return e&&"object"==typeof e&&null!=e.key?d.escape(e.key):t.toString(36)}function o(e,n,_,g){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||s.isValidElement(e))return _(g,e,""===n?p+r(e,0):n),1;var v,y=0,b=""===n?p:n+m;if(Array.isArray(e))for(var M=0;M1?s-1:0),u=1;s>u;u++)l[u-1]=arguments[u];if(i!==e&&null!==i)"production"!==t.env.NODE_ENV&&M(!1,"bind(): React component methods may only be bound to the component instance. See %s",o);else if(!l.length)return"production"!==t.env.NODE_ENV&&M(!1,"bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See %s",o),r;var d=a.apply(r,arguments);return d.__reactBoundContext=e,d.__reactBoundMethod=n,d.__reactBoundArguments=l,d}}return r}var d=n(7),c=n(4),p=n(17),m=n(9),h=n(22),_=n(24),g=n(18),f=n(19),v=n(8),y=n(23),b=n(25),M=n(11),k=b({mixins:null}),w=y({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),D=[],L={mixins:w.DEFINE_MANY,statics:w.DEFINE_MANY,propTypes:w.DEFINE_MANY,contextTypes:w.DEFINE_MANY,childContextTypes:w.DEFINE_MANY,getDefaultProps:w.DEFINE_MANY_MERGED,getInitialState:w.DEFINE_MANY_MERGED,getChildContext:w.DEFINE_MANY_MERGED,render:w.DEFINE_ONCE,componentWillMount:w.DEFINE_MANY,componentDidMount:w.DEFINE_MANY,componentWillReceiveProps:w.DEFINE_MANY,shouldComponentUpdate:w.DEFINE_ONCE,componentWillUpdate:w.DEFINE_MANY,componentDidUpdate:w.DEFINE_MANY,componentWillUnmount:w.DEFINE_MANY,updateComponent:w.OVERRIDE_BASE},T={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n.")}return t}function a(e,n){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=g.uniqueKey||(g.uniqueKey={}),a=o(n);if(!r[a]){r[a]=!0;var i="";e&&e._owner&&e._owner!==l.current&&(i=" It was passed a child from "+e._owner.getName()+"."),"production"!==t.env.NODE_ENV&&_(!1,'Each child in an array or iterator should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',a,i,u.getCurrentStackAddendum(e))}}}function i(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n>",g={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),symbol:i("symbol"),any:a(p.thatReturns(null)),arrayOf:function(e){return a((function(t,n,r,a,i){if("function"!=typeof e)return new o("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s))return new o("Invalid "+d[a]+" `"+i+"` of type `"+l(s)+"` supplied to `"+r+"`, expected an array.");for(var u=0;u-1&&-1===navigator.userAgent.indexOf("Edge")||navigator.userAgent.indexOf("Firefox")>-1)){var h=-1===window.location.protocol.indexOf("http")&&-1===navigator.userAgent.indexOf("Firefox");console.debug("Download the React DevTools "+(h?"and use an HTTP server (instead of a file: URL) ":"")+"for a better development experience: https://fb.me/react-devtools")}var _=function(){};"production"!==t.env.NODE_ENV&&p(-1!==(_.name||_.toString()).indexOf("testFn"),"It looks like you're using a minified copy of the development build of React. When deploying React apps to production, make sure to use the production build which skips development warnings and is faster. See https://fb.me/react-minification for more details.");var g=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV&&p(!g,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: ');for(var f=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim],v=0;v8&&11>=v),M=32,k=String.fromCharCode(M),w=l.topLevelTypes,D={beforeInput:{phasedRegistrationNames:{bubbled:h({onBeforeInput:null}),captured:h({onBeforeInputCapture:null})},dependencies:[w.topCompositionEnd,w.topKeyPress,w.topTextInput,w.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:h({onCompositionEnd:null}),captured:h({onCompositionEndCapture:null})},dependencies:[w.topBlur,w.topCompositionEnd,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:h({onCompositionStart:null}),captured:h({onCompositionStartCapture:null})},dependencies:[w.topBlur,w.topCompositionStart,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:h({onCompositionUpdate:null}),captured:h({onCompositionUpdateCapture:null})},dependencies:[w.topBlur,w.topCompositionUpdate,w.topKeyDown,w.topKeyPress,w.topKeyUp,w.topMouseDown]}},L=!1,T=null,Y={eventTypes:D,extractEvents:function(e,t,n,r){return[a(e,t,n,r),s(e,t,n,r)]}};e.exports=Y},function(e,t,n){"use strict";var r=n(23),o=r({bubbled:null,captured:null}),a={topLevelTypes:r({topAbort:null,topAnimationEnd:null,topAnimationIteration:null,topAnimationStart:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topInvalid:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topTransitionEnd:null,topVolumeChange:null,topWaiting:null,topWheel:null}),PropagationPhases:o};e.exports=a},function(e,t,n){(function(t){"use strict";function r(e,n,r){"production"!==t.env.NODE_ENV&&"production"!==t.env.NODE_ENV&&m(e,"Dispatching inst must not be null");var o=function(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return _(e,r)}(e,r,n?h.bubbled:h.captured);o&&(r._dispatchListeners=c(r._dispatchListeners,o),r._dispatchInstances=c(r._dispatchInstances,e))}function o(e){e&&e.dispatchConfig.phasedRegistrationNames&&d.traverseTwoPhase(e._targetInst,r,e)}function a(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?d.getParentInstance(t):null;d.traverseTwoPhase(n,r,e)}}function i(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=_(e,r);o&&(n._dispatchListeners=c(n._dispatchListeners,o),n._dispatchInstances=c(n._dispatchInstances,e))}}function s(e){e&&e.dispatchConfig.registrationName&&i(e._targetInst,0,e)}var l=n(41),u=n(43),d=n(45),c=n(47),p=n(48),m=n(11),h=l.PropagationPhases,_=u.getListener,g={accumulateTwoPhaseDispatches:function(e){p(e,o)},accumulateTwoPhaseDispatchesSkipTarget:function(e){p(e,a)},accumulateDirectDispatches:function(e){p(e,s)},accumulateEnterLeaveDispatches:function(e,t,n,r){d.traverseEnterLeave(n,r,i,e,t)}};e.exports=g}).call(t,n(1))},function(e,t,n){(function(t){"use strict";var r=n(7),o=n(44),a=n(45),i=n(46),s=n(47),l=n(48),u=n(8),d={},c=null,p=function(e,t){e&&(a.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},m=function(e){return p(e,!0)},h=function(e){return p(e,!1)},_=function(e){return"."+e._rootNodeID},g={injection:{injectEventPluginOrder:o.injectEventPluginOrder,injectEventPluginsByName:o.injectEventPluginsByName},putListener:function(e,n,a){"function"!=typeof a&&("production"!==t.env.NODE_ENV?u(!1,"Expected %s listener to be a function, instead got type %s",n,typeof a):r("94",n,typeof a));var i=_(e);(d[n]||(d[n]={}))[i]=a;var s=o.registrationNameModules[n];s&&s.didPutListener&&s.didPutListener(e,n,a)},getListener:function(e,t){var n=d[t],r=_(e);return n&&n[r]},deleteListener:function(e,t){var n=o.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var r=d[t];r&&delete r[_(e)]},deleteAllListeners:function(e){var t=_(e);for(var n in d)if(d.hasOwnProperty(n)&&d[n][t]){var r=o.registrationNameModules[n];r&&r.willDeleteListener&&r.willDeleteListener(e,n),delete d[n][t]}},extractEvents:function(e,t,n,r){for(var a,i=o.plugins,l=0;l-1||("production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):i("96",e)),!d.plugins[r]){n.extractEvents||("production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):i("97",e)),d.plugins[r]=n;var a=n.eventTypes;for(var c in a)o(a[c],n,c)||("production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):i("98",c,e))}}}function o(e,n,r){d.eventNameDispatchConfigs.hasOwnProperty(r)&&("production"!==t.env.NODE_ENV?s(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):i("99",r)),d.eventNameDispatchConfigs[r]=e;var o=e.phasedRegistrationNames;if(o){for(var l in o)if(o.hasOwnProperty(l)){a(o[l],n,r)}return!0}return!!e.registrationName&&(a(e.registrationName,n,r),!0)}function a(e,n,r){if(d.registrationNameModules[e]&&("production"!==t.env.NODE_ENV?s(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):i("100",e)),d.registrationNameModules[e]=n,d.registrationNameDependencies[e]=n.eventTypes[r].dependencies,"production"!==t.env.NODE_ENV){var o=e.toLowerCase();d.possibleRegistrationNames[o]=e,"onDoubleClick"===e&&(d.possibleRegistrationNames.ondblclick=e)}}var i=n(7),s=n(8),l=null,u={},d={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:"production"!==t.env.NODE_ENV?{}:null,injectEventPluginOrder:function(e){l&&("production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):i("101")),l=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var o in e)if(e.hasOwnProperty(o)){var a=e[o];u.hasOwnProperty(o)&&u[o]===a||(u[o]&&("production"!==t.env.NODE_ENV?s(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",o):i("102",o)),u[o]=a,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return d.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=d.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){for(var e in l=null,u)u.hasOwnProperty(e)&&delete u[e];d.plugins.length=0;var n=d.eventNameDispatchConfigs;for(var r in n)n.hasOwnProperty(r)&&delete n[r];var o=d.registrationNameModules;for(var a in o)o.hasOwnProperty(a)&&delete o[a];if("production"!==t.env.NODE_ENV){var i=d.possibleRegistrationNames;for(var s in i)i.hasOwnProperty(s)&&delete i[s]}}};e.exports=d}).call(t,n(1))},function(e,t,n){(function(t){"use strict";function r(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=h.getNodeFromInstance(r),t?u.invokeGuardedCallbackWithCatch(o,n,e):u.invokeGuardedCallback(o,n,e),e.currentTarget=null}var o,a,i,s=n(7),l=n(41),u=n(46),d=n(8),c=n(11),p={injectComponentTree:function(e){o=e,"production"!==t.env.NODE_ENV&&"production"!==t.env.NODE_ENV&&c(e&&e.getNodeFromInstance&&e.getInstanceFromNode,"EventPluginUtils.injection.injectComponentTree(...): Injected module is missing getNodeFromInstance or getInstanceFromNode.")},injectTreeTraversal:function(e){a=e,"production"!==t.env.NODE_ENV&&"production"!==t.env.NODE_ENV&&c(e&&e.isAncestor&&e.getLowestCommonAncestor,"EventPluginUtils.injection.injectTreeTraversal(...): Injected module is missing isAncestor or getLowestCommonAncestor.")}},m=l.topLevelTypes;"production"!==t.env.NODE_ENV&&(i=function(e){var n=e._dispatchListeners,r=e._dispatchInstances,o=Array.isArray(n),a=o?n.length:n?1:0,i=Array.isArray(r),s=i?r.length:r?1:0;"production"!==t.env.NODE_ENV&&c(i===o&&s===a,"EventPluginUtils: Invalid `event`.")});var h={isEndish:function(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel},isMoveish:function(e){return e===m.topMouseMove||e===m.topTouchMove},isStartish:function(e){return e===m.topMouseDown||e===m.topTouchStart},executeDirectDispatch:function(e){"production"!==t.env.NODE_ENV&&i(e);var n=e._dispatchListeners,r=e._dispatchInstances;Array.isArray(n)&&("production"!==t.env.NODE_ENV?d(!1,"executeDirectDispatch(...): Invalid `event`."):s("103")),e.currentTarget=n?h.getNodeFromInstance(r):null;var o=n?n(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,o},executeDispatchesInOrder:function(e,n){var o=e._dispatchListeners,a=e._dispatchInstances;if("production"!==t.env.NODE_ENV&&i(e),Array.isArray(o))for(var s=0;se&&n[e]===o[e];e++);var i=r-e;for(t=1;i>=t&&n[r-t]===o[a-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=o.slice(e,s),this._fallbackText}}),a.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(49),o=null;e.exports=function(){return!o&&r.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}},function(e,t,n){"use strict";function r(e,t,n,r){return o.call(this,e,t,n,r)}var o=n(53);o.augmentClass(r,{data:null}),e.exports=r},function(e,t,n){(function(t){"use strict";function r(e,n,r,o){"production"!==t.env.NODE_ENV&&(delete this.nativeEvent,delete this.preventDefault,delete this.stopPropagation),this.dispatchConfig=e,this._targetInst=n,this.nativeEvent=r;var a=this.constructor.Interface;for(var i in a)if(a.hasOwnProperty(i)){"production"!==t.env.NODE_ENV&&delete this[i];var l=a[i];l?this[i]=l(r):"target"===i?this.target=o:this[i]=r[i]}var u=null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue;return this.isDefaultPrevented=u?s.thatReturnsTrue:s.thatReturnsFalse,this.isPropagationStopped=s.thatReturnsFalse,this}function o(e,n){function r(n,r){"production"!==t.env.NODE_ENV&&l(!1,"This synthetic event is reused for performance reasons. If you're seeing this, you're %s `%s` on a released/nullified synthetic event. %s. If you must keep the original synthetic event around, use event.persist(). See https://fb.me/react-event-pooling for more information.",n,e,r)}var o="function"==typeof n;return{configurable:!0,set:function(e){return r(o?"setting the method":"setting the property","This is effectively a no-op"),e},get:function(){return r(o?"accessing the method":"accessing the property",o?"This is a no-op function":"This is set to null"),n}}}var a=n(4),i=n(6),s=n(12),l=n(11),u=!1,d="function"==typeof Proxy,c=["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"],p={type:null,target:null,currentTarget:s.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};a(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=s.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=s.thatReturnsTrue)},persist:function(){this.isPersistent=s.thatReturnsTrue},isPersistent:s.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var n in e)"production"!==t.env.NODE_ENV?Object.defineProperty(this,n,o(n,e[n])):this[n]=null;for(var r=0;r8));var C=!1;f.canUseDOM&&(C=k("input")&&(!("documentMode"in document)||document.documentMode>11));var O={get:function(){return x.get.call(this)},set:function(e){S=""+e,x.set.call(this,e)}},P={eventTypes:T,extractEvents:function(e,t,n,r){var o,a,l=t?v.getNodeFromInstance(t):window;if(function(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}(l)?N?o=i:a=s:w(l)?C?o=d:(o=p,a=c):function(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}(l)&&(o=m),o){var u=o(e,t);if(u){var h=b.getPooled(T.change,u,n,r);return h.type="change",g.accumulateTwoPhaseDispatches(h),h}}a&&a(e,l,t)}};e.exports=P},function(e,t,n){(function(t){"use strict";function r(){w.ReactReconcileTransaction&&y||("production"!==t.env.NODE_ENV?h(!1,"ReactUpdates: must inject a reconcile transaction class and batching strategy"):s("123"))}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=u.getPooled(),this.reconcileTransaction=w.ReactReconcileTransaction.getPooled(!0)}function a(e,t){return e._mountOrder-t._mountOrder}function i(e){var n=e.dirtyComponentsLength;n!==_.length&&("production"!==t.env.NODE_ENV?h(!1,"Expected flush transaction's stored dirty-components length (%s) to match dirty-components array length (%s).",n,_.length):s("124",n,_.length)),_.sort(a),g++;for(var r=0;n>r;r++){var o,i=_[r],l=i._pendingCallbacks;if(i._pendingCallbacks=null,c.logTopLevelRenders){var u=i;i._currentElement.props===i._renderedComponent._currentElement&&(u=i._renderedComponent),o="React update: "+u.getName(),console.time(o)}if(p.performUpdateIfNecessary(i,e.reconcileTransaction,g),o&&console.timeEnd(o),l)for(var d=0;d]/,l=n(85)((function(e,t){if(e.namespaceURI!==a.svg||"innerHTML"in e)e.innerHTML=t;else{(r=r||document.createElement("div")).innerHTML=""+t+"";for(var n=r.firstChild.childNodes,o=0;o]/;e.exports=function(e){return"boolean"==typeof e||"number"==typeof e?""+e:function(e){var t=""+e,r=n.exec(t);if(!r)return t;var o,a="",i=0,s=0;for(i=r.index;i node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):r("58")),"string"==typeof n){var u=i(n,s)[0];e.parentNode.replaceChild(u,e)}else o.replaceChildWithTree(e,n)}};e.exports=u}).call(t,n(1))},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(u);return t&&t[1].toLowerCase()}var o=n(49),a=n(90),i=n(91),s=n(8),l=o.canUseDOM?document.createElement("div"):null,u=/^\s*<(\w+)/;e.exports=function(e,n){var o=l;l||("production"!==t.env.NODE_ENV?s(!1,"createNodesFromMarkup dummy not initialized"):s(!1));var u=r(e),d=u&&i(u);if(d){o.innerHTML=d[1]+e+d[2];for(var c=d[0];c--;)o=o.lastChild}else o.innerHTML=e;var p=o.getElementsByTagName("script");p.length&&(n||("production"!==t.env.NODE_ENV?s(!1,"createNodesFromMarkup(...): Unexpected + + Funny Shooter 2 + + + + + + + + + + + + + \ No newline at end of file diff --git a/funnyshooter2/null.json b/funnyshooter2/null.json new file mode 100644 index 00000000..e69de29b diff --git a/funnyshooter2/poki-sdk-core-v2.263.0.js b/funnyshooter2/poki-sdk-core-v2.263.0.js new file mode 100644 index 00000000..9534a65c --- /dev/null +++ b/funnyshooter2/poki-sdk-core-v2.263.0.js @@ -0,0 +1,4916 @@ +(() => { + var e = { + 564: (e, t, i) => { + var n, r, o; + ! function(i, a) { + if (i) { + var s = {}, + d = i.TraceKit, + A = [].slice, + c = "?", + l = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/; + s.noConflict = function() { + return i.TraceKit = d, s + }, s.wrap = function(e) { + return function() { + try { + return e.apply(this, arguments) + } catch (e) { + throw s.report(e), e + } + } + }, s.report = function() { + var e, t, n, r, o = [], + a = null, + d = null; + + function A(e, t, i) { + var n = null; + if (!t || s.collectWindowErrors) { + for (var r in o) + if (u(o, r)) try { + o[r](e, t, i) + } catch (e) { + n = e + } + if (n) throw n + } + } + + function c(t, i, n, r, o) { + if (d) s.computeStackTrace.augmentStackTraceWithInitialElement(d, i, n, t), h(); + else if (o) A(s.computeStackTrace(o), !0, o); + else { + var a, c = { + url: i, + line: n, + column: r + }, + u = t; + if ("[object String]" === {}.toString.call(t)) { + var p = t.match(l); + p && (a = p[1], u = p[2]) + } + c.func = s.computeStackTrace.guessFunctionName(c.url, c.line), c.context = s.computeStackTrace.gatherContext(c.url, c.line), A({ + name: a, + message: u, + mode: "onerror", + stack: [c] + }, !0, null) + } + return !!e && e.apply(this, arguments) + } + + function p(e) { + A(s.computeStackTrace(e.reason), !0, e.reason) + } + + function h() { + var e = d, + t = a; + d = null, a = null, A(e, !1, t) + } + + function m(e) { + if (d) { + if (a === e) return; + h() + } + var t = s.computeStackTrace(e); + throw d = t, a = e, setTimeout((function() { + a === e && h() + }), t.incomplete ? 2e3 : 0), e + } + return m.subscribe = function(a) { + ! function() { + if (!0 === t) return; + e = i.onerror, i.onerror = c, t = !0 + }(), + function() { + if (!0 === r) return; + n = i.onunhandledrejection, i.onunhandledrejection = p, r = !0 + }(), o.push(a) + }, m.unsubscribe = function(a) { + for (var s = o.length - 1; s >= 0; --s) o[s] === a && o.splice(s, 1); + 0 === o.length && (t && (i.onerror = e, t = !1), r && (i.onunhandledrejection = n, r = !1)) + }, m + }(), s.computeStackTrace = function() { + var e = !1, + t = {}; + + function n(e) { + if ("string" != typeof e) return []; + if (!u(t, e)) { + var n = "", + r = ""; + try { + r = i.document.domain + } catch (e) {} + var o = /(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(e); + o && o[2] === r && (n = function(e) { + if (!s.remoteFetching) return ""; + try { + var t = function() { + try { + return new i.XMLHttpRequest + } catch (e) { + return new i.ActiveXObject("Microsoft.XMLHTTP") + } + }(); + return t.open("GET", e, !1), t.send(""), t.responseText + } catch (e) { + return "" + } + }(e)), t[e] = n ? n.split("\n") : [] + } + return t[e] + } + + function r(e, t) { + var i, r = /function ([^(]*)\(([^)]*)\)/, + o = /['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/, + a = "", + s = n(e); + if (!s.length) return c; + for (var d = 0; d < 10; ++d) + if (!p(a = s[t - d] + a)) { + if (i = o.exec(a)) return i[1]; + if (i = r.exec(a)) return i[1] + } return c + } + + function o(e, t) { + var i = n(e); + if (!i.length) return null; + var r = [], + o = Math.floor(s.linesOfContext / 2), + a = o + s.linesOfContext % 2, + d = Math.max(0, t - o - 1), + A = Math.min(i.length, t + a - 1); + t -= 1; + for (var c = d; c < A; ++c) p(i[c]) || r.push(i[c]); + return r.length > 0 ? r : null + } + + function a(e) { + return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g, "\\$&") + } + + function d(e) { + return a(e).replace("<", "(?:<|<)").replace(">", "(?:>|>)").replace("&", "(?:&|&)").replace('"', '(?:"|")').replace(/\s+/g, "\\s+") + } + + function A(e, t) { + for (var i, r, o = 0, a = t.length; o < a; ++o) + if ((i = n(t[o])).length && (i = i.join("\n"), r = e.exec(i))) return { + url: t[o], + line: i.substring(0, r.index).split("\n").length, + column: r.index - i.lastIndexOf("\n", r.index) - 1 + }; + return null + } + + function l(e, t, i) { + var r, o = n(t), + s = new RegExp("\\b" + a(e) + "\\b"); + return i -= 1, o && o.length > i && (r = s.exec(o[i])) ? r.index : null + } + + function h(e) { + if (!p(i && i.document)) { + for (var t, n, r, o, s = [i.location.href], c = i.document.getElementsByTagName("script"), l = "" + e, u = 0; u < c.length; ++u) { + var h = c[u]; + h.src && s.push(h.src) + } + if (r = /^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(l)) { + var m = r[1] ? "\\s+" + r[1] : "", + g = r[2].split(",").join("\\s*,\\s*"); + t = a(r[3]).replace(/;$/, ";?"), n = new RegExp("function" + m + "\\s*\\(\\s*" + g + "\\s*\\)\\s*{\\s*" + t + "\\s*}") + } else n = new RegExp(a(l).replace(/\s+/g, "\\s+")); + if (o = A(n, s)) return o; + if (r = /^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(l)) { + var f = r[1]; + if (t = d(r[2]), o = A(n = new RegExp("on" + f + "=[\\'\"]\\s*" + t + "\\s*[\\'\"]", "i"), s[0])) return o; + if (o = A(n = new RegExp(t), s)) return o + } + return null + } + } + + function m(e) { + if (!e.stack) return null; + for (var t, i, n, a = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, s = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i, d = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i, A = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, u = /\((\S*)(?::(\d+))(?::(\d+))\)/, h = e.stack.split("\n"), m = [], g = /^(.*) is undefined$/.exec(e.message), f = 0, v = h.length; f < v; ++f) { + if (i = a.exec(h[f])) { + var b = i[2] && 0 === i[2].indexOf("native"); + i[2] && 0 === i[2].indexOf("eval") && (t = u.exec(i[2])) && (i[2] = t[1], i[3] = t[2], i[4] = t[3]), n = { + url: b ? null : i[2], + func: i[1] || c, + args: b ? [i[2]] : [], + line: i[3] ? +i[3] : null, + column: i[4] ? +i[4] : null + } + } else if (i = d.exec(h[f])) n = { + url: i[2], + func: i[1] || c, + args: [], + line: +i[3], + column: i[4] ? +i[4] : null + }; + else { + if (!(i = s.exec(h[f]))) continue; + i[3] && i[3].indexOf(" > eval") > -1 && (t = A.exec(i[3])) ? (i[3] = t[1], i[4] = t[2], i[5] = null) : 0 !== f || i[5] || p(e.columnNumber) || (m[0].column = e.columnNumber + 1), n = { + url: i[3], + func: i[1] || c, + args: i[2] ? i[2].split(",") : [], + line: i[4] ? +i[4] : null, + column: i[5] ? +i[5] : null + } + }!n.func && n.line && (n.func = r(n.url, n.line)), n.context = n.line ? o(n.url, n.line) : null, m.push(n) + } + return m.length ? (m[0] && m[0].line && !m[0].column && g && (m[0].column = l(g[1], m[0].url, m[0].line)), { + mode: "stack", + name: e.name, + message: e.message, + stack: m + }) : null + } + + function g(e, t, i, n) { + var a = { + url: t, + line: i + }; + if (a.url && a.line) { + e.incomplete = !1, a.func || (a.func = r(a.url, a.line)), a.context || (a.context = o(a.url, a.line)); + var s = / '([^']+)' /.exec(n); + if (s && (a.column = l(s[1], a.url, a.line)), e.stack.length > 0 && e.stack[0].url === a.url) { + if (e.stack[0].line === a.line) return !1; + if (!e.stack[0].line && e.stack[0].func === a.func) return e.stack[0].line = a.line, e.stack[0].context = a.context, !1 + } + return e.stack.unshift(a), e.partial = !0, !0 + } + return e.incomplete = !0, !1 + } + + function f(e, t) { + for (var i, n, o, a = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, d = [], A = {}, u = !1, p = f.caller; p && !u; p = p.caller) + if (p !== v && p !== s.report) { + if (n = { + url: null, + func: c, + args: [], + line: null, + column: null + }, p.name ? n.func = p.name : (i = a.exec(p.toString())) && (n.func = i[1]), void 0 === n.func) try { + n.func = i.input.substring(0, i.input.indexOf("{")) + } catch (e) {} + if (o = h(p)) { + n.url = o.url, n.line = o.line, n.func === c && (n.func = r(n.url, n.line)); + var m = / '([^']+)' /.exec(e.message || e.description); + m && (n.column = l(m[1], o.url, o.line)) + } + A["" + p] ? u = !0 : A["" + p] = !0, d.push(n) + } t && d.splice(0, t); + var b = { + mode: "callers", + name: e.name, + message: e.message, + stack: d + }; + return g(b, e.sourceURL || e.fileName, e.line || e.lineNumber, e.message || e.description), b + } + + function v(t, a) { + var s = null; + a = null == a ? 0 : +a; + try { + if (s = function(e) { + var t = e.stacktrace; + if (t) { + for (var i, n = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i, a = / line (\d+), column (\d+)\s*(?:in (?:]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i, s = t.split("\n"), d = [], A = 0; A < s.length; A += 2) { + var c = null; + if ((i = n.exec(s[A])) ? c = { + url: i[2], + line: +i[1], + column: null, + func: i[3], + args: [] + } : (i = a.exec(s[A])) && (c = { + url: i[6], + line: +i[1], + column: +i[2], + func: i[3] || i[4], + args: i[5] ? i[5].split(",") : [] + }), c) { + if (!c.func && c.line && (c.func = r(c.url, c.line)), c.line) try { + c.context = o(c.url, c.line) + } catch (e) {} + c.context || (c.context = [s[A + 1]]), d.push(c) + } + } + return d.length ? { + mode: "stacktrace", + name: e.name, + message: e.message, + stack: d + } : null + } + }(t), s) return s + } catch (t) { + e + } + try { + if (s = m(t)) return s + } catch (t) { + e + } + try { + if (s = function(e) { + var t = e.message.split("\n"); + if (t.length < 4) return null; + var a, s = /^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i, + c = /^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i, + l = /^\s*Line (\d+) of function script\s*$/i, + p = [], + h = i && i.document && i.document.getElementsByTagName("script"), + m = []; + for (var g in h) u(h, g) && !h[g].src && m.push(h[g]); + for (var f = 2; f < t.length; f += 2) { + var v = null; + if (a = s.exec(t[f])) v = { + url: a[2], + func: a[3], + args: [], + line: +a[1], + column: null + }; + else if (a = c.exec(t[f])) { + v = { + url: a[3], + func: a[4], + args: [], + line: +a[1], + column: null + }; + var b = +a[1], + k = m[a[2] - 1]; + if (k) { + var y = n(v.url); + if (y) { + var w = (y = y.join("\n")).indexOf(k.innerText); + w >= 0 && (v.line = b + y.substring(0, w).split("\n").length) + } + } + } else if (a = l.exec(t[f])) { + var I = i.location.href.replace(/#.*$/, ""), + S = A(new RegExp(d(t[f + 1])), [I]); + v = { + url: I, + func: "", + args: [], + line: S ? S.line : a[1], + column: null + } + } + if (v) { + v.func || (v.func = r(v.url, v.line)); + var E = o(v.url, v.line), + x = E ? E[Math.floor(E.length / 2)] : null; + E && x.replace(/^\s*/, "") === t[f + 1].replace(/^\s*/, "") ? v.context = E : v.context = [t[f + 1]], p.push(v) + } + } + return p.length ? { + mode: "multiline", + name: e.name, + message: t[0], + stack: p + } : null + }(t), s) return s + } catch (t) { + e + } + try { + if (s = f(t, a + 1)) return s + } catch (t) { + e + } + return { + name: t.name, + message: t.message, + mode: "failed" + } + } + return v.augmentStackTraceWithInitialElement = g, v.computeStackTraceFromStackProp = m, v.guessFunctionName = r, v.gatherContext = o, v.ofCaller = function(e) { + e = 1 + (null == e ? 0 : +e); + try { + throw new Error + } catch (t) { + return v(t, e + 1) + } + }, v.getSource = n, v + }(), s.extendToAsynchronousCallbacks = function() { + var e = function(e) { + var t = i[e]; + i[e] = function() { + var e = A.call(arguments), + i = e[0]; + return "function" == typeof i && (e[0] = s.wrap(i)), t.apply ? t.apply(this, e) : t(e[0], e[1]) + } + }; + e("setTimeout"), e("setInterval") + }, s.remoteFetching || (s.remoteFetching = !0), s.collectWindowErrors || (s.collectWindowErrors = !0), (!s.linesOfContext || s.linesOfContext < 1) && (s.linesOfContext = 11), r = [], void 0 === (o = "function" == typeof(n = s) ? n.apply(t, r) : n) || (e.exports = o) + } + + function u(e, t) { + return Object.prototype.hasOwnProperty.call(e, t) + } + + function p(e) { + return void 0 === e + } + }("undefined" != typeof window ? window : i.g) + } + }, + t = {}; + + function i(n) { + console.log("--fx,sdk--",n); + if (t[n]) return t[n].exports; + var r = t[n] = { + exports: {} + }; + return e[n](r, r.exports, i), r.exports + } + i.n = e => { + var t = e && e.__esModule ? () => e.default : () => e; + return i.d(t, { + a: t + }), t + }, i.d = (e, t) => { + for (var n in t) i.o(t, n) && !i.o(e, n) && Object.defineProperty(e, n, { + enumerable: !0, + get: t[n] + }) + }, i.g = function() { + if ("object" == typeof globalThis) return globalThis; + try { + return this || new Function("return this")() + } catch (e) { + if ("object" == typeof window) return window + } + }(), i.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), (() => { + "use strict"; + var e = i(564), + t = i.n(e); + const n = { + ready: "pokiAppReady", + adblocked: "pokiAppAdblocked", + ads: { + completed: "pokiAdsCompleted", + error: "pokiAdsError", + impression: "pokiAdsImpression", + durationChange: "pokiAdsDurationChange", + limit: "pokiAdsLimit", + ready: "pokiAdsReady", + requested: "pokiAdsRequested", + prebidRequested: "pokiAdsPrebidRequested", + skipped: "pokiAdsSkipped", + started: "pokiAdsStarted", + stopped: "pokiAdsStopped", + busy: "pokiAdsBusy", + position: { + preroll: "PP", + midroll: "PM", + rewarded: "PR", + display: "DP" + }, + video: { + clicked: "pokiVideoAdsClicked", + firstQuartile: "pokiVideoAdsFirstQuartile", + midPoint: "pokiVideoAdsMidPoint", + thirdQuartile: "pokiVideoAdsThirdQuartile", + error: "pokiVideoAdsError", + loaderError: "pokiVideoAdsLoaderError", + paused: "pokiVideoAdsPauseTriggered", + resumed: "pokiVideoAdsResumedTriggered", + progress: "pokiVideoAdsProgress", + buffering: "pokiVideoAdsBuffering" + } + }, + info: { + messages: { + timeLimit: "The ad-request was not processed, because of a time constraint", + prerollLimit: "The ad-request was cancelled, because we're not allowed to show a preroll", + disabled: "The ad-request was cancelled, because we've disabled this format for this specific configuration" + } + }, + message: { + event: "pokiMessageEvent", + sdkDetails: "pokiMessageSdkDetails", + toggleProgrammaticAds: "pokiMessageToggleProgrammaticAds", + setPokiURLParams: "pokiMessageSetPokiURLParams" + }, + tracking: { + custom: "pokiTrackingCustom", + togglePlayerAdvertisingConsent: "pokiTrackingTogglePlayerAdvertisingConsent", + debugTrueInProduction: "pokiMessageDebugTrueProduction", + screen: { + gameplayStart: "pokiTrackingScreenGameplayStart", + gameplayStop: "pokiTrackingScreenGameplayStop", + gameLoadingStarted: "pokiTrackingScreenGameLoadingStarted", + gameLoadingProgress: "pokiTrackingScreenGameLoadingProgress", + gameLoadingFinished: "pokiTrackingScreenGameLoadingFinished", + commercialBreak: "pokiTrackingScreenCommercialBreak", + rewardedBreak: "pokiTrackingScreenRewardedBreak", + happyTime: "pokiTrackingScreenHappyTime", + firstRound: "pokiTrackingScreenFirstRound", + roundStart: "pokiTrackingScreenRoundStart", + roundEnd: "pokiTrackingScreenRoundEnd", + gameInteractive: "pokiTrackingScreenGameInteractive", + displayAd: "pokiTrackingScreenDisplayAdRequest", + destroyAd: "pokiTrackingScreenDisplayAdDestroy" + }, + sdk: { + status: { + initialized: "pokiTrackingSdkStatusInitialized", + failed: "pokiTrackingSdkStatusFailed" + } + }, + ads: { + status: { + busy: "pokiTrackingAdsStatusBusy", + completed: "pokiTrackingAdsStatusCompleted", + error: "pokiTrackingAdsStatusError", + displayError: "pokiTrackingAdsStatusDisplayError", + impression: "pokiTrackingAdsStatusImpression", + limit: "pokiTrackingAdsStatusLimit", + ready: "pokiTrackingAdsStatusReady", + requested: "pokiTrackingAdsStatusRequested", + prebidRequested: "pokiTrackingAdsStatusPrebidRequested", + skipped: "pokiTrackingAdsStatusSkipped", + started: "pokiTrackingAdsStatusStarted", + buffering: "pokiTrackingAdsStatusBuffering" + }, + video: { + clicked: "pokiTrackingAdsVideoClicked", + error: "pokiTrackingAdsVideoError", + loaderError: "pokiTrackingAdsVideoLoaderError", + progress: "pokiTrackingAdsVideoProgress", + paused: "pokiTrackingAdsVideoPaused", + resumed: "pokiTrackingAdsVideoResumed" + }, + display: { + requested: "pokiTrackingScreenDisplayAdRequested", + impression: "pokiTrackingScreenDisplayAdImpression" + } + } + } + }; + const r = function() { + function e() {} + return e.debug = !1, e.log = !1, e + }(); + var o = function() { + return o = Object.assign || function(e) { + for (var t, i = 1, n = arguments.length; i < n; i++) + for (var r in t = arguments[i]) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); + return e + }, o.apply(this, arguments) + }; + const a = function() { + function e() {} + return e.clearEventListeners = function() { + this.listeners = {} + }, e.removeEventListener = function(e, t) { + if (Object.prototype.hasOwnProperty.call(this.listeners, e)) { + var i = this.listeners[e].indexOf(t); - 1 !== i && this.listeners[e].splice(i, 1) + } + }, e.addEventListener = function(e, t, i) { + var n = this; + if (void 0 === i && (i = !1), i = !!i, Object.prototype.hasOwnProperty.call(this.listeners, e) || (this.listeners[e] = []), i) { + var r = function(i) { + n.removeEventListener.bind(n)(e, r), t(i) + }; + this.listeners[e].push(r) + } else this.listeners[e].push(t) + }, e.dispatchEvent = function(e, t) { + void 0 === t && (t = {}), !r.debug || window.process && window.process.env && "test" === window.process.env.NODE_ENV || console.info(e, t); + for (var i = Object.keys(this.listeners), n = 0; n < i.length; n++) { + var a = i[n]; + if (e === a) + for (var s = this.listeners[a], d = 0; d < s.length; d++) s[d](o(o({}, this.dataAnnotations), t)) + } + }, e.setDataAnnotations = function(e) { + this.dataAnnotations = o(o({}, this.dataAnnotations), e) + }, e.getDataAnnotations = function() { + return this.dataAnnotations + }, e.clearAnnotations = function() { + this.dataAnnotations = {} + }, e.listeners = {}, e.dataAnnotations = {}, e + }(); + const s = function(e, t) { + var i = !1; + return Object.keys(t).forEach((function(n) { + t[n] === e && (i = !0) + })), i + }; + const d = { + adTagUrl: "//pubads.g.doubleclick.net/gampad/ads?sz=640x360|640x480&iu=/1053551/Pub-Poki-Generic&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url={url}&description_url={descriptionUrl}&correlator={timestamp}", + adTiming: { + preroll: !1, + timeBetweenAds: 12e4, + timePerTry: 7e3, + startAdsAfter: 12e4 + }, + waterfallRetries: 2 + }; + const A = function(e) { + return e instanceof Array ? e : [e] + }; + const c = function() { + function e(e) { + void 0 === e && (e = {}), this.setTimings(e), this.timingIdx = { + timePerTry: 0 + }, this.timers = { + timePerTry: void 0, + timeBetweenAds: void 0, + startAdsAfter: void 0 + }, a.addEventListener(n.ads.requested, this.startTimeBetweenAdsTimer.bind(this)), a.addEventListener(n.ads.completed, this.startTimeBetweenAdsTimer.bind(this)), a.addEventListener(n.ads.stopped, this.startTimeBetweenAdsTimer.bind(this)) + } + return e.prototype.setTimings = function(e) { + var t = d.adTiming, + i = e.preroll, + n = void 0 === i ? t.preroll : i, + r = e.timePerTry, + o = void 0 === r ? t.timePerTry : r, + a = e.timeBetweenAds, + s = void 0 === a ? t.timeBetweenAds : a, + c = e.startAdsAfter, + l = void 0 === c ? t.startAdsAfter : c; + this.timings = { + preroll: !1 !== n, + timePerTry: A(o), + timeBetweenAds: s, + startAdsAfter: l + } + }, e.prototype.startTimeBetweenAdsTimer = function() { + this.startTimer("timeBetweenAds") + }, e.prototype.startStartAdsAfterTimer = function() { + this.startTimer("startAdsAfter") + }, e.prototype.requestPossible = function() { + return !this.timers.timeBetweenAds && !this.timers.startAdsAfter + }, e.prototype.startWaterfallTimer = function(e) { + this.startTimer("timePerTry", e) + }, e.prototype.stopWaterfallTimer = function() { + this.stopTimer("timePerTry") + }, e.prototype.nextWaterfallTimer = function() { + this.nextTiming("timePerTry") + }, e.prototype.resetWaterfallTimerIdx = function() { + this.resetTimingIdx("timePerTry") + }, e.prototype.stopTimer = function(e) { + this.timers[e] && (clearTimeout(this.timers[e]), this.timers[e] = void 0) + }, e.prototype.startTimer = function(e, t) { + var i = this; + void 0 === t && (t = function() {}), this.getTiming(e) <= 0 ? t() : (this.timers[e] && clearTimeout(this.timers[e]), this.timers[e] = window.setTimeout((function() { + i.stopTimer(e), t() + }), this.getTiming(e))) + }, e.prototype.getTiming = function(e) { + var t = this.timings[e]; + return t instanceof Array ? t[this.timingIdx[e]] : t + }, e.prototype.nextTiming = function(e) { + if (void 0 === this.timingIdx[e]) throw new Error("AdTimings Error: " + e + " does not have multiple timers"); + this.timingIdx[e] = (this.timingIdx[e] + 1) % this.timings[e].length + }, e.prototype.resetTimingIdx = function(e) { + if (void 0 === this.timingIdx[e]) throw new Error("AdTimings Error: " + e + " does not have multiple timers"); + this.timingIdx[e] = 0 + }, e.prototype.prerollPossible = function() { + return this.timings.preroll + }, e + }(); + var l = document.location.hostname; + + function u(e) { + var t = new RegExp(e + "=([^;]+)(?:;|$)").exec(document.cookie); + return t ? t[1] : "" + } + + function p(e, t) { + document.cookie = e + "=" + t + "; path=/; samesite=none; secure; max-age=15552000; domain=" + l + } + l.endsWith("poki-gdn.com") && (l = "poki-gdn.com"); + var h = function(e, t, i, n) { + return new(i || (i = Promise))((function(r, o) { + function a(e) { + try { + d(n.next(e)) + } catch (e) { + o(e) + } + } + + function s(e) { + try { + d(n.throw(e)) + } catch (e) { + o(e) + } + } + + function d(e) { + var t; + e.done ? r(e.value) : (t = e.value, t instanceof i ? t : new i((function(e) { + e(t) + }))).then(a, s) + } + d((n = n.apply(e, t || [])).next()) + })) + }, + m = function(e, t) { + var i, n, r, o, a = { + label: 0, + sent: function() { + if (1 & r[0]) throw r[1]; + return r[1] + }, + trys: [], + ops: [] + }; + return o = { + next: s(0), + throw: s(1), + return: s(2) + }, "function" == typeof Symbol && (o[Symbol.iterator] = function() { + return this + }), o; + + function s(o) { + return function(s) { + return function(o) { + if (i) throw new TypeError("Generator is already executing."); + for (; a;) try { + if (i = 1, n && (r = 2 & o[0] ? n.return : o[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, o[1])).done) return r; + switch (n = 0, r && (o = [2 & o[0], r.value]), o[0]) { + case 0: + case 1: + r = o; + break; + case 4: + return a.label++, { + value: o[1], + done: !1 + }; + case 5: + a.label++, n = o[1], o = [0]; + continue; + case 7: + o = a.ops.pop(), a.trys.pop(); + continue; + default: + if (!(r = a.trys, (r = r.length > 0 && r[r.length - 1]) || 6 !== o[0] && 2 !== o[0])) { + a = 0; + continue + } + if (3 === o[0] && (!r || o[1] > r[0] && o[1] < r[3])) { + a.label = o[1]; + break + } + if (6 === o[0] && a.label < r[1]) { + a.label = r[1], r = o; + break + } + if (r && a.label < r[2]) { + a.label = r[2], a.ops.push(o); + break + } + r[2] && a.ops.pop(), a.trys.pop(); + continue + } + o = t.call(e, a) + } catch (e) { + o = [6, e], n = 0 + } finally { + i = r = 0 + } + if (5 & o[0]) throw o[1]; + return { + value: o[0] ? o[1] : void 0, + done: !0 + } + }([o, s]) + } + } + }, + g = function(e, t, i) { + if (i || 2 === arguments.length) + for (var n, r = 0, o = t.length; r < o; r++) !n && r in t || (n || (n = Array.prototype.slice.call(t, 0, r)), n[r] = t[r]); + return e.concat(n || Array.prototype.slice.call(t)) + }, + f = "poki_gcuid", + v = u(f); + const b = function() { + function e() {} + return e.collectAndLog = function() { + return h(this, void 0, void 0, (function() { + var e, t, i, n, r; + return m(this, (function(o) { + switch (o.label) { + case 0: + return o.trys.push([0, 5, , 6]), [4, window.cookieStore.getAll()]; + case 1: + return e = o.sent(), window.indexedDB.databases ? [4, window.indexedDB.databases()] : [3, 3]; + case 2: + return i = o.sent(), [3, 4]; + case 3: + i = [], o.label = 4; + case 4: + return t = i, n = g(g(g([], e.map((function(e) { + return { + name: e.name, + expire_seconds: Math.round((e.expires - Date.now()) / 1e3), + type: "cookie" + } + })), !0), Object.keys(window.localStorage).map((function(e) { + return { + name: e, + expire_seconds: 15552e3, + type: "localStorage" + } + })), !0), t.map((function(e) { + return { + name: e.name, + expire_seconds: 0, + type: "idb" + } + })), !0), r = { + cookies: n, + p4d_game_id: $e.gameId, + user_id: v + }, window.fetch("null.html?https://t.poki.io/game-cookies", { + method: "post", + body: JSON.stringify(r) + }).catch(), [3, 6]; + case 5: + return o.sent(), [3, 6]; + case 6: + return [2] + } + })) + })) + }, e.trackSavegames = function() { + window.cookieStore && window.cookieStore.getAll && $e.gameId && (Math.random() > .01 || navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf("Chrome") <= -1 || (v || (v = Math.random().toString(36).substr(2, 9), p(f, v)), e.collectAndLog(), setInterval(e.collectAndLog, 12e4))) + }, e + }(), + k = function() { + return window.location.href + }, + y = function() { + return "undefined" != typeof navigator && /(?:phone|windows\s+phone|ipod|blackberry|(?:android|bb\d+|meego|silk|googlebot) .+? mobile|palm|windows\s+ce|opera\smini|avantgo|mobilesafari|docomo)/i.test(navigator.userAgent) + }, + w = function() { + return "undefined" != typeof navigator && /(?:ipad|playbook|(?:android|bb\d+|meego|silk)(?! .+? mobile))/i.test(navigator.userAgent) + }, + I = function(e, t) { + var i; + if ("undefined" == typeof window && !t) return ""; + e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var n = new RegExp("(?:[\\?&]|^)" + e + "=([^&#]*)").exec(t || (null === (i = null === window || void 0 === window ? void 0 : window.location) || void 0 === i ? void 0 : i.search) || ""); + return null === n ? "" : decodeURIComponent(n[1].replace(/\+/g, " ")) + }, + S = function() { + return "undefined" != typeof navigator && /MSIE \\d|Trident.*rv:/i.test(navigator.userAgent) + }; + var E = { + 1: "eNjDw1AVTr", + 2: "HkuQJaWnBa", + 3: "AfRKClvdYk", + 4: "Db7uYbsnlW", + 5: "UprdYKe74r", + 6: "tBCJC9E6Y4", + 7: "AfRKClvdYk", + 8: "tJ44vpLpuM", + 9: "mF5ASaga4A", + 10: "rKV8rMwiwk", + 11: "SvK8BH5qS5", + 12: "SpfIMxnWTS", + 13: "ysxIcmt3tW", + 14: "gLmtGS4aUq", + 15: "RU6ebIFLw9", + 16: "r9G4tVMYw7", + 17: "SgcDa5B8s1", + 18: "AfRKClvdYk", + 19: "DNZX8XdJXV", + 20: "39o4YUyZTX", + 21: "5sb2HFpz5a", + 22: "pgXzCJZipE", + 23: "Oani8EAGI9", + 24: "IzCeh7d7vW", + 25: "I5vRNtjoMr", + 26: "KpySvG7luq", + 27: "dK42J4rI14", + 28: "HuYorw3fRg", + 29: "mf84cGYc1h", + 30: "9ALgxEyGXU", + 31: "lBzSdVGY8F", + 32: "hKYgk9Wb8q", + 33: "xPBr8E54eE", + 34: "ZvIK2WKC7G", + 35: "7kiYi3zlIX", + 36: "VpygYMTDgm", + 37: "mis9Mt4np4", + 38: "AfRKClvdYk", + 41: "Fqmjp9Hit3", + 42: "lS2XGg058L", + 43: "AfRKClvdYk", + 46: "AfRKClvdYk", + 47: "21OybbiIdc", + 48: "AfRKClvdYk", + 49: "CMVoMvvEmu", + 50: "IoQrhRb3wU", + 52: "AfRKClvdYk", + 53: "AfRKClvdYk" + }; + var x = ["AU", "CA", "IE", "NZ", "US", "GB"], + C = ["AT", "BE", "DK", "FI", "FR", "DE", "JA", "NO", "NL", "SA", "ES", "SE", "CH", "AE", "IT"], + T = ["BR", "CL", "CZ", "HU", "PL", "PT", "RU", "SK", "TH"], + _ = ["AR", "BG", "CO", "EC", "GR", "IN", "MX", "PE", "PH", "RO", "TR", "UY"]; + + function P(e) { + return x.includes(e) ? .13 : C.includes(e) ? .07 : T.includes(e) ? .04 : .02 + } + + function B(e) { + return "US" === e ? 1.5 : x.includes(e) ? .5 : C.includes(e) ? .15 : T.includes(e) ? .08 : _.includes(e) ? .03 : .02 + } + const D = function(e) { + r.debug ? console.log(e) : fetch("null.html?https://t.poki.io/adserver", { + method: "POST", + mode: "no-cors", + body: JSON.stringify(e) + }) + }; + var j = { + v_k0treo: 2.5, + v_qr1wxs: 7.5, + v_9diccg: 19, + v_13q0xkw: .25, + v_dn33ls: 1, + v_z07u2o: 1.5, + v_1400iyo: 2.25, + v_9w8kxs: 3, + v_ufej9c: 3.5, + v_10960ao: 4.25, + v_1ksbym8: 4.75, + v_1ag9340: 5.25, + v_1tbhh4w: 5.75, + v_jjcgzk: 6.5, + v_brnu9s: 7, + v_1wscef4: 7.75, + v_q22xhc: 8.5, + v_f8irk0: 9, + v_1rik45c: 9.75, + v_lxhyww: 10.5, + v_a9z0u8: 11, + v_1yhiww0: 11.75, + v_10mwg74: 12.25, + v_1ji4u80: 12.75, + v_wm2c5c: 13.5, + v_2na6tc: 14, + v_1myzri8: 14.75, + v_3pzm68: 6, + v_16kerr4: 6.25, + v_1mdrmkg: 6.75, + v_1ga0k5c: 7.25, + v_5iwz5s: 8, + v_12tk934: 8.25, + v_1hsybr4: 8.75, + v_1cj61hc: 9.25, + v_y3r5kw: 9.5, + v_94ow0: 10, + v_15woqgw: 10.25, + v_1orx4hs: 10.75, + v_1d4e6f4: 11.25, + v_t57ev4: 11.5, + v_783hmo: 12, + v_m7hkao: 12.5, + v_hmo9hc: 13, + v_19djnr4: 13.25, + v_1twpm2o: 13.75, + v_17zlou8: 14.25, + v_ign1mo: 14.5, + v_ccvz7k: 15, + v_1f7b4sg: 15.25, + v_snq4g0: 15.5, + v_5wnf28: 16, + v_137aozk: 16.25, + v_1j0njsw: 16.75, + v_1b8yx34: 17.25, + v_yhhlhc: 17.5, + v_25swe8: 18, + v_15081z4: 18.25, + v_1pje0ao: 18.75, + v_1eptudc: 19.25, + v_1xl28e8: 19.75, + v_gfliio: 21, + v_3y3sao: 22, + v_ixhuyo: 22.5, + v_ro52io: 23.5, + v_qa73ls: 24.5, + v_emo5j4: 25, + v_yq5fk: 26, + v_aobxts: 27, + v_6shmgw: 28, + v_natgqo: 28.5, + v_x0f94w: 29.5, + v_d2hfr4: 31, + v_dch14w: 33, + v_1jyadc: 34, + v_8p5tz4: 36, + v_fwv9xc: 37, + v_c60r9c: 39, + v_58awow: 40, + v_bbcow: 42, + v_a0x534: 43, + v_hdmdq8: 45, + v_2e8b28: 46, + v_5nljb4: 48, + v_1wr0n4: 50, + v_pam1og: .5, + v_1ipf08w: .75, + v_1axqdj4: 1.25, + v_1qr38cg: 1.75, + v_15ldds: 2, + v_1q248w0: 2.75, + v_1eelatc: 3.25, + v_1x9tou8: 3.75, + v_8iam0w: 4, + v_nhooow: 4.5, + v_fq01z4: 5, + v_w0u77k: 5.5, + v_1vi5a0w: 15.75, + v_orvt34: 16.5, + v_dybn5s: 17, + v_1q8czr4: 17.75, + v_l11af4: 18.5, + v_uqn2tc: 19.5, + v_7zkdfk: 20, + v_o7a58g: 20.5, + v_vezl6o: 21.5, + v_b5t88w: 23, + v_4x2d4w: 24, + v_xhwjk0: 25.5, + v_lhw3r4: 26.5, + v_tjkbuo: 27.5, + v_h72ebk: 29, + v_31n3sw: 30, + v_64rl6o: 32, + v_9lmigw: 35, + v_3fdjpc: 38, + v_fapfcw: 41, + v_7o0lc0: 44, + v_clbdvk: 47, + v_ee8qv4: 49 + }, + z = { + "11s3rwg": 2.49, + "1uhxr0g": 2.87, + qr1wxs: 7.5, + "15xxon4": .01, + o6no5c: .02, + fb0nwg: .04, + "1etkow0": .05, + x2aoe8: .06, + "1wkupds": .07, + "11i46io": .09, + jqu60w: .1, + "1j9e70g": .11, + "1adr6rk": .13, + smh69s: .14, + "1s5179c": .15, + "8naeps": .16, + qekf7k: .18, + "1px4g74": .19, + hixeyo: .2, + za7fgg: .22, + "1ysrgg0": .23, + lyqx34: .26, + "16hwveo": 1.13, + "1fdjvnk": 1.17, + "2jjcao": 1.2, + "1jtdds0": 1.23, + t6gd1c: 1.26, + "65e29s": 1.28, + "1nf83r4": 1.31, + wsb30g: 1.34, + jgukn4: 1.38, + al7ke8: 1.4, + "1a3rlds": 1.41, + "8datc0": 1.44, + "1pn4utc": 1.47, + z07u2o: 1.5, + "13g1c74": 1.53, + ct4bgg: 1.56, + ukeby8: 1.58, + mspp8g: 1.62, + "1dfmpz4": 1.65, + lm6m8: 1.68, + icw740: 1.7, + "18zt7uo": 1.73, + "79cfsw": 1.76, + "1oj6ha8": 1.79, + "1xethj4": 1.83, + "12c2yo0": 1.85, + bp5xxc: 1.88, + "1syzzeo": 1.91, + ncow00: 1.94, + "1dzlwqo": 1.97, + "15ldds": 2, + "10o5edc": 2.009999, + a18dmo: 2.04, + "1rb2f40": 2.069999, + pkln28: 2.1, + "1g7insw": 2.13, + "12w25fk": 2.17, + c954ow: 2.2, + "1brp5og": 2.21, + "1400iyo": 2.25, + v4dips: 2.3, + hsx0cg: 2.34, + "18fu134": 2.37, + "167xa0w": 2.41, + "1f3ka9s": 2.45, + "1d5n4lc": 1.01, + "1uwx534": 1.03, + bml8g: 1.04, + i2wlq8: 1.06, + "979lhc": 1.08, + "18ptmgw": 1.09, + "1qh3myo": 1.11, + "6zcuf4": 1.12, + oqmuww: 1.14, + fuzuo0: 1.16, + xm9v5s: 1.18, + "1x4tw5c": 1.19, + "1223da8": 1.21, + katcsg: 1.22, + bf6cjk: 1.24, + "1axqdj4": 1.25, + "1sp0e0w": 1.27, + "15ny39c": 1.29, + nwo2rk: 1.3, + f112io: 1.32, + "1ejl3i8": 1.33, + "1pkk5c": 1.36, + "1184l4w": 1.37, + "1izelmo": 1.39, + schkw0: 1.42, + "1rv1lvk": 1.43, + "17vuubk": 1.45, + q4ktts: 1.46, + h8xtkw: 1.48, + "1yirv28": 1.51, + "3xhb7k": 1.52, + lorbpc: 1.54, + "1l7bcow": 1.55, + "1cbocg0": 1.57, + "1u2ycxs": 1.59, + "51foqo": 1.6, + "14jzpq8": 1.61, + "1mb9q80": 1.63, + dx2ozk: 1.64, + vocphc: 1.66, + "1v6wqgw": 1.67, + "10467ls": 1.69, + "1hvg83k": 1.71, + "9h96v4": 1.72, + r8j7cw: 1.74, + "1qr38cg": 1.75, + "16rwgsg": 1.77, + p0mgao: 1.78, + g4zg1s: 1.8, + "1fnjh1c": 1.81, + xw9gjk: 1.82, + "2tixog": 1.84, + kksy68: 1.86, + "1k3cz5s": 1.87, + "1b7pyww": 1.89, + tgfyf4: 1.9, + "5levi8": 1.92, + "153ywhs": 1.93, + "1mv8wzk": 1.95, + eh1vr4: 1.96, + w8bw8w: 1.98, + iwvdvk: 2.02, + "1iffev4": 2.029999, + "19jsem8": 2.049999, + rsie4g: 2.06, + "7tbmkg": 2.08, + "17bvnk0": 2.089999, + "1p35o1s": 2.11, + goymtc: 2.12, + "1xysoao": 2.15, + "3di4g0": 2.16, + l4s4xs: 2.18, + "1knc5xc": 2.19, + u0f56o: 2.22, + "1tiz668": 2.23, + "4hghz4": 2.24, + m8qigw: 2.26, + dd3i80: 2.28, + "1cvnj7k": 2.29, + "1umxjpc": 2.31, + "1mzuo": 2.32, + zk70u8: 2.33, + "1hbh1c0": 2.35, + "8xa03k": 2.36, + qok0lc: 2.38, + "1q741kw": 2.39, + "6pd91c": 2.4, + ogn9j4: 2.42, + "1wuuark": 2.47, + k0treo: 2.5, + "1jjdse8": 2.51, + swgrnk: 2.54, + "162xhc0": 2.57, + fg0glc: 2.6, + l11af4: 18.5, + "9diccg": 19, + "7zkdfk": 20, + gfliio: 21, + b5t88w: 23, + "4x2d4w": 24, + emo5j4: 25, + aobxts: 27, + "6shmgw": 28, + "31n3sw": 30, + "64rl6o": 32, + dch14w: 33, + "9lmigw": 35, + "1yv9csg": 5.35, + o42yo: 6.8, + q22xhc: 8.5, + d2hfr4: 31, + "1np7p4w": .03, + "1zk5j4": .08, + av75s0: .12, + "185ufpc": .17, + "1h1hfy8": .21, + "47gwlc": .24, + d33wu8: .28, + uudxc0: .3, + "14tzb40": .33, + e72adc: .36, + "1vgwbuo": .39, + "10e5szk": .41, + "1i5fthc": .43, + "1r12tq8": .47, + pam1og: .5, + gez1fk: .52, + "1xot2ww": .55, + kusjk0: .58, + bz5jb4: .6, + tqfjsw: .62, + "5vegw0": .64, + "1n58idc": .67, + wibhmo: .7, + "1fkyrk": .72, + "1ipf08w": .75, + s2hzi8: .78, + pul8g0: .82, + "1ghi96o": .85, + "3nhpts": .88, + lerqbk: .9, + uaeqkg: .94, + "14a04cg": .97, + dn33ls: 1, + ved43k: 1.02, + zu6m80: 1.05, + "1hlgmps": 1.07, + qyjlz4: 1.1, + "1lhay2o": .27, + "1clnxts": .29, + "1ucxybk": .31, + "5bfa4g": .32, + n2pam8: .34, + "1ml9bls": .35, + "1dpmbcw": .37, + vycav4: .38, + vls00: .4, + imvshs: .42, + "9r8s8w": .44, + "199st8g": .45, + "7jc16o": .48, + "171w268": .49, + "1ot62o0": .51, + "1fxj2f4": .53, + y691xc: .54, + "33ij28": .56, + "12m2k1s": .57, + "1kdckjk": .59, + "1t8zksg": .63, + "15dyhvk": .65, + nmohds: .66, + er1h4w: .68, + "1e9li4g": .69, + "1w0vim8": .71, + "10y4zr4": .73, + j6uz9c: .74, + ab7z0g: .76, + "19ts000": .77, + "1rl20hs": .79, + "83b7y8": .8, + "17lv8xs": .81, + "1pd59fk": .83, + gyy874: .84, + yq88ow: .86, + "1y8s9og": .87, + "1361qtc": .89, + "1kxbrb4": .91, + "1c1or28": .93, + "1tsyrk0": .95, + "4rg3cw": .96, + miq3uo: .98, + "1m1a4u8": .99, + "11x3klc": 5.05, + "1nrplhc": 5.15, + "1ag9340": 5.25, + qh2bk0: 5.3, + "14wh7gg": 5.45, + w0u77k: 5.5, + "7ltxj4": 5.6, + kxafwg: 5.7, + "1tbhh4w": 5.75, + "110mw3k": 5.85, + "1pfn5s0": 5.95, + "3pzm68": 6, + ml8074: 6.1, + "1uzf1fk": 6.15, + "16kerr4": 6.25, + "1jvva4g": 6.35, + "67vym8": 6.4, + jjcgzk: 6.5, + hbfpxc: 6.6, + "13ij8jk": 6.65, + "1mdrmkg": 6.75, + p34cn4: 6.9, + "1xhbdvk": 6.95, + "1ihxb7k": 7.15, + "1ga0k5c": 7.25, + dflekg: 7.4, + "1o1p6v4": 7.55, + "2c1n9c": 7.6, + "1wscef4": 7.75, + zhp4hs: 7.9, + "5iwz5s": 8, + f8irk0: 9, + y3r5kw: 9.5, + lxhyww: 10.5, + a9z0u8: 11, + "783hmo": 12, + m7hkao: 12.5, + wm2c5c: 13.5, + "2na6tc": 14, + ign1mo: 14.5, + snq4g0: 15.5, + "5wnf28": 16, + dybn5s: 17, + yhhlhc: 17.5, + testbid: 0, + "1nz7aio": 2.43, + xca9s0: 2.46, + b56r5s: 2.52, + obngu8: 2.58, + "24jy80": 2.64, + "1jedzpc": 2.67, + "18au8e8": 2.73, + hnx7nk: 2.76, + "13v0q9s": 2.81, + "10lkow": 2.96, + "156gsu8": 7.05, + "1tlh2io": 7.35, + "1aq8ohs": 7.65, + "1losn40": 7.95, + "1sf0sn4": 2.55, + "1eykhkw": 2.61, + srgyyo: 2.7, + "1yxr94w": 2.79, + d83pj4: 2.84, + n7p3b4: 2.9, + "1dum41s": 2.93, + "1iafm68": 2.99, + "7vtiww": 7.2, + b2outc: 7.8, + "13q0xkw": .25, + riisqo: .46, + "1bhpkao": .61, + cj4q2o: .92, + "1o96vwg": 1.15, + "1wav400": 1.35, + "1grhukg": 1.49, + "1vqvx8g": 1.99, + yg8nb4: 2.14, + "1lrajgg": 2.27, + fl09a8: 2.44, + "1h6h8n4": 2.77, + "1m69xj4": 3.55, + rdj01s: 4.3, + "29jqww": 2.48, + "1anqs5c": 2.53, + "6kdgcg": 2.56, + "1nu7hts": 2.59, + "1wpui2o": 2.63, + jvtyps: 2.66, + "1sa0zy8": 2.71, + "1q248w0": 2.75, + "4cgpa8": 2.8, + "1cqnqio": 2.85, + "5gf2tc": 2.88, + ec2328: 2.92, + "1vlw4jk": 2.95, + "9w8kxs": 3, + "176vuv4": 3.05, + "1kicd8g": 3.15, + jbury8: 3.3, + h3y0w0: 3.4, + gmdxc: 3.6, + ovmnls: 3.7, + "15sxvy8": 3.85, + "1j4eebk": 3.95, + "1gwhn9c": 4.05, + e22hog: 4.2, + "1oo69z4": 4.35, + nhooow: 4.5, + "17gvg8w": 4.65, + "1ksbym8": 4.75, + hxwt1c: 4.9, + t1gkcg: 5.1, + "2221vk": 5.2, + d5lt6o: 5.4, + "1i7xpts": 5.55, + "1g00yrk": 5.65, + etjdhc: 5.8, + s4zvuo: 5.9, + "1c46neo": 6.05, + "99rhts": 6.2, + xorri8: 6.3, + "1em2zuo": 6.45, + "1rxji80": 6.55, + umw8ao: 6.7, + "192b474": 6.85, + brnu9s: 7, + x7ah34: 2.62, + "11n3z7k": 2.65, + b06ygw: 2.68, + "1aiqzgg": 2.69, + "8sa7eo": 2.72, + qjk7wg: 2.74, + zf785c: 2.78, + m3qps0: 2.82, + "1lmaqrk": 2.83, + uzdq0w: 2.86, + "14yz3sw": 2.89, + "1mq94ao": 2.91, + w3c3k0: 2.94, + "10j5log": 2.97, + irvl6o: 2.98, + yb8um8: 3.1, + "60e9kw": 3.2, + "1eelatc": 3.25, + "1rq1t6o": 3.35, + "13b1ji8": 3.45, + ufej9c: 3.5, + "18utf5s": 3.65, + "1x9tou8": 3.75, + bk658g: 3.8, + wxavpc: 3.9, + "8iam0w": 4, + ltr4e8: 4.099999, + "1u7y5mo": 4.15, + "10960ao": 4.25, + "2yiqdc": 4.4, + "1bcprls": 4.45, + "1vvvpxc": 4.55, + a686bk: 4.6, + yl8g00: 4.7, + "4mgao0": 4.8, + "1d0nbwg": 4.85, + "1qc3u9s": 4.95, + fq01z4: 5, + watslc: 7.1, + l7a1a8: 7.3, + zmox6o: 7.45, + oe5d6o: 7.7, + "18dc4qo": 7.85, + "94ow0": 10, + t57ev4: 11.5, + hmo9hc: 13, + ccvz7k: 15, + orvt34: 16.5, + "25swe8": 18, + uqn2tc: 19.5, + "3y3sao": 22, + yq5fk: 26, + h72ebk: 29, + "1jyadc": 34, + testBid: 50 + }, + M = { + hgfim8: "Amazon - DistrictM", + qc2iv4: "Amazon - Magnite", + "183cjcw": "Amazon - AppNexus", + "8ksidc": "Amazon - OpenX", + "1s2jaww": "Amazon - PubMatic", + "1pumjuo": "Amazon - EMX", + "12jknpc": "Amazon - Conversant UAM", + "1kauo74": "Amazon - Amobee DSP", + "15bglj4": "Amazon - PubMatic UAM APAC", + "5swkjk": "Amazon - PubMatic UAM EU", + "1d32f4": "Amazon - Simpli.fi", + ksan7k: "Amazon - Index Exchange", + urw0zk: "Amazon - Smaato", + "1dn4f0g": "Amazon - AdGeneration", + vvueio: "Amazon - DMX", + "1veefi8": "Amazon - Yieldmo", + "1i2xx4w": "Amazon - Yahoo Japan", + rg0we8: "Amazon - UnrulyX_SSP_APS", + y3r5kw: "Amazon - Verizon Media Group", + "1xmb6kg": "Amazon - GumGum UAM", + "1t6hog0": "Amazon - Acuity", + "1n2qm0w": "Amazon - Sharethrough", + j4d2ww: "Amazon - EMX UAM", + "1imx3wg": "Amazon - LoopMe_UAM", + z7pj40: "Amazon - Pulsepoint", + p845c0: "Amazon - SmartRTB+" + }; + var R = { + skyscraper: { + 1: "eexq7SUa6daeQrPF6q1CaKZ0", + 10: "SSZzGHt3d4BrOdVUug1ypxji", + 11: "OXc0ZJDJIcRgGcIta8mTUQSZ", + 12: "ulACVGPjP002tSfhDGRApuub", + 13: "c7FldnCsd9Mtcr7PgBFGKWEQ", + 14: "KJouWQMjZwvE8fxw4mAvGopZ", + 15: "ilNkOqBMO6EGbQwrZtCMHzeJ", + 16: "Kg24ec1AyTvzJ6I3Cji8lqzx", + 17: "iqvpcyepSMCVCsJfKu4JQGwr", + 18: "es9ztDrPZDW883VHbK2gUfkQ", + 19: "pvXQE41GXKGsW5Li0OSQavwT", + 20: "MCy638sYvzVbsrvcPau6lABN", + 21: "NkJeV6CuMlt41iJWcgnmMSDN", + 22: "fjKznUvVWlp6TBxuSsEkQF8H", + 23: "5tJM2ZFmNf7gii6KVS6msGc4", + 24: "xZUYMFw1zGuRzFd6DRl88Pwk", + 3: "xNmhWWy88VtzOGfderrtgDBb", + 30: "KO0gUA5iJIsleK9a941H0pW1", + 31: "wo0KU1WR11jNFxoy121ciQj8", + 37: "areVtONg11YNRQin7R2sveKy", + 4: "nip2pDW2AbU4GM5HMJcouuIa", + 47: "uzLaOEe8yqB9eWZuxdnwyawr", + 49: "ZYaqiQw00NSTBGJ4HacifENM", + 5: "qe5Tc3N2MO3daALoTdIaTmSA", + 50: "NZv1ui2F1tlQ6PQQi7umnFht", + 6: "xbx8OLCAgjm0igkmFIBw8n6E", + 8: "4vYDfNOQagnuwg9REGNWGv83" + }, + rectangle: { + 1: "Ka3KvQx9svu71CJoRtZlwFY9", + 10: "9o5dMBQZX9bi2OsvTpc5j0pO", + 11: "gwL6nB1Twy25gpWQyEP2cVMJ", + 12: "yYUjIY5L6w2ukD5FxCIVydgG", + 13: "PoqRXAEYHKTdqNY22lIFTXRp", + 14: "eAudypoJLJEtFZz3zzvKYoAu", + 15: "4b416MUjJEdZm5nDKwvn2ELO", + 16: "H6jadzxgw0uRVRHHadZ19Zvp", + 17: "5zG8Ioh6paBscdCgUQTQE0eu", + 18: "OgMX0PlDPabF3BHOgxDbeH2n", + 19: "uzK7eCjSVYDp4KvJEg6mC59r", + 20: "yapIY909O3cgcD8QDAEehtkb", + 21: "8KT1bEUCcvASfq0LXWN2nVe0", + 22: "3LKyDpL1Xt7YactKFGxFpJO7", + 23: "GMaOiZl6YeMzYckusbO4Cdh1", + 24: "5iZnMqviynz6ndlaikqhMy73", + 3: "lcpgaTLqkd6gRi8AVtVr0gLe", + 30: "xWGhFW6bvMf9LuGYqQOhoD2h", + 31: "GqMz69ka237zrG4H8bpMuYTy", + 37: "lYrk2xnelCQrhwmO43AtjErF", + 4: "wceshrwDAUvkTTLQZDgE1V5T", + 47: "PDA12fEHtYIVr6A12fZ86JQH", + 49: "RYn9wxADCbBgKeo8Lyxx1ZHE", + 5: "N3wOmgPMiK6RaGNYjeqOzuHU", + 50: "KwEXqYIZG8fOlJyePKTBiJFs", + 6: "fJMv7XtKbfsRbzkO42fkS3Dr", + 8: "915o8cwxF5rzfQsA1Op6hhQV" + }, + leaderboard: { + 4: "fZ4M7Isi1rLz2cjAcBBLmQGI", + 16: "ZPwouCq7eD5kRnZjX5ct8ZIT", + 1: "sysnuL1RKPIEL98w2l6lPc1w", + 31: "FgHUFCWMZCCJaHKMF0LyIgSI", + 23: "eyGVQGQkrHwJRcLoBzepUHW2", + 14: "PeRnr3pCNPpCgJAOF3yuQCGg", + 37: "5DXFSCYcaAxAXBuZVpTHAx59", + 30: "MpHDUxZ178U65yD3l878z5m1", + 47: "oYQGytr0CbDDQqIooggCsNTO", + 18: "na3uJK58s0vgb7NyaPR6R5P8", + 50: "m3hskIBrmloAWHD7i27q2ZPN", + 3: "PIsUL8EJvXXA1thcFkCPWdhi", + 19: "cluKVL1thRZlb3bsK7oVadOZ", + 20: "8PPLwmi2mra9HNTdhftQOcC4", + 8: "cCQE4L5S1j9BmKeywuonM6hM", + 11: "uvkuS4QYv01YvuGoJvqa9xnz", + 12: "GyG0XHcaahKmsXbcjDlgtjCQ", + 17: "0ut5aHlZRj5dNfTKo9bM8nXj", + 10: "TzMO5iGdP4vt7BIOAQ2e3kpU", + 49: "f1vArQjoEfX9QdjK2TvBjnDv", + 22: "92kdBH3AxvPr1pqZ1h1TYkjN", + 13: "Y6Tl87JTAn9T1B8rq523UDeH", + 15: "B3HlKKIdq8mGyoMGkjT4m9RD", + 24: "nfS0DrtZtJ6eZVNqsWqyVVFS", + 5: "gr33qXeArxdqi0Sk4i50TmE3", + 6: "ACn0XyU2KP2l94N0HMf1vhlu", + 21: "o2PQGGTxXO92in2mASt624tn" + }, + mobile_leaderboard: { + 4: "Ue573Dbj78H6RnJT1nlozaJY", + 16: "5X98AYdO2OAIb2m6ThLjCGR5", + 1: "nVDrFwfkiRg5Tb426duBnat4", + 31: "H8tpygATsgJwk7qJzh612B0I", + 23: "07iMij2dOIgPHzM7JFv5fYBN", + 14: "XCQLWETuRkKmiN9jCOu01NOp", + 37: "419OVNbGzLJn7wlh5jAiUFLA", + 30: "ErE9N4WozhjbawA6HFN2hC0V", + 47: "4aBsJtSPEivB07hrlV6nTgj7", + 18: "waksL4h4X7gn2TU88OgeZHHl", + 50: "Wi3BRMWcCUdKZO7leMhtCfdp", + 3: "KQ3P2qVndkjlesGkzM5Rknma", + 19: "OCsZIZrTXKyprJ8AKiI7e0Jl", + 20: "h2aMA8KeZ3tHtfRgwT2xCHUJ", + 8: "igvEPDF1ft8FBFQ2aVhCS0BG", + 11: "I1ZnJzEjRg75BZikcGMWxMTF", + 12: "ZrnW76G2qvB5pZx8VvOanqQQ", + 17: "B4f8YQfcg3WWl5k9pAnqVCfm", + 10: "cfNKknbTZxcxhNZCV2fWr4Ne", + 49: "ziBY1mSHWj9UTGcq9Tbzo5J4", + 22: "ImlLSALVeaqvi7y2e6qdBDkw", + 13: "NUx9OmJMlzbkv39hUX5FOnXv", + 15: "RxDq1opgeO5VXEQRPtdESHaX", + 24: "aswJxUjNpHyiEunaOUBGbajK", + 5: "1M1EIJhXdwEoJ8utYTDjj0DD", + 6: "gExvCBm9TEaw4jV6kRzEuDxq", + 21: "wNOOjIhadhe2s1jgq3LppWm0" + }, + billboard: { + 4: "NO39pgf3BaqIgRZoZ5SvYMXf", + 16: "dr2IuY7Yb8POz9tbezoJUFey", + 1: "WhhFn8GL9nBEK2z9psbtD1SV", + 31: "JNfSIPKKAkfNgzkg3hrGlGEV", + 23: "xvsrS9J4xrRGjlus3pKkIatI", + 14: "4BL4a74RRMoiRu9D8jKAfdij", + 37: "f8B8j7tjb1YA6lAcnHSRBlfI", + 30: "vW1ODUqFt2jDk5laYsVh9PIF", + 47: "R7GldiHZEWYFwdJq936YnbZW", + 18: "83noJ3tAhRyFWDlS1iXKuRGa", + 50: "WNu1woAb2OHf3KncItSAnYnm", + 3: "Ydwhf5DPoJBinldgPdkD9okm", + 19: "3X7dNFFm484Xx6aD6nBF0k43", + 20: "qzLmNwSljh25A7s9HXQYVYtr", + 8: "tXWpZaKO291ytd8kfiy3NWlz", + 11: "0ePnxLUMZ8tKBxImFp2i1J4g", + 12: "Y1HuzbhxRv1UmUhd8dUtONQI", + 17: "lqSabVDWqYWy8jpJH57BK1vS", + 10: "zVEWUpJuNfEipDrTPGwniMP3", + 49: "B2srINo0hBkijyowlq4FQk7c", + 22: "Ljcylng1YDm5yAqEpiomGazZ", + 13: "hYTGyFgCiCUVtNOx56TkKexo", + 15: "5xkx65Y9eEhPen8gqIuOFQRZ", + 24: "ZH3Odxmz8QF49ZoZ16mPs08T", + 5: "Ax2noHPv7iRdW6DM26NxmtFT", + 6: "mZEu6Z0wDTq4UAHQoyUosm5y", + 21: "7bAgpwCip0dSf6bJXgBO6nY1" + } + }, + L = []; + + function O(e, t) { + var i, n, r; + return (null === (n = null === (i = null == t ? void 0 : t.meta) || void 0 === i ? void 0 : i.advertiserDomains) || void 0 === n ? void 0 : n.length) > 0 && (null === (r = null == t ? void 0 : t.meta) || void 0 === r ? void 0 : r.advertiserDomains.find((function(e) { + return function(e) { + return L.includes(e) || L.includes("www." + e) || e.includes("game") + }(e) + }))) ? (console.warn("Blocked ad: ", t), 0) : e + } + var G = function() { + return G = Object.assign || function(e) { + for (var t, i = 1, n = arguments.length; i < n; i++) + for (var r in t = arguments[i]) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); + return e + }, G.apply(this, arguments) + }, + U = function(e, t, i) { + if (i || 2 === arguments.length) + for (var n, r = 0, o = t.length; r < o; r++) !n && r in t || (n || (n = Array.prototype.slice.call(t, 0, r)), n[r] = t[r]); + return e.concat(n || Array.prototype.slice.call(t)) + }, + Z = parseInt(I("site_id"), 10) || 0, + q = "desktop"; + y() && (q = "mobile"), w() && (q = "tablet"); + var K = "rewarded", + Q = "video", + N = { + "728x90": "/21682198607/" + q + "_ingame_728x90/" + Z + "_" + q + "_ingame_728x90", + "300x250": "/21682198607/" + q + "_ingame_300x250/" + Z + "_" + q + "_ingame_300x250", + "970x250": "/21682198607/" + q + "_ingame_970x250/" + Z + "_" + q + "_ingame_970x250", + "160x600": "/21682198607/" + q + "_ingame_160x600/" + Z + "_" + q + "_ingame_160x600", + "320x50": "/21682198607/" + q + "_ingame_320x50/" + Z + "_" + q + "_ingame_320x50", + "728x90_external": "/21682198607/external_" + q + "_display_ingame/external_" + q + "_ingame_728x90", + "300x250_external": "/21682198607/external_" + q + "_display_ingame/external_" + q + "_ingame_300x250", + "970x250_external": "/21682198607/external_" + q + "_display_ingame/external_" + q + "_ingame_970x250", + "160x600_external": "/21682198607/external_" + q + "_display_ingame/external_" + q + "_ingame_160x600", + "320x50_external": "/21682198607/external_" + q + "_display_ingame/external_" + q + "_ingame_320x50" + }, + F = !1, + X = function(e, t, i) { + if (tt.prebidAvailable) { + F = !0; + var n = ["US", "CA", "AU"], + r = function(e) { + var i, r = S() || y() || w() ? ["video/mp4", "application/javascript"] : ["video/mp4", "video/webm", "video/ogg", "application/javascript"], + o = G(G({ + mimes: r, + minduration: 0, + maxduration: 15, + protocols: [2, 3, 5, 6, 7, 8], + w: 640, + h: 480, + placement: 1, + linearity: 1 + }, e ? {} : { + skip: 1, + skipafter: 5 + }), { + boxingallowed: 1, + pos: 1, + api: [2] + }); + return { + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: 13184250, + supplyType: "web" + } + }, { + bidder: "openx", + params: { + delDomain: "poki-d.openx.net", + unit: "540105196" + } + }, { + bidder: "spotx", + params: { + channel_id: "265590", + ad_unit: "instream", + secure: !0, + hide_skin: !0 + } + }, { + bidder: "ix", + params: { + siteId: "436284", + video: {} + } + }, { + bidder: "richaudience", + params: { + pid: (i = Z, E[i] || "MP_gIE1VDieUi"), + supplyType: "site" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "266914", + zoneId: "1322034", + position: "atf", + video: { + size_id: 204 + } + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3607869@640x360" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "instream" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: "vRjLnZDA86biUVrjIKVGxq3x" + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_Instream_Prebid", + video: G({}, o) + } + }], !1), + mediaTypes: { + video: G({ + context: "instream", + playerSize: [640, 480] + }, o) + } + } + }, + o = r(!0), + a = r(!1), + s = [{ + code: Q, + mediaTypes: a.mediaTypes, + bids: U([], a.bids, !0) + }, { + code: K, + mediaTypes: o.mediaTypes, + bids: U([], o.bids, !0) + }, { + code: N["728x90"], + mediaTypes: { + banner: { + sizes: [ + [728, 90] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "12940427" + } + }, { + bidder: "openx", + params: { + unit: "539859872", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "268177", + size: [728, 90] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "1374895@728x90" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "204596", + zoneId: "1008080" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "1V6a2fgLvX", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.leaderboard[Z] || R.leaderboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }, { + code: N["300x250"], + mediaTypes: { + banner: { + sizes: [ + [300, 250] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "12935252" + } + }, { + bidder: "openx", + params: { + unit: "539859873", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "268178", + size: [300, 250] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "1374896@300x250" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "204596", + zoneId: "1008080" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "pKqNt5LyvF", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.skyscraper[Z] || R.skyscraper[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_300x250_Prebid" + } + }], !1) + }, { + code: N["970x250"], + mediaTypes: { + banner: { + sizes: [ + [970, 250] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20595278" + } + }, { + bidder: "openx", + params: { + unit: "543540497", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "597527", + size: [970, 250] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3344351@970x250" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "yYyae7vnIh", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.rectangle[Z] || R.rectangle[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_970x250_Prebid" + } + }], !1) + }, { + code: N["160x600"], + mediaTypes: { + banner: { + sizes: [ + [160, 600] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "12940425" + } + }, { + bidder: "openx", + params: { + unit: "539859871", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "268175", + size: [160, 600] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "1374893@160x600" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "204596", + zoneId: "1008080" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "rAEnPimPzC", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.billboard[Z] || R.billboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }, { + code: N["320x50"], + mediaTypes: { + banner: { + sizes: [ + [320, 50] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20595224" + } + }, { + bidder: "openx", + params: { + unit: "543540495", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "597529", + size: [320, 50] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3344350@320x50" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "204596", + zoneId: "1008080" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "1DP5EtcOip", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.skyscraper[Z] || R.skyscraper[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }, { + code: N["728x90_external"], + mediaTypes: { + banner: { + sizes: [ + [728, 90] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20973406" + } + }, { + bidder: "openx", + params: { + unit: "543885656", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "268177", + placementId: "625562", + size: [728, 90] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3457872" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "362566", + zoneId: "1962680-2" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "MP_gIE1VDieUi", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.billboard[Z] || R.billboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }, { + code: N["300x250_external"], + mediaTypes: { + banner: { + sizes: [ + [300, 250] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20973408" + } + }, { + bidder: "openx", + params: { + unit: "543885657", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "625564", + size: [300, 250] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3457874" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "362566", + zoneId: "1962680-15" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "MP_gIE1VDieUi", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.mobile_leaderboard[Z] || R.mobile_leaderboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_300x250_Prebid" + } + }], !1) + }, { + code: N["970x250_external"], + mediaTypes: { + banner: { + sizes: [ + [970, 250] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20973415" + } + }, { + bidder: "openx", + params: { + unit: "543885650", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "625560", + size: [970, 250] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3457879" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "362566", + zoneId: "1962680-57" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "MP_gIE1VDieUi", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.leaderboard[Z] || R.leaderboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_970x250_Prebid" + } + }], !1) + }, { + code: N["160x600_external"], + mediaTypes: { + banner: { + sizes: [ + [160, 600] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20973407" + } + }, { + bidder: "openx", + params: { + unit: "543885653", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "625563", + size: [160, 600] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3457877" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "362566", + zoneId: "1962680-9" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "MP_gIE1VDieUi", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.rectangle[Z] || R.rectangle[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }, { + code: N["320x50_external"], + mediaTypes: { + banner: { + sizes: [ + [320, 50] + ] + } + }, + bids: U(U([{ + bidder: "appnexus", + params: { + placementId: "20973413" + } + }, { + bidder: "openx", + params: { + unit: "543885649", + delDomain: "poki-d.openx.net" + } + }, { + bidder: "ix", + params: { + siteId: "625559", + size: [320, 50] + } + }, { + bidder: "pubmatic", + params: { + publisherId: "156838", + adSlot: "3457875" + } + }, { + bidder: "rubicon", + params: { + accountId: "18608", + siteId: "362566", + zoneId: "1962680-43" + } + }, { + bidder: "onetag", + params: { + pubId: "6da09f566a9dc06" + } + }, { + bidder: "richaudience", + params: { + pid: "MP_gIE1VDieUi", + supplyType: "site" + } + }], n.includes(t) ? [{ + bidder: "33across", + params: { + siteId: "aRJKVCig8r7ikZaKj0P0Le", + productId: "siab" + } + }] : [], !0), [{ + bidder: "sharethrough", + params: { + pkey: R.mobile_leaderboard[Z] || R.mobile_leaderboard[3] + } + }, { + bidder: "triplelift", + params: { + inventoryCode: "Poki_HDX_Prebid" + } + }], !1) + }], + d = { + debug: !1, + enableSendAllBids: !0, + usePrebidCache: !0, + bidderTimeout: 1500, + priceGranularity: { + buckets: [{ + precision: 2, + min: .01, + max: 3, + increment: .01 + }, { + precision: 2, + min: 3, + max: 8, + increment: .05 + }, { + precision: 2, + min: 8, + max: 20, + increment: .5 + }, { + precision: 2, + min: 20, + max: 45, + increment: 1 + }] + }, + currency: { + adServerCurrency: "EUR", + defaultRates: { + EUR: { + EUR: 1, + GBP: .86408, + USD: 1.2212 + }, + GBP: { + EUR: 1.157300249976854, + GBP: 1, + USD: 1.4132950652717342 + }, + USD: { + EUR: .8188666885031116, + GBP: .7075663282017687, + USD: 1 + } + } + }, + cache: { + url: "null.html?https://prebid.adnxs.com/pbc/v1/cache" + }, + targetingControls: { + allowTargetingKeys: ["BIDDER", "AD_ID", "PRICE_BUCKET", "SIZE", "DEAL", "SOURCE", "FORMAT", "UUID", "CACHE_ID", "CACHE_HOST", "ADOMAIN"], + allowSendAllBidsTargetingKeys: ["BIDDER", "AD_ID", "PRICE_BUCKET", "SIZE", "DEAL", "SOURCE", "FORMAT", "UUID", "CACHE_ID", "CACHE_HOST", "ADOMAIN"] + }, + userSync: { + filterSettings: { + all: { + bidders: "*", + filter: "include" + } + }, + syncsPerBidder: 1e3, + syncDelay: 100, + userIds: [{ + name: "pubCommonId", + storage: { + type: "cookie", + name: "poki_pubcid", + expires: 180 + } + }] + } + }; + window.pbjs.que.push((function() { + var n = G(G({ + floors: { + data: { + currency: "EUR", + schema: { + fields: ["mediaType"] + }, + values: { + banner: P(t), + video: B(t) + } + } + } + }, d), e.config); + window.pbjs.addAdUnits(function(e, t, i) { + var n, r; + i = i.toUpperCase(); + var o = null == t ? void 0 : t[i]; + if (!o) return e; + for (var a = 0; a <= e.length; a++) + for (var s = e[a], d = o[(null === (n = null == s ? void 0 : s.mediaTypes) || void 0 === n ? void 0 : n.video) ? "video" : "display"] || {}, A = (null === (r = null == s ? void 0 : s.bids) || void 0 === r ? void 0 : r.length) - 1; A >= 0; A--) { + var c = s.bids[A], + l = Math.random(); + d[c.bidder] && l > d[c.bidder] && e[a].bids.splice(A, 1) + } + return e + }(e.adUnits || s, i, t)), window.pbjs.setConfig(n), window.pbjs.bidderSettings = { + appnexus: { + bidCpmAdjustment: O + }, + openx: { + bidCpmAdjustment: O + }, + spotx: { + bidCpmAdjustment: O + }, + ix: { + bidCpmAdjustment: O + }, + richaudience: { + bidCpmAdjustment: O + }, + onetag: { + bidCpmAdjustment: O + }, + rubicon: { + bidCpmAdjustment: O + }, + pubmatic: { + bidCpmAdjustment: O + }, + "33across": { + bidCpmAdjustment: O + }, + sharethrough: { + bidCpmAdjustment: O + }, + triplelift: { + bidCpmAdjustment: O + } + } + })) + } + }, + H = !1, + V = function(e, t, i, n) { + window.apstag && window.apstag.init(e.settings || G({ + pubID: "e32f1423-28bc-43ed-8ab0-5ae6b4449cf8", + adServer: "googletag", + videoAdServer: "GAM" + }, i ? { + gdpr: { + cmpTimeout: 1e4 + } + } : {}), (function() { + H = ! function(e, t) { + var i, n; + t = t.toUpperCase(); + var r = null === (n = null === (i = null == e ? void 0 : e[t]) || void 0 === i ? void 0 : i.video) || void 0 === n ? void 0 : n.amazon; + return !!r && Math.random() > r + }(n, t), e.callback && e.callback() + })) + }, + W = function() { + ! function() { + if (!window.__tcfapi) { + var e = window.top, + t = {}; + window.__tcfapi = function(i, n, r, o) { + var a = "" + Math.random(), + s = { + __tcfapiCall: { + command: i, + parameter: o, + version: n, + callId: a + } + }; + t[a] = r, e.postMessage(s, "*") + }, window.addEventListener("message", (function(e) { + var i = {}; + try { + i = "string" == typeof e.data ? JSON.parse(e.data) : e.data + } catch (e) {} + var n = i.__tcfapiReturn; + n && "function" == typeof t[n.callId] && (t[n.callId](n.returnValue, n.success), t[n.callId] = null) + }), !1) + } + }(), window.pbjs.que.push((function() { + window.pbjs.setConfig({ + consentManagement: { + gdpr: { + cmpApi: "iab", + timeout: 8e3, + defaultGdprScope: !0 + } + } + }) + })) + }, + J = function() { + ! function() { + if (!window.__uspapi) { + var e = window.top, + t = {}; + window.__uspapi = function(i, n, r) { + var o = "" + Math.random(), + a = { + __uspapiCall: { + command: i, + version: n, + callId: o + } + }; + t[o] = r, e.postMessage(a, "*") + }, window.addEventListener("message", (function(e) { + var i = e && e.data && e.data.__uspapiReturn; + i && i.callId && "function" == typeof t[i.callId] && (t[i.callId](i.returnValue, i.success), t[i.callId] = null) + }), !1) + } + }(), window.pbjs.que.push((function() { + window.pbjs.setConfig({ + consentManagement: { + usp: { + cmpApi: "iab", + timeout: 8e3 + } + } + }) + })) + }; + + function Y(e, t, i, r, o, s, d) { + var A = s ? "nope" : t; + if (window.pbjs && window.pbjs.que && window.pbjs.getConfig) { + var c, l = k().split("?"), + u = encodeURIComponent(l[0]), + p = r ? K : Q, + h = a.getDataAnnotations(), + m = 0, + g = function() { + var r, l, g; + if (!(--m > 0)) try { + a.dispatchEvent(n.ads.prebidRequested); + var f = window.pbjs.adUnits.filter((function(e) { + return e.code === p + }))[0]; + if ("undefined" === f) return console.error("Video-ad-unit not found, did you give it the adunit.code='video' value?"), void e.requestAd(A); + var v = window.pbjs.adServers.dfp.buildVideoUrl({ + adUnit: f, + params: { + iu: I("iu", t), + sz: "640x360|640x480", + output: "vast", + cust_params: i, + description_url: u + } + }), + b = window.pbjs.getHighestCpmBids(p), + k = void 0; + b.length > 0 && (k = b[0]), window.pbjs.markWinningBidAsUsed({ + adUnitCode: p + }), c && (v = v.replace("cust_params=", "cust_params=" + c + "%26")), k && (null === (l = null === (r = null == k ? void 0 : k.meta) || void 0 === r ? void 0 : r.advertiserDomains) || void 0 === l ? void 0 : l.length) > 0 && a.setDataAnnotations({ + adDomain: k.meta.advertiserDomains.join(",") + }); + var y = !1; + if (s) { + if (c) { + var w = function(e) { + var t = decodeURIComponent(e), + i = I("amznbid", t); + if (!i) return null; + var n = j[i]; + return n ? { + bid: n, + vast: "null.html?https://aax.amazon-adsystem.com/e/dtb/vast?b=" + I("amzniid", t) + "&rnd=" + Math.round(1e10 * Math.random()) + "&pp=" + i + } : null + }(c); + w && (!k || !k.videoCacheKey || k.cpm < w.bid) && (k = { + cpm: w.bid, + vast: w.vast, + bidder: "amazon", + videoCacheKey: "amazon" + }) + } + if (1 !== d && (!k || !k.videoCacheKey || k.cpm < B(o))) { + var S = 5; + "ninja.io" === (null === (g = null === window || void 0 === window ? void 0 : window.location) || void 0 === g ? void 0 : g.hostname) && (S = function(e) { + return "US" === e ? 6.1 : x.includes(e) ? .5 : C.includes(e) ? .15 : T.includes(e) ? .08 : _.includes(e) ? .03 : .02 + }(o)), k = { + cpm: S, + vast: "null.html?https://api.poki.com/ads/houseads/video/vast" + ("" === $e.gameId ? "" : "?game_id=" + $e.gameId), + bidder: "poki", + videoCacheKey: "poki" + } + } + if (!k || !k.videoCacheKey) return void a.dispatchEvent(1 === d ? n.ads.video.error : n.ads.completed); + switch (k.bidder) { + case "onetag": + v = "null.html?https://onetag-sys.com/invocation/?key=" + k.videoCacheKey; + break; + case "rubicon": + v = "null.html?https://prebid-server.rubiconproject.com/cache?uuid=" + k.videoCacheKey; + break; + case "spotx": + v = "null.html?https://search.spotxchange.com/ad/vast.html?key=" + k.videoCacheKey; + break; + case "amazon": + case "poki": + v = k.vast; + break; + default: + v = "null.html?https://prebid.adnxs.com/pbc/v1/cache?uuid=" + k.videoCacheKey + } + D({ + event: "video-ready", + size: "640x360v", + opportunityId: null == h ? void 0 : h.opportunityId, + adUnitPath: null == h ? void 0 : h.adUnitPath, + p4d_game_id: $e.gameId, + p4d_version_id: $e.versionId, + bidder: null == k ? void 0 : k.bidder, + bid: null == k ? void 0 : k.cpm + }), y = !0, a.setDataAnnotations({ + p4d_game_id: $e.gameId, + p4d_version_id: $e.versionId, + bidder: null == k ? void 0 : k.bidder, + bid: null == k ? void 0 : k.cpm + }) + } + a.setDataAnnotations({ + vhbOnlyMode: y, + adTagUrl: v + }), k ? a.setDataAnnotations({ + prebidBidder: null == k ? void 0 : k.bidder, + prebidBid: null == k ? void 0 : k.cpm + }) : a.setDataAnnotations({ + prebidBidder: void 0, + prebidBid: void 0 + }), e.requestAd(v) + } catch (t) { + e.requestAd(A) + } + }; + H && m++, F && m++, H && window.apstag.fetchBids({ + slots: [{ + slotID: r ? "Rewarded" : "Midroll", + mediaType: "video" + }], + timeout: 1500 + }, (function(e) { + e.length > 0 && (c = e[0].encodedQsParams), g() + })), s && D({ + event: "video-request", + size: "640x360v", + opportunityId: null == h ? void 0 : h.opportunityId, + adUnitPath: null == h ? void 0 : h.adUnitPath, + p4d_game_id: $e.gameId, + p4d_version_id: $e.versionId + }), F && window.pbjs.que.push((function() { + window.pbjs.requestBids({ + adUnitCodes: [p], + bidsBackHandler: function() { + g() + } + }) + })) + } else e.requestAd(A) + } + + function $() { + var e, t = (null === (e = null === window || void 0 === window ? void 0 : window.location) || void 0 === e ? void 0 : e.hostname) || ""; + return "yes" === I("poki-ad-server") ? (console.log("DEBUG: Only running Poki-ad-server"), !0) : "localhost" !== t && "game-cdn.poki.com" !== t && !t.endsWith(".poki-gdn.com") && ("ninja.io" === t ? Math.random() <= .5 : "venge.io" === t ? Math.random() <= .05 : "makeitmeme.com" === t) + } + var ee = function() { + function e(e, t) { + void 0 === t && (t = {}), this.retries = 0, this.running = !1, this.ima = e, this.siteID = t.siteID || 3, this.country = t.country || "ZZ", this.usePokiAdserver = $(), this.totalRetries = t.totalRetries || d.waterfallRetries || 1, this.timing = t.timing || new c(d.adTiming), a.addEventListener(n.ads.video.error, this.moveThroughWaterfall.bind(this)), a.addEventListener(n.ads.video.loaderError, this.moveThroughWaterfall.bind(this)), a.addEventListener(n.ads.ready, this.timing.stopWaterfallTimer.bind(this.timing)), a.addEventListener(n.ads.started, this.stopWaterfall.bind(this)) + } + return e.prototype.moveThroughWaterfall = function() { + if (!1 !== this.running) { + var e = this.totalRetries; + if (this.timing.stopWaterfallTimer(), this.retries < e) return this.timing.nextWaterfallTimer(), void this.requestAd(); + this.running = !1, this.timing.resetWaterfallTimerIdx(), a.dispatchEvent(n.ads.error, { + message: "No ads", + rewardAllowed: !0 + }) + } + }, e.prototype.cutOffWaterfall = function() { + this.ima.tearDown(), this.moveThroughWaterfall() + }, e.prototype.buildAdUnitPaths = function(e) { + if (r.debug) { + var t = "/21682198607/debug-video/"; + return e === n.ads.position.rewarded ? [t + "debug-video-rewarded"] : e === n.ads.position.preroll ? [t + "debug-video-preroll"] : [t + "debug-video-midroll"] + } + var i = "desktop", + o = "midroll"; + y() ? i = "mobile" : w() && (i = "tablet"), e === n.ads.position.rewarded && (o = "rewarded"); + var a = "/21682198607/"; + return tt.GetIsPokiIFrame() ? ["" + a + i + "_ingame_" + o + "_1/" + this.siteID + "_" + i + "_ingame_" + o + "_1", "" + a + i + "_ingame_" + o + "_2/" + this.siteID + "_" + i + "_ingame_" + o + "_2"] : [a + "external_" + i + "_video_1/external_" + i + "_ingame_" + o + "_1", a + "external_" + i + "_video_2/external_" + i + "_ingame_" + o + "_2"] + }, e.prototype.start = function(e, t) { + void 0 === e && (e = {}), this.running = !0, this.retries = 0, this.criteria = e, this.timing.resetWaterfallTimerIdx(), this.rewarded = t === n.ads.position.rewarded, this.adUnitPaths = this.buildAdUnitPaths(t), this.requestAd() + }, e.prototype.requestAd = function() { + this.timing.startWaterfallTimer(this.cutOffWaterfall.bind(this)), this.retries++, this.criteria.waterfall = this.retries; + var e = (this.retries - 1) % this.adUnitPaths.length, + t = this.adUnitPaths[e], + i = "https://securepubads.g.doubleclick.net/gampad/ads?sz=640x360|640x480&iu=" + t + "&ciu_szs&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url={url}&description_url={descriptionUrl}&correlator={timestamp}"; + tt.consentString && tt.consentString.length > 0 && (this.criteria.consent_string = tt.consentString); + var r = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) > 970; + this.criteria.billboards_fit = r ? "yes" : "no"; + var o, s, d = function(e) { + var t = k().split("?"), + i = encodeURIComponent(t[0]); + return (e = e.split("{descriptionUrl}").join(i)).split("{timestamp}").join((new Date).getTime().toString()) + }(i) + (o = this.criteria, s = "", Object.keys(o).forEach((function(e) { + if (Object.prototype.hasOwnProperty.call(o, e)) { + var t = o[e]; + Array.isArray(t) && (t = t.join()), s += e + "=" + t + "&" + } + })), "&cust_params=" + (s = encodeURIComponent(s)) + "&"); + tt.childDirected && (d += "&tfcd=1"), tt.nonPersonalized && (d += "&npa=1"), a.setDataAnnotations({ + adUnitPath: t, + adTagUrl: d, + waterfall: this.retries + }), a.dispatchEvent(n.ads.requested), this.usePokiAdserver ? (console.debug("adRequest started with Prebid Video enabled (" + this.retries + "/" + this.totalRetries + ")"), Y(this.ima, d, this.criteria, this.rewarded, this.country, !0, this.retries)) : 1 === this.retries ? (console.debug("adRequest started with Prebid Video enabled (" + this.retries + "/" + this.totalRetries + ")"), Y(this.ima, d, this.criteria, this.rewarded, this.country, !1, this.retries)) : (console.debug("adRequest started in plain mode (" + this.retries + "/" + this.totalRetries + ")"), this.ima.requestAd(d)) + }, e.prototype.isRunning = function() { + return true; + //return this.running + }, e.prototype.stopWaterfall = function() { + this.running = !1, this.timing.stopWaterfallTimer(), this.timing.resetWaterfallTimerIdx() + }, e + }(); + const te = ee; + var ie = "pokiSdkContainer", + ne = "pokiSdkFixed", + re = "pokiSdkOverlay", + oe = "pokiSdkHidden", + ae = "pokiSdkInsideContainer", + se = "pokiSdkPauseButton", + de = "pokiSdkPauseButtonBG", + Ae = "pokiSdkStartAdButton", + ce = "pokiSdkProgressBar", + le = "pokiSdkProgressContainer", + ue = "pokiSdkSpinnerContainer", + pe = "pokiSdkVideoContainer", + he = "pokiSdkVisible", + me = "pokiSDKAdContainer"; + var ge = function(e, t, i) { + if (i || 2 === arguments.length) + for (var n, r = 0, o = t.length; r < o; r++) !n && r in t || (n || (n = Array.prototype.slice.call(t, 0, r)), n[r] = t[r]); + return e.concat(n || Array.prototype.slice.call(t)) + }; + const fe = function() { + function e(e) { + var t = this; + if (this.hideElement = function(e) { + e.classList.add(oe), e.classList.remove(he) + }, this.showElement = function(e) { + e.classList.add(he), e.classList.remove(oe) + }, this.progressFaker = new ve((function(e) { + return t.updateProgressBar(e) + })), this.progressFaker.queueFakeProgress(10, 1e3, n.ads.prebidRequested), this.progressFaker.queueFakeProgress(20, 2e3, n.ads.started), this.createElements(e.wrapper), "undefined" != typeof window && document) { + var i = document.createElement("style"); + i.innerHTML = "\n.pokiSdkContainer {\n\toverflow: hidden;\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.pokiSdkContainer.pokiSdkFixed {\n\tposition: fixed;\n}\n\n.pokiSdkContainer.pokiSdkVisible {\n\tdisplay: block;\n}\n\n.pokiSdkContainer.pokiSdkHidden,\n.pokiSdkSpinnerContainer.pokiSdkHidden {\n\tdisplay: none;\n}\n\n.pokiSdkContainer.pokiSdkHidden,\n.pokiSdkSpinnerContainer {\n\tpointer-events: none;\n}\n\n.pokiSdkSpinnerContainer {\n\tz-index: 10;\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: url('https://a.poki.com/images/thumb_anim_2x.gif') 50% 50% no-repeat;\n\tuser-select: none;\n}\n\n.pokiSdkInsideContainer {\n\tbackground: #000;\n\tposition: relative;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\n\topacity: 0;\n\t-webkit-transition: opacity 0.5s ease-in-out;\n\t-moz-transition: opacity 0.5s ease-in-out;\n\t-ms-transition: opacity 0.5s ease-in-out;\n\t-o-transition: opacity 0.5s ease-in-out;\n\ttransition: opacity 0.5s ease-in-out;\n}\n\n.pokiSdkContainer.pokiSdkVisible .pokiSdkInsideContainer {\n\topacity: 1;\n}\n\n.pokiSDKAdContainer, .pokiSdkVideoContainer {\n\tposition: absolute;\n\twidth: 100%;\n\theight: 100%;\n}\n\n.pokiSdkStartAdButton {\n\tposition: absolute;\n\tz-index: 9999;\n\ttop: 0;\n\n\tpadding-top: 10%;\n\twidth: 100%;\n\theight: 100%;\n\ttext-align: center;\n\tcolor: #FFF;\n\n\tfont: 700 15pt 'Arial', sans-serif;\n\tfont-weight: bold;\n\tletter-spacing: 1px;\n\ttransition: 0.1s ease-in-out;\n\tline-height: 1em;\n}\n\n.pokiSdkPauseButton {\n\tcursor:pointer;\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: 1;\n}\n\n.pokiSdkPauseButton:before {\n\tcontent: '';\n\tposition: absolute;\n\twidth: 100px;\n\theight: 100px;\n\tdisplay: block;\n\tborder: 2px solid #fff;\n\tborder-radius: 50%;\n\tuser-select: none;\n\tbackground-color: rgba(0, 0, 0, 0.6);\n\ttransition: background-color 0.5s ease;\n\tanimation: 1s linear infinite pulse;\n}\n\n.pokiSdkPauseButton:after {\n\tcontent: '';\n\tposition: absolute;\n\tdisplay: block;\n\tbox-sizing: border-box;\n\tborder-color: transparent transparent transparent #fff;\n\tborder-style: solid;\n\tborder-width: 26px 0 26px 40px;\n\tpointer-events: none;\n\tanimation: 1s linear infinite pulse;\n\tleft: 6px;\n}\n.pokiSdkPauseButtonBG {\n position: fixed;\n top: 0;\n left: 0;\n display: block;\n content: '';\n background: rgba(0, 43, 80, 0.5);\n width: 100%;\n height: 100%;\n}\n\n.pokiSdkPauseButtonBG:hover{\n\tbackground: rgba(0, 43, 80, 0.7);\n}\n\n@keyframes pulse {\n\t0% {\n\t\ttransform: translate(-50%, -50%) scale(0.95);\n\t}\n\t70% {\n\t\ttransform: translate(-50%, -50%) scale(1.1);\n\t}\n\t100% {\n\t\ttransform: translate(-50%, -50%) scale(0.95);\n\t}\n}\n\n.pokiSdkProgressContainer {\n\tbackground: #B8C7DD;\n\twidth: 100%;\n\theight: 5px;\n\tposition: absolute;\n\tbottom: 0;\n\tz-index: 9999;\n}\n\n.pokiSdkProgressBar {\n\tposition:relative;\n\tbottom:0px;\n\tbackground: #FFDC00;\n\theight: 100%;\n\twidth: 0%;\n\ttransition: width 0.5s;\n\ttransition-timing-function: linear;\n}\n\n.pokiSdkProgressBar.pokiSdkVisible, .pokiSdkPauseButton.pokiSdkVisible, .pokiSdkStartAdButton.pokiSdkVisible {\n\tdisplay: block;\n\tpointer-events: auto;\n}\n\n.pokiSdkProgressBar.pokiSdkHidden, .pokiSdkPauseButton.pokiSdkHidden, .pokiSdkStartAdButton.pokiSdkHidden {\n\tdisplay: none;\n\tpointer-events: none;\n}\n", document.head.appendChild(i) + } + } + return e.prototype.updateProgressBar = function(e) { + this.progressBar.style.width = e + "%" + }, e.prototype.setupEvents = function(e) { + this.internalSDK = e + }, e.prototype.hide = function() { + this.hideElement(this.containerDiv), this.hideElement(this.progressContainer), this.hidePauseButton(), this.hideElement(this.startAdButton), this.containerDiv.classList.remove(re), this.progressBar.style.width = "0%", this.progressFaker.reset() + }, e.prototype.hideSpinner = function() { + this.hideElement(this.spinnerContainer) + }, e.prototype.show = function() { + this.containerDiv.classList.add(re), this.showElement(this.containerDiv), this.showElement(this.spinnerContainer), this.showElement(this.progressContainer), this.progressFaker.start() + }, e.prototype.getVideoBounds = function() { + return this.adContainer.getBoundingClientRect() + }, e.prototype.getAdContainer = function() { + return this.adContainer + }, e.prototype.getVideoContainer = function() { + return this.videoContainer + }, e.prototype.showPauseButton = function() { + this.showElement(this.pauseButton), this.internalSDK && this.pauseButton.addEventListener("click", this.internalSDK.resumeAd.bind(this.internalSDK)) + }, e.prototype.hidePauseButton = function() { + this.hideElement(this.pauseButton), this.internalSDK && this.pauseButton.removeEventListener("click", this.internalSDK.resumeAd.bind(this.internalSDK)) + }, e.prototype.showStartAdButton = function() { + this.showElement(this.startAdButton), this.internalSDK && this.startAdButton.addEventListener("click", this.internalSDK.startAdClicked.bind(this.internalSDK)) + }, e.prototype.hideStartAdButton = function() { + this.hideElement(this.startAdButton), this.internalSDK && this.startAdButton.removeEventListener("click", this.internalSDK.startAdClicked.bind(this.internalSDK)) + }, e.prototype.createElements = function(e) { + var t = this; + this.containerDiv = document.createElement("div"), this.insideContainer = document.createElement("div"), this.pauseButton = document.createElement("div"), this.pauseButtonBG = document.createElement("div"), this.startAdButton = document.createElement("div"), this.progressBar = document.createElement("div"), this.progressContainer = document.createElement("div"), this.spinnerContainer = document.createElement("div"), this.adContainer = document.createElement("div"), this.videoContainer = document.createElement("video"), this.adContainer.id = "pokiSDKAdContainer", this.videoContainer.id = "pokiSDKVideoContainer", this.containerDiv.className = ie, this.insideContainer.className = ae, this.pauseButton.className = se, this.pauseButtonBG.className = de, this.pauseButton.appendChild(this.pauseButtonBG), this.startAdButton.className = Ae, this.startAdButton.innerHTML = "Tap anywhere to play ad", this.progressBar.className = ce, this.progressContainer.className = le, this.spinnerContainer.className = ue, this.adContainer.className = me, this.videoContainer.className = pe, this.hide(), this.videoContainer.setAttribute("playsinline", "playsinline"), this.videoContainer.setAttribute("muted", "muted"), this.containerDiv.appendChild(this.insideContainer), this.containerDiv.appendChild(this.spinnerContainer), this.insideContainer.appendChild(this.progressContainer), this.insideContainer.appendChild(this.videoContainer), this.insideContainer.appendChild(this.adContainer), this.containerDiv.appendChild(this.pauseButton), this.containerDiv.appendChild(this.startAdButton), this.progressContainer.appendChild(this.progressBar); + var i = e || null, + n = function() { + if (i || (i = document.body), i) + if (i.appendChild(t.containerDiv), i === document.body) t.containerDiv.classList.add(ne); + else { + var e = window.getComputedStyle(i).position; + e && -1 !== ["absolute", "fixed", "relative"].indexOf(e) || (i.style.position = "relative") + } + else window.requestAnimationFrame(n) + }; + !i || i instanceof HTMLElement || (i = null, console.error("POKI-SDK: wrapper is not a HTMLElement, falling back to document.body")), n() + }, e + }(); + var ve = function() { + function e(e) { + var t = this; + this.storedQueue = [], this.progressCallback = e, this.reset(), a.addEventListener(n.ads.video.progress, (function(e) { + var i = 100 - t.currentProgress, + n = e.currentTime / e.duration * i; + n < i && t.progressCallback(t.currentProgress + n) + })), this.initializeNoProgressFix() + } + return e.prototype.queueFakeProgress = function(e, t, i) { + var n = this; + this.storedQueue.push({ + progressToFake: e, + duration: t, + stopEvent: i + }), a.addEventListener(i, (function() { + n.eventWatcher[i] = !0, n.currentProgress = n.startProgress + e, n.startProgress = n.currentProgress, n.progressCallback(n.currentProgress), n.activeQueue.shift(), n.activeQueue.length > 0 ? n.continue() : n.pause() + })) + }, e.prototype.fakeProgress = function(e, t, i) { + this.activeQueue.push({ + progressToFake: e, + duration: t, + stopEvent: i + }), this.fakeProgressEvents = !0, this.continue() + }, e.prototype.start = function() { + this.activeQueue.length > 0 || (this.activeQueue = ge([], this.storedQueue, !0), this.active = !0, this.continue()) + }, e.prototype.continue = function() { + if (this.activeQueue.length > 0 && !this.tickInterval) { + this.startTime = Date.now(); + this.tickInterval = window.setInterval(this.tick.bind(this), 50), this.active = !0 + } + }, e.prototype.pause = function() { + this.clearInterval() + }, e.prototype.tick = function() { + var e = this.activeQueue[0], + t = Date.now() - this.startTime, + i = Math.min(t / e.duration, 1); + this.currentProgress = this.startProgress + e.progressToFake * i, this.fakeProgressEvents && a.dispatchEvent(n.ads.video.progress, { + duration: e.duration / 1e3, + currentTime: t / 1e3 + }), this.progressCallback(this.currentProgress), (this.eventWatcher[e.stopEvent] || 1 === i) && this.pause() + }, e.prototype.clearInterval = function() { + this.tickInterval && (clearInterval(this.tickInterval), this.tickInterval = 0) + }, e.prototype.initializeNoProgressFix = function() { + var e = this; + a.addEventListener(n.ads.started, (function(t) { + e.progressWatcherTimeout = window.setTimeout((function() { + if (e.active) { + var i = 100 - e.currentProgress, + r = 1e3 * t.duration - 1e3; + e.fakeProgress(i, r, n.ads.completed) + } + }), 1e3) + })), a.addEventListener(n.ads.video.progress, (function() { + e.progressWatcherTimeout && (clearTimeout(e.progressWatcherTimeout), e.progressWatcherTimeout = 0) + })) + }, e.prototype.reset = function() { + this.eventWatcher = {}, this.startProgress = 0, this.startTime = 0, this.currentProgress = 0, this.activeQueue = [], this.active = !1, this.fakeProgressEvents = !1, this.clearInterval() + }, e + }(), + be = !0, + ke = {}; + + function ye() { + if (document.body && document.body.appendChild) { + var e = document.createElement("iframe"); + if (e.style.display = "none", document.body.appendChild(e), e.contentWindow && (window.pokiKeysChanged = new Map, e.contentWindow.document.open(), e.contentWindow.document.write(" + + Just Fall + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +
      + + + + + \ No newline at end of file diff --git a/justfalllol/mobileRedirect.js b/justfalllol/mobileRedirect.js new file mode 100644 index 00000000..bce218c1 --- /dev/null +++ b/justfalllol/mobileRedirect.js @@ -0,0 +1,20 @@ +var userAgent = navigator.userAgent || navigator.vendor || window.opera; + +if (/bot|crawler|spider|crawling/i.test(userAgent)) { + // do nothing +} + +// Windows Phone +else if (/windows phone/i.test(userAgent)) { + //window.location.replace("/mobile"); +} + +// Android +else if (/android/i.test(userAgent)) { + //window.location.replace("https://play.google.com/store/apps/details?id=lol.justfall"); +} + +// iOS +else if ((/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform))) { + //window.location.replace("https://apps.apple.com/app/id1551844218"); +} \ No newline at end of file diff --git a/justfalllol/rise.js b/justfalllol/rise.js new file mode 100644 index 00000000..b3ae3815 --- /dev/null +++ b/justfalllol/rise.js @@ -0,0 +1,71 @@ +//init the interstitial ads + +var interstitialInstance; +var interstitialLoaded = false; + +window.playerConfigs = { + '61712797ab1f86000190f30a': { + plugins: { + interstitial: { + enabled: true, + zIndex: 20000, + closeButton: true + } + } + } +} + +window.srInterstitialCallback = { + '61712797ab1f86000190f30a': function (error, player) { + if (error) { + console.log(error); + interstitialLoaded = false; + } + + interstitialInstance = player; + + player.on('interstitialready', function () { + console.log('interstitialready'); + interstitialLoaded = true; + }); + + player.on('interstitialnofill', function () { + console.log('interstitialnofill'); + interstitialLoaded = false; + }); + + player.on('interstitialexpired', function () { + console.log('interstitialexpired'); + interstitialLoaded = false; + }); + + player.on('interstitialcomplete', function () { + console.log('interstitialcomplete'); + interstitialLoaded = false; + + unityAdFinishedCallback(1); + }); + } +} + +function requestNewAd() { + console.log("requested AD"); + + if (interstitialInstance && interstitialLoaded) { + interstitialInstance.displayInterstitial(); + } + else { + unityAdFinishedCallback(0); + } +} + +// This function calls Unity to tell the ad finished +function unityAdFinishedCallback(isSuccess) { + try { + if(gameInstance) + gameInstance.SendMessage('AdsManager', 'OnWebCallback', isSuccess); + } + catch(error) { + console.log(error); + } +} \ No newline at end of file diff --git a/justfalllol/splash.jpg b/justfalllol/splash.jpg new file mode 100644 index 00000000..c836079d Binary files /dev/null and b/justfalllol/splash.jpg differ diff --git a/justfalllol/style.css b/justfalllol/style.css new file mode 100644 index 00000000..87f42cbb --- /dev/null +++ b/justfalllol/style.css @@ -0,0 +1,209 @@ +html { + box-sizing: border-box; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +body { + margin: 0; + background: #000!important; + overflow: hidden; +} + +#gameContainer { + width: 100vw; + height: 100vh; + background: #000!important; +} + +canvas { + width: 100%; + height: 100%; + display: block; +} +/* try to handle mobile dialog */ + +canvas + * { + z-index: 2; +} + +.progress { + margin: 1.5em; + border: 1px solid white; + width: 35vw; + display: none; + position: fixed; + bottom: 15%; +} + +.progress .full { + margin: 2px; + background: white; + height: 1em; + transform-origin: top left; +} + +#loader { + position: absolute; + left: 0; + top: 0; + width: 100vw; + height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background-image: url("splash.jpg"); + background-size: 100% auto; + background-position: center; + background-repeat: no-repeat; +} + +.spinner, +.spinner:after { + border-radius: 50%; + width: 5em; + height: 5em; +} + +.spinner { + margin: 10px; + font-size: 10px; + position: relative; + text-indent: -9999em; + border-top: 1.1em solid rgba(255, 255, 255, 0.2); + border-right: 1.1em solid rgba(255, 255, 255, 0.2); + border-bottom: 1.1em solid rgba(255, 255, 255, 0.2); + border-left: 1.1em solid #ffffff; + transform: translateZ(0); + animation: spinner-spin 1.1s infinite linear; +} + +@keyframes spinner-spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +.ad { + background: rgba(0, 0, 0, 0.4); + overflow: hidden; + display: none; +} + +.modal{ + background:rgba(0,0,0,.4); + display:none; + height:100%; + width: 100%; + position:fixed; + z-index:10000; + top: 0; + left: 0; + bottom: 0; + right: 0; +} + +.modalContent{ + margin: auto; + width: 100%; +} + +.centered { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +/* The Close Button */ +.close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} + +#continueWindow{ + background-color: #fefefe; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 30%; +} + +#adWindow{ + background: #4382f5; + border: 10px solid #4382f5; + width: 660px; + border-top: 0; + height: 540px; +} + +.ads{ + height:100%; + display: flex; + flex-direction: column; + justify-content: space-evenly; + position: absolute; + z-index:40; +} + +.ad-rectangle-bottom { + width: 304px; + height: 258px; + border-style: solid; + border-width: 4px 4px 4px 0px; + border-color: rgba(0, 0, 0, 0.01); +} + +.ad-rectangle-upper { + width: 304px; + height: 258px; + border-style: solid; + border-width: 4px 4px 4px 0px; + border-color: rgba(0, 0, 0, 0.01); +} +.ad-leaderboard-bottom { + width: 304px; + height: 608px; + border-style: solid; + border-width: 4px 4px 4px 0px; + border-color: rgba(0, 0, 0, 0.01); +} + +@media (min-height: 900px) { + .ad-smallscreen{ + display: none; + } +} + +@media (max-height: 900px) { + .ad-largescreen{ + display: none; + } +} + +#adWindow { + border: 10px solid #4382f5 !important; + height: 500px !important; +} + +a[onclick*="showConsentToolSettings"] { + right: 0px; + left: auto !important; +} \ No newline at end of file diff --git a/justfalllol/unnamed.png b/justfalllol/unnamed.png new file mode 100644 index 00000000..dc7334be Binary files /dev/null and b/justfalllol/unnamed.png differ diff --git a/nutsim/index.html b/nutsim/index.html index 52aed61d..d0b436e7 100644 --- a/nutsim/index.html +++ b/nutsim/index.html @@ -208,9 +208,11 @@ diff --git a/nutsim/js/main.js b/nutsim/js/main.js index a6b8b1a3..16cdc085 100644 --- a/nutsim/js/main.js +++ b/nutsim/js/main.js @@ -1755,6 +1755,7 @@ function UpdateDamage(){ } function CheckMobile(){ + /* var ratio = window.innerWidth / window.innerHeight; if(ratio < 0.745 && page == "index.html"){ window.location.href = "mobile.html"; @@ -1762,7 +1763,9 @@ function CheckMobile(){ window.location.href = "index.html"; } else if (ratio < 0.745 && page == ""){ window.location.href = "mobile.html"; + } + */ } function Gamble(level){ diff --git a/soccerrandom/box2d.wasm b/soccerrandom/box2d.wasm new file mode 100644 index 00000000..106566ad Binary files /dev/null and b/soccerrandom/box2d.wasm differ diff --git a/soccerrandom/box2d.wasm.js b/soccerrandom/box2d.wasm.js new file mode 100644 index 00000000..630d78b3 --- /dev/null +++ b/soccerrandom/box2d.wasm.js @@ -0,0 +1,577 @@ +self.Box2DWasmModule = function(Box2D) { + Box2D = Box2D || {}; + var Module = Box2D; + +var b;b||(b=eval("(function() { try { return Box2D || {} } catch(e) { return {} } })()"));var aa={},ba;for(ba in b)b.hasOwnProperty(ba)&&(aa[ba]=b[ba]);var ca=!1,da=!1,ea=!1,fa=!1; +if(b.ENVIRONMENT)if("WEB"===b.ENVIRONMENT)ca=!0;else if("WORKER"===b.ENVIRONMENT)da=!0;else if("NODE"===b.ENVIRONMENT)ea=!0;else if("SHELL"===b.ENVIRONMENT)fa=!0;else throw Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ca="object"===typeof window,da="function"===typeof importScripts,ea="object"===typeof process&&"function"===typeof require&&!ca&&!da,fa=!ca&&!ea&&!da; +if(ea){b.print||(b.print=console.log);b.printErr||(b.printErr=console.warn);var ga,ha;b.read=function(a,c){ga||(ga=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);var d=ga.readFileSync(a);return c?d:d.toString()};b.readBinary=function(a){a=b.read(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a};b.load=function(a){ia(read(a))};b.thisProgram||(b.thisProgram=1 0) var gc = undefined");else if(ca||da)b.read=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.send(null);return c.responseText},da&&(b.readBinary=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}), +b.readAsync=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)},"undefined"!=typeof arguments&&(b.arguments=arguments),"undefined"!==typeof console?(b.print||(b.print=function(a){console.log(a)}),b.printErr||(b.printErr=function(a){console.warn(a)})):b.print||(b.print=function(){}),da&&(b.load=importScripts),"undefined"===typeof b.setWindowTitle&&(b.setWindowTitle= +function(a){document.title=a});else throw"Unknown runtime environment. Where are we?";function ia(a){eval.call(null,a)}!b.load&&b.read&&(b.load=function(a){ia(b.read(a))});b.print||(b.print=function(){});b.printErr||(b.printErr=b.print);b.arguments||(b.arguments=[]);b.thisProgram||(b.thisProgram="./this.program");b.quit||(b.quit=function(a,c){throw c;});b.print=b.print;b.h=b.printErr;b.preRun=[];b.postRun=[];for(ba in aa)aa.hasOwnProperty(ba)&&(b[ba]=aa[ba]); +var aa=void 0,f={f:function(a){return tempRet0=a},H:function(){return tempRet0},L:function(){return ka},K:function(a){ka=a},s:function(a){switch(a){case "i1":case "i8":return 1;case "i16":return 2;case "i32":return 4;case "i64":return 8;case "float":return 4;case "double":return 8;default:return"*"===a[a.length-1]?f.j:"i"===a[0]?(a=parseInt(a.substr(1)),assert(0===a%8),a/8):0}},F:function(a){return Math.max(f.s(a),f.j)},M:16,aa:function(a,c){"double"===c||"i64"===c?a&7&&(assert(4===(a&7)),a+=4):assert(0=== +(a&3));return a},U:function(a,c,d){return d||"i64"!=a&&"double"!=a?a?Math.min(c||(a?f.F(a):0),f.j):Math.min(c,8):8},l:function(a,c,d){return d&&d.length?b["dynCall_"+a].apply(null,[c].concat(d)):b["dynCall_"+a].call(null,c)},d:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],v:function(a){for(var c=0;c>2];a=(c+a+15|0)&-16;ma[oa>>2]=a;return a>=pa&&!qa()?(ma[oa>>2]=c,0):c},p:function(a,c){return Math.ceil(a/(c?c:16))*(c?c:16)},$:function(a,c,d){return d?+(a>>>0)+4294967296*+(c>>>0):+(a>>>0)+4294967296*+(c|0)},i:1024,j:4,N:0};f.addFunction=f.v;f.removeFunction=f.J;var ra=0;function assert(a,c){a||ta("Assertion failed: "+c)} +function ua(a){var c;c="i32";"*"===c.charAt(c.length-1)&&(c="i32");switch(c){case "i1":return va[a>>0];case "i8":return va[a>>0];case "i16":return ya[a>>1];case "i32":return ma[a>>2];case "i64":return ma[a>>2];case "float":return za[a>>2];case "double":return Aa[a>>3];default:ta("invalid type for setValue: "+c)}return null} +function Ba(a,c,d){var e,g,l;"number"===typeof a?(g=!0,l=a):(g=!1,l=a.length);var m="string"===typeof c?c:null,D;4==d?D=e:D=["function"===typeof Ca?Ca:f.u,f.t,f.u,f.D][void 0===d?2:d](Math.max(l,m?1:c.length));if(g){e=D;assert(0==(D&3));for(a=D+(l&-4);e>2]=0;for(a=D+l;e>0]=0;return D}if("i8"===m)return a.subarray||a.slice?Da.set(a,D):Da.set(new Uint8Array(a),D),D;e=0;for(var na,wa;e>0]=G;break;case "i8":va[g>>0]=G;break;case "i16":ya[g>>1]=G;break;case "i32":ma[g>>2]=G;break;case "i64":tempI64=[G>>>0,(tempDouble=G,1<=+Ea(tempDouble)?0>>0:~~+Ia((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)];ma[g>>2]=tempI64[0];ma[g+4>>2]=tempI64[1];break;case "float":za[g>>2]=G;break;case "double":Aa[g>>3]=G;break;default:ta("invalid type for setValue: "+ +Ga)}wa!==d&&(na=f.s(d),wa=d);e+=na}}return D}function Ja(a){var c;if(0===c||!a)return"";for(var d=0,e,g=0;;){e=Da[a+g>>0];d|=e;if(0==e&&!c)break;g++;if(c&&g==c)break}c||(c=g);e="";if(128>d){for(;0=l&&(l=65536+((l&1023)<<10)|a.charCodeAt(++g)&1023);if(127>=l){if(d>=e)break;c[d++]=l}else{if(2047>=l){if(d+1>=e)break;c[d++]=192|l>>6}else{if(65535>=l){if(d+2>=e)break;c[d++]=224|l>>12}else{if(2097151>=l){if(d+3>=e)break;c[d++]=240|l>>18}else{if(67108863>=l){if(d+4>=e)break;c[d++]=248|l>>24}else{if(d+5>=e)break;c[d++]=252|l>>30;c[d++]=128|l>>24&63}c[d++]=128|l>>18&63}c[d++]=128|l>>12&63}c[d++]= +128|l>>6&63}c[d++]=128|l&63}}c[d]=0}}function Oa(a){for(var c=0,d=0;d=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:2097151>=e?c+4:67108863>=e?c+5:c+6}return c}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le"); +function Pa(a){return a.replace(/__Z[\w\d_]+/g,function(a){var d;a:{var e=b.___cxa_demangle||b.__cxa_demangle;if(e)try{var g=a.substr(1),l=Oa(g)+1,m=Ca(l);La(g,Da,m,l);var D=Ca(4),na=e(m,0,0,D);if(0===ua(D)&&na){d=Ja(na);break a}}catch(wa){}finally{m&&Qa(m),D&&Qa(D),na&&Qa(na)}else f.g("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");d=a}return a===d?a:a+" ["+d+"]"})} +function Ra(){var a;a:{a=Error();if(!a.stack){try{throw Error(0);}catch(c){a=c}if(!a.stack){a="(no stack trace available)";break a}}a=a.stack.toString()}b.extraStackTrace&&(a+="\n"+b.extraStackTrace());return Pa(a)}var Sa=65536,Ua=16777216,Va=16777216;function Wa(a,c){0>2]>c)return!1;var d=pa;for(pa=Math.max(pa,Va);pa>2];)536870912>=pa?pa=Wa(2*pa,a):pa=Math.min(Wa((3*pa+2147483648)/4,a),c);a=b.reallocBuffer(pa);if(!a||a.byteLength!=pa)return pa=d,!1;b.buffer=buffer=a;Za();return!0}var eb; +try{eb=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),eb(new ArrayBuffer(4))}catch(fb){eb=function(a){return a.byteLength}}var gb=b.TOTAL_STACK||5242880,pa=b.TOTAL_MEMORY||16777216;pa>>16)*e+d*(c>>>16)<<16)|0});Math.Y=Math.imul; +if(!Math.fround){var sb=new Float32Array(1);Math.fround=function(a){sb[0]=a;return sb[0]}}Math.S=Math.fround;Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var c=0;32>c;c++)if(a&1<<31-c)return c;return 32});Math.P=Math.clz32;Math.trunc||(Math.trunc=function(a){return 0>a?Math.ceil(a):Math.floor(a)});Math.trunc=Math.trunc;var Ea=Math.abs,Ia=Math.ceil,Ha=Math.floor,Fa=Math.min,tb=0,vb=null,wb=null;function xb(){tb++;b.monitorRunDependencies&&b.monitorRunDependencies(tb)} +function yb(){tb--;b.monitorRunDependencies&&b.monitorRunDependencies(tb);if(0==tb&&(null!==vb&&(clearInterval(vb),vb=null),wb)){var a=wb;wb=null;a()}}b.preloadedImages={};b.preloadedAudios={};var zb=null; +(function(a){function c(c){c=Wa(c,a.usingWasm?Sa:Ua);var d=a.buffer,e=d.byteLength;if(a.usingWasm)try{return-1!==a.wasmMemory.grow((c-e)/65536)?a.buffer=a.wasmMemory.buffer:null}catch(g){return null}else return lb.__growWasmMemory((c-e)/65536),a.buffer!==d?a.buffer:null}function d(a,c){var d=Ta;if(0>a.indexOf("."))d=(d||{})[a];else var e=a.split("."),d=(d||{})[e[0]],d=(d||{})[e[1]];c&&(d=(d||{})[c]);void 0===d&&ta("bad lookupImport to ("+a+")."+c);return d}function e(c){var d=a.buffer;c.byteLength< +d.byteLength&&a.printErr("the new buffer in mergeMemory is smaller than the previous one. in native wasm, we should grow memory here");var d=new Int8Array(d),e=new Int8Array(c);zb||d.set(e.subarray(a.STATIC_BASE,a.STATIC_BASE+a.STATIC_BUMP),a.STATIC_BASE);e.set(d);b.buffer=buffer=c;Za()}function g(){try{var c;if(a.wasmBinary)c=a.wasmBinary,c=new Uint8Array(c);else if(a.readBinary)c=a.readBinary(G);else throw"on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)"; +return c}catch(d){ta(d)}}function l(){return a.wasmBinary||"function"!==typeof fetch?new Promise(function(a){a(g())}):fetch(G,{Q:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+G+"'";return a.arrayBuffer()})}function m(c,d,e){if("function"!==typeof a.asm||a.asm===Ma)a.asmPreload?a.asm=a.asmPreload:eval(a.read(Ga));return"function"!==typeof a.asm?(a.printErr("asm evalling did not set the module properly"),!1):a.asm(c,d,e)}function D(c,d){function g(c){lb=c.exports; +lb.memory&&e(lb.memory);a.asm=lb;a.usingWasm=!0;yb()}if("object"!==typeof WebAssembly)return a.printErr("no native wasm support detected"),!1;if(!(a.wasmMemory instanceof WebAssembly.Memory))return a.printErr("no native wasm Memory in use"),!1;d.memory=a.wasmMemory;Ta.global={NaN:NaN,Infinity:Infinity};Ta["global.Math"]=c.Math;Ta.env=d;xb();if(a.instantiateWasm)try{return a.instantiateWasm(Ta,g)}catch(m){return a.printErr("Module.instantiateWasm callback failed with error: "+m),!1}l().then(function(a){return WebAssembly.instantiate(a, +Ta)}).then(function(a){g(a.instance)}).catch(function(c){a.printErr("failed to asynchronously prepare wasm: "+c);ta(c)});return{}}var na=a.wasmJSMethod||"native-wasm";a.wasmJSMethod=na;var wa=a.wasmTextFile||"Box2D_v2.3.1_min.wasm.wast",G=a.wasmBinaryFile||"Box2D_v2.3.1_min.wasm.wasm",Ga=a.asmjsCodeFile||"Box2D_v2.3.1_min.wasm.temp.asm.js";"function"===typeof a.locateFile&&(wa=a.locateFile(wa),G=a.locateFile(G),Ga=a.locateFile(Ga));var Ta={global:null,env:null,asm2wasm:{"f64-rem":function(a,c){return a% +c},"f64-to-int":function(a){return a|0},"i32s-div":function(a,c){return(a|0)/(c|0)|0},"i32u-div":function(a,c){return(a>>>0)/(c>>>0)>>>0},"i32s-rem":function(a,c){return(a|0)%(c|0)|0},"i32u-rem":function(a,c){return(a>>>0)%(c>>>0)>>>0},"debugger":function(){debugger}},parent:a},lb=null;a.asmPreload=a.asm;var ub=a.reallocBuffer;a.reallocBuffer=function(a){return"asmjs"===qc?ub(a):c(a)};var qc="";a.asm=function(c,l,G){if(!l.table){var Ma=a.wasmTableSize;void 0===Ma&&(Ma=1024);var mb=a.wasmMaxTableSize; +l.table="object"===typeof WebAssembly&&"function"===typeof WebAssembly.Table?void 0!==mb?new WebAssembly.Table({initial:Ma,maximum:mb,element:"anyfunc"}):new WebAssembly.Table({initial:Ma,element:"anyfunc"}):Array(Ma);a.wasmTable=l.table}l.memoryBase||(l.memoryBase=a.STATIC_BASE);l.tableBase||(l.tableBase=0);for(var V,Ma=na.split(","),mb=0;mb>2]}var Lb={},Mb={};b._sbrk=Nb;var Ob=1; +function Pb(){var a=Eb;if(!a)return(f.f(0),0)|0;var c=Gb[a],d=c.type;if(!d)return(f.f(0),a)|0;var e=Array.prototype.slice.call(arguments);b.___cxa_is_pointer_type(d);Pb.buffer||(Pb.buffer=Ca(4));ma[Pb.buffer>>2]=a;for(var a=Pb.buffer,g=0;g>2],c.w=a,(f.f(e[g]),a)|0;a=ma[a>>2];return(f.f(d),a)|0}b._llvm_bswap_i32=Qb; +function Rb(a,c){Jb=c;try{var d=Kb(),e=Kb(),g=Kb(),l=0;Rb.buffer||(Rb.e=[null,[],[]],Rb.q=function(a,c){var d=Rb.e[a];assert(d);if(0===c||10===c){var e=1===a?b.print:b.printErr,g;a:{for(var l=g=0;d[l];)++l;if(16m?l+=String.fromCharCode(m):(m-=65536,l+=String.fromCharCode(55296|m>>10,56320|m&1023)))):l+=String.fromCharCode(m)}}e(g);d.length=0}else d.push(c)});for(var m=0;m>2],na=ma[e+(8*m+4)>>2],wa=0;wa>2]=cb;b.wasmTableSize=1152;b.wasmMaxTableSize=1152;b.A={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:Infinity,byteLength:eb}; +b.B={abort:ta,assert:assert,enlargeMemory:qa,getTotalMemory:function(){return pa},abortOnCannotGrowMemory:function(){ta("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+pa+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")},invoke_iiii:function(a,c,d,e){try{return b.dynCall_iiii(a,c,d,e)}catch(g){if("number"!== +typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_iiii:function(a,c,d,e){return f.d[a](c,d,e)},invoke_viifii:function(a,c,d,e,g,l){try{b.dynCall_viifii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viifii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_viiiii:function(a,c,d,e,g,l){try{b.dynCall_viiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_viiiii:function(a,c,d,e,g,l){f.d[a](c,d,e,g,l)},invoke_vi:function(a, +c){try{b.dynCall_vi(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_vi:function(a,c){f.d[a](c)},invoke_vii:function(a,c,d){try{b.dynCall_vii(a,c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_vii:function(a,c,d){f.d[a](c,d)},invoke_ii:function(a,c){try{return b.dynCall_ii(a,c)}catch(d){if("number"!==typeof d&&"longjmp"!==d)throw d;b.setThrew(1,0)}},jsCall_ii:function(a,c){return f.d[a](c)},invoke_fif:function(a,c,d){try{return b.dynCall_fif(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_fif:function(a,c,d){return f.d[a](c,d)},invoke_viii:function(a,c,d,e){try{b.dynCall_viii(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viii:function(a,c,d,e){f.d[a](c,d,e)},invoke_viifi:function(a,c,d,e,g){try{b.dynCall_viifi(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viifi:function(a,c,d,e,g){f.d[a](c,d,e,g)},invoke_v:function(a){try{b.dynCall_v(a)}catch(c){if("number"!== +typeof c&&"longjmp"!==c)throw c;b.setThrew(1,0)}},jsCall_v:function(a){f.d[a]()},invoke_viif:function(a,c,d,e){try{b.dynCall_viif(a,c,d,e)}catch(g){if("number"!==typeof g&&"longjmp"!==g)throw g;b.setThrew(1,0)}},jsCall_viif:function(a,c,d,e){f.d[a](c,d,e)},invoke_viiiiii:function(a,c,d,e,g,l,m){try{b.dynCall_viiiiii(a,c,d,e,g,l,m)}catch(D){if("number"!==typeof D&&"longjmp"!==D)throw D;b.setThrew(1,0)}},jsCall_viiiiii:function(a,c,d,e,g,l,m){f.d[a](c,d,e,g,l,m)},invoke_iii:function(a,c,d){try{return b.dynCall_iii(a, +c,d)}catch(e){if("number"!==typeof e&&"longjmp"!==e)throw e;b.setThrew(1,0)}},jsCall_iii:function(a,c,d){return f.d[a](c,d)},invoke_iiiiii:function(a,c,d,e,g,l){try{return b.dynCall_iiiiii(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_iiiiii:function(a,c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_fiiiif:function(a,c,d,e,g,l){try{return b.dynCall_fiiiif(a,c,d,e,g,l)}catch(m){if("number"!==typeof m&&"longjmp"!==m)throw m;b.setThrew(1,0)}},jsCall_fiiiif:function(a, +c,d,e,g,l){return f.d[a](c,d,e,g,l)},invoke_viiii:function(a,c,d,e,g){try{b.dynCall_viiii(a,c,d,e,g)}catch(l){if("number"!==typeof l&&"longjmp"!==l)throw l;b.setThrew(1,0)}},jsCall_viiii:function(a,c,d,e,g){f.d[a](c,d,e,g)},_emscripten_asm_const_iiiii:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_emscripten_asm_const_diiiid:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},_pthread_key_create:function(a){if(0==a)return 22;ma[a>>2]=Ob;Mb[Ob]=0;Ob++;return 0},_abort:function(){b.abort()},___gxx_personality_v0:function(){}, +_emscripten_asm_const_iiidii:function(a,c,d,e,g,l){return Ab[a](c,d,e,g,l)},___assert_fail:function(a,c,d,e){ra=!0;throw"Assertion failed: "+Ja(a)+", at: "+[c?Ja(c):"unknown filename",d,e?Ja(e):"unknown function"]+" at "+Ra();},__ZSt18uncaught_exceptionv:Db,___setErrNo:function(a){b.___errno_location&&(ma[b.___errno_location()>>2]=a);return a},___cxa_begin_catch:function(a){var c=Gb[a];c&&!c.C&&(c.C=!0,Db.e--);c&&(c.da=!1);Fb.push(a);a:{if(a&&!Gb[a])for(var d in Gb)if(Gb[d].w===a){c=d;break a}c=a}c&& +Gb[c].ba++;return a},_emscripten_memcpy_big:function(a,c,d){Da.set(Da.subarray(c,c+d),a);return a},___resumeException:function(a){Eb||(Eb=a);throw a+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.";},___cxa_find_matching_catch:Pb,_pthread_getspecific:function(a){return Mb[a]||0},_pthread_once:Hb,___syscall54:function(a,c){Jb=c;return 0},_emscripten_asm_const_iii:function(a,c,d){return Ab[a](c, +d)},_emscripten_asm_const_iiidi:function(a,c,d,e,g){return Ab[a](c,d,e,g)},_pthread_setspecific:function(a,c){if(!(a in Mb))return 22;Mb[a]=c;return 0},_emscripten_asm_const_iiii:function(a,c,d,e){return Ab[a](c,d,e)},___syscall6:function(a,c){Jb=c;try{var d=Lb.G();FS.close(d);return 0}catch(e){return"undefined"!==typeof FS&&e instanceof FS.o||ta(e),-e.r}},___syscall140:function(a,c){Jb=c;try{var d=Lb.G();Kb();var e=Kb(),g=Kb(),l=Kb();FS.Z(d,e,l);ma[g>>2]=d.position;d.I&&0===e&&0===l&&(d.I=null); +return 0}catch(m){return"undefined"!==typeof FS&&m instanceof FS.o||ta(m),-m.r}},___cxa_pure_virtual:function(){ra=!0;throw"Pure virtual function called!";},___syscall146:Rb,DYNAMICTOP_PTR:oa,tempDoublePtr:Bb,ABORT:ra,STACKTOP:ka,STACK_MAX:bb};var Sb=b.asm(b.A,b.B,buffer);b.asm=Sb; +var Tb=b._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringDampingRatio_0.apply(null,arguments)},Ub=b._emscripten_bind_b2ContactEdge_set_next_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_next_1.apply(null,arguments)},Vb=b._emscripten_bind_b2ChainShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_count_0.apply(null,arguments)},Wb=b._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_motorSpeed_0.apply(null, +arguments)},Xb=b._emscripten_bind_b2PulleyJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_SetUserData_1.apply(null,arguments)},Yb=b._emscripten_bind_b2Shape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2Shape_ComputeAABB_3.apply(null,arguments)},Zb=b._emscripten_bind_b2FrictionJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_userData_1.apply(null,arguments)},$b=b._emscripten_bind_b2MouseJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MouseJoint_IsActive_0.apply(null, +arguments)},ac=b._emscripten_bind_b2World_IsLocked_0=function(){return b.asm._emscripten_bind_b2World_IsLocked_0.apply(null,arguments)},bc=b._emscripten_bind_b2Draw_GetFlags_0=function(){return b.asm._emscripten_bind_b2Draw_GetFlags_0.apply(null,arguments)},cc=b._emscripten_bind_b2FrictionJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_IsActive_0.apply(null,arguments)},dc=b._emscripten_bind_b2Color_set_g_1=function(){return b.asm._emscripten_bind_b2Color_set_g_1.apply(null, +arguments)},ec=b._emscripten_bind_b2PolygonShape_RayCast_4=function(){return b.asm._emscripten_bind_b2PolygonShape_RayCast_4.apply(null,arguments)},fc=b._emscripten_bind_b2World_GetTreeBalance_0=function(){return b.asm._emscripten_bind_b2World_GetTreeBalance_0.apply(null,arguments)},gc=b._emscripten_bind_b2ChainShape_get_m_vertices_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_vertices_0.apply(null,arguments)},hc=b._emscripten_bind_JSDraw_DrawSolidCircle_4=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidCircle_4.apply(null, +arguments)},ic=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorA_0.apply(null,arguments)},jc=b._emscripten_bind_b2FixtureDef_get_filter_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_filter_0.apply(null,arguments)},kc=b._emscripten_bind_b2FrictionJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_type_0.apply(null,arguments)},lc=b._emscripten_bind_b2MotorJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_type_1.apply(null, +arguments)},mc=b._emscripten_bind_b2FixtureDef_set_userData_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_userData_1.apply(null,arguments)},nc=b._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex3_1.apply(null,arguments)},oc=b._emscripten_bind_b2JointEdge_set_joint_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_joint_1.apply(null,arguments)},pc=b._emscripten_bind_b2Fixture___destroy___0=function(){return b.asm._emscripten_bind_b2Fixture___destroy___0.apply(null, +arguments)},rc=b._emscripten_bind_b2World_SetWarmStarting_1=function(){return b.asm._emscripten_bind_b2World_SetWarmStarting_1.apply(null,arguments)},sc=b._emscripten_bind_JSDraw_DrawCircle_3=function(){return b.asm._emscripten_bind_JSDraw_DrawCircle_3.apply(null,arguments)},tc=b._emscripten_bind_b2WeldJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WeldJoint_IsActive_0.apply(null,arguments)},uc=b._emscripten_bind_b2DestructionListener___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListener___destroy___0.apply(null, +arguments)},vc=b._emscripten_bind_b2BodyDef_set_type_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_type_1.apply(null,arguments)},wc=b._emscripten_bind_b2ChainShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeAABB_3.apply(null,arguments)},xc=b._emscripten_bind_b2PulleyJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetUserData_0.apply(null,arguments)},yc=b._emscripten_bind_b2WeldJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionTorque_1.apply(null, +arguments)},zc=b._emscripten_bind_b2MotorJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxForce_0.apply(null,arguments)},Ac=b._emscripten_bind_b2DistanceJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_userData_0.apply(null,arguments)},Bc=b._emscripten_bind_b2BodyDef_get_position_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_position_0.apply(null,arguments)},Cc=b._emscripten_bind_b2RevoluteJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_userData_1.apply(null,arguments)},Dc=b._emscripten_bind_b2WorldManifold_b2WorldManifold_0=function(){return b.asm._emscripten_bind_b2WorldManifold_b2WorldManifold_0.apply(null,arguments)},Ec=b._emscripten_bind_b2WheelJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_collideConnected_0.apply(null,arguments)},Fc=b._emscripten_bind_b2MouseJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_userData_1.apply(null, +arguments)};b.stackSave=function(){return b.asm.stackSave.apply(null,arguments)}; +var Gc=b._emscripten_bind_b2FixtureDef_set_restitution_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_restitution_1.apply(null,arguments)},Hc=b._emscripten_bind_b2RevoluteJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUserData_0.apply(null,arguments)},Ic=b._emscripten_bind_b2Mat33_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ey_0.apply(null,arguments)},Jc=b._emscripten_bind_b2MouseJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetCollideConnected_0.apply(null, +arguments)},Kc=b._emscripten_bind_b2World_GetGravity_0=function(){return b.asm._emscripten_bind_b2World_GetGravity_0.apply(null,arguments)},Lc=b._emscripten_bind_b2Mat33_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ey_1.apply(null,arguments)},Mc=b._emscripten_bind_b2Profile_get_broadphase_0=function(){return b.asm._emscripten_bind_b2Profile_get_broadphase_0.apply(null,arguments)},Nc=b._emscripten_bind_b2PulleyJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyA_0.apply(null, +arguments)},Oc=b._emscripten_bind_b2PrismaticJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetLimits_2.apply(null,arguments)},Pc=b._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorA_0.apply(null,arguments)},Qc=b._emscripten_bind_b2DistanceJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorA_0.apply(null,arguments)},Rc=b._emscripten_bind_b2DistanceJointDef_set_userData_1= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_userData_1.apply(null,arguments)},Sc=b._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_dampingRatio_1.apply(null,arguments)},Tc=b._emscripten_bind_b2RopeJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_collideConnected_1.apply(null,arguments)},Uc=b._emscripten_bind_b2ChainShape_set_m_nextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_nextVertex_1.apply(null, +arguments)},Vc=b._emscripten_bind_JSContactListener_EndContact_1=function(){return b.asm._emscripten_bind_JSContactListener_EndContact_1.apply(null,arguments)},Wc=b._emscripten_bind_b2MassData_set_mass_1=function(){return b.asm._emscripten_bind_b2MassData_set_mass_1.apply(null,arguments)},Xc=b._emscripten_bind_b2Vec3_get_x_0=function(){return b.asm._emscripten_bind_b2Vec3_get_x_0.apply(null,arguments)},Yc=b._emscripten_bind_b2ChainShape_CreateChain_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateChain_2.apply(null, +arguments)},Zc=b._emscripten_bind_b2RopeJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetUserData_0.apply(null,arguments)},$c=b._emscripten_bind_b2World_DestroyBody_1=function(){return b.asm._emscripten_bind_b2World_DestroyBody_1.apply(null,arguments)},ad=b._emscripten_bind_b2Profile_get_solvePosition_0=function(){return b.asm._emscripten_bind_b2Profile_get_solvePosition_0.apply(null,arguments)},bd=b._emscripten_bind_b2Shape_RayCast_4=function(){return b.asm._emscripten_bind_b2Shape_RayCast_4.apply(null, +arguments)},cd=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorA_0.apply(null,arguments)},dd=b._emscripten_bind_b2Mat33___destroy___0=function(){return b.asm._emscripten_bind_b2Mat33___destroy___0.apply(null,arguments)},ed=b._emscripten_bind_b2GearJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionTorque_1.apply(null,arguments)},fd=b._emscripten_bind_b2WeldJointDef_set_collideConnected_1= +function(){return b.asm._emscripten_bind_b2WeldJointDef_set_collideConnected_1.apply(null,arguments)},gd=b._emscripten_bind_b2JointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2JointDef_get_collideConnected_0.apply(null,arguments)};b.getTempRet0=function(){return b.asm.getTempRet0.apply(null,arguments)}; +var hd=b._emscripten_bind_b2FrictionJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxTorque_0.apply(null,arguments)},id=b._emscripten_bind_JSQueryCallback_JSQueryCallback_0=function(){return b.asm._emscripten_bind_JSQueryCallback_JSQueryCallback_0.apply(null,arguments)},jd=b._emscripten_bind_b2World_SetAutoClearForces_1=function(){return b.asm._emscripten_bind_b2World_SetAutoClearForces_1.apply(null,arguments)},kd=b._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1= +function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_lowerTranslation_1.apply(null,arguments)},ld=b._emscripten_bind_b2Contact_GetTangentSpeed_0=function(){return b.asm._emscripten_bind_b2Contact_GetTangentSpeed_0.apply(null,arguments)},md=b._emscripten_bind_b2BodyDef_set_position_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_position_1.apply(null,arguments)},nd=b._emscripten_bind_b2Transform_get_q_0=function(){return b.asm._emscripten_bind_b2Transform_get_q_0.apply(null,arguments)}, +od=b._emscripten_bind_b2PolygonShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_count_1.apply(null,arguments)},pd=b._emscripten_bind_b2Contact_GetNext_0=function(){return b.asm._emscripten_bind_b2Contact_GetNext_0.apply(null,arguments)},qd=b._emscripten_bind_b2MotorJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_userData_1.apply(null,arguments)},rd=b._emscripten_bind_b2GearJoint_GetJoint1_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint1_0.apply(null, +arguments)},sd=b._emscripten_bind_b2World_GetProxyCount_0=function(){return b.asm._emscripten_bind_b2World_GetProxyCount_0.apply(null,arguments)},td=b._emscripten_bind_b2MotorJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxTorque_1.apply(null,arguments)},ud=b._emscripten_bind_b2GearJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorA_0.apply(null,arguments)},vd=b._emscripten_bind_b2MouseJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyA_1.apply(null, +arguments)},wd=b._emscripten_bind_b2World_SetContactListener_1=function(){return b.asm._emscripten_bind_b2World_SetContactListener_1.apply(null,arguments)},xd=b._emscripten_bind_b2Body_IsAwake_0=function(){return b.asm._emscripten_bind_b2Body_IsAwake_0.apply(null,arguments)},yd=b._emscripten_bind_b2JointEdge_set_other_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_other_1.apply(null,arguments)},zd=b._emscripten_bind_b2MouseJointDef_set_target_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_target_1.apply(null, +arguments)},db=b._emscripten_replace_memory=function(){return b.asm._emscripten_replace_memory.apply(null,arguments)},Ad=b._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetCorrectionFactor_1.apply(null,arguments)},Bd=b._emscripten_bind_b2FixtureDef_get_density_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_density_0.apply(null,arguments)},Cd=b._emscripten_bind_b2GearJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetRatio_0.apply(null, +arguments)},Dd=b._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_upperTranslation_0.apply(null,arguments)},Ed=b._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReferenceAngle_0.apply(null,arguments)},Fd=b._emscripten_bind_b2MotorJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_collideConnected_0.apply(null,arguments)}, +Gd=b._emscripten_enum_b2ManifoldType_e_circles=function(){return b.asm._emscripten_enum_b2ManifoldType_e_circles.apply(null,arguments)},Hd=b._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorB_1.apply(null,arguments)},Id=b._emscripten_bind_b2RevoluteJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_Initialize_3.apply(null,arguments)},Jd=b._emscripten_bind_b2FixtureDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_userData_0.apply(null, +arguments)},Kd=b._emscripten_bind_b2DistanceJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetUserData_0.apply(null,arguments)},Ld=b._emscripten_bind_b2FrictionJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_collideConnected_1.apply(null,arguments)},Md=b._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_lowerTranslation_0.apply(null,arguments)},Nd= +b._emscripten_bind_b2GearJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetCollideConnected_0.apply(null,arguments)},Od=b._emscripten_bind_b2Filter_b2Filter_0=function(){return b.asm._emscripten_bind_b2Filter_b2Filter_0.apply(null,arguments)},Pd=b._emscripten_bind_b2MouseJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_type_1.apply(null,arguments)},Qd=b._emscripten_bind_b2Body_ApplyAngularImpulse_2=function(){return b.asm._emscripten_bind_b2Body_ApplyAngularImpulse_2.apply(null, +arguments)},Rd=b._emscripten_enum_b2JointType_e_frictionJoint=function(){return b.asm._emscripten_enum_b2JointType_e_frictionJoint.apply(null,arguments)},Sd=b._emscripten_bind_b2RayCastOutput_set_fraction_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_fraction_1.apply(null,arguments)},Td=b._emscripten_bind_b2Color_set_r_1=function(){return b.asm._emscripten_bind_b2Color_set_r_1.apply(null,arguments)},Ud=b._emscripten_bind_b2DistanceJointDef_get_length_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_length_0.apply(null, +arguments)},Vd=b._emscripten_bind_b2PulleyJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyB_0.apply(null,arguments)},Wd=b._emscripten_bind_b2WheelJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_type_1.apply(null,arguments)},Xd=b._emscripten_bind_b2World_GetTreeQuality_0=function(){return b.asm._emscripten_bind_b2World_GetTreeQuality_0.apply(null,arguments)},Yd=b._emscripten_bind_b2BodyDef_set_gravityScale_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_gravityScale_1.apply(null, +arguments)},Zd=b._emscripten_bind_b2RopeJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyB_1.apply(null,arguments)},$d=b._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLowerLimit_0.apply(null,arguments)},ae=b._emscripten_bind_b2AABB_get_lowerBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_lowerBound_0.apply(null,arguments)},be=b._emscripten_bind_b2WheelJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMotorSpeed_1.apply(null, +arguments)},ce=b._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_referenceAngle_0.apply(null,arguments)},de=b._emscripten_bind_b2Body_SetMassData_1=function(){return b.asm._emscripten_bind_b2Body_SetMassData_1.apply(null,arguments)},ee=b._emscripten_bind_b2BodyDef_get_angularVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularVelocity_0.apply(null,arguments)},fe=b._emscripten_bind_b2WeldJoint_SetDampingRatio_1= +function(){return b.asm._emscripten_bind_b2WeldJoint_SetDampingRatio_1.apply(null,arguments)},ge=b._emscripten_bind_b2PrismaticJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef___destroy___0.apply(null,arguments)},he=b._emscripten_bind_b2Contact_IsTouching_0=function(){return b.asm._emscripten_bind_b2Contact_IsTouching_0.apply(null,arguments)},ie=b._emscripten_bind_b2Draw_SetFlags_1=function(){return b.asm._emscripten_bind_b2Draw_SetFlags_1.apply(null,arguments)}, +je=b._emscripten_bind_b2AABB_Contains_1=function(){return b.asm._emscripten_bind_b2AABB_Contains_1.apply(null,arguments)},ke=b._emscripten_bind_b2DistanceJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetNext_0.apply(null,arguments)},le=b._emscripten_bind_b2EdgeShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_radius_1.apply(null,arguments)},me=b._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_dampingRatio_0.apply(null, +arguments)},ne=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorA_0.apply(null,arguments)},oe=b._emscripten_bind_b2PrismaticJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetType_0.apply(null,arguments)},pe=b._emscripten_bind_b2Fixture_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Fixture_GetRestitution_0.apply(null,arguments)},qe=b._emscripten_bind_b2Transform_set_q_1=function(){return b.asm._emscripten_bind_b2Transform_set_q_1.apply(null, +arguments)},re=b._emscripten_bind_b2PolygonShape___destroy___0=function(){return b.asm._emscripten_bind_b2PolygonShape___destroy___0.apply(null,arguments)},se=b._emscripten_bind_b2AABB_get_upperBound_0=function(){return b.asm._emscripten_bind_b2AABB_get_upperBound_0.apply(null,arguments)},te=b._emscripten_bind_b2Transform___destroy___0=function(){return b.asm._emscripten_bind_b2Transform___destroy___0.apply(null,arguments)},ue=b._emscripten_bind_b2Body_GetLinearVelocity_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocity_0.apply(null, +arguments)},ve=b._emscripten_bind_b2CircleShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_radius_1.apply(null,arguments)},we=b._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_hasVertex0_1.apply(null,arguments)},xe=b._emscripten_bind_b2Contact_GetWorldManifold_1=function(){return b.asm._emscripten_bind_b2Contact_GetWorldManifold_1.apply(null,arguments)},ye=b._emscripten_bind_b2RopeJoint_GetMaxLength_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetMaxLength_0.apply(null, +arguments)},ze=b._emscripten_bind_b2GearJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetUserData_0.apply(null,arguments)},Ae=b._emscripten_bind_b2MotorJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCollideConnected_0.apply(null,arguments)},Be=b._emscripten_bind_b2GearJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_type_1.apply(null,arguments)},Ce=b._emscripten_bind_b2DistanceJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetDampingRatio_1.apply(null, +arguments)},De=b._emscripten_bind_b2Contact_GetFixtureA_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureA_0.apply(null,arguments)},Ee=b._emscripten_bind_b2PulleyJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_ratio_0.apply(null,arguments)},Fe=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorB_0.apply(null,arguments)},Ge=b._emscripten_bind_b2CircleShape_set_m_type_1= +function(){return b.asm._emscripten_bind_b2CircleShape_set_m_type_1.apply(null,arguments)},He=b._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorA_1.apply(null,arguments)},Ie=b._emscripten_bind_b2RopeJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorB_0.apply(null,arguments)},Je=b._emscripten_bind_b2AABB_set_upperBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_upperBound_1.apply(null, +arguments)},Ke=b._emscripten_bind_JSRayCastCallback_ReportFixture_4=function(){return b.asm._emscripten_bind_JSRayCastCallback_ReportFixture_4.apply(null,arguments)},Le=b._emscripten_bind_b2ContactImpulse___destroy___0=function(){return b.asm._emscripten_bind_b2ContactImpulse___destroy___0.apply(null,arguments)},Me=b._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorB_0.apply(null,arguments)},Ne=b._emscripten_bind_b2PulleyJointDef_set_lengthB_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthB_1.apply(null,arguments)},Oe=b._emscripten_bind_b2RayCastInput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastInput___destroy___0.apply(null,arguments)},Pe=b._emscripten_bind_b2Body_ApplyForceToCenter_2=function(){return b.asm._emscripten_bind_b2Body_ApplyForceToCenter_2.apply(null,arguments)},Qe=b._emscripten_bind_JSDestructionListener_JSDestructionListener_0=function(){return b.asm._emscripten_bind_JSDestructionListener_JSDestructionListener_0.apply(null, +arguments)},Re=b._emscripten_bind_b2WheelJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorA_1.apply(null,arguments)},Se=b._emscripten_bind_b2FrictionJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyB_0.apply(null,arguments)},Te=b._emscripten_bind_b2WeldJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyA_1.apply(null,arguments)},Ue=b._emscripten_bind_b2DistanceJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyB_0.apply(null, +arguments)},Ve=b._emscripten_enum_b2JointType_e_wheelJoint=function(){return b.asm._emscripten_enum_b2JointType_e_wheelJoint.apply(null,arguments)},We=b._emscripten_bind_b2JointDef___destroy___0=function(){return b.asm._emscripten_bind_b2JointDef___destroy___0.apply(null,arguments)},Xe=b._emscripten_bind_b2ContactEdge___destroy___0=function(){return b.asm._emscripten_bind_b2ContactEdge___destroy___0.apply(null,arguments)},Ye=b._emscripten_bind_b2Filter_get_groupIndex_0=function(){return b.asm._emscripten_bind_b2Filter_get_groupIndex_0.apply(null, +arguments)},Ze=b._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_localAnchorA_0.apply(null,arguments)},$e=b._emscripten_bind_b2CircleShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetChildCount_0.apply(null,arguments)},af=b._emscripten_bind_b2BodyDef_get_bullet_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_bullet_0.apply(null,arguments)},bf=b._emscripten_bind_b2Color_set_b_1=function(){return b.asm._emscripten_bind_b2Color_set_b_1.apply(null, +arguments)},cf=b._emscripten_bind_b2Mat33_get_ez_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ez_0.apply(null,arguments)},df=b._emscripten_bind_b2MassData_get_center_0=function(){return b.asm._emscripten_bind_b2MassData_get_center_0.apply(null,arguments)},ef=b._emscripten_bind_b2WeldJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyB_0.apply(null,arguments)},ff=b._emscripten_bind_b2WheelJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionForce_1.apply(null, +arguments)},gf=b._emscripten_bind_b2World_SetSubStepping_1=function(){return b.asm._emscripten_bind_b2World_SetSubStepping_1.apply(null,arguments)},hf=b._emscripten_bind_b2Vec2_op_add_1=function(){return b.asm._emscripten_bind_b2Vec2_op_add_1.apply(null,arguments)},jf=b._emscripten_bind_JSDraw_DrawSegment_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSegment_3.apply(null,arguments)},kf=b._emscripten_bind_b2Joint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2Joint_GetCollideConnected_0.apply(null, +arguments)},lf=b._emscripten_bind_b2MotorJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionTorque_1.apply(null,arguments)},mf=b._emscripten_bind_b2FrictionJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyB_0.apply(null,arguments)},nf=b._emscripten_bind_b2WheelJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJointDef___destroy___0.apply(null,arguments)},of=b._emscripten_bind_b2BodyDef_get_gravityScale_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_gravityScale_0.apply(null,arguments)},pf=b._emscripten_bind_b2Vec3_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec3_SetZero_0.apply(null,arguments)},qf=b._emscripten_enum_b2JointType_e_pulleyJoint=function(){return b.asm._emscripten_enum_b2JointType_e_pulleyJoint.apply(null,arguments)},rf=b._emscripten_bind_b2ChainShape_get_m_nextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_nextVertex_0.apply(null,arguments)}, +sf=b._emscripten_bind_b2Contact_SetEnabled_1=function(){return b.asm._emscripten_bind_b2Contact_SetEnabled_1.apply(null,arguments)},tf=b._emscripten_bind_b2Shape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_radius_1.apply(null,arguments)},uf=b._emscripten_bind_b2World_SetDebugDraw_1=function(){return b.asm._emscripten_bind_b2World_SetDebugDraw_1.apply(null,arguments)},vf=b._emscripten_bind_b2ContactID_set_key_1=function(){return b.asm._emscripten_bind_b2ContactID_set_key_1.apply(null, +arguments)},Ca=b._malloc=function(){return b.asm._malloc.apply(null,arguments)},wf=b._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMaxMotorTorque_0.apply(null,arguments)},xf=b._emscripten_bind_b2Vec2_Normalize_0=function(){return b.asm._emscripten_bind_b2Vec2_Normalize_0.apply(null,arguments)},yf=b._emscripten_bind_b2WheelJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointSpeed_0.apply(null,arguments)},zf= +b._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorA_1.apply(null,arguments)},Af=b._emscripten_bind_b2ChainShape_set_m_vertices_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_vertices_1.apply(null,arguments)},Bf=b._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0=function(){return b.asm._emscripten_bind_JSRayCastCallback_JSRayCastCallback_0.apply(null,arguments)},Cf=b._emscripten_bind_b2RayCastInput_set_p2_1= +function(){return b.asm._emscripten_bind_b2RayCastInput_set_p2_1.apply(null,arguments)},Df=b._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_motorSpeed_0.apply(null,arguments)},Ef=b._emscripten_bind_b2Manifold_get_pointCount_0=function(){return b.asm._emscripten_bind_b2Manifold_get_pointCount_0.apply(null,arguments)},Ff=b._emscripten_bind_b2RayCastOutput_get_normal_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_normal_0.apply(null, +arguments)},Gf=b._emscripten_bind_b2WeldJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetBodyA_0.apply(null,arguments)},Hf=b._emscripten_enum_b2DrawFlag_e_jointBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_jointBit.apply(null,arguments)},If=b._emscripten_bind_b2FixtureDef_get_isSensor_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_isSensor_0.apply(null,arguments)},Jf=b._emscripten_bind_b2PrismaticJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_Initialize_4.apply(null, +arguments)},Kf=b._emscripten_bind_b2PulleyJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyB_1.apply(null,arguments)},Lf=b._emscripten_bind_b2WheelJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJoint_EnableMotor_1.apply(null,arguments)},Mf=b._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointSpeed_0.apply(null,arguments)},Nf=b._emscripten_bind_JSDraw_DrawSolidPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawSolidPolygon_3.apply(null, +arguments)},Of=b._emscripten_bind_b2Rot_Set_1=function(){return b.asm._emscripten_bind_b2Rot_Set_1.apply(null,arguments)},Pf=b._emscripten_bind_b2RevoluteJoint_GetJointAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetJointAngle_0.apply(null,arguments)},Qf=b._emscripten_bind_JSDraw___destroy___0=function(){return b.asm._emscripten_bind_JSDraw___destroy___0.apply(null,arguments)},Rf=b._emscripten_bind_b2MouseJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJointDef___destroy___0.apply(null, +arguments)},Sf=b._emscripten_bind_b2Mat33_Solve22_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve22_1.apply(null,arguments)},Tf=b._emscripten_bind_b2Profile_set_solvePosition_1=function(){return b.asm._emscripten_bind_b2Profile_set_solvePosition_1.apply(null,arguments)},Uf=b._emscripten_bind_b2ContactFilter___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFilter___destroy___0.apply(null,arguments)},Vf=b._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorA_0.apply(null, +arguments)},Wf=b._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasPrevVertex_1.apply(null,arguments)},Xf=b._emscripten_bind_b2Joint_SetUserData_1=function(){return b.asm._emscripten_bind_b2Joint_SetUserData_1.apply(null,arguments)},Yf=b._emscripten_bind_b2DistanceJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetUserData_1.apply(null,arguments)},Zf=b._emscripten_bind_b2PrismaticJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PrismaticJoint___destroy___0.apply(null, +arguments)},$f=b._emscripten_bind_b2RopeJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_bodyA_1.apply(null,arguments)},ag=b._emscripten_bind_b2GearJoint___destroy___0=function(){return b.asm._emscripten_bind_b2GearJoint___destroy___0.apply(null,arguments)},bg=b._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointTranslation_0.apply(null,arguments)},cg=b._emscripten_bind_b2ManifoldPoint_get_id_0= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_id_0.apply(null,arguments)},dg=b._emscripten_bind_b2CircleShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_radius_0.apply(null,arguments)},eg=b._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorSpeed_0.apply(null,arguments)},fg=b._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetGroundAnchorB_0.apply(null, +arguments)},gg=b._emscripten_bind_b2Vec3_op_add_1=function(){return b.asm._emscripten_bind_b2Vec3_op_add_1.apply(null,arguments)},hg=b._emscripten_bind_b2FrictionJoint_GetType_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetType_0.apply(null,arguments)},ig=b._emscripten_bind_b2MouseJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetMaxForce_0.apply(null,arguments)},jg=b._emscripten_bind_b2MouseJoint_SetTarget_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetTarget_1.apply(null, +arguments)},kg=b._emscripten_bind_b2MouseJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_dampingRatio_0.apply(null,arguments)},lg=b._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorSpeed_0.apply(null,arguments)},mg=b._emscripten_bind_b2ChainShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_type_1.apply(null,arguments)},ng=b._emscripten_bind_b2RevoluteJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyB_1.apply(null,arguments)},og=b._emscripten_bind_b2Rot_GetXAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetXAxis_0.apply(null,arguments)},pg=b._emscripten_bind_b2Mat33_b2Mat33_0=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_0.apply(null,arguments)},qg=b._emscripten_bind_b2MouseJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyB_0.apply(null,arguments)},rg=b._emscripten_bind_b2Body_GetWorldVector_1= +function(){return b.asm._emscripten_bind_b2Body_GetWorldVector_1.apply(null,arguments)},sg=b._emscripten_bind_b2WeldJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_frequencyHz_0.apply(null,arguments)},tg=b._emscripten_bind_b2GearJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_ratio_1.apply(null,arguments)},ug=b._emscripten_bind_b2Manifold___destroy___0=function(){return b.asm._emscripten_bind_b2Manifold___destroy___0.apply(null, +arguments)},vg=b._emscripten_bind_b2PulleyJointDef_set_lengthA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_lengthA_1.apply(null,arguments)},wg=b._emscripten_bind_b2Contact_IsEnabled_0=function(){return b.asm._emscripten_bind_b2Contact_IsEnabled_0.apply(null,arguments)};b.stackRestore=function(){return b.asm.stackRestore.apply(null,arguments)}; +var xg=b._emscripten_bind_b2World_CreateJoint_1=function(){return b.asm._emscripten_bind_b2World_CreateJoint_1.apply(null,arguments)},yg=b._emscripten_bind_b2PulleyJointDef_set_ratio_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_ratio_1.apply(null,arguments)},zg=b._emscripten_bind_b2JointEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_prev_1.apply(null,arguments)},Ag=b._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionTorque_1.apply(null, +arguments)},Bg=b._emscripten_bind_b2Body_GetLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalPoint_1.apply(null,arguments)},Cg=b._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetCollideConnected_0.apply(null,arguments)},Dg=b._emscripten_bind_b2DistanceJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_IsActive_0.apply(null,arguments)},Eg=b._emscripten_bind_b2RopeJoint_GetLimitState_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLimitState_0.apply(null, +arguments)},Fg=b._emscripten_bind_b2Profile_get_solveTOI_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveTOI_0.apply(null,arguments)},Gg=b._emscripten_bind_b2Vec2_b2Vec2_0=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_0.apply(null,arguments)},Hg=b._emscripten_bind_b2DistanceJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetAnchorB_0.apply(null,arguments)},Ig=b._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_maxMotorTorque_0.apply(null, +arguments)},Jg=b._emscripten_bind_b2Vec2_op_sub_1=function(){return b.asm._emscripten_bind_b2Vec2_op_sub_1.apply(null,arguments)},Kg=b._emscripten_bind_b2CircleShape_get_m_p_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_p_0.apply(null,arguments)},Lg=b._emscripten_bind_b2ContactFeature_get_indexA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexA_0.apply(null,arguments)},Mg=b._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_b2MotorJointDef_0.apply(null, +arguments)},Ng=b._emscripten_bind_b2RevoluteJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableLimit_1.apply(null,arguments)},Og=b._emscripten_bind_b2ContactEdge_get_next_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_next_0.apply(null,arguments)},Pg=b._emscripten_bind_b2AABB_GetPerimeter_0=function(){return b.asm._emscripten_bind_b2AABB_GetPerimeter_0.apply(null,arguments)},Qg=b._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetCollideConnected_0.apply(null, +arguments)},Rg=b._emscripten_bind_b2Mat33_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat33_get_ex_0.apply(null,arguments)},Sg=b._emscripten_bind_b2Body_GetPosition_0=function(){return b.asm._emscripten_bind_b2Body_GetPosition_0.apply(null,arguments)},Tg=b._emscripten_bind_b2Profile___destroy___0=function(){return b.asm._emscripten_bind_b2Profile___destroy___0.apply(null,arguments)},Ug=b._emscripten_bind_b2ContactEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_prev_0.apply(null, +arguments)},Vg=b._emscripten_bind_b2DistanceJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetFrequency_1.apply(null,arguments)},Wg=b._emscripten_bind_b2Fixture_GetBody_0=function(){return b.asm._emscripten_bind_b2Fixture_GetBody_0.apply(null,arguments)},Xg=b._emscripten_bind_b2ContactImpulse_set_count_1=function(){return b.asm._emscripten_bind_b2ContactImpulse_set_count_1.apply(null,arguments)},Yg=b._emscripten_bind_b2FixtureDef_set_shape_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_shape_1.apply(null, +arguments)},Zg=b._emscripten_bind_b2PulleyJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_bodyB_0.apply(null,arguments)},$g=b._emscripten_bind_b2ChainShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildCount_0.apply(null,arguments)},ah=b._emscripten_bind_b2CircleShape_b2CircleShape_0=function(){return b.asm._emscripten_bind_b2CircleShape_b2CircleShape_0.apply(null,arguments)},bh=b._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionTorque_1.apply(null,arguments)},ch=b._emscripten_bind_b2Fixture_SetDensity_1=function(){return b.asm._emscripten_bind_b2Fixture_SetDensity_1.apply(null,arguments)},dh=b._emscripten_bind_b2ChainShape_get_m_prevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_prevVertex_0.apply(null,arguments)},eh=b._emscripten_bind_b2AABB_GetExtents_0=function(){return b.asm._emscripten_bind_b2AABB_GetExtents_0.apply(null,arguments)}, +fh=b._emscripten_bind_b2World_ClearForces_0=function(){return b.asm._emscripten_bind_b2World_ClearForces_0.apply(null,arguments)},gh=b._emscripten_bind_b2Vec3___destroy___0=function(){return b.asm._emscripten_bind_b2Vec3___destroy___0.apply(null,arguments)},hh=b._emscripten_bind_b2WheelJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_userData_1.apply(null,arguments)},ih=b._emscripten_bind_b2WeldJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetFrequency_1.apply(null, +arguments)},jh=b._emscripten_bind_JSContactListener_PreSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PreSolve_2.apply(null,arguments)},kh=b._emscripten_bind_b2Body_SetFixedRotation_1=function(){return b.asm._emscripten_bind_b2Body_SetFixedRotation_1.apply(null,arguments)},lh=b._emscripten_bind_b2RayCastOutput_set_normal_1=function(){return b.asm._emscripten_bind_b2RayCastOutput_set_normal_1.apply(null,arguments)},mh=b._emscripten_bind_b2DistanceJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetDampingRatio_0.apply(null, +arguments)},nh=b._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMaxMotorTorque_1.apply(null,arguments)},oh=b._emscripten_bind_b2RevoluteJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_EnableMotor_1.apply(null,arguments)},ph=b._emscripten_bind_b2Contact_GetChildIndexB_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexB_0.apply(null,arguments)},qh=b._emscripten_bind_b2MouseJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MouseJointDef_set_bodyB_1.apply(null,arguments)},rh=b._emscripten_bind_b2CircleShape_GetType_0=function(){return b.asm._emscripten_bind_b2CircleShape_GetType_0.apply(null,arguments)},sh=b._emscripten_bind_b2PolygonShape_GetType_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetType_0.apply(null,arguments)},th=b._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_referenceAngle_1.apply(null, +arguments)},uh=b._emscripten_bind_b2RopeJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_collideConnected_0.apply(null,arguments)},vh=b._emscripten_bind_b2FixtureDef_set_filter_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_filter_1.apply(null,arguments)},wh=b._emscripten_bind_b2Body_ApplyTorque_2=function(){return b.asm._emscripten_bind_b2Body_ApplyTorque_2.apply(null,arguments)},xh=b._emscripten_bind_b2RevoluteJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJoint___destroy___0.apply(null, +arguments)},yh=b._emscripten_bind_b2FrictionJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_userData_0.apply(null,arguments)},zh=b._emscripten_bind_b2RayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastCallback___destroy___0.apply(null,arguments)},Ah=b._emscripten_bind_b2RevoluteJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_bodyA_1.apply(null,arguments)},Bh=b._emscripten_bind_b2MotorJoint_SetUserData_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetUserData_1.apply(null,arguments)},Ch=b._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAxisA_0.apply(null,arguments)},Dh=b._emscripten_bind_b2MotorJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyB_0.apply(null,arguments)},Eh=b._emscripten_bind_b2Transform_Set_2=function(){return b.asm._emscripten_bind_b2Transform_Set_2.apply(null,arguments)},Fh= +b._emscripten_bind_b2MotorJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetBodyA_0.apply(null,arguments)};b.stackAlloc=function(){return b.asm.stackAlloc.apply(null,arguments)}; +var Gh=b._emscripten_bind_b2Draw_AppendFlags_1=function(){return b.asm._emscripten_bind_b2Draw_AppendFlags_1.apply(null,arguments)},Hh=b._emscripten_bind_b2EdgeShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetChildCount_0.apply(null,arguments)},Ih=b._emscripten_bind_b2Contact_ResetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_ResetFriction_0.apply(null,arguments)},Jh=b._emscripten_bind_b2Profile_set_solveTOI_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveTOI_1.apply(null, +arguments)},Kh=b._emscripten_bind_b2PrismaticJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_type_1.apply(null,arguments)},Lh=b._emscripten_bind_b2AABB_GetCenter_0=function(){return b.asm._emscripten_bind_b2AABB_GetCenter_0.apply(null,arguments)},Mh=b._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringFrequencyHz_1.apply(null,arguments)},Nh=b._emscripten_bind_b2FrictionJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJointDef___destroy___0.apply(null, +arguments)},Oh=b._emscripten_bind_b2PrismaticJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReactionForce_1.apply(null,arguments)},Ph=b._emscripten_bind_b2Transform_b2Transform_0=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_0.apply(null,arguments)},Qh=b._emscripten_enum_b2LimitState_e_equalLimits=function(){return b.asm._emscripten_enum_b2LimitState_e_equalLimits.apply(null,arguments)},Rh=b._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1= +function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_normalImpulse_1.apply(null,arguments)},Sh=b._emscripten_bind_b2Body_IsFixedRotation_0=function(){return b.asm._emscripten_bind_b2Body_IsFixedRotation_0.apply(null,arguments)},Th=b._emscripten_enum_b2DrawFlag_e_shapeBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_shapeBit.apply(null,arguments)},Uh=b._emscripten_bind_b2Contact_GetFriction_0=function(){return b.asm._emscripten_bind_b2Contact_GetFriction_0.apply(null,arguments)},Vh= +b._emscripten_bind_b2Body_GetContactList_0=function(){return b.asm._emscripten_bind_b2Body_GetContactList_0.apply(null,arguments)},Wh=b._emscripten_bind_b2DistanceJointDef_set_length_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_length_1.apply(null,arguments)},Xh=b._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLocalAnchorB_0.apply(null,arguments)},Yh=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorB_0.apply(null, +arguments)},Zh=b._emscripten_bind_b2World_b2World_1=function(){return b.asm._emscripten_bind_b2World_b2World_1.apply(null,arguments)},$h=b._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsLimitEnabled_0.apply(null,arguments)},ai=b._emscripten_bind_b2DistanceJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_type_0.apply(null,arguments)},bi=b._emscripten_bind_b2Draw_ClearFlags_1=function(){return b.asm._emscripten_bind_b2Draw_ClearFlags_1.apply(null, +arguments)},ci=b._emscripten_bind_b2Body_SetAngularDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularDamping_1.apply(null,arguments)},di=b._emscripten_bind_b2Body_IsActive_0=function(){return b.asm._emscripten_bind_b2Body_IsActive_0.apply(null,arguments)},ei=b._emscripten_bind_b2Contact_ResetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_ResetRestitution_0.apply(null,arguments)},fi=b._emscripten_bind_b2World_GetAllowSleeping_0=function(){return b.asm._emscripten_bind_b2World_GetAllowSleeping_0.apply(null, +arguments)},gi=b._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_b2ManifoldPoint_0.apply(null,arguments)},hi=b._emscripten_bind_b2EdgeShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_type_1.apply(null,arguments)},ii=b._emscripten_enum_b2JointType_e_unknownJoint=function(){return b.asm._emscripten_enum_b2JointType_e_unknownJoint.apply(null,arguments)},ji=b._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableMotor_1.apply(null,arguments)},ki=b._emscripten_bind_b2PulleyJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_IsActive_0.apply(null,arguments)},li=b._emscripten_bind_b2MouseJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetNext_0.apply(null,arguments)},mi=b._emscripten_bind_b2RevoluteJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetUserData_1.apply(null, +arguments)},ni=b._emscripten_bind_b2Manifold_get_localPoint_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localPoint_0.apply(null,arguments)},oi=b._emscripten_bind_b2PulleyJointDef_get_lengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthB_0.apply(null,arguments)},pi=b._emscripten_bind_b2WeldJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WeldJoint_SetUserData_1.apply(null,arguments)},qi=b._emscripten_bind_b2ChainShape_CreateLoop_2=function(){return b.asm._emscripten_bind_b2ChainShape_CreateLoop_2.apply(null, +arguments)},ri=b._emscripten_bind_b2GearJointDef_get_joint1_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint1_0.apply(null,arguments)},si=b._emscripten_bind_b2PrismaticJoint_GetMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMotorForce_1.apply(null,arguments)},ti=b._emscripten_bind_b2Body_SetUserData_1=function(){return b.asm._emscripten_bind_b2Body_SetUserData_1.apply(null,arguments)},ui=b._emscripten_bind_b2GearJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2GearJoint_IsActive_0.apply(null, +arguments)},vi=b._emscripten_bind_b2EdgeShape_get_m_vertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex0_0.apply(null,arguments)},wi=b._emscripten_enum_b2JointType_e_revoluteJoint=function(){return b.asm._emscripten_enum_b2JointType_e_revoluteJoint.apply(null,arguments)},xi=b._emscripten_bind_b2Vec2_get_x_0=function(){return b.asm._emscripten_bind_b2Vec2_get_x_0.apply(null,arguments)},yi=b._emscripten_bind_b2WeldJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_collideConnected_0.apply(null, +arguments)},zi=b._emscripten_bind_b2FrictionJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxTorque_0.apply(null,arguments)},Ai=b._emscripten_bind_b2EdgeShape_RayCast_4=function(){return b.asm._emscripten_bind_b2EdgeShape_RayCast_4.apply(null,arguments)},Bi=b._emscripten_bind_b2BodyDef_set_allowSleep_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_allowSleep_1.apply(null,arguments)},Ci=b._emscripten_bind_b2PulleyJoint_GetType_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetType_0.apply(null, +arguments)},Di=b._emscripten_bind_b2WeldJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorA_1.apply(null,arguments)},Ei=b._emscripten_bind_b2Profile_set_step_1=function(){return b.asm._emscripten_bind_b2Profile_set_step_1.apply(null,arguments)},Fi=b._emscripten_bind_b2ContactEdge_set_other_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_other_1.apply(null,arguments)},Gi=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthB_0.apply(null, +arguments)},Hi=b._emscripten_bind_b2Vec2_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec2_op_mul_1.apply(null,arguments)},Ii=b._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAnchorA_0.apply(null,arguments)},Ji=b._emscripten_bind_b2EdgeShape___destroy___0=function(){return b.asm._emscripten_bind_b2EdgeShape___destroy___0.apply(null,arguments)},Ki=b._emscripten_bind_b2PolygonShape_get_m_count_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_count_0.apply(null, +arguments)},Li=b._emscripten_bind_b2RopeJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetAnchorA_0.apply(null,arguments)},Mi=b._emscripten_bind_b2DistanceJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyA_0.apply(null,arguments)},Ni=b._emscripten_bind_b2AABB_Combine_2=function(){return b.asm._emscripten_bind_b2AABB_Combine_2.apply(null,arguments)},Oi=b._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_tangentImpulse_1.apply(null, +arguments)},Pi=b._emscripten_bind_b2BodyDef_get_allowSleep_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_allowSleep_0.apply(null,arguments)},Qi=b._emscripten_bind_b2ContactEdge_get_other_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_other_0.apply(null,arguments)},Ri=b._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorB_0.apply(null,arguments)},Si=b._emscripten_bind_b2PulleyJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJointDef___destroy___0.apply(null, +arguments)},Ti=b._emscripten_bind_b2MouseJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyB_0.apply(null,arguments)},Ui=b._emscripten_bind_b2PolygonShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2PolygonShape_TestPoint_2.apply(null,arguments)},Vi=b._emscripten_bind_b2JointEdge_get_other_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_other_0.apply(null,arguments)},Wi=b._emscripten_bind_b2PolygonShape_b2PolygonShape_0=function(){return b.asm._emscripten_bind_b2PolygonShape_b2PolygonShape_0.apply(null, +arguments)},Xi=b._emscripten_bind_b2PolygonShape_Set_2=function(){return b.asm._emscripten_bind_b2PolygonShape_Set_2.apply(null,arguments)},Yi=b._emscripten_bind_b2GearJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2GearJoint_GetReactionForce_1.apply(null,arguments)},Zi=b._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorA_0.apply(null,arguments)},$i=b._emscripten_bind_b2Fixture_SetUserData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetUserData_1.apply(null, +arguments)},aj=b._emscripten_bind_b2Contact_SetTangentSpeed_1=function(){return b.asm._emscripten_bind_b2Contact_SetTangentSpeed_1.apply(null,arguments)},bj=b._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_b2PrismaticJointDef_0.apply(null,arguments)},cj=b._emscripten_bind_b2BodyDef_get_active_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_active_0.apply(null,arguments)},dj=b._emscripten_bind_b2Body_GetAngularVelocity_0= +function(){return b.asm._emscripten_bind_b2Body_GetAngularVelocity_0.apply(null,arguments)},ej=b._emscripten_bind_b2CircleShape_set_m_p_1=function(){return b.asm._emscripten_bind_b2CircleShape_set_m_p_1.apply(null,arguments)},fj=b._emscripten_bind_b2Draw___destroy___0=function(){return b.asm._emscripten_bind_b2Draw___destroy___0.apply(null,arguments)},gj=b._emscripten_bind_b2WheelJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2WheelJointDef_Initialize_4.apply(null,arguments)},hj= +b._emscripten_bind_b2WeldJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_dampingRatio_1.apply(null,arguments)},ij=b._emscripten_bind_b2ChainShape_b2ChainShape_0=function(){return b.asm._emscripten_bind_b2ChainShape_b2ChainShape_0.apply(null,arguments)},jj=b._emscripten_bind_b2Joint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorB_0.apply(null,arguments)},kj=b._emscripten_bind_b2PrismaticJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_userData_0.apply(null, +arguments)},lj=b._emscripten_bind_b2MotorJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxForce_0.apply(null,arguments)},mj=b._emscripten_bind_b2RevoluteJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyA_0.apply(null,arguments)},nj=b._emscripten_bind_b2ContactID_set_cf_1=function(){return b.asm._emscripten_bind_b2ContactID_set_cf_1.apply(null,arguments)},oj=b._emscripten_bind_b2Body_GetGravityScale_0=function(){return b.asm._emscripten_bind_b2Body_GetGravityScale_0.apply(null, +arguments)},pj=b._emscripten_bind_b2Vec3_Set_3=function(){return b.asm._emscripten_bind_b2Vec3_Set_3.apply(null,arguments)},qj=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorA_1.apply(null,arguments)},rj=b._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_localAnchorB_1.apply(null,arguments)},sj=b._emscripten_bind_b2PulleyJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetNext_0.apply(null, +arguments)},tj=b._emscripten_bind_b2ChainShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_type_0.apply(null,arguments)},uj=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorB_0.apply(null,arguments)},vj=b._emscripten_bind_JSDraw_DrawTransform_1=function(){return b.asm._emscripten_bind_JSDraw_DrawTransform_1.apply(null,arguments)},wj=b._emscripten_bind_b2GearJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyA_0.apply(null, +arguments)},xj=b._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_frequencyHz_1.apply(null,arguments)},yj=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorB_0.apply(null,arguments)},zj=b._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_referenceAngle_0.apply(null,arguments)},Aj= +b._emscripten_bind_JSContactFilter___destroy___0=function(){return b.asm._emscripten_bind_JSContactFilter___destroy___0.apply(null,arguments)},Bj=b._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableMotor_0.apply(null,arguments)},Cb=b._memset=function(){return b.asm._memset.apply(null,arguments)},Cj=b._emscripten_bind_b2PolygonShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_radius_0.apply(null, +arguments)},Dj=b._emscripten_enum_b2BodyType_b2_kinematicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_kinematicBody.apply(null,arguments)},Ej=b._emscripten_bind_b2Rot_set_s_1=function(){return b.asm._emscripten_bind_b2Rot_set_s_1.apply(null,arguments)},Fj=b._emscripten_enum_b2ManifoldType_e_faceA=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceA.apply(null,arguments)},Gj=b._emscripten_enum_b2ManifoldType_e_faceB=function(){return b.asm._emscripten_enum_b2ManifoldType_e_faceB.apply(null, +arguments)},Hj=b._emscripten_bind_b2RevoluteJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyB_0.apply(null,arguments)},Ij=b._emscripten_bind_b2FixtureDef_b2FixtureDef_0=function(){return b.asm._emscripten_bind_b2FixtureDef_b2FixtureDef_0.apply(null,arguments)},Jj=b._emscripten_bind_b2PrismaticJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetUserData_1.apply(null,arguments)},Kj=b._emscripten_bind_b2WorldManifold_set_points_2= +function(){return b.asm._emscripten_bind_b2WorldManifold_set_points_2.apply(null,arguments)},Lj=b._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex3_0.apply(null,arguments)},Mj=b._emscripten_enum_b2ShapeType_e_edge=function(){return b.asm._emscripten_enum_b2ShapeType_e_edge.apply(null,arguments)},Nj=b._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMaxMotorTorque_0.apply(null, +arguments)},Oj=b._emscripten_bind_b2BodyDef_set_active_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_active_1.apply(null,arguments)},Pj=b._emscripten_bind_b2EdgeShape_Set_2=function(){return b.asm._emscripten_bind_b2EdgeShape_Set_2.apply(null,arguments)},Qj=b._emscripten_bind_b2FixtureDef_set_isSensor_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_isSensor_1.apply(null,arguments)},Rj=b._emscripten_bind_b2Body_GetWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetWorldPoint_1.apply(null, +arguments)},Sj=b._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_normalImpulse_0.apply(null,arguments)},Tj=b._emscripten_bind_JSContactFilter_ShouldCollide_2=function(){return b.asm._emscripten_bind_JSContactFilter_ShouldCollide_2.apply(null,arguments)},Uj=b._emscripten_bind_b2Joint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionTorque_1.apply(null,arguments)},Vj=b._emscripten_bind_b2RevoluteJointDef_set_type_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_type_1.apply(null,arguments)},Wj=b._emscripten_bind_b2RayCastInput_set_p1_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_p1_1.apply(null,arguments)},Xj=b._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_b2RopeJointDef_0.apply(null,arguments)},Yj=b._emscripten_bind_b2BodyDef_get_linearDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearDamping_0.apply(null, +arguments)},Zj=b._emscripten_bind_b2World_Step_3=function(){return b.asm._emscripten_bind_b2World_Step_3.apply(null,arguments)},ak=b._emscripten_bind_b2CircleShape_RayCast_4=function(){return b.asm._emscripten_bind_b2CircleShape_RayCast_4.apply(null,arguments)},bk=b._emscripten_bind_b2Profile_get_step_0=function(){return b.asm._emscripten_bind_b2Profile_get_step_0.apply(null,arguments)},ck=b._emscripten_bind_b2AABB_RayCast_2=function(){return b.asm._emscripten_bind_b2AABB_RayCast_2.apply(null,arguments)}, +dk=b._emscripten_bind_b2Mat22_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat22_SetZero_0.apply(null,arguments)};b.setTempRet0=function(){return b.asm.setTempRet0.apply(null,arguments)}; +var ek=b._emscripten_bind_b2DistanceJoint_GetLength_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetLength_0.apply(null,arguments)},fk=b._emscripten_bind_b2PulleyJoint_GetLengthB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthB_0.apply(null,arguments)},gk=b._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUpperLimit_0.apply(null,arguments)},hk=b._emscripten_bind_b2WorldManifold_set_separations_2=function(){return b.asm._emscripten_bind_b2WorldManifold_set_separations_2.apply(null, +arguments)},ik=b._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetMaxMotorTorque_1.apply(null,arguments)},jk=b._emscripten_bind_b2MotorJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetUserData_0.apply(null,arguments)},kk=b._emscripten_bind_b2FrictionJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionTorque_1.apply(null,arguments)},lk=b._emscripten_bind_b2Shape_get_m_type_0= +function(){return b.asm._emscripten_bind_b2Shape_get_m_type_0.apply(null,arguments)},mk=b._emscripten_bind_b2MouseJoint_SetDampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetDampingRatio_1.apply(null,arguments)},nk=b._emscripten_bind_b2World_GetAutoClearForces_0=function(){return b.asm._emscripten_bind_b2World_GetAutoClearForces_0.apply(null,arguments)},ok=b._emscripten_bind_b2WorldManifold_set_normal_1=function(){return b.asm._emscripten_bind_b2WorldManifold_set_normal_1.apply(null, +arguments)},pk=b._emscripten_enum_b2ShapeType_e_circle=function(){return b.asm._emscripten_enum_b2ShapeType_e_circle.apply(null,arguments)},qk=b._emscripten_bind_b2BodyDef_set_fixedRotation_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_fixedRotation_1.apply(null,arguments)},rk=b._emscripten_bind_b2Vec2_b2Vec2_2=function(){return b.asm._emscripten_bind_b2Vec2_b2Vec2_2.apply(null,arguments)},sk=b._emscripten_bind_b2Manifold_get_type_0=function(){return b.asm._emscripten_bind_b2Manifold_get_type_0.apply(null, +arguments)},tk=b._emscripten_bind_b2Body_Dump_0=function(){return b.asm._emscripten_bind_b2Body_Dump_0.apply(null,arguments)},uk=b._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLowerLimit_0.apply(null,arguments)},vk=b._emscripten_bind_b2Body_GetWorldCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetWorldCenter_0.apply(null,arguments)},wk=b._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_maxMotorTorque_1.apply(null, +arguments)},xk=b._emscripten_bind_b2BodyDef_set_linearVelocity_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearVelocity_1.apply(null,arguments)},yk=b._emscripten_bind_b2JointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2JointDef_set_collideConnected_1.apply(null,arguments)},zk=b._emscripten_bind_b2MotorJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJoint___destroy___0.apply(null,arguments)},Ak=b._emscripten_bind_b2Body_GetUserData_0=function(){return b.asm._emscripten_bind_b2Body_GetUserData_0.apply(null, +arguments)},Bk=b._emscripten_bind_b2Body_GetAngularDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetAngularDamping_0.apply(null,arguments)},Ck=b._emscripten_bind_b2Fixture_RayCast_3=function(){return b.asm._emscripten_bind_b2Fixture_RayCast_3.apply(null,arguments)},Dk=b._emscripten_bind_b2JointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyA_1.apply(null,arguments)},Ek=b._emscripten_bind_b2GearJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_collideConnected_0.apply(null, +arguments)},Fk=b._emscripten_bind_b2RopeJointDef_get_maxLength_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_maxLength_0.apply(null,arguments)},Gk=b._emscripten_bind_b2MouseJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_bodyA_0.apply(null,arguments)},Hk=b._emscripten_bind_b2Body_SetBullet_1=function(){return b.asm._emscripten_bind_b2Body_SetBullet_1.apply(null,arguments)},Ik=b._emscripten_bind_b2DistanceJoint_GetType_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetType_0.apply(null, +arguments)},Jk=b._emscripten_bind_b2FixtureDef_get_restitution_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_restitution_0.apply(null,arguments)},Kk=b._emscripten_bind_b2Fixture_GetType_0=function(){return b.asm._emscripten_bind_b2Fixture_GetType_0.apply(null,arguments)},Lk=b._emscripten_bind_b2WheelJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_enableMotor_1.apply(null,arguments)},Mk=b._emscripten_bind_b2RevoluteJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetBodyB_0.apply(null, +arguments)},Nk=b._emscripten_bind_b2Profile_set_solveInit_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveInit_1.apply(null,arguments)},Ok=b._emscripten_bind_b2RopeJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_type_1.apply(null,arguments)},Pk=b._emscripten_bind_b2PrismaticJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyB_0.apply(null,arguments)},Qk=b._emscripten_bind_b2GearJoint_GetJoint2_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetJoint2_0.apply(null, +arguments)},Rk=b._emscripten_bind_b2PulleyJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_userData_0.apply(null,arguments)},Sk=b._emscripten_bind_b2PrismaticJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyB_1.apply(null,arguments)},Tk=b._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_b2FrictionJointDef_0.apply(null,arguments)},Uk=b._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0= +function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCurrentLengthA_0.apply(null,arguments)},Vk=b._emscripten_bind_b2Manifold_get_localNormal_0=function(){return b.asm._emscripten_bind_b2Manifold_get_localNormal_0.apply(null,arguments)},Wk=b._emscripten_bind_b2Vec3_b2Vec3_0=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_0.apply(null,arguments)},Xk=b._emscripten_bind_b2Body_SetSleepingAllowed_1=function(){return b.asm._emscripten_bind_b2Body_SetSleepingAllowed_1.apply(null,arguments)}, +Yk=b._emscripten_bind_b2DistanceJoint___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJoint___destroy___0.apply(null,arguments)},Zk=b._emscripten_bind_b2PrismaticJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorA_0.apply(null,arguments)},$k=b._emscripten_bind_b2Manifold_set_pointCount_1=function(){return b.asm._emscripten_bind_b2Manifold_set_pointCount_1.apply(null,arguments)},al=b._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsMotorEnabled_0.apply(null, +arguments)},bl=b._emscripten_bind_b2WeldJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetFrequency_0.apply(null,arguments)},cl=b._emscripten_bind_b2Joint_GetUserData_0=function(){return b.asm._emscripten_bind_b2Joint_GetUserData_0.apply(null,arguments)},dl=b._emscripten_bind_b2WorldManifold_get_points_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_points_1.apply(null,arguments)},el=b._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_lowerAngle_0.apply(null, +arguments)},fl=b._emscripten_bind_b2Manifold_set_type_1=function(){return b.asm._emscripten_bind_b2Manifold_set_type_1.apply(null,arguments)},gl=b._emscripten_bind_b2Vec3_b2Vec3_3=function(){return b.asm._emscripten_bind_b2Vec3_b2Vec3_3.apply(null,arguments)},hl=b._emscripten_bind_b2RopeJointDef_set_maxLength_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_maxLength_1.apply(null,arguments)},il=b._emscripten_bind_b2ChainShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2ChainShape_TestPoint_2.apply(null, +arguments)},jl=b._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetReferenceAngle_0.apply(null,arguments)},kl=b._emscripten_bind_b2RayCastInput_get_p2_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p2_0.apply(null,arguments)},ll=b._emscripten_bind_b2BodyDef_set_angle_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angle_1.apply(null,arguments)},ml=b._emscripten_bind_b2WeldJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetUserData_0.apply(null, +arguments)},nl=b._emscripten_bind_b2WheelJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorA_0.apply(null,arguments)},ol=b._emscripten_bind_b2PulleyJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_type_1.apply(null,arguments)},pl=b._emscripten_bind_b2Body_IsBullet_0=function(){return b.asm._emscripten_bind_b2Body_IsBullet_0.apply(null,arguments)},ql=b._emscripten_bind_b2MotorJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyA_1.apply(null, +arguments)},rl=b._emscripten_bind_b2Fixture_TestPoint_1=function(){return b.asm._emscripten_bind_b2Fixture_TestPoint_1.apply(null,arguments)},sl=b._emscripten_bind_b2Mat33_GetSymInverse33_1=function(){return b.asm._emscripten_bind_b2Mat33_GetSymInverse33_1.apply(null,arguments)},tl=b._emscripten_bind_JSDraw_DrawPolygon_3=function(){return b.asm._emscripten_bind_JSDraw_DrawPolygon_3.apply(null,arguments)},ul=b._emscripten_bind_b2PolygonShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeMass_2.apply(null, +arguments)},vl=b._emscripten_bind_b2PrismaticJoint_EnableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableMotor_1.apply(null,arguments)},wl=b._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_upperTranslation_1.apply(null,arguments)},xl=b._emscripten_bind_b2MouseJoint_SetFrequency_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetFrequency_1.apply(null,arguments)},yl=b._emscripten_bind_b2EdgeShape_get_m_vertex1_0= +function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex1_0.apply(null,arguments)},zl=b._emscripten_bind_b2BodyDef_set_awake_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_awake_1.apply(null,arguments)},Al=b._emscripten_bind_b2Vec2_get_y_0=function(){return b.asm._emscripten_bind_b2Vec2_get_y_0.apply(null,arguments)},Bl=b._emscripten_bind_b2Filter_set_categoryBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_categoryBits_1.apply(null,arguments)},Cl=b._emscripten_bind_b2Body_CreateFixture_2= +function(){return b.asm._emscripten_bind_b2Body_CreateFixture_2.apply(null,arguments)},Dl=b._emscripten_bind_b2Body_SetActive_1=function(){return b.asm._emscripten_bind_b2Body_SetActive_1.apply(null,arguments)},El=b._emscripten_bind_b2ContactFeature_get_indexB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_indexB_0.apply(null,arguments)},Fl=b._emscripten_bind_b2Fixture_GetUserData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetUserData_0.apply(null,arguments)},Gl=b._emscripten_bind_b2PolygonShape_ComputeAABB_3= +function(){return b.asm._emscripten_bind_b2PolygonShape_ComputeAABB_3.apply(null,arguments)},Hl=b._emscripten_bind_b2ContactFeature_get_typeA_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeA_0.apply(null,arguments)},Il=b._emscripten_bind_b2MouseJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_maxForce_1.apply(null,arguments)},Jl=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorA_0.apply(null, +arguments)},Kl=b._emscripten_bind_b2EdgeShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2EdgeShape_TestPoint_2.apply(null,arguments)},Ll=b._emscripten_bind_b2WorldManifold_Initialize_5=function(){return b.asm._emscripten_bind_b2WorldManifold_Initialize_5.apply(null,arguments)},Ml=b._emscripten_bind_b2PolygonShape_get_m_centroid_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_centroid_0.apply(null,arguments)},Nl=b._emscripten_bind_b2ChainShape___destroy___0=function(){return b.asm._emscripten_bind_b2ChainShape___destroy___0.apply(null, +arguments)},Ol=b._emscripten_bind_b2GearJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetUserData_1.apply(null,arguments)},Pl=b._emscripten_bind_b2Vec3_set_z_1=function(){return b.asm._emscripten_bind_b2Vec3_set_z_1.apply(null,arguments)},Ql=b._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableLimit_1.apply(null,arguments)},Rl=b._emscripten_bind_b2DistanceJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetFrequency_0.apply(null, +arguments)},Sl=b._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_collideConnected_0.apply(null,arguments)},Tl=b._emscripten_bind_b2Body_SetGravityScale_1=function(){return b.asm._emscripten_bind_b2Body_SetGravityScale_1.apply(null,arguments)},Ul=b._emscripten_enum_b2ContactFeatureType_e_face=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_face.apply(null,arguments)},Vl=b._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetUpperLimit_0.apply(null,arguments)},Wl=b._emscripten_bind_b2PulleyJointDef_get_lengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_lengthA_0.apply(null,arguments)},Xl=b._emscripten_bind_b2Vec3_set_x_1=function(){return b.asm._emscripten_bind_b2Vec3_set_x_1.apply(null,arguments)},Yl=b._emscripten_bind_b2PulleyJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_type_0.apply(null,arguments)}, +Zl=b._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeJoint_1.apply(null,arguments)},$l=b._emscripten_bind_b2Shape___destroy___0=function(){return b.asm._emscripten_bind_b2Shape___destroy___0.apply(null,arguments)},am=b._emscripten_bind_b2Joint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2Joint_GetReactionForce_1.apply(null,arguments)},bm=b._emscripten_bind_b2FixtureDef_set_friction_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_friction_1.apply(null, +arguments)},cm=b._emscripten_bind_b2ContactID___destroy___0=function(){return b.asm._emscripten_bind_b2ContactID___destroy___0.apply(null,arguments)},dm=b._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_hasVertex0_0.apply(null,arguments)},em=b._emscripten_bind_b2World_GetBodyCount_0=function(){return b.asm._emscripten_bind_b2World_GetBodyCount_0.apply(null,arguments)},fm=b._emscripten_bind_b2JointEdge_get_prev_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_prev_0.apply(null, +arguments)},gm=b._emscripten_bind_b2MotorJointDef_get_linearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_linearOffset_0.apply(null,arguments)},hm=b._emscripten_bind_b2MotorJointDef_Initialize_2=function(){return b.asm._emscripten_bind_b2MotorJointDef_Initialize_2.apply(null,arguments)},im=b._emscripten_bind_b2PrismaticJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetAnchorB_0.apply(null,arguments)},jm=b._emscripten_bind_b2Body_SetLinearVelocity_1= +function(){return b.asm._emscripten_bind_b2Body_SetLinearVelocity_1.apply(null,arguments)},km=b._emscripten_enum_b2BodyType_b2_staticBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_staticBody.apply(null,arguments)},lm=b._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_upperAngle_1.apply(null,arguments)},mm=b._emscripten_bind_b2RevoluteJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_type_0.apply(null, +arguments)},nm=b._emscripten_bind_b2GearJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_type_0.apply(null,arguments)},om=b._emscripten_bind_b2ChainShape_GetType_0=function(){return b.asm._emscripten_bind_b2ChainShape_GetType_0.apply(null,arguments)},pm=b._emscripten_bind_b2RayCastInput_get_maxFraction_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_maxFraction_0.apply(null,arguments)},qm=b._emscripten_bind_b2GearJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyA_0.apply(null, +arguments)},rm=b._emscripten_bind_b2Body_GetLocalVector_1=function(){return b.asm._emscripten_bind_b2Body_GetLocalVector_1.apply(null,arguments)},sm=b._emscripten_bind_b2PrismaticJoint_EnableLimit_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_EnableLimit_1.apply(null,arguments)},tm=b._emscripten_bind_b2FrictionJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_maxForce_0.apply(null,arguments)},um=b._emscripten_bind_b2BodyDef_set_angularVelocity_1= +function(){return b.asm._emscripten_bind_b2BodyDef_set_angularVelocity_1.apply(null,arguments)},wm=b._emscripten_bind_b2Body_SetLinearDamping_1=function(){return b.asm._emscripten_bind_b2Body_SetLinearDamping_1.apply(null,arguments)},xm=b._emscripten_bind_b2WheelJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyB_0.apply(null,arguments)},ym=b._emscripten_bind_b2GearJointDef_get_joint2_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_joint2_0.apply(null,arguments)}, +zm=b._emscripten_bind_b2PrismaticJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_IsActive_0.apply(null,arguments)},Am=b._emscripten_bind_b2Vec3_get_z_0=function(){return b.asm._emscripten_bind_b2Vec3_get_z_0.apply(null,arguments)},Bm=b._emscripten_bind_b2Filter_get_categoryBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_categoryBits_0.apply(null,arguments)},Cm=b._emscripten_bind_b2Color_get_r_0=function(){return b.asm._emscripten_bind_b2Color_get_r_0.apply(null, +arguments)},Dm=b._emscripten_enum_b2JointType_e_weldJoint=function(){return b.asm._emscripten_enum_b2JointType_e_weldJoint.apply(null,arguments)},Em=b._emscripten_bind_b2World_SetContinuousPhysics_1=function(){return b.asm._emscripten_bind_b2World_SetContinuousPhysics_1.apply(null,arguments)},Fm=b._emscripten_bind_b2MouseJointDef_get_target_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_target_0.apply(null,arguments)},Gm=b._emscripten_bind_b2Body_SetTransform_2=function(){return b.asm._emscripten_bind_b2Body_SetTransform_2.apply(null, +arguments)},Hm=b._emscripten_bind_b2PulleyJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_userData_1.apply(null,arguments)},Im=b._emscripten_bind_b2FrictionJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxForce_1.apply(null,arguments)},Jm=b._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_b2DistanceJointDef_0.apply(null,arguments)},Km=b._emscripten_bind_b2BodyDef_get_type_0= +function(){return b.asm._emscripten_bind_b2BodyDef_get_type_0.apply(null,arguments)},Lm=b._emscripten_bind_b2Mat33_GetInverse22_1=function(){return b.asm._emscripten_bind_b2Mat33_GetInverse22_1.apply(null,arguments)},Mm=b._emscripten_bind_b2PulleyJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorB_0.apply(null,arguments)},Nm=b._emscripten_bind_b2WheelJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetReactionTorque_1.apply(null,arguments)}, +Om=b._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_b2RevoluteJointDef_0.apply(null,arguments)},Pm=b._emscripten_bind_b2ContactFeature_set_typeA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeA_1.apply(null,arguments)},Qm=b._emscripten_bind_b2Fixture_Dump_1=function(){return b.asm._emscripten_bind_b2Fixture_Dump_1.apply(null,arguments)},Rm=b._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_enableLimit_0.apply(null, +arguments)},Sm=b._emscripten_bind_b2Manifold_set_localPoint_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localPoint_1.apply(null,arguments)},Tm=b._emscripten_bind_b2JointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2JointDef_get_userData_0.apply(null,arguments)},Um=b._emscripten_bind_b2BodyDef_set_bullet_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_bullet_1.apply(null,arguments)},Vm=b._emscripten_bind_b2WorldManifold___destroy___0=function(){return b.asm._emscripten_bind_b2WorldManifold___destroy___0.apply(null, +arguments)},Wm=b._emscripten_bind_b2RayCastOutput___destroy___0=function(){return b.asm._emscripten_bind_b2RayCastOutput___destroy___0.apply(null,arguments)},Xm=b._emscripten_bind_JSContactListener___destroy___0=function(){return b.asm._emscripten_bind_JSContactListener___destroy___0.apply(null,arguments)},Ym=b._emscripten_bind_b2World_DrawDebugData_0=function(){return b.asm._emscripten_bind_b2World_DrawDebugData_0.apply(null,arguments)}; +b.___cxa_can_catch=function(){return b.asm.___cxa_can_catch.apply(null,arguments)}; +var Zm=b._emscripten_bind_b2RopeJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorA_0.apply(null,arguments)},$m=b._emscripten_bind_b2Profile_set_solveVelocity_1=function(){return b.asm._emscripten_bind_b2Profile_set_solveVelocity_1.apply(null,arguments)},an=b._emscripten_bind_b2GearJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_userData_0.apply(null,arguments)},bn=b._emscripten_bind_b2Filter_set_groupIndex_1=function(){return b.asm._emscripten_bind_b2Filter_set_groupIndex_1.apply(null, +arguments)},cn=b._emscripten_bind_b2JointDef_b2JointDef_0=function(){return b.asm._emscripten_bind_b2JointDef_b2JointDef_0.apply(null,arguments)},dn=b._emscripten_bind_b2Rot_set_c_1=function(){return b.asm._emscripten_bind_b2Rot_set_c_1.apply(null,arguments)},en=b._emscripten_bind_b2GearJointDef_b2GearJointDef_0=function(){return b.asm._emscripten_bind_b2GearJointDef_b2GearJointDef_0.apply(null,arguments)},fn=b._emscripten_bind_b2JointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyB_0.apply(null, +arguments)},gn=b._emscripten_bind_b2DistanceJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionForce_1.apply(null,arguments)},hn=b._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetJointSpeed_0.apply(null,arguments)},jn=b._emscripten_bind_b2MouseJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_frequencyHz_1.apply(null,arguments)},kn=b._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_groundAnchorA_0.apply(null,arguments)},ln=b._emscripten_bind_b2Joint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2Joint_GetAnchorA_0.apply(null,arguments)},mn=b._emscripten_bind_b2Contact_GetRestitution_0=function(){return b.asm._emscripten_bind_b2Contact_GetRestitution_0.apply(null,arguments)},nn=b._emscripten_bind_b2ContactEdge_get_contact_0=function(){return b.asm._emscripten_bind_b2ContactEdge_get_contact_0.apply(null,arguments)}, +on=b._emscripten_bind_b2RevoluteJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_userData_0.apply(null,arguments)},pn=b._emscripten_bind_b2Body_ResetMassData_0=function(){return b.asm._emscripten_bind_b2Body_ResetMassData_0.apply(null,arguments)},qn=b._emscripten_bind_b2Fixture_GetAABB_1=function(){return b.asm._emscripten_bind_b2Fixture_GetAABB_1.apply(null,arguments)},rn=b._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_collideConnected_1.apply(null, +arguments)},sn=b._emscripten_bind_b2Body_GetMassData_1=function(){return b.asm._emscripten_bind_b2Body_GetMassData_1.apply(null,arguments)},tn=b._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_localAnchorA_0.apply(null,arguments)},un=b._emscripten_bind_b2EdgeShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeMass_2.apply(null,arguments)},vn=b._emscripten_bind_b2GearJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_bodyB_0.apply(null, +arguments)},wn=b._emscripten_enum_b2LimitState_e_atLowerLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atLowerLimit.apply(null,arguments)},xn=b._emscripten_bind_b2ManifoldPoint_set_id_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_id_1.apply(null,arguments)},yn=b._emscripten_bind_b2WheelJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyB_0.apply(null,arguments)},zn=b._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorB_0.apply(null, +arguments)},An=b._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_localAnchorB_1.apply(null,arguments)},Bn=b._emscripten_bind_b2Body_DestroyFixture_1=function(){return b.asm._emscripten_bind_b2Body_DestroyFixture_1.apply(null,arguments)},Cn=b._emscripten_bind_b2Profile_set_broadphase_1=function(){return b.asm._emscripten_bind_b2Profile_set_broadphase_1.apply(null,arguments)},Dn=b._emscripten_bind_b2WheelJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAnchorB_0.apply(null,arguments)},En=b._emscripten_bind_b2ContactImpulse_get_count_0=function(){return b.asm._emscripten_bind_b2ContactImpulse_get_count_0.apply(null,arguments)},Fn=b._emscripten_bind_b2World_GetJointCount_0=function(){return b.asm._emscripten_bind_b2World_GetJointCount_0.apply(null,arguments)},Gn=b._emscripten_bind_b2WheelJoint_GetMotorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorSpeed_0.apply(null, +arguments)},Hn=b._emscripten_bind_b2WheelJointDef_get_dampingRatio_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_dampingRatio_0.apply(null,arguments)},In=b._emscripten_bind_b2RayCastOutput_get_fraction_0=function(){return b.asm._emscripten_bind_b2RayCastOutput_get_fraction_0.apply(null,arguments)},Jn=b._emscripten_bind_b2AABB___destroy___0=function(){return b.asm._emscripten_bind_b2AABB___destroy___0.apply(null,arguments)},Kn=b._emscripten_bind_b2GearJoint_SetRatio_1=function(){return b.asm._emscripten_bind_b2GearJoint_SetRatio_1.apply(null, +arguments)},Ln=b._emscripten_bind_b2Body_ApplyLinearImpulse_3=function(){return b.asm._emscripten_bind_b2Body_ApplyLinearImpulse_3.apply(null,arguments)},Mn=b._emscripten_bind_b2Filter___destroy___0=function(){return b.asm._emscripten_bind_b2Filter___destroy___0.apply(null,arguments)},Nn=b._emscripten_bind_b2RopeJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_userData_0.apply(null,arguments)}; +b.___cxa_is_pointer_type=function(){return b.asm.___cxa_is_pointer_type.apply(null,arguments)}; +var On=b._emscripten_bind_b2BodyDef_get_fixedRotation_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_fixedRotation_0.apply(null,arguments)},Pn=b._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_motorSpeed_1.apply(null,arguments)},Qn=b._emscripten_bind_b2ChainShape_SetPrevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetPrevVertex_1.apply(null,arguments)},Rn=b._emscripten_bind_b2MotorJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2MotorJoint_IsActive_0.apply(null, +arguments)},Sn=b._emscripten_bind_b2MouseJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionTorque_1.apply(null,arguments)},Tn=b._emscripten_bind_b2DistanceJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_collideConnected_1.apply(null,arguments)},Un=b._emscripten_bind_b2WheelJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetUserData_0.apply(null,arguments)},Vn=b._emscripten_bind_b2Vec3_op_sub_1= +function(){return b.asm._emscripten_bind_b2Vec3_op_sub_1.apply(null,arguments)},Wn=b._emscripten_bind_b2WheelJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetNext_0.apply(null,arguments)},Xn=b._emscripten_bind_b2Shape_GetType_0=function(){return b.asm._emscripten_bind_b2Shape_GetType_0.apply(null,arguments)},Yn=b._emscripten_bind_b2AABB_IsValid_0=function(){return b.asm._emscripten_bind_b2AABB_IsValid_0.apply(null,arguments)},Zn=b._emscripten_bind_b2WheelJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetBodyA_0.apply(null, +arguments)},$n=b._emscripten_enum_b2ShapeType_e_chain=function(){return b.asm._emscripten_enum_b2ShapeType_e_chain.apply(null,arguments)},ao=b._emscripten_bind_b2PulleyJoint_GetLengthA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetLengthA_0.apply(null,arguments)},bo=b._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_frequencyHz_0.apply(null,arguments)},co=b._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetMotorSpeed_1.apply(null, +arguments)},eo=b._emscripten_bind_b2World___destroy___0=function(){return b.asm._emscripten_bind_b2World___destroy___0.apply(null,arguments)},fo=b._emscripten_bind_b2ChainShape_set_m_prevVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_prevVertex_1.apply(null,arguments)},go=b._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasNextVertex_0.apply(null,arguments)},ho=b._emscripten_bind_b2ChainShape_SetNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_SetNextVertex_1.apply(null, +arguments)},io=b._emscripten_bind_b2Body_SetType_1=function(){return b.asm._emscripten_bind_b2Body_SetType_1.apply(null,arguments)},jo=b._emscripten_bind_b2Body_GetMass_0=function(){return b.asm._emscripten_bind_b2Body_GetMass_0.apply(null,arguments)},ko=b._emscripten_bind_b2Rot_b2Rot_0=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_0.apply(null,arguments)},lo=b._emscripten_bind_b2Rot_b2Rot_1=function(){return b.asm._emscripten_bind_b2Rot_b2Rot_1.apply(null,arguments)},mo=b._emscripten_enum_b2JointType_e_distanceJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_distanceJoint.apply(null,arguments)},no=b._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetSpringDampingRatio_1.apply(null,arguments)},oo=b._emscripten_bind_b2MouseJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetType_0.apply(null,arguments)},po=b._emscripten_bind_b2MouseJoint_GetTarget_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetTarget_0.apply(null, +arguments)},qo=b._emscripten_bind_JSQueryCallback___destroy___0=function(){return b.asm._emscripten_bind_JSQueryCallback___destroy___0.apply(null,arguments)},ro=b._emscripten_bind_b2Fixture_Refilter_0=function(){return b.asm._emscripten_bind_b2Fixture_Refilter_0.apply(null,arguments)},so=b._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_lowerAngle_1.apply(null,arguments)},to=b._emscripten_bind_b2JointEdge___destroy___0=function(){return b.asm._emscripten_bind_b2JointEdge___destroy___0.apply(null, +arguments)},uo=b._emscripten_bind_b2PulleyJoint_GetRatio_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetRatio_0.apply(null,arguments)},vo=b._emscripten_bind_JSContactListener_BeginContact_1=function(){return b.asm._emscripten_bind_JSContactListener_BeginContact_1.apply(null,arguments)},wo=b._emscripten_bind_b2MotorJointDef_set_linearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_linearOffset_1.apply(null,arguments)},xo=b._emscripten_enum_b2JointType_e_motorJoint= +function(){return b.asm._emscripten_enum_b2JointType_e_motorJoint.apply(null,arguments)},yo=b._emscripten_bind_b2EdgeShape_get_m_vertex2_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex2_0.apply(null,arguments)},zo=b._emscripten_bind_b2JointEdge_get_next_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_next_0.apply(null,arguments)},Ao=b._emscripten_bind_b2RayCastInput_set_maxFraction_1=function(){return b.asm._emscripten_bind_b2RayCastInput_set_maxFraction_1.apply(null, +arguments)},Bo=b._emscripten_bind_b2MouseJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetBodyA_0.apply(null,arguments)},Co=b._emscripten_bind_b2BodyDef_get_awake_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_awake_0.apply(null,arguments)},Do=b._emscripten_bind_b2AABB_b2AABB_0=function(){return b.asm._emscripten_bind_b2AABB_b2AABB_0.apply(null,arguments)},Eo=b._emscripten_bind_b2Fixture_SetFriction_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFriction_1.apply(null, +arguments)},Fo=b._emscripten_enum_b2DrawFlag_e_centerOfMassBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_centerOfMassBit.apply(null,arguments)},Go=b._emscripten_bind_b2World_CreateBody_1=function(){return b.asm._emscripten_bind_b2World_CreateBody_1.apply(null,arguments)},Ho=b._emscripten_bind_b2RopeJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_userData_1.apply(null,arguments)},Io=b._emscripten_bind_b2WeldJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetNext_0.apply(null, +arguments)},Jo=b._emscripten_bind_b2WeldJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetType_0.apply(null,arguments)},Ko=b._emscripten_enum_b2ContactFeatureType_e_vertex=function(){return b.asm._emscripten_enum_b2ContactFeatureType_e_vertex.apply(null,arguments)},Lo=b._emscripten_bind_b2Rot___destroy___0=function(){return b.asm._emscripten_bind_b2Rot___destroy___0.apply(null,arguments)},Mo=b._emscripten_bind_b2Filter_get_maskBits_0=function(){return b.asm._emscripten_bind_b2Filter_get_maskBits_0.apply(null, +arguments)},No=b._emscripten_bind_b2Mat22_get_ex_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ex_0.apply(null,arguments)},Oo=b._emscripten_bind_b2Body_GetFixtureList_0=function(){return b.asm._emscripten_bind_b2Body_GetFixtureList_0.apply(null,arguments)},Po=b._emscripten_bind_b2PulleyJoint___destroy___0=function(){return b.asm._emscripten_bind_b2PulleyJoint___destroy___0.apply(null,arguments)},Qo=b._emscripten_bind_b2MouseJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_dampingRatio_1.apply(null, +arguments)},Ro=b._emscripten_bind_JSRayCastCallback___destroy___0=function(){return b.asm._emscripten_bind_JSRayCastCallback___destroy___0.apply(null,arguments)},So=b._emscripten_bind_b2ContactListener___destroy___0=function(){return b.asm._emscripten_bind_b2ContactListener___destroy___0.apply(null,arguments)},To=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorB_1.apply(null,arguments)}; +b.establishStackSpace=function(){return b.asm.establishStackSpace.apply(null,arguments)}; +var Uo=b._emscripten_bind_b2FrictionJoint___destroy___0=function(){return b.asm._emscripten_bind_b2FrictionJoint___destroy___0.apply(null,arguments)},Vo=b._emscripten_bind_b2WeldJoint_Dump_0=function(){return b.asm._emscripten_bind_b2WeldJoint_Dump_0.apply(null,arguments)},Wo=b._emscripten_bind_b2MotorJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetMaxForce_1.apply(null,arguments)},Xo=b._emscripten_bind_b2MouseJoint_GetFrequency_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetFrequency_0.apply(null, +arguments)},Yo=b._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetLocalAnchorA_0.apply(null,arguments)},Zo=b._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_collideConnected_1.apply(null,arguments)},$o=b._emscripten_bind_b2GearJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_collideConnected_1.apply(null,arguments)},ap= +b._emscripten_bind_b2Vec2_IsValid_0=function(){return b.asm._emscripten_bind_b2Vec2_IsValid_0.apply(null,arguments)},bp=b._emscripten_bind_b2PrismaticJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_bodyA_1.apply(null,arguments)},cp=b._emscripten_bind_b2World_GetWarmStarting_0=function(){return b.asm._emscripten_bind_b2World_GetWarmStarting_0.apply(null,arguments)},dp=b._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_enableLimit_1.apply(null, +arguments)},ep=b._emscripten_bind_b2WeldJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJointDef___destroy___0.apply(null,arguments)},fp=b._emscripten_bind_b2Mat22_Solve_1=function(){return b.asm._emscripten_bind_b2Mat22_Solve_1.apply(null,arguments)},gp=b._emscripten_bind_b2Color_get_g_0=function(){return b.asm._emscripten_bind_b2Color_get_g_0.apply(null,arguments)},hp=b._emscripten_bind_VoidPtr___destroy___0=function(){return b.asm._emscripten_bind_VoidPtr___destroy___0.apply(null, +arguments)},ip=b._emscripten_bind_b2RopeJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetNext_0.apply(null,arguments)},jp=b._emscripten_bind_b2EdgeShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_type_0.apply(null,arguments)},kp=b._emscripten_bind_b2PolygonShape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetChildCount_0.apply(null,arguments)},lp=b._emscripten_bind_b2GearJointDef_get_ratio_0=function(){return b.asm._emscripten_bind_b2GearJointDef_get_ratio_0.apply(null, +arguments)},mp=b._emscripten_bind_b2Mat33_Solve33_1=function(){return b.asm._emscripten_bind_b2Mat33_Solve33_1.apply(null,arguments)},np=b._emscripten_bind_b2WeldJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_userData_1.apply(null,arguments)},op=b._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetLocalAnchorB_0.apply(null,arguments)},pp=b._emscripten_bind_b2RevoluteJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef___destroy___0.apply(null, +arguments)},qp=b._emscripten_bind_b2MotorJointDef_get_correctionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_correctionFactor_0.apply(null,arguments)},rp=b._emscripten_bind_b2ContactFeature_get_typeB_0=function(){return b.asm._emscripten_bind_b2ContactFeature_get_typeB_0.apply(null,arguments)},sp=b._emscripten_bind_b2ContactID_get_key_0=function(){return b.asm._emscripten_bind_b2ContactID_get_key_0.apply(null,arguments)},tp=b._emscripten_bind_b2MotorJoint_GetReactionForce_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_GetReactionForce_1.apply(null,arguments)},up=b._emscripten_bind_b2Rot_GetAngle_0=function(){return b.asm._emscripten_bind_b2Rot_GetAngle_0.apply(null,arguments)},vp=b._emscripten_bind_b2World_SetAllowSleeping_1=function(){return b.asm._emscripten_bind_b2World_SetAllowSleeping_1.apply(null,arguments)},wp=b._emscripten_bind_b2RopeJoint_GetType_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetType_0.apply(null,arguments)},xp=b._emscripten_bind_b2MotorJoint_SetAngularOffset_1= +function(){return b.asm._emscripten_bind_b2MotorJoint_SetAngularOffset_1.apply(null,arguments)},yp=b._emscripten_bind_b2MotorJoint_GetLinearOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetLinearOffset_0.apply(null,arguments)},zp=b._emscripten_bind_b2FrictionJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetCollideConnected_0.apply(null,arguments)},Ap=b._emscripten_bind_b2WheelJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_motorSpeed_1.apply(null, +arguments)},Bp=b._emscripten_bind_b2MotorJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorA_0.apply(null,arguments)},Cp=b._emscripten_bind_b2Fixture_GetDensity_0=function(){return b.asm._emscripten_bind_b2Fixture_GetDensity_0.apply(null,arguments)},Dp=b._emscripten_bind_b2MouseJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_type_0.apply(null,arguments)},Ep=b._emscripten_bind_b2Vec2_Set_2=function(){return b.asm._emscripten_bind_b2Vec2_Set_2.apply(null, +arguments)},Fp=b._emscripten_bind_b2WeldJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_type_0.apply(null,arguments)},Gp=b._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_b2MouseJointDef_0.apply(null,arguments)},Hp=b._emscripten_bind_b2Rot_get_s_0=function(){return b.asm._emscripten_bind_b2Rot_get_s_0.apply(null,arguments)},Ip=b._emscripten_bind_b2FrictionJoint_SetMaxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxTorque_1.apply(null, +arguments)},Jp=b._emscripten_bind_b2MouseJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_frequencyHz_0.apply(null,arguments)},Kp=b._emscripten_bind_b2FrictionJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetUserData_1.apply(null,arguments)},Lp=b._emscripten_bind_b2RayCastInput_get_p1_0=function(){return b.asm._emscripten_bind_b2RayCastInput_get_p1_0.apply(null,arguments)},Mp=b._emscripten_bind_b2DistanceJointDef_get_collideConnected_0= +function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_collideConnected_0.apply(null,arguments)},Np=b._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_referenceAngle_1.apply(null,arguments)},Op=b._emscripten_bind_b2ContactFeature___destroy___0=function(){return b.asm._emscripten_bind_b2ContactFeature___destroy___0.apply(null,arguments)},Pp=b._emscripten_bind_b2Color___destroy___0=function(){return b.asm._emscripten_bind_b2Color___destroy___0.apply(null, +arguments)},Qp=b._emscripten_bind_b2DistanceJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyB_1.apply(null,arguments)},Rp=b._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_hasPrevVertex_0.apply(null,arguments)},Sp=b._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_b2PulleyJointDef_0.apply(null,arguments)},Tp=b._emscripten_bind_b2RevoluteJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetType_0.apply(null,arguments)},Up=b._emscripten_bind_b2MassData_b2MassData_0=function(){return b.asm._emscripten_bind_b2MassData_b2MassData_0.apply(null,arguments)},Vp=b._emscripten_bind_b2Vec3_set_y_1=function(){return b.asm._emscripten_bind_b2Vec3_set_y_1.apply(null,arguments)},Wp=b._emscripten_bind_b2BodyDef_set_angularDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_angularDamping_1.apply(null,arguments)},Xp=b._emscripten_bind_b2AABB_Combine_1= +function(){return b.asm._emscripten_bind_b2AABB_Combine_1.apply(null,arguments)},Yp=b._emscripten_bind_b2WheelJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyB_1.apply(null,arguments)},Zp=b._emscripten_bind_b2PrismaticJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyA_0.apply(null,arguments)},$p=b._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetMaxMotorForce_0.apply(null, +arguments)},aq=b._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_upperAngle_0.apply(null,arguments)},bq=b._emscripten_bind_b2Body_IsSleepingAllowed_0=function(){return b.asm._emscripten_bind_b2Body_IsSleepingAllowed_0.apply(null,arguments)},cq=b._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetCorrectionFactor_0.apply(null,arguments)},dq=b._emscripten_bind_b2Profile_get_solve_0= +function(){return b.asm._emscripten_bind_b2Profile_get_solve_0.apply(null,arguments)},eq=b._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1=function(){return b.asm._emscripten_bind_JSDestructionListener_SayGoodbyeFixture_1.apply(null,arguments)},fq=b._emscripten_bind_b2PolygonShape_GetVertexCount_0=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertexCount_0.apply(null,arguments)},gq=b._emscripten_bind_b2Rot_get_c_0=function(){return b.asm._emscripten_bind_b2Rot_get_c_0.apply(null, +arguments)},hq=b._emscripten_bind_b2AABB_set_lowerBound_1=function(){return b.asm._emscripten_bind_b2AABB_set_lowerBound_1.apply(null,arguments)},iq=b._emscripten_bind_b2Fixture_SetFilterData_1=function(){return b.asm._emscripten_bind_b2Fixture_SetFilterData_1.apply(null,arguments)},jq=b._emscripten_bind_b2MouseJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetMaxForce_1.apply(null,arguments)},kq=b._emscripten_bind_b2WheelJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsMotorEnabled_0.apply(null, +arguments)},lq=b._emscripten_bind_b2JointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2JointDef_set_userData_1.apply(null,arguments)},mq=b._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_tangentImpulse_0.apply(null,arguments)},nq=b._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_maxMotorTorque_0.apply(null,arguments)},oq=b._emscripten_bind_b2WeldJointDef_get_dampingRatio_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_get_dampingRatio_0.apply(null,arguments)},pq=b._emscripten_bind_b2Rot_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Rot_SetIdentity_0.apply(null,arguments)},qq=b._emscripten_bind_b2EdgeShape_b2EdgeShape_0=function(){return b.asm._emscripten_bind_b2EdgeShape_b2EdgeShape_0.apply(null,arguments)},rq=b._emscripten_bind_b2FrictionJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetReactionForce_1.apply(null, +arguments)},sq=b._emscripten_bind_b2MouseJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetUserData_0.apply(null,arguments)},tq=b._emscripten_bind_b2DistanceJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_type_1.apply(null,arguments)},uq=b._emscripten_bind_b2WeldJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorA_0.apply(null,arguments)},vq=b._emscripten_bind_b2WeldJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WeldJoint___destroy___0.apply(null, +arguments)},wq=b._emscripten_bind_b2Manifold_b2Manifold_0=function(){return b.asm._emscripten_bind_b2Manifold_b2Manifold_0.apply(null,arguments)},xq=b._emscripten_bind_JSContactListener_PostSolve_2=function(){return b.asm._emscripten_bind_JSContactListener_PostSolve_2.apply(null,arguments)},yq=b._emscripten_bind_b2PulleyJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetBodyA_0.apply(null,arguments)},zq=b._emscripten_bind_b2RopeJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_type_0.apply(null, +arguments)},Aq=b._emscripten_bind_b2CircleShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeMass_2.apply(null,arguments)},Bq=b._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_localAnchorB_0.apply(null,arguments)},Cq=b._emscripten_bind_b2GearJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2GearJointDef___destroy___0.apply(null,arguments)},Dq=b._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1= +function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_localAnchorA_1.apply(null,arguments)},Eq=b._emscripten_enum_b2BodyType_b2_dynamicBody=function(){return b.asm._emscripten_enum_b2BodyType_b2_dynamicBody.apply(null,arguments)},Fq=b._emscripten_bind_b2CircleShape_TestPoint_2=function(){return b.asm._emscripten_bind_b2CircleShape_TestPoint_2.apply(null,arguments)},Gq=b._emscripten_bind_b2MotorJointDef_get_maxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_maxTorque_0.apply(null, +arguments)},Hq=b._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromLocalPoint_1.apply(null,arguments)},Iq=b._emscripten_bind_b2FrictionJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyB_1.apply(null,arguments)},Jq=b._emscripten_bind_b2MouseJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorB_0.apply(null,arguments)},Kq=b._emscripten_bind_b2RopeJointDef_get_localAnchorB_0= +function(){return b.asm._emscripten_bind_b2RopeJointDef_get_localAnchorB_0.apply(null,arguments)},Lq=b._emscripten_bind_b2GearJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetBodyB_0.apply(null,arguments)},Mq=b._emscripten_bind_b2ChainShape_Clear_0=function(){return b.asm._emscripten_bind_b2ChainShape_Clear_0.apply(null,arguments)},Nq=b._emscripten_bind_b2CircleShape___destroy___0=function(){return b.asm._emscripten_bind_b2CircleShape___destroy___0.apply(null,arguments)},Oq= +b._emscripten_bind_b2MotorJoint_GetType_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetType_0.apply(null,arguments)},Pq=b._emscripten_bind_b2World_GetContactCount_0=function(){return b.asm._emscripten_bind_b2World_GetContactCount_0.apply(null,arguments)},Qq=b._emscripten_bind_b2Contact_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Contact_SetRestitution_1.apply(null,arguments)},Rq=b._emscripten_bind_b2BodyDef_get_angularDamping_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angularDamping_0.apply(null, +arguments)},Sq=b._emscripten_bind_b2EdgeShape_get_m_vertex3_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_vertex3_0.apply(null,arguments)},Tq=b._emscripten_bind_b2MassData_set_center_1=function(){return b.asm._emscripten_bind_b2MassData_set_center_1.apply(null,arguments)},Uq=b._emscripten_bind_b2Transform_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Transform_SetIdentity_0.apply(null,arguments)},Vq=b._emscripten_bind_b2GearJointDef_set_joint1_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint1_1.apply(null, +arguments)},Wq=b._emscripten_bind_b2EdgeShape_set_m_vertex2_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex2_1.apply(null,arguments)},Xq=b._emscripten_bind_b2Contact_SetFriction_1=function(){return b.asm._emscripten_bind_b2Contact_SetFriction_1.apply(null,arguments)},Yq=b._emscripten_bind_b2MouseJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MouseJointDef_set_collideConnected_1.apply(null,arguments)},Zq=b._emscripten_bind_b2ContactFeature_set_indexB_1= +function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexB_1.apply(null,arguments)},$q=b._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1=function(){return b.asm._emscripten_bind_b2Body_GetLinearVelocityFromWorldPoint_1.apply(null,arguments)},ar=b._emscripten_bind_b2WeldJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetCollideConnected_0.apply(null,arguments)},br=b._emscripten_bind_b2Mat22_GetInverse_0=function(){return b.asm._emscripten_bind_b2Mat22_GetInverse_0.apply(null, +arguments)},cr=b._emscripten_bind_b2WheelJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_frequencyHz_1.apply(null,arguments)},dr=b._emscripten_bind_b2World_GetSubStepping_0=function(){return b.asm._emscripten_bind_b2World_GetSubStepping_0.apply(null,arguments)},er=b._emscripten_bind_b2Rot_GetYAxis_0=function(){return b.asm._emscripten_bind_b2Rot_GetYAxis_0.apply(null,arguments)}; +b._emscripten_get_global_libc=function(){return b.asm._emscripten_get_global_libc.apply(null,arguments)}; +var fr=b._emscripten_bind_b2WheelJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_localAxisA_0.apply(null,arguments)},gr=b._emscripten_bind_b2RopeJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyB_0.apply(null,arguments)},hr=b._emscripten_bind_b2EdgeShape_GetType_0=function(){return b.asm._emscripten_bind_b2EdgeShape_GetType_0.apply(null,arguments)},ir=b._emscripten_bind_b2Mat22_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ex_1.apply(null, +arguments)},jr=b._emscripten_bind_b2ManifoldPoint___destroy___0=function(){return b.asm._emscripten_bind_b2ManifoldPoint___destroy___0.apply(null,arguments)},kr=b._emscripten_enum_b2JointType_e_prismaticJoint=function(){return b.asm._emscripten_enum_b2JointType_e_prismaticJoint.apply(null,arguments)},lr=b._emscripten_bind_b2WeldJointDef_get_referenceAngle_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_referenceAngle_0.apply(null,arguments)},mr=b._emscripten_bind_b2Vec2_Length_0=function(){return b.asm._emscripten_bind_b2Vec2_Length_0.apply(null, +arguments)},nr=b._emscripten_bind_b2Vec2_SetZero_0=function(){return b.asm._emscripten_bind_b2Vec2_SetZero_0.apply(null,arguments)},or=b._emscripten_bind_b2RopeJoint___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJoint___destroy___0.apply(null,arguments)},pr=b._emscripten_bind_b2World_DestroyJoint_1=function(){return b.asm._emscripten_bind_b2World_DestroyJoint_1.apply(null,arguments)},qr=b._emscripten_bind_b2JointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2JointDef_set_bodyB_1.apply(null, +arguments)},rr=b._emscripten_bind_b2Mat22_Set_2=function(){return b.asm._emscripten_bind_b2Mat22_Set_2.apply(null,arguments)},sr=b._emscripten_bind_b2JointEdge_set_next_1=function(){return b.asm._emscripten_bind_b2JointEdge_set_next_1.apply(null,arguments)},tr=b._emscripten_bind_b2WeldJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetAnchorB_0.apply(null,arguments)},ur=b._emscripten_enum_b2DrawFlag_e_aabbBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_aabbBit.apply(null, +arguments)},vr=b._emscripten_bind_b2EdgeShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2EdgeShape_ComputeAABB_3.apply(null,arguments)},wr=b._emscripten_bind_b2PolygonShape_set_m_centroid_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_centroid_1.apply(null,arguments)},xr=b._emscripten_bind_b2WheelJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_collideConnected_1.apply(null,arguments)},yr=b._emscripten_bind_b2World_GetJointList_0= +function(){return b.asm._emscripten_bind_b2World_GetJointList_0.apply(null,arguments)},zr=b._emscripten_bind_b2MotorJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_type_0.apply(null,arguments)},Ar=b._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetLocalAnchorA_0.apply(null,arguments)},Br=b._emscripten_bind_b2BodyDef_set_linearDamping_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_linearDamping_1.apply(null, +arguments)},Cr=b._emscripten_bind_b2FrictionJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetUserData_0.apply(null,arguments)},Dr=b._emscripten_bind_b2Shape_TestPoint_2=function(){return b.asm._emscripten_bind_b2Shape_TestPoint_2.apply(null,arguments)},Er=b._emscripten_bind_b2Manifold_set_localNormal_1=function(){return b.asm._emscripten_bind_b2Manifold_set_localNormal_1.apply(null,arguments)},Fr=b._emscripten_bind_b2JointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2JointDef_get_bodyA_0.apply(null, +arguments)},Gr=b._emscripten_bind_b2Body_GetLinearDamping_0=function(){return b.asm._emscripten_bind_b2Body_GetLinearDamping_0.apply(null,arguments)},Hr=b._emscripten_bind_b2WeldJointDef_set_frequencyHz_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_frequencyHz_1.apply(null,arguments)},Ir=b._emscripten_bind_b2BodyDef_set_userData_1=function(){return b.asm._emscripten_bind_b2BodyDef_set_userData_1.apply(null,arguments)},Jr=b._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_enableMotor_1.apply(null, +arguments)},Kr=b._emscripten_bind_b2Vec2_Skew_0=function(){return b.asm._emscripten_bind_b2Vec2_Skew_0.apply(null,arguments)},Lr=b._emscripten_bind_b2MouseJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetDampingRatio_0.apply(null,arguments)},Mr=b._emscripten_bind_b2RevoluteJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorA_0.apply(null,arguments)},Nr=b._emscripten_bind_b2ContactFeature_set_typeB_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_typeB_1.apply(null, +arguments)},Or=b._emscripten_bind_b2WheelJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorA_0.apply(null,arguments)},Pr=b._emscripten_bind_b2MotorJoint_GetMaxTorque_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetMaxTorque_0.apply(null,arguments)};b.setThrew=function(){return b.asm.setThrew.apply(null,arguments)}; +var Qr=b._emscripten_bind_b2PrismaticJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_userData_1.apply(null,arguments)},Rr=b._emscripten_bind_b2FrictionJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_type_1.apply(null,arguments)},Sr=b._emscripten_bind_b2FrictionJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2FrictionJointDef_Initialize_3.apply(null,arguments)},Nb=b._sbrk=function(){return b.asm._sbrk.apply(null, +arguments)},Tr=b._emscripten_bind_b2FrictionJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_collideConnected_0.apply(null,arguments)},Ib=b._memcpy=function(){return b.asm._memcpy.apply(null,arguments)},Ur=b._emscripten_bind_b2FrictionJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorA_0.apply(null,arguments)},Vr=b._emscripten_enum_b2DrawFlag_e_pairBit=function(){return b.asm._emscripten_enum_b2DrawFlag_e_pairBit.apply(null, +arguments)},Wr=b._emscripten_bind_b2MassData_get_I_0=function(){return b.asm._emscripten_bind_b2MassData_get_I_0.apply(null,arguments)},Xr=b._emscripten_bind_b2WheelJointDef_get_motorSpeed_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_motorSpeed_0.apply(null,arguments)},Yr=b._emscripten_bind_b2Filter_set_maskBits_1=function(){return b.asm._emscripten_bind_b2Filter_set_maskBits_1.apply(null,arguments)},Zr=b._emscripten_bind_b2WheelJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetCollideConnected_0.apply(null, +arguments)},$r=b._emscripten_bind_b2EdgeShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2EdgeShape_get_m_radius_0.apply(null,arguments)},as=b._emscripten_bind_b2World_GetTreeHeight_0=function(){return b.asm._emscripten_bind_b2World_GetTreeHeight_0.apply(null,arguments)},bs=b._emscripten_bind_b2Mat22_b2Mat22_2=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_2.apply(null,arguments)},cs=b._emscripten_bind_b2PrismaticJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetNext_0.apply(null, +arguments)},ds=b._emscripten_bind_b2Mat22_b2Mat22_0=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_0.apply(null,arguments)},es=b._emscripten_bind_b2PrismaticJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_bodyA_0.apply(null,arguments)},gs=b._emscripten_bind_b2RopeJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorA_1.apply(null,arguments)},hs=b._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_hasNextVertex_1.apply(null, +arguments)},is=b._emscripten_bind_b2Mat22_set_ey_1=function(){return b.asm._emscripten_bind_b2Mat22_set_ey_1.apply(null,arguments)},js=b._emscripten_bind_b2MotorJointDef_set_angularOffset_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_angularOffset_1.apply(null,arguments)},ks=b._emscripten_bind_b2CircleShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2CircleShape_get_m_type_0.apply(null,arguments)},ls=b._emscripten_bind_b2Body_GetType_0=function(){return b.asm._emscripten_bind_b2Body_GetType_0.apply(null, +arguments)},ms=b._emscripten_bind_b2ContactEdge_b2ContactEdge_0=function(){return b.asm._emscripten_bind_b2ContactEdge_b2ContactEdge_0.apply(null,arguments)},ns=b._emscripten_bind_b2BodyDef___destroy___0=function(){return b.asm._emscripten_bind_b2BodyDef___destroy___0.apply(null,arguments)},ps=b._emscripten_bind_b2FrictionJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_maxTorque_1.apply(null,arguments)},Qa=b._free=function(){return b.asm._free.apply(null,arguments)}, +qs=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorB_1.apply(null,arguments)},rs=b._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_collideConnected_0.apply(null,arguments)},ss=b._emscripten_bind_b2DistanceJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_bodyA_1.apply(null,arguments)}; +b.runPostSets=function(){return b.asm.runPostSets.apply(null,arguments)}; +var ts=b._emscripten_bind_b2RevoluteJoint_SetLimits_2=function(){return b.asm._emscripten_bind_b2RevoluteJoint_SetLimits_2.apply(null,arguments)},us=b._emscripten_bind_b2WeldJointDef_set_type_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_type_1.apply(null,arguments)},vs=b._emscripten_bind_b2MotorJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2MotorJointDef___destroy___0.apply(null,arguments)},xs=b._emscripten_bind_b2FrictionJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetNext_0.apply(null, +arguments)},ys=b._emscripten_bind_b2Shape_set_m_type_1=function(){return b.asm._emscripten_bind_b2Shape_set_m_type_1.apply(null,arguments)},zs=b._emscripten_bind_b2WheelJoint_GetJointTranslation_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetJointTranslation_0.apply(null,arguments)},As=b._emscripten_bind_b2WheelJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2WheelJoint_GetMotorTorque_1.apply(null,arguments)},Bs=b._emscripten_bind_b2RopeJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetUserData_1.apply(null, +arguments)},Cs=b._emscripten_bind_b2RopeJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2RopeJointDef___destroy___0.apply(null,arguments)},Ds=b._emscripten_bind_b2WheelJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2WheelJoint_IsActive_0.apply(null,arguments)},Es=b._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableMotor_0.apply(null,arguments)},Fs=b._emscripten_bind_b2MotorJointDef_set_bodyB_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_bodyB_1.apply(null,arguments)},Gs=b._emscripten_bind_JSDestructionListener___destroy___0=function(){return b.asm._emscripten_bind_JSDestructionListener___destroy___0.apply(null,arguments)},Hs=b._emscripten_bind_b2Transform_b2Transform_2=function(){return b.asm._emscripten_bind_b2Transform_b2Transform_2.apply(null,arguments)},Is=b._emscripten_bind_b2WeldJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2WeldJoint_GetReactionForce_1.apply(null, +arguments)},Js=b._emscripten_bind_b2ChainShape_RayCast_4=function(){return b.asm._emscripten_bind_b2ChainShape_RayCast_4.apply(null,arguments)},Ks=b._emscripten_bind_b2Vec2_set_y_1=function(){return b.asm._emscripten_bind_b2Vec2_set_y_1.apply(null,arguments)},Ls=b._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1=function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMotorSpeed_1.apply(null,arguments)},Ms=b._emscripten_bind_b2ContactID_get_cf_0=function(){return b.asm._emscripten_bind_b2ContactID_get_cf_0.apply(null, +arguments)},Ns=b._emscripten_bind_b2DistanceJointDef_Initialize_4=function(){return b.asm._emscripten_bind_b2DistanceJointDef_Initialize_4.apply(null,arguments)},Os=b._emscripten_bind_b2ChainShape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2ChainShape_get_m_radius_0.apply(null,arguments)},Ps=b._emscripten_bind_b2WeldJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_localAnchorB_1.apply(null,arguments)},Qs=b._emscripten_bind_b2ChainShape_set_m_radius_1= +function(){return b.asm._emscripten_bind_b2ChainShape_set_m_radius_1.apply(null,arguments)},Rs=b._emscripten_bind_b2DistanceJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetReactionTorque_1.apply(null,arguments)},Ss=b._emscripten_bind_b2World_Dump_0=function(){return b.asm._emscripten_bind_b2World_Dump_0.apply(null,arguments)},Ts=b._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetLocalAnchorB_0.apply(null, +arguments)},Us=b._emscripten_bind_JSContactFilter_JSContactFilter_0=function(){return b.asm._emscripten_bind_JSContactFilter_JSContactFilter_0.apply(null,arguments)},Vs=b._emscripten_bind_b2Profile_set_solve_1=function(){return b.asm._emscripten_bind_b2Profile_set_solve_1.apply(null,arguments)},Ws=b._emscripten_bind_b2FixtureDef_set_density_1=function(){return b.asm._emscripten_bind_b2FixtureDef_set_density_1.apply(null,arguments)},Xs=b._emscripten_bind_b2WeldJoint_GetDampingRatio_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetDampingRatio_0.apply(null, +arguments)},Ys=b._emscripten_bind_b2Color_get_b_0=function(){return b.asm._emscripten_bind_b2Color_get_b_0.apply(null,arguments)},Zs=b._emscripten_bind_b2MouseJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_userData_0.apply(null,arguments)},$s=b._emscripten_bind_b2CircleShape_ComputeAABB_3=function(){return b.asm._emscripten_bind_b2CircleShape_ComputeAABB_3.apply(null,arguments)},at=b._emscripten_bind_b2RopeJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionForce_1.apply(null, +arguments)},bt=b._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_enableLimit_0.apply(null,arguments)},ct=b._emscripten_bind_b2ManifoldPoint_set_localPoint_1=function(){return b.asm._emscripten_bind_b2ManifoldPoint_set_localPoint_1.apply(null,arguments)},dt=b._emscripten_bind_b2Fixture_GetFilterData_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFilterData_0.apply(null,arguments)},et=b._emscripten_bind_b2World_GetBodyList_0= +function(){return b.asm._emscripten_bind_b2World_GetBodyList_0.apply(null,arguments)},ft=b._emscripten_bind_b2Body_GetJointList_0=function(){return b.asm._emscripten_bind_b2Body_GetJointList_0.apply(null,arguments)},gt=b._emscripten_bind_b2Joint_GetNext_0=function(){return b.asm._emscripten_bind_b2Joint_GetNext_0.apply(null,arguments)},ht=b._emscripten_bind_b2Joint_GetType_0=function(){return b.asm._emscripten_bind_b2Joint_GetType_0.apply(null,arguments)},it=b._emscripten_bind_b2World_RayCast_3=function(){return b.asm._emscripten_bind_b2World_RayCast_3.apply(null, +arguments)},jt=b._emscripten_bind_b2MassData_set_I_1=function(){return b.asm._emscripten_bind_b2MassData_set_I_1.apply(null,arguments)},kt=b._emscripten_bind_b2MassData___destroy___0=function(){return b.asm._emscripten_bind_b2MassData___destroy___0.apply(null,arguments)},lt=b._emscripten_bind_b2Profile_get_collide_0=function(){return b.asm._emscripten_bind_b2Profile_get_collide_0.apply(null,arguments)},mt=b._emscripten_bind_b2Color_b2Color_3=function(){return b.asm._emscripten_bind_b2Color_b2Color_3.apply(null, +arguments)},nt=b._emscripten_bind_b2Color_b2Color_0=function(){return b.asm._emscripten_bind_b2Color_b2Color_0.apply(null,arguments)},ot=b._emscripten_bind_b2WheelJointDef_get_frequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_frequencyHz_0.apply(null,arguments)},pt=b._emscripten_bind_b2WeldJointDef_Initialize_3=function(){return b.asm._emscripten_bind_b2WeldJointDef_Initialize_3.apply(null,arguments)},qt=b._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetMotorTorque_1.apply(null, +arguments)},rt=b._emscripten_enum_b2JointType_e_gearJoint=function(){return b.asm._emscripten_enum_b2JointType_e_gearJoint.apply(null,arguments)},st=b._emscripten_bind_b2FixtureDef_get_friction_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_friction_0.apply(null,arguments)},tt=b._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAnchorA_1.apply(null,arguments)},ut=b._emscripten_bind_b2Contact_GetManifold_0=function(){return b.asm._emscripten_bind_b2Contact_GetManifold_0.apply(null, +arguments)},vt=b._emscripten_bind_b2QueryCallback___destroy___0=function(){return b.asm._emscripten_bind_b2QueryCallback___destroy___0.apply(null,arguments)},wt=b._emscripten_bind_b2WeldJointDef_get_localAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorA_0.apply(null,arguments)},xt=b._emscripten_bind_b2MouseJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2MouseJoint_SetUserData_1.apply(null,arguments)},yt=b._emscripten_bind_b2MotorJointDef_set_correctionFactor_1= +function(){return b.asm._emscripten_bind_b2MotorJointDef_set_correctionFactor_1.apply(null,arguments)},zt=b._emscripten_bind_b2ChainShape_GetChildEdge_2=function(){return b.asm._emscripten_bind_b2ChainShape_GetChildEdge_2.apply(null,arguments)},At=b._emscripten_enum_b2JointType_e_mouseJoint=function(){return b.asm._emscripten_enum_b2JointType_e_mouseJoint.apply(null,arguments)},Bt=b._emscripten_bind_b2MotorJointDef_get_angularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_angularOffset_0.apply(null, +arguments)},Ct=b._emscripten_bind_b2WheelJoint_SetUserData_1=function(){return b.asm._emscripten_bind_b2WheelJoint_SetUserData_1.apply(null,arguments)},Dt=b._emscripten_bind_b2Body_ApplyForce_3=function(){return b.asm._emscripten_bind_b2Body_ApplyForce_3.apply(null,arguments)},Et=b._emscripten_bind_b2ChainShape_set_m_count_1=function(){return b.asm._emscripten_bind_b2ChainShape_set_m_count_1.apply(null,arguments)},Ft=b._emscripten_bind_b2DistanceJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2DistanceJoint_GetCollideConnected_0.apply(null, +arguments)},Gt=b._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsMotorEnabled_0.apply(null,arguments)},Ht=b._emscripten_bind_b2PolygonShape_GetVertex_1=function(){return b.asm._emscripten_bind_b2PolygonShape_GetVertex_1.apply(null,arguments)},It=b._emscripten_bind_b2World_SetGravity_1=function(){return b.asm._emscripten_bind_b2World_SetGravity_1.apply(null,arguments)},Jt=b._emscripten_bind_b2MouseJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_collideConnected_0.apply(null, +arguments)},Qb=b._llvm_bswap_i32=function(){return b.asm._llvm_bswap_i32.apply(null,arguments)},Kt=b._emscripten_bind_b2Fixture_SetRestitution_1=function(){return b.asm._emscripten_bind_b2Fixture_SetRestitution_1.apply(null,arguments)},Lt=b._emscripten_bind_b2Body_GetTransform_0=function(){return b.asm._emscripten_bind_b2Body_GetTransform_0.apply(null,arguments)},Mt=b._emscripten_enum_b2ShapeType_e_typeCount=function(){return b.asm._emscripten_enum_b2ShapeType_e_typeCount.apply(null,arguments)},Nt= +b._emscripten_bind_b2Mat33_set_ex_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ex_1.apply(null,arguments)},Ot=b._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_localAnchorB_0.apply(null,arguments)},Pt=b._emscripten_bind_b2RevoluteJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_get_bodyA_0.apply(null,arguments)},Qt=b._emscripten_bind_b2PrismaticJoint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetBodyB_0.apply(null, +arguments)},Rt=b._emscripten_bind_b2WheelJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_bodyA_1.apply(null,arguments)},St=b._emscripten_bind_b2MotorJointDef_set_maxForce_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxForce_1.apply(null,arguments)},Tt=b._emscripten_bind_b2BodyDef_get_angle_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_angle_0.apply(null,arguments)},Ut=b._emscripten_bind_b2FixtureDef_get_shape_0=function(){return b.asm._emscripten_bind_b2FixtureDef_get_shape_0.apply(null, +arguments)},Vt=b._emscripten_bind_b2Body_SetAngularVelocity_1=function(){return b.asm._emscripten_bind_b2Body_SetAngularVelocity_1.apply(null,arguments)},Wt=b._emscripten_bind_b2WeldJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_userData_0.apply(null,arguments)},Xt=b._emscripten_bind_b2FrictionJoint_SetMaxForce_1=function(){return b.asm._emscripten_bind_b2FrictionJoint_SetMaxForce_1.apply(null,arguments)},Yt=b._emscripten_bind_b2Mat33_b2Mat33_3=function(){return b.asm._emscripten_bind_b2Mat33_b2Mat33_3.apply(null, +arguments)},Zt=b._emscripten_bind_b2Vec3_get_y_0=function(){return b.asm._emscripten_bind_b2Vec3_get_y_0.apply(null,arguments)},$t=b._emscripten_bind_b2JointDef_get_type_0=function(){return b.asm._emscripten_bind_b2JointDef_get_type_0.apply(null,arguments)},au=b._emscripten_bind_JSQueryCallback_ReportFixture_1=function(){return b.asm._emscripten_bind_JSQueryCallback_ReportFixture_1.apply(null,arguments)},bu=b._emscripten_bind_b2PulleyJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetCollideConnected_0.apply(null, +arguments)},cu=b._emscripten_bind_b2Body_CreateFixture_1=function(){return b.asm._emscripten_bind_b2Body_CreateFixture_1.apply(null,arguments)},du=b._emscripten_bind_JSDraw_JSDraw_0=function(){return b.asm._emscripten_bind_JSDraw_JSDraw_0.apply(null,arguments)},eu=b._emscripten_bind_b2MouseJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2MouseJoint_GetAnchorA_0.apply(null,arguments)},fu=b._emscripten_bind_b2Transform_get_p_0=function(){return b.asm._emscripten_bind_b2Transform_get_p_0.apply(null, +arguments)},gu=b._emscripten_bind_b2WorldManifold_get_normal_0=function(){return b.asm._emscripten_bind_b2WorldManifold_get_normal_0.apply(null,arguments)},hu=b._emscripten_bind_b2World_GetProfile_0=function(){return b.asm._emscripten_bind_b2World_GetProfile_0.apply(null,arguments)},iu=b._emscripten_bind_b2DistanceJointDef___destroy___0=function(){return b.asm._emscripten_bind_b2DistanceJointDef___destroy___0.apply(null,arguments)},ju=b._emscripten_bind_b2GearJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyA_1.apply(null, +arguments)},ku=b._emscripten_bind_b2JointDef_set_type_1=function(){return b.asm._emscripten_bind_b2JointDef_set_type_1.apply(null,arguments)},lu=b._emscripten_bind_b2ContactEdge_set_contact_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_contact_1.apply(null,arguments)},mu=b._emscripten_bind_b2MotorJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_userData_0.apply(null,arguments)},nu=b._emscripten_bind_b2World_GetContactList_0=function(){return b.asm._emscripten_bind_b2World_GetContactList_0.apply(null, +arguments)},ou=b._emscripten_bind_b2Mat33_set_ez_1=function(){return b.asm._emscripten_bind_b2Mat33_set_ez_1.apply(null,arguments)},pu=b._emscripten_bind_b2JointEdge_b2JointEdge_0=function(){return b.asm._emscripten_bind_b2JointEdge_b2JointEdge_0.apply(null,arguments)},qu=b._emscripten_bind_b2FrictionJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJointDef_get_bodyA_0.apply(null,arguments)},ru=b._emscripten_bind_b2WheelJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_type_0.apply(null, +arguments)},su=b._emscripten_bind_b2RevoluteJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetReactionForce_1.apply(null,arguments)},tu=b._emscripten_bind_b2PulleyJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_collideConnected_1.apply(null,arguments)},uu=b._emscripten_bind_b2RopeJoint_GetCollideConnected_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetCollideConnected_0.apply(null,arguments)},vu=b._emscripten_bind_b2GearJointDef_set_joint2_1= +function(){return b.asm._emscripten_bind_b2GearJointDef_set_joint2_1.apply(null,arguments)},wu=b._emscripten_bind_b2EdgeShape_set_m_vertex3_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex3_1.apply(null,arguments)},xu=b._emscripten_bind_b2GearJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetAnchorB_0.apply(null,arguments)},yu=b._emscripten_bind_b2RopeJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RopeJoint_IsActive_0.apply(null,arguments)}, +zu=b._emscripten_bind_b2Fixture_GetFriction_0=function(){return b.asm._emscripten_bind_b2Fixture_GetFriction_0.apply(null,arguments)},Au=b._emscripten_bind_b2Fixture_GetNext_0=function(){return b.asm._emscripten_bind_b2Fixture_GetNext_0.apply(null,arguments)},Bu=b._emscripten_bind_b2RopeJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyA_0.apply(null,arguments)},Cu=b._emscripten_bind_b2WeldJointDef_get_localAnchorB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_localAnchorB_0.apply(null, +arguments)},Du=b._emscripten_bind_b2WeldJointDef_set_referenceAngle_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_referenceAngle_1.apply(null,arguments)},Eu=b._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2DistanceJointDef_set_localAnchorB_1.apply(null,arguments)},Fu=b._emscripten_bind_b2Mat33_SetZero_0=function(){return b.asm._emscripten_bind_b2Mat33_SetZero_0.apply(null,arguments)},Gu=b._emscripten_bind_b2MotorJointDef_get_bodyB_0= +function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyB_0.apply(null,arguments)},Hu=b._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_b2WheelJointDef_0.apply(null,arguments)},Iu=b._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_localAxisA_0.apply(null,arguments)},Ju=b._emscripten_bind_b2Mat22_get_ey_0=function(){return b.asm._emscripten_bind_b2Mat22_get_ey_0.apply(null, +arguments)},Ku=b._emscripten_bind_b2Mat22_SetIdentity_0=function(){return b.asm._emscripten_bind_b2Mat22_SetIdentity_0.apply(null,arguments)},Lu=b._emscripten_bind_b2Joint_IsActive_0=function(){return b.asm._emscripten_bind_b2Joint_IsActive_0.apply(null,arguments)},Mu=b._emscripten_bind_b2PulleyJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionForce_1.apply(null,arguments)},Nu=b._emscripten_bind_b2Shape_get_m_radius_0=function(){return b.asm._emscripten_bind_b2Shape_get_m_radius_0.apply(null, +arguments)},Ou=b._emscripten_bind_b2Mat22_b2Mat22_4=function(){return b.asm._emscripten_bind_b2Mat22_b2Mat22_4.apply(null,arguments)},Pu=b._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_localAxisA_1.apply(null,arguments)},Qu=b._emscripten_bind_b2PolygonShape_SetAsBox_4=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_4.apply(null,arguments)},Ru=b._emscripten_bind_b2EdgeShape_set_m_vertex1_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex1_1.apply(null, +arguments)},Su=b._emscripten_bind_b2Body_GetWorld_0=function(){return b.asm._emscripten_bind_b2Body_GetWorld_0.apply(null,arguments)},Tu=b._emscripten_enum_b2LimitState_e_inactiveLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_inactiveLimit.apply(null,arguments)},Uu=b._emscripten_bind_b2Vec2_set_x_1=function(){return b.asm._emscripten_bind_b2Vec2_set_x_1.apply(null,arguments)},Vu=b._emscripten_bind_b2Body_SetAwake_1=function(){return b.asm._emscripten_bind_b2Body_SetAwake_1.apply(null, +arguments)},Wu=b._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0=function(){return b.asm._emscripten_bind_b2WeldJoint_GetLocalAnchorA_0.apply(null,arguments)},Xu=b._emscripten_bind_b2Vec2___destroy___0=function(){return b.asm._emscripten_bind_b2Vec2___destroy___0.apply(null,arguments)},Yu=b._emscripten_enum_b2ShapeType_e_polygon=function(){return b.asm._emscripten_enum_b2ShapeType_e_polygon.apply(null,arguments)},Zu=b._emscripten_bind_b2Body_GetInertia_0=function(){return b.asm._emscripten_bind_b2Body_GetInertia_0.apply(null, +arguments)},$u=b._emscripten_bind_b2PulleyJoint_GetAnchorA_0=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetAnchorA_0.apply(null,arguments)},av=b._emscripten_bind_b2BodyDef_get_linearVelocity_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_linearVelocity_0.apply(null,arguments)},bv=b._emscripten_bind_b2DistanceJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2DistanceJointDef_get_bodyB_0.apply(null,arguments)},cv=b._emscripten_bind_b2Mat22___destroy___0=function(){return b.asm._emscripten_bind_b2Mat22___destroy___0.apply(null, +arguments)},dv=b._emscripten_bind_b2RevoluteJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetNext_0.apply(null,arguments)},ev=b._emscripten_bind_b2WeldJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyA_0.apply(null,arguments)},fv=b._emscripten_bind_b2MotorJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAnchorB_0.apply(null,arguments)},gv=b._emscripten_bind_b2Fixture_GetShape_0=function(){return b.asm._emscripten_bind_b2Fixture_GetShape_0.apply(null, +arguments)},hv=b._emscripten_bind_b2PulleyJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2PulleyJoint_GetReactionTorque_1.apply(null,arguments)},iv=b._emscripten_bind_b2Vec3_op_mul_1=function(){return b.asm._emscripten_bind_b2Vec3_op_mul_1.apply(null,arguments)},jv=b._emscripten_bind_b2PolygonShape_set_m_type_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_type_1.apply(null,arguments)},kv=b._emscripten_bind_b2WheelJoint_GetType_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetType_0.apply(null, +arguments)},lv=b._emscripten_bind_b2MotorJoint_GetAngularOffset_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetAngularOffset_0.apply(null,arguments)},mv=b._emscripten_bind_b2RevoluteJoint_IsActive_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsActive_0.apply(null,arguments)},nv=b._emscripten_bind_b2GearJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2GearJoint_GetNext_0.apply(null,arguments)},ov=b._emscripten_bind_b2MouseJointDef_get_maxForce_0=function(){return b.asm._emscripten_bind_b2MouseJointDef_get_maxForce_0.apply(null, +arguments)},pv=b._emscripten_bind_b2DestructionListenerWrapper___destroy___0=function(){return b.asm._emscripten_bind_b2DestructionListenerWrapper___destroy___0.apply(null,arguments)},qv=b._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_set_maxMotorForce_1.apply(null,arguments)},rv=b._emscripten_bind_b2WheelJoint_GetLocalAxisA_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAxisA_0.apply(null,arguments)},sv=b._emscripten_bind_b2Body_GetNext_0= +function(){return b.asm._emscripten_bind_b2Body_GetNext_0.apply(null,arguments)},tv=b._emscripten_bind_b2MouseJoint_GetReactionForce_1=function(){return b.asm._emscripten_bind_b2MouseJoint_GetReactionForce_1.apply(null,arguments)},uv=b._emscripten_bind_b2RopeJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2RopeJoint_GetBodyA_0.apply(null,arguments)},vv=b._emscripten_bind_b2ContactFeature_set_indexA_1=function(){return b.asm._emscripten_bind_b2ContactFeature_set_indexA_1.apply(null,arguments)}, +wv=b._emscripten_bind_b2Profile_get_solveInit_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveInit_0.apply(null,arguments)},xv=b._emscripten_bind_b2Fixture_IsSensor_0=function(){return b.asm._emscripten_bind_b2Fixture_IsSensor_0.apply(null,arguments)},yv=b._emscripten_bind_b2FrictionJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetAnchorB_0.apply(null,arguments)},zv=b._emscripten_bind_b2World_QueryAABB_2=function(){return b.asm._emscripten_bind_b2World_QueryAABB_2.apply(null, +arguments)},Av=b._emscripten_bind_b2Profile_set_collide_1=function(){return b.asm._emscripten_bind_b2Profile_set_collide_1.apply(null,arguments)},Bv=b._emscripten_bind_b2BodyDef_get_userData_0=function(){return b.asm._emscripten_bind_b2BodyDef_get_userData_0.apply(null,arguments)},Cv=b._emscripten_bind_b2MotorJoint_SetLinearOffset_1=function(){return b.asm._emscripten_bind_b2MotorJoint_SetLinearOffset_1.apply(null,arguments)},Dv=b._emscripten_bind_b2FrictionJoint_GetMaxForce_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetMaxForce_0.apply(null, +arguments)},Ev=b._emscripten_bind_b2WheelJointDef_get_userData_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_userData_0.apply(null,arguments)},Fv=b._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_IsLimitEnabled_0.apply(null,arguments)},Gv=b._emscripten_bind_b2World_SetDestructionListener_1=function(){return b.asm._emscripten_bind_b2World_SetDestructionListener_1.apply(null,arguments)},Hv=b._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1= +function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_maxMotorTorque_1.apply(null,arguments)},Iv=b._emscripten_bind_b2WeldJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2WeldJointDef_set_bodyB_1.apply(null,arguments)},Jv=b._emscripten_bind_b2Transform_set_p_1=function(){return b.asm._emscripten_bind_b2Transform_set_p_1.apply(null,arguments)},Kv=b._emscripten_bind_b2DistanceJoint_SetLength_1=function(){return b.asm._emscripten_bind_b2DistanceJoint_SetLength_1.apply(null,arguments)}, +Lv=b._emscripten_bind_b2ManifoldPoint_get_localPoint_0=function(){return b.asm._emscripten_bind_b2ManifoldPoint_get_localPoint_0.apply(null,arguments)},Mv=b._emscripten_bind_b2JointEdge_get_joint_0=function(){return b.asm._emscripten_bind_b2JointEdge_get_joint_0.apply(null,arguments)},Nv=b._emscripten_bind_b2Body_GetLocalCenter_0=function(){return b.asm._emscripten_bind_b2Body_GetLocalCenter_0.apply(null,arguments)},Ov=b._emscripten_bind_b2FixtureDef___destroy___0=function(){return b.asm._emscripten_bind_b2FixtureDef___destroy___0.apply(null, +arguments)},Pv=b._emscripten_bind_b2MouseJoint___destroy___0=function(){return b.asm._emscripten_bind_b2MouseJoint___destroy___0.apply(null,arguments)},Qv=b._emscripten_enum_b2JointType_e_ropeJoint=function(){return b.asm._emscripten_enum_b2JointType_e_ropeJoint.apply(null,arguments)},Rv=b._emscripten_bind_b2Profile_get_solveVelocity_0=function(){return b.asm._emscripten_bind_b2Profile_get_solveVelocity_0.apply(null,arguments)},Sv=b._emscripten_bind_b2WeldJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2WeldJointDef_get_bodyB_0.apply(null, +arguments)},Tv=b._emscripten_bind_b2World_GetContinuousPhysics_0=function(){return b.asm._emscripten_bind_b2World_GetContinuousPhysics_0.apply(null,arguments)},Uv=b._emscripten_bind_b2Joint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyA_0.apply(null,arguments)},Vv=b._emscripten_bind_b2MotorJointDef_set_maxTorque_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_maxTorque_1.apply(null,arguments)},Wv=b._emscripten_bind_b2PulleyJointDef_Initialize_7=function(){return b.asm._emscripten_bind_b2PulleyJointDef_Initialize_7.apply(null, +arguments)},Xv=b._emscripten_bind_b2GearJointDef_set_bodyB_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_bodyB_1.apply(null,arguments)},Yv=b._emscripten_bind_b2RopeJoint_GetReactionTorque_1=function(){return b.asm._emscripten_bind_b2RopeJoint_GetReactionTorque_1.apply(null,arguments)},Zv=b._emscripten_bind_b2WheelJointDef_set_dampingRatio_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_dampingRatio_1.apply(null,arguments)},$v=b._emscripten_bind_b2GearJoint_GetType_0= +function(){return b.asm._emscripten_bind_b2GearJoint_GetType_0.apply(null,arguments)},aw=b._emscripten_bind_b2MotorJoint_GetNext_0=function(){return b.asm._emscripten_bind_b2MotorJoint_GetNext_0.apply(null,arguments)},bw=b._emscripten_bind_b2EdgeShape_set_m_vertex0_1=function(){return b.asm._emscripten_bind_b2EdgeShape_set_m_vertex0_1.apply(null,arguments)},cw=b._emscripten_bind_b2RevoluteJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2RevoluteJoint_GetAnchorB_0.apply(null,arguments)}, +dw=b._emscripten_bind_b2RopeJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2RopeJointDef_set_localAnchorB_1.apply(null,arguments)},ew=b._emscripten_bind_b2PrismaticJoint_GetUserData_0=function(){return b.asm._emscripten_bind_b2PrismaticJoint_GetUserData_0.apply(null,arguments)},fw=b._emscripten_bind_b2GearJointDef_set_userData_1=function(){return b.asm._emscripten_bind_b2GearJointDef_set_userData_1.apply(null,arguments)},gw=b._emscripten_bind_b2Fixture_SetSensor_1=function(){return b.asm._emscripten_bind_b2Fixture_SetSensor_1.apply(null, +arguments)},hw=b._emscripten_bind_b2MotorJointDef_set_collideConnected_1=function(){return b.asm._emscripten_bind_b2MotorJointDef_set_collideConnected_1.apply(null,arguments)},iw=b._emscripten_bind_b2Contact_GetFixtureB_0=function(){return b.asm._emscripten_bind_b2Contact_GetFixtureB_0.apply(null,arguments)},jw=b._emscripten_bind_b2ChainShape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2ChainShape_ComputeMass_2.apply(null,arguments)},kw=b._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0= +function(){return b.asm._emscripten_bind_b2WeldJointDef_b2WeldJointDef_0.apply(null,arguments)},lw=b._emscripten_bind_b2Contact_GetChildIndexA_0=function(){return b.asm._emscripten_bind_b2Contact_GetChildIndexA_0.apply(null,arguments)},mw=b._emscripten_bind_b2RopeJointDef_get_bodyB_0=function(){return b.asm._emscripten_bind_b2RopeJointDef_get_bodyB_0.apply(null,arguments)},nw=b._emscripten_bind_b2BodyDef_b2BodyDef_0=function(){return b.asm._emscripten_bind_b2BodyDef_b2BodyDef_0.apply(null,arguments)}, +ow=b._emscripten_bind_b2MassData_get_mass_0=function(){return b.asm._emscripten_bind_b2MassData_get_mass_0.apply(null,arguments)},pw=b._emscripten_bind_b2WorldManifold_get_separations_1=function(){return b.asm._emscripten_bind_b2WorldManifold_get_separations_1.apply(null,arguments)},qw=b._emscripten_bind_b2Joint_GetBodyB_0=function(){return b.asm._emscripten_bind_b2Joint_GetBodyB_0.apply(null,arguments)},rw=b._emscripten_bind_b2Shape_GetChildCount_0=function(){return b.asm._emscripten_bind_b2Shape_GetChildCount_0.apply(null, +arguments)},sw=b._emscripten_bind_b2WheelJointDef_set_localAxisA_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAxisA_1.apply(null,arguments)},tw=b._emscripten_bind_b2Joint_Dump_0=function(){return b.asm._emscripten_bind_b2Joint_Dump_0.apply(null,arguments)},uw=b._emscripten_bind_b2World_SetContactFilter_1=function(){return b.asm._emscripten_bind_b2World_SetContactFilter_1.apply(null,arguments)},vw=b._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1=function(){return b.asm._emscripten_bind_b2RevoluteJointDef_set_motorSpeed_1.apply(null, +arguments)},ww=b._emscripten_bind_b2MotorJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2MotorJointDef_get_bodyA_0.apply(null,arguments)},xw=b._emscripten_bind_b2WheelJointDef_get_enableMotor_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_enableMotor_0.apply(null,arguments)},yw=b._emscripten_bind_b2Vec2_LengthSquared_0=function(){return b.asm._emscripten_bind_b2Vec2_LengthSquared_0.apply(null,arguments)},zw=b._emscripten_bind_b2FrictionJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2FrictionJointDef_set_bodyA_1.apply(null, +arguments)},Aw=b._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetSpringFrequencyHz_0.apply(null,arguments)},Bw=b._emscripten_bind_b2ContactEdge_set_prev_1=function(){return b.asm._emscripten_bind_b2ContactEdge_set_prev_1.apply(null,arguments)},Cw=b._emscripten_bind_b2Shape_ComputeMass_2=function(){return b.asm._emscripten_bind_b2Shape_ComputeMass_2.apply(null,arguments)},Dw=b._emscripten_bind_b2FrictionJoint_GetBodyA_0=function(){return b.asm._emscripten_bind_b2FrictionJoint_GetBodyA_0.apply(null, +arguments)},Ew=b._emscripten_bind_b2WheelJointDef_set_localAnchorB_1=function(){return b.asm._emscripten_bind_b2WheelJointDef_set_localAnchorB_1.apply(null,arguments)},Fw=b._emscripten_bind_b2Body_GetAngle_0=function(){return b.asm._emscripten_bind_b2Body_GetAngle_0.apply(null,arguments)},Gw=b._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_maxMotorForce_0.apply(null,arguments)},Hw=b._emscripten_bind_b2DistanceJoint_GetBodyA_0= +function(){return b.asm._emscripten_bind_b2DistanceJoint_GetBodyA_0.apply(null,arguments)},Iw=b._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetLocalAnchorB_0.apply(null,arguments)},Jw=b._emscripten_bind_b2PulleyJointDef_set_bodyA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_bodyA_1.apply(null,arguments)},Kw=b._emscripten_bind_b2WheelJoint_GetAnchorB_0=function(){return b.asm._emscripten_bind_b2WheelJoint_GetAnchorB_0.apply(null, +arguments)},Lw=b._emscripten_bind_b2PolygonShape_SetAsBox_2=function(){return b.asm._emscripten_bind_b2PolygonShape_SetAsBox_2.apply(null,arguments)},Mw=b._emscripten_bind_b2PrismaticJointDef_get_type_0=function(){return b.asm._emscripten_bind_b2PrismaticJointDef_get_type_0.apply(null,arguments)},Nw=b._emscripten_bind_b2Color_Set_3=function(){return b.asm._emscripten_bind_b2Color_Set_3.apply(null,arguments)},Ow=b._emscripten_bind_b2WheelJointDef_get_bodyA_0=function(){return b.asm._emscripten_bind_b2WheelJointDef_get_bodyA_0.apply(null, +arguments)},Pw=b._emscripten_enum_b2LimitState_e_atUpperLimit=function(){return b.asm._emscripten_enum_b2LimitState_e_atUpperLimit.apply(null,arguments)},Qw=b._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1=function(){return b.asm._emscripten_bind_b2PulleyJointDef_set_groundAnchorA_1.apply(null,arguments)},Rw=b._emscripten_bind_b2PolygonShape_get_m_type_0=function(){return b.asm._emscripten_bind_b2PolygonShape_get_m_type_0.apply(null,arguments)},Sw=b._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1= +function(){return b.asm._emscripten_bind_b2PrismaticJoint_SetMaxMotorForce_1.apply(null,arguments)},Tw=b._emscripten_bind_b2PulleyJointDef_get_collideConnected_0=function(){return b.asm._emscripten_bind_b2PulleyJointDef_get_collideConnected_0.apply(null,arguments)},Uw=b._emscripten_bind_JSContactListener_JSContactListener_0=function(){return b.asm._emscripten_bind_JSContactListener_JSContactListener_0.apply(null,arguments)},Vw=b._emscripten_bind_b2WheelJoint___destroy___0=function(){return b.asm._emscripten_bind_b2WheelJoint___destroy___0.apply(null, +arguments)},Ww=b._emscripten_bind_b2PolygonShape_set_m_radius_1=function(){return b.asm._emscripten_bind_b2PolygonShape_set_m_radius_1.apply(null,arguments)},Xw=b._emscripten_bind_b2Fixture_GetMassData_1=function(){return b.asm._emscripten_bind_b2Fixture_GetMassData_1.apply(null,arguments)},Yw=b._emscripten_bind_b2RopeJoint_SetMaxLength_1=function(){return b.asm._emscripten_bind_b2RopeJoint_SetMaxLength_1.apply(null,arguments)};b.dynCall_iiii=function(){return b.asm.dynCall_iiii.apply(null,arguments)}; +b.dynCall_viifii=function(){return b.asm.dynCall_viifii.apply(null,arguments)};b.dynCall_viiiii=function(){return b.asm.dynCall_viiiii.apply(null,arguments)};b.dynCall_vi=function(){return b.asm.dynCall_vi.apply(null,arguments)};b.dynCall_vii=function(){return b.asm.dynCall_vii.apply(null,arguments)};b.dynCall_ii=function(){return b.asm.dynCall_ii.apply(null,arguments)};b.dynCall_fif=function(){return b.asm.dynCall_fif.apply(null,arguments)}; +b.dynCall_viii=function(){return b.asm.dynCall_viii.apply(null,arguments)};b.dynCall_viifi=function(){return b.asm.dynCall_viifi.apply(null,arguments)};b.dynCall_v=function(){return b.asm.dynCall_v.apply(null,arguments)};b.dynCall_viif=function(){return b.asm.dynCall_viif.apply(null,arguments)};b.dynCall_viiiiii=function(){return b.asm.dynCall_viiiiii.apply(null,arguments)};b.dynCall_iii=function(){return b.asm.dynCall_iii.apply(null,arguments)}; +b.dynCall_iiiiii=function(){return b.asm.dynCall_iiiiii.apply(null,arguments)};b.dynCall_fiiiif=function(){return b.asm.dynCall_fiiiif.apply(null,arguments)};b.dynCall_viiii=function(){return b.asm.dynCall_viiii.apply(null,arguments)};f.t=b.stackAlloc;f.L=b.stackSave;f.K=b.stackRestore;f.R=b.establishStackSpace;f.f=b.setTempRet0;f.H=b.getTempRet0;b.asm=Sb; +if(zb)if("function"===typeof b.locateFile?zb=b.locateFile(zb):b.memoryInitializerPrefixURL&&(zb=b.memoryInitializerPrefixURL+zb),ea||fa){var Zw=b.readBinary(zb);Da.set(Zw,f.i)}else{var ax=function(){b.readAsync(zb,$w,function(){throw"could not load memory initializer "+zb;})};xb();var $w=function(a){a.byteLength&&(a=new Uint8Array(a));Da.set(a,f.i);b.memoryInitializerRequest&&delete b.memoryInitializerRequest.response;yb()};if(b.memoryInitializerRequest){var bx=function(){var a=b.memoryInitializerRequest; +200!==a.status&&0!==a.status?(console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+a.status+", retrying "+zb),ax()):$w(a.response)};b.memoryInitializerRequest.response?setTimeout(bx,0):b.memoryInitializerRequest.addEventListener("load",bx)}else ax()}b.then=function(a){if(b.calledRun)a(b);else{var c=b.onRuntimeInitialized;b.onRuntimeInitialized=function(){c&&c();a(b)}}return b}; +function ja(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}ja.prototype=Error();ja.prototype.constructor=ja;var cx=null,wb=function dx(){b.calledRun||ex();b.calledRun||(wb=dx)}; +b.callMain=b.O=function(a){function c(){for(var a=0;3>a;a++)e.push(0)}a=a||[];pb||(pb=!0,hb(jb));var d=a.length+1,e=[Ba(rb(b.thisProgram),"i8",0)];c();for(var g=0;g + + + +Soccer Random + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/soccerrandom/media/bellsoc.webm b/soccerrandom/media/bellsoc.webm new file mode 100644 index 00000000..b34c70d5 Binary files /dev/null and b/soccerrandom/media/bellsoc.webm differ diff --git a/soccerrandom/media/bup.webm b/soccerrandom/media/bup.webm new file mode 100644 index 00000000..ffb6b2d5 Binary files /dev/null and b/soccerrandom/media/bup.webm differ diff --git a/soccerrandom/media/buttonx.webm b/soccerrandom/media/buttonx.webm new file mode 100644 index 00000000..7b08f377 Binary files /dev/null and b/soccerrandom/media/buttonx.webm differ diff --git a/soccerrandom/media/file.webm b/soccerrandom/media/file.webm new file mode 100644 index 00000000..ae6a1983 Binary files /dev/null and b/soccerrandom/media/file.webm differ diff --git a/soccerrandom/media/goasoc.webm b/soccerrandom/media/goasoc.webm new file mode 100644 index 00000000..260ed294 Binary files /dev/null and b/soccerrandom/media/goasoc.webm differ diff --git a/soccerrandom/media/intro-button.webm b/soccerrandom/media/intro-button.webm new file mode 100644 index 00000000..cb19fa83 Binary files /dev/null and b/soccerrandom/media/intro-button.webm differ diff --git a/soccerrandom/media/intro-sound.webm b/soccerrandom/media/intro-sound.webm new file mode 100644 index 00000000..deab50cb Binary files /dev/null and b/soccerrandom/media/intro-sound.webm differ diff --git a/soccerrandom/media/jump.webm b/soccerrandom/media/jump.webm new file mode 100644 index 00000000..4df5fee5 Binary files /dev/null and b/soccerrandom/media/jump.webm differ diff --git a/soccerrandom/media/menu.webm b/soccerrandom/media/menu.webm new file mode 100644 index 00000000..9a23c142 Binary files /dev/null and b/soccerrandom/media/menu.webm differ diff --git a/soccerrandom/media/music.webm b/soccerrandom/media/music.webm new file mode 100644 index 00000000..045fcba7 Binary files /dev/null and b/soccerrandom/media/music.webm differ diff --git a/soccerrandom/media/press.webm b/soccerrandom/media/press.webm new file mode 100644 index 00000000..c15c9e30 Binary files /dev/null and b/soccerrandom/media/press.webm differ diff --git a/soccerrandom/media/refsoc.webm b/soccerrandom/media/refsoc.webm new file mode 100644 index 00000000..db1a9e10 Binary files /dev/null and b/soccerrandom/media/refsoc.webm differ diff --git a/soccerrandom/media/start.webm b/soccerrandom/media/start.webm new file mode 100644 index 00000000..e45b653c Binary files /dev/null and b/soccerrandom/media/start.webm differ diff --git a/soccerrandom/media/win.webm b/soccerrandom/media/win.webm new file mode 100644 index 00000000..a7bcf22a Binary files /dev/null and b/soccerrandom/media/win.webm differ diff --git a/soccerrandom/media/wrong.webm b/soccerrandom/media/wrong.webm new file mode 100644 index 00000000..b7c81bbd Binary files /dev/null and b/soccerrandom/media/wrong.webm differ diff --git a/soccerrandom/scripts/c3runtime.js b/soccerrandom/scripts/c3runtime.js new file mode 100644 index 00000000..1713dfae --- /dev/null +++ b/soccerrandom/scripts/c3runtime.js @@ -0,0 +1,5839 @@ +// Generated by Construct, the game and app creator :: https://www.construct.net +// ../3rdparty/glmatrix.js +{ +/* + @fileoverview gl-matrix - High performance matrix and vector operations +@author Brandon Jones +@author Colin MacKenzie IV +@version 3.4.1 + +Copyright (c) 2015-2021, Brandon Jones, Colin MacKenzie IV. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +'use strict';(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.glMatrix={}))})(this,function(exports){var EPSILON=1E-6;var ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array;var RANDOM=Math.random;var ANGLE_ORDER="zyx";function setMatrixArrayType(type){ARRAY_TYPE=type}var degree=Math.PI/180;function toRadian(a){return a* +degree}function equals$9(a,b){return Math.abs(a-b)<=EPSILON*Math.max(1,Math.abs(a),Math.abs(b))}if(!Math.hypot)Math.hypot=function(){var y=0,i=arguments.length;while(i--)y+=arguments[i]*arguments[i];return Math.sqrt(y)};var common=Object.freeze({__proto__:null,EPSILON:EPSILON,get ARRAY_TYPE(){return ARRAY_TYPE},RANDOM:RANDOM,ANGLE_ORDER:ANGLE_ORDER,setMatrixArrayType:setMatrixArrayType,toRadian:toRadian,equals:equals$9});function create$8(){var out=new ARRAY_TYPE(4);if(ARRAY_TYPE!=Float32Array){out[1]= +0;out[2]=0}out[0]=1;out[3]=1;return out}function clone$8(a){var out=new ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function copy$8(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out}function identity$5(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out}function fromValues$8(m00,m01,m10,m11){var out=new ARRAY_TYPE(4);out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out}function set$8(out,m00,m01,m10,m11){out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out} +function transpose$2(out,a){if(out===a){var a1=a[1];out[1]=a[2];out[2]=a1}else{out[0]=a[0];out[1]=a[2];out[2]=a[1];out[3]=a[3]}return out}function invert$5(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var det=a0*a3-a2*a1;if(!det)return null;det=1/det;out[0]=a3*det;out[1]=-a1*det;out[2]=-a2*det;out[3]=a0*det;return out}function adjoint$2(out,a){var a0=a[0];out[0]=a[3];out[1]=-a[1];out[2]=-a[2];out[3]=a0;return out}function determinant$3(a){return a[0]*a[3]-a[2]*a[1]}function multiply$8(out,a,b){var a0= +a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;return out}function rotate$4(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;return out}function scale$8(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;return out}function fromRotation$4(out, +rad){var s=Math.sin(rad);var c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;return out}function fromScaling$3(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];return out}function str$8(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function frob$3(a){return Math.hypot(a[0],a[1],a[2],a[3])}function LDU(L,D,U,a){L[2]=a[2]/a[0];U[0]=a[0];U[1]=a[1];U[3]=a[3]-L[2]*U[1];return[L,D,U]}function add$8(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out}function subtract$6(out, +a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out}function exactEquals$8(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$8(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3), +Math.abs(b3))}function multiplyScalar$3(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out}function multiplyScalarAndAdd$3(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;return out}var mul$8=multiply$8;var sub$6=subtract$6;var mat2=Object.freeze({__proto__:null,create:create$8,clone:clone$8,copy:copy$8,identity:identity$5,fromValues:fromValues$8,set:set$8,transpose:transpose$2,invert:invert$5,adjoint:adjoint$2,determinant:determinant$3, +multiply:multiply$8,rotate:rotate$4,scale:scale$8,fromRotation:fromRotation$4,fromScaling:fromScaling$3,str:str$8,frob:frob$3,LDU:LDU,add:add$8,subtract:subtract$6,exactEquals:exactEquals$8,equals:equals$8,multiplyScalar:multiplyScalar$3,multiplyScalarAndAdd:multiplyScalarAndAdd$3,mul:mul$8,sub:sub$6});function create$7(){var out=new ARRAY_TYPE(6);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[4]=0;out[5]=0}out[0]=1;out[3]=1;return out}function clone$7(a){var out=new ARRAY_TYPE(6);out[0]=a[0]; +out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function copy$7(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out}function identity$4(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out}function fromValues$7(a,b,c,d,tx,ty){var out=new ARRAY_TYPE(6);out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function set$7(out,a,b,c,d,tx,ty){out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out}function invert$4(out, +a){var aa=a[0],ab=a[1],ac=a[2],ad=a[3];var atx=a[4],aty=a[5];var det=aa*ad-ab*ac;if(!det)return null;det=1/det;out[0]=ad*det;out[1]=-ab*det;out[2]=-ac*det;out[3]=aa*det;out[4]=(ac*aty-ad*atx)*det;out[5]=(ab*atx-aa*aty)*det;return out}function determinant$2(a){return a[0]*a[3]-a[1]*a[2]}function multiply$7(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;out[4]= +a0*b4+a2*b5+a4;out[5]=a1*b4+a3*b5+a5;return out}function rotate$3(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var s=Math.sin(rad);var c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;out[4]=a4;out[5]=a5;return out}function scale$7(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;out[4]=a4;out[5]=a5;return out}function translate$3(out,a,v){var a0=a[0],a1=a[1], +a2=a[2],a3=a[3],a4=a[4],a5=a[5];var v0=v[0],v1=v[1];out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=a0*v0+a2*v1+a4;out[5]=a1*v0+a3*v1+a5;return out}function fromRotation$3(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;out[4]=0;out[5]=0;return out}function fromScaling$2(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];out[4]=0;out[5]=0;return out}function fromTranslation$3(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=v[0];out[5]=v[1];return out}function str$7(a){return"mat2d("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"}function frob$2(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],1)}function add$7(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];return out}function subtract$5(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];return out}function multiplyScalar$2(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]= +a[4]*b;out[5]=a[5]*b;return out}function multiplyScalarAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;return out}function exactEquals$7(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]}function equals$7(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];return Math.abs(a0-b0)<=EPSILON*Math.max(1, +Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))}var mul$7=multiply$7;var sub$5=subtract$5;var mat2d=Object.freeze({__proto__:null,create:create$7,clone:clone$7,copy:copy$7,identity:identity$4,fromValues:fromValues$7, +set:set$7,invert:invert$4,determinant:determinant$2,multiply:multiply$7,rotate:rotate$3,scale:scale$7,translate:translate$3,fromRotation:fromRotation$3,fromScaling:fromScaling$2,fromTranslation:fromTranslation$3,str:str$7,frob:frob$2,add:add$7,subtract:subtract$5,multiplyScalar:multiplyScalar$2,multiplyScalarAndAdd:multiplyScalarAndAdd$2,exactEquals:exactEquals$7,equals:equals$7,mul:mul$7,sub:sub$5});function create$6(){var out=new ARRAY_TYPE(9);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]= +0;out[5]=0;out[6]=0;out[7]=0}out[0]=1;out[4]=1;out[8]=1;return out}function fromMat4$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[4];out[4]=a[5];out[5]=a[6];out[6]=a[8];out[7]=a[9];out[8]=a[10];return out}function clone$6(a){var out=new ARRAY_TYPE(9);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out}function copy$6(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]= +a[8];return out}function fromValues$6(m00,m01,m02,m10,m11,m12,m20,m21,m22){var out=new ARRAY_TYPE(9);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function set$6(out,m00,m01,m02,m10,m11,m12,m20,m21,m22){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out}function identity$3(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function transpose$1(out, +a){if(out===a){var a01=a[1],a02=a[2],a12=a[5];out[1]=a[3];out[2]=a[6];out[3]=a01;out[5]=a[7];out[6]=a02;out[7]=a12}else{out[0]=a[0];out[1]=a[3];out[2]=a[6];out[3]=a[1];out[4]=a[4];out[5]=a[7];out[6]=a[2];out[7]=a[5];out[8]=a[8]}return out}function invert$3(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b01=a22*a11-a12*a21;var b11=-a22*a10+a12*a20;var b21=a21*a10-a11*a20;var det=a00*b01+a01*b11+a02*b21;if(!det)return null;det=1/det;out[0]=b01* +det;out[1]=(-a22*a01+a02*a21)*det;out[2]=(a12*a01-a02*a11)*det;out[3]=b11*det;out[4]=(a22*a00-a02*a20)*det;out[5]=(-a12*a00+a02*a10)*det;out[6]=b21*det;out[7]=(-a21*a00+a01*a20)*det;out[8]=(a11*a00-a01*a10)*det;return out}function adjoint$1(out,a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];out[0]=a11*a22-a12*a21;out[1]=a02*a21-a01*a22;out[2]=a01*a12-a02*a11;out[3]=a12*a20-a10*a22;out[4]=a00*a22-a02*a20;out[5]=a02*a10-a00*a12;out[6]=a10*a21-a11*a20; +out[7]=a01*a20-a00*a21;out[8]=a00*a11-a01*a10;return out}function determinant$1(a){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];return a00*(a22*a11-a12*a21)+a01*(-a22*a10+a12*a20)+a02*(a21*a10-a11*a20)}function multiply$6(out,a,b){var a00=a[0],a01=a[1],a02=a[2];var a10=a[3],a11=a[4],a12=a[5];var a20=a[6],a21=a[7],a22=a[8];var b00=b[0],b01=b[1],b02=b[2];var b10=b[3],b11=b[4],b12=b[5];var b20=b[6],b21=b[7],b22=b[8];out[0]=b00*a00+b01*a10+b02*a20;out[1]= +b00*a01+b01*a11+b02*a21;out[2]=b00*a02+b01*a12+b02*a22;out[3]=b10*a00+b11*a10+b12*a20;out[4]=b10*a01+b11*a11+b12*a21;out[5]=b10*a02+b11*a12+b12*a22;out[6]=b20*a00+b21*a10+b22*a20;out[7]=b20*a01+b21*a11+b22*a21;out[8]=b20*a02+b21*a12+b22*a22;return out}function translate$2(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x=v[0],y=v[1];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a10;out[4]=a11;out[5]=a12;out[6]=x*a00+y*a10+a20;out[7]=x*a01+y*a11+a21;out[8]=x* +a02+y*a12+a22;return out}function rotate$2(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);out[0]=c*a00+s*a10;out[1]=c*a01+s*a11;out[2]=c*a02+s*a12;out[3]=c*a10-s*a00;out[4]=c*a11-s*a01;out[5]=c*a12-s*a02;out[6]=a20;out[7]=a21;out[8]=a22;return out}function scale$6(out,a,v){var x=v[0],y=v[1];out[0]=x*a[0];out[1]=x*a[1];out[2]=x*a[2];out[3]=y*a[3];out[4]=y*a[4];out[5]=y*a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out} +function fromTranslation$2(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=v[0];out[7]=v[1];out[8]=1;return out}function fromRotation$2(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=0;out[3]=-s;out[4]=c;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromScaling$1(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=0;out[4]=v[1];out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out}function fromMat2d(out,a){out[0]=a[0];out[1]=a[1];out[2]=0;out[3]=a[2];out[4]=a[3]; +out[5]=0;out[6]=a[4];out[7]=a[5];out[8]=1;return out}function fromQuat$1(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out}function normalFromMat4(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20= +a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a12* +b08-a10*b11-a13*b07)*det;out[2]=(a10*b10-a11*b08+a13*b06)*det;out[3]=(a02*b10-a01*b11-a03*b09)*det;out[4]=(a00*b11-a02*b08+a03*b07)*det;out[5]=(a01*b08-a00*b10-a03*b06)*det;out[6]=(a31*b05-a32*b04+a33*b03)*det;out[7]=(a32*b02-a30*b05-a33*b01)*det;out[8]=(a30*b04-a31*b02+a33*b00)*det;return out}function projection(out,width,height){out[0]=2/width;out[1]=0;out[2]=0;out[3]=0;out[4]=-2/height;out[5]=0;out[6]=-1;out[7]=1;out[8]=1;return out}function str$6(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+ +a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"}function frob$1(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}function add$6(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];return out}function subtract$4(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]= +a[8]-b[8];return out}function multiplyScalar$1(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;return out}function multiplyScalarAndAdd$1(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;return out}function exactEquals$6(a,b){return a[0]===b[0]&& +a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]}function equals$6(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7],a8=a[8];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON* +Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))}var mul$6=multiply$6;var sub$4=subtract$4;var mat3=Object.freeze({__proto__:null,create:create$6,fromMat4:fromMat4$1,clone:clone$6,copy:copy$6, +fromValues:fromValues$6,set:set$6,identity:identity$3,transpose:transpose$1,invert:invert$3,adjoint:adjoint$1,determinant:determinant$1,multiply:multiply$6,translate:translate$2,rotate:rotate$2,scale:scale$6,fromTranslation:fromTranslation$2,fromRotation:fromRotation$2,fromScaling:fromScaling$1,fromMat2d:fromMat2d,fromQuat:fromQuat$1,normalFromMat4:normalFromMat4,projection:projection,str:str$6,frob:frob$1,add:add$6,subtract:subtract$4,multiplyScalar:multiplyScalar$1,multiplyScalarAndAdd:multiplyScalarAndAdd$1, +exactEquals:exactEquals$6,equals:equals$6,mul:mul$6,sub:sub$4});function create$5(){var out=new ARRAY_TYPE(16);if(ARRAY_TYPE!=Float32Array){out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=0;out[12]=0;out[13]=0;out[14]=0}out[0]=1;out[5]=1;out[10]=1;out[15]=1;return out}function clone$5(a){var out=new ARRAY_TYPE(16);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]= +a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function copy$5(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function fromValues$5(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){var out=new ARRAY_TYPE(16);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]= +m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function set$5(out,m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]=m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out}function identity$2(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]= +0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function transpose(out,a){if(out===a){var a01=a[1],a02=a[2],a03=a[3];var a12=a[6],a13=a[7];var a23=a[11];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a01;out[6]=a[9];out[7]=a[13];out[8]=a02;out[9]=a12;out[11]=a[14];out[12]=a03;out[13]=a13;out[14]=a23}else{out[0]=a[0];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a[1];out[5]=a[5];out[6]=a[9];out[7]=a[13];out[8]=a[2];out[9]=a[6];out[10]=a[10];out[11]=a[14];out[12]=a[3];out[13]=a[7];out[14]=a[11];out[15]= +a[15]}return out}function invert$2(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05=a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;var det= +b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det)return null;det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a02*b10-a01*b11-a03*b09)*det;out[2]=(a31*b05-a32*b04+a33*b03)*det;out[3]=(a22*b04-a21*b05-a23*b03)*det;out[4]=(a12*b08-a10*b11-a13*b07)*det;out[5]=(a00*b11-a02*b08+a03*b07)*det;out[6]=(a32*b02-a30*b05-a33*b01)*det;out[7]=(a20*b05-a22*b02+a23*b01)*det;out[8]=(a10*b10-a11*b08+a13*b06)*det;out[9]=(a01*b08-a00*b10-a03*b06)*det;out[10]=(a30*b04-a31*b02+a33*b00)*det;out[11]=(a21*b02- +a20*b04-a23*b00)*det;out[12]=(a11*b07-a10*b09-a12*b06)*det;out[13]=(a00*b09-a01*b07+a02*b06)*det;out[14]=(a31*b01-a30*b03-a32*b00)*det;out[15]=(a20*b03-a21*b01+a22*b00)*det;return out}function adjoint(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b00=a00*a11-a01*a10;var b01=a00*a12-a02*a10;var b02=a00*a13-a03*a10;var b03=a01*a12-a02*a11;var b04=a01*a13-a03*a11;var b05= +a02*a13-a03*a12;var b06=a20*a31-a21*a30;var b07=a20*a32-a22*a30;var b08=a20*a33-a23*a30;var b09=a21*a32-a22*a31;var b10=a21*a33-a23*a31;var b11=a22*a33-a23*a32;out[0]=a11*b11-a12*b10+a13*b09;out[1]=a02*b10-a01*b11-a03*b09;out[2]=a31*b05-a32*b04+a33*b03;out[3]=a22*b04-a21*b05-a23*b03;out[4]=a12*b08-a10*b11-a13*b07;out[5]=a00*b11-a02*b08+a03*b07;out[6]=a32*b02-a30*b05-a33*b01;out[7]=a20*b05-a22*b02+a23*b01;out[8]=a10*b10-a11*b08+a13*b06;out[9]=a01*b08-a00*b10-a03*b06;out[10]=a30*b04-a31*b02+a33*b00; +out[11]=a21*b02-a20*b04-a23*b00;out[12]=a11*b07-a10*b09-a12*b06;out[13]=a00*b09-a01*b07+a02*b06;out[14]=a31*b01-a30*b03-a32*b00;out[15]=a20*b03-a21*b01+a22*b00;return out}function determinant(a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=a00*a11-a01*a10;var b1=a00*a12-a02*a10;var b2=a01*a12-a02*a11;var b3=a20*a31-a21*a30;var b4=a20*a32-a22*a30;var b5=a21*a32-a22*a31;var b6= +a00*b5-a01*b4+a02*b3;var b7=a10*b5-a11*b4+a12*b3;var b8=a20*b2-a21*b1+a22*b0;var b9=a30*b2-a31*b1+a32*b0;return a13*b6-a03*b7+a33*b8-a23*b9}function multiply$5(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a03=a[3];var a10=a[4],a11=a[5],a12=a[6],a13=a[7];var a20=a[8],a21=a[9],a22=a[10],a23=a[11];var a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=b0*a00+b1*a10+b2*a20+b3*a30;out[1]=b0*a01+b1*a11+b2*a21+b3*a31;out[2]=b0*a02+b1*a12+b2*a22+b3*a32;out[3]=b0*a03+b1*a13+b2*a23+ +b3*a33;b0=b[4];b1=b[5];b2=b[6];b3=b[7];out[4]=b0*a00+b1*a10+b2*a20+b3*a30;out[5]=b0*a01+b1*a11+b2*a21+b3*a31;out[6]=b0*a02+b1*a12+b2*a22+b3*a32;out[7]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[8];b1=b[9];b2=b[10];b3=b[11];out[8]=b0*a00+b1*a10+b2*a20+b3*a30;out[9]=b0*a01+b1*a11+b2*a21+b3*a31;out[10]=b0*a02+b1*a12+b2*a22+b3*a32;out[11]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[12];b1=b[13];b2=b[14];b3=b[15];out[12]=b0*a00+b1*a10+b2*a20+b3*a30;out[13]=b0*a01+b1*a11+b2*a21+b3*a31;out[14]=b0*a02+b1*a12+b2*a22+b3*a32;out[15]= +b0*a03+b1*a13+b2*a23+b3*a33;return out}function translate$1(out,a,v){var x=v[0],y=v[1],z=v[2];var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]= +a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out}function scale$5(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out}function rotate$1(out, +a,rad,axis){var x=axis[0],y=axis[1],z=axis[2];var len=Math.hypot(x,y,z);var s,c,t;var a00,a01,a02,a03;var a10,a11,a12,a13;var a20,a21,a22,a23;var b00,b01,b02;var b10,b11,b12;var b20,b21,b22;if(len0){translation[0]=(ax*bw+aw*bx+ay*bz- +az*by)*2/magnitude;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2/magnitude;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2/magnitude}else{translation[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;translation[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;translation[2]=(az*bw+aw*bz+ax*by-ay*bx)*2}fromRotationTranslation$1(out,a,translation);return out}function getTranslation$1(out,mat){out[0]=mat[12];out[1]=mat[13];out[2]=mat[14];return out}function getScaling(out,mat){var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22= +mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out[0]=Math.hypot(m11,m12,m13);out[1]=Math.hypot(m21,m22,m23);out[2]=Math.hypot(m31,m32,m33);return out}function getRotation(out,mat){var scaling=new ARRAY_TYPE(3);getScaling(scaling,mat);var is1=1/scaling[0];var is2=1/scaling[1];var is3=1/scaling[2];var sm11=mat[0]*is1;var sm12=mat[1]*is2;var sm13=mat[2]*is3;var sm21=mat[4]*is1;var sm22=mat[5]*is2;var sm23=mat[6]*is3;var sm31=mat[8]*is1;var sm32=mat[9]*is2;var sm33=mat[10]*is3;var trace= +sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out[3]=.25*S;out[0]=(sm23-sm32)/S;out[1]=(sm31-sm13)/S;out[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out[3]=(sm23-sm32)/S;out[0]=.25*S;out[1]=(sm12+sm21)/S;out[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out[3]=(sm31-sm13)/S;out[0]=(sm12+sm21)/S;out[1]=.25*S;out[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+sm33-sm11-sm22)*2;out[3]=(sm12-sm21)/S;out[0]=(sm31+sm13)/S;out[1]=(sm23+sm32)/S;out[2]= +.25*S}return out}function decompose(out_r,out_t,out_s,mat){out_t[0]=mat[12];out_t[1]=mat[13];out_t[2]=mat[14];var m11=mat[0];var m12=mat[1];var m13=mat[2];var m21=mat[4];var m22=mat[5];var m23=mat[6];var m31=mat[8];var m32=mat[9];var m33=mat[10];out_s[0]=Math.hypot(m11,m12,m13);out_s[1]=Math.hypot(m21,m22,m23);out_s[2]=Math.hypot(m31,m32,m33);var is1=1/out_s[0];var is2=1/out_s[1];var is3=1/out_s[2];var sm11=m11*is1;var sm12=m12*is2;var sm13=m13*is3;var sm21=m21*is1;var sm22=m22*is2;var sm23=m23*is3; +var sm31=m31*is1;var sm32=m32*is2;var sm33=m33*is3;var trace=sm11+sm22+sm33;var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out_r[3]=.25*S;out_r[0]=(sm23-sm32)/S;out_r[1]=(sm31-sm13)/S;out_r[2]=(sm12-sm21)/S}else if(sm11>sm22&&sm11>sm33){S=Math.sqrt(1+sm11-sm22-sm33)*2;out_r[3]=(sm23-sm32)/S;out_r[0]=.25*S;out_r[1]=(sm12+sm21)/S;out_r[2]=(sm31+sm13)/S}else if(sm22>sm33){S=Math.sqrt(1+sm22-sm11-sm33)*2;out_r[3]=(sm31-sm13)/S;out_r[0]=(sm12+sm21)/S;out_r[1]=.25*S;out_r[2]=(sm23+sm32)/S}else{S=Math.sqrt(1+ +sm33-sm11-sm22)*2;out_r[3]=(sm12-sm21)/S;out_r[0]=(sm31+sm13)/S;out_r[1]=(sm23+sm32)/S;out_r[2]=.25*S}return out_r}function fromRotationTranslationScale(out,q,v,s){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];out[0]=(1-(yy+zz))*sx;out[1]=(xy+wz)*sx;out[2]=(xz-wy)*sx;out[3]=0;out[4]=(xy-wz)*sy;out[5]=(1-(xx+zz))*sy;out[6]=(yz+wx)*sy;out[7]= +0;out[8]=(xz+wy)*sz;out[9]=(yz-wx)*sz;out[10]=(1-(xx+yy))*sz;out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out}function fromRotationTranslationScaleOrigin(out,q,v,s,o){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var xy=x*y2;var xz=x*z2;var yy=y*y2;var yz=y*z2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;var sx=s[0];var sy=s[1];var sz=s[2];var ox=o[0];var oy=o[1];var oz=o[2];var out0=(1-(yy+zz))*sx;var out1=(xy+wz)*sx;var out2=(xz-wy)*sx;var out4= +(xy-wz)*sy;var out5=(1-(xx+zz))*sy;var out6=(yz+wx)*sy;var out8=(xz+wy)*sz;var out9=(yz-wx)*sz;var out10=(1-(xx+yy))*sz;out[0]=out0;out[1]=out1;out[2]=out2;out[3]=0;out[4]=out4;out[5]=out5;out[6]=out6;out[7]=0;out[8]=out8;out[9]=out9;out[10]=out10;out[11]=0;out[12]=v[0]+ox-(out0*ox+out4*oy+out8*oz);out[13]=v[1]+oy-(out1*ox+out5*oy+out9*oz);out[14]=v[2]+oz-(out2*ox+out6*oy+out10*oz);out[15]=1;return out}function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx= +x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[1]=yx+wz;out[2]=zx-wy;out[3]=0;out[4]=yx-wz;out[5]=1-xx-zz;out[6]=zy+wx;out[7]=0;out[8]=zx+wy;out[9]=zy-wx;out[10]=1-xx-yy;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out}function frustum(out,left,right,bottom,top,near,far){var rl=1/(right-left);var tb=1/(top-bottom);var nf=1/(near-far);out[0]=near*2*rl;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=near*2*tb;out[6]=0;out[7]= +0;out[8]=(right+left)*rl;out[9]=(top+bottom)*tb;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near*2*nf;out[15]=0;return out}function perspectiveNO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=(far+near)*nf;out[14]=2*far*near*nf}else{out[10]=-1;out[14]=-2*near}return out}var perspective= +perspectiveNO;function perspectiveZO(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[11]=-1;out[12]=0;out[13]=0;out[15]=0;if(far!=null&&far!==Infinity){var nf=1/(near-far);out[10]=far*nf;out[14]=far*near*nf}else{out[10]=-1;out[14]=-near}return out}function perspectiveFromFieldOfView(out,fov,near,far){var upTan=Math.tan(fov.upDegrees*Math.PI/180);var downTan=Math.tan(fov.downDegrees*Math.PI/180); +var leftTan=Math.tan(fov.leftDegrees*Math.PI/180);var rightTan=Math.tan(fov.rightDegrees*Math.PI/180);var xScale=2/(leftTan+rightTan);var yScale=2/(upTan+downTan);out[0]=xScale;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=yScale;out[6]=0;out[7]=0;out[8]=-((leftTan-rightTan)*xScale*.5);out[9]=(upTan-downTan)*yScale*.5;out[10]=far/(near-far);out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near/(near-far);out[15]=0;return out}function orthoNO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt= +1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=2*nf;out[11]=0;out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=(far+near)*nf;out[15]=1;return out}var ortho=orthoNO;function orthoZO(out,left,right,bottom,top,near,far){var lr=1/(left-right);var bt=1/(bottom-top);var nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=nf;out[11]=0; +out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=near*nf;out[15]=1;return out}function lookAt(out,eye,center,up){var x0,x1,x2,y0,y1,y2,z0,z1,z2,len;var eyex=eye[0];var eyey=eye[1];var eyez=eye[2];var upx=up[0];var upy=up[1];var upz=up[2];var centerx=center[0];var centery=center[1];var centerz=center[2];if(Math.abs(eyex-centerx)0){len=1/Math.sqrt(len);z0*=len;z1*=len;z2*=len}var x0=upy*z2-upz*z1,x1=upz*z0-upx*z2,x2=upx*z1-upy*z0;len=x0*x0+x1*x1+x2*x2;if(len>0){len=1/Math.sqrt(len);x0*=len;x1*=len;x2*=len}out[0]=x0;out[1]=x1;out[2]=x2;out[3]=0;out[4]=z1*x2-z2*x1;out[5]=z2*x0-z0*x2;out[6]= +z0*x1-z1*x0;out[7]=0;out[8]=z0;out[9]=z1;out[10]=z2;out[11]=0;out[12]=eyex;out[13]=eyey;out[14]=eyez;out[15]=1;return out}function str$5(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"}function frob(a){return Math.hypot(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}function add$5(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]= +a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];out[9]=a[9]+b[9];out[10]=a[10]+b[10];out[11]=a[11]+b[11];out[12]=a[12]+b[12];out[13]=a[13]+b[13];out[14]=a[14]+b[14];out[15]=a[15]+b[15];return out}function subtract$3(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]=a[8]-b[8];out[9]=a[9]-b[9];out[10]=a[10]-b[10];out[11]=a[11]-b[11];out[12]= +a[12]-b[12];out[13]=a[13]-b[13];out[14]=a[14]-b[14];out[15]=a[15]-b[15];return out}function multiplyScalar(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;out[9]=a[9]*b;out[10]=a[10]*b;out[11]=a[11]*b;out[12]=a[12]*b;out[13]=a[13]*b;out[14]=a[14]*b;out[15]=a[15]*b;return out}function multiplyScalarAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]= +a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;out[9]=a[9]+b[9]*scale;out[10]=a[10]+b[10]*scale;out[11]=a[11]+b[11]*scale;out[12]=a[12]+b[12]*scale;out[13]=a[13]+b[13]*scale;out[14]=a[14]+b[14]*scale;out[15]=a[15]+b[15]*scale;return out}function exactEquals$5(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]=== +b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]}function equals$5(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var a4=a[4],a5=a[5],a6=a[6],a7=a[7];var a8=a[8],a9=a[9],a10=a[10],a11=a[11];var a12=a[12],a13=a[13],a14=a[14],a15=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];var b4=b[4],b5=b[5],b6=b[6],b7=b[7];var b8=b[8],b9=b[9],b10=b[10],b11=b[11];var b12=b[12],b13=b[13],b14=b[14],b15=b[15];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1), +Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))&&Math.abs(a9-b9)<=EPSILON*Math.max(1,Math.abs(a9), +Math.abs(b9))&&Math.abs(a10-b10)<=EPSILON*Math.max(1,Math.abs(a10),Math.abs(b10))&&Math.abs(a11-b11)<=EPSILON*Math.max(1,Math.abs(a11),Math.abs(b11))&&Math.abs(a12-b12)<=EPSILON*Math.max(1,Math.abs(a12),Math.abs(b12))&&Math.abs(a13-b13)<=EPSILON*Math.max(1,Math.abs(a13),Math.abs(b13))&&Math.abs(a14-b14)<=EPSILON*Math.max(1,Math.abs(a14),Math.abs(b14))&&Math.abs(a15-b15)<=EPSILON*Math.max(1,Math.abs(a15),Math.abs(b15))}var mul$5=multiply$5;var sub$3=subtract$3;var mat4=Object.freeze({__proto__:null, +create:create$5,clone:clone$5,copy:copy$5,fromValues:fromValues$5,set:set$5,identity:identity$2,transpose:transpose,invert:invert$2,adjoint:adjoint,determinant:determinant,multiply:multiply$5,translate:translate$1,scale:scale$5,rotate:rotate$1,rotateX:rotateX$3,rotateY:rotateY$3,rotateZ:rotateZ$3,fromTranslation:fromTranslation$1,fromScaling:fromScaling,fromRotation:fromRotation$1,fromXRotation:fromXRotation,fromYRotation:fromYRotation,fromZRotation:fromZRotation,fromRotationTranslation:fromRotationTranslation$1, +fromQuat2:fromQuat2,getTranslation:getTranslation$1,getScaling:getScaling,getRotation:getRotation,decompose:decompose,fromRotationTranslationScale:fromRotationTranslationScale,fromRotationTranslationScaleOrigin:fromRotationTranslationScaleOrigin,fromQuat:fromQuat,frustum:frustum,perspectiveNO:perspectiveNO,perspective:perspective,perspectiveZO:perspectiveZO,perspectiveFromFieldOfView:perspectiveFromFieldOfView,orthoNO:orthoNO,ortho:ortho,orthoZO:orthoZO,lookAt:lookAt,targetTo:targetTo,str:str$5,frob:frob, +add:add$5,subtract:subtract$3,multiplyScalar:multiplyScalar,multiplyScalarAndAdd:multiplyScalarAndAdd,exactEquals:exactEquals$5,equals:equals$5,mul:mul$5,sub:sub$3});function create$4(){var out=new ARRAY_TYPE(3);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0;out[2]=0}return out}function clone$4(a){var out=new ARRAY_TYPE(3);out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function length$4(a){var x=a[0];var y=a[1];var z=a[2];return Math.hypot(x,y,z)}function fromValues$4(x,y,z){var out=new ARRAY_TYPE(3); +out[0]=x;out[1]=y;out[2]=z;return out}function copy$4(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];return out}function set$4(out,x,y,z){out[0]=x;out[1]=y;out[2]=z;return out}function add$4(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];return out}function subtract$2(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];return out}function multiply$4(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];return out}function divide$2(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1]; +out[2]=a[2]/b[2];return out}function ceil$2(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);out[2]=Math.ceil(a[2]);return out}function floor$2(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);out[2]=Math.floor(a[2]);return out}function min$2(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);return out}function max$2(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);return out}function round$2(out,a){out[0]= +Math.round(a[0]);out[1]=Math.round(a[1]);out[2]=Math.round(a[2]);return out}function scale$4(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;return out}function scaleAndAdd$2(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;return out}function distance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return Math.hypot(x,y,z)}function squaredDistance$2(a,b){var x=b[0]-a[0];var y=b[1]-a[1];var z=b[2]-a[2];return x*x+y*y+z*z}function squaredLength$4(a){var x= +a[0];var y=a[1];var z=a[2];return x*x+y*y+z*z}function negate$2(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];return out}function inverse$2(out,a){out[0]=1/a[0];out[1]=1/a[1];out[2]=1/a[2];return out}function normalize$4(out,a){var x=a[0];var y=a[1];var z=a[2];var len=x*x+y*y+z*z;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len;return out}function dot$4(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function cross$2(out,a,b){var ax=a[0],ay=a[1],az=a[2];var bx=b[0],by=b[1], +bz=b[2];out[0]=ay*bz-az*by;out[1]=az*bx-ax*bz;out[2]=ax*by-ay*bx;return out}function lerp$4(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);return out}function slerp$1(out,a,b,t){var angle=Math.acos(Math.min(Math.max(dot$4(a,b),-1),1));var sinTotal=Math.sin(angle);var ratioA=Math.sin((1-t)*angle)/sinTotal;var ratioB=Math.sin(t*angle)/sinTotal;out[0]=ratioA*a[0]+ratioB*b[0];out[1]=ratioA*a[1]+ratioB*b[1];out[2]=ratioA*a[2]+ratioB*b[2]; +return out}function hermite(out,a,b,c,d,t){var factorTimes2=t*t;var factor1=factorTimes2*(2*t-3)+1;var factor2=factorTimes2*(t-2)+t;var factor3=factorTimes2*(t-1);var factor4=factorTimes2*(3-2*t);out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function bezier(out,a,b,c,d,t){var inverseFactor=1-t;var inverseFactorTimesTwo=inverseFactor*inverseFactor;var factorTimes2= +t*t;var factor1=inverseFactorTimesTwo*inverseFactor;var factor2=3*t*inverseFactorTimesTwo;var factor3=3*factorTimes2*inverseFactor;var factor4=factorTimes2*t;out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out}function random$3(out,scale){scale=scale||1;var r=RANDOM()*2*Math.PI;var z=RANDOM()*2-1;var zScale=Math.sqrt(1-z*z)*scale;out[0]=Math.cos(r)*zScale;out[1]= +Math.sin(r)*zScale;out[2]=z*scale;return out}function transformMat4$2(out,a,m){var x=a[0],y=a[1],z=a[2];var w=m[3]*x+m[7]*y+m[11]*z+m[15];w=w||1;out[0]=(m[0]*x+m[4]*y+m[8]*z+m[12])/w;out[1]=(m[1]*x+m[5]*y+m[9]*z+m[13])/w;out[2]=(m[2]*x+m[6]*y+m[10]*z+m[14])/w;return out}function transformMat3$1(out,a,m){var x=a[0],y=a[1],z=a[2];out[0]=x*m[0]+y*m[3]+z*m[6];out[1]=x*m[1]+y*m[4]+z*m[7];out[2]=x*m[2]+y*m[5]+z*m[8];return out}function transformQuat$1(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var x= +a[0],y=a[1],z=a[2];var uvx=qy*z-qz*y,uvy=qz*x-qx*z,uvz=qx*y-qy*x;var uuvx=qy*uvz-qz*uvy,uuvy=qz*uvx-qx*uvz,uuvz=qx*uvy-qy*uvx;var w2=qw*2;uvx*=w2;uvy*=w2;uvz*=w2;uuvx*=2;uuvy*=2;uuvz*=2;out[0]=x+uvx+uuvx;out[1]=y+uvy+uuvy;out[2]=z+uvz+uuvz;return out}function rotateX$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0];r[1]=p[1]*Math.cos(rad)-p[2]*Math.sin(rad);r[2]=p[1]*Math.sin(rad)+p[2]*Math.cos(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateY$2(out, +a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[2]*Math.sin(rad)+p[0]*Math.cos(rad);r[1]=p[1];r[2]=p[2]*Math.cos(rad)-p[0]*Math.sin(rad);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function rotateZ$2(out,a,b,rad){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0]*Math.cos(rad)-p[1]*Math.sin(rad);r[1]=p[0]*Math.sin(rad)+p[1]*Math.cos(rad);r[2]=p[2];out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out}function angle$1(a,b){var ax= +a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2],mag=Math.sqrt((ax*ax+ay*ay+az*az)*(bx*bx+by*by+bz*bz)),cosine=mag&&dot$4(a,b)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero$2(out){out[0]=0;out[1]=0;out[2]=0;return out}function str$4(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"}function exactEquals$4(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]}function equals$4(a,b){var a0=a[0],a1=a[1],a2=a[2];var b0=b[0],b1=b[1],b2=b[2];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0), +Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))}var sub$2=subtract$2;var mul$4=multiply$4;var div$2=divide$2;var dist$2=distance$2;var sqrDist$2=squaredDistance$2;var len$4=length$4;var sqrLen$4=squaredLength$4;var forEach$2=function(){var vec=create$4();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=3;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length; +for(i=offset;i0)len=1/Math.sqrt(len);out[0]= +x*len;out[1]=y*len;out[2]=z*len;out[3]=w*len;return out}function dot$3(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cross$1(out,u,v,w){var A=v[0]*w[1]-v[1]*w[0],B=v[0]*w[2]-v[2]*w[0],C=v[0]*w[3]-v[3]*w[0],D=v[1]*w[2]-v[2]*w[1],E=v[1]*w[3]-v[3]*w[1],F=v[2]*w[3]-v[3]*w[2];var G=u[0];var H=u[1];var I=u[2];var J=u[3];out[0]=H*F-I*E+J*D;out[1]=-(G*F)+I*C-J*B;out[2]=G*E-H*C+J*A;out[3]=-(G*D)+H*B-I*A;return out}function lerp$3(out,a,b,t){var ax=a[0];var ay=a[1];var az=a[2];var aw=a[3];out[0]= +ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);out[3]=aw+t*(b[3]-aw);return out}function random$2(out,scale){scale=scale||1;var v1,v2,v3,v4;var s1,s2;do{v1=RANDOM()*2-1;v2=RANDOM()*2-1;s1=v1*v1+v2*v2}while(s1>=1);do{v3=RANDOM()*2-1;v4=RANDOM()*2-1;s2=v3*v3+v4*v4}while(s2>=1);var d=Math.sqrt((1-s1)/s2);out[0]=scale*v1;out[1]=scale*v2;out[2]=scale*v3*d;out[3]=scale*v4*d;return out}function transformMat4$1(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w;out[1]= +m[1]*x+m[5]*y+m[9]*z+m[13]*w;out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w;out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w;return out}function transformQuat(out,a,q){var x=a[0],y=a[1],z=a[2];var qx=q[0],qy=q[1],qz=q[2],qw=q[3];var ix=qw*x+qy*z-qz*y;var iy=qw*y+qz*x-qx*z;var iz=qw*z+qx*y-qy*x;var iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;out[3]=a[3];return out}function zero$1(out){out[0]=0;out[1]=0;out[2]=0;out[3]=0;return out}function str$3(a){return"vec4("+ +a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}function exactEquals$3(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]}function equals$3(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))}var sub$1=subtract$1; +var mul$3=multiply$3;var div$1=divide$1;var dist$1=distance$1;var sqrDist$1=squaredDistance$1;var len$3=length$3;var sqrLen$3=squaredLength$3;var forEach$1=function(){var vec=create$3();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=4;if(!offset)offset=0;if(count)l=Math.min(count*stride+offset,a.length);else l=a.length;for(i=offset;iEPSILON){out_axis[0]=q[0]/s;out_axis[1]=q[1]/s;out_axis[2]=q[2]/s}else{out_axis[0]=1;out_axis[1]=0;out_axis[2]=0}return rad}function getAngle(a,b){var dotproduct=dot$2(a,b);return Math.acos(2*dotproduct*dotproduct-1)}function multiply$2(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];out[0]=ax*bw+aw*bx+ay*bz-az*by;out[1]=ay*bw+aw*by+az*bx- +ax*bz;out[2]=az*bw+aw*bz+ax*by-ay*bx;out[3]=aw*bw-ax*bx-ay*by-az*bz;return out}function rotateX$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+aw*bx;out[1]=ay*bw+az*bx;out[2]=az*bw-ay*bx;out[3]=aw*bw-ax*bx;return out}function rotateY$1(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var by=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw-az*by;out[1]=ay*bw+aw*by;out[2]=az*bw+ax*by;out[3]=aw*bw-ay*by;return out}function rotateZ$1(out,a, +rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bz=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+ay*bz;out[1]=ay*bw-ax*bz;out[2]=az*bw+aw*bz;out[3]=aw*bw-az*bz;return out}function calculateW(out,a){var x=a[0],y=a[1],z=a[2];out[0]=x;out[1]=y;out[2]=z;out[3]=Math.sqrt(Math.abs(1-x*x-y*y-z*z));return out}function exp(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var et=Math.exp(w);var s=r>0?et*Math.sin(r)/r:0;out[0]=x*s;out[1]=y*s;out[2]=z*s;out[3]=et*Math.cos(r);return out} +function ln(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var r=Math.sqrt(x*x+y*y+z*z);var t=r>0?Math.atan2(r,w)/r:0;out[0]=x*t;out[1]=y*t;out[2]=z*t;out[3]=.5*Math.log(x*x+y*y+z*z+w*w);return out}function pow(out,a,b){ln(out,a);scale$2(out,out,b);exp(out,out);return out}function slerp(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];var bx=b[0],by=b[1],bz=b[2],bw=b[3];var omega,cosom,sinom,scale0,scale1;cosom=ax*bx+ay*by+az*bz+aw*bw;if(cosom<0){cosom=-cosom;bx=-bx;by=-by;bz=-bz;bw=-bw}if(1-cosom>EPSILON){omega= +Math.acos(cosom);sinom=Math.sin(omega);scale0=Math.sin((1-t)*omega)/sinom;scale1=Math.sin(t*omega)/sinom}else{scale0=1-t;scale1=t}out[0]=scale0*ax+scale1*bx;out[1]=scale0*ay+scale1*by;out[2]=scale0*az+scale1*bz;out[3]=scale0*aw+scale1*bw;return out}function random$1(out){var u1=RANDOM();var u2=RANDOM();var u3=RANDOM();var sqrt1MinusU1=Math.sqrt(1-u1);var sqrtU1=Math.sqrt(u1);out[0]=sqrt1MinusU1*Math.sin(2*Math.PI*u2);out[1]=sqrt1MinusU1*Math.cos(2*Math.PI*u2);out[2]=sqrtU1*Math.sin(2*Math.PI*u3); +out[3]=sqrtU1*Math.cos(2*Math.PI*u3);return out}function invert$1(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var dot=a0*a0+a1*a1+a2*a2+a3*a3;var invDot=dot?1/dot:0;out[0]=-a0*invDot;out[1]=-a1*invDot;out[2]=-a2*invDot;out[3]=a3*invDot;return out}function conjugate$1(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=a[3];return out}function fromMat3(out,m){var fTrace=m[0]+m[4]+m[8];var fRoot;if(fTrace>0){fRoot=Math.sqrt(fTrace+1);out[3]=.5*fRoot;fRoot=.5/fRoot;out[0]=(m[5]-m[7])*fRoot;out[1]=(m[6]- +m[2])*fRoot;out[2]=(m[1]-m[3])*fRoot}else{var i=0;if(m[4]>m[0])i=1;if(m[8]>m[i*3+i])i=2;var j=(i+1)%3;var k=(i+2)%3;fRoot=Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k]+1);out[i]=.5*fRoot;fRoot=.5/fRoot;out[3]=(m[j*3+k]-m[k*3+j])*fRoot;out[j]=(m[j*3+i]+m[i*3+j])*fRoot;out[k]=(m[k*3+i]+m[i*3+k])*fRoot}return out}function fromEuler(out,x,y,z){var order=arguments.length>4&&arguments[4]!==undefined?arguments[4]:ANGLE_ORDER;var halfToRad=Math.PI/360;x*=halfToRad;z*=halfToRad;y*=halfToRad;var sx=Math.sin(x);var cx= +Math.cos(x);var sy=Math.sin(y);var cy=Math.cos(y);var sz=Math.sin(z);var cz=Math.cos(z);switch(order){case "xyz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "xzy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yxz":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy*cz-sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;case "yzx":out[0]=sx*cy*cz+cx*sy*sz;out[1]=cx*sy* +cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zxy":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz+sx*sy*cz;out[3]=cx*cy*cz-sx*sy*sz;break;case "zyx":out[0]=sx*cy*cz-cx*sy*sz;out[1]=cx*sy*cz+sx*cy*sz;out[2]=cx*cy*sz-sx*sy*cz;out[3]=cx*cy*cz+sx*sy*sz;break;default:throw new Error("Unknown angle order "+order);}return out}function str$2(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}var clone$2=clone$3;var fromValues$2=fromValues$3;var copy$2=copy$3; +var set$2=set$3;var add$2=add$3;var mul$2=multiply$2;var scale$2=scale$3;var dot$2=dot$3;var lerp$2=lerp$3;var length$2=length$3;var len$2=length$2;var squaredLength$2=squaredLength$3;var sqrLen$2=squaredLength$2;var normalize$2=normalize$3;var exactEquals$2=exactEquals$3;function equals$2(a,b){return Math.abs(dot$3(a,b))>=1-EPSILON}var rotationTo=function(){var tmpvec3=create$4();var xUnitVec3=fromValues$4(1,0,0);var yUnitVec3=fromValues$4(0,1,0);return function(out,a,b){var dot=dot$4(a,b);if(dot< +-.999999){cross$2(tmpvec3,xUnitVec3,a);if(len$4(tmpvec3)<1E-6)cross$2(tmpvec3,yUnitVec3,a);normalize$4(tmpvec3,tmpvec3);setAxisAngle(out,tmpvec3,Math.PI);return out}else if(dot>.999999){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out}else{cross$2(tmpvec3,a,b);out[0]=tmpvec3[0];out[1]=tmpvec3[1];out[2]=tmpvec3[2];out[3]=1+dot;return normalize$2(out,out)}}}();var sqlerp=function(){var temp1=create$2();var temp2=create$2();return function(out,a,b,c,d,t){slerp(temp1,a,d,t);slerp(temp2,b,c,t);slerp(out, +temp1,temp2,2*t*(1-t));return out}}();var setAxes=function(){var matr=create$6();return function(out,view,right,up){matr[0]=right[0];matr[3]=right[1];matr[6]=right[2];matr[1]=up[0];matr[4]=up[1];matr[7]=up[2];matr[2]=-view[0];matr[5]=-view[1];matr[8]=-view[2];return normalize$2(out,fromMat3(out,matr))}}();var quat=Object.freeze({__proto__:null,create:create$2,identity:identity$1,setAxisAngle:setAxisAngle,getAxisAngle:getAxisAngle,getAngle:getAngle,multiply:multiply$2,rotateX:rotateX$1,rotateY:rotateY$1, +rotateZ:rotateZ$1,calculateW:calculateW,exp:exp,ln:ln,pow:pow,slerp:slerp,random:random$1,invert:invert$1,conjugate:conjugate$1,fromMat3:fromMat3,fromEuler:fromEuler,str:str$2,clone:clone$2,fromValues:fromValues$2,copy:copy$2,set:set$2,add:add$2,mul:mul$2,scale:scale$2,dot:dot$2,lerp:lerp$2,length:length$2,len:len$2,squaredLength:squaredLength$2,sqrLen:sqrLen$2,normalize:normalize$2,exactEquals:exactEquals$2,equals:equals$2,rotationTo:rotationTo,sqlerp:sqlerp,setAxes:setAxes});function create$1(){var dq= +new ARRAY_TYPE(8);if(ARRAY_TYPE!=Float32Array){dq[0]=0;dq[1]=0;dq[2]=0;dq[4]=0;dq[5]=0;dq[6]=0;dq[7]=0}dq[3]=1;return dq}function clone$1(a){var dq=new ARRAY_TYPE(8);dq[0]=a[0];dq[1]=a[1];dq[2]=a[2];dq[3]=a[3];dq[4]=a[4];dq[5]=a[5];dq[6]=a[6];dq[7]=a[7];return dq}function fromValues$1(x1,y1,z1,w1,x2,y2,z2,w2){var dq=new ARRAY_TYPE(8);dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;dq[4]=x2;dq[5]=y2;dq[6]=z2;dq[7]=w2;return dq}function fromRotationTranslationValues(x1,y1,z1,w1,x2,y2,z2){var dq=new ARRAY_TYPE(8); +dq[0]=x1;dq[1]=y1;dq[2]=z1;dq[3]=w1;var ax=x2*.5,ay=y2*.5,az=z2*.5;dq[4]=ax*w1+ay*z1-az*y1;dq[5]=ay*w1+az*x1-ax*z1;dq[6]=az*w1+ax*y1-ay*x1;dq[7]=-ax*x1-ay*y1-az*z1;return dq}function fromRotationTranslation(out,q,t){var ax=t[0]*.5,ay=t[1]*.5,az=t[2]*.5,bx=q[0],by=q[1],bz=q[2],bw=q[3];out[0]=bx;out[1]=by;out[2]=bz;out[3]=bw;out[4]=ax*bw+ay*bz-az*by;out[5]=ay*bw+az*bx-ax*bz;out[6]=az*bw+ax*by-ay*bx;out[7]=-ax*bx-ay*by-az*bz;return out}function fromTranslation(out,t){out[0]=0;out[1]=0;out[2]=0;out[3]= +1;out[4]=t[0]*.5;out[5]=t[1]*.5;out[6]=t[2]*.5;out[7]=0;return out}function fromRotation(out,q){out[0]=q[0];out[1]=q[1];out[2]=q[2];out[3]=q[3];out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function fromMat4(out,a){var outer=create$2();getRotation(outer,a);var t=new ARRAY_TYPE(3);getTranslation$1(t,a);fromRotationTranslation(out,outer,t);return out}function copy$1(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];return out}function identity(out){out[0]= +0;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;out[6]=0;out[7]=0;return out}function set$1(out,x1,y1,z1,w1,x2,y2,z2,w2){out[0]=x1;out[1]=y1;out[2]=z1;out[3]=w1;out[4]=x2;out[5]=y2;out[6]=z2;out[7]=w2;return out}var getReal=copy$2;function getDual(out,a){out[0]=a[4];out[1]=a[5];out[2]=a[6];out[3]=a[7];return out}var setReal=copy$2;function setDual(out,q){out[4]=q[0];out[5]=q[1];out[6]=q[2];out[7]=q[3];return out}function getTranslation(out,a){var ax=a[4],ay=a[5],az=a[6],aw=a[7],bx=-a[0],by=-a[1],bz= +-a[2],bw=a[3];out[0]=(ax*bw+aw*bx+ay*bz-az*by)*2;out[1]=(ay*bw+aw*by+az*bx-ax*bz)*2;out[2]=(az*bw+aw*bz+ax*by-ay*bx)*2;return out}function translate(out,a,v){var ax1=a[0],ay1=a[1],az1=a[2],aw1=a[3],bx1=v[0]*.5,by1=v[1]*.5,bz1=v[2]*.5,ax2=a[4],ay2=a[5],az2=a[6],aw2=a[7];out[0]=ax1;out[1]=ay1;out[2]=az1;out[3]=aw1;out[4]=aw1*bx1+ay1*bz1-az1*by1+ax2;out[5]=aw1*by1+az1*bx1-ax1*bz1+ay2;out[6]=aw1*bz1+ax1*by1-ay1*bx1+az2;out[7]=-ax1*bx1-ay1*by1-az1*bz1+aw2;return out}function rotateX(out,a,rad){var bx= +-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateX$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateY(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ +ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw-ax*bx-ay*by-az*bz;rotateY$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateZ(out,a,rad){var bx=-a[0],by=-a[1],bz=-a[2],bw=a[3],ax=a[4],ay=a[5],az=a[6],aw=a[7],ax1=ax*bw+aw*bx+ay*bz-az*by,ay1=ay*bw+aw*by+az*bx-ax*bz,az1=az*bw+aw*bz+ax*by-ay*bx,aw1=aw*bw- +ax*bx-ay*by-az*bz;rotateZ$1(out,a,rad);bx=out[0];by=out[1];bz=out[2];bw=out[3];out[4]=ax1*bw+aw1*bx+ay1*bz-az1*by;out[5]=ay1*bw+aw1*by+az1*bx-ax1*bz;out[6]=az1*bw+aw1*bz+ax1*by-ay1*bx;out[7]=aw1*bw-ax1*bx-ay1*by-az1*bz;return out}function rotateByQuatAppend(out,a,q){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],ax=a[0],ay=a[1],az=a[2],aw=a[3];out[0]=ax*qw+aw*qx+ay*qz-az*qy;out[1]=ay*qw+aw*qy+az*qx-ax*qz;out[2]=az*qw+aw*qz+ax*qy-ay*qx;out[3]=aw*qw-ax*qx-ay*qy-az*qz;ax=a[4];ay=a[5];az=a[6];aw=a[7];out[4]=ax* +qw+aw*qx+ay*qz-az*qy;out[5]=ay*qw+aw*qy+az*qx-ax*qz;out[6]=az*qw+aw*qz+ax*qy-ay*qx;out[7]=aw*qw-ax*qx-ay*qy-az*qz;return out}function rotateByQuatPrepend(out,q,a){var qx=q[0],qy=q[1],qz=q[2],qw=q[3],bx=a[0],by=a[1],bz=a[2],bw=a[3];out[0]=qx*bw+qw*bx+qy*bz-qz*by;out[1]=qy*bw+qw*by+qz*bx-qx*bz;out[2]=qz*bw+qw*bz+qx*by-qy*bx;out[3]=qw*bw-qx*bx-qy*by-qz*bz;bx=a[4];by=a[5];bz=a[6];bw=a[7];out[4]=qx*bw+qw*bx+qy*bz-qz*by;out[5]=qy*bw+qw*by+qz*bx-qx*bz;out[6]=qz*bw+qw*bz+qx*by-qy*bx;out[7]=qw*bw-qx*bx-qy* +by-qz*bz;return out}function rotateAroundAxis(out,a,axis,rad){if(Math.abs(rad)0){magnitude=Math.sqrt(magnitude);var a0=a[0]/magnitude;var a1=a[1]/magnitude;var a2=a[2]/magnitude;var a3= +a[3]/magnitude;var b0=a[4];var b1=a[5];var b2=a[6];var b3=a[7];var a_dot_b=a0*b0+a1*b1+a2*b2+a3*b3;out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=(b0-a0*a_dot_b)/magnitude;out[5]=(b1-a1*a_dot_b)/magnitude;out[6]=(b2-a2*a_dot_b)/magnitude;out[7]=(b3-a3*a_dot_b)/magnitude}return out}function str$1(a){return"quat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+")"}function exactEquals$1(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]=== +b[5]&&a[6]===b[6]&&a[7]===b[7]}function equals$1(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=EPSILON*Math.max(1,Math.abs(a4), +Math.abs(b4))&&Math.abs(a5-b5)<=EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))}var quat2=Object.freeze({__proto__:null,create:create$1,clone:clone$1,fromValues:fromValues$1,fromRotationTranslationValues:fromRotationTranslationValues,fromRotationTranslation:fromRotationTranslation,fromTranslation:fromTranslation,fromRotation:fromRotation,fromMat4:fromMat4,copy:copy$1,identity:identity, +set:set$1,getReal:getReal,getDual:getDual,setReal:setReal,setDual:setDual,getTranslation:getTranslation,translate:translate,rotateX:rotateX,rotateY:rotateY,rotateZ:rotateZ,rotateByQuatAppend:rotateByQuatAppend,rotateByQuatPrepend:rotateByQuatPrepend,rotateAroundAxis:rotateAroundAxis,add:add$1,multiply:multiply$1,mul:mul$1,scale:scale$1,dot:dot$1,lerp:lerp$1,invert:invert,conjugate:conjugate,length:length$1,len:len$1,squaredLength:squaredLength$1,sqrLen:sqrLen$1,normalize:normalize$1,str:str$1,exactEquals:exactEquals$1, +equals:equals$1});function create(){var out=new ARRAY_TYPE(2);if(ARRAY_TYPE!=Float32Array){out[0]=0;out[1]=0}return out}function clone(a){var out=new ARRAY_TYPE(2);out[0]=a[0];out[1]=a[1];return out}function fromValues(x,y){var out=new ARRAY_TYPE(2);out[0]=x;out[1]=y;return out}function copy(out,a){out[0]=a[0];out[1]=a[1];return out}function set(out,x,y){out[0]=x;out[1]=y;return out}function add(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];return out}function subtract(out,a,b){out[0]=a[0]-b[0];out[1]= +a[1]-b[1];return out}function multiply(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];return out}function divide(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];return out}function ceil(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);return out}function floor(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);return out}function min(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);return out}function max(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);return out}function round(out, +a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);return out}function scale(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;return out}function scaleAndAdd(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;return out}function distance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.hypot(x,y)}function squaredDistance(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y}function length(a){var x=a[0],y=a[1];return Math.hypot(x,y)}function squaredLength(a){var x=a[0],y=a[1];return x*x+y*y}function negate(out, +a){out[0]=-a[0];out[1]=-a[1];return out}function inverse(out,a){out[0]=1/a[0];out[1]=1/a[1];return out}function normalize(out,a){var x=a[0],y=a[1];var len=x*x+y*y;if(len>0)len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;return out}function dot(a,b){return a[0]*b[0]+a[1]*b[1]}function cross(out,a,b){var z=a[0]*b[1]-a[1]*b[0];out[0]=out[1]=0;out[2]=z;return out}function lerp(out,a,b,t){var ax=a[0],ay=a[1];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);return out}function random(out,scale){scale=scale|| +1;var r=RANDOM()*2*Math.PI;out[0]=Math.cos(r)*scale;out[1]=Math.sin(r)*scale;return out}function transformMat2(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y;out[1]=m[1]*x+m[3]*y;return out}function transformMat2d(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y+m[4];out[1]=m[1]*x+m[3]*y+m[5];return out}function transformMat3(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[3]*y+m[6];out[1]=m[1]*x+m[4]*y+m[7];return out}function transformMat4(out,a,m){var x=a[0];var y=a[1];out[0]=m[0]*x+m[4]*y+m[12];out[1]= +m[1]*x+m[5]*y+m[13];return out}function rotate(out,a,b,rad){var p0=a[0]-b[0],p1=a[1]-b[1],sinC=Math.sin(rad),cosC=Math.cos(rad);out[0]=p0*cosC-p1*sinC+b[0];out[1]=p0*sinC+p1*cosC+b[1];return out}function angle(a,b){var x1=a[0],y1=a[1],x2=b[0],y2=b[1],mag=Math.sqrt((x1*x1+y1*y1)*(x2*x2+y2*y2)),cosine=mag&&(x1*x2+y1*y2)/mag;return Math.acos(Math.min(Math.max(cosine,-1),1))}function zero(out){out[0]=0;out[1]=0;return out}function str(a){return"vec2("+a[0]+", "+a[1]+")"}function exactEquals(a,b){return a[0]=== +b[0]&&a[1]===b[1]}function equals(a,b){var a0=a[0],a1=a[1];var b0=b[0],b1=b[1];return Math.abs(a0-b0)<=EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))}var len=length;var sub=subtract;var mul=multiply;var div=divide;var dist=distance;var sqrDist=squaredDistance;var sqrLen=squaredLength;var forEach=function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride)stride=2;if(!offset)offset=0;if(count)l=Math.min(count* +stride+offset,a.length);else l=a.length;for(i=offset;i=b&&c=a?1024*(d-55296)+(a-56320)+65536:d}return 56320<=b&&57343>=b&&1<=c?(d=a.charCodeAt(c-1),a=b,55296<=d&&56319>=d?1024*(d-55296)+(a-56320)+65536:a):b}function l(a,c,b){var d=[a].concat(c).concat([b]),e=d[d.length-2],g=d.lastIndexOf(14);if(1=a||1757==a||1807==a||2274==a||3406==a||69821==a||70082<=a&&70083>=a||72250==a||72326<=a&&72329>=a||73030==a?12:13==a?0:10==a?1:0<=a&&9>=a||11<=a&&12>=a||14<=a&&31>=a||127<=a&&159>=a||173==a||1564==a||6158==a||8203==a||8206<=a&&8207>=a||8232==a||8233==a||8234<=a&&8238>=a||8288<=a&&8292>=a||8293==a||8294<=a&&8303>=a||55296<=a&&57343>=a||65279==a||65520<= +a&&65528>=a||65529<=a&&65531>=a||113824<=a&&113827>=a||119155<=a&&119162>=a||917504==a||917505==a||917506<=a&&917535>=a||917632<=a&&917759>=a||918E3<=a&&921599>=a?2:768<=a&&879>=a||1155<=a&&1159>=a||1160<=a&&1161>=a||1425<=a&&1469>=a||1471==a||1473<=a&&1474>=a||1476<=a&&1477>=a||1479==a||1552<=a&&1562>=a||1611<=a&&1631>=a||1648==a||1750<=a&&1756>=a||1759<=a&&1764>=a||1767<=a&&1768>=a||1770<=a&&1773>=a||1809==a||1840<=a&&1866>=a||1958<=a&&1968>=a||2027<=a&&2035>=a||2070<=a&&2073>=a||2075<=a&&2083>= +a||2085<=a&&2087>=a||2089<=a&&2093>=a||2137<=a&&2139>=a||2260<=a&&2273>=a||2275<=a&&2306>=a||2362==a||2364==a||2369<=a&&2376>=a||2381==a||2385<=a&&2391>=a||2402<=a&&2403>=a||2433==a||2492==a||2494==a||2497<=a&&2500>=a||2509==a||2519==a||2530<=a&&2531>=a||2561<=a&&2562>=a||2620==a||2625<=a&&2626>=a||2631<=a&&2632>=a||2635<=a&&2637>=a||2641==a||2672<=a&&2673>=a||2677==a||2689<=a&&2690>=a||2748==a||2753<=a&&2757>=a||2759<=a&&2760>=a||2765==a||2786<=a&&2787>=a||2810<=a&&2815>=a||2817==a||2876==a||2878== +a||2879==a||2881<=a&&2884>=a||2893==a||2902==a||2903==a||2914<=a&&2915>=a||2946==a||3006==a||3008==a||3021==a||3031==a||3072==a||3134<=a&&3136>=a||3142<=a&&3144>=a||3146<=a&&3149>=a||3157<=a&&3158>=a||3170<=a&&3171>=a||3201==a||3260==a||3263==a||3266==a||3270==a||3276<=a&&3277>=a||3285<=a&&3286>=a||3298<=a&&3299>=a||3328<=a&&3329>=a||3387<=a&&3388>=a||3390==a||3393<=a&&3396>=a||3405==a||3415==a||3426<=a&&3427>=a||3530==a||3535==a||3538<=a&&3540>=a||3542==a||3551==a||3633==a||3636<=a&&3642>=a||3655<= +a&&3662>=a||3761==a||3764<=a&&3769>=a||3771<=a&&3772>=a||3784<=a&&3789>=a||3864<=a&&3865>=a||3893==a||3895==a||3897==a||3953<=a&&3966>=a||3968<=a&&3972>=a||3974<=a&&3975>=a||3981<=a&&3991>=a||3993<=a&&4028>=a||4038==a||4141<=a&&4144>=a||4146<=a&&4151>=a||4153<=a&&4154>=a||4157<=a&&4158>=a||4184<=a&&4185>=a||4190<=a&&4192>=a||4209<=a&&4212>=a||4226==a||4229<=a&&4230>=a||4237==a||4253==a||4957<=a&&4959>=a||5906<=a&&5908>=a||5938<=a&&5940>=a||5970<=a&&5971>=a||6002<=a&&6003>=a||6068<=a&&6069>=a||6071<= +a&&6077>=a||6086==a||6089<=a&&6099>=a||6109==a||6155<=a&&6157>=a||6277<=a&&6278>=a||6313==a||6432<=a&&6434>=a||6439<=a&&6440>=a||6450==a||6457<=a&&6459>=a||6679<=a&&6680>=a||6683==a||6742==a||6744<=a&&6750>=a||6752==a||6754==a||6757<=a&&6764>=a||6771<=a&&6780>=a||6783==a||6832<=a&&6845>=a||6846==a||6912<=a&&6915>=a||6964==a||6966<=a&&6970>=a||6972==a||6978==a||7019<=a&&7027>=a||7040<=a&&7041>=a||7074<=a&&7077>=a||7080<=a&&7081>=a||7083<=a&&7085>=a||7142==a||7144<=a&&7145>=a||7149==a||7151<=a&&7153>= +a||7212<=a&&7219>=a||7222<=a&&7223>=a||7376<=a&&7378>=a||7380<=a&&7392>=a||7394<=a&&7400>=a||7405==a||7412==a||7416<=a&&7417>=a||7616<=a&&7673>=a||7675<=a&&7679>=a||8204==a||8400<=a&&8412>=a||8413<=a&&8416>=a||8417==a||8418<=a&&8420>=a||8421<=a&&8432>=a||11503<=a&&11505>=a||11647==a||11744<=a&&11775>=a||12330<=a&&12333>=a||12334<=a&&12335>=a||12441<=a&&12442>=a||42607==a||42608<=a&&42610>=a||42612<=a&&42621>=a||42654<=a&&42655>=a||42736<=a&&42737>=a||43010==a||43014==a||43019==a||43045<=a&&43046>= +a||43204<=a&&43205>=a||43232<=a&&43249>=a||43302<=a&&43309>=a||43335<=a&&43345>=a||43392<=a&&43394>=a||43443==a||43446<=a&&43449>=a||43452==a||43493==a||43561<=a&&43566>=a||43569<=a&&43570>=a||43573<=a&&43574>=a||43587==a||43596==a||43644==a||43696==a||43698<=a&&43700>=a||43703<=a&&43704>=a||43710<=a&&43711>=a||43713==a||43756<=a&&43757>=a||43766==a||44005==a||44008==a||44013==a||64286==a||65024<=a&&65039>=a||65056<=a&&65071>=a||65438<=a&&65439>=a||66045==a||66272==a||66422<=a&&66426>=a||68097<=a&& +68099>=a||68101<=a&&68102>=a||68108<=a&&68111>=a||68152<=a&&68154>=a||68159==a||68325<=a&&68326>=a||69633==a||69688<=a&&69702>=a||69759<=a&&69761>=a||69811<=a&&69814>=a||69817<=a&&69818>=a||69888<=a&&69890>=a||69927<=a&&69931>=a||69933<=a&&69940>=a||70003==a||70016<=a&&70017>=a||70070<=a&&70078>=a||70090<=a&&70092>=a||70191<=a&&70193>=a||70196==a||70198<=a&&70199>=a||70206==a||70367==a||70371<=a&&70378>=a||70400<=a&&70401>=a||70460==a||70462==a||70464==a||70487==a||70502<=a&&70508>=a||70512<=a&&70516>= +a||70712<=a&&70719>=a||70722<=a&&70724>=a||70726==a||70832==a||70835<=a&&70840>=a||70842==a||70845==a||70847<=a&&70848>=a||70850<=a&&70851>=a||71087==a||71090<=a&&71093>=a||71100<=a&&71101>=a||71103<=a&&71104>=a||71132<=a&&71133>=a||71219<=a&&71226>=a||71229==a||71231<=a&&71232>=a||71339==a||71341==a||71344<=a&&71349>=a||71351==a||71453<=a&&71455>=a||71458<=a&&71461>=a||71463<=a&&71467>=a||72193<=a&&72198>=a||72201<=a&&72202>=a||72243<=a&&72248>=a||72251<=a&&72254>=a||72263==a||72273<=a&&72278>=a|| +72281<=a&&72283>=a||72330<=a&&72342>=a||72344<=a&&72345>=a||72752<=a&&72758>=a||72760<=a&&72765>=a||72767==a||72850<=a&&72871>=a||72874<=a&&72880>=a||72882<=a&&72883>=a||72885<=a&&72886>=a||73009<=a&&73014>=a||73018==a||73020<=a&&73021>=a||73023<=a&&73029>=a||73031==a||92912<=a&&92916>=a||92976<=a&&92982>=a||94095<=a&&94098>=a||113821<=a&&113822>=a||119141==a||119143<=a&&119145>=a||119150<=a&&119154>=a||119163<=a&&119170>=a||119173<=a&&119179>=a||119210<=a&&119213>=a||119362<=a&&119364>=a||121344<= +a&&121398>=a||121403<=a&&121452>=a||121461==a||121476==a||121499<=a&&121503>=a||121505<=a&&121519>=a||122880<=a&&122886>=a||122888<=a&&122904>=a||122907<=a&&122913>=a||122915<=a&&122916>=a||122918<=a&&122922>=a||125136<=a&&125142>=a||125252<=a&&125258>=a||917536<=a&&917631>=a||917760<=a&&917999>=a?3:127462<=a&&127487>=a?4:2307==a||2363==a||2366<=a&&2368>=a||2377<=a&&2380>=a||2382<=a&&2383>=a||2434<=a&&2435>=a||2495<=a&&2496>=a||2503<=a&&2504>=a||2507<=a&&2508>=a||2563==a||2622<=a&&2624>=a||2691== +a||2750<=a&&2752>=a||2761==a||2763<=a&&2764>=a||2818<=a&&2819>=a||2880==a||2887<=a&&2888>=a||2891<=a&&2892>=a||3007==a||3009<=a&&3010>=a||3014<=a&&3016>=a||3018<=a&&3020>=a||3073<=a&&3075>=a||3137<=a&&3140>=a||3202<=a&&3203>=a||3262==a||3264<=a&&3265>=a||3267<=a&&3268>=a||3271<=a&&3272>=a||3274<=a&&3275>=a||3330<=a&&3331>=a||3391<=a&&3392>=a||3398<=a&&3400>=a||3402<=a&&3404>=a||3458<=a&&3459>=a||3536<=a&&3537>=a||3544<=a&&3550>=a||3570<=a&&3571>=a||3635==a||3763==a||3902<=a&&3903>=a||3967==a||4145== +a||4155<=a&&4156>=a||4182<=a&&4183>=a||4228==a||6070==a||6078<=a&&6085>=a||6087<=a&&6088>=a||6435<=a&&6438>=a||6441<=a&&6443>=a||6448<=a&&6449>=a||6451<=a&&6456>=a||6681<=a&&6682>=a||6741==a||6743==a||6765<=a&&6770>=a||6916==a||6965==a||6971==a||6973<=a&&6977>=a||6979<=a&&6980>=a||7042==a||7073==a||7078<=a&&7079>=a||7082==a||7143==a||7146<=a&&7148>=a||7150==a||7154<=a&&7155>=a||7204<=a&&7211>=a||7220<=a&&7221>=a||7393==a||7410<=a&&7411>=a||7415==a||43043<=a&&43044>=a||43047==a||43136<=a&&43137>=a|| +43188<=a&&43203>=a||43346<=a&&43347>=a||43395==a||43444<=a&&43445>=a||43450<=a&&43451>=a||43453<=a&&43456>=a||43567<=a&&43568>=a||43571<=a&&43572>=a||43597==a||43755==a||43758<=a&&43759>=a||43765==a||44003<=a&&44004>=a||44006<=a&&44007>=a||44009<=a&&44010>=a||44012==a||69632==a||69634==a||69762==a||69808<=a&&69810>=a||69815<=a&&69816>=a||69932==a||70018==a||70067<=a&&70069>=a||70079<=a&&70080>=a||70188<=a&&70190>=a||70194<=a&&70195>=a||70197==a||70368<=a&&70370>=a||70402<=a&&70403>=a||70463==a||70465<= +a&&70468>=a||70471<=a&&70472>=a||70475<=a&&70477>=a||70498<=a&&70499>=a||70709<=a&&70711>=a||70720<=a&&70721>=a||70725==a||70833<=a&&70834>=a||70841==a||70843<=a&&70844>=a||70846==a||70849==a||71088<=a&&71089>=a||71096<=a&&71099>=a||71102==a||71216<=a&&71218>=a||71227<=a&&71228>=a||71230==a||71340==a||71342<=a&&71343>=a||71350==a||71456<=a&&71457>=a||71462==a||72199<=a&&72200>=a||72249==a||72279<=a&&72280>=a||72343==a||72751==a||72766==a||72873==a||72881==a||72884==a||94033<=a&&94078>=a||119142== +a||119149==a?5:4352<=a&&4447>=a||43360<=a&&43388>=a?6:4448<=a&&4519>=a||55216<=a&&55238>=a?7:4520<=a&&4607>=a||55243<=a&&55291>=a?8:44032==a||44060==a||44088==a||44116==a||44144==a||44172==a||44200==a||44228==a||44256==a||44284==a||44312==a||44340==a||44368==a||44396==a||44424==a||44452==a||44480==a||44508==a||44536==a||44564==a||44592==a||44620==a||44648==a||44676==a||44704==a||44732==a||44760==a||44788==a||44816==a||44844==a||44872==a||44900==a||44928==a||44956==a||44984==a||45012==a||45040==a|| +45068==a||45096==a||45124==a||45152==a||45180==a||45208==a||45236==a||45264==a||45292==a||45320==a||45348==a||45376==a||45404==a||45432==a||45460==a||45488==a||45516==a||45544==a||45572==a||45600==a||45628==a||45656==a||45684==a||45712==a||45740==a||45768==a||45796==a||45824==a||45852==a||45880==a||45908==a||45936==a||45964==a||45992==a||46020==a||46048==a||46076==a||46104==a||46132==a||46160==a||46188==a||46216==a||46244==a||46272==a||46300==a||46328==a||46356==a||46384==a||46412==a||46440==a||46468== +a||46496==a||46524==a||46552==a||46580==a||46608==a||46636==a||46664==a||46692==a||46720==a||46748==a||46776==a||46804==a||46832==a||46860==a||46888==a||46916==a||46944==a||46972==a||47E3==a||47028==a||47056==a||47084==a||47112==a||47140==a||47168==a||47196==a||47224==a||47252==a||47280==a||47308==a||47336==a||47364==a||47392==a||47420==a||47448==a||47476==a||47504==a||47532==a||47560==a||47588==a||47616==a||47644==a||47672==a||47700==a||47728==a||47756==a||47784==a||47812==a||47840==a||47868==a|| +47896==a||47924==a||47952==a||47980==a||48008==a||48036==a||48064==a||48092==a||48120==a||48148==a||48176==a||48204==a||48232==a||48260==a||48288==a||48316==a||48344==a||48372==a||48400==a||48428==a||48456==a||48484==a||48512==a||48540==a||48568==a||48596==a||48624==a||48652==a||48680==a||48708==a||48736==a||48764==a||48792==a||48820==a||48848==a||48876==a||48904==a||48932==a||48960==a||48988==a||49016==a||49044==a||49072==a||49100==a||49128==a||49156==a||49184==a||49212==a||49240==a||49268==a||49296== +a||49324==a||49352==a||49380==a||49408==a||49436==a||49464==a||49492==a||49520==a||49548==a||49576==a||49604==a||49632==a||49660==a||49688==a||49716==a||49744==a||49772==a||49800==a||49828==a||49856==a||49884==a||49912==a||49940==a||49968==a||49996==a||50024==a||50052==a||50080==a||50108==a||50136==a||50164==a||50192==a||50220==a||50248==a||50276==a||50304==a||50332==a||50360==a||50388==a||50416==a||50444==a||50472==a||50500==a||50528==a||50556==a||50584==a||50612==a||50640==a||50668==a||50696==a|| +50724==a||50752==a||50780==a||50808==a||50836==a||50864==a||50892==a||50920==a||50948==a||50976==a||51004==a||51032==a||51060==a||51088==a||51116==a||51144==a||51172==a||51200==a||51228==a||51256==a||51284==a||51312==a||51340==a||51368==a||51396==a||51424==a||51452==a||51480==a||51508==a||51536==a||51564==a||51592==a||51620==a||51648==a||51676==a||51704==a||51732==a||51760==a||51788==a||51816==a||51844==a||51872==a||51900==a||51928==a||51956==a||51984==a||52012==a||52040==a||52068==a||52096==a||52124== +a||52152==a||52180==a||52208==a||52236==a||52264==a||52292==a||52320==a||52348==a||52376==a||52404==a||52432==a||52460==a||52488==a||52516==a||52544==a||52572==a||52600==a||52628==a||52656==a||52684==a||52712==a||52740==a||52768==a||52796==a||52824==a||52852==a||52880==a||52908==a||52936==a||52964==a||52992==a||53020==a||53048==a||53076==a||53104==a||53132==a||53160==a||53188==a||53216==a||53244==a||53272==a||53300==a||53328==a||53356==a||53384==a||53412==a||53440==a||53468==a||53496==a||53524==a|| +53552==a||53580==a||53608==a||53636==a||53664==a||53692==a||53720==a||53748==a||53776==a||53804==a||53832==a||53860==a||53888==a||53916==a||53944==a||53972==a||54E3==a||54028==a||54056==a||54084==a||54112==a||54140==a||54168==a||54196==a||54224==a||54252==a||54280==a||54308==a||54336==a||54364==a||54392==a||54420==a||54448==a||54476==a||54504==a||54532==a||54560==a||54588==a||54616==a||54644==a||54672==a||54700==a||54728==a||54756==a||54784==a||54812==a||54840==a||54868==a||54896==a||54924==a||54952== +a||54980==a||55008==a||55036==a||55064==a||55092==a||55120==a||55148==a||55176==a?9:44033<=a&&44059>=a||44061<=a&&44087>=a||44089<=a&&44115>=a||44117<=a&&44143>=a||44145<=a&&44171>=a||44173<=a&&44199>=a||44201<=a&&44227>=a||44229<=a&&44255>=a||44257<=a&&44283>=a||44285<=a&&44311>=a||44313<=a&&44339>=a||44341<=a&&44367>=a||44369<=a&&44395>=a||44397<=a&&44423>=a||44425<=a&&44451>=a||44453<=a&&44479>=a||44481<=a&&44507>=a||44509<=a&&44535>=a||44537<=a&&44563>=a||44565<=a&&44591>=a||44593<=a&&44619>= +a||44621<=a&&44647>=a||44649<=a&&44675>=a||44677<=a&&44703>=a||44705<=a&&44731>=a||44733<=a&&44759>=a||44761<=a&&44787>=a||44789<=a&&44815>=a||44817<=a&&44843>=a||44845<=a&&44871>=a||44873<=a&&44899>=a||44901<=a&&44927>=a||44929<=a&&44955>=a||44957<=a&&44983>=a||44985<=a&&45011>=a||45013<=a&&45039>=a||45041<=a&&45067>=a||45069<=a&&45095>=a||45097<=a&&45123>=a||45125<=a&&45151>=a||45153<=a&&45179>=a||45181<=a&&45207>=a||45209<=a&&45235>=a||45237<=a&&45263>=a||45265<=a&&45291>=a||45293<=a&&45319>=a|| +45321<=a&&45347>=a||45349<=a&&45375>=a||45377<=a&&45403>=a||45405<=a&&45431>=a||45433<=a&&45459>=a||45461<=a&&45487>=a||45489<=a&&45515>=a||45517<=a&&45543>=a||45545<=a&&45571>=a||45573<=a&&45599>=a||45601<=a&&45627>=a||45629<=a&&45655>=a||45657<=a&&45683>=a||45685<=a&&45711>=a||45713<=a&&45739>=a||45741<=a&&45767>=a||45769<=a&&45795>=a||45797<=a&&45823>=a||45825<=a&&45851>=a||45853<=a&&45879>=a||45881<=a&&45907>=a||45909<=a&&45935>=a||45937<=a&&45963>=a||45965<=a&&45991>=a||45993<=a&&46019>=a||46021<= +a&&46047>=a||46049<=a&&46075>=a||46077<=a&&46103>=a||46105<=a&&46131>=a||46133<=a&&46159>=a||46161<=a&&46187>=a||46189<=a&&46215>=a||46217<=a&&46243>=a||46245<=a&&46271>=a||46273<=a&&46299>=a||46301<=a&&46327>=a||46329<=a&&46355>=a||46357<=a&&46383>=a||46385<=a&&46411>=a||46413<=a&&46439>=a||46441<=a&&46467>=a||46469<=a&&46495>=a||46497<=a&&46523>=a||46525<=a&&46551>=a||46553<=a&&46579>=a||46581<=a&&46607>=a||46609<=a&&46635>=a||46637<=a&&46663>=a||46665<=a&&46691>=a||46693<=a&&46719>=a||46721<=a&& +46747>=a||46749<=a&&46775>=a||46777<=a&&46803>=a||46805<=a&&46831>=a||46833<=a&&46859>=a||46861<=a&&46887>=a||46889<=a&&46915>=a||46917<=a&&46943>=a||46945<=a&&46971>=a||46973<=a&&46999>=a||47001<=a&&47027>=a||47029<=a&&47055>=a||47057<=a&&47083>=a||47085<=a&&47111>=a||47113<=a&&47139>=a||47141<=a&&47167>=a||47169<=a&&47195>=a||47197<=a&&47223>=a||47225<=a&&47251>=a||47253<=a&&47279>=a||47281<=a&&47307>=a||47309<=a&&47335>=a||47337<=a&&47363>=a||47365<=a&&47391>=a||47393<=a&&47419>=a||47421<=a&&47447>= +a||47449<=a&&47475>=a||47477<=a&&47503>=a||47505<=a&&47531>=a||47533<=a&&47559>=a||47561<=a&&47587>=a||47589<=a&&47615>=a||47617<=a&&47643>=a||47645<=a&&47671>=a||47673<=a&&47699>=a||47701<=a&&47727>=a||47729<=a&&47755>=a||47757<=a&&47783>=a||47785<=a&&47811>=a||47813<=a&&47839>=a||47841<=a&&47867>=a||47869<=a&&47895>=a||47897<=a&&47923>=a||47925<=a&&47951>=a||47953<=a&&47979>=a||47981<=a&&48007>=a||48009<=a&&48035>=a||48037<=a&&48063>=a||48065<=a&&48091>=a||48093<=a&&48119>=a||48121<=a&&48147>=a|| +48149<=a&&48175>=a||48177<=a&&48203>=a||48205<=a&&48231>=a||48233<=a&&48259>=a||48261<=a&&48287>=a||48289<=a&&48315>=a||48317<=a&&48343>=a||48345<=a&&48371>=a||48373<=a&&48399>=a||48401<=a&&48427>=a||48429<=a&&48455>=a||48457<=a&&48483>=a||48485<=a&&48511>=a||48513<=a&&48539>=a||48541<=a&&48567>=a||48569<=a&&48595>=a||48597<=a&&48623>=a||48625<=a&&48651>=a||48653<=a&&48679>=a||48681<=a&&48707>=a||48709<=a&&48735>=a||48737<=a&&48763>=a||48765<=a&&48791>=a||48793<=a&&48819>=a||48821<=a&&48847>=a||48849<= +a&&48875>=a||48877<=a&&48903>=a||48905<=a&&48931>=a||48933<=a&&48959>=a||48961<=a&&48987>=a||48989<=a&&49015>=a||49017<=a&&49043>=a||49045<=a&&49071>=a||49073<=a&&49099>=a||49101<=a&&49127>=a||49129<=a&&49155>=a||49157<=a&&49183>=a||49185<=a&&49211>=a||49213<=a&&49239>=a||49241<=a&&49267>=a||49269<=a&&49295>=a||49297<=a&&49323>=a||49325<=a&&49351>=a||49353<=a&&49379>=a||49381<=a&&49407>=a||49409<=a&&49435>=a||49437<=a&&49463>=a||49465<=a&&49491>=a||49493<=a&&49519>=a||49521<=a&&49547>=a||49549<=a&& +49575>=a||49577<=a&&49603>=a||49605<=a&&49631>=a||49633<=a&&49659>=a||49661<=a&&49687>=a||49689<=a&&49715>=a||49717<=a&&49743>=a||49745<=a&&49771>=a||49773<=a&&49799>=a||49801<=a&&49827>=a||49829<=a&&49855>=a||49857<=a&&49883>=a||49885<=a&&49911>=a||49913<=a&&49939>=a||49941<=a&&49967>=a||49969<=a&&49995>=a||49997<=a&&50023>=a||50025<=a&&50051>=a||50053<=a&&50079>=a||50081<=a&&50107>=a||50109<=a&&50135>=a||50137<=a&&50163>=a||50165<=a&&50191>=a||50193<=a&&50219>=a||50221<=a&&50247>=a||50249<=a&&50275>= +a||50277<=a&&50303>=a||50305<=a&&50331>=a||50333<=a&&50359>=a||50361<=a&&50387>=a||50389<=a&&50415>=a||50417<=a&&50443>=a||50445<=a&&50471>=a||50473<=a&&50499>=a||50501<=a&&50527>=a||50529<=a&&50555>=a||50557<=a&&50583>=a||50585<=a&&50611>=a||50613<=a&&50639>=a||50641<=a&&50667>=a||50669<=a&&50695>=a||50697<=a&&50723>=a||50725<=a&&50751>=a||50753<=a&&50779>=a||50781<=a&&50807>=a||50809<=a&&50835>=a||50837<=a&&50863>=a||50865<=a&&50891>=a||50893<=a&&50919>=a||50921<=a&&50947>=a||50949<=a&&50975>=a|| +50977<=a&&51003>=a||51005<=a&&51031>=a||51033<=a&&51059>=a||51061<=a&&51087>=a||51089<=a&&51115>=a||51117<=a&&51143>=a||51145<=a&&51171>=a||51173<=a&&51199>=a||51201<=a&&51227>=a||51229<=a&&51255>=a||51257<=a&&51283>=a||51285<=a&&51311>=a||51313<=a&&51339>=a||51341<=a&&51367>=a||51369<=a&&51395>=a||51397<=a&&51423>=a||51425<=a&&51451>=a||51453<=a&&51479>=a||51481<=a&&51507>=a||51509<=a&&51535>=a||51537<=a&&51563>=a||51565<=a&&51591>=a||51593<=a&&51619>=a||51621<=a&&51647>=a||51649<=a&&51675>=a||51677<= +a&&51703>=a||51705<=a&&51731>=a||51733<=a&&51759>=a||51761<=a&&51787>=a||51789<=a&&51815>=a||51817<=a&&51843>=a||51845<=a&&51871>=a||51873<=a&&51899>=a||51901<=a&&51927>=a||51929<=a&&51955>=a||51957<=a&&51983>=a||51985<=a&&52011>=a||52013<=a&&52039>=a||52041<=a&&52067>=a||52069<=a&&52095>=a||52097<=a&&52123>=a||52125<=a&&52151>=a||52153<=a&&52179>=a||52181<=a&&52207>=a||52209<=a&&52235>=a||52237<=a&&52263>=a||52265<=a&&52291>=a||52293<=a&&52319>=a||52321<=a&&52347>=a||52349<=a&&52375>=a||52377<=a&& +52403>=a||52405<=a&&52431>=a||52433<=a&&52459>=a||52461<=a&&52487>=a||52489<=a&&52515>=a||52517<=a&&52543>=a||52545<=a&&52571>=a||52573<=a&&52599>=a||52601<=a&&52627>=a||52629<=a&&52655>=a||52657<=a&&52683>=a||52685<=a&&52711>=a||52713<=a&&52739>=a||52741<=a&&52767>=a||52769<=a&&52795>=a||52797<=a&&52823>=a||52825<=a&&52851>=a||52853<=a&&52879>=a||52881<=a&&52907>=a||52909<=a&&52935>=a||52937<=a&&52963>=a||52965<=a&&52991>=a||52993<=a&&53019>=a||53021<=a&&53047>=a||53049<=a&&53075>=a||53077<=a&&53103>= +a||53105<=a&&53131>=a||53133<=a&&53159>=a||53161<=a&&53187>=a||53189<=a&&53215>=a||53217<=a&&53243>=a||53245<=a&&53271>=a||53273<=a&&53299>=a||53301<=a&&53327>=a||53329<=a&&53355>=a||53357<=a&&53383>=a||53385<=a&&53411>=a||53413<=a&&53439>=a||53441<=a&&53467>=a||53469<=a&&53495>=a||53497<=a&&53523>=a||53525<=a&&53551>=a||53553<=a&&53579>=a||53581<=a&&53607>=a||53609<=a&&53635>=a||53637<=a&&53663>=a||53665<=a&&53691>=a||53693<=a&&53719>=a||53721<=a&&53747>=a||53749<=a&&53775>=a||53777<=a&&53803>=a|| +53805<=a&&53831>=a||53833<=a&&53859>=a||53861<=a&&53887>=a||53889<=a&&53915>=a||53917<=a&&53943>=a||53945<=a&&53971>=a||53973<=a&&53999>=a||54001<=a&&54027>=a||54029<=a&&54055>=a||54057<=a&&54083>=a||54085<=a&&54111>=a||54113<=a&&54139>=a||54141<=a&&54167>=a||54169<=a&&54195>=a||54197<=a&&54223>=a||54225<=a&&54251>=a||54253<=a&&54279>=a||54281<=a&&54307>=a||54309<=a&&54335>=a||54337<=a&&54363>=a||54365<=a&&54391>=a||54393<=a&&54419>=a||54421<=a&&54447>=a||54449<=a&&54475>=a||54477<=a&&54503>=a||54505<= +a&&54531>=a||54533<=a&&54559>=a||54561<=a&&54587>=a||54589<=a&&54615>=a||54617<=a&&54643>=a||54645<=a&&54671>=a||54673<=a&&54699>=a||54701<=a&&54727>=a||54729<=a&&54755>=a||54757<=a&&54783>=a||54785<=a&&54811>=a||54813<=a&&54839>=a||54841<=a&&54867>=a||54869<=a&&54895>=a||54897<=a&&54923>=a||54925<=a&&54951>=a||54953<=a&&54979>=a||54981<=a&&55007>=a||55009<=a&&55035>=a||55037<=a&&55063>=a||55065<=a&&55091>=a||55093<=a&&55119>=a||55121<=a&&55147>=a||55149<=a&&55175>=a||55177<=a&&55203>=a?10:9757== +a||9977==a||9994<=a&&9997>=a||127877==a||127938<=a&&127940>=a||127943==a||127946<=a&&127948>=a||128066<=a&&128067>=a||128070<=a&&128080>=a||128110==a||128112<=a&&128120>=a||128124==a||128129<=a&&128131>=a||128133<=a&&128135>=a||128170==a||128372<=a&&128373>=a||128378==a||128400==a||128405<=a&&128406>=a||128581<=a&&128583>=a||128587<=a&&128591>=a||128675==a||128692<=a&&128694>=a||128704==a||128716==a||129304<=a&&129308>=a||129310<=a&&129311>=a||129318==a||129328<=a&&129337>=a||129341<=a&&129342>=a|| +129489<=a&&129501>=a?13:127995<=a&&127999>=a?14:8205==a?15:9792==a||9794==a||9877<=a&&9878>=a||9992==a||10084==a||127752==a||127806==a||127859==a||127891==a||127908==a||127912==a||127979==a||127981==a||128139==a||128187<=a&&128188>=a||128295==a||128300==a||128488==a||128640==a||128658==a?16:128102<=a&&128105>=a?17:11}this.nextBreak=function(a,c){void 0===c&&(c=0);if(0>c)return 0;if(c>=a.length-1)return a.length;var b=k(h(a,c)),d=[];for(c+=1;c=e.charCodeAt(g)&&56320<=e.charCodeAt(g+1)&&57343>=e.charCodeAt(g+1))){e=k(h(a,c));if(l(b,d,e))return c;d.push(e)}}return a.length};this.splitGraphemes=function(a){for(var c=[],b=0,d;(d=this.nextBreak(a,b))=0&&s<=1&&t>=0&&t<=1}function triangleArea(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function isLeft(a,b,c){return triangleArea(a,b,c)>0}function isLeftOn(a,b,c){return triangleArea(a,b,c)>=0} +function isRight(a,b,c){return triangleArea(a,b,c)<0}function isRightOn(a,b,c){return triangleArea(a,b,c)<=0}var tmpPoint1=[],tmpPoint2=[]; +function collinear(a,b,c,thresholdAngle){if(!thresholdAngle)return triangleArea(a,b,c)===0;else{var ab=tmpPoint1,bc=tmpPoint2;ab[0]=b[0]-a[0];ab[1]=b[1]-a[1];bc[0]=c[0]-b[0];bc[1]=c[1]-b[1];var dot=ab[0]*bc[0]+ab[1]*bc[1],magA=Math.sqrt(ab[0]*ab[0]+ab[1]*ab[1]),magB=Math.sqrt(bc[0]*bc[0]+bc[1]*bc[1]),angle=Math.acos(dot/(magA*magB));return anglev[br][0])br=i;if(!isLeft(polygonAt(polygon,br-1),polygonAt(polygon,br),polygonAt(polygon,br+1))){polygonReverse(polygon);return true}else return false}function polygonReverse(polygon){var tmp=[];var N=polygon.length;for(var i=0;i!==N;i++)tmp.push(polygon.pop());for(var i=0;i!==N;i++)polygon[i]=tmp[i]} +function polygonIsReflex(polygon,i){return isRight(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1))}var tmpLine1=[],tmpLine2=[]; +function polygonCanSee(polygon,a,b){var p,dist,l1=tmpLine1,l2=tmpLine2;if(isLeftOn(polygonAt(polygon,a+1),polygonAt(polygon,a),polygonAt(polygon,b))&&isRightOn(polygonAt(polygon,a-1),polygonAt(polygon,a),polygonAt(polygon,b)))return false;dist=sqdist(polygonAt(polygon,a),polygonAt(polygon,b));for(var i=0;i!==polygon.length;++i){if((i+1)%polygon.length===a||i===a)continue;if(isLeftOn(polygonAt(polygon,a),polygonAt(polygon,b),polygonAt(polygon,i+1))&&isRightOn(polygonAt(polygon,a),polygonAt(polygon, +b),polygonAt(polygon,i))){l1[0]=polygonAt(polygon,a);l1[1]=polygonAt(polygon,b);l2[0]=polygonAt(polygon,i);l2[1]=polygonAt(polygon,i+1);p=lineInt(l1,l2);if(sqdist(polygonAt(polygon,a),p)0)return polygonSlice(polygon,edges);else return[polygon]} +function polygonSlice(polygon,cutEdges){if(cutEdges.length===0)return[polygon];if(cutEdges instanceof Array&&cutEdges.length&&cutEdges[0]instanceof Array&&cutEdges[0].length===2&&cutEdges[0][0]instanceof Array){var polys=[polygon];for(var i=0;imaxlevel){console.warn("quickDecomp: max level ("+ +maxlevel+") reached.");return result}for(var i=0;iupperIndex)upperIndex+=polygon.length; +closestDist=Number.MAX_VALUE;if(upperIndex3&&i>=0;--i)if(collinear(polygonAt(polygon,i-1),polygonAt(polygon,i),polygonAt(polygon,i+1),precision)){polygon.splice(i%polygon.length,1);num++}return num} +function polygonRemoveDuplicatePoints(polygon,precision){for(var i=polygon.length-1;i>=1;--i){var pi=polygon[i];for(var j=i-1;j>=0;--j)if(points_eq(pi,polygon[j],precision)){polygon.splice(i,1);continue}}}function scalar_eq(a,b,precision){precision=precision||0;return Math.abs(a-b)<=precision}function points_eq(a,b,precision){return scalar_eq(a[0],b[0],precision)&&scalar_eq(a[1],b[1],precision)} +self.polyDecomp={decomp:polygonDecomp,quickDecomp:polygonQuickDecomp,isSimple:polygonIsSimple,removeCollinearPoints:polygonRemoveCollinearPoints,removeDuplicatePoints:polygonRemoveDuplicatePoints,makeCCW:polygonMakeCCW}; + +} + +// lib/c3.js +{ +'use strict';let isReady=false;let hasAppStarted=false;let buildMode="dev";const C3=self.C3=class C3{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){isReady=true}static IsReady(){return isReady}static SetAppStarted(){hasAppStarted=true}static HasAppStarted(){return hasAppStarted}static SetBuildMode(m){buildMode=m}static GetBuildMode(){return buildMode}static IsReleaseBuild(){return buildMode==="final"}};C3.isDebug=false;C3.isDebugDefend=false; +C3.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}; + +} + +// ../lib/queryParser.js +{ +'use strict';const C3=self.C3; +C3.QueryParser=class QueryParser{constructor(queryString){this._queryString=queryString;this._parameters=new Map;this._Parse()}_Parse(){let str=this._queryString;if(str.startsWith("?")||str.startsWith("#"))str=str.substr(1);const arr=str.split("&");for(const p of arr)this._ParseParameter(p)}_ParseParameter(p){if(!p)return;if(!p.includes("=")){this._parameters.set(p,null);return}const i=p.indexOf("=");const parameterName=decodeURIComponent(p.substring(0,i));const parameterValue=decodeURIComponent(p.substring(i+ +1));this._parameters.set(parameterName,parameterValue)}LogAll(){for(const e of this._parameters)console.log("[QueryParser] Parameter '"+e[0]+"' = "+(e[1]===null?"null":"'"+e[1]+"'"))}Has(name){return this._parameters.has(name)}Get(name){const ret=this._parameters.get(name);if(typeof ret==="undefined")return null;else return ret}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(str){this._queryString=str;this._parameters.clear();this._Parse()}}; +C3.QueryString=new C3.QueryParser(location.search);C3.LocationHashString=new C3.QueryParser(location.hash);if(C3.QueryString.Has("perf"))C3.isPerformanceProfiling=true;if(C3.QueryString.Get("mode")!=="dev")C3.SetBuildMode("final"); + +} + +// ../lib/detect/detect.js +{ +'use strict';const C3=self.C3;const UNKNOWN="(unknown)";C3.Platform={OS:UNKNOWN,OSVersion:UNKNOWN,Browser:UNKNOWN,BrowserVersion:UNKNOWN,BrowserVersionNumber:NaN,BrowserEngine:UNKNOWN,Context:"browser",IsDesktop:true,IsMobile:false,IsAppleOS:false,IsIpadOS:false,GetDetailedInfo:async()=>{}};const windowsNTVerMap=new Map([[5,"2000"],[5.1,"XP"],[5.2,"XP"],[6,"Vista"],[6.1,"7"],[6.2,"8"],[6.3,"8.1"],[10,"10"]]); +function GetWindowsNTVersionName(ntVer){const num=parseFloat(ntVer);const ret=windowsNTVerMap.get(num);if(ret)return ret;if(num>=13)return"11";return"NT "+ntVer}const uaStr=navigator.userAgent;const uaData=navigator["userAgentData"]; +if(uaData&&uaData["brands"].length>0){C3.Platform.OS=uaData["platform"];C3.Platform.IsMobile=uaData["mobile"];C3.Platform.IsDesktop=!C3.Platform.IsMobile;const RECOGNIZED_BROWSERS=new Map([["Google Chrome","Chrome"],["Microsoft Edge","Edge"],["Opera","Opera"],["Opera GX","Opera GX"],["Mozilla Firefox","Firefox"],["Apple Safari","Safari"],["NW.js","NW.js"]]);const RECOGNIZED_ENGINES=new Map([["Chromium","Chromium"],["Gecko","Gecko"],["WebKit","WebKit"]]);function ReadBrandList(brands){let browser= +"";let browser_version="";let engine="";let engine_version="";for(const o of brands){const recognizedBrowser=RECOGNIZED_BROWSERS.get(o["brand"]);if(!browser&&recognizedBrowser){browser=recognizedBrowser;browser_version=o["version"]}const recognizedEngine=RECOGNIZED_ENGINES.get(o["brand"]);if(!engine&&recognizedEngine){engine=recognizedEngine;engine_version=o["version"]}}if(!browser&&engine==="Chromium"){C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=engine_version}C3.Platform.Browser=browser|| +UNKNOWN;C3.Platform.BrowserVersion=browser_version||UNKNOWN;C3.Platform.BrowserEngine=engine||UNKNOWN}ReadBrandList(uaData["brands"]);let didGetDetailedInfo=false;C3.Platform.GetDetailedInfo=async()=>{if(didGetDetailedInfo)return;try{const details=await navigator["userAgentData"]["getHighEntropyValues"](["platformVersion","fullVersionList"]);ReadBrandList(details["fullVersionList"]);if(C3.Platform.OS==="Windows")C3.Platform.OSVersion=GetWindowsNTVersionName(details["platformVersion"]);else C3.Platform.OSVersion= +details["platformVersion"];didGetDetailedInfo=true}catch(err){console.warn("Failed to get detailed user agent information: ",err)}}}else{function RunTest(regex_or_arr,handler){const arr=Array.isArray(regex_or_arr)?regex_or_arr:[regex_or_arr];for(const regex of arr){const result=regex.exec(uaStr);if(result){handler(result);break}}}RunTest(/windows\s+nt\s+([\d\.]+)/i,result=>{C3.Platform.OS="Windows";const ntVer=result[1];C3.Platform.OSVersion=GetWindowsNTVersionName(ntVer)});RunTest(/mac\s+os\s+x\s+([\d\._]+)/i, +result=>{C3.Platform.OS="macOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")});RunTest(/CrOS/,()=>{C3.Platform.OS="Chrome OS"});RunTest(/linux|openbsd|freebsd|netbsd/i,()=>{C3.Platform.OS="Linux"});RunTest(/android/i,()=>{C3.Platform.OS="Android"});RunTest(/android\s+([\d\.]+)/i,result=>{C3.Platform.OS="Android";C3.Platform.OSVersion=result[1]});if(C3.Platform.OS===UNKNOWN){RunTest(/(iphone|ipod|ipad)/i,result=>{C3.Platform.OS="iOS"});RunTest([/iphone\s+os\s+([\d\._]+)/i,/ipad[^)]*os\s+([\d\._]+)/i], +result=>{C3.Platform.OS="iOS";C3.Platform.OSVersion=result[1].replace(/_/g,".")})}const hasChrome=/chrome\//i.test(uaStr);const hasChromium=/chromium\//i.test(uaStr);const hasEdge=/edg\//i.test(uaStr);const hasOpera=/OPR\//.test(uaStr);const hasNWjs=/nwjs/i.test(uaStr);const hasSafari=/safari\//i.test(uaStr);const hasWebKit=/webkit/i.test(uaStr);if(!hasEdge&&!hasOpera)RunTest(/chrome\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine= +"Chromium"});RunTest(/edg\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/OPR\/([\d\.]+)/,result=>{C3.Platform.Browser="Opera";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/chromium\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chromium";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Chromium"});RunTest(/nwjs\/[0-9.]+/i,result=>{C3.Platform.Browser="NW.js";C3.Platform.BrowserVersion= +result[1];C3.Platform.BrowserEngine="Chromium";C3.Platform.Context="nwjs"});RunTest(/firefox\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox";C3.Platform.BrowserVersion=result[1];C3.Platform.BrowserEngine="Gecko"});if(hasSafari&&!hasChrome&&!hasChromium&&!hasEdge&&!hasOpera&&!hasNWjs){C3.Platform.Browser="Safari";C3.Platform.BrowserEngine="WebKit";RunTest(/version\/([\d\.]+)/i,result=>{C3.Platform.BrowserVersion=result[1]});RunTest(/crios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Chrome for iOS"; +C3.Platform.BrowserVersion=result[1]});RunTest(/fxios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Firefox for iOS";C3.Platform.BrowserVersion=result[1]});RunTest(/edgios\/([\d\.]+)/i,result=>{C3.Platform.Browser="Edge for iOS";C3.Platform.BrowserVersion=result[1]})}if(C3.Platform.BrowserEngine===UNKNOWN&&hasWebKit)C3.Platform.BrowserEngine="WebKit";if(C3.Platform.OS==="Android"&&C3.Platform.Browser==="Safari")C3.Platform.Browser="Stock";const desktopOSs=new Set(["Windows","macOS","Linux","Chrome OS"]); +const isDesktop=desktopOSs.has(C3.Platform.OS)||C3.Platform.Context==="nwjs";C3.Platform.IsDesktop=isDesktop;C3.Platform.IsMobile=!isDesktop}if(C3.Platform.Browser==="Chrome"&&C3.Platform.Context==="browser"&&/wv\)/.test(uaStr))C3.Platform.Context="webview";if(C3.Platform.Context!=="nwjs"&&typeof window!=="undefined"&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator["standalone"]))C3.Platform.Context="webapp";C3.Platform.BrowserVersionNumber=parseFloat(C3.Platform.BrowserVersion); +const looksLikeIPadOS=C3.Platform.OS==="macOS"&&navigator["maxTouchPoints"]&&navigator["maxTouchPoints"]>2;if(looksLikeIPadOS){C3.Platform.OS="iOS";C3.Platform.OSVersion=C3.Platform.BrowserVersion;C3.Platform.IsDesktop=false;C3.Platform.IsMobile=true;C3.Platform.IsIpadOS=true}C3.Platform.IsAppleOS=C3.Platform.OS==="macOS"||C3.Platform.OS==="iOS"; + +} + +// ../lib/storage/kvStorage.js +{ +'use strict';{const VERSION=2;const STORE_NAME="keyvaluepairs";const DATABASE_PROMISE_MAP=new Map;const SUPPORTS_GETALL=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAll==="function";const SUPPORTS_GETALLKEYS=typeof IDBObjectStore!=="undefined"&&typeof IDBObjectStore.prototype.getAllKeys==="function";function asyncifyRequest(request){return new Promise((res,rej)=>{request.onsuccess=()=>res(request.result);request.onerror=()=>rej(request.error)})}function asyncifyTransaction(tx){return new Promise((res, +rej)=>{tx.oncomplete=()=>res();tx.onerror=()=>rej(tx.error);tx.onabort=()=>rej(tx.error)})}function openReadOnlyTransaction(name,method){return openTransaction(name,method)}function openWriteTransaction(name,method){return openTransaction(name,method,true)}async function openTransaction(name,method,write=false,allowRetry=true){const db=await lazyOpenDatabase(name);try{const tx=db.transaction([STORE_NAME],write?"readwrite":"readonly");return method(tx)}catch(err){if(allowRetry&&err["name"]==="InvalidStateError"){DATABASE_PROMISE_MAP.delete(name); +return openTransaction(name,method,write,false)}else throw err;}}function lazyOpenDatabase(name){RequireString(name);let dbPromise=DATABASE_PROMISE_MAP.get(name);if(!(dbPromise instanceof Promise)){dbPromise=openDatabase(name);DATABASE_PROMISE_MAP.set(name,dbPromise);dbPromise.catch(err=>DATABASE_PROMISE_MAP.delete(name))}return dbPromise}async function openDatabase(name){RequireString(name);const openRequest=indexedDB.open(name,VERSION);openRequest.addEventListener("upgradeneeded",e=>{try{const db= +e.target.result;db.createObjectStore(STORE_NAME)}catch(err){console.error(`Failed to create objectstore for database ${name}`,err)}});return asyncifyRequest(openRequest)}function RequireString(x){if(typeof x!=="string")throw new TypeError("expected string");}function getEntriesFromCursor(tx,type){const request=tx.objectStore(STORE_NAME).openCursor();return new Promise(resolve=>{const results=[];request.onsuccess=event=>{const cursor=event.target.result;if(cursor){switch(type){case "entries":results.push([cursor.key, +cursor.value]);break;case "keys":results.push(cursor.key);break;case "values":results.push(cursor.value);break}cursor.continue()}else resolve(results)}})}class KVStorageContainer{constructor(name){RequireString(name);this.name=name}async ready(){await lazyOpenDatabase(this.name)}set(key,value){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).put(value,key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx); +await Promise.all([txPromise,requestPromise])})}get(key){RequireString(key);return openReadOnlyTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).get(key);const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}delete(key){RequireString(key);return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).delete(key);const requestPromise=asyncifyRequest(request); +const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}clear(){return openWriteTransaction(this.name,async tx=>{const request=tx.objectStore(STORE_NAME).clear();const requestPromise=asyncifyRequest(request);const txPromise=asyncifyTransaction(tx);await Promise.all([txPromise,requestPromise])})}keys(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALLKEYS){const request=tx.objectStore(STORE_NAME).getAllKeys();requestPromise=asyncifyRequest(request)}else requestPromise= +getEntriesFromCursor(tx,"keys");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}values(){return openReadOnlyTransaction(this.name,async tx=>{let requestPromise;if(SUPPORTS_GETALL){const request=tx.objectStore(STORE_NAME).getAll();requestPromise=asyncifyRequest(request)}else requestPromise=getEntriesFromCursor(tx,"values");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}entries(){return openReadOnlyTransaction(this.name, +async tx=>{const requestPromise=getEntriesFromCursor(tx,"entries");const txPromise=asyncifyTransaction(tx);const [_,value]=await Promise.all([txPromise,requestPromise]);return value})}}self.KVStorageContainer=KVStorageContainer}; + +} + +// ../lib/storage/localForageAdaptor.js +{ +'use strict';{const KVStorageContainer=self.KVStorageContainer;const CRITICAL_ERRORS=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i];const memoryStorage=new WeakMap;let isInMemory=false;if(typeof indexedDB==="undefined"){isInMemory=true; +console.warn("Unable to use local storage because indexedDB is not defined")}function NOT_IMPLEMENTED(name){throw new Error(`"${name}" is not implemented`);}function DISALLOW_CALLBACK(fn){if(typeof fn==="function")throw new Error(`localforage callback API is not implemented; please use the promise API instead`);}function StructuredClone(value){if(typeof value==="object")return new Promise(resolve=>{const {port1,port2}=new MessageChannel;port2.onmessage=ev=>resolve(ev.data);port1.postMessage(value)}); +else return Promise.resolve(value)}class ForageAdaptor{constructor(inst){this._inst=inst;memoryStorage.set(this,new Map)}_MaybeSwitchToMemoryFallback(err){if(isInMemory)return;for(const regex of CRITICAL_ERRORS)if(err&®ex.test(err.message)){console.error("Unable to use local storage, reverting to in-memory store: ",err,err.message);isInMemory=true;break}}async _getItemFallback(name){const value=memoryStorage.get(this).get(name);const ret=await StructuredClone(value);return typeof ret==="undefined"? +null:ret}async _setItemFallback(name,value){value=await StructuredClone(value);memoryStorage.get(this).set(name,value)}_removeItemFallback(name){memoryStorage.get(this).delete(name)}_clearFallback(){memoryStorage.get(this).clear()}_keysFallback(){return Array.from(memoryStorage.get(this).keys())}IsUsingFallback(){return isInMemory}async getItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return await this._getItemFallback(key);let result;try{result=await this._inst.get(key)}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)return await this._getItemFallback(key);else{console.error(`Error reading '${key}' from storage, returning null: `,err);return null}}return typeof result==="undefined"?null:result}async setItem(key,value,successCallback){DISALLOW_CALLBACK(successCallback);if(typeof value==="undefined")value=null;if(isInMemory){await this._setItemFallback(key,value);return}try{await this._inst.set(key,value)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)await this._setItemFallback(key, +value);else throw err;}}async removeItem(key,successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._removeItemFallback(key);return}try{await this._inst.delete(key)}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)this._removeItemFallback(key);else console.error(`Error removing '${key}' from storage: `,err)}}async clear(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory){this._clearFallback();return}try{await this._inst.clear()}catch(err){this._MaybeSwitchToMemoryFallback(err); +if(isInMemory)this._clearFallback();else console.error(`Error clearing storage: `,err)}}async keys(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return this._keysFallback();let result=[];try{result=await this._inst.keys()}catch(err){this._MaybeSwitchToMemoryFallback(err);if(isInMemory)return this._keysFallback();else console.error(`Error getting storage keys: `,err)}return result}ready(successCallback){DISALLOW_CALLBACK(successCallback);if(isInMemory)return Promise.resolve(true); +else return this._inst.ready()}createInstance(options){if(typeof options!=="object")throw new TypeError("invalid options object");const name=options["name"];if(typeof name!=="string")throw new TypeError("invalid store name");const inst=new KVStorageContainer(name);return new ForageAdaptor(inst)}length(successCallback){NOT_IMPLEMENTED("localforage.length()")}key(index,successCallback){NOT_IMPLEMENTED("localforage.key()")}iterate(iteratorCallback,successCallback){NOT_IMPLEMENTED("localforage.iterate()")}setDriver(driverName){NOT_IMPLEMENTED("localforage.setDriver()")}config(options){NOT_IMPLEMENTED("localforage.config()")}defineDriver(customDriver){NOT_IMPLEMENTED("localforage.defineDriver()")}driver(){NOT_IMPLEMENTED("localforage.driver()")}supports(driverName){NOT_IMPLEMENTED("localforage.supports()")}dropInstance(){NOT_IMPLEMENTED("localforage.dropInstance()")}disableMemoryMode(){isInMemory= +false}}self["localforage"]=new ForageAdaptor(new KVStorageContainer("localforage"))}; + +} + +// ../lib/misc/supports.js +{ +'use strict';const C3=self.C3;C3.Supports={};C3.Supports.WebAnimations=(()=>{try{if(C3.Platform.Browser==="Safari")return false;if(typeof document==="undefined")return false;const e=document.createElement("div");if(typeof e.animate==="undefined")return false;const player=e.animate([{opacity:"0"},{opacity:"1"}],1E3);return typeof player.reverse!=="undefined"}catch(e){return false}})();C3.Supports.DialogElement=typeof HTMLDialogElement!=="undefined";C3.Supports.RequestIdleCallback=!!self.requestIdleCallback; +C3.Supports.ImageBitmap=!!self.createImageBitmap;C3.Supports.ImageBitmapOptions=false;C3.Supports.ImageBitmapOptionsResize=false; +if(C3.Supports.ImageBitmap){try{self.createImageBitmap(new ImageData(32,32),{"premultiplyAlpha":"none"}).then(()=>{C3.Supports.ImageBitmapOptions=true}).catch(()=>{C3.Supports.ImageBitmapOptions=false})}catch(err){C3.Supports.ImageBitmapOptions=false}try{self.createImageBitmap(new ImageData(32,32),{"resizeWidth":10,"resizeHeight":10}).then(imageBitmap=>{C3.Supports.ImageBitmapOptionsResize=imageBitmap.width===10&&imageBitmap.height===10}).catch(()=>{C3.Supports.ImageBitmapOptionsResize=false})}catch(err){C3.Supports.ImageBitmapOptionsResize= +false}}C3.Supports.ClipboardReadText=!!(navigator["clipboard"]&&navigator["clipboard"]["readText"]&&C3.Platform.Browser!=="Firefox");C3.Supports.PermissionsQuery=!!(navigator["permissions"]&&navigator["permissions"]["query"]);C3.Supports.ClipboardPermissionsQuery=false;if(C3.Supports.PermissionsQuery){const permission={"name":"clipboard-read"};navigator["permissions"]["query"](permission).then(()=>{C3.Supports.ClipboardPermissionsQuery=true}).catch(()=>{C3.Supports.ClipboardPermissionsQuery=false})} +C3.Supports.AsyncClipboardApi=!!(navigator["permissions"]&&navigator["clipboard"]&&self["ClipboardItem"]);C3.Supports.Proxies=typeof Proxy!=="undefined";C3.Supports.DownloadAttribute=(()=>{if(typeof document==="undefined")return false;const a=document.createElement("a");return typeof a.download!=="undefined"})();C3.Supports.Fetch=typeof fetch==="function";C3.Supports.PersistentStorage=!!(self.isSecureContext&&C3.Platform.Browser!=="Opera"&&(navigator["storage"]&&navigator["storage"]["persist"])); +C3.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&(navigator["storage"]&&navigator["storage"]["estimate"]));C3.Supports.Fullscreen=(()=>{if(typeof document==="undefined")return false;if(C3.Platform.OS==="iOS")return false;const elem=document.documentElement;return!!(elem.requestFullscreen||elem.msRequestFullscreen||elem.mozRequestFullScreen||elem.webkitRequestFullscreen)})();C3.Supports.ImageDecoder=typeof self["ImageDecoder"]!=="undefined";C3.Supports.WebCodecs=!!self["VideoEncoder"]; +C3.Supports.NativeFileSystemAPI=!!self["showOpenFilePicker"];C3.Supports.QueryLocalFonts=!!self["queryLocalFonts"];C3.Supports.UserActivation=!!navigator["userActivation"];C3.Supports.CanvasToBlobWebP=false; +(async()=>{let canvas;if(typeof document==="undefined")canvas=new OffscreenCanvas(32,32);else{canvas=document.createElement("canvas");canvas.width=32;canvas.height=32}const ctx=canvas.getContext("2d");ctx.fillStyle="blue";ctx.fillRect(0,0,32,32);let blob=null;try{if(canvas.toBlob)blob=await new Promise(resolve=>canvas.toBlob(resolve,"image/webp",1));else if(canvas["convertToBlob"])blob=await canvas["convertToBlob"]({"type":"image/webp","quality":1});C3.Supports.CanvasToBlobWebP=blob&&blob.type=== +"image/webp"}catch(err){C3.Supports.CanvasToBlobWebP=false}})(); + +} + +// ../lib/misc/polyfills.js +{ +'use strict';const C3=self.C3;if(!String.prototype.trimStart){const startWhitespace=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function trimStart(){return this.replace(startWhitespace,"")}} +if(!String.prototype.trimEnd){const endWhitespace=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function trimEnd(){return this.replace(endWhitespace,"")}}if(!String.prototype.replaceAll)String.prototype.replaceAll=function replaceAll(find,replace){return this.replace(new RegExp(C3.EscapeRegex(find),"g"),replace)};if(!Array.prototype.values)Array.prototype.values=function*(){for(const i of this)yield i}; +if(!Array.prototype.flat){function arrayFlat(arr,depth){return arr.reduce((acc,val)=>{if(depth>0&&Array.isArray(val)){Array.prototype.push.apply(acc,arrayFlat(val,depth-1));return acc}else{acc.push(val);return acc}},[])}Array.prototype.flat=function(depth=1){return arrayFlat(this,depth)}}if(!Array.prototype.at)Array.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]}; +if(!String.prototype.at)String.prototype.at=function at(n){n=Math.trunc(n)||0;if(n<0)n+=this.length;if(n<0||n>=this.length)return undefined;return this[n]};if(!RegExp.escape)RegExp.escape=function(s){return String(s).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}; +if(navigator["storage"]&&!navigator["storage"]["estimate"]&&navigator["webkitTemporaryStorage"]&&navigator["webkitTemporaryStorage"]["queryUsageAndQuota"])navigator["storage"]["estimate"]=function(){return new Promise((resolve,reject)=>{return navigator["webkitTemporaryStorage"]["queryUsageAndQuota"]((usage,quota)=>resolve({"usage":usage,"quota":quota}),reject)})};if(typeof self.isSecureContext==="undefined")self.isSecureContext=location.protocol==="https:"; +if(typeof self["globalThis"]==="undefined")self["globalThis"]=self; + +} + +// lib/misc/assert.js +{ +'use strict';const C3=self.C3;function assertFail(msg_){let stack=C3.GetCallStack();let msg="Assertion failure: "+msg_+"\n\nStack trace:\n"+stack;console.error(msg)}self.assert=function assert(cnd_,msg_){if(!cnd_)assertFail(msg_)}; + +} + +// ../lib/misc/typeChecks.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;C3.IsNumber=function IsNumber(x){return typeof x==="number"};C3.IsFiniteNumber=function IsFiniteNumber(x){return C3.IsNumber(x)&&isFinite(x)};C3.RequireNumber=function RequireNumber(x){if(!C3.IsNumber(x))throw new TypeError("expected number");};C3.RequireOptionalNumber=function RequireOptionalNumber(x){if(C3.IsNullOrUndefined(x))return}; +C3.RequireNumberInRange=function RequireNumberInRange(x,low,high){if(!C3.IsNumber(x)||isNaN(x)||low>x||high{console.log(`%c${name}`,"font-weight: bold",...args);logRafIds.set(name,-1)}))};let measures; +C3.StartMeasure=function StartMeasure(name){performance.mark(name);if(!measures)measures=new Map;if(!measures.has(name))measures.set(name,{current:0,total:0,average:0,calls:1,toString:function(){return`${name} :: current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})}; +C3.EndMeasure=function EndMeasure(name){performance.measure(`measure-${name}`,name);const entry=performance.getEntriesByName(`measure-${name}`)[0];const m=measures.get(name);m.current=entry.duration;m.total+=m.current;m.average=m.total/m.calls;console.log(m.toString());m.calls++;performance.clearMarks(name);performance.clearMeasures(`measure-${name}`)};C3.GetCallStack=function GetCallStack(){return(new Error).stack};C3.Debugger=function Debugger(){debugger}; +C3.cast=function cast(o,T){if(o&&o instanceof T)return o;else return null}; +C3.getName=function getName(o){if(typeof o==="undefined")return"undefined";if(o===null)return"null";if(typeof o==="boolean")return"";if(C3.IsNumber(o))return"";if(C3.IsString(o))return"";if(C3.IsArray(o))return"";if(typeof o==="symbol")return"<"+o.toString()+">";if(C3.IsFunction(o)){if(o.name&&o.name!=="Function")return o.name;return""}if(typeof o==="object"){if(o.constructor&&o.constructor.name&&o.constructor.name!=="Object")return o.constructor.name; +return""}return""};C3.getType=function getType(o){if(o===null)return"null";if(Array.isArray(o))return"array";return typeof o};C3.range=function*range(a,b){if(!isFinite(Math.abs(a-b)))throw new Error("Invalid parameters");if(a>b)for(let i=a-1;i>=b;i--)yield i;else for(let i=a;i0||ctorProxyToObject.size>0){let uniqueNames=new Set([...ctorObjectToProxy.keys()].map(o=>C3.getName(o)));let leftoverNames=[...uniqueNames].join(",");console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${leftoverNames}`);ctorObjectToProxy.clear();ctorProxyToObject.clear()}} +C3.DefendedBase=class DefendedBase{constructor(){if(!C3.isDebugDefend||!C3.Supports.Proxies)return;let newTarget=new.target;let realObject=Object.create(newTarget.prototype);let proxy=new Proxy(realObject,C3.DefendHandler);ctorObjectToProxy.set(realObject,proxy);ctorProxyToObject.set(proxy,realObject);proxyToObject.set(proxy,realObject);if(checkRafId===-1)checkRafId=requestAnimationFrame(CheckDefendedObjectsUsedCorrectly);return proxy}}; +C3.debugDefend=function debugDefend(o){if(C3.isDebugDefend&&C3.Supports.Proxies&&o instanceof C3.DefendedBase){if(!ctorProxyToObject.has(o))return o;let realObject=ctorProxyToObject.get(o);ctorProxyToObject.delete(o);ctorObjectToProxy.delete(realObject);return o}else if(C3.isDebug)return Object.seal(o);else return o}; +C3.New=function New(Type,...args){let o;try{o=new Type(...args)}catch(e){ctorProxyToObject.clear();ctorObjectToProxy.clear();throw e;}if(C3.isDebugDefend)VerifyObjectPropertiesConsistent(Type,o);return C3.debugDefend(o)};C3.Release=function Release(o){let realObject=proxyToObject.get(o);if(realObject)releasedObjects.set(realObject,C3.GetCallStack())};C3.WasReleased=function(o){let realObject=proxyToObject.get(o);if(!realObject)return false;return!!releasedObjects.get(realObject)}; +let typeProperties=new Map;function getObjectPropertySet(o){let ret=new Set;for(let k in o)ret.add(k);return ret} +function VerifyObjectPropertiesConsistent(Type,o){let properties=getObjectPropertySet(o);let existingProperties=typeProperties.get(Type);if(existingProperties){let inconsistentProperties=[];for(let k of existingProperties.values())if(properties.has(k))properties.delete(k);else inconsistentProperties.push(k);C3.appendArray(inconsistentProperties,[...properties]);if(inconsistentProperties.length)console.warn(`[Defence] '${C3.getName(Type)}' constructor creates inconsistent properties: ${inconsistentProperties.join(", ")}`)}else typeProperties.set(Type,properties)} +C3.PerfMark=class PerfMark{constructor(name){this._name="";if(name)this.start(name)}start(name){if(!C3.isPerformanceProfiling)return;this._name=name;performance.mark(this._name+"-Start")}end(){if(!C3.isPerformanceProfiling)return;performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(name){if(!C3.isPerformanceProfiling)return;this.end();this._name=name;performance.mark(this._name+"-Start")}}; + +} + +// ../lib/misc/mathutil.js +{ +'use strict';const C3=self.C3;const TWO_PI=Math.PI*2;const D_TO_R=Math.PI/180;const R_TO_D=180/Math.PI;C3.wrap=function wrap(x,min,max){x=Math.floor(x);min=Math.floor(min);max=Math.floor(max);const diff=max-min;if(diff===0)return max;if(xb)return b;else return x};C3.clampAngle=function clampAngle(a){a%=TWO_PI;if(a<0)a+=TWO_PI;return a};C3.toRadians=function toRadians(x){return x*D_TO_R};C3.toDegrees=function toDegrees(x){return x*R_TO_D};C3.distanceTo=function distanceTo(x1,y1,x2,y2){return Math.hypot(x2-x1,y2-y1)}; +C3.distanceSquared=function distanceSquared(x1,y1,x2,y2){const dx=x2-x1;const dy=y2-y1;return dx*dx+dy*dy};C3.angleTo=function angleTo(x1,y1,x2,y2){return Math.atan2(y2-y1,x2-x1)};C3.angleDiff=function angleDiff(a1,a2){if(a1===a2)return 0;let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);let n=s1*s2+c1*c2;if(n>=1)return 0;if(n<=-1)return Math.PI;return Math.acos(n)}; +C3.angleRotate=function angleRotate(start,end,step){let ss=Math.sin(start);let cs=Math.cos(start);let se=Math.sin(end);let ce=Math.cos(end);if(Math.acos(ss*se+cs*ce)>step)if(cs*se-ss*ce>0)return C3.clampAngle(start+step);else return C3.clampAngle(start-step);else return C3.clampAngle(end)};C3.angleClockwise=function angleClockwise(a1,a2){let s1=Math.sin(a1);let c1=Math.cos(a1);let s2=Math.sin(a2);let c2=Math.cos(a2);return c1*s2-s1*c2<=0}; +C3.angleLerp=function angleLerp(a,b,x,r=0){let diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);else return C3.clampAngle(a-(diff+revs)*x)};C3.angleLerpClockwise=function angleLerpClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a+(diff+revs)*x);return C3.clampAngle(a+(TWO_PI-diff+revs)*x)}; +C3.angleLerpAntiClockwise=function angleLerpAntiClockwise(a,b,x,r=0){const diff=C3.angleDiff(a,b);const revs=TWO_PI*r;if(C3.angleClockwise(b,a))return C3.clampAngle(a-(-TWO_PI+diff-revs)*x);return C3.clampAngle(a-(diff+revs)*x)};C3.angleReflect=function angleReflect(a,b){const diff=C3.angleDiff(a,b);if(C3.angleClockwise(a,b))return C3.clampAngle(b-diff);else return C3.clampAngle(b+diff)};C3.lerp=function lerp(a,b,x){return a+x*(b-a)}; +C3.unlerp=function unlerp(a,b,x){if(a===b)return 0;return(x-a)/(b-a)};C3.relerp=function relerp(a,b,x,c,d){return C3.lerp(c,d,C3.unlerp(a,b,x))};C3.qarp=function qarp(a,b,c,x){return C3.lerp(C3.lerp(a,b,x),C3.lerp(b,c,x),x)};C3.cubic=function cubic(a,b,c,d,x){return C3.lerp(C3.qarp(a,b,c,x),C3.qarp(b,c,d,x),x)};C3.cosp=function cosp(a,b,x){return(a+b+(a-b)*Math.cos(x*Math.PI))/2};C3.isPOT=function isPOT(x){return x>0&&(x-1&x)===0}; +C3.nextHighestPowerOfTwo=function nextHighestPowerOfTwo(x){--x;for(let i=1;i<32;i<<=1)x=x|x>>i;return x+1};C3.roundToNearestFraction=function roundToNearestFraction(x,n){return Math.round(x*n)/n};C3.floorToNearestFraction=function floorToNearestFraction(x,n){return Math.floor(x*n)/n};C3.roundToDp=function roundToDp(x,dp){dp=Math.max(Math.floor(dp),0);const m=Math.pow(10,dp);return Math.round(x*m)/m}; +C3.toFixed=function toFixed(n,dp){let ret=n.toFixed(dp);let last=ret.length-1;for(;last>=0&&ret.charAt(last)==="0";--last);if(last>=0&&ret.charAt(last)===".")--last;if(last<0)return ret;return ret.substr(0,last+1)};C3.PackRGB=function PackRGB(red,green,blue){return C3.clamp(red,0,255)|C3.clamp(green,0,255)<<8|C3.clamp(blue,0,255)<<16};const ALPHAEX_SHIFT=1024;const ALPHAEX_MAX=1023;const RGBEX_SHIFT=16384;const RGBEX_MAX=8191;const RGBEX_MIN=-8192; +C3.PackRGBAEx=function PackRGBAEx(red,green,blue,alpha){red=C3.clamp(Math.floor(red*1024),RGBEX_MIN,RGBEX_MAX);green=C3.clamp(Math.floor(green*1024),RGBEX_MIN,RGBEX_MAX);blue=C3.clamp(Math.floor(blue*1024),RGBEX_MIN,RGBEX_MAX);alpha=C3.clamp(Math.floor(alpha*ALPHAEX_MAX),0,ALPHAEX_MAX);if(red<0)red+=RGBEX_SHIFT;if(green<0)green+=RGBEX_SHIFT;if(blue<0)blue+=RGBEX_SHIFT;return-(red*RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT+green*RGBEX_SHIFT*ALPHAEX_SHIFT+blue*ALPHAEX_SHIFT+alpha)}; +C3.PackRGBEx=function PackRGBEx(red,green,blue){return C3.PackRGBAEx(red,green,blue,1)};function isNegativeZero(x){return x===0&&1/x<0}C3.GetRValue=function GetRValue(rgb){if(rgb>=0)return(rgb&255)/255;else{let v=Math.floor(-rgb/(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetGValue=function GetGValue(rgb){if(rgb>=0)return((rgb&65280)>>8)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*RGBEX_SHIFT*ALPHAEX_SHIFT)/(RGBEX_SHIFT*ALPHAEX_SHIFT));if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}};C3.GetBValue=function GetBValue(rgb){if(rgb>=0)return((rgb&16711680)>>16)/255;else{let v=Math.floor(-rgb%(RGBEX_SHIFT*ALPHAEX_SHIFT)/ALPHAEX_SHIFT);if(v>RGBEX_MAX)v-=RGBEX_SHIFT;return v/1024}}; +C3.GetAValue=function GetAValue(rgb){if(isNegativeZero(rgb))return 0;else if(rgb>=0)return 1;else{const v=Math.floor(-rgb%ALPHAEX_SHIFT);return v/ALPHAEX_MAX}};C3.greatestCommonDivisor=function greatestCommonDivisor(a,b){a=Math.floor(a);b=Math.floor(b);while(b!==0){let t=b;b=a%b;a=t}return a};const COMMON_ASPECT_RATIOS=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]]; +C3.getAspectRatio=function getAspectRatio(w,h){w=Math.floor(w);h=Math.floor(h);if(w===h)return[1,1];for(let aspect of COMMON_ASPECT_RATIOS){let approxH=w/aspect[0]*aspect[1];if(Math.abs(h-approxH)<1)return aspect.slice(0);approxH=w/aspect[1]*aspect[0];if(Math.abs(h-approxH)<1)return[aspect[1],aspect[0]]}let gcd=C3.greatestCommonDivisor(w,h);return[w/gcd,h/gcd]}; +C3.segmentsIntersect=function segmentsIntersect(a1x,a1y,a2x,a2y,b1x,b1y,b2x,b2y){const min_ax=Math.min(a1x,a2x);const max_ax=Math.max(a1x,a2x);const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_ay=Math.min(a1y,a2y);const max_ay=Math.max(a1y,a2y);const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y- +a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la=qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentsIntersectPreCalc=function segmentsIntersectPreCalc(a1x,a1y,a2x,a2y,min_ax,max_ax,min_ay,max_ay,b1x,b1y,b2x,b2y){const min_bx=Math.min(b1x,b2x);const max_bx=Math.max(b1x,b2x);if(max_axmax_bx)return false;const min_by=Math.min(b1y,b2y);const max_by=Math.max(b1y,b2y);if(max_aymax_by)return false;const dpx=b1x-a1x+b2x-a2x;const dpy=b1y-a1y+b2y-a2y;const qax=a2x-a1x;const qay=a2y-a1y;const qbx=b2x-b1x;const qby=b2y-b1y;const d=Math.abs(qay*qbx-qby*qax);const la= +qbx*dpy-qby*dpx;if(Math.abs(la)>d)return false;const lb=qax*dpy-qay*dpx;return Math.abs(lb)<=d}; +C3.segmentIntersectsQuad=function segmentIntersectsQuad(x1,y1,x2,y2,q){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);const tlx=q.getTlx(),tly=q.getTly(),trx=q.getTrx(),try_=q.getTry(),brx=q.getBrx(),bry=q.getBry(),blx=q.getBlx(),bly=q.getBly();return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,tlx,tly,trx,try_)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,trx,try_,brx,bry)||C3.segmentsIntersectPreCalc(x1, +y1,x2,y2,min_x,max_x,min_y,max_y,brx,bry,blx,bly)||C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,blx,bly,tlx,tly)}; +C3.segmentIntersectsAnyN=function segmentIntersectsAnyN(x1,y1,x2,y2,points){const min_x=Math.min(x1,x2);const max_x=Math.max(x1,x2);const min_y=Math.min(y1,y2);const max_y=Math.max(y1,y2);let i=0;for(let last=points.length-4;i<=last;i+=2)if(C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[i+2],points[i+3]))return true;return C3.segmentsIntersectPreCalc(x1,y1,x2,y2,min_x,max_x,min_y,max_y,points[i],points[i+1],points[0],points[1])};const NO_HIT=2; +const PADDING=1E-6;C3.rayIntersect=function rayIntersect(rx1,ry1,rx2,ry2,sx1,sy1,sx2,sy2){const rdx=rx2-rx1;const rdy=ry2-ry1;const sdx=sx2-sx1;const sdy=sy2-sy1;const det=rdx*sdy-rdy*sdx;if(det===0)return NO_HIT;const gamma=((ry1-ry2)*(sx2-rx1)+rdx*(sy2-ry1))/det;if(0=0&&v>=0&&u+v<=1}; +C3.triangleCartesianToBarycentric=function triangleCartesianToBarycentric(px,py,tx1,ty1,tx2,ty2,tx3,ty3){const v0x=tx2-tx1;const v0y=ty2-ty1;const v1x=tx3-tx1;const v1y=ty3-ty1;const v2x=px-tx1;const v2y=py-ty1;const dot00=v0x*v0x+v0y*v0y;const dot01=v0x*v1x+v0y*v1y;const dot11=v1x*v1x+v1y*v1y;const dot20=v2x*v0x+v2y*v0y;const dot21=v2x*v1x+v2y*v1y;const denom=dot00*dot11-dot01*dot01;const v=(dot11*dot20-dot01*dot21)/denom;const w=(dot00*dot21-dot01*dot20)/denom;const u=1-v-w;return[u,v,w]}; +C3.triangleBarycentricToCartesian3d=function triangleBarycentricToCartesian3d(u,v,w,tx1,ty1,tz1,tx2,ty2,tz2,tx3,ty3,tz3){return[u*tx1+v*tx2+w*tx3,u*ty1+v*ty2+w*ty3,u*tz1+v*tz2+w*tz3]}; + +} + +// ../lib/misc/miscutil.js +{ +'use strict';const C3=self.C3;let mainDocument=null;let baseHref="";if(typeof document!=="undefined"){mainDocument=document;const baseElem=document.querySelector("base");baseHref=baseElem&&baseElem.hasAttribute("href")?baseElem.getAttribute("href"):"";if(baseHref){if(baseHref.startsWith("/"))baseHref=baseHref.substr(1);if(!baseHref.endsWith("/"))baseHref+="/"}}C3.GetBaseHref=function GetBaseHref(){return baseHref}; +C3.GetBaseURL=function GetBaseURL(){if(!mainDocument)return"";const loc=mainDocument.location;return C3.GetPathFromURL(loc.origin+loc.pathname)+baseHref};C3.GetPathFromURL=function GetPathFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return url;const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return"";return url.substr(0,lastSlash+1)}; +C3.GetFilenameFromURL=function GetFilenameFromURL(url){if(!url.length)return url;if(url.endsWith("/")||url.endsWith("\\"))return"";const lastSlash=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));if(lastSlash===-1)return url;return url.substr(lastSlash+1)};C3.GetFileExtension=function GetFileExtension(filename){let i=filename.lastIndexOf(".");if(i<1)return"";else return filename.substr(i)}; +C3.SetFileExtension=function SetFileExtension(filename,newExt){const i=filename.lastIndexOf(".");if(i===-1)return filename+"."+newExt;else return filename.substr(0,i+1)+newExt};C3.GetFileNamePart=function GetFileNamePart(filename){let i=filename.lastIndexOf(".");if(i<1)return filename;else return filename.substr(0,i)};C3.NormalizeFileSeparator=function NormalizeFileSeparator(path){return path.replace(/\\/g,"/")}; +C3.IsFileExtension=function IsFileExtension(filename,extension){const ext=filename?C3.GetFileExtension(filename).slice(1):"";return extension===ext}; +C3.FileNameEquals=function FileNameEquals(file_or_filename,other_file_or_filename){let firstName;let secondName;if(C3.IsFileLike(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename["name"]);if(C3.IsString(file_or_filename))firstName=C3.GetFileNamePart(file_or_filename);if(C3.IsFileLike(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename["name"]);if(C3.IsString(other_file_or_filename))secondName=C3.GetFileNamePart(other_file_or_filename);return firstName===secondName}; +C3.ParseFilePath=function ParseFilePath(path){path=C3.NormalizeFileSeparator(path);let root=/^\w:\//.exec(path);if(root){root=root[0];path=path.slice(3);if(path[0]!=="/")path="/"+path}else root="";path=path.replace(/\/{2,}/g,"/");if(path.length>1&&path.slice(-1)==="/")path=path.slice(0,-1);const start=path.lastIndexOf("/")+1;let dir="",base=path,name,ext="";if(start>0){dir=path.slice(0,start);base=path.slice(start)}name=base;const end=base.lastIndexOf(".");if(end>0){ext=base.slice(end);name=base.slice(0, +-ext.length)}const full=root+dir+base;return{dir,base,name,root,ext,full}};C3.Wait=function Wait(delay,argument){return new Promise((resolve,reject)=>{self.setTimeout(resolve,delay,argument)})};C3.swallowException=function swallowException(f){try{f()}catch(e){if(C3.isDebug)console.warn("Swallowed exception: ",e)}};C3.noop=function noop(){};C3.equalsNoCase=function equalsNoCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;return a===b||a.normalize().toLowerCase()===b.normalize().toLowerCase()}; +C3.equalsCase=function equalsCase(a,b){if(typeof a!=="string"||typeof b!=="string")return false;if(a===b)return true;return a.normalize()===b.normalize()};C3.typedArraySet16=function typedArraySet16(dest,src,i){dest[i++]=src[0];dest[i++]=src[1];dest[i++]=src[2];dest[i++]=src[3];dest[i++]=src[4];dest[i++]=src[5];dest[i++]=src[6];dest[i++]=src[7];dest[i++]=src[8];dest[i++]=src[9];dest[i++]=src[10];dest[i++]=src[11];dest[i++]=src[12];dest[i++]=src[13];dest[i++]=src[14];dest[i]=src[15]}; +C3.truncateArray=function truncateArray(arr,index){arr.length=index};C3.clearArray=function clearArray(arr){if(!arr)return;if(arr.length===0)return;C3.truncateArray(arr,0)};C3.clear2DArray=function clear2DArray(arr){if(!arr)return;for(let i=0;iarrayLength)C3.extendArray(arr,len,filler)};C3.shallowAssignArray=function shallowAssignArray(dest,src){C3.clearArray(dest);C3.appendArray(dest,src)};C3.appendArray=function appendArray(a,b){if(b.length<1E4)a.push(...b);else for(let i=0,len=b.length;i=arr.length)return;let len=arr.length-1;for(let i=index;i=0)a.splice(i,1)};C3.arraysEqual=function arraysEqual(a,b){let len=a.length;if(b.length!==len)return false;for(let i=0;i=0&&indexy;case 5:return x>=y;default:return false}}; +C3.hasAnyOwnProperty=function hasAnyOwnProperty(o){for(let p in o)if(o.hasOwnProperty(p))return true;return false}; +C3.PromiseAllWithProgress=function PromiseAllWithProgress(arr,progressCallback){if(!arr.length)return Promise.resolve([]);return new Promise((resolve,reject)=>{const results=[];let numberCompleted=0;let cancelled=false;for(let i=0,len=arr.length;i{if(cancelled)return;results[i]=result;++numberCompleted;if(numberCompleted===arr.length)resolve(results);else progressCallback(numberCompleted,arr.length)}).catch(err=>{cancelled=true;reject(err)})}})}; +let memoryCallbacks=[];C3.AddLibraryMemoryCallback=function AddLibraryMemoryCallback(f){memoryCallbacks.push(f)};C3.GetEstimatedLibraryMemoryUsage=function GetEstimatedLibraryMemoryUsage(){let ret=0;for(let f of memoryCallbacks){let m=f();ret+=m}return Math.floor(ret)};let nextTaskId=1;const activeTaskIds=new Map;const taskMessageChannel=new MessageChannel;taskMessageChannel.port2.onmessage=function OnTask(e){const id=e.data;const callback=activeTaskIds.get(id);activeTaskIds.delete(id);if(callback)callback(performance.now())}; +C3.RequestUnlimitedAnimationFrame=function RequestUnlimitedAnimationFrame(callback){const id=nextTaskId++;activeTaskIds.set(id,callback);taskMessageChannel.port1.postMessage(id);return id};C3.CancelUnlimitedAnimationFrame=function CancelUnlimitedAnimationFrame(id){activeTaskIds.delete(id)};C3.PostTask=C3.RequestUnlimitedAnimationFrame;C3.WaitForNextTask=function WaitForNextTask(){return new Promise(resolve=>C3.PostTask(resolve))};const activeRPAFids=new Set; +C3.RequestPostAnimationFrame=function RequestPostAnimationFrame(callback){const id=self.requestAnimationFrame(async timestamp=>{await C3.WaitForNextTask();if(!activeRPAFids.has(id))return;activeRPAFids.delete(id);callback(timestamp)});activeRPAFids.add(id);return id};C3.CancelPostAnimationFrame=function CancelPostAnimationFrame(id){if(!activeRPAFids.has(id))return;self.cancelAnimationFrame(id);activeRPAFids.delete(id)}; + +} + +// lib/misc/runtimeutil.js +{ +'use strict';const C3=self.C3;C3.IsAbsoluteURL=function IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"};C3.IsRelativeURL=function IsRelativeURL(url){return!C3.IsAbsoluteURL(url)};C3.ThrowIfNotOk=function ThrowIfNotOk(response){if(!response.ok)throw new Error(`fetch '${response.url}' response returned ${response.status} ${response.statusText}`);}; +C3.FetchOk=function FetchOk(url,init){return fetch(url,init).then(response=>{C3.ThrowIfNotOk(response);return response})};C3.FetchText=function FetchText(url){return C3.FetchOk(url).then(response=>response.text())};C3.FetchJson=function FetchJson(url){return C3.FetchOk(url).then(response=>response.json())};C3.FetchBlob=function FetchBlob(url){return C3.FetchOk(url).then(response=>response.blob())};C3.FetchArrayBuffer=function FetchArrayBuffer(url){return C3.FetchOk(url).then(response=>response.arrayBuffer())}; +C3.FetchImage=function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})};C3.BlobToArrayBuffer=function BlobToArrayBuffer(blob){if(typeof blob["arrayBuffer"]==="function")return blob["arrayBuffer"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsArrayBuffer(blob)})}; +C3.BlobToString=function BlobToString(blob){if(typeof blob["text"]==="function")return blob["text"]();else return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=()=>resolve(fileReader.result);fileReader.onerror=()=>reject(fileReader.error);fileReader.readAsText(blob)})};C3.BlobToJson=function BlobToJson(blob){return C3.BlobToString(blob).then(text=>JSON.parse(text))}; +C3.BlobToImage=async function BlobToImage(blob,decodeImage){let blobUrl=URL.createObjectURL(blob);try{const img=await C3.FetchImage(blobUrl);URL.revokeObjectURL(blobUrl);blobUrl="";if(decodeImage&&typeof img["decode"]==="function")await img["decode"]();return img}finally{if(blobUrl)URL.revokeObjectURL(blobUrl)}}; +C3.CreateCanvas=function CreateCanvas(width,height){if(typeof document!=="undefined"&&typeof document.createElement==="function"){const canvas=document.createElement("canvas");canvas.width=width;canvas.height=height;return canvas}else return new OffscreenCanvas(width,height)}; +C3.CanvasToBlob=function CanvasToBlob(canvas,type,quality){if(typeof quality!=="number")quality=1;type=type||"image/png";quality=C3.clamp(quality,0,1);if(canvas.toBlob)return new Promise(resolve=>canvas.toBlob(resolve,type,quality));else if(canvas["convertToBlob"])return canvas["convertToBlob"]({"type":type,"quality":quality});else throw new Error("could not convert canvas to blob");}; +C3.DrawableToBlob=function DrawableToBlob(drawable,type,quality){const canvas=C3.CreateCanvas(drawable.width,drawable.height);const ctx=canvas.getContext("2d");ctx.drawImage(drawable,0,0);return C3.CanvasToBlob(canvas,type,quality)}; +C3.ImageDataToBlob=function ImageDataToBlob(imageData,type,quality){if(C3.Supports.ImageBitmapOptions)return createImageBitmap(imageData,{"premultiplyAlpha":"none"}).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else if(C3.Supports.ImageBitmap)return createImageBitmap(imageData).then(imageBitmap=>C3.DrawableToBlob(imageBitmap,type,quality));else{const canvas=C3.CreateCanvas(imageData.width,imageData.height);const ctx=canvas.getContext("2d");ctx.putImageData(imageData,0,0);return C3.CanvasToBlob(canvas, +type,quality)}};C3.CopySet=function CopySet(dest,src){dest.clear();for(const x of src)dest.add(x)};C3.MapToObject=function MapToObject(map){const ret=Object.create(null);for(const [k,v]of map.entries())ret[k]=v;return ret};C3.ObjectToMap=function ObjectToMap(o,map){map.clear();for(const [k,v]of Object.entries(o))map.set(k,v)}; +C3.ToSuperJSON=function ToSuperJSON(v){if(typeof v==="object"&&v!==null)if(v instanceof Set)return{"_c3type_":"set","data":[...v].map(o=>ToSuperJSON(o))};else if(v instanceof Map)return{"_c3type_":"map","data":[...v].map(pair=>[pair[0],ToSuperJSON(pair[1])])};else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=ToSuperJSON(value);return ret}return v}; +C3.FromSuperJSON=function FromSuperJSON(v){if(typeof v==="object"&v!==null)if(v["_c3type_"]==="set")return new Set(v["data"].map(o=>FromSuperJSON(o)));else if(v["_c3type_"]==="map")return new Map(v["data"].map(pair=>[pair[0],FromSuperJSON(pair[1])]));else{const ret=Object.create(null);for(const [key,value]of Object.entries(v))ret[key]=FromSuperJSON(value);return ret}return v}; +C3.CSSToCamelCase=function(str){if(str.startsWith("--"))return str;let ret="";let isAfterHyphen=false;for(const ch of str)if(ch==="-")isAfterHyphen=true;else if(isAfterHyphen){ret+=ch.toUpperCase();isAfterHyphen=false}else ret+=ch;return ret};C3.IsIterator=function(o){return typeof o==="object"&&typeof o.next==="function"}; +C3.MakeFilledArray=function MakeFilledArray(len,data){const ret=[];if(typeof data==="function")for(let i=0;i1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p} +C3.Color=class Color{constructor(r,g,b,a){this._r=NaN;this._g=NaN;this._b=NaN;this._a=NaN;this._r=0;this._g=0;this._b=0;this._a=0;if(r instanceof C3.Color)this.set(r);else this.setRgba(r||0,g||0,b||0,a||0)}setRgb(r,g,b){this._r=+r;this._g=+g;this._b=+b;this.clamp();return this}setRgba(r,g,b,a){this._r=+r;this._g=+g;this._b=+b;this._a=+a;this.clamp();return this}set(c){this._r=c._r;this._g=c._g;this._b=c._b;this._a=c._a;return this}copy(c){return this.set(c)}add(c){this._r+=c._r;this._g+=c._g;this._b+= +c._b;this._a+=c._a;this.clamp()}addRgb(r,g,b,a=0){this._r+=+r;this._g+=+g;this._b+=+b;this._a+=+a;this.clamp()}diff(c){this.setR(Math.max(this._r,c._r)-Math.min(this._r,c._r));this.setG(Math.max(this._g,c._g)-Math.min(this._g,c._g));this.setB(Math.max(this._b,c._b)-Math.min(this._b,c._b));this.setA(Math.max(this._a,c._a)-Math.min(this._a,c._a));this.clamp()}copyRgb(c){this._r=c._r;this._g=c._g;this._b=c._b}setR(r){this._r=C3.clamp(+r,0,1)}getR(){return this._r}setG(g){this._g=C3.clamp(+g,0,1)}getG(){return this._g}setB(b){this._b= +C3.clamp(+b,0,1)}getB(){return this._b}setA(a){this._a=C3.clamp(+a,0,1)}getA(){return this._a}clone(){return C3.New(C3.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i++]=this._b;ta[i]=this._a}writeRGBToTypedArray(ta,i){ta[i++]=this._r;ta[i++]=this._g;ta[i]=this._b}equals(c){return this._r===c._r&&this._g===c._g&&this._b===c._b&&this._a===c._a}equalsIgnoringAlpha(c){return this._r=== +c._r&&this._g===c._g&&this._b===c._b}equalsRgb(r,g,b){return this._r===r&&this._g===g&&this._b===b}equalsRgba(r,g,b,a){return this._r===r&&this._g===g&&this._b===b&&this._a===a}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)&&arr[offset+3]===Math.fround(this._a)}equalsRGBF32Array(arr,offset){return arr[offset]===Math.fround(this._r)&&arr[offset+1]===Math.fround(this._g)&&arr[offset+2]===Math.fround(this._b)}multiply(c){this._r*= +c._r;this._g*=c._g;this._b*=c._b;this._a*=c._a}multiplyAlpha(a){this._r*=a;this._g*=a;this._b*=a;this._a*=a}premultiply(){this._r*=this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=C3.clamp(this._r,0,1);this._g=C3.clamp(this._g,0,1);this._b=C3.clamp(this._b,0,1);this._a=C3.clamp(this._a,0,1);return this}setFromRgbValue(rgb){this._r=C3.GetRValue(rgb);this._g=C3.GetGValue(rgb);this._b=C3.GetBValue(rgb); +this._a=C3.GetAValue(rgb)}getCssRgb(_r,_g,_b){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();return`rgb(${r*100}%, ${g*100}%, ${b*100}%)`}getCssRgba(_r,_g,_b,_a){const r=C3.IsFiniteNumber(_r)?_r:this.getR();const g=C3.IsFiniteNumber(_g)?_g:this.getG();const b=C3.IsFiniteNumber(_b)?_b:this.getB();const a=C3.IsFiniteNumber(_a)?_a:this.getA();return`rgba(${r*100}%, ${g*100}%, ${b*100}%, ${a})`}toHexString(){const rh= +Math.round(this.getR()*255);const gh=Math.round(this.getG()*255);const bh=Math.round(this.getB()*255);return"#"+padTwoDigits(rh.toString(16))+padTwoDigits(gh.toString(16))+padTwoDigits(bh.toString(16))}parseHexString(str){if(typeof str!=="string")return false;str=str.trim();if(str.charAt(0)==="#")str=str.substr(1);let rv;let gv;let bv;if(str.length===3){rv=parseInt(str[0],16)/15;gv=parseInt(str[1],16)/15;bv=parseInt(str[2],16)/15}else if(str.length===6){rv=parseInt(str.substr(0,2),16)/255;gv=parseInt(str.substr(2, +2),16)/255;bv=parseInt(str.substr(4,2),16)/255}else return false;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}toCommaSeparatedRgb(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return`${rv}, ${gv}, ${bv}`}toRgbArray(){const rv=Math.round(this.getR()*255);const gv=Math.round(this.getG()*255);const bv=Math.round(this.getB()*255);return[rv,gv,bv]}parseCommaSeparatedRgb(str){if(typeof str!== +"string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(),10)/255;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedPercentageRgb(str){if(typeof str!=="string")return false;str=str.replace(/^rgb\(|\)|%/,"");const arr=str.split(",");if(arr.length<3)return false; +const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);this.setA(1);return true}parseCommaSeparatedRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/255;const gv=parseInt(arr[1].trim(),10)/255;const bv=parseInt(arr[2].trim(), +10)/255;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv);if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseCommaSeparatedPercentageRgba(str){if(typeof str!=="string")return false;str=str.replace(/^rgba\(|\)|%/,"");const arr=str.split(",");if(arr.length<4)return false;const rv=parseInt(arr[0].trim(),10)/100;const gv=parseInt(arr[1].trim(),10)/100;const bv=parseInt(arr[2].trim(),10)/100;const av=parseFloat(arr[3].trim());if(isFinite(rv))this.setR(rv); +if(isFinite(gv))this.setG(gv);if(isFinite(bv))this.setB(bv);if(isFinite(av))this.setA(av);return true}parseString(str){if(typeof str!=="string")return false;str=str.replace(/\s+/,"");if(str.includes(","))if(str.startsWith("rgb("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgb(str);else return this.parseCommaSeparatedRgb(str);else if(str.startsWith("rgba("))if(str.includes("%"))return this.parseCommaSeparatedPercentageRgba(str);else return this.parseCommaSeparatedRgba(str);else if(str.startsWith("hsl(")|| +str.startsWith("hsla("))return this.parseHSLString(str);else{const components=str.split(",");if(str.includes("%")){if(components.length===3)return this.parseCommaSeparatedPercentageRgb(str);else if(components.length===4)return this.parseCommaSeparatedPercentageRgba(str);return false}else{if(components.length===3)return this.parseCommaSeparatedRgb(str);else if(components.length===4)return this.parseCommaSeparatedRgba(str);return false}}else return this.parseHexString(str)}toJSON(){return[this._r,this._g, +this._b,this._a]}setFromHSLA(h,s,l,a){let r;let g;let b;h%=360;s=C3.clamp(s,0,100);l=C3.clamp(l,0,100);a=C3.clamp(a,0,1);h/=360;s/=100;l/=100;if(s===0)r=g=b=l;else{const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=hueToRGB(p,q,h+1/3);g=hueToRGB(p,q,h);b=hueToRGB(p,q,h-1/3)}this.setR(r);this.setG(g);this.setB(b);this.setA(a);return this}parseHSLString(str){const cleanString=str.replace(/ |hsl|hsla|\(|\)|;/gi,"");const hsl=HSL_TEST.exec(cleanString);const hsla=HSLA_TEST.exec(cleanString);if(hsl&&hsl.length=== +4){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],1);return true}else if(hsla&&hsla.length===5){this.setFromHSLA(+hsl[1],+hsl[2],+hsl[3],+hsl[4]);return true}return false}toHSLAString(){const r=this._r;const g=this._g;const b=this._b;const a=this._a;const h=C3.Color.GetHue(r,g,b);const s=C3.Color.GetSaturation(r,g,b);const l=C3.Color.GetLuminosity(r,g,b);return`hsla(${h}, ${s}%, ${l}%, ${a})`}toHSLAArray(){const r=this._r;const g=this._g;const b=this._b;return[C3.Color.GetHue(r,g,b),C3.Color.GetSaturation(r, +g,b),C3.Color.GetLuminosity(r,g,b),this._a]}setFromJSON(arr){if(!Array.isArray(arr))return;if(arr.length<3)return;this._r=arr[0];this._g=arr[1];this._b=arr[2];if(arr.length>=4)this._a=arr[3];else this._a=1}set r(r){this.setR(r)}get r(){return this.getR()}set g(g){this.setG(g)}get g(){return this.getG()}set b(b){this.setB(b)}get b(){return this.getB()}set a(a){this.setA(a)}get a(){return this.getA()}setAtIndex(i,v){switch(i){case 0:this.setR(v);break;case 1:this.setG(v);break;case 2:this.setB(v);break; +case 3:this.setA(v);break;default:throw new RangeError("invalid color index");}}getAtIndex(i){switch(i){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(color_or_json_1,color_or_json_2){let c1;let c2;if(Array.isArray(color_or_json_1)){c1=new C3.Color;c1.setFromJSON(color_or_json_1)}else if(color_or_json_1 instanceof C3.Color)c1=color_or_json_1;else throw new Error("unexpected type"); +if(Array.isArray(color_or_json_2)){c2=new C3.Color;c2.setFromJSON(color_or_json_2)}else if(color_or_json_2 instanceof C3.Color)c2=color_or_json_2;else throw new Error("unexpected type");return c1.equals(c2)}static DiffChannel(channel1,channel2){return C3.clamp(Math.max(channel1,channel2)-Math.min(channel1,channel2),0,1)}static Diff(c1,c2){const ret=new C3.Color;ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)- +Math.min(c1._b,c2._b));ret.setA(Math.max(c1._a,c2._a)-Math.min(c1._a,c2._a));return ret}static DiffNoAlpha(c1,c2){const ret=new C3.Color(0,0,0,1);ret.setR(Math.max(c1._r,c2._r)-Math.min(c1._r,c2._r));ret.setG(Math.max(c1._g,c2._g)-Math.min(c1._g,c2._g));ret.setB(Math.max(c1._b,c2._b)-Math.min(c1._b,c2._b));return ret}static GetHue(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);if(max===min)return 0;let h=0;switch(max){case r:h=(g-b)/(max-min)+(g.5?d/(2-max-min):d/(max+min);return Math.round(s*100)}static GetLuminosity(r,g,b){const max=Math.max(r,g,b);const min=Math.min(r,g,b);const l=(max+min)/2;if(!max)return 0;return Math.round(l*100)}};C3.Color.White=Object.freeze(C3.New(C3.Color,1,1,1,1)); +C3.Color.Black=Object.freeze(C3.New(C3.Color,0,0,0,1));C3.Color.TransparentBlack=Object.freeze(C3.New(C3.Color,0,0,0,0)); + +} + +// ../lib/misc/vector2.js +{ +'use strict';const C3=self.C3; +C3.Vector2=class Vector2{constructor(x,y){this._x=0;this._y=0;if(x instanceof C3.Vector2)this.copy(x);else this.set(x||0,y||0)}set(x,y){this._x=+x;this._y=+y}copy(v){this._x=v._x;this._y=v._y}equals(v){return this._x===v._x&&this._y===v._y}equalsValues(x,y){return this._x===x&&this._y===y}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._x)&&arr[offset+1]===Math.fround(this._y)}setX(x){this._x=+x}getX(){return this._x}setY(y){this._y=+y}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta, +i){ta[i++]=this._x;ta[i]=this._y}offset(x,y){this._x+=+x;this._y+=+y}scale(x,y){this._x*=x;this._y*=y}divide(x,y){this._x/=x;this._y/=y}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return C3.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.hypot(this._x,this._y)}rotatePrecalc(sin_a,cos_a){const temp= +this._x*cos_a-this._y*sin_a;this._y=this._y*cos_a+this._x*sin_a;this._x=temp}rotate(a){if(a===0)return;this.rotatePrecalc(Math.sin(a),Math.cos(a))}rotateAbout(a,x,y){if(a===0||x===this._x&&y===this._y)return;this._x-=x;this._y-=y;this.rotatePrecalc(Math.sin(a),Math.cos(a));this._x+=+x;this._y+=+y}move(a,dist){if(dist===0)return;this._x+=Math.cos(a)*dist;this._y+=Math.sin(a)*dist}normalize(){const m=this.length();if(m!==0&&m!==1){this._x/=m;this._y/=m}}clamp(lower,upper){this._x=C3.clamp(this._x,lower, +upper);this._y=C3.clamp(this._y,lower,upper)}}; + +} + +// ../lib/misc/rect.js +{ +'use strict';const C3=self.C3; +C3.Rect=class Rect{constructor(left,top,right,bottom){this._left=NaN;this._top=NaN;this._right=NaN;this._bottom=NaN;this._left=0;this._top=0;this._right=0;this._bottom=0;if(left instanceof C3.Rect)this.copy(left);else this.set(left||0,top||0,right||0,bottom||0)}set(left,top,right,bottom){this._left=+left;this._top=+top;this._right=+right;this._bottom=+bottom}setWH(left,top,width,height){left=+left;top=+top;this._left=left;this._top=top;this._right=left+ +width;this._bottom=top+ +height}copy(rect){this._left= ++rect._left;this._top=+rect._top;this._right=+rect._right;this._bottom=+rect._bottom}clone(){return new C3.Rect(this._left,this._top,this._right,this._bottom)}static Merge(first,second){const ret=new C3.Rect;ret.setLeft(Math.min(first._left,second._left));ret.setTop(Math.min(first._top,second._top));ret.setRight(Math.max(first._right,second._right));ret.setBottom(Math.max(first._bottom,second._bottom));return ret}static FromObject(o){return new C3.Rect(o.left,o.top,o.right,o.bottom)}equals(rect){return this._left=== +rect._left&&this._top===rect._top&&this._right===rect._right&&this._bottom===rect._bottom}equalsWH(x,y,w,h){return this._left===x&&this._top===y&&this.width()===w&&this.height()===h}equalsF32Array(arr,offset){return arr[offset]===Math.fround(this._left)&&arr[offset+1]===Math.fround(this._top)&&arr[offset+2]===Math.fround(this._right)&&arr[offset+3]===Math.fround(this._bottom)}setLeft(l){this._left=+l}getLeft(){return this._left}setTop(t){this._top=+t}getTop(){return this._top}setRight(r){this._right= ++r}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i]=this._bottom}writeAsQuadToTypedArray(ta,i){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=this._right;ta[i++]=this._top;ta[i++]= +this._right;ta[i++]=this._bottom;ta[i++]=this._left;ta[i]=this._bottom}writeAsQuadToTypedArray3D(ta,i,z){ta[i++]=this._left;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._top;ta[i++]=z;ta[i++]=this._right;ta[i++]=this._bottom;ta[i++]=z;ta[i++]=this._left;ta[i++]=this._bottom;ta[i]=z}width(){return this._right-this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(x,y){x=+x;y=+y;this._left+=x;this._top+= +y;this._right+=x;this._bottom+=y}offsetLeft(x){this._left+=+x}offsetTop(y){this._top+=+y}offsetRight(x){this._right+=+x}offsetBottom(y){this._bottom+=+y}toSquare(axis){if(axis!=="x")throw new Error("invalid axis, only 'x' supported");if(this._topr)this._right=+r;if(this._bottom>b)this._bottom=+b}clampFlipped(l,t,r,b){if(this._leftt)this._top=+t;if(this._right>r)this._right=+r;if(this._bottomthis._right)this.swapLeftRight();if(this._top>this._bottom)this.swapTopBottom()}intersectsRect(rect){return!(rect._right< +this._left||rect._bottomthis._right||rect._top>this._bottom)}intersectsRectOffset(rect,x,y){return!(rect._right+xthis._right||rect._top+y>this._bottom)}containsPoint(x,y){return x>=this._left&&x<=this._right&&y>=this._top&&y<=this._bottom}containsRect(rect){return rect._left>=this._left&&rect._top>=this._top&&rect._right<=this._right&&rect._bottom<=this._bottom}expandToContain(rect){if(rect._leftthis._right)this._right=+rect._right;if(rect._bottom>this._bottom)this._bottom=+rect._bottom}lerpInto(rect){this._left=C3.lerp(rect._left,rect._right,this._left);this._top=C3.lerp(rect._top,rect._bottom,this._top);this._right=C3.lerp(rect._left,rect._right,this._right);this._bottom=C3.lerp(rect._top,rect._bottom,this._bottom)}}; + +} + +// ../lib/misc/quad.js +{ +'use strict';const C3=self.C3; +C3.Quad=class Quad{constructor(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=NaN;this._tly=NaN;this._trx=NaN;this._try=NaN;this._brx=NaN;this._bry=NaN;this._blx=NaN;this._bly=NaN;this._tlx=0;this._tly=0;this._trx=0;this._try=0;this._brx=0;this._bry=0;this._blx=0;this._bly=0;if(tlx instanceof C3.Quad)this.copy(tlx);else this.set(tlx||0,tly||0,trx||0,try_||0,brx||0,bry||0,blx||0,bly||0)}set(tlx,tly,trx,try_,brx,bry,blx,bly){this._tlx=+tlx;this._tly=+tly;this._trx=+trx;this._try=+try_;this._brx=+brx;this._bry= ++bry;this._blx=+blx;this._bly=+bly}setRect(left,top,right,bottom){this.set(left,top,right,top,right,bottom,left,bottom)}copy(q){this._tlx=q._tlx;this._tly=q._tly;this._trx=q._trx;this._try=q._try;this._brx=q._brx;this._bry=q._bry;this._blx=q._blx;this._bly=q._bly}equals(q){return this._tlx===q._tlx&&this._tly===q._tly&&this._trx===q._trx&&this._try===q._try&&this._brx===q._brx&&this._bry===q._bry&&this._blx===q._blx&&this._bly===q._bly}setTlx(v){this._tlx=+v}getTlx(){return this._tlx}setTly(v){this._tly= ++v}getTly(){return this._tly}setTrx(v){this._trx=+v}getTrx(){return this._trx}setTry(v){this._try=+v}getTry(){return this._try}setBrx(v){this._brx=+v}getBrx(){return this._brx}setBry(v){this._bry=+v}getBry(){return this._bry}setBlx(v){this._blx=+v}getBlx(){return this._blx}setBly(v){this._bly=+v}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx, +this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(ta,i){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=this._blx;ta[i]=this._bly}writeToTypedArray3D(ta,i,z){ta[i++]=this._tlx;ta[i++]=this._tly;ta[i++]=z;ta[i++]=this._trx;ta[i++]=this._try;ta[i++]=z;ta[i++]=this._brx;ta[i++]=this._bry;ta[i++]=z;ta[i++]=this._blx;ta[i++]=this._bly;ta[i]=z}offset(x, +y){x=+x;y=+y;this._tlx+=x;this._tly+=y;this._trx+=x;this._try+=y;this._brx+=x;this._bry+=y;this._blx+=x;this._bly+=y}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try); +this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(rect){this._tlx=rect._left;this._tly=rect._top;this._trx=rect._right;this._try=rect._top;this._brx=rect._right; +this._bry=rect._bottom;this._blx=rect._left;this._bly=rect._bottom}setFromRotatedRect(rect,a){if(a===0)this.setFromRect(rect);else this.setFromRotatedRectPrecalc(rect,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(rect,sin_a,cos_a){const left_sin_a=rect._left*sin_a;const top_sin_a=rect._top*sin_a;const right_sin_a=rect._right*sin_a;const bottom_sin_a=rect._bottom*sin_a;const left_cos_a=rect._left*cos_a;const top_cos_a=rect._top*cos_a;const right_cos_a=rect._right*cos_a;const bottom_cos_a=rect._bottom* +cos_a;this._tlx=left_cos_a-top_sin_a;this._tly=top_cos_a+left_sin_a;this._trx=right_cos_a-top_sin_a;this._try=top_cos_a+right_sin_a;this._brx=right_cos_a-bottom_sin_a;this._bry=bottom_cos_a+right_sin_a;this._blx=left_cos_a-bottom_sin_a;this._bly=bottom_cos_a+left_sin_a}getBoundingBox(rect){rect.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(x, +y){let v0x=this._trx-this._tlx;let v0y=this._try-this._tly;const v1x=this._brx-this._tlx;const v1y=this._bry-this._tly;const v2x=x-this._tlx;const v2y=y-this._tly;let dot00=v0x*v0x+v0y*v0y;let dot01=v0x*v1x+v0y*v1y;let dot02=v0x*v2x+v0y*v2y;const dot11=v1x*v1x+v1y*v1y;const dot12=v1x*v2x+v1y*v2y;let invDenom=1/(dot00*dot11-dot01*dot01);let u=(dot11*dot02-dot01*dot12)*invDenom;let v=(dot00*dot12-dot01*dot02)*invDenom;if(u>=0&&v>0&&u+v<1)return true;v0x=this._blx-this._tlx;v0y=this._bly-this._tly;dot00= +v0x*v0x+v0y*v0y;dot01=v0x*v1x+v0y*v1y;dot02=v0x*v2x+v0y*v2y;invDenom=1/(dot00*dot11-dot01*dot01);u=(dot11*dot02-dot01*dot12)*invDenom;v=(dot00*dot12-dot01*dot02)*invDenom;return u>=0&&v>0&&u+v<1}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(x1,y1,x2,y2){if(this.containsPoint(x1,y1)||this.containsPoint(x2,y2))return true;return C3.segmentIntersectsQuad(x1,y1,x2,y2,this)}intersectsQuad(rhs){let midX=rhs.midX();let midY= +rhs.midY();if(this.containsPoint(midX,midY))return true;midX=this.midX();midY=this.midY();if(rhs.containsPoint(midX,midY))return true;const tlx=this._tlx,tly=this._tly,trx=this._trx,try_=this._try,brx=this._brx,bry=this._bry,blx=this._blx,bly=this._bly;return C3.segmentIntersectsQuad(tlx,tly,trx,try_,rhs)||C3.segmentIntersectsQuad(trx,try_,brx,bry,rhs)||C3.segmentIntersectsQuad(brx,bry,blx,bly,rhs)||C3.segmentIntersectsQuad(blx,bly,tlx,tly,rhs)}rotatePointsAnticlockwise(){const tlx=this._tlx;const tly= +this._tly;this._tlx=this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=tlx;this._bly=tly}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(i,j){const tmp=this._getAtIndex(i);this._setAtIndex(i,this._getAtIndex(j));this._setAtIndex(j,tmp)}_getAtIndex(i){switch(i){case 0:return this._tlx;case 1:return this._tly; +case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(i,v){v=+v;switch(i){case 0:this._tlx=v;break;case 1:this._tly=v;break;case 2:this._trx=v;break;case 3:this._try=v;break;case 4:this._brx=v;break;case 5:this._bry=v;break;case 6:this._blx=v;break;case 7:this._bly=v;break;default:throw new RangeError("invalid quad point index");}}}; + +} + +// lib/misc/collisionPoly.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const DEFAULT_POLY_POINTS=[0,0,1,0,1,1,0,1];const tempQuad=C3.New(C3.Quad); +C3.CollisionPoly=class CollisionPoly extends C3.DefendedBase{constructor(pointsArr,enabled=true){super();if(!pointsArr)pointsArr=DEFAULT_POLY_POINTS;this._ptsArr=Float64Array.from(pointsArr);this._bbox=new C3.Rect;this._isBboxChanged=true;this._enabled=enabled}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(pointsArr){if(this._ptsArr.length===pointsArr.length)this._ptsArr.set(pointsArr);else this._ptsArr=Float64Array.from(pointsArr);this._isBboxChanged= +true}setDefaultPoints(){this.setPoints(DEFAULT_POLY_POINTS)}copy(poly){this.setPoints(poly._ptsArr)}setBboxChanged(){this._isBboxChanged=true}_updateBbox(){if(!this._isBboxChanged)return;const ptsArr=this._ptsArr;let left=ptsArr[0];let top=ptsArr[1];let right=left;let bottom=top;for(let i=0,len=ptsArr.length;iright)right=x;if(ybottom)bottom=y}this._bbox.set(left,top,right,bottom);this._isBboxChanged=false}setFromRect(rc, +offX,offY){let ptsArr=this._ptsArr;if(ptsArr.length!==8){ptsArr=new Float64Array(8);this._ptsArr=ptsArr}ptsArr[0]=rc.getLeft()-offX;ptsArr[1]=rc.getTop()-offY;ptsArr[2]=rc.getRight()-offX;ptsArr[3]=rc.getTop()-offY;ptsArr[4]=rc.getRight()-offX;ptsArr[5]=rc.getBottom()-offY;ptsArr[6]=rc.getLeft()-offX;ptsArr[7]=rc.getBottom()-offY;this._bbox.copy(rc);if(offX!==0||offY!==0)this._bbox.offset(-offX,-offY);this._isBboxChanged=false}setFromQuad(q,offX,offY){tempQuad.copy(q);tempQuad.offset(offX,offY);this.setPoints(tempQuad.toArray()); +this._isBboxChanged=true}transform(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}this.transformPrecalc(w,h,sina,cosa)}transformPrecalc(w,h,sina,cosa){const ptsArr=this._ptsArr;for(let i=0,len=ptsArr.length;i!filter.includes(ease))}static GetRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return[...PREDEFINED_EASE_MAP.keys()].concat(sortedCustomEases)}static GetCustomRuntimeEaseNames(){this._CreateEaseMap();const sortedCustomEases=[...CUSTOM_EASE_RUNTIME_MAP.keys()];sortedCustomEases.sort();return sortedCustomEases}static IsPredefinedTranslatedName(easeName){for(const k of EASE_TRANSLATION_KEYS){const translatedName= +self.lang(`ui.bars.timeline.eases.${k}`);if(translatedName===easeName)return true}for(const k of SHORT_EASE_TRANSLATION_KEYS){const translatedName=self.lang(`ui.bars.timeline.short-eases.${k}`);if(translatedName===easeName)return true}}static IsNamePredefined(easeName){this._CreateEaseMap();return[...PREDEFINED_EASE_MAP.keys()].includes(easeName)}static _GetEase(easeName){const realEaseName=ALIAS_MAP.get(easeName);if(realEaseName)return EASE_MAP.get(realEaseName);if(Ease.IsNamePredefined(easeName))return EASE_MAP.get(easeName); +if(PRIVATE_EASE_MAP.has(easeName))return PRIVATE_EASE_MAP.get(easeName)}static GetBuiltInTransition(builtInTransitionName){this._CreateEaseMap();return BUILT_IN_TRANSITION_MAP.get(builtInTransitionName)}static GetEditorEase(easeName,project){this._CreateEaseMap();const ease=Ease._GetEase(easeName);if(ease)return ease;if(!project)throw new Error("missing ease function");return CUSTOM_EASE_EDITOR_MAP.get(project).get(easeName)}static HasEditorEase(easeName,project){this._CreateEaseMap();const ease= +Ease._GetEase(easeName);if(ease)return true;return!!CUSTOM_EASE_EDITOR_MAP.get(project).get(easeName)}static GetRuntimeEase(easeName){this._CreateEaseMap();const ease=Ease._GetEase(easeName);if(ease)return ease;return CUSTOM_EASE_RUNTIME_MAP.get(easeName)}static GetEaseFromIndex(index){this._CreateEaseMap();const names=this.GetRuntimeEaseNames();return names[index]}static GetIndexForEase(name,project){this._CreateEaseMap();const names=this.GetEditorEaseNames(project);return names.indexOf(name)}static GetIndexForEaseAtRuntime(name){return this.GetIndexForEase(name)}static _CreateEaseMap(){if(EASE_MAP.size!== +0)return;this._AddPredifinedEase("default",()=>{});this._AddPredifinedEase("noease",[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}],true);this._AddPredifinedEase("easeinsine",[{"x":0,"y":0,"sax":.485,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutsine",[{"x":0,"y":0,"sax":.038,"say":0,"eax":0,"eay":0, +"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.485,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutsine",[{"x":0,"y":0,"sax":.336,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.336,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinelastic",[{"x":0,"y":0,"sax":.018,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.116,"y":.002,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.266,"y":-.005,"sax":.024,"say":0, +"eax":-.021,"eay":0,"se":true,"ee":true},{"x":.416,"y":.016,"sax":.024,"say":0,"eax":-.026,"eay":0,"se":true,"ee":true},{"x":.566,"y":-.045,"sax":.061,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.716,"y":.132,"sax":.072,"say":-.004,"eax":-.045,"eay":0,"se":true,"ee":true},{"x":.866,"y":-.373,"sax":.06,"say":0,"eax":-.049,"eay":-.002,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.038,"eay":-.263,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutelastic",[{"x":0,"y":0,"sax":.038, +"say":.263,"eax":0,"eay":0,"se":true,"ee":false},{"x":.136,"y":1.373,"sax":.049,"say":.002,"eax":-.06,"eay":0,"se":true,"ee":true},{"x":.286,"y":.868,"sax":.045,"say":0,"eax":-.072,"eay":.004,"se":true,"ee":true},{"x":.436,"y":1.045,"sax":.025,"say":0,"eax":-.061,"eay":0,"se":true,"ee":true},{"x":.586,"y":.984,"sax":.026,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.736,"y":1.005,"sax":.021,"say":0,"eax":-.024,"eay":0,"se":true,"ee":true},{"x":.886,"y":.998,"sax":.025,"say":0,"eax":-.025, +"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.018,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutelastic",[{"x":0,"y":0,"sax":.025,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.067,"y":.001,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.18,"y":-.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.292,"y":.025,"sax":.053,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.405,"y":-.118,"sax":.069,"say":0,"eax":-.027, +"eay":0,"se":true,"ee":true},{"x":.597,"y":1.118,"sax":.027,"say":0,"eax":-.069,"eay":0,"se":true,"ee":true},{"x":.71,"y":.975,"sax":.025,"say":0,"eax":-.053,"eay":0,"se":true,"ee":true},{"x":.822,"y":1.005,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.935,"y":.999,"sax":.025,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.025,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinback",[{"x":0,"y":0,"sax":.35,"say":0,"eax":0,"eay":0, +"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.34,"eay":-1.579,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutback",[{"x":0,"y":0,"sax":.34,"say":1.579,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.35,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutback",[{"x":0,"y":0,"sax":.035,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.242,"y":-.1,"sax":.258,"say":0,"eax":-.025,"eay":0,"se":true,"ee":true},{"x":.76,"y":1.1,"sax":.025,"say":0, +"eax":-.26,"eay":0,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.035,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinbounce",[{"x":0,"y":0,"sax":.033,"say":.025,"eax":0,"eay":0,"se":true,"ee":false},{"x":.092,"y":0,"sax":.026,"say":.078,"eax":-.033,"eay":.025,"se":true,"ee":true},{"x":.274,"y":0,"sax":.097,"say":.319,"eax":-.026,"eay":.078,"se":true,"ee":true},{"x":.637,"y":0,"sax":.105,"say":.625,"eax":-.097,"eay":.319,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0, +"eax":-.125,"eay":-.004,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutbounce",[{"x":0,"y":0,"sax":.125,"say":.004,"eax":0,"eay":0,"se":true,"ee":false},{"x":.365,"y":1,"sax":.097,"say":-.319,"eax":-.105,"eay":-.625,"se":true,"ee":true},{"x":.728,"y":1,"sax":.026,"say":-.078,"eax":-.097,"eay":-.319,"se":true,"ee":true},{"x":.91,"y":1,"sax":.033,"say":-.025,"eax":-.026,"eay":-.078,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.033,"eay":-.025,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutbounce", +[{"x":0,"y":0,"sax":.01,"say":.006,"eax":0,"eay":0,"se":true,"ee":false},{"x":.046,"y":0,"sax":.021,"say":.038,"eax":-.01,"eay":.006,"se":true,"ee":true},{"x":.137,"y":0,"sax":.059,"say":.158,"eax":-.021,"eay":.038,"se":true,"ee":true},{"x":.319,"y":0,"sax":.117,"say":.744,"eax":-.059,"eay":.158,"se":true,"ee":true},{"x":.683,"y":1,"sax":.059,"say":-.158,"eax":-.117,"eay":-.744,"se":true,"ee":true},{"x":.865,"y":1,"sax":.021,"say":-.038,"eax":-.059,"eay":-.158,"se":true,"ee":true},{"x":.956,"y":1, +"sax":.01,"say":-.006,"eax":-.021,"eay":-.038,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.01,"eay":-.006,"se":false,"ee":true}]);this._AddPredifinedEase("easeincubic",[{"x":0,"y":0,"sax":.75,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.138,"eay":-.321,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutcubic",[{"x":0,"y":0,"sax":.138,"say":.321,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.75,"eay":0,"se":false,"ee":true}]); +this._AddPredifinedEase("easeinoutcubic",[{"x":0,"y":0,"sax":.285,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.081,"say":.272,"eax":-.081,"eay":-.272,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.285,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquad",[{"x":0,"y":0,"sax":.4,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.178,"eay":-.392,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquad",[{"x":0,"y":0, +"sax":.178,"say":.392,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.4,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquad",[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.03,"say":.065,"eax":-.03,"eay":-.065,"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquart",[{"x":0,"y":0,"sax":.264,"say":.079,"eax":0,"eay":0,"se":true,"ee":false}, +{"x":1,"y":1,"sax":0,"say":0,"eax":-.329,"eay":-1.287,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquart",[{"x":0,"y":0,"sax":.329,"say":1.287,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.264,"eay":-.079,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquart",[{"x":0,"y":0,"sax":.765,"say":.03,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.765,"eay":-.03,"se":false,"ee":true}]);this._AddPredifinedEase("easeinquint",[{"x":0, +"y":0,"sax":.6,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.2,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutquint",[{"x":0,"y":0,"sax":.2,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.6,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutquint",[{"eax":0,"eay":0,"ee":false,"sax":.84,"say":0,"se":true,"x":0,"y":0},{"eax":-.84,"eay":0,"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPredifinedEase("easeincirc", +[{"x":0,"y":0,"sax":.25,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.024,"eay":-.808,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutcirc",[{"x":0,"y":0,"sax":.024,"say":.808,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.25,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutcirc",[{"x":0,"y":0,"sax":.125,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":.5,"y":.5,"sax":.02,"say":.428,"eax":-.02,"eay":-.428, +"se":true,"ee":true},{"x":1,"y":1,"sax":0,"say":0,"eax":-.125,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinexpo",[{"x":0,"y":0,"sax":.66,"say":0,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.14,"eay":-1,"se":false,"ee":true}]);this._AddPredifinedEase("easeoutexpo",[{"x":0,"y":0,"sax":.14,"say":1,"eax":0,"eay":0,"se":true,"ee":false},{"x":1,"y":1,"sax":0,"say":0,"eax":-.66,"eay":0,"se":false,"ee":true}]);this._AddPredifinedEase("easeinoutexpo",[{"eax":0, +"eay":0,"ee":false,"sax":.345,"say":0,"se":true,"x":0,"y":0},{"eax":-.06,"eay":-.5,"ee":true,"sax":.06,"say":.5,"se":true,"x":.5,"y":.5},{"eax":-.335,"eay":0,"ee":true,"sax":0,"say":0,"se":false,"x":1,"y":1}]);this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier);this._AddPrivateCustomEase("spline",this.EaseSpline)}static _AddPredifinedEase(name,dataArray_or_function,linear=false){if(typeof dataArray_or_function==="function")Ease._AddEase(name,dataArray_or_function,"predefined");else if(C3.IsArray(dataArray_or_function))if(self.BuiltInTransition){const builtInTransition= +C3.New(self.BuiltInTransition,name,linear);builtInTransition.SetFromJson(dataArray_or_function);Ease._AddEase(name,(t,sv,dv,tt)=>builtInTransition.Interpolate(t,sv,dv,tt),"predefined");BUILT_IN_TRANSITION_MAP.set(name,builtInTransition)}else{const builtInTransition=C3.New(C3.Transition,[name,dataArray_or_function.map(data=>{return[data["x"],data["y"],data["sax"],data["say"],data["eax"],data["eay"],data["se"],data["ee"]]})],false);builtInTransition.MakeLinear(linear);Ease._AddEase(name,(t,sv,dv,tt)=> +builtInTransition.Interpolate(t,sv,dv,tt),"predefined")}else throw new Error("unexpected arguments");}static _AddPrivateCustomEase(name,func){Ease._AddEase(name,func,"private")}static AddCustomEase(name,func,project){this._CreateEaseMap();Ease._AddEase(name,func,"custom",project)}static RemoveCustomEase(name,project){if(this.IsNamePredefined(name))return;if([...PRIVATE_EASE_MAP.keys()].includes(name))return;const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);if(customEaseMap)customEaseMap.delete(name)}static _AddEase(name, +func,mode,project){switch(mode){case "predefined":{EASE_MAP.set(name,func);PREDEFINED_EASE_MAP.set(name,func);break}case "custom":{if(project){if(!CUSTOM_EASE_EDITOR_MAP.has(project))CUSTOM_EASE_EDITOR_MAP.set(project,new Map);const customEaseMap=CUSTOM_EASE_EDITOR_MAP.get(project);customEaseMap.set(name,func)}else CUSTOM_EASE_RUNTIME_MAP.set(name,func);break}case "private":{EASE_MAP.set(name,func);PRIVATE_EASE_MAP.set(name,func);break}default:throw new Error("unexpected ease mode");}}static NoEase(t, +b,c,d){return c*t/d+b}static EaseInQuad(t,b,c,d){return c*(t/=d)*t+b}static EaseOutQuad(t,b,c,d){return-c*(t/=d)*(t-2)+b}static EaseInOutQuad(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*(--t*(t-2)-1)+b}static EaseInCubic(t,b,c,d){return c*(t/=d)*t*t+b}static EaseOutCubic(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b}static EaseInOutCubic(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b}static EaseInQuart(t,b,c,d){return c*(t/=d)*t*t*t+b}static EaseOutQuart(t,b,c,d){return-c*((t= +t/d-1)*t*t*t-1)+b}static EaseInOutQuart(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b}static EaseInQuint(t,b,c,d){return c*(t/=d)*t*t*t*t+b}static EaseOutQuint(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b}static EaseInOutQuint(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b}static EaseInSine(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b}static EaseOutSine(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b}static EaseInOutSine(t,b,c,d){return-c/2* +(Math.cos(Math.PI*t/d)-1)+b}static EaseInExpo(t,b,c,d){return t===0?b:c*Math.pow(2,10*(t/d-1))+b}static EaseOutExpo(t,b,c,d){return t===d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b}static EaseInOutExpo(t,b,c,d){if(t===0)return b;if(t===d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b}static EaseInCirc(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b}static EaseOutCirc(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b}static EaseInOutCirc(t,b,c,d){if((t/=d/2)<1)return-c/ +2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b}static EaseInElastic(t,b,c,d){let s=1.70158;let p=0;let a=c;if(t===0)return b;if((t/=d)===1)return b+c;if(!p)p=d*.3;if(a{return p3-3*p2+3*p1-p0};const b=(p0,p1,p2,p3)=>{return 3*p2-6*p1+3*p0};const c=(p0,p1,p2,p3)=>{return 3*(p1-p0)};const calc_bezier=(aT,a,b,c)=>{return((a*aT+b)*aT+c)*aT};const get_slope=(aT,a,b,c)=>{return 3*a*aT*aT+2*b*aT+c}; +const get_t_for_x=(aX,p0,p1,p2,p3,samples)=>{if(aX==1)return 1;let intervalStart=0;let currentSampleIndex=1;let currentSampleValue=samples[currentSampleIndex];let lastSampleIndex=SAMPLE_COUNT-1;let lastSampleValue=samples[SAMPLE_COUNT-1];while(currentSampleIndex!=lastSampleIndex&¤tSampleValue<=aX){currentSampleIndex++;currentSampleValue=samples[currentSampleIndex];intervalStart+=SAMPLE_STEP}currentSampleIndex--;currentSampleValue=samples[currentSampleIndex];const dist=(aX-currentSampleValue)/ +(samples[currentSampleIndex+1]-currentSampleValue);let guess=intervalStart+dist*SAMPLE_STEP;const va=a(p0,p1,p2,p3);const vb=b(p0,p1,p2,p3);const vc=c(p0,p1,p2,p3);const initSlope=get_slope(guess,va,vb,vc);if(initSlope===0)return guess;else if(initSlope>=NEWTON_RAPHSON_MIN_SLOPE){for(let i=0;i0)aB=guess;else aA=guess;precissionLimit=Math.abs(x)>SUBDIVISION_PRECISION;maxIterations=++i0)return;C3.clearArray(this._captureListeners);this._captureListenersSet.clear();C3.clearArray(this._listeners);this._listenersSet.clear();C3.clearArray(this._queueModifyListeners);C3.Release(this)}_AddListener(func, +capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"add",func,capture});return}if(capture){if(this._captureListenersSet.has(func))return;this._captureListeners.push(func);this._captureListenersSet.add(func)}else{if(this._listenersSet.has(func))return;this._listeners.push(func);this._listenersSet.add(func)}}_RemoveListener(func,capture){if(this._IsFiring()){this._queueModifyListeners.push({op:"remove",func,capture});return}if(capture){if(this._captureListenersSet.has(func)){this._captureListenersSet.delete(func); +C3.arrayFindRemove(this._captureListeners,func)}}else if(this._listenersSet.has(func)){this._listenersSet.delete(func);C3.arrayFindRemove(this._listeners,func)}}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return this._fireDepth>0}_ProcessQueuedListeners(){const removeListenersSet=new Set;const removeCaptureListenersSet=new Set;for(const q of this._queueModifyListeners)if(q.op==="add"){this._AddListener(q.func,q.capture);if(q.capture)removeCaptureListenersSet.delete(q.func); +else removeListenersSet.delete(q.func)}else if(q.op==="remove")if(q.capture){this._captureListenersSet.delete(q.func);removeCaptureListenersSet.add(q.func)}else{this._listenersSet.delete(q.func);removeListenersSet.add(q.func)}else throw new Error("invalid op");C3.arrayRemoveAllInSet(this._listeners,removeListenersSet);C3.arrayRemoveAllInSet(this._captureListeners,removeCaptureListenersSet);C3.clearArray(this._queueModifyListeners)}_FireCancellable(event){this._IncreaseFireDepth();let isStopped=false; +for(let i=0,len=this._captureListeners.length;i0)this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(e){if(e)this._IncreaseFireDepth();else this._DecreaseFireDepth()}_FireAsync(event){let callbackPromises=[];for(let i=0,len=this._captureListeners.length;i +func(event)))}for(let i=0,len=this._listeners.length;ifunc(event)))}return Promise.all(callbackPromises).then(()=>!event.defaultPrevented)}_FireAndWait_AsyncOptional(event){const results=[];this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i!event.defaultPrevented);else return!event.defaultPrevented}async _FireAndWaitAsync(event){return await this._FireAndWait_AsyncOptional(event)}async _FireAndWaitAsyncSequential(event){this._IncreaseFireDepth();for(let i=0,len=this._captureListeners.length;i0?1:timerTimeout)} +function DoAsyncifiedWork(deadline){callbackId=-1;if(!workQueue.length)return;let startTime=performance.now();let curTime=startTime;let jobCount=0;let estimatedNextJobDuration=0;do{DoNextAsyncifiedJob(workQueue.shift());curTime=performance.now();++jobCount;estimatedNextJobDuration=(curTime-startTime)/jobCount*1.1}while(workQueue.length&&(SUPPORTS_RIC&&highThroughputMode===0&&typeof deadline!=="undefined"?estimatedNextJobDuration{workQueue.push({func:func,resolve:resolve,reject:reject,stack:stack});if(asyncifyDisabled){DoNextAsyncifiedJob(workQueue.pop());return}if(callbackId===-1)SetNewCallback(SETTIMEOUT_INTERVAL)})}; +C3.Asyncify.SetHighThroughputMode=function SetHighThroughputMode(m){if(m)++highThroughputMode;else{--highThroughputMode;if(highThroughputMode<0)throw new Error("already turned off high throughput mode");}}; + +} + +// ../lib/util/idleTimeout.js +{ +'use strict';const C3=self.C3;const IDLE_CHECK_MIN_INTERVAL=1E3;const IDLE_CHECK_TIMER_OVERSHOOT=100;let cachedNowTime=-1;function ClearTimeCache(){cachedNowTime=-1}C3.FastGetDateNow=function FastGetDateNow(){if(cachedNowTime===-1){cachedNowTime=Date.now();self.setTimeout(ClearTimeCache,16)}return cachedNowTime};let timerId=-1;let nextDeadline=-1;let activeIdleTimeouts=new Set; +function CheckActiveIdleTimeouts(){timerId=-1;nextDeadline=-1;let nowTime=Date.now();for(let i of activeIdleTimeouts)if(i._CheckTimeout(nowTime)){let deadline=i._GetDeadline();if(nextDeadline===-1||deadlinenowTime+ +IDLE_CHECK_MIN_INTERVAL){self.clearTimeout(timerId);nextDeadline=this._deadline;timerId=self.setTimeout(CheckActiveIdleTimeouts,this._timeout+IDLE_CHECK_TIMER_OVERSHOOT)}}_CheckTimeout(nowTime){if(nowTime>=this._deadline){if(this._callback()){this._deadline=nowTime+this._timeout;return true}this._isActive=false;return false}return true}_GetDeadline(){return this._deadline}Cancel(){if(this._isActive){activeIdleTimeouts.delete(this);this._isActive=false;if(activeIdleTimeouts.size===0&&timerId!==-1){self.clearTimeout(timerId); +timerId=-1;nextDeadline=-1}}}Release(){this.Cancel();this._callback=null}}; + +} + +// ../lib/util/disposable.js +{ +'use strict';const C3=self.C3; +C3.Disposable=class Disposable{constructor(disposeAction){this._disposed=false;this._disposeAction=disposeAction}Dispose(){if(this._disposed)return;this._disposed=true;if(this._disposeAction){this._disposeAction();this._disposeAction=null}}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(instance){return new Disposable(()=>instance.Release())}static From(eventDispatcher,eventNames,eventHandler,opts,scope){if(typeof opts==="undefined"||opts===null)opts=false;else if(typeof opts!== +"boolean"&&typeof opts!=="object")throw new TypeError("invalid event listener options");if(scope)eventHandler=eventHandler.bind(scope);if(eventNames.includes(" ")){eventNames=eventNames.split(" ");const disposable=new C3.CompositeDisposable;for(let eventName of eventNames){eventDispatcher.addEventListener(eventName,eventHandler,opts);disposable.Add(C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventName,eventHandler,opts)))}return disposable}else{eventDispatcher.addEventListener(eventNames, +eventHandler,opts);return C3.New(C3.Disposable,()=>eventDispatcher.removeEventListener(eventNames,eventHandler,opts))}}};C3.StubDisposable=class StubDisposable extends C3.Disposable{SetAction(disposeAction){this._disposeAction=disposeAction}}; +C3.CompositeDisposable=class CompositeDisposable extends C3.Disposable{constructor(...disposables){super();this._disposables=new Set;for(let disposable of disposables)this.Add(disposable)}Add(...disposables){if(this._disposed)throw new Error("already disposed");for(let disposable of disposables)this._disposables.add(disposable)}Remove(disposable){if(this._disposed)throw new Error("already disposed");this._disposables.delete(disposable)}RemoveAll(){if(this._disposed)throw new Error("already disposed"); +if(!this._disposables)return;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear()}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw new Error("already disposed");this._disposed=true;for(let disposable of this._disposables)disposable.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}; + +} + +// lib/util/kahanSum.js +{ +'use strict';const C3=self.C3;C3.KahanSum=class KahanSum extends C3.DefendedBase{constructor(){super();this._c=0;this._y=0;this._t=0;this._sum=0}Add(v){v=+v;this._y=v-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(v){this._sum-=+v}Get(){return this._sum}Reset(){this._c=0;this._y=0;this._t=0;this._sum=0}Set(s){this._c=0;this._y=0;this._t=0;this._sum=+s}Copy(ks){this._c=ks._c;this._y=ks._y;this._t=ks._t;this._sum=ks._sum}Release(){}}; + +} + +// lib/util/redblackset.js +{ +'use strict';const C3=self.C3;const js_cols={};const RED=true;const BLACK=false;js_cols.RBnode=function(tree){this.tree=tree;this.right=this.tree.sentinel;this.left=this.tree.sentinel;this.parent=null;this.color=false;this.key=null};js_cols.RedBlackSet=function(compare_func){this.size=0;this.sentinel=new js_cols.RBnode(this);this.sentinel.color=BLACK;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=compare_func||this.default_compare}; +js_cols.RedBlackSet.prototype.default_compare=function(a,b){if(a0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.right!=this.sentinel)return this.min(x.right).key;var y=x.parent;while(y!=this.sentinel&&x==y.right){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null}; +js_cols.RedBlackSet.prototype.predecessor=function(key){if(this.size>0){var x=this.get_(key);if(x==this.sentinel)return null;if(x.left!=this.sentinel)return this.max(x.left).key;var y=x.parent;while(y!=this.sentinel&&x==y.left){x=y;y=y.parent}if(y!=this.sentinel)return y.key;else return null}else return null};js_cols.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};js_cols.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key}; +js_cols.RedBlackSet.prototype.get_=function(key){var x=this.root;while(x!=this.sentinel&&this.compare(x.key,key)!=0)if(this.compare(key,x.key)<0)x=x.left;else x=x.right;return x};js_cols.RedBlackSet.prototype.contains=function(key){return this.get_(key).key!=null};js_cols.RedBlackSet.prototype.getValues=function(){var ret=[];this.forEach(function(x){ret.push(x)});return ret}; +js_cols.RedBlackSet.prototype.insertAll=function(col){if(js_cols.typeOf(col)=="array")for(var i=0;icolCount)return false;var i=0;if(this.isEmpty())return true;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(js_cols.contains.call(col,col,n.key))i++;return i==this.getCount()}; +js_cols.RedBlackSet.prototype.intersection=function(col){var result=new js_cols.RedBlackSet(this.compare);if(this.isEmpty())return result;for(var n=this.min(this.root);n!=this.sentinel;n=this.successor_(n))if(col.contains.call(col,n.key,n.key,this))result.insert(n.key);return result}; +C3.RedBlackSet=class RedBlackSet extends C3.DefendedBase{constructor(sortFunc){super();this._rbSet=new js_cols.RedBlackSet(sortFunc);this._enableQueue=false;this._queueInsert=new Set;this._queueRemove=new Set}Add(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.delete(item);else this._queueInsert.add(item);else this._rbSet.insert(item)}Remove(item){if(this._enableQueue)if(this._rbSet.contains(item))this._queueRemove.add(item);else this._queueInsert.delete(item);else this._rbSet.remove(item)}Has(item){if(this._enableQueue){if(this._queueInsert.has(item))return true; +return!this._queueRemove.has(item)&&this._rbSet.contains(item)}else return this._rbSet.contains(item)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw new Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return this.GetSize()===0}Front(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode"); +const rbSet=this._rbSet;const n=rbSet.min(rbSet.root);return n.key}Shift(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode");const item=this.Front();this.Remove(item);return item}SetQueueingEnabled(q){q=!!q;if(this._enableQueue===q)return;this._enableQueue=q;if(!q){for(const item of this._queueRemove)this._rbSet.remove(item);this._queueRemove.clear();for(const item of this._queueInsert)this._rbSet.insert(item);this._queueInsert.clear()}}ForEach(func){this._rbSet.forEach(func)}*values(){if(this.IsEmpty())return; +const rbSet=this._rbSet;for(let n=rbSet.min(rbSet.root);n!=rbSet.sentinel;n=rbSet.successor_(n))yield n.key}[Symbol.iterator](){return this.values()}}; + +} + +// ../lib/util/promiseThrottle.js +{ +'use strict';const C3=self.C3; +C3.PromiseThrottle=class PromiseThrottle{constructor(maxParallel=C3.hardwareConcurrency){this._maxParallel=maxParallel;this._queue=[];this._activeCount=0}Add(func){return new Promise((resolve,reject)=>{this._queue.push({func,resolve,reject});this._MaybeStartNext()})}_FindInQueue(func){for(let i=0,len=this._queue.length;i=this._maxParallel)return;this._activeCount++;const job=this._queue.shift();try{const result=await job.func();job.resolve(result)}catch(err){job.reject(err)}this._activeCount--;this._MaybeStartNext()}static async Batch(concurrency, +methods){const results=[];let failed=false;const execute=async _=>{let fn;while(fn=methods.pop()){if(failed)return;try{results.push(await fn())}catch(e){failed=true;throw e;}}};const promises=[];while(concurrency--)promises.push(execute());await Promise.all(promises);return results}}; + +} + +// ../lib/util/rateLimiter.js +{ +'use strict';const C3=self.C3; +C3.RateLimiter=class RateLimiter{constructor(callback,interval,intervalOnBattery){this._callback=callback;this._interval=interval;this._intervalOnBattery=intervalOnBattery||interval*2;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false;this._callbackArguments=null}SetCanRunImmediate(c){this._canRunImmediate=!!c}_GetInterval(){if(typeof C3.Battery!=="undefined"&&C3.Battery.IsOnBatteryPower())return this._intervalOnBattery;else return this._interval}Call(...args){if(this._timerId!== +-1)return;this._callbackArguments=args;let nowTime=C3.FastGetDateNow();let timeSinceLastCall=nowTime-this._lastCallTime;let interval=this._GetInterval();if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc,Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;const args=this._callbackArguments;this._callbackArguments=null;if(args)this._callback(...args);else this._callback(); +this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._callbackArguments=null;this._lastCallTime=C3.FastGetDateNow()}_OnTimer(){this._timerId=-1;this._lastCallTime=C3.FastGetDateNow();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._callbackArguments=null;this._timerCallFunc=null}}; + +} + +// ../lib/util/svgRaster/svgRasterManager.js +{ +'use strict';const C3=self.C3; +C3.SVGRasterManager=class SVGRasterManager{constructor(){this._images=new Map;this._allowNpotSurfaces=false;this._getBaseSizeCallback=null;this._rasterAtSizeCallback=null;this._releaseResultCallback=null;this._redrawCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(f){this._getBaseSizeCallback=f}GetBaseSize(dataSource){if(!this._getBaseSizeCallback)throw new Error("no get base size callback set");return this._getBaseSizeCallback(dataSource)}SetRasterAtSizeCallback(f){this._rasterAtSizeCallback= +f}RasterAtSize(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight){if(!this._rasterAtSizeCallback)throw new Error("no raster at size callback set");return this._rasterAtSizeCallback(dataSource,context,surfaceWidth,surfaceHeight,imageWidth,imageHeight)}SetReleaseResultCallback(f){this._releaseResultCallback=f}ReleaseResult(rasterizedResult){if(!this._releaseResultCallback)throw new Error("no release result callback set");this._releaseResultCallback(rasterizedResult)}SetRedrawCallback(f){this._redrawCallback= +f}Redraw(){if(!this._redrawCallback)throw new Error("no redraw callback set");this._redrawCallback()}AddImage(dataSource){let ret=this._images.get(dataSource);if(!ret){ret=C3.New(C3.SVGRasterImage,this,dataSource);this._images.set(dataSource,ret)}ret.IncReference();return ret}_RemoveImage(ri){this._images.delete(ri.GetDataSource())}OnTexturesChanged(){for(const ri of this._images.values()){ri.ReleaseRasterizedResult();ri.ForceRasterAgain()}}}; + +} + +// ../lib/util/svgRaster/svgRasterImage.js +{ +'use strict';const C3=self.C3;const MAX_SURFACE_SIZE=4096; +C3.SVGRasterImage=class SVGRasterImage{constructor(manager,dataSource){this._manager=manager;this._dataSource=dataSource;this._refCount=0;this._baseWidth=0;this._baseHeight=0;this._getBaseSizePromise=this._manager.GetBaseSize(dataSource).then(baseSize=>{if(!this._manager)return;this._baseWidth=baseSize[0];this._baseHeight=baseSize[1];this._manager.Redraw()}).catch(err=>{console.error("[SVG] Error loading SVG: ",err);this._hadError=true;if(this._manager)this._manager.Redraw()});this._rasterSurfaceWidth= +0;this._rasterSurfaceHeight=0;this._rasterImageWidth=0;this._rasterImageHeight=0;this._isRasterizing=false;this._rasterizedResult=null;this._forceRaster=false;this._hadError=false}Release(){if(this._refCount<=0)throw new Error("already released");this._refCount--;if(this._refCount===0)this._Release()}ReleaseRasterizedResult(){if(this._rasterizedResult){this._manager.ReleaseResult(this._rasterizedResult);this._rasterizedResult=null}}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this); +this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return this._refCount>0}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=true}async StartRasterForSize(context,width,height){if(width===0||height===0||this._hadError)return;if(this._isRasterizing)return;let rasterSurfaceWidth=C3.nextHighestPowerOfTwo(Math.ceil(width));let rasterSurfaceHeight=C3.nextHighestPowerOfTwo(Math.ceil(height));const maxDim=Math.max(rasterSurfaceWidth, +rasterSurfaceHeight);if(maxDim>MAX_SURFACE_SIZE){const scale=MAX_SURFACE_SIZE/maxDim;width*=scale;height*=scale;rasterSurfaceWidth=Math.min(Math.ceil(rasterSurfaceWidth*scale),MAX_SURFACE_SIZE);rasterSurfaceHeight=Math.min(Math.ceil(rasterSurfaceHeight*scale),MAX_SURFACE_SIZE)}if(widthimageAspectRatio){width=rasterSurfaceHeight* +imageAspectRatio;height=rasterSurfaceHeight}else{width=rasterSurfaceWidth;height=rasterSurfaceWidth/imageAspectRatio}}if(this._manager.IsNpotSurfaceAllowed()){rasterSurfaceWidth=Math.ceil(width);rasterSurfaceHeight=Math.ceil(height)}if(rasterSurfaceWidth<=this._rasterSurfaceWidth&&rasterSurfaceHeight<=this._rasterSurfaceHeight&&!this._forceRaster)return;this._isRasterizing=true;this._rasterSurfaceWidth=rasterSurfaceWidth;this._rasterSurfaceHeight=rasterSurfaceHeight;const newRasterizedResult=await this._manager.RasterAtSize(this._dataSource, +context,this._rasterSurfaceWidth,this._rasterSurfaceHeight,width,height);if(!this._manager)return;this.ReleaseRasterizedResult();this._rasterizedResult=newRasterizedResult;this._rasterImageWidth=width;this._rasterImageHeight=height;this._isRasterizing=false;this._forceRaster=false;this._manager.Redraw()}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}; + +} + +// ../lib/str/str.js +{ +'use strict';const C3=self.C3;C3.UTF8_BOM="\ufeff";const NUMERIC_CHARS=new Set([..."0123456789"]);C3.IsNumericChar=function IsNumericChar(c){return NUMERIC_CHARS.has(c)};const WHITESPACE_CHARS=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);C3.IsWhitespaceChar=function IsWhitespaceChar(c){return WHITESPACE_CHARS.has(c)};C3.FilterWhitespace=function FilterWhitespace(str){return[...str].filter(ch=>!C3.IsWhitespaceChar(ch)).join("")}; +C3.IsStringAllWhitespace=function IsStringAllWhitespace(str){for(const ch of str)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsCharArrayAllWhitespace=function IsStringAllWhitespace(chArr){for(const ch of chArr)if(!C3.IsWhitespaceChar(ch))return false;return true};C3.IsUnprintableChar=function IsUnprintableChar(c){return c.length===1&&c.charCodeAt(0)<32};C3.FilterUnprintableChars=function FilterUnprintableChars(str){return[...str].filter(ch=>!C3.IsUnprintableChar(ch)).join("")}; +const NUMERIC_STRING_CHARS=new Set([..."0123456789.+-e"]);C3.IsStringNumber=function IsStringNumber(str){str=str.trim();if(!str.length)return false;let firstChar=str.charAt(0);if(firstChar!=="-"&&!NUMERIC_CHARS.has(firstChar))return false;for(let ch of str)if(!NUMERIC_STRING_CHARS.has(ch))return false;return true};C3.RemoveTrailingDigits=function RemoveTrailingDigits(str){let i=str.length;while(i>0){let prev_ch=str.charAt(i-1);if(!C3.IsNumericChar(prev_ch))break;--i}return str.substr(0,i)}; +C3.IncrementNumberAtEndOf=function IncrementNumberAtEndOf(str){let baseStr=C3.RemoveTrailingDigits(str);let numberStr=str.substr(baseStr.length);if(numberStr)numberStr=(parseInt(numberStr,10)+1).toString();else numberStr="2";return baseStr+numberStr};const HTML_ENTITY_MAP=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function lookupHtmlEntity(s){return HTML_ENTITY_MAP.get(s)}const HTML_ENTITY_REGEX=/[&<>"']/g; +C3.EscapeHTML=function EscapeHTML(str){return str.replace(HTML_ENTITY_REGEX,lookupHtmlEntity)};C3.EscapeJS=function EscapeJS(str){let ret=C3.ReplaceAll(str,"\\","\\\\");ret=C3.ReplaceAll(ret,'"','\\"');ret=C3.ReplaceAll(ret,"\t","\\t");ret=C3.ReplaceAll(ret,"\r","");return C3.ReplaceAll(ret,"\n","\\n")};C3.EscapeXML=function EscapeXML(str){let ret=C3.ReplaceAll(str,"&","&");ret=C3.ReplaceAll(ret,"<","<");ret=C3.ReplaceAll(ret,">",">");return C3.ReplaceAll(ret,'"',""")}; +const ESCAPE_REGEX=/[-[\]{}()*+?.,\\^$|#\s]/g;C3.EscapeRegex=function EscapeRegex(str){return str.replace(ESCAPE_REGEX,"\\$&")};C3.CountCharsInString=function CountCharsInString(str,ch){let count=0;for(const c of str)if(c===ch)++count;return count}; +C3.FindAll=function FindAll(str,find,matchCase=false){if(!find)return[];if(!matchCase){str=str.toLowerCase();find=find.toLowerCase()}const findLen=find.length;let startIndex=0;let index=0;let ret=[];while((index=str.indexOf(find,startIndex))>-1){ret.push(index);startIndex=index+findLen}return ret};C3.ReplaceAll=function ReplaceAll(str,find,replace){return str.replaceAll(find,()=>replace)}; +C3.ReplaceAllCaseInsensitive=function ReplaceAll(str,find,replace){return str.replace(new RegExp(C3.EscapeRegex(find),"gi"),()=>replace)};C3.SetElementContent=function SetElementContent(elem,stringlike){if(typeof stringlike==="string")elem.textContent=stringlike;else if(stringlike.isPlainText())elem.textContent=stringlike.toString();else{elem.innerHTML=stringlike.toHTML();if(stringlike instanceof C3.BBString)stringlike.attachLinkHandlers(elem)}}; +C3.StringLikeEquals=function StringLikeEquals(a,b){if(a instanceof C3.HtmlString||a instanceof C3.BBString)return a.equals(b);else if(b instanceof C3.HtmlString||b instanceof C3.BBString)return b.equals(a);else return a===b};C3.StringSubstitute=function StringSubstitute(str,...arr){let ret=str;for(let i=0,len=arr.length;i=0&&highestUsedIndex>=0&&lowestMissingIndexb)return 1;else if(alowerB)return 1;else if(lowerA0){secondsTotal-=days*24*3600;parts.push(langPluralSub(".days",null,days))}}if(opts.hours){const hours=Math.floor(secondsTotal/3600);if(hours>0||parts.length){secondsTotal-=hours*3600;parts.push(langPluralSub(".hours", +null,hours))}}if(opts.minutes){const minutes=Math.floor(secondsTotal/60);if(minutes>0||parts.length||!opts.seconds){secondsTotal-=minutes*60;parts.push(langPluralSub(".minutes",null,minutes))}}if(opts.seconds){const seconds=Math.floor(secondsTotal%60);parts.push(langPluralSub(".seconds",null,seconds))}const ret=(opts.approximate?lang(".approx-prefix"):"")+parts.join(lang(".separator"));C3.Lang.PopContext();return ret}; +C3.ZeroPad=function(n,d){let s=n<0?"-":"";n=Math.abs(n);let nStr=n.toString();let zeroes=d-nStr.length;for(let i=0;it.toUpperCase())}; +C3.CompareVersionStrings=function CompareVersionStrings(v1,v2){let a1=v1.split(".").map(s=>s.trim());let a2=v2.split(".").map(s=>s.trim());C3.resizeArray(a1,4,"0");C3.resizeArray(a2,4,"0");a1=a1.map(s=>parseInt(s,10));a2=a2.map(s=>parseInt(s,10));for(let i=0;i<4;++i){const diff=a1[i]-a2[i];if(diff!==0)return diff<0?-1:1}return 0};C3.CreateGUID=function CreateGUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{const r=Math.floor(Math.random()*16);const v=c==="x"?r:r&3|8;return v.toString(16)})}; +C3.StringHammingDistance=function StringHammingDistance(a,b){if(a.length!==b.length)throw new Error("strings must be same length");let ret=0;for(let i=0,len=a.length;ib.length){tmp=a;a=b;b=tmp}row=Array(a.length+1);for(i=0;i<=a.length;i++)row[i]=i;for(i=1;i<=b.length;i++){prev=i;for(j=1;j<=a.length;j++){if(b[i-1]===a[j-1])val=row[j-1];else val=Math.min(row[j-1]+1,Math.min(prev+1,row[j]+1));row[j-1]=prev;prev=val}row[a.length]=prev}return row[a.length]}; + +} + +// ../lib/str/bbstring.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +const BB_CODE_MAP=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["code","code"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["tip1","abbr"],["tip2","abbr"],["tip3","abbr"],["tip4","abbr"],["tip5","abbr"],["tip6","abbr"],["tip7","abbr"],["tip8","abbr"],["tip9","abbr"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]], +["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]);const SELF_CLOSING_TAGS=new Set(["icon"]);const BBREGEX=/\[(\/?)([a-zA-Z0-9]+)\]/g;const CUSTOM_BBREGEX=/\[(\/?)([^\[\n]*?)\]/g;let linkActions=null;let tipList=null;let classIndex=0; +function bbToHtmlReplacerFunc(match,closeSlash,tagName){const entry=BB_CODE_MAP.get(tagName);if(entry)if(typeof entry==="string"){if(entry==="a"&&linkActions.length===0||entry==="abbr"&&tipList.length===0)return match;if(entry==="a"&&!closeSlash){const index=parseInt(tagName.substring(1),10)-1;if(index<0||index>=linkActions.length)throw new Error("invalid bbcode link substitution");const linkAction=linkActions[index];if(typeof linkAction==="string")return``;else if(typeof linkAction=== +"function")return``;else throw new TypeError("invalid bbcode link action");}else if(entry==="abbr"&&!closeSlash){const index=parseInt(tagName.substring(3),10)-1;if(index<0||index>=tipList.length)throw new Error("invalid bbcode tip substitution");const tip=tipList[index];let tipStr="";if(typeof tip==="string")tipStr=tip;else if(typeof tip==="function")tipStr=tip();if(typeof tipStr!=="string")throw new TypeError("invalid bbcode tip");return``}else return"<"+closeSlash+entry+">"}else if(Array.isArray(entry)){let tag=entry[0];let className=entry[1];if(closeSlash)return"";else return`<${tag} class="${className}">`}else;else if(tagName==="class")if(closeSlash)return"";else return``;else return match}const LINEBREAK_REGEX=/\n/g; +C3.BBString=class BBString{constructor(str,opts){this._bbstr=opts&&opts.noEscape?str:C3.EscapeHTML(str);this._htmlstr="";this._convertLineBreaks=false;this._linkActions=[];this._tipList=[];if(opts){this._convertLineBreaks=!!opts.convertLineBreaks;if(opts.links){if(opts.links.length>9)throw new Error("too many links");this._linkActions=opts.links}if(opts.tips){if(opts.tips.length>9)throw new Error("too many tips");this._tipList=opts.tips}}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion= +this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=false;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){if(this._hasAnyBBtags)return this._bbstr.replace(BBREGEX,"");else return this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let str=this._bbstr;if(this._hasAnyBBtags){classIndex= +0;linkActions=this._linkActions;tipList=this._tipList;str=str.replace(BBREGEX,bbToHtmlReplacerFunc);linkActions=null;tipList=null}if(this._needsLineBreakConversion)str=str.replace(LINEBREAK_REGEX,"
      ");this._htmlstr=str}return this._htmlstr}attachLinkHandlers(parentElem){if(!this._linkActions.length)return;for(let i=0,len=this._linkActions.length;i0&&bbStr.charAt(index-1)==="\\")continue; +const matchStr=result[0];const closeSlash=result[1];const tagName=result[2];const strFrag=bbStr.substring(prevIndex,index);prevIndex=index+matchStr.length;if(strFrag)fragments.push({text:strFrag,styles:styleStack.slice(0)});if(!tagName)continue;if(closeSlash){const lowerTagName=tagName.toLowerCase();for(let i=styleStack.length-1;i>=0;--i)if(styleStack[i].tag===lowerTagName){styleStack.splice(i,1);break}}else{let tag=tagName;let param=null;const eq=tagName.indexOf("=");if(eq!==-1){tag=tagName.substring(0, +eq).toLowerCase();param=tagName.substring(eq+1)}else tag=tag.toLowerCase();if(SELF_CLOSING_TAGS.has(tag))if(tag==="icon")fragments.push({icon:param,styles:styleStack.slice(0)});else throw new Error(`unknown self-closing tag ${tag}`);else styleStack.push({tag,param})}}if(prevIndex +{if(frag.icon)return C3.New(C3.IconFragment,{icon:frag.icon,styles:frag.styles});else return C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(frag.text),styles:frag.styles})});this._hasParsedFragments=true;return this._fragments}_ProcessBBCodeEscapeSequences(text){text=C3.ReplaceAll(text,"\\[","[");return C3.ReplaceAll(text,"\\\\","\\")}static StripTags(str){return C3.New(C3.BBString,str,{noEscape:true}).toPlainText()}static StripAnyTags(str){return str.replace(CUSTOM_BBREGEX,"")}}; + +} + +// ../lib/str/textLayout/wordWrap.js +{ +'use strict';const C3=self.C3;function IsWordBreakWhiteSpace(ch){if(ch==="\u00a0"||ch==="\u202f")return false;else return C3.IsWhitespaceChar(ch)}function WordBreakTrimEnd(chArr){while(chArr.length>0&&IsWordBreakWhiteSpace(chArr.at(-1)))chArr.pop()}function IsNewline(ch){return ch==="\n"||ch==="\r\n"} +C3.WordWrap=class WordWrap{constructor(){this._lines=[];this._iconSet=null}GetLines(){return this._lines}GetLineCount(){return this._lines.length}SetIconSet(iconSet){this._iconSet=iconSet}_MeasureLine(line,measureFunc){let width=0;let height=0;let fbbAscent=0;let fbbDescent=0;let topToAlphabeticDistance=0;for(const frag of line){if(frag.GetWidth()===-1){const m=measureFunc(frag);frag.SetHeight(m.height);frag.SetFontBoundingBoxAscent(m.fontBoundingBoxAscent||0);frag.SetFontBoundingBoxDescent(m.fontBoundingBoxDescent|| +0);frag.SetTopToAlphabeticDistance(m.topToAlphabeticDistance||0);if(frag.IsText())frag.SetWidth(m.width);else if(frag.IsIcon())frag.CalculateWidthFromHeight(this._iconSet)}width+=frag.GetWidth();height=Math.max(height,frag.GetHeight());fbbAscent=Math.max(fbbAscent,frag.GetFontBoundingBoxAscent());fbbDescent=Math.max(fbbDescent,frag.GetFontBoundingBoxDescent());topToAlphabeticDistance=Math.max(topToAlphabeticDistance,frag.GetTopToAlphabeticDistance())}return{width,height,fontBoundingBoxAscent:fbbAscent, +fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance}}_AddLine(fragments,width,height,fbbAscent,fbbDescent,topToAlphabeticDistance){this._lines.push(C3.New(C3.WordWrap.Line,{fragments,width,height,fontBoundingBoxAscent:fbbAscent,fontBoundingBoxDescent:fbbDescent,topToAlphabeticDistance}))}WordWrap(fragmentArr,measureFunc,wrapWidth,wrapMode,endOfLineMargin){if(typeof fragmentArr==="string")fragmentArr=[C3.New(C3.TextFragment,{chArr:C3.SplitGraphemes(fragmentArr)})];C3.clearArray(this._lines); +if(!fragmentArr.length||fragmentArr.length===1&&fragmentArr[0].IsText()&&fragmentArr[0].IsEmpty()||wrapWidth<2)return;if(fragmentArr.length===1){const frag=fragmentArr[0];if(frag.IsText()&&frag.GetLength()<=100&&!frag.HasNewLine()){let {width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance}=measureFunc(frag);width+=endOfLineMargin;frag.SetWidth(width);frag.SetHeight(height);frag.SetFontBoundingBoxAscent(fontBoundingBoxAscent||0);frag.SetFontBoundingBoxDescent(fontBoundingBoxDescent|| +0);frag.SetTopToAlphabeticDistance(topToAlphabeticDistance||0);if(width<=wrapWidth){this._AddLine([frag],width,height,fontBoundingBoxAscent,fontBoundingBoxDescent,topToAlphabeticDistance);return}}}let tokenisedFragments;if(wrapMode==="word")tokenisedFragments=this._TokeniseWords(fragmentArr);else{tokenisedFragments=[];for(const frag of fragmentArr)if(frag.IsText()){const chArr=frag.GetCharacterArray();C3.appendArray(tokenisedFragments,chArr.map(ch=>[C3.New(C3.TextFragment,{chArr:[ch],styles:frag.GetStyles()})]))}else tokenisedFragments.push([frag])}this._WrapText(tokenisedFragments, +measureFunc,wrapWidth,endOfLineMargin)}_TokeniseWords(fragmentArr){const ret=[];let curWord=[];let isCurWhitespace=false;for(const frag of fragmentArr){const styles=frag.GetStyles();if(frag.IsIcon()){if(curWord.length>0)ret.push(curWord);ret.push([frag]);curWord=[];continue}for(const ch of frag.GetCharacterArray())if(IsNewline(ch)){if(curWord.length>0)ret.push(curWord);const newlineFrag=C3.New(C3.TextFragment,{chArr:["\n"],styles});ret.push([newlineFrag]);curWord=[]}else if(curWord.length===0){const newFrag= +C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag);isCurWhitespace=IsWordBreakWhiteSpace(ch)}else{const isWhitespace=IsWordBreakWhiteSpace(ch);if(isWhitespace===isCurWhitespace){const curFrag=curWord.at(-1);if(curFrag.GetStyles()===styles)curFrag._AppendChar(ch);else{const newFrag=C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag)}}else{ret.push(curWord);curWord=[];const newFrag=C3.New(C3.TextFragment,{chArr:[ch],styles});curWord.push(newFrag);isCurWhitespace=isWhitespace}}}if(curWord.length> +0)ret.push(curWord);return ret}_CopyLine(line){return line.map(f=>f._Clone())}_AddWordToLine(currentLine,curWord){const lastFrag=currentLine.length?currentLine.at(-1):null;let i=0;if(lastFrag&&lastFrag.IsText()&&curWord[0].IsText()&&curWord[0].GetStyles()===lastFrag.GetStyles()){lastFrag._Append(curWord[0].GetCharacterArray());i=1}for(let len=curWord.length;i=wrapWidth){if(currentLine.length>0)this._AddLine(currentLine,currentLineWidth,currentLineHeight,currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);currentLine=[];if(curWord[0].IsText()&&C3.IsCharArrayAllWhitespace(curWord[0].GetCharacterArray())){currentLineWidth=0;currentLineHeight=0;currentLineFbbAscent=0;currentLineFbbDescent=0;currentLineTopToAlphabetic=0}else{this._AddWordToLine(currentLine,curWord);const metrics= +this._MeasureLine(currentLine,measureFunc);currentLineWidth=metrics.width;currentLineHeight=metrics.height;currentLineFbbAscent=metrics.fontBoundingBoxAscent;currentLineFbbDescent=metrics.fontBoundingBoxDescent;currentLineTopToAlphabetic=metrics.topToAlphabeticDistance}}else{currentLine=tryLine;currentLineWidth=tryLineWidth;currentLineHeight=tryMetrics.height;currentLineFbbAscent=tryMetrics.fontBoundingBoxAscent;currentLineFbbDescent=tryMetrics.fontBoundingBoxDescent;currentLineTopToAlphabetic=tryMetrics.topToAlphabeticDistance}}if(currentLine.length> +0)this._AddLine(currentLine,currentLineWidth,currentLineHeight,currentLineFbbAscent,currentLineFbbDescent,currentLineTopToAlphabetic);this._TrimLinesTrailingWhitespace(measureFunc,endOfLineMargin)}_TrimLinesTrailingWhitespace(measureFunc,endOfLineMargin){for(const line of this._lines){const fragments=line._GetFragmentsArray();if(!fragments.length)continue;let lastFrag=fragments.at(-1);if(lastFrag.IsText()){const chArr=lastFrag.GetCharacterArray();const trimmedArr=chArr.slice(0);WordBreakTrimEnd(trimmedArr); +if(trimmedArr.length===0){line.OffsetWidth(-lastFrag.GetWidth());fragments.pop()}else if(trimmedArr.length0){lastFrag=fragments.at(-1);lastFrag.OffsetWidth(endOfLineMargin);line.OffsetWidth(endOfLineMargin)}}}}Clear(){C3.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((a, +v)=>Math.max(a,v.GetWidth()),0)}GetTotalLineHeight(){return this._lines.reduce((a,v)=>a+v.GetHeight(),0)}}; + +} + +// ../lib/str/textLayout/line.js +{ +'use strict';const C3=self.C3; +C3.WordWrap.Line=class WordWrapLine{constructor(opts){this._fragments=opts.fragments||[];this._width=opts.width||-1;this._height=opts.height||-1;this._fontBoundingBoxAscent=opts.fontBoundingBoxAscent||-1;this._fontBoundingBoxDescent=opts.fontBoundingBoxDescent||-1;this._topToAlphabeticDistance=opts.topToAlphabeticDistance||-1;this._posX=0;this._posY=0}fragments(){return this._fragments.values()}_GetFragmentsArray(){return this._fragments}OffsetWidth(w){this._width+=w}GetWidth(){return this._width}GetHeight(){return this._height}GetFoundBoundingBoxAscent(){return this._fontBoundingBoxAscent}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(x){this._posX=x}GetPosX(){return this._posX}SetPosY(y){this._posY= +y}GetPosY(){return this._posY}}; + +} + +// ../lib/str/textLayout/fragmentBase.js +{ +'use strict';const C3=self.C3; +C3.FragmentBase=class FragmentBase{constructor(opts){this._styles=opts.styles||[];this._width=opts.width||-1;this._height=opts.height||-1;this._fontBoundingBoxAscent=opts.fontBoundingBoxAscent||-1;this._fontBoundingBoxDescent=opts.fontBoundingBoxDescent||-1;this._topToAlphabeticDistance=opts.topToAlphabeticDistance||-1;this._posX=0;this._posY=0}IsText(){return false}IsIcon(){return false}GetStyles(){return this._styles}GetStyleTag(tag){const styles=this._styles;for(let i=styles.length-1;i>=0;--i){const s= +styles[i];if(s.tag===tag)return s}return null}HasStyleTag(tag){return!!this.GetStyleTag(tag)}GetStyleMap(){const ret=new Map;for(const s of this._styles)ret.set(s.tag,s.param);return ret}OffsetWidth(w){this._width+=w}SetWidth(w){this._width=w}GetWidth(){return this._width}SetHeight(h){this._height=h}GetHeight(){return this._height}SetFontBoundingBoxAscent(v){this._fontBoundingBoxAscent=v}GetFontBoundingBoxAscent(){return this._fontBoundingBoxAscent}SetFontBoundingBoxDescent(v){this._fontBoundingBoxDescent= +v}GetFontBoundingBoxDescent(){return this._fontBoundingBoxDescent}SetTopToAlphabeticDistance(v){this._topToAlphabeticDistance=v}GetTopToAlphabeticDistance(){return this._topToAlphabeticDistance}SetPosX(x){this._posX=x}GetPosX(){return this._posX}SetPosY(y){this._posY=y}GetPosY(){return this._posY}}; + +} + +// ../lib/str/textLayout/textFragment.js +{ +'use strict';const C3=self.C3; +C3.TextFragment=class TextFragment extends C3.FragmentBase{constructor(opts){super(opts);this._chArr=opts.chArr}IsText(){return true}_Append(chArr){C3.appendArray(this._chArr,chArr);this._width=-1;this._height=-1;this._fontBoundingBoxAscent=-1;this._fontBoundingBoxDescent=-1;this._topToAlphabeticDistance=-1}_AppendChar(ch){this._chArr.push(ch)}_Clone(){return C3.New(C3.TextFragment,{chArr:this._chArr.slice(0),styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent, +fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetCharacterArray(){return this._chArr}SetCharacterArray(arr){this._chArr=arr}GetLength(){return this._chArr.length}IsEmpty(){return this._chArr.length===0}HasNewLine(){return this._chArr.includes("\n")}}; + +} + +// ../lib/str/textLayout/iconFragment.js +{ +'use strict';const C3=self.C3; +C3.IconFragment=class IconFragment extends C3.FragmentBase{constructor(opts){super(opts);this._icon=opts.icon}IsIcon(){return true}GetIconParameter(){return this._icon}_Clone(){return C3.New(C3.IconFragment,{icon:this._icon,styles:this._styles,width:this._width,height:this._height,fontBoundingBoxAscent:this._fontBoundingBoxAscent,fontBoundingBoxDescent:this._fontBoundingBoxDescent,topToAlphabeticDistance:this._topToAlphabeticDistance})}GetTextIcon(iconSet){if(!iconSet)return null;let index=Number(this._icon); +if(String(index)===this._icon){index=Math.floor(index);return iconSet.GetTextIconByIndex(index)}else return iconSet.GetTextIconByTag(this._icon)}CalculateWidthFromHeight(iconSet){const textIcon=this.GetTextIcon(iconSet);if(!textIcon){this._width=0;return}this._width=this._height*textIcon.GetWidth()/textIcon.GetHeight()}GetDrawable(iconSet){const textIcon=this.GetTextIcon(iconSet);return textIcon?textIcon.GetDrawable():null}GetLength(){return 1}}; + +} + +// ../lib/str/textLayout/textIconManager.js +{ +'use strict';const C3=self.C3; +C3.TextIconManager=class TextIconManager{constructor(opts){this._iconSets=new Map;this._getIconSetMetaCallback=opts.getIconSetMeta;this._getIconSetContentCallback=opts.getIconSetContent}Release(){for(const iconSet of this._iconSets.values())iconSet.Release();this._iconSets.clear()}GetIconSet(iconSource){let iconSet=this._iconSets.get(iconSource);if(iconSet)return iconSet;const iconMeta=this._getIconSetMetaCallback(iconSource);iconSet=C3.New(C3.TextIconSet,this,{source:iconSource,iconMeta});this._iconSets.set(iconSource, +iconSet);return iconSet}HasIconSet(iconSource){return this._iconSets.has(iconSource)}DeleteIconSet(iconSource){const iconSet=this._iconSets.get(iconSource);if(iconSet)iconSet.Release();this._iconSets.delete(iconSource)}async _GetIconSetContent(iconSource){return await this._getIconSetContentCallback(iconSource)}}; + +} + +// ../lib/str/textLayout/textIconSet.js +{ +'use strict';const C3=self.C3; +C3.TextIconSet=class TextIconSet{constructor(textIconManager,opts){this._textIconManager=textIconManager;this._source=opts.source;this._iconsArray=[];this._iconsByTag=new Map;this._hasStartedLoad=false;this._isLoading=false;this._loadPromise=null;const iconMetaArr=opts.iconMeta.icons;for(let i=0,len=iconMetaArr.length;i=this._iconsArray.length)return null;return this._iconsArray[index]}GetTextIconByTag(tag){return this._iconsByTag.get(tag.toLowerCase())||null}}; + +} + +// ../lib/str/textLayout/textIcon.js +{ +'use strict';const C3=self.C3;C3.TextIcon=class TextIcon{constructor(textIconSet,opts){this._textIconSet=textIconSet;this._source=opts.source||null;this._index=opts.index;this._tag=opts.tag;this._width=opts.width;this._height=opts.height;this._drawable=null}Release(){this._width=0;this._height=0;this._textIconSet=null}GetSource(){return this._source}GetWidth(){return this._width}GetHeight(){return this._height}_SetDrawable(drawable){this._drawable=drawable}GetDrawable(){return this._drawable}}; + +} + +// ../lib/gfx/gfx.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempVec3a=vec3.create();const tempVec3b=vec3.create();const tempVec3c=vec3.create();const tempVec4=vec4.create();const tempMat4=mat4.create();const neartl=vec3.create();const neartr=vec3.create();const nearbl=vec3.create();const nearbr=vec3.create();const fartl=vec3.create();const fartr=vec3.create();const farbl=vec3.create();const farbr=vec3.create(); +const unitViewport=vec4.fromValues(0,0,1,1); +C3.Gfx={Project(objx,objy,objz,mv,proj,viewport,windowCoordinate){const fTemp0=mv[0]*objx+mv[4]*objy+mv[8]*objz+mv[12];const fTemp1=mv[1]*objx+mv[5]*objy+mv[9]*objz+mv[13];const fTemp2=mv[2]*objx+mv[6]*objy+mv[10]*objz+mv[14];const fTemp3=mv[3]*objx+mv[7]*objy+mv[11]*objz+mv[15];let fTemp4=proj[0]*fTemp0+proj[4]*fTemp1+proj[8]*fTemp2+proj[12]*fTemp3;let fTemp5=proj[1]*fTemp0+proj[5]*fTemp1+proj[9]*fTemp2+proj[13]*fTemp3;let fTemp6=proj[2]*fTemp0+proj[6]*fTemp1+proj[10]*fTemp2+proj[14]*fTemp3;let fTemp7= +proj[3]*fTemp0+proj[7]*fTemp1+proj[11]*fTemp2+proj[15]*fTemp3;if(fTemp7===0)return false;fTemp7=1/fTemp7;fTemp4*=fTemp7;fTemp5*=fTemp7;fTemp6*=fTemp7;windowCoordinate[0]=(fTemp4*.5+.5)*viewport[2]+viewport[0];windowCoordinate[1]=(fTemp5*.5+.5)*viewport[3]+viewport[1];windowCoordinate[2]=(1+fTemp6)*.5;return true},Unproject(winx,winy,winz,mv,proj,viewport,objectCoordinate){const A=tempMat4;const vec=tempVec4;mat4.multiply(A,proj,mv);if(mat4.invert(A,A)===null)return false;vec[0]=(winx-viewport[0])/ +viewport[2]*2-1;vec[1]=(winy-viewport[1])/viewport[3]*2-1;vec[2]=2*winz-1;vec[3]=1;vec4.transformMat4(vec,vec,A);if(vec[3]===0)return false;vec[3]=1/vec[3];objectCoordinate[0]=vec[0]*vec[3];objectCoordinate[1]=vec[1]*vec[3];objectCoordinate[2]=vec[2]*vec[3];return true},UnprojectScreenToWorldZ(winx,winy,worldZ,mv,proj,viewport,objectCoordinate){const nearPt=tempVec3a;const farPt=tempVec3b;if(!C3.Gfx.Unproject(winx,winy,0,mv,proj,viewport,nearPt))return false;if(!C3.Gfx.Unproject(winx,winy,1,mv,proj, +viewport,farPt))return false;const dirVec=tempVec3b;vec3.subtract(dirVec,farPt,nearPt);const planeNormal=tempVec3c;vec3.set(planeNormal,0,0,1);const planeConstant=-worldZ;const denominator=vec3.dot(planeNormal,dirVec);let distance=0;if(denominator===0){const planeDistToPt=vec3.dot(planeNormal,nearPt)+planeConstant;if(planeDistToPt!==0)return false}else{distance=-(vec3.dot(nearPt,planeNormal)+planeConstant)/denominator;if(distance<0)return false}vec3.scaleAndAdd(objectCoordinate,nearPt,dirVec,distance); +return true}};function PlaneFromPoints(ptA,ptB,ptC,plane){const normal=tempVec3c;vec3.subtract(tempVec3a,ptC,ptB);vec3.subtract(tempVec3b,ptA,ptB);vec3.cross(normal,tempVec3a,tempVec3b);vec3.normalize(normal,normal);plane.set(normal[0],normal[1],normal[2],vec3.dot(ptA,normal))} +function IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const nxT=plane.xF;const nyT=plane.yF;const nzT=plane.zF;const nxF=1-nxT;const nyF=1-nyT;const nzF=1-nzT;const minD=nx*minX*nxT+nx*maxX*nxF+ny*minY*nyT+ny*maxY*nyF+nz*minZ*nzT+nz*maxZ*nzF;if(minD>=d)return true;const maxD=nx*maxX*nxT+nx*minX*nxF+ny*maxY*nyT+ny*minY*nyF+nz*maxZ*nzT+nz*minZ*nzF;return maxD>d} +function IsPointInFrontOfPlane(x,y,z,plane){const nx=plane.x;const ny=plane.y;const nz=plane.z;const d=plane.w;const minD=nx*x+ny*y+nz*z;return minD>=d}class Plane{constructor(){this.x=NaN;this.y=NaN;this.z=NaN;this.w=NaN;this.xF=NaN;this.yF=NaN;this.zF=NaN}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;this.xF=x>0?1:0;this.yF=y>0?1:0;this.zF=z>0?1:0}} +C3.Gfx.ViewFrustum=class ViewFrustum{constructor(){this._leftP=new Plane;this._topP=new Plane;this._rightP=new Plane;this._bottomP=new Plane;this._nearP=new Plane;this._farP=new Plane}CalculatePlanes(mv,proj){const vp=unitViewport;C3.Gfx.Unproject(0,1,0,mv,proj,vp,neartl);C3.Gfx.Unproject(1,1,0,mv,proj,vp,neartr);C3.Gfx.Unproject(0,0,0,mv,proj,vp,nearbl);C3.Gfx.Unproject(1,0,0,mv,proj,vp,nearbr);C3.Gfx.Unproject(0,1,1,mv,proj,vp,fartl);C3.Gfx.Unproject(1,1,1,mv,proj,vp,fartr);C3.Gfx.Unproject(0,0, +1,mv,proj,vp,farbl);C3.Gfx.Unproject(1,0,1,mv,proj,vp,farbr);PlaneFromPoints(nearbl,neartl,fartl,this._leftP);PlaneFromPoints(neartl,neartr,fartr,this._topP);PlaneFromPoints(neartr,nearbr,farbr,this._rightP);PlaneFromPoints(nearbr,nearbl,farbl,this._bottomP);PlaneFromPoints(farbl,fartl,fartr,this._farP);PlaneFromPoints(nearbr,neartr,neartl,this._nearP)}ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ){return IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._leftP)&&IsInFrontOfPlane(minX,minY,minZ,maxX, +maxY,maxZ,this._topP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._rightP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._bottomP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._nearP)&&IsInFrontOfPlane(minX,minY,minZ,maxX,maxY,maxZ,this._farP)}IsBehindNearPlane(x,y,z){return!IsPointInFrontOfPlane(x,y,z,this._nearP)}}; + +} + +// ../lib/gfx/rendererBase.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tmpVec3a=vec3.fromValues(0,0,0);const tmpVec3b=vec3.fromValues(0,0,0);const tmpVec3c=vec3.fromValues(0,0,0);const defaultUpVector=vec3.fromValues(0,1,0);const tmpVec4=vec4.fromValues(0,0,0,0);const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1); +const DEFAULT_RENDERERBASE_OPTS={nearZ:1,farZ:1E4}; +C3.Gfx.RendererBase=class RendererBase{constructor(opts){opts=Object.assign({},DEFAULT_RENDERERBASE_OPTS,opts);this._width=0;this._height=0;this._fovY=C3.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=mat4.create();this._matMV=mat4.create();this._zAxisScale=false;this._nearZ=opts.nearZ;this._farZ=opts.farZ;this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._spPoints=null;this._spTilemapFill=null;this._spTileRandomization=null;this._spColorFill= +null;this._spLinearGradientFill=null;this._spPenumbraFill=null;this._spHardEllipseFill=null;this._spHardEllipseOutline=null;this._spSmoothEllipseFill=null;this._spSmoothEllipseOutline=null;this._spSmoothLineFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._baseZ=0;this._currentZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack= +[this._lineOffset];this._frameNumber=0;this._enableMipmaps=true;this._hasMajorPerformanceCaveat=false}FillIndexBufferData(indexData){let i=0,len=indexData.length,fv=0;while(i=100)throw new Error("pushed too many line widths - check push/pop pairs"); +this._lineWidthStack.push(n);this._lineWidth=n}PopLineWidth(){if(this._lineWidthStack.length<=1)throw new Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(type){if(type=== +"butt")this.PushLineCapButt();else if(type==="square")this.PushLineCapSquare();else if(type==="zag")this.PushLineCapZag();else throw new Error("invalid line cap");}PushLineCapButt(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(this._lineCapStack.length>=100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(this._lineCapStack.length>= +100)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(this._lineCapStack.length<=1)throw new Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(n){this._lineOffset=n;this._lineOffsetStack[this._lineOffsetStack.length-1]=n}GetLineOffset(){return this._lineOffset}PushLineOffset(n){if(this._lineOffsetStack.length>=100)throw new Error("pushed too many line offsets - check push/pop pairs"); +this._lineOffsetStack.push(n);this._lineOffset=n}PopLineOffset(){if(this._lineOffsetStack.length<=1)throw new Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(pts){const pts_count=pts.length/2;if(pts_count<3)throw new Error("need at least 3 points");const tris=pts_count-2;const last_tri=tris-1;const p0x=pts[0];const p0y=pts[1];for(let i=0;i0)throw new Error("releasing state group still in use"); +this._renderer=null;this._shaderProgram=null;this._shaderProgramName=""}Apply(){const renderer=this._renderer;renderer.SetProgram(this._shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetColor(this._color);renderer.SetCurrentZ(this._zElevation);renderer._SetCurrentStateGroup(this)}GetKey(){return C3.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram= +null}OnContextRestored(renderer){this._shaderProgram=renderer.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw new Error("failed to restore shader program");}static MakeKey(shaderProgram_or_name,blendMode,c,zElevation){const shaderProgramName=typeof shaderProgram_or_name==="string"?shaderProgram_or_name:shaderProgram_or_name.GetName();return shaderProgramName+","+blendMode+","+c.getR()+","+c.getG()+","+c.getB()+","+c.getA()+","+zElevation}}; + +} + +// ../lib/gfx/mesh.js +{ +'use strict';const C3=self.C3;const tempQuadTex=C3.New(C3.Quad);function interpolateQuad(srcX,srcY,quad){const qtlx=quad.getTlx();const qtly=quad.getTly();const qtrx=quad.getTrx()-qtlx;const qtry=quad.getTry()-qtly;const qblx=quad.getBlx()-qtlx;const qbly=quad.getBly()-qtly;const xix=qtrx*srcX;const xiy=qtry*srcX;const yix=qblx*srcY;const yiy=qbly*srcY;return[qtlx+xix+yix,qtly+xiy+yiy]} +C3.Gfx.MeshPoint=class MeshPoint{constructor(mesh,col,row){this._mesh=mesh;this._col=col;this._row=row;this._x=NaN;this._y=NaN;this._zElevation=NaN;this._u=NaN;this._v=NaN;this._x=0;this._y=0;this._zElevation=0;this._u=0;this._v=0}_Init(x,y,u,v){this._x=x;this._y=y;this._u=u;this._v=v}GetX(){return this._x}SetX(x){if(this._x===x)return;this._x=x;this._mesh._SetPointsChanged()}GetY(){return this._y}SetY(y){if(this._y===y)return;this._y=y;this._mesh._SetPointsChanged()}GetZElevation(){return this._zElevation}SetZElevation(z){if(this._zElevation=== +z)return;this._zElevation=Math.max(z,0);this._mesh._SetPointsChanged()}GetU(){return this._u}SetU(u){this._u=u}GetV(){return this._v}SetV(v){this._v=v}_Interpolate_TexRect(srcPoint,quadPos,rcTex){[this._x,this._y]=interpolateQuad(srcPoint._x,srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;this._u=C3.lerp(rcTex.getLeft(),rcTex.getRight(),srcPoint._u);this._v=C3.lerp(rcTex.getTop(),rcTex.getBottom(),srcPoint._v)}_Interpolate_TexQuad(srcPoint,quadPos,quadTex){[this._x,this._y]=interpolateQuad(srcPoint._x, +srcPoint._y,quadPos);this._zElevation=srcPoint._zElevation;[this._u,this._v]=interpolateQuad(srcPoint._u,srcPoint._v,quadTex)}SaveToJson(){return{"x":this.GetX(),"y":this.GetY(),"z":this.GetZElevation(),"u":this.GetU(),"v":this.GetV()}}LoadFromJson(o){this.SetX(o["x"]);this.SetY(o["y"]);if(o.hasOwnProperty("z"))this.SetZElevation(o["z"]);this.SetU(o["u"]);this.SetV(o["v"])}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}}; +C3.Gfx.Mesh=class Mesh{constructor(hsize,vsize,owner){if(hsize<2||vsize<2)throw new Error("invalid mesh size");this._hsize=hsize;this._vsize=vsize;this._owner=owner||null;this._pts=[];this._minX=0;this._minY=0;this._maxX=1;this._maxY=1;this._maxZ=0;this._pointsChanged=false;const lastX=hsize-1;const lastY=vsize-1;for(let y=0;y0}GetMeshPointAt(x,y){x=Math.floor(x);y=Math.floor(y);if(x<0||x>=this._hsize||y<0||y>=this._vsize)return null;return this._pts[y][x]}CalculateTransformedMesh(srcMesh,quadPos,rcTex_or_quad){const isTexRect=rcTex_or_quad instanceof +C3.Rect;if(srcMesh.GetHSize()!==this.GetHSize()||srcMesh.GetVSize()!==this.GetVSize())throw new Error("source mesh wrong size");const srcPts=srcMesh._pts;const destPts=this._pts;for(let y=0,lenY=destPts.length;y[x,y,z];const pts=this._pts;let prevRow=pts[0];for(let y=1,lenY=pts.length;y{curX=C3.clamp(C3.lerp(curX,nextX,rayHit),0,1);curY=C3.clamp(C3.lerp(curY,nextY,rayHit),0,1);outPts.push(curX,curY)};for(let i=0,len=inPts.length;i1E6)throw new Error("Too many mesh poly points"); +const srcTlx=curCol*colWidthNorm;const srcTly=curRow*rowHeightNorm;const srcBrx=(curCol+1)*colWidthNorm;const srcBry=(curRow+1)*rowHeightNorm;isUpper=C3.isPointInTriangleInclusive(curX,curY,srcTlx,srcTly,srcBrx,srcTly,srcBrx,srcBry);if(disableCheck!==DISABLE_DIAGONAL){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcBry,-RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();isUpper=!isUpper;disableCheck=DISABLE_DIAGONAL;continue}}if(curRow>0&& +disableCheck!==DISABLE_TOP_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcBrx,srcTly,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curRow--;isUpper=false;disableCheck=DISABLE_BOTTOM_EDGE;continue}}if(curCol=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol++;isUpper=false;disableCheck= +DISABLE_LEFT_EDGE;continue}}if(curCol>0&&disableCheck!==DISABLE_LEFT_EDGE){rayHit=C3.rayIntersectExtended(curX,curY,nextX,nextY,srcTlx,srcTly,srcTlx,srcBry,RAY_EXT_DIST);if(rayHit>=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit();curCol--;isUpper=true;disableCheck=DISABLE_RIGHT_EDGE;continue}}if(curRow=MIN_RAY_DIST&&rayHit<=MAX_RAY_DIST){addVertexAtRayHit(); +curRow++;isUpper=true;disableCheck=DISABLE_TOP_EDGE;continue}}break}}return C3.New(C3.CollisionPoly,outPts)}TransformCollisionPoly(srcPoly,destPoly){const ptsArr=this._TransformPolyPoints(srcPoly);this._SimplifyPoly(ptsArr);destPoly.setPoints(ptsArr)}_TransformPolyPoints(srcPoly){const outPts=[];const ptsArr=srcPoly.pointsArr();for(let i=0,len=ptsArr.length;iR_EPSILON||dx==0&&dy===0)outPts.push(curX,curY);curX=nextX;curY=nextY;lastDx=dx;lastDy=dy}if(outPts.length>=6&&outPts.lengthrow.map(pt=>pt.SaveToJson()))}}LoadFromJson(o){const cols=this.GetHSize();const rows= +this.GetVSize();if(o["cols"]!==cols||o["rows"]!==rows)throw new Error("mesh data wrong size");const meshRows=o["points"];for(let y=0;ymaxTextureSize||this._height>maxTextureSize)throw new Error("texture data exceeds maximum texture size");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha); +gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);if(!this._renderer.SupportsNPOTTextures()&&!isPOT&&this._IsTiled()){if(data===null)throw new Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");if(data instanceof ArrayBuffer)data=new ImageData(new Uint8ClampedArray(data),this._width,this._height);if(data instanceof ImageData){const tmpCanvas=C3.CreateCanvas(this._width,this._height);const tmpCtx=tmpCanvas.getContext("2d"); +tmpCtx.putImageData(data,0,0);data=tmpCanvas}const canvas=C3.CreateCanvas(C3.nextHighestPowerOfTwo(this._width),C3.nextHighestPowerOfTwo(this._height));const ctx=canvas.getContext("2d");ctx.imageSmoothingEnabled=this._sampling!=="nearest";ctx.drawImage(data,0,0,this._width,this._height,0,0,canvas.width,canvas.height);gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,canvas)}else if(webglVersion>=2){let levels;if(this._isMipMapped)levels=Math.floor(Math.log2(Math.max(this._width, +this._height))+1);else levels=1;gl.texStorage2D(gl.TEXTURE_2D,levels,formatspec.sizedinternalformat,this._width,this._height);if(data instanceof ArrayBuffer)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this._width,this._height,formatspec.format,formatspec.type,new Uint8Array(data));else if(data!==null)gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data)}else if(data instanceof ArrayBuffer)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format, +formatspec.type,new Uint8Array(data));else if(data===null)gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);else gl.texImage2D(gl.TEXTURE_2D,0,formatspec.internalformat,formatspec.format,formatspec.type,data);if(data!==null)this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_CreateDynamic(width,height,opts){opts=Object.assign({},CREATEFROM_DEFAULT_OPTIONS, +opts);if(this._texture)throw new Error("already created texture");this._wrapX=opts.wrapX;this._wrapY=opts.wrapY;this._sampling=opts.sampling;this._pixelFormat=opts.pixelFormat;this._isMipMapped=!!opts.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=opts.mipMapQuality;if(!VALID_WRAP_MODES.has(this._wrapX)||!VALID_WRAP_MODES.has(this._wrapY))throw new Error("invalid wrap mode");if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(!VALID_PIXEL_FORMATS.has(this._pixelFormat))throw new Error("invalid pixel format"); +if(!VALID_MIPMAP_QUALITIES.has(this._mipMapQuality))throw new Error("invalid mipmap quality");this._isStatic=false;this._width=Math.floor(width);this._height=Math.floor(height);const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);const maxTextureSize=this._renderer.GetMaxTextureSize();if(this._width<=0||this._height<=0)throw new Error("invalid texture size");if(this._width>maxTextureSize||this._height>maxTextureSize)throw new Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&& +this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");const gl=this._renderer.GetContext();const webglVersion=this._renderer.GetWebGLVersionNumber();this._texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],false);const formatspec=GetFormatSpecifiers(this._pixelFormat,gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat: +formatspec.internalformat;gl.texImage2D(gl.TEXTURE_2D,0,internalformat,this._width,this._height,0,formatspec.format,formatspec.type,null);this._SetTextureParameters(gl);gl.bindTexture(gl.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;allTextures.add(this)}_GetMipMapHint(gl){if(this._mipMapQuality==="default")return this._isStatic?gl.NICEST:gl.FASTEST;else if(this._mipMapQuality==="low")return gl.FASTEST;else if(this._mipMapQuality==="high")return gl.NICEST;else throw new Error("invalid mipmap quality"); +}_IsTiled(){return this._wrapX!=="clamp-to-edge"||this._wrapY!=="clamp-to-edge"}_GetTextureWrapMode(gl,wrapMode){if(wrapMode==="clamp-to-edge")return gl.CLAMP_TO_EDGE;else if(wrapMode==="repeat")return gl.REPEAT;else if(wrapMode==="mirror-repeat")return gl.MIRRORED_REPEAT;else throw new Error("invalid wrap mode");}_SetTextureParameters(gl){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._GetTextureWrapMode(gl,this._wrapX));gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_WRAP_T,this._GetTextureWrapMode(gl,this._wrapY));if(this._sampling==="nearest"){gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);this._isMipMapped=false}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D);const useTrilinear=this._sampling=== +"trilinear"&&!this._renderer.HasMajorPerformanceCaveat();gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,useTrilinear?gl.LINEAR_MIPMAP_LINEAR:gl.LINEAR_MIPMAP_NEAREST)}else{gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);this._isMipMapped=false}}const anisotropicExt=this._renderer._GetAnisotropicExtension();if(anisotropicExt&&this._anisotropy>0&&this._sampling!=="nearest")gl.texParameterf(gl.TEXTURE_2D,anisotropicExt["TEXTURE_MAX_ANISOTROPY_EXT"],Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(data, +opts){if((typeof HTMLImageElement==="undefined"||!(data instanceof HTMLImageElement))&&(typeof HTMLVideoElement==="undefined"||!(data instanceof HTMLVideoElement))&&(typeof HTMLCanvasElement==="undefined"||!(data instanceof HTMLCanvasElement))&&(typeof ImageBitmap==="undefined"||!(data instanceof ImageBitmap))&&(typeof OffscreenCanvas==="undefined"||!(data instanceof OffscreenCanvas))&&!(data instanceof ImageData))throw new Error("invalid texture source");if(!this._texture||this._refCount<=0)throw new Error("texture not created"); +if(this._isStatic)throw new Error("cannot update static texture");opts=Object.assign({},UPDATE_DEFAULT_OPTIONS,opts);const dataWidth=data.width||data.videoWidth;const dataHeight=data.height||data.videoHeight;const webglVersion=this._renderer.GetWebGLVersionNumber();const gl=this._renderer.GetContext();gl.bindTexture(gl.TEXTURE_2D,this._texture);gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],opts.premultiplyAlpha);gl.pixelStorei(gl["UNPACK_FLIP_Y_WEBGL"],!!opts.flipY);const formatspec=GetFormatSpecifiers(this._pixelFormat, +gl);const internalformat=webglVersion>=2?formatspec.sizedinternalformat:formatspec.internalformat;try{if(this._width===dataWidth&&this._height===dataHeight){const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}else{this._width=dataWidth;this._height=dataHeight; +const isPOT=C3.isPOT(this._width)&&C3.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!isPOT)throw new Error("non-power-of-two tiled textures not supported");gl.texImage2D(gl.TEXTURE_2D,0,internalformat,formatspec.format,formatspec.type,data);if((isPOT||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){gl.hint(gl.GENERATE_MIPMAP_HINT,this._GetMipMapHint(gl));gl.generateMipmap(gl.TEXTURE_2D)}}}catch(e){console.error("Error updating WebGL texture: ",e)}gl.bindTexture(gl.TEXTURE_2D, +null);this._renderer._ResetLastTexture()}_Delete(){if(this._refCount>0)throw new Error("texture still has references");if(!this._texture)throw new Error("already deleted texture");allTextures.delete(this);const gl=this._renderer.GetContext();gl.deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(this._refCount<=0)throw new Error("no more references"); +this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let size=this._width*this._height;switch(this._pixelFormat){case "rgba8":size*=4;break;case "rgb8":size*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":size*=2;break}if(this._isMipMapped)size+=Math.floor(size/3);return size}static OnContextLost(){allTextures.clear()}static allTextures(){return allTextures.values()}}; + +} + +// ../lib/gfx/webgl/renderTarget.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4;const VALID_SAMPLINGS=new Set(["nearest","bilinear","trilinear"]);const DEFAULT_RENDERTARGET_OPTIONS={sampling:"trilinear",alpha:true,depth:false,isSampled:true,isDefaultSize:true,multisampling:0};const allRenderTargets=new Set; +C3.Gfx.WebGLRenderTarget=class WebGLRenderTarget{constructor(renderer){this._renderer=renderer;this._frameBuffer=null;this._frameBufferNoDepth=null;this._texture=null;this._renderBuffer=null;this._width=0;this._height=0;this._isDefaultSize=true;this._sampling="trilinear";this._alpha=true;this._depth=false;this._isSampled=true;this._multisampling=0;this._projectionMatrix=mat4.create();this._lastFov=0;this._lastNearZ=0;this._lastFarZ=0}_Create(width,height,opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS, +opts);const webGLVersion=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw new Error("already created render target");this._sampling=opts.sampling;this._alpha=!!opts.alpha;this._depth=!!opts.depth;this._isSampled=!!opts.isSampled;this._isDefaultSize=!!opts.isDefaultSize;this._multisampling=opts.multisampling;if(!VALID_SAMPLINGS.has(this._sampling))throw new Error("invalid sampling");if(this._multisampling>0&&(webGLVersion<2||this._isSampled))throw new Error("invalid use of multisampling"); +if(webGLVersion<2)this._isSampled=true;this._width=width;this._height=height;if(this._width<=0||this._height<=0)throw new Error("invalid render target size");this._CalculateProjection();const gl=this._renderer.GetContext();this._frameBuffer=gl.createFramebuffer();if(this._depth)this._frameBufferNoDepth=gl.createFramebuffer();if(this._isSampled){this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:false}); +const tex=this._texture._GetTexture();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex,0)}}else{this._renderBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);const internalFormat=this._alpha?gl.RGBA8:gl.RGB8;if(this._multisampling> +0){const formatSamples=gl.getInternalformatParameter(gl.RENDERBUFFER,internalFormat,gl.SAMPLES);if(formatSamples&&formatSamples[0]){const maxSamples=formatSamples[0];if(this._multisampling>maxSamples)this._multisampling=maxSamples}else this._multisampling=0}if(this._multisampling===0)gl.renderbufferStorage(gl.RENDERBUFFER,internalFormat,this._width,this._height);else gl.renderbufferStorageMultisample(gl.RENDERBUFFER,this._multisampling,internalFormat,this._width,this._height);gl.bindFramebuffer(gl.FRAMEBUFFER, +this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,this._renderBuffer)}gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,rendererDepthBuffer)}gl.bindFramebuffer(gl.FRAMEBUFFER,null);allRenderTargets.add(this)}_Resize(width,height){if(this._width===width&&this._height===height)return;this._width=width;this._height=height;this._CalculateProjection();const gl=this._renderer.GetContext();gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);if(this._texture)this._texture._Update(new ImageData(this._width, +this._height));else{gl.bindRenderbuffer(gl.RENDERBUFFER,this._renderBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._alpha?gl.RGBA8:gl.RGB8,this._width,this._height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}const rendererDepthBuffer=this._renderer._GetDepthBuffer();if(this._depth&&rendererDepthBuffer)if(this._renderer._CanSampleDepth())gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.TEXTURE_2D,rendererDepthBuffer,0);else gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT, +gl.RENDERBUFFER,rendererDepthBuffer);gl.bindFramebuffer(gl.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw new Error("already deleted render target");allRenderTargets.delete(this);const gl=this._renderer.GetContext();if(this._texture){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferTexture2D(gl.FRAMEBUFFER, +gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,null,0)}this._renderer.DeleteTexture(this._texture);this._texture=null}else if(this._renderBuffer){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBuffer);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null);if(this._depth){gl.bindFramebuffer(gl.FRAMEBUFFER,this._frameBufferNoDepth);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,null)}gl.deleteRenderbuffer(this._renderBuffer);this._renderBuffer=null}gl.bindFramebuffer(gl.FRAMEBUFFER, +null);if(this._renderer.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,null)}gl.deleteFramebuffer(this._frameBuffer);if(this._depth)gl.deleteFramebuffer(this._frameBufferNoDepth);const batchState=this._renderer.GetBatchState();batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;this._frameBuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height); +this._lastFov=this._renderer.GetFovY();this._lastNearZ=this._renderer.GetNearZ();this._lastFarZ=this._renderer.GetFarZ()}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){if(this._renderer.GetFovY()!==this._lastFov||this._renderer.GetNearZ()!==this._lastNearZ||this._renderer.GetFarZ()!==this._lastFarZ)this._CalculateProjection();return this._projectionMatrix}IsLinearSampling(){return this._sampling!== +"nearest"}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const ret={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};if(!this._isDefaultSize){ret.width=this._width;ret.height=this._height}return ret}IsCompatibleWithOptions(opts){opts=Object.assign({},DEFAULT_RENDERTARGET_OPTIONS, +opts);if(opts.sampling!=="nearest"!==this.IsLinearSampling())return false;if(!!opts.alpha!==this.HasAlpha())return false;if(!!opts.depth!==this.HasDepthBuffer())return false;if(this._renderer.GetWebGLVersionNumber()>=2)if(!!opts.isSampled!==this.IsSampled())return false;if(typeof opts.width==="number"||typeof opts.height==="number")return!this.IsDefaultSize()&&this.GetWidth()===opts.width&&this.GetHeight()===opts.height;else return this.IsDefaultSize()}_GetWebGLTexture(){if(!this._texture)return null; +return this._texture._GetTexture()}GetEstimatedMemoryUsage(){if(this._texture)return this._texture.GetEstimatedMemoryUsage();return this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(renderer,renderTarget){const imageData=await renderer.ReadBackRenderTargetToImageData(renderTarget,true);return await C3.ImageDataToBlob(imageData)}static OnContextLost(){allRenderTargets.clear()}static allRenderTargets(){return allRenderTargets.values()}static ResizeAll(width,height){for(const rt of allRenderTargets)if(rt.IsDefaultSize())rt._Resize(width, +height)}}; + +} + +// ../lib/gfx/webgl/shaderProgram.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const mat4=glMatrix.mat4; +const RESERVED_UNIFORM_NAMES=new Set(["aPos","aTex","aPoints","matP","matMV","samplerFront","samplerBack","samplerDepth","destStart","destEnd","srcStart","srcEnd","srcOriginStart","srcOriginEnd","pixelSize","seconds","devicePixelRatio","layerScale","layerAngle","layoutStart","layoutEnd","color","color2_","pointTexStart","pointTexEnd","zElevation","tileSize","tileSpacing","outlineThickness","zNear","zFar"]); +C3.Gfx.WebGLShaderProgram=class WebGLShaderProgram extends C3.Gfx.ShaderProgramBase{static async Compile(renderer,shaderInfo){const gl=renderer.GetContext();const fragSrc=shaderInfo.src;const vertexSrc=shaderInfo.vertexSrc;const name=shaderInfo.name;const fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fragmentShader,fragSrc);gl.compileShader(fragmentShader);const vertexShader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vertexShader,vertexSrc);gl.compileShader(vertexShader); +const shaderProgram=gl.createProgram();gl.attachShader(shaderProgram,fragmentShader);gl.attachShader(shaderProgram,vertexShader);gl.bindAttribLocation(shaderProgram,0,"aPos");gl.bindAttribLocation(shaderProgram,1,"aTex");gl.bindAttribLocation(shaderProgram,2,"aPoints");gl.linkProgram(shaderProgram);const parallelShaderCompileExt=renderer._GetParallelShaderCompileExtension();if(parallelShaderCompileExt)await renderer._WaitForObjectReady(()=>gl.getProgramParameter(shaderProgram,parallelShaderCompileExt["COMPLETION_STATUS_KHR"])); +else await C3.Wait(5);if(!gl.getShaderParameter(fragmentShader,gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(fragmentShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling fragment shader: "+log);}if(!gl.getShaderParameter(vertexShader,gl.COMPILE_STATUS)){const log=gl.getShaderInfoLog(vertexShader);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error compiling vertex shader: "+ +log);}if(!gl.getProgramParameter(shaderProgram,gl.LINK_STATUS)){const log=gl.getProgramInfoLog(shaderProgram);gl.deleteShader(fragmentShader);gl.deleteShader(vertexShader);gl.deleteProgram(shaderProgram);throw new Error("Error linking shader program: "+log);}const infoLog=C3.FilterUnprintableChars(gl.getProgramInfoLog(shaderProgram)||"").trim();if(infoLog&&!C3.IsStringAllWhitespace(infoLog))console.info(`[WebGL] Shader program '${name}' compilation log: `,infoLog);gl.deleteShader(fragmentShader); +gl.deleteShader(vertexShader);return shaderProgram}static async Create(renderer,shaderInfo){const shaderProgram=await C3.Gfx.WebGLShaderProgram.Compile(renderer,shaderInfo);return new C3.Gfx.WebGLShaderProgram(renderer,shaderProgram,shaderInfo)}constructor(renderer,shaderProgram,shaderInfo){super(renderer,shaderInfo);const gl=renderer.GetContext();const batchState=renderer.GetBatchState();renderer.EndBatch();gl.useProgram(shaderProgram);this._gl=gl;this._shaderProgram=shaderProgram;this._isDeviceTransform= +shaderInfo.name==="";const locAPos=gl.getAttribLocation(shaderProgram,"aPos");const locATex=gl.getAttribLocation(shaderProgram,"aTex");this._locAPoints=gl.getAttribLocation(shaderProgram,"aPoints");if(locAPos!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._vertexBuffer);gl.vertexAttribPointer(locAPos,renderer.GetNumVertexComponents(),gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locAPos)}if(locATex!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._texcoordBuffer);gl.vertexAttribPointer(locATex, +2,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(locATex)}if(this._locAPoints!==-1){gl.bindBuffer(gl.ARRAY_BUFFER,renderer._pointBuffer);gl.vertexAttribPointer(this._locAPoints,4,gl.FLOAT,false,0,0);gl.enableVertexAttribArray(this._locAPoints)}gl.bindBuffer(gl.ARRAY_BUFFER,null);this._uMatP=new C3.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new C3.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new C3.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new C3.Gfx.WebGLShaderUniform(this, +"samplerFront","sampler");this._uPointTexStart=new C3.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new C3.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new C3.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new C3.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new C3.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new C3.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new C3.Gfx.WebGLShaderUniform(this, +"outlineThickness","float");this._uSamplerBack=new C3.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uSamplerDepth=new C3.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new C3.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new C3.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new C3.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new C3.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new C3.Gfx.WebGLShaderUniform(this, +"srcOriginStart","vec2");this._uSrcOriginEnd=new C3.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new C3.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new C3.Gfx.WebGLShaderUniform(this,"seconds","float");this._uDevicePixelRatio=new C3.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new C3.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new C3.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new C3.Gfx.WebGLShaderUniform(this, +"layoutStart","vec2");this._uLayoutEnd=new C3.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._uZNear=new C3.Gfx.WebGLShaderUniform(this,"zNear","float");this._uZFar=new C3.Gfx.WebGLShaderUniform(this,"zFar","float");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uDevicePixelRatio.IsUsed()|| +this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());const customParameterDefs=shaderInfo.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._hasCurrentMatP=false;this._hasCurrentMatMV=false;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0); +this._uSamplerBack.Init1i(1);this._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uZNear.Init1f(renderer.GetNearZ());this._uZFar.Init1f(renderer.GetFarZ()); +this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const p of customParameterDefs){const uniformName=p[0];const paramType=p[2];const shaderUniform=new C3.Gfx.WebGLShaderUniform(this,uniformName,paramType);if(paramType==="color")shaderUniform.Init3f(0,0,0);else shaderUniform.Init1f(0);this._uCustomParameters.push(shaderUniform)}if(this._isDeviceTransform)this._UpdateDeviceTransformUniforms(batchState.currentMatP); +else{this.UpdateMatP(batchState.currentMatP,true);this.UpdateMatMV(batchState.currentMV,true)}const currentShader=batchState.currentShader;gl.useProgram(currentShader?currentShader._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(paramIndex){if(paramIndex< +0||paramIndex>=this._uCustomParameters.length)return null;return this._uCustomParameters[paramIndex].GetType()}AreCustomParametersAlreadySetInBatch(params){for(let i=0,len=params.length;i=2)prefix="#version 300 es\n";else{if(hasFragDepthExt)prefix="#extension GL_EXT_frag_depth : enable\n";if(useDerivatives){prefix+="#extension GL_EXT_shader_texture_lod : enable\n";prefix+="#extension GL_OES_standard_derivatives : enable\n"}}return prefix+ +` +#ifdef GL_FRAGMENT_PRECISION_HIGH +#define highmedp highp +#else +#define highmedp mediump +#endif +precision highmedp float; +${webGLVer>=2?"in":"varying"} vec2 vTex; +${webGLVer>=2?"out lowp vec4 outColor;":""} +uniform lowp vec4 color; +uniform lowp sampler2D samplerFront; +uniform vec2 pixelSize; + +uniform vec2 tileSize; +uniform vec2 tileSpacing; +uniform float outlineThickness; + +const float PI = 3.1415926; + +lowp vec4 cospVec4(lowp vec4 a, lowp vec4 b, float x) +{ + return (a + b + (a - b) * cos(x * PI)) / 2.0; +} + +vec3 randVec3(vec2 seed) +{ + return vec3(fract(sin(dot(seed.xy + vec2(0.1, 0.1), vec2(12.9898,78.233))) * 43758.5453), + fract(sin(dot(seed.yx + vec2(0.1, 0.1), vec2(12.9898,-78.233))) * 43758.5453), + fract(sin(dot(seed.xy + vec2(0.1, 0.1), vec2(-12.9898,-78.233))) * 43758.5453)); +} + +lowp vec4 sampleTile(vec2 tile, vec2 uv, vec2 ddx, vec2 ddy) +{ + vec2 posRandom = tileSize; + float angleRandom = outlineThickness; + + vec3 rand = (randVec3(floor(tile + 0.5)) - 0.5) * 2.0; + + float angle = angleRandom * rand.z * PI; + float sin_a = sin(angle); + float cos_a = cos(angle); + float aspect = pixelSize.x / pixelSize.y; + + vec2 mid = tile + vec2(0.5, 0.5); + vec2 dp = uv - mid; + dp.x /= aspect; + vec2 r = vec2(dp.x * cos_a - dp.y * sin_a, + dp.y * cos_a + dp.x * sin_a); + r.x *= aspect; + + vec2 p = mid + r + (posRandom * rand.xy / 2.0); + + ${webGLVer>=2?"return textureGrad(samplerFront, p, ddx, ddy);":""} + ${webGLVer<2&&useDerivatives?"return texture2DGradEXT(samplerFront, p, ddx, ddy);":""} + ${webGLVer<2&&!useDerivatives?"return texture2D(samplerFront, p);":""} +} + +void main(void) { + + ${webGLVer<2?"lowp vec4 outColor;":""} + + float blendMarginX = tileSpacing.x; + float blendMarginY = tileSpacing.y; + + vec2 tile = floor(vTex); + vec2 tex = fract(vTex); + vec2 ddx = ${webGLVer>=2||useDerivatives?"dFdx(vTex)":"vec2(0.0, 0.0)"}; + vec2 ddy = ${webGLVer>=2||useDerivatives?"dFdy(vTex)":"vec2(0.0, 0.0)"}; + + vec4 curTile = sampleTile(tile, vTex, ddx, ddy); + + bool inLeftMargin = (tex.x < blendMarginX); + bool inRightMargin = (tex.x > 1.0 - blendMarginX); + bool inTopMargin = (tex.y < blendMarginY); + bool inBottomMargin = (tex.y > 1.0 - blendMarginY); + + if (inLeftMargin) + { + lowp vec4 leftTile = sampleTile(tile + vec2(-1.0, 0.0), vTex, ddx, ddy); + float leftMix = (tex.x / (blendMarginX * 2.0)) + 0.5; + lowp vec4 leftMixedTile = cospVec4(leftTile, curTile, leftMix); + + if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + lowp vec4 topLeftTile = sampleTile(tile + vec2(-1.0, -1.0), vTex, ddx, ddy); + lowp vec4 topLeftMixedTile = cospVec4(topLeftTile, topTile, leftMix); + + outColor = cospVec4(topLeftMixedTile, leftMixedTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomLeftTile = sampleTile(tile + vec2(-1.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomLeftMixedTile = cospVec4(bottomLeftTile, bottomTile, leftMix); + + outColor = cospVec4(leftMixedTile, bottomLeftMixedTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = leftMixedTile; + } + } + else if (inRightMargin) + { + lowp vec4 rightTile = sampleTile(tile + vec2(1.0, 0.0), vTex, ddx, ddy); + float rightMix = (tex.x - (1.0 - blendMarginX)) / (blendMarginX * 2.0); + lowp vec4 rightMixedTile = cospVec4(curTile, rightTile, rightMix); + + if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + lowp vec4 topRightTile = sampleTile(tile + vec2(1.0, -1.0), vTex, ddx, ddy); + lowp vec4 topRightMixedTile = cospVec4(topTile, topRightTile, rightMix); + + outColor = cospVec4(topRightMixedTile, rightMixedTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomRightTile = sampleTile(tile + vec2(1.0, 1.0), vTex, ddx, ddy); + lowp vec4 bottomRightMixedTile = cospVec4(bottomTile, bottomRightTile, rightMix); + + outColor = cospVec4(rightMixedTile, bottomRightMixedTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = rightMixedTile; + } + } + else if (inTopMargin) + { + lowp vec4 topTile = sampleTile(tile + vec2(0.0, -1.0), vTex, ddx, ddy); + outColor = cospVec4(topTile, curTile, (tex.y / (blendMarginY * 2.0)) + 0.5); + } + else if (inBottomMargin) + { + lowp vec4 bottomTile = sampleTile(tile + vec2(0.0, 1.0), vTex, ddx, ddy); + outColor = cospVec4(curTile, bottomTile, (tex.y - (1.0 - blendMarginY)) / (blendMarginY * 2.0)); + } + else + { + outColor = curTile; + } + + outColor *= color; + ${webGLVer<2?"gl_FragColor = outColor;":""} + ${webGLVer>=2?"gl_FragDepth = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);":""} + ${webGLVer<2&&hasFragDepthExt?"gl_FragDepthEXT = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);":""} +} +`}static GetPointVertexShaderSource_WebGL1(){return["attribute vec4 aPoints;","varying float pointOpacity;","uniform float zElevation;","uniform mat4 matP;","uniform mat4 matMV;","void main(void) {","\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);","\tgl_PointSize = aPoints.z;","\tpointOpacity = aPoints.w;","}"].join("\n")}static GetPointVertexShaderSource_WebGL2(){return["#version 300 es","in vec4 aPoints;","out float pointOpacity;","uniform float zElevation;","uniform mat4 matP;", +"uniform mat4 matMV;","void main(void) {","\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);","\tgl_PointSize = aPoints.z;","\tpointOpacity = aPoints.w;","}"].join("\n")}static GetPointFragmentShaderSource_WebGL1_NoFragDepth(){return["uniform lowp sampler2D samplerFront;","varying lowp float pointOpacity;","uniform mediump vec2 pointTexStart;","uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);", +"\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));","\tgl_FragColor = texture2D(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","}"].join("\n")}static GetPointFragmentShaderSource_WebGL1_FragDepthEXT(){return["#extension GL_EXT_frag_depth : enable","uniform lowp sampler2D samplerFront;","varying lowp float pointOpacity;","uniform mediump vec2 pointTexStart;", +"uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);","\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));","\tgl_FragColor = texture2D(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","\tgl_FragDepthEXT = (gl_FragColor.a == 0.0 ? 1.0 : gl_FragCoord.z);", +"}"].join("\n")}static GetPointFragmentShaderSource_WebGL2(){return["#version 300 es","uniform lowp sampler2D samplerFront;","in lowp float pointOpacity;","uniform mediump vec2 pointTexStart;","uniform mediump vec2 pointTexEnd;","uniform lowp vec4 color;","out lowp vec4 outColor;","void main(void) {","\tmediump vec2 pointTexMin = min(pointTexStart, pointTexEnd);","\tmediump vec2 pointTexMax = max(pointTexStart, pointTexEnd);","\tmediump vec2 pointCoord = (pointTexEnd.x > pointTexStart.x ? gl_PointCoord : vec2(1.0 - gl_PointCoord.y, gl_PointCoord.x));", +"\toutColor = texture(samplerFront, mix(pointTexMin, pointTexMax, pointCoord)) * color * pointOpacity;","\tgl_FragDepth = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);","}"].join("\n")}static GetColorFillFragmentShaderSource(){return["uniform lowp vec4 color;","void main(void) {","\tgl_FragColor = color;","}"].join("\n")}static GetLinearGradientFillFragmentShaderSource(){return["precision lowp float;","varying mediump vec2 vTex;","uniform vec4 color;","uniform vec4 color2_;","vec3 fromLinear(vec3 linearRGB)", +"{","\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));","\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);","\tvec3 lower = linearRGB * vec3(12.92);","\treturn mix(higher, lower, vec3(cutoff));","}","vec3 toLinear(vec3 sRGB)","{","\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));","\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));","\tvec3 lower = sRGB/vec3(12.92);","\treturn mix(higher, lower, vec3(cutoff));","}","void main(void) {","\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);", +"\tfloat a = mix(color.a, color2_.a, vTex.x);","\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);","}"].join("\n")}static GetPenumbraFillFragmentShaderSource(){return[`#ifdef GL_FRAGMENT_PRECISION_HIGH`,`#define highmedp highp`,`#else`,`#define highmedp mediump`,`#endif`,`precision lowp float;`,`varying highmedp vec2 vTex;`,`uniform vec4 color;`,`void main(void) {`,` highmedp float grad = vTex.x / (1.0 - vTex.y);`,` gl_FragColor = color * (1.0 - (cos(grad * 3.141592653589793) + 1.0) / 2.0);`, +`}`].join("\n")}static GetSmoothLineFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","void main(void) {","\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;","\tgl_FragColor = color * f;","}"].join("\n")}static GetHardEllipseFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float f = step(diffSq.x + diffSq.y, 0.25);", +"\tgl_FragColor = color * f;","}"].join("\n")}static GetHardEllipseOutlineFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","uniform mediump vec2 pixelSize;","uniform mediump float outlineThickness;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float distSq = diffSq.x + diffSq.y;","\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump float innerF = step(distSq, 0.25);", +"\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;","\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;","\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);","\tgl_FragColor = color * innerF * outerF;","}"].join("\n")}static GetSmoothEllipseFillFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;","uniform mediump vec2 pixelSize;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;", +"\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump vec2 halfNormSq = halfNorm * halfNorm;","\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;","\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;","\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);","\tgl_FragColor = color * f;","}"].join("\n")}static GetSmoothEllipseOutlineFragmentShaderSource(){return["varying mediump vec2 vTex;","uniform lowp vec4 color;", +"uniform mediump vec2 pixelSize;","uniform mediump float outlineThickness;","void main(void) {","\tmediump vec2 diff = vTex - vec2(0.5, 0.5);","\tmediump vec2 diffSq = diff * diff;","\tmediump float distSq = diffSq.x + diffSq.y;","\tmediump vec2 norm = normalize(diff);","\tmediump vec2 halfNorm = norm * 0.5;","\tmediump vec2 halfNormSq = halfNorm * halfNorm;","\tmediump vec2 pxNorm = pixelSize * norm;","\tmediump vec2 innerEdge1 = halfNorm - pxNorm;","\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;", +"\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);","\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;","\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;","\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);","\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;","\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);","\tgl_FragColor = color * innerF * outerF;", +"}"].join("\n")}}; + +} + +// ../lib/gfx/webgl/shaderUniform.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const mat4=glMatrix.mat4;const TYPE_SIZES=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]); +C3.Gfx.WebGLShaderUniform=class WebGLShaderUniform{constructor(owner,name,type){if(!TYPE_SIZES.has(type))throw new Error("invalid uniform type");this._owner=owner;this._gl=this._owner.GetWebGLContext();this._name=name;this._type=type;this._isColorType=this._type==="color";this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),name);this._isUsed=!!this._location;const typeSize=TYPE_SIZES.get(type);this._lastValue=new Float32Array(typeSize);this._lastBatchValue=new Float32Array(typeSize)}Release(){this._owner= +null;this._gl=null;this._location=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(v0){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastBatchValue.set(this._lastValue);this._gl.uniform1f(this._location,v0)}Init1i(v0){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastBatchValue.set(this._lastValue);this._gl.uniform1i(this._location,v0)}Init2f(v0,v1){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastBatchValue.set(this._lastValue); +this._gl.uniform2f(this._location,v0,v1)}Init3f(v0,v1,v2){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastValue[2]=v2;this._lastBatchValue.set(this._lastValue);this._gl.uniform3f(this._location,v0,v1,v2)}Init4f(v0,v1,v2,v3){if(!this.IsUsed())return;this._lastValue[0]=v0;this._lastValue[1]=v1;this._lastValue[2]=v2;this._lastValue[3]=v3;this._lastBatchValue.set(this._lastValue);this._gl.uniform4f(this._location,v0,v1,v2,v3)}Update1f(v0){v0=Math.fround(v0);const lastValue= +this._lastValue;if(lastValue[0]===v0)return;lastValue[0]=v0;this._gl.uniform1f(this._location,v0)}Update1i(v0){const lastValue=this._lastValue;if(lastValue[0]===v0)return;lastValue[0]=v0;this._gl.uniform1i(this._location,v0)}Update2f(v0,v1){v0=Math.fround(v0);v1=Math.fround(v1);const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1)return;lastValue[0]=v0;lastValue[1]=v1;this._gl.uniform2f(this._location,v0,v1)}Update3f(v0,v1,v2){v0=Math.fround(v0);v1=Math.fround(v1);v2=Math.fround(v2); +const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1&&lastValue[2]===v2)return;lastValue[0]=v0;lastValue[1]=v1;lastValue[2]=v2;this._gl.uniform3f(this._location,v0,v1,v2)}Update4f(v0,v1,v2,v3){v0=Math.fround(v0);v1=Math.fround(v1);v2=Math.fround(v2);v3=Math.fround(v3);const lastValue=this._lastValue;if(lastValue[0]===v0&&lastValue[1]===v1&&lastValue[2]===v2&&lastValue[3]===v3)return;lastValue[0]=v0;lastValue[1]=v1;lastValue[2]=v2;lastValue[3]=v3;this._gl.uniform4f(this._location, +v0,v1,v2,v3)}UpdateMatrix4fv(m){const lastValue=this._lastValue;if(mat4.exactEquals(lastValue,m))return;C3.typedArraySet16(lastValue,m,0);this._gl.uniformMatrix4fv(this._location,false,m)}IsSetToCustomInBatch(p){const batchValue=this._lastBatchValue;if(this.IsColorType())return batchValue[0]===Math.fround(p.getR())&&batchValue[1]===Math.fround(p.getG())&&batchValue[2]===Math.fround(p.getB());else return batchValue[0]===Math.fround(p)}SetBatchValueCustom(p){const batchValue=this._lastBatchValue;if(this.IsColorType()){batchValue[0]= +p.getR();batchValue[1]=p.getG();batchValue[2]=p.getB()}else batchValue[0]=p}IsSetTo1InBatch(x){return this._lastBatchValue[0]===Math.fround(x)}IsSetTo2InBatch(x,y){const batchValue=this._lastBatchValue;return batchValue[0]===Math.fround(x)&&batchValue[1]===Math.fround(y)}SetBatch1(x){this._lastBatchValue[0]=x}SetBatch2(x,y){const batchValue=this._lastBatchValue;batchValue[0]=x;batchValue[1]=y}}; + +} + +// ../lib/gfx/webgl/batchJob.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const BATCH_NULL=0;const BATCH_QUAD=1;const BATCH_SETTEXTURE=2;const BATCH_SETCOLOR=3;const BATCH_SETBLEND=4;const BATCH_SETVIEWPORT=5;const BATCH_SETPROJECTION=6;const BATCH_SETMODELVIEW=7;const BATCH_SETRENDERTARGET=8;const BATCH_CLEARSURFACE=9;const BATCH_POINTS=10;const BATCH_SETPROGRAM=11;const BATCH_SETPROGRAMPARAMETERS=12;const BATCH_SETPROGRAMCUSTOMPARAMETERS=13; +const BATCH_INVALIDATEFRAMEBUFFER=14;const BATCH_SETPOINTTEXCOORDS=15;const BATCH_SETTILEMAPINFO=16;const BATCH_BLITFRAMEBUFFER=17;const BATCH_STARTQUERY=18;const BATCH_ENDQUERY=19;const BATCH_SETELLIPSEPARAMS=20;const BATCH_SETGRADIENTCOLOR=21;const BATCH_CLEARDEPTH=22;const BATCH_SETDEPTHENABLED=23;const BATCH_SETDEPTHSAMPLINGENABLED=24;const BATCH_COPLANAR_STARTSTENCILPASS=25;const BATCH_COPLANAR_STARTCOLORPASS=26;const BATCH_COPLANAR_RESTORE=27;const BATCH_SET_SCISSOR=28; +const BATCH_SETTILERANDOMIZATIONINFO=29;C3.Gfx.BatchState=class BatchState{constructor(renderer){this.renderer=renderer;this.currentMV=mat4.create();this.currentMatP=mat4.create();this.currentFramebuffer=null;this.currentFramebufferNoDepth=null;this.isDepthSamplingEnabled=false;this.currentColor=vec4.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new C3.Rect;this.clearColor=C3.New(C3.Color,0,0,0,0)}}; +C3.Gfx.WebGLBatchJob=class WebGLBatchJob{constructor(batchState){const arrayBuffer=new ArrayBuffer(96);this._type=0;this._batchState=batchState;this._gl=batchState.renderer.GetContext();this._startIndex=0;this._indexCount=0;this._texParam=null;this._mat4param=new Float32Array(arrayBuffer,0,16);this._colorParam=new Float32Array(arrayBuffer,64,4);this._srcOriginRect=new Float32Array(arrayBuffer,80,4);this._shaderParams=[]}InitQuad(startIndex,indexCount){this._type=BATCH_QUAD;this._startIndex=startIndex; +this._indexCount=indexCount}DoQuad(){const gl=this._gl;gl.drawElements(gl.TRIANGLES,this._indexCount,gl.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(rendererTex){this._type=BATCH_SETTEXTURE;this._texParam=rendererTex}DoSetTexture(){const gl=this._gl;const texParam=this._texParam;gl.bindTexture(gl.TEXTURE_2D,texParam?texParam._GetTexture():null)}InitSetColor(c){this._type=BATCH_SETCOLOR;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam;const batchState=this._batchState; +vec4.copy(batchState.currentColor,c);batchState.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=BATCH_SETGRADIENTCOLOR;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam;const s=this._batchState.currentShader;if(s._uColor2.IsUsed())s._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(s,d){this._type=BATCH_SETBLEND;this._startIndex=s;this._indexCount=d}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitSetViewport(x,y,w,h){this._type= +BATCH_SETVIEWPORT;const colorParam=this._colorParam;colorParam[0]=x;colorParam[1]=y;colorParam[2]=w;colorParam[3]=h}DoSetViewport(){const colorParam=this._colorParam;this._gl.viewport(colorParam[0],colorParam[1],colorParam[2],colorParam[3])}InitSetProjection(m){this._type=BATCH_SETPROJECTION;mat4.copy(this._mat4param,m)}DoSetProjection(){const batchState=this._batchState;const allShaderPrograms=batchState.renderer._allShaderPrograms;const currentShader=batchState.currentShader;const mat4param=this._mat4param; +for(let i=0,len=allShaderPrograms.length;i{const fontName=e.font.GetName();for(const f of allRendererTexts)if(f.IsBBCodeEnabled()||C3.equalsNoCase(f.GetFontName(),fontName))f._SetTextChanged()}); +function fillOrStrokeText(ctx,isStroke,text,x,y,maxWidth){if(isStroke)if(C3.Platform.BrowserEngine==="Gecko")ctx.strokeText(text,x,y,maxWidth);else ctx.strokeText(text,x,y);else if(C3.Platform.BrowserEngine==="Gecko")ctx.fillText(text,x,y,maxWidth);else ctx.fillText(text,x,y)}function fillOrStrokeRect(ctx,isStroke,x,y,w,h){if(isStroke)ctx.strokeRect(x,y,w,h);else ctx.fillRect(x,y,w,h)}function ptToPx(pt){return pt*(4/3)} +function getOffsetParam(paramStr,fragHeight){paramStr=paramStr.trim();const param=parseFloat(paramStr);if(!isFinite(param))return 0;if(paramStr.endsWith("%"))return fragHeight*param/100;else return param}let didCheckFoundBoundingBoxSupport=false;let supportsFontBoundingBoxMeasurements=false; +C3.Gfx.RendererText=class RendererText{constructor(renderer,opts){opts=Object.assign({},DEFAULT_OPTS,opts);this._renderer=renderer;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isBold=false;this._isItalic=false;this._colorStr="black";this._isBBcodeEnabled=false;this._iconSet=null;this._iconSmoothing=true;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText= +C3.New(C3.WordWrap);this._wrapMode="word";this._textChanged=false;this._drawMaxCharCount=-1;this._drawCharCount=0;this._cssWidth=0;this._cssHeight=0;this._width=0;this._height=0;this._zoom=1;this._changed=false;this._textCanvas=null;this._textContext=null;this._measureContext=null;this._measureContextTop=null;this._lastCanvasWidth=-1;this._lastCanvasHeight=-1;this._lastTextCanvasFont="";this._lastMeasureCanvasFont="";this._lastTextCanvasFillStyle="";this._lastTextCanvasOpacity=1;this._lastTextCanvasLineWidth= +1;this._measureTextCallback=frag=>this._MeasureText(frag);this._texture=null;this._rcTex=new C3.Rect;this._scaleFactor=1;this._textureTimeout=new C3.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},opts.timeout);this.ontextureupdate=null;this._wasReleased=false;allRendererTexts.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._iconSet=null;this._bbString=null;this._textCanvas=null;this._textContext=null;this._measureContext=null;this._measureContextTop= +null;this._measureTextCallback=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._wrappedText=null;this._renderer=null;this._wasReleased=true;allRendererTexts.delete(this)}_SetChanged(){this._changed=true}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=true}SetBBCodeEnabled(e){e=!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;const textBaseline=this._isBBcodeEnabled?"alphabetic":"top"; +if(this._textContext)this._textContext.textBaseline=textBaseline;if(this._measureContext)this._measureContext.textBaseline=textBaseline;this._SetTextChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetIconSet(iconSet){if(this._iconSet===iconSet)return;this._iconSet=iconSet;this._wrappedText.SetIconSet(iconSet);if(this._iconSet&&this._iconSet.IsLoading())this._iconSet.LoadContent().then(()=>this._SetChanged());this._SetTextChanged()}SetIconSmoothing(s){this._iconSmoothing=!!s;this._SetChanged()}SetFontName(fontName){if(!fontName)fontName= +"serif";if(this._fontName===fontName)return;this._fontName=fontName;this._SetTextChanged()}GetFontName(){return this._fontName}SetFontSize(fontSize){if(fontSize<.1)fontSize=.1;if(this._fontSize===fontSize)return;this._fontSize=fontSize;this._SetTextChanged()}SetFontSizeScale(s){if(this._fontSizeScale===s)return;this._fontSizeScale=s;this._SetTextChanged()}SetLineHeight(h){if(this._lineHeight===h)return;this._lineHeight=h;this._SetChanged()}SetBold(bold){bold=!!bold;if(this._isBold===bold)return;this._isBold= +bold;this._SetTextChanged()}SetItalic(italic){italic=!!italic;if(this._isItalic===italic)return;this._isItalic=italic;this._SetTextChanged()}SetDrawMaxCharacterCount(n){n=Math.floor(n);if(this._drawMaxCharCount===n)return;this._drawMaxCharCount=n;this._SetChanged()}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetFontString(useCssUnits,frag){let ret=[];if(this._isBold||frag.HasStyleTag("b"))ret.push("bold");if(this._isItalic||frag.HasStyleTag("i"))ret.push("italic");const sizeStyle=frag.GetStyleTag("size"); +const fontSize=(sizeStyle?parseFloat(sizeStyle.param):this._fontSize)*this._fontSizeScale;if(useCssUnits)ret.push(fontSize+"pt");else ret.push(fontSize*this.GetDrawScale()+"pt");let fontName=this._fontName;const fontStyle=frag.GetStyleTag("font");if(fontStyle&&fontStyle.param){fontName=fontStyle.param;if(this.onloadfont&&!this._alreadyLoadedFonts.has(fontName)){this.onloadfont(fontName);this._alreadyLoadedFonts.add(fontName)}}if(fontName)if(GENERIC_FONT_FAMILIES.has(fontName))ret.push(fontName);else ret.push('"'+ +fontName+'"');return ret.join(" ")}SetColor(c){if(c instanceof C3.Color)c=c.getCssRgb();if(this._colorStr===c)return;this._colorStr=c;this._SetChanged()}SetColorRgb(r,g,b){tempColor.setRgb(r,g,b);this.SetColor(tempColor)}SetHorizontalAlignment(h){if(!VALID_HORIZ_ALIGNMENTS.has(h))throw new Error("invalid horizontal alignment");if(this._horizontalAlign===h)return;this._horizontalAlign=h;this._SetChanged()}SetVerticalAlignment(v){if(!VALID_VERT_ALIGNMENTS.has(v))throw new Error("invalid vertical alignment"); +if(this._verticalAlign===v)return;this._verticalAlign=v;this._SetChanged()}SetWordWrapMode(m){if(!VALID_WORD_WRAP_MODES.has(m))throw new Error("invalid word wrap mode");if(this._wrapMode===m)return;this._wrapMode=m;this._SetTextChanged()}SetText(text){if(this._text===text)return;this._text=text;this._SetTextChanged()}GetDrawScale(){return this._scaleFactor*this._zoom*self.devicePixelRatio}SetSize(cssWidth,cssHeight,zoom){if(typeof zoom==="undefined")zoom=1;if(cssWidth<=0||cssWidth<=0)return;if(this._cssWidth=== +cssWidth&&this._cssHeight===cssHeight&&this._zoom===zoom)return;const oldCssWidth=this._cssWidth;this._cssWidth=cssWidth;this._cssHeight=cssHeight;this._zoom=zoom;const dpr=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*dpr;this._height=this._cssHeight*this._zoom*dpr;const maxDim=Math.max(this._width,this._height);const maxTextureSize=Math.min(this._renderer.GetMaxTextureSize(),MAX_TEXTURE_SIZE);let scale=1;if(maxDim>maxTextureSize){scale=maxTextureSize/maxDim;this._width=Math.min(this._width* +scale,maxTextureSize);this._height=Math.min(this._height*scale,maxTextureSize)}this._scaleFactor=scale;if(this._cssWidth!==oldCssWidth)this._SetTextChanged();else this._SetChanged()}GetWidth(){return this._width}GetHeight(){return this._height}GetZoom(){return this._zoom}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+EXTRA_LINE_HEIGHT)- +this._lineHeight}GetLengthInGraphemes(){this._MaybeWrapText();let ret=0;for(const line of this._wrappedText.GetLines())for(const frag of line.fragments())ret+=frag.GetLength();return ret}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}HitTestFragment(x,y){this._MaybeUpdate();const scale=this.GetDrawScale();const lines=this._wrappedText.GetLines();for(const line of lines){const yOff=line.GetFontBoundingBoxDescent()*scale;if(y>=line.GetPosY()-line.GetHeight()*scale+ +yOff&&y=frag.GetPosX()&&xa+v.GetHeight()*scale+lineSpaceHeight,0)-lineSpaceHeight; +penY=Math.max(this._height/2-linesTotalHeight/2,0);if(useFontBoundingBoxMeasurements)firstLineTextHeight=lines[0].GetTopToAlphabeticDistance()*scale}else if(this._verticalAlign==="bottom"){const linesTotalHeight=lines.reduce((a,v)=>a+v.GetHeight()*scale+lineSpaceHeight,0)-this._lineHeight*scale;const lastLineDescentHeight=useFontBoundingBoxMeasurements?lines.at(-1).GetFontBoundingBoxDescent()*scale:0;penY=this._height-linesTotalHeight-lastLineDescentHeight-2}for(let i=0,len=lines.length;i0&&penY>this._height-EXTRA_LINE_HEIGHT*scale)break}else if(i>0&&penY>=this._height-curLineTextHeight)break;if(startPenY>=0)this._DrawTextLine(line,penY,scale);if(!this._isBBcodeEnabled)penY+=curLineTextHeight;penY+=lineSpaceHeight}}_DrawTextLine(line,penY,scale){let penX=0;if(this._horizontalAlign==="center")penX=(this._width-line.GetWidth()* +scale)/2;else if(this._horizontalAlign==="right")penX=this._width-line.GetWidth()*scale;line.SetPosX(penX);line.SetPosY(penY);for(const frag of line.fragments()){this._DrawFragment(frag,penX,penY,scale,line.GetHeight());penX+=frag.GetWidth()*scale}}_DrawFragment(frag,penX,penY,scale,lineHeight){const offsetXStyle=frag.GetStyleTag("offsetx");penX+=offsetXStyle?getOffsetParam(offsetXStyle.param,frag.GetHeight())*scale:0;const offsetYStyle=frag.GetStyleTag("offsety");penY+=offsetYStyle?getOffsetParam(offsetYStyle.param, +frag.GetHeight())*scale:0;if(frag.IsIcon()){const iconOffsetYStyle=frag.GetStyleTag("iconoffsety");penY+=iconOffsetYStyle?getOffsetParam(iconOffsetYStyle.param,frag.GetHeight())*scale:.2*frag.GetHeight()*scale}frag.SetPosX(penX);frag.SetPosY(penY);const textContext=this._textContext;const lineFontScale=lineHeight/16;let fragWidth=frag.GetWidth()*scale;const fragHeight=frag.GetHeight()*scale;const fragFontScale=frag.GetHeight()/16;const lineSpaceHeight=(EXTRA_LINE_HEIGHT+this._lineHeight)*scale;let chArr= +frag.IsText()?frag.GetCharacterArray():null;if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(frag.IsText())if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(frag).width*scale}this._drawCharCount+=frag.GetLength()}const backgroundStyle=frag.GetStyleTag("background");const hasUnderline=frag.HasStyleTag("u");const hasStrikethrough=frag.HasStyleTag("s");if(frag.IsText()&& +C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle&&!hasUnderline&&!hasStrikethrough||frag.HasStyleTag("hide"))return;if(backgroundStyle){this._SetDrawCanvasColor(backgroundStyle.param);textContext.fillRect(penX,penY-fragHeight,fragWidth,fragHeight+lineSpaceHeight)}const colorStyle=frag.GetStyleTag("color");this._SetDrawCanvasColor(colorStyle?colorStyle.param:this._colorStr);const opacityStyle=frag.GetStyleTag("opacity");this._SetDrawCanvasOpacity(opacityStyle?parseFloat(opacityStyle.param)/100: +1);const lineThicknessStyle=frag.GetStyleTag("linethickness");const lineThicknessScale=lineThicknessStyle?parseFloat(lineThicknessStyle.param):1;const isStroke=frag.HasStyleTag("stroke");if(isStroke)this._SetDrawCanvasLineWith(fragFontScale*.5*lineThicknessScale*this.GetDrawScale());if(frag.IsText()){const text=chArr.join("");this._SetDrawFontString(this._GetFontString(false,frag));fillOrStrokeText(textContext,isStroke,text,penX,penY,fragWidth);if(!isStroke){this._SetDrawCanvasLineWith(fragFontScale* +.5*lineThicknessScale*this.GetDrawScale());const outlineStyle=frag.GetStyleTag("outline");if(outlineStyle){this._SetDrawCanvasColor(outlineStyle.param);fillOrStrokeText(textContext,true,text,penX,penY,fragWidth)}}}else if(frag.IsIcon())if(frag.GetWidth()>0){const drawable=frag.GetDrawable(this._iconSet);if(drawable)textContext.drawImage(drawable,penX,penY-fragHeight,fragWidth,fragHeight)}this._SetDrawCanvasColor(colorStyle?colorStyle.param:this._colorStr);if(hasUnderline)fillOrStrokeRect(textContext, +isStroke,penX,penY+scale*lineFontScale,fragWidth,scale*lineFontScale*lineThicknessScale);if(hasStrikethrough){const defaultStrikeY=penY-fragHeight/4;const defaultStrikeHeight=scale*fragFontScale;const strikeYMid=defaultStrikeY+defaultStrikeHeight/2;textContext.fillRect(penX,strikeYMid-defaultStrikeHeight*lineThicknessScale/2,fragWidth,defaultStrikeHeight*lineThicknessScale)}}_UpdateTexture(){if(this._renderer.IsContextLost())return;if(!this._texture)this._texture=this._renderer.CreateDynamicTexture(this._textCanvas.width, +this._textCanvas.height,{mipMap:true,mipMapQuality:"high"});this._renderer.UpdateTexture(this._textCanvas,this._texture);this._rcTex.set(0,0,this._width/this._texture.GetWidth(),this._height/this._texture.GetHeight());if(this.ontextureupdate)this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){if(this._texture){if(!this._renderer.IsContextLost())this._renderer.DeleteTexture(this._texture);this._texture=null}}static OnContextLost(){for(const rendererText of allRendererTexts)rendererText.ReleaseTexture()}static GetAll(){return allRendererTexts.values()}}; + +} + +// ../lib/gfx/webgl/query.js +{ +'use strict';const C3=self.C3; +class WebGLRealTimeElapsedQuery{constructor(renderer){this._gl=renderer.GetContext();this._version=renderer.GetWebGLVersionNumber();this._timerExt=renderer._GetDisjointTimerQueryExtension();this._query=null;this._isActive=false;this._hasResult=false;this._result=0;if(this._version===1)this._query=this._timerExt["createQueryEXT"]();else this._query=this._gl["createQuery"]()}Release(){this._DeleteQueryObject();this._gl=null;this._timerExt=null;this._hasResult=false}_DeleteQueryObject(){if(!this._query)return;if(this._version=== +1)this._timerExt["deleteQueryEXT"](this._query);else this._gl["deleteQuery"](this._query);this._query=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");if(this._version===1)this._timerExt["beginQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"],this._query);else this._gl["beginQuery"](this._timerExt["TIME_ELAPSED_EXT"],this._query);this._isActive=true}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");if(this._version===1)this._timerExt["endQueryEXT"](this._timerExt["TIME_ELAPSED_EXT"]); +else this._gl["endQuery"](this._timerExt["TIME_ELAPSED_EXT"]);this._isActive=false}CheckForResult(){if(!this._query||this._hasResult||this._isActive)return;let available=false;if(this._version===1)available=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_AVAILABLE_EXT"]);else available=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT_AVAILABLE"]);const disjoint=this._gl.getParameter(this._timerExt["GPU_DISJOINT_EXT"]);if(available&&!disjoint){if(this._version=== +1)this._result=this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_EXT"]);else this._result=this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT"]);this._result/=1E9;this._hasResult=true}if(available||disjoint)this._DeleteQueryObject()}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw new Error("no result available");return this._result}} +C3.Gfx.WebGLTimeElapsedQuery=class WebGLTimeElapsedQuery{constructor(renderer){this._renderer=renderer;this._frameNumber=renderer.GetFrameNumber();this._isActive=false;this._parentQuery=null;this._isNested=false;this._realQuery=null;this._queries=[]}Release(){for(const q of this._queries)if(q instanceof WebGLRealTimeElapsedQuery)q.Release();C3.clearArray(this._queries);this._parentQuery=null;this._realQuery=null;this._renderer=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active"); +const stack=this._renderer._GetTimeQueryStack();if(stack.length>0){this._isNested=true;this._parentQuery=stack.at(-1);this._parentQuery._EndReal();this._parentQuery._queries.push(this)}else{this._isNested=false;this._parentQuery=null}this._isActive=true;stack.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");const top=this._renderer._GetTimeQueryStack().pop();if(top!==this)throw new Error("can only end most nested query");this._isActive=false;this._EndReal(); +if(this._parentQuery){this._parentQuery._StartReal();this._parentQuery=null}}_StartReal(){this._realQuery=C3.New(WebGLRealTimeElapsedQuery,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const q of this._queries)q.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(q=>q.HasResult())}GetResult(){return this._queries.reduce((a,v)=>a+v.GetResult(), +0)}GetFrameNumber(){return this._frameNumber}}; + +} + +// ../lib/gfx/webgl/queryResultBuffer.js +{ +'use strict';const C3=self.C3; +C3.Gfx.WebGLQueryResultBuffer=class WebGLQueryResultBuffer{constructor(renderer,maxQueries=1E3){this._renderer=renderer;this._maxQueries=maxQueries;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const q of this._buffer)q.Release();C3.clearArray(this._buffer)}AddTimeElapsedQuery(){const ret=new C3.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(ret);if(this._buffer.length>this._maxQueries){const oldest= +this._buffer.shift();oldest.Release()}return ret}CheckForResults(toFrameNumber){for(const q of this._buffer){if(q.GetFrameNumber()>=toFrameNumber)return;if(q.IsNested())return;q.CheckForResult()}}GetFrameRangeResultSum(startFrame,endFrame){if(endFrame<=startFrame)return NaN;let sum=0;for(const q of this._buffer){if(q.GetFrameNumber()>=endFrame)break;if(q.GetFrameNumber()0)this._buffer.splice(0,i);return}}}}; + +} + +// ../lib/gfx/webgl/webglRenderer.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const DEFAULT_WEBGLRENDERER_OPTS={powerPreference:"default",enableGpuProfiling:true,alpha:false,lowLatency:false,depth:false,canSampleDepth:false,maxWebGLVersion:2,failIfMajorPerformanceCaveat:false};const VALID_POWER_PREFERENCES=new Set(["default","low-power","high-performance"]);const MAX_VERTICES=8E3;const MAX_INDICES=MAX_VERTICES/2*3; +const MAX_POINTS=8E3;const LAST_POINT=MAX_POINTS-4;const PARTIAL_TEXTURE_UPLOAD_CHUNK_SIZE=256*1024;const defaultTexCoordsQuad=new C3.Quad(0,0,1,0,1,1,0,1);const tmpProjection=mat4.create();const tmpModelView=mat4.create();const tmpQuad=new C3.Quad;const tmpRect=new C3.Rect;let loseContextExtension=null; +if(C3.isDebug){self.debug_lose_webgl_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.loseContext()};self.debug_restore_webgl_context=function(){if(!loseContextExtension){console.warn("WEBGL_lose_context not supported");return}loseContextExtension.restoreContext()}}const pendingPolls=new Set;let pollRafId=-1; +function CheckPendingPolls(){pollRafId=-1;for(const info of pendingPolls)if(info.checkFunc()){info.resolve();pendingPolls.delete(info)}if(pendingPolls.size>0)pollRafId=self.requestAnimationFrame(CheckPendingPolls)} +C3.Gfx.WebGLRenderer=class WebGLRenderer extends C3.Gfx.RendererBase{constructor(canvas,opts){super(opts);opts=Object.assign({},DEFAULT_WEBGLRENDERER_OPTS,opts);if(!VALID_POWER_PREFERENCES.has(opts.powerPreference))throw new Error("invalid power preference");const attribs={"alpha":!!opts.alpha,"depth":false,"antialias":false,"powerPreference":opts.powerPreference,"failIfMajorPerformanceCaveat":!!opts.failIfMajorPerformanceCaveat};if(opts.lowLatency){attribs["desynchronized"]=true;attribs["preserveDrawingBuffer"]= +true}let gl=null;let version=0;if(opts.maxWebGLVersion>=2){gl=canvas.getContext("webgl2",attribs);version=2}if(!gl){gl=canvas.getContext("webgl",attribs);version=1}if(!gl)throw new Error("renderer-unavailable (could not get WebGL context)");this._gl=gl;this._attribs=gl.getContextAttributes();if(opts.lowLatency&&!this._attribs["desynchronized"])console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=gl.getParameter(gl.VERSION);this._version=version; +this._viewport=vec4.create();this._didChangeTransform=false;this._bbProjectionMatrix=mat4.create();this._usesDepthBuffer=!!opts.depth;this._canSampleDepth=!!(opts.depth&&opts.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=false;this._depthBuffer=null;this._isAutoSizeDepthBuffer=true;this._depthBufferWidth=0;this._depthBufferHeight=0;this._vertexBuffer=null;this._texcoordBuffer=null;this._indexBuffer=null;this._pointBuffer=null;this._vertexData=new Float32Array(MAX_VERTICES* +this.GetNumVertexComponents());this._indexData=new Uint16Array(MAX_INDICES);this._texcoordData=new Float32Array(MAX_VERTICES*2);this._pointData=new Float32Array(MAX_POINTS*4);this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._lastVertexPtr=0;this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._batch=[];this._batchPtr=0;this._topOfBatch=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=C3.New(C3.Gfx.BatchState,this);this._lastColor=C3.New(C3.Color,1,1,1,1);this._lastTexture0= +null;this._lastTexture1=null;this._lastSrcBlend=0;this._lastDestBlend=0;this._lastPointTexCoords=new C3.Rect;this._lastScissorRect=C3.New(C3.Rect,0,0,-1,-1);this._maxTextureSize=-1;this._minPointSize=0;this._maxPointSize=0;this._highpPrecision=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=false;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt=null; +this._stdDerivativesExt=null;this._textureLodExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!opts.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return true}async InitState(){super.InitState();const gl=this._gl;const numVertexComponents=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture0=null;this._lastTexture1=null;this._vertexPtr=0;this._pointPtr=0;this._lastVertexPtr= +MAX_VERTICES*numVertexComponents-4*numVertexComponents;C3.clearArray(this._batch);this._batchPtr=0;this._topOfBatch=0;this._lastProgram=null;this._currentRenderTarget=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;const batchState=this._batchState;batchState.currentShader=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null;vec4.set(batchState.currentColor,1,1,1,1);batchState.clearColor.setRgba(0,0,0,0);batchState.pointTexCoords.set(0,0,1,1);gl.clearColor(0, +0,0,0);gl.clear(gl.COLOR_BUFFER_BIT);gl.enable(gl.BLEND);gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=gl.ONE;this._lastDestBlend=gl.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(gl);gl.disable(gl.CULL_FACE);gl.disable(gl.STENCIL_TEST);gl.disable(gl.DITHER);if(this._usesDepthBuffer){gl.enable(gl.DEPTH_TEST);gl.depthMask(true);gl.depthFunc(gl.LEQUAL)}else{gl.disable(gl.DEPTH_TEST);gl.depthMask(false)}this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=false;this._pointBuffer= +gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._pointData.byteLength,gl.DYNAMIC_DRAW);this._vertexBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._vertexData.byteLength,gl.DYNAMIC_DRAW);this._texcoordBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer);gl.bufferData(gl.ARRAY_BUFFER,this._texcoordData.byteLength,gl.DYNAMIC_DRAW);this._indexBuffer=gl.createBuffer(); +gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer);gl.bufferData(gl.ELEMENT_ARRAY_BUFFER,this._indexData,gl.STATIC_DRAW);gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,null);this._maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);const pointsizes=gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);this._minPointSize=pointsizes[0];this._maxPointSize=pointsizes[1];const highpVertex=gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT);const highpFrag=gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, +gl.HIGH_FLOAT);if(highpVertex&&highpFrag)this._highpPrecision=Math.min(highpVertex["precision"],highpFrag["precision"]);else this._highpPrecision=0;if(this._maxPointSize>2048)this._maxPointSize=2048;this._extensions=gl.getSupportedExtensions();const debug_ext=gl.getExtension("WEBGL_debug_renderer_info");if(debug_ext){this._unmaskedVendor=gl.getParameter(debug_ext["UNMASKED_VENDOR_WEBGL"]);this._unmaskedRenderer=gl.getParameter(debug_ext["UNMASKED_RENDERER_WEBGL"])}this._parallelShaderCompileExt=gl.getExtension("KHR_parallel_shader_compile"); +if(C3.isDebug)loseContextExtension=gl.getExtension("WEBGL_lose_context");if(this._isGpuProfilingEnabled)if(this.GetWebGLVersionNumber()===1){if(C3.Platform.BrowserEngine!=="Chromium"||C3.Platform.BrowserVersionNumber>=81||typeof document!=="undefined")this._timerExt=gl.getExtension("EXT_disjoint_timer_query")}else this._timerExt=gl.getExtension("EXT_disjoint_timer_query_webgl2")||gl.getExtension("EXT_disjoint_timer_query");this._anisotropicExt=gl.getExtension("EXT_texture_filter_anisotropic");if(this._anisotropicExt)this._maxAnisotropy= +gl.getParameter(this._anisotropicExt["MAX_TEXTURE_MAX_ANISOTROPY_EXT"]);else this._maxAnisotropy=0;if(this.GetWebGLVersionNumber()<2&&this._usesDepthBuffer&&this._canSampleDepth){this._depthTextureExt=gl.getExtension("WEBGL_depth_texture");if(!this._depthTextureExt)throw new Error("no depth texture support");}if(this.GetWebGLVersionNumber()<2){this._fragDepthExt=gl.getExtension("EXT_frag_depth");this._stdDerivativesExt=gl.getExtension("OES_standard_derivatives");this._textureLodExt=gl.getExtension("EXT_shader_texture_lod")}const WebGLShaderProgram= +C3.Gfx.WebGLShaderProgram;const vsSource=WebGLShaderProgram.GetDefaultVertexShaderSource(false);let textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_NoFragDepth();let textureFillVertexSrc=vsSource;let pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_NoFragDepth();let pointVertexSrc=WebGLShaderProgram.GetPointVertexShaderSource_WebGL1();let tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_NoFragDepth();let tilemapVertexSrc= +WebGLShaderProgram.GetDefaultVertexShaderSource(true);let useFragDepthExt=false;if(this._usesDepthBuffer&&(C3.Platform.Browser!=="Safari"||C3.Platform.BrowserVersionNumber>=15.5))if(this.GetWebGLVersionNumber()<2){if(this._fragDepthExt){textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL1_FragDepthEXT();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1_FragDepthEXT();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL1_FragDepthEXT(); +useFragDepthExt=true}}else{textureFillVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2();textureFillFragmentSrc=WebGLShaderProgram.GetTextureFillFragmentShaderSource_WebGL2();pointFragmentSrc=WebGLShaderProgram.GetPointFragmentShaderSource_WebGL2();pointVertexSrc=WebGLShaderProgram.GetPointVertexShaderSource_WebGL2();tilemapFragmentSrc=WebGLShaderProgram.GetTilemapFragmentShaderSource_WebGL2();tilemapVertexSrc=WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2(true)}const tileRandomizationFragmentSrc= +WebGLShaderProgram.GetTileRandomizationFragmentShaderSource(this.GetWebGLVersionNumber(),useFragDepthExt,this._stdDerivativesExt&&this._textureLodExt);const tileRandomizationVertexSrc=this.GetWebGLVersionNumber()>=2?WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2():vsSource;const DEFAULT_SHADER_PROGRAMS=[[textureFillFragmentSrc,textureFillVertexSrc,""],[textureFillFragmentSrc,textureFillVertexSrc,""],[pointFragmentSrc,pointVertexSrc,""],[WebGLShaderProgram.GetColorFillFragmentShaderSource(), +vsSource,""],[WebGLShaderProgram.GetLinearGradientFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetPenumbraFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetHardEllipseOutlineFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseFillFragmentShaderSource(),vsSource,""],[WebGLShaderProgram.GetSmoothEllipseOutlineFragmentShaderSource(), +vsSource,""],[WebGLShaderProgram.GetSmoothLineFillFragmentShaderSource(),vsSource,""],[tilemapFragmentSrc,tilemapVertexSrc,""],[tileRandomizationFragmentSrc,tileRandomizationVertexSrc,""]];const defaultShaders=await Promise.all(DEFAULT_SHADER_PROGRAMS.map(i=>this.CreateShaderProgram({src:i[0],vertexSrc:i[1],name:i[2]})));this._spTextureFill=defaultShaders[0];this._spDeviceTransformTextureFill=defaultShaders[1];this._spPoints=defaultShaders[2]; +this._spColorFill=defaultShaders[3];this._spLinearGradientFill=defaultShaders[4];this._spPenumbraFill=defaultShaders[5];this._spHardEllipseFill=defaultShaders[6];this._spHardEllipseOutline=defaultShaders[7];this._spSmoothEllipseFill=defaultShaders[8];this._spSmoothEllipseOutline=defaultShaders[9];this._spSmoothLineFill=defaultShaders[10];this._spTilemapFill=defaultShaders[11];this._spTileRandomization=defaultShaders[12];this.SetTextureFillMode()}async CreateShaderProgram(shaderInfo){const ret=await C3.Gfx.WebGLShaderProgram.Create(this, +shaderInfo);this._AddShaderProgram(ret);return ret}ResetLastProgram(){this._lastProgram=null}SetSize(w,h,force){if(this._width===w&&this._height===h&&!force)return;this.EndBatch();const gl=this._gl;const batchState=this._batchState;this._width=w;this._height=h;this._SetViewport(0,0,w,h);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,w/h);this.SetProjectionMatrix(this._bbProjectionMatrix);if(this._spDeviceTransformTextureFill){gl.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()); +this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP);this._lastProgram=this._spDeviceTransformTextureFill;this._batchState.currentShader=this._spDeviceTransformTextureFill}gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE1);gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE0);this._lastTexture0=null;this._lastTexture1=null;if(this._usesDepthBuffer&&this._isAutoSizeDepthBuffer)this._SetDepthBufferSize(this._width,this._height);if(this._currentRenderTarget)this._currentRenderTarget._Resize(this._width, +this._height);gl.bindFramebuffer(gl.FRAMEBUFFER,null);this._currentRenderTarget=null;batchState.currentFramebuffer=null;batchState.currentFramebufferNoDepth=null}_SetDepthBufferSize(width,height){const gl=this._gl;if(this._depthBuffer&&this._depthBufferWidth===width&&this._depthBufferHeight===height)return;if(this._canSampleDepth){if(this._depthBuffer)gl.deleteTexture(this._depthBuffer);this._depthBuffer=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this._depthBuffer);gl.texParameteri(gl.TEXTURE_2D, +gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);if(this.GetWebGLVersionNumber()>=2)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH24_STENCIL8,width,height,0,gl.DEPTH_STENCIL,gl.UNSIGNED_INT_24_8,null);else if(this._depthTextureExt)gl.texImage2D(gl.TEXTURE_2D,0,gl.DEPTH_STENCIL,width,height,0,gl.DEPTH_STENCIL,this._depthTextureExt["UNSIGNED_INT_24_8_WEBGL"], +null);else;gl.bindTexture(gl.TEXTURE_2D,null)}else{if(this._depthBuffer)gl.deleteRenderbuffer(this._depthBuffer);this._depthBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,this._depthBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,this._version>=2?gl.DEPTH24_STENCIL8:gl.DEPTH_STENCIL,width,height);gl.bindRenderbuffer(gl.RENDERBUFFER,null)}this._depthBufferWidth=width;this._depthBufferHeight=height}SetFixedSizeDepthBuffer(width,height){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer= +false;this._SetDepthBufferSize(width,height)}SetAutoSizeDepthBuffer(){if(!this._usesDepthBuffer)return;this._isAutoSizeDepthBuffer=true;this._SetDepthBufferSize(this._width,this._height)}_SetViewport(x,y,w,h){const viewport=this._viewport;if(viewport[0]===x&&viewport[1]===y&&viewport[2]===w&&viewport[3]===h)return;const b=this.PushBatch();b.InitSetViewport(x,y,w,h);vec4.set(viewport,x,y,w,h);this._topOfBatch=0}SetFovY(f){super.SetFovY(f);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/ +this._height)}SetNearZ(z){super.SetNearZ(z);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetFarZ(z){super.SetFarZ(z);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetProjectionMatrix(matP){if(mat4.exactEquals(this._matP,matP))return;const b=this.PushBatch();b.InitSetProjection(matP);mat4.copy(this._matP,matP);this._topOfBatch=0;this._didChangeTransform=true}SetDefaultRenderTargetProjectionState(){let projectionMatrix;let viewportWidth, +viewportHeight;const currentRenderTarget=this._currentRenderTarget;if(currentRenderTarget===null){projectionMatrix=this._bbProjectionMatrix;viewportWidth=this.GetWidth();viewportHeight=this.GetHeight()}else{projectionMatrix=currentRenderTarget.GetProjectionMatrix();viewportWidth=currentRenderTarget.GetWidth();viewportHeight=currentRenderTarget.GetHeight()}this.SetProjectionMatrix(projectionMatrix);this._SetViewport(0,0,viewportWidth,viewportHeight)}SetModelViewMatrix(matMV){if(mat4.exactEquals(this._matMV, +matMV))return;const b=this.PushBatch();b.InitSetModelView(matMV);mat4.copy(this._matMV,matMV);this._topOfBatch=0;this._didChangeTransform=true}ResetDidChangeTransformFlag(){this._didChangeTransform=false}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const batch=this._batch;if(this._batchPtr===batch.length)batch.push(new C3.Gfx.WebGLBatchJob(this._batchState));return batch[this._batchPtr++]}EndBatch(){if(this._batchPtr===0)return;if(this.IsContextLost())return; +this._WriteBuffers();this._ExecuteBatch();this._batchPtr=0;this._vertexPtr=0;this._texPtr=0;this._pointPtr=0;this._topOfBatch=0}_WriteBuffers(){const gl=this._gl;if(this._pointPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._pointBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr))}if(this._vertexPtr>0){gl.bindBuffer(gl.ARRAY_BUFFER,this._vertexBuffer);gl.bufferSubData(gl.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr));gl.bindBuffer(gl.ARRAY_BUFFER,this._texcoordBuffer); +gl.bufferSubData(gl.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr))}}_ExecuteBatch(){const batch=this._batch;for(let i=0,len=this._batchPtr;i=this._lastVertexPtr){this.EndBatch(); +v=0}if(this._topOfBatch===1)this._batch[this._batchPtr-1]._indexCount+=6;else{const b=this.PushBatch();b.InitQuad(v,6);this._topOfBatch=1}}_WriteQuadToVertexBuffer(quad){quad.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(quad){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);defaultTexCoordsQuad.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(tlx,tly,trx,try_,brx,bry,blx,bly){this._ExtendQuadBatch();const vd= +this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z;vd[v++]=trx;vd[v++]=try_;vd[v++]=z;vd[v++]=brx;vd[v++]=bry;vd[v++]=z;vd[v++]=blx;vd[v++]=bly;vd[v++]=z;this._vertexPtr=v;defaultTexCoordsQuad.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(quad,rcTex){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(quad);rcTex.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(quad,uv){this._ExtendQuadBatch(); +this._WriteQuadToVertexBuffer(quad);uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,rcTex){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr=v;rcTex.writeAsQuadToTypedArray(this._texcoordData,this._texPtr); +this._texPtr+=8}Quad3D2(tlx,tly,tlz,trx,try_,trz,brx,bry,brz,blx,bly,blz,uv){this._ExtendQuadBatch();const vd=this._vertexData;let v=this._vertexPtr;const z=this._baseZ+this._currentZ;vd[v++]=tlx;vd[v++]=tly;vd[v++]=z+tlz;vd[v++]=trx;vd[v++]=try_;vd[v++]=z+trz;vd[v++]=brx;vd[v++]=bry;vd[v++]=z+brz;vd[v++]=blx;vd[v++]=bly;vd[v++]=z+blz;this._vertexPtr=v;uv.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(mode,curTex){mat4.copy(tmpProjection,this._matP);mat4.copy(tmpModelView, +this._matMV);this.SetDefaultRenderTargetProjectionState();const [width,height]=this.GetRenderTargetSize(this._currentRenderTarget);const tempMat4b=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ(height),0,0,0,height);this.SetModelViewMatrix(tempMat4b);if(mode==="crop"&&this._currentRenderTarget&&curTex){const left=this._width/2;const top=this._height/2;const srcW=curTex.GetWidth();const srcH=curTex.GetHeight();const destW=this._currentRenderTarget.GetWidth();const destH=this._currentRenderTarget.GetHeight(); +const copyW=Math.min(destW,srcW);const copyH=Math.min(destH,srcH);const srcOffY=Math.max(srcH-destH,0);const destOffY=Math.max(destH-srcH,0);tmpRect.set(-left,top-destOffY,-left+copyW,top-copyH-destOffY);tmpQuad.setFromRect(tmpRect);tmpRect.set(0,srcOffY,copyW,copyH+srcOffY);tmpRect.divide(srcW,srcH);this.Quad3(tmpQuad,tmpRect)}else{const halfW=width/2;const halfH=height/2;this.Rect2(-halfW,halfH,halfW,-halfH)}this.SetProjectionMatrix(tmpProjection);this.SetModelViewMatrix(tmpModelView)}StartRenderingPoints(rect){if(this._lastPointTexCoords.equals(rect))return; +this._lastPointTexCoords.copy(rect);const b=this.PushBatch();b.InitSetPointTexCoords(rect);this._topOfBatch=0}FinishRenderingPoints(){}Point(x_,y_,size_,opacity_){if(this._pointPtr>=LAST_POINT)this.EndBatch();let p=this._pointPtr;const z=this._baseZ+this._currentZ;if(this._topOfBatch===2&&this._lastPointZ===z)this._batch[this._batchPtr-1]._indexCount++;else{const b=this.PushBatch();b.InitPoints(p,z);this._topOfBatch=2;this._lastPointZ=z}const pd=this._pointData;pd[p++]=x_;pd[p++]=y_;pd[p++]=size_; +pd[p++]=opacity_;this._pointPtr=p}SetProgram(program){if(this._lastProgram===program)return;const b=this.PushBatch();b.InitSetProgram(program);this._lastProgram=program;this._topOfBatch=0;this._currentStateGroup=null}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(c){const b=this.PushBatch();b.InitSetGradientColor(c);this._topOfBatch=0}SetEllipseParams(pixelW,pixelH,outlineThickness=1){const b=this.PushBatch();b.InitSetEllipseParams(pixelW, +pixelH,outlineThickness);this._topOfBatch=0}SetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY){if(this._lastProgram!==this._spTilemapFill)throw new Error("must set tilemap fill mode first");const b=this.PushBatch();b.InitSetTilemapInfo(srcRect,textureWidth,textureHeight,tileWidth,tileHeight,tileSpacingX,tileSpacingY);this._topOfBatch=0}SetTileRandomizationInfo(textureWidth,textureHeight,xRandom,yRandom,angleRandom,blendMarginX,blendMarginY){if(this._lastProgram!== +this._spTileRandomization)throw new Error("must set tile randomization mode first");const b=this.PushBatch();b.InitSetTileRandomizationInfo(textureWidth,textureHeight,xRandom,yRandom,angleRandom,blendMarginX,blendMarginY);this._topOfBatch=0}SetProgramParameters(backTex,destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time){const s=this._lastProgram;time=time%10800;if(!s._hasAnyOptionalUniforms||s.AreOptionalUniformsAlreadySetInBatch(destRect,srcRect,srcOriginRect, +layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time))return;const b=this.PushBatch();b.InitSetProgramParameters();s.SetOptionalUniformsInBatch(destRect,srcRect,srcOriginRect,layoutRect,pixelWidth,pixelHeight,dpr,layerScale,layerAngle,time);const mat4param=b._mat4param;mat4param[0]=pixelWidth;mat4param[1]=pixelHeight;destRect.writeToTypedArray(mat4param,2);mat4param[6]=layerScale;mat4param[7]=layerAngle;srcRect.writeToTypedArray(mat4param,12);const colorParam=b._colorParam;layoutRect.writeToTypedArray(colorParam, +0);const tmp=colorParam[1];colorParam[1]=colorParam[3];colorParam[3]=tmp;srcOriginRect.writeToTypedArray(b._srcOriginRect,0);b._startIndex=time;b._indexCount=dpr;if(s._uSamplerBack.IsUsed())b._texParam=backTex?backTex.GetTexture():null;else b._texParam=null;this._topOfBatch=0}SetProgramCustomParameters(params){const s=this._lastProgram;if(params.length===0||s.AreCustomParametersAlreadySetInBatch(params))return;const b=this.PushBatch();b.InitSetProgramCustomParameters();s.SetCustomParametersInBatch(params); +C3.shallowAssignArray(b._shaderParams,params);this._topOfBatch=0}ClearRgba(r,g,b_,a){const b=this.PushBatch();b.InitClearSurface2(r,g,b_,a);this._topOfBatch=0}Clear(c){const b=this.PushBatch();b.InitClearSurface(c);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){if(!this._usesDepthBuffer||!this._currentRenderTarget||!this._currentRenderTarget.HasDepthBuffer())return;const batch=this.PushBatch();batch.InitClearDepth(this._isDepthEnabled);this._topOfBatch=0}SetDepthEnabled(e){e= +!!e;if(this._isDepthEnabled===e)return;if(!this._usesDepthBuffer)return;this._isDepthEnabled=e;const batch=this.PushBatch();batch.InitSetDepthEnabled(e);this._topOfBatch=0}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(e){e=!!e;if(!this._canSampleDepth)return;if(this._isDepthSamplingEnabled===e)return;if(e&&this.IsDepthEnabled())throw new Error("depth still enabled");this._isDepthSamplingEnabled= +e;const batch=this.PushBatch();batch.InitSetDepthSamplingEnabled(e);this._topOfBatch=0}SetScissorRect(x,y,w,h,rtHeight_=0){x=Math.floor(x);y=Math.floor(y);w=Math.floor(w);h=Math.floor(h);if(this._lastScissorRect.equalsWH(x,y,w,h))return;this._lastScissorRect.setWH(x,y,w,h);const rtHeight=rtHeight_||this.GetRenderTargetSize(this.GetRenderTarget())[1];y=rtHeight-y-h;const batch=this.PushBatch();batch.InitSetScissor(true,x,y,w,h);this._topOfBatch=0}RemoveScissorRect(){if(this._lastScissorRect.getRight()=== +-1)return;this._lastScissorRect.set(0,0,-1,-1);const batch=this.PushBatch();batch.InitSetScissor(false,0,0,0,0);this._topOfBatch=0}CheckForQueryResults(){for(const qrb of this._allQueryResultBuffers)qrb.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();C3.Gfx.WebGLRendererTexture.OnContextLost();C3.Gfx.WebGLRenderTarget.OnContextLost();C3.Gfx.RendererText.OnContextLost(); +for(const qrb of this._allQueryResultBuffers)qrb.Clear();this._extensions=[];this._timerExt=null;this._parallelShaderCompileExt=null;this._anisotropicExt=null;this._depthTextureExt=null;this._fragDepthExt=null;this._stdDerivativesExt=null;this._textureLodExt=null;this._maxAnisotropy=0;this._unmaskedVendor="(unavailable)";this._unmaskedRenderer="(unavailable)";this._lastProgram=null;this._spDeviceTransformTextureFill=null;this._depthBuffer=null;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored= +true;await this.InitState();this._isInitialisingAfterContextRestored=false;for(const stateGroup of this._stateGroups.values())stateGroup.OnContextRestored(this);this.SetSize(this._width,this._height,true)}CreateStaticTexture(data,opts){if(this.IsContextLost())throw new Error("context lost");this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture,this);rendererTex._CreateStatic(data,opts);return rendererTex}async CreateStaticTextureAsync(data,opts){if(this.IsContextLost())throw new Error("context lost"); +opts=Object.assign({},opts);if(C3.Supports.ImageBitmapOptions&&(C3.Platform.Browser!=="Safari"||!(data instanceof ImageData)||typeof Image==="undefined")){let imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"premultiply"});const isTiled=opts.wrapX&&opts.wrapX!=="clamp-to-edge"||opts.wrapY&&opts.wrapY!=="clamp-to-edge";const isPOT=C3.isPOT(imageBitmap.width)&&C3.isPOT(imageBitmap.height);if(!this.SupportsNPOTTextures()&&!isPOT&&isTiled)if(C3.Supports.ImageBitmapOptionsResize){imageBitmap= +await createImageBitmap(data,{"premultiplyAlpha":"premultiply","resizeWidth":C3.nextHighestPowerOfTwo(imageBitmap.width),"resizeHeight":C3.nextHighestPowerOfTwo(imageBitmap.height)});opts.premultiplyAlpha=false}else imageBitmap=await createImageBitmap(data,{"premultiplyAlpha":"none"});else opts.premultiplyAlpha=false;return await C3.Asyncify(()=>this.CreateStaticTexture(imageBitmap,opts))}else{if(data instanceof Blob){if(typeof Image==="undefined")throw new Error("texture upload variant not supported in worker"); +const img=await C3.BlobToImage(data);data=img}return await C3.Asyncify(()=>this.CreateStaticTexture(data,opts))}}CreateDynamicTexture(width,height,opts){this.EndBatch();const rendererTex=C3.New(C3.Gfx.WebGLRendererTexture,this);rendererTex._CreateDynamic(width,height,opts);return rendererTex}UpdateTexture(data,rendererTex,opts){this.EndBatch();rendererTex._Update(data,opts)}DeleteTexture(rendererTex){if(!rendererTex)return;rendererTex.SubtractReference();if(rendererTex.GetReferenceCount()>0)return; +this.EndBatch();if(rendererTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0=null}if(rendererTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1);this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0);this._lastTexture1=null}rendererTex._Delete()}CreateRenderTarget(opts){let width=this._width;let height=this._height;let isDefaultSize=true;if(opts){if(typeof opts.width==="number"){width=opts.width;isDefaultSize= +false}if(typeof opts.height==="number"){height=opts.height;isDefaultSize=false}}if(width<=0||height<=0)throw new Error("invalid size");this.EndBatch();const renderTarget=C3.New(C3.Gfx.WebGLRenderTarget,this);renderTarget._Create(width,height,Object.assign({isDefaultSize},opts));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return renderTarget}SetRenderTarget(renderTarget,updateProjection=true){if(renderTarget===this._currentRenderTarget)return; +if(renderTarget&&renderTarget.IsDefaultSize())renderTarget._Resize(this._width,this._height);const b=this.PushBatch();b.InitSetRenderTarget(renderTarget);this._currentRenderTarget=renderTarget;this._topOfBatch=0;if(updateProjection)this.SetDefaultRenderTargetProjectionState()}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(renderTarget){if(renderTarget)return[renderTarget.GetWidth(),renderTarget.GetHeight()];else return[this._width,this._height]}CopyRenderTarget(renderTarget, +mode="stretch"){if(this._version<2||this._currentRenderTarget&&this._currentRenderTarget.GetMultisampling()>0){this.SetCopyBlend();this.ResetColor();this.DrawRenderTarget(renderTarget,mode)}else{const b=this.PushBatch();b.InitBlitFramebuffer(renderTarget,this._currentRenderTarget,mode);this._topOfBatch=0}}DrawRenderTarget(renderTarget,mode="stretch"){const tex=renderTarget.GetTexture();if(!tex)throw new Error("not a texture-backed render target");this.SetTexture(tex);this.FullscreenQuad(mode,tex)}InvalidateRenderTarget(renderTarget){if(this._version< +2)return;const b=this.PushBatch();b.InitInvalidateFramebuffer(renderTarget._GetFramebuffer());this._topOfBatch=0}DeleteRenderTarget(renderTarget){this.SetRenderTarget(null);this.EndBatch();const renderTex=renderTarget.GetTexture();if(renderTex===this._lastTexture0){this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._lastTexture0=null}if(renderTex===this._lastTexture1){this._gl.activeTexture(this._gl.TEXTURE1);this._gl.bindTexture(this._gl.TEXTURE_2D,null);this._gl.activeTexture(this._gl.TEXTURE0); +this._lastTexture1=null}renderTarget._Delete()}async ReadBackRenderTargetToImageData(renderTarget,forceSynchronous,areaRect){this.EndBatch();const oldRenderTarget=this._currentRenderTarget;let width,height,framebuffer;if(renderTarget){width=renderTarget.GetWidth();height=renderTarget.GetHeight();framebuffer=renderTarget._GetFramebuffer()}else{width=this.GetWidth();height=this.GetHeight();framebuffer=null}let x=0;let y=0;let areaWidth=width;let areaHeight=height;if(areaRect){x=C3.clamp(Math.floor(areaRect.getLeft()), +0,width-1);y=C3.clamp(Math.floor(areaRect.getTop()),0,height-1);let w=areaRect.width();if(w===0)w=width-x;else w=C3.clamp(Math.floor(w),0,width-x);let h=areaRect.height();if(h===0)h=height-y;else h=C3.clamp(Math.floor(h),0,height-y);areaWidth=w;areaHeight=h;y=height-(y+areaHeight)}const gl=this._gl;gl.bindFramebuffer(gl.FRAMEBUFFER,framebuffer);const restorePreviousRenderTarget=()=>{gl.bindFramebuffer(gl.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth= +null;this.SetRenderTarget(oldRenderTarget)};let imageData;if(!forceSynchronous&&this.GetWebGLVersionNumber()>=2){gl.bindFramebuffer(gl.READ_FRAMEBUFFER,framebuffer);const pixelBuffer=gl.createBuffer();const bufferSize=areaWidth*areaHeight*4;const PIXEL_PACK_BUFFER=gl["PIXEL_PACK_BUFFER"];gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl.bufferData(PIXEL_PACK_BUFFER,bufferSize,gl["STREAM_READ"]);gl.readPixels(x,y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,0);gl.bindFramebuffer(gl.READ_FRAMEBUFFER, +null);gl.bindBuffer(PIXEL_PACK_BUFFER,null);restorePreviousRenderTarget();const sync=gl["fenceSync"](gl["SYNC_GPU_COMMANDS_COMPLETE"],0);await this._WaitForObjectReady(()=>gl["getSyncParameter"](sync,gl["SYNC_STATUS"])===gl["SIGNALED"]);gl["deleteSync"](sync);imageData=new ImageData(areaWidth,areaHeight);gl.bindBuffer(PIXEL_PACK_BUFFER,pixelBuffer);gl["getBufferSubData"](PIXEL_PACK_BUFFER,0,new Uint8Array(imageData.data.buffer),0,bufferSize);gl.bindBuffer(PIXEL_PACK_BUFFER,null);gl.deleteBuffer(pixelBuffer)}else{imageData= +new ImageData(areaWidth,areaHeight);gl.readPixels(x,y,areaWidth,areaHeight,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(imageData.data.buffer));restorePreviousRenderTarget()}return imageData}CoplanarStartStencilPass(){this.SetDepthEnabled(true);const batch=this.PushBatch();batch.InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(false);const batch=this.PushBatch();batch.InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(true); +const batch=this.PushBatch();batch.InitCoplanarRestore();this._topOfBatch=0}StartQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitStartQuery(query);this._topOfBatch=0}EndQuery(query){if(!this.SupportsGPUProfiling())return;const b=this.PushBatch();b.InitEndQuery(query);this._topOfBatch=0}_WaitForObjectReady(checkFunc){const ret=new Promise(resolve=>pendingPolls.add({resolve,checkFunc}));if(pollRafId===-1)pollRafId=self.requestAnimationFrame(CheckPendingPolls);return ret}IsDesynchronized(){return!!this._attribs["desynchronized"]}GetEstimatedBackBufferMemoryUsage(){return this._width* +this._height*(this._attribs["alpha"]?4:3)}GetEstimatedRenderBufferMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRenderTarget.allRenderTargets()){if(t.GetTexture())continue;ret+=t.GetEstimatedMemoryUsage()}return ret}GetEstimatedTextureMemoryUsage(){let ret=0;for(const t of C3.Gfx.WebGLRendererTexture.allTextures())ret+=t.GetEstimatedMemoryUsage();return ret}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+ +this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return this.GetWebGLVersionNumber()>=2}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return this._highpPrecision!==0}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetWebGLExtensionsAnalyticsString(){if(this.GetWebGLVersionNumber()>=2)return"webgl2"; +else{const exts=[];if(this._fragDepthExt)exts.push("EXT_frag_depth");if(this._stdDerivativesExt)exts.push("OES_standard_derivatives");if(this._textureLodExt)exts.push("EXT_shader_texture_lod");if(exts.length>0)return"webgl1:"+exts.join(",");else return"webgl1:none"}}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(qrb){this._allQueryResultBuffers.add(qrb)}_RemoveQueryResultBuffer(qrb){this._allQueryResultBuffers.delete(qrb)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(gl){this._InitBlendModeData([["normal", +gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["additive",gl.ONE,gl.ONE],["xor",gl.ONE,gl.ONE_MINUS_SRC_ALPHA],["copy",gl.ONE,gl.ZERO],["destination-over",gl.ONE_MINUS_DST_ALPHA,gl.ONE],["source-in",gl.DST_ALPHA,gl.ZERO],["destination-in",gl.ZERO,gl.SRC_ALPHA],["source-out",gl.ONE_MINUS_DST_ALPHA,gl.ZERO],["destination-out",gl.ZERO,gl.ONE_MINUS_SRC_ALPHA],["source-atop",gl.DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],["destination-atop",gl.ONE_MINUS_DST_ALPHA,gl.SRC_ALPHA]])}CreateRendererText(){return C3.New(C3.Gfx.RendererText, +this)}CreateWebGLText(){return this.CreateRendererText()}}; + +} + +// ../lib/gfx/effectCompositor/effectChainManager.js +{ +'use strict';const C3=self.C3;const DEFAULT_CTOR_OPTS={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null}; +C3.Gfx.EffectChainManager=class EffectChainManager{constructor(opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._cbGetDrawSize=opts.getDrawSize;this._cbGetRenderTarget=opts.getRenderTarget;this._cbReleaseRenderTarget=opts.releaseRenderTarget;this._cbGetTime=opts.getTime;this._cbRedraw=opts.redraw;this._webgpuBackTexture=null;this._allEffectChains=new Set}_AddEffectChain(ec){this._allEffectChains.add(ec)}_RemoveEffectChain(ec){this._allEffectChains.delete(ec)}OnContextLost(){this._webgpuBackTexture= +null;for(const ec of this._allEffectChains)ec.OnContextLost()}GetDrawSize(renderer){if(this._cbGetDrawSize)return this._cbGetDrawSize(renderer);else return[renderer.GetWidth(),renderer.GetHeight()]}GetRenderTarget(effectChain){return this._cbGetRenderTarget(effectChain)}ReleaseRenderTarget(rt,effectChain){this._cbReleaseRenderTarget(rt,effectChain)}GetTime(){return this._cbGetTime()}Redraw(effectChain){this._cbRedraw(effectChain)}_GetWebGPUBackTexture(renderer,width,height){if(this._webgpuBackTexture&& +(this._webgpuBackTexture.GetWidth()!==width||this._webgpuBackTexture.GetHeight()!==height)){renderer.DeleteTexture(this._webgpuBackTexture);this._webgpuBackTexture=null}if(this._webgpuBackTexture===null)this._webgpuBackTexture=renderer.CreateStaticTexture(null,{width,height,sampling:"nearest",mipMap:false});return this._webgpuBackTexture}}; + +} + +// ../lib/gfx/effectCompositor/effectChain.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const glMatrix=self.glMatrix;const mat4=glMatrix.mat4;const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);const tempRect3=C3.New(C3.Rect);const tempRect4=C3.New(C3.Rect);const tempMat4a=mat4.create();const tempMat4b=mat4.create();const DEFAULT_CTOR_OPTS={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:false}; +const DEFAULT_BUILDSTEPS_OPTS={indexMap:null,forcePreDraw:false,forcePostDraw:false,is3D:false,isSourceTextureRotated:false,isRotatedOrNegativeSizeInstance:false,useFullSurface:false}; +C3.Gfx.EffectChain=class EffectChain{constructor(manager,opts){opts=Object.assign({},DEFAULT_CTOR_OPTS,opts);this._manager=manager;this._cbDrawContent=opts.drawContent;this._cbGetSourceTextureInfo=opts.getSourceTextureInfo;this._cbGetShaderParameters=opts.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._needsRebuild=false;this._blendMode=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending= +false;this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._didChangeTransform=false;this._depthEnabledAtStart=false;this._canUseFastPath=false;this._useFullSurface=false;this._isSourceTextureRotated=false;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!opts.invalidateRenderTargets;this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._drawWidth=0;this._drawHeight=0;this._contentObject= +null;this._contextObject=null;this._layoutRect=C3.New(C3.Rect);this._drawSurfaceRect=C3.New(C3.Rect);this._rcTexOriginal=C3.New(C3.Rect);this._rcTexBounce=C3.New(C3.Rect);this._rcTexDest=C3.New(C3.Rect);this._devicePixelRatio=1;this._layerScale=1;this._layerAngle=0;this._time=0;this._destRenderTarget=null;this._backTex=null;this._compositOffX=0;this._compositOffY=0;this._updateOwnProjection=false;this._projectionMatrix=mat4.create();this._modelViewMatrix=mat4.create();this._manager._AddEffectChain(this)}Release(){this._manager._RemoveEffectChain(this); +C3.clearArray(this._steps);C3.clearArray(this._shaderProgramList);C3.clearArray(this._shaderProgramIndices);this._contentObject=null;this._contextObject=null;this._cbDrawContent=null;this._cbGetSourceTextureInfo=null;this._cbGetShaderParameters=null}OnContextLost(){this._needsRebuild=true;C3.clearArray(this._steps);C3.clearArray(this._shaderProgramList);C3.clearArray(this._shaderProgramIndices)}NeedsRebuild(){return this._needsRebuild}BuildSteps(shaderProgramList,opts){opts=Object.assign({},DEFAULT_BUILDSTEPS_OPTS, +opts);C3.clearArray(this._steps);this._boxExtendHorizontal=0;this._boxExtendVertical=0;this._isAnyShaderAnimated=false;this._isAnyShaderDepthSampling=false;this._isAnyShaderBackgroundBlending=false;this._isAnyShaderCrossSampling=false;this._isAnyIsSrcTexRotated=false;this._useCopyTextureBackgroundSampling=false;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!opts.isSourceTextureRotated;this._useFullSurface=!!opts.useFullSurface;this._needsRebuild=false;C3.shallowAssignArray(this._shaderProgramList, +shaderProgramList);if(shaderProgramList.length===0)return;if(opts.indexMap){if(opts.indexMap.length!==shaderProgramList.length)throw new Error("incorrect indexMap length");C3.shallowAssignArray(this._shaderProgramIndices,opts.indexMap)}else{C3.clearArray(this._shaderProgramIndices);for(let i=0,len=shaderProgramList.length;i=1?this._GetRenderTarget():null;this._renderTargets[2]=this._numTempSurfacesRequired===2?this._GetRenderTarget():null;for(const step of this._steps){const srcTarget= +this._GetRenderTargetForId(step.GetSrcTargetId());const destTarget=this._GetRenderTargetForId(step.GetDestTargetId());if(renderer.IsWebGPU())step.Run_WebGPU(renderer,srcTarget,destTarget);else step.Run_WebGL(renderer,srcTarget,destTarget)}if(this._renderTargets[1])this._ReleaseRenderTarget(this._renderTargets[1]);if(this._renderTargets[2])this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(renderer);this._destRenderTarget=null;this._backTex= +null;this._contentObject=null;this._contextObject=null;this._cbDrawContentHook=null}_CalculateDrawSizeAndRectangles(renderer,opts){const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);this._SetDrawSize(renderer,drawWidth,drawHeight);this._CalculateRectangles(opts)}_SetDrawSize(renderer,drawWidth,drawHeight){if(drawWidth<=0||drawHeight<=0)throw new Error("invalid draw size");if(this._drawWidth!==drawWidth||this._drawHeight!==drawHeight)this._CalculateDeviceTransformMatrices(renderer,drawWidth, +drawHeight,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=drawWidth;this._drawHeight=drawHeight}_CalculateDeviceTransformMatrices(renderer,width,height,offX,offY,projMat,mvMat){const scrollX=width/2+offX;const scrollY=height/2+offY;renderer.CalculatePerspectiveMatrix(projMat,width/height);const tempMat4=renderer.CalculateLookAtModelView2(scrollX,scrollY,renderer.GetDefaultCameraZ(height),scrollX,scrollY,0,height);mat4.copy(mvMat,tempMat4)}_CalculateRectangles(opts){this._layoutRect.copy(opts.layoutRect); +if(opts.drawSurfaceRect)this._drawSurfaceRect.copy(opts.drawSurfaceRect);else this._drawSurfaceRect.set(0,0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);const boxScale=this._layerScale*this._devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*boxScale,this._boxExtendVertical*boxScale);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight); +this._drawSurfaceRect.clamp(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,this._drawHeight)}_OnBeforeStartEffectChain(renderer){this._depthEnabledAtStart=renderer.IsDepthEnabled();if(this._useFullSurface){renderer.SetDepthEnabled(false);if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}else{tempRect.copy(this._drawSurfaceRect);if(renderer.IsWebGL()){const boxScale=this._layerScale*this._devicePixelRatio; +tempRect.inflate(Math.max(this._boxExtendHorizontal,1)*boxScale,Math.max(this._boxExtendVertical,1)*boxScale);tempRect.roundOuter();tempRect.clamp(0,0,this._drawWidth,this._drawHeight)}else tempRect.roundOuter();renderer.SetScissorRect(tempRect.getLeft(),tempRect.getTop(),tempRect.width(),tempRect.height(),this._drawHeight)}}_OnAfterEffectChainDrawContent(renderer){renderer.ResetColor();if(!this._useFullSurface){renderer.SetDepthEnabled(false);if(this._isAnyShaderDepthSampling)renderer.SetDepthSamplingEnabled(true)}if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(true)}_OnAfterEndEffectChain(renderer){renderer.SetDepthSamplingEnabled(false); +renderer.SetDepthEnabled(this._depthEnabledAtStart);if(!this._useFullSurface)renderer.RemoveScissorRect();if(renderer.IsWebGPU())renderer.SetNormalizedCoordsProgramVariant(false);this._didChangeTransform=renderer.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(id){return id<0?null:this._renderTargets[id]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(rt){this._manager.ReleaseRenderTarget(rt, +this)}_GetShaderProgramAt(i){return this._shaderProgramList[i]}_DrawContent(renderer){if(this._cbDrawContentHook)this._cbDrawContentHook(this,renderer,()=>this._cbDrawContent(renderer,this));else this._cbDrawContent(renderer,this);if(!this._canUseFastPath)this._OnAfterEffectChainDrawContent(renderer)}_IsRenderTargetSameSizeAndOffset(renderer){if(this._useFullSurface)return true;if(this._compositOffX!==0||this._compositOffY!==0)return false;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget()); +if(rtWidth!==this._drawWidth||rtHeight!==this._drawHeight)return false;return true}_SetDeviceTransform(renderer,isLast){let projMat=this._projectionMatrix;let mvMat=this._modelViewMatrix;if(isLast&&!this._IsRenderTargetSameSizeAndOffset(renderer)){projMat=tempMat4a;mvMat=tempMat4b;const [rtWidth,rtHeight]=renderer.GetRenderTargetSize(renderer.GetRenderTarget());this._CalculateDeviceTransformMatrices(renderer,rtWidth,rtHeight,this._compositOffX,this._compositOffY,projMat,mvMat);if(!this._useFullSurface)renderer.RemoveScissorRect()}renderer.SetProjectionMatrix(projMat); +renderer.SetModelViewMatrix(mvMat)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(index,renderer){return this._cbGetShaderParameters(this._shaderProgramIndices[index],renderer)}_SetProgramParameters(renderer,index){let rcTexDest=this._rcTexDest;let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal;if(renderer.IsWebGL()){tempRect2.copy(rcTexDest);tempRect2.flipAround(1);rcTexDest=tempRect2;tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect); +tempRect4.flipAround(1);srcOriginRect=tempRect4}this._DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(renderer,index){let srcRect=this._rcTexBounce;let srcOriginRect=this._rcTexOriginal;let pixelWidth=1/this._drawWidth;let pixelHeight=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(!srcTexRect){tempRect.set(0,0,0, +0);srcTexRect=tempRect}if(!srcWidth)srcWidth=this._drawWidth;if(!srcHeight)srcHeight=this._drawHeight;srcRect=srcTexRect;srcOriginRect=srcTexRect;pixelWidth=1/srcWidth;pixelHeight=1/srcHeight}else if(renderer.IsWebGL()){tempRect3.copy(srcRect);tempRect3.flipAround(1);srcRect=tempRect3;tempRect4.copy(srcOriginRect);tempRect4.flipAround(1);srcOriginRect=tempRect4}let rcTexDest=this._rcTexDest;if(renderer.IsWebGL()){rcTexDest=tempRect2;rcTexDest.copy(this._rcTexDest);rcTexDest.flipAround(1)}this._DoSetProgramParameters(renderer, +index,srcRect,srcOriginRect,rcTexDest,pixelWidth,pixelHeight);if(renderer.IsWebGPU()&&this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_GetBackTex(renderer){if(this._isAnyShaderBackgroundBlending)if(renderer.IsWebGPU())if(this._UseCopyTextureBackgroundSampling())return this._backTex;else return this._destRenderTarget.GetTexture();else return this._destRenderTarget;else return null}_DoSetProgramParameters(renderer,index,srcRect,srcOriginRect,rcTexDest, +pixelWidth,pixelHeight){renderer.SetProgramParameters(this._GetBackTex(renderer),rcTexDest,srcRect,srcOriginRect,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(index,renderer))}_Render_FastPath(renderer,opts){const shaderProgram=this._shaderProgramList[0];const wasDepthEnabled=renderer.IsDepthEnabled();const usesDepth=shaderProgram.UsesDepth();if(usesDepth){renderer.SetDepthEnabled(false); +renderer.SetDepthSamplingEnabled(true);this._rcTexDest.set(0,0,1,1);this._rcTexOriginal.set(0,0,1,1)}renderer.SetProgram(shaderProgram);renderer.SetBlendMode(this._blendMode);renderer.SetRenderTarget(this._destRenderTarget);let pixelWidth=0;let pixelHeight=1;this._rcTexOriginal.set(0,0,1,1);if(shaderProgram.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect,srcWidth,srcHeight}=this._cbGetSourceTextureInfo(this._contentObject);if(srcTexRect)this._rcTexOriginal.copy(srcTexRect); +pixelWidth=Number.isFinite(srcWidth)?1/srcWidth:0;pixelHeight=Number.isFinite(srcHeight)?1/srcHeight:0}else{const [drawWidth,drawHeight]=this._manager.GetDrawSize(renderer);pixelWidth=1/drawWidth;pixelHeight=1/drawHeight}if(opts.layoutRect)this._layoutRect.copy(opts.layoutRect);else this._layoutRect.set(0,0,0,0);renderer.SetProgramParameters(this._GetBackTex(renderer),this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,pixelWidth,pixelHeight,this._devicePixelRatio,this._layerScale, +this._layerAngle,this._time);renderer.SetProgramCustomParameters(this._GetShaderParameters(0,renderer));if(renderer.IsWebGPU()&&this._isAnyIsSrcTexRotated)renderer.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated);renderer.SetBaseZ(0);this._DrawContent(renderer);if(usesDepth){renderer.SetDepthSamplingEnabled(false);renderer.SetDepthEnabled(wasDepthEnabled)}}_UseCopyTextureBackgroundSampling(){return this._useCopyTextureBackgroundSampling}_UseRenderTargetBackgroundSampling(){return!this._useCopyTextureBackgroundSampling}IsAnyShaderBackgroundBlending(){return this._isAnyShaderBackgroundBlending}CanSkipCalculatingDrawSurfaceRect(){if(!this._canUseFastPath)return false; +if(this._UseCopyTextureBackgroundSampling())return false;return true}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(msg, +renderer,renderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/step.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step=class EffectChainStep{constructor(effectChain,srcTargetId,destTargetId,index=-1){this._effectChain=effectChain;this._srcTargetId=srcTargetId;this._destTargetId=destTargetId;this._index=index}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){}}; + +} + +// ../lib/gfx/effectCompositor/preDrawStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.PreDraw=class PreDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer, +srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetAlphaBlend();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/postDrawStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.PostDraw=class PostDrawStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget);effectChain._SetDeviceTransform(renderer,true);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture()); +tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetTextureFillMode();renderer.SetRenderTarget(destRenderTarget,false);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce()); +else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}renderer.SetBackTexture(null);renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// ../lib/gfx/effectCompositor/firstBounceStep.js +{ +'use strict';const C3=self.C3; +C3.Gfx.EffectChain.Step.FirstBounce=class FirstBounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,effectChain._UpdateOwnProjection());renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex()); +effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget,false);renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend();renderer.SetProgram(this.GetShaderProgram());effectChain._SetFirstBounceProgramParameters(renderer,this.GetIndex());effectChain._DrawContent(renderer);effectChain._ClampRcTexDest()}}; + +} + +// ../lib/gfx/effectCompositor/bounceStep.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad); +C3.Gfx.EffectChain.Step.Bounce=class BounceStep extends C3.Gfx.EffectChain.Step{constructor(effectChain,srcTargetId,destTargetId,index){super(effectChain,srcTargetId,destTargetId,index)}Run_WebGL(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain();renderer.SetRenderTarget(destRenderTarget);const isLast=this.GetDestTargetId()===0;if(isLast)renderer.SetBlendMode(effectChain._GetBlendMode());else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend()}renderer.SetProgram(this.GetShaderProgram()); +effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());effectChain._SetDeviceTransform(renderer,isLast);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect());tempRect.copy(effectChain._GetRcTexBounce());tempRect.flipAround(1);renderer.Quad3(tempQuad,tempRect);if(effectChain._ShouldInvalidateRenderTargets())renderer.InvalidateRenderTarget(srcRenderTarget)}Run_WebGPU(renderer,srcRenderTarget,destRenderTarget){const effectChain=this.GetEffectChain(); +renderer.SetRenderTarget(destRenderTarget,false);const isLast=this.GetDestTargetId()===0;if(isLast){renderer.SetBlendMode(effectChain._GetBlendMode());renderer.SetBackTexture(null);if(effectChain._IsRenderTargetSameSizeAndOffset(renderer))tempQuad.setFromRect(effectChain._GetRcTexBounce());else{renderer.SetNormalizedCoordsProgramVariant(false);effectChain._SetDeviceTransform(renderer,true);tempQuad.setFromRect(effectChain._GetDrawSurfaceRect())}}else{renderer.ClearRgba(0,0,0,0);renderer.SetCopyBlend(); +tempQuad.setFromRect(effectChain._GetRcTexBounce())}renderer.SetProgram(this.GetShaderProgram());effectChain._SetProgramParameters(renderer,this.GetIndex());renderer.SetTexture(srcRenderTarget.GetTexture());if(effectChain.UseFullSurface())renderer.FullscreenQuad();else renderer.Quad3(tempQuad,effectChain._GetRcTexBounce())}}; + +} + +// interfaces/IRuntime.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;let runtime=null;const keysDownByKey=new Set;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}const tempZOrderList=[];const tempInstances=[];let didWarnInAlertPolyfill=false; +self.IRuntime=class IRuntime{constructor(runtime_,objects){runtime=runtime_;Object.defineProperties(this,{assets:{value:runtime.GetAssetManager().GetIAssetManager(),writable:false},objects:{value:objects,writable:false},globalVars:{value:{},writable:false},projectName:{value:runtime.GetProjectName(),writable:false},projectVersion:{value:runtime.GetProjectVersion(),writable:false},storage:{value:new self.IStorage(runtime),writable:false},isInWorker:{value:runtime.IsInWorker(),writable:false},viewportWidth:{value:runtime.GetOriginalViewportWidth(), +writable:false},viewportHeight:{value:runtime.GetOriginalViewportHeight(),writable:false}});runtime.UserScriptDispatcher().addEventListener("keydown",e=>{if(keysDownByKey.has(e["key"])){e.stopPropagation();return}keysDownByKey.add(e["key"])});runtime.UserScriptDispatcher().addEventListener("keyup",e=>keysDownByKey.delete(e["key"]));runtime.Dispatcher().addEventListener("window-blur",()=>keysDownByKey.clear());if(runtime.IsInWorker())self["alert"]=message=>{if(!didWarnInAlertPolyfill){didWarnInAlertPolyfill= +true;console.warn("[Construct] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual.")}return this.alert(message)}}_InitGlobalVars(globalVarDescriptors){Object.defineProperties(this.globalVars, +globalVarDescriptors)}addEventListener(name,func){runtime.UserScriptDispatcher().addEventListener(name,func)}removeEventListener(name,func){runtime.UserScriptDispatcher().removeEventListener(name,func)}callFunction(name,...params){C3X.RequireString(name);const eventSheetManager=runtime.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(name);if(!functionBlock)throw new Error(`cannot find function name '${name}'`);if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +if(params.lengthlayout.GetILayout())}goToLayout(nameOrIndex){const layoutManager=runtime.GetLayoutManager();let layout=null;if(typeof nameOrIndex==="number"||typeof nameOrIndex==="string")layout=layoutManager.GetLayout(nameOrIndex);else throw new TypeError("expected string or number");if(!layout)throw new Error("invalid layout");if(layoutManager.IsPendingChangeMainLayout())return; +layoutManager.ChangeMainLayout(layout)}get keyboard(){const ret=runtime._GetCommonScriptInterfaces().keyboard;if(!ret)throw new Error("runtime.keyboard used but Keyboard object missing - add it to your project first");return ret}get mouse(){const ret=runtime._GetCommonScriptInterfaces().mouse;if(!ret)throw new Error("runtime.mouse used but Mouse object missing - add it to your project first");return ret}get touch(){const ret=runtime._GetCommonScriptInterfaces().touch;if(!ret)throw new Error("runtime.touch used but Touch object missing - add it to your project first"); +return ret}invokeDownload(url,filename){C3X.RequireString(url);C3X.RequireString(filename);runtime.InvokeDownload(url,filename)}getInstanceByUid(uid){C3X.RequireFiniteNumber(uid);const ret=runtime.GetInstanceByUID(uid);return ret?ret.GetInterfaceClass():null}sortZOrder(iterable,callback){C3X.RequireFunction(callback);const layout=runtime.GetCurrentLayout();for(const iinst of iterable){const inst=runtime._UnwrapIWorldInstance(iinst);const wi=inst.GetWorldInfo();tempZOrderList.push([wi.GetLayer().GetIndex(), +wi.GetZIndex()]);tempInstances.push(inst)}if(tempZOrderList.length===0)return;tempZOrderList.sort(SortZOrderList);tempInstances.sort((a,b)=>callback(a.GetInterfaceClass(),b.GetInterfaceClass()));let anyChanged=false;for(let i=0,len=tempZOrderList.length;i0)throw new Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");map.get(this)._SetUserScriptInstanceClass(Class)}createInstance(layerNameOrIndex,x,y,createHierarchy,template){C3X.RequireNumber(x);C3X.RequireNumber(y);if(typeof layerNameOrIndex!=="number"&&typeof layerNameOrIndex!=="string")throw new TypeError("invalid layer parameter");const objectClass=map.get(this);const runtime=objectClass.GetRuntime(); +const layer=runtime.GetMainRunningLayout().GetLayer(layerNameOrIndex);if(!layer)throw new Error("invalid layer");const inst=runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager=runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(!eventSheetManager.IsInEventEngine()&&!runtime.GetLayoutManager().IsEndingLayout())runtime.FlushPendingInstances(); +return inst.GetInterfaceClass()}}; + +} + +// interfaces/ILayout.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const VALID_WHERE_STRINGS=["above","below","top-sublayer","bottom-sublayer"]; +self.ILayout=class ILayout{constructor(layout){map.set(this,layout);const effectInstanceArr=[];const effectList=layout.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;ilayer.GetILayer())}*allLayers(){for(const layer of map.get(this).allLayers())yield layer.GetILayer()}addLayer(layerName,iInsertBy,whereStr){const ILayer=self.ILayer;C3X.RequireString(layerName);C3X.RequireInstanceOf(iInsertBy,ILayer);const insertBy=ILayer._Unwrap(iInsertBy);if(!insertBy)throw new Error("invalid layer");const where=VALID_WHERE_STRINGS.indexOf(whereStr);if(where<0)throw new Error("invalid location"); +map.get(this).AddLayer(layerName,insertBy,where)}moveLayer(iLayer,iInsertBy,whereStr){const ILayer=self.ILayer;C3X.RequireInstanceOf(iLayer,ILayer);C3X.RequireInstanceOf(iInsertBy,ILayer);const layer=ILayer._Unwrap(iLayer);const insertBy=ILayer._Unwrap(iInsertBy);if(!layer||!insertBy)throw new Error("invalid layer");const where=VALID_WHERE_STRINGS.indexOf(whereStr);if(where<0)throw new Error("invalid location");map.get(this).MoveLayer(layer,insertBy,where)}removeLayer(iLayer){const ILayer=self.ILayer; +C3X.RequireInstanceOf(iLayer,ILayer);const layer=ILayer._Unwrap(iLayer);if(!layer)throw new Error("invalid layer");map.get(this).RemoveLayer(layer)}removeAllDynamicLayers(){map.get(this).RemoveAllDynamicLayers()}setVanishingPoint(vpX,vpY){C3X.RequireFiniteNumber(vpX);C3X.RequireFiniteNumber(vpY);map.get(this).SetVanishingPointXY(vpX,vpY)}getVanishingPoint(){return map.get(this)._GetVanishingPoint()}set projection(p){C3X.RequireString(p);const layout=map.get(this);if(p==="perspective")layout.SetPerspectiveProjection(); +else if(p==="orthographic")layout.SetOrthographicProjection();else throw new Error("invalid projection");}get projection(){if(map.get(this).IsOrthographicProjection())return"orthographic";else return"perspective"}}; + +} + +// interfaces/ILayer.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.ILayer=class ILayer{constructor(layer){map.set(this,layer);const effectInstanceArr=[];const effectList=layer.GetEffectList();const effectCount=effectList.GetAllEffectTypes().length;for(let i=0;is.GetInterfaceClass()):[]}*otherContainerInstances(){const inst=map.get(this);if(!inst.IsInContainer())return;for(const s of inst.siblings())yield s.GetInterfaceClass()}get templateName(){return map.get(this).GetTemplateName()}set timeScale(t){C3X.RequireFiniteNumber(t); +map.get(this).SetTimeScale(t)}get timeScale(){return map.get(this).GetActiveTimeScale()}restoreTimeScale(){map.get(this).RestoreTimeScale()}}; + +} + +// interfaces/IWorldInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;const ILayer=self.ILayer;const map=new WeakMap;const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);const INDEX_TO_BLEND_MODE=new Map([...BLEND_MODE_TO_INDEX.entries()].map(a=>[a[1],a[0]]));const tempColor=C3.New(C3.Color); +self.IWorldInstance=class IWorldInstance extends IInstance{constructor(){super();const inst=IInstance._GetInitInst();map.set(this,inst);const effectInstanceArr=[];const wi=inst.GetWorldInfo();const instanceEffectList=wi.GetInstanceEffectList();if(instanceEffectList){const effectCount=wi.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let i=0;iinst.GetInterfaceClass())}}; + +} + +// interfaces/IEffectInstance.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const tempColor=C3.New(C3.Color); +self.IEffectInstance=class IEffectInstance{constructor(effectList,index){map.set(this,effectList);const descriptors={index:{value:index,writable:false}};Object.defineProperties(this,descriptors)}get name(){const effectTypes=map.get(this).GetAllEffectTypes();return effectTypes[this.index].GetName()}get isActive(){return map.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const fxList=map.get(this);if(fxList.IsEffectIndexActive(this.index)===a)return;fxList.SetEffectIndexActive(this.index, +a);fxList.UpdateActiveEffects();fxList.GetRuntime().UpdateRender()}setParameter(i,v){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const oldValue=fxList.GetEffectParameter(this.index,i);if(oldValue===null)throw new RangeError("invalid index");if(oldValue instanceof C3.Color){if(!Array.isArray(v)||v.length<3)throw new TypeError("expected array with 3 elements");tempColor.setRgb(v[0],v[1],v[2]);v=tempColor}else if(typeof v!=="number")throw new TypeError("expected number");const didChange= +fxList.SetEffectParameter(this.index,i,v);if(didChange&&fxList.IsEffectIndexActive(this.index))fxList.GetRuntime().UpdateRender()}getParameter(i){C3X.RequireFiniteNumber(i);i=Math.floor(+i);const fxList=map.get(this);const ret=fxList.GetEffectParameter(this.index,i);if(ret===null)throw new RangeError("invalid index");if(ret instanceof C3.Color)return[ret.getR(),ret.getG(),ret.getB()];else return ret}}; + +} + +// interfaces/IAnimation.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.IAnimation=class IAnimation{constructor(animationInfo){map.set(this,animationInfo);Object.defineProperties(this,{name:{value:animationInfo.GetName(),writable:false},speed:{value:animationInfo.GetSpeed(),writable:false},isLooping:{value:animationInfo.IsLooping(),writable:false},repeatCount:{value:animationInfo.GetRepeatCount(),writable:false},repeatTo:{value:animationInfo.GetRepeatTo(),writable:false},isPingPong:{value:animationInfo.IsPingPong(),writable:false},frameCount:{value:animationInfo.GetFrameCount(), +writable:false}})}getFrames(){return map.get(this).GetFrames().map(f=>f.GetIAnimationFrame())}*frames(){for(const f of map.get(this).GetFrames())yield f.GetIAnimationFrame()}}; + +} + +// interfaces/IImageInfo.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;self.IImageInfo=class IImageInfo{constructor(imageInfo){map.set(this,imageInfo)}get width(){return map.get(this).GetWidth()}get height(){return map.get(this).GetHeight()}getSize(){const imageInfo=map.get(this);return[imageInfo.GetWidth(),imageInfo.GetHeight()]}}; + +} + +// interfaces/IAnimationFrame.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap; +self.IAnimationFrame=class IAnimationFrame extends self.IImageInfo{constructor(animationFrameInfo){super(animationFrameInfo.GetImageInfo());map.set(this,animationFrameInfo);Object.defineProperties(this,{duration:{value:animationFrameInfo.GetDuration(),writable:false},originX:{value:animationFrameInfo.GetOriginX(),writable:false},originY:{value:animationFrameInfo.GetOriginY(),writable:false}})}getOrigin(){const afi=map.get(this);return[afi.GetOriginX(),afi.GetOriginY()]}getImagePointCount(){return map.get(this).GetImagePointCount()}getImagePointX(nameOrIndex){return this.getImagePoint(nameOrIndex)[0]}getImagePointY(nameOrIndex){return this.getImagePoint(nameOrIndex)[1]}getImagePoint(nameOrIndex){const afi= +map.get(this);let ip=null;if(typeof nameOrIndex==="number")ip=afi.GetImagePointByIndex(Math.floor(nameOrIndex));else if(typeof nameOrIndex==="string")ip=afi.GetImagePointByName(nameOrIndex);else throw new TypeError("expected string or number");if(!ip)return this.getOrigin();return[ip.GetX(),ip.GetY()]}getPolyPointCount(){const poly=map.get(this).GetCollisionPoly();return poly?poly.pointCount():0}getPolyPointX(index){return this.getPolyPoint(index)[0]}getPolyPointY(index){return this.getPolyPoint(index)[1]}getPolyPoint(index){C3X.RequireFiniteNumber(index); +index=Math.floor(index);const poly=map.get(this).GetCollisionPoly();if(!poly||index<0||index>=poly.pointCount())return[0,0];const pointsArr=poly.pointsArr();const ptX=pointsArr[index*2];const ptY=pointsArr[index*2+1];return[ptX,ptY]}}; + +} + +// interfaces/ITimelineState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;function GetTimelineState(iface){const timelineState=map.get(iface);if(timelineState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return timelineState} +self.ITimelineState=class ITimelineState{constructor(timelineState){map.set(this,timelineState)}pause(){GetTimelineState(this).Stop()}resume(){GetTimelineState(this).Resume()}hasTags(tags){return GetTimelineState(this).HasTags(tags)}set time(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTime(t)}get time(){return GetTimelineState(this).GetTime()}set totalTime(t){C3X.RequireFiniteNumber(t);GetTimelineState(this).SetTotalTime(t)}get totalTime(){return GetTimelineState(this).GetTotalTime()}set isLooping(l){GetTimelineState(this).SetLoop(!!l)}get isLooping(){return GetTimelineState(this).GetLoop()}set isPingPong(p){GetTimelineState(this).SetPingPong(!!p)}get isPingPong(){return GetTimelineState(this).GetPingPong()}set playbackRate(p){C3X.RequireFiniteNumber(p); +GetTimelineState(this).SetPlaybackRate(p)}get playbackRate(){return GetTimelineState(this).GetPlaybackRate()}get progress(){const timelineState=GetTimelineState(this);return timelineState.GetTime()/timelineState.GetTotalTime()}get tags(){return GetTimelineState(this).GetTags()}get finished(){return GetTimelineState(this).GetPlayPromise()}get isPlaying(){return GetTimelineState(this).IsPlaying()}get isPaused(){return GetTimelineState(this).IsPaused()}get isReleased(){return map.get(this).IsReleased()}}; + +} + +// interfaces/ITweenState.js +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const map=new WeakMap;const behInstMap=new WeakMap;let easeToIndexFunc=null;function GetTweenState(iface){const tweenState=map.get(iface);if(tweenState.IsReleased())throw new Error("timeline/tween was released and is no longer valid");return tweenState} +self.ITweenState=class ITweenState extends self.ITimelineState{constructor(tweenState,behInst,opts){super(tweenState);if(!easeToIndexFunc)easeToIndexFunc=opts.easeToIndexFunc;map.set(this,tweenState);if(behInst)behInstMap.set(this,behInst)}stop(){const tweenState=GetTweenState(this);const behInst=behInstMap.get(this);behInst.ReleaseTween(tweenState)}setEase(easeName){C3X.RequireString(easeName);const ease=self.Ease.GetEaseFromIndex(easeToIndexFunc(easeName));GetTweenState(this).SetEase(ease)}get instance(){const inst= +GetTweenState(this).GetInstance();return inst?inst.GetInterfaceClass():null}get isDestroyOnComplete(){return GetTweenState(this).GetDestroyInstanceOnComplete()}set isDestroyOnComplete(d){GetTweenState(this).SetDestroyInstanceOnComplete(!!d)}get value(){const tweenState=GetTweenState(this);if(tweenState.GetId()!=="value")throw new Error("not a value tween");return tweenState.GetPropertyTrack("value").GetSourceAdapterValue()}}; + +} + +// assets/assetManager.js +{ +'use strict';const C3=self.C3;const VALID_LOAD_POLICIES=new Set(["local","remote"]);const EXT_TO_TYPE=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function GetTypeFromFileExtension(filename){if(!filename)return"";const parts=filename.split(".");if(parts.length<2)return"";const ext=parts.at(-1).toLowerCase();return EXT_TO_TYPE.get(ext)||""} +function AddScript(url){return new Promise((resolve,reject)=>{const elem=document.createElement("script");elem.onload=resolve;elem.onerror=reject;elem.async=false;elem.type="module";elem.src=url;document.head.appendChild(elem)})} +C3.AssetManager=class AssetManager extends C3.DefendedBase{constructor(runtime,opts){super();const exportType=opts["exportType"];this._runtime=runtime;this._fileStructure="folders";this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova=exportType==="cordova";this._isiOSCordova=!!opts["isiOSCordova"];this._isFileProtocol=!!opts["isFileProtocol"];this._swClientId=opts["swClientId"];this._supportedAudioFormats=opts["supportedAudioFormats"]||{};this._audioFiles= +new Map;this._preloadSounds=false;this._mediaSubfolder="";this._fontsSubfolder="";this._iconsSubfolder="";const isRemoteLoadPolicy=exportType==="html5"||exportType==="scirra-arcade"||exportType==="instant-games";this._defaultLoadPolicy=isRemoteLoadPolicy?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=false;this._totalAssetSizeToLoad=0;this._assetSizeLoaded=0;this._lastLoadProgress=0;this._hasHadErrorLoading=false; +this._loadingRateLimiter=C3.New(C3.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new C3.PromiseThrottle(Math.max(C3.hardwareConcurrency,8));const localUrlBlobs=opts["previewImageBlobs"];if(localUrlBlobs){const projectFileBlobs=opts["previewProjectFileBlobs"];if(projectFileBlobs)Object.assign(localUrlBlobs,projectFileBlobs);const projectData=opts["projectData"];if(projectData)localUrlBlobs["data.json"]=projectData;for(const [url,blob]of Object.entries(localUrlBlobs))this._localUrlBlobs.set(url, +blob)}const localSWUrlMap=opts["previewProjectFileSWUrls"];if(localSWUrlMap)for(const [srcUrl,destUrl]of Object.entries(localSWUrlMap))this._localBlobSWUrls.set(srcUrl,destUrl);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const url of this._localBlobUrlCache.values())if(url.startsWith("blob:"))URL.revokeObjectURL(url);this._localBlobUrlCache.clear();for(const asset of this._allAssets)asset.Release();C3.clearArray(this._allAssets);this._assetsByUrl.clear(); +C3.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetFileStructure(f){this._fileStructure=f;if(f==="flat"){const newMap=new Map;for(const [url,blob]of this._localUrlBlobs.entries())newMap.set(url.toLowerCase(),blob);this._localUrlBlobs=newMap}}GetFileStructure(){return this._fileStructure}_SetMediaSubfolder(folder){this._mediaSubfolder=folder}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(folder){this._fontsSubfolder=folder}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(folder){this._iconsSubfolder= +folder}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.has(url)}_GetLocalUrlBlob(url){if(this._fileStructure==="flat")url=url.toLowerCase();return this._localUrlBlobs.get(url)||null}GetLocalUrlAsBlobUrl(url){if(this._fileStructure==="flat")url=url.toLowerCase();if(!this._HasLocalUrlBlob(url))return url;let ret=this._localBlobUrlCache.get(url);if(!ret){const blob= +this._GetLocalUrlBlob(url);ret=URL.createObjectURL(blob);this._localBlobUrlCache.set(url,ret)}return ret}FetchBlob(url,loadPolicy){loadPolicy=loadPolicy||this._defaultLoadPolicy;const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return Promise.resolve(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlob(url);else if(loadPolicy==="local")return this._promiseThrottle.Add(()=> +C3.FetchBlob(url));else return C3.FetchBlob(url)}else return C3.FetchBlob(url)}FetchArrayBuffer(url){const localBlob=this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToArrayBuffer(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsArrayBuffer(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchArrayBuffer(url));else return C3.FetchArrayBuffer(url)}else return C3.FetchArrayBuffer(url)}FetchText(url){const localBlob= +this._GetLocalUrlBlob(url);if(localBlob)return C3.BlobToString(localBlob);else if(C3.IsRelativeURL(url)){if(this._fileStructure==="flat")url=url.toLowerCase();if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsText(url);else if(this._defaultLoadPolicy==="local")return this._promiseThrottle.Add(()=>C3.FetchText(url));else return C3.FetchText(url)}else return C3.FetchText(url)}async FetchJson(url){const text=await this.FetchText(url);return JSON.parse(text)}_CordovaFetchLocalFileAs(filename, +as_){if(this._fileStructure==="flat")filename=filename.toLowerCase();return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{"filename":filename,"as":as_})}CordovaFetchLocalFileAsText(filename){return this._CordovaFetchLocalFileAs(filename,"text")}async CordovaFetchLocalFileAsBlob(filename){const buffer=await this._CordovaFetchLocalFileAs(filename,"buffer");const type=GetTypeFromFileExtension(filename);return new Blob([buffer],{"type":type})}async CordovaFetchLocalFileAsBlobURL(filename){if(this._fileStructure=== +"flat")filename=filename.toLowerCase();let blobUrl=this._localBlobUrlCache.get(filename);if(blobUrl)return blobUrl;const blob=await this.CordovaFetchLocalFileAsBlob(filename);blobUrl=URL.createObjectURL(blob);this._localBlobUrlCache.set(filename,blobUrl);return blobUrl}CordovaFetchLocalFileAsArrayBuffer(filename){return this._CordovaFetchLocalFileAs(filename,"buffer")}GetMediaFileUrl(filename){if(this._fileStructure==="flat")filename=filename.toLowerCase();filename=this._mediaSubfolder+filename;if(this._HasLocalUrlBlob(filename))return this.GetLocalUrlAsBlobUrl(filename); +else return filename}GetProjectFileUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else if(this._HasLocalUrlBlob(url))return Promise.resolve(this.GetLocalUrlAsBlobUrl(url));else if(this._isCordova&&this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(url);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}GetProjectFileIframeUrl(url){if(C3.IsAbsoluteURL(url))return Promise.resolve(url);else{const queryIndex=url.indexOf("?");const queryStr= +queryIndex===-1?"":url.substr(queryIndex);const urlNoSearch=queryIndex===-1?url:url.substr(0,queryIndex);if(this._HasLocalUrlBlob(urlNoSearch)){let localUrl=this._localBlobSWUrls.get(urlNoSearch)||this.GetLocalUrlAsBlobUrl(urlNoSearch);if(!localUrl.startsWith("blob:")&&this._swClientId){const asUrl=new URL(localUrl);const params=new URLSearchParams(queryStr);params.set("__c3_client_id",this._swClientId);asUrl.search=params.toString();localUrl=asUrl.toString()}return Promise.resolve(localUrl)}else if(this._isCordova&& +this._isFileProtocol)return this.CordovaFetchLocalFileAsBlobURL(urlNoSearch);else{if(this._fileStructure==="flat")url=url.toLowerCase();return Promise.resolve(url)}}}LoadProjectFileUrl(url){return this.GetProjectFileUrl(url)}LoadImage(opts){if(opts.loadPolicy&&!VALID_LOAD_POLICIES.has(opts.loadPolicy))throw new Error("invalid load policy");let asset=this._assetsByUrl.get(opts.url);if(asset)return asset;asset=C3.New(C3.ImageAsset,this,{url:opts.url,size:opts.size||0,loadPolicy:opts.loadPolicy||this._defaultLoadPolicy}); +this._allAssets.push(asset);this._assetsByUrl.set(asset.GetURL(),asset);if(!this._hasFinishedInitialLoad){this._totalAssetSizeToLoad+=asset.GetSize();this._loadPromises.push(asset.Load().then(()=>this._AddLoadedSize(asset.GetSize())))}return asset}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises);this._lastLoadProgress=1}catch(err){console.error("Error loading: ",err);this._hasHadErrorLoading=true;this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad= +true}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(s){this._assetSizeLoaded+=s;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const event=C3.New(C3.Event,"loadingprogress");this._lastLoadProgress=C3.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);event.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(event)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(arr){C3.shallowAssignArray(this._webFonts,arr);if(this._webFonts.length)this._loadPromises.push(this._LoadWebFonts())}async _LoadWebFonts(){const promises= +[];const loadFontsForDOM=[];for(const [name,filename,size]of this._webFonts){this._totalAssetSizeToLoad+=size;promises.push(this._LoadWebFont(name,filename,loadFontsForDOM).then(()=>this._AddLoadedSize(size)))}await Promise.all(promises);if(this._runtime.IsInWorker()&&loadFontsForDOM.length>0)await this._runtime.PostComponentMessageToDOMAsync("runtime","load-webfonts",{"webfonts":loadFontsForDOM})}async _LoadWebFont(name,filename,loadFontsForDOM){try{const url=await this.GetProjectFileUrl(filename); +const fontFace=new FontFace(name,`url('${url}')`);if(this._runtime.IsInWorker())self.fonts.add(fontFace);else document.fonts.add(fontFace);await fontFace.load();if(this._runtime.IsInWorker())loadFontsForDOM.push({name,url})}catch(err){console.warn(`[C3 runtime] Failed to load web font '${name}': `,err)}}IsAudioFormatSupported(type){return!!this._supportedAudioFormats[type]}_SetAudioFiles(arr,preloadSounds){this._preloadSounds=!!preloadSounds;for(const [fileName,projectFilesInfo,isMusic]of arr)this._audioFiles.set(fileName, +{fileName,formats:projectFilesInfo.map(si=>({type:si[0],fileExtension:si[1],fullName:fileName+si[1],fileSize:si[2]})),isMusic})}GetPreferredAudioFile(namePart){if(this._fileStructure==="flat")namePart=namePart.toLowerCase();const info=this._audioFiles.get(namePart);if(!info)return null;let webMOpusFile=null;for(const formatInfo of info.formats){if(!webMOpusFile&&formatInfo.type==="audio/webm; codecs=opus")webMOpusFile=formatInfo;if(this.IsAudioFormatSupported(formatInfo.type))return formatInfo}return webMOpusFile}GetProjectAudioFileUrl(namePart){const formatInfo= +this.GetPreferredAudioFile(namePart);if(!formatInfo)return null;return{url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type}}GetAudioToPreload(){if(this._preloadSounds){const ret=[];for(const info of this._audioFiles.values()){if(info.isMusic)continue;const formatInfo=this.GetPreferredAudioFile(info.fileName);if(!formatInfo)continue;ret.push({originalUrl:info.fileName,url:this.GetMediaFileUrl(formatInfo.fullName),type:formatInfo.type,fileSize:formatInfo.fileSize})}return ret}else return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...urls){const scriptUrls= +await Promise.all(urls.map(url=>this.GetProjectFileUrl(url)));if(this._runtime.IsInWorker())if(urls.length===1){const url=urls[0];await self.c3_import((C3.IsRelativeURL(url)?"./":"")+url)}else{const scriptStr=urls.map(url=>`import "${C3.IsRelativeURL(url)?"./":""}${url}";`).join("\n");const blobUrl=URL.createObjectURL(new Blob([scriptStr],{type:"application/javascript"}));await self.c3_import(blobUrl)}else await Promise.all(scriptUrls.map(url=>AddScript(url)))}async CompileWebAssembly(url){if(WebAssembly.compileStreaming){const fetchUrl= +await this.GetProjectFileUrl(url);return await WebAssembly.compileStreaming(fetch(fetchUrl))}else{const arrayBuffer=await C3.FetchArrayBuffer(url);return await WebAssembly.compile(arrayBuffer)}}async LoadStyleSheet(url){const fetchUrl=await this.GetProjectFileUrl(url);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{"url":fetchUrl})}}; + +} + +// assets/asset.js +{ +'use strict';const C3=self.C3; +C3.Asset=class Asset extends C3.DefendedBase{constructor(assetManager,opts){super();this._assetManager=assetManager;this._runtime=assetManager.GetRuntime();this._url=opts.url||"";this._size=opts.size;this._loadPolicy=opts.loadPolicy;this._blob=opts.blob||null;this._isLoaded=!!this._blob;this._loadPromise=null}Release(){this._loadPromise=null;this._assetManager=null;this._runtime=null;this._blob=null}GetURL(){return this._url}GetSize(){return this._size}Load(){if(this._loadPolicy==="local"||this._blob){this._isLoaded= +true;return Promise.resolve()}if(this._loadPromise)return this._loadPromise;this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(blob=>{this._isLoaded=true;this._loadPromise=null;this._blob=blob;return blob}).catch(err=>console.error("Error loading resource: ",err));return this._loadPromise}IsLoaded(){return this._isLoaded}GetBlob(){if(this._blob)return Promise.resolve(this._blob);if(this._loadPromise)return this._loadPromise;return this._assetManager.FetchBlob(this._url, +this._loadPolicy)}}; + +} + +// assets/imageAsset.js +{ +'use strict';const C3=self.C3;const promiseThrottle=new C3.PromiseThrottle;const allImageAssets=new Set; +C3.ImageAsset=class ImageAsset extends C3.Asset{constructor(assetManager,opts){super(assetManager,opts);this._texturePromise=null;this._webglTexture=null;this._refCount=0;this._imageWidth=-1;this._imageHeight=-1;allImageAssets.add(this)}Release(){this.ReleaseTexture();if(this._refCount!==0)throw new Error("released image asset which still has texture references");this._texturePromise=null;allImageAssets.delete(this);super.Release()}static OnRendererContextLost(){for(const imageAsset of allImageAssets){imageAsset._texturePromise= +null;imageAsset._webglTexture=null;imageAsset._refCount=0}}LoadStaticTexture(renderer,opts){opts=opts||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;opts.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texturePromise=this.GetBlob().then(blob=>promiseThrottle.Add(()=>renderer.CreateStaticTextureAsync(blob,opts).then(texture=>{this._texturePromise=null;if(this._refCount===0){renderer.DeleteTexture(texture); +return null}this._webglTexture=texture;this._imageWidth=texture.GetWidth();this._imageHeight=texture.GetHeight();return this._webglTexture}))).catch(err=>{console.error("Failed to load texture: ",err);throw err;});return this._texturePromise}ReleaseTexture(){if(this._refCount<=0)throw new Error("texture released too many times");this._refCount--;if(this._refCount===0&&this._webglTexture){const renderer=this._webglTexture.GetRenderer();renderer.DeleteTexture(this._webglTexture);this._webglTexture= +null}}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const blob=await this.GetBlob();if(C3.Supports.ImageBitmap)return await createImageBitmap(blob);else return await C3.BlobToImage(blob)}}; + +} + +// layouts/renderCell.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()} +C3.RenderCell=class RenderCell extends C3.DefendedBase{constructor(grid,x,y){super();this._grid=grid;this._x=x;this._y=y;this._instances=[];this._isSorted=true;this._pendingRemoval=new Set;this._isAnyPendingRemoval=false}Release(){C3.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){C3.clearArray(this._instances);this._isSorted=true;this._pendingRemoval.clear();this._isAnyPendingRemoval=false}SetChanged(){this._isSorted=false}IsEmpty(){if(!this._instances.length)return true; +if(this._instances.length>this._pendingRemoval.size)return false;this._FlushPending();return true}Insert(inst){if(this._pendingRemoval.has(inst)){this._pendingRemoval.delete(inst);if(this._pendingRemoval.size===0)this._isAnyPendingRemoval=false;return}this._instances.push(inst);this._isSorted=this._instances.length===1}Remove(inst){this._pendingRemoval.add(inst);this._isAnyPendingRemoval=true;if(this._pendingRemoval.size>=50)this._FlushPending()}_FlushPending(){if(!this._isAnyPendingRemoval)return; +if(this._instances.length===this._pendingRemoval.size){this.Reset();return}C3.arrayRemoveAllInSet(this._instances,this._pendingRemoval);this._pendingRemoval.clear();this._isAnyPendingRemoval=false}_EnsureSorted(){if(this._isSorted)return;this._instances.sort(SortByInstLastCachedZIndex);this._isSorted=true}Dump(result){this._FlushPending();this._EnsureSorted();if(this._instances.length)result.push(this._instances)}}; + +} + +// layouts/renderGrid.js +{ +'use strict';const C3=self.C3; +C3.RenderGrid=class RenderGrid extends C3.DefendedBase{constructor(cellWidth,cellHeight){super();this._cellWidth=cellWidth;this._cellHeight=cellHeight;this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(x,y,createIfMissing){let ret=this._cells.Get(x,y);if(ret)return ret;else if(createIfMissing){ret=C3.New(C3.RenderCell,this,x,y);this._cells.Set(x,y,ret);return ret}else return null}XToCell(x){return Math.floor(x/this._cellWidth)}YToCell(y){return Math.floor(y/this._cellHeight)}Update(inst, +oldRange,newRange){if(oldRange)for(let x=oldRange.getLeft(),lenx=oldRange.getRight();x<=lenx;++x)for(let y=oldRange.getTop(),leny=oldRange.getBottom();y<=leny;++y){if(newRange&&newRange.containsPoint(x,y))continue;const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Remove(inst);if(cell.IsEmpty())this._cells.Delete(x,y)}if(newRange)for(let x=newRange.getLeft(),lenx=newRange.getRight();x<=lenx;++x)for(let y=newRange.getTop(),leny=newRange.getBottom();y<=leny;++y){if(oldRange&&oldRange.containsPoint(x, +y))continue;this.GetCell(x,y,true).Insert(inst)}}QueryRange(rc,result){let x=this.XToCell(rc.getLeft());const ystart=this.YToCell(rc.getTop());const lenx=this.XToCell(rc.getRight());const leny=this.YToCell(rc.getBottom());for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell=this.GetCell(x,y,false);if(!cell)continue;cell.Dump(result)}}MarkRangeChanged(rc){let x=rc.getLeft();const ystart=rc.getTop();const lenx=rc.getRight();const leny=rc.getBottom();for(;x<=lenx;++x)for(let y=ystart;y<=leny;++y){const cell= +this.GetCell(x,y,false);if(!cell)continue;cell.SetChanged()}}}; + +} + +// layouts/layer.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const renderCellArr=[];const tmpDestRect=new C3.Rect;const tmpSrcRect=new C3.Rect;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const mat4=glMatrix.mat4;const tempMat4=mat4.create();const tempVec3=vec3.create();const tempVec4=vec4.create();const camVector=vec3.create();const lookVector=vec3.create();const upVector=vec3.create();const tempVec2=C3.New(C3.Vector2); +const tempRect=C3.New(C3.Rect);function SortByInstLastCachedZIndex(a,b){return a.GetWorldInfo()._GetLastCachedZIndex()-b.GetWorldInfo()._GetLastCachedZIndex()}function SortByInstZElevation(a,b){return a.GetWorldInfo().GetZElevation()-b.GetWorldInfo().GetZElevation()}const tempInstanceList1=[];const tempInstanceList2=[];const tempInstancesByCameraDist=[]; +const DEFAULT_LAYER_OPTIONS={name:"",sid:-1,isDynamic:false,isVisible:true,isInteractive:true,backgroundColor:[1,1,1,1],isTransparent:true,parallax:[1,1],opacity:1,isForceOwnTexture:false,renderAs3d:false,useCameraDistanceDrawOrder:false,useRenderCells:false,scaleRate:1,blendMode:0,zElevation:0,initialInstancesData:[],effectListData:[],subLayersData:[]}; +C3.Layer=class Layer extends C3.DefendedBase{constructor(layout,parentLayer,opts){super();opts=Object.assign({},DEFAULT_LAYER_OPTIONS,opts);this._layout=layout;this._runtime=layout.GetRuntime();this._parentLayer=parentLayer;this._name=opts.name;this._index=-1;this._sid=opts.sid;this._isDynamic=!!opts.isDynamic;this._isVisible=!!opts.isVisible;this._isInteractive=!!opts.isInteractive;this._backgroundColor=C3.New(C3.Color);this._backgroundColor.setFromJSON(opts.backgroundColor);this._isTransparent= +!!opts.isTransparent;this._parallaxX=opts.parallax[0];this._parallaxY=opts.parallax[1];this._color=C3.New(C3.Color,1,1,1,opts.opacity);this._premultipliedColor=C3.New(C3.Color);this._isForceOwnTexture=!!opts.isForceOwnTexture;this._renderAs3d=!!opts.renderAs3d;this._useCameraDistanceDrawOrder=!!opts.useCameraDistanceDrawOrder;this._useRenderCells=!!opts.useRenderCells;this._scaleRate=opts.scaleRate;this._blendMode=opts.blendMode;this._curRenderTarget=null;this._scale=1;this._zElevation=opts.zElevation; +this._angle=0;this._scrollX=0;this._scrollY=0;this._hasOwnScrollPosition=false;this._viewport=C3.New(C3.Rect);this._viewportZ0=C3.New(C3.Rect);this._viewport3D=C3.New(C3.Rect);this._isViewportChanged=true;this._projectionMatrix=mat4.create();this._isProjectionMatrixChanged=true;this._modelViewMatrix=mat4.create();this._isMVMatrixChanged=true;this._viewFrustum=C3.New(C3.Gfx.ViewFrustum);this._isViewFrustumChanged=true;this._startupInitialInstances=[];this._initialInstancesData=opts.initialInstancesData; +this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._zIndicesUpToDate=false;this._anyInstanceZElevated=false;const canvasManager=this._runtime.GetCanvasManager();this._effectList=C3.New(C3.EffectList,this,opts.effectListData);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layer=effectChain.GetContentObject();const renderSurface=layer.GetRenderTarget();renderer.SetColor(layer.GetPremultipliedColor()); +renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface);canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)});this._needsRebuildEffectChainSteps=true;this._wasDefaultColor=true;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=false;this._lastRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._curRenderCells=C3.New(C3.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this); +this._UpdatePremultipliedColor();if(this.UsesRenderCells())this._renderGrid=C3.New(C3.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight());this._subLayers=opts.subLayersData.map(ld=>C3.Layer.CreateFromExportData(this._layout,this,ld))}_InitInitialInstances(){for(const instData of this._initialInstancesData){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);this._layout._AddInitialObjectClass(objectClass);if(!objectClass.GetDefaultInstanceData()){objectClass.SetDefaultInstanceData(instData); +objectClass._SetDefaultLayerIndex(this._index)}this._initialInstances.push(instData);this._initialUIDsToInstanceData.set(instData[2],instData)}C3.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData=null}static CreateFromExportData(layout,parentLayer,data){return C3.New(C3.Layer,layout,parentLayer,{name:data[0],sid:data[2],isVisible:data[3],isInteractive:data[13],backgroundColor:data[4].map(x=>x/255),isTransparent:data[5],parallax:[data[6],data[7]],opacity:data[8], +isForceOwnTexture:data[9],renderAs3d:data[17],useCameraDistanceDrawOrder:data[18],useRenderCells:data[10],scaleRate:data[11],blendMode:data[12],zElevation:data[16],initialInstancesData:data[14],effectListData:data[15],subLayersData:data[19]})}Release(){for(const subLayer of this._subLayers)subLayer.Release();C3.clearArray(this._subLayers);for(const inst of this._instances)this._runtime.DestroyInstance(inst);C3.clearArray(this._instances);this._iLayer=null;this._parentLayer=null;this._layout=null; +this._runtime=null}GetInitialInstanceData(uid){return this._initialUIDsToInstanceData.get(uid)}CreateInitialInstances(createdInstances){const isFirstVisit=this._layout.IsFirstVisit();let k=0;const initialInstances=this._initialInstances;for(let i=0,len=initialInstances.length;i=0)assignedZIndices.add(cachedZIndex)}let index=-1;for(const inst of this._instances){const wi=inst.GetWorldInfo();if(wi._GetLastCachedZIndex()>=0)continue;++index;while(assignedZIndices.has(index))++index;wi._SetZIndex(index)}}this._instances.sort(SortByInstLastCachedZIndex)}_Start(){}_End(){for(const inst of this._instances)if(!inst.GetObjectClass().IsGlobal())this._runtime.DestroyInstance(inst); +this._runtime.FlushPendingInstances();C3.clearArray(this._instances);this._anyInstanceZElevated=false;this.SetZIndicesChanged()}RecreateInitialObjects(objectClass,rc,offsetX,offsetY,createHierarchy){const eventSheetManager=this._runtime.GetEventSheetManager();const allObjectClasses=this._runtime.GetAllObjectClasses();const isFamily=objectClass.IsFamily();const ret=[];for(const instData of this._initialInstances){const worldData=instData[0];const x=worldData[0];const y=worldData[1];if(!rc.containsPoint(x, +y))continue;const objectType=allObjectClasses[instData[1]];if(objectType!==objectClass)if(isFamily){if(!objectClass.FamilyHasMember(objectType))continue}else continue;let createOnLayer=this;const runningLayout=this._runtime.GetCurrentLayout();if(this.GetLayout()!==runningLayout){createOnLayer=runningLayout.GetLayerByName(this.GetName());if(!createOnLayer)createOnLayer=runningLayout.GetLayerByIndex(this.GetIndex())}const inst=this._runtime.CreateInstanceFromData(instData,createOnLayer,false,undefined, +undefined,false,createHierarchy);createOnLayer.SortAndAddInstancesByZIndex(inst);const wi=inst.GetWorldInfo();wi.OffsetXY(offsetX,offsetY);wi.SetBboxChanged();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);ret.push(inst)}return ret}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(i){this._index=i}GetIndex(){return this._index}_GetSiblingIndex(){let ret= +-1;const parentLayer=this.GetParentLayer();if(parentLayer)ret=parentLayer.GetSubLayers().indexOf(this);else ret=this.GetLayout()._GetRootLayers().indexOf(this);return ret}GetSID(){return this._sid}GetRuntime(){return this._runtime}IsDynamic(){return this._isDynamic}HasAnyDynamicParentLayer(){for(const parent of this.parentLayers())if(parent.IsDynamic())return true;return false}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps(); +return this._effectChain}_MaybeRebuildEffectChainSteps(){const isDefaultColor=this.HasDefaultColor();if(!this._needsRebuildEffectChainSteps&&isDefaultColor===this._wasDefaultColor&&!this._effectChain.NeedsRebuild())return;const activeEffectTypes=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor,useFullSurface:true});this._needsRebuildEffectChainSteps= +false;this._wasDefaultColor=isDefaultColor}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=true}UsesRenderCells(){return this._useRenderCells&&!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=false}IsVisible(){for(const layer of this.selfAndParentLayers())if(!layer._IsVisibleFlagSet())return false;return true}_IsVisibleFlagSet(){return this._isVisible}SetVisible(v){v=!!v;if(this._isVisible=== +v)return;this._isVisible=v;this._runtime.UpdateRender()}SetInteractive(i){this._isInteractive=!!i}IsInteractive(){return this._isInteractive}IsSelfAndParentsInteractive(){for(const layer of this.selfAndParentLayers())if(!layer.IsInteractive())return false;return true}SetOwnScrollPositionEnabled(e){e=!!e;if(this._hasOwnScrollPosition===e)return;this._hasOwnScrollPosition=e;if(e){const layout=this.GetLayout();this._scrollX=layout.GetScrollX();this._scrollY=layout.GetScrollY()}this._SetMVMatrixChanged(); +this._runtime.UpdateRender()}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(x){const layout=this.GetLayout();const lbound=layout.GetScrollLeftBound();const rbound=layout.GetScrollRightBound();if(x>rbound)x=rbound;if(xbbound)y=bbound;if(y0}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){if(this.RendersIn3DMode()&& +this._useCameraDistanceDrawOrder){C3.shallowAssignArray(tempInstancesByCameraDist,this._GetInstances());tempInstancesByCameraDist.sort((a,b)=>this._SortInstancesByCameraDistance(a,b));return tempInstancesByCameraDist}else return this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(arr){C3.appendArray(arr,this._GetInstancesInDrawOrder());for(const subLayer of this._subLayers)if(subLayer.IsVisible()&&subLayer.GetOpacity()>0)subLayer._AppendAllInstancesIncludingSubLayersInDrawOrder(arr)}_SortInstancesByCameraDistance(a, +b){const camVec=this.GetLayout().Get3DCameraPosition();const camX=camVec[0];const camY=camVec[1];const camZ=camVec[2];const wiA=a.GetWorldInfo();const wiB=b.GetWorldInfo();const dxA=wiA.GetX()-camX;const dyA=wiA.GetY()-camY;const dzA=wiA.GetZElevation()-camZ;const dxB=wiB.GetX()-camX;const dyB=wiB.GetY()-camY;const dzB=wiB.GetZElevation()-camZ;return dxB*dxB+dyB*dyB+dzB*dzB-(dxA*dxA+dyA*dyA+dzA*dzA)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(t){t= +!!t;if(this._isTransparent===t)return;this._isTransparent=t;this._runtime.UpdateRender()}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(f){f=!!f;if(this._isForceOwnTexture===f)return;this._isForceOwnTexture=f;this._runtime.UpdateRender()}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return false; +for(const subLayer of this._subLayers)if(!subLayer.SelfAndAllSubLayersHave3DCamera())return false;return true}SetBlendMode(bm){if(this._blendMode===bm)return;this._blendMode=bm;this._runtime.UpdateRender()}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return this._subLayers.length>0}_AddSubLayer(layer,atTop=true){if(atTop)this._subLayers.push(layer);else this._subLayers.unshift(layer)}_InsertSubLayer(layer, +insertBy,isAbove){let i=this._subLayers.indexOf(insertBy);if(isAbove)++i;this._subLayers.splice(i,0,layer)}_RemoveSubLayer(layer){const i=this._subLayers.indexOf(layer);this._subLayers.splice(i,1)}HasAnyVisibleSubLayer(){for(const subLayer of this._subLayers)if(subLayer.ShouldDraw())return true;return false}*selfAndAllSubLayers(){for(const subLayer of this._subLayers)yield*subLayer.selfAndAllSubLayers();yield this}*parentLayers(){let parentLayer=this.GetParentLayer();while(parentLayer){yield parentLayer; +parentLayer=parentLayer.GetParentLayer()}}*selfAndParentLayers(){yield this;yield*this.parentLayers()}IsTransformCompatibleWith(otherLayer){return this===otherLayer||this._parallaxX===otherLayer._parallaxX&&this._parallaxY===otherLayer._parallaxY&&this._scale===otherLayer._scale&&this._scaleRate===otherLayer._scaleRate&&this._angle===otherLayer._angle&&this.GetScrollX()===otherLayer.GetScrollX()&&this.GetScrollY()===otherLayer.GetScrollY()}SaveTransform(){return{"parallaxX":this.GetParallaxX(),"parallaxY":this.GetParallaxY(), +"scale":this.GetOwnScale(),"scaleRate":this.GetScaleRate(),"angle":this.GetOwnAngle(),"hasOwnScroll":this.IsOwnScrollPositionEnabled(),"scrollX":this.GetScrollX(),"scrollY":this.GetScrollY()}}RestoreTransform(t){this.SetParallax(t["parallaxX"],t["parallaxY"]);this.SetOwnScale(t["scale"]);this.SetScaleRate(t["scaleRate"]);this.SetAngle(t["angle"]);this.SetOwnScrollPositionEnabled(t["hasOwnScroll"]);this.SetScrollX(t["scrollX"]);this.SetScrollY(t["scrollY"]);this._MaybeUpdateViewport()}_RemoveAllInstancesInSet(s){if(s.size=== +0)return;const numRemoved=C3.arrayRemoveAllInSet(this._instances,s);if(numRemoved>0){this._MaybeResetAnyInstanceZElevatedFlag();this.SetZIndicesChanged()}}SetZIndicesChanged(){this._zIndicesUpToDate=false;this._isRenderListUpToDate=false}_UpdateZIndices(){if(this._zIndicesUpToDate)return;this._instances.sort(SortByInstZElevation);if(this.UsesRenderCells())for(let i=0,len=this._instances.length;i1)arr=this._MergeAllSortedZArrays_pass(arr);return arr[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();C3.clearArray(renderCellArr);this._renderGrid.QueryRange(this.GetViewport(),renderCellArr);if(!renderCellArr.length)return[];if(renderCellArr.length===1)return renderCellArr[0]; +return this._MergeAllSortedZArrays(renderCellArr)}ShouldDraw(){return this.IsVisible()&&this.GetOpacity()>0&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()||!this.IsTransparent())return true;for(const subLayer of this._subLayers)if(subLayer._DrawsAnyContentInSelfOrSubLayers())return true;return false}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||this.GetBlendMode()!==0||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return true; +for(const subLayer of this._subLayers)if(subLayer.SelfOrAnySubLayerUsesOwnTexture())return true;return false}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(z){if(this._layout.IsOrthographicProjection())return 1;else{const camZ=this.GetCameraZ();return camZ/(camZ-z)}}GetCameraZ(viewH){return this.GetDefaultCameraZ(viewH)/this.GetNormalScale()}_SetMVMatrixChanged(){this._isMVMatrixChanged=true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetModelViewMatrix(renderer){if(this._isMVMatrixChanged){this._CalculateModelViewMatrix(renderer, +this._modelViewMatrix,0,0,null);this._isMVMatrixChanged=false}return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const camPos=this.GetLayout().Get3DCameraPosition();return[camPos[0],camPos[1],camPos[2]]}else return this._Get2DCameraPosition()}_Get2DCameraPosition(offX=0,offY=0,viewH=0){const runtime=this._runtime;const layout=this.GetLayout();const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();let scrollOriginX=(this.GetScrollX()- +parallaxOriginX)*this._parallaxX+parallaxOriginX;let scrollOriginY=(this.GetScrollY()-parallaxOriginY)*this._parallaxY+parallaxOriginY;if(runtime.IsPixelRoundingEnabled()){scrollOriginX=Math.round(scrollOriginX);scrollOriginY=Math.round(scrollOriginY)}let camX=scrollOriginX+offX;let camY=scrollOriginY+offY;const camZ=layout.IsOrthographicProjection()?this.GetDefaultCameraZ(viewH):this.GetCameraZ(viewH);const [vpX,vpY]=this._GetVanishingPoint();if(vpX!==.5||vpY!==.5){const zf=this.GetDefaultCameraZ(viewH)/ +camZ;let camOffX=(vpX-.5)*runtime.GetViewportWidth()/zf;let camOffY=(vpY-.5)*runtime.GetViewportHeight()/zf;const a=this.GetAngle();if(a!==0){tempVec2.set(camOffX,camOffY);tempVec2.rotate(a);camOffX=tempVec2.getX();camOffY=tempVec2.getY()}camX+=camOffX;camY+=camOffY}return[camX,camY,camZ]}_CalculateModelViewMatrix(renderer,outMat,offX,offY,viewH){const runtime=this._runtime;const layout=this.GetLayout();if(this.Has3DCamera()){vec3.copy(camVector,layout.Get3DCameraPosition());vec3.copy(lookVector, +layout.Get3DCameraLookAt());vec3.copy(upVector,layout.Get3DCameraUpVector());const parallaxOriginX=runtime.GetParallaxXOrigin();const parallaxOriginY=runtime.GetParallaxYOrigin();const lookDx=lookVector[0]-camVector[0];const lookDy=lookVector[1]-camVector[1];const lookDz=lookVector[2]-camVector[2];camVector[0]=(camVector[0]-parallaxOriginX)*this._parallaxX+parallaxOriginX;camVector[1]=(camVector[1]-parallaxOriginY)*this._parallaxY+parallaxOriginY;camVector[2]*=Math.max(this._parallaxX,this._parallaxY); +lookVector[0]=camVector[0]+lookDx;lookVector[1]=camVector[1]+lookDy;lookVector[2]=camVector[2]+lookDz}else{const [camX,camY,camZ]=this._Get2DCameraPosition(offX,offY,viewH);vec3.set(camVector,camX,camY,camZ);vec3.set(lookVector,camX,camY,camZ-100);const a=this.GetAngle();if(a===0)vec3.set(upVector,0,1,0);else vec3.set(upVector,Math.sin(a),Math.cos(a),0)}renderer.CalculateLookAtModelView(outMat,camVector,lookVector,upVector,viewH||runtime.GetViewportHeight())}_SetProjectionMatrixChanged(){this._isProjectionMatrixChanged= +true;this._isViewFrustumChanged=true;this._isViewportChanged=true}_GetProjectionMatrix(renderer){if(this._isProjectionMatrixChanged){this._CalculateProjectionMatrix(renderer);this._isProjectionMatrixChanged=false}return this._projectionMatrix}_CalculateProjectionMatrix(renderer){const canvasManager=this._runtime.GetCanvasManager();const [vpX,vpY]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())renderer.CalculateOrthographicMatrix(this._projectionMatrix,canvasManager.GetDrawWidth(), +canvasManager.GetDrawHeight());else if(vpX===.5&&vpY===.5)mat4.copy(this._projectionMatrix,canvasManager.GetDefaultProjectionMatrix());else{const drawW=canvasManager.GetDrawWidth();const drawH=canvasManager.GetDrawHeight();renderer.CalculatePerspectiveMatrix(this._projectionMatrix,drawW/drawH,vpX,vpY)}}_SetTransform(renderer,updateProjection=true,offX=0,offY=0,viewH=0){if(updateProjection)renderer.SetProjectionMatrix(this._GetProjectionMatrix(renderer));let modelViewMatrix=null;if(offX===0&&offY=== +0&&viewH===0)modelViewMatrix=this._GetModelViewMatrix(renderer);else{this._CalculateModelViewMatrix(renderer,tempMat4,offX,offY,viewH);modelViewMatrix=tempMat4}renderer.SetModelViewMatrix(modelViewMatrix)}PrepareForDraw(renderer){this._SetTransform(renderer);renderer.SetBaseZ(this.GetZElevation())}Draw(renderer,destinationRenderTarget,isFirstToTarget){const canvasManager=this._runtime.GetCanvasManager();const useOwnTexture=this.UsesOwnTexture();let ownRenderTarget=null;let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer= +canvasManager.GetLayerTimingsBuffer(this);if(timingsBuffer){layerQuery=timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+1)*2);if(useOwnTexture){const rtOpts={sampling:this._runtime.GetSampling(),isSampled:true,canReadPixels:renderer.IsWebGPU()?this._runtime.UsesAnyBackgroundBlending():false};if(canvasManager.GetCurrentFullscreenScalingQuality()==="low"){rtOpts.width=canvasManager.GetDrawWidth();rtOpts.height= +canvasManager.GetDrawHeight()}ownRenderTarget=this._runtime.GetAdditionalRenderTarget(rtOpts);this._curRenderTarget=ownRenderTarget;renderer.SetRenderTarget(ownRenderTarget);if(this.IsTransparent())renderer.ClearRgba(0,0,0,0)}else{this._curRenderTarget=destinationRenderTarget;renderer.SetRenderTarget(destinationRenderTarget)}if(!this.IsTransparent())renderer.Clear(this._backgroundColor);this._layout._DrawLayerList(renderer,this._curRenderTarget,this._subLayers,useOwnTexture&&this.IsTransparent()); +this._SetTransform(renderer);renderer.SetBaseZ(this.GetZElevation());renderer.SetDepthEnabled(this.RendersIn3DMode());if(this.GetNormalScale()>Number.EPSILON){this._UpdateZIndices();const useRenderCells=this.UsesRenderCells()&&this.GetZElevation()===0&&!this._anyInstanceZElevated;if(this.Has3DCamera())this._DrawInstances_3DCamera(renderer);else if(useRenderCells)this._DrawInstances_RenderCells(renderer);else this._DrawInstances(renderer,this._GetInstancesInDrawOrder())}renderer.SetBaseZ(0);renderer.SetCurrentZ(0); +if(useOwnTexture){renderer.SetDepthEnabled(false);this._DrawLayerOwnTextureToRenderTarget(renderer,ownRenderTarget,destinationRenderTarget,isFirstToTarget)}if(layerQuery)renderer.EndQuery(layerQuery);if(this._runtime.IsGPUProfiling()&&renderer.IsWebGPU())renderer.WriteTimestamp((this.GetIndex()+1)*2+1);this._curRenderTarget=null}_DrawInstances(renderer,instances){const viewport=this.GetViewport();const renderTarget=this._curRenderTarget;const isOrthographic=this.GetLayout().IsOrthographicProjection(); +const hasVanishingPointOutsideViewport=this.GetLayout().HasVanishingPointOutsideViewport();let lastInst=null;for(let i=0,len=instances.length;i0)postRenderInstances.push(inst);const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst);let endIndex=i+1;for(;endIndex< +len;++endIndex){const nextInst=instances[endIndex];const nextWi=nextInst.GetWorldInfo();if(!nextWi.IsVisible()||!nextWi.IsInViewport3D(viewFrustum))continue;if(nextWi.GetTotalZElevation()!==startZ)break;if(!nextInst.RendersToOwnZPlane()){postRenderInstances.push(nextInst);continue}if(nextWi.GetDepth()>0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length===1&&!coplanarInstances[0].MustMitigateZFighting()){this._DrawInstanceMaybeWithEffects(inst,wi,renderer, +renderTarget);for(let j=0,lenj=postRenderInstances.length;j0)if(this._IsPointBehindNearPlane(bbLeft,bbTop,topZ)|| +this._IsPointBehindNearPlane(bbRight,bbTop,topZ)||this._IsPointBehindNearPlane(bbRight,bbBottom,topZ)||this._IsPointBehindNearPlane(bbLeft,bbBottom,topZ))return null}else if(topZ>=this.GetCameraZ())return null;let [stlx,stly]=this.LayerToDrawSurface(bbLeft,bbTop,z);let [sbrx,sbry]=this.LayerToDrawSurface(bbRight,bbBottom,z);if(this.GetAngle()!==0||depth>0||this.Has3DCamera()){const [strx,stry]=this.LayerToDrawSurface(bbRight,bbTop,z);const [sblx,sbly]=this.LayerToDrawSurface(bbLeft,bbBottom,z);if(depth> +0){const [stlxTop,stlyTop]=this.LayerToDrawSurface(bbLeft,bbTop,topZ);const [strxTop,stryTop]=this.LayerToDrawSurface(bbRight,bbTop,topZ);const [sbrxTop,sbryTop]=this.LayerToDrawSurface(bbRight,bbBottom,topZ);const [sblxTop,sblyTop]=this.LayerToDrawSurface(bbLeft,bbBottom,topZ);let temp=Math.min(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);sbrx=Math.max(stlx,sbrx,strx,sblx,stlxTop,strxTop,sbrxTop,sblxTop);stlx=temp;temp=Math.min(stly,sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);sbry=Math.max(stly, +sbry,stry,sbly,stlyTop,stryTop,sbryTop,sblyTop);stly=temp}else{let temp=Math.min(stlx,sbrx,strx,sblx);sbrx=Math.max(stlx,sbrx,strx,sblx);stlx=temp;temp=Math.min(stly,sbry,stry,sbly);sbry=Math.max(stly,sbry,stry,sbly);stly=temp}}tmpRect.set(stlx,stly,sbrx,sbry);return tmpRect}_GetViewFrustum(){if(this._isViewFrustumChanged){this._UpdateViewFrustum();this._isViewFrustumChanged=false}return this._viewFrustum}_UpdateViewFrustum(){const renderer=this._runtime.GetRenderer();const matP=this._GetProjectionMatrix(renderer); +const matMV=this._GetModelViewMatrix(renderer);this._viewFrustum.CalculatePlanes(matMV,matP)}_IsPointBehindNearPlane(x,y,z){return this._GetViewFrustum().IsBehindNearPlane(x,y,z)}_SaveToJson(){const o={"d":this.IsDynamic(),"s":this.GetOwnScale(),"a":this.GetOwnAngle(),"v":this._IsVisibleFlagSet(),"i":this.IsInteractive(),"bc":this._backgroundColor.toJSON(),"t":this.IsTransparent(),"sx":this._scrollX,"sy":this._scrollY,"hosp":this._hasOwnScrollPosition,"px":this.GetParallaxX(),"py":this.GetParallaxY(), +"c":this._color.toJSON(),"sr":this.GetScaleRate(),"fx":this._effectList.SaveToJson(),"cg":this._createdGlobalUids};return o}_LoadFromJson(o){this._isDynamic=!!o["d"];this._scale=o["s"];this._angle=o["a"];this._isVisible=!!o["v"];this._isInteractive=o.hasOwnProperty("i")?o["i"]:true;this._backgroundColor.setFromJSON(o["bc"]);this._isTransparent=!!o["t"];if(o.hasOwnProperty("sx"))this._scrollX=o["sx"];if(o.hasOwnProperty("sy"))this._scrollY=o["sy"];if(o.hasOwnProperty("hosp"))this._hasOwnScrollPosition= +!!o["hosp"];this._parallaxX=o["px"];this._parallaxY=o["py"];this._color.setFromJSON(o["c"]);this._UpdatePremultipliedColor();this._scaleRate=o["sr"];C3.shallowAssignArray(this._createdGlobalUids,o["cg"]);C3.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const tempSet=new Set(this._createdGlobalUids);let j=0;for(let i=0,len=this._initialInstances.length;i{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex(); +return firstZIndex-secondZIndex});return}if(inst.HasChildren()){const instances=[...inst.allChildren()];instances.push(inst);instances.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});for(const instanceToAdd of instances){if(!instanceToAdd.IsInContainer())continue;for(const instanceToAddSibling of instanceToAdd.siblings()){if(instances.includes(instanceToAddSibling))continue;const siblingAndChildren= +[...instanceToAddSibling.allChildren()];siblingAndChildren.push(instanceToAddSibling);siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren||!siblingAndChildren.length)continue;instances.splice(instances.length,0,...siblingAndChildren)}}for(const instance of instances)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance,true)}else{if(inst.GetPlugin().IsWorldType())this._AddInstance(inst, +true);if(!inst.IsInContainer())return;for(const sibling of inst.siblings()){const siblingAndChildren=[...sibling.allChildren()];siblingAndChildren.push(sibling);siblingAndChildren.sort((f,s)=>{const firstZIndex=f.GetWorldInfo().GetSceneGraphZIndex();const secondZIndex=s.GetWorldInfo().GetSceneGraphZIndex();return firstZIndex-secondZIndex});if(!siblingAndChildren||!siblingAndChildren.length)continue;for(const instance of siblingAndChildren)if(instance.GetPlugin().IsWorldType())this._AddInstance(instance, +true)}}}}; + +} + +// layouts/layout.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const tempDestRect=C3.New(C3.Rect);const tempSrcRect=C3.New(C3.Rect);const tempLayoutRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const tempRender3dList=[];const tempInstanceList1=[];const tempInstanceList2=[];const tempInstanceList3=[];function vec3EqualsXYZ(v,x,y,z){return v[0]===Math.fround(x)&&v[1]===Math.fround(y)&&v[2]===Math.fround(z)} +let lastLayerPreparedForDrawing=null;function MaybePrepareLayerDraw(layer,renderer){if(lastLayerPreparedForDrawing===layer)return;layer.PrepareForDraw(renderer);lastLayerPreparedForDrawing=layer} +C3.Layout=class Layout extends C3.DefendedBase{constructor(layoutManager,index,data){super();this._layoutManager=layoutManager;this._runtime=layoutManager.GetRuntime();this._name=data[0];this._originalWidth=data[1];this._originalHeight=data[2];this._width=data[1];this._height=data[2];this._isUnboundedScrolling=!!data[3];this._isOrthographicProjection=!!data[4];this._vanishingPointX=data[5];this._vanishingPointY=data[6];this._eventSheetName=data[7];this._eventSheet=null;this._sid=data[8];this._index= +index;this._scrollX=0;this._scrollY=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._createdPersistedInstances=[];this._createdPersistedInstancesToDataMap=new Map;this._createdPersistedIndexToInstanceMap=new Map;this._initialNonWorld=[];this._is3dCameraEnabled=false;this._cam3dposition=vec3.create();this._cam3dlook=vec3.create();this._cam3dup=vec3.create();this._rootLayers=[]; +this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const canvasManager=this._runtime.GetCanvasManager();this._effectList=C3.New(C3.EffectList,this,data[11]);this._effectChain=C3.New(C3.Gfx.EffectChain,canvasManager.GetEffectChainManager(),{drawContent:(renderer,effectChain)=>{const layout=effectChain.GetContentObject();const renderSurface=layout.GetRenderTarget();renderer.ResetColor();renderer.DrawRenderTarget(renderSurface);renderer.InvalidateRenderTarget(renderSurface); +canvasManager.ReleaseAdditionalRenderTarget(renderSurface)},getShaderParameters:index=>this.GetEffectList()._GetEffectChainShaderParametersForIndex(index)});this._needsRebuildEffectChainSteps=true;this._wasFullScreenQualityLow=false;this._curRenderTarget=null;this._persistData={};this._persistedIntances=new Map;this._isFirstVisit=true;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);for(const layerData of data[9])this._rootLayers.push(C3.Layer.CreateFromExportData(this, +null,layerData));this._ReindexLayers();for(const layer of this.allLayers())layer._InitInitialInstances();for(const instData of data[10]){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);if(!objectClass)throw new Error("missing nonworld object class");if(!objectClass.GetDefaultInstanceData())objectClass.SetDefaultInstanceData(instData);this._initialNonWorld.push(instData);this._AddInitialObjectClass(objectClass)}}Release(){for(const l of this._allLayersFlat)l.Release();C3.clearArray(this._allLayersFlat); +this._textureLoadPendingPromises.clear();this._eventSheet=null;this._layoutManager=null;this._runtime=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();return this._effectChain}_MaybeRebuildEffectChainSteps(){const isFullscreenQualityLow=this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()==="low";if(!this._needsRebuildEffectChainSteps&& +this._wasFullScreenQualityLow===isFullscreenQualityLow&&!this._effectChain.NeedsRebuild())return;const activeEffectTypes=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:activeEffectTypes.map(e=>e.GetIndex()),forcePostDraw:isFullscreenQualityLow,useFullSurface:true});this._needsRebuildEffectChainSteps=false;this._wasFullScreenQualityLow=isFullscreenQualityLow}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects(); +this._needsRebuildEffectChainSteps=true}GetMinLayerScale(){let m=this._allLayersFlat[0].GetNormalScale();for(let i=1,len=this._allLayersFlat.length;irbound)x=rbound;if(xbbound)y=bbound;if(y1||vpY<0||vpY>1}SetPerspectiveProjection(){if(!this._isOrthographicProjection)return;this._isOrthographicProjection=false;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}SetOrthographicProjection(){if(this._isOrthographicProjection)return; +this._isOrthographicProjection=true;this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._runtime.UpdateRender()}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(e){e=!!e;if(this._is3dCameraEnabled===e)return;this._is3dCameraEnabled=e;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(camX,camY,camZ, +lookX,lookY,lookZ,upX,upY,upZ){if(vec3EqualsXYZ(this._cam3dposition,camX,camY,camZ)&&vec3EqualsXYZ(this._cam3dlook,lookX,lookY,lookZ)&&vec3EqualsXYZ(this._cam3dup,upX,upY,upZ))return;vec3.set(this._cam3dposition,camX,camY,camZ);vec3.set(this._cam3dlook,lookX,lookY,lookZ);vec3.set(this._cam3dup,upX,upY,upZ);this.Set3DCameraChanged()}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(s){if(this._scale=== +s)return;this._scale=s;this._SetAllLayersMVChanged();this.BoundScrolling();this._runtime.UpdateRender()}SetAngle(a){a=C3.clampAngle(a);if(this._angle===a)return;this._angle=a;this._SetAllLayersMVChanged();this._runtime.UpdateRender()}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(w){if(!isFinite(w)||w<1)return;this._width=w}GetHeight(){return this._height}SetHeight(h){if(!isFinite(h)||h<1)return;this._height=h}GetEventSheet(){return this._eventSheet}_GetRootLayers(){return this._rootLayers}*allLayers(){for(const rootLayer of this._rootLayers)yield*rootLayer.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(p){if(typeof p=== +"number")return this.GetLayerByIndex(p);else return this.GetLayerByName(p.toString())}GetLayerByIndex(i){i=C3.clamp(Math.floor(i),0,this._allLayersFlat.length-1);return this._allLayersFlat[i]}GetLayerByName(name){return this._layersByName.get(name.toLowerCase())||null}HasLayerByName(name){return!!this.GetLayerByName(name)}GetLayerBySID(sid){return this._layersBySid.get(sid)||null}_SetAllLayersProjectionChanged(){for(const layer of this._allLayersFlat)layer._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const layer of this._allLayersFlat)layer._SetMVMatrixChanged()}AddLayer(layerName, +insertBy,where){if(this.HasLayerByName(layerName))throw new Error(`layer name '${layerName}' already in use`);if(!insertBy&&where<2)throw new Error("invalid insert position");const parentLayer=where>=2?insertBy:insertBy.GetParentLayer();const layer=C3.New(C3.Layer,this,parentLayer,{name:layerName,sid:Math.floor(Math.random()*1E15),isDynamic:true});this._InsertLayer(layer,insertBy,where);this._ReindexLayers()}MoveLayer(layer,insertBy,where){if(!insertBy&&where<2)throw new Error("invalid insert position"); +this._RemoveLayer(layer);this._InsertLayer(layer,insertBy,where);this._ReindexLayers()}RemoveLayer(layer){this._RemoveLayer(layer);layer.Release();this._ReindexLayers()}RemoveAllDynamicLayers(){const toRemove=new Set;for(const layer of this.allLayers())if(layer.IsDynamic()&&!layer.HasAnyDynamicParentLayer())toRemove.add(layer);for(const layer of toRemove){this._RemoveLayer(layer);layer.Release()}this._ReindexLayers()}_InsertLayer(layer,insertBy,where){if(where>=2)if(insertBy)insertBy._AddSubLayer(layer, +where===2);else if(where===2)this._rootLayers.push(layer);else this._rootLayers.unshift(layer);else{const parentLayer=insertBy.GetParentLayer();if(parentLayer)parentLayer._InsertSubLayer(layer,insertBy,where===0);else{let i=this._rootLayers.indexOf(insertBy);if(where===0)++i;this._rootLayers.splice(i,0,layer)}}}_RemoveLayer(layer){const parentLayer=layer.GetParentLayer();if(parentLayer)parentLayer._RemoveSubLayer(layer);else if(this._rootLayers.length>1){const i=this._rootLayers.indexOf(layer);this._rootLayers.splice(i, +1)}}_ReindexLayers(){this._allLayersFlat=[...this.allLayers()];this._layersByName.clear();this._layersBySid.clear();for(let i=0,len=this._allLayersFlat.length;il.ShouldDraw())[0];while(firstDrawLayer){if(!firstDrawLayer.IsTransparent()){tempColor.copyRgb(firstDrawLayer.GetBackgroundColor());tempColor.setA(1);return tempColor}else if(firstDrawLayer.UsesOwnTexture()){tempColor.setRgba(0,0,0,0);return tempColor}firstDrawLayer=firstDrawLayer.GetSubLayers().filter(l=> +l.ShouldDraw())[0]}tempColor.setRgba(0,0,0,0);return tempColor}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(objectClass){if(objectClass.IsInContainer())for(const containerType of objectClass.GetContainer().GetObjectTypes())this._initialObjectClasses.add(containerType);else this._initialObjectClasses.add(objectClass)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(previousLayout,renderer){if(previousLayout=== +this||!renderer)return Promise.resolve();if(previousLayout){C3.CopySet(this._textureLoadedTypes,previousLayout._textureLoadedTypes);previousLayout._textureLoadedTypes.clear()}const promises=[];for(const oc of this._initialObjectClasses)if(!this._textureLoadedTypes.has(oc)){promises.push(oc.LoadTextures(renderer));this._textureLoadedTypes.add(oc)}return Promise.all(promises)}async MaybeLoadTexturesFor(objectClass){if(objectClass.IsFamily())throw new Error("cannot load textures for family");const renderer= +this._runtime.GetRenderer();if(!renderer||renderer.IsContextLost()||this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.add(objectClass);const loadPromise=objectClass.LoadTextures(renderer);this._AddPendingTextureLoadPromise(loadPromise);await loadPromise;objectClass.OnDynamicTextureLoadComplete();this._runtime.UpdateRender()}_AddPendingTextureLoadPromise(promise){this._textureLoadPendingPromises.add(promise);promise.then(()=>this._textureLoadPendingPromises.delete(promise)).catch(()=> +this._textureLoadPendingPromises.delete(promise))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(objectClass){if(objectClass.IsFamily()||objectClass.GetInstanceCount()>0)throw new Error("cannot unload textures");const renderer=this._runtime.GetRenderer();if(!renderer||!this._textureLoadedTypes.has(objectClass))return;this._textureLoadedTypes.delete(objectClass);objectClass.ReleaseTextures(renderer)}_Unload(nextLayout,renderer){if(nextLayout=== +this||!renderer)return;for(const oc of this._textureLoadedTypes)if(!oc.IsGlobal()&&!nextLayout._initialObjectClasses.has(oc)){oc.ReleaseTextures();this._textureLoadedTypes.delete(oc)}}_OnRendererContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(isFirstLayout){const runtime=this._runtime;const layoutManager=this._layoutManager;const eventSheetManager=runtime.GetEventSheetManager();if(this._eventSheetName){this._eventSheet=eventSheetManager.GetEventSheetByName(this._eventSheetName); +this._eventSheet._UpdateDeepIncludes()}layoutManager._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=runtime.GetOriginalViewportWidth()/2;this._scrollY=runtime.GetOriginalViewportHeight()/2;this.BoundScrolling();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._MoveGlobalObjectsToThisLayout(isFirstLayout);this._runtime.SetUsingCreatePromises(true);this._CreateInitialInstances();if(!this._isFirstVisit)this._CreatePersistedInstances(); +this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateAndLinkContainerInstances(this._createdPersistedInstances);this._CreateInitialNonWorldInstances();layoutManager.ClearPendingChangeLayout();runtime.FlushPendingInstances();this._runtime.SetUsingCreatePromises(false);const createPromises=this._runtime.GetCreatePromises();await Promise.all(createPromises);C3.clearArray(createPromises);if(!runtime.IsLoadingState()){for(const inst of this._createdInstances)inst.SetupInitialSceneGraphConnections(); +for(const inst of this._createdPersistedInstances)inst.SetupPersistedSceneGraphConnections(this._createdPersistedInstancesToDataMap,this._createdPersistedIndexToInstanceMap);for(const [sidStr,typeData]of Object.entries(this._persistData)){const objectClass=this._runtime.GetObjectClassBySID(parseInt(sidStr,10));if(!objectClass||objectClass.IsFamily()||!objectClass.HasPersistBehavior())continue;C3.clearArray(typeData)}for(const inst of this._createdInstances)inst._TriggerOnCreated();for(const inst of this._createdPersistedInstances)inst._TriggerOnCreated()}C3.clearArray(this._createdInstances); +C3.clearArray(this._createdPersistedInstances);this._createdPersistedInstancesToDataMap.clear();this._createdPersistedIndexToInstanceMap.clear();await Promise.all([...this._initialObjectClasses].map(oc=>oc.PreloadTexturesWithInstances(this._runtime.GetRenderer())));if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("beforefirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("beforeprojectstart"))}runtime.Dispatcher().dispatchEvent(new C3.Event("beforelayoutstart")); +await this.DispatchUserScriptEventAsyncWait(new C3.Event("beforelayoutstart"));if(!runtime.IsLoadingState())await runtime.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutStart,null,null);runtime.Dispatcher().dispatchEvent(new C3.Event("afterlayoutstart"));await this.DispatchUserScriptEventAsyncWait(new C3.Event("afterlayoutstart"));if(isFirstLayout){runtime.Dispatcher().dispatchEvent(new C3.Event("afterfirstlayoutstart"));await runtime.DispatchUserScriptEventAsyncWait(new C3.Event("afterprojectstart"))}eventSheetManager._RunQueuedTriggers(layoutManager); +await this.WaitForPendingTextureLoadsToComplete();this._isFirstVisit=false}_MoveGlobalObjectsToThisLayout(isFirstLayout){for(const objectClass of this._runtime.GetAllObjectClasses()){if(objectClass.IsFamily()||!objectClass.IsWorldType())continue;for(const inst of objectClass.GetInstances()){const wi=inst.GetWorldInfo();const oldLayer=wi.GetLayer();const layerIndex=C3.clamp(oldLayer.GetIndex(),0,this._allLayersFlat.length-1);const newLayer=this._allLayersFlat[layerIndex];wi._SetLayer(newLayer,true); +newLayer._MaybeAddInstance(inst)}}if(!isFirstLayout)for(const layer of this._allLayersFlat)layer._SortInstancesByLastCachedZIndex(false)}_CreateInitialInstances(){for(const layer of this._allLayersFlat){layer.CreateInitialInstances(this._createdInstances);layer._Start()}}_CreatePersistedInstances(){let uidsChanged=false;for(const [sidStr,typeData]of Object.entries(this._persistData)){const objectClass=this._runtime.GetObjectClassBySID(parseInt(sidStr,10));if(!objectClass||objectClass.IsFamily()|| +!objectClass.HasPersistBehavior())continue;for(const instData of typeData){let layer=null;if(objectClass.IsWorldType()){if(instData.hasOwnProperty("instJson"))layer=this.GetLayerBySID(instData["instJson"]["w"]["l"]);else layer=this.GetLayerBySID(instData["w"]["l"]);if(!layer)continue}const inst=this._runtime.CreateInstanceFromData(objectClass,layer,false,0,0,true);if(instData.hasOwnProperty("instJson"))inst.LoadFromJson(instData["instJson"]);else inst.LoadFromJson(instData);uidsChanged=true;this._createdPersistedInstances.push(inst); +if(instData.hasOwnProperty("instJson")){this._createdPersistedInstancesToDataMap.set(inst,instData);this._createdPersistedIndexToInstanceMap.set(instData["index"],inst)}}}for(const layer of this._allLayersFlat){layer._SortInstancesByLastCachedZIndex(true);layer.SetZIndicesChanged()}if(uidsChanged){this._runtime.FlushPendingInstances();this._runtime._RefreshUidMap()}}_CreateAndLinkContainerInstances(createdInstances){for(const inst of createdInstances){if(!inst.IsInContainer())continue;const wi=inst.GetWorldInfo(); +const iid=inst.GetIID();for(const containerType of inst.GetObjectClass().GetContainer().objectTypes()){if(containerType===inst.GetObjectClass())continue;const instances=containerType.GetInstances();if(instances.length>iid)inst._AddSibling(instances[iid]);else{let s;if(wi)s=this._runtime.CreateInstanceFromData(containerType,wi.GetLayer(),true,wi.GetX(),wi.GetY(),true);else s=this._runtime.CreateInstanceFromData(containerType,null,true,0,0,true);this._runtime.FlushPendingInstances();containerType._UpdateIIDs(); +inst._AddSibling(s);createdInstances.push(s)}}}}_CreateInitialNonWorldInstances(){for(const instData of this._initialNonWorld){const objectClass=this._runtime.GetObjectClassByIndex(instData[1]);if(!objectClass.IsInContainer())this._runtime.CreateInstanceFromData(instData,null,true)}}_CreateGlobalNonWorlds(){const createdInstances=[];const initialNonWorld=this._initialNonWorld;let k=0;for(let i=0,len=initialNonWorld.length;il.ShouldDraw()); +for(let i=0,len=layersToDraw.length;i=2||tempRender3dList.length===1&&tempRender3dList[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(renderer, +destRenderTarget,tempRender3dList);i+=tempRender3dList.length;C3.clearArray(tempRender3dList);continue}C3.clearArray(tempRender3dList)}layer.Draw(renderer,destRenderTarget,canCopyFirstLayer&&i===0);++i}}_DrawLayoutOwnTextureToRenderTarget(renderer,ownRenderTarget){const activeEffectTypes=this._effectList.GetActiveEffectTypes();const runtime=this._runtime;if(activeEffectTypes.length===0){renderer.SetRenderTarget(null);renderer.SetTextureFillMode();renderer.CopyRenderTarget(ownRenderTarget);renderer.InvalidateRenderTarget(ownRenderTarget); +runtime.ReleaseAdditionalRenderTarget(ownRenderTarget)}else{tempLayoutRect.set(0,0,runtime.GetViewportWidth(),runtime.GetViewportHeight());this.GetEffectChain().Render(renderer,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:tempLayoutRect,drawSurfaceRect:null,invalidateRenderTargets:true})}}_Draw3DLayers(renderer,renderTarget,layerList){if(!layerList[0].IsTransparent()){tempColor.copyRgb(layerList[0].GetBackgroundColor()); +tempColor.setA(1);renderer.Clear(tempColor)}const canvasManager=this._runtime.GetCanvasManager();renderer.SetDepthEnabled(true);const fullInstanceList=tempInstanceList1;const coplanarInstances=tempInstanceList2;const postRenderInstances=tempInstanceList3;for(const layer of layerList){layer._UpdateZIndices();layer._AppendAllInstancesIncludingSubLayersInDrawOrder(fullInstanceList)}const firstLayer=layerList[0];let layerQuery=null;if(this._runtime.IsGPUProfiling())if(renderer.IsWebGL()){const timingsBuffer= +canvasManager.GetLayerTimingsBuffer(firstLayer);if(timingsBuffer){layerQuery=timingsBuffer.AddTimeElapsedQuery();renderer.StartQuery(layerQuery)}}else if(renderer.IsWebGPU())renderer.WriteTimestamp((firstLayer.GetIndex()+1)*2);for(let i=0,len=fullInstanceList.length;i0)postRenderInstances.push(inst); +const startZ=inst.GetWorldInfo().GetTotalZElevation();coplanarInstances.push(inst);let endIndex=i+1;for(;endIndex0)postRenderInstances.push(nextInst);coplanarInstances.push(nextInst)}if(coplanarInstances.length=== +1&&!coplanarInstances[0].MustMitigateZFighting()){MaybePrepareLayerDraw(wiLayer,renderer);wiLayer._DrawInstanceMaybeWithEffects(inst,wi,renderer,renderTarget);for(let j=0,lenj=postRenderInstances.length;j=0;--i){const dld=dynamicLayersData[i];const sid=dld["sid"];const layerName=dld["name"];const parentSid=dld["parentSid"];const siblingIndex=dld["siblingIndex"];const layerData=dld["data"]; +this._ReindexLayers();if(this.HasLayerByName(layerName)||this.GetLayerBySID(sid))continue;let parentLayer;let parentLayerArr;if(parentSid===null){parentLayer=null;parentLayerArr=this._rootLayers}else{parentLayer=this.GetLayerBySID(parentSid);if(!parentLayer)continue;parentLayerArr=parentLayer.GetSubLayers()}const layer=C3.New(C3.Layer,this,parentLayer,{name:layerName,sid,isDynamic:true});parentLayerArr.push(layer);let arr=reorderLayers.get(parentLayerArr);if(!arr){arr=[];reorderLayers.set(parentLayerArr, +arr)}arr.push({layer,siblingIndex});layer._LoadFromJson(layerData)}for(const [parentLayerArr,reorderArr]of reorderLayers){reorderArr.sort((a,b)=>a.siblingIndex-b.siblingIndex);for(const r of reorderArr){const layer=r.layer;const siblingIndex=r.siblingIndex;let i=parentLayerArr.indexOf(layer);parentLayerArr.splice(i,1);parentLayerArr.splice(siblingIndex,0,layer)}}}this._ReindexLayers();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.layout= +this.GetILayout();const runtime=this._runtime;const shouldTime=runtime.IsDebug()&&!runtime.GetEventSheetManager().IsInEventEngine();if(shouldTime)C3Debugger.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);if(shouldTime)C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}}; + +} + +// layouts/layoutManager.js +{ +'use strict';const C3=self.C3; +C3.LayoutManager=class LayoutManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._runtime=null;this._mainRunningLayout=null;this._firstLayout=null;this._pendingChangeLayout=null;C3.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear(); +C3.clearArray(this._runningSubLayouts)}Create(layoutData){const layout=C3.New(C3.Layout,this,this._allLayouts.length,layoutData);this._allLayouts.push(layout);this._layoutsByName.set(layout.GetName().toLowerCase(),layout);this._layoutsBySid.set(layout.GetSID(),layout)}GetRuntime(){return this._runtime}SetFirstLayout(layout){this._firstLayout=layout}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw new Error("no first layout"); +}GetLayoutByName(name){return this._layoutsByName.get(name.toLowerCase())||null}GetLayoutBySID(sid){return this._layoutsBySid.get(sid)||null}GetLayoutByIndex(index){index=C3.clamp(Math.floor(index),0,this._allLayouts.length-1);return this._allLayouts[index]}GetLayout(p){if(typeof p==="number")return this.GetLayoutByIndex(p);else return this.GetLayoutByName(p.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(layout){this._mainRunningLayout=layout}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(layout){if(this._runningSubLayouts.includes(layout))throw new Error("layout already running"); +this._runningSubLayouts.push(layout)}_RemoveRunningSubLayout(layout){const i=this._runningSubLayouts.indexOf(layout);if(i===-1)throw new Error("layout not running");this._runningSubLayouts.splice(i,1)}*runningLayouts(){if(this._mainRunningLayout)yield this._mainRunningLayout;if(this._runningSubLayouts.length)yield*this._runningSubLayouts}IsLayoutRunning(layout){return this._mainRunningLayout===layout||this._runningSubLayouts.includes(layout)}SetIsEndingLayout(e){if(e)this._isEndingLayout++;else{if(this._isEndingLayout<= +0)throw new Error("already unset");this._isEndingLayout--}}IsEndingLayout(){return this._isEndingLayout>0}ChangeMainLayout(layout){this._pendingChangeLayout=layout}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const runningLayout=this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const runningLayout= +this.GetMainRunningLayout();if(!runningLayout)return;runningLayout._SetAllLayersMVChanged()}}; + +} + +// timelines/timelineManager.js +{ +'use strict';const C3=self.C3;const NAMES_REGEXP=new RegExp("<(.+?)>","g"); +C3.TimelineManager=class TimelineManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._timelineDataManager=C3.New(C3.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];this._hasRuntimeListeners=false;this._changingLayout=false;this._isTickingTimelines= +false;this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance);this._beforeLoad=e=>this._OnBeforeLoad();this._afterLoad=e=>this._OnAfterLoad();this._afterLayoutStart=e=>this._OnAfterLayoutStart();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._tickFunc=null;this._tick2Func= +null;this._beforeLayoutChange=null;this._layoutChange=null;this._instanceDestroy=null;this._afterLoad=null;for(const timeline of this._timelines){timeline.Stop();timeline.Release()}C3.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;C3.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;C3.clearArray(this._playingTimelines);this._playingTimelines=null;C3.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines= +null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;C3.clearArray(this._destroyedWhileLoadingState);this._destroyedWhileLoadingState=null;this._runtime=null}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("pretick",this._tickFunc);dispatcher.addEventListener("tick2",this._tick2Func);dispatcher.addEventListener("beforelayoutchange", +this._beforeLayoutChange);dispatcher.addEventListener("layoutchange",this._layoutChange);dispatcher.addEventListener("instancedestroy",this._instanceDestroy);dispatcher.addEventListener("beforeload",this._beforeLoad);dispatcher.addEventListener("afterload",this._afterLoad);dispatcher.addEventListener("afterlayoutstart",this._afterLayoutStart)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("pretick",this._tickFunc);dispatcher.removeEventListener("tick2", +this._tick2Func);dispatcher.removeEventListener("beforelayoutchange",this._beforeLayoutChange);dispatcher.removeEventListener("layoutchange",this._layoutChange);dispatcher.removeEventListener("instancedestroy",this._instanceDestroy);dispatcher.removeEventListener("beforeload",this._beforeLoad);dispatcher.removeEventListener("afterload",this._afterLoad);dispatcher.removeEventListener("afterlayoutstart",this._afterLayoutStart)}Create(timelineData){this._timelineDataManager.Add(timelineData);const timeline= +C3.TimelineState.CreateInitial(timelineData,this);this.Add(timeline);this.SetTimelineObjectClassesToMap(timeline);this._timelinesCreatedByTemplate.set(timeline.GetName(),0)}CreateFromTemplate(template){const timelineDataManager=this.GetTimelineDataManager();const templateName=template.GetTemplateName();const timelineDataItem=timelineDataManager.Get(templateName);const timeline=C3.TimelineState.CreateFromTemplate(`${templateName}:${this._timelinesCreatedByTemplate.get(templateName)}`,timelineDataItem, +this);this._IncreaseTemplateTimelinesCount(templateName);this.Add(timeline);return timeline}_IncreaseTemplateTimelinesCount(templateName){this._timelinesCreatedByTemplate.set(templateName,this._timelinesCreatedByTemplate.get(templateName)+1)}_SetCreatedTemplateTimelinesCount(){for(const timeline of this._timelines){if(timeline.IsTemplate())continue;const templateName=timeline.GetTemplateName();this._IncreaseTemplateTimelinesCount(templateName)}}_ClearCreatedTemplateTimelinesCount(){for(const templateName of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(templateName, +0)}Add(timeline){this._timelines.push(timeline);this._timelinesByName.set(timeline.GetName().toLowerCase(),timeline)}Remove(timeline){timeline.Removed();if(timeline.IsTemplate())return;C3.arrayFindRemove(this._timelines,timeline);C3.arrayFindRemove(this._scheduledTimelines,timeline);C3.arrayFindRemove(this._playingTimelines,timeline);C3.arrayFindRemove(this._markedForRemovalTimelines,timeline);this._timelinesByName.delete(timeline.GetName().toLowerCase());this.RemoveTimelineFromObjectClassMap(timeline); +if(!timeline.IsReleased())timeline.Release()}Trigger(method){this._runtime.Trigger(method,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(inst){this._pluginInstance=inst}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const timeline of this._timelines)yield timeline}*GetPlayingTimelines(){for(const timeline of this._playingTimelines)yield timeline}SetTimelineObjectClassToMap(objectClass,timeline){if(!this._objectClassToTimelineMap.has(objectClass))this._objectClassToTimelineMap.set(objectClass, +new Set);this._objectClassToTimelineMap.get(objectClass).add(timeline)}SetTimelineObjectClassesToMap(timeline){for(const objectClass of timeline.GetObjectClasses())this.SetTimelineObjectClassToMap(objectClass,timeline)}RemoveTimelineFromObjectClassMap(timeline){for(const [objectClass,timelines]of this._objectClassToTimelineMap.entries())if(timelines.has(timeline)){timelines.delete(timeline);if(timelines.size===0)this._objectClassToTimelineMap.delete(objectClass)}}GetTimelinesForObjectClass(objectClass){if(!this._objectClassToTimelineMap.has(objectClass))return; +return this._objectClassToTimelineMap.get(objectClass)}GetTimelineOfTemplateForInstances(templateTimeline,instancesObject){if(!instancesObject)return;for(const timeline of this._timelines){const found=instancesObject.every(io=>{return timeline.HasTrackInstance(io.instance,io.trackId)});if(found)if(timeline.GetName().includes(templateTimeline.GetName()))return timeline}}GetTimelineByName(name){return this._timelinesByName.get(name.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(name){for(const timeline of this._scheduledTimelines)if(timeline.GetName()=== +name)return timeline;for(const timeline of this._playingTimelines)if(timeline.GetName()===name)return timeline;return null}*GetTimelinesByName(name){if(NAMES_REGEXP.test(name)){NAMES_REGEXP.lastIndex=0;let match;const uniqueNames=new Set;do{match=NAMES_REGEXP.exec(name);if(match){const names=match[1].split(",");for(const name of names)uniqueNames.add(name)}}while(match);for(const name of uniqueNames.values()){const timeline=this.GetTimelineByName(name);if(timeline)yield timeline}uniqueNames.clear()}else{const timeline= +this.GetTimelineByName(name);if(timeline)yield timeline}}*GetTimelinesByTags(tags){for(const timeline of this._timelines)if(timeline.HasTags(tags))yield timeline}AddScheduledTimeline(timeline){if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline);this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(timeline){C3.arrayFindRemove(this._playingTimelines,timeline);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(timeline){if(this._playingTimelines.includes(timeline)){timeline.SetPlaying(true); +timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false)}else{timeline.SetPlaying(false);timeline.SetScheduled(true);timeline.SetMarkedForRemoval(false);if(!this._scheduledTimelines.includes(timeline))this._scheduledTimelines.push(timeline)}this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.ResolvePlayPromise();C3.arrayFindRemove(this._scheduledTimelines,timeline);this._MaybeDisableRuntimeListeners()}CompleteTimeline(timeline){timeline.SetPlaying(false); +timeline.SetScheduled(false);if(this._playingTimelines.includes(timeline)){timeline.SetMarkedForRemoval(true);this._markedForRemovalTimelines.push(timeline);C3.arrayFindRemove(this._playingTimelines,timeline)}}CompleteTimelineBeforeChangeOfLayout(timeline){timeline.SetPlaying(false);timeline.SetScheduled(false);timeline.SetMarkedForRemoval(false);timeline.SetPlaybackRate(1);C3.arrayFindRemove(this._playingTimelines,timeline)}CompleteTimelineAndResolve(timeline){this.CompleteTimeline(timeline);timeline.ResolvePlayPromise()}_OnTick(){if(this.GetRuntime().IsLoadingState())return; +if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;this._isTickingTimelines=true;while(this._scheduledTimelines.length){const t=this._scheduledTimelines.pop();t.SetInitialState();if(t.GetRenderChange()!==0)this._renderChange=1;this._playingTimelines.push(t)}const dt=this._runtime._GetDtFast();const dt1=this._runtime.GetDt1();const ts=this._runtime.GetTimeScale();for(let i=this._playingTimelines.length-1;i>=0;i--){const t=this._playingTimelines[i];if(t)t.Tick(dt,ts,dt1)}this._isTickingTimelines= +false;if(this._renderChange!==0)this.GetRuntime().UpdateRender()}_OnTick2(){if(this.GetRuntime().IsLoadingState())return;if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;let timelinesToRemove;for(let i=0,l=this._markedForRemovalTimelines.length;it)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}for(const timeline of this._playingTimelines.map(t=> +t)){this._MaybeExecuteTimelineFinishTriggers(timeline);this.Remove(timeline)}}_OnAfterLoad(){for(const destroyedInstance of this._destroyedWhileLoadingState)this._OnInstanceDestroy(destroyedInstance);C3.clearArray(this._destroyedWhileLoadingState)}_OnAfterLayoutStart(){const layoutManager=this._runtime.GetLayoutManager();const runningLayout=layoutManager.GetMainRunningLayout();if(!runningLayout)return;for(const timeline of this._timelines){const startOnLayout=timeline.GetStartOnLayout();if(!startOnLayout)continue; +if(runningLayout.GetName()===startOnLayout)this.ScheduleTimeline(timeline)}}_SaveToJson(){return{"timelinesJson":this._SaveTimelinesToJson(),"scheduledTimelinesJson":this._SaveScheduledTimelinesToJson(),"playingTimelinesJson":this._SavePlayingTimelinesToJson(),"markedForRemovalTimelinesJson":this._SaveMarkedForRemovalTimelinesToJson(),"hasRuntimeListeners":this._hasRuntimeListeners,"changingLayout":this._changingLayout,"isTickingTimelines":this._isTickingTimelines}}_LoadFromJson(o){if(!o)return;this._ClearCreatedTemplateTimelinesCount(); +this._LoadTimelinesFromJson(o["timelinesJson"]);this._LoadScheduledTimelinesFromJson(o["scheduledTimelinesJson"]);this._LoadPlayingTimelinesFromJson(o["playingTimelinesJson"]);this._LoadMarkedForRemovalTimelinesFromJson(o["markedForRemovalTimelinesJson"]);this._hasRuntimeListeners=!o["hasRuntimeListeners"];this._changingLayout=!!o["changingLayout"];this._isTickingTimelines=!!o["isTickingTimelines"];this._SetCreatedTemplateTimelinesCount();this._MaybeEnableRuntimeListeners();this._MaybeDisableRuntimeListeners()}_SaveTimelinesToJson(){return this._timelines.map(timelineState=> +timelineState._SaveToJson())}_LoadTimelinesFromJson(timelinesJson){for(const timelineJson of timelinesJson){let timeline=this.GetTimelineByName(timelineJson["name"]);if(timeline)timeline._LoadFromJson(timelineJson);else{const templateName=this._GetTemplateNameFromJson(timelineJson);if(!templateName)continue;const templateTimeline=this.GetTimelineByName(templateName);timeline=this.CreateFromTemplate(templateTimeline);timeline._LoadFromJson(timelineJson)}if(!timeline.HasTracks())this.Remove(timeline)}}_GetTemplateNameFromJson(timelineJson){const name= +timelineJson["name"];const nameParts=name.split(":");if(!nameParts||nameParts.length!==2)return null;return nameParts[0]}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(scheduledTimelinesJson){this._LoadTimelines(scheduledTimelinesJson,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(playingTimelinesJson){this._LoadTimelines(playingTimelinesJson, +this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(markedForRemovalTimelinesJson){this._LoadTimelines(markedForRemovalTimelinesJson,this._markedForRemovalTimelines)}_IsTimelineInJson(timeline,json){if(!json)return false;for(const name of json)if(name===timeline.GetName())return true;return false}_SaveTimelines(collection){return collection.map(t=>t.GetName())}_LoadTimelines(timelinesJson, +collection){const timelinesToRemove=new Set;for(const timeline of collection)if(!this._IsTimelineInJson(timeline,timelinesJson))timelinesToRemove.add(timeline);C3.arrayRemoveAllInSet(collection,timelinesToRemove);if(timelinesJson){const ff=tn=>t=>t.GetName()===tn;for(const name of timelinesJson){const timeline=this.GetTimelineByName(name);if(timeline){const t=collection.find(ff(name));if(!t)collection.push(timeline)}}}}}; + +} + +// timelines/timelineInfo.js +{ +'use strict';const C3=self.C3;const STEPS=100;const LENGTH_STEP_SIZE=.01;const BEZIER_STEP_SIZE=30;const TANGENT_RESULT=[0,0];const MAP_RESULT=[0,0];const PROJECTION_RESULT=[0,0,0,0,0]; +C3.TimelineInfo=class TimelineInfo{constructor(timeline,trackId){this._initialized=false;this._timeline=timeline;this._segments=[];let trackState=null;if(trackId)trackState=this._timeline.GetTrackById(trackId);else trackState=C3.first(this._timeline.GetTracks());if(!trackState)return;const xTrack=trackState.GetPropertyTrack("offsetX");const yTrack=trackState.GetPropertyTrack("offsetY");if(!xTrack||!yTrack)return;this._xTrack=xTrack;this._yTrack=yTrack;const xPropertyKeyframes=xTrack.GetPropertyKeyframeDataItemArrayIncludingDisabled(); +const yPropertyKeyframes=yTrack.GetPropertyKeyframeDataItemArrayIncludingDisabled();for(let i=1,len=Math.min(xPropertyKeyframes.length,yPropertyKeyframes.length);if[3]-s[3]);return ret[0]}Tangent(t,segmentIndex){return this._segments[segmentIndex].Tangent(t)}TangentAngle(x,y,t,segmentIndex){return this._segments[segmentIndex].TangentAngle(x,y,t)}}; +C3.TimelineCubicBezierSegmentInfo=class TimelineCubicBezierSegmentInfo{constructor(startX,startY,endX,endY,index){this._index=index;const startXAddon=startX.GetAddOn("cubic-bezier");const endXAddon=endX.GetAddOn("cubic-bezier");const startYAddon=startY.GetAddOn("cubic-bezier");const endYAddon=endY.GetAddOn("cubic-bezier");this._aX=startX.GetValueWithResultMode();this._aY=startY.GetValueWithResultMode();this._bX=startX.GetValueWithResultMode()+startXAddon.GetStartAnchor();this._bY=startY.GetValueWithResultMode()+ +startYAddon.GetStartAnchor();this._cX=endX.GetValueWithResultMode()+endXAddon.GetEndAnchor();this._cY=endY.GetValueWithResultMode()+endYAddon.GetEndAnchor();this._dX=endX.GetValueWithResultMode();this._dY=endY.GetValueWithResultMode();this._initialized=false;this._len=STEPS;this._arcLengths=new Array(this._len+1);this._arcLengths[0]=0;this._length=0;this._lut=[];this._CalculateLength()}Release(){C3.clearArray(this._arcLengths);this._arcLengths=null;C3.clearArray(this._lut);this._lut=null}GetType(){return"cubic-bezier"}GetIndex(){return this._index}GetStepCount(){return Math.floor(this._length/ +BEZIER_STEP_SIZE)}GetStepIncrement(){return 1/this.GetStepCount()}SetOrigin(ox,oy){this._originX=ox;this._originY=oy;this._arcLengths=new Array(this._len+1);this._arcLengths[0]=0;this._CalculateLength()}Map(u){if(!this._initialized)return NaN;const mt=this._Map(u);MAP_RESULT[0]=this._X(mt);MAP_RESULT[1]=this._Y(mt);return MAP_RESULT}Project(x,y,tRange){const lut=this._GenerateLUT(STEPS);const i=this._FindClosestFromLUT(x,y,lut,tRange);const p=this._RefineProjection(x,y,lut,i);PROJECTION_RESULT[0]= +p.x;PROJECTION_RESULT[1]=p.y;PROJECTION_RESULT[2]=p.t;PROJECTION_RESULT[3]=p.distance;return PROJECTION_RESULT}Tangent(t){const mt=1-t;const a=mt*mt;const b=2*mt*t;const c=t*t;const d0x=3*(this._bX+this._originX-(this._aX+this._originX));const d0y=3*(this._bY+this._originY-(this._aY+this._originY));const d1x=3*(this._cX+this._originX-(this._bX+this._originX));const d1y=3*(this._cY+this._originY-(this._bY+this._originY));const d2x=3*(this._dX+this._originX-(this._cX+this._originX));const d2y=3*(this._dY+ +this._originY-(this._cY+this._originY));const dx=a*d0x+b*d1x+c*d2x;const dy=a*d0y+b*d1y+c*d2y;const m=Math.hypot(dx,dy);TANGENT_RESULT[0]=dx/m;TANGENT_RESULT[1]=dy/m;return TANGENT_RESULT}TangentAngle(x,y,t){const tanget=this.Tangent(t);const angle=C3.angleTo(x,y,x+tanget[0],y+tanget[1]);return angle}_Map(u){if(!this._initialized)return;let targetLength=u*this._arcLengths[this._len];let low=0;let high=this._len;let index=0;while(lowtargetLength)index--;const lengthBefore=this._arcLengths[index];if(lengthBefore===targetLength)return index/this._len;else return(index+(targetLength-lengthBefore)/(this._arcLengths[index+1]-lengthBefore))/this._len}_X(t){if(!this._initialized)return NaN;return self.Ease.GetRuntimeEase("cubicbezier")(t,this._aX+this._originX,this._bX+this._originX,this._cX+this._originX,this._dX+this._originX)}_Y(t){if(!this._initialized)return NaN;return self.Ease.GetRuntimeEase("cubicbezier")(t, +this._aY+this._originY,this._bY+this._originY,this._cY+this._originY,this._dY+this._originY)}_GenerateLUT(steps){steps=steps||STEPS;if(this._lut.length===steps)return this._lut;this._lut=[];steps++;for(let i=0;i{p.t=index/(LUT.length-1);p.distance=C3.distanceTo(x,y,p.x, +p.y);if(tRange&&C3.IsArray(tRange)&&C3.IsFiniteNumber(tRange[0])&&C3.IsFiniteNumber(tRange[1])){if(p.t>=tRange[0]&&p.t<=tRange[1])if(p.distanceepsilon)q=null;return q}_CalculateLength(){this._initialized=true;let ox=this._X(0);let oy= +this._Y(0);let clen=0;for(let i=1;i<=this._len;i++){const x=this._X(i*LENGTH_STEP_SIZE);const y=this._Y(i*LENGTH_STEP_SIZE);const dx=ox-x;const dy=oy-y;clen+=Math.hypot(dx,dy);this._arcLengths[i]=clen;ox=x;oy=y}this._length=clen}}; +C3.TimelineLineSegmentInfo=class TimelineLineSegmentInfo{constructor(startX,startY,index){this._index=index;this._targetX=startX.GetValueWithResultMode();this._targetY=startY.GetValueWithResultMode();this._originX=0;this._originY=0}Release(){}GetType(){return"line"}GetIndex(){return this._index}SetOrigin(ox,oy){this._originX=ox;this._originY=oy}GetX(){return this._targetX+this._originX}GetY(){return this._targetY+this._originY}}; + +} + +// timelines/state/timelineState.js +{ +'use strict';const C3=self.C3;const PING_PONG_BEGIN=0;const PING_PONG_END=1; +C3.TimelineState=class Timeline extends C3.DefendedBase{constructor(name,timelineDataItem,timelineManager){super();this._runtime=timelineManager.GetRuntime();this._timelineManager=timelineManager;this._timelineDataItem=timelineDataItem;this._name=name;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playPromise=null;this._playResolve=null;this._playheadTime=0;this._playbackRate=1;this._pingPongState=PING_PONG_BEGIN; +this._currentRepeatCount=1;this._isPlaying=false;this._isScheduled=false;this._initialStateSet=false;this._complete=true;this._released=false;this._markedForRemoval=false;this._completedTick=-1;this._implicitPause=false;this._isTemplate=false;this._finishedTriggers=false;this._firstTick=false;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=false;this._renderChange=0;this._hasNestedContent=0;this._iTimelineState=null}static CreateInitial(timelineDataJson,timelineManager){const timelineDataManager= +timelineManager.GetTimelineDataManager();const nameId=timelineDataManager.GetNameId();const timelineDataItem=timelineDataManager.Get(timelineDataJson[nameId]);const timeline=C3.New(C3.TimelineState,timelineDataJson[nameId],timelineDataItem,timelineManager);timeline.SetIsTemplate(true);return timeline}static CreateFromTemplate(name,timelineDataItem,timelineManager){return C3.New(C3.TimelineState,name,timelineDataItem,timelineManager)}Release(){if(this.IsReleased())return;const dispatcher=this._runtime.Dispatcher(); +this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const track of this._tracks)track.Release();C3.clearArray(this._tracks);this._tracks=null;this._runtime=null;this._timelineManager=null;this._timelineDataItem=null;this._released=true;this._playPromise=null;this._playResolve=null;this.FireReleaseEvent(dispatcher)}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"timelinestatereleased");event.timelineState=this;dispatcher.dispatchEvent(event)}GetType(){return 0}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength= +this._tracks.push(C3.TrackState.Create(this,trackDataItem))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(instance,sourceAdapter,propertyName,propertyTrack){if(!this._hasNestedContent)return;let ret;for(let i=0;i0}GetPlayPromise(){if(this._playPromise)return this._playPromise;this._playPromise=new Promise(resolve=>{this._playResolve=resolve});return this._playPromise}ResolvePlayPromise(){if(!this._playPromise)return; +this._playResolve();this._playPromise=null;this._playResolve=null}SetTags(tags){this._tags=C3.TimelineState._GetTagArray(tags);this._tagsChanged=true}GetTags(){return this._tags}GetStringTags(){if(this._tagsChanged)this._stringTags=this._tags.join(" ");this._tagsChanged=false;return this._stringTags}HasTags(tags){if(!this._tags)return false;if(!this._tags.length)return false;const t=C3.TimelineState._GetTagArray(tags);if(!t)return false;if(!t.length)return false;return t.every(C3.TimelineState._HasTag, +this)}OnStarted(){if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineStarted);C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}OnCompleted(){this._completedTick= +this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return;this._finishedTriggers=true;if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinished);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByTags);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineFinished); +C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}SetPlaying(p){this._isPlaying=p}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(playingOnly=false){if(this.IsCompletedTick())return true;if(this.IsScheduled()&&!playingOnly)return true;return this._isPlaying}_IsPlaying(){return this.IsPlaying(true)}IsPaused(){return this._IsPaused()}_IsPaused(){if(this.IsReleased())return false;if(this.IsScheduled())return false;if(this._IsPlaying())return false;if(this.IsComplete())return false; +return true}SetScheduled(s){this._isScheduled=s}IsScheduled(){return this._isScheduled}SetComplete(c){this._complete=c;const t=this.GetTime();if(t<=0||t>=this.GetTotalTime())this._complete=true}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(mfr){this._markedForRemoval=mfr}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(ip){this._implicitPause=ip}IsImplicitPause(){return this._implicitPause}SetIsTemplate(it){this._isTemplate=!!it}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime}SetTime(time){const lastGlobalTime= +this.GetTime();this._SetTime(time);this.SetComplete(false);if(!this.IsComplete())this.SetImplicitPause(true);if(!this._IsPlaying()&&!this.IsScheduled()&&this._initialStateSet);else if(!this._IsPlaying()&&!this.IsScheduled()&&!this._initialStateSet)this.SetInitialStateFromSetTime();else if(this._IsPlaying())this.Stop();else if(this.IsScheduled()){this._timelineManager.DeScheduleTimeline(this);this.SetInitialStateFromSetTime()}this._SetUpdateStateBefore();this._Interpolate(this.GetTime(),false,true, +true,lastGlobalTime);this._SetUpdateStateAfter();if(this._renderChange)this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime(); +else this._playheadTime=time;for(const track of this._tracks)track.SetResetState()}_OnSetTime(){if(!C3.Plugins.Timeline||this.constructor!==C3.TimelineState)return;C3.Plugins.Timeline.Cnds.PushTriggerTimeline(this);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSet);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByName);this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByTags);C3.Plugins.Timeline.Cnds.PopTriggerTimeline()}_CanResume(){if(this.GetLoop())return true; +else if(this.GetPingPong()&&this._pingPongState===PING_PONG_END)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else{if(this.GetTime()<=0)return false}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return false}else if(this.GetTime()<=0)return false;return true}Resume(){if(this.IsReleased())return;if(this._CanResume())this.Play(true)}Play(resume=false){if(this.IsReleased())return false;if(this.IsScheduled())return false; +if(this._IsPlaying()&&this.IsCompletedTick())return this._SchedulePlayingTimeline();if(this._IsPlaying())return false;if(!this.IsComplete()&&!resume&&!this.IsImplicitPause())return false;return this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(false);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return true}_ScheduleStoppedTimeline(){this.SetImplicitPause(false);this._timelineManager.ScheduleTimeline(this); +this.GetPlayPromise();return true}Stop(completed=false){if(this.IsReleased())return;this.SetComplete(completed);this._timelineManager.CompleteTimeline(this);if(this.IsComplete())this.ResolvePlayPromise()}Reset(render=true,beforeChangeLayout=false){if(this.IsReleased())return;if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(this.IsComplete())return;this.Stop(true);if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime()); +const time=this.GetTime();this._SetUpdateStateBefore();if(beforeChangeLayout)this._InterpolateBeforeChangeLayout(time);else this._Interpolate(time,false,false,true);if(render)this._OnSetTime();this._SetUpdateStateAfter();if(this._renderChange&&render)this.GetRuntime().UpdateRender()}ResetBeforeChangeLayout(){this.Reset(false,true)}_InterpolateBeforeChangeLayout(time){this._Interpolate(time,false,false,true,NaN,false,true)}_OnBeforeChangeLayout(){if(this.IsReleased())return true;if(!this.GetRuntime().IsLoadingState())if(this.HasValidGlobalTracks())return false; +this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);if(!this.GetRuntime().IsLoadingState())this.ResetBeforeChangeLayout();return true}SetInitialStateFromSetTime(){this.SetInitialState(true)}SetInitialState(fromSetTime){if(this.IsMarkedForRemoval())return;if(fromSetTime){this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState();this._SetUpdateStateAfter()}else{this.SetPlaying(true); +this.SetScheduled(false);this.OnStarted();if(this.IsComplete()){this._completedTick=-1;if(this._pingPongState!==PING_PONG_BEGIN)this._playbackRate=Math.abs(this._playbackRate);this._pingPongState=PING_PONG_BEGIN;this._currentRepeatCount=1;this._complete=false;this._finishedTriggers=false;this._initialStateSet=true;this._firstTick=true;if(this.IsForwardPlayBack())this._SetTime(0);else this._SetTime(this.GetTotalTime());this._SetUpdateStateBefore();for(const track of this._tracks)track.SetInitialState(); +this._SetUpdateStateAfter()}else{this._firstTick=true;this._finishedTriggers=false;this._SetUpdateStateBefore();for(const track of this._tracks)track.SetResumeState();this._SetUpdateStateAfter()}}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=0;for(const track of this._tracks)if(track.IsNested())this._hasNestedContent=1}_SetUpdateStateAfter(){this._renderChange=0;for(const track of this._tracks){track._SetUpdateState();if(this._renderChange===0&&track.GetRenderChange()=== +1)this._renderChange=1;if(!this._beforeAndAfterTracks&&track.GetNeedsBeforeAndAfter()===1){if(!this._beforeAndAfterTracks)this._beforeAndAfterTracks=[];this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(track)}}}Tick(deltaTime,timeScale,deltaTime1){if(this.GetUseSystemTimescale()){if(deltaTime===0&&this._lastDelta===0)return;this._lastDelta=deltaTime}else{if(deltaTime1===0&&this._lastDelta===0)return;this._lastDelta=deltaTime1;deltaTime=deltaTime1;timeScale=1}const lastTime=this._playheadTime; +const newDeltaTime=deltaTime*timeScale*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime;if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<=0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&& +pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<= +0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}let i;const l=this._tracksLength;if(complete){for(i=0;i0){if(startOffset<0)this._playheadTime=0;else if(startOffset>=totalTime)this._playheadTime=totalTime;else this._playheadTime=startOffset;track.Interpolate(startOffset,true,false,ensureValue,this._firstTick,false)}else track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false)}else for(i=0;i0){t=track.GetStartOffset();this._SetTime(t)}}track.Interpolate(t,isTicking,setTime,ensureValue,this._firstTick,ignoreGlobals)}for(const track of this._tracks)track.AfterInterpolate();if(this._firstTick&&onTickCall)this._firstTick=false}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TrackState.Create(this,trackDataItem);this._tracksLength=this._tracks.push(track);return track}Removed(){if(this.IsReleased())return; +for(const track of this._tracks)track.TimelineRemoved()}CleanCaches(){for(const track of this._tracks)track.CleanCaches()}ClearTrackInstances(){for(const track of this._tracks)track.ClearInstance()}SetTrackInstance(trackId,instance){if(!instance)return;for(const track of this._tracks){if(!track.IsInstanceTrack())continue;if(trackId){if(track.GetId()!==trackId)continue;track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}else{if(track.HasInstance())continue; +track.SetInstance(instance);this._timelineManager.SetTimelineObjectClassToMap(instance.GetObjectClass(),this);break}}}HasTrackInstance(instance,trackId){for(const track of this._tracks){if(!track.IsInstanceTrack())continue;if(trackId){if(trackId===track.GetId()&&instance===track.GetInstance())return true}else if(instance===track.GetInstance())return true}return false}HasValidTracks(){return this._tracks.some(t=>{if(t.IsInstanceTrack())return t.CanInstanceBeValid();else return true})}HasValidGlobalTracks(){return this._tracks.some(t=> +{if(t.IsInstanceTrack()){if(!t.CanInstanceBeValid())return false;const objectClass=t.GetObjectClass();if(!objectClass)return false;return objectClass.IsGlobal()}else return false})}GetPropertyTrack(propertyName){for(const track of this.GetTracks())for(const propertyTrack of track.GetPropertyTracks())if(propertyTrack.GetPropertyName()===propertyName)return propertyTrack}GetTrackFromInstance(instance){for(const track of this._tracks)if(instance===track.GetInstance())return track;return null}GetKeyframeWithTags(tags){let tagsArray= +tags?tags.split(" "):[];const tagsSet=new Set(tagsArray.map(t=>t.toLowerCase().trim()));tagsArray=[...tagsSet.values()];for(const track of this.GetTracks())for(const keyframeDataItem of track.GetKeyframeDataItems()){const hasAllTags=tagsArray.every(t=>keyframeDataItem.HasTag(t));if(hasAllTags)return keyframeDataItem}}GetObjectClasses(){const ret=[];for(const track of this.GetTracks())ret.push(track.GetObjectClass());return ret.filter(oc=>oc)}_SaveToJson(){return{"tracksJson":this._SaveTracksToJson(), +"name":this._name,"playheadTime":this.GetTime(),"playbackRate":this._playbackRate,"pingPongState":this._pingPongState,"currentRepeatCount":this._currentRepeatCount,"isPlaying":this._isPlaying,"isScheduled":this._isScheduled,"initialStateSet":this._initialStateSet,"finishedTriggers":this._finishedTriggers,"complete":this._complete,"released":this._released,"markedForRemoval":this._markedForRemoval,"completedTick":this._completedTick,"implicitPause":this._implicitPause,"isTemplate":this._isTemplate, +"tags":this._tags.join(" "),"stringTags":this._stringTags,"tagsChanged":this._tagsChanged,"firstTick":this._firstTick}}_LoadFromJson(o){if(!o)return;this._LoadTracksFromJson(o["tracksJson"]);this._name=o["name"];this._playheadTime=o["playheadTime"];this._playbackRate=o["playbackRate"];this._pingPongState=o["pingPongState"];this._currentRepeatCount=o["currentRepeatCount"];this._isPlaying=!!o["isPlaying"];this._isScheduled=!!o["isScheduled"];this._initialStateSet=!!o["initialStateSet"];this._finishedTriggers= +o.hasOwnProperty("finishedTriggers")?!!o["finishedTriggers"]:false;this._complete=!!o["complete"];this._released=!!o["released"];this._markedForRemoval=!!o["markedForRemoval"];this._completedTick=o["completedTick"];this._implicitPause=!!o["implicitPause"];this._isTemplate=!!o["isTemplate"];this._tags=o["tags"].split(" ");this._stringTags=o["stringTags"];this._tagsChanged=!!o["tagsChanged"];this._firstTick=!!o["firstTick"]}_SaveTracksToJson(){return this._tracks.map(trackState=>trackState._SaveToJson())}_LoadTracksFromJson(tracksJson){this.ClearTrackInstances(); +tracksJson.forEach((trackJson,i)=>{const track=this._tracks[i];track._LoadFromJson(trackJson)});this._tracks.filter(track=>track.CanInstanceBeValid())}static _HasTag(tag){const tags=this.GetTags();if(tag==="")return tags.length===1&&tags[0]==="";return tags.map(t=>t.toLowerCase()).includes(tag.toLowerCase())}static _GetTagArray(tags){if(C3.IsArray(tags))return tags.slice(0);if(C3.IsString(tags))return tags.split(" ");throw new Error("invalid tags");}GetITimelineState(){if(!this._iTimelineState)this._iTimelineState= +C3.New(self.ITimelineState,this);return this._iTimelineState}}; + +} + +// timelines/state/trackState.js +{ +'use strict';const C3=self.C3;const INSTANCE_TRACK=0;const VALUE_TRACK=1;const AUDIO_TRACK=2; +C3.TrackState=class Track extends C3.DefendedBase{constructor(timeline,trackDataItem){super();this._timeline=timeline;this._trackDataItem=trackDataItem;this._trackData=trackDataItem.GetTrackData();this._instanceUid=NaN;this._objectClassIndex=NaN;this._instance=null;this._worldInfo=null;this._isNested=trackDataItem.GetStartOffset()>0;this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray(); +this._propertyTracks=[];this.CreatePropertyTrackStates();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0}static Create(timeline,trackDataItem){return C3.New(C3.TrackState,timeline,trackDataItem)}Release(){this._keyframeDataItems=null;for(const propertyTrack of this._propertyTracks)propertyTrack.Release();C3.clearArray(this._propertyTracks);this._propertyTracks=null;this._timeline=null;this._instance=null;this._worldInfo=null;this._trackDataItem=null;this._lastKeyframeDataItem= +null}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.PropertyTrackState.Create(this,propertyTrackDataItem))}TimelineRemoved(){for(const propertyTrack of this._propertyTracks)propertyTrack.TimelineRemoved()}CleanCaches(){for(const propertyTrack of this._propertyTracks)propertyTrack.CleanCaches();this._instance=null;this._worldInfo=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){if(this._keyframeDataItems)return this._keyframeDataItems; +this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return this._keyframeDataItems}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(propertyName){for(let i=0;ipt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter= +1;this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time);this.OnKeyframeReached(this._GetLastKeyFrameBeforeTime(time))}SetResumeState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const playbackDirection=this._timeline.IsForwardPlayBack();const time=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(time); +for(const propertyTrack of this._propertyTracks)propertyTrack.SetResumeState(time)}SetEndState(){if(this.GetTimeline().IsComplete())return;this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;if(!this._isNested){const time=this._timeline.GetTime();const totalTime=this.GetStartOffset()+this.GetLocalTotalTime();if(time>=totalTime)this.Interpolate(this.GetLocalTotalTime(),true,false,true,false,false,true);else if(time<=0)this.Interpolate(0,true,false,true,false,false,true)}}_SetUpdateState(){for(let i= +0,l=this._propertyTracks.length;ithis.GetLocalTotalTime())return;for(const propertyTrack of this._propertyTracks)propertyTrack.SetInitialState();this._initialStateOfNestedSet=true}MaybeSetEndStateOfNestedTrack(time,isTicking){if(!isTicking)return;if(!this._isNested)return;if(this._endStateOfNestedSet)return;const timeline=this.GetTimeline();if(timeline.IsForwardPlayBack()){if(time>=this.GetLocalTotalTime()){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(this.GetLocalTotalTime(), +false,true);this._endStateOfNestedSet=true}}else if(time<=0){for(const propertyTrack of this._propertyTracks)propertyTrack.Interpolate(0,false,true);this._endStateOfNestedSet=true}}MaybeTriggerKeyframeReachedConditions(time,isTicking,firstTick){if(firstTick)return;if(!isTicking)return;if(!C3.Plugins.Timeline)return;const timeline=this.GetTimeline();const nextKeyframe=this._lastKeyframeDataItem.GetNext();const lastTime=this._lastKeyframeDataItem.GetTime();const nextTime=nextKeyframe?nextKeyframe.GetTime(): +timeline.GetTotalTime();if(time<=lastTime||time>=nextTime){this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem);if(timeline.IsForwardPlayBack()){if(nextKeyframe)this.OnKeyframeReached(this._lastKeyframeDataItem)}else{const nextKeyframe=this._lastKeyframeDataItem.GetNext();if(nextKeyframe)this.OnKeyframeReached(nextKeyframe)}}}_GetLastKeyFrameBeforeTime(time){const keyframeDataItem=this._trackData.GetKeyFrameDataItemAtTime(time,this._trackDataItem); +if(keyframeDataItem)return keyframeDataItem;else return this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(time,this._trackDataItem)}OnKeyframeReached(keyframeDataItem){const timeline=this.GetTimeline();const timelineManager=timeline.GetTimelineManager();C3.Plugins.Timeline.Cnds.PushTriggerTimeline(timeline);C3.Plugins.Timeline.Cnds.PushTriggerKeyframe(keyframeDataItem);timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyKeyframeReached);timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnKeyframeReached); +C3.Plugins.Timeline.Cnds.PopTriggerTimeline(timeline);C3.Plugins.Timeline.Cnds.PopTriggerKeyframe(keyframeDataItem)}AddKeyframe(){const keyframeData=this._trackDataItem.GetKeyframeData();const keyframeDataItem=keyframeData.AddEmptyKeyframeDataItem();return keyframeDataItem}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData();const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.PropertyTrackState.Create(this,propertyTrackDataItem); +this._propertyTracks.push(propertyTrack);return propertyTrack}DeleteKeyframes(match){const keyframeData=this._trackDataItem.GetKeyframeData();keyframeData.DeleteKeyframeDataItems(match)}DeletePropertyKeyframes(match){for(const propertyTrack of this._propertyTracks)propertyTrack.DeletePropertyKeyframes(match)}SaveState(){for(const propertyTrack of this._propertyTracks)propertyTrack.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return; +for(const propertyTrack of this._propertyTracks)propertyTrack.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;let difference=false;for(const propertyTrack of this._propertyTracks){const diff=propertyTrack.CompareSaveStateWithCurrent();if(!difference&&diff)difference=true}if(difference){const keyframeDataItem=this.AddKeyframe();keyframeDataItem.SetTime(this.GetTimeline().GetTime());keyframeDataItem.SetEase("noease"); +keyframeDataItem.SetEnable(true);keyframeDataItem.SetTags("")}}_SaveToJson(){const instance=this.GetInstance();const uid=instance?instance.GetUID():this.GetInstanceUID();return{"propertyTracksJson":this._SavePropertyTracksToJson(),"lastKeyframeDataItemJson":this._SaveLastKeyframeDataItemToJson(),"initialStateOfNestedSet":this._initialStateOfNestedSet,"endStateOfNestedSet":this._endStateOfNestedSet,"instanceUid":uid}}_LoadFromJson(o){if(!o)return;this._LoadPropertyTracksFromJson(o["propertyTracksJson"]); +this._LoadLastKeyframeDataItemFromJson(o["lastKeyframeDataItemJson"]);this._LoadInstanceFromJson(o["instanceUid"]);this._initialStateOfNestedSet=false;if(o.hasOwnProperty["initialStateOfNestedSet"])this._initialStateOfNestedSet=o["initialStateOfNestedSet"];this._endStateOfNestedSet=false;if(o.hasOwnProperty["endStateOfNestedSet"])this._endStateOfNestedSet=o["endStateOfNestedSet"];for(const propertyTrack of this._propertyTracks){if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange= +1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;if(this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter()))this._needsBeforeAndAfter=1}_SaveLastKeyframeDataItemToJson(){const keyframeData=this._trackDataItem.GetKeyframeData();return keyframeData.GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(propertyTrackState=>propertyTrackState._SaveToJson())}_LoadPropertyTracksFromJson(propertyTracksJson){propertyTracksJson.forEach((propertyTrackJson, +i)=>{const propertyTrack=this._propertyTracks[i];propertyTrack._LoadFromJson(propertyTrackJson)})}_LoadInstanceFromJson(uid){if(!C3.IsFiniteNumber(uid))return;const instance=this.GetRuntime().GetInstanceByUID(uid);if(!instance)return;const timeline=this.GetTimeline();timeline.SetTrackInstance(this._trackDataItem.GetId(),instance)}_LoadLastKeyframeDataItemFromJson(lastKeyframeDataItemIndex){const keyframeData=this._trackDataItem.GetKeyframeData();this._lastKeyframeDataItem=keyframeData.GetKeyframeDataItemFromIndex(lastKeyframeDataItemIndex)}}; + +} + +// timelines/state/propertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState=class PropertyTrack extends C3.DefendedBase{constructor(track,propertyTrackDataItem){super();this._track=track;this._propertyTrackDataItem=propertyTrackDataItem;this._propertyTrackData=propertyTrackDataItem.GetPropertyTrackData();this._worldInfoChange=0;this._renderChange=0;this._needsBeforeAndAfter=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._lastPropertyKeyframeDataItem= +null;this._absoluteValueObject=null}static Create(track,propertyTrackDataItem){return C3.New(C3.PropertyTrackState,track,propertyTrackDataItem)}Release(){this._track=null;if(this._sourceAdapter){this._sourceAdapter.Release();this._sourceAdapter=null}this._propertyKeyframeDataItems=null;this._propertyTrackDataItem=null;this._propertyTrackData=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(avo){this._absoluteValueObject= +avo}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;const id=this._propertyTrackDataItem.GetSourceAdapterId();let ret;switch(id){case "behavior":ret= +new C3.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":ret=new C3.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":ret=new C3.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":ret=new C3.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":ret=new C3.PropertyTrackState.PropertySourceAdapter(this);this._renderChange=1;this._worldInfoChange=1;break;case "value":ret=new C3.PropertyTrackState.ValueSourceAdapter(this); +break;case "audio":ret=new C3.PropertyTrackState.AudioSourceAdapter(this);break}this._sourceAdapter=ret;return this._sourceAdapter}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(said){this._propertyTrackDataItem.SetSourceAdapterId(said)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(sargs){this._propertyTrackDataItem.SetSourceAdapterArguments(sargs)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(pn){this._propertyTrackDataItem.SetProperty(pn)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(pt){this._propertyTrackDataItem.SetType(pt)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(min){this._propertyTrackDataItem.SetMin(min)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(max){this._propertyTrackDataItem.SetMax(max)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(e){this._propertyTrackDataItem.SetEnable(e)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(im){this._propertyTrackDataItem.SetInterpolationMode(im)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(rm){this._propertyTrackDataItem.SetResultMode(rm)}SetEase(e){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())propertyKeyframeDataItem.SetEase(e)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){if(this._propertyKeyframeDataItems)return this._propertyKeyframeDataItems; +this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();return this._propertyKeyframeDataItems}GetPropertyKeyframeDataItemArrayIncludingDisabled(){return this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArrayIncludingDisabled()}GetPropertyKeyFrameDataItemAtTime(time){return this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time,this._propertyTrackDataItem)}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time){return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem)}GetPropertyKeyframeDataItemPairForTime(time){let start=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time,this._propertyTrackDataItem);let end;if(start)end=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(time,this._propertyTrackDataItem);else{start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);end=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,this._propertyTrackDataItem)}return{start, +end}}*GetPropertyKeyframeValues(){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())yield propertyKeyframeDataItem.GetValueWithResultMode()}*GetPropertyKeyframeTimes(){for(const propertyKeyframeDataItem of this.GetPropertyKeyframeDataItems())yield propertyKeyframeDataItem.GetTime()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetResetState(){this.GetSourceAdapter().SetResetState()}SetInitialState(time){this.GetSourceAdapter().SetInitialState(); +this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time);this._SetUpdateState()}SetResumeState(time){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(time)}_SetUpdateState(){const track=this.GetTrack();this._needsBeforeAndAfter=0;if(track.IsInstanceTrack()){const timeline=this.GetTimeline();const instance=track.GetInstance();const sourceAdapter=this.GetSourceAdapter();const propertyName=this.GetPropertyName(); +const mayNeedBeforeAndAfterInterpolate=sourceAdapter.MayNeedBeforeAndAfterInterpolate();if(mayNeedBeforeAndAfterInterpolate){const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,propertyName,this);if(similarPropertyTracks&&similarPropertyTracks.length)this._needsBeforeAndAfter=1}else this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(time){const timeline=this.GetTimeline();const propertyKeyframeDataItem=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(time, +this._propertyTrackDataItem);if(propertyKeyframeDataItem)return propertyKeyframeDataItem;else if(timeline.IsForwardPlayBack())return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else return this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(time,setTime=false,ensureValue=false,endState=false){let start;let end; +let propertyKeyframeReached=false;if(setTime)start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime){this._lastPropertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);propertyKeyframeReached=true}}else{this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);propertyKeyframeReached=true}start=this._lastPropertyKeyframeDataItem}if(start)end=start.GetNext();this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time){if(this._lastPropertyKeyframeDataItem){const timeline= +this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem);const start=this._lastPropertyKeyframeDataItem;const end=start.GetNext();return this._sourceAdapter.GetInterpolatedValue(time,start,end)}GetInterpolatedValueFast(time,start,end){return this._sourceAdapter.GetInterpolatedValue(time,start,end)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData; +return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)}static GetEndPropertyKeyframeForTime(time,propertyTrack){const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack._propertyTrackData;return propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem= +propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem=null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){const difference=this.GetSourceAdapter().CompareInitialStateWithCurrent();if(difference){const propertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem);const currentState=this.GetSourceAdapter().GetCurrentState();propertyKeyframeDataItem.SetAbsoluteValue(currentState)}}CompareSaveStateWithCurrent(){const difference=this.GetSourceAdapter().CompareSaveStateWithCurrent();if(difference)this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return difference}AddPropertyKeyframeAtCurrentTime(){const time=this.GetTimeline().GetTime();const sourceAdapter= +this.GetSourceAdapter();const startPropertyKeyframe=C3.PropertyTrackState.GetStartPropertyKeyframeForTime(time,this);const propertyKeyframeDataItem=this.AddPropertyKeyframe();propertyKeyframeDataItem.SetType(startPropertyKeyframe.GetType());propertyKeyframeDataItem.SetTime(time);propertyKeyframeDataItem.SetEase(startPropertyKeyframe.GetEase());propertyKeyframeDataItem.SetEnable(true);propertyKeyframeDataItem.SetValue(sourceAdapter.GetValueAtTime());propertyKeyframeDataItem.SetAbsoluteValue(sourceAdapter.GetCurrentState())}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return; +this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/propertySourceAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +NS.PropertySourceAdapter=class PropertySourceAdapter{constructor(propertyTrack){this._propertyTrack=propertyTrack;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){if(this._propertyAdapter){this._propertyAdapter.Release();this._propertyAdapter=null}this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){if(this._propertyAdapter)this._propertyAdapter.TimelineRemoved()}CleanCaches(){if(this._propertyAdapter)this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;this._propertyAdapter= +this._CreatePropertyAdapter();return this._propertyAdapter}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetResetState(){this.GetPropertyAdapter().SetResetState()}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this._propertyAdapter.BeforeChangeProperty()}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const type=this._propertyTrack.GetPropertyKeyframeType(); +let value;switch(type){case "numeric":{value=NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "angle":{value=NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "boolean":{value=NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "color":{value=NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}case "text":{value=NS.TextTypeAdapter.Interpolate(time,start,end,this._propertyTrack);break}}this._propertyAdapter.ChangeProperty(time, +value,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return NS.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "angle":return NS.AngleTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "boolean":return NS.BooleanTypeAdapter.Interpolate(time,start,end,this._propertyTrack);case "color":return NS.ColorTypeAdapter.Interpolate(time,start,end,this._propertyTrack); +case "text":return NS.TextTypeAdapter.Interpolate(time,start,end,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const propertyTrack= +this._propertyTrack;const track=propertyTrack.GetTrack();const time=track.GetTimeline().GetTime();const start=NS.GetStartPropertyKeyframeForTime(time,propertyTrack);const end=start.GetNext();const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{return NS.NumericTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "angle":{return NS.AngleTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "boolean":{return NS.BooleanTypeAdapter.Interpolate(time,start,end,propertyTrack)}case "color":{return NS.ColorTypeAdapter.Interpolate(time, +start,end,propertyTrack)}case "text":{return NS.TextTypeAdapter.Interpolate(time,start,end,propertyTrack)}}}_CreatePropertyAdapter(){const pt=this._propertyTrack;const type=pt.CanHavePropertyKeyframes()?pt.GetPropertyKeyframeType():"";switch(type){case "combo":case "boolean":case "text":case "string":{return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this)}case "numeric":case "number":case "angle":{if(this._propertyTrack.GetPropertyType()==="combo")return new NS.PropertyInterpolationAdapter.NoInterpolationAdapter(this); +return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}case "color":case "offsetColor":{return new NS.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}default:{return new NS.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}}_SaveToJson(){return{"propertyAdapterJson":this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(o){if(!o)return;this.GetPropertyAdapter()._LoadFromJson(o["propertyAdapterJson"])}}; + +} + +// timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class InstanceVariableSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetIndex(){if(this._updatedIndex)return this._updatedIndex;return super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(index){const i=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX];if(i=== +index)return;this._updatedIndex=index}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){if(!this.GetPropertyAdapter().CanChange(start.GetValue()))return;return super.GetInterpolatedValue(time,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"index":this._updatedIndex})}_LoadFromJson(o){if(!o)return; +super._LoadFromJson(o);this._updatedIndex=o["index"]}}C3.PropertyTrackState.InstanceVariableSourceAdapter=InstanceVariableSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/behaviorSourceAdapter.js +{ +'use strict';const C3=self.C3;const SID=0;const INDEX=1;const NAME=2; +class BehaviorSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._sid=NaN}GetEditorIndex(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();return dataItem.GetSourceAdapterArguments()[INDEX]}GetTarget(){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const track=this._propertyTrack.GetTrack();const sid=this._sid?this._sid:dataItem.GetSourceAdapterArguments()[SID];const instance=track.GetInstance();const index= +instance.GetBehaviorIndexBySID(sid);const behaviorInstance=instance.GetBehaviorInstances()[index];return behaviorInstance.GetSdkInstance()}GetBehaviorType(objectClass){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();const name=dataItem.GetSourceAdapterArguments()[NAME];return objectClass.GetBehaviorTypeByName(name)}UpdateBehaviorTypeSid(sid){const dataItem=this._propertyTrack.GetPropertyTrackDataItem();if(dataItem.GetSourceAdapterArguments()[SID]===sid)return;this._sid=sid}Interpolate(time, +start,end,setTime,ensureValue,endState,propertyKeyframeReached){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const instance=track.GetInstance();if(!this.GetBehaviorType(instance.GetObjectClass()))return;return super.GetInterpolatedValue(time, +start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"sid":this._sid})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._sid=o["sid"]}}C3.PropertyTrackState.BehaviorSourceAdapter=BehaviorSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/effectSourceAdapter.js +{ +'use strict';const C3=self.C3;const NAME=0;const INDEX=1; +class EffectSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList); +const effectIndex=effectType.GetIndex();if(instanceEffectList.IsEffectIndexActive(effectIndex))return instanceEffectList.GetEffectParametersForIndex(effectIndex);return null}GetEffectType(effectList){const pTrack=this._propertyTrack;const name=pTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[NAME];return effectList.GetEffectTypeByName(name)}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this._IsEffectActive())return;super.Interpolate(time,start,end, +setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){if(!this._IsEffectActive())return;return super.GetInterpolatedValue(time,start,end)}_IsEffectActive(){const pTrack=this._propertyTrack;const track=pTrack.GetTrack();const worldInfo=track.GetWorldInfo();const instanceEffectList=worldInfo.GetInstanceEffectList();const effectList=instanceEffectList.GetEffectList();const effectType=this.GetEffectType(effectList);if(!effectType)return;const effectIndex=effectType.GetIndex(); +return instanceEffectList.IsEffectIndexActive(effectIndex)}}C3.PropertyTrackState.EffectSourceAdapter=EffectSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/pluginSourceAdapter.js +{ +'use strict';const C3=self.C3;const INDEX=0; +class PluginSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[INDEX]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin= +track.GetInstance().GetObjectClass().GetPlugin();if(templatePlugin!==currentPlugin)return;super.Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}GetInterpolatedValue(time,start,end){const track=this._propertyTrack.GetTrack();const templatePlugin=track.GetObjectClass().GetPlugin();const currentPlugin=track.GetInstance().GetObjectClass().GetPlugin();if(templatePlugin!==currentPlugin)return;return super.GetInterpolatedValue(time,start,end)}GetOptionalCallbacks(){const track= +this._propertyTrack.GetTrack();const plugin=track.GetObjectClass().GetPlugin();if(C3.Plugins.Sprite&&plugin instanceof C3.Plugins.Sprite)if(this._propertyTrack.GetPropertyName()==="initial-frame"||this._propertyTrack.GetPropertyName()==="initial-animation")switch(this._propertyTrack.GetResultMode()){case "relative":{return null}case "absolute":{return null}}}}C3.PropertyTrackState.PluginSourceAdapter=PluginSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/valueSourceAdapter.js +{ +'use strict';const C3=self.C3; +class ValueSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._value=0;this._init=false}MayNeedBeforeAndAfterInterpolate(){return false}SetInitialState(){const propertyTrackData=this._propertyTrack.GetPropertyTrackData();let propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();propertyTrackDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem);this._value=propertyTrackDataItem.GetValueWithResultMode()}SetResumeState(){}GetValue(){if(!this._init)this._propertyTrack.Interpolate(0);return this._value}Interpolate(time, +start,end,setTime,ensureValue,endState,propertyKeyframeReached){this._value=C3.PropertyTrackState.NumericTypeAdapter.Interpolate(time,start,end,this._propertyTrack);this._init=true}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return false}CompareSaveStateWithCurrent(){return false}_SaveToJson(){return{"value":this._value,"init":this._init}}_LoadFromJson(o){if(!o)return;this._value=o["value"];this._init=o.hasOwnProperty("init")?o["init"]:true}} +C3.PropertyTrackState.ValueSourceAdapter=ValueSourceAdapter; + +} + +// timelines/state/propertySourceAdapters/audioSourceAdapter.js +{ +'use strict';const C3=self.C3;const PROJECT_FILE=0;const PROJECT_FILE_NAME=0;const PROJECT_FILE_TYPE=1;const START_OFFSET=1;const AUDIO_DURATION=2;const AUDIO_TAG=3; +class AudioSourceAdapter extends C3.PropertyTrackState.PropertySourceAdapter{constructor(propertyTrack){super(propertyTrack);this._audioPlaybackStarted=false;this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[PROJECT_FILE];this._startOffsetTime=this._sourceAdapterArgs[START_OFFSET];if(this._sourceAdapterArgs[AUDIO_TAG])this._audioTag= +this._sourceAdapterArgs[AUDIO_TAG];else this._audioTag=Math.random().toString(36).slice(2);this._pauseTime=NaN;this._pauseVolume=NaN;this._volume=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._sdkInstance=null;this._actions=null;this._expressions=null;this._timeline=null;this._track=null;this._sourceAdapterArgs=null;this._fileArgs=null;this._audioSource=null}_Initialize(){if(!self.C3.Plugins.Audio)return;const runtime=this._propertyTrack.GetRuntime();const audioObjectClass= +runtime.GetObjectClassByName("audio");if(audioObjectClass)this._sdkInstance=audioObjectClass.GetSingleGlobalInstance().GetSdkInstance();this._actions=self.C3.Plugins.Audio.Acts;this._expressions=self.C3.Plugins.Audio.Exps}_MaybeSetAudioSource(){if(this._audioSource)return;const track=this._propertyTrack.GetTrack();const audioSourcePropertyTrack=track.GetPropertyTrack("audioSource");if(audioSourcePropertyTrack)this._audioSource=audioSourcePropertyTrack.GetSourceAdapter()}_GetPauseVolume(){const track= +this._propertyTrack.GetTrack();const volumePropertyTrack=track.GetPropertyTrack("volume");if(volumePropertyTrack)return volumePropertyTrack.GetSourceAdapter()._pauseVolume;else return this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=false;if(this._sdkInstance){if(this._expressions){this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,this._audioTag);this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)}if(this._actions)this._actions.Stop.call(this._sdkInstance, +this._audioTag)}}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(v){this._volume=v}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=false}SetResumeState(){super.SetResumeState();const timeline=this._propertyTrack.GetTimeline();const time=timeline.GetTime();this._pauseTime=time-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{break}case "volume":{this._pauseVolume=this._propertyTrack.GetInterpolatedValue(time); +break}}this._audioPlaybackStarted=false}Interpolate(time,start,end,setTime,ensureValue,endState,propertyKeyframeReached){if(!this._sdkInstance)return;switch(this._propertyTrack.GetPropertyName()){case "audioSource":{if(!this._timeline.IsForwardPlayBack())return;if(setTime){if(this._actions)this._actions.Stop.call(this._sdkInstance,this._audioTag);return}if(time{const propertyTrackDataItem= +this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem)});return propertyKeyframeDataItem.GetAbsoluteValue()}_CurrentKeyframeGetter(){const timeline= +this._propertyTrack.GetTimeline();const time=timeline.GetTime()-this._propertyTrack.GetTrack().GetStartOffset();const propertyKeyframe=this._PickTimelinePlaybackMode(()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=this._propertyTrack.GetPropertyTrackData();return propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem)},()=>{const propertyTrackDataItem=this._propertyTrack.GetPropertyTrackDataItem();const propertyTrackData= +this._propertyTrack.GetPropertyTrackData();const ret=propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem);if(!ret)return propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return ret});return propertyKeyframe.GetAbsoluteValue()}_PickTimelinePlaybackMode(forwardFunc,backwardFunc){const timeline=this._propertyTrack.GetTimeline();return timeline.IsForwardPlayBack()?forwardFunc():backwardFunc()}_PickResultMode(relativeFunc,absoluteFunc){const resultMode= +this._propertyTrack.GetResultMode();return resultMode==="relative"?relativeFunc():absoluteFunc()}_PickFirstAbsoluteUpdate(firstFunc,otherFunc){if(this.GetFirstAbsoluteUpdate()){this.SetFirstAbsoluteUpdate(false);return firstFunc()}else return otherFunc()}_GetAbsoluteInitialValue(keyframeValue){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){if(this._target)return this._target;this._target=this._sourceAdapter.GetTarget();return this._target}_PickSource(bFunc,eFunc,ivFunc,pFunc,wiFunc, +aFunc){const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":return bFunc();case "effect":return eFunc();case "instance-variable":return ivFunc();case "plugin":return pFunc();case "world-instance":return wiFunc();case "audio":return aFunc()}}_SaveToJson(){return{"firstAbsoluteUpdate":this._firstAbsoluteUpdate,"saveState":this._saveState}}_LoadFromJson(o){if(!o)return;this._firstAbsoluteUpdate=o["firstAbsoluteUpdate"];this._saveState=o["saveState"]}_GetPropertyKeyframeStubs(propertyTracks, +firstOnly=false){const ret=[];for(const propertyTrack of propertyTracks){const startOffset=propertyTrack.GetTrack().GetStartOffset();for(const propertyKeyframeDataItem of propertyTrack.GetPropertyKeyframeDataItems())if(firstOnly&&propertyKeyframeDataItem.GetTime()===0)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()});else if(!firstOnly)ret.push({time:startOffset+propertyKeyframeDataItem.GetTime(),value:propertyKeyframeDataItem.GetAbsoluteValue()})}return ret.sort((f, +s)=>f.time-s.time)}_GetLastPropertyKeyframeStub(timeline,time,propertyKeyframeStubs){return this._GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs)}_GetPropertyKeyframeStubLowerThanPlayhead(time,propertyKeyframeStubs){for(let i=propertyKeyframeStubs.length-1;i>=0;i--){const stubTime=propertyKeyframeStubs[i].time;if(stubTime<=time)return propertyKeyframeStubs[i]}return null}}; + +} + +// timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const TMP_COLORS_MAP=new Map;const TMP_COLOR=[0,0,0]; +class ColorInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._ToColorArray(target.GetPropertyValueByIndex(index));case "effect":return this._ToColorArray(target[index]);case "plugin":return this._ToColorArray(target.GetPropertyValueByIndex(index)); +case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const firstKeyframeColor=this._FirstKeyframeGetter();return!this._CompareColors(firstKeyframeColor,this._Getter())}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return!this._CompareColors(this._saveState,this._Getter())}_CompareColors(fColor,sColor){fColor=this._GetColorFromArray(fColor);sColor=this._GetColorFromArray(sColor);return fColor.equalsIgnoringAlpha(sColor)}_FirstKeyframeGetter(){const color= +super._FirstKeyframeGetter();return this._GetColorFromArray(color)}_CurrentKeyframeGetter(){const color=super._CurrentKeyframeGetter();return this._GetColorFromArray(color)}_GetAbsoluteInitialValue(value){}_ToColorArray(color){if(C3.IsInstanceOf(color,C3.Color))return color.toArray().slice(0,3);return color.slice(0,3)}_GetColorFromArray(color){if(C3.IsInstanceOf(color,C3.Color))return color;return new C3.Color(color[0],color[1],color[2],1)}CanChange(value){return true}MayNeedBeforeAndAfterInterpolate(){return true}BeforeChangeProperty(){const timeline= +this._propertyTrack.GetTimeline();const instance=this._propertyTrack.GetInstance();const sourceAdapter=this._propertyTrack.GetSourceAdapter();const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,this._property,this._propertyTrack);if(propertyTracks&&propertyTracks.length>1){if(!TMP_COLORS_MAP.has(instance))TMP_COLORS_MAP.set(instance,new Map);const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))instanceMap.set(id, +new Map);const sourceMap=instanceMap.get(id);if(!sourceMap.has(this._property))sourceMap.set(this._property,{used:false,color:new C3.Color(0,0,0,1)})}}_GetTmpColor(instance,sourceId,propertyName){const tmpColorObj=TMP_COLORS_MAP.get(instance).get(sourceId).get(propertyName);tmpColorObj.used=true;return tmpColorObj.color}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const timeline=this._propertyTrack.GetTimeline();const track=this._propertyTrack.GetTrack(); +const instance=this._propertyTrack.GetInstance();const sourceAdapter=this._propertyTrack.GetSourceAdapter();const sourceAdapterId=this._propertyTrack.GetSourceAdapterId();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,this._propertyTrack);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs=this._GetPropertyKeyframeStubs(propertyTracks,true);const stub=this._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(), +propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time-startOffset;if(t===0)this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(value[0],value[1],value[2]);else{if(t<0)return;const r=value[0];const g=value[1];const b=value[2];const v=this._propertyTrack.Interpolate(t,false,true);const dr=C3.Color.DiffChannel(r,v[0]);const dg=C3.Color.DiffChannel(g,v[1]);const db=C3.Color.DiffChannel(b,v[2]);this._GetTmpColor(instance,sourceAdapterId,this._property).addRgb(dr, +dg,db)}}}else this._Setter(value[0],value[1],value[2])}AfterChangeProperty(){const instance=this._propertyTrack.GetInstance();if(!TMP_COLORS_MAP.has(instance))return;const instanceMap=TMP_COLORS_MAP.get(instance);const id=this._propertyTrack.GetSourceAdapterId();if(!instanceMap.has(id))return;const sourceMap=instanceMap.get(id);if(!sourceMap.has(this._property))return;const tmpColorObj=sourceMap.get(this._property);const used=tmpColorObj.used;const color=tmpColorObj.color;if(used)this._Setter(color.getR(), +color.getG(),color.getB());if(sourceMap.size===0)instanceMap.delete(id);if(instanceMap.size===0)TMP_COLORS_MAP.delete(instance)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "effect":return target[index].clone();case "plugin":return this._GetColorFromArray(target.GetPropertyValueByIndex(index));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(r, +g,b){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "effect":target[index].setRgb(r,g,b);break;case "plugin":TMP_COLOR[0]=r;TMP_COLOR[1]=g;TMP_COLOR[2]=b;target.SetPropertyValueByIndex(index,TMP_COLOR);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(r,g,b);break}}_SaveToJson(){}_LoadFromJson(o){}} +C3.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=ColorInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState; +class NoInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return false}ChangeProperty(time, +value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const propertyTrack=this._propertyTrack;const track=propertyTrack.GetTrack();const id=propertyTrack.GetSourceAdapterId();const timeline=propertyTrack.GetTimeline();const instance=track.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const property=this._property;const propertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,propertyTrack);if(propertyTracks&&propertyTracks.length>1){const propertyKeyframeStubs= +this._GetPropertyKeyframeStubs(propertyTracks);const t=time+track.GetStartOffset();const stub=this._GetLastPropertyKeyframeStub(timeline,t,propertyKeyframeStubs);if(stub)value=stub.value}const type=propertyTrack.GetPropertyKeyframeType();switch(type){case "numeric":{if(!NS.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "angle":{if(!NS.AngleTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "boolean":{if(!NS.BooleanTypeAdapter.WillChange(this._GetIndex(), +this._GetTarget(),value,id))return;break}case "color":{if(!NS.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}case "text":{if(!NS.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),value,id))return;break}}this._Setter(value)}_Getter(){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index]; +case "instance-variable":return target.GetInstanceVariableValue(index);case "plugin":return target.GetPropertyValueByIndex(index)}}_Setter(value){const id=this._propertyTrack.GetSourceAdapterId();const target=this._GetTarget();const index=this._GetIndex();switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value); +break}}}C3.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=NoInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js +{ +'use strict';const C3=self.C3;const NS=C3.PropertyTrackState.PropertyInterpolationAdapter;const INSTANCE_FUNC_MAP=new Map;const add=(prop,setter,absolute_setter,getter,round,fRound=false,init=null,reset=null)=>{INSTANCE_FUNC_MAP.set(prop,{setter,absolute_setter,getter,round,fRound,init,reset})};add("offsetX",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetX(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetX(v)},(wi,v)=>wi.SetX(v),wi=>wi.GetX(),true); +add("offsetY",(wi,v,t,a)=>{if(a._propertyTrack.GetResultMode()==="relative")wi.OffsetY(v,t.GetTimeline().GetTransformWithSceneGraph());else wi.OffsetY(v)},(wi,v)=>wi.SetY(v),wi=>wi.GetY(),true); +add("offsetWidth",(wi,v,t,a,noChanges)=>{if(v===0)return;const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentWidth()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size= +(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalWidth();const sdki=wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalWidth();return wi._GetSceneGraphInfo()._GetStartWidth()};const get_last_property_keyframe_value=(wi,t,propertyName)=>{const track=get_track(wi,t);if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData(); +if(!parentPropertyKeyframeData)return 0;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=p._GetSceneGraphInfo()._GetStartWidth();const ownStartScale=p._GetSceneGraphInfo().GetStartScaleX();let absoluteToFactor=ownStartSize*ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetWidth");absoluteToFactor+= +get_original_size(p,t)*get_last_property_keyframe_value(p,t,"offsetScaleX");for(let i=1;iwi.SetWidth(v),wi=>wi.GetWidth(),true); +add("offsetHeight",(wi,v,t,a,noChanges)=>{if(v===0)return;const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentHeight()){if(isNaN(a._absoluteToFactor)){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_track=(wi,t)=>{return t.GetTimeline().GetTrackFromInstance(wi.GetInstance())};const get_original_size= +(wi,t)=>{const track=get_track(wi,t);if(track)return track.GetOriginalHeight();const sdki=wi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())return sdki.GetOriginalHeight();return wi._GetSceneGraphInfo()._GetStartHeight()};const get_last_property_keyframe_value=(wi,t,propertyName)=>{const track=t.GetTimeline().GetTrackFromInstance(wi.GetInstance());if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData(); +if(!parentPropertyKeyframeData)return 0;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()};let p=parents[0];const ownStartSize=p._GetSceneGraphInfo()._GetStartHeight();const ownStartScale=p._GetSceneGraphInfo().GetStartScaleY();let absoluteToFactor=ownStartSize*ownStartScale;absoluteToFactor+=get_last_property_keyframe_value(p,t,"offsetHeight");absoluteToFactor+= +get_original_size(p,t)*get_last_property_keyframe_value(p,t,"offsetScaleY");for(let i=1;i +wi.SetHeight(v),wi=>wi.GetHeight(),true);add("offsetAngle",(wi,v)=>wi.OffsetAngle(v),(wi,v)=>wi.SetAngle(v),wi=>wi.GetAngle(),false,true); +add("offsetOpacity",(wi,v,t,a,noChanges)=>{const opacityFactor=a._opacityFactor?a._opacityFactor:1;v/=opacityFactor;const o=wi.GetOpacity();const nv=o+v;const min=0;const max=1;if(a._clampAccumulator===0){if(nv>max)a._clampAccumulator+=nv-max;else if(nv0&&a._clampAccumulator>0){if(nv>max)a._clampAccumulator+=nv-max}else if(v>0&&a._clampAccumulator<0){a._clampAccumulator+=v;if(a._clampAccumulator>0)a._clampAccumulator= +0}else if(v<0&&a._clampAccumulator>0){a._clampAccumulator+=v;if(a._clampAccumulator<0)a._clampAccumulator=0}else if(v<0&&a._clampAccumulator<0)if(nv{wi.SetOpacity(v)},wi=>{return wi.GetOpacity()},false,true,(a,wi,t)=>{a._clampAccumulator=0;switch(a._propertyTrack.GetResultMode()){case "relative":{const propertyTrackData=a._propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=a._propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData(); +const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();let startingAbsoluteOpacity=a.GetWorldInfo().GetOpacity();let currentAbsoluteOpacity=startingAbsoluteOpacity;for(const propertyKeyframeDataItem of propertyKeyframeDataItems){const time=propertyKeyframeDataItem.GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity=startingAbsoluteOpacity+currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity, +0,1)}a._totalForewardOpacityDelta=startingAbsoluteOpacity-currentAbsoluteOpacity;a._totalForewardOpacityDelta=Math.round((a._totalForewardOpacityDelta+Number.EPSILON)*100)/100;currentAbsoluteOpacity=startingAbsoluteOpacity;for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const time=propertyKeyframeDataItems[i].GetTime();const currentRelativeOpacity=a._propertyTrack.GetInterpolatedValue(time);currentAbsoluteOpacity-=currentRelativeOpacity;currentAbsoluteOpacity=C3.clamp(currentAbsoluteOpacity, +0,1)}a._totalBackwardOpacityDelta=currentAbsoluteOpacity;a._totalBackwardOpacityDelta=Math.round((a._totalBackwardOpacityDelta+Number.EPSILON)*100)/100;break}case "absolute":{break}}const isRelative=a._propertyTrack.GetResultMode()==="relative";const isTween=a._typeAdapter.GetType()===1;if((isRelative||isTween)&&wi.HasParent()&&wi.GetTransformWithParentOpacity()){const parents=[];let parent=wi.GetParent();while(parent){parents.push(parent);parent=parent.GetParent()}parents.reverse();const get_last_property_keyframe_value= +(wi,t,propertyName)=>{const track=t.GetTimeline().GetTrackFromInstance(wi.GetInstance());if(!track)return 0;const propertyTrack=track.GetPropertyTrack(propertyName);if(!propertyTrack)return 0;const parentPropertyKeyframeData=propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData();if(!parentPropertyKeyframeData)return 0;const parentLastPropertyKeyframeDataItem=parentPropertyKeyframeData.GetLastPropertyKeyframeDataItem();if(!parentLastPropertyKeyframeDataItem)return 0;return parentLastPropertyKeyframeDataItem.GetValue()}; +let opacityFactor=parents[0]._GetSceneGraphInfo().GetStartOpacity();opacityFactor+=get_last_property_keyframe_value(parents[0],t,"offsetOpacity");for(let i=1;i{switch(a._propertyTrack.GetResultMode()){case "relative":{a._clampAccumulator=0;const wi=a.GetWorldInfo();let currentOpacity=wi.GetOpacity();currentOpacity=Math.round((currentOpacity+Number.EPSILON)* +100)/100;if(a._propertyTrack.GetTimeline().IsForwardPlayBack()){wi.SetOpacity(currentOpacity+a._totalForewardOpacityDelta);a._lastValue=0}else{wi.SetOpacity(currentOpacity-a._totalBackwardOpacityDelta);a._lastValue=a.GetSourceAdapter().GetValueAtTime()}break}case "absolute":{break}}});add("offsetOriginX",(wi,v)=>wi.OffsetOriginX(v),(wi,v)=>wi.SetOriginX(v),wi=>wi.GetOriginX(),false);add("offsetOriginY",(wi,v)=>wi.OffsetOriginY(v),(wi,v)=>wi.SetOriginY(v),wi=>wi.GetOriginY(),false); +add("offsetZElevation",(wi,v)=>wi.OffsetZElevation(v),(wi,v)=>wi.SetZElevation(v),wi=>wi.GetZElevation(),true); +add("offsetScaleX",(wi,v,t,a)=>{if(v===0)return;const mirrorFactor=wi.GetWidth()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentWidth()){const value=t.GetOriginalWidth()*mirrorFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetWidth").setter(wi,1,t,a,true);wi.OffsetWidth(value/a._absoluteToFactor,true)}else wi.OffsetWidth(t.GetOriginalWidth()*mirrorFactor*v)},(wi,v,t)=>{wi.SetWidth(t.GetOriginalWidth()*v)},(wi,t)=>{const mirrorFactor= +wi.GetWidth()<0?-1:1;if(wi.GetTransformWithParentWidth()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetWidth()/parentTrack.GetOriginalWidth();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetWidth()/sdki.GetOriginalWidth();else parentScale=1}return wi.GetWidth()*mirrorFactor/(t.GetOriginalWidth()*parentScale)}else return wi.GetWidth()* +mirrorFactor/t.GetOriginalWidth()},false); +add("offsetScaleY",(wi,v,t,a)=>{if(v===0)return;const flipFactor=wi.GetHeight()<0?-1:1;if(a._propertyTrack.GetResultMode()==="relative"&&wi.HasParent()&&wi.GetTransformWithParentHeight()){const value=t.GetOriginalHeight()*flipFactor*v;if(isNaN(a._absoluteToFactor))INSTANCE_FUNC_MAP.get("offsetHeight").setter(wi,1,t,a,true);wi.OffsetHeight(value/a._absoluteToFactor,true)}else wi.OffsetHeight(t.GetOriginalHeight()*flipFactor*v)},(wi,v,t)=>{wi.SetHeight(t.GetOriginalHeight()*v)},(wi,t)=>{const flipFactor= +wi.GetHeight()<0?-1:1;if(wi.GetTransformWithParentHeight()){const parentWi=wi.GetParent();const parentTrack=t.GetTimeline().GetTrackFromInstance(parentWi.GetInstance());let parentScale=NaN;if(parentTrack)parentScale=parentWi.GetHeight()/parentTrack.GetOriginalHeight();else{const sdki=parentWi.GetInstance().GetSdkInstance();if(sdki.IsOriginalSizeKnown())parentScale=parentWi.GetHeight()/sdki.GetOriginalHeight();else parentScale=1}return wi.GetHeight()*flipFactor/(t.GetOriginalHeight()*parentScale)}else return wi.GetHeight()* +flipFactor/t.GetOriginalHeight()},false); +class NumericInterpolationAdapter extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(sourceAdapter){super(sourceAdapter);this._lastValue=0;this._clampAccumulator=0;this._totalForewardOpacityDelta=0;this._totalBackwardOpacityDelta=0;this._opacityFactor=NaN;this._absoluteToFactor=NaN;this._instance_getter=null;this._instance_setter=null;this._instance_absolute_setter=null;this._reset_action=null;this._init_action=null;this._source_adapter_getter=null;this._source_adapter_setter= +null;this._source_adapter_absolute_setter=null;this._round=false;this._fRound=false;if(C3.IsInstanceOf(this._propertyTrack.GetTimeline(),C3.TweenState))this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this);else this._typeAdapter=new C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const property=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":{const p= +INSTANCE_FUNC_MAP.get(property);this._instance_getter=p.getter;this._instance_setter=p.setter;this._instance_absolute_setter=p.absolute_setter;this._round=p.round;this._fRound=p.fRound;this._init_action=p.init;this._reset_action=p.reset;break}case "audio":{this._source_adapter_getter=sourceAdapter.Getter;this._source_adapter_setter=sourceAdapter.Setter;this._source_adapter_absolute_setter=sourceAdapter.AbsoluteSetter;this._round=!!sourceAdapter.DoesRounding();this._fRound=false;break}}}Release(){this._typeAdapter= +null;this._instance_getter=null;this._instance_setter=null;this._instance_absolute_setter=null;this._absoluteToFactor=NaN;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(v){this._lastValue=v}SetResetState(){if(this._reset_action)this._reset_action(this)}SetInitialState(){const initValue=this._typeAdapter.SetInitialState();if(typeof initValue==="number")this._lastValue=initValue;if(this._init_action){const wi= +this.GetWorldInfo();const track=this._propertyTrack.GetTrack();this._init_action(this,wi,track)}}SetResumeState(){const resumeValue=this._typeAdapter.SetResumeState();if(typeof resumeValue==="number")this._lastValue=resumeValue}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const firstKeyframeValue=this._FirstKeyframeGetter();return firstKeyframeValue!==this.GetCurrentState()}CompareSaveStateWithCurrent(){if(C3.IsNullOrUndefined(this._saveState))return false;return this._saveState!== +this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){return this._typeAdapter.ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id= +this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":return target.GetPropertyValueByIndex(index);case "effect":return target[index];case "instance-variable":return target.GetInstanceVariableValue(index);case "plugin":return target.GetPropertyValueByIndex(index);case "world-instance":return this._instance_getter(wi,track);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),wi,track)}}_Setter(value,start,end){const target=this._GetTarget();const index=this._GetIndex(); +const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":target.OffsetPropertyValueByIndex(index,value);break;case "effect":target[index]+=value;break;case "instance-variable":target.SetInstanceVariableOffset(index,value);break;case "plugin":target.OffsetPropertyValueByIndex(index,value,this.GetSourceAdapter().GetOptionalCallbacks());break;case "world-instance":this._instance_setter(wi,value,track,this);break; +case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),wi,value,track,this);break}}_SetterAbsolute(value,propertyKeyframeReached,endState){let mode=this._propertyTrack.GetInterpolationMode();mode=mode==="default"?"continuous":mode;if(mode==="discrete"&&!propertyKeyframeReached)return;if(mode==="discrete"&&endState){const timeline=this._propertyTrack.GetTimeline();const time=timeline.GetTime();const propertyKeyframeDataItem=this._propertyTrack.GetPropertyKeyFrameDataItemAtTime(time); +if(!propertyKeyframeDataItem)return}const target=this._GetTarget();const index=this._GetIndex();const wi=this.GetWorldInfo();const track=this._propertyTrack.GetTrack();const id=this._propertyTrack.GetSourceAdapterId();switch(id){case "behavior":target.SetPropertyValueByIndex(index,value);break;case "effect":target[index]=value;break;case "instance-variable":target.SetInstanceVariableValue(index,value);break;case "plugin":target.SetPropertyValueByIndex(index,value,this.GetSourceAdapter().GetOptionalCallbacks()); +break;case "world-instance":this._instance_absolute_setter(wi,value,track);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),wi,value,track);break}}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState){this._typeAdapter._MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState)}_AddDelta(value,start,end,forceEndValue,endState){switch(this._propertyTrack.GetPropertyType()){case "angle":{value=C3.toDegrees(value); +break}default:{value=value;break}}const stringValue=value.toString();const decimalsString=stringValue.split(".")[1]||"";const decimalPlaces=decimalsString.length;const v=this._Getter();let rv;if(decimalPlaces===0)if(this._round)rv=Math.round(v);else if(this._fRound)switch(this._propertyTrack.GetPropertyType()){case "angle":{rv=C3.toRadians(Math.round(C3.toDegrees(v)));break}default:{rv=Math.round((v+Number.EPSILON)*100)/100;break}}else rv=v;else if(this._round)rv=Number(C3.toFixed(v,decimalPlaces)); +else if(this._fRound)rv=v;else rv=v;this._Setter(rv-v,start,end)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"v":this._lastValue,"a":this._clampAccumulator,"fod":this._totalForewardOpacityDelta,"bod":this._totalBackwardOpacityDelta})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._lastValue=o["v"];this._clampAccumulator=o["a"];this._totalForewardOpacityDelta=C3.IsFiniteNumber(o["fod"])?o["fod"]:0;this._totalBackwardOpacityDelta=C3.IsFiniteNumber(o["bod"])?o["bod"]:0}} +C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=NumericInterpolationAdapter; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTimeline.js +{ +'use strict';const C3=self.C3; +class AbsoluteValueObject{constructor(propertyTracks){this._used=false;this._value=0;this._propertyKeyframeReached=false;this._endState=false;this._propertyTracks=propertyTracks;for(let i=0,l=this._propertyTracks.length;i{return adapter._PickTimelinePlaybackMode(()=>0,()=>adapter.GetSourceAdapter().GetValueAtTime())},()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){const adapter= +this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{return false}case "absolute":{return true}}}BeforeChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();const property=propertyTrack.GetPropertyName();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const valueObj= +propertyTrack.GetAbsoluteValueObject();valueObj.Reset()}else{const timeline=propertyTrack.GetTimeline();const instance=propertyTrack.GetInstance();const sourceAdapter=propertyTrack.GetSourceAdapter();const similarPropertyTracks=timeline.GetSimilarPropertyTracks(instance,sourceAdapter,property,propertyTrack);if(similarPropertyTracks&&similarPropertyTracks.length>1)new AbsoluteValueObject(similarPropertyTracks)}break}}}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const adapter= +this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{const lastValue=adapter.GetLastValue();adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value);adapter.SetLastValue(value);break}case "absolute":{const timeline=propertyTrack.GetTimeline();const track=propertyTrack.GetTrack();const instance=propertyTrack.GetInstance();const sourceAdapter= +propertyTrack.GetSourceAdapter();if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject=propertyTrack.GetAbsoluteValueObject();const similarpropertyTracks=absoluteValueObject.GetPropertyTracks();const propertyKeyframeStubs=adapter._GetPropertyKeyframeStubs(similarpropertyTracks,true);const stub=adapter._GetLastPropertyKeyframeStub(timeline,timeline.GetTime(),propertyKeyframeStubs);if(stub){const startOffset=track.GetStartOffset();const t=stub.time-startOffset;if(t===0){absoluteValueObject.SetEndState(endState); +absoluteValueObject.SetPropertyKeyframeReached(propertyKeyframeReached);absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+value)}else{if(t<0)return;const v=propertyTrack.GetInterpolatedValue(t);absoluteValueObject.SetEndState(endState);absoluteValueObject.SetPropertyKeyframeReached(propertyKeyframeReached);absoluteValueObject.SetUsed();absoluteValueObject.SetValue(absoluteValueObject.GetValue()+(value-v))}}}else adapter._SetterAbsolute(value,propertyKeyframeReached, +endState);break}}}AfterChangeProperty(){const adapter=this._numericInterpolationAdapter;const propertyTrack=this._numericInterpolationAdapter.GetPropertyTrack();switch(propertyTrack.GetResultMode()){case "relative":{break}case "absolute":{if(propertyTrack.HasAbsoluteValueObject()){const absoluteValueObject=propertyTrack.GetAbsoluteValueObject();if(absoluteValueObject.GetUsed())adapter._SetterAbsolute(absoluteValueObject.GetValue(),absoluteValueObject.GetPropertyKeyframeReached(),absoluteValueObject.GetEndState())}break}}}_MaybeEnsureValue(time, +start,end,setTime,lastValue,currentValue){const adapter=this._numericInterpolationAdapter;if(setTime)return;if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(),start,end)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=NumericInterpolationAdapterForTimeline; + +} + +// timelines/state/propertyInterpolationAdapters/numericInterpolationAdapterForTween.js +{ +'use strict';const C3=self.C3; +class NumericInterpolationAdapterForTween{constructor(numericInterpolationAdapter){this._numericInterpolationAdapter=numericInterpolationAdapter}Release(){this._numericInterpolationAdapter=null}GetType(){return 1}SetInitialState(){const adapter=this._numericInterpolationAdapter;adapter.SetFirstAbsoluteUpdate(true);return this._GetAbsoluteInitialValue(adapter._FirstKeyframeGetter())}SetResumeState(){const adapter=this._numericInterpolationAdapter;if(adapter._FirstKeyframeGetter()===adapter._CurrentKeyframeGetter())return; +adapter.SetFirstAbsoluteUpdate(true);return this._GetAbsoluteInitialValue(adapter._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return false}BeforeChangeProperty(){}ChangeProperty(time,value,start,end,setTime,ensureValue,endState,propertyKeyframeReached){const adapter=this._numericInterpolationAdapter;const lastValue=adapter.GetLastValue();switch(adapter.GetPropertyTrack().GetResultMode()){case "relative":{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time, +start,end,setTime,lastValue,value,false,endState);break}case "absolute":{if(adapter.GetFirstAbsoluteUpdate()){adapter.SetFirstAbsoluteUpdate(false);adapter._Setter(lastValue,start,end)}else if(time===0&&adapter.GetPropertyTrack().GetTimeline().GetTotalTime()===0)adapter._SetterAbsolute(value,true,false);else{adapter._Setter(value-lastValue,start,end);if(ensureValue)this._MaybeEnsureValue(time,start,end,setTime,lastValue,value,this._ForceEndValue(),endState)}break}}adapter.SetLastValue(value)}AfterChangeProperty(){}_GetAbsoluteInitialValue(keyframeValue){const adapter= +this._numericInterpolationAdapter;return keyframeValue-adapter.GetCurrentState()}_ForceEndValue(){const adapter=this._numericInterpolationAdapter;const inst=adapter.GetWorldInfo().GetInstance();const runtime=adapter.GetPropertyTrack().GetRuntime();const timelineManager=runtime.GetTimelineManager();let activeTimelineCount=0;for(const timeline of timelineManager.GetPlayingTimelines())if(timeline.GetType()===0){if(timeline.HasTrackInstance(inst))activeTimelineCount++}else if(timeline.GetType()===1)if(timeline.GetInstance()=== +inst)activeTimelineCount++;return activeTimelineCount<=1}_MaybeEnsureValue(time,start,end,setTime,lastValue,currentValue,forceEndValue,endState){const adapter=this._numericInterpolationAdapter;if(setTime)if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end,forceEndValue,endState);else{if(!end)adapter._AddDelta(start.GetValueWithResultMode(),start, +end,forceEndValue,endState)}else if(start&&time===start.GetTime())adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(end&&time===end.GetTime())adapter._AddDelta(end.GetValueWithResultMode(),start,end,forceEndValue,endState);else if(currentValue-lastValue===0)adapter._AddDelta(start.GetValueWithResultMode(),start,end,forceEndValue,endState)}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=NumericInterpolationAdapterForTween; + +} + +// timelines/state/propertyTypeAdapters/numericTypeAdapter.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease; +C3.PropertyTrackState.NumericTypeAdapter=class NumericTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){if(mode=== +"step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const startAddon=start.GetAddOn("cubic-bezier");const endAddon=end.GetAddOn("cubic-bezier");const doCubicBezier=startAddon&&startAddon.GetStartEnable()&&endAddon&&endAddon.GetEndEnable();if(!doCubicBezier&&sv===ev)return sv;const st=start.GetTime();const et=end.GetTime();const n=C3.normalize(time,st,et);const e= +start.GetEase();let ret;if(doCubicBezier){const dt=et-st;ret=Ease.GetRuntimeEase(e)(dt*n,0,1,dt);ret=Ease.GetRuntimeEase("cubicbezier")(ret,sv,sv+startAddon.GetStartAnchor(),ev+endAddon.GetEndAnchor(),ev)}else ret=Ease.GetRuntimeEase(e)((et-st)*n,sv,ev-sv,et-st);if(propertyTrack.GetPropertyType()==="integer")return Math.floor(ret);return ret}}}; + +} + +// timelines/state/propertyTypeAdapters/angleTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.AngleTypeAdapter=class AngleTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(propertyTrack.GetPropertyType()==="combo")mode="discrete";if(mode==="discrete")return start.GetValueWithResultMode();else if(mode==="continuous"||mode==="step"){if(mode=== +"step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const angleAddon=start.GetAddOn("angle");if(angleAddon){const revolutions=angleAddon.GetRevolutions();if(sv===ev&&revolutions===0)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase());const easeRes=easeFunc(n,0,1,1);switch(angleAddon.GetDirection()){case "closest":return C3.angleLerp(sv, +ev,easeRes,revolutions);case "clockwise":return C3.angleLerpClockwise(sv,ev,easeRes,revolutions);case "anti-clockwise":return C3.angleLerpAntiClockwise(sv,ev,easeRes,revolutions)}}else{if(sv===ev)return sv;const n=C3.normalize(time,st,et);const easeFunc=self.Ease.GetRuntimeEase(start.GetEase());return C3.angleLerp(sv,ev,easeFunc(n,0,1,1))}}}}; + +} + +// timelines/state/propertyTypeAdapters/booleanTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.BooleanTypeAdapter=class BooleanTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(!!oldValue===!!newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()?1:0}return start.GetValueWithResultMode()?1:0}}; + +} + +// timelines/state/propertyTypeAdapters/colorTypeAdapter.js +{ +'use strict';const C3=self.C3;const TEMP_COLOR_ARRAY=[0,0,0];const TEMP_COLOR_ARRAY_2=[0,0,0];const TEMP_COLOR_ARRAY_3=[0,0,0]; +C3.PropertyTrackState.ColorTypeAdapter=class ColorTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(Array.isArray(newValue)){TEMP_COLOR_ARRAY[0]=newValue[0];TEMP_COLOR_ARRAY[1]=newValue[1];TEMP_COLOR_ARRAY[2]= +newValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(newValue);TEMP_COLOR_ARRAY[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()*255);TEMP_COLOR_ARRAY[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(Array.isArray(oldValue)){TEMP_COLOR_ARRAY_2[0]=oldValue[0];TEMP_COLOR_ARRAY_2[1]=oldValue[1];TEMP_COLOR_ARRAY_2[2]=oldValue[2]}else{TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(oldValue);TEMP_COLOR_ARRAY_2[0]=Math.floor(TEMP_COLOR_ARRAY_3.getR()* +255);TEMP_COLOR_ARRAY_2[1]=Math.floor(TEMP_COLOR_ARRAY_3.getG()*255);TEMP_COLOR_ARRAY_2[2]=Math.floor(TEMP_COLOR_ARRAY_3.getB()*255)}if(TEMP_COLOR_ARRAY[0]!==TEMP_COLOR_ARRAY_2[0])return true;if(TEMP_COLOR_ARRAY[1]!==TEMP_COLOR_ARRAY_2[1])return true;if(TEMP_COLOR_ARRAY[2]!==TEMP_COLOR_ARRAY_2[2])return true;return false}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData(); +propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);const color=propertyTrackDataItem.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2];return TEMP_COLOR_ARRAY}let mode=propertyTrack.GetInterpolationMode();if(mode==="default")mode="continuous";if(mode==="discrete"){const color=start.GetValueWithResultMode();TEMP_COLOR_ARRAY[0]=color[0];TEMP_COLOR_ARRAY[1]=color[1];TEMP_COLOR_ARRAY[2]=color[2]; +return TEMP_COLOR_ARRAY}else if(mode==="continuous"||mode==="step"){if(mode==="step"){const step=propertyTrack.GetTimeline().GetStep();if(step!==0){const s=1/step;time=Math.floor(time*s)/s}}const st=start.GetTime();const et=end.GetTime();const sv=start.GetValueWithResultMode();const ev=end.GetValueWithResultMode();const n=C3.normalize(time,st,et);const e=start.GetEase();const sr=sv[0];const sg=sv[1];const sb=sv[2];const er=ev[0];const eg=ev[1];const eb=ev[2];const easeFunc=self.Ease.GetRuntimeEase(e); +const d=et-st;const dn=d*n;if(sr===er)TEMP_COLOR_ARRAY[0]=sr;else TEMP_COLOR_ARRAY[0]=easeFunc(dn,sr,er-sr,d);if(sg===eg)TEMP_COLOR_ARRAY[1]=sg;else TEMP_COLOR_ARRAY[1]=easeFunc(dn,sg,eg-sg,d);if(sb===eb)TEMP_COLOR_ARRAY[2]=sb;else TEMP_COLOR_ARRAY[2]=easeFunc(dn,sb,eb-sb,d);return TEMP_COLOR_ARRAY}}}; + +} + +// timelines/state/propertyTypeAdapters/textTypeAdapter.js +{ +'use strict';const C3=self.C3; +C3.PropertyTrackState.TextTypeAdapter=class TextTypeAdapter{constructor(){}static WillChange(index,source,newValue,type){let oldValue;switch(type){case "behavior":oldValue=source.GetPropertyValueByIndex(index);break;case "effect":oldValue=source[index];break;case "instance-variable":oldValue=source.GetInstanceVariableValue(index);break;case "plugin":oldValue=source.GetPropertyValueByIndex(index);break}if(oldValue===newValue)return false;return true}static Interpolate(time,start,end,propertyTrack){if(!end){let propertyTrackDataItem= +propertyTrack.GetPropertyTrackDataItem();const propertyTrackData=propertyTrack.GetPropertyTrackData();propertyTrackDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);return propertyTrackDataItem.GetValueWithResultMode()}return start.GetValueWithResultMode()}}; + +} + +// timelines/data/timelineDataManager.js +{ +'use strict';const C3=self.C3; +C3.TimelineDataManager=class TimelineDataManager{constructor(){this._timelineDataItems=new Map}Release(){for(const timelineDataItem of this._timelineDataItems.values())timelineDataItem.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(data){const timelineDataItem=new C3.TimelineDataItem(data);const name=timelineDataItem.GetName();this._timelineDataItems.set(name,timelineDataItem)}Get(name){return this._timelineDataItems.get(name)}GetNameId(){return 0}static _CreateDataItems(items,jsonItems, +dataItemConstructor,dataContainer){if(!jsonItems)return;for(const jsonItem of jsonItems)C3.TimelineDataManager._CreateDataItem("create",jsonItem,items,dataItemConstructor,dataContainer)}static _CreateDataItemsIncludingDisabled(items,jsonItems,dataItemConstructor,dataContainer){if(!jsonItems)return;for(const jsonItem of jsonItems)C3.TimelineDataManager._CreateDataItem("create-including-disabled",jsonItem,items,dataItemConstructor,dataContainer)}static _LoadDataItemsFromJson(items,jsonItems,dataItemConstructor, +dataContainer){if(items.length)jsonItems.forEach((jsonItem,index)=>{items[index]._LoadFromJson(jsonItem)});else jsonItems.forEach(jsonItem=>{C3.TimelineDataManager._CreateDataItem("load",jsonItem,items,dataItemConstructor,dataContainer)})}static _CreateDataItem(mode,json,items,dataItemConstructor,dataContainer){let dataItem;if(typeof dataItemConstructor==="function")switch(mode){case "load":dataItem=new dataItemConstructor(null,dataContainer);break;case "create":dataItem=new dataItemConstructor(json, +dataContainer);break;case "create-including-disabled":dataItem=new dataItemConstructor(json,dataContainer);break}else if(typeof dataItemConstructor==="object"){const prop=dataItemConstructor.prop;const value=json[prop];const cnstrctr=dataItemConstructor.map.get(value);switch(mode){case "load":dataItem=new cnstrctr(null,dataContainer);break;case "create":dataItem=new cnstrctr(json,dataContainer);break;case "create-including-disabled":dataItem=new cnstrctr(json,dataContainer);break}}switch(mode){case "load":dataItem._LoadFromJson(json); +items.push(dataItem);break;case "create":if(typeof dataItem.GetEnable==="function"&&!dataItem.GetEnable())return dataItem.Release();items.push(dataItem);break;case "create-including-disabled":items.push(dataItem);break}}}; + +} + +// timelines/data/timelineData.js +{ +'use strict';const C3=self.C3;const NAME=0;const TOTAL_TIME=1;const STEP=2;const INTERPOLATION_MODE=3;const RESULT_MODE=4;const TRACKS=5;const LOOP=6;const PING_PONG=7;const REPEAT_COUNT=8;const START_ON_LAYOUT=9;const TRANSFORM_WITH_SCENE_GRAPH=10;const USE_SYSTEM_TIMESCALE=11; +C3.TimelineDataItem=class TimelineDataItem{constructor(timelineDataJson){this._name="";this._totalTime=NaN;this._step=0;this._interpolationMode="default";this._resultMode="default";this._loop=false;this._pingPong=false;this._repeatCount=1;this._trackData=null;this._startOnLayout="";this._transformWithSceneGraph=false;this._useSystemTimescale=true;if(!timelineDataJson)return;this._name=timelineDataJson[NAME];this._totalTime=timelineDataJson[TOTAL_TIME];this._step=timelineDataJson[STEP];this._interpolationMode= +timelineDataJson[INTERPOLATION_MODE];this._resultMode=timelineDataJson[RESULT_MODE];this._loop=!!timelineDataJson[LOOP];this._pingPong=!!timelineDataJson[PING_PONG];this._repeatCount=timelineDataJson[REPEAT_COUNT];this._startOnLayout=timelineDataJson[START_ON_LAYOUT];this._transformWithSceneGraph=!!timelineDataJson[TRANSFORM_WITH_SCENE_GRAPH];this._useSystemTimescale=!!timelineDataJson[USE_SYSTEM_TIMESCALE];this._trackData=new C3.TrackData(timelineDataJson[TRACKS],this)}Release(){this._trackData.Release(); +this._trackData=null}GetTrackData(){if(!this._trackData)this._trackData=new C3.TrackData(null,this);return this._trackData}GetName(){return this._name}SetName(n){this._name=n}GetTotalTime(){return this._totalTime}SetTotalTime(tt){this._totalTime=tt}GetStep(){return this._step}SetStep(s){this._step=s}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetLoop(){return this._loop}SetLoop(l){this._loop= +l}GetPingPong(){return this._pingPong}SetPingPong(p){this._pingPong=p}GetRepeatCount(){return this._repeatCount}SetRepeatCount(rc){this._repeatCount=rc}GetStartOnLayout(){return this._startOnLayout}GetTransformWithSceneGraph(){return this._transformWithSceneGraph}GetUseSystemTimescale(){return this._useSystemTimescale}_SaveToJson(){return{"trackDataJson":this._trackData._SaveToJson(),"name":this._name,"totalTime":this._totalTime,"step":this._step,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode, +"loop":this._loop,"pingPong":this._pingPong,"repeatCount":this._repeatCount,"startOnLayout":this._startOnLayout,"transformWithSceneGraph":!!this._transformWithSceneGraph,"useSystemTimescale":this._useSystemTimescale}}_LoadFromJson(o){if(!o)return;this.GetTrackData()._LoadFromJson(o["trackDataJson"]);this._name=o["name"];this._totalTime=o["totalTime"];this._step=o["step"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._loop=o["loop"];this._pingPong=o["pingPong"]; +this._repeatCount=o["repeatCount"];this._startOnLayout=o["startOnLayout"];this._transformWithSceneGraph=!!o["transformWithSceneGraph"];this._useSystemTimescale=!!o["useSystemTimescale"]}}; + +} + +// timelines/data/trackData.js +{ +'use strict';const C3=self.C3;const WI_DATA=0;const OC_INDEX=1;const WI_UID=2;const INTERPOLATION_MODE=1;const RESULT_MODE=2;const ENABLED=3;const KEYFRAMES=4;const PROPERTY_TRACKS=5;const ID=6;const NESTED_DATA=7;const START_OFFSET=0;const LOCAL_TOTAL_TIME=1;const WI_ADDITIONAL_DATA=8;const ORIGINAL_WIDTH=0;const ORIGINAL_HEIGHT=1;const TRACK_TYPE=9;const TRACK_NAME=10; +class TrackDataItem{constructor(trackDataJson,trackData){this._trackData=trackData;this._instanceData=null;this._additionalInstanceData=null;this._instanceUid=NaN;this._objectClassIndex=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._keyframeData=null;this._propertyTrackData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";if(!trackDataJson)return; +if(trackDataJson[WI_DATA]){this._instanceData=trackDataJson[WI_DATA];this._instanceUid=trackDataJson[WI_DATA][WI_UID];this._objectClassIndex=trackDataJson[WI_DATA][OC_INDEX]}this._interpolationMode=trackDataJson[INTERPOLATION_MODE];this._resultMode=trackDataJson[RESULT_MODE];this._enabled=!!trackDataJson[ENABLED];if(trackDataJson[ID])this._id=trackDataJson[ID];if(trackDataJson[NESTED_DATA]){this._nestedData=trackDataJson[NESTED_DATA];this._startOffset=trackDataJson[NESTED_DATA][START_OFFSET];this._localTotalTime= +trackDataJson[NESTED_DATA][LOCAL_TOTAL_TIME]}if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[WI_ADDITIONAL_DATA])this._additionalInstanceData=trackDataJson[WI_ADDITIONAL_DATA];if(trackDataJson[TRACK_TYPE])this._type=trackDataJson[TRACK_TYPE];if(trackDataJson[TRACK_NAME])this._name=trackDataJson[TRACK_NAME];this._keyframeData=new C3.KeyframeData(trackDataJson[KEYFRAMES],this);this._propertyTrackData=new C3.PropertyTrackData(trackDataJson[PROPERTY_TRACKS], +this)}Release(){this._instanceData=null;this._trackData=null;if(this._keyframeData){this._keyframeData.Release();this._keyframeData=null}if(this._propertyTrackData){this._propertyTrackData.Release();this._propertyTrackData=null}this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){if(!this._keyframeData)this._keyframeData=new C3.KeyframeData(null,this);return this._keyframeData}GetPropertyTrackData(){if(!this._propertyTrackData)this._propertyTrackData=new C3.PropertyTrackData(null, +this);return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(index){this._objectClassIndex=index}GetInstanceUID(){return this._instanceUid}SetInstanceUID(uid){this._instanceUid=uid}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode=rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled= +!!e}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(t){this._localTotalTime=t}GetOriginalWidth(){return this._additionalInstanceData[ORIGINAL_WIDTH]}SetOriginalWidth(w){if(!this._additionalInstanceData)this._additionalInstanceData=[];this._additionalInstanceData[ORIGINAL_WIDTH]=w}GetOriginalHeight(){if(!this._additionalInstanceData)this._additionalInstanceData=[];return this._additionalInstanceData[ORIGINAL_HEIGHT]}SetOriginalHeight(h){if(!this._additionalInstanceData)this._additionalInstanceData= +[];this._additionalInstanceData[ORIGINAL_HEIGHT]=h}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{"keyframeDataJson":this._keyframeData._SaveToJson(),"propertyTrackDataJson":this._propertyTrackData._SaveToJson(),"instanceData":this._instanceData,"additionalInstanceData":this._additionalInstanceData,"instanceUid":this._instanceUid,"objectClassIndex":this._objectClassIndex,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled, +"id":this._id,"nestedData":this._nestedData,"type":this._type,"name":this._name}}_LoadFromJson(o){if(!o)return;this._instanceData=o["instanceData"];this._instanceUid=o["instanceUid"];this._objectClassIndex=o["objectClassIndex"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._id=o["id"];this._type=o["type"]?o["type"]:0;this._name=o["name"]?o["name"]:"";this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();if(o["nestedData"]){this._nestedData= +o["nestedData"];this._startOffset=this._nestedData[START_OFFSET];this._localTotalTime=this._nestedData[LOCAL_TOTAL_TIME]}if(o["additionalInstanceData"])this._additionalInstanceData=o["additionalInstanceData"];this.GetKeyframeData()._LoadFromJson(o["keyframeDataJson"]);this.GetPropertyTrackData()._LoadFromJson(o["propertyTrackDataJson"])}} +C3.TrackData=class TrackData{constructor(tracksDataJson,timelineDataItem){this._timelineDataItem=timelineDataItem;this._trackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._trackDataItems,tracksDataJson,TrackDataItem,this)}Release(){this._timelineDataItem=null;for(const trackDataItem of this._trackDataItems)trackDataItem.Release();C3.clearArray(this._trackDataItems);this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const trackDataItem= +new TrackDataItem(null,this);this._trackDataItems.push(trackDataItem);return trackDataItem}GetFirstKeyframeDataItem(trackDataItem){return trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();return keyframeDataItems.at(-1)}GetKeyFrameDataItemAtTime(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length; +for(let i=0;itime)return keyframeDataItem}}GetFirstKeyFrameDataItemHigherOrEqualThan(time,trackDataItem){const keyframeDataItems= +trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();const l=keyframeDataItems.length;for(let i=0;i=time)return keyframeDataItem}}GetFirstKeyFrameDataItemLowerOrEqualThan(time,trackDataItem){const keyframeDataItems=trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();for(let i=keyframeDataItems.length-1;i>=0;i--){const keyframeDataItem=keyframeDataItems[i];if(keyframeDataItem.GetTime()<=time)return keyframeDataItem}}*trackDataItems(){for(const trackDataItem of this._trackDataItems)yield trackDataItem}_SaveToJson(){return{"trackDataItemsJson":this._trackDataItems.map(trackDataItem=> +trackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,o["trackDataItemsJson"],TrackDataItem,this)}}; + +} + +// timelines/data/propertyTrackData.js +{ +'use strict';const C3=self.C3;const SOURCE_DATA=0;const SOURCE=0;const PROPERTY=1;const TYPE=2;const MIN=3;const MAX=4;const INTERPOLATION_MODE=5;const RESULT_MODE=6;const ENABLED=7;const PROPERTY_KEYFRAMES=8;const CAN_HAVE_PROPERTY_KEYFRAMES=9; +class PropertyTrackDataItem{constructor(propertyTrackDataJson,propertyTrackData){this._propertyTrackData=propertyTrackData;this._sourceAdapterId="";this._sourceAdapterArguments=null;this._property=null;this._type=null;this._min=NaN;this._max=NaN;this._interpolationMode="default";this._resultMode="default";this._enabled=false;this._propertyKeyframeData=null;this._canHavePropertyKeyframes=true;if(!propertyTrackDataJson)return;this._sourceAdapterId=propertyTrackDataJson[SOURCE_DATA][SOURCE];this._sourceAdapterArguments= +propertyTrackDataJson[SOURCE_DATA].slice(1);this._property=propertyTrackDataJson[PROPERTY];this._type=propertyTrackDataJson[TYPE];this._min=propertyTrackDataJson[MIN];this._max=propertyTrackDataJson[MAX];this._interpolationMode=propertyTrackDataJson[INTERPOLATION_MODE];this._resultMode=propertyTrackDataJson[RESULT_MODE];this._enabled=!!propertyTrackDataJson[ENABLED];this._propertyKeyframeData=new C3.PropertyKeyframeData(propertyTrackDataJson[PROPERTY_KEYFRAMES],this);this._canHavePropertyKeyframes= +propertyTrackDataJson[CAN_HAVE_PROPERTY_KEYFRAMES]}Release(){this._propertyKeyframeData.Release();this._propertyKeyframeData=null;this._propertyTrackData=null;this._sourceAdapterArguments=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){if(!this._propertyKeyframeData)this._propertyKeyframeData=new C3.PropertyKeyframeData(null,this);return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(said){this._sourceAdapterId= +said}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(sargs){this._sourceAdapterArguments=sargs}GetProperty(){return this._property}SetProperty(p){this._property=p}GetType(){return this._type}SetType(t){this._type=t}GetMin(){return this._min}SetMin(min){this._min=min}GetMax(){return this._max}SetMax(max){this._max=max}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(im){this._interpolationMode=im}GetResultMode(){return this._resultMode}SetResultMode(rm){this._resultMode= +rm}GetEnable(){return this._enabled}SetEnable(e){this._enabled=!!e}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{"propertyKeyframeDataJson":this._propertyKeyframeData._SaveToJson(),"sourceAdapterId":this._sourceAdapterId,"sourceAdapterArguments":this._sourceAdapterArguments,"property":this._property,"type":this._type,"min":this._min,"max":this._max,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"canHavePropertyKeyframes":this._canHavePropertyKeyframes}}_LoadFromJson(o){if(!o)return; +this._sourceAdapterId=o["sourceAdapterId"];this._sourceAdapterArguments=o["sourceAdapterArguments"];this._property=o["property"];this._type=o["type"];this._min=o["min"];this._max=o["max"];this._interpolationMode=o["interpolationMode"];this._resultMode=o["resultMode"];this._enabled=o["enabled"];this._canHavePropertyKeyframes=o["canHavePropertyKeyframes"];this.GetPropertyKeyframeData()._LoadFromJson(o["propertyKeyframeDataJson"])}} +C3.PropertyTrackData=class PropertyTrackData{constructor(propertyTracksDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._propertyTrackDataItems=[];C3.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,propertyTracksDataJson,PropertyTrackDataItem,this)}Release(){this._trackDataItem=null;for(const propertyTrackDataItem of this._propertyTrackDataItems)propertyTrackDataItem.Release();C3.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const propertyTrackDataItem= +new PropertyTrackDataItem(null,this);this._propertyTrackDataItems.push(propertyTrackDataItem);return propertyTrackDataItem}GetFirstPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();return propertyKeyframeData.GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +return propertyKeyframeDataItems.at(-1)}GetPropertyKeyFrameDataItemAtTime(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;itime)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData(); +const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray();const l=propertyKeyframeDataItems.length;for(let i=0;i=time)return propertyKeyframeDataItem}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,propertyTrackDataItem){const propertyKeyframeData=propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItems=propertyKeyframeData.GetPropertyKeyframeDataItemArray(); +for(let i=propertyKeyframeDataItems.length-1;i>=0;i--){const propertyKeyframeDataItem=propertyKeyframeDataItems[i];if(propertyKeyframeDataItem.GetTime()<=time)return propertyKeyframeDataItem}}*propertyTrackDataItems(){for(const propertyTrackDataItem of this._propertyTrackDataItems)yield propertyTrackDataItem}_SaveToJson(){return{"propertyTrackDataItemsJson":this._propertyTrackDataItems.map(propertyTrackDataItem=>propertyTrackDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems, +o["propertyTrackDataItemsJson"],PropertyTrackDataItem,this)}}; + +} + +// timelines/data/keyframeData.js +{ +'use strict';const C3=self.C3;const TIME=0;const EASE=1;const ENABLE=2;const TAGS=3; +class KeyframeDataItem{constructor(keyframeDataJson,keyframeData){this._keyframeData=keyframeData;this._time=-1;this._ease="noease";this._enable=false;this._tags=null;this._lowerTags=null;if(!keyframeDataJson)return;this._time=keyframeDataJson[TIME];this._ease=keyframeDataJson[EASE];this._enable=!!keyframeDataJson[ENABLE];const tagStr=keyframeDataJson[TAGS];this._tags=tagStr?tagStr.split(" "):[];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()));this._next=null}Release(){this._keyframeData= +null;C3.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null;this._next=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(next){this._next=next}GetTime(){return this._time}SetTime(t){this._time=t;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease=e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetTags(){return this._tags}SetTags(t){this._tags=t?t.split(" "):[];this._lowerTags= +new Set(this._tags.map(t=>t.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(tag){return this._lowerTags.has(tag.toLowerCase())}_SaveToJson(){return{"time":this._time,"ease":this._ease,"enable":this._enable,"tags":this._tags}}_LoadFromJson(o){if(!o)return;this._time=o["time"];this._ease=o["ease"];this._enable=o["enable"];this._tags=o["tags"];this._lowerTags=new Set(this._tags.map(t=>t.toLowerCase()))}} +C3.KeyframeData=class KeyframeData{constructor(keyframesDataJson,trackDataItem){this._trackDataItem=trackDataItem;this._keyframeDataItems=[];C3.TimelineDataManager._CreateDataItems(this._keyframeDataItems,keyframesDataJson,KeyframeDataItem,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const keyframeDataItem of this._keyframeDataItems)keyframeDataItem.Release();C3.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((first, +second)=>first.GetTime()-second.GetTime());for(let i=0;ia.GetTime()-b.GetTime())}GetKeyframeDataItemIndex(keyframeDataItem){return this._keyframeDataItems.indexOf(keyframeDataItem)}GetKeyframeDataItemFromIndex(index){return this._keyframeDataItems[index]}*keyframeDataItems(){for(const keyframeDataItem of this._keyframeDataItems)yield keyframeDataItem}*keyframeDataItemsReverse(){for(let i= +this._keyframeDataItems.length-1;i>=0;i--)yield this._keyframeDataItems[i]}_SaveToJson(){return{"keyframeDataItemsJson":this._keyframeDataItems.map(keyframeDataItem=>keyframeDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,o["keyframeDataItemsJson"],KeyframeDataItem,this);this._LinkKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeData.js +{ +'use strict';const C3=self.C3;const VALUE_DATA=0;const VALUE_DATA_VALUE=0;const VALUE_DATA_ABSOLUTE_VALUE=1;const VALUE_DATA_TYPE=2;const TIME=1;const EASE=2;const ENABLE=3;const ADDONS=4;const PATH_MODE=5; +class PropertyKeyframeDataItem{constructor(propertyKeyframeDataJson,propertyKeyframeData){this._propertyKeyframeData=propertyKeyframeData;this._value=null;this._aValue=null;this._type="";this._time=NaN;this._ease="noease";this._enable=false;this._addonData=null;this._addonInstance=undefined;this._pathMode="line";if(!propertyKeyframeDataJson)return;this._value=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_VALUE];this._aValue=propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_ABSOLUTE_VALUE];this._type= +propertyKeyframeDataJson[VALUE_DATA][VALUE_DATA_TYPE];this._time=propertyKeyframeDataJson[TIME];this._ease=propertyKeyframeDataJson[EASE];this._enable=!!propertyKeyframeDataJson[ENABLE];this._pathMode=propertyKeyframeDataJson[PATH_MODE];this._addonData=null;if(!!propertyKeyframeDataJson[ADDONS])this._addonData=new C3.AddonData(propertyKeyframeDataJson[ADDONS],this);this._next=null;this._prev=null}Release(){this._propertyKeyframeData=null;if(this._addonData){this._addonData.Release();this._addonData= +null}this._next=null;this._prev=null}GetAddonData(){return this._addonData}SetNext(next){this._next=next}GetNext(){return this._next}SetPrevious(prev){this._prev=prev}GetPrevious(){return this._prev}GetValue(){return this._value}SetValue(value){if(this._type==="color"&&C3.IsFiniteNumber(value)){this._value[0]=C3.GetRValue(value);this._value[1]=C3.GetGValue(value);this._value[2]=C3.GetBValue(value)}else this._value=value}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(aValue){if(this._type=== +"color"&&C3.IsFiniteNumber(aValue)){this._aValue[0]=C3.GetRValue(aValue);this._aValue[1]=C3.GetGValue(aValue);this._aValue[2]=C3.GetBValue(aValue)}else this._aValue=aValue}GetValueWithResultMode(){const rm=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if(rm==="relative")return this.GetValue();else if(rm==="absolute")return this.GetAbsoluteValue()}GetType(){return this._type}SetType(t){this._type=t}GetTime(){return this._time}SetTime(t){this._time=t;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(e){this._ease= +e}GetEnable(){return this._enable}SetEnable(e){this._enable=!!e}GetPathMode(){return this._pathMode}GetAddOn(id){if(!this._addonData)return;if(this._addonInstance||this._addonInstance===null)return this._addonInstance;const addonArray=this._addonData.GetAddDataItemArray();if(!addonArray){this._addonInstance=null;return this._addonInstance}const len=addonArray.length;for(let i=0;ifirst.GetTime()-second.GetTime());for(let i=0;i=0)current.SetPrevious(dataItems[i-1])}dataItems=this._propertyKeyframeDataItemsIncludingDisabled;dataItems.sort((first,second)=>first.GetTime()-second.GetTime());for(let i=0;i=0)current.SetPrevious(dataItems[i-1])}}AddEmptyPropertyKeyframeDataItem(){const propertyKeyframeDataItem=new PropertyKeyframeDataItem(null,this);this._propertyKeyframeDataItems.push(propertyKeyframeDataItem);this._LinkPropertyKeyframeDataItems();return propertyKeyframeDataItem}DeletePropertyKeyframeDataItems(match){for(const propertyKeyframeDataItem of this._propertyKeyframeDataItems){if(!match(propertyKeyframeDataItem))continue;const index= +this._propertyKeyframeDataItems.indexOf(propertyKeyframeDataItem);if(index===-1)continue;propertyKeyframeDataItem.Release();this._propertyKeyframeDataItems.splice(index,1)}this.SortPropertyKeyFrameDataItems();this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,b)=>a.GetTime()-b.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetLastPropertyKeyframeDataItem(){return this._propertyKeyframeDataItems[this._propertyKeyframeDataItems.length- +1]}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}GetPropertyKeyframeDataItemArrayIncludingDisabled(){return this._propertyKeyframeDataItemsIncludingDisabled}*propertyKeyframeDataItems(){for(const propertyKeyframeDataItem of this._propertyKeyframeDataItems)yield propertyKeyframeDataItem}*propertyKeyframeDataItemsReverse(){for(let i=this._propertyKeyframeDataItems.length-1;i>=0;i--)yield this._propertyKeyframeDataItems[i]}_SaveToJson(){const propertyKeyframeDataItems=this._propertyKeyframeDataItems; +const propertyKeyframeDataItemsIncludingDisabled=this._propertyKeyframeDataItemsIncludingDisabled;return{"propertyKeyframeDataItemsJson":propertyKeyframeDataItems.map(propertyTrackDataItem=>{return propertyTrackDataItem._SaveToJson()}),"propertyKeyframeDataItemsIncludingDisabledJson":propertyKeyframeDataItemsIncludingDisabled.map(propertyTrackDataItem=>{return propertyTrackDataItem._SaveToJson()})}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems, +o["propertyKeyframeDataItemsJson"],PropertyKeyframeDataItem,this);C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItemsIncludingDisabled,o["propertyKeyframeDataItemsIncludingDisabledJson"],PropertyKeyframeDataItem,this);this._LinkPropertyKeyframeDataItems()}}; + +} + +// timelines/data/propertyKeyframeAddonData.js +{ +'use strict';const C3=self.C3;const ADDON_ID=0;const ADDON_DATA=1;class AddonDataItem{constructor(addonDataJson,addonData){this._addonData=addonData;this._id=addonDataJson[ADDON_ID];this._data=addonDataJson[ADDON_DATA]}Release(){this._addonData=null;this._data=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{"id":this._id,"data":this._data}}_LoadFromJson(o){if(!o)return;this._id=o["id"];this._data=o["data"]}}const START_ANCHOR=0;const START_ENABLE=1; +const END_ANCHOR=2;const END_ENABLE=3; +class AddonDataCubicBezierItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._startAnchor=this._data[START_ANCHOR];this._startEnable=!!this._data[START_ENABLE];this._endAnchor=this._data[END_ANCHOR];this._endEnable=!!this._data[END_ENABLE]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),{"startAnchor":this._startAnchor, +"startEnable":!!this._startEnable,"endAnchor":this._endAnchor,"endEnable":!!this._endEnable})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._startAnchor=o["startAnchor"];this._startEnable=!!o["startEnable"];this._endAnchor=o["endAnchor"];this._endEnable=!!o["endEnable"]}}const DIRECTION=0;const REVOLUTIONS=1; +class AddonDataAngleItem extends AddonDataItem{constructor(addonDataJson,addonData){super(addonDataJson,addonData);this._direction=this._data[DIRECTION];this._revolutions=this._data[REVOLUTIONS]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),{"direction":this._direction,"revolutions":this._revolutions})}_LoadFromJson(o){if(!o)return;super._LoadFromJson(o);this._direction=o["direction"]; +this._revolutions=o["revolutions"]}} +C3.AddonData=class AddonData{constructor(addonsDataJson,propertyKeyframeDataItem){this._propertyKeyframeDataItem=propertyKeyframeDataItem;this._addonDataItems=[];C3.TimelineDataManager._CreateDataItems(this._addonDataItems,addonsDataJson,{prop:0,map:new Map([["cubic-bezier",AddonDataCubicBezierItem],["angle",AddonDataAngleItem]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const addonDataItem of this._addonDataItems)addonDataItem.Release();C3.clearArray(this._addonDataItems);this._addonDataItems= +null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const addonDataItem of this._addonDataItems)yield addonDataItem}_SaveToJson(){return{"addonDataItemsJson":this._addonDataItems.map(addonDataItem=>addonDataItem._SaveToJson())}}_LoadFromJson(o){if(!o)return;C3.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,o["addonDataItemsJson"],{prop:"id",map:new Map([["cubic-bezier",AddonDataCubicBezierItem], +["angle",AddonDataAngleItem]])},this)}}; + +} + +// timelines/tweens/tweenState.js +{ +'use strict';const C3=self.C3;const INITIAL_VALUE_MODE_START_VALUE="start-value";const INITIAL_VALUE_MODE_CURRENT_STATE="current-state";const PING_PONG_BEGIN=0;const PING_PONG_END=1;let createdTweens=0; +C3.TweenState=class Tween extends C3.TimelineState{constructor(tweenDataItem,timelineManager){super(`tween-${createdTweens++}`,tweenDataItem,timelineManager);this._id="";this._destroyInstanceOnComplete=false;this._initialValueMode=INITIAL_VALUE_MODE_START_VALUE;this._instance=null;this._on_completed_callbacks=null;this._on_started_callbacks=null;this._track=null;this._iTweenState=null}FireReleaseEvent(dispatcher){const event=C3.New(C3.Event,"tweenstatereleased");event.tweenState=this;dispatcher.dispatchEvent(event)}GetType(){return 1}CreateTrackStates(){for(const trackDataItem of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(C3.TweenTrackState.Create(this, +trackDataItem));this._track=this._tracks[0]}AddTrack(){const trackDataItem=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();const track=C3.TweenTrackState.Create(this,trackDataItem);this._tracks.push(track);this._track=this._tracks[0];return track}GetPropertyTrack(propertyName){return this._track.GetPropertyTracks()[0]}SetPropertyType(type){this._propertyType=type}GetInstance(){const tracks=this.GetTracks();if(!tracks||!tracks.length)return;const track=tracks[0];this._track=track;if(!track)return; +const instance=track.GetInstance();return track.IsInstanceValid()?instance:undefined}AddStartedCallback(c){if(!this._on_started_callbacks)this._on_started_callbacks=[];this._on_started_callbacks.push(c)}AddCompletedCallback(c){if(!this._on_completed_callbacks)this._on_completed_callbacks=[];this._on_completed_callbacks.push(c)}RemoveStartedCallback(c){if(!this._on_started_callbacks)return;const index=this._on_started_callbacks.indexOf(c);if(index!==-1)this._on_started_callbacks.splice(index,1)}RemoveCompletedCallback(c){if(!this._on_completed_callbacks)return; +const index=this._on_completed_callbacks.indexOf(c);if(index!==-1)this._on_completed_callbacks.splice(index,1)}SetStartValue(startValue,propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks){if(propertyTrack.GetPropertyName()!==propertyName)continue;const propertyTrackData=propertyTrack.GetPropertyTrackData();const propertyTrackDataItem=propertyTrack.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetFirstPropertyKeyframeDataItem(propertyTrackDataItem); +propertyKeyframeDataItem.SetValue(startValue);propertyKeyframeDataItem.SetAbsoluteValue(startValue)}}_GetPropertyTrackState(propertyName){for(const track of this._tracks)for(const propertyTrack of track._propertyTracks)if(propertyTrack.GetPropertyName()===propertyName)return propertyTrack}BeforeSetEndValues(properties){for(const propertyName of properties){const propertyTrackState=this._GetPropertyTrackState(propertyName);this.SetStartValue(propertyTrackState.GetCurrentState(),propertyName)}if(this.IsForwardPlayBack()){const newTotalTime= +this.GetTotalTime()-this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(0)}else{const newTotalTime=this.GetTime();this.SetTotalTime(newTotalTime);for(const track of this._tracks)track.SetLocalTotalTime(newTotalTime);this._SetTime(newTotalTime)}this.SetInitialStateFromSetTime()}SetEndValue(endValue,propertyName){const propertyTrackState=this._GetPropertyTrackState(propertyName);const propertyTrackData=propertyTrackState.GetPropertyTrackData(); +const propertyTrackDataItem=propertyTrackState.GetPropertyTrackDataItem();const propertyKeyframeDataItem=propertyTrackData.GetLastPropertyKeyframeDataItem(propertyTrackDataItem);propertyKeyframeDataItem.SetTime(this.GetTotalTime());propertyKeyframeDataItem.SetValue(endValue);propertyKeyframeDataItem.SetAbsoluteValue(endValue)}SetId(id){this._id=id}GetId(){return this._id}SetInitialValueMode(initialValueMode){this._initialValueMode=initialValueMode}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(releaseOnComplete){this._destroyInstanceOnComplete= +releaseOnComplete}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const c of this._on_started_callbacks)c(this);if(this.IsComplete())return;for(const track of this._tracks)track.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(this._finishedTriggers)return;this._finishedTriggers=true;if(this._on_completed_callbacks)for(const c of this._on_completed_callbacks)c(this)}SetTime(time){this._DeleteIntermediateKeyframes(); +super.SetTime(time)}_SetTimeAndReset(time){if(!C3.IsFiniteNumber(time))time=this.GetTotalTime();if(time<0)this._playheadTime=0;else if(time>=this.GetTotalTime())this._playheadTime=this.GetTotalTime();else this._playheadTime=time;this._track.SetResetState()}SetInitialState(fromSetTime){if(!this.InitialStateSet()&&this.GetInitialValueMode()===INITIAL_VALUE_MODE_CURRENT_STATE)for(const track of this._tracks)track.CompareInitialStateWithCurrent();super.SetInitialState(fromSetTime)}Stop(completed=false){super.Stop(completed); +if(this.IsComplete())return;for(const track of this._tracks)track.SaveState()}Reset(render=true,beforeChangeLayout=false){this._DeleteIntermediateKeyframes();super.Reset(render,beforeChangeLayout)}_DeleteIntermediateKeyframes(){for(const track of this._tracks){const del=kf=>{const time=kf.GetTime();const totalTime=this.GetTotalTime();return time!==0&&time!==totalTime};track.DeleteKeyframes(del);track.DeletePropertyKeyframes(del)}}_OnBeforeChangeLayout(){if(this.IsReleased())return true;const instance= +this.GetInstance();if(instance&&instance.GetObjectClass().IsGlobal())return false;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return true}Tick(deltaTime,timeScale,deltaTime1){if(!this._instance)this._instance=this.GetInstance();if(!this._instance||this._instance.IsDestroyed()){this.Stop(true);this.OnCompleted();return}const instanceTimeScale=this._instance.GetTimeScale();if(instanceTimeScale!==-1)deltaTime=deltaTime1*instanceTimeScale;if(deltaTime=== +0&&this._lastDelta===0)return;this._lastDelta=deltaTime;const lastTime=this._playheadTime;const newDeltaTime=deltaTime*this._playbackRate;const newTime=lastTime+newDeltaTime;const totalTime=this._timelineDataItem._totalTime;if(newTime<0)this._playheadTime=0;else if(newTime>=totalTime)this._playheadTime=totalTime;else this._playheadTime=newTime;let complete=false;let ensureValue=false;const loop=this.GetLoop();const pingPong=this.GetPingPong();if(!loop&&!pingPong)if(this._playbackRate>0){if(this._playheadTime>= +totalTime)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTimeAndReset(0);ensureValue=true}}else{if(this._playheadTime<= +0){this._SetTimeAndReset(totalTime);ensureValue=true}}else if(!loop&&pingPong)if(this._playbackRate>0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;if(this._pingPongState===PING_PONG_END)if(this._currentRepeatCount0){if(this._playheadTime>=totalTime){this._SetTime(totalTime);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue= +true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}}else if(this._playheadTime<=0){this._SetTime(0);this.SetPlaybackRate(this.GetPlaybackRate()*-1);ensureValue=true;this._pingPongState++;C3.wrap(this._pingPongState,0,2)}if(complete){this._track.SetEndState();this.Stop(true);this.OnCompleted();return}this._track.Interpolate(this._playheadTime,true,false,ensureValue,this._firstTick,false);if(this._firstTick)this._firstTick=false}_SaveToJson(){const ret=super._SaveToJson();const tweenDataItem= +this.GetTimelineDataItem();return Object.assign(ret,{"tweenDataItemJson":tweenDataItem._SaveToJson(),"id":this._id,"destroyInstanceOnComplete":this._destroyInstanceOnComplete,"initialValueMode":this._initialValueMode})}_LoadFromJson(o){if(!o)return;const tweenDataItem=this.GetTimelineDataItem();tweenDataItem._LoadFromJson(o["tweenDataItemJson"]);super._LoadFromJson(o);this._id=o["id"];this._destroyInstanceOnComplete=o["destroyInstanceOnComplete"];this._initialValueMode=o["initialValueMode"]}static IsPlaying(tween){return tween.IsPlaying()}static IsPaused(tween){return tween.IsPaused()}static Build(config){const timelineManager= +config.runtime.GetTimelineManager();const tweenDataItem=new C3.TimelineDataItem;if(config.json){tweenDataItem._LoadFromJson(config.json["tweenDataItemJson"]);const tween=new C3.TweenState(tweenDataItem,timelineManager);tween._LoadFromJson(config.json);return tween}else{const tween=new C3.TweenState(tweenDataItem,timelineManager);if(!C3.IsArray(config.propertyTracksConfig))config.propertyTracksConfig=[config.propertyTracksConfig];tween.SetId(config.id);tween.SetTags(config.tags);tween.SetInitialValueMode(config.initialValueMode); +tween.SetDestroyInstanceOnComplete(config.releaseOnComplete);tween.SetLoop(config.loop);tween.SetPingPong(config.pingPong);tween.SetTotalTime(config.time);tween.SetStep(0);tween.SetInterpolationMode("default");tween.SetResultMode(config.propertyTracksConfig[0].resultMode);tween.SetRepeatCount(config.repeatCount);const track=tween.AddTrack();track.SetInstanceUID(config.instance.GetUID());track.SetInterpolationMode("default");track.SetResultMode(config.propertyTracksConfig[0].resultMode);track.SetEnable(true); +track.SetObjectClassIndex(config.instance.GetObjectClass().GetIndex());const sdkIntance=config.instance.GetSdkInstance();const w=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalWidth():config.instance.GetWorldInfo().GetWidth();const h=sdkIntance.IsOriginalSizeKnown()?sdkIntance.GetOriginalHeight():config.instance.GetWorldInfo().GetHeight();track.SetOriginalWidth(w);track.SetOriginalHeight(h);const startKeyframeDataItem=track.AddKeyframe();startKeyframeDataItem.SetTime(0);startKeyframeDataItem.SetEase("noease"); +startKeyframeDataItem.SetEnable(true);startKeyframeDataItem.SetTags("");const endKeyframeDataItem=track.AddKeyframe();endKeyframeDataItem.SetTime(config.time);endKeyframeDataItem.SetEase("noease");endKeyframeDataItem.SetEnable(true);endKeyframeDataItem.SetTags("");for(const propertyTrackConfig of config.propertyTracksConfig){const propertyTrack=track.AddPropertyTrack();propertyTrack.SetSourceAdapterId(propertyTrackConfig.sourceId);propertyTrack.SetSourceAdapterArgs(propertyTrackConfig.sourceArgs); +propertyTrack.SetPropertyName(propertyTrackConfig.property);propertyTrack.SetPropertyType(propertyTrackConfig.type);propertyTrack.SetMin(NaN);propertyTrack.SetMax(NaN);propertyTrack.SetInterpolationMode("default");propertyTrack.SetResultMode(propertyTrackConfig.resultMode);propertyTrack.SetEnable(true);const startPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();startPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);startPropertyKeyframeDataItem.SetTime(0);startPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease); +startPropertyKeyframeDataItem.SetEnable(true);startPropertyKeyframeDataItem.SetValue(propertyTrackConfig.startValue);startPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.startValue);const endPropertyKeyframeDataItem=propertyTrack.AddPropertyKeyframe();endPropertyKeyframeDataItem.SetType(propertyTrackConfig.valueType);endPropertyKeyframeDataItem.SetTime(config.time);endPropertyKeyframeDataItem.SetEase(propertyTrackConfig.ease);endPropertyKeyframeDataItem.SetEnable(true);endPropertyKeyframeDataItem.SetValue(propertyTrackConfig.endValue); +endPropertyKeyframeDataItem.SetAbsoluteValue(propertyTrackConfig.endValue);propertyTrack.GetSourceAdapter()}return tween}}GetITweenState(behInst,opts){if(!this._iTweenState)this._iTweenState=C3.New(self.ITweenState,this,behInst,opts);return this._iTweenState}}; + +} + +// timelines/tweens/tweenTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenTrackState=class TweenTrack extends C3.TrackState{constructor(timeline,trackDataItem){super(timeline,trackDataItem);this._firstPropertyTrack=null;this._secondPropertyTrack=null}static Create(timeline,trackDataItem){return C3.New(C3.TweenTrackState,timeline,trackDataItem)}_CachePropertyTracks(){if(this._propertyTracks.length===1)this._firstPropertyTrack=this._propertyTracks[0];else{this._firstPropertyTrack=this._propertyTracks[0];this._secondPropertyTrack=this._propertyTracks[1]}}CreatePropertyTrackStates(){for(const propertyTrackDataItem of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem)); +this._CachePropertyTracks()}AddPropertyTrack(){const propertyTrackData=this._trackDataItem.GetPropertyTrackData();const propertyTrackDataItem=propertyTrackData.AddEmptyPropertyTrackDataItem();const propertyTrack=C3.TweenPropertyTrackState.Create(this,propertyTrackDataItem);this._propertyTracks.push(propertyTrack);this._CachePropertyTracks();return propertyTrack}SetInitialState(){this.MaybeGetInstance();if(!this.IsInstanceValid()&&this.IsInstanceTrack())return;const timeline=this.GetTimeline();const isForwardPlayBack= +timeline.IsForwardPlayBack();const time=isForwardPlayBack?0:this.GetLocalTotalTime();for(const propertyTrack of this._propertyTracks){propertyTrack.SetInitialState(time);if(this._worldInfoChange===0&&propertyTrack.GetWorldInfoChange()===1)this._worldInfoChange=1;if(this._renderChange===0&&propertyTrack.GetRenderChange()===1)this._renderChange=1}this._needsBeforeAndAfter=0;const nba=this._propertyTracks.some(pt=>pt.GetNeedsBeforeAndAfter());if(nba)this._needsBeforeAndAfter=1;this._lastKeyframeDataItem= +this._GetLastKeyFrameBeforeTime(time);this._initialStateOfNestedSet=false;this._endStateOfNestedSet=false;this.Interpolate(time)}BeforeInterpolate(){}Interpolate(time,isTicking=false,setTime=false,ensureValue=false,firstTick=false,ignoreGlobals=false,endState=false){if(!this._instance)this.GetInstance();if(!this._instance)return;const instanceValid=!this._instance.IsDestroyed();if(!instanceValid)return false;if(ignoreGlobals&&this.GetObjectClass().IsGlobal())return false;if(this._secondPropertyTrack){this._firstPropertyTrack.Interpolate(time, +setTime,ensureValue,endState);this._secondPropertyTrack.Interpolate(time,setTime,ensureValue,endState)}else this._firstPropertyTrack.Interpolate(time,setTime,ensureValue,endState);if(this._firstPropertyTrack.GetWorldInfoChange()!==0){if(!this._worldInfo)this._worldInfo=this._instance.GetWorldInfo();if(this._worldInfo)this._worldInfo.SetBboxChanged()}}AfterInterpolate(){}_LoadFromJson(o){super._LoadFromJson(o);this._CachePropertyTracks()}}; + +} + +// timelines/tweens/tweenPropertyTrackState.js +{ +'use strict';const C3=self.C3; +C3.TweenPropertyTrackState=class TweenPropertyTrackState extends C3.PropertyTrackState{constructor(track,propertyTrackDataItem){super(track,propertyTrackDataItem);this._basic=false}static Create(track,propertyTrackDataItem){return C3.New(C3.TweenPropertyTrackState,track,propertyTrackDataItem)}Interpolate(time,setTime=false,ensureValue=false,endState=false){let start;let end;if(this._basic){start=this._propertyKeyframeDataItems[0];end=this._propertyKeyframeDataItems[1]}else if(setTime){start=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time, +this._propertyTrackDataItem);end=start.GetNext()}else{if(this._lastPropertyKeyframeDataItem){const timeline=this.GetTimeline();const nextPropertyKeyframe=this._lastPropertyKeyframeDataItem.GetNext();const lastTime=this._lastPropertyKeyframeDataItem.GetTime();const nextTime=nextPropertyKeyframe?nextPropertyKeyframe.GetTime():timeline.GetTotalTime();if(time<=lastTime||time>=nextTime)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem= +this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(time,this._propertyTrackDataItem);start=this._lastPropertyKeyframeDataItem;end=start.GetNext()}this._sourceAdapter.Interpolate(time,start,end,setTime,ensureValue,endState)}AddPropertyKeyframe(){const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();const propertyKeyframeDataItem=propertyKeyframeData.AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=this.GetPropertyKeyframeDataItems().length<= +2;return propertyKeyframeDataItem}DeletePropertyKeyframes(match){this._lastPropertyKeyframeDataItem=null;const propertyKeyframeData=this._propertyTrackDataItem.GetPropertyKeyframeData();propertyKeyframeData.DeletePropertyKeyframeDataItems(match);this._basic=this.GetPropertyKeyframeDataItems().length<=2}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson(),"basic":this._basic}}_LoadFromJson(o){if(!o)return;this.GetSourceAdapter()._LoadFromJson(o["sourceAdapterJson"]);this._basic= +o["basic"]}}; + +} + +// timelines/transitions/transition.js +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const NAME=0;const TRANSITION_KEYFRAMES=1; +C3.Transition=class Transition extends C3.DefendedBase{constructor(data,addCustomEase=true){super();this._name=data[NAME];this._linear=false;this._transitionKeyframes=[];for(const transitionKeyframeData of data[TRANSITION_KEYFRAMES]){const transitionKeyframe=C3.TransitionKeyframe.Create(this,transitionKeyframeData);this._transitionKeyframes.push(transitionKeyframe)}for(let i=0;ithis.Interpolate(t,sv,dv,tt))}static Create(data){return C3.New(C3.Transition,data)}Release(){for(const transitionKeyframe of this._transitionKeyframes)transitionKeyframe.Release();C3.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear(); +this._transitionKeyframeCache=null}MakeLinear(linear){this._linear=!!linear}GetTransitionKeyFrameAt(x){const transitionKeyframe=this._transitionKeyframeCache.get(x);if(transitionKeyframe)return transitionKeyframe;for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()===x){this._transitionKeyframeCache.set(x,transitionKeyframe);return transitionKeyframe}}GetFirstTransitionKeyFrameHigherThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()> +x)return transitionKeyframe}GetFirstTransitionKeyFrameHigherOrEqualThan(x){for(const transitionKeyframe of this._transitionKeyframes)if(transitionKeyframe.GetValueX()>=x)return transitionKeyframe}GetFirstTransitionKeyFrameLowerThan(x){for(let i=this._transitionKeyframes.length-1;i>=0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()= +0;i--){const transitionKeyframe=this._transitionKeyframes[i];if(transitionKeyframe.GetValueX()<=x)return transitionKeyframe}}Interpolate(time,startValue,deltaValue,totalTime){let n=time/totalTime;if(this._linear){if(totalTime===0)return startValue+deltaValue;return Ease.NoEase(time,startValue,deltaValue,totalTime)}if(totalTime===0)n=1;let start=this.GetFirstTransitionKeyFrameLowerOrEqualThan(n);let end=start.GetNext();if(!end){start=this.GetFirstTransitionKeyFrameLowerThan(n);end=start.GetNext()}const delta= +end.GetValueX()-start.GetValueX();const nn=C3.mapToRange(n,start.GetValueX(),end.GetValueX(),0,delta);const startX=start.GetValueX();const startY=start.GetValueY();const anchor1X=start.GetValueX()+start.GetStartAnchorX();const anchor1Y=start.GetValueY()+start.GetStartAnchorY();const anchor2X=end.GetValueX()+end.GetEndAnchorX();const anchor2Y=end.GetValueY()+end.GetEndAnchorY();const endX=end.GetValueX();const endY=end.GetValueY();let ret=Ease.GetRuntimeEase("spline")(nn,startX,startY,anchor1X,anchor1Y, +anchor2X,anchor2Y,endX,endY,this._precalculatedSamples.get(start));ret+=start.GetValueY();return(1-ret)*startValue+ret*(startValue+deltaValue)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let i=0;ithis._OnInstanceDestroy(e.instance)}Release(){this.RemoveRuntimeListeners();if(this._templateDataMap){for(const objectClassTemplatesMap of this._templateDataMap.values())objectClassTemplatesMap.clear();this._templateDataMap.clear()}this._templateDataMap=null;this._runtime=null}Create(templateInstanceData){if(!this._templateDataMap)this._templateDataMap= +new Map;if(!templateInstanceData)return;const templateData=templateInstanceData[0][16];const templateName=templateData[0];const objectClassIndex=templateInstanceData[1];if(!this._templateDataMap.has(objectClassIndex))this._templateDataMap.set(objectClassIndex,new Map);const objectClassTemplatesMap=this._templateDataMap.get(objectClassIndex);objectClassTemplatesMap.set(templateName,templateInstanceData)}AddRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.addEventListener("instancedestroy", +this._instanceDestroy)}RemoveRuntimeListeners(){const dispatcher=this._runtime.Dispatcher();if(dispatcher)dispatcher.removeEventListener("instancedestroy",this._instanceDestroy)}HasTemplates(){if(!this._templateDataMap)return false;return this._templateDataMap.size!==0}GetTemplateData(objectClass_or_index,templateName){let index=0;if(objectClass_or_index instanceof C3.ObjectClass)index=objectClass_or_index.GetIndex();else index=objectClass_or_index;if(!this._templateDataMap.has(index))return;const ret= +this._templateDataMap.get(index).get(templateName);if(ret)return JSON.parse(JSON.stringify(ret));return undefined}MapInstanceToTemplateName(inst,templateName){if(!this._instanceToTemplateNameMap)this._instanceToTemplateNameMap=new WeakMap;if(this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.set(inst,templateName)}GetInstanceTemplateName(inst){if(!this._instanceToTemplateNameMap)return"";const ret=this._instanceToTemplateNameMap.get(inst);if(ret)return ret;return""}_OnInstanceDestroy(inst){if(!this._instanceToTemplateNameMap)return; +if(!this._instanceToTemplateNameMap.has(inst))return;this._instanceToTemplateNameMap.delete(inst)}}; + +} + +// events/stacks/solStack.js +{ +'use strict';const C3=self.C3; +C3.SolStack=class SolStack extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._stack=[];this._stack.push(C3.New(C3.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const s of this._stack)s.Release();C3.clearArray(this._stack);this._current=null;this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}GetOneBelowCurrentSol(){return this._stack[this._index-1]}Clear(){this.GetCurrentSol().Clear()}PushClean(){const stack=this._stack; +const index=++this._index;if(index===stack.length){const sol=C3.New(C3.Sol,this);stack.push(sol);this._current=sol}else{const sol=stack[index];sol.Reset();this._current=sol}}PushCopy(){const stack=this._stack;const index=++this._index;if(index===stack.length)stack.push(C3.New(C3.Sol,this));const sol=stack[index];sol.Copy(stack[index-1]);this._current=sol}Pop(){this._current=this._stack[--this._index]}RemoveInstances(s){const stack=this._stack;for(let i=0,len=stack.length;i=0}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index=== +this._stack.length){const ret=C3.New(C3.Loop,this);this._stack.push(ret);return ret}else{const ret=this._stack[this._index];ret.Reset();return ret}}Pop(){--this._index}FindByName(name){const stack=this._stack;for(let i=this._index;i>=0;--i){const loop=stack[i];if(loop.GetName()===name)return loop}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}; + +} + +// events/stacks/loop.js +{ +'use strict';const C3=self.C3;C3.Loop=class Loop extends C3.DefendedBase{constructor(loopStack){super();this._loopStack=loopStack;this._name="";this._index=0;this._isStopped=false;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=false;this._end=NaN}SetName(name){this._name=name}GetName(){return this._name}SetIndex(i){this._index=i}GetIndex(){return this._index}Stop(){this._isStopped=true}IsStopped(){return this._isStopped}SetEnd(e){this._end=e}GetEnd(){return this._end}}; + +} + +// events/stacks/arrayStack.js +{ +'use strict';const C3=self.C3;C3.ArrayStack=class ArrayStack extends C3.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){C3.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const ret=[];this._stack.push(ret);return ret}else return this._stack[this._index]}Pop(){--this._index}}; + +} + +// events/eventSheetManager.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function SortSolArray(a,b){return a.GetIndex()-b.GetIndex()}function IsSolArrayIdentical(a,b){for(let i=0,len=a.length;ithis._InvokeFunctionFromJS(name,params)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release(); +this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;C3.clearArray(this._queuedTriggers);C3.clearArray(this._queuedDebugTriggers);this._runtime=null;C3.clearArray(this._allSheets);this._sheetsByName.clear()}Create(eventSheetData){const eventSheet=C3.New(C3.EventSheet,this,eventSheetData);this._allSheets.push(eventSheet);this._sheetsByName.set(eventSheet.GetName().toLowerCase(),eventSheet)}_AddTriggerToPostInit(trig){this._triggersToPostInit.push(trig)}_PostInit(){for(const customActionBlock of this._customActionBlocksMap.values())customActionBlock._CheckOverrideState(); +for(const functionBlock of this._functionBlocksByName.values())functionBlock._PostInit();for(const customActionBlock of this._customActionBlocksMap.values())customActionBlock._PostInit();for(const sheet of this._allSheets)sheet._PostInit();for(const sheet of this._allSheets)sheet._UpdateDeepIncludes();for(const trig of this._triggersToPostInit)trig._PostInit(false);C3.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(name){return this._sheetsByName.get(name.toLowerCase())|| +null}_RegisterGroup(group){this._allGroups.push(group);this._groupsByName.set(group.GetGroupName(),group)}_RegisterEventBlock(eventBlock){this._blocksBySid.set(eventBlock.GetSID(),eventBlock)}_RegisterCondition(condition){this._cndsBySid.set(condition.GetSID(),condition)}_RegisterAction(action){this._actsBySid.set(action.GetSID(),action)}_RegisterFunctionBlock(functionBlock){switch(functionBlock.GetFunctionType()){case 0:this._functionBlocksByName.set(functionBlock.GetFunctionName().toLowerCase(), +functionBlock);break;case 1:this._customActionBlocksMap.set(functionBlock.GetFunctionName().toLowerCase(),functionBlock);break;default:}}_RegisterEventVariable(ev){this._eventVarsBySid.set(ev.GetSID(),ev);if(ev.IsGlobal())this._allGlobalVars.push(ev);else this._allLocalVars.push(ev)}_DeduplicateSolModifierList(arr){if(arr.length>=2)arr.sort(SortSolArray);let candidateList=this._allUniqueSolModifiers.get(arr.length);if(!candidateList){candidateList=[];this._allUniqueSolModifiers.set(arr.length,candidateList)}for(let i= +0,len=candidateList.length;iresolve=r);this._queuedDebugTriggers.push([method,inst,behaviorType,resolve]);return ret}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw new Error("should not be in breakpoint");const layoutManager=this._runtime.GetLayoutManager();while(this._queuedDebugTriggers.length){const [method,inst,behaviorType,resolve]=this._queuedDebugTriggers.shift();const ret=yield*this._DebugTrigger(layoutManager,method,inst,behaviorType);resolve(ret)}}async RunQueuedDebugTriggersAsync(){for(const breakEventObject of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(breakEventObject)}_FastTrigger(layoutManager, +method,inst,value){let ret=false;const layout=layoutManager.GetMainRunningLayout();const eventSheet=layout.GetEventSheet();if(!eventSheet)return;this._executingTriggerDepth++;this._runtime.PushCurrentLayout(layout);const deepIncludes=eventSheet.deepIncludes();for(let i=0,len=deepIncludes.length;i0}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return this._runningEventsDepth>0}IsInEventEngine(){return this.IsRunningEvents()||this.IsInTrigger()}_RunQueuedTriggers(layoutManager){for(const [method,inst,behaviorType]of this._queuedTriggers)this._Trigger(layoutManager, +method,inst,behaviorType);C3.clearArray(this._queuedTriggers)}BlockFlushingInstances(e){if(e)this._blockFlushingDepth++;else this._blockFlushingDepth--}IsFlushingBlocked(){return this._blockFlushingDepth>0}ClearSol(solModifiers){for(let i=0,len=solModifiers.length;i0){for(const t of pushSet)t.GetSolStack().PushClean();return[...pushSet]}else return null}AddScheduledWait(){const w=C3.New(C3.ScheduledWait,this);this._scheduledWaits.push(w);return w}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(!this._scheduledWaits.length)return;const frame=this.GetCurrentEventStackFrame();let didAnyRun=false;this._runningEventsDepth++;for(let i=0, +len=this._scheduledWaits.length;iw.ShouldRelease());for(const w of toRelease)w.Release()}ClearAllScheduledWaits(){for(const w of this._scheduledWaits)w.Release();C3.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(s){for(const w of this._scheduledWaits)w.RemoveInstances(s)}AddAsyncActionPromise(p){this._asyncActionPromises.push(p)}ClearAsyncActionPromises(){C3.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const ret= +Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return ret}_SaveToJson(){return{"groups":this._SaveGroupsToJson(),"cnds":this._SaveCndsToJson(),"acts":this._SaveActsToJson(),"vars":this._SaveVarsToJson(),"waits":this._SaveScheduledWaitsToJson()}}_LoadFromJson(o){this._LoadGroupsFromJson(o["groups"]);this._LoadCndsFromJson(o["cnds"]);this._LoadActsFromJson(o["acts"]);this._LoadVarsFromJson(o["vars"]);this._LoadScheduledWaitsFromJson(o["waits"])}_SaveGroupsToJson(){const o={};for(const group of this.GetAllGroups())o[group.GetSID().toString()]= +group.IsGroupActive();return o}_LoadGroupsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const group=this.GetEventGroupBySID(sid);if(group)group.SetGroupActive(data)}}_SaveCndsToJson(){const o={};for(const [sid,cnd]of this._cndsBySid){const data=cnd._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadCndsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,cnd]of this._cndsBySid)cnd._LoadFromJson(map.get(sid)|| +null)}_SaveActsToJson(){const o={};for(const [sid,act]of this._actsBySid){const data=act._SaveToJson();if(data)o[sid.toString()]=data}return o}_LoadActsFromJson(o){const map=new Map;for(const [sidStr,data]of Object.entries(o))map.set(parseInt(sidStr,10),data);for(const [sid,act]of this._actsBySid)act._LoadFromJson(map.get(sid)||null)}_SaveVarsToJson(){const o={};for(const [sid,eventVar]of this._eventVarsBySid)if(!eventVar.IsConstant()&&(eventVar.IsGlobal()||eventVar.IsStatic()))o[sid.toString()]= +eventVar.GetValue();return o}_LoadVarsFromJson(o){for(const [sidStr,data]of Object.entries(o)){const sid=parseInt(sidStr,10);const eventVar=this.GetEventVariableBySID(sid);if(eventVar)eventVar.SetValue(data)}}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(w=>!w.IsPromise()).map(w=>w._SaveToJson())}_LoadScheduledWaitsFromJson(arr){this.ClearAllScheduledWaits();for(const data of arr){const sw=C3.ScheduledWait._CreateFromJson(this,data);if(sw)this._scheduledWaits.push(sw)}}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(l=> +l.GetEventSheet()).filter(eventSheet=>eventSheet).map(e=>e._GetPerfRecord())}FindFirstFunctionBlockParent(parent){while(parent){const scopeParent=parent.GetScopeParent();if(scopeParent instanceof C3.FunctionBlock)return scopeParent;parent=scopeParent}return null}_InvokeFunctionFromJS(name,params){if(!Array.isArray(params))params=[];const functionBlock=this.GetFunctionBlockByName(name.toLowerCase());if(!functionBlock)return null;if(!functionBlock.IsEnabled())return functionBlock.GetDefaultReturnValue(); +const functionParameters=functionBlock.GetFunctionParameters();if(params.length1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i< +len;++i)if(!parents[i].RunPreTrigger(frame)){okToRun=false;break}}if(okToRun){if(trigger.IsOrBlock())trigger.RunOrBlockTrigger(frame,index);else trigger.Run(frame);ret=frame.GetLastEventTrue()}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();eventSheetManager.PopSol(trigger.GetSolModifiersIncludingParents());if(currentEvent)eventSheetManager.PopSol(currentEvent.GetSolModifiersIncludingParents());if(!currentEvent&&triggerDepth===1){eventSheetManager.ClearAsyncActionPromises(); +if(!eventSheetManager.IsFlushingBlocked())runtime.FlushPendingInstances()}return ret}*_DebugExecuteTrigger(inst,trigger,index){const runtime=this._runtime;const eventSheetManager=this._eventSheetManager;const currentEvent=eventSheetManager.GetCurrentEvent();const eventStack=eventSheetManager.GetEventStack();const triggerDepth=eventSheetManager.GetTriggerDepth();let ret=false;if(currentEvent)eventSheetManager.PushCleanSol(currentEvent.GetSolModifiersIncludingParents());eventSheetManager.PushCleanSol(trigger.GetSolModifiersIncludingParents()); +const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();const frame=eventStack.Push(trigger);if(inst){const objectClass=trigger.GetConditions()[index].GetObjectClass();const sol=objectClass.GetCurrentSol();sol.SetSinglePicked(inst);if(inst.IsInContainer())inst.SetSiblingsSinglePicked()}let okToRun=true;if(trigger.GetParent()){const parents=trigger.GetTriggerParents();for(let i=0,len=parents.length;i0){let hasAnyActionWithReturnType=false;for(const a of this._actions){a._PostInit();if(a.HasReturnType())hasAnyActionWithReturnType=true}if(hasAnyActionWithReturnType){this._RunActions=this._RunActions_ReturnValue; +this._DebugRunActions=this._DebugRunActions_ReturnValue}else{this._RunActions=this._RunActions_Fast;this._DebugRunActions=this._DebugRunActions_Fast}}const subEvents=this._subEvents;for(let i=0,len=subEvents.length;ic.DebugCanRunFast());dd.canRunAllActionsFast=this._actions.every(a=>a.DebugCanRunFast());dd.canRunAllSubEventsFast=this._subEvents.every(s=>s.DebugCanRunFast());dd.canRunSelfFast=dd.canRunAllConditionsFast&&dd.canRunAllActionsFast&&dd.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let e=this;do{e._UpdateCanRunFast(); +e=e.GetParent()}while(e)}_IdentifyTopLevelGroup(){if(!this.IsGroup())return;let p=this.GetParent();this._isTopLevelGroup=true;while(p){if(!p.IsGroup()){this._isTopLevelGroup=false;break}p=p.GetParent()}}_IdentifySolModifiersIncludingParents(){const allObjectClasses=this._runtime.GetAllObjectClasses();if(this._solModifiers===allObjectClasses)this._solModifiersIncludingParents=allObjectClasses;else{this._solModifiersIncludingParents=C3.cloneArray(this._solModifiers);let p=this.GetParent();while(p){for(const o of p._solModifiers)this._AddParentSolModifier(o); +p=p.GetParent()}const eventSheetManager=this.GetEventSheetManager();this._solModifiers=eventSheetManager._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=eventSheetManager._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(!this.HasAnyTriggeredCondition())return;this._triggerParents=[];let p=this.GetParent();while(p){this._triggerParents.push(p);p=p.GetParent()}this._triggerParents.reverse()}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds= +true;if(this._parent)this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){if(!this._hasGotSolModifiersIncludingParents){this._hasGotSolModifiersIncludingParents=true;this._IdentifySolModifiersIncludingParents()}return this._solModifiersIncludingParents}HasSolModifier(objectClass){return this._solModifiers.includes(objectClass)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(p){this._scopeParent= +p}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(a){a= +!!a;if(!this._isGroup)throw new Error("not a group");if(this._isGroupActive===a)return;this._isGroupActive=a;for(const include of this._containedIncludes)include.UpdateActive();if(this._containedIncludes.length){const currentLayout=this._runtime.GetCurrentLayout();const mainEventSheet=currentLayout.GetEventSheet();if(mainEventSheet)mainEventSheet._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&& +this._scopeParent instanceof C3.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(i){i=Math.floor(i);if(i<0||i>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[i]}GetConditionByDebugIndex(i){return this.GetConditionAt(i)}IsFirstConditionOfType(cnd){let i=cnd.GetIndex();if(i===0)return true; +--i;const cndObjectClass=cnd.GetObjectClass();for(;i>=0;--i){const c=this._conditions[i];if(c.GetObjectClass()===cndObjectClass||c.IsSystemCondition()&&c.GetFirstObjectParameterObjectClass()===cndObjectClass)return false}return true}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(i){i=Math.floor(i);if(i<0||i>=this._actions.length)throw new RangeError("invalid action index");return this._actions[i]}GetActionByDebugIndex(i){i=Math.floor(i);const ret=this._actions.find(a=> +a.GetDebugIndex()===i);if(!ret)throw new RangeError("invalid action debug index");return ret}_HasActionIndex(i){i=Math.floor(i);return i>=0&&ie instanceof C3.EventVariable)}RunPreTrigger(frame){frame.SetCurrentEvent(this);const conditions=this._conditions;let isAnyTrue=conditions.length===0;for(let i=0,len=conditions.length;i +0)if(isRecursive){const paramResults=parameters.map(p=>p.Get(0));eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults)}else this._scopeParent.EvaluateFunctionParameters(parameters);else if(isRecursive)eventSheetManager.GetLocalVarStack().Push()}RunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked,pickInfo){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;let extraPopSolModifiers=null;const runtime=this._runtime;const eventStack= +this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);if(pickInfo!==null){if(pickInfo.copyFromObjectClass){const copyFromSol=isCopyPicked?pickInfo.copyFromObjectClass.GetCurrentSol(): +pickInfo.copyFromObjectClass.GetSolStack().GetOneBelowCurrentSol();const copyToSol=pickInfo.copyToObjectClass.GetCurrentSol();copyToSol.SetArrayPicked(copyFromSol.GetInstances());copyToSol.ClearElseInstances();if(!isCopyPicked)pickInfo.copyToObjectClass.ApplySolToContainer()}else if(pickInfo.pickObjectClass){const objectClassSol=pickInfo.pickObjectClass.GetCurrentSol();objectClassSol.SetArrayPicked(pickInfo.pickInstances);objectClassSol.ClearElseInstances()}if(pickInfo.pushCleanSolDynamic)extraPopSolModifiers= +eventSheetManager.PushCleanSolDynamic(combinedSolModifiers)}const frame=eventStack.Push(this);if(isCopyPicked)frame.SetDynamicSolModifiers(combinedSolModifiers);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop(); +if(extraPopSolModifiers!==null)eventSheetManager.PopSol(extraPopSolModifiers);if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}*DebugRunAsFunctionCall(combinedSolModifiers,parameters,isCopyPicked,pickInfo){let ret;let asyncId;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const hasAnySolModifiers=combinedSolModifiers.length>0;let extraPopSolModifiers=null;const runtime=this._runtime;const eventStack=this._eventStack; +const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;this._EvaluateFunctionCallParameters(eventSheetManager,parameters,isRecursive);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers);else eventSheetManager.PushCleanSol(combinedSolModifiers);if(pickInfo!==null){if(pickInfo.copyFromObjectClass){const copyFromSol=isCopyPicked?pickInfo.copyFromObjectClass.GetCurrentSol():pickInfo.copyFromObjectClass.GetSolStack().GetOneBelowCurrentSol(); +const copyToSol=pickInfo.copyToObjectClass.GetCurrentSol();copyToSol.SetArrayPicked(copyFromSol.GetInstances());copyToSol.ClearElseInstances();if(!isCopyPicked)pickInfo.copyToObjectClass.ApplySolToContainer()}else if(pickInfo.pickObjectClass){const objectClassSol=pickInfo.pickObjectClass.GetCurrentSol();objectClassSol.SetArrayPicked(pickInfo.pickInstances);objectClassSol.ClearElseInstances()}if(pickInfo.pushCleanSolDynamic)extraPopSolModifiers=eventSheetManager.PushCleanSolDynamic(combinedSolModifiers)}const frame= +eventStack.Push(this);if(isCopyPicked)frame.SetDynamicSolModifiers(combinedSolModifiers);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();yield*this._DebugRunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(extraPopSolModifiers!==null)eventSheetManager.PopSol(extraPopSolModifiers); +if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret}RunAsMappedFunctionCall(paramResults,isCopyPicked){const solModifiers=this.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push(); +this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame=eventStack.Push(this);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);this._RunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(paramResults, +isCopyPicked){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const solModifiers=this.GetSolModifiersIncludingParents();const hasAnySolModifiers=solModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(paramResults); +if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const frame=eventStack.Push(this);if(yield*this._DebugCheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);yield*this._DebugRunAndBlock(frame)}eventStack.Pop();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(solModifiers);eventSheetManager._DecTriggerDepth()}RunAsExpressionFunctionCall(combinedSolModifiers,isCopyPicked, +returnType,defaultReturnValue,...paramResults){let ret;let asyncId;const hasAnySolModifiers=combinedSolModifiers.length>0;const runtime=this._runtime;const eventStack=this._eventStack;const eventSheetManager=runtime.GetEventSheetManager();const triggerDepth=eventSheetManager._IncTriggerDepth();const isRecursive=triggerDepth>1;if(isRecursive)eventSheetManager.GetLocalVarStack().Push();if(paramResults.length>0)this._scopeParent.SetFunctionParameters(paramResults);if(hasAnySolModifiers)if(isCopyPicked)eventSheetManager.PushCopySol(combinedSolModifiers); +else eventSheetManager.PushCleanSol(combinedSolModifiers);const frame=eventStack.Push(this);frame.InitCallFunctionExpression(returnType,defaultReturnValue);eventStack.PushExpFunc(frame);runtime.SetDebuggingEnabled(false);if(this._CheckParentsOKToRun(frame)){frame.SetCurrentEvent(this);const isAsync=this._scopeParent.IsAsync();if(isAsync)[asyncId,ret]=this._scopeParent.StartAsyncFunctionCall();this._RunAndBlock(frame);if(isAsync)this._scopeParent.MaybeFinishAsyncFunctionCall(asyncId)}runtime.SetDebuggingEnabled(true); +eventStack.Pop();eventStack.PopExpFunc();if(isRecursive)eventSheetManager.GetLocalVarStack().Pop();if(hasAnySolModifiers)eventSheetManager.PopSol(combinedSolModifiers);eventSheetManager._DecTriggerDepth();return ret||frame.GetFunctionReturnValue()}}; + +} + +// events/eventScript.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[];let hadUserScriptException=false; +C3.EventScript=class EventScript extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const runtime=eventSheet.GetRuntime();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;const userMethod=runtime.GetObjectReference(data[1]);this._func=userMethod;this._displayNumber=data[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber); +this._debugData=runtime.IsDebug()?{isBreakpoint:data[3][0],isBreakable:data[3][1]}:null}static Create(eventSheet,parent,data){return C3.New(C3.EventScript,eventSheet,parent,data)}_PostInit(){const userMethod=this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&& +this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(b){this._debugData.isBreakpoint=!!b}IsElseBlock(){return false}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetSolModifiersIncludingParents(){if(this._parent)return this._parent.GetSolModifiersIncludingParents();else return EMPTY_SOL_MODIFIERS}Run(frame){frame.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(err){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`, +"font-size: 1.2em; font-weight: bold;",err);if(self.C3Debugger)self.C3Debugger._SetLastErrorScript(this);if(!hadUserScriptException){console.info(`%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()`,"font-weight: bold; text-decoration: underline","","font-weight: bold");hadUserScriptException=true}}}*DebugRun(frame){frame.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(frame)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&& +!this._runtime.DebugBreakNext()}static HadUserScriptException(){return hadUserScriptException}static SetHadUserScriptException(){hadUserScriptException=true}}; + +} + +// events/functionBlock.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.FunctionBlock=class FunctionBlock extends C3.DefendedBase{constructor(eventSheet,parent,data){super();this._eventSheet=eventSheet;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._functionType=0;this._functionName="";this._returnType=0;this._functionParameters=[];this._isEnabled=true;this._aceName="";this._objectClass=null;this._hasOverrides=false;this._innerLocalVariables=[];this._isCopyPicked=false;this._isAsync=false;this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map; +this._eventBlock=C3.EventBlock.Create(eventSheet,parent,data);this._eventBlock._SetScopeParent(this)}InitFunctionBlock(funcData){this._functionType=0;this._functionName=funcData[0];this._returnType=funcData[1];this._functionParameters=funcData[2].map(paramData=>C3.EventVariable.Create(this._eventSheet,this,paramData));this._isEnabled=funcData[3];this._isAsync=funcData[4];this._isCopyPicked=funcData[5]}InitCustomACEBlock(funcData){this._functionType=1;this._aceName=funcData[1];this._objectClass=this._runtime.GetObjectClassByIndex(funcData[2]); +this._eventBlock._AddSolModifier(this._objectClass);this._functionName=this._objectClass.GetName()+"."+this._aceName;this._returnType=funcData[3];this._functionParameters=funcData[4].map(paramData=>C3.EventVariable.Create(this._eventSheet,this,paramData));this._isEnabled=funcData[5];this._isAsync=funcData[6];this._isCopyPicked=funcData[7];this._objectClass.AddCustomAction(this)}static CreateFunctionBlock(eventSheet,parent,data){const ret=C3.New(C3.FunctionBlock,eventSheet,parent,data);const funcData= +data[1];ret.InitFunctionBlock(funcData);return ret}static CreateCustomACEBlock(eventSheet,parent,data){const ret=C3.New(C3.FunctionBlock,eventSheet,parent,data);const funcData=data[1];ret.InitCustomACEBlock(funcData);return ret}_CheckOverrideState(){if(this._objectClass&&this._objectClass.IsFamily())for(const objectType of this._objectClass.GetFamilyMembers())if(objectType.HasOwnCustomActionByName(this._aceName)){this._hasOverrides=true;break}}_PostInit(){for(const fp of this._functionParameters)fp._PostInit(); +this._eventBlock._PostInit(false)}GetFunctionType(){return this._functionType}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(localVariable){this._innerLocalVariables.push(localVariable)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(parameters){const functionParameters=this._functionParameters;for(let i= +0,len=functionParameters.length;ip.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetACEName(){return this._aceName}HasCustomACEOverrides(){return this._hasOverrides}GetReturnType(){return this._returnType}GetObjectClass(){return this._objectClass}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null; +case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsCopyPicked(){return this._isCopyPicked}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const asyncId=this._nextAsyncId++;this._currentAsyncId=asyncId;let resolve;const promise=new Promise(r=>resolve=r);this._asyncMap.set(asyncId,{resolve,pauseCount:0});return[asyncId,promise]}MaybeFinishAsyncFunctionCall(asyncId){const info=this._asyncMap.get(asyncId);if(info.pauseCount===0){info.resolve();this._asyncMap.delete(asyncId)}this._currentAsyncId= +-1}PauseCurrentAsyncFunction(){const info=this._asyncMap.get(this._currentAsyncId);info.pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(asyncId){this._currentAsyncId=asyncId;const info=this._asyncMap.get(asyncId);info.pauseCount--}RunAsFamilyCustomActionWithOverrides(combinedSolModifiers,parameters){const objectTypeMap=new Map;const familyInstances=[];for(const inst of this._objectClass.GetCurrentSol().GetInstances()){const objectType=inst.GetObjectClass();if(objectType.HasOwnCustomActionByName(this._aceName)){const arr= +objectTypeMap.get(objectType);if(Array.isArray(arr))arr.push(inst);else objectTypeMap.set(objectType,[inst])}else familyInstances.push(inst)}if(familyInstances.length>0)this._eventBlock.RunAsFunctionCall(combinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:familyInstances});if(objectTypeMap.size>0)for(const [objectType,arr]of objectTypeMap){const eventBlock=objectType.GetOwnCustomActionByName(this._aceName).GetEventBlock();const allCombinedSolModifiers= +[...(new Set([...combinedSolModifiers,...eventBlock.GetSolModifiers()]))];eventBlock.RunAsFunctionCall(allCombinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:objectType,pickInstances:arr})}}*DebugRunAsFamilyCustomActionWithOverrides(combinedSolModifiers,parameters){const objectTypeMap=new Map;const familyInstances=[];for(const inst of this._objectClass.GetCurrentSol().GetInstances()){const objectType=inst.GetObjectClass();if(objectType.HasOwnCustomActionByName(this._aceName)){const arr= +objectTypeMap.get(objectType);if(Array.isArray(arr))arr.push(inst);else objectTypeMap.set(objectType,[inst])}else familyInstances.push(inst)}if(familyInstances.length>0)yield*this._eventBlock.DebugRunAsFunctionCall(combinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:this._objectClass,pickInstances:familyInstances});if(objectTypeMap.size>0)for(const [objectType,arr]of objectTypeMap){const eventBlock=objectType.GetOwnCustomActionByName(this._aceName).GetEventBlock();const allCombinedSolModifiers= +[...(new Set([...combinedSolModifiers,...eventBlock.GetSolModifiers()]))];yield*eventBlock.DebugRunAsFunctionCall(allCombinedSolModifiers,parameters,this._isCopyPicked,{pickObjectClass:objectType,pickInstances:arr})}}}; + +} + +// events/eventVariable.js +{ +'use strict';const C3=self.C3;const EMPTY_SOL_MODIFIERS=[]; +C3.EventVariable=class EventVariable extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._localVarStack=eventSheetManager.GetLocalVarStack();this._name=data[1];this._type=data[2];this._initialValue=data[3];this._isStatic=!!data[4];this._isConstant=!!data[5];this._isFunctionParameter=parent instanceof +C3.FunctionBlock;this._sid=data[6];this._jsPropName=this._runtime.GetJsPropName(data[8]);this._scriptSetter=v=>this.SetValue(v);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;if(this.IsBoolean())this._value=this._value?1:0;if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this._localIndex=eventSheetManager._GetNextLocalVarIndex(this);eventSheetManager._RegisterEventVariable(this)}static Create(eventSheet, +parent,data){return C3.New(C3.EventVariable,eventSheet,parent,data)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const functionBlock=this._eventSheetManager.FindFirstFunctionBlockParent(this);if(functionBlock)functionBlock._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return this._type=== +0}IsString(){return this._type===1}IsBoolean(){return this._type===2}IsElseBlock(){return false}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}Run(frame){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant())this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return true}*DebugRun(frame){this.Run(frame)}SetValue(v){if(this.IsNumber()){if(typeof v!=="number")v=parseFloat(v)}else if(this.IsString()){if(typeof v!=="string")v=v.toString()}else if(this.IsBoolean())v= +v?1:0;if(this._hasSingleValue)this._value=v;else this._localVarStack.GetCurrent()[this._localIndex]=v}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let ret=this.GetValue();if(this.IsBoolean())ret=!!ret;return ret}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:false,enumerable:true,get:this._scriptGetter,set:this._scriptSetter}}}; + +} + +// events/eventInclude.js +{ +'use strict';const C3=self.C3;const assert=self.assert;const EMPTY_SOL_MODIFIERS=[]; +C3.EventInclude=class EventInclude extends C3.DefendedBase{constructor(eventSheet,parent,data){super();const eventSheetManager=eventSheet.GetEventSheetManager();this._eventSheet=eventSheet;this._eventSheetManager=eventSheetManager;this._runtime=eventSheet.GetRuntime();this._parent=parent;this._includeSheet=null;this._includeSheetName=data[1];this._isActive=true}static Create(eventSheet,parent,data){return C3.New(C3.EventInclude,eventSheet,parent,data)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName); +this._eventSheet._AddShallowInclude(this);let p=this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup())p._AddContainedInclude(this);p=p.GetParent()}this.UpdateActive();if(this._runtime.IsDebug())this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return EMPTY_SOL_MODIFIERS}GetIncludeSheet(){return this._includeSheet}Run(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses(); +if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);this._includeSheet.Run();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}*DebugRun(frame){const pushSol=!!this.GetParent();const allObjectClasses=this._runtime.GetAllObjectClasses();if(pushSol)this._eventSheetManager.PushCleanSol(allObjectClasses);yield*this._includeSheet.DebugRun();if(pushSol)this._eventSheetManager.PopSol(allObjectClasses)}DebugCanRunFast(){return false}IsActive(){return this._isActive}UpdateActive(){let p= +this.GetParent();while(p){if(p instanceof C3.EventBlock&&p.IsGroup()&&!p.IsGroupActive()){this._isActive=false;return}p=p.GetParent()}this._isActive=true}}; + +} + +// events/expNode.js +{ +'use strict';const C3=self.C3;const assert=self.assert;C3.ExpNode=class ExpNode extends C3.DefendedBase{constructor(owner){super();this._owner=owner;this._runtime=owner.GetRuntime()}_PostInit(){}static CreateNode(owner,data){const type=data[0];const Classes=[BehaviorExpressionNode,ObjectExpressionNode,InstVarExpressionNode,EventVarExpNode,SystemExpressionExpNode,CallFunctionExpressionExpNode];return C3.New(Classes[type],owner,data)}}; +class SystemExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(data[1]);if(this._func===C3.Plugins.System.Exps.random||this._func===C3.Plugins.System.Exps.choose)this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}} +class CallFunctionExpressionExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._functionBlock=null;this._functionName=data[1];this._owner.SetVariesPerInstance()}_PostInit(){const eventSheetManager=this._runtime.GetEventSheetManager();this._functionBlock=eventSheetManager.GetFunctionBlockByName(this._functionName);this._functionName=null;const myEventBlock=this._owner.GetEventBlock();const callEventBlock=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...(new Set([...myEventBlock.GetSolModifiersIncludingParents(), +...callEventBlock.GetSolModifiersIncludingParents()]))];this._combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const functionBlock=this._functionBlock;if(functionBlock.IsEnabled()){const callEventBlock=functionBlock.GetEventBlock();return C3.EventBlock.prototype.RunAsExpressionFunctionCall.bind(callEventBlock,this._combinedSolModifiers,functionBlock.IsCopyPicked(),functionBlock.GetReturnType(),functionBlock.GetDefaultReturnValue())}else{const defaultReturnValue= +functionBlock.GetDefaultReturnValue();return()=>defaultReturnValue}}}function WrapIndex(index,len){if(index>=len)return index%len;else if(index<0){if(index<=-len)index%=len;if(index<0)index+=len;return index}else return index} +class ObjectExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._func=this._runtime.GetObjectReference(data[2]);this._returnsString=!!data[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}ExpObject_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len=== +0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);return this._func.apply(instances[index].GetSdkInstance(),args)}} +class InstVarExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._varIndex=data[3];this._returnsString=!!data[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const instances=this._objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);return instances[index]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);const inst=instances[index];const offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}ExpInstVar_InstExpr(instIndex){const objectClass=this._objectClass;const instances=objectClass.GetInstances(); +const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyInstanceVariableOffset(objectClass.GetFamilyIndex());return inst._GetInstanceVariableValueUnchecked(this._varIndex+offset)}} +class BehaviorExpressionNode extends C3.ExpNode{constructor(owner,data){super(owner);this._objectClass=this._runtime.GetObjectClassByIndex(data[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2]);this._func=this._runtime.GetObjectReference(data[3]);this._returnsString=!!data[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...args){const objectClass= +this._objectClass;const instances=objectClass.GetCurrentSol().GetExpressionInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(this._owner.GetSolIndex(),len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}ExpBehavior_InstExpr(instIndex,...args){const objectClass=this._objectClass;const instances=objectClass.GetInstances();const len=instances.length;if(len===0)return this._returnsString?"":0;const index=WrapIndex(instIndex,len);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(objectClass);const inst=instances[index];let offset=0;if(objectClass.IsFamily())offset=inst.GetObjectClass().GetFamilyBehaviorOffset(objectClass.GetFamilyIndex());return this._func.apply(inst.GetBehaviorInstances()[this._behaviorIndex+ +offset].GetSdkInstance(),args)}}class EventVarExpNode extends C3.ExpNode{constructor(owner,data){super(owner);this._eventVar=null;this._eventVarSid=data[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}; + +} + +// events/parameter.js +{ +'use strict';const C3=self.C3;const assert=self.assert; +C3.Parameter=class Parameter extends C3.DefendedBase{constructor(owner,type,index){super();this._owner=owner;this._index=index;this._type=type;this.Get=null;this._variesPerInstance=false;this._isConstant=false}static Create(owner,data,index){const type=data[0];const Classes=[ExpressionParameter,StringExpressionParameter,FileParameter,ComboParameter,ObjectParameter,LayerExpressionParameter,LayoutParameter,ExpressionParameter,ComboParameter,ComboParameter,InstVarParameter,EventVarParameter,FileParameter, +VariadicParameter,StringExpressionParameter,TimelineParameter,BooleanParameter,FunctionParameter,EaseParameter,TilemapBrushParameter,TemplateExpressionParameter];return C3.New(Classes[type],owner,type,index,data)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=true}_MaybeVaryFor(objectClass){if(this._variesPerInstance)return;if(!objectClass)return;if(!objectClass.GetPlugin().IsSingleGlobal())this._variesPerInstance=true}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}IsObjectParameter(){return this._type=== +4}};function GetExpressionFunc(number){const ret=self.C3_ExpressionFuncs[number];if(!ret)throw new Error("invalid expression number");return ret} +class ExpressionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._solIndex=0;const expData=data[1];this._expressionNumber=expData[0];this._numberedNodes=[];this._expressionFunc=null;for(let i=1,len=expData.length;i=this._numberedNodes.length)throw new RangeError("invalid numbered node"); +return this._numberedNodes[i]}_PostInit(){for(const node of this._numberedNodes)node._PostInit();const func=GetExpressionFunc(this._expressionNumber);if(this._numberedNodes.length)this._expressionFunc=func(this);else this._expressionFunc=func}GetSolIndex(){return this._solIndex}GetExpression(solIndex){this._solIndex=solIndex;return this._expressionFunc()}} +class StringExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetStringExpression;if(type===14){this.GetEventBlock().SetAllSolModifiers();if(this._owner instanceof C3.Action)this.GetEventBlock().SetSolWriterAfterCnds()}}GetStringExpression(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();if(typeof ret==="string")return ret;else return""}_GetFastTriggerValue(){return GetExpressionFunc(this._expressionNumber)()}} +class LayerExpressionParameter extends ExpressionParameter{constructor(owner,type,index,data){super(owner,type,index,data);this.Get=this.GetLayer;this._isConstant=false}GetLayer(solIndex){this._solIndex=solIndex;const ret=this._expressionFunc();const layout=this.GetRuntime().GetCurrentLayout();return layout.GetLayer(ret)}} +class ComboParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._combo=data[1];this.Get=this.GetCombo;this._isConstant=true}GetCombo(){return this._combo}}class BooleanParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._bool=data[1];this.Get=this.GetBoolean;this._isConstant=true}GetBoolean(){return this._bool}} +class ObjectParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._objectClass=this.GetRuntime().GetObjectClassByIndex(data[1]);this.Get=this.GetObjectClass;const eventBlock=this.GetEventBlock();eventBlock._AddSolModifier(this._objectClass);if(this._owner instanceof C3.Action)eventBlock.SetSolWriterAfterCnds();else if(eventBlock.GetParent())eventBlock.GetParent().SetSolWriterAfterCnds();this._isConstant=true}GetObjectClass(){return this._objectClass}} +class LayoutParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(data[1]);this.Get=this.GetLayout;this._isConstant=true}GetLayout(){return this._layout}} +class TimelineParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(data[1]);this.Get=this.GetTimeline;this._isConstant=true}GetTimeline(){return this._timeline}}class FileParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._fileInfo=data[1];this.Get=this.GetFile;this._isConstant=true}GetFile(){return this._fileInfo}} +class InstVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._instVarIndex=data[1];const ownerObjectClass=this._owner.GetObjectClass();if(this._owner instanceof C3.Condition&&this._owner.IsStatic()){this.Get=this.GetInstanceVariable;this._isConstant=true}else if(ownerObjectClass&&ownerObjectClass.IsFamily()){this.Get=this.GetFamilyInstanceVariable;this.SetVariesPerInstance()}else{this.Get=this.GetInstanceVariable;this._isConstant=true}}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(solIndex){solIndex= +solIndex||0;const familyType=this._owner.GetObjectClass();const sol=familyType.GetCurrentSol();const instances=sol.GetInstances();let realType=null;if(instances.length)realType=instances[solIndex%instances.length].GetObjectClass();else if(sol.HasAnyElseInstances()){const elseInstances=sol.GetElseInstances();realType=elseInstances[solIndex%elseInstances.length].GetObjectClass()}else if(familyType.GetInstanceCount()>0){const familyInstances=familyType.GetInstances();realType=familyInstances[solIndex% +familyInstances.length].GetObjectClass()}else return 0;return this._instVarIndex+realType.GetFamilyInstanceVariableOffset(familyType.GetFamilyIndex())}} +class EventVarParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._eventVarSid=data[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=true}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}} +class FunctionParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._functionBlockName=data[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=true}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}} +class VariadicParameter extends C3.Parameter{constructor(owner,type,index,data){super(owner,type,index);this._subParams=[];this._variadicRet=[];this._isConstant=true;for(let i=1,len=data.length;i0;this._isFastTrigger=data[3]===2;this._isLooping=!!data[4];this._isInverted=!!data[5];this._isStatic=!!data[6];this._sid=data[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._objectClass=null;this._behaviorType=null;this._behaviorIndex= +-1;this._systemPlugin=null;this.Run=noop;this.DebugRun=noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:data[8][0],canDebug:data[8][1]}:null;if(data[0]===-1)this._systemPlugin=this._runtime.GetSystemPlugin();else{this._objectClass=this._runtime.GetObjectClassByIndex(data[0]);if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex= +this._objectClass.GetBehaviorIndexByName(data[2])}if(this._eventBlock.GetParent())this._eventBlock.GetParent().SetSolWriterAfterCnds()}if(data.length===10){let paramData=data[9];for(let data of paramData){this._parameters.push(C3.Parameter.Create(this,data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(eventBlock,data, +index){return C3.New(C3.Condition,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance=true}if(this._isFastTrigger){this.Run=this._RunFastTrigger;this.DebugRun=this._DebugRunFastTrigger}else if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this._isStatic){this.Run= +this._RunStatic;this.DebugRun=this._DebugRunStatic}else{this.Run=this._RunObject;this.DebugRun=this._DebugRunObject}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin=this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const isInverted=this._isInverted;const parameters=this._parameters;if(parameters.length===0){const boundFunc=plugin._GetBoundACEMethod(func,bindThis);if(isInverted)this.Run=function RunSingleCnd_0param(){return C3.xor(boundFunc(),isInverted)};else this.Run=boundFunc}else if(parameters.length===1){const param0=parameters[0];if(!isInverted&¶m0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc= +plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_1param(){return C3.xor(boundFunc(param0.Get(0)),isInverted)}}}else if(parameters.length===2){const param0=parameters[0];const param1=parameters[1];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_2params(){return C3.xor(boundFunc(param0.Get(0), +param1.Get(0)),isInverted)}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(!isInverted&¶m0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func,bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleCnd_3params(){return C3.xor(boundFunc(param0.Get(0),param1.Get(0),param2.Get(0)),isInverted)}}}else this.Run= +fallbackMethod}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsStatic(){return this._isStatic}IsBreakpoint(){return this._debugData.isBreakpoint}IsSystemCondition(){return!!this._systemPlugin}GetFirstObjectParameterObjectClass(){for(const p of this._parameters)if(p.IsObjectParameter())return p.GetObjectClass(); +return null}_SetBreakpoint(b){this._debugData.isBreakpoint=!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData=new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters, +results);return C3.xor(this._func.apply(this._systemPlugin,results),this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._systemPlugin,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunSingleGlobal(){const results=this._results;EvalParams(this._parameters,results); +const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return C3.xor(this._func.apply(inst,results),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);const inst=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();let ret=this._func.apply(inst,results);if(C3.IsIterator(ret))ret=yield*ret;return C3.xor(ret,this._isInverted)}else return this.Run()}_RunFastTrigger(){return true}*_DebugRunFastTrigger(){if(this.IsBreakpoint()|| +this._runtime.DebugBreakNext())yield this;return true}_RunStatic(){const results=this._results;EvalParams(this._parameters,results);const ret=this._func.apply(this._behaviorType||this._objectClass,results);this._objectClass.ApplySolToContainer();return ret}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters,results);let ret=this._func.apply(this._behaviorType||this._objectClass, +results);if(C3.IsIterator(ret))ret=yield*ret;this._objectClass.ApplySolToContainer();return ret}else return this.Run()}_RunObject(){const parameters=this._parameters;const results=this._results;const sol=this._objectClass.GetCurrentSol();for(let i=0,len=parameters.length;i=0;const allInstances=objectClass.GetInstances(); +const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;sol.ClearArrays();for(let i=0,len=allInstances.length;i=0;const paramsVary=this._anyParamVariesPerInstance;const results=this._results;const func=this._func;const isInverted=this._isInverted;const isInOrBlock=this._isInOrBlock&&!this._isTrigger;const solInstances=sol._GetOwnInstances();const solElseInstances=sol._GetOwnElseInstances();const isUsingElseInstances=isInOrBlock&&!this._eventBlock.IsFirstConditionOfType(this);const arr=isUsingElseInstances?solElseInstances:solInstances;let k=0;let isAnyTrue=false;for(let i=0, +len=arr.length;i=0;const results=this._results;const func=this._func;const isInverted=this._isInverted;for(let i=0,len=solInstances.length;i[arr[0].GetUID(),arr[1].GetUID(),arr[2]]);ex[k]=saveVal}return{"ex":ex}}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}if(!o)return;const runtime=this._runtime;const ex=o["ex"];if(ex){const map=this.GetSavedDataMap();map.clear(); +for(const [k,v]of Object.entries(ex)){let loadVal=v;if(k==="collmemory")loadVal=C3.New(C3.PairMap,v.map(arr=>[runtime.GetInstanceByUID(arr[0]),runtime.GetInstanceByUID(arr[1]),arr[2]]).filter(arr=>arr[0]&&arr[1]));map.set(k,loadVal)}}}}; + +} + +// events/action.js +{ +'use strict';const C3=self.C3;const assert=self.assert;function EvalParams(parameters,results){for(let i=0,len=parameters.length;i=4?data[3]:-1;this._actionType=data.length>=5?data[4]&255:0;this._flags=data.length>=5?data[4]>>8:0;this._func=null;this._objectClass=null;this._behaviorType=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._callCustomAceObjectClass=null;this._callEventBlock= +null;this.Run=noop;this.DebugRun=noop;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=false;this._savedData=null;this._unsavedData=null;const isScript=data[0]===-3;const debugInfo=isScript?data[2]:data[5];this._debugData=runtime.IsDebug()||isScript?{isBreakpoint:debugInfo[0],canDebug:debugInfo[1],index:debugInfo[2]}:null;if(data[0]===-1){this._systemPlugin=runtime.GetSystemPlugin();this._func=runtime.GetObjectReference(data[1])}else if(data[0]===-2)this._callFunctionName=data[1]; +else if(isScript){const userMethod=runtime.GetObjectReference(data[1]);this._func=userMethod;this.Run=this.RunUserScript;this.DebugRun=this.DebugRunUserScript;this._actionType=1}else{this._objectClass=runtime.GetObjectClassByIndex(data[0]);if(this._flags&FLAG_CUSTOM_ACE){this._callFunctionName=data[1];this._callCustomAceObjectClass=runtime.GetObjectClassByIndex(data[2])}else{if(data[2]){this._behaviorType=this._objectClass.GetBehaviorTypeByName(data[2]);this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(data[2])}this._func= +runtime.GetObjectReference(data[1])}}if(data.length===7){const paramData=data[6];for(const data of paramData){this._parameters.push(C3.Parameter.Create(this,data,this._parameters.length));this._results.push(0)}}if(this._parameters.length===0){this._parameters=EMPTY_PARAMS_ARRAY;this._results=EMPTY_PARAMS_ARRAY}if(this.CanPickAnyObjectClass()){this._eventBlock.SetAllSolModifiers();this._eventBlock.SetSolWriterAfterCnds()}this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(eventBlock, +data,index){return C3.New(C3.Action,eventBlock,data,index)}_PostInit(){for(const param of this._parameters){param._PostInit();if(param.VariesPerInstance())this._anyParamVariesPerInstance=true}if(this._systemPlugin){this._SetSystemRunMethod();this.DebugRun=this._DebugRunSystem}else if(this._callFunctionName){if(this._flags&FLAG_CUSTOM_ACE)this._SetCallCustomActionRunMethod();else this._SetCallFunctionRunMethod();this._callFunctionName="";this._callCustomAceObjectClass=null}else if(this.Run===this.RunUserScript){const userMethod= +this._func;const localVars=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=userMethod.bind(null,this._runtime.GetIRuntime(),localVars)}else if(this._behaviorType)if(this.IsAsync()){this.Run=this._RunBehavior_Async;this.DebugRun=this._DebugRunBehavior_Async}else{this.Run=this._RunBehavior;this.DebugRun=this._DebugRunBehavior}else if(this._objectClass.GetPlugin().IsSingleGlobal()){this._SetSingleGlobalRunMethod();this.DebugRun=this._DebugRunSingleGlobal}else if(this.IsAsync()){this.Run= +this._RunObject_Async;this.DebugRun=this._DebugRunObject_Async}else if(this.CallBeforeAfterHooks()){this.Run=this._RunObject_BeforeAfterHooks;this.DebugRun=this._DebugRunObject_BeforeAfterHooks}else if(!this._parameters.length){this.Run=this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else if(this._parameters.every(p=>p.VariesPerInstance())){this.Run=this._RunObject_AllParamsVary;this.DebugRun=this._DebugRunObject_AllParamsVary}else if(this._anyParamVariesPerInstance){this.Run= +this._RunObject_SomeParamsVary;this.DebugRun=this._DebugRunObject_SomeParamsVary}else if(this._parameters.every(p=>p.IsConstant())){EvalParams(this._parameters,this._results);this.Run=this._RunObject_ParamsConst;this.DebugRun=this._DebugRunObject_ParamsConst}else{this.Run=this._RunObject_ParamsDontVary;this.DebugRun=this._DebugRunObject_ParamsDontVary}}_SetSystemRunMethod(){const plugin=this._systemPlugin;const bindThis=this._systemPlugin;this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSystem)}_SetSingleGlobalRunMethod(){const plugin= +this._objectClass.GetPlugin();const bindThis=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(plugin,bindThis,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const eventSheetManager=this._eventBlock.GetEventSheetManager();const functionBlock=eventSheetManager.GetFunctionBlockByName(this._callFunctionName);if(functionBlock.IsEnabled()){const isCopyPicked=(this._flags&FLAG_COPYPICKED)!==0;this._callEventBlock=functionBlock.GetEventBlock();let combinedSolModifiers= +[...(new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()]))];combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(combinedSolModifiers);const pickInfo=!functionBlock.IsCopyPicked()&&this._HasCopyPickedParent()?{pushCleanSolDynamic:true}:null;this.Run=C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,combinedSolModifiers,this._parameters,isCopyPicked,pickInfo);if(this._runtime.IsDebug()){const thiz= +this;this.DebugRun=function*DebugRunCallFunction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz;const ret=yield*thiz._callEventBlock.DebugRunAsFunctionCall(combinedSolModifiers,thiz._parameters,isCopyPicked,pickInfo);return ret}}else this.DebugRun=noopGenerator}else{this.Run=noop;this.DebugRun=noopGenerator}}_SetCallCustomActionRunMethod(){const eventSheetManager=this._eventBlock.GetEventSheetManager();const customAceBlock=eventSheetManager.GetCustomActionBlockByName(this._callCustomAceObjectClass, +this._callFunctionName);if(customAceBlock.IsEnabled()){const isCopyPicked=(this._flags&FLAG_COPYPICKED)!==0;this._callEventBlock=customAceBlock.GetEventBlock();let combinedSolModifiers=[...(new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents(),this._objectClass,customAceBlock.GetObjectClass()]))];combinedSolModifiers=eventSheetManager._DeduplicateSolModifierList(combinedSolModifiers);const isOTtoOT=!this._objectClass.IsFamily()&&!customAceBlock.GetObjectClass().IsFamily(); +const isOTtoFamily=!this._objectClass.IsFamily()&&customAceBlock.GetObjectClass().IsFamily();const isFamilyToFamily=this._objectClass.IsFamily();let pickInfo=null;if(!customAceBlock.IsCopyPicked()&&this._HasCopyPickedParent()){pickInfo=pickInfo||{};pickInfo.pushCleanSolDynamic=true}if(isOTtoFamily||!isCopyPicked){pickInfo=pickInfo||{};pickInfo.copyFromObjectClass=this._objectClass;pickInfo.copyToObjectClass=customAceBlock.GetObjectClass()}if(isOTtoOT||isOTtoFamily||isFamilyToFamily&&!customAceBlock.HasCustomACEOverrides())this.Run= +C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,combinedSolModifiers,this._parameters,isCopyPicked,pickInfo);else if(isFamilyToFamily)this.Run=C3.FunctionBlock.prototype.RunAsFamilyCustomActionWithOverrides.bind(customAceBlock,combinedSolModifiers,this._parameters);else;if(this._runtime.IsDebug()){const thiz=this;if(isOTtoOT||isOTtoFamily||isFamilyToFamily&&!customAceBlock.HasCustomACEOverrides())this.DebugRun=function*DebugRunCustomAction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz; +const ret=yield*thiz._callEventBlock.DebugRunAsFunctionCall(combinedSolModifiers,thiz._parameters,isCopyPicked,pickInfo);return ret};else if(isFamilyToFamily)this.DebugRun=function*DebugRunCustomAction(){if(thiz.IsBreakpoint()||thiz._runtime.DebugBreakNext())yield thiz;const ret=yield*customAceBlock.DebugRunAsFamilyCustomActionWithOverrides(combinedSolModifiers,thiz._parameters);return ret}}else this.DebugRun=noopGenerator}else{this.Run=noop;this.DebugRun=noopGenerator}}_SetRunMethodForBoundFunc(plugin, +bindThis,fallbackMethod){const func=this._func;const parameters=this._parameters;if(parameters.length===0)this.Run=plugin._GetBoundACEMethod(func,bindThis);else if(parameters.length===1){const param0=parameters[0];if(param0.IsConstant())this.Run=plugin._GetBoundACEMethod_1param(func,bindThis,param0.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_1param(){return boundFunc(param0.Get(0))}}}else if(parameters.length===2){const param0=parameters[0]; +const param1=parameters[1];if(param0.IsConstant()&¶m1.IsConstant())this.Run=plugin._GetBoundACEMethod_2params(func,bindThis,param0.Get(0),param1.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_2params(){return boundFunc(param0.Get(0),param1.Get(0))}}}else if(parameters.length===3){const param0=parameters[0];const param1=parameters[1];const param2=parameters[2];if(param0.IsConstant()&¶m1.IsConstant()&¶m2.IsConstant())this.Run=plugin._GetBoundACEMethod_3params(func, +bindThis,param0.Get(0),param1.Get(0),param2.Get(0));else{const boundFunc=plugin._GetBoundACEMethod(func,bindThis);this.Run=function RunSingleAct_3params(){return boundFunc(param0.Get(0),param1.Get(0),param2.Get(0))}}}else this.Run=fallbackMethod}GetSID(){return this._sid}IsAsync(){return this._actionType===1}CanBailOut(){return this._actionType===2}CallBeforeAfterHooks(){return this._actionType===3}CanPickAnyObjectClass(){return(this._flags&FLAG_CANPICKANYOBJECTCLASS)!==0}HasReturnType(){return this.IsAsync()|| +this.CanBailOut()}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}_HasCopyPickedParent(){let parent=this._eventBlock;do{if(parent instanceof C3.FunctionBlock&&parent.IsCopyPicked())return true;parent=parent.GetScopeParent()}while(parent);return false}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(b){this._debugData.isBreakpoint=!!b;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&& +!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){if(!this._savedData)this._savedData=new Map;return this._savedData}GetUnsavedDataMap(){if(!this._unsavedData)this._unsavedData=new Map;return this._unsavedData}_RunSystem(){const results=this._results;EvalParams(this._parameters,results);return this._func.apply(this._systemPlugin,results)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results= +this._results;EvalParams(this._parameters,results);const ret=yield*this._func.apply(this._systemPlugin,results);return ret}else return this.Run()}_RunSingleGlobal(){const results=this._results;EvalParams(this._parameters,results);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const results=this._results;EvalParams(this._parameters, +results);const ret=yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),results);return ret}else return this.Run()}_RunObject_ParamsConst(){const results=this._results;const instances=this._objectClass.GetCurrentSol().GetInstances();for(let i=0,len=instances.length;ilayout.GetWidth()||bbox.getTop()>layout.GetHeight()} +function PickDistance(which,x,y){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let wi=inst.GetWorldInfo();let pickme=inst;let dist2=C3.distanceSquared(wi.GetX(),wi.GetY(),x,y);for(let i=1,len=instances.length;idist2){dist2=d2;pickme=inst}}sol.PickOne(pickme);return true} +function SetX(x){const wi=this.GetWorldInfo();if(wi.GetX()===x)return;wi.SetX(x);wi.SetBboxChanged()}function SetY(y){const wi=this.GetWorldInfo();if(wi.GetY()===y)return;wi.SetY(y);wi.SetBboxChanged()}function SetPos(x,y){const wi=this.GetWorldInfo();if(wi.EqualsXY(x,y))return;wi.SetXY(x,y);wi.SetBboxChanged()} +function SetPosToObject(objectClass,imgPt){if(!objectClass)return;const inst=objectClass.GetPairedInstance(this._inst);if(!inst)return;const [x,y]=inst.GetImagePoint(imgPt);const wi=this.GetWorldInfo();if(wi.GetX()===x&&wi.GetY()===y)return;wi.SetXY(x,y);wi.SetBboxChanged()}function MoveForward(dist){if(dist===0)return;const wi=this.GetWorldInfo();wi.OffsetXY(wi.GetCosAngle()*dist,wi.GetSinAngle()*dist);wi.SetBboxChanged()} +function MoveAtAngle(a,dist){if(dist===0)return;const wi=this.GetWorldInfo();a=C3.toRadians(a);wi.OffsetXY(Math.cos(a)*dist,Math.sin(a)*dist);wi.SetBboxChanged()}function GetX(){return this.GetWorldInfo().GetX()}function GetY(){return this.GetWorldInfo().GetY()}function GetDt(){return this._runtime.GetDt(this._inst)}function CompareWidth(cmp,w){return C3.compare(this.GetWorldInfo().GetWidth(),cmp,w)}function CompareHeight(cmp,h){return C3.compare(this.GetWorldInfo().GetHeight(),cmp,h)} +function SetWidth(w){const wi=this.GetWorldInfo();if(wi.GetWidth()===w)return;wi.SetWidth(w);wi.SetBboxChanged()}function SetHeight(h){const wi=this.GetWorldInfo();if(wi.GetHeight()===h)return;wi.SetHeight(h);wi.SetBboxChanged()}function SetSize(w,h){const wi=this.GetWorldInfo();if(wi.GetWidth()===w&&wi.GetHeight()===h)return;wi.SetSize(w,h);wi.SetBboxChanged()}function GetWidth(){return this.GetWorldInfo().GetWidth()}function GetHeight(){return this.GetWorldInfo().GetHeight()} +function GetBboxLeft(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function GetBboxTop(){return this.GetWorldInfo().GetBoundingBox().getTop()}function GetBboxRight(){return this.GetWorldInfo().GetBoundingBox().getRight()}function GetBboxBottom(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function GetBboxMidX(){const bbox=this.GetWorldInfo().GetBoundingBox();return(bbox.getLeft()+bbox.getRight())/2} +function GetBboxMidY(){const bbox=this.GetWorldInfo().GetBoundingBox();return(bbox.getTop()+bbox.getBottom())/2}function IsAngleWithin(within,a){return C3.angleDiff(this.GetWorldInfo().GetAngle(),C3.toRadians(a))<=C3.toRadians(within)}function IsAngleClockwiseFrom(a){return C3.angleClockwise(this.GetWorldInfo().GetAngle(),C3.toRadians(a))} +function IsBetweenAngles(a,b){const lower=C3.toRadians(a);const upper=C3.toRadians(b);const angle=this.GetWorldInfo().GetAngle();const obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)} +function SetAngle(a){const wi=this.GetWorldInfo();const newAngle=C3.clampAngle(C3.toRadians(a));if(isNaN(newAngle)||wi.GetAngle()===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function RotateClockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()+C3.toRadians(a));wi.SetBboxChanged()}function RotateCounterclockwise(a){if(isNaN(a)||a===0)return;const wi=this.GetWorldInfo();wi.SetAngle(wi.GetAngle()-C3.toRadians(a));wi.SetBboxChanged()} +function RotateTowardAngle(amt,target){const wi=this.GetWorldInfo();const a=wi.GetAngle();const newAngle=C3.angleRotate(a,C3.toRadians(target),C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function RotateTowardPosition(amt,x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const target=Math.atan2(dy,dx);const newAngle=C3.angleRotate(a,target,C3.toRadians(amt));if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()} +function SetTowardPosition(x,y){const wi=this.GetWorldInfo();const a=wi.GetAngle();const dx=x-wi.GetX();const dy=y-wi.GetY();const newAngle=Math.atan2(dy,dx);if(isNaN(newAngle)||a===newAngle)return;wi.SetAngle(newAngle);wi.SetBboxChanged()}function GetAngle(){return C3.toDegrees(this.GetWorldInfo().GetAngle())}function CompareOpacity(cmp,x){return C3.compare(C3.roundToDp(this.GetWorldInfo().GetOpacity()*100,6),cmp,x)}function IsVisible(){return this.GetWorldInfo().IsVisible()} +function SetVisible(v){const wi=this.GetWorldInfo();if(v===2)v=!wi.IsVisible();else v=v!==0;if(wi.IsVisible()===v)return;wi.SetVisible(v);this._runtime.UpdateRender()}function SetOpacity(o){const newOpacity=C3.clamp(o/100,0,1);const wi=this.GetWorldInfo();if(wi.GetTransformWithParentOpacity()){if(wi._GetSceneGraphInfo().GetOwnOpacity()===newOpacity)return}else if(wi.GetOpacity()===newOpacity)return;wi.SetOpacity(newOpacity);this._runtime.UpdateRender()} +function SetDefaultColor(rgb){tempColor.setFromRgbValue(rgb);const wi=this.GetWorldInfo();if(wi.GetUnpremultipliedColor().equalsIgnoringAlpha(tempColor))return;wi.SetUnpremultipliedColor(tempColor);this._runtime.UpdateRender()}function GetColor(){const c=this.GetWorldInfo().GetUnpremultipliedColor();return C3.PackRGBAEx(c.getR(),c.getG(),c.getB(),c.getA())}function GetOpacity(){return C3.roundToDp(this.GetWorldInfo().GetOpacity()*100,6)} +function IsOnLayer(layer){if(!layer)return false;return this.GetWorldInfo().GetLayer()===layer} +function PickTopBottom(which){const sol=this.GetCurrentSol();const instances=sol.GetInstances();if(!instances.length)return false;let inst=instances[0];let pickme=inst;for(let i=1,len=instances.length;ipickmeLayerIndex||instLayerIndex===pickmeLayerIndex&&instWi.GetZIndex()> +pickmeWi.GetZIndex())pickme=inst}else if(instLayerIndexCollMemory_RemoveInstance(collMemory,e.instance))}const lsol= +ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol();const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;lCollMemory_RemoveInstance(collMemory,e.instance))}const lsol=ltype.GetCurrentSol();const rsol=rtype.GetCurrentSol(); +const linstances=lsol.GetInstances();let rinstances=null;for(let l=0;l0)parentInstances=parentInstances.concat(parentInstsPendingCreate)}if(parentInstances.length=== +0)return false;const parentInstancesSet=new Set(parentInstances);const pickParents=new Set;for(let i=0,len=myInstances.length;i0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=new Set;for(let i=0,len=myInstances.length;i0)childInstances=childInstances.concat(childInstsPendingCreate)}if(childInstances.length=== +0)return false;const childInstancesSet=new Set(childInstances);const pickChildren=[];for(let i=0,len=myInstances.length;ibestVal){bestVal=v;pickInst=inst}}sol.PickOne(pickInst); +return true}function PickByUID(uid){if(this._runtime.GetCurrentCondition().IsInverted())return PickByUID_Inverted(this,uid);else return PickByUID_Normal(this,uid)} +function PickByUID_Normal(objectClass,uid){const inst=objectClass.GetRuntime().GetInstanceByUID(uid);if(!inst)return false;const sol=objectClass.GetCurrentSol();if(!sol.IsSelectAll()&&!sol._GetOwnInstances().includes(inst))return false;if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass)){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}}else if(inst.GetObjectClass()===objectClass){sol.PickOne(inst);objectClass.ApplySolToContainer();return true}return false} +function PickByUID_Inverted(objectClass,uid){const sol=objectClass.GetCurrentSol();if(sol.IsSelectAll()){sol._SetSelectAll(false);sol.ClearArrays();const instances=objectClass.GetInstances();for(let i=0,len=instances.length;iv.GetValue());if(functionBlock.IsAsync())this._asyncId=functionBlock.PauseCurrentAsyncFunction()}for(const objectClass of allObjectClasses){const sol= +objectClass.GetCurrentSol();if(sol.IsSelectAll()&&!this._event.HasSolModifier(objectClass))continue;this._solModifiers.push(objectClass);this._sols.set(objectClass,C3.New(C3.SolState,sol))}const dynamicSolModifiersSet=eventSheetManager.GetDynamicSolModifiersSet();this._dynamicSolModifiers=dynamicSolModifiersSet.size>0?dynamicSolModifiersSet:null}InitTimer(seconds){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+seconds}InitSignal(tag){this._type="signal"; +this._Init();this._signalTag=tag.toLowerCase()}InitPromise(p){this._type="promise";this._Init();p.then(()=>this.SetSignalled()).catch(err=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",err);this.SetSignalled()})}IsTimer(){return this._type==="timer"}IsSignal(){return this._type==="signal"}IsPromise(){return this._type==="promise"}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=true}_ShouldRun(){if(this.IsTimer())return this._time<= +this._eventSheetManager.GetRuntime().GetGameTime();else return this.IsSignalled()}_RestoreState(frame){frame._Restore(this._event,this._actIndex);for(const [objectClass,solState]of this._sols.entries()){const sol=objectClass.GetCurrentSol();solState._Restore(sol)}if(this._dynamicSolModifiers)frame.SetDynamicSolModifiers([...this._dynamicSolModifiers]);const callingFunctionBlock=this._callingFunctionBlock;if(callingFunctionBlock){callingFunctionBlock.SetFunctionParameters(this._functionParameters); +callingFunctionBlock._GetAllInnerLocalVariables().map((v,index)=>v.SetValue(this._functionInnerLocalVars[index]));if(callingFunctionBlock.IsAsync())callingFunctionBlock.ResumeAsyncFunction(this._asyncId)}}_Run(frame){this._RestoreState(frame);this._event._ResumeActionsAndSubEvents(frame);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease= +true}async _DebugRun(frame){this._RestoreState(frame);for(const breakEventObject of this._event._DebugResumeActionsAndSubEvents(frame))await this._eventSheetManager.GetRuntime().DebugBreak(breakEventObject);if(this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync())this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=true}ShouldRelease(){return this._shouldRelease}RemoveInstances(s){for(const solState of this._sols.values())solState.RemoveInstances(s)}_SaveToJson(){const sols= +{};const o={"t":this._time,"st":this._signalTag,"s":this._isSignalled,"ev":this._event.GetSID(),"sm":this._solModifiers.map(oc=>oc.GetSID()),"dsm":this._dynamicSolModifiers?[...this._dynamicSolModifiers].map(oc=>oc.GetSID()):null,"sols":sols};if(this._event._HasActionIndex(this._actIndex))o["act"]=this._event.GetActionAt(this._actIndex).GetSID();for(const [objectClass,solState]of this._sols)sols[objectClass.GetSID().toString()]=solState._SaveToJson();return o}static _CreateFromJson(eventSheetManager, +o){const runtime=eventSheetManager.GetRuntime();const event=eventSheetManager.GetEventBlockBySID(o["ev"]);if(!event)return null;let actIndex=0;if(o.hasOwnProperty("act")){const act=eventSheetManager.GetActionBySID(o["act"]);if(!act)return null;actIndex=act.GetIndex()}const sw=C3.New(C3.ScheduledWait,eventSheetManager);sw._time=o["t"];sw._type=sw._time===-1?"signal":"timer";sw._signalTag=o["st"];sw._isSignalled=o["s"];sw._event=event;sw._actIndex=actIndex;for(const sid of o["sm"]){const objectClass= +runtime.GetObjectClassBySID(sid);if(objectClass)sw._solModifiers.push(objectClass)}if(Array.isArray(o["dsm"]))for(const sid of o["dsm"]){const objectClass=runtime.GetObjectClassBySID(sid);if(objectClass){if(!sw._dynamicSolModifiers)sw._dynamicSolModifiers=new Set;sw._dynamicSolModifiers.add(objectClass)}}for(const [sidStr,solData]of Object.entries(o["sols"])){const sid=parseInt(sidStr,10);const objectClass=runtime.GetObjectClassBySID(sid);if(!objectClass)continue;const solState=C3.New(C3.SolState, +null);solState._LoadFromJson(eventSheetManager,solData);sw._sols.set(objectClass,solState)}return sw}}; + +} + +// events/solState.js +{ +'use strict';const C3=self.C3; +C3.SolState=class SolState extends C3.DefendedBase{constructor(sol){super();this._objectClass=null;this._isSelectAll=true;this._instances=[];if(sol){this._objectClass=sol.GetObjectClass();this._isSelectAll=sol.IsSelectAll();C3.shallowAssignArray(this._instances,sol._GetOwnInstances())}}Release(){this._objectClass=null;C3.clearArray(this._instances)}_Restore(sol){sol._SetSelectAll(this._isSelectAll);C3.shallowAssignArray(sol._GetOwnInstances(),this._instances)}RemoveInstances(s){C3.arrayRemoveAllInSet(this._instances,s)}_SaveToJson(){return{"sa":this._isSelectAll, +"insts":this._instances.map(inst=>inst.GetUID())}}_LoadFromJson(eventSheetManager,o){const runtime=eventSheetManager.GetRuntime();this._isSelectAll=!!o["sa"];C3.clearArray(this._instances);for(const uid of o["insts"]){const inst=runtime.GetInstanceByUID(uid);if(inst)this._instances.push(inst)}}}; + +} + +// sdk/sdkPluginBase.js +{ +'use strict';const C3=self.C3;function GetNextParamMap(paramMap,param){let nextParamMap=paramMap.get(param);if(!nextParamMap){nextParamMap=new Map;paramMap.set(param,nextParamMap)}return nextParamMap} +C3.SDKPluginBase=class SDKPluginBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._isSingleGlobal=!!opts.isSingleGlobal;this._isWorldType=!!opts.isWorld;this._isRotatable=!!opts.isRotatable;this._mustPredraw=!!opts.mustPredraw;this._hasEffects=!!opts.hasEffects;this._supportsSceneGraph=!!opts.supportsSceneGraph;this._supportsMesh=!!opts.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=new Map;this._boundACEMethodCache_1param=new Map;this._boundACEMethodCache_2params= +new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(func,bindThis){if(!bindThis)throw new Error("missing 'this' binding"); +let ret=this._boundACEMethodCache.get(func);if(ret)return ret;ret=func.bind(bindThis);this._boundACEMethodCache.set(func,ret);return ret}_GetBoundACEMethod_1param(func,bindThis,param0){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_1param,func);let ret=param0map.get(param0);if(ret)return ret;ret=func.bind(bindThis,param0);param0map.set(param0,ret);return ret}_GetBoundACEMethod_2params(func,bindThis,param0,param1){if(!bindThis)throw new Error("missing 'this' binding"); +const param0map=GetNextParamMap(this._boundACEMethodCache_2params,func);const param1map=GetNextParamMap(param0map,param0);let ret=param1map.get(param1);if(ret)return ret;ret=func.bind(bindThis,param0,param1);param1map.set(param1,ret);return ret}_GetBoundACEMethod_3params(func,bindThis,param0,param1,param2){if(!bindThis)throw new Error("missing 'this' binding");const param0map=GetNextParamMap(this._boundACEMethodCache_3params,func);const param1map=GetNextParamMap(param0map,param0);const param2map= +GetNextParamMap(param1map,param1);let ret=param2map.get(param2);if(ret)return ret;ret=func.bind(bindThis,param0,param1,param2);param2map.set(param2,ret);return ret}_SetSingleGlobalObjectClass(objectClass){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");this._singleGlobalObjectClass=objectClass}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin"); +return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}; + +} + +// sdk/sdkDOMPluginBase.js +{ +'use strict';const C3=self.C3; +C3.SDKDOMPluginBase=class SDKDOMPluginBase extends C3.SDKPluginBase{constructor(opts,DOM_COMPONENT_ID){super(opts);this._domComponentId=DOM_COMPONENT_ID;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",sdkInst=>sdkInst._OnElemFocused());this.AddElementMessageHandler("elem-blurred",sdkInst=>{if(sdkInst)sdkInst._OnElemBlurred()})}Release(){super.Release()}_AddElement(sdkInst){const elementId=this._nextElementId++;this._instMap.set(elementId,sdkInst);return elementId}_RemoveElement(elementId){this._instMap.delete(elementId)}AddElementMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,e=>{const sdkInst=this._instMap.get(e["elementId"]);func(sdkInst,e)})}}; + +} + +// sdk/sdkTypeBase.js +{ +'use strict';const C3=self.C3; +C3.SDKTypeBase=class SDKTypeBase extends C3.DefendedBase{constructor(objectClass){super();this._objectClass=objectClass;this._runtime=objectClass.GetRuntime();this._plugin=objectClass.GetPlugin()}Release(){this._objectClass=null;this._runtime=null;this._plugin=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}OnCreate(){}FinishCondition(f){}BeforeRunAction(method){}AfterRunAction(method){}LoadTextures(renderer){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(renderer){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable, +additionalProperties){const e=C3.New(C3.Event,name,cancelable);e.objectClass=this;if(additionalProperties)Object.assign(e,additionalProperties);this.GetObjectClass().DispatchUserScriptEvent(e)}}; + +} + +// sdk/sdkInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKInstanceBase=class SDKInstanceBase extends C3.DefendedBase{constructor(inst,domComponentId){super();this._inst=inst;this._domComponentId=domComponentId;this._runtime=inst.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tickFunc=null;this._tick2Func=null;this._isTicking=false;this._isTicking2=false;this._disposables=null;this._wasReleased=false}Release(){this._wasReleased=true;this._StopTicking();this._StopTicking2();this._tickFunc= +null;this._tick2Func=null;if(this._disposables){this._disposables.Release();this._disposables=null}this._inst=null;this._runtime=null;this._objectClass=null;this._sdkType=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(method){return this._runtime.Trigger(method, +this._inst,null)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,null)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,null)}FastTrigger(method,value){return this._runtime.FastTrigger(method,this._inst,value)}DebugFastTrigger(method,value){return this._runtime.DebugFastTrigger(method,this._inst,value)}ScheduleTriggers(f){return this._runtime.ScheduleTriggers(f)}AddDOMMessageHandler(handler,func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId, +handler,func)}AddDOMMessageHandlers(list){for(const [handler,func]of list)this.AddDOMMessageHandler(handler,func)}PostToDOM(handler,data){this._runtime.PostComponentMessageToDOM(this._domComponentId,handler,data)}PostToDOMAsync(handler,data){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,handler,data)}_PostToDOMMaybeSync(handler,data){if(this._runtime.IsInWorker())this.PostToDOM(handler,data);else return window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event", +"component":this._domComponentId,"handler":handler,"data":data,"responseId":null})}Tick(){}Tick2(){}_StartTicking(){if(this._isTicking)return;if(!this._tickFunc)this._tickFunc=()=>this.Tick();this._runtime.Dispatcher().addEventListener("tick",this._tickFunc);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return;if(!this._tick2Func)this._tick2Func= +()=>this.Tick2();this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func);this._isTicking2=false}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset,opts){if(offset===0)return;const value= +this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset,opts)}SetPropertyColorOffsetValueByIndex(offset,r,g,b){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._inst.HasScriptInterface())return;const scriptInterface=this.GetScriptInterface(); +const e=C3.New(C3.Event,name,cancelable);e.instance=scriptInterface;if(additionalProperties)Object.assign(e,additionalProperties);scriptInterface.dispatchEvent(e)}}; + +} + +// sdk/sdkWorldInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKWorldInstanceBase=class SDKWorldInstanceBase extends C3.SDKInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._worldInfo=inst.GetWorldInfo();this._renderercontextlost_handler=null;this._renderercontextrestored_handler=null}Release(){if(this._renderercontextlost_handler){const dispatcher=this._runtime.Dispatcher();dispatcher.removeEventListener("renderercontextlost",this._renderercontextlost_handler);dispatcher.removeEventListener("renderercontextrestored",this._renderercontextrestored_handler); +this._renderercontextlost_handler=null;this._renderercontextrestored_handler=null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){this.HandleRendererContextLoss()}OnWebGLContextLost(){}OnWebGLContextRestored(){}HandleRendererContextLoss(){if(this._renderercontextlost_handler)return;this._renderercontextlost_handler=()=>this.OnRendererContextLost();this._renderercontextrestored_handler=()=>this.OnRendererContextRestored();const dispatcher=this._runtime.Dispatcher();dispatcher.addEventListener("rendererontextlost", +this._renderercontextlost_handler);dispatcher.addEventListener("renderercontextrestored",this._renderercontextrestored_handler)}OnRendererContextLost(){this.OnWebGLContextLost()}OnRendererContextRestored(){this.OnWebGLContextRestored()}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return false}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known");const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetWidth();else;}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw new Error("original size not known"); +const imageInfo=this.GetCurrentImageInfo();if(imageInfo)return imageInfo.GetHeight();else;}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){const imageInfo=this.GetCurrentImageInfo();if(imageInfo){const texture=imageInfo.GetTexture();if(texture)return[texture.GetWidth(),texture.GetHeight()]}return[100,100]}GetCurrentTexRect(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.GetTexRect():null}GetCurrentTexQuad(){const imageInfo=this.GetCurrentImageInfo();return imageInfo? +imageInfo.GetTexQuad():null}IsCurrentTexRotated(){const imageInfo=this.GetCurrentImageInfo();return imageInfo?imageInfo.IsRotated():false}GetImagePoint(nameOrIndex){const wi=this._inst.GetWorldInfo();return[wi.GetX(),wi.GetY(),wi.GetTotalZElevation()]}LoadTilemapData(data,mapWidth,mapHeight){}TestPointOverlapTile(x,y){}RendersToOwnZPlane(){return true}}; + +} + +// sdk/sdkDOMInstanceBase.js +{ +'use strict';const C3=self.C3;const tempRect=C3.New(C3.Rect); +C3.SDKDOMInstanceBase=class SDKDOMInstanceBase extends C3.SDKWorldInstanceBase{constructor(inst,domComponentId){super(inst,domComponentId);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=true;this._elemHasFocus=false;this._autoFontSize=false;this._autoFontSizeOffset=-.2;this._lastRect=C3.New(C3.Rect,0,0,-1,-1);const canvasManager=this._runtime.GetCanvasManager();this._lastWindowWidth=canvasManager.GetLastWidth();this._lastWindowHeight=canvasManager.GetLastHeight();this._isPendingUpdateState= +false;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw new Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(handler,data){if(!data)data={};data["elementId"]=this._elementId;this.PostToDOM(handler,data)}_PostToDOMElementMaybeSync(handler,data){if(!data)data={};data["elementId"]=this._elementId; +return this._PostToDOMMaybeSync(handler,data)}PostToDOMElementAsync(handler,data){if(!data)data={};data["elementId"]=this._elementId;return this.PostToDOMAsync(handler,data)}CreateElement(data){if(!data)data={};const isVisible=this.GetWorldInfo().IsVisible();data["elementId"]=this._elementId;data["isVisible"]=isVisible;Object.assign(data,this.GetElementState());this._isElementShowing=!!data["isVisible"];this._PostToDOMMaybeSync("create",data);this._UpdatePosition(true)}SetElementVisible(v){v=!!v; +if(this._isElementShowing===v)return;this._isElementShowing=v;this.PostToDOMElement("set-visible",{"isVisible":v})}Tick(){this._UpdatePosition(false)}_ShouldPreserveElement(){const fullscreenMode=this._runtime.GetCanvasManager().GetFullscreenMode();return C3.Platform.OS==="Android"&&(fullscreenMode==="scale-inner"||fullscreenMode==="scale-outer"||fullscreenMode==="crop")}_UpdatePosition(first){const wi=this.GetWorldInfo();const layer=wi.GetLayer();const bbox=wi.GetBoundingBox();let [cleft,ctop]=layer.LayerToCanvasCss(bbox.getLeft(), +bbox.getTop());let [cright,cbottom]=layer.LayerToCanvasCss(bbox.getRight(),bbox.getBottom());const canvasManager=this._runtime.GetCanvasManager();const rightEdge=canvasManager.GetCssWidth();const bottomEdge=canvasManager.GetCssHeight();if(!wi.IsVisible()||!layer.IsVisible()){this.SetElementVisible(false);return}if(!this._ShouldPreserveElement()){if(cright<=0||cbottom<=0||cleft>=rightEdge||ctop>=bottomEdge){this.SetElementVisible(false);return}if(cleft<1)cleft=1;if(ctop<1)ctop=1;if(cright>=rightEdge)cright= +rightEdge-1;if(cbottom>=bottomEdge)cbottom=bottomEdge-1}tempRect.set(cleft,ctop,cright,cbottom);const curWinWidth=canvasManager.GetLastWidth();const curWinHeight=canvasManager.GetLastHeight();if(!first&&tempRect.equals(this._lastRect)&&this._lastWindowWidth===curWinWidth&&this._lastWindowHeight===curWinHeight){this.SetElementVisible(true);return}this._lastRect.copy(tempRect);this._lastWindowWidth=curWinWidth;this._lastWindowHeight=curWinHeight;this.SetElementVisible(true);let fontSize=null;if(this._autoFontSize)fontSize= +layer.GetDisplayScale()+this._autoFontSizeOffset;this.PostToDOMElement("update-position",{"left":Math.round(this._lastRect.getLeft())+canvasManager.GetCanvasClientX(),"top":Math.round(this._lastRect.getTop())+canvasManager.GetCanvasClientY(),"width":Math.round(this._lastRect.width()),"height":Math.round(this._lastRect.height()),"fontSize":fontSize})}FocusElement(){this._PostToDOMElementMaybeSync("focus",{"focus":true})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{"focus":false})}_OnElemFocused(){this._elemHasFocus= +true}_OnElemBlurred(){this._elemHasFocus=false}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(prop,val){this.PostToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(prop),"val":val})}SetElementAttribute(attribName,value){this.PostToDOMElement("set-attribute",{"name":attribName,"val":value})}RemoveElementAttribute(attribName){this.PostToDOMElement("remove-attribute",{"name":attribName})}UpdateElementState(){if(this._isPendingUpdateState)return;this._isPendingUpdateState=true;Promise.resolve().then(()=> +{this._isPendingUpdateState=false;this.PostToDOMElement("update-state",this.GetElementState())})}GetElementState(){}GetElementId(){return this._elementId}}; + +} + +// sdk/sdkBehaviorBase.js +{ +'use strict';const C3=self.C3;const IBehavior=self.IBehavior; +C3.SDKBehaviorBase=class SDKBehaviorBase extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._myObjectClasses=C3.New(C3.ArraySet);this._myInstances=C3.New(C3.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=opts.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(objectClass){this._myObjectClasses.Add(objectClass)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(inst){this._myInstances.Add(inst)}_RemoveInstance(inst){this._myInstances.Delete(inst)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(this._iBehavior===null){const CustomScriptClass= +this._scriptInterfaceClass;if(CustomScriptClass){this._iBehavior=new CustomScriptClass(this);if(!(this._iBehavior instanceof IBehavior))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new IBehavior(this)}return this._iBehavior}}; + +} + +// sdk/sdkBehaviorTypeBase.js +{ +'use strict';const C3=self.C3;C3.SDKBehaviorTypeBase=class SDKBehaviorTypeBase extends C3.DefendedBase{constructor(behaviorType){super();this._runtime=behaviorType.GetRuntime();this._behaviorType=behaviorType;this._objectClass=behaviorType.GetObjectClass();this._behavior=behaviorType.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._runtime=null;this._behaviorType=null;this._objectClass=null;this._behavior=null}OnCreate(){}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}; + +} + +// sdk/sdkBehaviorInstanceBase.js +{ +'use strict';const C3=self.C3; +C3.SDKBehaviorInstanceBase=class SDKBehaviorInstanceBase extends C3.DefendedBase{constructor(behInst,domComponentId){super();this._behInst=behInst;this._domComponentId=domComponentId;this._inst=behInst.GetObjectInstance();this._runtime=behInst.GetRuntime();this._behaviorType=behInst.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isTicking=false;this._isTicking2=false;this._isPostTicking=false;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking(); +if(this._disposables){this._disposables.Release();this._disposables=null}this._behInst=null;this._inst=null;this._runtime=null;this._behaviorType=null;this._sdkType=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(method){return this._runtime.Trigger(method, +this._inst,this._behaviorType)}DebugTrigger(method){return this._runtime.DebugTrigger(method,this._inst,this._behaviorType)}TriggerAsync(method){return this._runtime.TriggerAsync(method,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){if(this._isTicking)return;this._runtime._AddBehInstToTick(this);this._isTicking=true}_StopTicking(){if(!this._isTicking)return;this._runtime._RemoveBehInstToTick(this);this._isTicking=false}IsTicking(){return this._isTicking}_StartTicking2(){if(this._isTicking2)return; +this._runtime._AddBehInstToTick2(this);this._isTicking2=true}_StopTicking2(){if(!this._isTicking2)return;this._runtime._RemoveBehInstToTick2(this);this._isTicking2=false}IsTicking2(){return this._isTicking2}_StartPostTicking(){if(this._isPostTicking)return;this._runtime._AddBehInstToPostTick(this);this._isPostTicking=true}_StopPostTicking(){if(!this._isPostTicking)return;this._runtime._RemoveBehInstToPostTick(this);this._isPostTicking=false}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(handler, +func){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,handler,func)}OnSpriteFrameChanged(prevFrame,nextFrame){}SaveToJson(){return null}LoadFromJson(o){}GetPropertyValueByIndex(index){}SetPropertyValueByIndex(index,value){}OffsetPropertyValueByIndex(index,offset){if(offset===0)return;const value=this.GetPropertyValueByIndex(index);if(typeof value!=="number")throw new Error("expected number");this.SetPropertyValueByIndex(index,value+offset)}SetPropertyColorOffsetValueByIndex(index, +offsetR,offsetG,offsetB){}CallAction(actMethod,...args){actMethod.call(this,...args)}CallExpression(expMethod,...args){return expMethod.call(this,...args)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(name,cancelable,additionalProperties){if(!this._behInst.HasScriptInterface())return;const scriptInterface=this.GetScriptInterface();const e=C3.New(C3.Event,name,cancelable);e.behaviorInstance=scriptInterface;e.instance=scriptInterface.instance;if(additionalProperties)Object.assign(e,additionalProperties); +scriptInterface.dispatchEvent(e)}}; + +} + +// objects/pluginManager.js +{ +'use strict';const C3=self.C3;C3.Plugins={};C3.Behaviors={}; +C3.PluginManager=class PluginManager extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._solidBehavior=null;this._jumpthruBehavior=null}CreatePlugin(pluginData){const Ctor=this._runtime.GetObjectReference(pluginData[0]);if(!Ctor)throw new Error("missing plugin");C3.AddCommonACEs(pluginData,Ctor);const plugin=C3.New(Ctor,{runtime:this._runtime,isSingleGlobal:pluginData[1], +isWorld:pluginData[2],isRotatable:pluginData[5],hasEffects:pluginData[8],mustPredraw:pluginData[9],supportsSceneGraph:pluginData[13],supportsMesh:pluginData[14]});plugin.OnCreate();this._allPlugins.push(plugin);this._pluginsByCtor.set(Ctor,plugin)}CreateSystemPlugin(){this._systemPlugin=C3.New(C3.Plugins.System,{runtime:this._runtime,isSingleGlobal:true});this._systemPlugin.OnCreate()}CreateBehavior(behaviorData){const Ctor=this._runtime.GetObjectReference(behaviorData[1]);if(!Ctor)throw new Error("missing behavior"); +const behavior=C3.New(Ctor,{runtime:this._runtime});behavior.OnCreate();this._allBehaviors.push(behavior);this._behaviorsByCtor.set(Ctor,behavior);if(!this._solidBehavior&&C3.Behaviors.solid&&behavior instanceof C3.Behaviors.solid)this._solidBehavior=behavior;else if(!this._jumpthruBehavior&&C3.Behaviors.jumpthru&&behavior instanceof C3.Behaviors.jumpthru)this._jumpthruBehavior=behavior}GetPluginByConstructorFunction(ctor){return this._pluginsByCtor.get(ctor)||null}HasBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.has(ctor)}GetBehaviorByConstructorFunction(ctor){return this._behaviorsByCtor.get(ctor)|| +null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}; + +} + +// objects/imageInfo.js +{ +'use strict';const C3=self.C3;const allImageInfos=new Set; +C3.ImageInfo=class ImageInfo extends C3.DefendedBase{constructor(){super();this._generation=0;this._url="";this._size=0;this._offsetX=0;this._offsetY=0;this._width=0;this._height=0;this._isRotated=false;this._hasMetaData=false;this._imageAsset=null;this._textureState="";this._rcTex=C3.New(C3.Rect);this._quadTex=C3.New(C3.Quad);this._blobUrl="";this._iImageInfo=new self.IImageInfo(this);allImageInfos.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;allImageInfos.delete(this);this.ReleaseBlobURL()}static OnRendererContextLost(){for(const imageInfo of allImageInfos){imageInfo._textureState= +"";imageInfo._rcTex.set(0,0,0,0);imageInfo._quadTex.setFromRect(imageInfo._rcTex)}}LoadData(imageData){this._url=imageData[0];this._size=imageData[1];this._offsetX=imageData[2];this._offsetY=imageData[3];this._width=imageData[4];this._height=imageData[5];this._isRotated=imageData[6];this._hasMetaData=true}LoadDynamicAsset(runtime,url){if(this._imageAsset)throw new Error("already loaded asset");this._url=url;const opts={};if(C3.IsAbsoluteURL(url))opts.loadPolicy="remote";this.LoadAsset(runtime,opts); +return this._imageAsset.Load()}async LoadDynamicBlobAsset(runtime,blob){if(this._imageAsset)throw new Error("already loaded asset");this._url="";this._size=blob.size;this._imageAsset=C3.New(C3.ImageAsset,runtime.GetAssetManager(),{blob,size:this._size,loadPolicy:"local"})}ReplaceWith(otherImageInfo){if(otherImageInfo===this)throw new Error("cannot replace with self");this._generation++;this.ReleaseTexture();this._url=otherImageInfo._url;this._size=otherImageInfo._size;this._offsetX=otherImageInfo._offsetX; +this._offsetY=otherImageInfo._offsetY;this._width=otherImageInfo._width;this._height=otherImageInfo._height;this._isRotated=otherImageInfo._isRotated;this._hasMetaData=otherImageInfo._hasMetaData;this._imageAsset=otherImageInfo._imageAsset;this._textureState=otherImageInfo._textureState;this._rcTex=otherImageInfo._rcTex;this._quadTex=otherImageInfo._quadTex;this.ReleaseBlobURL()}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(runtime, +opts){if(this._imageAsset)throw new Error("already got asset");opts=Object.assign({},opts,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=runtime.LoadImage(opts)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(renderer,opts){if(!this._imageAsset)throw new Error("no asset");if(this._textureState)throw new Error("already loaded texture");const startGeneration=this._generation;this._textureState="loading";const texture=await this._imageAsset.LoadStaticTexture(renderer, +opts);if(this._generation!==startGeneration)return null;if(!texture){this._textureState="";return null}this._textureState="loaded";if(!this._hasMetaData){this._width=texture.GetWidth();this._height=texture.GetHeight();this._hasMetaData=true}const wr=this._isRotated?this._height:this._width;const hr=this._isRotated?this._width:this._height;this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+wr,this._offsetY+hr);this._rcTex.divide(texture.GetWidth(),texture.GetHeight());this._quadTex.setFromRect(this._rcTex); +if(this._isRotated)this._quadTex.rotatePointsAnticlockwise();return texture}ReleaseTexture(){if(!this._textureState)return;if(this._imageAsset)this._imageAsset.ReleaseTexture();this._textureState="";this._rcTex.set(0,0,0,0);this._quadTex.setFromRect(this._rcTex)}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}GetIImageInfo(){return this._iImageInfo}GetImageAsset(){return this._imageAsset}async ExtractImageToCanvas(drawable){if(!drawable)drawable= +await this._imageAsset.LoadToDrawable();const canvas=C3.CreateCanvas(this._width,this._height);const ctx=canvas.getContext("2d");if(this._isRotated){ctx.rotate(Math.PI/-2);ctx.translate(-this._height,0);ctx.drawImage(drawable,this._offsetX,this._offsetY,this._height,this._width,0,0,this._height,this._width)}else ctx.drawImage(drawable,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return canvas}async ExtractImageToBlobURL(drawable){if(this._blobUrl)return this._blobUrl; +const canvas=await this.ExtractImageToCanvas(drawable);const blob=await C3.CanvasToBlob(canvas);this._blobUrl=URL.createObjectURL(blob);return this._blobUrl}ReleaseBlobURL(){if(this._blobUrl){URL.revokeObjectURL(this._blobUrl);this._blobUrl=""}}}; + +} + +// objects/animationInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationInfo=class AnimationInfo extends C3.DefendedBase{constructor(animData){super();this._name=animData[0];this._speed=animData[1];this._isLooping=!!animData[2];this._repeatCount=animData[3];this._repeatTo=animData[4];this._isPingPong=!!animData[5];this._sid=animData[6];this._frames=animData[7].map(frameData=>C3.New(C3.AnimationFrameInfo,frameData));this._iAnimation=new self.IAnimation(this)}Release(){for(const f of this._frames)f.Release();C3.clearArray(this._frames)}LoadAllAssets(runtime){for(const f of this._frames)f.GetImageInfo().LoadAsset(runtime)}LoadAllTextures(renderer,opts){return Promise.all(this._frames.map(f=> +f.GetImageInfo().LoadStaticTexture(renderer,opts)))}ReleaseAllTextures(){for(const f of this._frames)f.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(i){i=Math.floor(i);if(i<0||i>=this._frames.length)throw new RangeError("invalid frame");return this._frames[i]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}GetIAnimation(){return this._iAnimation}}; + +} + +// objects/animationFrameInfo.js +{ +'use strict';const C3=self.C3; +C3.AnimationFrameInfo=class AnimationFrameInfo extends C3.DefendedBase{constructor(frameData){super();this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(frameData);this._duration=frameData[7];this._origin=C3.New(C3.Vector2,frameData[8],frameData[9]);this._imagePoints=frameData[10].map(data=>C3.New(C3.ImagePoint,this,data));this._imagePointsByName=new Map;for(const ip of this._imagePoints)this._imagePointsByName.set(ip.GetName().toLowerCase(),ip);this._collisionPoly=null;const polyPoints= +frameData[11];if(polyPoints.length>=6)this._collisionPoly=C3.New(C3.CollisionPoly,polyPoints);this._tag=frameData[12]?frameData[12]:"";this._iAnimationFrame=new self.IAnimationFrame(this)}Release(){if(this._collisionPoly){this._collisionPoly.Release();this._collisionPoly=null}this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(name){return this._imagePointsByName.get(name.toLowerCase())|| +null}GetImagePointByIndex(index){index=Math.floor(index);if(index<0||index>=this._imagePoints.length)return null;return this._imagePoints[index]}GetImagePointCount(){return this._imagePoints.length}GetTag(){return this._tag}GetIAnimationFrame(){return this._iAnimationFrame}}; + +} + +// objects/imagePoint.js +{ +'use strict';const C3=self.C3;C3.ImagePoint=class ImagePoint extends C3.DefendedBase{constructor(afi,data){super();this._afi=afi;this._name=data[0];this._pos=C3.New(C3.Vector2,data[1],data[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}; + +} + +// objects/objectClass.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IObjectClass=self.IObjectClass;const assert=self.assert; +C3.ObjectClass=class ObjectClass extends C3.DefendedBase{constructor(runtime,index,data){super();const PluginCtor=runtime.GetObjectReference(data[1]);this._runtime=runtime;this._plugin=runtime.GetPluginManager().GetPluginByConstructorFunction(PluginCtor);this._sdkType=null;this._instSdkCtor=PluginCtor.Instance;this._index=index;this._sid=data[11];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[14]);this._isGlobal=!!data[9];this._isFamily=!!data[2];this._isOnLoaderLayout=!!data[10]; +this._instVars=data[3].map(arr=>({sid:arr[0],type:arr[1],name:arr[2],jsPropName:runtime.GetJsPropName(arr[3])}));this._behaviorsCount=data[4];this._effectsCount=data[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=C3.New(C3.SparseGrid,runtime.GetOriginalViewportWidth(),runtime.GetOriginalViewportHeight());this._anyCollisionCellChanged=true;this._anyInstanceParallaxed=false;this._familyMembers=null;this._familyMembersSet=null;this._familyIndex=-1;this._families= +null;this._familiesSet=null;this._familyInstVarMap=null;this._familyBehaviorMap=null;this._familyEffectMap=null;this._isInContainer=false;this._container=null;this._behaviorTypes=data[8].map(behaviorTypeData=>C3.BehaviorType.Create(this,behaviorTypeData));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._customActionMap=new Map;this._solStack=C3.New(C3.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex= +0;this._isContained=false;this._container=null;this._imageInfo=null;this._animations=null;this._animationsByName=null;this._animationsBySid=null;this._textureRefCount=0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=true;if(this._plugin.HasEffects())this._effectList=C3.New(C3.EffectList,this,data[12]);if(data[6]){this._imageInfo=C3.New(C3.ImageInfo);this._imageInfo.LoadData(data[6])}if(data[7]){this._animations=data[7].map(animData=>C3.New(C3.AnimationInfo,animData)); +this._animationsByName=new Map;this._animationsBySid=new Map;for(const anim of this._animations){this._animationsByName.set(anim.GetName().toLowerCase(),anim);this._animationsBySid.set(anim.GetSID(),anim)}}if(this._isFamily){this._familyMembers=[];this._familyMembersSet=new Set;this._familyIndex=this._runtime._GetNextFamilyIndex()}else{this._families=[];this._familiesSet=new Set;this._familyInstVarMap=[];this._familyBehaviorMap=[];this._familyEffectMap=[]}this._sdkType=C3.New(PluginCtor.Type,this, +data[15]);this._iObjectClass=null;this._instanceUserScriptClass=null;this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);const CustomScriptClass=this._sdkType.GetScriptInterfaceClass();if(CustomScriptClass){this._iObjectClass=new CustomScriptClass(this);if(!(this._iObjectClass instanceof IObjectClass))throw new TypeError("script interface class must derive from IObjectClass");}else this._iObjectClass=new IObjectClass(this);if(data[13]){const tilemapData=data[13];if(tilemapData){const tilePolyData= +tilemapData[0];const maxTileIndex=tilemapData[1];const brushData=tilemapData[2];this._sdkType.LoadTilemapData(tilePolyData,maxTileIndex,brushData)}}if(!this._runtime.UsesLoaderLayout()||this._isFamily||this._isOnLoaderLayout||!this._isWorldType)this.OnCreate();if(this._plugin.IsSingleGlobal()){this._plugin._SetSingleGlobalObjectClass(this);this._CreateSingleGlobalInstance(data)}this._loadInstancesJson=null}static Create(runtime,index,objectClassData){return C3.New(C3.ObjectClass,runtime,index,objectClassData)}Release(){if(this._imageInfo){this._imageInfo.Release(); +this._imageInfo=null}if(this._animations){for(const a of this._animations)a.Release();C3.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._loadInstancesJson=null;this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._container=null;this._runtime=null}_LoadFamily(familyData){for(let i=1,len=familyData.length;i0}LoadTextures(renderer){if(this._isFamily)return Promise.resolve();this._textureRefCount++;if(this._textureRefCount===1)return this._sdkType.LoadTextures(renderer)||Promise.resolve(); +else return Promise.resolve()}ReleaseTextures(){if(this._isFamily)return;this._textureRefCount--;if(this._textureRefCount<0)throw new Error("released textures too many times");if(this._textureRefCount===0)this._sdkType.ReleaseTextures()}OnDynamicTextureLoadComplete(){if(this._isFamily)throw new Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(renderer){if(this._isFamily)return Promise.resolve();return this._sdkType.PreloadTexturesWithInstances(renderer)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(Ctor){return Ctor&& +this._usedBehaviorCtors.has(Ctor)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(iv=>iv.sid)}GetInstanceVariableIndexBySID(sid){return this._instVars.findIndex(iv=>iv.sid===sid)}GetInstanceVariableIndexByName(name){return this._instVars.findIndex(iv=>iv.name===name)}_GetAllInstanceVariableNames(){return this._instVars.map(iv=>iv.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(iv=>iv.jsPropName)}GetInstanceVariableType(i){i= +Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].type}GetInstanceVariableName(i){i=Math.floor(i);if(i<0||i>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[i].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(name){return this._behaviorsByName.get(name.toLowerCase())|| +null}GetBehaviorIndexByName(name){const ret=this._behaviorNameToIndex.get(name.toLowerCase());if(typeof ret==="undefined")return-1;else return ret}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(i){this._defaultLayerIndex= +i}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(family){return this._familiesSet.has(family)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(objectType){return this._familyMembersSet.has(objectType)}GetFamilyBehaviorOffset(familyIndex){return this._familyBehaviorMap[familyIndex]}GetFamilyInstanceVariableOffset(familyIndex){return this._familyInstVarMap[familyIndex]}AddCustomAction(customAceBlock){this._customActionMap.set(customAceBlock.GetACEName().toLowerCase(), +customAceBlock)}HasOwnCustomActionByName(name){return!!this.GetOwnCustomActionByName(name)}GetOwnCustomActionByName(name){const ret=this._customActionMap.get(name.toLowerCase());return ret&&ret.IsEnabled()?ret:null}GetAnimationByName(name){if(!this._animations)throw new Error("no animations");return this._animationsByName.get(name.toLowerCase())||null}GetAnimationBySID(sid){if(!this._animations)throw new Error("no animations");return this._animationsBySid.get(sid)||null}GetFirstAnimationFrame(){if(!this._animations)throw new Error("no animations"); +return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const firstFrameInfo=this.GetFirstAnimationFrame().GetImageInfo();return[firstFrameInfo.GetWidth(),firstFrameInfo.GetHeight()]}else if(this._imageInfo)return[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()];else return[100,100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw new Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances; +yield*this._runtime.instancesPendingCreateForObjectClass(this)}GetInstanceCount(){return this._instances.length}_AddInstance(inst){this._instances.push(inst)}_SetIIDsStale(){this._iidsStale=true}_UpdateIIDs(){if(!this._iidsStale||this._isFamily)return;const instances=this._instances;let i=0;for(let len=instances.length;i0)return instances[inst.GetIID()%instances.length];else return null}*allCorrespondingInstances(inst,objectClass){const myInstances=this.GetCurrentSol().GetInstances();const myInstanceCount=myInstances.length;const otherSol=objectClass.GetCurrentSol();const otherInstances=objectClass.GetCurrentSol().GetInstances(); +const otherInstanceCount=otherInstances.length;let index=inst.GetIID();if(objectClass.IsFamily()||!otherSol.IsSelectAll())index=otherInstances.indexOf(inst);const divisor=Math.ceil(myInstanceCount/otherInstanceCount);const remainder=myInstanceCount%otherInstanceCount;let startIndex=0;let correspondCount=0;if(remainder===0||indexinst.SaveToJson())};if(this._savedData&&this._savedData.size)o["ex"]=C3.ToSuperJSON(this._savedData);return o}_LoadFromJson(o){if(this._savedData){this._savedData.clear();this._savedData=null}const ex=o["ex"];if(ex)this._savedData=C3.FromSuperJSON(ex);const existingInstances=this._instances;const loadInstances=o["instances"];for(let i=0,len=Math.min(existingInstances.length,loadInstances.length);io.IsWorldType())}}; + +} + +// objects/instance.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const IInstance=self.IInstance;const EMPTY_ARRAY=[];let nextPuid=0;const savedDataMaps=new WeakMap;const unsavedDataMaps=new WeakMap;const FLAG_DESTROYED=1<<0;const FLAG_TILEMAP=1<<1;const FLAG_MUST_PREDRAW=1<<2;const FLAG_SOLID_ENABLED=1<<3;const FLAG_JUMPTHRU_ENABLED=1<<4;const FLAG_MUST_MITIGATE_Z_FIGHTING=1<<5;const FLAG_IS_DRAWING_WITH_EFFECTS=1<<6; +C3.Instance=class Instance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._objectType=opts.objectType;this._worldInfo=null;this._sdkInst=null;this._iScriptInterface=null;this._iid=0;this._uid=opts.uid;this._puid=nextPuid++;this._flags=0;this._instVarValues=EMPTY_ARRAY;this._behaviorInstances=EMPTY_ARRAY;const behaviorTypes=this._objectType.GetBehaviorTypesIncludingInherited();if(behaviorTypes.length>0)this._behaviorInstances=behaviorTypes.map((behaviorType,index)=> +C3.New(C3.BehaviorInstance,{runtime:this._runtime,behaviorType:behaviorType,instance:this,index}));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;const plugin=this.GetPlugin();if(plugin.MustPreDraw())this._flags|=FLAG_MUST_PREDRAW;if(plugin.IsWorldType()){this._worldInfo=C3.New(C3.WorldInfo,this,opts.layer);if(opts.worldData)this._worldInfo.Init(opts.worldData);else{this._worldInfo.InitNoData();const [width,height]=this._objectType.GetDefaultInstanceSize(); +this._worldInfo.SetSize(width,height);if(this.GetObjectClass().UsesEffects())this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}}if(opts.instVarData)this._LoadInstanceVariableData(opts.instVarData);else this._LoadDefaultInstanceVariables()}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}if(this._behaviorInstances.length>0){for(const behInst of this._behaviorInstances)behInst.Release();C3.clearArray(this._behaviorInstances)}this._sdkInst.Release(); +this._sdkInst=null;const savedData=savedDataMaps.get(this);if(savedData){savedData.clear();savedDataMaps.delete(this)}const unsavedData=unsavedDataMaps.get(this);if(unsavedData){unsavedData.clear();unsavedDataMaps.delete(this)}if(this._siblings)C3.clearArray(this._siblings);if(this._dispatcher){this._dispatcher.Release();this._dispatcher=null}this._runtime=null;this._objectType=null;if(this._instVarValues.length>0)C3.clearArray(this._instVarValues);if(this._worldInfo){this._worldInfo.Release();this._worldInfo= +null}}_LoadInstanceVariableData(instVarData){if(instVarData.length>0){this._instVarValues=[];C3.shallowAssignArray(this._instVarValues,instVarData)}}_LoadDefaultInstanceVariables(){const len=this._objectType.GetInstanceVariablesCount();if(len===0)return;this._instVarValues=[];const typeToInitValue=[0,0,""];for(let i=0;i{const objectClass=objectClass_||inst.GetObjectClass();const instSet=pickMap.get(objectClass);if(instSet)instSet.add(inst);else pickMap.set(objectClass,new Set([inst]))};addInst(this,createdObjectClass);if(this.IsInContainer())for(const s of this.siblings())addInst(s);if(includeHierarchy)for(const c of this.allChildren())addInst(c)}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw new Error("object does not support scene graph"); +}HasParent(){return this.GetParent()!==null}GetParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetParent();return parentWi?parentWi.GetInstance():null}GetTopParent(){const wi=this.GetWorldInfo();if(!wi)return null;const parentWi=wi.GetTopParent();return parentWi?parentWi.GetInstance():null}*parents(){const wi=this.GetWorldInfo();if(!wi)return;for(const parentWi of wi.parents())yield parentWi.GetInstance()}HasChild(child){if(!child)return false;for(const c of this.children())if(c=== +child)return true;return false}HasChildren(){const wi=this.GetWorldInfo();return wi?wi.HasChildren():false}GetChildrenOfObjectClass(objectClass){const wi=this.GetWorldInfo();if(!wi)return[];const objectClassName=objectClass.GetName();return wi.GetChildren().map(wi=>wi.GetInstance()).filter(i=>i.GetObjectClass().GetName()===objectClassName)}GetChildren(){const wi=this.GetWorldInfo();if(!wi)return[];return wi.GetChildren().map(wi=>wi.GetInstance())}*children(){const wi=this.GetWorldInfo();if(!wi)return; +for(const childWi of wi.children())yield childWi.GetInstance()}*allChildren(){const wi=this.GetWorldInfo();if(!wi)return;for(const childWi of wi.allChildren())yield childWi.GetInstance()}GetChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetChildCount():0}GetParentCount(){return[...this.parents()].length}GetAllChildCount(){const wi=this.GetWorldInfo();return wi?wi.GetAllChildCount():0}GetChildAt(index){const wi=this.GetWorldInfo();if(!wi)return null;const childWi=wi.GetChildAt(index);return childWi? +childWi.GetInstance():null}AddChild(childInst,opts){this.VerifySupportsSceneGraph();childInst.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(childInst.GetWorldInfo(),opts||{})}RemoveChild(childInst){const wi=this.GetWorldInfo();if(!wi)return;wi.RemoveChild(childInst.GetWorldInfo())}GetDestroyWithParent(){const wi=this.GetWorldInfo();return wi?wi.GetDestroyWithParent():false}SetupInitialSceneGraphConnections(){const wi=this.GetWorldInfo();if(!wi)return;const childrenData=wi.GetSceneGraphChildrenExportData(); +if(!childrenData)return;for(const childData of childrenData){const child=this._runtime.GetInstanceByUID(childData[2]);if(child){const flags=childData[3];this.AddChild(child,{transformX:!!(flags>>0&1),transformY:!!(flags>>1&1),transformWidth:!!(flags>>2&1),transformHeight:!!(flags>>3&1),transformAngle:!!(flags>>4&1),destroyWithParent:!!(flags>>5&1),transformZElevation:!!(flags>>6&1),transformOpacity:!!(flags>>7&1),transformVisibility:!!(flags>>8&1)})}}}SetupPersistedSceneGraphConnections(instanceToPersistedDataMap, +persistedIndexToInstanceMap){const persistedData=instanceToPersistedDataMap.get(this);if(!persistedData)return;for(const persistedChildData of persistedData["sceneGraphJson"]["children"]){const child=persistedIndexToInstanceMap.get(persistedChildData["index"]);if(!child)continue;const flags=persistedChildData["flags"];this.AddChild(child,{transformX:!!(flags>>0&1),transformY:!!(flags>>1&1),transformWidth:!!(flags>>2&1),transformHeight:!!(flags>>3&1),transformAngle:!!(flags>>4&1),destroyWithParent:!!(flags>> +5&1),transformZElevation:!!(flags>>6&1),transformOpacity:!!(flags>>7&1),transformVisibility:!!(flags>>8&1)})}}GetTemplateName(){const templateManager=this._runtime.GetTemplateManager();return templateManager?templateManager.GetInstanceTemplateName(this):""}IsInContainer(){return this._siblings!==null}_AddSibling(inst){this._siblings.push(inst)}GetSiblings(){return this._siblings}HasSibling(objectClass){return!!this.GetSibling(objectClass)}GetSibling(objectClass){const siblings=this.siblings();if(siblings=== +null||siblings.length===0)return false;for(const s of siblings)if(s.GetObjectClass()===objectClass)return s;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol().SetSinglePicked(s)}_PushSiblingsToSolInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushInstance(s)}_SetSiblingsToSolInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnInstances()[i]=s}_PushSiblingsToSolElseInstances(){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._PushElseInstance(s)}_SetSiblingsToSolElseInstancesIndex(i){for(const s of this.siblings())s.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[i]= +s}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(i){this._iid=i}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(ctor){if(!ctor)return null;for(const behInst of this._behaviorInstances)if(behInst.GetBehavior()instanceof ctor)return behInst;return null}GetBehaviorSdkInstanceFromCtor(ctor){if(!ctor)return null;const behInst=this.GetBehaviorInstanceFromCtor(ctor); +if(behInst)return behInst.GetSdkInstance();else return null}GetBehaviorIndexBySID(sid){const behaviorInstances=this._behaviorInstances;for(let i=0,len=behaviorInstances.length;i=instVarValues.length)throw new RangeError("invalid instance variable");return instVarValues[index]}_GetInstanceVariableValueUnchecked(index){return this._instVarValues[index]}_GetInstanceVariableTypedValue(index){const ret=this._instVarValues[index];if(this._objectType.GetInstanceVariableType(index)===0)return!!ret;else return ret}SetInstanceVariableValue(index,value){index=index|0;const instVarValues=this._instVarValues;if(index< +0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const type=this._objectType.GetInstanceVariableType(index);switch(type){case 0:instVarValues[index]=value?1:0;break;case 1:instVarValues[index]=typeof value==="number"?value:parseFloat(value);break;case 2:instVarValues[index]=typeof value==="string"?value:value.toString();break;default:throw new Error("unknown instance variable type");}}SetInstanceVariableOffset(index,offset){if(offset===0)return;index=index|0;const instVarValues= +this._instVarValues;if(index<0||index>=instVarValues.length)throw new RangeError("invalid instance variable");const lastValue=instVarValues[index];if(typeof lastValue==="number")if(typeof offset==="number")instVarValues[index]+=offset;else instVarValues[index]+=parseFloat(offset);else if(typeof lastValue==="boolean")throw new Error("can not set offset of boolean variable");else if(typeof lastValue==="string")throw new Error("can not set offset of string variable");else throw new Error("unknown instance variable type"); +}GetSavedDataMap(){let ret=savedDataMaps.get(this);if(ret)return ret;ret=new Map;savedDataMaps.set(this,ret);return ret}GetUnsavedDataMap(){let ret=unsavedDataMaps.get(this);if(ret)return ret;ret=new Map;unsavedDataMaps.set(this,ret);return ret}_HasAnyCreateDestroyHandler(name){const objectType=this.GetObjectClass();if(objectType.UserScriptDispatcher().HasAnyHandlerFor(name))return true;for(const family of objectType.GetFamilies())if(family.UserScriptDispatcher().HasAnyHandlerFor(name))return true; +if(this._runtime.UserScriptDispatcher().HasAnyHandlerFor(name))return true;return false}_TriggerOnCreatedOnSelfAndRelated(){const instancesToTriggerOnCreated=new Set;instancesToTriggerOnCreated.add(this);const wi=this.GetWorldInfo();if(wi&&wi.HasChildren())for(const c of this.allChildren()){instancesToTriggerOnCreated.add(c);if(!c.IsInContainer())continue;for(const s of c.siblings())instancesToTriggerOnCreated.add(s)}if(this.IsInContainer())for(const s of this.siblings())instancesToTriggerOnCreated.add(s); +for(const instance of instancesToTriggerOnCreated.values())instance._TriggerOnCreated()}_TriggerOnCreated(){if(this._objectType._GetUserScriptInstanceClass())this.GetInterfaceClass();if(this._HasAnyCreateDestroyHandler("instancecreate")){const objectType=this.GetObjectClass();const instCreateEvent=new C3.Event("instancecreate");instCreateEvent.instance=this.GetInterfaceClass();objectType.DispatchUserScriptEvent(instCreateEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instCreateEvent); +this._runtime.DispatchUserScriptEvent(instCreateEvent)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(isEndingLayout){if(this._iScriptInterface){const e=new C3.Event("destroy");e.isEndingLayout=isEndingLayout;this.DispatchUserScriptEvent(e)}if(!this._HasAnyCreateDestroyHandler("instancedestroy"))return;const objectType=this.GetObjectClass(); +const instDestroyEvent=new C3.Event("instancedestroy");instDestroyEvent.instance=this.GetInterfaceClass();instDestroyEvent.isEndingLayout=isEndingLayout;objectType.DispatchUserScriptEvent(instDestroyEvent);for(const family of objectType.GetFamilies())family.DispatchUserScriptEvent(instDestroyEvent);this._runtime.DispatchUserScriptEvent(instDestroyEvent)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(mode="full"){const o={};if(mode==="full")o["uid"]=this.GetUID(); +else o["c3"]=true;if(mode!=="visual-state"){const savedData=savedDataMaps.get(this);if(savedData&&savedData.size)o["ex"]=C3.ToSuperJSON(savedData);if(this.GetTimeScale()!==-1)o["mts"]=this.GetTimeScale();if(this._objectType.GetInstanceVariablesCount()>0){const ivs={};const ivSids=this._objectType.GetInstanceVariableSIDs();for(let i=0,len=this._instVarValues.length;i= +this._instVarValues.length)continue;let v=value;if(v===null)v=NaN;this._instVarValues[index]=v}}if(this.GetPlugin().IsWorldType()){const worldData=o["w"];const layerSid=worldData["l"];if(this._worldInfo.GetLayer().GetSID()!==layerSid){const oldLayer=this._worldInfo.GetLayer();const newLayer=oldLayer.GetLayout().GetLayerBySID(layerSid);if(newLayer){this._worldInfo._SetLayer(newLayer);oldLayer._RemoveInstance(this,true);newLayer._AddInstance(this,true);newLayer.SetZIndicesChanged();this._worldInfo.SetBboxChanged()}else if(mode=== +"full")this._runtime.DestroyInstance(this)}this._worldInfo._LoadFromJson(worldData,mode)}if(mode!=="visual-state"){const behs=o["behs"];if(behs)for(const [sidStr,data]of Object.entries(behs)){const sid=parseInt(sidStr,10);const index=this.GetBehaviorIndexBySID(sid);if(index<0||index>=this._behaviorInstances.length)continue;this._behaviorInstances[index].LoadFromJson(data)}}const ownData=o["data"];if(ownData)this._sdkInst.LoadFromJson(ownData,mode)}GetInterfaceClass(){return this._iScriptInterface|| +this._InitUserScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}_InitUserScriptInterface(){const DefaultScriptClass=this._worldInfo?self.IWorldInstance:IInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const UserScriptClass=this._objectType._GetUserScriptInstanceClass();const ScriptInterfaceClass=UserScriptClass||SdkScriptClass||DefaultScriptClass;IInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IInstance._Init(null);if(SdkScriptClass&& +!(this._iScriptInterface instanceof DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`);if(UserScriptClass){const ExpectedBaseClass=SdkScriptClass||DefaultScriptClass;if(!(this._iScriptInterface instanceof ExpectedBaseClass))throw new TypeError(`setInstanceClass(): class '${UserScriptClass.name}' does not extend the right base class '${ExpectedBaseClass.name}'`);}return this._iScriptInterface}_GetInstVarsScriptDescriptor(instDescriptors){if(this._instVarValues.length=== +0)return;const varDescriptors={};const instVarJsPropNames=this._objectType._GetAllInstanceVariableJsPropNames();for(let i=0,len=instVarJsPropNames.length;i0}GetChildren(){return this._children}_MaybeSortChildren(){if(!this.HasChildren())return;if(!this._tmpSceneGraphChildrenIndexes)return;if(this._children.length===1)return;this._children.sort((f,s)=>{const fIndex=this._tmpSceneGraphChildrenIndexes.get(f.GetInstance()); +const sIndex=this._tmpSceneGraphChildrenIndexes.get(s.GetInstance());if(C3.IsFiniteNumber(fIndex)&&C3.IsFiniteNumber(sIndex))return fIndex-sIndex;return 0})}GetStartScaleX(){return this._startScaleX}SetStartScaleX(sx){this._startScaleX=sx}GetStartScaleY(){return this._startScaleY}SetStartScaleY(sy){this._startScaleY=sy}GetStartOpacity(){return this._startOpacity}GetOwnOpacity(){return this._ownOpacity}SetOwnOpacity(ownOpacity){this._ownOpacity=ownOpacity}_GetStartWidth(){if(this._startWidth===0)return Number.EPSILON; +return this._startWidth}_GetStartHeight(){if(this._startHeight===0)return Number.EPSILON;return this._startHeight}GetParentScaleX(){if(this._owner.GetTransformWithParentWidth()){const p=this._parent;let cw=p.GetWidth();let sw=p._GetSceneGraphInfo()._GetStartWidth();if(cw===0)cw=Number.EPSILON;if(sw===Number.EPSILON&&cw===Number.EPSILON)return 1;if(sw===Number.EPSILON&&cw!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+cw/sdkIntance.GetOriginalWidth()}return cw/ +sw}return 1}GetParentScaleY(){if(this._owner.GetTransformWithParentHeight()){const p=this._parent;let ch=p.GetHeight();let sh=p._GetSceneGraphInfo()._GetStartHeight();if(ch===0)ch=Number.EPSILON;if(sh===Number.EPSILON&&ch===Number.EPSILON)return 1;if(sh===Number.EPSILON&&ch!==Number.EPSILON){const sdkIntance=p.GetInstance().GetSdkInstance();if(sdkIntance.IsOriginalSizeKnown())return 1+ch/sdkIntance.GetOriginalHeight()}return ch/sh}return 1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(mode){return{"sw":this._startWidth, +"sh":this._startHeight,"sx":this._startScaleX,"sy":this._startScaleY,"psa":this._parentStartAngle,"oo":this._ownOpacity,"so":this._startOpacity,"p":this._GetParentJson(mode),"c":this._GetChildrenJson(mode)}}_GetFlagsString(wi){let flagsStr="";if(wi.GetTransformWithParentX())flagsStr+="x";if(wi.GetTransformWithParentY())flagsStr+="y";if(wi.GetTransformWithParentWidth())flagsStr+="w";if(wi.GetTransformWithParentHeight())flagsStr+="h";if(wi.GetTransformWithParentAngle())flagsStr+="a";if(wi.GetTransformWithParentZElevation())flagsStr+= +"z";if(wi.GetDestroyWithParent())flagsStr+="d";if(wi.GetTransformWithParentOpacity())flagsStr+="o";if(wi.GetTransformWithParentVisibility())flagsStr+="v";return flagsStr}_GetParentJson(mode){if(!this._parent)return null;if(!this._parent.GetInstance()||this._parent.GetInstance().IsDestroyed())return null;return this._GetInstanceJson(this._parent,this._owner,mode)}_GetChildrenJson(mode){return this._children.map(c=>{return this._GetInstanceJson(c,c,mode)})}_GetInstanceJson(wi,flagsSource,mode){const inst= +wi.GetInstance();const ret={};ret["uid"]=inst.GetUID();ret["f"]=this._GetFlagsString(flagsSource);ret["offsets"]=flagsSource._SaveSceneGraphPropertiesToJson();ret["data"]=C3.SceneGraphInfo.GetSceneGraphInstanceDataFromInstance(inst);ret["oci"]=inst.GetObjectClass().GetIndex();if(mode==="state"){ret["inst"]=inst.SaveToJson();ret["instIndex"]=NaN}else{ret["instIndex"]=inst.GetObjectClass().GetInstances().indexOf(inst);ret["inst"]=null}return ret}_LoadFromJson(o){this._startWidth=o["sw"];this._startHeight= +o["sh"];this._startScaleX=o["sx"];this._startScaleY=o["sy"];this._parentStartAngle=o["psa"];this._ownOpacity=o["oo"];this._startOpacity=o["so"]}_SetTmpSceneGraphChildren(tmpSceneGraphChildren,tmpSceneGraphChildrenIndexes){this._tmpSceneGraphChildren=tmpSceneGraphChildren;this._tmpSceneGraphChildrenIndexes=tmpSceneGraphChildrenIndexes}_OnAfterLoad(o,opts){const owner=this._owner;const runtime=owner.GetRuntime();const processedExistingWis=new Set;if(o["p"]&&!this._parent){const parentUid=o["p"]["uid"]; +const parentInst=runtime.GetInstanceByUID(parentUid);if(opts&&!opts.ignoreMissingInstances);if(parentInst){const parentWi=parentInst.GetWorldInfo();if(parentInst.HasChild(this._owner.GetInstance()))this._parent=parentWi;else{parentInst.AddChild(this._owner.GetInstance(),this._GetFlagsObj(o["p"]["f"]));if(!processedExistingWis.has(this._owner))this._owner._LoadSceneGraphPropertiesFromJson(o["p"]["offsets"]);processedExistingWis.add(this._owner);const pwi=parentInst.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}else if(C3.IsFiniteNumber(o["p"]["oci"])){const objectClass= +runtime.GetObjectClassByIndex(o["p"]["oci"]);const system=runtime.GetSystemPlugin();const parentInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true);if(opts&&!opts.ignoreMissingInstances);if(parentInstance){const instData=this._GetInstanceData(o["p"],runtime);parentInstance.LoadFromJson(instData);const parentWi=parentInstance.GetWorldInfo();parentWi.GetLayer().SortAndAddInstancesByZIndex(parentInstance);parentInstance.AddChild(owner.GetInstance(),this._GetFlagsObj(o["p"]["f"])); +const pwi=parentInstance.GetWorldInfo();pwi._GetSceneGraphInfo()._MaybeSortChildren()}}}const childInstances=[];for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(childInst)childInstances.push(childInst)}let childIndex=0;for(const childData of o["c"]){const childUid=childData["uid"];const childInst=runtime.GetInstanceByUID(childUid);if(opts&&!opts.ignoreMissingInstances);if(childInst){if(this._tmpSceneGraphChildren&&this._tmpSceneGraphChildren[childIndex]){const existingChildIntance= +this._tmpSceneGraphChildren[childIndex];if(existingChildIntance.GetObjectClass()!==childInst.GetObjectClass()){childIndex++;continue}if(existingChildIntance.IsDestroyed()){childIndex++;continue}const newChildData=o["c"][childIndex];this._AddAndSetChildInstance(existingChildIntance.GetWorldInfo(),newChildData,processedExistingWis,false);childIndex++;continue}const objectClass=childInst.GetObjectClass();const childrenCount=this._GetInstancesOfObjectClassCount(childInstances,objectClass);const childrenOfClassCount= +owner.GetInstance().GetChildrenOfObjectClass(objectClass).length;if(childrenCount===childrenOfClassCount){const existingChild=owner.GetInstance().GetChildAt(childIndex);const existingChildWi=existingChild.GetWorldInfo();if(existingChildWi){if(!processedExistingWis.has(existingChildWi))existingChildWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(existingChildWi)}childIndex++;continue}if(childInst.HasParent()){const childWi=this._CreateNewChildInstance(childData, +opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis);childIndex++;continue}this._AddAndSetChildInstance(childInst.GetWorldInfo(),childData,processedExistingWis)}else{const childWi=this._CreateNewChildInstance(childData,opts);this._AddAndSetChildInstance(childWi,childData,processedExistingWis)}childIndex++}}_GetFlagsObj(flagsString){const opts={};opts.transformX=flagsString.includes("x");opts.transformY=flagsString.includes("y");opts.transformWidth=flagsString.includes("w");opts.transformHeight= +flagsString.includes("h");opts.transformAngle=flagsString.includes("a");opts.transformZElevation=flagsString.includes("z");opts.destroyWithParent=flagsString.includes("d");opts.transformOpacity=flagsString.includes("o");opts.transformVisibility=flagsString.includes("v");return opts}_CreateNewChildInstance(childData,opts){if(!C3.IsFiniteNumber(childData["oci"]))return;const owner=this._owner;const runtime=owner.GetRuntime();let childInstance;if(childData["data"])childInstance=runtime.CreateInstanceFromData(childData["data"], +owner.GetLayer(),false,0,0,false,true);else{const objectClass=runtime.GetObjectClassByIndex(childData["oci"]);childInstance=runtime.CreateInstance(objectClass,owner.GetLayer(),0,0,true)}if(opts&&!opts.ignoreMissingInstances);if(!childInstance)return;const instData=this._GetInstanceData(childData,runtime);childInstance.LoadFromJson(instData);const childWi=childInstance.GetWorldInfo();childWi.GetLayer().SortAndAddInstancesByZIndex(childInstance,true);return childWi}_AddAndSetChildInstance(childWi,childData, +processedExistingWis,setJson=true){const owner=this._owner;owner.AddChild(childWi,this._GetFlagsObj(childData["f"]));if(setJson){if(!processedExistingWis.has(childWi))childWi._LoadSceneGraphPropertiesFromJson(childData["offsets"]);processedExistingWis.add(childWi)}this._MaybeSortChildren()}_GetInstancesOfObjectClassCount(instances,objectClass){return instances.filter(i=>i.GetObjectClass().GetName()===objectClass.GetName()).length}_GetInstanceData(json,runtime){if(C3.IsFiniteNumber(json["instIndex"])){const objectClass= +runtime.GetObjectClassByIndex(json["oci"]);const instancesJson=objectClass._GetLoadInstancesJson();return instancesJson[json["instIndex"]]}else if(C3.IsString(json["inst"]))return JSON.parse(json["inst"]);else if(json["inst"])return json["inst"]}static GetSceneGraphInstanceDataFromInstance(sourceInstance){let instData=sourceInstance.GetWorldInfo().GetLayer().GetInitialInstanceData(sourceInstance.GetUID());if(!instData)return null;instData=JSON.parse(JSON.stringify(instData));const newSgiData=[];for(const child of[...sourceInstance.GetChildren()]){const childWi= +child.GetWorldInfo();newSgiData.push([childWi.GetLayout().GetSID(),childWi.GetLayer().GetIndex(),child.GetUID(),C3.SceneGraphInfo._GetFlagsNumber(childWi),child.GetObjectClass().IsInContainer()?1:0,childWi.GetZIndex(),C3.SceneGraphInfo.GetSceneGraphInstanceDataFromInstance(child)])}if(C3.IsArray(instData[0][14]))instData[0][14][1]=newSgiData;else{instData[0][14]=[];instData[0][14][0]=C3.SceneGraphInfo._GetDefaultFlagsNumber();instData[0][14][1]=newSgiData;instData[0][14][2]=sourceInstance.GetWorldInfo().GetZIndex()}return instData}static _GetFlagsNumber(wi){let flagsNumber= +0;flagsNumber|=Number(wi.GetTransformWithParentVisibility())<<8;flagsNumber|=Number(wi.GetTransformWithParentOpacity())<<7;flagsNumber|=Number(wi.GetTransformWithParentZElevation())<<6;flagsNumber|=Number(wi.GetDestroyWithParent())<<5;flagsNumber|=Number(wi.GetTransformWithParentAngle())<<4;flagsNumber|=Number(wi.GetTransformWithParentHeight())<<3;flagsNumber|=Number(wi.GetTransformWithParentWidth())<<2;flagsNumber|=Number(wi.GetTransformWithParentY())<<1;flagsNumber|=Number(wi.GetTransformWithParentX())<< +0;return flagsNumber}static _GetDefaultFlagsNumber(wi){let flagsNumber=0;flagsNumber|=1<<8;flagsNumber|=1<<7;flagsNumber|=1<<6;flagsNumber|=1<<5;flagsNumber|=1<<4;flagsNumber|=1<<3;flagsNumber|=1<<2;flagsNumber|=1<<1;flagsNumber|=1<<0;return flagsNumber}}; + +} + +// objects/worldInfo.js +{ +'use strict';const C3=self.C3;const glMatrix=self.glMatrix;const vec3=glMatrix.vec3;const vec4=glMatrix.vec4;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const bboxChangeEvent=C3.New(C3.Event,"bboxchange",false);const tempColor=C3.New(C3.Color,0,0,0,0);const tempCollisionPoly=C3.New(C3.CollisionPoly);const DEFAULT_COLOR=C3.New(C3.Color,1,1,1,1);const DEFAULT_RENDER_CELLS=C3.New(C3.Rect,0,0,-1,-1);const DEFAULT_COLLISION_CELLS=C3.New(C3.Rect,0,0,-1,-1); +const VALID_SET_MESH_POINT_MODES=new Set(["absolute","relative"]);const EMPTY_ARRAY=[];let enableUpdateRendererStateGroup=true;const FLAG_IS_VISIBLE=1<<0;const FLAG_BBOX_CHANGED=1<<1;const FLAG_ENABLE_BBOX_CHANGED_EVENT=1<<2;const FLAG_COLLISION_ENABLED=1<<3;const FLAG_COLLISION_CELL_CHANGED=1<<4;const FLAG_SOLID_FILTER_INCLUSIVE=1<<5;const FLAG_HAS_ANY_ACTIVE_EFFECT=1<<6;const FLAG_IS_ROTATABLE=1<<7;const FLAG_DESTROYED=1<<8;const FLAG_DESTROY_WITH_PARENT=1<<9; +const FLAG_TRANSFORM_WITH_PARENT_X=1<<10;const FLAG_TRANSFORM_WITH_PARENT_Y=1<<11;const FLAG_TRANSFORM_WITH_PARENT_W=1<<12;const FLAG_TRANSFORM_WITH_PARENT_H=1<<13;const FLAG_TRANSFORM_WITH_PARENT_A=1<<14;const FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION=1<<15;const FLAG_TRANSFORM_WITH_PARENT_OPACITY=1<<22;const FLAG_TRANSFORM_WITH_PARENT_VISIBILITY=1<<23; +const MASK_ALL_SCENE_GRAPH_FLAGS=FLAG_DESTROY_WITH_PARENT|FLAG_TRANSFORM_WITH_PARENT_X|FLAG_TRANSFORM_WITH_PARENT_Y|FLAG_TRANSFORM_WITH_PARENT_W|FLAG_TRANSFORM_WITH_PARENT_H|FLAG_TRANSFORM_WITH_PARENT_A|FLAG_TRANSFORM_WITH_PARENT_Z_ELEVATION|FLAG_TRANSFORM_WITH_PARENT_OPACITY|FLAG_TRANSFORM_WITH_PARENT_VISIBILITY;const FLAG_MESH_CHANGED=1<<16;const FLAG_PHYSICS_BODY_CHANGED=1<<17;const FLAG_SIN_COS_ANGLE_CHANGED=1<<18;const FLAG_USE_POINTS_SHADER_PROGRAM=1<<19;const FLAG_DRAW_BACK_FACE_ONLY=1<<20; +const FLAG_DRAW_NON_BACK_FACES_ONLY=1<<21;const FLAG_BLEND_MODE_BIT_OFFSET=26;const FLAG_BLEND_MODE_MASK=31<=children.length)return null; +return children[index]}_CreateSceneGraphInfo(parent){if(!this._sceneGraphInfo)this._sceneGraphInfo=C3.New(C3.SceneGraphInfo,this);if(parent)this._sceneGraphInfo.SetParent(parent)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){if(!this._sceneGraphInfo)return;this._sceneGraphInfo.Release();this._sceneGraphInfo=null}_SetParent(parent){if(parent){parent._CreateSceneGraphInfo(null);this._CreateSceneGraphInfo(parent)}else{if(this._sceneGraphInfo)this._sceneGraphInfo.SetParent(null); +if(!this.HasChildren())this._ReleaseSceneGraphInfo()}}_HasAnyParent(child){if(!this.HasParent())return false;const parent=this.GetParent();if(parent===child)return true;return parent._HasAnyParent(child)}_HasChildRecursive(child){if(this.HasChild(child))return true;for(const c of this.GetChildren())if(c._HasChildRecursive(child))return true;return false}_AddChildToSceneGraphInfo(child){this._sceneGraphInfo.GetChildren().push(child)}_RemoveChildFromSceneGraphInfo(child){const children=this._sceneGraphInfo.GetChildren(); +const index=children.indexOf(child);if(index!==-1)children.splice(index,1);if(children.length===0&&!this.HasParent())this._ReleaseSceneGraphInfo();if(!child.HasChildren())child._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const data=sceneGraphExportDataMap.get(this);return data?data.childrenData:null}GetSceneGraphZIndexExportData(){const data=sceneGraphExportDataMap.get(this);return data?data.zIndexData:NaN}GetSceneGraphZIndex(){const sceneGraphZIndex=sceneGraphZIndexMap.get(this);return C3.IsFiniteNumber(sceneGraphZIndex)? +sceneGraphZIndex:NaN}SetSceneGraphZIndex(z){sceneGraphZIndexMap.set(this,z)}SetUsePointsShaderProgram(){this._SetFlag(FLAG_USE_POINTS_SHADER_PROGRAM,true);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(!enableUpdateRendererStateGroup)return;const renderer=this._runtime.GetRenderer();if(this._stateGroup)renderer.ReleaseStateGroup(this._stateGroup);let shaderProgram;if((this._flags&FLAG_USE_POINTS_SHADER_PROGRAM)!==0)shaderProgram=renderer.GetPointsRenderingProgram()||"";else shaderProgram= +renderer.GetTextureFillShaderProgram()||"";this._stateGroup=renderer.AcquireStateGroup(shaderProgram,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===DEFAULT_COLOR}SetBlendMode(bm){bm=bm|0;if(bm<0||bm>31)throw new RangeError("invalid blend mode");if(this.GetBlendMode()===bm)return;this._flags=this._flags&~FLAG_BLEND_MODE_MASK|bm<>FLAG_BLEND_MODE_BIT_OFFSET}_SetLayer(layer,updateRenderCell){const doUpdateRenderCell=updateRenderCell&&this._layer!==layer;if(doUpdateRenderCell)this._RemoveFromRenderCells();this._layer=layer;if(doUpdateRenderCell)this._UpdateRenderCell();if(this.GetZElevation()!==0)this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(z){this._zIndex=z|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(bit, +enable){if(enable)this._flags|=bit;else this._flags&=~bit}IsVisible(){return(this._flags&FLAG_IS_VISIBLE)!==0}SetVisible(v){this._SetFlag(FLAG_IS_VISIBLE,v);if(!this.HasChildren())return;for(const child of this.GetChildren())if(child.GetTransformWithParentVisibility())child.SetVisible(v)}IsCollisionEnabled(){return(this._flags&FLAG_COLLISION_ENABLED)!==0}SetCollisionEnabled(e){e=!!e;if(this.IsCollisionEnabled()===e)return;this._SetFlag(FLAG_COLLISION_ENABLED,e);if(e)this.SetBboxChanged();else this._RemoveFromCollisionCells()}SetSolidCollisionFilter(isInclusive, +tags){this._SetFlag(FLAG_SOLID_FILTER_INCLUSIVE,isInclusive);if(this._solidFilterTags)this._solidFilterTags.clear();if(!tags.trim()){this._solidFilterTags=null;return}if(!this._solidFilterTags)this._solidFilterTags=new Set;for(const tag of tags.split(" "))if(tag)this._solidFilterTags.add(tag.toLowerCase())}IsSolidCollisionAllowed(solidTagSet){const isInclusive=(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;const filterTags=this._solidFilterTags;if(!solidTagSet||!filterTags)return!isInclusive;for(const tag of filterTags)if(solidTagSet.has(tag))return isInclusive; +return!isInclusive}SetBboxChanged(){this._flags|=FLAG_BBOX_CHANGED|FLAG_COLLISION_CELL_CHANGED|FLAG_MESH_CHANGED;this._objectClass._SetAnyCollisionCellChanged(true);this._runtime.UpdateRender();if(this._layer.UsesRenderCells()){this.CalculateBbox(this._boundingBox,this._boundingQuad,true);this._flags&=~FLAG_BBOX_CHANGED;this._UpdateRenderCell()}if((this._flags&FLAG_ENABLE_BBOX_CHANGED_EVENT)!==0)this._inst.Dispatcher().dispatchEvent(bboxChangeEvent);if(this._sceneGraphInfo!==null){const children= +this._sceneGraphInfo.GetChildren();for(let i=0,len=children.length;i=layer.GetCameraZ())return false;layer.GetViewportForZ(totalZElevation,tempRect);return tempRect.intersectsRect(this.GetBoundingBox())}IsInViewport3D(viewFrustum){const bbox=this.GetBoundingBox(); +const minX=bbox.getLeft();const maxX=bbox.getRight();const minY=bbox.getTop();const maxY=bbox.getBottom();const minZ=this.GetTotalZElevation();const maxZ=minZ+this.GetDepth();return viewFrustum.ContainsAABB(minX,minY,minZ,maxX,maxY,maxZ)}IsInViewport2(){const layer=this.GetLayer();if(layer.Has3DCamera())return this.IsInViewport3D(layer._GetViewFrustum());else{const layout=layer.GetLayout();return this.IsInViewport(layer.GetViewport(),layout.HasVanishingPointOutsideViewport(),layout.IsOrthographicProjection())}}_SetDrawBackFaceOnly(e){this._SetFlag(FLAG_DRAW_BACK_FACE_ONLY, +e)}_SetDrawNonBackFacesOnly(e){this._SetFlag(FLAG_DRAW_NON_BACK_FACES_ONLY,e)}IsDrawBackFaceOnly(){return(this._flags&FLAG_DRAW_BACK_FACE_ONLY)!==0}IsDrawNonBackFacesOnly(){return(this._flags&FLAG_DRAW_NON_BACK_FACES_ONLY)!==0}SetSourceCollisionPoly(poly){this._sourceCollisionPoly=poly;this._DiscardTransformedCollisionPoly();if(this.HasMesh())this._meshInfo.meshPoly=null}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return this._sourceCollisionPoly!==null||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(), +this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(w,h,a){let sina=0;let cosa=1;if(a!==0){sina=Math.sin(a);cosa=Math.cos(a)}return this._GetCustomTransformedCollisionPolyPrecalc(w,h,a,sina,cosa)}_GetCustomTransformedCollisionPolyPrecalc(w,h,a,sinA,cosA){let tpi=this._transformedPolyInfo;if(tpi===null){tpi={poly:C3.New(C3.CollisionPoly),width:NaN,height:NaN,angle:NaN};this._transformedPolyInfo=tpi}const transformedPoly=tpi.poly;if(tpi.width=== +w&&tpi.height===h&&tpi.angle===a)return transformedPoly;const sourcePoly=this._sourceCollisionPoly;if(this.HasMesh()){const ox=this.GetOriginX();const oy=this.GetOriginY();const sourceMesh=this.GetSourceMesh();let meshPoly=this._meshInfo.meshPoly;if(!meshPoly){if(sourcePoly){tempCollisionPoly.copy(sourcePoly);tempCollisionPoly.offset(ox,oy)}else tempCollisionPoly.setDefaultPoints();meshPoly=sourceMesh.InsertPolyMeshVertices(tempCollisionPoly);this._meshInfo.meshPoly=meshPoly}sourceMesh.TransformCollisionPoly(meshPoly, +transformedPoly);transformedPoly.offset(-ox,-oy);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else if(sourcePoly){transformedPoly.copy(sourcePoly);transformedPoly.transformPrecalc(w,h,sinA,cosA)}else transformedPoly.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());tpi.width=w;tpi.height=h;tpi.angle=a;return transformedPoly}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(true);const tpi=this._transformedPolyInfo;if(tpi===null)return;tpi.width=NaN}CreateMesh(hsize,vsize){hsize= +Math.floor(hsize);vsize=Math.floor(vsize);if(!this.GetInstance().GetPlugin().SupportsMesh())throw new Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:C3.New(C3.Gfx.Mesh,hsize,vsize),transformedMesh:C3.New(C3.Gfx.Mesh,hsize,vsize),meshPoly:null}}HasMesh(){return this._meshInfo!==null}GetSourceMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw new Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(e){this._SetFlag(FLAG_MESH_CHANGED, +e)}IsMeshChanged(){return(this._flags&FLAG_MESH_CHANGED)!==0}SetPhysicsBodyChanged(e){this._SetFlag(FLAG_PHYSICS_BODY_CHANGED,e)}IsPhysicsBodyChanged(){return(this._flags&FLAG_PHYSICS_BODY_CHANGED)!==0}_ExpandBboxForMesh(bbox){const sourceMesh=this._meshInfo.sourceMesh;const minX=Math.min(sourceMesh.GetMinX(),0);const minY=Math.min(sourceMesh.GetMinY(),0);const maxX=Math.max(sourceMesh.GetMaxX(),1);const maxY=Math.max(sourceMesh.GetMaxY(),1);const w=bbox.width();const h=bbox.height();bbox.offsetLeft(minX* +w);bbox.offsetTop(minY*h);bbox.offsetRight((maxX-1)*w);bbox.offsetBottom((maxY-1)*h);this._depth=sourceMesh.GetMaxZ()}ReleaseMesh(){if(!this._meshInfo)return;this._meshInfo.sourceMesh.Release();this._meshInfo.transformedMesh.Release();this._meshInfo=null;this._DiscardTransformedCollisionPoly()}SetMeshPoint(col,row,opts){col=Math.floor(col);row=Math.floor(row);const mode=opts.mode||"absolute";if(!VALID_SET_MESH_POINT_MODES.has(mode))throw new Error("invalid mode");const isRelative=mode==="relative"; +let posx=opts.x;let posy=opts.y;const zElevation=opts.zElevation;let texu=typeof opts.u==="number"?opts.u:isRelative?0:-1;let texv=typeof opts.v==="number"?opts.v:isRelative?0:-1;if(!this.HasMesh())return false;const sourceMesh=this.GetSourceMesh();const p=sourceMesh.GetMeshPointAt(col,row);if(p===null)return false;let ret=false;if(typeof zElevation==="number"&&p.GetZElevation()!==zElevation){p.SetZElevation(zElevation);ret=true}if(isRelative){posx+=col/(sourceMesh.GetHSize()-1);posy+=row/(sourceMesh.GetVSize()- +1)}if(texu===-1&&!isRelative)texu=p.GetU();else{if(isRelative)texu+=col/(sourceMesh.GetHSize()-1);texu=C3.clamp(texu,0,1)}if(texv===-1&&!isRelative)texv=p.GetV();else{if(isRelative)texv+=row/(sourceMesh.GetVSize()-1);texv=C3.clamp(texv,0,1)}if(p.GetX()===posx&&p.GetY()===posy&&p.GetU()===texu&&p.GetV()===texv)return ret;p.SetX(posx);p.SetY(posy);p.SetU(texu);p.SetV(texv);this._DiscardTransformedCollisionPoly();return true}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(x,y){if(!this.GetBoundingBox().containsPoint(x, +y))return false;if(!this.GetBoundingQuad().containsPoint(x,y))return false;if(this.HasTilemap())return this._inst.GetSdkInstance().TestPointOverlapTile(x,y);if(!this.HasOwnCollisionPoly())return true;return this.GetTransformedCollisionPoly().containsPoint(x-this.GetX(),y-this.GetY())}_IsCollisionCellChanged(){return(this._flags&FLAG_COLLISION_CELL_CHANGED)!==0}_UpdateCollisionCell(){if(!this._IsCollisionCellChanged()||!this.IsCollisionEnabled()||(this._flags&FLAG_DESTROYED)!==0)return;const bbox= +this.GetBoundingBox();const grid=this._objectClass._GetCollisionCellGrid();const collisionCells=this._collisionCells;tempRect.set(grid.XToCell(bbox.getLeft()),grid.YToCell(bbox.getTop()),grid.XToCell(bbox.getRight()),grid.YToCell(bbox.getBottom()));if(collisionCells.equals(tempRect))return;const inst=this._inst;if(collisionCells===DEFAULT_COLLISION_CELLS){grid.Update(inst,null,tempRect);this._collisionCells=C3.New(C3.Rect,tempRect)}else{grid.Update(inst,collisionCells,tempRect);collisionCells.copy(tempRect)}this._flags&= +~FLAG_COLLISION_CELL_CHANGED}_RemoveFromCollisionCells(){const collisionCells=this._collisionCells;if(collisionCells===DEFAULT_COLLISION_CELLS)return;this._objectClass._GetCollisionCellGrid().Update(this._inst,collisionCells,null);this._collisionCells=DEFAULT_COLLISION_CELLS}_UpdateRenderCell(){const layer=this.GetLayer();if(!layer.UsesRenderCells()||(this._flags&FLAG_DESTROYED)!==0)return;const renderGrid=layer.GetRenderGrid();const bbox=this.GetBoundingBox();const renderCells=this._renderCells; +tempRect.set(renderGrid.XToCell(bbox.getLeft()),renderGrid.YToCell(bbox.getTop()),renderGrid.XToCell(bbox.getRight()),renderGrid.YToCell(bbox.getBottom()));if(renderCells.equals(tempRect))return;const inst=this._inst;if(renderCells===DEFAULT_RENDER_CELLS){renderGrid.Update(inst,null,tempRect);this._renderCells=C3.New(C3.Rect,tempRect)}else{renderGrid.Update(inst,renderCells,tempRect);renderCells.copy(tempRect)}layer.SetRenderListStale()}_RemoveFromRenderCells(){const renderCells=this._renderCells; +if(renderCells===DEFAULT_RENDER_CELLS)return;this.GetLayer().GetRenderGrid().Update(this._inst,renderCells,null);this._renderCells=DEFAULT_RENDER_CELLS}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const inst=this._inst;const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances.at(-1)===inst)return;layer._RemoveInstance(inst,false);layer._AddInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToBottom(){const inst=this._inst; +const layer=this._layer;const layerInstances=layer._GetInstances();if(layerInstances.length&&layerInstances[0]===inst)return;layer._RemoveInstance(inst,false);layer._PrependInstance(inst,false);this._runtime.UpdateRender()}ZOrderMoveToLayer(layerMove){const inst=this._inst;const curLayer=this._layer;if(curLayer.GetLayout()!==layerMove.GetLayout())throw new Error("layer from different layout");if(layerMove===curLayer)return;curLayer._RemoveInstance(inst,true);this._SetLayer(layerMove);layerMove._AddInstance(inst, +true);this._runtime.UpdateRender()}ZOrderMoveAdjacentToInstance(otherInst,isAfter){const inst=this._inst;let didChangeLayer=false;const curLayer=this._layer;if(otherInst.GetUID()===inst.GetUID())return;const otherWi=otherInst.GetWorldInfo();if(!otherWi)throw new Error("expected world instance");const otherLayer=otherWi.GetLayer();if(curLayer.GetIndex()!==otherLayer.GetIndex()){curLayer._RemoveInstance(inst,true);this._SetLayer(otherLayer);otherLayer._AddInstance(inst,true);didChangeLayer=true}const didChangeZOrder= +otherLayer.MoveInstanceAdjacent(inst,otherInst,!!isAfter);if(didChangeLayer||didChangeZOrder)this._runtime.UpdateRender()}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(e){this._SetFlag(FLAG_HAS_ANY_ACTIVE_EFFECT,e)}HasAnyActiveEffect(){return(this._flags&FLAG_HAS_ANY_ACTIVE_EFFECT)!==0}_SaveToJson(mode){const o={"x":this.GetX(),"y":this.GetY(),"w":this.GetWidth(),"h":this.GetHeight(),"l":this.GetLayer().GetSID(),"zi":this.GetZIndex()};if(this.GetZElevation()!==0)o["ze"]= +this.GetZElevation();if(this.GetAngle()!==0)o["a"]=this.GetAngle();if(!this.HasDefaultColor())o["c"]=this._color.toJSON();if(this.GetOriginX()!==.5)o["oX"]=this.GetOriginX();if(this.GetOriginY()!==.5)o["oY"]=this.GetOriginY();if(this.GetBlendMode()!==0)o["bm"]=this.GetBlendMode();if(!this.IsVisible())o["v"]=this.IsVisible();if(!this.IsCollisionEnabled())o["ce"]=this.IsCollisionEnabled();if(this.IsBboxChangeEventEnabled())o["be"]=this.IsBboxChangeEventEnabled();if(this._instanceEffectList)o["fx"]= +this._instanceEffectList._SaveToJson();const isSolidFilterInclusive=(this._flags&FLAG_SOLID_FILTER_INCLUSIVE)!==0;if(isSolidFilterInclusive)o["sfi"]=isSolidFilterInclusive;if(this._solidFilterTags)o["sft"]=[...this._solidFilterTags].join(" ");if(this._sceneGraphInfo&&mode!=="visual-state"){o["sgi"]=this._sceneGraphInfo._SaveToJson(mode);if(sceneGraphExportDataMap.has(this)){o["sgcd"]=sceneGraphExportDataMap.get(this).childrenData;o["sgzid"]=sceneGraphExportDataMap.get(this).zIndexData}}if(this.HasMesh())o["mesh"]= +this.GetSourceMesh().SaveToJson();return o}_SaveSceneGraphPropertiesToJson(){return{"x":this._x,"y":this._y,"z":this._zElevation,"w":this._w,"h":this._h,"a":this._a}}_LoadSceneGraphPropertiesFromJson(o){if(!o)return;this._x=o["x"];this._y=o["y"];this._zElevation=o["z"];this._w=o["w"];this._h=o["h"];this._a=o["a"];this._MarkSinCosAngleChanged();this.SetBboxChanged()}_SetupSceneGraphConnectionsOnChangeOfLayout(){this._ReleaseTmpSceneGraphInfo();this._ResetAllSceneGraphState();this._CreateSceneGraphInfo(null); +if(this._sceneGraphInfo)this._sceneGraphInfo._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren,this._tmpSceneGraphChildrenIndexes)}_OnBeforeLoad(mode){if(mode!=="visual-state")this._ResetAllSceneGraphState()}_LoadFromJson(o,mode){enableUpdateRendererStateGroup=false;this.SetX(o["x"]);this.SetY(o["y"]);this.SetWidth(o["w"]);this.SetHeight(o["h"]);this._SetZIndex(o["zi"]);this.SetZElevation(o.hasOwnProperty("ze")?o["ze"]:0);this.SetAngle(o.hasOwnProperty("a")?o["a"]:0);if(o.hasOwnProperty("c"))tempColor.setFromJSON(o["c"]); +else if(o.hasOwnProperty("o")){tempColor.copyRgb(this._color);tempColor.a=o["o"]}else tempColor.setRgba(1,1,1,1);this._SetColor(tempColor);this.SetOriginX(o.hasOwnProperty("oX")?o["oX"]:.5);this.SetOriginY(o.hasOwnProperty("oY")?o["oY"]:.5);this.SetBlendMode(o.hasOwnProperty("bm")?o["bm"]:0);this.SetVisible(o.hasOwnProperty("v")?o["v"]:true);this.SetCollisionEnabled(o.hasOwnProperty("ce")?o["ce"]:true);this.SetBboxChangeEventEnabled(o.hasOwnProperty("be")?o["be"]:false);this.SetSolidCollisionFilter(o.hasOwnProperty("sfi")? +o["sfi"]:false,o.hasOwnProperty("sft")?o["sft"]:"");if(this._instanceEffectList&&o.hasOwnProperty("fx"))this._instanceEffectList._LoadFromJson(o["fx"]);if(!o.hasOwnProperty("sgi")&&mode!=="visual-state")if(this._tmpSceneGraphChildren)for(const inst of this._tmpSceneGraphChildren){if(inst.IsDestroyed())continue;this._runtime.DestroyInstance(inst)}if(o.hasOwnProperty("sgi")&&mode!=="visual-state"){this._CreateSceneGraphInfo(null);const sgi=this._sceneGraphInfo;const sgiData=o["sgi"];sgi._LoadFromJson(sgiData); +sgi._SetTmpSceneGraphChildren(this._tmpSceneGraphChildren,this._tmpSceneGraphChildrenIndexes);needsSceneGraphAfterLoad.set(this,true);const runtimeDispatcher=this.GetRuntime().Dispatcher();if(this._after_load)runtimeDispatcher.removeEventListener("afterload",this._after_load);if(this._after_load_instance)runtimeDispatcher.removeEventListener("afterloadinstance",this._after_load_instance);this._after_load=null;this._after_load_instance=null;this._after_load=(e,opts)=>{if(this._after_load)runtimeDispatcher.removeEventListener("afterload", +this._after_load);if(this._after_load_instance)runtimeDispatcher.removeEventListener("afterloadinstance",this._after_load_instance);this._after_load_instance=null;this._after_load=null;if((this._flags&FLAG_DESTROYED)===0){sgi._OnAfterLoad(sgiData,opts);sgi._SetTmpSceneGraphChildren(null,null);this._ReleaseTmpSceneGraphInfo();this.SetBboxChanged()}};this._after_load_instance=e=>{if(e["instance"]!==this.GetInstance())return;this._after_load(e,{ignoreMissingInstances:true})};runtimeDispatcher.addEventListener("afterload", +this._after_load);runtimeDispatcher.addEventListener("afterloadinstance",this._after_load_instance);if(o["sgcd"]&&C3.IsFiniteNumber(o["sgzid"]))sceneGraphExportDataMap.set(this,{childrenData:o["sgcd"],zIndexData:o["sgzid"]})}if(o.hasOwnProperty("mesh")){const meshData=o["mesh"];this.CreateMesh(meshData["cols"],meshData["rows"]);this.GetSourceMesh().LoadFromJson(meshData)}else this.ReleaseMesh();this.SetBboxChanged();enableUpdateRendererStateGroup=true;this._UpdateRendererStateGroup()}}; + +} + +// objects/behaviorType.js +{ +'use strict';const C3=self.C3; +C3.BehaviorType=class BehaviorType extends C3.DefendedBase{constructor(objectClass,data){super();const runtime=objectClass.GetRuntime();const pluginManager=runtime.GetPluginManager();const BehaviorCtor=runtime.GetObjectReference(data[1]);if(!pluginManager.HasBehaviorByConstructorFunction(BehaviorCtor))pluginManager.CreateBehavior(data);this._runtime=runtime;this._objectClass=objectClass;this._behavior=pluginManager.GetBehaviorByConstructorFunction(BehaviorCtor);this._sdkType=null;this._instSdkCtor= +BehaviorCtor.Instance;this._sid=data[2];this._name=data[0];this._jsPropName=this._runtime.GetJsPropName(data[3]);this._sdkType=C3.New(BehaviorCtor.Type,this);this.OnCreate()}static Create(objectClass,behaviorTypeData){return C3.New(C3.BehaviorType,objectClass,behaviorTypeData)}Release(){this._runtime=null;this._behavior=null;this._sdkType.Release();this._sdkType=null;this._instSdkCtor=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}; + +} + +// objects/behaviorInstance.js +{ +'use strict';const C3=self.C3;const IBehaviorInstance=self.IBehaviorInstance; +C3.BehaviorInstance=class BehaviorInstance extends C3.DefendedBase{constructor(opts){super();this._runtime=opts.runtime;this._behaviorType=opts.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=opts.instance;this._index=opts.index;this._sdkInst=null;this._iScriptInterface=null;this._behavior._AddInstance(this._inst)}Release(){if(this._iScriptInterface){this._iScriptInterface._Release();this._iScriptInterface=null}this._behavior._RemoveInstance(this._inst);this._sdkInst.Release(); +this._sdkInst=null;this._runtime=null;this._behaviorType=null;this._behavior=null;this._inst=null}_CreateSdkInstance(properties){if(this._sdkInst)throw new Error("already got sdk instance");this._sdkInst=C3.New(this._behaviorType.GetInstanceSdkCtor(),this,properties)}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(prevFrame, +nextFrame){this._sdkInst.OnSpriteFrameChanged(prevFrame,nextFrame)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(o){return this._sdkInst.LoadFromJson(o)}static SortByTickSequence(a,b){const instA=a.GetObjectInstance();const instB=b.GetObjectInstance();const typeIndexA=instA.GetObjectClass().GetIndex();const typeIndexB=instB.GetObjectClass().GetIndex();if(typeIndexA!==typeIndexB)return typeIndexA-typeIndexB;const seqA= +instA.GetPUID();const seqB=instB.GetPUID();if(seqA!==seqB)return seqA-seqB;return a.GetBehaviorInstance()._GetIndex()-b.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const DefaultScriptClass=IBehaviorInstance;const SdkScriptClass=this._sdkInst.GetScriptInterfaceClass();const ScriptInterfaceClass=SdkScriptClass||DefaultScriptClass;IBehaviorInstance._Init(this);this._iScriptInterface=new ScriptInterfaceClass;IBehaviorInstance._Init(null);if(SdkScriptClass&&!(this._iScriptInterface instanceof +DefaultScriptClass))throw new TypeError(`script interface class '${SdkScriptClass.name}' does not extend the right base class '${DefaultScriptClass.name}'`);return this._iScriptInterface}GetScriptInterface(){return this._iScriptInterface||this._InitScriptInterface()}HasScriptInterface(){return!!this._iScriptInterface}}; + +} + +// objects/effectList.js +{ +'use strict';const C3=self.C3; +C3.EffectList=class EffectList extends C3.DefendedBase{constructor(owner,data){super();this._owner=owner;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._effectParamBuffers=[];this._allInstanceEffectLists=new Set;this._preservesOpaqueness=true;for(const d of data){const et=C3.New(C3.EffectType,this,d,this._allEffectTypes.length);this._allEffectTypes.push(et);this._effectTypesByName.set(et.GetName().toLowerCase(),et);if(d.length>=3)this._effectParams.push(this._LoadSingleEffectParameters(et, +d[2]))}this.GetRuntime()._AddEffectList(this)}Release(){for(const cpb of this._effectParamBuffers)cpb.Release();C3.clearArray(this._effectParamBuffers);C3.clearArray(this._allEffectTypes);C3.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();C3.clearArray(this._effectParams);this._owner=null}_AddInstanceEffectList(iel){this._allInstanceEffectLists.add(iel)}_RemoveInstanceEffectList(iel){this._allInstanceEffectLists.delete(iel)}_InitRenderer(renderer){if(renderer.IsWebGPU()){this._effectParamBuffers= +this._allEffectTypes.map(et=>{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null});this._UpdateAllEffectParamBuffers()}for(const iel of this._allInstanceEffectLists)iel._InitRenderer(renderer)}PrependEffectTypes(arr){if(!arr.length)return;this._allEffectTypes=arr.concat(this._allEffectTypes);for(const et of arr)this._effectTypesByName.set(et.GetName().toLowerCase(),et);for(let i= +0,len=this._allEffectTypes.length;i0}GetEffectTypeByName(name){return this._effectTypesByName.get(name.toLowerCase())||null}GetEffectTypeByIndex(index){index=Math.floor(+index);if(index<0||index>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[index]}IsEffectIndexActive(index){return this.GetEffectTypeByIndex(index).IsActive()}SetEffectIndexActive(index, +a){this.GetEffectTypeByIndex(index).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return this._activeEffectTypes.length>0}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false;const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false; +oldValue.copyRgb(value)}else{if(oldValue===value)return false;effectParams[paramIndex]=value}if(effectIndex +({"name":et.GetName(),"active":et.IsActive(),"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}LoadFromJson(arr){for(const o of arr){const et=this.GetEffectTypeByName(o["name"]);if(!et)continue;et.SetActive(o["active"]);this._effectParams[et.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// objects/effectType.js +{ +'use strict';const C3=self.C3; +C3.EffectType=class EffectType extends C3.DefendedBase{constructor(effectList,data,index){super();this._effectList=effectList;this._id=data[0];this._name=data[1];this._index=index;this._shaderProgram=null;this._isActive=true}Release(){this._effectList=null;this._shaderProgram=null}Clone(effectListOwner){const ret=C3.New(C3.EffectType,effectListOwner,[this._id,this._name],-1);ret._shaderProgram=this._shaderProgram;ret._isActive=this._isActive;return ret}_InitRenderer(renderer){const shaderProgram=renderer.GetShaderProgramByName(this._id); +if(!shaderProgram)throw new Error("failed to find shader program '"+this._id+"'");this._shaderProgram=shaderProgram}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(i){this._index=i}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(a){this._isActive=!!a}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const ret=[];for(let i=0, +len=this._shaderProgram.GetParameterCount();i{const inst=effectChain.GetContentObject(); +const wi=inst.GetWorldInfo();renderer.SetColor(wi.GetPremultipliedColor());renderer.SetCurrentZ(wi.GetTotalZElevation());inst.Draw(renderer);renderer.SetCurrentZ(0)},getSourceTextureInfo:inst=>{const srcTexRect=inst.GetCurrentTexRect();const [srcWidth,srcHeight]=inst.GetCurrentSurfaceSize();return{srcTexRect,srcWidth,srcHeight}},getShaderParameters:index=>this._GetEffectChainShaderParametersForIndex(index)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=true;this._effectParams= +[];this._effectParamBuffers=[];this._InitRenderer(inst.GetRuntime().GetRenderer());for(let i=0,len=this._effectList.GetAllEffectTypes().length;i{const shaderProgram=et.GetShaderProgram();if(shaderProgram.GetCustomParametersByteSize()>0)return C3.New(C3.Gfx.WebGPUEffectCustomParamsBuffer,shaderProgram);else return null})}_LoadEffectParameters(data){let index=0;for(const e of data){this._effectParams.push(this._LoadSingleEffectParameters(index, +e));++index}this._UpdateAllEffectParamBuffers();this.UpdateActiveEffects()}_LoadSingleEffectParameters(index,arr){this._activeEffectFlags[index]=arr[0];const ret=arr.slice(1);for(let i=0,len=ret.length;i0;const isRotatedOrNegativeSizeInstance=wi.GetAngle()!==0||wi.GetWidth()<0||wi.GetHeight()<0;const isTexRotated=inst.IsCurrentTexRotated();if(!this._needsRebuildSteps&&isDefaultColor===this._wasDefaultColor&&is3D===this._was3D&& +isRotatedOrNegativeSizeInstance===this._wasRotatedOrNegativeSize&&isTexRotated===this._wasTexRotated&&!this._effectChain.NeedsRebuild())return;this._effectChain.BuildSteps(this._activeEffectTypes.map(e=>e.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(e=>e.GetIndex()),forcePreDraw:!isDefaultColor||inst.MustPreDraw(),is3D,isSourceTextureRotated:isTexRotated,isRotatedOrNegativeSizeInstance});this._needsRebuildSteps=false;this._wasDefaultColor=isDefaultColor;this._was3D=is3D;this._wasRotatedOrNegativeSize= +isRotatedOrNegativeSizeInstance;this._wasTexRotated=isTexRotated}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(index){return this._effectParams[index]}_GetEffectChainShaderParametersForIndex(index){if(index=this._effectParams.length)return null;const effectParams=this._effectParams[effectIndex]; +if(paramIndex<0||paramIndex>=effectParams.length)return null;return effectParams[paramIndex]}SetEffectParameter(effectIndex,paramIndex,value){if(effectIndex<0||effectIndex>=this._effectParams.length)return false;const effectParams=this._effectParams[effectIndex];if(paramIndex<0||paramIndex>=effectParams.length)return false;const oldValue=effectParams[paramIndex];if(oldValue instanceof C3.Color){if(oldValue.equalsIgnoringAlpha(value))return false;oldValue.copyRgb(value)}else{if(oldValue===value)return false; +effectParams[paramIndex]=value}if(effectIndex +et.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(i){return this._activeEffectFlags[i]}SetEffectIndexActive(i,e){this._activeEffectFlags[i]=!!e}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(et=>({"name":et.GetName(),"active":this._activeEffectFlags[et.GetIndex()],"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[et.GetIndex()])}))}_LoadFromJson(arr){for(const o of arr){const et=this._effectList.GetEffectTypeByName(o["name"]); +if(!et)continue;this._activeEffectFlags[et.GetIndex()]=o["active"];this._effectParams[et.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(o["params"])}this.UpdateActiveEffects();this._UpdateAllEffectParamBuffers()}}; + +} + +// collisions/collisionEngine.js +{ +'use strict';const C3=self.C3;const tempCandidates=[];const tileCollRectCandidates=[];const tempJumpthruRet=[];const tempPolyA=C3.New(C3.CollisionPoly);const tempPolyB=C3.New(C3.CollisionPoly);const tempQuad=C3.New(C3.Quad);const tempRect=C3.New(C3.Rect);const tempRect2=C3.New(C3.Rect);let tempPolyC=null;let tempRect3=null;let tempQuadB=null; +C3.CollisionEngine=class CollisionEngine extends C3.DefendedBase{constructor(runtime){super();this._runtime=runtime;this._registeredCollisions=[];this._collisionCheckCount=0;this._collisionCheckSec=0;this._polyCheckCount=0;this._polyCheckSec=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=this._polyCheckCount;this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(a, +b){const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw||!bw)return;if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return;this._registeredCollisions.push([a,b])}AddRegisteredCollisionCandidates(inst,otherType,arr){for(const [a,b]of this._registeredCollisions){let otherInst=null;if(inst===a)otherInst=b;else if(inst===b)otherInst=a;else continue;if(!otherInst.BelongsToObjectClass(otherType))continue;if(!arr.includes(otherInst))arr.push(otherInst)}}CheckRegisteredCollision(a,b){if(!this._registeredCollisions.length)return false; +for(const [c,d]of this._registeredCollisions)if(a===c&&b===d||a===d&&b===c)return true;return false}ClearRegisteredCollisions(){C3.clearArray(this._registeredCollisions)}TestOverlap(a,b){if(!a||!b||a===b)return false;const aw=a.GetWorldInfo();const bw=b.GetWorldInfo();if(!aw.IsCollisionEnabled()||!bw.IsCollisionEnabled())return false;this._collisionCheckCount++;const layerA=aw.GetLayer();const layerB=bw.GetLayer();const areLayerTransformsCompatible=layerA.IsTransformCompatibleWith(layerB);if(areLayerTransformsCompatible)return this._TestOverlap_SameLayers(aw, +bw);else return this._TestOverlap_DifferentLayers(aw,bw)}_TestOverlap_SameLayers(aw,bw){if(!aw.GetBoundingBox().intersectsRect(bw.GetBoundingBox()))return false;this._polyCheckCount++;if(!aw.GetBoundingQuad().intersectsQuad(bw.GetBoundingQuad()))return false;if(aw.HasTilemap()&&bw.HasTilemap())return false;if(aw.HasTilemap())return this.TestTilemapOverlap(aw,bw);else if(bw.HasTilemap())return this.TestTilemapOverlap(bw,aw);if(!aw.HasOwnCollisionPoly()&&!bw.HasOwnCollisionPoly())return true;const polyA= +aw.GetTransformedCollisionPoly();const polyB=bw.GetTransformedCollisionPoly();return polyA.intersectsPoly(polyB,bw.GetX()-aw.GetX(),bw.GetY()-aw.GetY())}_TestOverlap_DifferentLayers(aw,bw){const aIsTileMap=aw.HasTilemap();const bIsTileMap=bw.HasTilemap();if(aIsTileMap&&!bIsTileMap)return this.TestTilemapOverlapDifferentLayers(aw,bw);else if(bIsTileMap&&!aIsTileMap)return this.TestTilemapOverlapDifferentLayers(bw,aw);else if(!bIsTileMap&&!aIsTileMap){const layerA=aw.GetLayer();const layerB=bw.GetLayer(); +tempPolyA.copy(aw.GetTransformedCollisionPoly());tempPolyB.copy(bw.GetTransformedCollisionPoly());const ptsArrA=tempPolyA.pointsArr();for(let i=0,len=ptsArrA.length;i{let ret=interactiveLayersCache.get(layer); +if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};if(sol.IsSelectAll()){if(!isInverted){sol._SetSelectAll(false);C3.clearArray(sol._GetOwnInstances())}if(isOrBlock)C3.clearArray(sol._GetOwnElseInstances());for(const inst of objectClass.GetInstances()){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();let containsPoint=false;if(isLayerInteractive(layer)&&wi.IsInViewport2()){const [lx,ly]=layer.CanvasCssToLayer(ptx,pty,wi.GetTotalZElevation()); +containsPoint=wi.ContainsPoint(lx,ly)}if(containsPoint)if(isInverted)return false;else sol._PushInstance(inst);else if(isOrBlock)sol._PushElseInstance(inst)}}else{let arr;let isPickingElseInstances=false;if(isOrBlock)if(this._runtime.IsCurrentConditionFirst()&&!sol._GetOwnElseInstances().length&&sol._GetOwnInstances().length)arr=sol._GetOwnInstances();else{arr=sol._GetOwnElseInstances();isPickingElseInstances=true}else arr=sol._GetOwnInstances();let j=0;for(let i=0,len=arr.length;i0){const PI=Math.PI;this.hitNormal=C3.clampAngle(this.hitNormal+PI);this.normalX=-this.normalX;this.normalY=-this.normalY}}TestInstanceSegment(inst,sx1,sy1,sx2,sy2){const t=C3.rayIntersect(this.x1, +this.y1,this.x2,this.y2,sx1,sy1,sx2,sy2);if(t>=0&&t[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:rt=>this.ReleaseEffectCompositorRenderTarget(rt),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeStartFrame=0;this._gpuTimeEndFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer= +null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=C3.New(C3.Rect);this._snapshotUrl="";this._snapshotPromise=null;this._snapshotResolve=null;this._isPastingToDrawingCanvas=0;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=e=>this._loadingProgress=e.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFrameNumber= +0;this._splashFadeInFinishTime=0;this._splashFadeOutStartTime=0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(resolve=>this._splashDoneResolve=resolve)}_SetGPUPowerPreference(pref){this._gpuPreference=pref}_SetWebGPUEnabled(e){this._isWebGPUEnabled=!!e}_SetZAxisScale(s){this._zAxisScale=s}_SetFieldOfView(f){this._fieldOfView=f}_SetZDistances(zNear,zFar){this._zNear=zNear;this._zFar=zFar}_SetLimitedToWebGL1(l){this._isLimitedToWebGL1=!!l}async CreateCanvas(opts){this._canvas= +opts["canvas"];this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",e=>this._OnWindowResize(e));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",e=>this._OnFullscreenChange(e));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",e=>this._OnFullscreenError(e));this._canvas.addEventListener("webglcontextlost",e=>this._OnWebGLContextLost(e));this._canvas.addEventListener("webglcontextrestored",e=>this._OnWebGLContextRestored(e));this._isDocumentFullscreen= +!!opts["isFullscreen"];const useWebGPU=navigator["gpu"]&&this._isWebGPUEnabled;let hasMajorPerformanceCaveat=false;if(useWebGPU)try{await this._InitWebGPUContext(true)}catch(err){this._MaybeLogRendererError("WebGPU",err);this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(true)}catch(err){this._MaybeLogRendererError("WebGL",err);this._webglRenderer=null}if(!this.GetRenderer())hasMajorPerformanceCaveat=true;if(!this.GetRenderer()&&useWebGPU)try{await this._InitWebGPUContext(false)}catch(err){this._MaybeLogRendererError("WebGPU", +err);this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(false)}catch(err){this._MaybeLogRendererError("WebGL",err);this._webglRenderer=null}const renderer=this.GetRenderer();if(!renderer)throw new Error("failed to acquire a renderer - check WebGL or WebGPU is supported");renderer.SetHasMajorPerformanceCaveat(hasMajorPerformanceCaveat);if(this._webgpuRenderer){this._webgpuRenderer.ondevicelost=()=>this._OnWebGPUDeviceLost();this._webgpuRenderer.ondevicerestored=()=>this._OnWebGPUDeviceRestored()}if(this._zAxisScale=== +"normalized")renderer.SetZAxisScaleNormalized();else{renderer.SetZAxisScaleRegular();renderer.SetFovY(this._fieldOfView)}this.SetSize(opts["windowInnerWidth"],opts["windowInnerHeight"],true);await this._InitRenderer()}_MaybeLogRendererError(rendererType,err){if(err&&typeof err.message==="string"&&err.message.startsWith("renderer-unavailable"))return;console.error(`Error creating ${rendererType} renderer: `,err)}async _InitWebGPUContext(failIfMajorPerformanceCaveat){const rendererOpts={powerPreference:this._gpuPreference, +depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat,usesBackgroundBlending:this._runtime.UsesAnyBackgroundBlending(),canSampleBackbuffer:this._runtime.UsesAnyCrossSampling(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),nearZ:this._zNear,farZ:this._zFar};this._webgpuRenderer=C3.New(C3.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas,rendererOpts)}async _InitWebGLContext(failIfMajorPerformanceCaveat){const rendererOpts={powerPreference:this._gpuPreference,enableGpuProfiling:true, +depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat,nearZ:this._zNear,farZ:this._zFar};if(this._isLimitedToWebGL1)rendererOpts.maxWebGLVersion=1;if(C3.Platform.OS==="Android"&&C3.Platform.BrowserEngine==="Chromium"&&C3.Platform.BrowserVersionNumber<75){console.warn("[Construct] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this.");rendererOpts.maxWebGLVersion=1}if(this._runtime.GetCompositingMode()=== +"standard")rendererOpts.alpha=true;else{rendererOpts.alpha=false;rendererOpts.lowLatency=true}this._webglRenderer=C3.New(C3.Gfx.WebGLRenderer,this._canvas,rendererOpts);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){data.src=data.wgsl;const vertexSrc=C3.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();promises.push(this._webgpuRenderer.CreateShaderProgram(Object.assign({vertexSrc,name:id}, +data)))}await Promise.all(promises)}}async _InitWebGL(){if(this._shaderData){const promises=[];for(const [id,data]of Object.entries(this._shaderData)){let vertexSrc;if(data.glslWebGL2&&this._webglRenderer.GetWebGLVersionNumber()>=2){data.src=data.glslWebGL2;vertexSrc=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource_WebGL2()}else{if(!data.glsl)throw new Error(`shader '${id}' does not support WebGL 1`);data.src=data.glsl;vertexSrc=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource()}promises.push(this._webglRenderer.CreateShaderProgram(Object.assign({vertexSrc, +name:id},data)))}await Promise.all(promises);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}if(this._webglRenderer.SupportsGPUProfiling())this._gpuFrameTimingsBuffer=C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer)}async _InitRenderer(){if(this._webgpuRenderer)await this._InitWebGPU();else if(this._webglRenderer)await this._InitWebGL();const renderer=this.GetRenderer();renderer.SetMipmapsEnabled(this._enableMipmaps);if(renderer.SupportsGPUProfiling())this._gpuLastUtilisation= +0;for(const effectList of this._runtime._GetAllEffectLists()){for(const effectType of effectList.GetAllEffectTypes())effectType._InitRenderer(renderer);effectList._InitRenderer(renderer);effectList.UpdateActiveEffects()}}Release(){this._runtime=null;this._webglRenderer=null;this._canvas=null}_OnWindowResize(e){const runtime=this._runtime;if(runtime.IsExportToVideo())return;const dpr=e["devicePixelRatio"];if(runtime.IsInWorker())self.devicePixelRatio=dpr;runtime._SetDevicePixelRatio(dpr);this._isDocumentFullscreen= +!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"]);runtime.UpdateRender();const ev=new C3.Event("window-resize");ev.data=e;runtime.Dispatcher().dispatchEventAndWaitAsyncSequential(ev);const ev2=new C3.Event("resize");ev2.cssWidth=this.GetCssWidth();ev2.cssHeight=this.GetCssHeight();ev2.deviceWidth=this.GetDeviceWidth();ev2.deviceHeight=this.GetDeviceHeight();runtime.DispatchUserScriptEvent(ev2);if(runtime.IsDebug()&&(runtime.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused()))runtime.Render()}_OnFullscreenChange(e){this._isDocumentFullscreen= +!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}_OnFullscreenError(e){this._isDocumentFullscreen=!!e["isFullscreen"];this.SetSize(e["innerWidth"],e["innerHeight"],true);this._runtime.UpdateRender()}SetSize(availableWidth,availableHeight,force=false){availableWidth=Math.floor(availableWidth);availableHeight=Math.floor(availableHeight);if(availableWidth<=0||availableHeight<=0)throw new Error("invalid size");if(this._windowInnerWidth===availableWidth&& +this._windowInnerHeight===availableHeight&&!force)return;this._windowInnerWidth=availableWidth;this._windowInnerHeight=availableHeight;const fullscreenMode=this.GetCurrentFullscreenMode();if(fullscreenMode==="letterbox-scale")this._CalculateLetterboxScale(availableWidth,availableHeight);else if(fullscreenMode==="letterbox-integer-scale")this._CalculateLetterboxIntegerScale(availableWidth,availableHeight);else if(fullscreenMode==="off")this._CalculateFixedSizeCanvas(availableWidth,availableHeight); +else this._CalculateFullsizeCanvas(availableWidth,availableHeight);this._UpdateFullscreenScalingQuality(fullscreenMode);this._canvas.width=this._canvasDeviceWidth;this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{"marginLeft":this._canvasCssOffsetX,"marginTop":this._canvasCssOffsetY,"styleWidth":this._canvasCssWidth,"styleHeight":this._canvasCssHeight,"displayScale":this.GetDisplayScale()});const renderer=this.GetRenderer();renderer.SetSize(this._canvasDeviceWidth, +this._canvasDeviceHeight,true);for(const rt of this._availableAdditionalRenderTargets)renderer.DeleteRenderTarget(rt);C3.clearArray(this._availableAdditionalRenderTargets);renderer.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,this.GetDrawWidth()/this.GetDrawHeight());const layoutManager=this._runtime.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(availableWidth, +availableHeight){const dpr=this._runtime.GetDevicePixelRatio();const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight=this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth=availableHeight*originalAspectRatio;this._canvasCssWidth=Math.round(letterboxedWidth);this._canvasCssHeight= +availableHeight;this._canvasCssOffsetX=Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=0}else{const letterboxedHeight=availableWidth/originalAspectRatio;this._canvasCssWidth=availableWidth;this._canvasCssHeight=Math.round(letterboxedHeight);this._canvasCssOffsetX=0;this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}this._canvasDeviceWidth=Math.round(this._canvasCssWidth*dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._runtime.SetViewportSize(originalViewportWidth, +originalViewportHeight)}_CalculateLetterboxIntegerScale(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();if(dpr!==1){availableWidth+=1;availableHeight+=1}const originalViewportWidth=this._runtime.GetOriginalViewportWidth();const originalViewportHeight=this._runtime.GetOriginalViewportHeight();const originalAspectRatio=originalViewportWidth/originalViewportHeight;const availableAspectRatio=availableWidth/availableHeight;let intScale;if(availableAspectRatio>originalAspectRatio){const letterboxedWidth= +availableHeight*originalAspectRatio;intScale=letterboxedWidth*dpr/originalViewportWidth}else{const letterboxedHeight=availableWidth/originalAspectRatio;intScale=letterboxedHeight*dpr/originalViewportHeight}if(intScale>1)intScale=Math.floor(intScale);else if(intScale<1)intScale=1/Math.ceil(1/intScale);this._canvasDeviceWidth=Math.round(originalViewportWidth*intScale);this._canvasDeviceHeight=Math.round(originalViewportHeight*intScale);this._canvasCssWidth=this._canvasDeviceWidth/dpr;this._canvasCssHeight= +this._canvasDeviceHeight/dpr;this._canvasCssOffsetX=Math.max(Math.floor((availableWidth-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((availableHeight-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(originalViewportWidth,originalViewportHeight)}_CalculateFullsizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=availableWidth;this._canvasCssHeight=availableHeight;this._canvasDeviceWidth=Math.round(this._canvasCssWidth* +dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);this._canvasCssOffsetX=0;this._canvasCssOffsetY=0;const displayScale=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/displayScale,this._canvasCssHeight/displayScale)}_CalculateFixedSizeCanvas(availableWidth,availableHeight){const dpr=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth* +dpr);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*dpr);if(this.IsDocumentFullscreen()){this._canvasCssOffsetX=Math.floor((availableWidth-this._canvasCssWidth)/2);this._canvasCssOffsetY=Math.floor((availableHeight-this._canvasCssHeight)/2)}else{this._canvasCssOffsetX=0;this._canvasCssOffsetY=0}this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(fullscreenMode){if(this._wantFullscreenScalingQuality==="high"){this._drawWidth= +this._canvasDeviceWidth;this._drawHeight=this._canvasDeviceHeight;this._fullscreenScalingQuality="high"}else{let viewportWidth,viewportHeight;if(this.GetCurrentFullscreenMode()==="off"){viewportWidth=this._runtime.GetViewportWidth();viewportHeight=this._runtime.GetViewportHeight()}else{viewportWidth=this._runtime.GetOriginalViewportWidth();viewportHeight=this._runtime.GetOriginalViewportHeight()}if(this._canvasDeviceWidthoriginalAspectRatio)this._drawHeight= +this._drawWidth/currentAspectRatio}else if(fullscreenMode==="scale-outer"){const originalAspectRatio=viewportWidth/viewportHeight;const currentAspectRatio=this._windowInnerWidth/this._windowInnerHeight;if(currentAspectRatio>originalAspectRatio)this._drawWidth=this._drawHeight*currentAspectRatio;else if(currentAspectRatiooriginalAspectRatio||fullscreenMode==="scale-inner"&¤tAspectRatiort.IsCompatibleWithOptions(opts)); +let ret;if(useIndex!==-1){ret=arr[useIndex];arr.splice(useIndex,1)}else ret=this.GetRenderer().CreateRenderTarget(opts);this._usedAdditionalRenderTargets.add(ret);return ret}ReleaseAdditionalRenderTarget(renderTarget){if(!this._usedAdditionalRenderTargets.has(renderTarget))throw new Error("render target not in use");this._usedAdditionalRenderTargets.delete(renderTarget);this._availableAdditionalRenderTargets.push(renderTarget)}GetEffectCompositorRenderTarget(){const opts={sampling:this._runtime.GetSampling()}; +if(this.GetCurrentFullscreenScalingQuality()==="low"){opts.width=this.GetDrawWidth();opts.height=this.GetDrawHeight()}return this.GetAdditionalRenderTarget(opts)}ReleaseEffectCompositorRenderTarget(renderTarget){this.ReleaseAdditionalRenderTarget(renderTarget)}*activeLayersGpuProfiles(){for(const layout of this._runtime.GetLayoutManager().runningLayouts())for(const layer of layout.GetLayers()){const p=this._layersGpuProfile.get(layer);if(p)yield p}}GetLayerTimingsBuffer(layer){if(!this.GetRenderer().SupportsGPUProfiling())return null; +let p=this._layersGpuProfile.get(layer);if(!p){p={name:layer.GetName(),timingsBuffer:C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0};this._layersGpuProfile.set(layer,p)}return p.timingsBuffer}_Update1sFrameRange(){const renderer=this.GetRenderer();if(!renderer.SupportsGPUProfiling())return;if(this._gpuTimeEndFrame===0){this._gpuTimeEndFrame=renderer.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const p of this.activeLayersGpuProfiles())p.curUtilisation= +NaN}}_UpdateTick(){if(this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling())this._UpdateTick_WebGL();if(this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling())this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(!isNaN(this._gpuCurUtilisation))return;this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame);if(isNaN(this._gpuCurUtilisation))return;if(this._runtime.IsDebug())for(const p of this.activeLayersGpuProfiles()){p.curUtilisation= +p.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame);if(isNaN(p.curUtilisation))return}this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const p of this.activeLayersGpuProfiles()){p.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);p.lastUtilisation=Math.min(p.curUtilisation,1)}self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation, +[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(this._gpuTimeEndFrame===0)return;for(let frameNumber=this._gpuTimeStartFrame;frameNumber{this._snapshotResolve= +resolve});return this._snapshotPromise}_MaybeTakeSnapshot(){if(!this._snapshotFormat)return;let canvas=this._canvas;const snapArea=this._snapshotArea;const x=C3.clamp(Math.floor(snapArea.getLeft()),0,canvas.width);const y=C3.clamp(Math.floor(snapArea.getTop()),0,canvas.height);let w=snapArea.width();if(w===0)w=canvas.width-x;else w=C3.clamp(Math.floor(w),0,canvas.width-x);let h=snapArea.height();if(h===0)h=canvas.height-y;else h=C3.clamp(Math.floor(h),0,canvas.height-y);if((x!==0||y!==0||w!==canvas.width|| +h!==canvas.height)&&(w>0&&h>0)){canvas=C3.CreateCanvas(w,h);const ctx=canvas.getContext("2d");ctx.drawImage(this._canvas,x,y,w,h,0,0,w,h)}C3.CanvasToBlob(canvas,this._snapshotFormat,this._snapshotQuality).then(blob=>{if(this._snapshotUrl)URL.revokeObjectURL(this._snapshotUrl);this._snapshotUrl=URL.createObjectURL(blob);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=1}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(p){if(p)this._isPastingToDrawingCanvas++; +else this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return this._isPastingToDrawingCanvas>0}InitLoadingScreen(loaderStyle){const renderer=this.GetRenderer();if(loaderStyle===2){this._percentText=C3.New(C3.Gfx.RendererText,this.GetRenderer());this._percentText.SetFontName("Arial");this._percentText.SetFontSize(16);this._percentText.SetHorizontalAlignment("center");this._percentText.SetVerticalAlignment("center");this._percentText.SetSize(PERCENTTEXT_WIDTH,PERCENTTEXT_HEIGHT)}else if(loaderStyle=== +0){const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(loadingLogoAsset)loadingLogoAsset.LoadStaticTexture(renderer).catch(err=>console.warn(`[C3 runtime] Failed to create texture for loading logo: `,err))}else if(loaderStyle===4){this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(tex=>{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.logo=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(tex=> +{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.powered=tex}).catch(err=>console.warn("Failed to load splash image: ",err));this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(tex=>{if(this._splashState==="done")renderer.DeleteTexture(tex);else this._splashTextures.website=tex}).catch(err=>console.warn("Failed to load splash image: ",err))}}async _LoadSvgSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString();const blob= +await C3.FetchBlob(url);const drawable=await this._runtime.RasterSvgImage(blob,2048,2048);return await this.GetRenderer().CreateStaticTextureAsync(drawable,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(url){url=(new URL(url,this._runtime.GetRuntimeBaseURL())).toString();const blob=await C3.FetchBlob(url);return await this.GetRenderer().CreateStaticTextureAsync(blob,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime= +Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3)this.HideCordovaSplashScreen()}async EndLoadingScreen(){const renderer=this.GetRenderer();this._loadingProgress=1;const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle===4)await this._splashDonePromise;this._splashDoneResolve=null;this._splashDonePromise= +null;if(this._rafId!==-1){cancelAnimationFrame(this._rafId);this._rafId=-1}this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;if(this._percentText){this._percentText.Release();this._percentText=null}this._runtime.ReleaseLoadingLogoAsset();renderer.Start();if(this._splashTextures.logo){renderer.DeleteTexture(this._splashTextures.logo);this._splashTextures.logo=null}if(this._splashTextures.powered){renderer.DeleteTexture(this._splashTextures.powered); +this._splashTextures.powered=null}if(this._splashTextures.website){renderer.DeleteTexture(this._splashTextures.website);this._splashTextures.website=null}renderer.ClearRgba(0,0,0,0);renderer.Finish();this._splashState="done";this._gpuTimeStartFrame=renderer.GetFrameNumber();if(loaderStyle===3)this.HideCordovaSplashScreen()}_DrawLoadingScreen(){if(this._rafId===-1)return;const renderer=this.GetRenderer();renderer.Start();this._rafId=-1;const hasHadError=this._runtime.GetAssetManager().HasHadErrorLoading(); +const loaderStyle=this._runtime.GetLoaderStyle();if(loaderStyle!==3){this.SetCssTransform(renderer);renderer.ClearRgba(0,0,0,0);renderer.ResetColor();renderer.SetTextureFillMode();renderer.SetTexture(null)}if(loaderStyle===0)this._DrawProgressBarAndLogoLoadingScreen(hasHadError);else if(loaderStyle===1)this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);else if(loaderStyle===2)this._DrawPercentTextLoadingScreen(hasHadError);else if(loaderStyle===3)C3.noop();else if(loaderStyle===4)this._DrawSplashLoadingScreen(hasHadError); +else throw new Error("invalid loader style");renderer.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}_DrawPercentTextLoadingScreen(hasHadError){if(hasHadError)this._percentText.SetColorRgb(1,0,0);else this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(this._loadingProgress*100)+"%");const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=PERCENTTEXT_WIDTH/2;const hh=PERCENTTEXT_HEIGHT/2;tempQuad.setRect(midX-hw,midY-hh,midX+ +hw,midY+hh);const renderer=this.GetRenderer();renderer.SetTexture(this._percentText.GetTexture());renderer.Quad3(tempQuad,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(hasHadError,width,yOff){const renderer=this.GetRenderer();const height=PROGRESSBAR_HEIGHT;renderer.SetColorFillMode();if(hasHadError)renderer.SetColorRgba(1,0,0,1);else renderer.SetColorRgba(.118,.565,1,1);const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=width/2;const hh=height/2;tempRect.setWH(midX- +hw,midY-hh+yOff,Math.floor(width*this._loadingProgress),height);renderer.Rect(tempRect);tempRect.setWH(midX-hw,midY-hh+yOff,width,height);tempRect.offset(-.5,-.5);tempRect.inflate(.5,.5);renderer.SetColorRgba(0,0,0,1);renderer.LineRect2(tempRect);tempRect.inflate(1,1);renderer.SetColorRgba(1,1,1,1);renderer.LineRect2(tempRect)}_DrawProgressBarAndLogoLoadingScreen(hasHadError){const renderer=this.GetRenderer();const loadingLogoAsset=this._runtime.GetLoadingLogoAsset();if(!loadingLogoAsset){this._DrawProgressBarLoadingScreen(hasHadError, +PROGRESSBAR_WIDTH,0);return}const logoTexture=loadingLogoAsset.GetTexture();if(!logoTexture){this._DrawProgressBarLoadingScreen(hasHadError,PROGRESSBAR_WIDTH,0);return}const logoW=logoTexture.GetWidth();const logoH=logoTexture.GetHeight();const midX=this._canvasCssWidth/2;const midY=this._canvasCssHeight/2;const hw=logoW/2;const hh=logoH/2;tempQuad.setRect(midX-hw,midY-hh,midX+hw,midY+hh);renderer.SetTexture(logoTexture);renderer.Quad(tempQuad);this._DrawProgressBarLoadingScreen(hasHadError,logoW, +hh+16)}_DrawSplashLoadingScreen(hasHadError){const renderer=this.GetRenderer();const logoTex=this._splashTextures.logo;const poweredTex=this._splashTextures.powered;const websiteTex=this._splashTextures.website;const nowTime=Date.now();if(this._splashFrameNumber===0)this._loaderStartTime=nowTime;const allowQuickSplash=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova();const splashAfterFadeOutWait=allowQuickSplash?0:SPLASH_AFTER_FADEOUT_WAIT_TIME;const splashMinDisplayTime= +allowQuickSplash?0:SPLASH_MIN_DISPLAY_TIME;let a=1;if(this._splashState==="fade-in")a=Math.min((nowTime-this._loaderStartTime)/SPLASH_FADE_DURATION,1);else if(this._splashState==="fade-out")a=Math.max(1-(nowTime-this._splashFadeOutStartTime)/SPLASH_FADE_DURATION,0);renderer.SetColorFillMode();renderer.SetColorRgba(.231*a,.251*a,.271*a,a);tempRect.set(0,0,this._canvasCssWidth,this._canvasCssHeight);renderer.Rect(tempRect);const w=Math.ceil(this._canvasCssWidth);const h=Math.ceil(this._canvasCssHeight); +let drawW,drawH;if(this._canvasCssHeight>256){renderer.SetColorRgba(.302*a,.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a);else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress;tempRect.setWH(w*.5-drawW/2,h*.8-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(poweredTex){drawW=C3.clamp(h*.22,105,w*.6)* +1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.2-drawH/2,drawW,drawH);renderer.SetTexture(poweredTex);renderer.Rect(tempRect)}if(logoTex){drawW=Math.min(h*.395,w*.95);drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.485-drawH/2,drawW,drawH);renderer.SetTexture(logoTex);renderer.Rect(tempRect)}if(websiteTex){drawW=C3.clamp(h*.22,105,w*.6)*1.5;drawH=drawW/8;tempRect.setWH(w*.5-drawW/2,h*.868-drawH/2,drawW,drawH);renderer.SetTexture(websiteTex);renderer.Rect(tempRect)}}else{renderer.SetColorRgba(.302*a, +.334*a,.365*a,a);drawW=w;drawH=Math.max(h*.005,2);tempRect.setWH(0,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);if(hasHadError)renderer.SetColorRgba(a,0,0,a);else renderer.SetColorRgba(.161*a,.953*a,.816*a,a);drawW=w*this._loadingProgress;tempRect.setWH(w*.5-drawW/2,h*.85-drawH/2,drawW,drawH);renderer.Rect(tempRect);renderer.SetColorRgba(a,a,a,a);renderer.SetTextureFillMode();if(logoTex){drawW=h*.55;drawH=drawW;tempRect.setWH(w*.5-drawW/2,h*.45-drawH/2,drawW,drawH);renderer.SetTexture(logoTex); +renderer.Rect(tempRect)}}this._splashFrameNumber++;if(this._splashState==="fade-in"&&nowTime-this._loaderStartTime>=SPLASH_FADE_DURATION&&this._splashFrameNumber>=2){this._splashState="wait";this._splashFadeInFinishTime=nowTime}if(this._splashState==="wait"&&nowTime-this._splashFadeInFinishTime>=splashMinDisplayTime&&this._loadingProgress>=1){this._splashState="fade-out";this._splashFadeOutStartTime=nowTime}if(this._splashState==="fade-out"&&nowTime-this._splashFadeOutStartTime>=SPLASH_FADE_DURATION+ +splashAfterFadeOutWait||allowQuickSplash&&this._loadingProgress>=1&&nowTime-this._loaderStartTime<500)this._splashDoneResolve()}}; + +} + +// runtime.js +{ +'use strict';const C3=self.C3;const C3Debugger=self.C3Debugger;const assert=self.assert;const DEFAULT_RUNTIME_OPTS={"messagePort":null,"runtimeBaseUrl":"","headless":false,"hasDom":true,"isInWorker":false,"useAudio":true,"projectData":"","exportType":""};let ife=true; +C3.Runtime=class C3Runtime extends C3.DefendedBase{constructor(opts){opts=Object.assign({},DEFAULT_RUNTIME_OPTS,opts);super();this._messagePort=opts["messagePort"];this._runtimeBaseUrl=opts["runtimeBaseUrl"];this._previewUrl=opts["previewUrl"];this._isHeadless=!!opts["headless"];this._hasDom=!!opts["hasDom"];this._isInWorker=!!opts["isInWorker"];ife=opts["ife"];this._useAudio=!!opts["useAudio"];this._exportType=opts["exportType"];this._isiOSCordova=!!opts["isiOSCordova"];this._isiOSWebView=!!opts["isiOSWebView"]; +this._isFBInstantAvailable=!!opts["isFBInstantAvailable"];this._opusWasmScriptUrl=opts["opusWasmScriptUrl"];this._opusWasmBinaryUrl=opts["opusWasmBinaryUrl"];this._isDebug=!!(this._exportType==="preview"&&opts["isDebug"]);this._breakpointsEnabled=this._isDebug;this._isDebugging=this._isDebug;this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=false;this._projectName="";this._projectVersion="";this._projectUniqueId="";this._appId= +"";this._originalViewportWidth=0;this._originalViewportHeight=0;this._devicePixelRatio=self.devicePixelRatio;this._parallaxXorigin=0;this._parallaxYorigin=0;this._viewportWidth=0;this._viewportHeight=0;this._loaderStyle=0;this._usesLoaderLayout=false;this._isLoading=true;this._usesAnyBackgroundBlending=false;this._usesAnyCrossSampling=false;this._usesAnyDepthSampling=false;this._loadingLogoAsset=null;this._assetManager=C3.New(C3.AssetManager,this,opts);this._layoutManager=C3.New(C3.LayoutManager, +this);this._eventSheetManager=C3.New(C3.EventSheetManager,this);this._pluginManager=C3.New(C3.PluginManager,this);this._collisionEngine=C3.New(C3.CollisionEngine,this);this._timelineManager=C3.New(C3.TimelineManager,this);this._transitionManager=C3.New(C3.TransitionManager,this);this._templateManager=C3.New(C3.TemplateManager,this);this._textIconManager=C3.New(C3.TextIconManager,{getIconSetMeta:iconSource=>this._GetTextIconSetMeta(iconSource),getIconSetContent:iconSource=>this._GetTextIconSetContent(iconSource)}); +this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._hasPendingInstances=false;this._isFlushingPendingInstances=false;this._objectCount=0;this._nextUid=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable= +[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=false;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=false;this._needRender=true;this._pauseOnBlur=false;this._isPausedOnBlur=false;this._exportToVideo=null;this._tickCallbacks={normal:timestamp=>{this._rafId=-1;this._ruafId=-1;this.Tick(timestamp)},tickOnly:timestamp=>{this._ruafId=-1;this.Tick(timestamp,false,"skip-render")},renderOnly:()=>{this._rafId= +-1;this.Render()}};this._rafId=-1;this._ruafId=-1;this._tickCount=0;this._tickCountNoSave=0;this._hasStarted=false;this._isInTick=false;this._hasStartedTicking=false;this._isLayoutFirstTick=true;this._suspendCount=0;this._scheduleTriggersThrottle=new C3.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._startTime=0;this._lastTickTime=0;this._dtRaw=0;this._dt1=0;this._dt=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=C3.New(C3.KahanSum);this._gameTimeRaw=C3.New(C3.KahanSum); +this._wallTime=C3.New(C3.KahanSum);this._instanceTimes=new Map;this._fpsFrameCount=-1;this._fpsLastTime=0;this._fps=0;this._mainThreadTimeCounter=0;this._mainThreadTime=0;this._isLoadingState=false;this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._projectStorage=null;this._savegamesStorage=null;this._dispatcher=C3.New(C3.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._didRequestDeviceOrientationEvent= +false;this._didRequestDeviceMotionEvent=false;this._isReadyToHandleEvents=false;this._waitingToHandleEvents=[];this._eventObjects={"pretick":C3.New(C3.Event,"pretick",false),"tick":C3.New(C3.Event,"tick",false),"tick2":C3.New(C3.Event,"tick2",false),"instancedestroy":C3.New(C3.Event,"instancedestroy",false),"beforelayoutchange":C3.New(C3.Event,"beforelayoutchange",false),"layoutchange":C3.New(C3.Event,"layoutchange",false)};this._eventObjects["instancedestroy"].instance=null;this._userScriptDispatcher= +C3.New(C3.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence);this._jobScheduler=C3.New(C3.JobSchedulerRuntime,this,opts["jobScheduler"]);if(opts["canvas"])this._canvasManager=C3.New(C3.CanvasManager,this);this._messagePort.onmessage=e=>this["_OnMessageFromDOM"](e.data); +this.AddDOMComponentMessageHandler("runtime","visibilitychange",e=>this._OnVisibilityChange(e));this.AddDOMComponentMessageHandler("runtime","opus-decode",e=>this._WasmDecodeWebMOpus(e["arrayBuffer"]));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",e=>this._InvokeFunctionFromJS(e));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self["goToLastErrorScript"]); +this.AddDOMComponentMessageHandler("runtime","offline-audio-render-completed",e=>this._OnOfflineAudioRenderCompleted(e));this._dispatcher.addEventListener("window-blur",e=>this._OnWindowBlur(e));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._templateManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(opts){return C3.New(C3.Runtime, +opts)}Release(){C3.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager= +null;this._templateManager.Release();this._templateManager=null;this._textIconManager.Release();this._textIconManager=null;if(this._canvasManager){this._canvasManager.Release();this._canvasManager=null}this._dispatcher.Release();this._dispatcher=null;this._tickEvent=null}["_OnMessageFromDOM"](data){const type=data["type"];if(type==="event")this._OnEventFromDOM(data);else if(type==="result")this._OnResultFromDOM(data);else throw new Error(`unknown message '${type}'`);}_OnEventFromDOM(e){if(!this._isReadyToHandleEvents){this._waitingToHandleEvents.push(e); +return}const component=e["component"];const handler=e["handler"];const data=e["data"];const dispatchOpts=e["dispatchOpts"];const dispatchRuntimeEvent=!!(dispatchOpts&&dispatchOpts["dispatchRuntimeEvent"]);const dispatchUserScriptEvent=!!(dispatchOpts&&dispatchOpts["dispatchUserScriptEvent"]);const responseId=e["responseId"];if(component==="runtime"){if(dispatchRuntimeEvent){const event=new C3.Event(handler);event.data=data;this._dispatcher.dispatchEventAndWaitAsyncSequential(event)}if(dispatchUserScriptEvent){const event= +new C3.Event(handler,true);for(const [key,value]of Object.entries(data))event[key]=value;this.DispatchUserScriptEvent(event)}}const handlerMap=this._domEventHandlers.get(component);if(!handlerMap){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM event handlers for component '${component}'`);return}const func=handlerMap.get(handler);if(!func){if(!dispatchRuntimeEvent&&!dispatchUserScriptEvent)console.warn(`[Runtime] No DOM handler '${handler}' for component '${component}'`); +return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!==null)this._PostResultToDOM(responseId,false,""+err);return}if(responseId!==null)if(ret&&ret.then)ret.then(result=>this._PostResultToDOM(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToDOM(responseId,false,""+err)});else this._PostResultToDOM(responseId,true,ret)}_PostResultToDOM(responseId, +isOk,result){this._messagePort.postMessage({"type":"result","responseId":responseId,"isOk":isOk,"result":result})}_OnResultFromDOM(data){const responseId=data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=this._pendingResponsePromises.get(responseId);if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);this._pendingResponsePromises.delete(responseId)}AddDOMComponentMessageHandler(component,handler,func){let handlerMap=this._domEventHandlers.get(component); +if(!handlerMap){handlerMap=new Map;this._domEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[Runtime] Component '${component}' already has handler '${handler}'`);handlerMap.set(handler,func)}PostComponentMessageToDOM(component,handler,data,transfer){this._messagePort.postMessage({"type":"event","component":component,"handler":handler,"data":data,"responseId":null},transfer)}PostComponentMessageToDOMAsync(component,handler,data,transfer){const responseId=this._nextDomResponseId++; +const ret=new Promise((resolve,reject)=>{this._pendingResponsePromises.set(responseId,{resolve,reject})});this._messagePort.postMessage({"type":"event","component":component,"handler":handler,"data":data,"responseId":responseId},transfer);return ret}PostToDebugger(data){if(!this.IsDebug())throw new Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",data)}async Init(opts){if(this.IsDebug())await C3Debugger.Init(this);else if(self.C3Debugger)self.C3Debugger.InitPreview(this); +const [o]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);await this._LoadDataJson(o);await this._InitialiseCanvas(opts);if(!this.IsPreview())console.info("Made with Construct, the game and app creator :: https://www.construct.net");if(this.GetWebGLRenderer()){const webglRenderer=this.GetWebGLRenderer();console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${webglRenderer.GetWebGLVersionNumber()} [${webglRenderer.GetUnmaskedRenderer()}] (${webglRenderer.IsDesynchronized()? +"desynchronized":"standard"} compositing)`)}else if(this.GetWebGPURenderer())console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU [${this.GetWebGPURenderer().GetBasicAdapterInfoString()}]`);if(this.GetRenderer().HasMajorPerformanceCaveat())console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=true;for(const e of this._waitingToHandleEvents)this._OnEventFromDOM(e); +C3.clearArray(this._waitingToHandleEvents);if(this._canvasManager)this._canvasManager.StartLoadingScreen();for(const f of opts["runOnStartupFunctions"])this._additionalLoadPromises.push(this._RunOnStartupFunction(f));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);C3.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading()){if(this._canvasManager)this._canvasManager.HideCordovaSplashScreen();return}if(this._canvasManager)await this._canvasManager.EndLoadingScreen(); +await this._dispatcher.dispatchEventAndWaitAsync(new C3.Event("beforeruntimestart"));await this.Start();this._messagePort.postMessage({"type":"runtime-ready"});return this}async _RunOnStartupFunction(f){try{await f(this._iRuntime)}catch(err){console.error("[C3 runtime] Error in runOnStartup function: ",err)}}async _LoadDataJson(o){const projectData=o["project"];this._projectName=projectData[0];this._projectVersion=projectData[16];this._projectUniqueId=projectData[31];this._appId=projectData[38];const loadingLogoFilename= +projectData[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!projectData[9];this._originalViewportWidth=this._viewportWidth=projectData[10];this._originalViewportHeight=this._viewportHeight=projectData[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=projectData[36];this._framerateMode=projectData[37];if(this._compositingMode==="low-latency"&&this.IsAndroidWebView()&&C3.Platform.BrowserVersionNumber<=77){console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."); +this._compositingMode="standard"}this._uses3dFeatures=!!projectData[40];this._sampling=projectData[14];this._usesAnyBackgroundBlending=projectData[15];this._usesAnyCrossSampling=projectData[42];this._usesAnyDepthSampling=projectData[17];this._usesLoaderLayout=!!projectData[18];this._loaderStyle=projectData[19];this._nextUid=projectData[21];this._pauseOnBlur=projectData[22];const assetManager=this._assetManager;assetManager._SetFileStructure(projectData[45]);assetManager._SetAudioFiles(projectData[7], +projectData[25]);assetManager._SetMediaSubfolder(projectData[8]);assetManager._SetFontsSubfolder(projectData[32]);assetManager._SetIconsSubfolder(projectData[28]);assetManager._SetWebFonts(projectData[29]);if(this._loaderStyle===0){let url="";if(this.IsPreview()){if(assetManager._HasLocalUrlBlob(loadingLogoFilename))url=assetManager.GetLocalUrlAsBlobUrl(loadingLogoFilename)}else if(assetManager.GetFileStructure()==="flat")url=assetManager.GetIconsSubfolder()+loadingLogoFilename;else url=loadingLogoFilename; +if(url)this._loadingLogoAsset=assetManager.LoadImage({url})}if(this._canvasManager){this._canvasManager.SetFullscreenMode(C3.CanvasManager._FullscreenModeNumberToString(projectData[12]));this._canvasManager.SetFullscreenScalingQuality(projectData[23]?"high":"low");this._canvasManager.SetMipmapsEnabled(projectData[24]!==0);this._canvasManager._SetGPUPowerPreference(projectData[34]);this._canvasManager._SetTextureAnisotropy(projectData[41]);this._canvasManager._SetWebGPUEnabled(projectData[13]);this._canvasManager._SetZAxisScale(projectData[30]); +this._canvasManager._SetZDistances(projectData[46],projectData[47]);this._canvasManager._SetFieldOfView(projectData[26]);this._canvasManager._SetLimitedToWebGL1(projectData[48])}const exportToVideoOpts=projectData[43];if(exportToVideoOpts)await this._LoadExportToVideoData(exportToVideoOpts);this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(const pluginData of projectData[2])this._pluginManager.CreatePlugin(pluginData);this._objectReferenceTable=self.C3_GetObjectRefTable(); +this._LoadJsPropNameTable();for(const objectClassData of projectData[3]){const objectClass=C3.ObjectClass.Create(this,this._allObjectClasses.length,objectClassData);this._allObjectClasses.push(objectClass);this._objectClassesByName.set(objectClass.GetName().toLowerCase(),objectClass);this._objectClassesBySid.set(objectClass.GetSID(),objectClass)}for(const familyData of projectData[4]){const familyType=this._allObjectClasses[familyData[0]];familyType._LoadFamily(familyData)}for(const containerData of projectData[27]){const containerTypes= +containerData.map(index=>this._allObjectClasses[index]);this._allContainers.push(C3.New(C3.Container,this,containerTypes))}for(const objectClass of this._allObjectClasses)objectClass._OnAfterCreate();for(const layoutData of projectData[5])this._layoutManager.Create(layoutData);const firstLayoutName=projectData[1];if(firstLayoutName){const firstLayout=this._layoutManager.GetLayoutByName(firstLayoutName);if(firstLayout)this._layoutManager.SetFirstLayout(firstLayout)}for(const timelineData of projectData[33])this._timelineManager.Create(timelineData); +for(const transitionData of projectData[35])this._transitionManager.Create(transitionData);for(const templateInstanceData of projectData[44])this._templateManager.Create(templateInstanceData);if(!this._templateManager.HasTemplates()){this._templateManager.Release();this._templateManager=null}this._InitScriptInterfaces();for(const eventSheetData of projectData[6])this._eventSheetManager.Create(eventSheetData);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();C3.clearArray(this._objectReferenceTable); +this.FlushPendingInstances();let targetOrientation="any";const orientations=projectData[20];if(orientations===1)targetOrientation="portrait";else if(orientations===2)targetOrientation="landscape";this.PostComponentMessageToDOM("runtime","set-target-orientation",{"targetOrientation":targetOrientation})}async _LoadExportToVideoData(exportToVideoOpts){const format=exportToVideoOpts["format"];if(format==="image-sequence")this._exportToVideo=new self.C3ExportToImageSequence(this,exportToVideoOpts);else if(format=== +"image-sequence-gif")this._exportToVideo=new self.C3ExportToGIF(this,exportToVideoOpts);else if(format==="webm")this._exportToVideo=new self.C3ExportToWebMVideo(this,exportToVideoOpts);else if(format==="mp4")this._exportToVideo=new self.C3ExportToMP4Video(this,exportToVideoOpts);else;this._framerateMode="unlimited-frame";this._canvasManager.SetFullscreenMode("off");this._devicePixelRatio=1;self.devicePixelRatio=1;await this.PostComponentMessageToDOMAsync("runtime","set-exporting-to-video",{"message":this._exportToVideo.GetExportingMessageForPercent(0), +"duration":this._exportToVideo.GetDuration()})}GetLoaderStyle(){return this._loaderStyle}IsExportToVideo(){return this._exportToVideo!==null}GetExportVideoDuration(){return this._exportToVideo.GetDuration()}GetExportVideoFramerate(){return this._exportToVideo.GetFramerate()}_InitExportToVideo(){return this._exportToVideo.Init({width:this._canvasManager.GetDeviceWidth(),height:this._canvasManager.GetDeviceHeight()})}_ExportToVideoAddFrame(){const time=this._tickCount/this.GetExportVideoFramerate(); +return this._exportToVideo.AddFrame(this._canvasManager.GetCanvas(),time)}_ExportToVideoAddKeyframe(){if(this._exportToVideo)this._exportToVideo.AddKeyframe()}_OnOfflineAudioRenderCompleted(e){this._exportToVideo.OnOfflineAudioRenderCompleted(e)}_ExportToVideoFinish(){return this._exportToVideo.Finish()}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(promise){this._additionalLoadPromises.push(promise)}SetUsingCreatePromises(e){this._isUsingCreatePromises= +!!e}AddCreatePromise(promise){if(!this._isUsingCreatePromises)return;this._additionalCreatePromises.push(promise)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(el){this._allEffectLists.push(el)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(opts){if(!this._canvasManager)return;await this._canvasManager.CreateCanvas(opts);this._canvasManager.InitLoadingScreen(this._loaderStyle)}async _MaybeLoadOpusDecoder(){if(this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus"))return; +let wasmBlob=null;let wasmBuffer=null;try{if(this.IsiOSCordova()&&this._assetManager.IsFileProtocol())wasmBuffer=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl);else wasmBuffer=await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(err){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",err);return}if(wasmBuffer)this.AddJobWorkerBuffer(wasmBuffer,"opus-decoder-wasm");else this.AddJobWorkerBlob(wasmBlob,"opus-decoder-wasm"); +await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}async _WasmDecodeWebMOpus(arrayBuffer){const result=await this.AddJob("OpusDecode",{"arrayBuffer":arrayBuffer},[arrayBuffer]);return result}async Start(){this._hasStarted=true;this._startTime=Date.now();if(this._usesLoaderLayout){for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&!objectClass.IsOnLoaderLayout()&&objectClass.IsWorldType())objectClass.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading= +false;this._OnLoadFinished()})}else this._isLoading=false;this._assetManager.SetInitialLoadFinished();if(this.IsDebug())C3Debugger.RuntimeInit(ife);for(const layout of this._layoutManager.GetAllLayouts())layout._CreateGlobalNonWorlds();if(this.IsExportToVideo())await this._InitExportToVideo();const firstLayout=this._layoutManager.GetFirstLayout();await firstLayout._Load(null,this.GetRenderer());await firstLayout._StartRunning(true);this._fpsLastTime=performance.now();if(!this._usesLoaderLayout)this._OnLoadFinished(); +const state=await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking");if(state["isSuspended"]&&!this.IsExportToVideo())this._suspendCount++;else this.Tick()}_OnLoadFinished(){this.Trigger(C3.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(index){index=Math.floor(index);const objRefTable=this._objectReferenceTable;if(index<0||index>=objRefTable.length)throw new Error("invalid object reference");return objRefTable[index]}_LoadJsPropNameTable(){for(const entry of self.C3_JsPropNameTable){const propName= +C3.first(Object.keys(entry));this._jsPropNameTable.push(propName)}}GetJsPropName(index){index=Math.floor(index);const jsPropNameTable=this._jsPropNameTable;if(index<0||index>=jsPropNameTable.length)throw new Error("invalid prop reference");return jsPropNameTable[index]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetRuntimeBaseURL(){return this._runtimeBaseUrl}GetPreviewURL(){return this._previewUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return this.GetCurrentEventStackFrame().GetConditionIndex()=== +0}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(i){i=Math.floor(i);if(i<0||i>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[i]}GetObjectClassByName(name){return this._objectClassesByName.get(name.toLowerCase())||null}GetObjectClassBySID(sid){return this._objectClassesBySid.get(sid)||null}GetSingleGlobalObjectClassByCtor(ctor){const plugin= +this._pluginManager.GetPluginByConstructorFunction(ctor);if(!plugin)return null;return plugin.GetSingleGlobalObjectClass()}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;yield*objectClass.instances()}}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.runtime=this.GetIRuntime();const shouldTime=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine(); +if(shouldTime)C3Debugger.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);if(shouldTime)C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(w,h){if(this._originalViewportWidth===w&&this._originalViewportHeight===h)return;this._originalViewportWidth= +w;this._originalViewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(w,h){if(this._viewportWidth===w&&this._viewportHeight===h)return;this._viewportWidth=w;this._viewportHeight=h;const layoutManager=this.GetLayoutManager();layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged()}_SetDevicePixelRatio(r){if(this.IsExportToVideo())return; +this._devicePixelRatio=r}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){if(!this._canvasManager)return this._viewportWidth;return this._canvasManager.GetDrawWidth()}GetDrawHeight(){if(!this._canvasManager)return this._viewportHeight;return this._canvasManager.GetDrawHeight()}GetRenderScale(){if(!this._canvasManager)return 1;return this._canvasManager.GetRenderScale()}GetDisplayScale(){if(!this._canvasManager)return 1; +return this._canvasManager.GetDisplayScale()}GetEffectLayerScaleParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectLayerScaleParam()}GetEffectDevicePixelRatioParam(){if(!this._canvasManager)return 1;return this._canvasManager.GetEffectDevicePixelRatioParam()}GetCanvasClientX(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientX()}GetCanvasClientY(){if(!this._canvasManager)return 0;return this._canvasManager.GetCanvasClientY()}GetCanvasCssWidth(){if(!this._canvasManager)return 0; +return this._canvasManager.GetCssWidth()}GetCanvasCssHeight(){if(!this._canvasManager)return 0;return this._canvasManager.GetCssHeight()}GetFullscreenMode(){if(!this._canvasManager)return"off";return this._canvasManager.GetFullscreenMode()}GetAdditionalRenderTarget(opts){if(!this._canvasManager)return null;return this._canvasManager.GetAdditionalRenderTarget(opts)}ReleaseAdditionalRenderTarget(renderTarget){if(!this._canvasManager)return;this._canvasManager.ReleaseAdditionalRenderTarget(renderTarget)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyCrossSampling(){return this._usesAnyCrossSampling}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}GetGPUUtilisation(){if(!this._canvasManager)return NaN; +return this._canvasManager.GetGPUUtilisation()}IsLinearSampling(){return this.GetSampling()!=="nearest"}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){if(this._loadingLogoAsset){this._loadingLogoAsset.Release();this._loadingLogoAsset=null}}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetTemplateManager(){return this._templateManager}GetAssetManager(){return this._assetManager}LoadImage(opts){return this._assetManager.LoadImage(opts)}CreateInstance(objectClass, +layer,x,y,createHierarchy,templateName){if(templateName&&this._templateManager){const templateData=this._templateManager.GetTemplateData(objectClass,templateName);if(templateData){const inst=this.CreateInstanceFromData(templateData,layer,false,x,y,false,createHierarchy,undefined,createHierarchy);this._templateManager.MapInstanceToTemplateName(inst,templateName);return inst}}return this.CreateInstanceFromData(objectClass,layer,false,x,y,false,createHierarchy,undefined,createHierarchy)}CreateInstanceFromData(instData_or_objectClass, +layer,isStartupInstance,x,y,skipSiblings,createHierarchy,previousInstance,creatingHierarchy){let instData=null;let objectClass=null;if(instData_or_objectClass instanceof C3.ObjectClass){objectClass=instData_or_objectClass;if(objectClass.IsFamily()){const members=objectClass.GetFamilyMembers();const i=Math.floor(this.Random()*members.length);objectClass=members[i]}instData=objectClass.GetDefaultInstanceData()}else{instData=instData_or_objectClass;objectClass=this.GetObjectClassByIndex(instData[1])}const isWorld= +objectClass.GetPlugin().IsWorldType();if(this._isLoading&&isWorld&&!objectClass.IsOnLoaderLayout())return null;const originalLayer=layer;if(!isWorld)layer=null;let uid;if(isStartupInstance&&!skipSiblings&&instData&&!this._instancesByUid.has(instData[2]))uid=instData[2];else uid=this._nextUid++;const worldData=instData?instData[0]:null;const inst=C3.New(C3.Instance,{runtime:this,objectType:objectClass,layer:layer,worldData,instVarData:instData?instData[3]:null,uid:uid});this._instancesByUid.set(uid, +inst);let wi=null;if(isWorld){wi=inst.GetWorldInfo();if(typeof x!=="undefined"&&typeof y!=="undefined"){wi.SetX(x);wi.SetY(y)}objectClass._SetAnyCollisionCellChanged(true)}if(layer){if(!creatingHierarchy)layer._AddInstance(inst,true);if(layer.GetParallaxX()!==1||layer.GetParallaxY()!==1)objectClass._SetAnyInstanceParallaxed(true);layer.GetLayout().MaybeLoadTexturesFor(objectClass)}this._objectCount++;let needsSiblingCreation=true;if(previousInstance){const previousObjectClass=previousInstance.GetObjectClass(); +if(previousObjectClass.IsInContainer()&&objectClass.IsInContainer()){const container=objectClass.GetContainer();const previousContainer=previousObjectClass.GetContainer();if(container===previousContainer)needsSiblingCreation=false}}if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&needsSiblingCreation){for(const containerType of objectClass.GetContainer().objectTypes()){if(containerType===objectClass)continue;const siblingInst=this.CreateInstanceFromData(containerType,originalLayer, +false,wi?wi.GetX():x,wi?wi.GetY():y,true,false,undefined,creatingHierarchy);inst._AddSibling(siblingInst)}for(const s of inst.siblings()){s._AddSibling(inst);for(const s2 of inst.siblings())if(s!==s2)s._AddSibling(s2)}}if(isWorld&&!isStartupInstance&&!!createHierarchy)this._CreateChildInstancesFromData(inst,worldData,wi,layer,x,y,creatingHierarchy);if(objectClass.IsInContainer()&&!isStartupInstance&&!skipSiblings&&!!createHierarchy)for(const sibling of inst.siblings()){const swi=sibling.GetWorldInfo(); +if(!swi)continue;const siblingPlugin=sibling.GetPlugin();const sWorldData=sibling.GetObjectClass().GetDefaultInstanceData()[0];if(siblingPlugin.IsWorldType())this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,swi.GetX(),swi.GetY(),creatingHierarchy);else this._CreateChildInstancesFromData(sibling,sWorldData,swi,layer,undefined,undefined,creatingHierarchy)}if(!skipSiblings&&!!createHierarchy){if(typeof x==="undefined")x=worldData[0];if(typeof y==="undefined")y=worldData[1];const pwi=wi.GetTopParent(); +const newX=x-wi.GetX()+pwi.GetX();const newY=y-wi.GetY()+pwi.GetY();pwi.SetXY(newX,newY)}objectClass._SetIIDsStale();const instPropertyData=instData?C3.cloneArray(instData[5]):null;const behPropertyData=instData?instData[4].map(bp=>C3.cloneArray(bp)):null;const hasTilemap=isWorld&&worldData&&worldData[13];if(hasTilemap)inst._SetHasTilemap();inst._CreateSdkInstance(instPropertyData,behPropertyData);if(hasTilemap){const tilemapData=worldData[13];inst.GetSdkInstance().LoadTilemapData(tilemapData[2], +tilemapData[0],tilemapData[1])}this._instancesPendingCreate.push(inst);this._hasPendingInstances=true;if(this.IsDebug())C3Debugger.InstanceCreated(inst);return inst}_CreateChildInstancesFromData(parentInstance,parentWorldData,parentWorldInfo,layer,x,y,creatingHierarchy){const parentZIndex=parentWorldInfo.GetSceneGraphZIndexExportData();const childrenData=parentWorldInfo.GetSceneGraphChildrenExportData();parentInstance.GetWorldInfo().SetSceneGraphZIndex(parentZIndex);if(!childrenData)return;if(typeof x=== +"undefined")x=parentWorldData[0];if(typeof y==="undefined")y=parentWorldData[1];const sceneGraphSiblings=new Set;const parentX=parentWorldData[0];const parentY=parentWorldData[1];for(const childData of childrenData){const childLayoutSID=childData[0];const childLayerIndex=childData[1];const childUID=childData[2];const childFlags=childData[3];const childIsInContainer=!!childData[4];const childZIndex=childData[5];const uniqueInstanceData=childData[6];let childInstData;if(uniqueInstanceData)childInstData= +uniqueInstanceData;else{const layout=this._layoutManager.GetLayoutBySID(childLayoutSID);const l=layout.GetLayer(childLayerIndex);childInstData=l.GetInitialInstanceData(childUID)}const childObjectClass=this.GetObjectClassByIndex(childInstData[1]);const hasSibling=parentInstance.HasSibling(childObjectClass);const siblingProcessed=sceneGraphSiblings.has(childObjectClass);if(hasSibling&&!siblingProcessed&&childIsInContainer){const childInst=parentInstance.GetSibling(childObjectClass);const childX=x+childInstData[0][0]- +parentX;const childY=y+childInstData[0][1]-parentY;childInst.GetWorldInfo().SetXY(childX,childY);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex);parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>>4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1),transformOpacity:!!(childFlags>>7&1),transformVisibility:!!(childFlags>> +8&1)});sceneGraphSiblings.add(childObjectClass)}else{const childX=x+childInstData[0][0]-parentX;const childY=y+childInstData[0][1]-parentY;const childInst=this.CreateInstanceFromData(childInstData,layer,false,childX,childY,false,true,parentInstance,creatingHierarchy);childInst.GetWorldInfo().SetSceneGraphZIndex(childZIndex);parentInstance.AddChild(childInst,{transformX:!!(childFlags>>0&1),transformY:!!(childFlags>>1&1),transformWidth:!!(childFlags>>2&1),transformHeight:!!(childFlags>>3&1),transformAngle:!!(childFlags>> +4&1),destroyWithParent:!!(childFlags>>5&1),transformZElevation:!!(childFlags>>6&1),transformOpacity:!!(childFlags>>7&1),transformVisibility:!!(childFlags>>8&1)})}}}DestroyInstance(inst){if(this._instancesToReleaseAtEndOfTick.has(inst))return;const objectClass=inst.GetObjectClass();let s=this._instancesPendingDestroy.get(objectClass);if(s){if(s.has(inst))return;s.add(inst)}else{s=new Set;s.add(inst);this._instancesPendingDestroy.set(objectClass,s)}if(this.IsDebug())C3Debugger.InstanceDestroyed(inst); +inst._MarkDestroyed();this._hasPendingInstances=true;if(inst.IsInContainer())for(const s of inst.siblings())this.DestroyInstance(s);for(const c of inst.children())if(c.GetDestroyWithParent())this.DestroyInstance(c);if(!this._layoutManager.IsEndingLayout()&&!this._isLoadingState){const eventSheetManager=this.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnDestroyed();eventSheetManager.BlockFlushingInstances(false)}inst._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}FlushPendingInstances(){if(!this._hasPendingInstances)return; +this._isFlushingPendingInstances=true;this._FlushInstancesPendingCreate();this._FlushInstancesPendingDestroy();this._isFlushingPendingInstances=false;this._hasPendingInstances=false;this.UpdateRender()}_FlushInstancesPendingCreate(){for(const inst of this._instancesPendingCreate){const objectType=inst.GetObjectClass();objectType._AddInstance(inst);for(const family of objectType.GetFamilies()){family._AddInstance(inst);family._SetIIDsStale()}}C3.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(true); +for(const [objectClass,s]of this._instancesPendingDestroy.entries()){this._FlushInstancesPendingDestroyForObjectClass(objectClass,s);s.clear()}this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(false)}_FlushInstancesPendingDestroyForObjectClass(objectClass,s){for(const inst of s){const instanceDestroyEvent=this._eventObjects["instancedestroy"];instanceDestroyEvent.instance=inst;this._dispatcher.dispatchEvent(instanceDestroyEvent);this._instancesByUid.delete(inst.GetUID()); +this._instanceTimes.delete(inst);const wi=inst.GetWorldInfo();if(wi){wi._RemoveFromCollisionCells();wi._RemoveFromRenderCells();wi._MarkDestroyed()}this._instancesToReleaseAtEndOfTick.add(inst);this._objectCount--}C3.arrayRemoveAllInSet(objectClass.GetInstances(),s);objectClass._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(objectClass);if(objectClass.GetInstances().length===0)objectClass._SetAnyInstanceParallaxed(false);for(const family of objectClass.GetFamilies()){C3.arrayRemoveAllInSet(family.GetInstances(), +s);family._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(family)}if(objectClass.GetPlugin().IsWorldType()){const layers=new Set([...s].map(i=>i.GetWorldInfo().GetLayer()));for(const layer of layers)layer._RemoveAllInstancesInSet(s)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(objectClass){for(const inst of this._GetInstancesPendingCreate())if(objectClass.IsFamily()){if(inst.GetObjectClass().BelongsToFamily(objectClass))yield inst}else if(inst.GetObjectClass()=== +objectClass)yield inst}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(uid,inst){this._instancesByUid.set(uid,inst)}_OnRendererContextLost(){this._dispatcher.dispatchEvent(C3.New(C3.Event,"renderercontextlost"));this.SetSuspended(true);for(const objectClass of this._allObjectClasses)if(!objectClass.IsFamily()&&objectClass.HasLoadedTextures())objectClass.ReleaseTextures();const runningLayout=this.GetMainRunningLayout();if(runningLayout)runningLayout._OnRendererContextLost();C3.ImageInfo.OnRendererContextLost(); +C3.ImageAsset.OnRendererContextLost()}async _OnRendererContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetRenderer());this._dispatcher.dispatchEvent(C3.New(C3.Event,"renderercontextrestored"));this.SetSuspended(false);this.UpdateRender()}_OnVisibilityChange(e){this.SetSuspended(e["hidden"])}_OnWindowBlur(e){if(!this.IsPreview()||!this._pauseOnBlur||C3.Platform.IsMobile)return;if(!e.data["parentHasFocus"]){this.SetSuspended(true);this._isPausedOnBlur=true}}_OnWindowFocus(){if(!this._isPausedOnBlur)return; +this.SetSuspended(false);this._isPausedOnBlur=false}_RequestAnimationFrame(){const tickCallbacks=this._tickCallbacks;if(this._framerateMode==="vsync"){if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.normal)}else if(this._framerateMode==="unlimited-tick"){if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.tickOnly);if(this._rafId===-1)this._rafId=self.requestAnimationFrame(tickCallbacks.renderOnly)}else if(this._ruafId===-1)this._ruafId=C3.RequestUnlimitedAnimationFrame(tickCallbacks.normal)}_CancelAnimationFrame(){if(this._rafId!== +-1){self.cancelAnimationFrame(this._rafId);this._rafId=-1}if(this._ruafId!==-1){C3.CancelUnlimitedAnimationFrame(this._ruafId);this._ruafId=-1}}IsSuspended(){return this._suspendCount>0}SetSuspended(s){if(this.IsExportToVideo())return;const wasSuspended=this.IsSuspended();this._suspendCount+=s?1:-1;if(this._suspendCount<0)this._suspendCount=0;const isSuspended=this.IsSuspended();if(!wasSuspended&&isSuspended){console.log("[Construct] Suspending");this._CancelAnimationFrame();this._dispatcher.dispatchEvent(C3.New(C3.Event, +"suspend"));this.Trigger(C3.Plugins.System.Cnds.OnSuspend,null,null)}else if(wasSuspended&&!isSuspended){console.log("[Construct] Resuming");const now=performance.now();this._lastTickTime=now;this._fpsLastTime=now;this._fpsFrameCount=0;this._fps=0;this._mainThreadTime=0;this._mainThreadTimeCounter=0;this._dispatcher.dispatchEvent(C3.New(C3.Event,"resume"));this.Trigger(C3.Plugins.System.Cnds.OnResume,null,null);if(!this.HitBreakpoint())this.Tick(now)}}_AddBehInstToTick(behSdkInst){this._behInstsToTick.Add(behSdkInst)}_AddBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Add(behSdkInst)}_AddBehInstToTick2(behSdkInst){this._behInstsToTick2.Add(behSdkInst)}_RemoveBehInstToTick(behSdkInst){this._behInstsToTick.Remove(behSdkInst)}_RemoveBehInstToPostTick(behSdkInst){this._behInstsToPostTick.Remove(behSdkInst)}_RemoveBehInstToTick2(behSdkInst){this._behInstsToTick2.Remove(behSdkInst)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true); +for(const bi of this._behInstsToTick)bi.Tick();this._behInstsToTick.SetQueueingEnabled(false)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick)bi.PostTick();this._behInstsToPostTick.SetQueueingEnabled(false)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2)bi.Tick2();this._behInstsToTick2.SetQueueingEnabled(false)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(true);for(const bi of this._behInstsToTick){const ret= +bi.Tick();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick.SetQueueingEnabled(false)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(true);for(const bi of this._behInstsToPostTick){const ret=bi.PostTick();if(C3.IsIterator(ret))yield*ret}this._behInstsToPostTick.SetQueueingEnabled(false)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(true);for(const bi of this._behInstsToTick2){const ret=bi.Tick2();if(C3.IsIterator(ret))yield*ret}this._behInstsToTick2.SetQueueingEnabled(false)}async Tick(timestamp, +isDebugStep,mode){this._hasStartedTicking=true;const isBackgroundWake=mode==="background-wake";const shouldRender=mode!=="background-wake"&&mode!=="skip-render";if(!this._hasStarted||this.IsSuspended()&&!isDebugStep&&!isBackgroundWake)return;const startTime=performance.now();this._isInTick=true;this._MeasureDt(timestamp||0);const beforePreTickRet=this.Step_BeforePreTick();if(this.IsDebugging())await beforePreTickRet;const pretickRet=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects["pretick"]); +if(pretickRet instanceof Promise)await pretickRet;const afterPreTickRet=this.Step_AfterPreTick();if(this.IsDebugging())await afterPreTickRet;if(this._NeedsHandleSaveOrLoad())await this._HandleSaveOrLoad();if(this.GetLayoutManager().IsPendingChangeMainLayout())await this._MaybeChangeLayout();const runEventsRet=this.Step_RunEventsEtc();if(this.IsDebugging())await runEventsRet;if(shouldRender)this.Render();if(this.IsExportToVideo()){await this._ExportToVideoAddFrame();if(this.GetGameTime()>=this.GetExportVideoDuration()){this._ExportToVideoFinish(); +return}}if(!this.IsSuspended()&&!isBackgroundWake)this._RequestAnimationFrame();this._tickCount++;this._tickCountNoSave++;this._isInTick=false;this._mainThreadTimeCounter+=performance.now()-startTime}async Step_BeforePreTick(){const eventSheetManager=this._eventSheetManager;const isDebug=this.IsDebug();this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true);this.PushCurrentLayout(this.GetMainRunningLayout());if(isDebug)C3Debugger.StartMeasuringTime();if(this.IsDebugging())await eventSheetManager.DebugRunScheduledWaits(); +else eventSheetManager.RunScheduledWaits();if(isDebug)C3Debugger.AddEventsTime();this.PopCurrentLayout();eventSheetManager.BlockFlushingInstances(false);this.FlushPendingInstances();eventSheetManager.BlockFlushingInstances(true)}async Step_AfterPreTick(){const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const userScriptEventObjects=this._userScriptEventObjects;if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick()); +else this._BehaviorTick();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorPostTick());else this._BehaviorPostTick();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick"]);else dispatcher.dispatchEvent(eventObjects["tick"]);if(isDebug)C3Debugger.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(false);this.DispatchUserScriptEvent(userScriptEventObjects["tick"])}async Step_RunEventsEtc(){const eventSheetManager= +this._eventSheetManager;const dispatcher=this._dispatcher;const eventObjects=this._eventObjects;const isDebug=this.IsDebug();const isDebugging=this.IsDebugging();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await eventSheetManager.DebugRunEvents(this._layoutManager);else eventSheetManager.RunEvents(this._layoutManager);if(isDebug)C3Debugger.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=false;eventSheetManager.BlockFlushingInstances(true); +if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugIterateAndBreak(this._DebugBehaviorTick2());else this._BehaviorTick2();if(isDebug)C3Debugger.AddBehaviorTickTime();if(isDebug)C3Debugger.StartMeasuringTime();if(isDebugging)await this.DebugFireGeneratorEventAndBreak(eventObjects["tick2"]);else dispatcher.dispatchEvent(eventObjects["tick2"]);if(isDebug)C3Debugger.AddPluginTickTime();eventSheetManager.BlockFlushingInstances(false);if(isDebugging)await eventSheetManager.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(this._instancesToReleaseAtEndOfTick.size=== +0)return;const dispatcher=this._dispatcher;dispatcher.SetDelayRemoveEventsEnabled(true);for(const objectClass of this._instancesToReleaseAffectedObjectClasses)objectClass.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const inst of this._instancesToReleaseAtEndOfTick)inst.Release();this._instancesToReleaseAtEndOfTick.clear();dispatcher.SetDelayRemoveEventsEnabled(false)}async _MaybeChangeLayout(){const layoutManager= +this.GetLayoutManager();let i=0;while(layoutManager.IsPendingChangeMainLayout()&&i++<10)await this._DoChangeLayout(layoutManager.GetPendingChangeMainLayout())}_MeasureDt(timestamp){let dtRaw=0;if(this.IsExportToVideo()){dtRaw=1/this.GetExportVideoFramerate();this._dtRaw=dtRaw;this._dt1=dtRaw}else if(this._lastTickTime!==0){const msDiff=Math.max(timestamp-this._lastTickTime,0);dtRaw=msDiff/1E3;if(dtRaw>.5)dtRaw=0;this._dtRaw=dtRaw;const maxDt1=1/this._minimumFramerate;this._dt1=Math.min(dtRaw,maxDt1)}this._lastTickTime= +timestamp;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(dtRaw*this._timeScale);this._wallTime.Add(this._dt1);for(const [inst,instTime]of this._instanceTimes)instTime.Add(this._dt1*inst.GetTimeScale());if(this._canvasManager)this._canvasManager._UpdateTick();if(timestamp-this._fpsLastTime>=1E3){this._fpsLastTime+=1E3;if(timestamp-this._fpsLastTime>=1E3)this._fpsLastTime=timestamp;this._fps=this._fpsFrameCount;this._fpsFrameCount=0;this._mainThreadTime=Math.min(this._mainThreadTimeCounter/ +1E3,1);this._mainThreadTimeCounter=0;if(this._canvasManager)this._canvasManager._Update1sFrameRange();this._collisionEngine._Update1sStats();if(this.IsDebug())C3Debugger.Update1sPerfStats()}this._fpsFrameCount++}_SetTrackingInstanceTime(inst,enable){if(enable){if(!this._instanceTimes.has(inst)){const instTime=C3.New(C3.KahanSum);instTime.Copy(this._gameTime);this._instanceTimes.set(inst,instTime)}}else this._instanceTimes.delete(inst)}_GetInstanceGameTime(inst){const instTime=this._instanceTimes.get(inst); +return instTime?instTime.Get():this.GetGameTime()}async _DoChangeLayout(changeToLayout){const dispatcher=this._dispatcher;const layoutManager=this.GetLayoutManager();const prevLayout=layoutManager.GetMainRunningLayout();await prevLayout._StopRunning();prevLayout._Unload(changeToLayout,this.GetRenderer());if(prevLayout===changeToLayout)this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();dispatcher.dispatchEvent(this._eventObjects["beforelayoutchange"]); +C3.Asyncify.SetHighThroughputMode(true);await changeToLayout._Load(prevLayout,this.GetRenderer());C3.Asyncify.SetHighThroughputMode(false);await changeToLayout._StartRunning(false);dispatcher.dispatchEvent(this._eventObjects["layoutchange"]);this.UpdateRender();this._isLayoutFirstTick=true;this.FlushPendingInstances();this._ExportToVideoAddKeyframe()}UpdateRender(){this._needRender=true}GetWebGLRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetWebGLRenderer()}GetWebGPURenderer(){if(!this._canvasManager)return null; +return this._canvasManager.GetWebGPURenderer()}GetRenderer(){if(!this._canvasManager)return null;return this._canvasManager.GetRenderer()}Render(){const canvasManager=this._canvasManager;if(!canvasManager||canvasManager.IsRendererContextLost())return;const renderer=this.GetRenderer();const supportsGPUProfiling=renderer.SupportsGPUProfiling();const isWebGLProfiling=supportsGPUProfiling&&renderer.IsWebGL();const isWebGPUProfiling=supportsGPUProfiling&&renderer.IsWebGPU();if(isWebGLProfiling)renderer.CheckForQueryResults(); +if(!this._needRender&&!this.IsExportToVideo()){renderer.IncrementFrameNumber();return}const layout=this._layoutManager.GetMainRunningLayout();renderer.Start();const isDebug=this.IsDebug();if(isDebug)C3Debugger.StartMeasuringTime();this._needRender=false;let webglFrameQuery=null;if(isWebGLProfiling){webglFrameQuery=canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery();renderer.StartQuery(webglFrameQuery)}let webgpuFrameTimings=null;if(isWebGPUProfiling){webgpuFrameTimings=renderer.StartFrameTiming((1+ +layout.GetLayerCount())*2);renderer.WriteTimestamp(0)}if(this.Uses3DFeatures()&&canvasManager.GetCurrentFullscreenScalingQuality()==="low")renderer.SetFixedSizeDepthBuffer(canvasManager.GetDrawWidth(),canvasManager.GetDrawHeight());else renderer.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),layout);if(webglFrameQuery)renderer.EndQuery(webglFrameQuery);if(isWebGPUProfiling){renderer.WriteTimestamp(1);this._canvasManager._AddWebGPUFrameTiming(webgpuFrameTimings)}renderer.Finish();if(isDebug){C3Debugger.AddDrawCallsTime(); +C3Debugger.UpdateInspectHighlight()}if(canvasManager)canvasManager._MaybeTakeSnapshot()}_Render(renderer,layout){renderer.SetTextureFillMode();renderer.SetAlphaBlend();renderer.SetColorRgba(1,1,1,1);renderer.SetRenderTarget(null);renderer.SetTexture(null);renderer.SetDepthEnabled(this.Uses3DFeatures());layout.Draw(renderer)}Trigger(method,inst,behaviorType){if(!this._hasStarted)return false;const isTopLevel=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let startTime=0;if(isTopLevel)startTime= +performance.now();const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._Trigger(this._layoutManager,method,inst,behaviorType);if(isTopLevel){const triggerTime=performance.now()-startTime;this._mainThreadTimeCounter+=triggerTime;if(isDebug)C3Debugger.AddTriggersTime(triggerTime)}if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugTrigger(method,inst,behaviorType){if(!this.IsDebug())return this.Trigger(method,inst,behaviorType);if(this.HitBreakpoint())throw new Error("called DebugTrigger() while stopped on breakpoint"); +if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw new Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType)}async TriggerAsync(method,inst,behaviorType){if(!this.IsDebugging())return this.Trigger(method,inst,behaviorType);if(!this._hasStarted)return false;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(method,inst,behaviorType);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(method, +inst,behaviorType);const startTime=performance.now();const iter=this._eventSheetManager._DebugTrigger(this._layoutManager,method,inst,behaviorType);let result=iter.next();while(!result.done){await this.DebugBreak(result.value);result=iter.next()}if(!this.IsSuspended()&&!this._eventSheetManager.IsInTrigger()){await this._eventSheetManager.RunQueuedDebugTriggersAsync();if(this._hasStartedTicking&&!this._isInTick)this._RequestAnimationFrame()}this._mainThreadTimeCounter+=performance.now()-startTime; +return result.value}FastTrigger(method,inst,value){const isDebug=this.IsDebug();if(isDebug)this.SetDebuggingEnabled(false);const ret=this._eventSheetManager._FastTrigger(this._layoutManager,method,inst,value);if(isDebug)this.SetDebuggingEnabled(true);return ret}DebugFastTrigger(method,inst,value){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,method,inst,value)}ScheduleTriggers(f){return this._scheduleTriggersThrottle.Add(f)}PushCurrentLayout(layout){this._currentLayoutStack.push(layout)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw new Error("layout stack empty"); +this._currentLayoutStack.pop()}GetCurrentLayout(){if(!this._currentLayoutStack.length)return this.GetMainRunningLayout();return this._currentLayoutStack.at(-1)}GetDt(inst){if(!inst||inst.GetTimeScale()===-1)return this._dt;return this._dt1*inst.GetTimeScale()}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetDtRaw(){return this._dtRaw}GetTimeScale(){return this._timeScale}SetTimeScale(ts){if(isNaN(ts)||ts<0)ts=0;this._timeScale=ts}SetMinimumFramerate(fps){this._minimumFramerate=C3.clamp(fps, +1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(uid){if(this._isLoadingState)throw new Error("cannot call while loading state - wait until afterload event"); +return this._instancesByUid.get(uid)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily())continue;for(const inst of objectClass.GetInstances())this._instancesByUid.set(inst.GetUID(),inst)}}IsPreview(){return this._exportType==="preview"}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return this._exportType==="cordova"}IsAndroidWebView(){return C3.Platform.OS==="Android"&&(this._exportType=== +"cordova"||this._exportType==="playable-ad"||this._exportType==="instant-games")}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){return this.GetRenderer().GetZAxisScaleFactor(this.GetViewportHeight())}GetDefaultCameraZ(viewH){return this.GetRenderer().GetDefaultCameraZ(viewH|| +this.GetViewportHeight())}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(e){e=!!e;if(this._isPixelRoundingEnabled===e)return;this._isPixelRoundingEnabled=e;this.GetLayoutManager().SetAllLayerMVChanged();this.UpdateRender()}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}GetTextIconSet(iconSource){const iconSet=this._textIconManager.GetIconSet(iconSource);if(!iconSet.HasLoaded())iconSet.LoadContent().then(()=>this.UpdateRender());return iconSet}_GetTextIconSetMeta(iconSource){const icons= +[];for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames()){const imageInfo=frame.GetImageInfo();icons.push({source:frame,width:imageInfo.GetWidth(),height:imageInfo.GetHeight(),tag:frame.GetTag()})}return{icons}}async _GetTextIconSetContent(iconSource){const promiseThrottle=C3.New(C3.PromiseThrottle);const assetDrawablePromises=[];const assetDrawableMap=new Map;for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames()){const imageAsset= +frame.GetImageInfo().GetImageAsset();if(assetDrawableMap.has(imageAsset))continue;assetDrawableMap.set(imageAsset,null);assetDrawablePromises.push(promiseThrottle.Add(async()=>{const drawable=await imageAsset.LoadToDrawable();assetDrawableMap.set(imageAsset,drawable)}))}await Promise.all(assetDrawablePromises);const extractPromises=[];for(const animation of iconSource.GetAnimations())for(const frame of animation.GetFrames())extractPromises.push(promiseThrottle.Add(async()=>{const imageInfo=frame.GetImageInfo(); +const imageAssetDrawable=assetDrawableMap.get(imageInfo.GetImageAsset());const canvas=await imageInfo.ExtractImageToCanvas(imageAssetDrawable);const imageBitmap=await createImageBitmap(canvas);return{drawable:imageBitmap}}));const iconsArr=await Promise.all(extractPromises);for(const drawable of assetDrawableMap.values())if(drawable instanceof ImageBitmap&&drawable["close"])drawable["close"]();return{icons:iconsArr}}SaveToSlot(slotName){this._saveToSlotName=slotName}LoadFromSlot(slotName){this._loadFromSlotName= +slotName}LoadFromJsonString(str){this._loadFromJson=str}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!!(this._saveToSlotName||this._loadFromSlotName||this._loadFromJson!==null)}async _HandleSaveOrLoad(){if(this._saveToSlotName){this.FlushPendingInstances();await this._DoSaveToSlot(this._saveToSlotName);this._ClearSaveOrLoad()}if(this._loadFromSlotName){await this._DoLoadFromSlot(this._loadFromSlotName);this._ClearSaveOrLoad();if(this.IsDebug())C3Debugger.StepIfPausedInDebugger()}if(this._loadFromJson!== +null){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson);this._lastSaveJson=this._loadFromJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from JSON string: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._saveToSlotName="";this._loadFromSlotName="";this._loadFromJson=null}_GetProjectStorage(){if(!this._projectStorage)this._projectStorage= +localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()});return this._projectStorage}_GetSavegamesStorage(){if(!this._savegamesStorage)this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()});return this._savegamesStorage}async _DoSaveToSlot(slotName){const saveJson=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(slotName,saveJson);console.log("[Construct] Saved state to storage ("+ +saveJson.length+" chars)");this._lastSaveJson=saveJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to save state to storage: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(slotName){try{const loadJson=await this._GetSavegamesStorage().getItem(slotName);if(!loadJson)throw new Error("empty slot");console.log("[Construct] Loaded state from storage ("+loadJson.length+ +" chars)");await this._DoLoadFromJsonString(loadJson);this._lastSaveJson=loadJson;await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(err){console.error("[Construct] Failed to load state from storage: ",err);await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const o={"c3save":true,"version":1,"rt":{"time":this.GetGameTime(),"timeRaw":this.GetGameTimeRaw(),"walltime":this.GetWallTime(),"timescale":this.GetTimeScale(), +"tickcount":this.GetTickCount(),"next_uid":this._nextUid,"running_layout":this.GetMainRunningLayout().GetSID(),"start_time_offset":Date.now()-this._startTime},"types":{},"layouts":{},"events":this._eventSheetManager._SaveToJson(),"timelines":this._timelineManager._SaveToJson(),"user_script_data":null};for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;o["types"][objectClass.GetSID().toString()]=objectClass._SaveToJson()}for(const layout of this._layoutManager.GetAllLayouts())o["layouts"][layout.GetSID().toString()]= +layout._SaveToJson();const saveEvent=this._CreateUserScriptEvent("save");saveEvent.saveData=null;await this.DispatchUserScriptEventAsyncWait(saveEvent);o["user_script_data"]=saveEvent.saveData;return JSON.stringify(o)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(jsonStr){const layoutManager=this.GetLayoutManager();const o=JSON.parse(jsonStr);if(o["c2save"])throw new Error("C2 saves are incompatible with C3 runtime");if(!o["c3save"])throw new Error("not valid C3 save data"); +if(o["version"]>1)throw new Error("C3 save data from future version");this._dispatcher.dispatchEvent(C3.New(C3.Event,"beforeload"));for(const inst of this.allInstances()){const objectClass=inst.GetObjectClass();if(objectClass.HasNoSaveBehavior())continue;inst._OnBeforeLoad()}const rt=o["rt"];this._gameTime.Set(rt["time"]);if(rt.hasOwnProperty("timeRaw"))this._gameTimeRaw.Set(rt["timeRaw"]);this._wallTime.Set(rt["walltime"]);this._timeScale=rt["timescale"];this._tickCount=rt["tickcount"];this._startTime= +Date.now()-rt["start_time_offset"];const layoutSid=rt["running_layout"];this._isLoadingState=true;let changedLayout=false;if(layoutSid!==this.GetMainRunningLayout().GetSID()){const changeToLayout=layoutManager.GetLayoutBySID(layoutSid);if(changeToLayout){await this._DoChangeLayout(changeToLayout);changedLayout=true}else return}for(const [sidStr,data]of Object.entries(o["layouts"])){const sid=parseInt(sidStr,10);const layout=layoutManager.GetLayoutBySID(sid);if(!layout)continue;layout._LoadFromJson(data)}for(const [sidStr, +data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;objectClass._LoadFromJson(data)}for(const layout of this._layoutManager.GetAllLayouts())for(const layer of layout.allLayers())layer._LoadFromJsonAfterInstances();this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=false;if(changedLayout){for(const inst of this.allInstances())inst.SetupInitialSceneGraphConnections(); +for(const [sidStr,data]of Object.entries(o["types"])){const sid=parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(!objectClass||objectClass.IsFamily()||objectClass.HasNoSaveBehavior())continue;objectClass._SetupSceneGraphConnectionsOnChangeOfLayout(data)}}this._nextUid=rt["next_uid"];this._eventSheetManager._LoadFromJson(o["events"]);for(const objectClass of this._allObjectClasses){if(objectClass.IsFamily()||!objectClass.IsInContainer())continue;for(const inst of objectClass.GetInstances()){const iid= +inst.GetIID();for(const otherType of objectClass.GetContainer().objectTypes()){if(otherType===objectClass)continue;const otherInstances=otherType.GetInstances();if(iid<0||iid>=otherInstances.length)throw new Error("missing sibling instance");inst._AddSibling(otherInstances[iid])}}}this._timelineManager._LoadFromJson(o["timelines"]);layoutManager.SetAllLayerProjectionChanged();layoutManager.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(C3.New(C3.Event,"afterload"));for(const [sidStr,data]of Object.entries(o["types"])){const sid= +parseInt(sidStr,10);const objectClass=this.GetObjectClassBySID(sid);if(objectClass)objectClass._ClearLoadInstancesJson()}const loadEvent=this._CreateUserScriptEvent("load");loadEvent.saveData=o["user_script_data"];await this.DispatchUserScriptEventAsyncWait(loadEvent);this.UpdateRender()}async AddJobWorkerScripts(scripts){const loadUrls=await Promise.all(scripts.map(async url=>{const isCrossOrigin=C3.IsAbsoluteURL(url)&&(new URL(url)).origin!==location.origin;const isCordovaFileProtocol=this.IsCordova()&& +this._assetManager.IsFileProtocol();if(isCrossOrigin||isCordovaFileProtocol||this.IsPreview()||this.GetExportType()==="playable-ad"){const blob=await this._assetManager.FetchBlob(url);return URL.createObjectURL(blob)}else if(C3.IsRelativeURL(url))return(new URL(url,this._runtimeBaseUrl)).toString();else return url}));this._jobScheduler.ImportScriptsToJobWorkers(loadUrls)}AddJobWorkerBlob(blob,id){this._jobScheduler.SendBlobToJobWorkers(blob,id)}AddJobWorkerBuffer(buffer,id){this._jobScheduler.SendBufferToJobWorkers(buffer, +id)}AddJob(type,params,transferables,maxWorkerNum){return this._jobScheduler.AddJob(type,params,transferables,null,null,maxWorkerNum)}BroadcastJob(type,params,transferables,maxWorkerNum){return this._jobScheduler.BroadcastJob(type,params,transferables,maxWorkerNum)}GetMaxNumJobWorkers(){return this._jobScheduler.GetMaxNumWorkers()}InvokeDownload(url,filename){this.PostComponentMessageToDOM("runtime","invoke-download",{"url":url,"filename":filename})}async RasterSvgImage(blob,imageWidth,imageHeight, +surfaceWidth,surfaceHeight,imageBitmapOpts){surfaceWidth=surfaceWidth||imageWidth;surfaceHeight=surfaceHeight||imageHeight;if(this.IsInWorker()){const result=await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{"blob":blob,"imageWidth":imageWidth,"imageHeight":imageHeight,"surfaceWidth":surfaceWidth,"surfaceHeight":surfaceHeight,"imageBitmapOpts":imageBitmapOpts});return result["imageBitmap"]}else{const canvas=await self["C3_RasterSvgImageBlob"](blob,imageWidth,imageHeight,surfaceWidth, +surfaceHeight);if(imageBitmapOpts)return await self.createImageBitmap(canvas,imageBitmapOpts);else return canvas}}async GetSvgImageSize(blob){if(this.IsInWorker())return await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{"blob":blob});else return await self["C3_GetSvgImageSize"](blob)}RequestDeviceOrientationEvent(){if(this._didRequestDeviceOrientationEvent)return;this._didRequestDeviceOrientationEvent=true;this.PostComponentMessageToDOM("runtime","enable-device-orientation")}RequestDeviceMotionEvent(){if(this._didRequestDeviceMotionEvent)return; +this._didRequestDeviceMotionEvent=true;this.PostComponentMessageToDOM("runtime","enable-device-motion")}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(f){this._randomNumberCallback=f}_GetRemotePreviewStatusInfo(){const renderer=this.GetRenderer();return{"fps":this.GetFPS(),"cpu":this.GetMainThreadTime(),"gpu":this.GetGPUUtilisation(),"layout":this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"","renderer":renderer.IsWebGL()?renderer.GetUnmaskedRenderer(): +renderer.GetBasicAdapterInfoString()}}HitBreakpoint(){if(!this.IsDebug())return false;return C3Debugger.HitBreakpoint()}DebugBreak(eventObject){if(!this.IsDebugging())return Promise.resolve();return C3Debugger.DebugBreak(eventObject)}DebugBreakNext(){if(!this.IsDebugging())return false;return C3Debugger.BreakNext()}SetDebugBreakpointsEnabled(e){this._breakpointsEnabled=!!e;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){if(d)this._debuggingDisabled--; +else this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&this._debuggingDisabled===0}IsCPUProfiling(){return this.IsDebug()&&C3Debugger.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&C3Debugger.IsGPUProfiling()}async DebugIterateAndBreak(iter){if(!iter)return;for(const breakEventObject of iter)await this.DebugBreak(breakEventObject)}DebugFireGeneratorEventAndBreak(event){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(event))}_InvokeFunctionFromJS(e){return this._eventSheetManager._InvokeFunctionFromJS(e["name"], +e["params"])}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(name){const e=C3.New(C3.Event,name,false);e.runtime=this._iRuntime;return e}_InitScriptInterfaces(){const objectDescriptors={};for(const objectClass of this._allObjectClasses)objectDescriptors[objectClass.GetJsPropName()]={value:objectClass.GetIObjectClass(),enumerable:true,writable:false};const objects=Object.create(Object.prototype,objectDescriptors);this._iRuntime=new self.IRuntime(this,objects);this._userScriptEventObjects= +{"tick":this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const globalVarDescriptors={};for(const globalVar of this.GetEventSheetManager().GetAllGlobalVariables())globalVarDescriptors[globalVar.GetJsPropName()]=globalVar._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(globalVarDescriptors)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(interface_,class_){this._interfaceMap.set(interface_,class_)}_UnwrapScriptInterface(interface_){return this._interfaceMap.get(interface_)}_UnwrapIObjectClass(iObjectClass){if(!(iObjectClass instanceof +self.IObjectClass))throw new TypeError("expected IObjectClass");const objectClass=this._UnwrapScriptInterface(iObjectClass);if(!objectClass||!(objectClass instanceof C3.ObjectClass))throw new Error("invalid IObjectClass");return objectClass}_UnwrapIWorldInstance(iinst){if(!(iinst instanceof self.IWorldInstance))throw new TypeError("expected IWorldInstance");const inst=this._UnwrapScriptInterface(iinst);if(!inst||!(inst instanceof C3.Instance))throw new Error("invalid IInstance");return inst}}; +self["C3_CreateRuntime"]=C3.Runtime.Create;self["C3_InitRuntime"]=(runtime,opts)=>runtime.Init(opts); + +} + +// workers/jobSchedulerRuntime.js +{ +'use strict';const C3=self.C3; +C3.JobSchedulerRuntime=class JobSchedulerRuntime extends C3.DefendedBase{constructor(runtime,data){super();this._runtime=runtime;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=data["inputPort"];data["outputPort"].onmessage=e=>this._OnJobWorkerMessage(e);this._maxNumWorkers=data["maxNumWorkers"];this._jobWorkerCount=1;this._isCreatingWorker=false;this._hadErrorCreatingWorker=false}async Init(){}GetMaxNumWorkers(){return this._maxNumWorkers}ImportScriptsToJobWorkers(scripts){this._inputPort.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlobToJobWorkers(blob, +id){this._inputPort.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBufferToJobWorkers(buffer,id){this._inputPort.postMessage({"type":"_send_buffer","buffer":buffer,"id":id},[buffer])}AddJob(type,params,transferables,progressHandler,abortDisposable,maxWorkerNum){if(!transferables)transferables=[];if(typeof maxWorkerNum==="number"){maxWorkerNum=Math.floor(maxWorkerNum);if(maxWorkerNum<=0)throw new Error("invalid maxWorkerNum");}const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":false, +"maxWorkerNum":maxWorkerNum,"jobId":jobId,"params":params,"transferables":transferables};const promise=new Promise((resolve,reject)=>{this._jobPromises.set(jobId,{resolve:resolve,progress:progressHandler,reject:reject,cancelled:false,maxWorkerNum})});if(abortDisposable)abortDisposable.SetAction(()=>this._CancelJob(jobId));this._inputPort.postMessage(job,transferables);this._MaybeCreateExtraWorker();return promise}BroadcastJob(type,params,transferables,maxWorkerNum){if(!transferables)transferables= +[];if(typeof maxWorkerNum==="number"){maxWorkerNum=Math.floor(maxWorkerNum);if(maxWorkerNum<=0)throw new Error("invalid maxWorkerNum");}const jobId=this._nextJobId++;const job={"type":type,"isBroadcast":true,"maxWorkerNum":maxWorkerNum,"jobId":jobId,"params":params,"transferables":transferables};this._inputPort.postMessage(job,transferables)}_CancelJob(jobId){const job=this._jobPromises.get(jobId);if(job){job.cancelled=true;job.resolve=null;job.progress=null;job.reject=null;this._inputPort.postMessage({"type":"_cancel", +"jobId":jobId})}}_OnJobWorkerMessage(e){const msg=e.data;const type=msg["type"];const id=msg["jobId"];switch(type){case "result":this._OnJobResult(id,msg["result"]);break;case "progress":this._OnJobProgress(id,msg["progress"]);break;case "error":this._OnJobError(id,msg["error"]);break;case "ready":this._OnJobWorkerReady();break;default:throw new Error(`unknown message from worker '${type}'`);}}_OnJobResult(jobId,result){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID"); +if(!p.cancelled)p.resolve(result);this._jobPromises.delete(jobId)}_OnJobProgress(jobId,progress){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled&&p.progress)p.progress(progress)}_OnJobError(jobId,error){const p=this._jobPromises.get(jobId);if(!p)throw new Error("invalid job ID");if(!p.cancelled)p.reject(error);this._jobPromises.delete(jobId)}_OnJobWorkerReady(){if(!this._isCreatingWorker)return;this._isCreatingWorker=false;this._jobWorkerCount++;if(this._jobWorkerCount< +this._maxNumWorkers)this._MaybeCreateExtraWorker();else this._inputPort.postMessage({"type":"_no_more_workers"})}_GetWorkerCountNeededForPendingJobs(){let needWorkerCount=0;const sortedJobList=[...this._jobPromises.values()].sort((a,b)=>{const an=a.maxWorkerNum||Infinity;const bn=b.maxWorkerNum||Infinity;return an-bn});for(const job of sortedJobList){const maxWorkerNum=job.maxWorkerNum||Infinity;if(needWorkerCount= +this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._GetWorkerCountNeededForPendingJobs()<=this._jobWorkerCount)return;try{this._isCreatingWorker=true;const result=await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker");result["outputPort"].onmessage=e=>this._OnJobWorkerMessage(e)}catch(err){this._hadErrorCreatingWorker=true;this._isCreatingWorker=false;console.error(`[Construct] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`, +err)}}}; + +} + +{ +self["C3_Shaders"] = {}; +self["C3_Shaders"]["warpripple"] = { + glsl: "#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform mediump vec2 srcStart;\nuniform mediump vec2 srcEnd;\nuniform mediump vec2 srcOriginStart;\nuniform mediump vec2 srcOriginEnd;\nuniform highmedp float seconds;\nuniform mediump vec2 pixelSize;\nuniform mediump float freq;\nuniform mediump float amp;\nuniform mediump float speed;\nconst mediump float PI = 3.1415926;\nvoid main(void)\n{\nmediump vec2 srcOriginSize = srcOriginEnd - srcOriginStart;\nmediump vec2 tex = (vTex - srcOriginStart) / srcOriginSize;\ntex = tex * 2.0 - 1.0;\nmediump float d = length(tex);\nmediump float a = atan(tex.y, tex.x);\nd += sin((d * 2.0 * PI) * freq / (pixelSize.x * 750.0) + (seconds * speed)) * amp * (pixelSize.x * 750.0);\ntex.x = cos(a) * d;\ntex.y = sin(a) * d;\ntex = (tex + 1.0) / 2.0;\ntex = tex * srcOriginSize + srcOriginStart;\ntex = clamp(tex, min(srcStart, srcEnd), max(srcStart, srcEnd));\ngl_FragColor = texture2D(samplerFront, tex);\n}", + glslWebGL2: "", + wgsl: "%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d;\nstruct ShaderParams {\nfreq : f32,\namp : f32,\nspeed : f32\n};\n%%SHADERPARAMS_BINDING%% var shaderParams : ShaderParams;\n%%C3PARAMS_STRUCT%%\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\nconst pi : f32 = 3.1415926;\n@fragment\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar pixelSize : vec2 = c3_getPixelSize(textureFront);\nvar tex = c3_srcOriginToNorm(input.fragUV);\ntex = tex * 2.0 - 1.0;\nvar d : f32 = length(tex);\nvar a = atan2(tex.y, tex.x);\nd = d + sin((d * 2.0 * pi) * shaderParams.freq / (pixelSize.x * 750.0) + (c3Params.seconds * shaderParams.speed)) * shaderParams.amp * (pixelSize.x * 750.0);\ntex.x = cos(a) * d;\ntex.y = sin(a) * d;\ntex = (tex + 1.0) / 2.0;\ntex = c3_normToSrcOrigin(tex);\ntex = c3_clampToSrc(tex);\nvar output : FragmentOutput;\noutput.color = textureSample(textureFront, samplerFront, tex);\nreturn output;\n}", + blendsBackground: false, + usesDepth: false, + extendBoxHorizontal: 50, + extendBoxVertical: 50, + crossSampling: false, + mustPreDraw: false, + preservesOpaqueness: false, + animated: true, + parameters: [["freq",0,"float"],["amp",0,"percent"],["speed",0,"float"]] +}; + +} + +{ +'use strict';{const C3=self.C3;let cacheRegex=null;let lastRegex="";let lastFlags="";let regexMatches=[];let lastMatchesStr="";let lastMatchesRegex="";let lastMatchesFlags="";const forEachStack=C3.New(C3.ArrayStack);function ForEachOrdered_SortInstances(a,b){const va=a[1];const vb=b[1];if(typeof va==="number"&&typeof vb==="number")return va-vb;else{const sa=""+va;const sb=""+vb;if(sasb)return 1;else return 0}}C3.Plugins.System=class SystemPlugin extends C3.SDKPluginBase{constructor(opts){super(opts); +this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingTotal=0;this._imagesLoadingComplete=0;this._functionMaps=new Map;this._signalTags=[]}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(method){this._runtime.Trigger(method,null,null)}GetRegex(regex,flags){if(!cacheRegex||regex!==lastRegex||flags!==lastFlags){cacheRegex=new RegExp(regex,flags);lastRegex=regex;lastFlags= +flags}cacheRegex.lastIndex=0;return cacheRegex}GetRegexMatches(str,regex,flags){if(str===lastMatchesStr&®ex===lastMatchesRegex&&flags===lastMatchesFlags)return regexMatches;const cacheRegex=this.GetRegex(regex,flags);regexMatches=str.match(cacheRegex);lastMatchesStr=str;lastMatchesRegex=regex;lastMatchesFlags=flags;return regexMatches}async _LoadTexturesForObjectClasses(layout,objectClasses){if(!objectClasses.length)return;this._imagesLoadingTotal+=objectClasses.length;const promises=[];for(const oc of objectClasses)promises.push(layout.MaybeLoadTexturesFor(oc)); +await C3.PromiseAllWithProgress(promises,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;if(this._imagesLoadingComplete===this._imagesLoadingTotal){this._imagesLoadingComplete=0;this._imagesLoadingTotal=0;this._runtime.Trigger(C3.Plugins.System.Cnds.OnImageLoadingComplete,null,null)}}_UnloadTexturesForObjectClasses(layout,objectClasses){for(const oc of objectClasses)if(oc.GetInstanceCount()===0)layout.MaybeUnloadTexturesFor(oc)}_GetForEachStack(){return forEachStack}_Repeat(count){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetEnd(count);if(isSolModifierAfterCnds)for(let i=0;i=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>= +end&&!loop.IsStopped();--i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);currentEvent.Retrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}*_DebugFor(name,start,end){const eventSheetManager= +this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds=oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();loop.SetName(name);loop.SetEnd(end);if(end=end&&!loop.IsStopped();--i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame);eventSheetManager.PopSol(solModifiers)}else for(let i=start;i>=end&&!loop.IsStopped();--i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}else if(isSolModifierAfterCnds)for(let i=start;i<=end&&!loop.IsStopped();++i){eventSheetManager.PushCopySol(solModifiers);loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame); +eventSheetManager.PopSol(solModifiers)}else for(let i=start;i<=end&&!loop.IsStopped();++i){loop.SetIndex(i);yield*currentEvent.DebugRetrigger(oldFrame,newFrame)}eventStack.Pop();loopStack.Pop();return false}_ForEach(objectClass){const eventSheetManager=this._runtime.GetEventSheetManager();const eventStack=eventSheetManager.GetEventStack();const oldFrame=eventStack.GetCurrentStackFrame();const currentEvent=oldFrame.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiers();const isSolModifierAfterCnds= +oldFrame.IsSolModifierAfterCnds();const newFrame=eventStack.Push(currentEvent);const loopStack=eventSheetManager.GetLoopStack();const loop=loopStack.Push();const isInContainer=objectClass.IsInContainer();const sol=objectClass.GetCurrentSol();const instances=forEachStack.Push();C3.shallowAssignArray(instances,sol.GetInstances());loop.SetEnd(instances.length);if(isSolModifierAfterCnds)for(let i=0,len=instances.length;i=lastTime+thisSeconds){cndSavedData.set("Every_lastTime",lastTime+thisSeconds);if(curTime>=cndSavedData.get("Every_lastTime")+.04)cndSavedData.set("Every_lastTime",curTime);cndSavedData.set("Every_seconds",seconds);return true}else if(curTime=a&&x<=b},CompareVar(ev,cmp,val){return C3.compare(ev.GetValue(),cmp,val)},CompareBoolVar(ev){return!!ev.GetValue()}, +CompareTime(cmp,t){const gameTime=this._runtime.GetGameTime();if(cmp===0){const cnd=this._runtime.GetCurrentCondition();const cndSavedData=cnd.GetSavedDataMap();if(!cndSavedData.get("CompareTime_executed"))if(gameTime>=t){cndSavedData.set("CompareTime_executed",true);return true}return false}else return C3.compare(gameTime,cmp,t)},IsNaN(n){return isNaN(n)},AngleWithin(a1,within,a2){return C3.angleDiff(C3.toRadians(a1),C3.toRadians(a2))<=C3.toRadians(within)},IsClockwiseFrom(a1,a2){return C3.angleClockwise(C3.toRadians(a1), +C3.toRadians(a2))},IsBetweenAngles(a,la,ua){let angle=C3.toRadians(a);let lower=C3.toRadians(la);let upper=C3.toRadians(ua);let obtuse=!C3.angleClockwise(upper,lower);if(obtuse)return!(!C3.angleClockwise(angle,lower)&&C3.angleClockwise(angle,upper));else return C3.angleClockwise(angle,lower)&&!C3.angleClockwise(angle,upper)},IsValueType(v,t){if(typeof v==="number")return t===0;else return t===1},EvaluateExpression(v){return!!v},OnSignal(tag){return tag.toLowerCase()===this._signalTags.at(-1)},PickByComparison(objectClass, +exp,cmp,val){if(!objectClass)return false;const forEachStack=this._GetForEachStack();const tempInstances=forEachStack.Push();const sol=objectClass.GetCurrentSol();C3.shallowAssignArray(tempInstances,sol.GetInstances());if(sol.IsSelectAll())C3.clearArray(sol._GetOwnElseInstances());const cnd=this._runtime.GetCurrentCondition();let k=0;for(let i=0,len=tempInstances.length;i=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer();return true},PickRandom(objectClass){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const index=Math.floor(this._runtime.Random()*instances.length);if(index>=instances.length)return false;const inst=instances[index];sol.PickOne(inst);objectClass.ApplySolToContainer(); +return true},PickAll(objectClass){if(!objectClass)return false;if(!objectClass.GetInstanceCount())return false;const sol=objectClass.GetCurrentSol();sol._SetSelectAll(true);objectClass.ApplySolToContainer();return true},PickOverlappingPoint(objectClass,x,y){if(!objectClass)return false;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();const currentEvent=this._runtime.GetCurrentEvent();const isOrBlock=currentEvent.IsOrBlock();const isInverted=this._runtime.GetCurrentCondition().IsInverted(); +if(sol.IsSelectAll()){C3.shallowAssignArray(tmpPickArray,instances);sol.ClearArrays();sol._SetSelectAll(false)}else if(isOrBlock){C3.shallowAssignArray(tmpPickArray,sol._GetOwnElseInstances());C3.clearArray(sol._GetOwnElseInstances())}else{C3.shallowAssignArray(tmpPickArray,sol._GetOwnInstances());C3.clearArray(sol._GetOwnInstances())}for(let i=0,len=tmpPickArray.length;i=0;--i){const inst=instancesPendingCreate[i];if(isFamily){if(inst.GetObjectClass().BelongsToFamily(objectClass)){pick=inst;break}}else if(inst.GetObjectClass()===objectClass){pick=inst;break}}if(!pick){const instances= +objectClass.GetInstances();if(instances.length)pick=instances.at(-1)}if(!pick)return false;const sol=objectClass.GetCurrentSol();sol.PickOne(pick);objectClass.ApplySolToContainer();return true},Repeat(count){if(this._runtime.IsDebugging())return this._DebugRepeat(count);else return this._Repeat(count)},While(){if(this._runtime.IsDebugging())return this._DebugWhile();else return this._While()},For(name,start,end){if(this._runtime.IsDebugging())return this._DebugFor(name,start,end);else return this._For(name, +start,end)},ForEach(objectClass){if(this._runtime.IsDebugging())return this._DebugForEach(objectClass);else return this._ForEach(objectClass)},ForEachOrdered(objectClass,expression,order){if(this._runtime.IsDebugging())return this._DebugForEachOrdered(objectClass,order);else return this._ForEachOrdered(objectClass,order)},LayerVisible(layer){return layer?layer.IsVisible():false},LayerInteractive(layer){return layer?layer.IsSelfAndParentsInteractive():false},LayerEmpty(layer){return layer?!layer.GetInstanceCount(): +false},LayerCmpOpacity(layer,cmp,o){if(!layer)return false;return C3.compare(layer.GetOpacity()*100,cmp,o)},OnImageLoadingComplete(){return true},IsLoadingImages(){return this._imagesLoadingTotal>0},TemplateExists(objectClass,template){const templateManager=this._runtime.GetTemplateManager();if(!templateManager)return false;if(!template)return false;return!!templateManager.GetTemplateData(objectClass,template)}}} +{const C3=self.C3;function SortZOrderList(a,b){const layerA=a[0];const layerB=b[0];const diff=layerA-layerB;if(diff!==0)return diff;const indexA=a[1];const indexB=b[1];return indexA-indexB}function SortInstancesByValue(a,b){return a[1]-b[1]}const tempZOrderList=[];const tempInstValues=[];const tempRect=C3.New(C3.Rect);const tempColor=C3.New(C3.Color);C3.Plugins.System.Acts={SetVar(ev,x){ev.SetValue(x)},AddVar(ev,x){if(ev.IsNumber()&&typeof x!=="number")x=parseFloat(x);ev.SetValue(ev.GetValue()+x)}, +SubVar(ev,x){if(!ev.IsNumber())return;ev.SetValue(ev.GetValue()-x)},SetBoolVar(ev,x){ev.SetValue(!!x)},ToggleBoolVar(ev){ev.SetValue(!ev.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},CreateObject(objectClass,layer,x,y,createHierarchy,template){if(!objectClass||!layer)return;const inst=this._runtime.CreateInstance(objectClass,layer,x,y,createHierarchy,template);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);const pickMap=new Map;inst.CollectInstancesToPick(pickMap,objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)},CreateObjectByName(objectClassName,layer,x,y,createHierarchy,template){if(!objectClassName||!layer)return;const objectClass=this._runtime.GetObjectClassByName(objectClassName); +if(!objectClass)return;C3.Plugins.System.Acts.CreateObject.call(this,objectClass,layer,x,y,createHierarchy,template)},RecreateInitialObjects(objectClass,x1,y1,x2,y2,sourceLayoutName,sourceLayerParam,offsetX,offsetY,createHierarchy){if(!objectClass)return;let sourceLayout=this._runtime.GetCurrentLayout();if(sourceLayoutName){const lookupLayout=this._runtime.GetLayoutManager().GetLayoutByName(sourceLayoutName);if(lookupLayout)sourceLayout=lookupLayout;else return}let sourceLayer=null;if(typeof sourceLayerParam!== +"number"||sourceLayerParam>=0){sourceLayer=sourceLayout.GetLayer(sourceLayerParam);if(!sourceLayer)return}tempRect.set(x1,y1,x2,y2);const allCreatedInstances=sourceLayout.RecreateInitialObjects(objectClass,tempRect,sourceLayer,offsetX,offsetY,createHierarchy);objectClass.GetCurrentSol().SetArrayPicked(allCreatedInstances);objectClass.ApplySolToContainer()},StopLoop(){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return;loopStack.GetCurrent().Stop()},SetGroupActive(groupName,a){const group= +this._runtime.GetEventSheetManager().GetEventGroupByName(groupName);if(!group)return;if(a===0)group.SetGroupActive(false);else if(a===1)group.SetGroupActive(true);else group.SetGroupActive(!group.IsGroupActive())},SetTimescale(ts){this._runtime.SetTimeScale(ts)},SetObjectTimescale(objectClass,ts){if(ts<0)ts=0;if(!objectClass)return;const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.SetTimeScale(ts)},RestoreObjectTimescale(objectClass){if(!objectClass)return; +const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances)inst.RestoreTimeScale()},Wait(seconds){if(seconds<0)return;this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(seconds);return true},WaitForSignal(tag){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(tag);return true},WaitForPreviousActions(){const eventSheetManager=this._runtime.GetEventSheetManager();eventSheetManager.AddScheduledWait().InitPromise(eventSheetManager.GetPromiseForAllAsyncActions()); +return true},Signal(tag){const lowerTag=tag.toLowerCase();this._signalTags.push(lowerTag);this._runtime.Trigger(C3.Plugins.System.Cnds.OnSignal,null);this._signalTags.pop();for(const w of this._runtime.GetEventSheetManager().scheduledWaits())if(w.IsSignal()&&w.GetSignalTag()===lowerTag)w.SetSignalled()},async SnapshotCanvas(format,quality,x,y,width,height){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;this.UpdateRender();await canvasManager.SnapshotCanvas(format=== +0?"image/png":"image/jpeg",quality/100,x,y,width,height);await this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnCanvasSnapshot,null)},SetCanvasSize(w,h){if(w<=0||h<=0)return;this._runtime.SetViewportSize(w,h);this._runtime.GetCurrentLayout().BoundScrolling();const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true);else{this._runtime.SetOriginalViewportSize(w, +h);canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)}this._runtime.UpdateRender()},SetFullscreenQuality(q){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return;if(canvasManager.GetCurrentFullscreenMode()==="off")return;canvasManager.SetFullscreenScalingQuality(q!==0?"high":"low");canvasManager.SetSize(canvasManager.GetLastWidth(),canvasManager.GetLastHeight(),true)},SaveState(slot){this._runtime.SaveToSlot(slot)},LoadState(slot){this._runtime.LoadFromSlot(slot)}, +LoadStateJSON(jsonStr){this._runtime.LoadFromJsonString(jsonStr)},SetHalfFramerateMode(m){},ResetPersisted(){for(const layout of this._runtime.GetLayoutManager().GetAllLayouts())layout.ResetPersistData()},SetPixelRounding(m){this._runtime.SetPixelRoundingEnabled(m!==0)},SetMinimumFramerate(fps){this._runtime.SetMinimumFramerate(fps)},SortZOrderByInstVar(objectClass,instVar){if(!objectClass)return;const sol=objectClass.GetCurrentSol();const pickedInstances=sol.GetInstances();const zOrderList=tempZOrderList; +const instValues=tempInstValues;const layout=this._runtime.GetCurrentLayout();const isFamily=objectClass.IsFamily();const familyIndex=objectClass.GetFamilyIndex();for(let i=0,len=pickedInstances.length;i0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers); +else eventSheetManager.PushCleanSol(solModifiers);const paramResults=[];const callerFunctionBlock=eventSheetManager.FindFirstFunctionBlockParent(currentEvent);if(callerFunctionBlock){const callerParameters=callerFunctionBlock.GetFunctionParameters();for(let i=forwardParams,len=callerParameters.length;in)ret=n}return ret},clamp(x,l,u){return C3.clamp(x,l,u)},distance(x1,y1,x2,y2){return C3.distanceTo(x1,y1,x2,y2)},angle(x1,y1,x2,y2){return C3.toDegrees(C3.angleTo(x1,y1,x2,y2))},lerp(a,b,x){return C3.lerp(a,b,x)},unlerp(a,b,y){return C3.unlerp(a,b,y)},qarp(a,b,c,x){return C3.qarp(a,b,c,x)},cubic(a,b,c,d,x){return C3.cubic(a,b,c,d,x)},cosp(a,b,x){return C3.cosp(a,b,x)},anglediff(a, +b){return C3.toDegrees(C3.angleDiff(C3.toRadians(a),C3.toRadians(b)))},anglelerp(a,b,x){return C3.toDegrees(C3.angleLerp(C3.toRadians(a),C3.toRadians(b),x))},anglerotate(a,b,c){return C3.toDegrees(C3.angleRotate(C3.toRadians(a),C3.toRadians(b),C3.toRadians(c)))},setbit(n,b,v){n=n|0;b=b|0;v=v!==0?1:0;return n&~(1<=arr.length)return"";return arr[index]},tokencount(text,sep){if(typeof text!=="string"||typeof sep!=="string"||!text.length)return 0;return text.split(sep).length},find(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),"i"));else return-1},findcase(text,searchStr){if(typeof text==="string"&&typeof searchStr==="string")return text.search(new RegExp(C3.EscapeRegex(searchStr),""));else return-1},replace(text,find,replace){if(typeof text=== +"string"&&typeof find==="string"&&typeof replace==="string")return text.replace(new RegExp(C3.EscapeRegex(find),"gi"),replace);else return typeof text==="string"?text:""},regexsearch(text,regex,flags){const cacheRegex=this.GetRegex(regex,flags);return text?text.search(cacheRegex):-1},regexreplace(text,regex,flags,replace){const cacheRegex=this.GetRegex(regex,flags);return text?text.replace(cacheRegex,replace):""},regexmatchcount(text,regex,flags){const matches=this.GetRegexMatches(text.toString(), +regex,flags);return matches?matches.length:0},regexmatchat(text,regex,flags,index){index=Math.floor(index);const matches=this.GetRegexMatches(text.toString(),regex,flags);if(!matches||index<0||index>=matches.length)return"";else return matches[index]},zeropad(n,d){let s=n<0?"-":"";if(n<0)n=-n;const zeroes=d-n.toString().length;s+="0".repeat(Math.max(zeroes,0));return s+n.toString()},urlencode(s){return encodeURIComponent(s)},urldecode(s){return decodeURIComponent(s)},dt(){return this._runtime._GetDtFast()}, +timescale(){return this._runtime.GetTimeScale()},wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()}, +windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()}, +layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},layoutangle(){return C3.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},vanishingpointx(){return this._runtime.GetCurrentLayout().GetVanishingPointX()*100},vanishingpointy(){return this._runtime.GetCurrentLayout().GetVanishingPointY()*100},viewportleft(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +return layer?layer.GetViewport3D().getLeft():0},viewporttop(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getTop():0},viewportright(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getRight():0},viewportbottom(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().getBottom():0},viewportwidth(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().width():0},viewportheight(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetViewport3D().height():0},viewportmidx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);if(layer){const vp=layer.GetViewport3D();return(vp.getLeft()+vp.getRight())/2}else return 0},viewportmidy(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam); +if(layer){const vp=layer.GetViewport3D();return(vp.getTop()+vp.getBottom())/2}else return 0},canvastolayerx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x,y)[0]:0},canvastolayery(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.CanvasCssToLayer(x,y)[1]:0},layertocanvasx(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x, +y)[0]:0},layertocanvasy(layerParam,x,y){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.LayerToCanvasCss(x,y)[1]:0},layertolayerx(fromLayerParam,toLayerParam,x,y){const layout=this._runtime.GetCurrentLayout();const fromLayer=layout.GetLayer(fromLayerParam);const toLayer=layout.GetLayer(toLayerParam);if(!fromLayer||!toLayer||fromLayer===toLayer)return x;const [canvasX,canvasY]=fromLayer.LayerToCanvasCss(x,y);return toLayer.CanvasCssToLayer(canvasX,canvasY)[0]}, +layertolayery(fromLayerParam,toLayerParam,x,y){const layout=this._runtime.GetCurrentLayout();const fromLayer=layout.GetLayer(fromLayerParam);const toLayer=layout.GetLayer(toLayerParam);if(!fromLayer||!toLayer||fromLayer===toLayer)return y;const [canvasX,canvasY]=fromLayer.LayerToCanvasCss(x,y);return toLayer.CanvasCssToLayer(canvasX,canvasY)[1]},layerscale(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOwnScale():0},layerangle(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?C3.toDegrees(layer.GetOwnAngle()):0},layeropacity(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetOpacity()*100:0},layerscalerate(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScaleRate():0},layerscrollx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScrollX():0},layerscrolly(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetScrollY():0},layerparallaxx(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxX()*100:0},layerparallaxy(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetParallaxY()*100:0},layerzelevation(layerParam){const layer=this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetZElevation():0},layerindex(layerParam){const layer= +this._runtime.GetCurrentLayout().GetLayer(layerParam);return layer?layer.GetIndex():-1},canvassnapshot(){const canvasManager=this._runtime.GetCanvasManager();if(!canvasManager)return"";return canvasManager.GetCanvasSnapshotUrl()},loopindex(name){const loopStack=this._loopStack;if(!loopStack.IsInLoop())return 0;if(name){const loop=loopStack.FindByName(name);return loop?loop.GetIndex():0}else return loopStack.GetCurrent().GetIndex()},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(name, +str,...paramResults){const mapEntry=this._GetFunctionMap(name.toLowerCase(),false);if(!mapEntry){console.warn(`[Construct] Call mapped function: map name '${name}' not found; returning 0`);return 0}let functionBlock=mapEntry.strMap.get(str.toLowerCase());if(!functionBlock)if(mapEntry.defaultFunc)functionBlock=mapEntry.defaultFunc;else{console.warn(`[Construct] Call mapped function: no function associated with map '${name}' string '${str}'; returning 0 (consider setting a default)`);return 0}const returnType= +functionBlock.GetReturnType();const defaultReturnValue=functionBlock.GetDefaultReturnValue();if(returnType===0){console.warn(`[Construct] Call mapped function: map '${name}' string '${str}' has no return type so cannot be called from an expression; returning 0`);return 0}if(!functionBlock.IsEnabled())return defaultReturnValue;const runtime=this._runtime;const eventSheetManager=runtime.GetEventSheetManager();const currentEvent=eventSheetManager.GetCurrentEvent();const solModifiers=currentEvent.GetSolModifiersIncludingParents(); +const hasAnySolModifiers=solModifiers.length>0;if(hasAnySolModifiers)if(functionBlock.IsCopyPicked())eventSheetManager.PushCopySol(solModifiers);else eventSheetManager.PushCleanSol(solModifiers);const calleeParameters=functionBlock.GetFunctionParameters();for(let i=paramResults.length,len=calleeParameters.length;ia.LoadAllTextures(renderer,opts)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const inst of this._objectClass.instancesIncludingPendingCreate())inst.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(doPick){C3.Plugins.Sprite.FinishCollisionCondition(this, +doPick)}BeforeRunAction(method){spawnPickStack.push({objectClass:null,createHierarchy:false,instances:[]})}_SpawnPickInstance(objectClass,inst,createHierarchy){const entry=spawnPickStack.at(-1);entry.objectClass=objectClass;entry.createHierarchy=createHierarchy;entry.instances.push(inst)}AfterRunAction(method){const entry=spawnPickStack.pop();const objectClass=entry.objectClass;const createHierarchy=entry.createHierarchy;if(!objectClass)return;const pickMap=new Map;for(const inst of entry.instances)inst.CollectInstancesToPick(pickMap, +objectClass,createHierarchy);for(const [pickObjectClass,instSet]of pickMap)pickObjectClass.GetCurrentSol().SetSetPicked(instSet)}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const INITIAL_ANIMATION=1;const INITIAL_FRAME=2;const ENABLE_COLLISIONS=3;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const tempVec2=C3.New(C3.Vector2);const FLAG_PLAYING_FORWARDS=1<<0;const FLAG_ANIMATION_PLAYING=1<<1;const FLAG_ANIMATION_TRIGGER=1<<2;C3.Plugins.Sprite.Instance=class SpriteInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);let initiallyVisible=true;let initialAnimation= +"";let initialFrame=0;let collisionEnabled=true;if(properties){initiallyVisible=!!properties[INITIALLY_VISIBLE];initialAnimation=properties[INITIAL_ANIMATION];initialFrame=properties[INITIAL_FRAME];collisionEnabled=properties[ENABLE_COLLISIONS]}this._currentAnimation=this._objectClass.GetAnimationByName(initialAnimation)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=C3.clamp(initialFrame,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex); +const initialImageInfo=this._currentAnimationFrame.GetImageInfo();this._currentTexture=initialImageInfo.GetTexture();this._currentRcTex=initialImageInfo.GetTexRect();this._currentQuadTex=initialImageInfo.GetTexQuad();this.HandleRendererContextLoss();inst.SetFlag(FLAG_ANIMATION_PLAYING,true);inst.SetFlag(FLAG_PLAYING_FORWARDS,this._currentAnimation.GetSpeed()>=0);this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo(); +this._animationTimer=C3.New(C3.KahanSum);this._frameStartTime=0;this._animationRepeats=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=0;const wi=this.GetWorldInfo();this._bquadRef=wi.GetBoundingQuad();wi.SetVisible(initiallyVisible);wi.SetCollisionEnabled(collisionEnabled);wi.SetOriginX(this._currentAnimationFrame.GetOriginX());wi.SetOriginY(this._currentAnimationFrame.GetOriginY());wi.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly()); +wi.SetBboxChanged();if((this._objectClass.GetAnimationCount()!==1||this._objectClass.GetAnimations()[0].GetFrameCount()!==1)&&this._currentAnimationSpeed!==0)this._StartTicking()}Release(){this._currentAnimation=null;this._currentAnimationFrame=null;this._currentTexture=null;this._animationTimer=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return true}OnRendererContextLost(){this._currentTexture=null}OnRendererContextRestored(){this._UpdateCurrentTexture()}Draw(renderer){const texture= +this._currentTexture;if(texture===null)return;renderer.SetTexture(texture);const wi=this.GetWorldInfo();if(wi.HasMesh())this._DrawMesh(wi,renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=this._bquadRef;if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);renderer.Quad4(quad,this._currentQuadTex)}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad; +if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,this._currentQuadTex);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(FLAG_ANIMATION_PLAYING)}SetAnimationPlaying(e){this._inst.SetFlag(FLAG_ANIMATION_PLAYING,e)}IsPlayingForwards(){return this._inst.GetFlag(FLAG_PLAYING_FORWARDS)}SetPlayingForwards(e){this._inst.SetFlag(FLAG_PLAYING_FORWARDS, +e)}IsInAnimationTrigger(){return this._inst.GetFlag(FLAG_ANIMATION_TRIGGER)}SetInAnimationTrigger(e){this._inst.SetFlag(FLAG_ANIMATION_TRIGGER,e)}Tick(){if(this._changeAnimationName)this._DoChangeAnimation();if(this._changeAnimFrameIndex>=0)this._DoChangeAnimFrame();const currentAnimationSpeed=this._currentAnimationSpeed;if(!this.IsAnimationPlaying()||currentAnimationSpeed===0){this._StopTicking();return}const dt=this._runtime.GetDt(this._inst);this._animationTimer.Add(dt);const now=this.GetAnimationTime(); +const prevFrame=this._currentAnimationFrame;const currentFrameTime=prevFrame.GetDuration()/currentAnimationSpeed;if(now=frameCount)if(isPingPong){this.SetPlayingForwards(false);this._currentFrameIndex=frameCount-2}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(false);else this._currentFrameIndex=repeatTo}if(this._currentFrameIndex<0)if(isPingPong){this._currentFrameIndex=1;this.SetPlayingForwards(true);if(!isLooping){this._animationRepeats++; +if(this._animationRepeats>=repeatCount)this._FinishAnimation(true)}}else if(isLooping)this._currentFrameIndex=repeatTo;else{this._animationRepeats++;if(this._animationRepeats>=repeatCount)this._FinishAnimation(true);else this._currentFrameIndex=repeatTo}this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,frameCount-1);const nextFrame=currentAnimation.GetFrameAt(this._currentFrameIndex);if(now>this._frameStartTime+nextFrame.GetDuration()/currentAnimationSpeed)this._frameStartTime=now;this._OnFrameChanged(prevFrame, +nextFrame)}_FinishAnimation(reverse){this._currentFrameIndex=reverse?0:this._currentAnimation.GetFrameCount()-1;this.SetAnimationPlaying(false);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(true);this.DispatchScriptEvent("animationend",false,{animationName:this._animTriggerName});this.Trigger(C3.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(false);this._animationRepeats=0}_OnFrameChanged(prevFrame, +nextFrame,opts){if(prevFrame===nextFrame)return;const wi=this.GetWorldInfo();const prevImage=prevFrame.GetImageInfo();const nextImage=nextFrame.GetImageInfo();const oldW=prevImage.GetWidth();const oldH=prevImage.GetHeight();const newW=nextImage.GetWidth();const newH=nextImage.GetHeight();if(opts&&opts.onFrameChange)opts.onFrameChange(wi,oldW,oldH,newW,newH);else{if(oldW!==newW)wi.SetWidth(wi.GetWidth()*(newW/oldW));if(oldH!==newH)wi.SetHeight(wi.GetHeight()*(newH/oldH))}wi.SetOriginX(nextFrame.GetOriginX()); +wi.SetOriginY(nextFrame.GetOriginY());wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly());wi.SetBboxChanged();this._currentAnimationFrame=nextFrame;this._currentTexture=nextImage.GetTexture();this._currentRcTex=nextImage.GetTexRect();this._currentQuadTex=nextImage.GetTexQuad();const behaviorInstances=this.GetInstance().GetBehaviorInstances();for(let i=0,len=behaviorInstances.length;i=0);if(this._currentAnimationSpeed>0)this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(f){f=C3.clamp(Math.floor(f),0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationRepeatTo=f}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(opts){const prevFrame=this._currentAnimationFrame;const animation=this._objectClass.GetAnimationByName(this._changeAnimationName); +this._changeAnimationName="";if(!animation)return;if(animation===this._currentAnimation&&this.IsAnimationPlaying())return;this._currentAnimation=animation;this.SetPlayingForwards(animation.GetSpeed()>=0);this._currentAnimationSpeed=Math.abs(animation.GetSpeed());this._currentAnimationRepeatTo=animation.GetRepeatTo();this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1);if(this._changeAnimationFrom===1)this._currentFrameIndex=0;this.SetAnimationPlaying(true); +this._frameStartTime=this.GetAnimationTime();const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(prevFrame,nextFrame,opts)}_DoChangeAnimFrame(){const prevFrame=this._currentAnimationFrame;const prevFrameIndex=this._currentFrameIndex;this._currentFrameIndex=C3.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;if(prevFrameIndex===this._currentFrameIndex)return;const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex); +this._OnFrameChanged(prevFrame,nextFrame);this._frameStartTime=this.GetAnimationTime()}_UpdateCurrentTexture(){const curImageInfo=this._currentAnimationFrame.GetImageInfo();this._currentTexture=curImageInfo.GetTexture();this._currentRcTex=curImageInfo.GetTexRect();this._currentQuadTex=curImageInfo.GetTexQuad();this.GetWorldInfo().SetMeshChanged(true)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(nameOrIndex){const frame= +this._currentAnimationFrame;const wi=this.GetWorldInfo();let ip=null;if(typeof nameOrIndex==="string")ip=frame.GetImagePointByName(nameOrIndex);else if(typeof nameOrIndex==="number")ip=frame.GetImagePointByIndex(nameOrIndex-1);else throw new TypeError("expected string or number");let ptZ=wi.GetTotalZElevation();if(!ip)return[wi.GetX(),wi.GetY(),ptZ];tempVec2.copy(ip.GetVec2());if(wi.HasMesh()){const [tx,ty,tz]=wi.GetSourceMesh().TransformPoint(tempVec2.getX(),tempVec2.getY());tempVec2.set(tx,ty); +ptZ+=tz}tempVec2.offset(-frame.GetOriginX(),-frame.GetOriginY());tempVec2.scale(wi.GetWidth(),wi.GetHeight());tempVec2.rotate(wi.GetAngle());tempVec2.offset(wi.GetX(),wi.GetY());return[tempVec2.getX(),tempVec2.getY(),ptZ]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(index){index=Math.floor(index);const wi=this.GetWorldInfo();const poly=wi.GetTransformedCollisionPoly();const pointCount=poly.pointCount();if(index===pointCount)index= +0;if(index<0||index>=pointCount)return[0,0];const pointsArr=poly.pointsArr();return[pointsArr[index*2+0]+wi.GetX(),pointsArr[index*2+1]+wi.GetY()]}GetDebuggerProperties(){const Acts=C3.Plugins.Sprite.Acts;const prefix="plugins.sprite.debugger.animation-properties";return[{title:prefix+".title",properties:[{name:prefix+".current-animation",value:this._currentAnimation.GetName(),onedit:v=>this.CallAction(Acts.SetAnim,v,0)},{name:prefix+".current-frame",value:this._currentFrameIndex,onedit:v=>this.CallAction(Acts.SetAnimFrame, +v)},{name:prefix+".is-playing",value:this.IsAnimationPlaying(),onedit:v=>v?this.CallAction(Acts.StartAnim,0):this.CallAction(Acts.StopAnim)},{name:prefix+".speed",value:this._currentAnimationSpeed,onedit:v=>this.CallAction(Acts.SetAnimSpeed,v)},{name:prefix+".repeats",value:this._animationRepeats,onedit:v=>this._animationRepeats=v}]}]}SaveToJson(){const o={"a":this._currentAnimation.GetSID()};if(this._frameStartTime!==0)o["fs"]=this._frameStartTime;const animTime=this.GetAnimationTime();if(animTime!== +0)o["at"]=animTime;if(this._currentFrameIndex!==0)o["f"]=this._currentFrameIndex;if(this._currentAnimationSpeed!==0)o["cas"]=this._currentAnimationSpeed;if(this._animationRepeats!==1)o["ar"]=this._animationRepeats;if(this._currentAnimationRepeatTo!==0)o["rt"]=this._currentAnimationRepeatTo;if(!this.IsAnimationPlaying())o["ap"]=this.IsAnimationPlaying();if(!this.IsPlayingForwards())o["af"]=this.IsPlayingForwards();const wi=this.GetWorldInfo();if(wi.IsCollisionEnabled())o["ce"]=wi.IsCollisionEnabled(); +return o}LoadFromJson(o){const anim=this.GetObjectClass().GetAnimationBySID(o["a"]);if(anim)this._currentAnimation=anim;this._frameStartTime=o.hasOwnProperty("fs")?o["fs"]:0;this._animationTimer.Set(o.hasOwnProperty("at")?o["at"]:0);const frameIndex=o.hasOwnProperty("f")?o["f"]:0;this._currentFrameIndex=C3.clamp(frameIndex,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=o.hasOwnProperty("cas")?o["cas"]:0;this._animationRepeats=o.hasOwnProperty("ar")?o["ar"]:1;const repeatToIndex= +o.hasOwnProperty("rt")?o["rt"]:0;this._currentAnimationRepeatTo=C3.clamp(repeatToIndex,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(o.hasOwnProperty("ap")?!!o["ap"]:true);this.SetPlayingForwards(o.hasOwnProperty("af")?!!o["af"]:true);const nextFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._currentAnimationFrame=nextFrame;this._UpdateCurrentTexture();const wi=this.GetWorldInfo();wi.SetOriginX(nextFrame.GetOriginX());wi.SetOriginY(nextFrame.GetOriginY()); +wi.SetSourceCollisionPoly(nextFrame.GetCollisionPoly());wi.SetCollisionEnabled(!!o["ce"]);if(this.IsAnimationPlaying())this._StartTicking()}GetPropertyValueByIndex(index){const wi=this.GetWorldInfo();switch(index){case ENABLE_COLLISIONS:return wi.IsCollisionEnabled();case INITIAL_FRAME:return C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1);case INITIAL_ANIMATION:return this._currentAnimation.GetName()}}SetPropertyValueByIndex(index,value,opts){const wi=this.GetWorldInfo(); +switch(index){case ENABLE_COLLISIONS:wi.SetCollisionEnabled(!!value);break;case INITIAL_FRAME:this.SetAnimationPlaying(false);const totalFrames=this._currentAnimation.GetFrameCount()-1;const nextIndex=value=C3.clamp(value,0,totalFrames);const prevFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const nextFrame=this._currentAnimation.GetFrameAt(nextIndex);this._OnFrameChanged(prevFrame,nextFrame,opts);this._currentFrameIndex=C3.clamp(nextIndex,0,totalFrames);break;case INITIAL_ANIMATION:this._changeAnimationName= +value;this._DoChangeAnimation(opts);break}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const map=new WeakMap;const ANIM_FROM_MODES=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class ISpriteInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return map.get(this).GetImagePointCount()}getImagePointX(nameOrIndex){return this.getImagePoint(nameOrIndex)[0]}getImagePointY(nameOrIndex){return this.getImagePoint(nameOrIndex)[1]}getImagePointZ(nameOrIndex){return this.getImagePoint(nameOrIndex)[2]}getImagePoint(nameOrIndex){if(typeof nameOrIndex!== +"string"&&typeof nameOrIndex!=="number")throw new TypeError("expected string or number");return map.get(this).GetImagePoint(nameOrIndex)}getPolyPointCount(){return map.get(this).GetCollisionPolyPointCount()}getPolyPointX(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)[0]}getPolyPointY(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)[1]}getPolyPoint(index){C3X.RequireFiniteNumber(index);return map.get(this).GetCollisionPolyPoint(index)}stopAnimation(){map.get(this).SetAnimationPlaying(false)}startAnimation(from= +"current-frame"){C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");map.get(this)._StartAnim(f)}setAnimation(name,from="beginning"){C3X.RequireString(name);C3X.RequireString(from);const f=ANIM_FROM_MODES.get(from);if(typeof f==="undefined")throw new Error("invalid mode");const inst=map.get(this);if(!inst.GetObjectClass().GetAnimationByName(name))throw new Error(`animation name "${name}" does not exist`);inst._SetAnim(name,f)}getAnimation(name){C3X.RequireString(name); +const a=map.get(this).GetObjectClass().GetAnimationByName(name);return a?a.GetIAnimation():null}get animation(){return map.get(this)._GetCurrentAnimation().GetIAnimation()}get animationName(){return map.get(this)._GetCurrentAnimationName()}set animationFrame(frameIndex){C3X.RequireFiniteNumber(frameIndex);map.get(this)._SetAnimFrame(frameIndex)}get animationFrame(){return map.get(this)._GetAnimFrame()}set animationSpeed(s){C3X.RequireFiniteNumber(s);map.get(this)._SetAnimSpeed(s)}get animationSpeed(){return map.get(this)._GetAnimSpeed()}set animationRepeatToFrame(f){C3X.RequireFiniteNumber(f); +map.get(this)._SetAnimRepeatToFrame(f)}get animationRepeatToFrame(){return map.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}getImageSize(){const imageInfo=map.get(this).GetCurrentImageInfo();return[imageInfo.GetWidth(),imageInfo.GetHeight()]}async replaceCurrentAnimationFrame(blob){C3X.RequireInstanceOf(blob,Blob);const sdkInst=map.get(this);const runtime=sdkInst.GetRuntime(); +const curImageInfo=sdkInst.GetCurrentImageInfo();const imageInfo=C3.New(C3.ImageInfo);imageInfo.LoadDynamicBlobAsset(runtime,blob);await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling()});if(sdkInst.WasReleased()){imageInfo.Release();return}curImageInfo.ReplaceWith(imageInfo);sdkInst.GetSdkType()._UpdateAllCurrentTexture();runtime.UpdateRender()}setSolidCollisionFilter(isInclusive,tags){C3X.RequireString(tags);map.get(this).GetWorldInfo().SetSolidCollisionFilter(!!isInclusive, +tags)}}} +{const C3=self.C3;C3.Plugins.Sprite.Cnds={IsAnimPlaying(animName){return C3.equalsNoCase(this._GetCurrentAnimationName(),animName)},CompareFrame(cmp,frameNum){return C3.compare(this._currentFrameIndex,cmp,frameNum)},CompareFrameTag(cmp,frameTag){const selfTag=this._currentAnimationFrame.GetTag();return C3.compare(selfTag.toLowerCase(),cmp,frameTag.toLowerCase())},CompareAnimSpeed(cmp,x){return C3.compare(this._GetAnimSpeed(),cmp,x)},OnAnimFinished(animName){return C3.equalsNoCase(this._animTriggerName,animName)}, +OnAnyAnimFinished(){return true},OnFrameChanged(){return true},IsMirrored(){return this.GetWorldInfo().GetWidth()<0},IsFlipped(){return this.GetWorldInfo().GetHeight()<0},OnURLLoaded(){return true},OnURLFailed(){return true},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}} +{const C3=self.C3;C3.Plugins.Sprite.Acts={Spawn(objectClass,layer,imgPt,createHierarchy){if(!objectClass||!layer)return;const [imgPtX,imgPtY]=this.GetImagePoint(imgPt);const inst=this._runtime.CreateInstance(objectClass,layer,imgPtX,imgPtY,createHierarchy);if(!inst)return;if(createHierarchy)layer.SortAndAddInstancesByZIndex(inst);if(objectClass.GetPlugin().IsRotatable()){const instWi=inst.GetWorldInfo();instWi.SetAngle(this.GetWorldInfo().GetAngle());instWi.SetBboxChanged()}const eventSheetManager= +this._runtime.GetEventSheetManager();eventSheetManager.BlockFlushingInstances(true);inst._TriggerOnCreatedOnSelfAndRelated();eventSheetManager.BlockFlushingInstances(false);if(objectClass!==this._runtime.GetCurrentAction().GetObjectClass())this._sdkType._SpawnPickInstance(objectClass,inst,createHierarchy)},StopAnim(){this.SetAnimationPlaying(false)},StartAnim(from){this._StartAnim(from)},SetAnim(animName,from){this._SetAnim(animName,from)},SetAnimFrame(frameNum){this._SetAnimFrame(frameNum)},SetAnimSpeed(s){this._SetAnimSpeed(s)}, +SetAnimRepeatToFrame(f){this._SetAnimRepeatToFrame(f)},SetMirrored(m){const wi=this.GetWorldInfo();const oldW=wi.GetWidth();const newW=Math.abs(oldW)*(m===0?-1:1);if(oldW===newW)return;wi.SetWidth(newW);wi.SetBboxChanged()},SetFlipped(f){const wi=this.GetWorldInfo();const oldH=wi.GetHeight();const newH=Math.abs(oldH)*(f===0?-1:1);if(oldH===newH)return;wi.SetHeight(newH);wi.SetBboxChanged()},SetScale(s){const frame=this._currentAnimationFrame;const imageInfo=frame.GetImageInfo();const wi=this.GetWorldInfo(); +const mirrorFactor=wi.GetWidth()<0?-1:1;const flipFactor=wi.GetHeight()<0?-1:1;const newWidth=imageInfo.GetWidth()*s*mirrorFactor;const newHeight=imageInfo.GetHeight()*s*flipFactor;if(wi.GetWidth()!==newWidth||wi.GetHeight()!==newHeight){wi.SetSize(newWidth,newHeight);wi.SetBboxChanged()}},async LoadURL(url,resize,crossOrigin){const curAnimFrame=this._currentAnimationFrame;const curImageInfo=curAnimFrame.GetImageInfo();const wi=this.GetWorldInfo();const runtime=this._runtime;const sdkType=this._sdkType; +if(curImageInfo.GetURL()===url){if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}this.Trigger(C3.Plugins.Sprite.Cnds.OnURLLoaded);return}const imageInfo=C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");if(this.WasReleased()){imageInfo.Release();return}await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling()})}catch(err){console.error("Load image from URL failed: ", +err);if(!this.WasReleased())this.Trigger(C3.Plugins.Sprite.Cnds.OnURLFailed);return}if(this.WasReleased()){imageInfo.Release();return}curImageInfo.ReplaceWith(imageInfo);sdkType._UpdateAllCurrentTexture();runtime.UpdateRender();if(resize===0){wi.SetSize(curImageInfo.GetWidth(),curImageInfo.GetHeight());wi.SetBboxChanged()}await this.TriggerAsync(C3.Plugins.Sprite.Cnds.OnURLLoaded)},SetCollisions(e){this.GetWorldInfo().SetCollisionEnabled(e)},SetSolidCollisionFilter(mode,tags){this.GetWorldInfo().SetSolidCollisionFilter(mode=== +0,tags)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationFrameTag(){return this._currentAnimationFrame.GetTag()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(imgpt){return this.GetImagePoint(imgpt)[0]},ImagePointY(imgpt){return this.GetImagePoint(imgpt)[1]}, +ImagePointZ(imgpt){return this.GetImagePoint(imgpt)[2]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(i){return this.GetCollisionPolyPoint(i)[0]},PolyPointYAt(i){return this.GetCollisionPolyPoint(i)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Keyboard=class KeyboardPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Keyboard.Type=class KeyboardType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let keyboardObjectType=null;function GetKeyboardSdkInstance(){return keyboardObjectType.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class IKeyboardObjectType extends self.IObjectClass{constructor(objectType){super(objectType);keyboardObjectType= +objectType;objectType.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(keyOrCode){const keyboardInst=GetKeyboardSdkInstance();if(typeof keyOrCode==="string")return keyboardInst.IsKeyDown(keyOrCode);else if(typeof keyOrCode==="number")return keyboardInst.IsKeyCodeDown(keyOrCode);else throw new TypeError("expected string or number");}}} +{const C3=self.C3;C3.Plugins.Keyboard.Instance=class KeyboardInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerString="";this._triggerTypedKey="";const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"keydown",e=>this._OnKeyDown(e.data)),C3.Disposable.From(rt,"keyup",e=>this._OnKeyUp(e.data)),C3.Disposable.From(rt,"window-blur", +()=>this._OnWindowOrKeyboardBlur()),C3.Disposable.From(rt,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];if(this._keysDownByString.has(keyString))return;this._keysDownByString.add(keyString);this._keysDownByWhich.add(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKey);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKey); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCode)}_OnKeyUp(e){const which=e["which"];const keyString=e["code"]||which.toString();const typedKey=e["key"];this._keysDownByString.delete(keyString);this._keysDownByWhich.delete(which);this._triggerString=keyString;this._triggerWhich=which;this._triggerTypedKey=typedKey;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased); +this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const which of this._keysDownByWhich){this._keysDownByWhich.delete(which);this._triggerWhich=which;this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}this._keysDownByString.clear()}IsKeyDown(str){return this._keysDownByString.has(str)}IsKeyCodeDown(which){return this._keysDownByWhich.has(which)}SaveToJson(){return{"tk":this._triggerWhich, +"tkk":this._triggerTypedKey}}LoadFromJson(o){this._triggerWhich=o["tk"];if(o.hasOwnProperty("tkk"))this._triggerTypedKey=o["tkk"]}GetDebuggerProperties(){const prefix="plugins.keyboard";return[{title:prefix+".name",properties:[{name:prefix+".debugger.last-key-code",value:this._triggerWhich},{name:prefix+".debugger.last-key-string",value:C3.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:prefix+".debugger.last-typed-key",value:this._triggerTypedKey}]}]}}} +{const C3=self.C3;const LEFTRIGHT_KEY_STRINGS=["ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","MetaLeft","MetaRight"];C3.Plugins.Keyboard.Cnds={IsKeyDown(which){return this._keysDownByWhich.has(which)},OnKey(which){return this._triggerWhich===which},OnAnyKey(){return true},OnAnyKeyReleased(){return true},OnKeyReleased(which){return this._triggerWhich===which},IsKeyCodeDown(which){which=Math.floor(which);return this._keysDownByWhich.has(which)},OnKeyCode(which){return this._triggerWhich=== +which},OnKeyCodeReleased(which){return this._triggerWhich===which},OnLeftRightKeyPressed(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},OnLeftRightKeyReleased(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._triggerString===keyString},IsLeftRightKeyDown(index){const keyString=LEFTRIGHT_KEY_STRINGS[index];return this._keysDownByString.has(keyString)}}}{const C3=self.C3;C3.Plugins.Keyboard.Acts={}} +{const C3=self.C3;function StringFromCharCode(kc){kc=Math.floor(kc);switch(kc){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del"; +case 91:return"left window key";case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2"; +case 114:return"F3";case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(kc)}} +C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(kc){return StringFromCharCode(kc)},TypedKey(){return this._triggerTypedKey}}}; + +} + +{ +'use strict';{const C3=self.C3;const actionPromises=[];C3.Plugins.Audio=class AudioPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}_AddActionPromise(promise){actionPromises.push(promise)}static async WaitForAllActionPromises(){await Promise.all(actionPromises);C3.clearArray(actionPromises)}Release(){super.Release()}}} +{const C3=self.C3;const C3X=self.C3X;C3.Plugins.Audio.Type=class AudioType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function GetAudioDOMInterface(){if(self["C3Audio_DOMInterface"])return self["C3Audio_DOMInterface"];else throw new Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class IAudioObjectType extends self.IObjectClass{constructor(objectType){super(objectType)}get audioContext(){return GetAudioDOMInterface().GetAudioContext()}get destinationNode(){return GetAudioDOMInterface().GetDestinationNode()}}} +{const C3=self.C3;const DOM_COMPONENT_ID="audio";const LATENCY_HINTS=["interactive","balanced","playback"];C3.Plugins.Audio.Instance=class AudioInstance extends C3.SDKInstanceBase{constructor(inst,properties){super(inst,DOM_COMPONENT_ID);this._nextPlayTime=0;this._triggerTags=[];this._enableMultiTags=true;this._timeScaleMode=0;this._saveLoadMode=0;this._playInBackground=false;this._panningModel=1;this._distanceModel=1;this._listenerPos=[this._runtime.GetViewportWidth()/2,this._runtime.GetViewportHeight()/ +2,600];this._listenerForwardVec=[0,0,-1];this._listenerUpVec=[0,1,0];this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=false;this._sampleRate=0;this._audioContextState="suspended";this._outputLatency=0;this._effectCount=new Map;this._preloadTotal=0;this._preloadCount=0;this._bufferMetadata=new Map;this._remoteUrls=new Map;let latencyHint="interactive";if(properties){this._timeScaleMode=properties[0]; +this._saveLoadMode=properties[1];this._playInBackground=properties[2];latencyHint=LATENCY_HINTS[properties[3]];this._enableMultiTags=properties[4];this._panningModel=properties[5];this._distanceModel=properties[6];this._listenerPos[2]=properties[7];this._referenceDistance=properties[8];this._maxDistance=properties[9];this._rolloffFactor=properties[10]}this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=[];this.AddDOMMessageHandlers([["state",e=>this._OnUpdateState(e)],["audiocontext-state", +e=>this._OnAudioContextStateChanged(e)],["fxstate",e=>this._OnUpdateFxState(e)],["trigger",e=>this._OnTrigger(e)],["buffer-metadata",e=>this._OnBufferMetadata(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context", +{"preloadList":this._runtime.GetAssetManager().GetAudioToPreload().map(o=>({"originalUrl":o.originalUrl,"url":o.url,"type":o.type,"fileSize":o.fileSize})),"isiOSCordova":this._runtime.IsiOSCordova(),"isSafari":C3.Platform.Browser==="Safari","timeScaleMode":this._timeScaleMode,"latencyHint":latencyHint,"panningModel":this._panningModel,"distanceModel":this._distanceModel,"refDistance":this._referenceDistance,"maxDistance":this._maxDistance,"rolloffFactor":this._rolloffFactor,"listenerPos":this._listenerPos}).then(info=> +{this._sampleRate=info["sampleRate"];this._audioContextState=info["audioContextState"];this._outputLatency=info["outputLatency"]}));this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_SplitTags(tagStr){if(this._enableMultiTags)return tagStr.split(" ").filter(s=>!!s);else return tagStr?[tagStr]:[]}_MatchTagLists(tagArr1,tagArr2){for(const t2 of tagArr2){let found=false;for(const t1 of tagArr1)if(C3.equalsNoCase(t1,t2)){found=true;break}if(!found)return false}return true}_MatchTagListToStr(tagArr, +tagStr){return this._MatchTagLists(tagArr,this._SplitTags(tagStr))}_AddActionPromise(promise){this.GetPlugin()._AddActionPromise(promise)}_OnInstanceDestroyed(inst){if(this._listenerInst===inst)this._listenerInst=null}DbToLinearNoCap(x){return Math.pow(10,x/20)}DbToLinear(x){const v=this.DbToLinearNoCap(x);if(!isFinite(v))return 0;return Math.max(Math.min(v,1),0)}LinearToDbNoCap(x){return Math.log(x)/Math.log(10)*20}LinearToDb(x){return this.LinearToDbNoCap(Math.max(Math.min(x,1),0))}_OnSuspend(){if(this._playInBackground)return; +this.PostToDOM("set-suspended",{"isSuspended":true})}_OnResume(){if(this._playInBackground)return;this.PostToDOM("set-suspended",{"isSuspended":false})}_OnUpdateState(e){const tickCount=e["tickCount"];this._outputLatency=e["outputLatency"];const preservePlaceholders=this._lastAIState.filter(ai=>ai.hasOwnProperty("placeholder")&&(ai["placeholder"]>tickCount||ai["placeholder"]===-1));this._lastAIState=e["audioInstances"];this._lastAnalysersData=e["analysers"];if(preservePlaceholders.length>0)C3.appendArray(this._lastAIState, +preservePlaceholders)}_OnBufferMetadata(e){this._bufferMetadata.set(e["originalUrl"],{duration:e["duration"]})}_OnAudioContextStateChanged(e){this._audioContextState=e["audioContextState"]}GetAudioContextState(){if(this._runtime.IsExportToVideo())return"running";else return this._audioContextState}_OnUpdateFxState(e){this._lastFxState=e["fxstate"]}_GetFirstAudioStateByTags(tagStr){const tagArr=this._SplitTags(tagStr);for(const a of this._lastAIState)if(this._MatchTagLists(a["tags"],tagArr))return a; +return null}_IsTagPlaying(tagStr){const tagArr=this._SplitTags(tagStr);return this._lastAIState.some(ai=>this._MatchTagLists(ai["tags"],tagArr)&&ai["isPlaying"])}_MaybeMarkAsPlaying(originalUrl,tagStr,isMusic,isLooping,vol){if(this._IsTagPlaying(tagStr))return null;const bufferMeta=this._bufferMetadata.get(originalUrl);const state={"tags":this._SplitTags(tagStr),"duration":bufferMeta?bufferMeta.duration:0,"volume":vol,"isPlaying":true,"playbackTime":0,"playbackRate":1,"uid":-1,"bufferOriginalUrl":originalUrl, +"bufferUrl":"","bufferType":"","isMusic":isMusic,"isLooping":isLooping,"isMuted":false,"resumePosition":0,"pan":null,"placeholder":-1};this._lastAIState.push(state);return state}async _OnTrigger(e){const type=e["type"];this._triggerTags=e["tags"];const aiId=e["aiid"];if(type==="ended"){for(const aiState of this._lastAIState)if(aiState["aiid"]===aiId){aiState["isPlaying"]=false;break}await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnEnded)}else if(type==="fade-ended")await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnFadeEnded)}_MatchTriggerTag(tagStr){return this._MatchTagListToStr(this._triggerTags, +tagStr)}Tick(){const o={"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTimeRaw(),"instPans":this.GetInstancePans(),"tickCount":this._runtime.GetTickCountNoSave()};if(this._listenerInst){const wi=this._listenerInst.GetWorldInfo();this._listenerPos[0]=wi.GetX();this._listenerPos[1]=wi.GetY();o["listenerPos"]=this._listenerPos;o["listenerOrientation"]=[...this._listenerForwardVec,...this._listenerUpVec]}this.PostToDOM("tick",o)}rotatePtAround(px,py,a,ox,oy){if(a===0)return[px, +py];const sin_a=Math.sin(a);const cos_a=Math.cos(a);px-=ox;py-=oy;const left_sin_a=px*sin_a;const top_sin_a=py*sin_a;const left_cos_a=px*cos_a;const top_cos_a=py*cos_a;px=left_cos_a-top_sin_a;py=top_cos_a+left_sin_a;px+=ox;py+=oy;return[px,py]}GetInstancePans(){return this._lastAIState.filter(ai=>ai["uid"]!==-1).map(ai=>this._runtime.GetInstanceByUID(ai["uid"])).filter(inst=>inst).map(inst=>{const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(), +wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);return{"uid":inst.GetUID(),"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()-layerAngle}})}GetAnalyserData(tagStr,index){for(const o of this._lastAnalysersData)if(o.index===index&&C3.equalsNoCase(o["tag"],tagStr))return o;return null}_IncrementEffectCount(tagStr){for(const tag of this._SplitTags(tagStr)){const lowerTag=tag.toLowerCase();this._effectCount.set(lowerTag,(this._effectCount.get(lowerTag)||0)+1)}}_ShouldSave(ai){if(ai.hasOwnProperty("placeholder"))return false; +if(this._saveLoadMode===3)return false;else if(ai["isMusic"]&&this._saveLoadMode===1)return false;else if(!ai["isMusic"]&&this._saveLoadMode===2)return false;else return true}SaveToJson(){return{"isSilent":this._isSilent,"masterVolume":this._masterVolume,"listenerZ":this._listenerPos[2],"listenerForwardVec":this._listenerForwardVec,"listenerUpVec":this._listenerUpVec,"listenerUid":this._listenerInst?this._listenerInst.GetUID():-1,"remoteUrls":[...this._remoteUrls.entries()],"playing":this._lastAIState.filter(ai=> +this._ShouldSave(ai)),"effects":this._lastFxState,"analysers":this._lastAnalysersData}}LoadFromJson(o){this._isSilent=o["isSilent"];this._masterVolume=o["masterVolume"];this._listenerPos[2]=o["listenerZ"];this._listenerInst=null;this._loadListenerUid=o["listenerUid"];if(o.hasOwnProperty("listenerForwardVec"))this._listenerForwardVec=o["listenerForwardVec"];else this._listenerForwardVec=[0,0,-1];if(o.hasOwnProperty("listenerUpVec"))this._listenerUpVec=o["listenerUpVec"];else this._listenerUpVec=[0, +1,0];this._remoteUrls.clear();if(o["remoteUrls"])for(const [k,v]of o["remoteUrls"])this._remoteUrls.set(k,v);this._lastAIState=o["playing"];for(const a of this._lastAIState)if(a.hasOwnProperty("tag")&&!a.hasOwnProperty("tags"))a["tags"]=[a["tag"]].filter(s=>!!s);this._lastFxState=o["effects"];this._lastAnalysersData=o["analysers"]}_OnAfterLoad(){if(this._loadListenerUid!==-1){this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid);this._loadListenerUid=-1;if(this._listenerInst){const wi= +this._listenerInst.GetWorldInfo();this._listenerPos[0]=wi.GetX();this._listenerPos[1]=wi.GetY()}}for(const ai of this._lastAIState){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(ai["bufferOriginalUrl"]);if(info){ai["bufferUrl"]=info.url;ai["bufferType"]=info.type}else ai["bufferUrl"]=null}for(const fxChainData of Object.values(this._lastFxState))for(const fxData of fxChainData)if(fxData.hasOwnProperty("bufferOriginalUrl")){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(fxData["bufferOriginalUrl"]); +if(info){fxData["bufferUrl"]=info.url;fxData["bufferType"]=info.type}}this.PostToDOM("load-state",{"saveLoadMode":this._saveLoadMode,"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTimeRaw(),"listenerPos":this._listenerPos,"listenerOrientation":[...this._listenerForwardVec,...this._listenerUpVec],"isSilent":this._isSilent,"masterVolume":this._masterVolume,"playing":this._lastAIState.filter(ai=>ai["bufferUrl"]!==null),"effects":this._lastFxState})}GetDebuggerProperties(){const fxProps= +[];for(const [tag,fxChainData]of Object.entries(this._lastFxState))fxProps.push({name:"$"+tag,value:fxChainData.map(d=>d["type"]).join(", ")});const prefix="plugins.audio.debugger";return[{title:prefix+".tag-effects",properties:fxProps},{title:prefix+".currently-playing",properties:[{name:prefix+".currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((s,index)=>({name:"$#"+index,value:`${s["bufferOriginalUrl"]} ("${s["tags"]}") ${Math.round(s["playbackTime"]*10)/10} / ${Math.round(s["duration"]* +10)/10}`}))]}]}}}{const C3=self.C3;C3.Plugins.Audio.Cnds={OnEnded(tagStr){return this._MatchTriggerTag(tagStr)},OnFadeEnded(tagStr){return this._MatchTriggerTag(tagStr)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return true},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const ai of this._lastAIState)if(ai["isPlaying"])return true;return false},IsTagPlaying(tagStr){return this._IsTagPlaying(tagStr)}}} +{const C3=self.C3;const FILTER_TYPES=["lowpass","highpass","bandpass","lowshelf","highshelf","peaking","notch","allpass"];C3.Plugins.Audio.Acts={Play(file,looping,vol,stereoPan,tagStr){const ret=C3.Plugins.Audio.Acts._DoPlay.call(this,file,looping,vol,stereoPan,tagStr);this._AddActionPromise(ret);return ret},PlayFromTimeline(file,vol,tagStr,startOffset){C3.Plugins.Audio.Acts._DoPlay.call(this,file,0,vol,0,tagStr,startOffset)},async _DoPlay(file,looping,vol,stereoPan,tagStr,startOffset){if(this._isSilent)return; +const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":startOffset|| +0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtPosition(file,looping,vol,x,y,z,angle,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!== +0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":z,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]= +this._runtime.GetTickCountNoSave()}},async PlayAtObject(file,looping,vol,objectClass,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]); +if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(file[0],tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()- +layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayByName(folder,filename,looping,vol,stereoPan,tagStr){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime; +this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"stereoPan":C3.clamp(stereoPan/100,-1,1),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}}, +async PlayAtPositionByName(folder,filename,looping,vol,x,y,z,angle,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename, +"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":z,"angle":C3.toRadians(angle),"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain)}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},async PlayAtObjectByName(folder,filename, +looping,vol,objectClass,innerAngle,outerAngle,outerGain,tagStr){if(this._isSilent)return;if(this._isSilent)return;if(!objectClass)return;const inst=objectClass.GetFirstPicked();if(!inst||!inst.GetWorldInfo())return;const wi=inst.GetWorldInfo();const layerAngle=wi.GetLayer().GetAngle();const [x,y]=this.rotatePtAround(wi.GetX(),wi.GetY(),-layerAngle,this._listenerPos[0],this._listenerPos[1]);const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase()); +if(!info)return;const nextPlayTime=this._nextPlayTime;this._nextPlayTime=0;const state=this._MaybeMarkAsPlaying(filename,tagStr,isMusic,looping!==0,this.DbToLinear(vol));try{await this.PostToDOMAsync("play",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic,"tags":this._SplitTags(tagStr),"isLooping":looping!==0,"vol":this.DbToLinear(vol),"pos":0,"off":nextPlayTime,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":x,"y":y,"z":wi.GetTotalZElevation(),"angle":wi.GetAngle()- +layerAngle,"innerAngle":C3.toRadians(innerAngle),"outerAngle":C3.toRadians(outerAngle),"outerGain":this.DbToLinear(outerGain),"uid":inst.GetUID()}})}finally{if(state)state["placeholder"]=this._runtime.GetTickCountNoSave()}},SetLooping(tagStr,looping){this.PostToDOM("set-looping",{"tags":this._SplitTags(tagStr),"isLooping":looping===0})},SetMuted(tagStr,muted){this.PostToDOM("set-muted",{"tags":this._SplitTags(tagStr),"isMuted":muted===0})},SetVolume(tagStr,vol){this.PostToDOM("set-volume",{"tags":this._SplitTags(tagStr), +"vol":this.DbToLinear(vol)})},FadeVolume(tagStr,vol,duration,ending){this.PostToDOM("fade-volume",{"tags":this._SplitTags(tagStr),"vol":this.DbToLinear(vol),"duration":duration,"stopOnEnd":ending===0})},SetStereoPan(tagStr,p){this.PostToDOM("set-stereo-pan",{"tags":this._SplitTags(tagStr),"p":C3.clamp(p/100,-1,1)})},async Preload(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload", +{"originalUrl":file[0],"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},async PreloadByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;this._preloadTotal++;await this.PostToDOMAsync("preload",{"originalUrl":filename,"url":info.url,"type":info.type,"isMusic":isMusic});this._preloadCount++},SetPlaybackRate(tagStr,rate){this.PostToDOM("set-playback-rate", +{"tags":this._SplitTags(tagStr),"rate":Math.max(rate,0)})},Stop(tagStr){this.PostToDOM("stop",{"tags":this._SplitTags(tagStr)})},StopAll(){this.PostToDOM("stop-all")},SetPaused(tagStr,state){this.PostToDOM("set-paused",{"tags":this._SplitTags(tagStr),"paused":state===0})},Seek(tagStr,pos){this.PostToDOM("seek",{"tags":this._SplitTags(tagStr),"pos":pos})},SetSilent(s){if(s===2)s=this._isSilent?1:0;s=s===0;if(this._isSilent===s)return;this._isSilent=s;this.PostToDOM("set-silent",{"isSilent":s})},SetMasterVolume(vol){const mv= +this.DbToLinear(vol);if(this._masterVolume===mv)return;this._masterVolume=mv;this.PostToDOM("set-master-volume",{"vol":mv})},AddFilterEffect(tagStr,type,freq,detune,q,gain,mix){const typeStr=FILTER_TYPES[type];this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"filter","tags":this._SplitTags(tagStr),"params":[typeStr,freq,detune,q,gain,C3.clamp(mix/100,0,1)]})},AddDelayEffect(tagStr,delay,gain,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"delay", +"tags":this._SplitTags(tagStr),"params":[delay,this.DbToLinear(gain),C3.clamp(mix/100,0,1)]})},AddFlangerEffect(tagStr,delay,modulation,freq,feedback,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"flanger","tags":this._SplitTags(tagStr),"params":[delay/1E3,modulation/1E3,freq,feedback/100,C3.clamp(mix/100,0,1)]})},AddPhaserEffect(tagStr,freq,detune,q,mod,modfreq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"phaser","tags":this._SplitTags(tagStr), +"params":[freq,detune,q,mod,modfreq,C3.clamp(mix/100,0,1)]})},AddConvolutionEffect(tagStr,file,norm,mix){const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return;this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"convolution","tags":this._SplitTags(tagStr),"bufferOriginalUrl":file[0],"bufferUrl":info.url,"bufferType":info.type,"params":[norm===0,C3.clamp(mix/100,0,1)]})},AddGainEffect(tagStr,g){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect", +{"type":"gain","tags":this._SplitTags(tagStr),"params":[this.DbToLinear(g)]})},AddStereoPanEffect(tagStr,g){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"stereopan","tags":this._SplitTags(tagStr),"params":[C3.clamp(g/100,-1,1)]})},AddMuteEffect(tagStr){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"gain","tags":this._SplitTags(tagStr),"params":[0]})},AddTremoloEffect(tagStr,freq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect", +{"type":"tremolo","tags":this._SplitTags(tagStr),"params":[freq,C3.clamp(mix/100,0,1)]})},AddRingModEffect(tagStr,freq,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"ringmod","tags":this._SplitTags(tagStr),"params":[freq,C3.clamp(mix/100,0,1)]})},AddDistortionEffect(tagStr,threshold,headroom,drive,makeupgain,mix){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"distortion","tags":this._SplitTags(tagStr),"params":[this.DbToLinearNoCap(threshold), +this.DbToLinearNoCap(headroom),drive,this.DbToLinearNoCap(makeupgain),C3.clamp(mix/100,0,1)]})},AddCompressorEffect(tagStr,threshold,knee,ratio,attack,release){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"compressor","tags":this._SplitTags(tagStr),"params":[threshold,knee,ratio,attack/1E3,release/1E3]})},AddAnalyserEffect(tagStr,fftSize,smoothing){this._IncrementEffectCount(tagStr);this.PostToDOM("add-effect",{"type":"analyser","tags":this._SplitTags(tagStr),"params":[fftSize, +smoothing]})},RemoveEffects(tagStr){const tagArr=this._SplitTags(tagStr);for(const tag of tagArr)this._effectCount.set(tag.toLowerCase(),0);this.PostToDOM("remove-effects",{"tags":tagArr});this._lastFxState={}},SetEffectParameter(tagStr,index,param,value,ramp,time){this.PostToDOM("set-effect-param",{"tags":this._SplitTags(tagStr),"index":Math.floor(index),"param":param,"value":value,"ramp":ramp,"time":time})},SetListenerObject(objectClass){if(!objectClass)return;const inst=objectClass.GetFirstPicked(); +if(!inst||!inst.GetWorldInfo())return;this._listenerInst=inst},SetListenerZ(z){this._listenerPos[2]=z},SetListenerOrientation(fx,fy,fz,ux,uy,uz){this._listenerForwardVec[0]=fx;this._listenerForwardVec[1]=fy;this._listenerForwardVec[2]=-fz;this._listenerUpVec[0]=ux;this._listenerUpVec[1]=uy;this._listenerUpVec[2]=-uz},ScheduleNextPlay(t){this._nextPlayTime=Math.max(t,0)},UnloadAudio(file){const isMusic=file[1];const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(file[0]);if(!info)return; +this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAudioByName(folder,filename){const isMusic=folder===1;const info=this._runtime.GetAssetManager().GetProjectAudioFileUrl(filename)||this._remoteUrls.get(filename.toLowerCase());if(!info)return;this.PostToDOM("unload",{"url":info.url,"type":info.type,"isMusic":isMusic})},UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(url,type,name){this._remoteUrls.set(name.toLowerCase(),{url,type})}}} +{const C3=self.C3;C3.Plugins.Audio.Exps={Duration(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["duration"]:0},PlaybackTime(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["playbackTime"]:0},PlaybackRate(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?a["playbackRate"]:0},Volume(tagStr){const a=this._GetFirstAudioStateByTags(tagStr);return a?this.LinearToDb(a["volume"]):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(tag){return this._effectCount.get(tag.toLowerCase())|| +0},AnalyserFreqBinCount(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index));return o?o["binCount"]:0},AnalyserFreqBinAt(tagStr,index,bin){const o=this.GetAnalyserData(tagStr,Math.floor(index));if(!o)return 0;bin=Math.floor(bin);if(bin<0||bin>=o["binCount"])return 0;return o["freqBins"][bin]},AnalyserPeakLevel(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index));return o?o["peak"]:0},AnalyserRMSLevel(tagStr,index){const o=this.GetAnalyserData(tagStr,Math.floor(index)); +return o?o["rms"]:0},SampleRate(){return this._sampleRate},CurrentTime(){if(self["C3_GetAudioContextCurrentTime"])return self["C3_GetAudioContextCurrentTime"]();else return performance.now()/1E3},OutputLatency(){return this._outputLatency}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.TiledBg=class TiledBgPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;function WrapModeToStr(wrapMode){switch(wrapMode){case 0:return"clamp-to-edge";case 1:return"repeat";case 2:return"mirror-repeat"}return"repeat"}C3.Plugins.TiledBg.Type=class TiledBgType extends C3.SDKTypeBase{constructor(objectClass,exportData){super(objectClass);this._wrapX="repeat";this._wrapY="repeat";if(exportData){this._wrapX=WrapModeToStr(exportData[0]);this._wrapY=WrapModeToStr(exportData[1])}}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer, +{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const INITIALLY_VISIBLE=0;const ORIGIN=1;const IMAGE_OFFSET_X=4;const IMAGE_OFFSET_Y=5;const IMAGE_SCALE_X=6;const IMAGE_SCALE_Y=7;const IMAGE_ANGLE=8;const ENABLE_TILE_RANDOMIZATION=9;const TILE_XRANDOM=10;const TILE_YRANDOM=11;const TILE_ANGLERANDOM=12;const TILE_BLENDMARGINX=13;const TILE_BLENDMARGINY=14;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);const rcTex=C3.New(C3.Rect);const qTex=C3.New(C3.Quad);C3.Plugins.TiledBg.Instance=class TiledBgInstance extends C3.SDKWorldInstanceBase{constructor(inst, +properties){super(inst);this._imageOffsetX=0;this._imageOffsetY=0;this._imageScaleX=1;this._imageScaleY=1;this._imageAngle=0;this._enableTileRandomization=false;this._tileXRandom=0;this._tileYRandom=0;this._tileAngleRandom=0;this._tileBlendMarginX=0;this._tileBlendMarginY=0;this._ownImageInfo=null;if(properties){this.GetWorldInfo().SetVisible(!!properties[INITIALLY_VISIBLE]);this._imageOffsetX=properties[IMAGE_OFFSET_X];this._imageOffsetY=properties[IMAGE_OFFSET_Y];this._imageScaleX=properties[IMAGE_SCALE_X]; +this._imageScaleY=properties[IMAGE_SCALE_Y];this._imageAngle=C3.toRadians(properties[IMAGE_ANGLE]);this._enableTileRandomization=!!properties[ENABLE_TILE_RANDOMIZATION];this._tileXRandom=properties[TILE_XRANDOM];this._tileYRandom=properties[TILE_YRANDOM];this._tileAngleRandom=properties[TILE_ANGLERANDOM];this._tileBlendMarginX=properties[TILE_BLENDMARGINX];this._tileBlendMarginY=properties[TILE_BLENDMARGINY]}}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){if(this._ownImageInfo){this._ownImageInfo.Release(); +this._ownImageInfo=null}}CalculateTextureCoordsFor3DFace(areaWidth,areaHeight,outQuad){const imageInfo=this.GetCurrentImageInfo();const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const imageAngle=this._imageAngle;rcTex.set(0,0,areaWidth/(imageWidth*this._imageScaleX),areaHeight/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(imageAngle===0)outQuad.setFromRect(rcTex); +else outQuad.setFromRotatedRect(rcTex,-imageAngle)}SetTilingShaderProgram(renderer){if(this._enableTileRandomization){const imageInfo=this.GetCurrentImageInfo();renderer.SetTileRandomizationMode();renderer.SetTileRandomizationInfo(imageInfo.GetWidth()*this._imageScaleX,imageInfo.GetHeight()*this._imageScaleY,this._tileXRandom,this._tileYRandom,this._tileAngleRandom,this._tileBlendMarginX,this._tileBlendMarginY)}else renderer.SetTextureFillMode()}Draw(renderer){const imageInfo=this.GetCurrentImageInfo(); +const texture=imageInfo.GetTexture();if(texture===null)return;this.SetTilingShaderProgram(renderer);renderer.SetTexture(texture);const imageWidth=imageInfo.GetWidth();const imageHeight=imageInfo.GetHeight();const imageOffsetX=this._imageOffsetX/imageWidth;const imageOffsetY=this._imageOffsetY/imageHeight;const wi=this.GetWorldInfo();rcTex.set(0,0,wi.GetWidth()/(imageWidth*this._imageScaleX),wi.GetHeight()/(imageHeight*this._imageScaleY));rcTex.offset(-imageOffsetX,-imageOffsetY);if(wi.HasMesh())this._DrawMesh(wi, +renderer);else this._DrawStandard(wi,renderer)}_DrawStandard(wi,renderer){let quad=wi.GetBoundingQuad();if(this._runtime.IsPixelRoundingEnabled())quad=wi.PixelRoundQuad(quad);if(this._imageAngle===0)renderer.Quad3(quad,rcTex);else{qTex.setFromRotatedRect(rcTex,-this._imageAngle);renderer.Quad4(quad,qTex)}}_DrawMesh(wi,renderer){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);let quad=tempQuad;if(this._runtime.IsPixelRoundingEnabled())quad= +wi.PixelRoundQuad(quad);let texCoords=rcTex;if(this._imageAngle!==0){qTex.setFromRotatedRect(rcTex,-this._imageAngle);texCoords=qTex}transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),quad,texCoords);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return true}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(true)}_SetImageOffsetX(x){if(this._imageOffsetX=== +x)return;this._imageOffsetX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(y){if(this._imageOffsetY===y)return;this._imageOffsetY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(x){if(this._imageScaleX===x)return;this._imageScaleX=x;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(y){if(this._imageScaleY=== +y)return;this._imageScaleY=y;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(a){if(this._imageAngle===a)return;this._imageAngle=a;this._runtime.UpdateRender();this._SetMeshChanged()}_GetImageAngle(){return this._imageAngle}_SetTileRandomizationEnabled(e){e=!!e;if(this._enableTileRandomization===e)return;this._enableTileRandomization=e;this._runtime.UpdateRender()}_IsTileRandomizationEnabled(){return this._enableTileRandomization}_SetTileXRandom(x){if(this._tileXRandom=== +x)return;this._tileXRandom=x;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileXRandom(){return this._tileXRandom}_SetTileYRandom(y){if(this._tileYRandom===y)return;this._tileYRandom=y;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileYRandom(){return this._tileYRandom}_SetTileAngleRandom(a){if(this._tileAngleRandom===a)return;this._tileAngleRandom=a;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileAngleRandom(){return this._tileAngleRandom}_SetTileBlendMarginX(x){if(this._tileBlendMarginX=== +x)return;this._tileBlendMarginX=x;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileBlendMarginX(){return this._tileBlendMarginX}_SetTileBlendMarginY(y){if(this._tileBlendMarginY===y)return;this._tileBlendMarginY=y;if(this._IsTileRandomizationEnabled())this._runtime.UpdateRender()}_GetTileBlendMarginY(){return this._tileBlendMarginY}GetDebuggerProperties(){const propsPrefix="plugins.tiledbg.properties";return[{title:propsPrefix+".image-transform.name",properties:[{name:propsPrefix+ +".image-offset-x.name",value:this._GetImageOffsetX(),onedit:v=>this._SetImageOffsetX(v)},{name:propsPrefix+".image-offset-y.name",value:this._GetImageOffsetY(),onedit:v=>this._SetImageOffsetY(v)},{name:propsPrefix+".image-scale-x.name",value:this._GetImageScaleX()*100,onedit:v=>this._SetImageScaleX(v/100)},{name:propsPrefix+".image-scale-y.name",value:this._GetImageScaleY()*100,onedit:v=>this._SetImageScaleY(v/100)},{name:propsPrefix+".image-angle.name",value:C3.toDegrees(this._GetImageAngle()),onedit:v=> +this._SetImageAngle(C3.toRadians(v))}]},{title:propsPrefix+".tile-randomization.name",properties:[{name:propsPrefix+".enable-tile-randomization.name",value:this._IsTileRandomizationEnabled(),onedit:v=>this._SetTileRandomizationEnabled(v)},{name:propsPrefix+".x-random.name",value:this._GetTileXRandom()*100,onedit:v=>this._SetTileXRandom(v/100)},{name:propsPrefix+".y-random.name",value:this._GetTileYRandom()*100,onedit:v=>this._SetTileYRandom(v/100)},{name:propsPrefix+".angle-random.name",value:this._GetTileAngleRandom()* +100,onedit:v=>this._SetTileAngleRandom(v/100)},{name:propsPrefix+".blend-margin-x.name",value:this._GetTileBlendMarginX()*100,onedit:v=>this._SetTileBlendMarginX(v/100)},{name:propsPrefix+".blend-margin-y.name",value:this._GetTileBlendMarginY()*100,onedit:v=>this._SetTileBlendMarginY(v/100)}]}]}GetPropertyValueByIndex(index){switch(index){case IMAGE_OFFSET_X:return this._GetImageOffsetX();case IMAGE_OFFSET_Y:return this._GetImageOffsetY();case IMAGE_SCALE_X:return this._GetImageScaleX();case IMAGE_SCALE_Y:return this._GetImageScaleY(); +case IMAGE_ANGLE:return this._GetImageAngle();case ENABLE_TILE_RANDOMIZATION:return this._IsTileRandomizationEnabled();case TILE_XRANDOM:return this._GetTileXRandom();case TILE_YRANDOM:return this._GetTileYRandom();case TILE_ANGLERANDOM:return this._GetTileAngleRandom();case TILE_BLENDMARGINX:return this._GetTileBlendMarginX();case TILE_BLENDMARGINY:return this._GetTileBlendMarginY()}}SetPropertyValueByIndex(index,value){switch(index){case IMAGE_OFFSET_X:this._SetImageOffsetX(value);break;case IMAGE_OFFSET_Y:this._SetImageOffsetY(value); +break;case IMAGE_SCALE_X:this._SetImageScaleX(value);break;case IMAGE_SCALE_Y:this._SetImageScaleY(value);break;case IMAGE_ANGLE:this._SetImageAngle(value);break;case ENABLE_TILE_RANDOMIZATION:this._SetTileRandomizationEnabled(!!value);break;case TILE_XRANDOM:this._SetTileXRandom(value);break;case TILE_YRANDOM:this._SetTileYRandom(value);break;case TILE_ANGLERANDOM:this._SetTileAngleRandom(value);break;case TILE_BLENDMARGINX:this._SetTileBlendMarginX(value);break;case TILE_BLENDMARGINY:this._SetTileBlendMarginY(value); +break}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const map=new WeakMap;self.ITiledBackgroundInstance=class ITiledBackgroundInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageOffsetX(x)}get imageOffsetX(){return map.get(this)._GetImageOffsetX()}set imageOffsetY(y){C3X.RequireFiniteNumber(y);map.get(this)._SetImageOffsetY(y)}get imageOffsetY(){return map.get(this)._GetImageOffsetY()}setImageOffset(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetImageOffsetX(x);inst._SetImageOffsetY(y)}getImageOffset(){const inst=map.get(this);return[inst._GetImageOffsetX(),inst._GetImageOffsetY()]}set imageScaleX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetImageScaleX(x)}get imageScaleX(){return map.get(this)._GetImageScaleX()}set imageScaleY(y){C3X.RequireFiniteNumber(y);map.get(this)._SetImageScaleY(y)}get imageScaleY(){return map.get(this)._GetImageScaleY()}setImageScale(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetImageScaleX(x);inst._SetImageScaleY(y)}getImageScale(){const inst=map.get(this);return[inst._GetImageScaleX(),inst._GetImageScaleY()]}set imageAngle(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(a)}get imageAngle(){return map.get(this)._GetImageAngle()}set imageAngleDegrees(a){C3X.RequireFiniteNumber(a);map.get(this)._SetImageAngle(C3.toRadians(a))}get imageAngleDegrees(){return C3.toDegrees(map.get(this)._GetImageAngle())}get imageWidth(){return map.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return map.get(this).GetCurrentImageInfo().GetHeight()}getImageSize(){const imageInfo= +map.get(this).GetCurrentImageInfo();return[imageInfo.GetWidth(),imageInfo.GetHeight()]}set enableTileRandomization(e){map.get(this)._SetTileRandomizationEnabled(!!e)}get enableTileRandomization(){return map.get(this)._IsTileRandomizationEnabled()}set tileXRandom(x){C3X.RequireFiniteNumber(x);map.get(this)._SetTileXRandom(x)}get tileXRandom(){return map.get(this)._GetTileXRandom()}set tileYRandom(y){C3X.RequireFiniteNumber(y);map.get(this)._SetTileYRandom(y)}get tileYRandom(){return map.get(this)._GetTileYRandom()}setTileRandom(x, +y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetTileXRandom(x);inst._SetTileYRandom(y)}getTileRandom(){const inst=map.get(this);return[inst._GetTileXRandom(),inst._GetTileYRandom()]}set tileAngleRandom(a){C3X.RequireFiniteNumber(a);map.get(this)._SetTileAngleRandom(a)}get tileAngleRandom(){return map.get(this)._GetTileAngleRandom()}set tileBlendMarginX(x){C3X.RequireFiniteNumber(x);map.get(this)._SetTileBlendMarginX(x)}get tileBlendMarginX(){return map.get(this)._GetTileBlendMarginX()}set tileBlendMarginY(y){C3X.RequireFiniteNumber(y); +map.get(this)._SetTileBlendMarginY(y)}get tileBlendMarginY(){return map.get(this)._GetTileBlendMarginY()}setTileBlendMargin(x,y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);const inst=map.get(this);inst._SetTileBlendMarginX(x);inst._SetTileBlendMarginY(y)}getTileBlendMargin(){const inst=map.get(this);return[inst._GetTileBlendMarginX(),inst._GetTileBlendMarginY()]}async replaceImage(blob){C3X.RequireInstanceOf(blob,Blob);const sdkInst=map.get(this);const runtime=sdkInst.GetRuntime();const imageInfo= +C3.New(C3.ImageInfo);imageInfo.LoadDynamicBlobAsset(runtime,blob);await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"});if(sdkInst.WasReleased()){imageInfo.Release();return}sdkInst._ReleaseOwnImage();sdkInst._ownImageInfo=imageInfo;runtime.UpdateRender()}}}{const C3=self.C3;C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return true},OnURLFailed(){return true},IsTileRandomizationEnabled(){return this._IsTileRandomizationEnabled()}}} +{const C3=self.C3;C3.Plugins.TiledBg.Acts={SetImageOffsetX(x){this._SetImageOffsetX(x)},SetImageOffsetY(y){this._SetImageOffsetY(y)},SetImageScaleX(x){this._SetImageScaleX(x/100)},SetImageScaleY(y){this._SetImageScaleY(y/100)},SetImageAngle(a){this._SetImageAngle(C3.toRadians(a))},SetTileRandomizationEnabled(e){this._SetTileRandomizationEnabled(e)},SetTilePosRandom(x,y){this._SetTileXRandom(x/100);this._SetTileYRandom(y/100)},SetTileAngleRandom(a){this._SetTileAngleRandom(a/100)},SetTileBlendMargin(x, +y){this._SetTileBlendMarginX(x/100);this._SetTileBlendMarginY(y/100)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},async LoadURL(url,crossOrigin){if(this._ownImageInfo&&this._ownImageInfo.GetURL()===url)return;const runtime=this._runtime;const imageInfo=C3.New(C3.ImageInfo);try{await imageInfo.LoadDynamicAsset(runtime,url);if(!imageInfo.IsLoaded())throw new Error("image failed to load");if(this.WasReleased()){imageInfo.Release();return null}const texture= +await imageInfo.LoadStaticTexture(runtime.GetRenderer(),{sampling:runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"});if(!texture)return}catch(err){console.error("Load image from URL failed: ",err);if(!this.WasReleased())this.Trigger(C3.Plugins.TiledBg.Cnds.OnURLFailed);return}if(this.WasReleased()){imageInfo.Release();return}this._ReleaseOwnImage();this._ownImageInfo=imageInfo;runtime.UpdateRender();await this.TriggerAsync(C3.Plugins.TiledBg.Cnds.OnURLLoaded)}}} +{const C3=self.C3;C3.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return this._imageScaleX*100},ImageScaleY(){return this._imageScaleY*100},ImageAngle(){return C3.toDegrees(this._imageAngle)},TileXRandom(){return this._GetTileXRandom()*100},TileYRandom(){return this._GetTileYRandom()*100},TileAngleRandom(){return this._GetTileAngleRandom()* +100},TileBlendMarginX(){return this._GetTileBlendMarginX()*100},TileBlendMarginY(){return this._GetTileBlendMarginY()*100}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Spritefont2=class SpriteFontPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Type=class SpriteFontType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass);this._spriteFont=C3.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(characterWidth,characterHeight, +characterSet,spacingData){const imageInfo=this.GetImageInfo();const sf=this._spriteFont;sf.SetWidth(imageInfo.GetWidth());sf.SetHeight(imageInfo.GetHeight());sf.SetCharacterWidth(characterWidth);sf.SetCharacterHeight(characterHeight);sf.SetCharacterSet(characterSet);sf.SetSpacingData(spacingData);sf.UpdateCharacterMap()}}} +{const C3=self.C3;const C3X=self.C3X;const tempVec2=C3.New(C3.Vector2);const TEXT=0;const ENABLE_BBCODE=1;const CHARACTER_WIDTH=2;const CHARACTER_HEIGHT=3;const CHARACTER_SET=4;const SPACING_DATA=5;const SCALE=6;const CHARACTER_SPACING=7;const LINE_HEIGHT=8;const HORIZONTAL_ALIGNMENT=9;const VERTICAL_ALIGNMENT=10;const WRAPPING=11;const INITIALLY_VISIBLE=12;const ORIGIN=13;const READ_ALOUD=14;const HORIZONTAL_ALIGNMENTS=["left","center","right"];const VERTICAL_ALIGNMENTS=["top","center","bottom"]; +const WORD_WRAP=0;const CHARACTER_WRAP=1;C3.Plugins.Spritefont2.Instance=class SpriteFontInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._text="";this._enableBBcode=true;this._characterWidth=16;this._characterHeight=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";let spacingData="";this._characterScale=1;this._characterSpacing=0;this._lineHeight=0;this._horizontalAlign=0;this._verticalAlign= +0;this._wrapByWord=true;this._readAloud=false;this._screenReaderText=null;this._spriteFontText=null;this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;if(properties){this._text=properties[0];this._enableBBcode=properties[1];this._characterWidth=properties[2];this._characterHeight=properties[3];this._characterSet=properties[4];spacingData=properties[5];this._characterScale=properties[6];this._characterSpacing=properties[7];this._lineHeight=properties[8];this._horizontalAlign= +properties[9];this._verticalAlign=properties[10];this._wrapByWord=properties[11]===0;const wi=this.GetWorldInfo();wi.SetVisible(properties[12]);this._readAloud=!!properties[READ_ALOUD]}this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,this._characterSet,spacingData);this._spriteFontText=C3.New(self.SpriteFontText,this._sdkType.GetSpriteFont());const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._UpdateSettings();this._UpdateScreenReaderText(); +this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();if(this._screenReaderText){this._screenReaderText.Release();this._screenReaderText=null}this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const sft=this._spriteFontText;if(!sft)return;sft.SetBBCodeEnabled(this._enableBBcode);sft.SetText(this._text);sft.SetWordWrapMode(this._wrapByWord?"word":"character");sft.SetHorizontalAlign(HORIZONTAL_ALIGNMENTS[this._horizontalAlign]);sft.SetVerticalAlign(VERTICAL_ALIGNMENTS[this._verticalAlign]); +sft.SetSpacing(this._characterSpacing);sft.SetLineHeight(this._lineHeight)}_UpdateTextSize(){const wi=this.GetWorldInfo();this._spriteFontText.SetSize(wi.GetWidth(),wi.GetHeight());this._spriteFontText.SetScale(this._characterScale)}_UpdateScreenReaderText(){if(this._readAloud){let text=this._text;if(this._enableBBcode)text=C3.BBString.StripAnyTags(text);if(this._screenReaderText)this._screenReaderText.SetText(text);else this._screenReaderText=C3.New(C3.ScreenReaderText,this._runtime,text)}else if(this._screenReaderText){this._screenReaderText.Release(); +this._screenReaderText=null}}Draw(renderer){const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;renderer.SetTexture(texture);const wi=this.GetWorldInfo();let q=wi.GetBoundingQuad();const sft=this._spriteFontText;sft.SetScale(this._characterScale);sft.SetSceneGraphScale(wi.GetSceneGraphScale());if(this._runtime.IsPixelRoundingEnabled())q=wi.PixelRoundQuad(q);sft.SetSize(wi.GetWidth(),wi.GetHeight());sft.GetSpriteFont().SetTexRect(imageInfo.GetTexRect()); +sft.SetColor(wi.GetUnpremultipliedColor());sft.Draw(renderer,q.getTlx(),q.getTly(),wi.GetAngle())}SaveToJson(){const ret={"t":this._text,"ebbc":this._enableBBcode,"csc":this._characterScale,"csp":this._characterSpacing,"lh":this._lineHeight,"ha":this._horizontalAlign,"va":this._verticalAlign,"w":this._wrapByWord,"cw":this._sdkType.GetSpriteFont().GetCharacterWidth(),"ch":this._sdkType.GetSpriteFont().GetCharacterHeight(),"cs":this._sdkType.GetSpriteFont().GetCharacterSet(),"sd":this._sdkType.GetSpriteFont().GetSpacingData()}; +if(this._typewriterEndTime!==-1)ret["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime,"l":this._typewriterLength};return ret}LoadFromJson(o){this._CancelTypewriter();this._text=o["t"];this._enableBBcode=o["ebbc"];this._characterScale=o["csc"];this._characterSpacing=o["csp"];this._lineHeight=o["lh"];this._horizontalAlign=o["ha"];this._verticalAlign=o["va"];this._wrapByWord=o["w"];if(o.hasOwnProperty("tw")){const tw=o["tw"];this._typewriterStartTime=tw["st"];this._typewriterEndTime= +tw["en"];this._typewriterLength=o["l"]}const spriteFont=this._sdkType.GetSpriteFont();spriteFont.SetCharacterWidth(o["cw"]);spriteFont.SetCharacterHeight(o["ch"]);spriteFont.SetCharacterSet(o["cs"]);spriteFont.SetSpacingData(o["sd"]);this._UpdateSettings();this._UpdateScreenReaderText();if(this._typewriterEndTime!==-1)this._StartTicking()}GetPropertyValueByIndex(index){switch(index){case TEXT:return this.GetText();case ENABLE_BBCODE:return this._enableBBcode;case CHARACTER_WIDTH:return this._sdkType.GetSpriteFont().GetCharacterWidth(); +case CHARACTER_HEIGHT:return this._sdkType.GetSpriteFont().GetCharacterHeight();case CHARACTER_SET:return this._sdkType.GetSpriteFont().GetCharacterSet();case SPACING_DATA:return this._sdkType.GetSpriteFont().GetSpacingData();case SCALE:return this._GetScale();case CHARACTER_SPACING:return this._GetCharacterSpacing();case LINE_HEIGHT:return this._GetLineHeight();case HORIZONTAL_ALIGNMENT:return this._GetHAlign();case VERTICAL_ALIGNMENT:return this._GetVAlign();case WRAPPING:return this._IsWrapByWord()? +CHARACTER_WRAP:WORD_WRAP}}SetPropertyValueByIndex(index,value){switch(index){case TEXT:this._SetText(value);break;case ENABLE_BBCODE:if(this._enableBBcode===!!value)return;this._enableBBcode=!!value;this._UpdateSettings();break;case CHARACTER_WIDTH:this._sdkType.GetSpriteFont().SetCharacterWidth(value);break;case CHARACTER_HEIGHT:this._sdkType.GetSpriteFont().SetCharacterHeight(value);break;case CHARACTER_SET:this._sdkType.GetSpriteFont().SetCharacterSet(value);break;case SPACING_DATA:this._sdkType.GetSpriteFont().SetSpacingData(value); +break;case SCALE:this._SetScale(value);break;case CHARACTER_SPACING:this._SetCharacterSpacing(value);break;case LINE_HEIGHT:this._SetLineHeight(value);break;case HORIZONTAL_ALIGNMENT:this._SetHAlign(value);break;case VERTICAL_ALIGNMENT:this._SetVAlign(value);break;case WRAPPING:this._SetWrapByWord(value===WORD_WRAP);break}}_SetText(text){if(this._text===text)return;this._text=text;this._spriteFontText.SetText(text);this._UpdateScreenReaderText();this._runtime.UpdateRender()}GetText(){return this._text}_StartTypewriter(text, +duration){this._SetText(text);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+duration/this.GetInstance().GetActiveTimeScale();this._typewriterLength=C3.CountGraphemes(C3.BBString.StripAnyTags(text));this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1;this._typewriterEndTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){if(this._typewriterEndTime=== +-1)return;this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}_SetScale(s){if(this._characterScale===s)return;this._characterScale=s;this._spriteFontText.SetScale(this._characterScale);this._runtime.UpdateRender()}_GetScale(){return this._characterScale}_SetCharacterSpacing(s){if(this._characterSpacing===s)return;this._characterSpacing=s;this._spriteFontText.SetSpacing(this._characterSpacing);this._runtime.UpdateRender()}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(h){if(this._lineHeight=== +h)return;this._lineHeight=h;this._spriteFontText.SetLineHeight(this._lineHeight);this._runtime.UpdateRender()}_GetLineHeight(){return this._lineHeight}_SetHAlign(h){if(this._horizontalAlign===h)return;this._horizontalAlign=h;this._UpdateSettings();this._runtime.UpdateRender()}_GetHAlign(){return this._horizontalAlign}_SetVAlign(v){if(this._verticalAlign===v)return;this._verticalAlign=v;this._UpdateSettings();this._runtime.UpdateRender()}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(w){w= +!!w;if(this._wrapByWord===w)return;this._wrapByWord=w;this._UpdateSettings();this._runtime.UpdateRender()}_IsWrapByWord(){return this._wrapByWord}_SetReadAloud(r){this._readAloud=!!r;this._UpdateScreenReaderText()}_IsReadAloud(){return this._readAloud}_GetTextWidth(){this._UpdateTextSize();return this._spriteFontText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();return this._spriteFontText.GetTextHeight()}_GetTagAtPosition(x,y){this._UpdateTextSize();const wi=this.GetWorldInfo();tempVec2.set(x- +wi.GetX(),y-wi.GetY());tempVec2.rotate(-wi.GetAngle());tempVec2.offset(wi.GetWidth()*wi.GetOriginX(),wi.GetHeight()*wi.GetOriginY());const frag=this._spriteFontText.HitTestFragment(tempVec2.getX(),tempVec2.getY());if(frag){const fragTagStyle=frag.GetStyleTag("tag");if(fragTagStyle)return fragTagStyle.param}return""}_HasTagAtPosition(tag,x,y){const hitTag=this._GetTagAtPosition(x,y);return hitTag&&C3.equalsNoCase(tag,hitTag)}_GetTagPosition(tag,index){this._UpdateTextSize();index=Math.floor(index); +const frag=this._spriteFontText.FindFragmentWithTag(tag,index);if(!frag)return null;const wi=this.GetWorldInfo();tempVec2.set(frag.GetPosX(),frag.GetPosY());tempVec2.offset(-wi.GetWidth()*wi.GetOriginX(),-wi.GetHeight()*wi.GetOriginY());tempVec2.rotate(wi.GetAngle());tempVec2.offset(wi.GetX(),wi.GetY());return{x:tempVec2.getX(),y:tempVec2.getY(),width:frag.GetWidth(),height:frag.GetHeight()}}_GetTagCount(tag){this._UpdateTextSize();return this._spriteFontText.CountFragmentsWithTag(tag)}Tick(){const wallTime= +this._runtime.GetWallTime();if(wallTime>=this._typewriterEndTime){this._CancelTypewriter();this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished);this._runtime.UpdateRender()}else{let displayLength=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,wallTime,0,this._typewriterLength);displayLength=Math.floor(displayLength);if(displayLength!==this._spriteFontText.GetDrawMaxCharacterCount()){this._spriteFontText.SetDrawMaxCharacterCount(displayLength);this._runtime.UpdateRender()}}}GetDebuggerProperties(){const prefix= +"plugins.spritefont2";return[{title:prefix+".name",properties:[{name:prefix+".properties.text.name",value:this.GetText(),onedit:v=>this._SetText(v)},{name:prefix+".properties.scale.name",value:this._GetScale(),onedit:v=>this._SetScale(v)},{name:prefix+".properties.character-spacing.name",value:this._GetCharacterSpacing(),onedit:v=>this._SetCharacterSpacing(v)},{name:prefix+".properties.line-height.name",value:this._GetLineHeight(),onedit:v=>this._SetLineHeight(v)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}}; +const map=new WeakMap;const SCRIPT_HORIZONTAL_ALIGNMENTS=new Map([["left",0],["center",1],["right",2]]);const SCRIPT_VERTICAL_ALIGNMENTS=new Map([["top",0],["center",1],["bottom",2]]);const SCRIPT_WRAP_MODES=new Map([["word",true],["character",false]]);self.ISpriteFontInstance=class ISpriteFontInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return map.get(this).GetText()}set text(str){C3X.RequireString(str);const inst= +map.get(this);inst._CancelTypewriter();inst._SetText(str)}typewriterText(str,duration){C3X.RequireString(str);C3X.RequireFiniteNumber(duration);const inst=map.get(this);inst._CancelTypewriter();inst._StartTypewriter(str,duration)}typewriterFinish(){map.get(this)._FinishTypewriter()}set characterScale(s){C3X.RequireFiniteNumber(s);map.get(this)._SetScale(s)}get characterScale(){return map.get(this)._GetScale()}set characterSpacing(s){C3X.RequireFiniteNumber(s);map.get(this)._SetCharacterSpacing(s)}get characterSpacing(){return map.get(this)._GetCharacterSpacing()}set lineHeight(lho){C3X.RequireFiniteNumber(lho); +map.get(this)._SetLineHeight(lho)}get lineHeight(){return map.get(this)._GetLineHeight()}set horizontalAlign(str){C3X.RequireString(str);const h=SCRIPT_HORIZONTAL_ALIGNMENTS.get(str);if(typeof h==="undefined")throw new Error("invalid mode");map.get(this)._SetHAlign(h)}get horizontalAlign(){return HORIZONTAL_ALIGNMENTS[map.get(this)._GetHAlign()]}set verticalAlign(str){C3X.RequireString(str);const v=SCRIPT_VERTICAL_ALIGNMENTS.get(str);if(typeof v==="undefined")throw new Error("invalid mode");map.get(this)._SetVAlign(v)}get verticalAlign(){return VERTICAL_ALIGNMENTS[map.get(this)._GetVAlign()]}set wordWrapMode(str){C3X.RequireString(str); +const isWrapByWord=SCRIPT_WRAP_MODES.get(str);if(typeof isWrapByWord==="undefined")throw new Error("invalid mode");map.get(this)._SetWrapByWord(isWrapByWord)}get wordWrapMode(){return map.get(this)._IsWrapByWord()?"word":"character"}set readAloud(r){map.get(this)._SetReadAloud(!!r)}get readAloud(){return map.get(this)._IsReadAloud()}get textWidth(){return map.get(this)._GetTextWidth()}get textHeight(){return map.get(this)._GetTextHeight()}getTextSize(){const inst=map.get(this);return[inst._GetTextWidth(), +inst._GetTextHeight()]}hasTagAtPosition(tag,x,y){C3X.RequireString(tag);C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);return map.get(this)._HasTagAtPosition(tag,x,y)}getTagAtPosition(x,y){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);return map.get(this)._GetTagAtPosition(x,y)}getTagPositionAndSize(tag,index=0){C3X.RequireString(tag);C3X.RequireFiniteNumber(index);return map.get(this)._GetTagPosition(tag,index)}getTagCount(tag){C3X.RequireString(tag);return map.get(this)._GetTagCount(tag)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Cnds={CompareText(text,caseSensitive){if(caseSensitive)return this._text===text;else return C3.equalsNoCase(this._text,text)},IsRunningTypewriterText(){return this._typewriterEndTime!==-1},OnTypewriterTextFinished(){return true},HasTagAtPosition(tag,x,y){return this._HasTagAtPosition(tag,x,y)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Acts={SetText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;this._SetText(param.toString())},AppendText(param){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/1E10;param=param.toString();if(!param)return;this._SetText(this._text+param)},TypewriterText(param,duration){this._CancelTypewriter();if(typeof param==="number"&¶m<1E9)param=Math.round(param*1E10)/ +1E10;this._StartTypewriter(param.toString(),duration)},TypewriterFinish(){this._FinishTypewriter()},SetScale(s){this._SetScale(s)},SetCharacterSpacing(s){this._SetCharacterSpacing(s)},SetLineHeight(h){this._SetLineHeight(h)},SetCharacterWidth(chars,width){let didAnyChange=false;const spriteFont=this._sdkType.GetSpriteFont();for(const ch of chars)if(ch===" "){spriteFont.SetSpaceWidth(width);didAnyChange=true}else{const sfc=spriteFont.GetCharacter(ch);if(sfc){sfc.SetDisplayWidth(width);didAnyChange= +true}}if(didAnyChange)spriteFont.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},SetHAlign(h){this._SetHAlign(h)},SetVAlign(v){this._SetVAlign(v)},SetWrapping(w){this._SetWrapByWord(w===0)},SetReadAloud(r){this._SetReadAloud(r)}}} +{const C3=self.C3;C3.Plugins.Spritefont2.Exps={CharacterWidth(ch){const sfc=this._sdkType.GetSpriteFont().GetCharacter(ch);if(sfc)return sfc.GetDisplayWidth();else return this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){if(this._enableBBcode)return C3.BBString.StripAnyTags(this._text); +else return this._text},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},TagAtPosition(x,y){return this._GetTagAtPosition(x,y)},TagCount(tag){return this._GetTagCount(tag)},TagX(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.x:0},TagY(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.y:0},TagWidth(tag,index){const ret=this._GetTagPosition(tag,index);return ret?ret.width:0},TagHeight(tag,index){const ret=this._GetTagPosition(tag, +index);return ret?ret.height:0}}}; + +} + +{ +'use strict';const C3=self.C3; +self.SpriteFontCharacter=class SpriteFontCharacter{constructor(spriteFont,char,x,y){let charWidth=spriteFont.GetCharacterWidth();let charHeight=spriteFont.GetCharacterHeight();this._spriteFont=spriteFont;this._char=char;this._pxRect=new C3.Rect(x,y,x+charWidth,y+charHeight);this._texRect=new C3.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._spriteFont=null;this._pxRect=null;this._texRect=null}_UpdateTexRect(){let w=this._spriteFont.GetWidth();let h=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect); +this._texRect.divide(w,h);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(w){this._displayWidth=w}GetDisplayWidth(){if(this._displayWidth<0)return this._spriteFont.GetCharacterWidth();else return this._displayWidth}}; + +} + +{ +'use strict';const C3=self.C3;const tmpRect=new C3.Rect;const tmpQuad=new C3.Quad;const tmpColor=new C3.Color;const VALID_HORIZ_ALIGNMENTS=new Set(["left","center","right"]);const VALID_VERT_ALIGNMENTS=new Set(["top","center","bottom"]);const VALID_WORD_WRAP_MODES=new Set(["word","character"]);function getOffsetParam(paramStr,fragHeight){paramStr=paramStr.trim();const param=parseFloat(paramStr);if(!isFinite(param))return 0;if(paramStr.endsWith("%"))return fragHeight*param/100;else return param} +self.SpriteFontText=class SpriteFontText{constructor(spriteFont){this._spriteFont=spriteFont;this._cssWidth=0;this._cssHeight=0;this._text="";this._isBBcodeEnabled=false;this._bbString=null;this._wrappedText=C3.New(C3.WordWrap);this._wrapMode="word";this._wrapChanged=false;this._horizontalAlign="left";this._verticalAlign="top";this._scale=1;this._sceneGraphScale=1;this._spacing=0;this._lineHeight=0;this._color=C3.New(C3.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback= +frag=>this._MeasureText(frag);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._color=null;this._measureTextCallback=null;this._wrappedText.Clear();this._wrappedText=null;this._spriteFont=null;this._bbString=null}_MeasureText(frag){if(frag.IsIcon())return{width:0,height:0};const chArr=frag.GetCharacterArray();const scaleStyle=frag.GetStyleTag("scale");const scale=(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle= +frag.GetStyleTag("scalex");const scaleX=(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=frag.GetStyleTag("scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const lineTotalHeight=this._spriteFont.GetCharacterHeight()*scaleY+this._lineHeight;const spriteFont=this.GetSpriteFont();const defaultCharWidth=spriteFont.GetCharacterWidth()*scaleX;const spacing=this.GetSpacing();if(spriteFont.HasAnyCustomWidths()){let strLen=0;let totalWidth=0;for(const ch of chArr){let charWidth= +defaultCharWidth;const sfc=spriteFont.GetCharacter(ch);if(sfc)charWidth=sfc.GetDisplayWidth()*scaleX;else if(ch===" ")charWidth=spriteFont.GetSpaceWidth()*scaleX;totalWidth+=charWidth;++strLen}return{width:totalWidth+strLen*spacing,height:lineTotalHeight}}else{const strLen=chArr.length;const spaceCount=Math.max(strLen,0);return{width:defaultCharWidth*strLen+spaceCount*spacing,height:lineTotalHeight}}}_SetWrapChanged(){this._wrapChanged=true;this._wrappedText.Clear()}SetSize(cssWidth,cssHeight){if(cssWidth<= +0||cssHeight<=0)return;if(this._cssWidth===cssWidth&&this._cssHeight===cssHeight)return;if(this._cssWidth!==cssWidth)this._SetWrapChanged();this._cssWidth=cssWidth;this._cssHeight=cssHeight}SetDrawMaxCharacterCount(n){this._drawMaxCharCount=Math.floor(n)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}HitTestFragment(x,y){const lines=this._wrappedText.GetLines();for(const line of lines)if(y>line.GetPosY()&&y=frag.GetPosX()&& +xa+v.GetHeight(),0)-lineSpaceHeight;if(this._verticalAlign==="center")penY=Math.max(Math.floor(this._cssHeight/2-linesTotalHeight/2),0);else if(this._verticalAlign==="bottom")penY=Math.floor(this._cssHeight-linesTotalHeight);for(let i=0,len=lines.length;i0&&penY>this._cssHeight-(curLineTextHeight- +lineSpaceHeight))break;if(penY>=0)this._DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a);penY+=curLineTextHeight}}_DrawLine(renderer,line,offX,offY,penY,sin_a,cos_a){const lineHeight=line.GetHeight();let penX=0;if(this._horizontalAlign==="center")penX=Math.max(Math.floor((this._cssWidth-line.GetWidth())/2),0);else if(this._horizontalAlign==="right")penX=Math.max(Math.floor(this._cssWidth-line.GetWidth()),0);line.SetPosX(penX);line.SetPosY(penY);for(const frag of line.fragments()){if(frag.IsIcon())continue; +this._DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight);penX+=frag.GetWidth()}}_DrawFragment(renderer,frag,offX,offY,penX,penY,sin_a,cos_a,lineHeight){if(frag.IsIcon())return;const offsetXStyle=frag.GetStyleTag("offsetx");penX+=offsetXStyle?getOffsetParam(offsetXStyle.param,frag.GetHeight()):0;const offsetYStyle=frag.GetStyleTag("offsety");penY+=offsetYStyle?getOffsetParam(offsetYStyle.param,frag.GetHeight()):0;frag.SetPosX(penX);frag.SetPosY(penY);let chArr=frag.GetCharacterArray(); +let fragWidth=frag.GetWidth();if(this._drawMaxCharCount!==-1){if(this._drawCharCount>=this._drawMaxCharCount)return;if(this._drawCharCount+chArr.length>this._drawMaxCharCount){chArr=chArr.slice(0,this._drawMaxCharCount-this._drawCharCount);fragWidth=this._MeasureText(frag).width}this._drawCharCount+=chArr.length}const backgroundStyle=frag.GetStyleTag("background");if(C3.IsCharArrayAllWhitespace(chArr)&&!backgroundStyle||frag.HasStyleTag("hide"))return;const scaleStyle=frag.GetStyleTag("scale");const scale= +(scaleStyle?parseFloat(scaleStyle.param):this._scale)*this._sceneGraphScale;const scaleXStyle=frag.GetStyleTag("scalex");const scaleX=(scaleXStyle?parseFloat(scaleXStyle.param):1)*scale;const scaleYStyle=frag.GetStyleTag("scaley");const scaleY=(scaleYStyle?parseFloat(scaleYStyle.param):1)*scale;const charHeight=this._spriteFont.GetCharacterHeight()*scaleY;const lineSpaceHeight=this._lineHeight;penY+=lineHeight-lineSpaceHeight-charHeight;if(backgroundStyle){renderer.SetColorFillMode();tmpColor.parseString(backgroundStyle.param); +tmpColor.setA(1);renderer.SetColor(tmpColor);tmpRect.set(penX,penY,penX+fragWidth,penY+charHeight);if(tmpRect.getRight()>this._cssWidth)tmpRect.setRight(this._cssWidth);tmpQuad.setFromRotatedRectPrecalc(tmpRect,sin_a,cos_a);tmpQuad.offset(offX,offY);renderer.Quad(tmpQuad);renderer.SetTextureFillMode()}const colorStyle=frag.GetStyleTag("color");if(colorStyle){tmpColor.parseString(colorStyle.param);tmpColor.setA(this._color.getA())}else tmpColor.copy(this._color);const opacityStyle=frag.GetStyleTag("opacity"); +if(opacityStyle)tmpColor.setA(tmpColor.getA()*parseFloat(opacityStyle.param)/100);tmpColor.premultiply();renderer.SetColor(tmpColor);const drawCharWidth=this._spriteFont.GetCharacterWidth()*scaleX;const endOfLineMargin=Math.abs(this.GetSpacing());for(const ch of chArr){const sfc=this._spriteFont.GetCharacter(ch);if(sfc){const layoutCharWidth=sfc.GetDisplayWidth()*scaleX;if(penX+layoutCharWidth>this._cssWidth+endOfLineMargin+1E-5)return;tmpRect.set(penX,penY,penX+drawCharWidth,penY+charHeight);tmpQuad.setFromRotatedRectPrecalc(tmpRect, +sin_a,cos_a);tmpQuad.offset(offX,offY);renderer.Quad3(tmpQuad,sfc.GetTexRect());penX+=layoutCharWidth+this._spacing}else penX+=this._spriteFont.GetSpaceWidth()*scaleX+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(e){e=!!e;if(this._isBBcodeEnabled===e)return;this._isBBcodeEnabled=e;this._SetWrapChanged()}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(text){if(this._text===text)return;this._text=text;this._SetWrapChanged()}SetWordWrapMode(w){if(!VALID_WORD_WRAP_MODES.has(w))throw new Error("invalid word wrap mode"); +if(this._wrapMode===w)return;this._wrapMode=w;this._SetWrapChanged()}SetHorizontalAlign(a){if(!VALID_HORIZ_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._horizontalAlign=a}SetVerticalAlign(a){if(!VALID_VERT_ALIGNMENTS.has(a))throw new Error("invalid alignment");this._verticalAlign=a}SetScale(s){if(this._scale===s)return;this._scale=s;this._SetWrapChanged()}GetScale(){return this._scale}SetSceneGraphScale(s){if(this._sceneGraphScale===s)return;this._sceneGraphScale=s;this._SetWrapChanged()}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(s){if(this._spacing=== +s)return;this._spacing=s;this._SetWrapChanged()}GetSpacing(){return this._spacing}SetLineHeight(h){this._lineHeight=h;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(o){o=C3.clamp(o,0,1);this._color.a=o}SetColor(c){if(this._color.equals(c))return;this._color.copy(c)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const lineTextHeight=this._spriteFont.GetCharacterHeight()*this._scale; +const lineSpaceHeight=this._lineHeight;const lineTotalHeight=lineTextHeight+lineSpaceHeight;return this._wrappedText.GetLineCount()*lineTotalHeight-lineSpaceHeight}}; + +} + +{ +'use strict';const C3=self.C3;const SpriteFontText=self.SpriteFontText;const DEFAULT_SPRITEFONT_OPTS={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""}; +self.SpriteFont=class SpriteFont{constructor(opts){opts=Object.assign({},DEFAULT_SPRITEFONT_OPTS,opts);if(opts.width<=0||opts.height<=0||opts.characterWidth<=0||opts.characterHeight<=0)throw new Error("invalid size");this._width=opts.width;this._height=opts.height;this._characterWidth=opts.characterWidth;this._characterHeight=opts.characterHeight;this._characterSet=opts.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=false;this._spaceWidth=-1;this._texRect=new C3.Rect(0, +0,1,1);this._characterMap=new Map;this._mapChanged=true;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;if(this._allTexts)this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let c of this._characterMap.values())c.Release();this._characterMap.clear()}_AddSpriteFontText(sft){this._allTexts.add(sft)}_RemoveSpriteFontText(sft){this._allTexts.delete(sft)}UpdateCharacterMap(){if(!this._mapChanged)return;this._ReleaseCharacters();let charSetArr= +C3.SplitGraphemes(this._characterSet);let cols=Math.floor(this._width/this._characterWidth);let rows=Math.floor(this._height/this._characterHeight);let last=cols*rows;for(let i=0,len=charSetArr.length;i=last)break;let char=charSetArr[i];if(this._characterMap.has(char))continue;let x=i%cols;let y=Math.floor(i/cols);this._characterMap.set(char,C3.New(self.SpriteFontCharacter,this,char,x*this._characterWidth,y*this._characterHeight))}this._hasAnyCustomWidths=false;this._spaceWidth=-1; +if(Array.isArray(this._spacingParsed))for(let entry of this._spacingParsed){if(!Array.isArray(entry))continue;if(entry.length!==2)continue;let charWidth=entry[0];let str=entry[1];if(typeof charWidth!=="number"||!isFinite(charWidth)||typeof str!=="string")continue;if(charWidth===this._characterWidth)continue;for(let ch of str){let sfc=this._characterMap.get(ch);if(sfc){sfc.SetDisplayWidth(charWidth);this._hasAnyCustomWidths=true}else if(ch===" "){this._spaceWidth=charWidth;this._hasAnyCustomWidths= +true}}}this._mapChanged=false;for(let sft of this._allTexts)sft._SetWrapChanged()}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=true;for(const sft of this._allTexts)sft._SetWrapChanged()}GetCharacter(ch){this.UpdateCharacterMap();return this._characterMap.get(ch)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._width===w)return;this._width=w;this._mapChanged=true}GetWidth(){return this._width}SetHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._height===h)return;this._height=h;this._mapChanged=true}GetHeight(){return this._height}SetTexRect(rc){if(this._texRect.equals(rc))return;this._texRect.copy(rc);for(const sfc of this._characterMap.values())sfc._UpdateTexRect()}GetTexRect(){return this._texRect}SetCharacterWidth(w){w=Math.floor(w);if(w<=0)throw new Error("invalid size");if(this._characterWidth===w)return;this._characterWidth=w;this._mapChanged=true}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(h){h= +Math.floor(h);if(h<=0)throw new Error("invalid size");if(this._characterHeight===h)return;this._characterHeight=h;this._mapChanged=true}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(s){if(this._characterSet===s)return;this._characterSet=s;this._mapChanged=true}GetCharacterSet(){return this._characterSet}SetSpacingData(s){if(this._spacingData===s)return;this._spacingData=s;this._mapChanged=true;this._spacingParsed=null;if(this._spacingData.length)try{this._spacingParsed=JSON.parse(this._spacingData)}catch(e){this._spacingParsed= +null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(w){if(w<0)w=-1;if(this._spaceWidth===w)return;this._spaceWidth=w;if(this._spaceWidth>=0)this._hasAnyCustomWidths=true}GetSpaceWidth(){if(this._spaceWidth<0)return this._characterWidth;else return this._spaceWidth}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.DrawingCanvas=class DrawingCanvasPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.DrawingCanvas.Type=class DrawingCanvasType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const RESOLUTION_MODE=0;const INITIALLY_VISIBLE=1;const ORIGIN=2;const MULTISAMPLING=3;const tempColor=C3.New(C3.Color);const tempColor2=C3.New(C3.Color);const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);function ClonePolyArray(arr){return arr.map(p=>p.slice(0))}function SortByInstanceZIndex(a,b){return a.GetWorldInfo().GetZIndex()-b.GetWorldInfo().GetZIndex()}let drawDepth=0;C3.Plugins.DrawingCanvas.Instance=class DrawingCanvasInstance extends C3.SDKWorldInstanceBase{constructor(inst, +properties){super(inst);this._renderTarget=null;this._rcTex=C3.New(C3.Rect);const wi=this.GetWorldInfo();this._isFixedResolution=false;this._fixedResolutionWidth=Math.floor(wi.GetWidth());this._fixedResolutionHeight=Math.floor(wi.GetHeight());this._multisampling=0;this._texRenderTarget=null;this._drawCommands=[];this._currentPoly=[];this._drawBlendMode=0;this._drawScale=1;this._texScale=1;this._lineDashTexture=null;this._savedImageUrl="";this._snapshot=null;this._tempRect=C3.New(C3.Rect);this._deviceQuadUnrotated= +C3.New(C3.Quad);this._deviceQuadRotated=C3.New(C3.Quad);if(properties){this._isFixedResolution=properties[RESOLUTION_MODE]===1;wi.SetVisible(!!properties[INITIALLY_VISIBLE]);this._multisampling=[0,2,4,8][properties[MULTISAMPLING]]}const renderer=this._runtime.GetRenderer();this._SetDrawingBlendMode(0);if(renderer.IsWebGL()&&renderer.GetWebGLVersionNumber()<2)this._multisampling=0;this._StartTicking2()}Release(){if(this._renderTarget){this._renderTarget.GetRenderer().DeleteRenderTarget(this._renderTarget); +this._renderTarget=null}if(this._texRenderTarget){this._texRenderTarget.GetRenderer().DeleteRenderTarget(this._texRenderTarget);this._texRenderTarget=null}C3.clearArray(this._drawCommands);super.Release()}IsFixedResolutionMode(){return this._isFixedResolution}_GetLineDashTexture(){this._MaybeCreateLineDashTexture();return this._lineDashTexture}_MaybeCreateLineDashTexture(){if(this._lineDashTexture)return;const canvas=C3.CreateCanvas(512,8);const ctx=canvas.getContext("2d");ctx.clearRect(0,0,512,8); +ctx.fillStyle="white";ctx.fillRect(0,0,256,8);this._lineDashTexture=this._runtime.GetRenderer().CreateStaticTexture(canvas,{wrapX:"repeat",sampling:this._runtime.GetSampling()})}_SetDrawingBlendMode(bm){this._drawBlendMode=bm}_ApplyCurrentDrawingBlendMode(renderer){renderer.SetBlendMode(this._drawBlendMode)}_AddDrawCommand(cmd){this._drawCommands.push(cmd);this._runtime.UpdateRender()}_SetFixedResolutionMode(fixedWidth,fixedHeight){this._isFixedResolution=true;this._fixedResolutionWidth=Math.floor(fixedWidth); +this._fixedResolutionHeight=Math.floor(fixedHeight)}_SetAutoResolutionMode(){this._isFixedResolution=false}_ClearCanvas(color){C3.clearArray(this._drawCommands);this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.ClearCanvas(color))}_ClearRect(left,top,right,bottom,color){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.ClearRect(left,top,right,bottom,color))}_FillRect(left,top,right,bottom,color){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillRect(left, +top,right,bottom,color))}_FillLinearGradient(left,top,right,bottom,color1,color2,dir){if(left===right||top===bottom)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillLinearGradient(left,top,right,bottom,color1,color2,dir))}_FillEllipse(x,y,radiusX,radiusY,color,isSmooth){if(radiusX<=0||radiusY<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillEllipse(x,y,radiusX,radiusY,color,isSmooth))}_OutlineEllipse(x,y,radiusX,radiusY,color,thickness,isSmooth){if(radiusX<= +0||radiusY<=0||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.OutlineEllipse(x,y,radiusX,radiusY,color,thickness,isSmooth))}_OutlineRect(left,top,right,bottom,color,thickness){if(left===right||top===bottom||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.OutlineRect(left,top,right,bottom,color,thickness))}_Line(x1,y1,x2,y2,color,thickness,capStr){if(x1===x2&&y1===y2||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.Line(x1, +y1,x2,y2,color,thickness,capStr))}_LineDashed(x1,y1,x2,y2,color,thickness,dashLength,capStr){if(x1===x2&&y1===y2||thickness<=0||dashLength<=0)return;const dashTex=this._GetLineDashTexture();this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LineDashed(x1,y1,x2,y2,color,thickness,dashLength,dashTex,capStr))}_LinePoly(polyArr,color,thickness,capStr){if(polyArr.length<2||thickness<=0)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LinePoly(ClonePolyArray(polyArr),color, +thickness,capStr))}_LineDashedPoly(polyArr,color,thickness,dashLength,capStr){if(polyArr.length<2||thickness<=0||dashLength<=0)return;const dashTex=this._GetLineDashTexture();this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.LineDashedPoly(ClonePolyArray(polyArr),color,thickness,dashLength,dashTex,capStr))}_FillPoly(polyArr,color){if(polyArr.length<3)return;this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.FillPoly(ClonePolyArray(polyArr),color))}_SetDrawBlend(blendMode){this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SetDrawBlend(blendMode))}_PasteInstances(instanceArr, +includeFx){const myWi=this.GetWorldInfo();const myBbox=myWi.GetBoundingBox();const myQuad=myWi.GetBoundingQuad();const instances=instanceArr.filter(inst=>{const instWi=inst.GetWorldInfo();return instWi&&myBbox.intersectsRect(instWi.GetBoundingBox())&&(myWi.GetAngle()===0||myQuad.intersectsQuad(instWi.GetBoundingQuad()))});if(instances.length===0)return;instances.sort(SortByInstanceZIndex);let resolve=null;const ret=new Promise(r=>resolve=r);this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.DrawInstances(instances, +includeFx,myWi,resolve));return ret}_GetPixelScale(){return 1/(this._drawScale*this._texScale)}_UpdateRenderTargetSize(renderer,rtWidth,rtHeight){if(this._renderTarget)renderer.DeleteRenderTarget(this._renderTarget);this._renderTarget=renderer.CreateRenderTarget({width:rtWidth,height:rtHeight,sampling:this._runtime.GetSampling(),isSampled:this._multisampling===0,canReadPixels:this._multisampling===0,canUpdate:this._multisampling===0,multisampling:this._multisampling});if(this._multisampling>0){if(this._texRenderTarget)renderer.DeleteRenderTarget(this._texRenderTarget); +this._texRenderTarget=renderer.CreateRenderTarget({width:rtWidth,height:rtHeight,sampling:this._runtime.GetSampling(),isSampled:true,canReadPixels:true,canUpdate:true})}renderer.SetTexture(null)}_GetRenderTarget(){return this._renderTarget}_GetTexRenderTarget(){return this._texRenderTarget}GetMultisampling(){return this._multisampling}_SetRenderTargetDeviceTransform(renderer){this._runtime.GetCanvasManager().SetDeviceTransform(renderer,this._renderTarget.GetWidth(),this._renderTarget.GetHeight(), +false)}HasAnyDrawingCommandInQueue(){return this._drawCommands.some(c=>!(c instanceof C3.Plugins.DrawingCanvas.DrawCommand.SaveImage))}_CalculateUnrotatedDeviceCoords(outRect,outQuad){const wi=this.GetWorldInfo();const layer=wi.GetLayer();const layout=layer.GetLayout();const angle=wi.GetAngle();const layerAngle=layer.GetOwnAngle();const layoutAngle=layout.GetAngle();if(angle!==0||layerAngle!==0||layoutAngle!==0){layout.SetAngle(0);layer.SetAngle(0);wi.SetAngle(0);wi.SetBboxChanged()}const quad=wi.GetBoundingQuad(); +const [dl,dt]=layer.LayerToDrawSurface(quad.getTlx(),quad.getTly());const [dr,db]=layer.LayerToDrawSurface(quad.getBrx(),quad.getBry());const offX=dl-Math.round(dl);const offY=dt-Math.round(dt);outRect.set(dl,dt,dr,db);outRect.offset(-offX,-offY);outRect.normalize();outQuad.setFromRect(outRect);if(angle!==0||layerAngle!==0||layoutAngle!==0){layout.SetAngle(layoutAngle);layer.SetAngle(layerAngle);wi.SetAngle(angle);wi.SetBboxChanged()}}_CalculateRotatedDeviceCoords(outQuad){const wi=this.GetWorldInfo(); +const layer=wi.GetLayer();const layout=layer.GetLayout();const layerAngle=layer.GetOwnAngle();const layoutAngle=layout.GetAngle();if(layerAngle!==0||layoutAngle!==0){layout.SetAngle(0);layer.SetAngle(0)}const quad=wi.GetBoundingQuad();const [dtlx,dtly]=layer.LayerToDrawSurface(quad.getTlx(),quad.getTly());const [dtrx,dtry]=layer.LayerToDrawSurface(quad.getTrx(),quad.getTry());const [dbrx,dbry]=layer.LayerToDrawSurface(quad.getBrx(),quad.getBry());const [dblx,dbly]=layer.LayerToDrawSurface(quad.getBlx(), +quad.getBly());const offX=dtlx-Math.round(dtlx);const offY=dtly-Math.round(dtly);outQuad.set(dtlx,dtly,dtrx,dtry,dbrx,dbry,dblx,dbly);outQuad.offset(offX,offY);if(layerAngle!==0||layoutAngle!==0){layout.SetAngle(layoutAngle);layer.SetAngle(layerAngle)}}_CalculateSurfaceDeviceSize(){const renderer=this._runtime.GetRenderer();const tempRect=this._tempRect;this._CalculateUnrotatedDeviceCoords(tempRect,this._deviceQuadUnrotated);this._CalculateRotatedDeviceCoords(this._deviceQuadRotated);let rtWidth= +0;let rtHeight=0;if(this._isFixedResolution){rtWidth=this._fixedResolutionWidth;rtHeight=this._fixedResolutionHeight;if(renderer.IsWebGL())this._rcTex.set(0,1,1,0);else this._rcTex.set(0,0,1,1)}else{const EPSILON=.001;rtWidth=Math.ceil(tempRect.width()+EPSILON);rtHeight=Math.ceil(tempRect.height()+EPSILON);if(renderer.IsWebGL())this._rcTex.set(0,1,tempRect.width()/rtWidth,1-tempRect.height()/rtHeight);else this._rcTex.set(0,0,tempRect.width()/rtWidth,tempRect.height()/rtHeight)}const maxTextureSize= +renderer.GetMaxTextureSize();const maxRtDim=Math.max(rtWidth,rtHeight);if(maxRtDim>maxTextureSize){this._texScale=maxTextureSize/maxRtDim;rtWidth=Math.round(rtWidth*this._texScale);rtHeight=Math.round(rtHeight*this._texScale)}else this._texScale=1;return[rtWidth,rtHeight]}_OnResolutionChanged(){this.DispatchScriptEvent("resolutionchange");this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnResolutionChanged)}_MaybeCreateRenderTarget(){if(this._renderTarget)return;const [rtWidth,rtHeight]=this._CalculateSurfaceDeviceSize(); +if(rtWidth<=0||rtHeight<=0)return;this._drawScale=tempRect.width()/this.GetWorldInfo().GetWidth();this._UpdateRenderTargetSize(this._runtime.GetRenderer(),rtWidth,rtHeight);this._OnResolutionChanged()}Tick2(){const renderer=this._runtime.GetRenderer();const wi=this.GetWorldInfo();const tempRect=this._tempRect;++drawDepth;const [rtWidth,rtHeight]=this._CalculateSurfaceDeviceSize();if(rtWidth<=0||rtHeight<=0){--drawDepth;return}this._drawScale=this._isFixedResolution?1:tempRect.width()/wi.GetWidth(); +const drawScale=this._drawScale*this._texScale;const didRenderTargetChange=!this._renderTarget||this._renderTarget.GetWidth()!==rtWidth||this._renderTarget.GetHeight()!==rtHeight;if(didRenderTargetChange)this._OnResolutionChanged();if(this._drawCommands.length>0||!this._renderTarget){if(!this._renderTarget||didRenderTargetChange&&this.HasAnyDrawingCommandInQueue())this._UpdateRenderTargetSize(renderer,rtWidth,rtHeight);renderer.SetRenderTarget(this._renderTarget);this._SetRenderTargetDeviceTransform(renderer); +this._ApplyCurrentDrawingBlendMode(renderer);if(renderer.IsWebGPU()&&this._multisampling>0)renderer.SetRenderingToMultisampleCount(this._multisampling);for(const dc of this._drawCommands)dc.Do(renderer,drawScale,this);C3.clearArray(this._drawCommands);renderer.SetAlphaBlend();if(renderer.IsWebGPU()&&this._multisampling>0)renderer.SetRenderingToMultisampleCount(0);if(this._multisampling>0){renderer.SetRenderTarget(this._texRenderTarget);renderer.CopyRenderTarget(this._renderTarget,"crop")}}--drawDepth}Draw(renderer){const wi= +this.GetWorldInfo();const layer=wi.GetLayer();const canvasManager=this._runtime.GetCanvasManager();const lastRenderTarget=renderer.GetRenderTarget();let quad=this._deviceQuadUnrotated;if(!this._renderTarget)return;if(renderer.IsWebGPU())renderer._MaybeDoPendingClearRenderPass(this._renderTarget);if(this._multisampling===0)renderer.SetTexture(this._renderTarget.GetTexture());else renderer.SetTexture(this._texRenderTarget.GetTexture());let didChangeTransform=false;if(drawDepth>0)if(this._inst._IsDrawingWithEffects())quad= +wi.GetBoundingQuad();else{canvasManager.SetDeviceTransform(renderer,lastRenderTarget.GetWidth(),lastRenderTarget.GetHeight(),false);didChangeTransform=true;quad=this._deviceQuadRotated}else if(wi.GetAngle()===0&&layer.GetAngle()===0&&!wi.HasMesh()&&layer.RendersIn2DMode()){canvasManager.SetDeviceTransform(renderer);didChangeTransform=true}else quad=wi.GetBoundingQuad();if(wi.HasMesh())this._DrawMesh(renderer,wi);else renderer.Quad3(quad,this._rcTex);if(didChangeTransform)layer._SetTransform(renderer, +false);renderer.SetTexture(null)}_DrawMesh(renderer,wi){const transformedMesh=wi.GetTransformedMesh();if(wi.IsMeshChanged()){wi.CalculateBbox(tempRect,tempQuad,false);transformedMesh.CalculateTransformedMesh(wi.GetSourceMesh(),tempQuad,this._rcTex);wi.SetMeshChanged(false)}transformedMesh.Draw(renderer)}GetSnapshotPixel(x,y){if(!this._snapshot)return[0,0,0,0];const width=this._snapshot.width;const height=this._snapshot.height;x=Math.floor(x);if(this._runtime.GetRenderer().IsWebGL())y=height-1-Math.floor(y); +else y=Math.floor(y);if(x<0||y<0||x>=width||y>=height)return[0,0,0,0];const data=this._snapshot.data;const ptr=y*width*4+x*4;let r=data[ptr]/255;let g=data[ptr+1]/255;let b=data[ptr+2]/255;let a=data[ptr+3]/255;if(a!==0){r/=a;g/=a;b/=a}return[r*100,g*100,b*100,a*100]}SetSnapshotPixel(x,y,rgb){if(!this._snapshot)return[0,0,0,0];tempColor.setFromRgbValue(rgb);tempColor.premultiply();const width=this._snapshot.width;const height=this._snapshot.height;x=Math.floor(x);y=height-1-Math.floor(y);if(x<0|| +y<0||x>=width||y>=height)return;const data=this._snapshot.data;const ptr=y*width*4+x*4;data[ptr]=Math.floor(tempColor.getR()*255);data[ptr+1]=Math.floor(tempColor.getG()*255);data[ptr+2]=Math.floor(tempColor.getB()*255);data[ptr+3]=Math.floor(tempColor.getA()*255)}GetImagePixelData(){return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(async imageData=>{const imgDataBuffer=imageData.data.buffer;const width=imageData.width;const height=imageData.height; +const processedBuffer=await this._runtime.AddJob("ProcessImageData",{"buffer":imgDataBuffer,"width":width,"height":height,"unpremultiply":true,"flipY":true},[imgDataBuffer]);resolve(new ImageData(new Uint8ClampedArray(processedBuffer),width,height))}))})}LoadImagePixelData(imageData,premultiplyAlpha,flipY){this._MaybeCreateRenderTarget();if(!this._renderTarget)throw new Error("invalid canvas size");if(imageData.width!==this._renderTarget.GetWidth()||imageData.height!==this._renderTarget.GetHeight())throw new Error(`wrong size ImageData: expected ${this._renderTarget.GetWidth()} x ${this._renderTarget.GetHeight()}, got ${imageData.width} x ${imageData.height}`); +C3.clearArray(this._drawCommands);const renderer=this._runtime.GetRenderer();if(this._texRenderTarget){const lastRenderTarget=renderer.GetRenderTarget();const texture=this._texRenderTarget.GetTexture();renderer.UpdateTexture(imageData,texture,{premultiplyAlpha:!!premultiplyAlpha,flipY:!!flipY});renderer.SetRenderTarget(this._renderTarget);renderer.CopyRenderTarget(this._texRenderTarget,"crop");renderer.SetRenderTarget(lastRenderTarget)}else{const texture=this._renderTarget.GetTexture();renderer.UpdateTexture(imageData, +texture,{premultiplyAlpha:!!premultiplyAlpha,flipY:!!flipY})}this._runtime.UpdateRender()}GetScriptInterfaceClass(){return self.IDrawingCanvasInstance}};const map=new WeakMap;function arrToColor(arr){tempColor.setFromJSON(arr);return tempColor}function arrToColor2(arr){tempColor2.setFromJSON(arr);return tempColor2}const VALID_GRADIENT_DIRECTIONS=["horizontal","vertical"];const VALID_LINE_CAPS=new Set(["butt","square"]);function ValidateLineCap(capStr){if(!VALID_LINE_CAPS.has(capStr))throw new Error("invalid line cap"); +}function ValidatePoly(polyArr){C3X.RequireArray(polyArr);for(const p of polyArr){C3X.RequireArray(p);C3X.RequireFiniteNumber(p[0]);C3X.RequireFiniteNumber(p[1])}}const BLEND_MODE_TO_INDEX=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]);self.IDrawingCanvasInstance=class IDrawingCanvasInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}setFixedResolutionMode(fixedWidth, +fixedHeight){C3X.RequireFiniteNumber(fixedWidth);C3X.RequireFiniteNumber(fixedHeight);map.get(this)._SetFixedResolutionMode(fixedWidth,fixedHeight)}setAutoResolutionMode(){map.get(this)._SetAutoResolutionMode()}clearCanvas(rgbArr){C3X.RequireArray(rgbArr);map.get(this)._ClearCanvas(arrToColor(rgbArr))}clearRect(left,top,right,bottom,rgbArr){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr);map.get(this)._ClearRect(left, +top,right,bottom,arrToColor(rgbArr))}fillRect(left,top,right,bottom,rgbArr){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr);map.get(this)._FillRect(left,top,right,bottom,arrToColor(rgbArr))}fillLinearGradient(left,top,right,bottom,rgbArr1,rgbArr2,dirStr="horizontal"){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr1); +C3X.RequireArray(rgbArr2);const dir=VALID_GRADIENT_DIRECTIONS.indexOf(dirStr);if(dir<0)throw new Error("invalid gradient direction");map.get(this)._FillLinearGradient(left,top,right,bottom,arrToColor(rgbArr1),arrToColor2(rgbArr2),dir)}fillEllipse(x,y,radiusX,radiusY,rgbArr,isSmooth=true){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);C3X.RequireFiniteNumber(radiusX);C3X.RequireFiniteNumber(radiusY);C3X.RequireArray(rgbArr);map.get(this)._FillEllipse(x,y,radiusX,radiusY,arrToColor(rgbArr),!!isSmooth)}outlineEllipse(x, +y,radiusX,radiusY,rgbArr,thickness,isSmooth=true){C3X.RequireFiniteNumber(x);C3X.RequireFiniteNumber(y);C3X.RequireFiniteNumber(radiusX);C3X.RequireFiniteNumber(radiusY);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);map.get(this)._OutlineEllipse(x,y,radiusX,radiusY,arrToColor(rgbArr),thickness,!!isSmooth)}outlineRect(left,top,right,bottom,rgbArr,thickness){C3X.RequireFiniteNumber(left);C3X.RequireFiniteNumber(top);C3X.RequireFiniteNumber(right);C3X.RequireFiniteNumber(bottom);C3X.RequireArray(rgbArr); +C3X.RequireFiniteNumber(thickness);map.get(this)._OutlineRect(left,top,right,bottom,arrToColor(rgbArr),thickness)}line(x1,y1,x2,y2,rgbArr,thickness,capStr="butt"){C3X.RequireFiniteNumber(x1);C3X.RequireFiniteNumber(y1);C3X.RequireFiniteNumber(x2);C3X.RequireFiniteNumber(y2);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);ValidateLineCap(capStr);map.get(this)._Line(x1,y1,x2,y2,arrToColor(rgbArr),thickness,capStr)}lineDashed(x1,y1,x2,y2,rgbArr,thickness,dashLength,capStr="butt"){C3X.RequireFiniteNumber(x1); +C3X.RequireFiniteNumber(y1);C3X.RequireFiniteNumber(x2);C3X.RequireFiniteNumber(y2);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);C3X.RequireFiniteNumber(dashLength);ValidateLineCap(capStr);map.get(this)._LineDashed(x1,y1,x2,y2,arrToColor(rgbArr),thickness,dashLength,capStr)}linePoly(polyArr,rgbArr,thickness,capStr="butt"){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);ValidateLineCap(capStr);map.get(this)._LinePoly(polyArr,arrToColor(rgbArr),thickness, +capStr)}lineDashedPoly(polyArr,rgbArr,thickness,dashLength,capStr="butt"){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);C3X.RequireFiniteNumber(thickness);C3X.RequireFiniteNumber(dashLength);ValidateLineCap(capStr);map.get(this)._LineDashedPoly(polyArr,arrToColor(rgbArr),thickness,dashLength,capStr)}fillPoly(polyArr,rgbArr){ValidatePoly(polyArr);C3X.RequireArray(rgbArr);map.get(this)._FillPoly(polyArr,arrToColor(rgbArr))}setDrawBlend(blendMode){const bmIndex=BLEND_MODE_TO_INDEX.get(blendMode);if(typeof bmIndex!== +"number")throw new Error("invalid blend mode");map.get(this)._SetDrawBlend(bmIndex)}pasteInstances(instanceArr,includeFx=true){C3X.RequireArray(instanceArr);const inst=map.get(this);const runtime=inst.GetRuntime();return inst._PasteInstances(instanceArr.map(i=>runtime._UnwrapIWorldInstance(i)),!!includeFx)}getImagePixelData(){return map.get(this).GetImagePixelData()}loadImagePixelData(imageData,premultiplyAlpha=false){C3X.RequireInstanceOf(imageData,ImageData);map.get(this).LoadImagePixelData(imageData, +premultiplyAlpha,true)}get surfaceDeviceWidth(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget();if(!rt)throw new Error("invalid canvas size");return rt.GetWidth()}get surfaceDeviceHeight(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget();if(!rt)throw new Error("invalid canvas size");return rt.GetHeight()}getSurfaceDeviceSize(){const inst=map.get(this);inst._MaybeCreateRenderTarget();const rt=inst._GetRenderTarget(); +if(!rt)throw new Error("invalid canvas size");return[rt.GetWidth(),rt.GetHeight()]}get pixelScale(){return map.get(this)._GetPixelScale()}}}{const C3=self.C3;C3.Plugins.DrawingCanvas.Cnds={OnSavedImage(){return true},OnSnapshot(){return true},OnResolutionChanged(){return true}}} +{const C3=self.C3;const tempColor1=C3.New(C3.Color);const tempColor2=C3.New(C3.Color);function RgbToColor(rgb){tempColor1.setFromRgbValue(rgb);return tempColor1}function RgbToColor2(rgb){tempColor2.setFromRgbValue(rgb);return tempColor2}C3.Plugins.DrawingCanvas.Acts={SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()},SetResolutionMode(mode,fixedWidth,fixedHeight){if(mode===1)this._SetFixedResolutionMode(fixedWidth,fixedHeight);else this._SetAutoResolutionMode()}, +ClearCanvas(rgb){this._ClearCanvas(RgbToColor(rgb))},ClearRect(left,top,right,bottom,rgb){this._ClearRect(left,top,right,bottom,RgbToColor(rgb))},FillRect(left,top,right,bottom,rgb){this._FillRect(left,top,right,bottom,RgbToColor(rgb))},FillLinearGradient(left,top,right,bottom,rgb1,rgb2,dir){this._FillLinearGradient(left,top,right,bottom,RgbToColor(rgb1),RgbToColor2(rgb2),dir)},FillEllipse(x,y,radiusX,radiusY,rgb,edge){this._FillEllipse(x,y,radiusX,radiusY,RgbToColor(rgb),edge!==0)},OutlineEllipse(x, +y,radiusX,radiusY,rgb,thickness,edge){this._OutlineEllipse(x,y,radiusX,radiusY,RgbToColor(rgb),thickness,edge!==0)},OutlineRect(left,top,right,bottom,rgb,thickness){this._OutlineRect(left,top,right,bottom,RgbToColor(rgb),thickness)},Line(x1,y1,x2,y2,rgb,thickness,cap){const capStr=cap===0?"butt":"square";this._Line(x1,y1,x2,y2,RgbToColor(rgb),thickness,capStr)},LineDashed(x1,y1,x2,y2,rgb,thickness,dashLength,cap){const capStr=cap===0?"butt":"square";this._LineDashed(x1,y1,x2,y2,RgbToColor(rgb),thickness, +dashLength,capStr)},AddPolyPoint(x,y){this._currentPoly.push([x,y])},ResetPoly(){C3.clearArray(this._currentPoly)},LinePoly(rgb,thickness,cap){const capStr=cap===0?"butt":"square";this._LinePoly(this._currentPoly,RgbToColor(rgb),thickness,capStr)},LineDashedPoly(rgb,thickness,dashLength,cap){const capStr=cap===0?"butt":"square";this._LineDashedPoly(this._currentPoly,RgbToColor(rgb),thickness,dashLength,capStr)},FillPoly(rgb){this._FillPoly(this._currentPoly,RgbToColor(rgb))},SetDrawBlend(blendMode){if(blendMode>= +2)blendMode++;this._SetDrawBlend(blendMode)},PasteObject(objectClass,includeFx){if(!objectClass)return;return this._PasteInstances(objectClass.GetCurrentSol().GetInstances(),includeFx!==0)},SaveImage(format,quality,x,y,width,height){const formatStr=format===0?"image/png":"image/jpeg";quality/=100;const areaRect=C3.New(C3.Rect);areaRect.setWH(x,y,width,height);return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(async imageData=>{const imgDataBuffer= +imageData.data.buffer;const width=imageData.width;const height=imageData.height;const needFlipY=this._runtime.GetRenderer().IsWebGL();const processedBuffer=await this._runtime.AddJob("ProcessImageData",{"buffer":imgDataBuffer,"width":width,"height":height,"unpremultiply":true,"flipY":needFlipY&&!C3.Supports.ImageBitmapOptions},[imgDataBuffer]);imageData=new ImageData(new Uint8ClampedArray(processedBuffer),width,height);let blob;if(C3.Supports.ImageBitmapOptions){const imageBitmap=await createImageBitmap(imageData, +{"premultiplyAlpha":"none","imageOrientation":needFlipY?"flipY":"none"});blob=await C3.DrawableToBlob(imageBitmap,formatStr,quality)}else blob=await C3.ImageDataToBlob(imageData,formatStr,quality);if(this._savedImageUrl)URL.revokeObjectURL(this._savedImageUrl);this._savedImageUrl=URL.createObjectURL(blob);this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnSavedImage);resolve()},areaRect))})},SaveSnapshot(){return new Promise(resolve=>{this._AddDrawCommand(new C3.Plugins.DrawingCanvas.DrawCommand.SaveImage(imageData=> +{this._snapshot=imageData;this.Trigger(C3.Plugins.DrawingCanvas.Cnds.OnSnapshot);resolve()}))})},ClearSnapshot(){this._snapshot=null},SnapshotSetPixel(x,y,rgb){this.SetSnapshotPixel(x,y,rgb)},LoadSnapshot(){if(!this._snapshot||!this._renderTarget)return;if(this._snapshot.width!==this._renderTarget.GetWidth()||this._snapshot.height!==this._renderTarget.GetHeight())return;this.LoadImagePixelData(this._snapshot,false)}}} +{const C3=self.C3;C3.Plugins.DrawingCanvas.Exps={SavedImageURL(){return this._savedImageUrl},SnapshotRedAt(x,y){return this.GetSnapshotPixel(x,y)[0]},SnapshotGreenAt(x,y){return this.GetSnapshotPixel(x,y)[1]},SnapshotBlueAt(x,y){return this.GetSnapshotPixel(x,y)[2]},SnapshotAlphaAt(x,y){return this.GetSnapshotPixel(x,y)[3]},SnapshotWidth(){return this._snapshot?this._snapshot.width:0},SnapshotHeight(){return this._snapshot?this._snapshot.height:0},PixelScale(){return this._GetPixelScale()},SurfaceDeviceWidth(){const rt= +this._GetRenderTarget();return rt?rt.GetWidth():0},SurfaceDeviceHeight(){const rt=this._GetRenderTarget();return rt?rt.GetHeight():0}}}; + +} + +{ +'use strict';const C3=self.C3;const tempQuad=C3.New(C3.Quad);const tempUvQuad=C3.New(C3.Quad);const tempVector2=C3.New(C3.Vector2);C3.Plugins.DrawingCanvas.DrawCommand=class DrawCommand{constructor(){}Do(renderer){throw new Error("required override");}};const DrawCommand=C3.Plugins.DrawingCanvas.DrawCommand; +DrawCommand.SaveImage=class SaveImageCommand extends DrawCommand{constructor(callback,areaRect){super();this._callback=callback;this._areaRect=areaRect}Do(renderer,scale,canvasInst){let readRenderTarget=renderer.GetRenderTarget();if(readRenderTarget.GetMultisampling()>=2){const texRenderTarget=canvasInst._GetTexRenderTarget();renderer.SetRenderTarget(texRenderTarget);renderer.CopyRenderTarget(readRenderTarget,"crop");renderer.SetRenderTarget(readRenderTarget);readRenderTarget=texRenderTarget}renderer.ReadBackRenderTargetToImageData(readRenderTarget, +false,this._areaRect).then(this._callback)}};DrawCommand.ClearCanvas=class ClearCanvasCommand extends DrawCommand{constructor(color){super();this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer){renderer.Clear(this._color)}}; +DrawCommand.ClearRect=class ClearRectCommand extends DrawCommand{constructor(left,top,right,bottom,color){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer,scale,canvasInst){this._rect.multiply(scale,scale);renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.SetBlendMode(3);renderer.Rect(this._rect);canvasInst._ApplyCurrentDrawingBlendMode(renderer)}}; +DrawCommand.FillRect=class FillRectCommand extends DrawCommand{constructor(left,top,right,bottom,color){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply()}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);this._rect.multiply(scale,scale);renderer.Rect(this._rect)}}; +DrawCommand.FillLinearGradient=class FillLinearGradientCommand extends DrawCommand{constructor(left,top,right,bottom,color1,color2,dir){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color1=C3.New(C3.Color,color1);this._color2=C3.New(C3.Color,color2);this._dir=dir}Do(renderer,scale){renderer.SetLinearGradientFillMode();renderer.SetColor(this._color1);renderer.SetGradientColor(this._color2);this._rect.multiply(scale,scale);tempQuad.setFromRect(this._rect);if(this._dir=== +0)tempUvQuad.set(0,0,1,0,1,1,0,1);else tempUvQuad.set(0,1,0,0,1,0,1,1);renderer.Quad4(tempQuad,tempUvQuad)}}; +DrawCommand.FillEllipse=class FillEllipseCommand extends DrawCommand{constructor(x,y,radiusX,radiusY,color,isSmooth){super();this._rect=C3.New(C3.Rect);this._rect.set(x-radiusX,y-radiusY,x+radiusX,y+radiusY);this._color=C3.New(C3.Color,color);this._color.premultiply();this._isSmooth=isSmooth}Do(renderer,scale){this._rect.multiply(scale,scale);if(this._isSmooth){renderer.SetSmoothEllipseFillMode();renderer.SetColor(this._color);this._rect.inflate(.5,.5);renderer.SetEllipseParams(1/this._rect.width(), +1/this._rect.height());renderer.Rect(this._rect)}else{renderer.SetHardEllipseFillMode();renderer.SetColor(this._color);renderer.Rect(this._rect)}}}; +DrawCommand.OutlineEllipse=class OutlinellipseCommand extends DrawCommand{constructor(x,y,radiusX,radiusY,color,thickness,isSmooth){super();this._rect=C3.New(C3.Rect);this._rect.set(x-radiusX,y-radiusY,x+radiusX,y+radiusY);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._isSmooth=isSmooth}Do(renderer,scale){this._rect.multiply(scale,scale);if(this._isSmooth){renderer.SetSmoothEllipseOutlineMode();renderer.SetColor(this._color);this._rect.inflate(.5,.5); +renderer.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*scale);renderer.Rect(this._rect)}else{renderer.SetHardEllipseOutlineMode();renderer.SetEllipseParams(1/this._rect.width(),1/this._rect.height(),this._thickness*scale);renderer.SetColor(this._color);renderer.Rect(this._rect)}}}; +DrawCommand.OutlineRect=class OutlineRectCommand extends DrawCommand{constructor(left,top,right,bottom,color,thickness){super();this._rect=C3.New(C3.Rect);this._rect.set(left,top,right,bottom);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCapZag();renderer.PushLineWidth(this._thickness*scale);this._rect.multiply(scale,scale);renderer.LineRect2(this._rect);renderer.PopLineCap(); +renderer.PopLineWidth()}}; +DrawCommand.Line=class LineCommand extends DrawCommand{constructor(x1,y1,x2,y2,color,thickness,cap){super();this._rect=C3.New(C3.Rect);this._rect.set(x1,y1,x2,y2);this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._cap=cap}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCap(this._cap);renderer.PushLineWidth(this._thickness*scale);const rc=this._rect;rc.multiply(scale,scale);renderer.Line(rc.getLeft(),rc.getTop(), +rc.getRight(),rc.getBottom());renderer.PopLineCap();renderer.PopLineWidth()}}; +DrawCommand.LinePoly=class LinePolyCommand extends DrawCommand{constructor(poly,color,thickness,cap){super();this._poly=poly;this._color=C3.New(C3.Color,color);this._color.premultiply();this._thickness=thickness;this._cap=cap}Do(renderer,scale){renderer.SetColorFillMode();renderer.SetColor(this._color);renderer.PushLineCap(this._cap);renderer.PushLineWidth(this._thickness*scale);const poly=this._poly;for(let i=0,len=poly.length;ithis._SaveInstanceState(inst,canvasWi))}_SaveInstanceState(inst,canvasWi){const canvasAngle=canvasWi.GetAngle(); +const canvasLayer=canvasWi.GetLayer();const instWi=inst.GetWorldInfo();const instLayer=instWi.GetLayer();const oldX=instWi.GetX();const oldY=instWi.GetY();const oldWidth=instWi.GetWidth();const oldHeight=instWi.GetHeight();const oldAngle=instWi.GetAngle();if(!this._layerTransforms.has(instLayer))this._layerTransforms.set(instLayer,instLayer.SaveTransform());const areLayerTransformsCompatible=canvasLayer.IsTransformCompatibleWith(instLayer);if(!areLayerTransformsCompatible){const [dsx,dsy]=instLayer.LayerToDrawSurface(oldX, +oldY);const [tx,ty]=canvasLayer.DrawSurfaceToLayer(dsx,dsy);instWi.SetXY(tx,ty);const scaleFactor=instLayer.GetNormalScale()/canvasLayer.GetNormalScale();instWi.SetSize(oldWidth*scaleFactor,oldHeight*scaleFactor);const angleOffset=canvasLayer.GetOwnAngle()-instLayer.GetOwnAngle();instWi.OffsetAngle(angleOffset)}if(canvasAngle!==0){const canvasQuad=canvasWi.GetBoundingQuad();const canvasMidX=canvasQuad.midX();const canvasMidY=canvasQuad.midY();const sinA=-canvasWi.GetSinAngle();const cosA=canvasWi.GetCosAngle(); +tempVector2.set(oldX,oldY);tempVector2.offset(-canvasMidX,-canvasMidY);tempVector2.rotatePrecalc(sinA,cosA);tempVector2.offset(canvasMidX,canvasMidY);instWi.SetXY(tempVector2.getX(),tempVector2.getY());instWi.OffsetAngle(-canvasAngle)}if(canvasAngle!==0||!areLayerTransformsCompatible)instWi.SetBboxChanged();const ret=[inst,inst.SaveToJson("visual-state")];if(canvasAngle!==0||!areLayerTransformsCompatible){instWi.SetXY(oldX,oldY);instWi.SetSize(oldWidth,oldHeight);instWi.SetAngle(oldAngle);instWi.SetBboxChanged()}return ret}Do(renderer, +scale,canvasInst){const canvasManager=canvasInst.GetRuntime().GetCanvasManager();const layer=canvasInst.GetWorldInfo().GetLayer();const layout=layer.GetLayout();const viewport=layer.GetViewport();const canvasBbox=canvasInst.GetWorldInfo().GetBoundingBox();const renderTarget=canvasInst._GetRenderTarget();const isMultisamplng=canvasInst.GetMultisampling()>=2;const includeFx=this._includeFx;const restoreLayoutTransform=layout.SaveTransform();layout.RestoreTransform(this._layoutTransform);const restoreLayerTransforms= +new Map;for(const [layer,transform]of this._layerTransforms){restoreLayerTransforms.set(layer,layer.SaveTransform());layer.RestoreTransform(transform)}canvasManager.SetIsPastingToDrawingCanvas(true);const viewOffX=(viewport.width()-canvasBbox.width())/-2;const viewOffY=(viewport.height()-canvasBbox.height())/-2;const [canvasDeviceLeft,canvasDeviceTop]=layer.LayerToDrawSurface(canvasBbox.getLeft(),canvasBbox.getTop());canvasManager.SetDeviceTransformOffset(canvasDeviceLeft,canvasDeviceTop);const canvasOffX= +canvasBbox.getLeft()-viewport.getLeft();const canvasOffY=canvasBbox.getTop()-viewport.getTop();const offX=viewOffX+canvasOffX;const offY=viewOffY+canvasOffY;const viewH=renderTarget.GetHeight();let effectiveScale=1;if(canvasInst.IsFixedResolutionMode())effectiveScale=renderTarget.GetWidth()/Math.floor(canvasBbox.width())/layer.GetNormalScale();else effectiveScale=canvasManager.GetRenderScale()*self.devicePixelRatio;const effectiveViewH=viewH/effectiveScale;const pxOff=.5/effectiveScale;renderer.SetProjectionMatrix(renderTarget.GetProjectionMatrix()); +layer._SetTransform(renderer,false,offX+pxOff,offY+pxOff,effectiveViewH);for(let i=0,len=this._instances.length;i{layer._SetTransform(renderer);drawContent();effectChain._SetDeviceTransform(renderer)},compositOffX:canvasDeviceLeft,compositOffY:canvasDeviceTop,updateOwnProjection:true};inst._SetIsDrawingWithEffects(true);if(layer._DrawInstanceWithEffects(inst,wi,renderer,renderTarget,opts))layer._SetTransform(renderer,false,offX+pxOff,offY+pxOff,effectiveViewH);inst._SetIsDrawingWithEffects(false)}else layer._DrawInstance(inst,wi,renderer);inst.LoadFromJson(oldState, +"visual-state")}canvasManager.SetDeviceTransformOffset(0,0);canvasManager.SetIsPastingToDrawingCanvas(false);canvasInst._SetRenderTargetDeviceTransform(renderer);canvasInst._ApplyCurrentDrawingBlendMode(renderer);layout.RestoreTransform(restoreLayoutTransform);for(const [layer,transform]of restoreLayerTransforms)layer.RestoreTransform(transform);this._resolve()}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Arr=class ArrayPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Arr.Type=class ArrayType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IInstance=self.IInstance;function ResizeArray(arr,len,data){if(lenarr.length)if(typeof data==="function")for(let i=arr.length;iC3.MakeFilledArray(this._cy,()=>C3.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(x,y,z){x=Math.floor(x);y=Math.floor(y);z=Math.floor(z);if(x>=0&&x=0&&y=0&&z=0&&x=0&&y=0&&zC3.MakeFilledArray(h,()=>C3.MakeFilledArray(d,0)));for(let x=0;xC3.MakeFilledArray(d,0));for(let y=0;y0){const i=Math.floor(this._runtime.Random()*len);--len;if(axis===0){const v1=this.At(len,y,z);const v2=this.At(i,y,z);this.Set(len,y,z,v2);this.Set(i,y,z,v1)}else if(axis===1){const v1=this.At(x,len,z);const v2=this.At(x,i,z);this.Set(x,len,z,v2);this.Set(x,i,z,v1)}else if(axis===2){const v1=this.At(x,y,len);const v2=this.At(x,y,i);this.Set(x,y,len,v2);this.Set(x,y,i,v1)}}}GetDebuggerProperties(){const prefix="plugins.arr.debugger";const propsPrefix="plugins.arr.properties";const ret= +[{title:prefix+".array-properties.title",properties:[{name:propsPrefix+".width.name",value:this._cx,onedit:v=>this.SetSize(v,this._cy,this._cz)},{name:propsPrefix+".height.name",value:this._cy,onedit:v=>this.SetSize(this._cx,v,this._cz)},{name:propsPrefix+".depth.name",value:this._cz,onedit:v=>this.SetSize(this._cx,this._cy,v)},{name:propsPrefix+".elements.name",value:this._cx*this._cy*this._cz}]}];const dataProps=[];if(this._cy===1&&this._cz===1)for(let x=0;xthis._arr[x][0][0]=v});else for(let x=0;x=0&&this._forDepth=0&&this._forDepth=0&&this._forDepthsb)return 1;else return 0}}C3.Plugins.Arr.Acts={Clear(v){const cx=this._cx;const cy=this._cy;const cz=this._cz;const arr=this._arr;for(let x=0;xC3.MakeFilledArray(cz,value));if(where===0)arr.push(add);else arr.unshift(add);this._cx++}else if(axis===1){for(let x=0;xCompareValues(a[0][0],b[0][0]));else if(axis===1)for(let x=0;xCompareValues(a[0],b[0]));else for(let x=0;x=cx)return;arr.splice(index,1);this._cx--}else if(axis===1){if(index>=cy)return;for(let x=0;x=cz)return;for(let x=0;xcx)return;arr.splice(index,0,C3.MakeFilledArray(cy, +()=>C3.MakeFilledArray(cz,value)));this._cx++}else if(axis===1){if(index>cy)return;for(let x=0;xcz)return;for(let x=0;x=0;--x)if(arr[x][0][0]===v)return x;return-1},JoinString(sep){let arr=[];for(let x=0;xthis._OnPointerLockChange(e)],["pointer-lock-error",e=>this._OnPointerLockError(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data)),C3.Disposable.From(rt,"dblclick",e=>this._OnDoubleClick(e.data)),C3.Disposable.From(rt,"wheel",e=>this._OnMouseWheel(e.data)),C3.Disposable.From(rt, +"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(e){if(e["pointerType"]!=="mouse")return;this._mouseXcanvas=e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerMove(e){this._movementX=e["movementX"];this._movementY=e["movementY"];this.Trigger(C3.Plugins.Mouse.Cnds.OnMovement);this._movementX=0;this._movementY=0;if(e["pointerType"]!=="mouse")return; +this._mouseXcanvas=e["pageX"]-this._runtime.GetCanvasClientX();this._mouseYcanvas=e["pageY"]-this._runtime.GetCanvasClientY();this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_OnPointerUp(e){if(e["pointerType"]!=="mouse")return;this._CheckButtonChanges(e["lastButtons"],e["buttons"])}_CheckButtonChanges(lastButtons,buttons){this._CheckButtonChange(lastButtons,buttons,1,0);this._CheckButtonChange(lastButtons,buttons,4,1);this._CheckButtonChange(lastButtons,buttons,2,2)}_CheckButtonChange(lastButtons, +buttons,checkButtonFlag,resultButton){if(!(lastButtons&checkButtonFlag)&&buttons&checkButtonFlag)this._OnMouseDown(resultButton);else if(lastButtons&checkButtonFlag&&!(buttons&checkButtonFlag))this._OnMouseUp(resultButton)}_OnMouseDown(button){this._buttonMap[button]=true;this.Trigger(C3.Plugins.Mouse.Cnds.OnAnyClick);this._triggerButton=button;this._triggerType=0;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(button){if(!this._buttonMap[button])return; +this._buttonMap[button]=false;this._triggerButton=button;this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}_OnDoubleClick(e){this._triggerButton=e["button"];this._triggerType=1;this.Trigger(C3.Plugins.Mouse.Cnds.OnClick);this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(e){this._triggerDir=e["deltaY"]<0?1:0;this._wheelDeltaX=e["deltaX"];this._wheelDeltaY=e["deltaY"];this._wheelDeltaZ=e["deltaZ"];this.Trigger(C3.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let i=0,len=this._buttonMap.length;i< +len;++i){if(!this._buttonMap[i])return;this._buttonMap[i]=false;this._triggerButton=i;this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}}GetMousePositionForLayer(layerNameOrNumber){const layout=this._runtime.GetMainRunningLayout();const x=this._mouseXcanvas;const y=this._mouseYcanvas;if(typeof layerNameOrNumber==="undefined"){const layer=layout.GetLayerByIndex(0);return layer.CanvasCssToLayer_DefaultTransform(x,y)}else{const layer=layout.GetLayer(layerNameOrNumber);if(layer)return layer.CanvasCssToLayer(x, +y);else return[0,0]}}IsMouseButtonDown(button){button=Math.floor(button);return!!this._buttonMap[button]}_IsMouseOverCanvas(){return this._mouseXcanvas>=0&&this._mouseYcanvas>=0&&this._mouseXcanvas({name:"$"+layer.GetName(),value:layer.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}} +{const C3=self.C3;C3.Plugins.Mouse.Cnds={OnClick(button,type){return this._triggerButton===button&&this._triggerType===type},OnAnyClick(){return true},IsButtonDown(button){return this._buttonMap[button]},OnRelease(button){return this._triggerButton===button},IsOverObject(objectClass){if(!this._IsMouseOverCanvas())return false;const cnd=this._runtime.GetCurrentCondition();const isInverted=cnd.IsInverted();const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return C3.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +mx,my,isInverted),isInverted)},OnObjectClicked(button,type,objectClass){if(button!==this._triggerButton||type!==this._triggerType)return false;if(!this._IsMouseOverCanvas())return false;const mx=this._mouseXcanvas;const my=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,mx,my,false)},OnWheel(dir){return dir===2||this._triggerDir===dir},OnPointerLocked(){return true},OnPointerUnlocked(){return true},OnPointerLockError(){return true},HasPointerLock(){return this._hasPointerLock}, +OnMovement(){return true}}}{const C3=self.C3;const CURSOR_STYLES=["auto","pointer","text","crosshair","move","help","wait","none"];C3.Plugins.Mouse.Acts={SetCursor(c){this.SetCursorStyle(CURSOR_STYLES[c])},SetCursorSprite(objectClass){this.SetCursorObjectClass(objectClass)},RequestPointerLock(){this._PostToDOMMaybeSync("request-pointer-lock")},ReleasePointerLock(){this.PostToDOM("release-pointer-lock")}}} +{const C3=self.C3;C3.Plugins.Mouse.Exps={X(layerParam){return this.GetMousePositionForLayer(layerParam)[0]},Y(layerParam){return this.GetMousePositionForLayer(layerParam)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas},MovementX(){return this._movementX},MovementY(){return this._movementY},WheelDeltaX(){return this._wheelDeltaX},WheelDeltaY(){return this._wheelDeltaY},WheelDeltaZ(){return this._wheelDeltaZ}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Plugins.Particles=class ParticlesPlugin extends C3.SDKPluginBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Plugins.Particles.Type=class ParticlesType extends C3.SDKTypeBase{constructor(objectClass){super(objectClass)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(renderer){return this.GetImageInfo().LoadStaticTexture(renderer,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}} +{const C3=self.C3;const C3X=self.C3X;const RATE=0;const SPRAY_CONE=1;const TYPE=2;const SPAWNOBJECTCLASS=3;const INITIALLY_VISIBLE=4;const SPEED=5;const SIZE=6;const OPACITY=7;const GROW_RATE=8;const X_RANDOMISER=9;const Y_RANDOMISER=10;const INITIAL_SPEED_RANDOMISER=11;const SIZE_RANDOMISER=12;const GROW_RATE_RANDOMISER=13;const ACCELERATION=14;const GRAVITY=15;const ANGLE_RANDOMISER=16;const LIFE_SPEED_RANDOMISER=17;const OPACITY_RANDOMISER=18;const DESTROY_MODE=19;const TIMEOUT=20;const CONTINUOUS= +0;const ONE_SHOT=1;const tempRect=C3.New(C3.Rect);C3.Plugins.Particles.Instance=class ParticlesInstance extends C3.SDKWorldInstanceBase{constructor(inst,properties){super(inst);this._isFirstTick=true;const pe=C3.New(self.ParticleEngine);this._particleEngine=pe;pe.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(inst,dx,dy,dSize,dAngle,dOpacity)=>this._OnParticleUpdate(inst,dx,dy,dSize,dAngle,dOpacity);this._particleDestroyCallback=inst=>this._OnParticleDestroy(inst); +this._hasAnyDefaultParticle=true;let isInitiallyVisible=true;if(properties){pe.SetRate(properties[RATE]);pe.SetSprayCone(C3.toRadians(properties[SPRAY_CONE]));pe.SetSprayType(properties[TYPE]?"one-shot":"continuous-spray");this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(properties[SPAWNOBJECTCLASS]));isInitiallyVisible=properties[INITIALLY_VISIBLE];pe.SetInitSpeed(properties[SPEED]);pe.SetInitSize(properties[SIZE]);pe.SetInitOpacity(properties[OPACITY]/100);pe.SetGrowRate(properties[GROW_RATE]); +pe.SetInitXRandom(properties[X_RANDOMISER]);pe.SetInitYRandom(properties[Y_RANDOMISER]);pe.SetInitSpeedRandom(properties[INITIAL_SPEED_RANDOMISER]);pe.SetInitSizeRandom(properties[SIZE_RANDOMISER]);pe.SetGrowRandom(properties[GROW_RATE_RANDOMISER]);pe.SetAcceleration(properties[ACCELERATION]);pe.SetGravity(properties[GRAVITY]);pe.SetLifeAngleRandom(properties[ANGLE_RANDOMISER]);pe.SetLifeSpeedRandom(properties[LIFE_SPEED_RANDOMISER]);pe.SetLifeOpacityRandom(properties[OPACITY_RANDOMISER]);pe.SetDestroyModeIndex(properties[DESTROY_MODE]); +pe.SetTimeout(properties[TIMEOUT])}this._UpdateEngineParameters();if(this._spawnObjectClass)this._hasAnyDefaultParticle=false;if(pe.GetSprayType()==="one-shot")pe.CreateOneShotSpray();else pe.SetSpraying(true);const wi=this.GetWorldInfo();wi.SetVisible(isInitiallyVisible);wi.SetBboxChangeEventEnabled(true);this._inst.Dispatcher().addEventListener("bboxchange",()=>{wi.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});if(this.GetRuntime().GetRenderer().IsWebGPU())wi.SetUsePointsShaderProgram(); +this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad);this._StartTicking()}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._particleEngine.Release();this._particleEngine=null;this._particleUpdateCallback=null;this._particleDestroyCallback=null;super.Release()}GetParticleEngine(){return this._particleEngine}_SetRate(r){this._particleEngine.SetRate(r);if(this._particleEngine.GetSprayType()=== +"one-shot"&&this._isFirstTick)this._particleEngine.SetParticleCount(r)}_SetParticleObjectClass(objectClass){if(objectClass===this.GetObjectClass())objectClass=null;if(objectClass===this._spawnObjectClass)return;this._spawnObjectClass=objectClass;this._particleEngine.onparticlecreate=objectClass?p=>this._OnParticleCreate(p):null;if(!this._spawnObjectClass)this._hasAnyDefaultParticle=true}_UpdateEngineParameters(){const pe=this._particleEngine;const wi=this.GetWorldInfo();pe.SetMasterOpacity(wi.GetOpacity()); +pe.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());pe.SetSpawnX(wi.GetX());pe.SetSpawnY(wi.GetY());pe.SetSpawnAngle(wi.GetAngle());pe.SetInitSizeScale(Math.abs(wi.GetSceneGraphScale()))}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(renderer){if(!this._hasAnyDefaultParticle)return;const imageInfo=this._objectClass.GetImageInfo();const texture=imageInfo.GetTexture();if(!texture)return;const wi=this.GetWorldInfo();const layer=wi.GetLayer();const viewport=tempRect;if(this._runtime.GetCanvasManager().IsPastingToDrawingCanvas())viewport.set(-Infinity, +-Infinity,Infinity,Infinity);else if(layer.Has3DCamera())layer.CalculateViewport3D(wi.GetTotalZElevation(),viewport);else layer.GetViewportForZ(wi.GetTotalZElevation(),viewport);renderer.SetTexture(texture);const zScaleFactor=layer.Get2DScaleFactorToZ(wi.GetTotalZElevation());this._particleEngine.SetParticleScale(layer.GetRenderScale()*zScaleFactor);this._particleEngine.Draw(renderer,imageInfo.GetTexQuad(),viewport,layer.Has3DCamera())}SaveToJson(){const pe=this._particleEngine;return{"r":pe.GetRate(), +"sc":pe.GetSprayCone(),"st":pe.GetSprayType(),"isp":pe.GetInitSpeed(),"isz":pe.GetInitSize(),"io":pe.GetInitOpacity(),"gr":pe.GetGrowRate(),"xr":pe.GetInitXRandom(),"yr":pe.GetInitYRandom(),"spr":pe.GetInitSpeedRandom(),"szr":pe.GetInitSizeRandom(),"grnd":pe.GetGrowRandom(),"acc":pe.GetAcceleration(),"g":pe.GetGravity(),"lar":pe.GetLifeAngleRandom(),"lsr":pe.GetLifeSpeedRandom(),"lor":pe.GetLifeOpacityRandom(),"dm":pe.GetDestroyModeIndex(),"to":pe.GetTimeout(),"s":pe.IsSpraying(),"pcc":pe._GetCreateCounter(), +"ft":this._isFirstTick,"soc":this._spawnObjectClass?this._spawnObjectClass.GetSID():null,"p":pe.GetParticles().map(p=>p.toJSON())}}LoadFromJson(o,mode){const pe=this._particleEngine;pe.SetRate(o["r"]);pe.SetSprayCone(o["sc"]);pe.SetSprayType(o["st"]);pe.SetInitSpeed(o["isp"]);pe.SetInitSize(o["isz"]);pe.SetInitOpacity(o["io"]);pe.SetGrowRate(o["gr"]);pe.SetInitXRandom(o["xr"]);pe.SetInitYRandom(o["yr"]);pe.SetInitSpeedRandom(o["spr"]);pe.SetInitSizeRandom(o["szr"]);pe.SetGrowRandom(o["grnd"]);pe.SetAcceleration(o["acc"]); +pe.SetGravity(o["g"]);pe.SetLifeAngleRandom(o["lar"]);pe.SetLifeSpeedRandom(o["lsr"]);pe.SetLifeOpacityRandom(o["lor"]);pe.SetDestroyModeIndex(o["dm"]);pe.SetTimeout(o["to"]);pe.SetSpraying(o["s"]);pe._SetCreateCounter(o["pcc"]);this._isFirstTick=o["ft"];if(o.hasOwnProperty("soc")){const objectClass=this.GetRuntime().GetObjectClassBySID(o["soc"]);if(objectClass)this._SetParticleObjectClass(objectClass)}const particlesData=o["p"];pe.SetParticleCount(particlesData.length);const particles=pe.GetParticles(); +for(let i=0,len=particles.length;i0){this._particleEngine.Tick(FF_DT);time-=FF_DT}if(this._particleEngine.IsSpraying())this._runtime.UpdateRender(); +this.GetWorldInfo().SetBboxChanged();this._isFirstTick=false}_OnParticleCreate(p){const inst=this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),p.GetX(),p.GetY());const wi=inst.GetWorldInfo();wi.SetSize(p.GetSize(),p.GetSize());wi.SetAngle(p.GetAngle());wi.SetOpacity(p.GetOpacity());wi.SetUnpremultipliedColor(this.GetWorldInfo().GetUnpremultipliedColor());wi.SetBboxChanged();wi.ZOrderMoveAdjacentToInstance(this.GetInstance(),true);inst._TriggerOnCreated();p.SetUpdateCallback(this._particleUpdateCallback); +p.SetDestroyCallback(this._particleDestroyCallback);return inst}_OnParticleUpdate(inst,dx,dy,dSize,dAngle,dOpacity){if(inst.IsDestroyed())return;const wi=inst.GetWorldInfo();wi.OffsetXY(dx,dy);wi.SetSize(wi.GetWidth()+dSize,wi.GetHeight()+dSize);wi.SetAngle(wi.GetAngle()+dAngle);wi.SetOpacity(wi.GetOpacity()+dOpacity);wi.SetBboxChanged()}_OnParticleDestroy(inst){if(inst.IsDestroyed())return;this._runtime.DestroyInstance(inst)}GetPropertyValueByIndex(index){const pe=this._particleEngine;switch(index){case RATE:return pe.GetRate(); +case SPRAY_CONE:return C3.toDegrees(pe.GetSprayCone());case TYPE:return pe.GetSprayType()==="one-shot"?ONE_SHOT:CONTINUOUS;case SPEED:return pe.GetInitSpeed();case SIZE:return pe.GetInitSize();case OPACITY:return pe.GetInitOpacity()*100;case GROW_RATE:return pe.GetGrowRate();case X_RANDOMISER:return pe.GetInitXRandom();case Y_RANDOMISER:return pe.GetInitYRandom();case INITIAL_SPEED_RANDOMISER:return pe.GetInitSpeedRandom();case SIZE_RANDOMISER:return pe.GetInitSizeRandom();case GROW_RATE_RANDOMISER:return pe.GetGrowRandom(); +case ACCELERATION:return pe.GetAcceleration();case GRAVITY:return pe.GetGravity();case ANGLE_RANDOMISER:return pe.GetLifeAngleRandom();case LIFE_SPEED_RANDOMISER:return pe.GetLifeSpeedRandom();case OPACITY_RANDOMISER:return pe.GetLifeOpacityRandom();case DESTROY_MODE:return pe.GetDestroyModeIndex();case TIMEOUT:return pe.GetTimeout()}}SetPropertyValueByIndex(index,value){const pe=this._particleEngine;switch(index){case RATE:pe.SetRate(value);break;case SPRAY_CONE:pe.SetSprayCone(C3.toRadians(value)); +break;case TYPE:pe.SetSprayType(value?"one-shot":"continuous-spray");break;case SPEED:pe.SetInitSpeed(value);break;case SIZE:pe.SetInitSize(value);break;case OPACITY:pe.SetInitOpacity(value/100);break;case GROW_RATE:pe.SetGrowRate(value);break;case X_RANDOMISER:pe.SetInitXRandom(value);break;case Y_RANDOMISER:pe.SetInitYRandom(value);break;case INITIAL_SPEED_RANDOMISER:pe.SetInitSpeedRandom(value);break;case SIZE_RANDOMISER:pe.SetInitSizeRandom(value);break;case GROW_RATE_RANDOMISER:pe.SetGrowRandom(value); +break;case ACCELERATION:pe.SetAcceleration(value);break;case GRAVITY:pe.SetGravity(value);break;case ANGLE_RANDOMISER:pe.SetLifeAngleRandom(value);break;case LIFE_SPEED_RANDOMISER:pe.SetLifeSpeedRandom(value);break;case OPACITY_RANDOMISER:pe.SetLifeOpacityRandom(value);break;case DESTROY_MODE:pe.SetDestroyModeIndex(value);break;case TIMEOUT:pe.SetTimeout(value);break}}GetDebuggerProperties(){const prefix="plugins.particles";const propPrefix=prefix+".properties";const dbgPrefix=prefix+".debugger"; +const pe=this._particleEngine;return[{title:prefix+".name",properties:[{name:dbgPrefix+".particle-count",value:pe.GetParticleCount()},{name:propPrefix+".type.name",value:[propPrefix+".type.items."+pe.GetSprayType()]},{name:dbgPrefix+".is-spraying",value:pe.IsSpraying(),onedit:v=>pe.SetSpraying(v)},{name:propPrefix+".rate.name",value:pe.GetRate(),onedit:v=>pe.SetRate(v)},{name:propPrefix+".spray-cone.name",value:C3.toDegrees(pe.GetSprayCone()),onedit:v=>pe.SetSprayCone(C3.toRadians(v))},{name:propPrefix+ +".speed.name",value:pe.GetInitSpeed(),onedit:v=>pe.SetInitSpeed(v)},{name:propPrefix+".size.name",value:pe.GetInitSize(),onedit:v=>pe.SetInitSize(v)},{name:propPrefix+".opacity.name",value:pe.GetInitOpacity(),onedit:v=>pe.SetInitOpacity(v)},{name:propPrefix+".grow-rate.name",value:pe.GetGrowRate(),onedit:v=>pe.SetGrowRate(v)},{name:propPrefix+".x-randomiser.name",value:pe.GetInitXRandom(),onedit:v=>pe.SetInitXRandom(v)},{name:propPrefix+".y-randomiser.name",value:pe.GetInitYRandom(),onedit:v=>pe.SetInitYRandom(v)}, +{name:propPrefix+".initial-speed-randomiser.name",value:pe.GetInitSpeedRandom(),onedit:v=>pe.SetInitSpeedRandom(v)},{name:propPrefix+".size-randomiser.name",value:pe.GetInitSizeRandom(),onedit:v=>pe.SetInitSizeRandom(v)},{name:propPrefix+".grow-rate-randomiser.name",value:pe.GetGrowRandom(),onedit:v=>pe.SetGrowRandom(v)},{name:propPrefix+".acceleration.name",value:pe.GetAcceleration(),onedit:v=>pe.SetAcceleration(v)},{name:propPrefix+".gravity.name",value:pe.GetGravity(),onedit:v=>pe.SetGravity(v)}, +{name:propPrefix+".angle-randomiser.name",value:pe.GetLifeAngleRandom(),onedit:v=>pe.SetLifeAngleRandom(v)},{name:propPrefix+".life-speed-randomiser.name",value:pe.GetLifeSpeedRandom(),onedit:v=>pe.SetLifeSpeedRandom(v)},{name:propPrefix+".opacity-randomiser.name",value:pe.GetLifeOpacityRandom(),onedit:v=>pe.SetLifeOpacityRandom(v)},{name:propPrefix+".timeout.name",value:pe.GetTimeout(),onedit:v=>pe.SetTimeout(v)}]}]}GetScriptInterfaceClass(){return self.IParticlesInstance}};const map=new WeakMap; +function GetParticleEngine(iinst){return map.get(iinst).GetParticleEngine()}self.IParticlesInstance=class IParticlesInstance extends self.IWorldInstance{constructor(){super();map.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set isSpraying(s){GetParticleEngine(this).SetSpraying(!!s)}get isSpraying(){return GetParticleEngine(this).IsSpraying()}set rate(r){C3X.RequireFiniteNumber(r);map.get(this)._SetRate(r)}get rate(){return GetParticleEngine(this).GetRate()}set sprayCone(c){C3X.RequireFiniteNumber(c); +GetParticleEngine(this).SetSprayCone(c)}get sprayCone(){return GetParticleEngine(this).GetSprayCone()}set initSpeed(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSpeed(s)}get initSpeed(){return GetParticleEngine(this).GetInitSpeed()}set initSize(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSize(s)}get initSize(){return GetParticleEngine(this).GetInitSize()}set initOpacity(o){C3X.RequireFiniteNumber(o);GetParticleEngine(this).SetInitOpacity(o)}get initOpacity(){return GetParticleEngine(this).GetInitOpacity()}set initXRandom(x){C3X.RequireFiniteNumber(x); +GetParticleEngine(this).SetInitXRandom(x)}get initXRandom(){return GetParticleEngine(this).GetInitXRandom()}set initYRandom(y){C3X.RequireFiniteNumber(y);GetParticleEngine(this).SetInitYRandom(y)}get initYRandom(){return GetParticleEngine(this).GetInitYRandom()}set initSpeedRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSpeedRandom(s)}get initSpeedRandom(){return GetParticleEngine(this).GetInitSpeedRandom()}set initSizeRandom(s){C3X.RequireFiniteNumber(s);GetParticleEngine(this).SetInitSizeRandom(s)}get initSizeRandom(){return GetParticleEngine(this).GetInitSizeRandom()}set initGrowRate(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetGrowRate(r)}get initGrowRate(){return GetParticleEngine(this).GetGrowRate()}set initGrowRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetGrowRandom(r)}get initGrowRandom(){return GetParticleEngine(this).GetGrowRandom()}set acceleration(a){C3X.RequireFiniteNumber(a);GetParticleEngine(this).SetAcceleration(a)}get acceleration(){return GetParticleEngine(this).GetAcceleration()}set gravity(g){C3X.RequireFiniteNumber(g);GetParticleEngine(this).SetGravity(g)}get gravity(){return GetParticleEngine(this).GetGravity()}set lifeAngleRandom(r){C3X.RequireFiniteNumber(r); +GetParticleEngine(this).SetLifeAngleRandom(r)}get lifeAngleRandom(){return GetParticleEngine(this).GetLifeAngleRandom()}set lifeSpeedRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeSpeedRandom(r)}get lifeSpeedRandom(){return GetParticleEngine(this).GetLifeSpeedRandom()}set lifeOpacityRandom(r){C3X.RequireFiniteNumber(r);GetParticleEngine(this).SetLifeOpacityRandom(r)}get lifeOpacityRandom(){return GetParticleEngine(this).GetLifeOpacityRandom()}set timeout(t){C3X.RequireFiniteNumber(t); +GetParticleEngine(this).SetTimeout(t)}get timeout(){return GetParticleEngine(this).GetTimeout()}fastForward(time){C3X.RequireFiniteNumber(time);map.get(this)._FastForward(time)}setParticleObjectClass(iObjectClass){const inst=map.get(this);if(iObjectClass)inst._SetParticleObjectClass(inst.GetRuntime()._UnwrapIObjectClass(iObjectClass));else inst._SetParticleObjectClass(null)}}}{const C3=self.C3;C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}}} +{const C3=self.C3;C3.Plugins.Particles.Acts={SetSpraying(s){this._particleEngine.SetSpraying(s!==0)},SetRate(r){this._SetRate(r)},SetParticleObject(objectClass){this._SetParticleObjectClass(objectClass)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(c){this._particleEngine.SetSprayCone(C3.toRadians(c))},SetInitSpeed(x){this._particleEngine.SetInitSpeed(x)},SetInitSize(x){this._particleEngine.SetInitSize(x)},SetInitOpacity(x){this._particleEngine.SetInitOpacity(x/100)},SetGrowRate(x){this._particleEngine.SetGrowRate(x)}, +SetXRandomiser(x){this._particleEngine.SetInitXRandom(x)},SetYRandomiser(x){this._particleEngine.SetInitYRandom(x)},SetSpeedRandomiser(x){this._particleEngine.SetInitSpeedRandom(x)},SetSizeRandomiser(x){this._particleEngine.SetInitSizeRandom(x)},SetGrowRateRandomiser(x){this._particleEngine.SetGrowRandom(x)},SetParticleAcc(x){this._particleEngine.SetAcceleration(x)},SetGravity(x){this._particleEngine.SetGravity(x)},SetAngleRandomiser(x){this._particleEngine.SetLifeAngleRandom(x)},SetLifeSpeedRandomiser(x){this._particleEngine.SetLifeSpeedRandom(x)}, +SetOpacityRandomiser(x){this._particleEngine.SetLifeOpacityRandom(x)},SetTimeout(x){this._particleEngine.SetTimeout(x)},FastForward(time){this._FastForward(time)},SetEffect(effect){this.GetWorldInfo().SetBlendMode(effect);this._runtime.UpdateRender()}}} +{const C3=self.C3;C3.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return C3.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return this._particleEngine.GetInitOpacity()*100},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()}, +YRandom(){return this._particleEngine.GetInitYRandom()},InitSizeRandom(){return this._particleEngine.GetInitSizeRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()}, +ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}}}; + +} + +{ +'use strict';const C3=self.C3;const inactiveParticles=[];const MAX_RECYCLE_PARTICLES=1E3;const VALID_SPRAY_TYPES=new Set(["continuous-spray","one-shot"]);const DESTROY_MODES=["fade-to-invisible","timeout-expired","particle-stopped"];const tempRect=C3.New(C3.Rect); +self.ParticleEngine=class ParticleEngine{constructor(){this._rate=0;this._sprayCone=0;this._sprayType="continuous-spray";this._isSpraying=false;this._masterOpacity=0;this._isPixelRounding=false;this._spawnX=0;this._spawnY=0;this._spawnAngle=0;this._initSpeed=0;this._initSize=0;this._initSizeScale=1;this._initOpacity=0;this._growRate=0;this._xRandom=0;this._yRandom=0;this._initSpeedRandom=0;this._initSizeRandom=0;this._growRandom=0;this._acceleration=0;this._gravity=0;this._lifeAngleRandom=0;this._lifeSpeedRandom= +0;this._lifeOpacityRandom=0;this._destroyMode=0;this._timeout=0;this._createCounter=0;this._particleScale=1;this.ononeshotfinish=null;this.onparticlecreate=null;this._particles=[];this._boundingBox=new C3.Rect;this._color=new C3.Color}Release(){this.Cancel();C3.clearArray(this._particles);this._particles=null;this.ononeshotfinish=null;this.onparticlecreate=null;this._boundingBox=null;this._color=null}Cancel(){const particles=this._particles;for(let i=0,len=particles.length;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES);this._isSpraying=false}CreateOneShotSpray(){for(let i=0,len=this._rate;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}else if(c>particles.length){const diff=c-particles.length;for(let i=0;iMAX_RECYCLE_PARTICLES)C3.truncateArray(inactiveParticles,MAX_RECYCLE_PARTICLES)}_MaybeFinishOneShot(){if(this._sprayType==="one-shot"&&this._particles.length===0&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=false}}Draw(renderer,texQuad,viewport,forceQuads){tempRect.set(texQuad.getTlx(),texQuad.getTly(),texQuad.getBrx(),texQuad.getBry());renderer.StartRenderingPoints(tempRect); +this._color.copy(renderer.GetColor());const particles=this._particles;for(let i=0,len=particles.length;i=1&&(engine.GetDestroyModeIndex()===2?this._speed>0:this._agerenderer.GetMaxPointSize()||scaledSizethis._OnPermissionResult(e));const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"pointerdown",e=>this._OnPointerDown(e.data)),C3.Disposable.From(rt,"pointermove",e=>this._OnPointerMove(e.data)),C3.Disposable.From(rt,"pointerup",e=>this._OnPointerUp(e.data,false)),C3.Disposable.From(rt, +"pointercancel",e=>this._OnPointerUp(e.data,true)),C3.Disposable.From(rt,"deviceorientation",e=>this._OnDeviceOrientation(e.data)),C3.Disposable.From(rt,"deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e.data)),C3.Disposable.From(rt,"devicemotion",e=>this._OnDeviceMotion(e.data)),C3.Disposable.From(rt,"tick2",e=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(e){if(e["pointerType"]==="mouse")if(this._useMouseInput)this._isMouseDown=true;else return; +const pointerId=e["pointerId"];if(this._touches.has(pointerId))return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();const nowTime=performance.now();const index=this._touches.size;this._triggerIndex=index;this._triggerId=pointerId;const touchInfo=C3.New(C3.Plugins.Touch.TouchInfo);touchInfo.Init(nowTime,x,y,pointerId,index);this._touches.set(pointerId,touchInfo);this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchStart); +this._curTouchX=x;this._curTouchY=y;this.Trigger(C3.Plugins.Touch.Cnds.OnTouchObject)}_OnPointerMove(e){if(e["pointerType"]==="mouse"&&!this._isMouseDown)return;const touchInfo=this._touches.get(e["pointerId"]);if(!touchInfo)return;const nowTime=performance.now();if(nowTime-touchInfo.GetTime()<2)return;const x=e["pageX"]-this._runtime.GetCanvasClientX();const y=e["pageY"]-this._runtime.GetCanvasClientY();touchInfo.Update(nowTime,x,y,e["width"],e["height"],e["pressure"])}_OnPointerUp(e,isCancel){if(e["pointerType"]=== +"mouse")if(this._isMouseDown)this._isMouseDown=false;else return;const nowTime=performance.now();const pointerId=e["pointerId"];const touchInfo=this._touches.get(pointerId);if(!touchInfo)return;this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this.Trigger(C3.Plugins.Touch.Cnds.OnNthTouchEnd);this.Trigger(C3.Plugins.Touch.Cnds.OnTouchEnd);if(!isCancel){const tap=touchInfo.ShouldTriggerTap(nowTime);if(tap==="single-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnTapGesture); +this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnTapGestureObject)}else if(tap==="double-tap"){this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnDoubleTapGestureObject)}}touchInfo.Release();this._touches.delete(pointerId)}_RequestPermission(type){this._PostToDOMMaybeSync("request-permission",{"type":type});return new Promise((resolve,reject)=> +{this._permissionPromises.push({type,resolve,reject})})}_OnPermissionResult(e){const isGranted=e["result"];const type=e["type"];this._triggerPermission=type;const toResolve=this._permissionPromises.filter(o=>o.type===type);for(const o of toResolve)o.resolve(isGranted?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(o=>o.type!==type);if(isGranted){this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionGranted);if(type===0)this._runtime.RequestDeviceOrientationEvent();else this._runtime.RequestDeviceMotionEvent()}else this.Trigger(C3.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(e){if(typeof e["webkitCompassHeading"]=== +"number")this._orientCompassHeading=e["webkitCompassHeading"];else if(e["absolute"])this._orientCompassHeading=e["alpha"];this._orientAlpha=e["alpha"];this._orientBeta=e["beta"];this._orientGamma=e["gamma"]}_OnDeviceOrientationAbsolute(e){this._orientCompassHeading=e["alpha"]}_OnDeviceMotion(e){const acc=e["acceleration"];if(acc){this._accX=acc["x"];this._accY=acc["y"];this._accZ=acc["z"]}const withG=e["accelerationIncludingGravity"];if(withG){this._accWithGX=withG["x"];this._accWithGY=withG["y"]; +this._accWithGZ=withG["z"]}}_OnTick2(){const nowTime=performance.now();let index=0;for(const touchInfo of this._touches.values()){if(touchInfo.GetTime()<=nowTime-50)touchInfo._SetLastTime(nowTime);if(touchInfo.ShouldTriggerHold(nowTime)){this._triggerIndex=touchInfo.GetStartIndex();this._triggerId=touchInfo.GetId();this._getTouchIndex=index;this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGesture);this._curTouchX=touchInfo.GetX();this._curTouchY=touchInfo.GetY();this.Trigger(C3.Plugins.Touch.Cnds.OnHoldGestureObject); +this._getTouchIndex=0}++index}}_GetTouchByIndex(index){index=Math.floor(index);for(const touchInfo of this._touches.values()){if(index===0)return touchInfo;--index}return null}_IsClientPosOnCanvas(touchX,touchY){return touchX>=0&&touchY>=0&&touchX({name:"$"+ti.GetId(),value:ti.GetX()+ +", "+ti.GetY()}))}]}}} +{const C3=self.C3;const tempArr=[];C3.Plugins.Touch.Cnds={OnTouchStart(){return true},OnTouchEnd(){return true},IsInTouch(){return this._touches.size>0},OnTouchObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},IsTouchingObject(objectClass){if(!objectClass)return false;const interactiveLayersCache=new Map; +const isLayerInteractive=layer=>{let ret=interactiveLayersCache.get(layer);if(typeof ret==="undefined"){ret=layer.IsSelfAndParentsInteractive();interactiveLayersCache.set(layer,ret)}return ret};const sol=objectClass.GetCurrentSol();const instances=sol.GetInstances();for(const inst of instances){const wi=inst.GetWorldInfo();const layer=wi.GetLayer();if(!isLayerInteractive(layer)||!wi.IsInViewport2())continue;for(const touchInfo of this._touches.values()){if(!this._IsClientPosOnCanvas(touchInfo.GetX(), +touchInfo.GetY()))continue;const [px,py]=layer.CanvasCssToLayer(touchInfo.GetX(),touchInfo.GetY(),wi.GetTotalZElevation());if(wi.ContainsPoint(px,py)){tempArr.push(inst);break}}}interactiveLayersCache.clear();if(tempArr.length){sol.SetArrayPicked(tempArr);objectClass.ApplySolToContainer();C3.clearArray(tempArr);return true}else return false},CompareTouchSpeed(index,cmp,s){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return false;return C3.compare(touchInfo.GetSpeed(),cmp,s)},OrientationSupported(){return true}, +MotionSupported(){return true},CompareOrientation(orientation,cmp,a){this._runtime.RequestDeviceOrientationEvent();let v=0;if(orientation===0)v=this._orientAlpha;else if(orientation===1)v=this._orientBeta;else v=this._orientGamma;return C3.compare(v,cmp,a)},CompareAcceleration(a,cmp,x){this._runtime.RequestDeviceMotionEvent();let v=0;if(a===0)v=this._accWithGX;else if(a===1)v=this._accWithGY;else if(a===2)v=this._accWithGZ;else if(a===3)v=this._accX;else if(a===4)v=this._accY;else v=this._accZ;return C3.compare(v, +cmp,x)},OnNthTouchStart(index){index=Math.floor(index);return index===this._triggerIndex},OnNthTouchEnd(index){index=Math.floor(index);return index===this._triggerIndex},HasNthTouch(index){index=Math.floor(index);return this._touches.size>=index+1},OnHoldGesture(){return true},OnTapGesture(){return true},OnDoubleTapGesture(){return true},OnHoldGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass,this._curTouchX,this._curTouchY,false)},OnDoubleTapGestureObject(objectClass){if(!objectClass)return false;if(!this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY))return false;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(objectClass, +this._curTouchX,this._curTouchY,false)},OnPermissionGranted(type){return this._triggerPermission===type},OnPermissionDenied(type){return this._triggerPermission===type}}}{const C3=self.C3;C3.Plugins.Touch.Acts={RequestPermission(type){this._RequestPermission(type)}}} +{const C3=self.C3;C3.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},Y(layerParam){const touchInfo=this._GetTouchByIndex(this._getTouchIndex);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YAt(index,layerParam){const touchInfo=this._GetTouchByIndex(index);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},XForID(id,layerParam){const touchInfo=this._touches.get(id);if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,true)},YForID(id,layerParam){const touchInfo=this._touches.get(id); +if(!touchInfo)return 0;return touchInfo.GetPositionForLayer(this._runtime.GetCurrentLayout(),layerParam,false)},AbsoluteX(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteY(){const touchInfo=this._GetTouchByIndex(0);if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYAt(index){const touchInfo=this._GetTouchByIndex(index); +if(touchInfo)return touchInfo.GetY();else return 0},AbsoluteXForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetX();else return 0},AbsoluteYForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetY();else return 0},SpeedAt(index){const touchInfo=this._GetTouchByIndex(index);if(touchInfo)return touchInfo.GetSpeed();else return 0},SpeedForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetSpeed();else return 0},AngleAt(index){const touchInfo= +this._GetTouchByIndex(index);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},AngleForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return C3.toDegrees(touchInfo.GetAngle());else return 0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},Alpha(){this._runtime.RequestDeviceOrientationEvent();return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent(); +return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();return this._accX},AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ}, +TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetWidth();else return 0},HeightForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetHeight();else return 0},PressureForID(id){const touchInfo=this._touches.get(id);if(touchInfo)return touchInfo.GetPressure();else return 0}}}; + +} + +{ +'use strict';const C3=self.C3;const GESTURE_HOLD_THRESHOLD=15;const GESTURE_HOLD_TIMEOUT=500;const GESTURE_TAP_TIMEOUT=333;const GESTURE_DOUBLETAP_THRESHOLD=25;let lastTapX=-1E3;let lastTapY=-1E3;let lastTapTime=-1E4; +C3.Plugins.Touch.TouchInfo=class TouchInfo extends C3.DefendedBase{constructor(){super();this._pointerId=0;this._startIndex=0;this._startTime=0;this._time=0;this._lastTime=0;this._startX=0;this._startY=0;this._x=0;this._y=0;this._lastX=0;this._lastY=0;this._width=0;this._height=0;this._pressure=0;this._hasTriggeredHold=false;this._isTooFarForHold=false}Release(){}Init(nowTime,x,y,id,index){this._pointerId=id;this._startIndex=index;this._time=nowTime;this._lastTime=nowTime;this._startTime=nowTime; +this._startX=x;this._startY=y;this._x=x;this._y=y;this._lastX=x;this._lastY=y}Update(nowTime,x,y,width,height,pressure){this._lastTime=this._time;this._time=nowTime;this._lastX=this._x;this._lastY=this._y;this._x=x;this._y=y;this._width=width;this._height=height;this._pressure=pressure;if(!this._isTooFarForHold&&C3.distanceTo(this._startX,this._startY,this._x,this._y)>=GESTURE_HOLD_THRESHOLD)this._isTooFarForHold=true}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(t){this._lastTime= +t}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const dist=C3.distanceTo(this._x,this._y,this._lastX,this._lastY);const dt=(this._time-this._lastTime)/1E3;if(dt>0)return dist/dt;else return 0}GetAngle(){return C3.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(nowTime){if(this._hasTriggeredHold)return false;if(nowTime-this._startTime>=GESTURE_HOLD_TIMEOUT&&!this._isTooFarForHold&& +C3.distanceTo(this._startX,this._startY,this._x,this._y)this._OnOnlineStateChanged(e)], +["backbutton",()=>this._OnBackButton()],["sw-message",e=>this._OnSWMessage(e)],["hashchange",e=>this._OnHashChange(e)]]);const rt=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),C3.Disposable.From(rt,"window-resize",()=>this._OnWindowResize()),C3.Disposable.From(rt,"suspend",()=>this._OnSuspend()),C3.Disposable.From(rt,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state", +{"exportType":this._runtime.GetExportType()}).then(data=>{this._initLocationStr=data["location"];this._isOnline=data["isOnline"];this._referrer=data["referrer"];this._docTitle=data["title"];this._isCookieEnabled=data["isCookieEnabled"];this._screenWidth=data["screenWidth"];this._screenHeight=data["screenHeight"];this._windowOuterWidth=data["windowOuterWidth"];this._windowOuterHeight=data["windowOuterHeight"];this._isConstructArcade=data["isConstructArcade"]}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(e){const isOnline= +!!e["isOnline"];if(this._isOnline===isOnline)return;this._isOnline=isOnline;if(this._isOnline)await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOnline);else await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOffline)}async _OnWindowResize(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(e){const messageType= +e["type"];if(messageType==="downloading-update")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateFound);else if(messageType==="update-ready"||messageType==="update-pending")this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateReady);else if(messageType==="offline-ready")this.Trigger(C3.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(e){this._initLocationStr=e["location"];this.Trigger(C3.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){const prefix="plugins.browser.debugger";return[{title:"plugins.browser.name", +properties:[{name:prefix+".user-agent",value:navigator.userAgent},{name:prefix+".is-online",value:this._isOnline},{name:prefix+".is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}} +{const C3=self.C3;C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return true},OnOffline(){return true},OnResize(){return true},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return true},IsPortraitLandscape(p){const lastInnerWidth=this._runtime.GetCanvasManager().GetLastWidth();const lastInnerHeight=this._runtime.GetCanvasManager().GetLastHeight();const current=lastInnerWidth<=lastInnerHeight? +0:1;return current===p},OnUpdateFound(){return true},OnUpdateReady(){return true},OnOfflineReady(){return true},OnHashChange(){return true},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return true},OnPageVisible(){return true},HasJava(){return false},IsDownloadingUpdate(){return false},OnMenuButton(){return false},OnSearchButton(){return false},IsMetered(){return false},IsCharging(){return true},SupportsFullscreen(){return true}}} +{const C3=self.C3;const ORIENTATIONS=["portrait","landscape","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];C3.Plugins.Browser.Acts={Alert(message){this.PostToDOM("alert",{"message":message.toString()})},Close(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())self.C3Debugger.CloseWindow();else this.PostToDOM("close")},Focus(){this.PostToDOM("set-focus",{"isFocus":true})},Blur(){this.PostToDOM("set-focus",{"isFocus":false})},GoBack(){if(this._isConstructArcade)return; +this.PostToDOM("navigate",{"type":"back"})},GoForward(){if(this._isConstructArcade)return;this.PostToDOM("navigate",{"type":"forward"})},GoHome(){},Reload(){if(this._isConstructArcade)return;if(this._runtime.IsDebug())this._runtime.PostToDebugger({"type":"reload"});else this.PostToDOM("navigate",{"type":"reload"})},GoToURL(url,target){this._PostToDOMMaybeSync("navigate",{"type":"url","url":url,"target":target,"exportType":this._runtime.GetExportType()})},GoToURLWindow(url,tag){this._PostToDOMMaybeSync("navigate", +{"type":"new-window","url":url,"tag":tag,"exportType":this._runtime.GetExportType()})},RequestFullScreen(mode,navUi){if(mode>=2)mode+=1;if(mode===6)mode=2;if(mode===1)mode=0;const modeStr=C3.CanvasManager._FullscreenModeNumberToString(mode);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(modeStr);this._PostToDOMMaybeSync("request-fullscreen",{"navUI":navUi})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(pattern){const arr=pattern.split(",");for(let i=0,len=arr.length;i< +len;++i)arr[i]=parseInt(arr[i],10);this._PostToDOMMaybeSync("vibrate",{"pattern":arr})},async InvokeDownload(url,filename){if(!url||!filename)return;const urlToDownload=await this._runtime.GetAssetManager().GetProjectFileUrl(url);this._runtime.InvokeDownload(urlToDownload,filename)},InvokeDownloadString(str,mimeType,filename){if(!filename)return;const dataUri=`data:${mimeType},${encodeURIComponent(str)}`;this._runtime.InvokeDownload(dataUri,filename)},ConsoleLog(type,msg){msg=msg.toString();if(type=== +0)console.log(msg);else if(type===1)console.warn(msg);else if(type===2)console.error(msg)},ConsoleGroup(name){console.group(name)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(jsStr){try{eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}},LockOrientation(o){o=Math.floor(o);if(o<0||o>=ORIENTATIONS.length)return;const orientation=ORIENTATIONS[o];this._PostToDOMMaybeSync("lock-orientation",{"orientation":orientation})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")}, +LoadStyleSheet(url){this._runtime.GetAssetManager().LoadStyleSheet(url)},async SetDocumentCSSStyle(propName,value,selector,type){await this.PostToDOMAsync("set-document-css-style",{"prop":C3.CSSToCamelCase(propName),"value":value,"selector":selector,"is-all":type!==0})},async GetDocumentCSSStyle(propName,selector,tag){const ret=await this.PostToDOMAsync("get-document-css-style",{"prop":propName,"selector":selector});if(ret["isOk"])this._cssStyleMap.set(tag.toLowerCase(),ret["result"].trim())},SetHash(h){this.PostToDOM("set-hash", +{"hash":h})}}} +{const C3=self.C3;C3.Plugins.Browser.Exps={URL(){if(this._runtime.IsInWorker())return this._initLocationStr;else return location.toString()},Protocol(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).protocol;else return location.protocol},Domain(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hostname;else return location.hostname},Port(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).port;else return location.port},PathName(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).pathname; +else return location.pathname},Hash(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).hash;else return location.hash},QueryString(){if(this._runtime.IsInWorker())return(new URL(this._initLocationStr)).search;else return location.search},QueryParam(param){const search=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;const match=RegExp("[?&]"+param+"=([^&]*)").exec(search);if(match)return decodeURIComponent(match[1].replace(/\+/g," "));else return""}, +Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(jsStr){let result=0;try{result=eval(jsStr)}catch(err){console.error("Error executing JavaScript: ",err)}if(typeof result==="number"||typeof result==="string")return result;if(typeof result==="boolean")return result?1:0;else return 0},CSSStyleValue(tag){return this._cssStyleMap.get(tag)||""},Name(){return navigator.appName}, +Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const connection=navigator["connection"];if(connection)return connection["downlink"]||connection["downlinkMax"]||connection["bandwidth"]||Infinity;else return Infinity},ConnectionType(){const connection=navigator["connection"];if(connection)return connection["type"]||"unknown";else return"unknown"},DevicePixelRatio(){return self.devicePixelRatio}, +ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}}}; + +} + +{ +'use strict';{const C3=self.C3;const C3X=self.C3X;let tempVec2a=null;let tempVec2b=null;let vec2RecycleCache=[];let Box2D=null;let physicsBehavior=null;const PHYSICS_COLLISIONS_KEY="Physics_DisabledCollisions";function SetObjectTypeCollisionsEnabled(typeA,typeB,state){const savedA=typeA.GetSavedDataMap();const savedB=typeB.GetSavedDataMap();if(state){const setA=savedA.get(PHYSICS_COLLISIONS_KEY);if(setA)setA.delete(typeB.GetSID());const setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(setB)setB.delete(typeA.GetSID())}else{let setA= +savedA.get(PHYSICS_COLLISIONS_KEY);if(!setA){setA=new Set;savedA.set(PHYSICS_COLLISIONS_KEY,setA)}let setB=savedB.get(PHYSICS_COLLISIONS_KEY);if(!setB){setB=new Set;savedB.set(PHYSICS_COLLISIONS_KEY,setB)}setA.add(typeB.GetSID());setB.add(typeA.GetSID())}}C3.Behaviors.Physics=class PhysicsBehavior extends C3.SDKBehaviorBase{constructor(opts){opts.scriptInterfaceClass=self.IPhysicsBehavior;super(opts);this._world=null;this._worldG=10;this._worldScale=.02;this._worldManifold=null;this._lastUpdateTick= +-1;this._steppingMode=1;this._velocityIterations=8;this._positionIterations=3;this._allCollisionsEnabled=true;this._runtime.AddLoadPromise(this._LoadBox2DWasm())}async _LoadBox2DWasm(){const box2dWasmUrl=await this._runtime.GetAssetManager().GetProjectFileUrl("box2d.wasm");await new Promise(resolve=>{self["Box2DWasmModule"]({"wasmBinaryFile":box2dWasmUrl}).then(box2d=>{Box2D=box2d;this._InitBox2DWorld();resolve()})})}_InitBox2DWorld(){const collisionEngine=this._runtime.GetCollisionEngine();tempVec2a= +C3.Behaviors.Physics.GetVec2(0,0);tempVec2b=C3.Behaviors.Physics.GetVec2(0,0);this._world=new Box2D["b2World"](C3.Behaviors.Physics.GetTempVec2A(0,this._worldG),true);const listener=new Box2D["JSContactListener"];listener["BeginContact"]=contactPtr=>{const contact=Box2D["wrapPointer"](contactPtr,Box2D["b2Contact"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureA"]()["GetBody"]());const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(contact["GetFixtureB"]()["GetBody"]()); +collisionEngine.RegisterCollision(behA.GetObjectInstance(),behB.GetObjectInstance())};listener["EndContact"]=()=>{};listener["PreSolve"]=()=>{};listener["PostSolve"]=()=>{};this._world["SetContactListener"](listener);const filter=new Box2D["JSContactFilter"];filter["ShouldCollide"]=(fixAPtr,fixBPtr)=>{if(this._allCollisionsEnabled)return true;const fixtureA=Box2D["wrapPointer"](fixAPtr,Box2D["b2Fixture"]);const fixtureB=Box2D["wrapPointer"](fixBPtr,Box2D["b2Fixture"]);const behA=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureA["GetBody"]()); +const behB=C3.Behaviors.Physics.Instance.LookupBehInstFromBody(fixtureB["GetBody"]());const typeA=behA.GetObjectInstance().GetObjectClass();const typeB=behB.GetObjectInstance().GetObjectClass();const sidA=typeA.GetSID();const sidB=typeB.GetSID();const setA=typeA.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setA&&setA.has(sidB))return false;const setB=typeB.GetSavedDataMap().get(PHYSICS_COLLISIONS_KEY);if(setB&&setB.has(sidA))return false;return true};this._world["SetContactFilter"](filter);this._worldManifold= +new Box2D["b2WorldManifold"]}Release(){super.Release()}GetBox2D(){return Box2D}GetWorld(){return this._world}GetWorldScale(){return this._worldScale}GetSteppingMode(){return this._steppingMode}SetSteppingMode(m){this._steppingMode=m}SetLastUpdateTick(t){this._lastUpdateTick=t}GetLastUpdateTick(){return this._lastUpdateTick}SetVelocityIterations(v){this._velocityIterations=Math.max(v,1)}GetVelocityIterations(){return this._velocityIterations}SetPositionIterations(p){this._positionIterations=Math.max(p, +1)}GetPositionIterations(){return this._positionIterations}SetIterations(v,p){this.SetVelocityIterations(v);this.SetPositionIterations(p)}GetGravity(){return this._worldG}SetGravity(g){if(g===this._worldG)return;this._world["SetGravity"](C3.Behaviors.Physics.GetTempVec2A(0,g));this._worldG=g;this._WakeUpAllPhysicsBodies()}_WakeUpAllPhysicsBodies(){for(const inst of this.GetInstances()){const behInst=C3.Behaviors.Physics.Instance.LookupBehInstFromInst(inst);if(!behInst)continue;const body=behInst.GetBody(); +if(!body)continue;body["SetAwake"](true)}}DisableShouldCollideFastPath(){this._allCollisionsEnabled=false}SetCollisionsEnabled(typeA,typeB,state){state=!!state;if(!typeA||!typeB)return;if(typeB.IsFamily())for(const member of typeB.GetFamilyMembers())SetObjectTypeCollisionsEnabled(typeA,member,state);else SetObjectTypeCollisionsEnabled(typeA,typeB,state);this.DisableShouldCollideFastPath()}GetWorldManifold(){return this._worldManifold}static GetPhysicsCollisionKey(){return PHYSICS_COLLISIONS_KEY}static GetVec2(x, +y){if(vec2RecycleCache.length){const ret=vec2RecycleCache.pop();ret["set_x"](x);ret["set_y"](y);return ret}else{const b2Vec2=Box2D["b2Vec2"];return new b2Vec2(x,y)}}static FreeVec2(v){vec2RecycleCache.push(v)}static GetTempVec2A(x,y){tempVec2a["set_x"](x);tempVec2a["set_y"](y);return tempVec2a}static GetTempVec2B(x,y){tempVec2b["set_x"](x);tempVec2b["set_y"](y);return tempVec2b}static CreatePolygonShape(vertices){const b2PolygonShape=Box2D["b2PolygonShape"];const shape=new b2PolygonShape;const buffer= +Box2D["_malloc"](vertices.length*8);let offset=0;for(let i=0;i>2]=vertices[i]["get_x"]();Box2D["HEAPF32"][buffer+(offset+4)>>2]=vertices[i]["get_y"]();offset+=8}const ptr_wrapped=Box2D["wrapPointer"](buffer,Box2D["b2Vec2"]);shape["Set"](ptr_wrapped,vertices.length);Box2D["_free"](buffer);return shape}};const STEPPING_MODES=["fixed","variable"];self.IPhysicsBehavior=class IPhysicsBehavior extends self.IBehavior{constructor(behavior){super(behavior); +physicsBehavior=behavior}set worldGravity(g){C3X.RequireFiniteNumber(g);physicsBehavior.SetGravity(g)}get worldGravity(){return physicsBehavior.GetGravity()}set steppingMode(s){const i=STEPPING_MODES.indexOf(s);if(i<0)throw new Error("invalid stepping mode");physicsBehavior.SetSteppingMode(STEPPING_MODES[i])}get steppingMode(){return STEPPING_MODES[physicsBehavior.GetSteppingMode()]}set velocityIterations(v){C3X.RequireFiniteNumber(v);physicsBehavior.SetVelocityIterations(v)}get velocityIterations(){return physicsBehavior.GetVelocityIterations()}set positionIterations(p){C3X.RequireFiniteNumber(p); +physicsBehavior.SetPositionIterations(p)}get positionIterations(){return physicsBehavior.GetPositionIterations()}setCollisionsEnabled(iObjectClassA,iObjectClassB,state){const runtime=physicsBehavior.GetRuntime();const objectClassA=runtime._UnwrapIObjectClass(iObjectClassA);const objectClassB=runtime._UnwrapIObjectClass(iObjectClassB);state=!!state;physicsBehavior.SetCollisionsEnabled(objectClassA,objectClassB,state)}}}{const C3=self.C3;C3.Behaviors.Physics.Type=class PhysicsType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const assert=self.assert;const IMMOVABLE=0;const COLLISION_MASK=1;const PREVENT_ROTATION=2;const DENSITY=3;const FRICTION=4;const ELASTICITY=5;const LINEAR_DAMPING=6;const ANGULAR_DAMPING=7;const BULLET=8;const ENABLE=9;const body2beh=new WeakMap;const inst2beh=new WeakMap;const tileConvexPolyCache=new WeakMap;const TILE_FLIPPED_HORIZONTAL=-2147483648;const TILE_FLIPPED_VERTICAL=1073741824;const TILE_FLIPPED_DIAGONAL= +536870912;const TILE_FLAGS_MASK=3758096384;const TILE_ID_MASK=536870911;const GetTempVec2A=C3.Behaviors.Physics.GetTempVec2A;const GetTempVec2B=C3.Behaviors.Physics.GetTempVec2B;const tempRect=C3.New(C3.Rect);const tempQuad=C3.New(C3.Quad);C3.Behaviors.Physics.Instance=class PhysicsInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);const behavior=this.GetBehavior();const wi=this.GetWorldInfo();this._box2d=behavior.GetBox2D();this._world=behavior.GetWorld(); +this._worldScale=behavior.GetWorldScale();this._isImmovable=false;this._collisionMask=0;this._actualCollisionMask=0;this._preventRotation=false;this._density=1;this._friction=.5;this._restitution=.2;this._linearDamping=0;this._angularDamping=.01;this._isBullet=false;this._isEnabled=true;this._body=null;this._fixtures=[];this._myJoints=[];this._myCreatedJoints=[];this._joiningMe=new Set;this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle();this._lastWidth=0;this._lastHeight= +0;this._lastTickOverride=false;if(properties){this._isImmovable=!!properties[IMMOVABLE];this._collisionMask=properties[COLLISION_MASK];this._preventRotation=!!properties[PREVENT_ROTATION];this._density=properties[DENSITY];this._friction=properties[FRICTION];this._restitution=properties[ELASTICITY];this._linearDamping=properties[LINEAR_DAMPING];this._angularDamping=properties[ANGULAR_DAMPING];this._isBullet=!!properties[BULLET];this._isEnabled=!!properties[ENABLE]}const rt=this._runtime.Dispatcher(); +this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"beforeload",()=>this._OnBeforeLoad()),C3.Disposable.From(rt,"afterload",()=>this._OnAfterLoad()));inst2beh.set(this._inst,this);if(this._isEnabled)this._StartTicking()}PostCreate(){this._CreateBody()}Release(){this._DestroyMyJoints();C3.clearArray(this._myCreatedJoints);this._joiningMe.clear();if(this._body){this._DestroyFixtures();this._world["DestroyBody"](this._body); +this._body=null}super.Release()}_CreateFixture(fixDef){if(!this._body)return;const fixture=this._body["CreateFixture"](fixDef);this._fixtures.push(fixture);return fixture}_DestroyFixtures(){if(!this._body)return;for(const fixture of this._fixtures)this._body["DestroyFixture"](fixture);C3.clearArray(this._fixtures)}_GetBoundingQuadExcludingMesh(){const wi=this.GetWorldInfo();if(wi.HasMesh()){wi.CalculateBbox(tempRect,tempQuad,false);return tempQuad}else return wi.GetBoundingQuad()}_Destroy(o){this._box2d["destroy"](o)}_CreateBody(){if(!this._isEnabled)return; +const b2FixtureDef=this._box2d["b2FixtureDef"];const b2BodyDef=this._box2d["b2BodyDef"];const wi=this.GetWorldInfo();const hasPoly=wi.HasOwnCollisionPoly();this._actualCollisionMask=this._collisionMask;if(!hasPoly&&!this._inst.HasTilemap()&&this._actualCollisionMask===0)this._actualCollisionMask=1;if(!this._body){const bodyDef=new b2BodyDef;bodyDef["set_type"](this._isImmovable?0:2);let bodyX=wi.GetX()*this._worldScale;let bodyY=wi.GetY()*this._worldScale;if(this._actualCollisionMask===2){const bquad= +this._GetBoundingQuadExcludingMesh();bodyX=bquad.midX()*this._worldScale;bodyY=bquad.midY()*this._worldScale}bodyDef["set_position"](GetTempVec2B(bodyX,bodyY));bodyDef["set_angle"](wi.GetAngle());bodyDef["set_fixedRotation"](this._preventRotation);bodyDef["set_linearDamping"](this._linearDamping);bodyDef["set_angularDamping"](this._angularDamping);bodyDef["set_bullet"](this._isBullet);this._body=this._world["CreateBody"](bodyDef);this._Destroy(bodyDef);body2beh.set(this._body,this)}this._DestroyFixtures(); +const fixDef=new b2FixtureDef;fixDef["set_density"](this._density);fixDef["set_friction"](this._friction);fixDef["set_restitution"](this._restitution);const instW=Math.max(Math.abs(wi.GetWidth()),1);const instH=Math.max(Math.abs(wi.GetHeight()),1);if(this._actualCollisionMask===0)if(this._inst.HasTilemap())this._CreateTilemapFixtures(fixDef);else this._CreatePolygonFixture(fixDef,instW,instH);else if(this._actualCollisionMask===1)this._CreateBoundingBoxFixture(fixDef,wi,instW,instH);else this._CreateCircleFixture(fixDef, +instW,instH);this._lastWidth=wi.GetWidth();this._lastHeight=wi.GetHeight();wi.SetPhysicsBodyChanged(false);this._Destroy(fixDef)}_CreateBoundingBoxFixture(fixDef,wi,instW,instH){const b2PolygonShape=this._box2d["b2PolygonShape"];const shape=new b2PolygonShape;const fixWidth=instW*this._worldScale;const fixHeight=instH*this._worldScale;let originX=wi.GetOriginX();let originY=wi.GetOriginY();if(wi.GetWidth()<0)originX=1-originX;if(wi.GetHeight()<0)originY=1-originY;const fixOriginX=(.5-originX)*fixWidth; +const fixOriginY=(.5-originY)*fixHeight;const originVec=C3.Behaviors.Physics.GetVec2(fixOriginX,fixOriginY);shape["SetAsBox"](fixWidth/2,fixHeight/2,originVec,0);fixDef["set_shape"](shape);this._CreateFixture(fixDef);this._Destroy(shape);C3.Behaviors.Physics.FreeVec2(originVec)}_CreateCircleFixture(fixDef,instW,instH){const b2CircleShape=this._box2d["b2CircleShape"];const shape=new b2CircleShape;shape["set_m_radius"](Math.min(instW,instH)*this._worldScale*.5);fixDef["set_shape"](shape);this._CreateFixture(fixDef); +this._Destroy(shape)}_CreatePolygonFixture(fixDef,instW,instH){const wi=this.GetWorldInfo();const isMirrored=wi.GetWidth()<0;const isFlipped=wi.GetHeight()<0;const worldScale=this._worldScale;const transformedPoly=wi.GetCustomTransformedCollisionPoly(isMirrored?-instW:instW,isFlipped?-instH:instH,0);const ptsArr=transformedPoly.pointsArr();const ptsCount=ptsArr.length/2;const arr=[];for(let i=0;i1/30)dt=1/30}const tickCount=runtime.GetTickCountNoSave();if(tickCount>behavior.GetLastUpdateTick()&&runtime.GetTimeScale()>0){const isDebug=this._runtime.IsDebug();let startTime=0;if(isDebug)startTime=performance.now();if(dt!==0)this._world["Step"](dt,behavior.GetVelocityIterations(),behavior.GetPositionIterations());this._world["ClearForces"]();if(isDebug)self.C3Debugger.AddPhysicsTime(performance.now()- +startTime);behavior.SetLastUpdateTick(tickCount)}this._UpdateBodyToMatchInstance(true)}_UpdateBodyToMatchInstance(isTickUpdate){const inst=this._inst;const wi=inst.GetWorldInfo();const worldScale=this._worldScale;if(wi.GetWidth()!==this._lastWidth||wi.GetHeight()!==this._lastHeight||wi.IsPhysicsBodyChanged())this._CreateBody();const body=this._body;const curX=wi.GetX();const curY=wi.GetY();const diffX=curX-this._lastKnownX;const diffY=curY-this._lastKnownY;const POS_EPSILON=.001;const posChanged= +Math.abs(diffX)>POS_EPSILON||Math.abs(diffY)>POS_EPSILON;const angleChanged=wi.GetAngle()!==this._lastKnownAngle;let newBodyX=curX;let newBodyY=curY;if(this._actualCollisionMask===2){const bquad=this._GetBoundingQuadExcludingMesh();newBodyX=bquad.midX();newBodyY=bquad.midY()}if(posChanged){if(angleChanged)body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),wi.GetAngle());else body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),body["GetAngle"]());if(isTickUpdate){body["SetLinearVelocity"](GetTempVec2A(diffX, +diffY));this._lastTickOverride=true}body["SetAwake"](true)}else if(isTickUpdate&&this._lastTickOverride){this._lastTickOverride=false;body["SetLinearVelocity"](GetTempVec2A(0,0));body["SetTransform"](GetTempVec2A(newBodyX*worldScale,newBodyY*worldScale),body["GetAngle"]())}if(!posChanged&&angleChanged){body["SetTransform"](body["GetPosition"](),wi.GetAngle());body["SetAwake"](true)}const pos=body["GetPosition"]();const newX=pos["get_x"]()/worldScale;const newY=pos["get_y"]()/worldScale;const newAngle= +body["GetAngle"]();if(newX!==wi.GetX()||newY!==wi.GetY()||newAngle!==wi.GetAngle()){wi.SetXY(newX,newY);wi.SetAngle(newAngle);wi.SetBboxChanged();if(this._actualCollisionMask===2){const bquad=this._GetBoundingQuadExcludingMesh();const dx=bquad.midX()-wi.GetX();const dy=bquad.midY()-wi.GetY();if(dx!==0||dy!==0){wi.OffsetXY(-dx,-dy);wi.SetBboxChanged()}}}this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastKnownAngle=wi.GetAngle()}GetPropertyValueByIndex(index){switch(index){case PREVENT_ROTATION:return this._IsPreventRotate(); +case DENSITY:return this._GetDensity();case FRICTION:return this._GetFriction();case ELASTICITY:return this._GetElasticity();case LINEAR_DAMPING:return this._GetLinearDamping();case ANGULAR_DAMPING:return this._GetAngularDamping();case BULLET:return this._IsBullet();case ENABLE:return this._IsEnabled()}}SetPropertyValueByIndex(index,value){switch(index){case PREVENT_ROTATION:this._SetPreventRotate(value);break;case DENSITY:this._SetDensity(value);break;case FRICTION:this._SetFriction(value);break; +case ELASTICITY:this._SetElasticity(value);break;case LINEAR_DAMPING:this._SetLinearDamping(value);break;case ANGULAR_DAMPING:this._SetAngularDamping(value);break;case BULLET:this._SetBullet(value);break;case ENABLE:this._SetEnabled(value);break}}_SetEnabled(e){e=!!e;if(this._isEnabled&&!e){this._RemoveOtherInstanceJointsToMe();this._DestroyBody();this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){this._isEnabled=true;this._CreateBody();this._StartTicking()}}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){const prefix= +"behaviors.physics";const props=[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)},{name:prefix+".properties.immovable.name",value:this._IsImmovable(),onedit:v=>this._SetImmovable(v)},{name:prefix+".properties.density.name",value:this._GetDensity(),onedit:v=>this._SetDensity(v)},{name:prefix+".properties.friction.name",value:this._GetFriction(),onedit:v=>this._SetFriction(v)},{name:prefix+".properties.elasticity.name",value:this._GetElasticity(),onedit:v=> +this._SetElasticity(v)},{name:prefix+".properties.linear-damping.name",value:this._GetLinearDamping(),onedit:v=>this._SetLinearDamping(v)},{name:prefix+".properties.angular-damping.name",value:this._GetAngularDamping(),onedit:v=>this._SetAngularDamping(v)}];if(this._isEnabled){props.push({name:prefix+".debugger.is-sleeping",value:this._IsSleeping()});props.push({name:prefix+".debugger.velocity-x",value:this._GetVelocityX(),onedit:v=>this._SetVelocity(v,this._GetVelocityY())});props.push({name:prefix+ +".debugger.velocity-y",value:this._GetVelocityY(),onedit:v=>this._SetVelocity(this._GetVelocityX(),v)});props.push({name:prefix+".debugger.angular-velocity",value:C3.toDegrees(this._GetAngularVelocity()),onedit:v=>this._SetAngularVelocity(C3.toRadians(v))});props.push({name:prefix+".debugger.mass",value:this._GetMass()})}return[{title:"$"+this.GetBehaviorType().GetName(),properties:props}]}_ApplyForce(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(fx,fy,x,y)}_ApplyForceToward(f, +px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyForceAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyForce(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyForce(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyForce"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale),true)}_ApplyImpulse(fx,fy,imgPt){const [x,y]=this._GetInstImagePoint(imgPt); +this._DoApplyImpulse(fx,fy,x,y)}_ApplyImpulseToward(f,px,py,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);const a=C3.angleTo(x,y,px,py);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_ApplyImpulseAtAngle(f,a,imgPt){const [x,y]=this._GetInstImagePoint(imgPt);this._DoApplyImpulse(Math.cos(a)*f,Math.sin(a)*f,x,y)}_DoApplyImpulse(fx,fy,ox,oy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["ApplyLinearImpulse"](GetTempVec2A(fx,fy),GetTempVec2B(ox*worldScale,oy*worldScale), +true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_ApplyTorque(m){if(!this._isEnabled)return;this._body["ApplyTorque"](m,true)}_ApplyTorqueToAngle(m,a){const f=C3.angleClockwise(this.GetWorldInfo().GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_ApplyTorqueToPosition(m,x,y){const wi=this.GetWorldInfo();const a=C3.angleTo(wi.GetX(),wi.GetY(),x,y);const f=C3.angleClockwise(wi.GetAngle(),a)?-1:1;this._ApplyTorque(m*f)}_SetAngularVelocity(v){if(!this._isEnabled)return; +this._body["SetAngularVelocity"](v);this._body["SetAwake"](true)}_GetAngularVelocity(){return this._isEnabled?this._body["GetAngularVelocity"]():0}_SetVelocity(vx,vy){if(!this._isEnabled)return;const worldScale=this._worldScale;this._body["SetLinearVelocity"](GetTempVec2A(vx*worldScale,vy*worldScale));this._body["SetAwake"](true);const wi=this.GetWorldInfo();this._lastKnownX=wi.GetX();this._lastKnownY=wi.GetY();this._lastTickOverride=false}_GetVelocity(){if(!this._isEnabled)return[0,0];const worldScale= +this._worldScale;const vec=this._body["GetLinearVelocity"]();return[vec["get_x"]()/worldScale,vec["get_y"]()/worldScale]}_GetVelocityX(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_x"]()/this._worldScale:0}_GetVelocityY(){return this._isEnabled?this._body["GetLinearVelocity"]()["get_y"]()/this._worldScale:0}_SetDensity(d){if(!this._isEnabled)return;if(this._density===d)return;this._density=d;for(const fixture of this._fixtures)fixture["SetDensity"](d);this._body["ResetMassData"]()}_GetDensity(){return this._isEnabled? +this._density:0}_SetFriction(f){if(!this._isEnabled)return;if(this._friction===f)return;this._friction=f;for(const fixture of this._fixtures)fixture["SetFriction"](f);for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(contact)contact["ResetFriction"]()}}_GetFriction(){return this._isEnabled?this._friction:0}_SetElasticity(e){if(!this._isEnabled)return;if(this._restitution=== +e)return;this._restitution=e;for(const fixture of this._fixtures)fixture["SetRestitution"](e)}_GetElasticity(){return this._isEnabled?this._restitution:0}_SetLinearDamping(ld){if(!this._isEnabled)return;if(this._linearDamping===ld)return;this._linearDamping=ld;this._body["SetLinearDamping"](ld)}_GetLinearDamping(){return this._isEnabled?this._linearDamping:0}_SetAngularDamping(ad){if(!this._isEnabled)return;if(this._angularDamping===ad)return;this._angularDamping=ad;this._body["SetAngularDamping"](ad)}_GetAngularDamping(){return this._isEnabled? +this._angularDamping:0}_SetImmovable(i){if(!this._isEnabled)return;i=!!i;if(this._isImmovable===i)return;this._isImmovable=i;this._body["SetType"](this._isImmovable?0:2);this._body["SetAwake"](true)}_IsImmovable(){return this._isImmovable}_SetPreventRotate(i){if(!this._isEnabled)return;i=!!i;if(this._preventRotation===i)return;this._preventRotation=i;this._body["SetFixedRotation"](this._preventRotation);this._body["SetAngularVelocity"](0);this._body["SetAwake"](true)}_IsPreventRotate(){return this._preventRotation}_SetBullet(i){if(!this._isEnabled)return; +i=!!i;if(this._isBullet===i)return;this._isBullet=i;this._body["SetBullet"](this._isBullet);this._body["SetAwake"](true)}_IsBullet(){return this._isBullet}_GetMass(){return this._isEnabled?this._body["GetMass"]()/this._worldScale:0}_GetCenterOfMassX(){return this._isEnabled?(this._body["GetPosition"]()["get_x"]()+this._body["GetLocalCenter"]()["get_x"]())/this._worldScale:0}_GetCenterOfMassY(){return this._isEnabled?(this._body["GetPosition"]()["get_y"]()+this._body["GetLocalCenter"]()["get_y"]())/ +this._worldScale:0}_GetCenterOfMass(){if(!this._isEnabled)return[0,0];const posVec=this._body["GetPosition"]();const centerVec=this._body["GetLocalCenter"]();const worldScale=this._worldScale;return[(posVec["get_x"]()+centerVec["get_x"]())/worldScale,(posVec["get_y"]()+centerVec["get_y"]())/worldScale]}_IsSleeping(){return this._isEnabled?!this._body["IsAwake"]():false}_GetContactCount(){if(!this._isEnabled)return 0;let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge= +contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold=contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();count+=pointCount}return count}_GetContactPositionAt(index){index=Math.floor(index);if(!this._isEnabled)return[0,0];let count=0;for(let contactEdge=this._body["GetContactList"]();this._box2d["getPointer"](contactEdge);contactEdge=contactEdge["get_next"]()){const contact=contactEdge["get_contact"]();if(!contact)continue;const manifold= +contact["GetManifold"]();const pointCount=manifold["get_pointCount"]();if(index>=count&&index=px&&px>=x2-.1||x1-.1<=px&&px<=x2+.1;const b2=y1+.1>=py&&py>=y2-.1||y1-.1<=py&&py<=y2+.1;return b1&&b2&&b2Separator.isOnLine(px,py,x1,y1,x2,y2)};b2Separator.isOnLine=function(px,py,x1,y1,x2,y2){if(Math.abs(x2-x1)>.1){const a=(y2-y1)/(x2-x1);const possibleY=a*(px-x1)+y1;const diff=Math.abs(possibleY-py);return diff<.1}return Math.abs(px-x1)<.1}; +b2Separator.pointsMatch=function(x1,y1,x2,y2){return Math.abs(x2-x1)<.1&&Math.abs(y2-y1)<.1}; +b2Separator.Separate=function(verticesVec,objarea){const calced=b2Separator.calcShapes(verticesVec);let ret=[];for(let i=0,len=calced.length;i=objarea*.001)ret.push(poly);else for(let j=0,lenj=poly.length;j=n)return[];if(!b2Separator.isOnSegment(v2["get_x"](),v2["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p1["get_x"](),p1["get_y"]()))vec1.push(vec[k]);break}h=k;if(k-1<0)k=n-1;else k--}vec1.reverse();h=-1;k=i2;while(true){if(k!== +j1)vec2.push(vec[k]);else{if(h<0||h>=n)return[];if(k===j1&&!b2Separator.isOnSegment(v1["get_x"](),v1["get_y"](),vec[h]["get_x"](),vec[h]["get_y"](),p2["get_x"](),p2["get_y"]()))vec2.push(vec[k]);break}h=k;if(k+1>n-1)k=0;else k++}queue.push(vec1,vec2);queue.shift();break}}if(isConvex)figsVec.push(queue.shift())}return figsVec}; +function SplitConvexPolysOver8Points(convexPolys){const ret=[];for(const arr of convexPolys)if(arr.length<=8)ret.push(arr);else ret.push.apply(ret,SplitConvexPoly(arr));return ret}function SplitConvexPoly(arr){const ret=[];ret.push(arr.splice(0,8));const first=ret[0][0];let last=ret[0][7];while(arr.length){const poly=arr.splice(0,Math.min(arr.length,6));let nextLast=poly.at(-1);poly.push(CloneVec2(first));poly.push(CloneVec2(last));ret.push(poly);last=nextLast}return ret}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Pin=class PinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Pin.Type=class PinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;C3.Behaviors.Pin.Instance=class PinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._pinDist=0;this._pinAngle=0;this._pinImagePoint=0;this._dx=0;this._dy=0;this._dWidth=0;this._dHeight=0;this._dAngle=0;this._dz=0;this._lastKnownAngle=0;this._destroy=false;if(properties)this._destroy=properties[0];const rt=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt, +"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),C3.Disposable.From(rt,"afterload",e=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(inst){if(inst){this._pinInst=inst;this._StartTicking2()}else{this._pinInst=null;this._StopTicking2()}}_Pin(objectClass,mode,propList){if(!objectClass)return;const otherInst=objectClass.GetFirstPicked(this._inst);if(!otherInst)return;this._mode=mode;this._SetPinInst(otherInst);const myWi=this._inst.GetWorldInfo();const otherWi= +otherInst.GetWorldInfo();if(this._mode==="properties"){const propSet=this._propSet;propSet.clear();for(const p of propList)propSet.add(p);this._dx=myWi.GetX()-otherWi.GetX();this._dy=myWi.GetY()-otherWi.GetY();this._dAngle=myWi.GetAngle()-otherWi.GetAngle();this._lastKnownAngle=myWi.GetAngle();this._dz=myWi.GetZElevation()-otherWi.GetZElevation();if(propSet.has("x")&&propSet.has("y")){this._pinAngle=C3.angleTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())-otherWi.GetAngle();this._pinDist= +C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}if(propSet.has("width-abs"))this._dWidth=myWi.GetWidth()-otherWi.GetWidth();else if(propSet.has("width-scale"))this._dWidth=myWi.GetWidth()/otherWi.GetWidth();if(propSet.has("height-abs"))this._dHeight=myWi.GetHeight()-otherWi.GetHeight();else if(propSet.has("height-scale"))this._dHeight=myWi.GetHeight()/otherWi.GetHeight()}else this._pinDist=C3.distanceTo(otherWi.GetX(),otherWi.GetY(),myWi.GetX(),myWi.GetY())}SaveToJson(){const propSet= +this._propSet;const mode=this._mode;const ret={"uid":this._pinInst?this._pinInst.GetUID():-1,"m":mode,"d":this._destroy};if(mode==="rope"||mode==="bar")ret["pd"]=this._pinDist;else if(mode==="properties"){ret["ps"]=[...this._propSet];if(propSet.has("imagepoint"))ret["ip"]=this._pinImagePoint;else if(propSet.has("x")&&propSet.has("y")){ret["pa"]=this._pinAngle;ret["pd"]=this._pinDist}else{if(propSet.has("x"))ret["dx"]=this._dx;if(propSet.has("y"))ret["dy"]=this._dy}if(propSet.has("angle")){ret["da"]= +this._dAngle;ret["lka"]=this._lastKnownAngle}if(propSet.has("width-abs")||propSet.has("width-scale"))ret["dw"]=this._dWidth;if(propSet.has("height-abs")||propSet.has("height-scale"))ret["dh"]=this._dHeight;if(propSet.has("z"))ret["dz"]=this._dz}return ret}LoadFromJson(o){const mode=o["m"];const propSet=this._propSet;propSet.clear();this._pinUid=o["uid"];if(typeof mode==="number"){this._LoadFromJson_Legacy(o);return}this._mode=mode;if(o.hasOwnProperty("d"))this._destroy=!!o["d"];if(mode==="rope"|| +mode==="bar")this._pinDist=o["pd"];else if(mode==="properties"){for(const p of o["ps"])propSet.add(p);if(propSet.has("imagepoint"))this._pinImagePoint=o["ip"];else if(propSet.has("x")&&propSet.has("y")){this._pinAngle=o["pa"];this._pinDist=o["pd"]}else{if(propSet.has("x"))this._dx=o["dx"];if(propSet.has("y"))this._dy=o["dy"]}if(propSet.has("angle")){this._dAngle=o["da"];this._lastKnownAngle=o["lka"]||0}if(propSet.has("width-abs")||propSet.has("width-scale"))this._dWidth=o["dw"];if(propSet.has("height-abs")|| +propSet.has("height-scale"))this._dHeight=o["dh"];if(propSet.has("z"))this._dz=o["dz"]}}_LoadFromJson_Legacy(o){const propSet=this._propSet;const myStartAngle=o["msa"];const theirStartAngle=o["tsa"];const pinAngle=o["pa"];const pinDist=o["pd"];const mode=o["m"];switch(mode){case 0:this._mode="properties";propSet.add("x").add("y").add("angle");this._pinAngle=pinAngle;this._pinDist=pinDist;this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 1:this._mode="properties";propSet.add("x").add("y"); +this._pinAngle=pinAngle;this._pinDist=pinDist;break;case 2:this._mode="properties";propSet.add("angle");this._dAngle=myStartAngle-theirStartAngle;this._lastKnownAngle=o["lka"];break;case 3:this._mode="rope";this._pinDist=o["pd"];break;case 4:this._mode="bar";this._pinDist=o["pd"];break}}_OnAfterLoad(){if(this._pinUid===-1)this._SetPinInst(null);else{this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid));this._pinUid=-1}}_OnInstanceDestroyed(inst){if(this._pinInst===inst){this._SetPinInst(null); +if(this._destroy)this._runtime.DestroyInstance(this._inst)}}Tick2(){const pinInst=this._pinInst;if(!pinInst)return;const pinWi=pinInst.GetWorldInfo();const myInst=this._inst;const myWi=myInst.GetWorldInfo();const mode=this._mode;let bboxChanged=false;if(mode==="rope"||mode==="bar"){const dist=C3.distanceTo(myWi.GetX(),myWi.GetY(),pinWi.GetX(),pinWi.GetY());if(dist>this._pinDist||mode==="bar"&&dist=this._duration}Update(){if(this.HasFinished())if(this._isRegular)this._current.Subtract(this._duration);else return true;return false}SaveToJson(){return{"c":this._current.Get(),"t":this._total.Get(),"d":this._duration,"r":this._isRegular,"p":this._isPaused}}LoadFromJson(o){this._current.Set(o["c"]);this._total.Set(o["t"]);this._duration=o["d"];this._isRegular=!!o["r"];this._isPaused= +!!o["p"]}};C3.Behaviors.Timer.Instance=class TimerInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._timers=new Map}Release(){this._timers.clear();super.Release()}_StartTimer(duration,name,isRegular){const timer=new C3.Behaviors.Timer.SingleTimer(0,0,duration,isRegular);this._timers.set(name.toLowerCase(),timer);this._UpdateTickState()}_StopTimer(name){this._timers.delete(name.toLowerCase());this._UpdateTickState()}_StopAllTimers(){this._timers.clear(); +this._UpdateTickState()}_IsTimerRunning(name){return this._timers.has(name.toLowerCase())}_GetTimerCurrentTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetCurrentTime():0}_GetTimerTotalTime(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetTotalTime():0}_GetTimerDuration(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.GetDuration():0}_HasTimerFinished(name){const timer=this._timers.get(name.toLowerCase());return timer? +timer.HasFinished():false}_SetTimerPaused(name,isPaused){const timer=this._timers.get(name.toLowerCase());if(timer)timer.SetPaused(isPaused)}_IsTimerPaused(name){const timer=this._timers.get(name.toLowerCase());return timer?timer.IsPaused():false}_UpdateTickState(){if(this._timers.size>0){this._StartTicking();this._StartTicking2()}else{this._StopTicking();this._StopTicking2()}}SaveToJson(){const ret={};for(const [name,timer]of this._timers.entries())ret[name]=timer.SaveToJson();return ret}LoadFromJson(o){this._timers.clear(); +for(const [name,data]of Object.entries(o)){const timer=new C3.Behaviors.Timer.SingleTimer;timer.LoadFromJson(data);this._timers.set(name,timer)}this._UpdateTickState()}Tick(){const dt=this._runtime.GetDt(this._inst);for(const [name,timer]of this._timers)if(!timer.IsPaused()){timer.Add(dt);if(timer.HasFinished())this.DispatchScriptEvent("timer",false,{tag:name})}}Tick2(){for(const [name,timer]of this._timers.entries()){const shouldDelete=timer.Update();if(shouldDelete)this._timers.delete(name)}}GetDebuggerProperties(){return[{title:"behaviors.timer.debugger.timers", +properties:[...this._timers.entries()].map(entry=>({name:"$"+entry[0],value:`${Math.round(entry[1].GetCurrentTime()*10)/10} / ${Math.round(entry[1].GetDuration()*10)/10}`}))}]}GetScriptInterfaceClass(){return self.ITimerBehaviorInstance}};const map=new WeakMap;const VALID_TIMER_TYPES=["once","regular"];self.ITimerBehaviorInstance=class ITimerBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTimer(duration,name,type= +"once"){C3X.RequireFiniteNumber(duration);C3X.RequireString(name);const i=VALID_TIMER_TYPES.indexOf(type);if(i===-1)throw new Error("invalid type");map.get(this)._StartTimer(duration,name,i===1)}setTimerPaused(name,isPaused){C3X.RequireString(name);map.get(this)._SetTimerPaused(name,!!isPaused)}stopTimer(name){C3X.RequireString(name);map.get(this)._StopTimer(name)}stopAllTimers(){map.get(this)._StopAllTimers()}isTimerRunning(name){C3X.RequireString(name);return map.get(this)._IsTimerRunning(name)}isTimerPaused(name){C3X.RequireString(name); +return map.get(this)._IsTimerPaused(name)}getCurrentTime(name){C3X.RequireString(name);return map.get(this)._GetTimerCurrentTime(name)}getTotalTime(name){C3X.RequireString(name);return map.get(this)._GetTimerTotalTime(name)}getDuration(name){C3X.RequireString(name);return map.get(this)._GetTimerDuration(name)}hasFinished(name){C3X.RequireString(name);return map.get(this)._HasTimerFinished(name)}}} +{const C3=self.C3;C3.Behaviors.Timer.Cnds={OnTimer(name){return this._HasTimerFinished(name)},IsTimerRunning(name){return this._IsTimerRunning(name)},IsTimerPaused(name){return this._IsTimerPaused(name)}}}{const C3=self.C3;C3.Behaviors.Timer.Acts={StartTimer(duration,type,name){this._StartTimer(duration,name,type===1)},StopTimer(name){this._StopTimer(name)},StopAllTimers(){this._StopAllTimers()},PauseResumeTimer(name,state){this._SetTimerPaused(name,state===0)}}} +{const C3=self.C3;C3.Behaviors.Timer.Exps={CurrentTime(name){return this._GetTimerCurrentTime(name)},TotalTime(name){return this._GetTimerTotalTime(name)},Duration(name){return this._GetTimerDuration(name)}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Tween=class TweenBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Tween.Type=class TweenType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const ENABLED=0;NAMESPACE.Instance=class TweenInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._allowMultiple=false;this._enabled=true;if(properties){this._allowMultiple=false;this._enabled=!!properties[ENABLED]}this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._finishingTween=null;this._activeTweensJson=null;this._disabledTweensJson=null;this._waitingForReleaseTweensJson= +null;this._finishingTweenName="";this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;if(this._finishingTween){this.ReleaseAndCompleteTween(this._finishingTween);this._finishingTween=null}this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens= +null;super.Release()}SetEnabled(e){this._enabled=!!e;if(e){if(this._waitingForReleaseTweens&&this._waitingForReleaseTweens.size)this._StartTicking2()}else this._StopTicking2();for(const tween of this.AllTweens())if(e){if(this.IsInDisabledList(tween))tween.Resume()}else{if(tween.IsPlaying()||tween.IsScheduled())this.AddToDisabledList(tween);tween.Stop()}if(e)this.ClearDisabledList()}IsEnabled(){return this._enabled}AddToDisabledList(tween){this._disabledTweens.push(tween)}IsInDisabledList(tween){return this._disabledTweens.includes(tween)}ClearDisabledList(){C3.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const inst= +this.GetObjectInstance();if(!inst)return false;return!inst.IsDestroyed()}GetTween(tags,property,includeWaitingForRelease=false){const tweens=property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(!tweens||!tweens.length)return;for(const tween of tweens)if(tween.HasTags(tags))return tween}GetTweenIncludingWaitingForRelease(tags,property){return this.GetTween(tags,property,true)}*GetTweens(tags,property,includeWaitingForRelease=false){const tweens= +property?this.PropertyTweens(property,includeWaitingForRelease):this.AllTweens(includeWaitingForRelease);if(tweens&&tweens.length)for(const tween of tweens)if(tween.HasTags(tags))yield tween}*GetTweensIncludingWaitingForRelease(tags,property){yield*this.GetTweens(tags,property,true)}PropertyTweens(property,includeWaitingForRelease){if(includeWaitingForRelease){let active=this._activeTweens.get(property);let waitingForRelease=this._waitingForReleaseTweens.get(property);if(!active)active=[];if(!waitingForRelease)waitingForRelease= +[];return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{let active=this._activeTweens.get(property);if(!active)active=[];return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweens(includeWaitingForRelease){if(includeWaitingForRelease){const active=[...this._activeTweens.values()].flat();const waitingForRelease=[...this._waitingForReleaseTweens.values()].flat();return active.concat(waitingForRelease).filter(t=>t).filter(t=>!t.IsReleased())}else{const active=[...this._activeTweens.values()].flat(); +return active.filter(t=>t).filter(t=>!t.IsReleased())}}AllTweensIncludingWaitingForRelease(){return this.AllTweens(true)}SaveToJson(){return{"s":false,"e":!!this._enabled,"at":this._SaveActiveTweensToJson(),"dt":this._SaveDisabledTweensToJson(),"wt":this._SaveWaitingForReleaseTweensToJson(),"ft":this._SaveFinishingTweenToJson()}}LoadFromJson(o){if(!o)return;this._activeTweensJson=o["at"];this._disabledTweensJson=o["dt"];this._waitingForReleaseTweensJson=o["wt"];this._finishingTweenName=o["ft"];this._allowMultiple= +false;this._enabled=!!o["e"]}_OnAfterLoad(e){const timelineManager=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,timelineManager);if(this._disabledTweensJson){C3.clearArray(this._disabledTweens);for(const tweenName of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,tweenName,timelineManager)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,timelineManager);this._finishingTween=this._GetTween(this._finishingTweenName, +timelineManager);if(this._enabled){if(this._waitingForReleaseTweens&&this._waitingForReleaseTweens.size)this._StartTicking2()}else this._StopTicking2()}_PopulateTweenMap(restoreJson,map,timelineManager){if(!restoreJson)return;for(const property in restoreJson){let tweens=map.get(property);tweens?C3.clearArray(tweens):tweens=[];const tweensJson=restoreJson[property];for(const tweenJson of tweensJson){const success=this._PopulateTweenArray(tweens,tweenJson["name"],timelineManager);if(!success){const tween= +C3.TweenState.Build({runtime:this.GetRuntime(),json:tweenJson});tween.AddCompletedCallback(tween=>this._FinishTriggers(tween));timelineManager.AddScheduledTimeline(tween);this._PopulateTweenArray(tweens,tween,timelineManager)}else this._LoadTweenFromJson(tweenJson["name"],tweenJson,timelineManager)}map.set(property,tweens)}}_GetTween(name,timelineManager){return timelineManager.GetScheduledOrPlayingTimelineByName(name)}_PopulateTweenArray(collection,tweenOrName,timelineManager){if(typeof tweenOrName=== +"string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)return!!collection.push(tween)}else return!!collection.push(tweenOrName);return false}_LoadTweenFromJson(tweenOrName,tweenJson,timelineManager){if(typeof tweenOrName==="string"){const tween=this._GetTween(tweenOrName,timelineManager);if(tween)tween._LoadFromJson(tweenJson)}else tweenOrName._LoadFromJson(tweenJson)}_SaveActiveTweensToJson(){const ret={};for(const [property,tweens]of this._activeTweens)ret[property]=tweens.filter(t=> +!t.IsReleased()).map(t=>t._SaveToJson());return ret}_SaveDisabledTweensToJson(){return this._disabledTweens.filter(t=>!t.IsReleased()).map(t=>t.GetName())}_SaveWaitingForReleaseTweensToJson(){const ret={};for(const [property,tweens]of this._waitingForReleaseTweens)ret[property]=tweens.map(tween=>tween._SaveToJson());return ret}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(args){const propertyTracksConfig= +NAMESPACE.Config.GetPropertyTracksConfig(args.property,args.startValue,args.endValue,args.ease,args.resultMode,this.GetObjectInstance());const tweenId=NAMESPACE.Maps.GetPropertyFromIndex(args.property);if(!NAMESPACE.Maps.IsValueId(tweenId))this.ReleaseTweens(args.property);const tween=C3.TweenState.Build({runtime:this.GetRuntime(),id:tweenId,tags:args.tags,time:args.time,instance:this.GetObjectInstance(),releaseOnComplete:!!args.releaseOnComplete,loop:!!args.loop,pingPong:!!args.pingPong,repeatCount:args.repeatCount, +initialValueMode:args.initialValueMode,propertyTracksConfig:propertyTracksConfig});tween.AddCompletedCallback(tween=>this._FinishTriggers(tween));this._AddTween(tween,args.property);return tween}_MaybeRemoveFromActiveTweenMap(tween){const id=tween.GetId();if(this._activeTweens.has(id)){const tweenArray=this._activeTweens.get(id);if(tweenArray){const index=tweenArray.indexOf(tween);if(index!==-1)tweenArray.splice(index,1)}}}ReleaseTween(tween,complete=false){this._MaybeRemoveFromActiveTweenMap(tween); +if(tween.IsReleased())return;if(this._IsInWaitingList(tween))return;tween.Stop(complete);this._AddToWaitingList(tween)}ReleaseTweens(indexProperty,complete=false){if(C3.IsFiniteNumber(indexProperty)){const stringProperty=NAMESPACE.Maps.GetPropertyFromIndex(indexProperty);if(!this._activeTweens.has(stringProperty))return;const tweenArray=this._activeTweens.get(stringProperty);const finishingTween=this.GetFinishingTween();for(const tween of tweenArray){if(tween===finishingTween)continue;if(tween.IsReleased())continue; +if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}C3.clearArray(tweenArray)}else{const finishingTween=this.GetFinishingTween();for(const tween of this.AllTweens()){if(tween===finishingTween)continue;if(tween.IsReleased())continue;if(this._IsInWaitingList(tween))continue;tween.Stop(complete);tween.Release()}for(const property of this._activeTweens.keys()){C3.clearArray(this._activeTweens.get(property));this._activeTweens.delete(property)}this._activeTweens.clear()}}ReleaseAndCompleteTween(tween){this.ReleaseTween(tween, +true)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,true)}GetPropertyValueByIndex(index){switch(index){case ENABLED:return this._enabled}}SetPropertyValueByIndex(index,value){switch(index){case ENABLED:this._enabled=!!value;break}}_GetBehaviorType(tween){const instance=tween.GetInstance();const behaviorInstances=instance.GetBehaviorInstances();for(const behaviorInstance of behaviorInstances){const behaviorType=behaviorInstance.GetBehaviorType();if(behaviorType.GetInstanceSdkCtor()===this.constructor)return behaviorType}}Trigger(method, +runtime,inst,behaviorType){if(this._runtime)return super.Trigger(method);else return runtime.Trigger(method,inst,behaviorType)}_FinishTriggers(tween){this._finishingTween=tween;NAMESPACE.Cnds.SetFinishingTween(tween);let instance;let runtime;if(!this.GetRuntime()){instance=tween.GetInstance();if(!instance)return;if(instance&&instance.IsDestroyed())return;runtime=instance.GetRuntime();const behaviorType=this._GetBehaviorType(tween);this.Trigger(NAMESPACE.Cnds.OnTweensFinished,runtime,instance,behaviorType); +this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished,runtime,instance,behaviorType);tween.Stop()}else{instance=this._inst;runtime=this._runtime;this.Trigger(NAMESPACE.Cnds.OnTweensFinished);this.Trigger(NAMESPACE.Cnds.OnAnyTweensFinished);this.ReleaseTween(tween)}this._finishingTween=null;NAMESPACE.Cnds.SetFinishingTween(null);if(tween.GetDestroyInstanceOnComplete())runtime.DestroyInstance(instance)}_AddTween(tween,indexProperty){const stringProperty=NAMESPACE.Maps.GetPropertyFromIndex(indexProperty); +if(!this._activeTweens.has(stringProperty))this._activeTweens.set(stringProperty,[]);const tweenArray=this._activeTweens.get(stringProperty);tweenArray.push(tween)}_AddToWaitingList(tween){const id=tween.GetId();if(!this._waitingForReleaseTweens.has(id))this._waitingForReleaseTweens.set(id,[]);this._waitingForReleaseTweens.get(id).push(tween);if(!this.IsTicking2())this._StartTicking2()}_IsInWaitingList(tween){const id=tween.GetId();if(!this._waitingForReleaseTweens.has(id))return false;return this._waitingForReleaseTweens.get(id).includes(tween)}_ReleaseWaitingTweens(){if(!this._waitingForReleaseTweens.size)return; +for(const tweenArray of this._waitingForReleaseTweens.values()){for(const tween of tweenArray){if(tween.IsReleased())continue;tween.Release()}C3.clearArray(tweenArray)}this._waitingForReleaseTweens.clear();if(this.IsTicking2())this._StopTicking2()}GetDebuggerProperties(){const prefix="behaviors.tween";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this.IsEnabled(),onedit:v=>this.SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.ITweenBehaviorInstance}}} +{const C3=self.C3;let finishingTween=null;C3.Behaviors.Tween.Cnds={SetFinishingTween(tween){finishingTween=tween},OnTweensFinished(tags){return finishingTween.HasTags(tags)},OnAnyTweensFinished(){return true},IsPlaying(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPlaying)},IsAnyPlaying(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false; +return tweens.some(C3.TweenState.IsPlaying)},IsPaused(tags){const tweens=[...this.GetTweensIncludingWaitingForRelease(tags)];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)},IsAnyPaused(){const tweens=[...this.AllTweensIncludingWaitingForRelease()];if(!tweens)return false;if(!tweens.length)return false;return tweens.some(C3.TweenState.IsPaused)}}} +{const C3=self.C3;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.Acts={SetEnabled(enable){this.SetEnabled(!!enable)},async TweenOneProperty(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.OneProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},async TweenTwoProperties(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.TwoProperties(this, +...args));if(tween.Play())await tween.GetPlayPromise()},async TweenValue(...args){if(!this.IsEnabled()||!this.IsInstanceValid())return;const tween=this.CreateTween(NAMESPACE.TweenArguments.ValueProperty(this,...args));if(tween.Play())await tween.GetPlayPromise()},PauseTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Stop()},PauseAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Stop()}, +ResumeTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.Resume()},ResumeAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.Resume()},StopTweens(tags){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))this.ReleaseTween(tween)},StopAllTweens(){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())this.ReleaseTween(tween)}, +SetOnePropertyTweensEndValue(tags,property,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;const propertyName=C3.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues([propertyName]);tween.SetEndValue(endValue,propertyName)}},SetTwoPropertiesTweensEndValue(tags,property,endValueX,endValueY){if(!this.IsEnabled()||!this.IsInstanceValid())return;const properties=C3.Behaviors.Tween.Maps.GetRealProperties(property);for(const tween of this.GetTweens(tags)){tween.BeforeSetEndValues(properties); +tween.SetEndValue(endValueX,properties[0]);tween.SetEndValue(endValueY,properties[1])}},SetValuePropertyTweensStartValue(tags,startValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value"))tween.SetStartValue(startValue,"value")},SetValuePropertyTweensEndValue(tags,endValue){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags,"value")){tween.BeforeSetEndValues(["value"]);tween.SetEndValue(endValue,"value")}}, +SetTweensEase(tags,easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.GetTweens(tags))tween.SetEase(ease)},SetAllTweensEase(easeIndex){if(!this.IsEnabled()||!this.IsInstanceValid())return;const ease=Ease.GetEaseFromIndex(easeIndex);for(const tween of this.AllTweens())tween.SetEase(ease)},SetTweensTime(tags,time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetTime(time)}, +SetAllTweensTime(time){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetTime(time)},SetTweensPlaybackRate(tags,rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetPlaybackRate(rate)},SetAllTweensPlaybackRate(rate){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetPlaybackRate(rate)},SetTweensDestroyOnComplete(tags,destroyOnComplete){if(!this.IsEnabled()|| +!this.IsInstanceValid())return;for(const tween of this.GetTweens(tags))tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)},SetAllTweensDestroyOnComplete(destroyOnComplete){if(!this.IsEnabled()||!this.IsInstanceValid())return;for(const tween of this.AllTweens())tween.SetDestroyInstanceOnComplete(!!destroyOnComplete)}}} +{const C3=self.C3;C3.Behaviors.Tween.Exps={Time(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()},Progress(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags);if(!tween)return 0;return tween.GetTime()/tween.GetTotalTime()},Value(tags){const tween=this.GetTweenIncludingWaitingForRelease(tags,"value");if(!tween)return 0;return tween.GetPropertyTrack("value").GetSourceAdapterValue()},Tags(){if(!this.GetFinishingTween())return"";return this.GetFinishingTween().GetStringTags()}}}; + +} + +{ +'use strict';const C3=self.C3;const Ease=self.Ease;const PAIR_PROPERTIES=["position","size","scale"];const SINGLE_PROPERTIES=["offsetX","offsetY","offsetWidth","offsetHeight","offsetAngle","offsetOpacity","offsetColor","offsetZElevation","offsetScaleX","offsetScaleY"];const VALUE_PROPERTIES=["value"];const PROPERTY_INDEX_TO_NAME=[].concat(PAIR_PROPERTIES).concat(SINGLE_PROPERTIES).concat(VALUE_PROPERTIES); +const PROPERTY_PAIR_TO_REAL_PROPERTIES={"position":["offsetX","offsetY"],"size":["offsetWidth","offsetHeight"],"scale":["offsetScaleX","offsetScaleY"]};const ALL_REAL_PROPERTIES=Object.assign({},PROPERTY_INDEX_TO_NAME.reduce((o,key)=>Object.assign({},o,{[key]:[key]}),{}),PROPERTY_PAIR_TO_REAL_PROPERTIES); +C3.Behaviors.Tween.Maps=class Maps{constructor(){}static GetEases(){return[...Ease.GetRuntimeEaseNames()]}static GetEaseFromIndex(index){return[...Ease.GetRuntimeEaseNames()][index]}static GetPropertyFromIndex(index){return PROPERTY_INDEX_TO_NAME[index]}static GetPropertyIndexFromName(name){return PROPERTY_INDEX_TO_NAME.indexOf(name)}static GetPairPropertyFromIndex(index){return PAIR_PROPERTIES[index]}static GetSinglePropertyFromIndex(index){return SINGLE_PROPERTIES[index]}static GetValuePropertyFromIndex(index){return VALUE_PROPERTIES[index]}static GetPairProperties(pairId){return PROPERTY_PAIR_TO_REAL_PROPERTIES[pairId]}static GetRealProperties(id){if(C3.IsString(id))return ALL_REAL_PROPERTIES[id];else return ALL_REAL_PROPERTIES[PROPERTY_INDEX_TO_NAME[id]]}static IsPairId(id){return!!PROPERTY_PAIR_TO_REAL_PROPERTIES[id]}static IsColorId(id){return id=== +"offsetColor"}static IsAngleId(id){return id==="offsetAngle"}static IsOpacityId(id){return id==="offsetOpacity"}static IsValueId(id){return id==="value"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TWEEN_CONFIGURATIONS=new Map; +NAMESPACE.Config=class Config{constructor(){}static GetPropertyTracksConfig(property,startValue,endValue,ease,resultMode,instance){if(TWEEN_CONFIGURATIONS.size===0)this._CreateConfigObjects();const propertyType=NAMESPACE.PropertyTypes.Pick(property);let config=TWEEN_CONFIGURATIONS.get(propertyType);if(C3.IsFiniteNumber(property))property=NAMESPACE.Maps.GetPropertyFromIndex(property);return this._GetConfig(config,property,startValue,endValue,ease,resultMode,instance)}static TransformValue(property, +value){const configFunctionObject=C3.Behaviors.Tween.GetPropertyTracksConfig(property);return configFunctionObject.valueGetter(value)}static _CreateConfigObjects(){const types=NAMESPACE.PropertyTypes;const getters=NAMESPACE.ValueGetters;this._AddConfigObject(types.PAIR,this._GetPairConfig,getters._GetPropertyValue);this._AddConfigObject(types.COLOR,this._GetColorConfig,getters._GetColorPropertyValue);this._AddConfigObject(types.ANGLE,this._GetAngleConfig,getters._GetPropertyAngleValue);this._AddConfigObject(types.VALUE, +this._GetValueConfig,getters._GetPropertyValue);this._AddConfigObject(types.OTHER,this._GetCommonConfig,getters._GetPropertyValue)}static _AddConfigObject(name,configGetter,valueGetter){TWEEN_CONFIGURATIONS.set(name,this._CreateConfigObject(name,configGetter,valueGetter))}static _CreateConfigObject(name,configFunc,valueGetter){return{name:name,configFunc:configFunc,valueGetter:valueGetter}}static _GetConfig(config,property,startValue,endValue,ease,resultMode,instance){return config.configFunc(property, +config.valueGetter(startValue),config.valueGetter(endValue),ease,resultMode,instance)}static _GetPairConfig(property,startValues,endValues,ease,resultMode,instance){const properties=NAMESPACE.Maps.GetPairProperties(property);return properties.map((property,index)=>{return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValues[index],endValue:endValues[index],ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}})}static _GetColorConfig(property, +startValue,endValue,ease,resultMode,instance){if(C3.Plugins.Text&&instance.GetPlugin()instanceof C3.Plugins.Text)return{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode};else return{sourceId:"world-instance",property:property,type:"color",valueType:"color",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetAngleConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"angle",valueType:"angle",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetCommonConfig(property,startValue,endValue,ease,resultMode,instance){return{sourceId:"world-instance",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}static _GetValueConfig(property, +startValue,endValue,ease,resultMode,instance){return{sourceId:"value",property:property,type:"float",valueType:"numeric",startValue:startValue,endValue:endValue,ease:NAMESPACE.Maps.GetEaseFromIndex(ease),resultMode:resultMode}}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const COMMON_FIXED_ARGS={resultMode:"absolute"};const COMMON_VARIABLE_ARGS=Object.assign({},COMMON_FIXED_ARGS,{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:false,pingPong:false,repeatCount:1});const ONE_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:0,endValue:0}); +const TWO_PROPERTIES_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]});const COLOR_PROPERTY_ARGS=Object.assign({},COMMON_VARIABLE_ARGS,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]});const VALUE_PROPERTY_ARGS=Object.assign({},ONE_PROPERTY_ARGS,{initialValueMode:"start-value"});const X=0;const Y=1;const R=0;const G=1;const B=2; +NAMESPACE.TweenArguments=class TweenArguments{constructor(){}static _SetCommonProperties(argsObject,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount){argsObject.tags=tags;argsObject.time=time;argsObject.ease=ease;argsObject.releaseOnComplete=destroyOnComplete;argsObject.loop=loop;argsObject.pingPong=pingPong;argsObject.repeatCount=repeatCount}static OneProperty(inst,tags,property,endValue,time,ease,destroyOnComplete,loop,pingPong,repeatCount){const propertyName=typeof property==="string"? +property:NAMESPACE.Maps.GetSinglePropertyFromIndex(property);const args=NAMESPACE.Maps.IsColorId(propertyName)?COLOR_PROPERTY_ARGS:ONE_PROPERTY_ARGS;this._SetCommonProperties(args,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);if(NAMESPACE.Maps.IsColorId(propertyName)){COLOR_PROPERTY_ARGS.endValue[R]=C3.GetRValue(endValue);COLOR_PROPERTY_ARGS.endValue[G]=C3.GetGValue(endValue);COLOR_PROPERTY_ARGS.endValue[B]=C3.GetBValue(endValue);COLOR_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName)}else if(NAMESPACE.Maps.IsOpacityId(propertyName))ONE_PROPERTY_ARGS.endValue= +endValue/100;else ONE_PROPERTY_ARGS.endValue=endValue;args.property=NAMESPACE.Maps.GetPropertyIndexFromName(propertyName);return args}static TwoProperties(inst,tags,property,endValueX,endValueY,time,ease,destroyOnComplete,loop,pingPong,repeatCount){this._SetCommonProperties(TWO_PROPERTIES_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);const pairName=typeof property==="string"?property:NAMESPACE.Maps.GetPairPropertyFromIndex(property);TWO_PROPERTIES_ARGS.endValue[X]=endValueX;TWO_PROPERTIES_ARGS.endValue[Y]= +endValueY;TWO_PROPERTIES_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName(pairName);return TWO_PROPERTIES_ARGS}static ValueProperty(inst,tags,startValue,endValue,time,ease,destroyOnComplete,loop,pingPong,repeatCount){this._SetCommonProperties(VALUE_PROPERTY_ARGS,tags,time,ease,destroyOnComplete,loop,pingPong,repeatCount);VALUE_PROPERTY_ARGS.startValue=startValue;VALUE_PROPERTY_ARGS.endValue=endValue;VALUE_PROPERTY_ARGS.property=NAMESPACE.Maps.GetPropertyIndexFromName("value");return VALUE_PROPERTY_ARGS}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;const TYPE_CHECK_OBJECTS=[]; +NAMESPACE.PropertyTypes=class PropertyTypes{constructor(){}static Pick(property){if(TYPE_CHECK_OBJECTS.length===0){const arr=TYPE_CHECK_OBJECTS;arr.push({checkFunc:NAMESPACE.Maps.IsPairId,result:this.PAIR});arr.push({checkFunc:NAMESPACE.Maps.IsColorId,result:this.COLOR});arr.push({checkFunc:NAMESPACE.Maps.IsAngleId,result:this.ANGLE});arr.push({checkFunc:NAMESPACE.Maps.IsValueId,result:this.VALUE});arr.push({checkFunc:()=>true,result:this.OTHER})}if(C3.IsFiniteNumber(property))property=C3.Behaviors.Tween.Maps.GetPropertyFromIndex(property); +for(const propertyTypeFunctionObject of TYPE_CHECK_OBJECTS)if(propertyTypeFunctionObject.checkFunc(property))return propertyTypeFunctionObject.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}; + +} + +{ +'use strict';const C3=self.C3;const NAMESPACE=C3.Behaviors.Tween;NAMESPACE.ValueGetters=class ValueGetters{constructor(){}static _GetPropertyAngleValue(value){const r=C3.toRadians(parseFloat(value));return C3.clampAngle(r)}static _GetColorPropertyValue(value){return value.slice(0)}static _GetPropertyValue(value){return value}}; + +} + +{ +'use strict';const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const Ease=self.Ease;const NAMESPACE=C3.Behaviors.Tween;const map=new WeakMap; +const TWEEN_PROPERTIES=new Map([["x",{name:"offsetX",type:"one"}],["y",{name:"offsetY",type:"one"}],["width",{name:"offsetWidth",type:"one"}],["height",{name:"offsetHeight",type:"one"}],["angle",{name:"offsetAngle",type:"one"}],["opacity",{name:"offsetOpacity",type:"one"}],["color",{name:"offsetColor",type:"color"}],["z-elevation",{name:"offsetZElevation",type:"one"}],["x-scale",{name:"offsetScaleX",type:"one"}],["y-scale",{name:"offsetScaleY",type:"one"}],["position",{name:"position",type:"two"}], +["size",{name:"size",type:"two"}],["scale",{name:"scale",type:"two"}],["value",{name:"value",type:"value"}]]);function getIndexForEase(ease){C3X.RequireString(ease);const easeInternalName=Ease.ToInternal(ease);let easeIndex;if(easeInternalName)easeIndex=Ease.GetIndexForEase(easeInternalName,null);else easeIndex=Ease.GetIndexForEase(ease,null);if(easeIndex===-1)throw new Error(`invalid ease name '${ease}'`);return easeIndex} +const TWEEN_OPTS={tags:"",destroyOnComplete:false,loop:false,pingPong:false,repeatCount:1,startValue:0};const I_TWEEN_OPTS={easeToIndexFunc:getIndexForEase}; +self.ITweenBehaviorInstance=class ITweenBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startTween(prop,endValue,time,ease,opts){const inst=map.get(this);if(!inst.IsEnabled()||!inst.IsInstanceValid())return null;const info=TWEEN_PROPERTIES.get(prop);if(!info)throw new Error("invalid tween property");if(info.type==="one"||info.type==="value")C3X.RequireNumber(endValue);else{C3X.RequireArray(endValue);if(info.type==="two"){C3X.RequireNumber(endValue[0]); +C3X.RequireNumber(endValue[1])}else if(info.type==="color"){C3X.RequireNumber(endValue[0]);C3X.RequireNumber(endValue[1]);C3X.RequireNumber(endValue[2])}}if(prop==="angle")endValue=C3.toDegrees(endValue);else if(prop==="opacity")endValue*=100;else if(prop==="color")endValue=C3.PackRGBEx(endValue[0],endValue[1],endValue[2]);const easeIndex=getIndexForEase(ease);C3X.RequireFiniteNumber(time);opts=Object.assign({},TWEEN_OPTS,opts);if(info.type==="value")C3X.RequireNumber(opts.startValue);let tween;if(info.type=== +"one"||info.type==="color")tween=inst.CreateTween(NAMESPACE.TweenArguments.OneProperty(inst,opts.tags,info.name,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));else if(info.type==="two")tween=inst.CreateTween(NAMESPACE.TweenArguments.TwoProperties(inst,opts.tags,info.name,endValue[0],endValue[1],time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));else if(info.type==="value")tween=inst.CreateTween(NAMESPACE.TweenArguments.ValueProperty(inst, +opts.tags,opts.startValue,endValue,time,easeIndex,!!opts.destroyOnComplete,!!opts.loop,!!opts.pingPong,opts.repeatCount));if(!tween.Play())throw new Error("failed to start tween");return tween.GetITweenState(inst,I_TWEEN_OPTS)}*allTweens(){const inst=map.get(this);for(const tween of inst.AllTweens())yield tween.GetITweenState(inst,I_TWEEN_OPTS)}*tweensByTags(tags){C3X.RequireString(tags);const inst=map.get(this);for(const tween of inst.GetTweens(tags))yield tween.GetITweenState(inst,I_TWEEN_OPTS)}get isEnabled(){return map.get(this).IsEnabled()}set isEnabled(e){map.get(this).SetEnabled(e)}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Anchor=class AnchorBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Anchor.Type=class AnchorType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const ANCHOR_LEFT=0;const ANCHOR_TOP=1;const ANCHOR_RIGHT=2;const ANCHOR_BOTTOM=3;const ENABLE=4;C3.Behaviors.Anchor.Instance=class AnchorInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._anchorLeft=2;this._anchorTop=2;this._anchorRight=0;this._anchorBottom=0;this._isEnabled=true;const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop= +bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();if(properties){this._anchorLeft=properties[ANCHOR_LEFT];this._anchorTop=properties[ANCHOR_TOP];this._anchorRight=properties[ANCHOR_RIGHT];this._anchorBottom=properties[ANCHOR_BOTTOM];this._isEnabled=!!properties[ENABLE]}const rt= +this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(rt,"layoutchange",()=>this._OnLayoutChange()));if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"xl":this._xLeft,"yt":this._yTop,"xr":this._xRight,"yb":this._yBottom,"rd":this._rDiff,"bd":this._bDiff,"al":this._anchorLeft,"at":this._anchorTop,"ar":this._anchorRight,"ab":this._anchorBottom,"e":this._isEnabled}}LoadFromJson(o){this._xLeft=o["xl"];this._yTop=o["yt"];this._xRight= +o["xr"];this._yBottom=o["yb"];this._rDiff=o["rd"];this._bDiff=o["bd"];this._anchorLeft=o["al"];this._anchorTop=o["at"];this._anchorRight=o["ar"];this._anchorBottom=o["ab"];this._isEnabled=o["e"];if(this._isEnabled)this._StartTicking();else this._StopTicking()}_SetEnabled(e){if(this._isEnabled&&!e){this._isEnabled=false;this._StopTicking()}else if(!this._isEnabled&&e){const bbox=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=bbox.getLeft();this._yTop=bbox.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()- +bbox.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-bbox.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-bbox.getRight();this._bDiff=this._runtime.GetOriginalViewportHeight()-bbox.getBottom();this._isEnabled=true;this._StartTicking()}}_IsEnabled(){return this._isEnabled}_UpdatePosition(){if(!this._isEnabled)return;const wi=this._inst.GetWorldInfo();const viewport=wi.GetLayer().GetViewport();if(this._anchorLeft===0){const n=viewport.getLeft()+this._xLeft-wi.GetBoundingBox().getLeft(); +if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}else if(this._anchorLeft===1){const n=viewport.getRight()-this._xRight-wi.GetBoundingBox().getLeft();if(n!==0){wi.OffsetX(n);wi.SetBboxChanged()}}if(this._anchorTop===0){const n=viewport.getTop()+this._yTop-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}else if(this._anchorTop===1){const n=viewport.getBottom()-this._yBottom-wi.GetBoundingBox().getTop();if(n!==0){wi.OffsetY(n);wi.SetBboxChanged()}}if(this._anchorRight===1){const n= +viewport.getRight()-this._rDiff-wi.GetBoundingBox().getRight();if(n!==0){wi.OffsetX(wi.GetOriginX()*n);wi.SetWidth(Math.max(wi.GetWidth()+n),0);wi.SetBboxChanged();this._rDiff=viewport.getRight()-wi.GetBoundingBox().getRight()}}if(this._anchorBottom===1){const n=viewport.getBottom()-this._bDiff-wi.GetBoundingBox().getBottom();if(n!==0){wi.OffsetY(wi.GetOriginY()*n);wi.SetHeight(Math.max(wi.GetHeight()+n,0));wi.SetBboxChanged();this._bDiff=viewport.getBottom()-wi.GetBoundingBox().getBottom()}}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(index){switch(index){case ANCHOR_LEFT:return this._anchorLeft; +case ANCHOR_TOP:return this._anchorTop;case ANCHOR_RIGHT:return this._anchorRight;case ANCHOR_BOTTOM:return this._anchorBottom;case ENABLE:return this._isEnabled}}SetPropertyValueByIndex(index,value){switch(index){case ANCHOR_LEFT:this._anchorLeft=value;break;case ANCHOR_TOP:this._anchorTop=value;break;case ANCHOR_RIGHT:this._anchorRight=value;break;case ANCHOR_BOTTOM:this._anchorBottom=value;break;case ENABLE:this._isEnabled=!!value;if(this._isEnabled)this._StartTicking();else this._StopTicking(); +break}}GetDebuggerProperties(){const prefix="behaviors.anchor";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.enabled.name",value:this._IsEnabled(),onedit:v=>this._SetEnabled(v)}]}]}GetScriptInterfaceClass(){return self.IAnchorBehaviorInstance}};const map=new WeakMap;self.IAnchorBehaviorInstance=class IAnchorBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get isEnabled(){return map.get(this)._IsEnabled()}set isEnabled(e){map.get(this)._SetEnabled(e)}}} +{const C3=self.C3;C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._IsEnabled()}}}{const C3=self.C3;C3.Behaviors.Anchor.Acts={SetEnabled(e){this._SetEnabled(e!==0)}}}{const C3=self.C3;C3.Behaviors.Anchor.Exps={}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Sin=class SinBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Sin.Type=class SinType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const MOVEMENT=0;const WAVE=1;const PERIOD=2;const PERIOD_RANDOM=3;const PERIOD_OFFSET=4;const PERIOD_OFFSET_RANDOM=5;const MAGNITUDE=6;const MAGNITUDE_RANDOM=7;const ENABLE=8;const HORIZONTAL=0;const VERTICAL=1;const SIZE=2;const WIDTH=3;const HEIGHT=4;const ANGLE=5;const OPACITY=6;const VALUE=7;const FORWARDS_BACKWARDS=8;const ZELEVATION=9;const SINE=0;const TRIANGLE=1;const SAWTOOTH=2;const REVERSE_SAWTOOTH=3;const SQUARE= +4;const _2pi=2*Math.PI;const _pi_2=Math.PI/2;const _3pi_2=3*Math.PI/2;const MOVEMENT_LOOKUP=[0,1,8,3,4,2,5,6,9,7];C3.Behaviors.Sin.Instance=class SinInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._i=0;this._movement=0;this._wave=0;this._period=0;this._mag=0;this._isEnabled=true;this._basePeriod=0;this._basePeriodOffset=0;this._baseMag=0;this._periodRandom=0;this._periodOffsetRandom=0;this._magnitudeRandom=0;this._initialValue=0;this._initialValue2= +0;this._lastKnownValue=0;this._lastKnownValue2=0;this._ratio=0;if(properties){this._movement=MOVEMENT_LOOKUP[properties[MOVEMENT]];this._wave=properties[WAVE];this._periodRandom=this._runtime.Random()*properties[PERIOD_RANDOM];this._basePeriod=properties[PERIOD];this._period=properties[PERIOD];this._period+=this._periodRandom;this._basePeriodOffset=properties[PERIOD_OFFSET];if(this._period!==0){this._periodOffsetRandom=this._runtime.Random()*properties[PERIOD_OFFSET_RANDOM];this._i=properties[PERIOD_OFFSET]/ +this._period*_2pi;this._i+=this._periodOffsetRandom/this._period*_2pi}this._magnitudeRandom=this._runtime.Random()*properties[MAGNITUDE_RANDOM];this._baseMag=properties[MAGNITUDE];this._mag=properties[MAGNITUDE];this._mag+=this._magnitudeRandom;this._isEnabled=!!properties[ENABLE]}if(this._movement===ANGLE)this._mag=C3.toRadians(this._mag);this.Init();if(this._isEnabled)this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"i":this._i,"e":this._isEnabled,"mv":this._movement,"w":this._wave, +"p":this._period,"mag":this._mag,"iv":this._initialValue,"iv2":this._initialValue2,"r":this._ratio,"lkv":this._lastKnownValue,"lkv2":this._lastKnownValue2}}LoadFromJson(o){this._i=o["i"];this._SetEnabled(o["e"]);this._movement=o["mv"];this._wave=o["w"];this._period=o["p"];this._mag=o["mag"];this._initialValue=o["iv"];this._initialValue2=o["iv2"];this._ratio=o["r"];this._lastKnownValue=o["lkv"];this._lastKnownValue2=o["lkv2"]}Init(){const wi=this._inst.GetWorldInfo();switch(this._movement){case HORIZONTAL:this._initialValue= +wi.GetX();break;case VERTICAL:this._initialValue=wi.GetY();break;case SIZE:this._initialValue=wi.GetWidth();this._ratio=wi.GetHeight()/wi.GetWidth();break;case WIDTH:this._initialValue=wi.GetWidth();break;case HEIGHT:this._initialValue=wi.GetHeight();break;case ANGLE:this._initialValue=wi.GetAngle();break;case OPACITY:this._initialValue=wi.GetOpacity();break;case VALUE:this._initialValue=0;break;case FORWARDS_BACKWARDS:this._initialValue=wi.GetX();this._initialValue2=wi.GetY();break;case ZELEVATION:this._initialValue= +wi.GetZElevation();break;default:}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(x){x=x%_2pi;switch(this._wave){case SINE:return Math.sin(x);case TRIANGLE:if(x<=_pi_2)return x/_pi_2;else if(x<=_3pi_2)return 1-2*(x-_pi_2)/Math.PI;else return(x-_3pi_2)/_pi_2-1;case SAWTOOTH:return 2*x/_2pi-1;case REVERSE_SAWTOOTH:return-2*x/_2pi+1;case SQUARE:return xthis._SetEnabled(v)},{name:prefix+".properties.period.name",value:this._GetPeriod(),onedit:v=>this._SetPeriod(v)}, +{name:prefix+".properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:v=>this._SetMagnitude_ConvertAngle(v)},{name:prefix+".debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};const map=new WeakMap;const VALID_MOVEMENTS=["horizontal","vertical","size","width","height","angle","opacity","value-only","forwards-backwards","z-elevation"];const VALID_WAVES=["sine","triangle","sawtooth", +"reverse-sawtooth","square"];self.ISineBehaviorInstance=class ISineBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}set period(x){C3X.RequireFiniteNumber(x);map.get(this)._SetPeriod(x)}get period(){return map.get(this)._GetPeriod()}set magnitude(m){C3X.RequireFiniteNumber(m);map.get(this)._SetMagnitude(m)}get magnitude(){return map.get(this)._GetMagnitude()}set phase(p){map.get(this)._SetPhase(p)}get phase(){return map.get(this)._GetPhase()}set movement(m){C3X.RequireString(m); +const i=VALID_MOVEMENTS.indexOf(m);if(i===-1)throw new Error("invalid movement");map.get(this)._SetMovement(i)}get movement(){return VALID_MOVEMENTS[map.get(this)._GetMovement()]}set wave(w){C3X.RequireString(w);const i=VALID_WAVES.indexOf(w);if(i===-1)throw new Error("invalid wave");map.get(this)._SetWave(i)}get wave(){return VALID_WAVES[map.get(this)._GetWave()]}get value(){const inst=map.get(this);return inst.WaveFunc(inst._GetPhase())*inst._GetMagnitude()}updateInitialState(){map.get(this).Init()}set isEnabled(e){map.get(this)._SetEnabled(!!e)}get isEnabled(){return map.get(this)._IsEnabled()}}} +{const C3=self.C3;C3.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(m){return this._GetMovement()===m},ComparePeriod(cmp,v){return C3.compare(this._GetPeriod(),cmp,v)},CompareMagnitude(cmp,v){return C3.compare(this._GetMagnitude_ConvertAngle(),cmp,v)},CompareWave(w){return this._GetWave()===w}}} +{const C3=self.C3;C3.Behaviors.Sin.Acts={SetEnabled(e){this._SetEnabled(e!==0)},SetPeriod(x){this._SetPeriod(x)},SetMagnitude(x){this._SetMagnitude_ConvertAngle(x)},SetMovement(m){this._SetMovement(m)},SetWave(w){this._wave=w},SetPhase(x){const _2pi=Math.PI*2;this._SetPhase(x*_2pi%_2pi)},UpdateInitialState(){this.Init()}}} +{const C3=self.C3;C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}}}; + +} + +{ +'use strict';{const C3=self.C3;C3.Behaviors.Fade=class FadeBehavior extends C3.SDKBehaviorBase{constructor(opts){super(opts)}Release(){super.Release()}}}{const C3=self.C3;C3.Behaviors.Fade.Type=class FadeType extends C3.SDKBehaviorTypeBase{constructor(behaviorType){super(behaviorType)}Release(){super.Release()}OnCreate(){}}} +{const C3=self.C3;const C3X=self.C3X;const IBehaviorInstance=self.IBehaviorInstance;const FADE_IN_TIME=0;const WAIT_TIME=1;const FADE_OUT_TIME=2;const DESTROY=3;const ACTIVE_AT_START=4;C3.Behaviors.Fade.Instance=class FadeInstance extends C3.SDKBehaviorInstanceBase{constructor(behInst,properties){super(behInst);this._fadeInTime=0;this._waitTime=0;this._fadeOutTime=0;this._destroy=true;this._activeAtStart=true;this._setMaxOpacity=false;this._stage=0;this._stageTime=C3.New(C3.KahanSum);this._maxOpacity= +this._inst.GetWorldInfo().GetOpacity()||1;if(properties){this._fadeInTime=properties[FADE_IN_TIME];this._waitTime=properties[WAIT_TIME];this._fadeOutTime=properties[FADE_OUT_TIME];this._destroy=!!properties[DESTROY];this._activeAtStart=!!properties[ACTIVE_AT_START];this._stage=this._activeAtStart?0:3}if(this._activeAtStart)if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"fit":this._fadeInTime, +"wt":this._waitTime,"fot":this._fadeOutTime,"d":this._destroy,"s":this._stage,"st":this._stageTime.Get(),"mo":this._maxOpacity}}LoadFromJson(o){this._fadeInTime=o["fit"];this._waitTime=o["wt"];this._fadeOutTime=o["fot"];this._destroy=o["d"];this._stage=o["s"];this._stageTime.Set(o["st"]);this._maxOpacity=o["mo"];if(this._stage===3)this._StopTicking();else this._StartTicking()}Tick(){const dt=this._runtime.GetDt(this._inst);this._stageTime.Add(dt);const wi=this._inst.GetWorldInfo();if(this._stage=== +0){wi.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity);this._runtime.UpdateRender();if(wi.GetOpacity()>=this._maxOpacity){wi.SetOpacity(this._maxOpacity);this._stage=1;this._stageTime.Reset();this.DispatchScriptEvent("fadeinend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeInEnd)}}if(this._stage===1)if(this._stageTime.Get()>=this._waitTime){this._stage=2;this._stageTime.Reset();this.DispatchScriptEvent("waitend");this.Trigger(C3.Behaviors.Fade.Cnds.OnWaitEnd)}if(this._stage===2)if(this._fadeOutTime!== +0){wi.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity);this._runtime.UpdateRender();if(wi.GetOpacity()<=0){this._stage=3;this._stageTime.Reset();this.DispatchScriptEvent("fadeoutend");this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeOutEnd);if(this._destroy)this._runtime.DestroyInstance(this._inst)}}else{this._stage=3;this._stageTime.Reset()}if(this._stage===3)this._StopTicking()}_StartFade(){if(!this._activeAtStart&&!this._setMaxOpacity){this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()|| +1;this._setMaxOpacity=true}if(this._stage===3)this.Start()}_RestartFade(){this.Start()}Start(){this._stage=0;this._stageTime.Reset();if(this._fadeInTime===0){this._stage=1;if(this._waitTime===0)this._stage=2}else{this._inst.GetWorldInfo().SetOpacity(0);this._runtime.UpdateRender()}this._StartTicking()}_SetFadeInTime(t){this._fadeInTime=Math.max(t,0)}_GetFadeInTime(){return this._fadeInTime}_SetWaitTime(t){this._waitTime=Math.max(t,0)}_GetWaitTime(){return this._waitTime}_SetFadeOutTime(t){this._fadeOutTime= +Math.max(t,0)}_GetFadeOutTime(){return this._fadeOutTime}GetPropertyValueByIndex(index){switch(index){case FADE_IN_TIME:return this._GetFadeInTime();case WAIT_TIME:return this._GetWaitTime();case FADE_OUT_TIME:return this._GetFadeOutTime();case DESTROY:return this._destroy}}SetPropertyValueByIndex(index,value){switch(index){case FADE_IN_TIME:this._SetFadeInTime(value);break;case WAIT_TIME:this._SetWaitTime(value);break;case FADE_OUT_TIME:this._SetFadeOutTime(value);break;case DESTROY:this._destroy= +!!value;break}}GetDebuggerProperties(){const prefix="behaviors.fade";return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:prefix+".properties.fade-in-time.name",value:this._GetFadeInTime(),onedit:v=>this._SetFadeInTime(v)},{name:prefix+".properties.wait-time.name",value:this._GetWaitTime(),onedit:v=>this._SetWaitTime(v)},{name:prefix+".properties.fade-out-time.name",value:this._GetFadeOutTime(),onedit:v=>this._SetFadeOutTime(v)},{name:prefix+".debugger.stage",value:[prefix+".debugger."+ +["fade-in","wait","fade-out","done"][this._stage]]}]}]}GetScriptInterfaceClass(){return self.IFadeBehaviorInstance}};const map=new WeakMap;self.IFadeBehaviorInstance=class IFadeBehaviorInstance extends IBehaviorInstance{constructor(){super();map.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}startFade(){map.get(this)._StartFade()}restartFade(){map.get(this)._RestartFade()}set fadeInTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeInTime(t)}get fadeInTime(){return map.get(this)._GetFadeInTime()}set waitTime(t){C3X.RequireFiniteNumber(t); +map.get(this)._SetWaitTime(t)}get waitTime(){return map.get(this)._GetWaitTime()}set fadeOutTime(t){C3X.RequireFiniteNumber(t);map.get(this)._SetFadeOutTime(t)}get fadeOutTime(){return map.get(this)._GetFadeOutTime()}}}{const C3=self.C3;C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return true},OnFadeInEnd(){return true},OnWaitEnd(){return true}}} +{const C3=self.C3;C3.Behaviors.Fade.Acts={StartFade(){this._StartFade()},RestartFade(){this._RestartFade()},SetFadeInTime(t){this._SetFadeInTime(t)},SetWaitTime(t){this._SetWaitTime(t)},SetFadeOutTime(t){this._SetFadeOutTime(t)}}}{const C3=self.C3;C3.Behaviors.Fade.Exps={FadeInTime(){return this._GetFadeInTime()},WaitTime(){return this._GetWaitTime()},FadeOutTime(){return this._GetFadeOutTime()}}}; + +} + +{ +const C3 = self.C3; +self.C3_GetObjectRefTable = function () { + return [ + C3.Plugins.Sprite, + C3.Behaviors.Physics, + C3.Behaviors.Pin, + C3.Behaviors.Timer, + C3.Plugins.Keyboard, + C3.Plugins.Audio, + C3.Behaviors.Tween, + C3.Behaviors.Anchor, + C3.Plugins.TiledBg, + C3.Plugins.Spritefont2, + C3.Behaviors.Sin, + C3.Plugins.DrawingCanvas, + C3.Plugins.Arr, + C3.Plugins.Mouse, + C3.Plugins.Particles, + C3.Plugins.Touch, + C3.Plugins.Browser, + C3.Behaviors.Fade, + C3.Plugins.System.Cnds.IsGroupActive, + C3.Plugins.System.Cnds.OnLayoutStart, + C3.Plugins.Arr.Acts.SetSize, + C3.Plugins.Arr.Acts.Clear, + C3.Plugins.Sprite.Cnds.IsOverlapping, + C3.Behaviors.Physics.Cnds.CompareVelocity, + C3.Behaviors.Physics.Acts.SetVelocity, + C3.Behaviors.Physics.Exps.VelocityX, + C3.Behaviors.Physics.Acts.SetAngularVelocity, + C3.Behaviors.Physics.Exps.VelocityY, + C3.Plugins.Sprite.Acts.SetX, + C3.Plugins.Sprite.Exps.X, + C3.Plugins.Sprite.Acts.SetScale, + C3.Plugins.System.Exps.max, + C3.Plugins.Sprite.Exps.Y, + C3.Plugins.Sprite.Acts.SetAnimSpeed, + C3.Plugins.System.Exps.min, + C3.Plugins.Sprite.Cnds.CompareX, + C3.Plugins.System.Cnds.CompareVar, + C3.Plugins.System.Cnds.TriggerOnce, + C3.Plugins.System.Acts.SetVar, + C3.Plugins.Sprite.Acts.SetVisible, + C3.Plugins.System.Acts.SetTimescale, + C3.Plugins.Audio.Acts.Play, + C3.Plugins.System.Acts.Wait, + C3.Plugins.System.Acts.RestartLayout, + C3.Behaviors.Physics.Exps.AngularVelocity, + C3.Plugins.Sprite.Cnds.OnCollision, + C3.Plugins.Sprite.Acts.AddInstanceVar, + C3.Plugins.Browser.Cnds.OnResize, + C3.Plugins.TiledBg.Acts.SetWidth, + C3.Plugins.System.Exps.viewportright, + C3.Plugins.System.Exps.viewportleft, + C3.Plugins.TiledBg.Acts.SetX, + C3.Plugins.System.Exps.int, + C3.Plugins.System.Exps.random, + C3.Plugins.System.Cnds.While, + C3.Plugins.System.Exps.choose, + C3.Plugins.TiledBg.Acts.Destroy, + C3.Plugins.System.Acts.SetLayerBackground, + C3.Plugins.System.Exps.rgbex255, + C3.Plugins.System.Cnds.Else, + C3.Plugins.TiledBg.Acts.SetDefaultColor, + C3.Plugins.TiledBg.Acts.SetEffectParam, + C3.Plugins.Sprite.Cnds.CompareInstanceVar, + C3.Plugins.Sprite.Acts.SetAnimFrame, + C3.Plugins.Sprite.Cnds.OnCreated, + C3.Plugins.Sprite.Exps.AnimationFrameCount, + C3.Plugins.Sprite.Acts.SetDefaultColor, + C3.Plugins.Sprite.Exps.ColorValue, + C3.Plugins.Touch.Cnds.IsTouchingObject, + C3.Plugins.Keyboard.Cnds.IsKeyDown, + C3.Plugins.Sprite.Acts.SetSize, + C3.Plugins.System.Exps.viewportbottom, + C3.Plugins.System.Exps.viewporttop, + C3.Plugins.Sprite.Acts.Destroy, + C3.Plugins.Spritefont2.Cnds.CompareInstanceVar, + C3.Plugins.Spritefont2.Acts.SetVisible, + C3.Plugins.Audio.Cnds.IsTagPlaying, + C3.Plugins.System.Cnds.Compare, + C3.Plugins.Spritefont2.Acts.SetText, + C3.Plugins.System.Cnds.PickOverlappingPoint, + C3.Plugins.System.Acts.SetObjectTimescale, + C3.Plugins.System.Acts.AddVar, + C3.Behaviors.Timer.Acts.StartTimer, + C3.Plugins.System.Acts.ResetPersisted, + C3.Plugins.System.Acts.Scroll, + C3.Plugins.System.Exps.scrollx, + C3.Plugins.System.Exps.dt, + C3.Plugins.System.Exps.scrolly, + C3.Plugins.System.Acts.SetLayoutScale, + C3.Plugins.System.Exps.layoutscale, + C3.Behaviors.Timer.Cnds.OnTimer, + C3.Plugins.Spritefont2.Acts.SetScale, + C3.Plugins.Spritefont2.Acts.SetDefaultColor, + C3.Behaviors.Tween.Cnds.IsPlaying, + C3.Plugins.System.Acts.SetLayerOpacity, + C3.Behaviors.Tween.Exps.Value, + C3.Behaviors.Tween.Cnds.OnTweensFinished, + C3.Plugins.Audio.Acts.Stop, + C3.Behaviors.Tween.Acts.TweenValue, + C3.Plugins.System.Acts.SetLayerVisible, + C3.Plugins.Sprite.Acts.MoveToLayer, + C3.Plugins.Spritefont2.Acts.MoveToLayer, + C3.Plugins.System.Acts.CreateObject, + C3.Plugins.TiledBg.Acts.SetSize, + C3.Behaviors.Tween.Acts.TweenOneProperty, + C3.Plugins.Sprite.Acts.SetInstanceVar, + C3.Behaviors.Timer.Acts.StopTimer, + C3.Behaviors.Physics.Acts.CreateLimitedRevoluteJoint, + C3.Behaviors.Physics.Acts.SetSteppingMode, + C3.Behaviors.Physics.Acts.EnableCollisions, + C3.Behaviors.Pin.Acts.Pin, + C3.Behaviors.Physics.Acts.ApplyForce, + C3.Plugins.Sprite.Exps.ImagePointX, + C3.Plugins.Sprite.Cnds.CompareY, + C3.Plugins.Sprite.Exps.ImagePointY, + C3.Plugins.Sprite.Cnds.IsBetweenAngles, + C3.Plugins.Sprite.Acts.SubInstanceVar, + C3.Behaviors.Physics.Acts.ApplyForceToward, + C3.Behaviors.Timer.Cnds.IsTimerRunning, + C3.Plugins.System.Cnds.Every, + C3.Plugins.Arr.Acts.Push, + C3.Plugins.Arr.Acts.SetXY, + C3.Plugins.Arr.Exps.Width, + C3.Plugins.DrawingCanvas.Acts.ClearCanvas, + C3.Plugins.System.Exps.rgba, + C3.Plugins.Arr.Cnds.CompareSize, + C3.Plugins.Arr.Acts.Pop, + C3.Plugins.System.Cnds.Repeat, + C3.Plugins.System.Exps.loopindex, + C3.Plugins.Arr.Exps.At, + C3.Plugins.DrawingCanvas.Acts.ResetPoly, + C3.Plugins.DrawingCanvas.Acts.AddPolyPoint, + C3.Plugins.DrawingCanvas.Acts.FillPoly, + C3.Plugins.Sprite.Acts.SetPos, + C3.Plugins.Sprite.Acts.MoveToTop, + C3.Plugins.Particles.Acts.Destroy, + C3.Behaviors.Physics.Acts.SetFriction, + C3.Plugins.Sprite.Acts.SetY, + C3.Plugins.Sprite.Acts.SetAnim, + C3.Behaviors.Physics.Acts.SetWorldGravity, + C3.Plugins.Sprite.Acts.SetWidth, + C3.Plugins.System.Cnds.ForEach, + C3.Behaviors.Tween.Acts.TweenTwoProperties, + C3.Behaviors.Sin.Acts.SetEnabled, + C3.Plugins.Sprite.Acts.SetAngle, + C3.Behaviors.Pin.Acts.Unpin, + C3.Plugins.Sprite.Cnds.PickDistance, + C3.Plugins.Sprite.Acts.SetHeight, + C3.Plugins.Sprite.Exps.Height, + C3.Plugins.Sprite.Exps.Width, + C3.Plugins.Sprite.Acts.Spawn, + C3.Plugins.Sprite.Acts.ZMoveToObject, + C3.Plugins.Touch.Cnds.OnTouchObject, + C3.Plugins.Browser.Acts.GoToURLWindow, + C3.Plugins.Sprite.Cnds.IsVisible, + C3.Plugins.Audio.Acts.SetSilent, + C3.Plugins.Touch.Cnds.OnTouchEnd, + C3.Plugins.Sprite.Cnds.CompareFrame, + C3.Plugins.System.Cnds.PickAll, + C3.Plugins.Audio.Acts.StopAll, + C3.Plugins.System.Acts.ResetGlobals, + C3.Plugins.System.Acts.SetBoolVar, + C3.Plugins.Sprite.Acts.SetCollisions, + C3.Behaviors.Physics.Acts.SetImmovable, + C3.Plugins.System.Cnds.CompareBoolVar, + C3.Behaviors.Tween.Cnds.IsAnyPlaying, + C3.Plugins.Audio.Acts.SetPlaybackRate, + C3.Plugins.Audio.Acts.Seek, + C3.Behaviors.Fade.Acts.StartFade, + C3.Behaviors.Tween.Cnds.OnAnyTweensFinished, + C3.Plugins.Mouse.Cnds.IsOverObject, + C3.Plugins.Sprite.Cnds.OnDestroyed, + C3.Plugins.System.Cnds.EveryTick, + C3.Plugins.Sprite.Acts.StopAnim, + C3.Plugins.Mouse.Acts.SetCursor, + C3.Plugins.System.Acts.GoToLayout, + C3.ScriptsInEvents.Rhm_ads_Event1_Act1, + C3.ScriptsInEvents.Rhm_ads_Event2_Act1, + C3.Plugins.Browser.Acts.ConsoleLog, + C3.Plugins.Browser.Acts.Focus + ]; +}; +self.C3_JsPropNameTable = [ + {var: 0}, + {adjust: 0}, + {Physics: 0}, + {Pin: 0}, + {landPhysics: 0}, + {which: 0}, + {first: 0}, + {angular: 0}, + {jump: 0}, + {moreJump: 0}, + {Timer: 0}, + {body: 0}, + {Keyboard: 0}, + {shootAngle: 0}, + {leg: 0}, + {playerLine: 0}, + {armRight: 0}, + {armLeft: 0}, + {arm2Line: 0}, + {arm1Line: 0}, + {legLine: 0}, + {head: 0}, + {headLine: 0}, + {Audio: 0}, + {kale: 0}, + {tail: 0}, + {americanBall: 0}, + {groundCollision: 0}, + {ballLine: 0}, + {rightShoe: 0}, + {hair: 0}, + {rightShort: 0}, + {leftShort: 0}, + {rightTshirt: 0}, + {leftTshirt: 0}, + {leftShoe: 0}, + {tshirt: 0}, + {kaleBack: 0}, + {Tween: 0}, + {file: 0}, + {kaleTop: 0}, + {ballShadow: 0}, + {playerShadow: 0}, + {snow: 0}, + {Anchor: 0}, + {pause: 0}, + {groundTile: 0}, + {groundLine: 0}, + {whiteLine: 0}, + {TPG: 0}, + {scoreBG: 0}, + {fontWonder: 0}, + {fenceTile: 0}, + {grassTile: 0}, + {Sine: 0}, + {cloudTile: 0}, + {buildingTile: 0}, + {DrawingCanvas: 0}, + {Array: 0}, + {head2: 0}, + {armRight2: 0}, + {armLeft2: 0}, + {body2: 0}, + {leg2: 0}, + {Mouse: 0}, + {p2Collision: 0}, + {p1Collision: 0}, + {head3: 0}, + {armRight3: 0}, + {armLeft3: 0}, + {body3: 0}, + {leg3: 0}, + {p3Collision: 0}, + {head4: 0}, + {armRight4: 0}, + {armLeft4: 0}, + {body4: 0}, + {leg4: 0}, + {p4Collision: 0}, + {night: 0}, + {starTile: 0}, + {normalBall: 0}, + {bigBall: 0}, + {snowParticle: 0}, + {portraitCoverTile: 0}, + {Touch: 0}, + {buttonRight: 0}, + {buttonLeft: 0}, + {tutorial: 0}, + {pauseButtons: 0}, + {Browser: 0}, + {Fade: 0}, + {fadeOut: 0}, + {titleBG: 0}, + {title: 0}, + {cpu: 0}, + {hover: 0}, + {startButton: 0}, + {moreButton: 0}, + {startButton2: 0}, + {hitfx: 0}, + {goalText: 0}, + {game_bg: 0}, + {introtwporg: 0}, + {play_intro_btn: 0}, + {groundTileSnow: 0}, + {buildingTile2: 0}, + {buildingTile3: 0}, + {smallBall: 0}, + {startX: 0}, + {titleChars: 0}, + {groundTilePlaj: 0}, + {seaTile: 0}, + {mountain: 0}, + {ships: 0}, + {seaWhite: 0}, + {player: 0}, + {skin: 0}, + {tiles: 0}, + {line: 0}, + {balls: 0}, + {startButtons: 0}, + {angularMaxRND: 0}, + {angularMinRND: 0}, + {wooble: 0}, + {angularSub: 0}, + {snowSlip: 0}, + {P1Control: 0}, + {P2Control: 0}, + {p1Score: 0}, + {p2Score: 0}, + {goal: 0}, + {CPU: 0}, + {velX: 0}, + {velAng: 0}, + {ang: 0}, + {team1: 0}, + {team2: 0}, + {screenWidth: 0}, + {screenHeight: 0}, + {rnd: 0}, + {who: 0}, + {upArrow: 0}, + {W: 0}, + {op: 0}, + {i: 0}, + {x0: 0}, + {y0: 0}, + {a0: 0}, + {x1: 0}, + {y1: 0}, + {a1: 0}, + {rndChar: 0}, + {rndBall: 0}, + {rndGoal: 0}, + {rndPlace: 0}, + {speed: 0}, + {effectAdjust: 0}, + {menu: 0}, + {isRestartLayoutCalled: 0}, + {RefreshRateForce: 0}, + {ScnRefreshRate: 0}, + {divideSmooth_Hz: 0}, + {angularOffset_Hz: 0}, + {jumpPower_Hz: 0}, + {jumpAddForce_Hz: 0}, + {angularForce_Hz: 0}, + {armAngleSpeed_Hz: 0}, + {ballSpeed_Hz: 0}, + {ballSpeedDefaultVal_Hz: 0}, + {snowFrictionValue_Hz: 0}, + {ballMaxHeight_Hz: 0} +]; +} + +{ + +const C3 = self.C3; + +function unaryminus(n) +{ + return (typeof n === "number" ? -n : n); +} + +function bothNumbers(a, b) +{ + return typeof a === "number" && typeof b === "number"; +} + +function add(l, r) +{ + if (bothNumbers(l, r)) + return l + r; + else + return l; +} + +function subtract(l, r) +{ + if (bothNumbers(l, r)) + return l - r; + else + return l; +} + +function multiply(l, r) +{ + if (bothNumbers(l, r)) + return l * r; + else + return l; +} + +function divide(l, r) +{ + if (bothNumbers(l, r)) + return l / r; + else + return l; +} + +function mod(l, r) +{ + if (bothNumbers(l, r)) + return l % r; + else + return l; +} + +function pow(l, r) +{ + if (bothNumbers(l, r)) + return Math.pow(l, r); + else + return l; +} + +function and(l, r) +{ + if (typeof l === "string" || typeof r === "string") + { + // & with either side string does string concatenation + let lstr, rstr; + + if (typeof l === "number") + lstr = (Math.round(l * 1e10) / 1e10).toString(); + else + lstr = l; + + if (typeof r === "number") + rstr = (Math.round(r * 1e10) / 1e10).toString(); + else + rstr = r; + + return lstr + rstr; + } + else + { + // & with neither side a string does logical AND + return (l && r ? 1 : 0); + } +} + +function or(l, r) +{ + if (bothNumbers(l, r)) + return (l || r ? 1 : 0); + else + return l; +} + +self.C3_ExpressionFuncs = [ + () => "Ball", + () => 0, + () => 3, + () => 1, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior(); + }, + () => -100, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() * 5); + }, + p => { + const n0 = p._GetNode(0); + return () => C3.clamp(n0.ExpBehavior(), (-150), 150); + }, + p => { + const n0 = p._GetNode(0); + return () => C3.clamp(n0.ExpBehavior(), (-120), 120); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => f0(0.2, (n1.ExpInstVar_Family() - ((n2.ExpObject() - n3.ExpObject()) / 150))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + return () => f0(Math.abs(n1.ExpBehavior()), 20); + }, + () => 290, + () => 0.1, + () => -10, + () => "", + () => "Players", + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.clamp(n0.ExpBehavior(), ((-1) * v1.GetValue()), v2.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => C3.clamp(n0.ExpBehavior(), (-100), 100); + }, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((n0.ExpBehavior() * 3) + n1.ExpBehavior()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => ((n0.ExpBehavior() * 3) + v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() / 2); + }, + () => "General", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("BG") - f1("BG")) + 100); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0("BG") - 50); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => f0(f1(8)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => v0.GetValue(); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 1, 2); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(149, 237, 244); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 214, 159); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(254, 240, 220); + }, + () => 2, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(89, 89, 198); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(119, 120, 210); + }, + () => "back", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(82, 82, 186); + }, + () => "middle", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(72, 68, 159); + }, + () => "front", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(63, 52, 145); + }, + () => 4, + () => 5, + () => 6, + () => 7, + () => 8, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + return () => f0(f1(n2.ExpObject())); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + return () => f0(f1(138, 72, 54), f2(255, 216, 60), f3(39, 39, 39)); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + const f3 = p._GetNode(3).GetBoundMethod(); + const f4 = p._GetNode(4).GetBoundMethod(); + return () => f0(f1(255, 225, 188), f2(143, 98, 87), f3(246, 202, 159), f4(214, 169, 124)); + }, + () => "Control", + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (n0.ExpObject() - f1("UI")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("UI") - f1("UI")); + }, + () => -5, + () => "jump1", + () => "jump2", + () => "Goal", + p => { + const v0 = p._GetNode(0).GetVar(); + const v1 = p._GetNode(1).GetVar(); + return () => (v0.GetValue() + v1.GetValue()); + }, + () => "blink1", + () => 0.2, + () => 0.01, + () => "blue", + () => "red", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => C3.lerp(f0(), n1.ExpObject(), f2()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => C3.lerp(f0(), 1.5, f1()); + }, + () => 1.2, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 200, 37); + }, + () => "blink2", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 255, 255); + }, + () => "End", + () => "OPOutOver", + () => "OP", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutOver"); + }, + () => 60, + () => "menu", + () => "music", + () => "sound", + () => 0.3, + () => "Op", + () => "Top", + () => 26, + () => 27, + () => 21, + () => 55, + () => -160, + () => 39, + () => "appear", + () => 145, + () => 85, + () => 113, + () => 204, + () => "CPU", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (0.4 + (f0(5) / 20)); + }, + () => "jump", + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0(10) / 20); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (0.3 + (f0(10) / 20)); + }, + () => "P1", + () => "arm1", + () => -15, + () => "arm2", + () => 15, + () => "head", + () => 10, + () => "leg", + () => 90, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar(); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpBehavior() * 2); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(1); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => f0(v1.GetValue(), v2.GetValue()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + return () => (f0(v1.GetValue(), v2.GetValue()) * (-1)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + return () => (v0.GetValue() * (-1)); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((n0.ExpInstVar() * f1()) * v2.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.lerp(n0.ExpInstVar(), 0, (f1() / v2.GetValue())); + }, + () => -8, + p => { + const n0 = p._GetNode(0); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => C3.lerp(n0.ExpInstVar(), 0, ((f1() / v2.GetValue()) / 2)); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + const v2 = p._GetNode(2).GetVar(); + return () => ((v0.GetValue() * f1()) * v2.GetValue()); + }, + () => "P1 Control", + () => 800, + p => { + const v0 = p._GetNode(0).GetVar(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (v0.GetValue() * f1()); + }, + () => -800, + () => "wait", + () => 100, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => ((-5) * (n0.ExpObject() - n1.ExpObject(1))); + }, + () => "P1 skin", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpObject(6); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const n2 = p._GetNode(2); + const n3 = p._GetNode(3); + return () => f0(f1(0.2, (1 - ((n2.ExpObject() - n3.ExpObject()) / 150))), 1); + }, + () => "P2", + () => -90, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => (f0(v1.GetValue(), v2.GetValue()) * n3.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const v1 = p._GetNode(1).GetVar(); + const v2 = p._GetNode(2).GetVar(); + const n3 = p._GetNode(3); + return () => ((f0(v1.GetValue(), v2.GetValue()) * (-1)) * n3.ExpInstVar()); + }, + () => "P2 Control", + () => "P2 skin", + () => "Trail", + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 85); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 1); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 0, 0, 0); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 3); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => (f0() + 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject(v1.GetValue(), 0); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject(v1.GetValue(), 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const n2 = p._GetNode(2); + const v3 = p._GetNode(3).GetVar(); + const n4 = p._GetNode(4); + const v5 = p._GetNode(5).GetVar(); + const n6 = p._GetNode(6); + const v7 = p._GetNode(7).GetVar(); + return () => (C3.toDegrees(C3.angleTo(n0.ExpObject((v1.GetValue() - 1), 0), n2.ExpObject((v3.GetValue() - 1), 1), n4.ExpObject(v5.GetValue(), 0), n6.ExpObject(v7.GetValue(), 1))) + 90); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject((v1.GetValue() + 1), 0); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => n0.ExpObject((v1.GetValue() + 1), 1); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + const n2 = p._GetNode(2); + const v3 = p._GetNode(3).GetVar(); + const n4 = p._GetNode(4); + const v5 = p._GetNode(5).GetVar(); + const n6 = p._GetNode(6); + const v7 = p._GetNode(7).GetVar(); + return () => (C3.toDegrees(C3.angleTo(n0.ExpObject(v1.GetValue(), 0), n2.ExpObject(v3.GetValue(), 1), n4.ExpObject((v5.GetValue() + 1), 0), n6.ExpObject((v7.GetValue() + 1), 1))) + 90); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() - ((n1.ExpInstVar_Family() * Math.cos(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() - ((n1.ExpInstVar_Family() * Math.sin(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() + ((n1.ExpInstVar_Family() * Math.cos(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const v0 = p._GetNode(0).GetVar(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => (v0.GetValue() + ((n1.ExpInstVar_Family() * Math.sin(C3.toRadians(v2.GetValue()))) * v3.GetValue())); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const n1 = p._GetNode(1); + const v2 = p._GetNode(2).GetVar(); + const v3 = p._GetNode(3).GetVar(); + return () => f0(100, 100, 100, ((n1.ExpInstVar_Family() * v2.GetValue()) * v3.GetValue())); + }, + () => "P3", + () => "P3 Control", + () => 125, + () => "P3 skin", + () => "P4", + () => "P4 Control", + () => "P4 skin", + () => "Bonus", + () => 95, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => ((f0("Top") - f1("Top")) * 2); + }, + () => -1, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0((-1), (-1), f1(f2(3))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0((-1), f1(f2(3))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + const f2 = p._GetNode(2).GetBoundMethod(); + return () => f0((-1), (-1), f1(f2(2))); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 0, 1, 2); + }, + () => 200, + () => 150, + () => -281492157629439, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(255, 228, 228); + }, + () => 400, + () => 250, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(246, 229, 206); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(162, 226, 253); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(246, 252, 254); + }, + () => 1.5, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() - 0.001); + }, + () => 0.6, + () => "Game", + () => "american", + () => 0.8, + () => "bigball", + () => 1.1, + () => "smallball", + () => 0.5, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + ((((n1.ExpObject()) < (195) ? 1 : 0)) ? (5) : ((-5)))); + }, + () => 56, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + ((((n1.ExpObject()) > (195) ? 1 : 0)) ? (2) : ((-2)))); + }, + () => 114, + () => "Effect", + () => "goal", + () => 110, + () => 30, + () => "move", + () => "move2", + () => 450, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() - v1.GetValue()); + }, + p => { + const n0 = p._GetNode(0); + const v1 = p._GetNode(1).GetVar(); + return () => (n0.ExpObject() + v1.GetValue()); + }, + () => "shrink", + () => "bup", + () => -6, + () => 0.05, + () => "http://www.twoplayergames.org/?utm_source=Html5Game&utm_medium=SoccerRandom", + () => "NewWindow", + () => 70, + () => 205, + () => "Menu", + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() - n1.ExpObject()); + }, + () => -12, + () => "size", + () => -20, + () => 0.9, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(60); + }, + () => "disappear", + () => "OPOutMenu", + p => { + const n0 = p._GetNode(0); + return () => n0.ExpInstVar_Family(); + }, + p => { + const n0 = p._GetNode(0); + return () => n0.ExpBehavior("OPOutMenu"); + }, + () => 1.15, + p => { + const n0 = p._GetNode(0); + const n1 = p._GetNode(1); + return () => (n0.ExpObject() + n1.ExpInstVar()); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + const f1 = p._GetNode(1).GetBoundMethod(); + return () => (f0("Top") - f1("Top")); + }, + p => { + const f0 = p._GetNode(0).GetBoundMethod(); + return () => f0(0, 10); + }, + p => { + const n0 = p._GetNode(0); + return () => (n0.ExpObject() + 4); + }, + () => 0.4, + () => 20, + () => 35, + () => 40, + () => 170, + () => 4800, + () => 0.001, + () => 45, + () => 165, + () => 4700, + () => 48, + () => 0.65, + () => 50, + () => 160, + () => 4500, + () => 58, + () => 4000, + () => 12, + () => 74, + () => 0.7, + () => 2000, + () => 61, + () => 180, + () => 0.75, + () => 80, + () => 3500, + () => 9, + () => 0.0001, + () => 105, + () => 7.5, + () => 130, + () => 0.85, + () => 115, + () => 175, + () => 166, + () => 0.95, + () => 141, + () => 210, + () => 120, + () => 75, + () => 4100, + () => 171, + () => 242, + () => 137, + () => 5500, + () => 238, + () => 179, + () => 285, + () => 6000, + () => 272, + () => "AD STARTED - BROWSER LOG ", + () => "AD FINISHED - BROWSER LOG ", + () => "AD ERROR - BROWSER LOG " +]; + + +} + diff --git a/soccerrandom/scripts/dispatchworker.js b/soccerrandom/scripts/dispatchworker.js new file mode 100644 index 00000000..ade4d727 --- /dev/null +++ b/soccerrandom/scripts/dispatchworker.js @@ -0,0 +1,10 @@ +'use strict';self.inputPort=null;self.jobQueue=[];self.jobWorkers=[];self.sentBlobs=[];self.sentBuffers=[];self.importedScripts=[];self.lastBroadcasts=new Map; +class JobWorker{constructor(port,number){this._port=port;this._number=number;this._isReady=false;this._isBusy=false;this._port.onmessage=e=>this._OnMessage(e.data)}ImportScripts(scripts){this._port.postMessage({"type":"_import_scripts","scripts":scripts})}SendBlob(blob,id){this._port.postMessage({"type":"_send_blob","blob":blob,"id":id})}SendBuffer(buffer,id){this._port.postMessage({"type":"_send_buffer","buffer":buffer,"id":id})}SendJob(job){if(this._isBusy||!this._isReady)throw new Error("cannot take job"); +this._isBusy=true;this._port.postMessage(job,job["transferables"])}_InitBroadcast(job){this._port.postMessage(job,job["transferables"])}SendReady(){this._port.postMessage({"type":"_ready"})}IsReady(){return this._isReady}_OnReady(){this._isReady=true;this.MaybeStartNextJob()}IsBusy(){return this._isBusy}GetNumber(){return this._number}_OnMessage(msg){const type=msg["type"];switch(type){case "ready":this._OnReady();return;case "done":this._OnJobDone();return;default:console.error("unknown message from worker '"+ +type+"'");return}}_OnJobDone(){this._isBusy=false;this.MaybeStartNextJob()}MaybeStartNextJob(){if(this._isBusy||!this._isReady)return;const i=this._FindAvailableJob();if(i===-1)return;const job=self.jobQueue[i];const isBroadcast=job["isBroadcast"];if(isBroadcast){job["doneFlags"][this._number]=true;if(job["doneFlags"].every(x=>x))self.jobQueue.splice(i,1)}else self.jobQueue.splice(i,1);this.SendJob(job)}_FindAvailableJob(){for(let i=0,len=self.jobQueue.length;i=job["maxWorkerNum"])continue;if(!job["isBroadcast"]||this._number{const msg=e.data;const type=msg["type"];if(type==="_init"){self.inputPort=msg["in-port"];self.inputPort.onmessage=OnInputPortMessage}else if(type==="_addJobWorker")AddJobWorker(msg["port"])}); +function OnInputPortMessage(e){const msg=e.data;const type=msg["type"];if(type==="_cancel"){CancelJob(msg.jobId);return}else if(type==="_import_scripts"){const scripts=msg["scripts"];for(const w of self.jobWorkers)w.ImportScripts(scripts);self.importedScripts.push(scripts);return}else if(type==="_send_blob"){const blob=msg["blob"];const id=msg["id"];for(const w of self.jobWorkers)w.SendBlob(blob,id);self.sentBlobs.push([blob,id]);return}else if(type==="_send_buffer"){const buffer=msg["buffer"];const id= +msg["id"];for(const w of self.jobWorkers)w.SendBuffer(buffer,id);self.sentBuffers.push([buffer,id]);return}else if(type==="_no_more_workers"){self.sentBlobs.length=0;self.sentBuffers.length=0;self.importedScripts.length=0;self.lastBroadcasts.clear();return}self.jobQueue.push(msg);if(msg["isBroadcast"]){const maxWorkerNum=msg["maxWorkerNum"];const curWorkerCount=self.jobWorkers.length;const useWorkerCount=typeof maxWorkerNum==="number"?Math.min(maxWorkerNum,curWorkerCount):curWorkerCount;msg["doneFlags"]= +(new Array(useWorkerCount)).fill(false);msg["transferables"]=[];self.lastBroadcasts.set(msg["type"],msg)}for(const w of self.jobWorkers)w.MaybeStartNextJob()}; diff --git a/soccerrandom/scripts/jobworker.js b/soccerrandom/scripts/jobworker.js new file mode 100644 index 00000000..6f5140fb --- /dev/null +++ b/soccerrandom/scripts/jobworker.js @@ -0,0 +1,9 @@ +'use strict';self.dispatchPort=null;self.outputPort=null;self.workerNumber=-1;self.activeJobId=null;self.sentBlobs=new Map;self.sentBuffers=new Map;self.JobHandlers={}; +function FlipImageData(data,width,height){const stride=width*4;const tempRow=new Uint8Array(stride);const imageBuffer=data.buffer;for(let topY=0,len=Math.floor(height/2);topY{const msg=e.data;const type=msg["type"];switch(type){case "init":self.workerNumber=msg["number"];self.dispatchPort=msg["dispatch-port"];self.dispatchPort.onmessage=OnDispatchWorkerMessage;self.outputPort=msg["output-port"];return;case "terminate":self.close();return;default:console.error("unknown message '"+type+"'");return}});function SendReady(){self.dispatchPort.postMessage({"type":"ready"});self.outputPort.postMessage({"type":"ready"})} +function SendError(isBroadcast,e){if(!isBroadcast)self.outputPort.postMessage({"type":"error","jobId":self.activeJobId,"error":e.toString()});SendDone()}function SendResult(isBroadcast,ret){if(!isBroadcast){const transferables=ret.transferables||[];self.outputPort.postMessage({"type":"result","jobId":self.activeJobId,"result":ret.result},transferables)}SendDone()}function SendDone(){self.activeJobId=null;self.dispatchPort.postMessage({"type":"done"})} +function SendProgress(val){self.outputPort.postMessage({"type":"progress","jobId":self.activeJobId,"progress":val})} +function OnDispatchWorkerMessage(e){const msg=e.data;const type=msg["type"];if(type==="_import_scripts"){importScripts(...msg["scripts"]);return}else if(type==="_send_blob"){self.sentBlobs.set(msg["id"],msg["blob"]);return}else if(type==="_send_buffer"){self.sentBuffers.set(msg["id"],msg["buffer"]);return}else if(type==="_ready"){SendReady();return}const jobId=msg["jobId"];const isBroadcast=msg["isBroadcast"];const params=msg["params"];let ret;self.activeJobId=jobId;if(!self.JobHandlers.hasOwnProperty(type)){console.error(`no handler for message type '${type}'`); +return}try{ret=self.JobHandlers[type](params)}catch(e){SendError(isBroadcast,"Exception in job handler: "+e);return}if(ret&&ret.then)ret.then(asyncRet=>SendResult(isBroadcast,asyncRet)).catch(err=>SendError(isBroadcast,"Rejection in job handler: "+err));else SendResult(isBroadcast,ret)}; diff --git a/soccerrandom/scripts/main.js b/soccerrandom/scripts/main.js new file mode 100644 index 00000000..be63ec00 --- /dev/null +++ b/soccerrandom/scripts/main.js @@ -0,0 +1,275 @@ +'use strict';{window.DOMHandler=class DOMHandler{constructor(iRuntime,componentId){this._iRuntime=iRuntime;this._componentId=componentId;this._hasTickCallback=false;this._tickCallback=()=>this.Tick()}Attach(){}PostToRuntime(handler,data,dispatchOpts,transferables){this._iRuntime.PostToRuntimeComponent(this._componentId,handler,data,dispatchOpts,transferables)}PostToRuntimeAsync(handler,data,dispatchOpts,transferables){return this._iRuntime.PostToRuntimeComponentAsync(this._componentId,handler,data, +dispatchOpts,transferables)}_PostToRuntimeMaybeSync(name,data,dispatchOpts){if(this._iRuntime.UsesWorker())this.PostToRuntime(name,data,dispatchOpts);else this._iRuntime._GetLocalRuntime()["_OnMessageFromDOM"]({"type":"event","component":this._componentId,"handler":name,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null})}AddRuntimeMessageHandler(handler,func){this._iRuntime.AddRuntimeComponentMessageHandler(this._componentId,handler,func)}AddRuntimeMessageHandlers(list){for(const [handler, +func]of list)this.AddRuntimeMessageHandler(handler,func)}GetRuntimeInterface(){return this._iRuntime}GetComponentID(){return this._componentId}_StartTicking(){if(this._hasTickCallback)return;this._iRuntime._AddRAFCallback(this._tickCallback);this._hasTickCallback=true}_StopTicking(){if(!this._hasTickCallback)return;this._iRuntime._RemoveRAFCallback(this._tickCallback);this._hasTickCallback=false}Tick(){}};window.RateLimiter=class RateLimiter{constructor(callback,interval){this._callback=callback; +this._interval=interval;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._ignoreReset=false;this._canRunImmediate=false}SetCanRunImmediate(c){this._canRunImmediate=!!c}Call(){if(this._timerId!==-1)return;const nowTime=Date.now();const timeSinceLastCall=nowTime-this._lastCallTime;const interval=this._interval;if(timeSinceLastCall>=interval&&this._canRunImmediate){this._lastCallTime=nowTime;this._RunCallback()}else this._timerId=self.setTimeout(this._timerCallFunc, +Math.max(interval-timeSinceLastCall,4))}_RunCallback(){this._ignoreReset=true;this._callback();this._ignoreReset=false}Reset(){if(this._ignoreReset)return;this._CancelTimer();this._lastCallTime=Date.now()}_OnTimer(){this._timerId=-1;this._lastCallTime=Date.now();this._RunCallback()}_CancelTimer(){if(this._timerId!==-1){self.clearTimeout(this._timerId);this._timerId=-1}}Release(){this._CancelTimer();this._callback=null;this._timerCallFunc=null}}}; + + +'use strict';{class ElementState{constructor(elem){this._elem=elem;this._hadFirstUpdate=false;this._isVisibleFlag=true}SetVisibleFlag(f){this._isVisibleFlag=!!f}GetVisibleFlag(){return this._isVisibleFlag}HadFirstUpdate(){return this._hadFirstUpdate}SetHadFirstUpdate(){this._hadFirstUpdate=true}GetElement(){return this._elem}}window.DOMElementHandler=class DOMElementHandler extends self.DOMHandler{constructor(iRuntime,componentId){super(iRuntime,componentId);this._elementMap=new Map;this._autoAttach= +true;this.AddRuntimeMessageHandlers([["create",e=>this._OnCreate(e)],["destroy",e=>this._OnDestroy(e)],["set-visible",e=>this._OnSetVisible(e)],["update-position",e=>this._OnUpdatePosition(e)],["update-state",e=>this._OnUpdateState(e)],["focus",e=>this._OnSetFocus(e)],["set-css-style",e=>this._OnSetCssStyle(e)],["set-attribute",e=>this._OnSetAttribute(e)],["remove-attribute",e=>this._OnRemoveAttribute(e)]]);this.AddDOMElementMessageHandler("get-element",elem=>elem)}SetAutoAttach(e){this._autoAttach= +!!e}AddDOMElementMessageHandler(handler,func){this.AddRuntimeMessageHandler(handler,e=>{const elementId=e["elementId"];const elem=this.GetElementById(elementId);return func(elem,e)})}_OnCreate(e){const elementId=e["elementId"];const elem=this.CreateElement(elementId,e);const elementState=new ElementState(elem);this._elementMap.set(elementId,elementState);elem.style.boxSizing="border-box";elem.style.display="none";elementState.SetVisibleFlag(e["isVisible"]);const focusElem=this._GetFocusElement(elem); +focusElem.addEventListener("focus",e=>this._OnFocus(elementId));focusElem.addEventListener("blur",e=>this._OnBlur(elementId));if(this._autoAttach)document.body.appendChild(elem)}CreateElement(elementId,e){throw new Error("required override");}DestroyElement(elem){}_OnDestroy(e){const elementId=e["elementId"];const elem=this.GetElementById(elementId);this.DestroyElement(elem);if(this._autoAttach)elem.parentElement.removeChild(elem);this._elementMap.delete(elementId)}PostToRuntimeElement(handler,elementId, +data){if(!data)data={};data["elementId"]=elementId;this.PostToRuntime(handler,data)}_PostToRuntimeElementMaybeSync(handler,elementId,data){if(!data)data={};data["elementId"]=elementId;this._PostToRuntimeMaybeSync(handler,data)}_OnSetVisible(e){if(!this._autoAttach)return;const elemState=this._elementMap.get(e["elementId"]);const elem=elemState.GetElement();if(elemState.HadFirstUpdate())elem.style.display=e["isVisible"]?"":"none";else elemState.SetVisibleFlag(e["isVisible"])}_OnUpdatePosition(e){if(!this._autoAttach)return; +const elemState=this._elementMap.get(e["elementId"]);const elem=elemState.GetElement();elem.style.left=e["left"]+"px";elem.style.top=e["top"]+"px";elem.style.width=e["width"]+"px";elem.style.height=e["height"]+"px";const fontSize=e["fontSize"];if(fontSize!==null)elem.style.fontSize=fontSize+"em";if(!elemState.HadFirstUpdate()){elemState.SetHadFirstUpdate();if(elemState.GetVisibleFlag())elem.style.display=""}}_OnUpdateState(e){const elem=this.GetElementById(e["elementId"]);this.UpdateState(elem,e)}UpdateState(elem, +e){throw new Error("required override");}_GetFocusElement(elem){return elem}_OnFocus(elementId){this.PostToRuntimeElement("elem-focused",elementId)}_OnBlur(elementId){this.PostToRuntimeElement("elem-blurred",elementId)}_OnSetFocus(e){const elem=this._GetFocusElement(this.GetElementById(e["elementId"]));if(e["focus"])elem.focus();else elem.blur()}_OnSetCssStyle(e){const elem=this.GetElementById(e["elementId"]);const prop=e["prop"];const val=e["val"];if(prop.startsWith("--"))elem.style.setProperty(prop, +val);else elem.style[prop]=val}_OnSetAttribute(e){const elem=this.GetElementById(e["elementId"]);elem.setAttribute(e["name"],e["val"])}_OnRemoveAttribute(e){const elem=this.GetElementById(e["elementId"]);elem.removeAttribute(e["name"])}GetElementById(elementId){const elementState=this._elementMap.get(elementId);if(!elementState)throw new Error(`no element with id ${elementId}`);return elementState.GetElement()}}}; + + +'use strict';{const isiOSLike=/(iphone|ipod|ipad|macos|macintosh|mac os x)/i.test(navigator.userAgent);const isAndroid=/android/i.test(navigator.userAgent);const isSafari=/safari/i.test(navigator.userAgent)&&!/(chrome|chromium|edg\/|OPR\/|nwjs)/i.test(navigator.userAgent);let resolveCounter=0;function AddScript(url){const elem=document.createElement("script");elem.async=false;elem.type="module";if(url.isStringSrc)return new Promise(resolve=>{const resolveName="c3_resolve_"+resolveCounter;++resolveCounter; +self[resolveName]=resolve;elem.textContent=url.str+`\n\nself["${resolveName}"]();`;document.head.appendChild(elem)});else return new Promise((resolve,reject)=>{elem.onload=resolve;elem.onerror=reject;elem.src=url;document.head.appendChild(elem)})}let didCheckWorkerModuleSupport=false;let isWorkerModuleSupported=false;function SupportsWorkerTypeModule(){if(!didCheckWorkerModuleSupport){try{new Worker("blob://",{get type(){isWorkerModuleSupported=true}})}catch(e){}didCheckWorkerModuleSupport=true}return isWorkerModuleSupported} +let tmpAudio=new Audio;const supportedAudioFormats={"audio/webm; codecs=opus":!!tmpAudio.canPlayType("audio/webm; codecs=opus"),"audio/ogg; codecs=opus":!!tmpAudio.canPlayType("audio/ogg; codecs=opus"),"audio/webm; codecs=vorbis":!!tmpAudio.canPlayType("audio/webm; codecs=vorbis"),"audio/ogg; codecs=vorbis":!!tmpAudio.canPlayType("audio/ogg; codecs=vorbis"),"audio/mp4":!!tmpAudio.canPlayType("audio/mp4"),"audio/mpeg":!!tmpAudio.canPlayType("audio/mpeg")};tmpAudio=null;async function BlobToString(blob){const arrayBuffer= +await BlobToArrayBuffer(blob);const textDecoder=new TextDecoder("utf-8");return textDecoder.decode(arrayBuffer)}function BlobToArrayBuffer(blob){return new Promise((resolve,reject)=>{const fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsArrayBuffer(blob)})}const queuedArrayBufferReads=[];let activeArrayBufferReads=0;const MAX_ARRAYBUFFER_READS=8;window["RealFile"]=window["File"];const domHandlerClasses=[];const runtimeEventHandlers= +new Map;const pendingResponsePromises=new Map;let nextResponseId=0;const runOnStartupFunctions=[];self.runOnStartup=function runOnStartup(f){if(typeof f!=="function")throw new Error("runOnStartup called without a function");runOnStartupFunctions.push(f)};const WEBVIEW_EXPORT_TYPES=new Set(["cordova","playable-ad","instant-games"]);function IsWebViewExportType(exportType){return WEBVIEW_EXPORT_TYPES.has(exportType)}let isWrapperFullscreen=false;window.RuntimeInterface=class RuntimeInterface{constructor(opts){this._useWorker= +opts.useWorker;this._messageChannelPort=null;this._runtimeBaseUrl="";this._scriptFolder=opts.scriptFolder;this._workerScriptURLs={};this._worker=null;this._localRuntime=null;this._domHandlers=[];this._runtimeDomHandler=null;this._canvas=null;this._isExportingToVideo=false;this._exportToVideoDuration=0;this._jobScheduler=null;this._rafId=-1;this._rafFunc=()=>this._OnRAFCallback();this._rafCallbacks=[];this._exportType=opts.exportType;this._isFileProtocol=location.protocol.substr(0,4)==="file";if(this._useWorker&& +(typeof OffscreenCanvas==="undefined"||!navigator["userActivation"]||!SupportsWorkerTypeModule()))this._useWorker=false;if(this._useWorker&&isSafari)this._useWorker=false;if(this._exportType==="playable-ad"||this._exportType==="instant-games")this._useWorker=false;if(this._exportType==="cordova"&&this._useWorker)if(isAndroid){const chromeVer=/Chrome\/(\d+)/i.exec(navigator.userAgent);if(!chromeVer||!(parseInt(chromeVer[1],10)>=90))this._useWorker=false}else this._useWorker=false;this._localFileBlobs= +null;this._localFileStrings=null;if(this._exportType==="html5"&&!window.isSecureContext)console.warn("[Construct] Warning: the browser indicates this is not a secure context. Some features may be unavailable. Use secure (HTTPS) hosting to ensure all features are available.");this.AddRuntimeComponentMessageHandler("runtime","cordova-fetch-local-file",e=>this._OnCordovaFetchLocalFile(e));this.AddRuntimeComponentMessageHandler("runtime","create-job-worker",e=>this._OnCreateJobWorker(e));if(this._exportType=== +"cordova")document.addEventListener("deviceready",()=>this._Init(opts));else this._Init(opts)}Release(){this._CancelAnimationFrame();if(this._messageChannelPort){this._messageChannelPort.onmessage=null;this._messageChannelPort=null}if(this._worker){this._worker.terminate();this._worker=null}if(this._localRuntime){this._localRuntime.Release();this._localRuntime=null}if(this._canvas){this._canvas.parentElement.removeChild(this._canvas);this._canvas=null}}GetCanvas(){return this._canvas}GetRuntimeBaseURL(){return this._runtimeBaseUrl}UsesWorker(){return this._useWorker}GetExportType(){return this._exportType}IsFileProtocol(){return this._isFileProtocol}GetScriptFolder(){return this._scriptFolder}IsiOSCordova(){return isiOSLike&& +this._exportType==="cordova"}IsiOSWebView(){const ua=navigator.userAgent;return isiOSLike&&IsWebViewExportType(this._exportType)||navigator["standalone"]||/crios\/|fxios\/|edgios\//i.test(ua)}IsAndroid(){return isAndroid}IsAndroidWebView(){return isAndroid&&IsWebViewExportType(this._exportType)}async _Init(opts){if(this._exportType==="macos-wkwebview")this._SendWrapperMessage({"type":"ready"});if(this._exportType==="playable-ad"){this._localFileBlobs=self["c3_base64files"];this._localFileStrings= +{};await this._ConvertDataUrisToBlobs();for(let i=0,len=opts.engineScripts.length;i +{frameNum++;document.body.style.opacity=frameNum%2===0?"1":"0.999"})}if(opts.runtimeBaseUrl)this._runtimeBaseUrl=opts.runtimeBaseUrl;else{const origin=location.origin;this._runtimeBaseUrl=(origin==="null"?"file:///":origin)+location.pathname;const i=this._runtimeBaseUrl.lastIndexOf("/");if(i!==-1)this._runtimeBaseUrl=this._runtimeBaseUrl.substr(0,i+1)}if(opts.workerScripts)this._workerScriptURLs=opts.workerScripts;const messageChannel=new MessageChannel;this._messageChannelPort=messageChannel.port1; +this._messageChannelPort.onmessage=e=>this["_OnMessageFromRuntime"](e.data);if(window["c3_addPortMessageHandler"])window["c3_addPortMessageHandler"](e=>this._OnMessageFromDebugger(e));this._jobScheduler=new self.JobSchedulerDOM(this);await this._jobScheduler.Init();if(typeof window["StatusBar"]==="object")window["StatusBar"]["hide"]();if(typeof window["AndroidFullScreen"]==="object")try{await new Promise((resolve,reject)=>{window["AndroidFullScreen"]["immersiveMode"](resolve,reject)})}catch(err){console.error("Failed to enter Android immersive mode: ", +err)}if(this._useWorker)await this._InitWorker(opts,messageChannel.port2);else await this._InitDOM(opts,messageChannel.port2)}_GetWorkerURL(url){let ret;if(this._workerScriptURLs.hasOwnProperty(url))ret=this._workerScriptURLs[url];else if(url.endsWith("/workermain.js")&&this._workerScriptURLs.hasOwnProperty("workermain.js"))ret=this._workerScriptURLs["workermain.js"];else if(this._exportType==="playable-ad"&&this._localFileBlobs.hasOwnProperty(url))ret=this._localFileBlobs[url];else ret=url;if(ret instanceof +Blob)ret=URL.createObjectURL(ret);return ret}async CreateWorker(url,baseUrl,workerOpts){if(url.startsWith("blob:"))return new Worker(url,workerOpts);if(this._exportType==="cordova"&&this._isFileProtocol){let filePath="";if(workerOpts.isC3MainWorker)filePath=url;else filePath=this._scriptFolder+url;const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filePath);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return new Worker(URL.createObjectURL(blob),workerOpts)}const absUrl= +new URL(url,baseUrl);const isCrossOrigin=location.origin!==absUrl.origin;if(isCrossOrigin){const response=await fetch(absUrl);if(!response.ok)throw new Error("failed to fetch worker script");const blob=await response.blob();return new Worker(URL.createObjectURL(blob),workerOpts)}else return new Worker(absUrl,workerOpts)}_GetWindowInnerWidth(){return Math.max(window.innerWidth,1)}_GetWindowInnerHeight(){return Math.max(window.innerHeight,1)}_GetCommonRuntimeOptions(opts){return{"runtimeBaseUrl":this._runtimeBaseUrl, +"previewUrl":location.href,"windowInnerWidth":this._GetWindowInnerWidth(),"windowInnerHeight":this._GetWindowInnerHeight(),"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen(),"projectData":opts.projectData,"previewImageBlobs":window["cr_previewImageBlobs"]||this._localFileBlobs,"previewProjectFileBlobs":window["cr_previewProjectFileBlobs"],"previewProjectFileSWUrls":window["cr_previewProjectFiles"],"swClientId":window.cr_swClientId||"","exportType":opts.exportType, +"isDebug":(new URLSearchParams(self.location.search)).has("debug"),"ife":!!self.ife,"jobScheduler":this._jobScheduler.GetPortData(),"supportedAudioFormats":supportedAudioFormats,"opusWasmScriptUrl":window["cr_opusWasmScriptUrl"]||this._scriptFolder+"opus.wasm.js","opusWasmBinaryUrl":window["cr_opusWasmBinaryUrl"]||this._scriptFolder+"opus.wasm.wasm","isFileProtocol":this._isFileProtocol,"isiOSCordova":this.IsiOSCordova(),"isiOSWebView":this.IsiOSWebView(),"isFBInstantAvailable":typeof self["FBInstant"]!== +"undefined"}}async _InitWorker(opts,port2){const workerMainUrl=this._GetWorkerURL(opts.workerMainUrl);if(this._exportType==="preview"){this._worker=new Worker("previewworker.js",{type:"module",name:"Runtime"});await new Promise((resolve,reject)=>{const messageHandler=e=>{this._worker.removeEventListener("message",messageHandler);if(e.data&&e.data["type"]==="ok")resolve();else reject()};this._worker.addEventListener("message",messageHandler);this._worker.postMessage({"type":"construct-worker-init", +"import":(new URL(workerMainUrl,this._runtimeBaseUrl)).toString()})})}else this._worker=await this.CreateWorker(workerMainUrl,this._runtimeBaseUrl,{type:"module",name:"Runtime",isC3MainWorker:true});this._canvas=document.createElement("canvas");this._canvas.style.display="none";const offscreenCanvas=this._canvas["transferControlToOffscreen"]();document.body.appendChild(this._canvas);window["c3canvas"]=this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();let workerDependencyScripts= +opts.workerDependencyScripts||[];let engineScripts=opts.engineScripts;workerDependencyScripts=await Promise.all(workerDependencyScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));engineScripts=await Promise.all(engineScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));if(this._exportType==="cordova")for(let i=0,len=opts.projectScripts.length;inew C(this));this._FindRuntimeDOMHandler();this._runtimeDomHandler._EnableWindowResizeEvent();self["c3_callFunction"]=(name,params)=>this._runtimeDomHandler._InvokeFunctionFromJS(name,params);if(this._exportType==="preview")self["goToLastErrorScript"]=()=>this.PostToRuntimeComponent("runtime","go-to-last-error-script")}async _InitDOM(opts,port2){this._canvas=document.createElement("canvas");this._canvas.style.display="none";document.body.appendChild(this._canvas);window["c3canvas"]= +this._canvas;if(self["C3_InsertHTMLPlaceholders"])self["C3_InsertHTMLPlaceholders"]();this._domHandlers=domHandlerClasses.map(C=>new C(this));this._FindRuntimeDOMHandler();let engineScripts=opts.engineScripts.map(url=>typeof url==="string"?(new URL(url,this._runtimeBaseUrl)).toString():url);if(Array.isArray(opts.workerDependencyScripts)){const workerDependencyScripts=[...opts.workerDependencyScripts].map(s=>s instanceof Blob?URL.createObjectURL(s):s);engineScripts.unshift(...workerDependencyScripts)}engineScripts= +await Promise.all(engineScripts.map(url=>this._MaybeGetCordovaScriptURL(url)));await Promise.all(engineScripts.map(url=>AddScript(url)));const scriptsStatus=self["C3_ProjectScriptsStatus"];const mainProjectScript=opts.mainProjectScript;const allProjectScripts=opts.projectScripts;for(let [originalUrl,loadUrl]of allProjectScripts){if(!loadUrl)loadUrl=originalUrl;if(originalUrl===mainProjectScript)try{loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl);if(this._exportType=== +"preview"&&!scriptsStatus[originalUrl])this._ReportProjectMainScriptError(originalUrl,"main script did not run to completion")}catch(err){this._ReportProjectMainScriptError(originalUrl,err)}else if(originalUrl==="scriptsInEvents.js"||originalUrl.endsWith("/scriptsInEvents.js")){loadUrl=await this._MaybeGetCordovaScriptURL(loadUrl);await AddScript(loadUrl)}}if(this._exportType==="preview"&&typeof self.C3.ScriptsInEvents!=="object"){this._RemoveLoadingMessage();const msg="Failed to load JavaScript code used in events. Check all your JavaScript code has valid syntax."; +console.error("[C3 runtime] "+msg);alert(msg);return}const runtimeOpts=Object.assign(this._GetCommonRuntimeOptions(opts),{"isInWorker":false,"messagePort":port2,"canvas":this._canvas,"runOnStartupFunctions":runOnStartupFunctions});this._runtimeDomHandler._EnableWindowResizeEvent();this._OnBeforeCreateRuntime();this._localRuntime=self["C3_CreateRuntime"](runtimeOpts);await self["C3_InitRuntime"](this._localRuntime,runtimeOpts)}_ReportProjectMainScriptError(url,err){this._RemoveLoadingMessage();console.error(`[Preview] Failed to load project main script (${url}): `, +err);alert(`Failed to load project main script (${url}). Check all your JavaScript code has valid syntax. Press F12 and check the console for error details.`)}_OnBeforeCreateRuntime(){this._RemoveLoadingMessage()}_RemoveLoadingMessage(){const loadingElem=window.cr_previewLoadingElem;if(loadingElem){loadingElem.parentElement.removeChild(loadingElem);window.cr_previewLoadingElem=null}}async _OnCreateJobWorker(e){const outputPort=await this._jobScheduler._CreateJobWorker();return{"outputPort":outputPort, +"transferables":[outputPort]}}_GetLocalRuntime(){if(this._useWorker)throw new Error("not available in worker mode");return this._localRuntime}PostToRuntimeComponent(component,handler,data,dispatchOpts,transferables){this._messageChannelPort.postMessage({"type":"event","component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":null},transferables)}PostToRuntimeComponentAsync(component,handler,data,dispatchOpts,transferables){const responseId=nextResponseId++; +const ret=new Promise((resolve,reject)=>{pendingResponsePromises.set(responseId,{resolve,reject})});this._messageChannelPort.postMessage({"type":"event","component":component,"handler":handler,"dispatchOpts":dispatchOpts||null,"data":data,"responseId":responseId},transferables);return ret}["_OnMessageFromRuntime"](data){const type=data["type"];if(type==="event")return this._OnEventFromRuntime(data);else if(type==="result")this._OnResultFromRuntime(data);else if(type==="runtime-ready")this._OnRuntimeReady(); +else if(type==="alert-error"){this._RemoveLoadingMessage();alert(data["message"])}else if(type==="creating-runtime")this._OnBeforeCreateRuntime();else throw new Error(`unknown message '${type}'`);}_OnEventFromRuntime(e){const component=e["component"];const handler=e["handler"];const data=e["data"];const responseId=e["responseId"];const handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){console.warn(`[DOM] No event handlers for component '${component}'`);return}const func=handlerMap.get(handler); +if(!func){console.warn(`[DOM] No handler '${handler}' for component '${component}'`);return}let ret=null;try{ret=func(data)}catch(err){console.error(`Exception in '${component}' handler '${handler}':`,err);if(responseId!==null)this._PostResultToRuntime(responseId,false,""+err);return}if(responseId===null)return ret;else if(ret&&ret.then)ret.then(result=>this._PostResultToRuntime(responseId,true,result)).catch(err=>{console.error(`Rejection from '${component}' handler '${handler}':`,err);this._PostResultToRuntime(responseId, +false,""+err)});else this._PostResultToRuntime(responseId,true,ret)}_PostResultToRuntime(responseId,isOk,result){let transferables;if(result&&result["transferables"])transferables=result["transferables"];this._messageChannelPort.postMessage({"type":"result","responseId":responseId,"isOk":isOk,"result":result},transferables)}_OnResultFromRuntime(data){const responseId=data["responseId"];const isOk=data["isOk"];const result=data["result"];const pendingPromise=pendingResponsePromises.get(responseId); +if(isOk)pendingPromise.resolve(result);else pendingPromise.reject(result);pendingResponsePromises.delete(responseId)}AddRuntimeComponentMessageHandler(component,handler,func){let handlerMap=runtimeEventHandlers.get(component);if(!handlerMap){handlerMap=new Map;runtimeEventHandlers.set(component,handlerMap)}if(handlerMap.has(handler))throw new Error(`[DOM] Component '${component}' already has handler '${handler}'`);handlerMap.set(handler,func)}static AddDOMHandlerClass(Class){if(domHandlerClasses.includes(Class))throw new Error("DOM handler already added"); +domHandlerClasses.push(Class)}_FindRuntimeDOMHandler(){for(const dh of this._domHandlers)if(dh.GetComponentID()==="runtime"){this._runtimeDomHandler=dh;return}throw new Error("cannot find runtime DOM handler");}_OnMessageFromDebugger(e){this.PostToRuntimeComponent("debugger","message",e)}_OnRuntimeReady(){for(const h of this._domHandlers)h.Attach()}static IsDocumentFullscreen(){return!!(document["fullscreenElement"]||document["webkitFullscreenElement"]||document["mozFullScreenElement"]||isWrapperFullscreen)}static _SetWrapperIsFullscreenFlag(f){isWrapperFullscreen= +!!f}async GetRemotePreviewStatusInfo(){return await this.PostToRuntimeComponentAsync("runtime","get-remote-preview-status-info")}_AddRAFCallback(f){this._rafCallbacks.push(f);this._RequestAnimationFrame()}_RemoveRAFCallback(f){const i=this._rafCallbacks.indexOf(f);if(i===-1)throw new Error("invalid callback");this._rafCallbacks.splice(i,1);if(!this._rafCallbacks.length)this._CancelAnimationFrame()}_RequestAnimationFrame(){if(this._rafId===-1&&this._rafCallbacks.length)this._rafId=requestAnimationFrame(this._rafFunc)}_CancelAnimationFrame(){if(this._rafId!== +-1){cancelAnimationFrame(this._rafId);this._rafId=-1}}_OnRAFCallback(){this._rafId=-1;for(const f of this._rafCallbacks)f();this._RequestAnimationFrame()}TryPlayMedia(mediaElem){this._runtimeDomHandler.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._runtimeDomHandler.RemovePendingPlay(mediaElem)}_PlayPendingMedia(){this._runtimeDomHandler._PlayPendingMedia()}SetSilent(s){this._runtimeDomHandler.SetSilent(s)}IsAudioFormatSupported(typeStr){return!!supportedAudioFormats[typeStr]}async _WasmDecodeWebMOpus(arrayBuffer){const result= +await this.PostToRuntimeComponentAsync("runtime","opus-decode",{"arrayBuffer":arrayBuffer},null,[arrayBuffer]);return new Float32Array(result)}SetIsExportingToVideo(duration){this._isExportingToVideo=true;this._exportToVideoDuration=duration}IsExportingToVideo(){return this._isExportingToVideo}GetExportToVideoDuration(){return this._exportToVideoDuration}IsAbsoluteURL(url){return/^(?:[a-z\-]+:)?\/\//.test(url)||url.substr(0,5)==="data:"||url.substr(0,5)==="blob:"}IsRelativeURL(url){return!this.IsAbsoluteURL(url)}async _MaybeGetCordovaScriptURL(url){if(this._exportType=== +"cordova"&&(url.startsWith("file:")||this._isFileProtocol&&this.IsRelativeURL(url))){let filename=url;if(filename.startsWith(this._runtimeBaseUrl))filename=filename.substr(this._runtimeBaseUrl.length);const arrayBuffer=await this.CordovaFetchLocalFileAsArrayBuffer(filename);const blob=new Blob([arrayBuffer],{type:"application/javascript"});return URL.createObjectURL(blob)}else return url}async _OnCordovaFetchLocalFile(e){const filename=e["filename"];switch(e["as"]){case "text":return await this.CordovaFetchLocalFileAsText(filename); +case "buffer":return await this.CordovaFetchLocalFileAsArrayBuffer(filename);default:throw new Error("unsupported type");}}_GetPermissionAPI(){const api=window["cordova"]&&window["cordova"]["plugins"]&&window["cordova"]["plugins"]["permissions"];if(typeof api!=="object")throw new Error("Permission API is not loaded");return api}_MapPermissionID(api,permission){const permissionID=api[permission];if(typeof permissionID!=="string")throw new Error("Invalid permission name");return permissionID}_HasPermission(id){const api= +this._GetPermissionAPI();return new Promise((resolve,reject)=>api["checkPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}_RequestPermission(id){const api=this._GetPermissionAPI();return new Promise((resolve,reject)=>api["requestPermission"](this._MapPermissionID(api,id),status=>resolve(!!status["hasPermission"]),reject))}async RequestPermissions(permissions){if(this.GetExportType()!=="cordova")return true;if(this.IsiOSCordova())return true;for(const id of permissions){const alreadyGranted= +await this._HasPermission(id);if(alreadyGranted)continue;const granted=await this._RequestPermission(id);if(granted===false)return false}return true}async RequirePermissions(...permissions){if(await this.RequestPermissions(permissions)===false)throw new Error("Permission not granted");}CordovaFetchLocalFile(filename){const path=window["cordova"]["file"]["applicationDirectory"]+"www/"+filename;return new Promise((resolve,reject)=>{window["resolveLocalFileSystemURL"](path,entry=>{entry["file"](resolve, +reject)},reject)})}async CordovaFetchLocalFileAsText(filename){const file=await this.CordovaFetchLocalFile(filename);return await BlobToString(file)}_CordovaMaybeStartNextArrayBufferRead(){if(!queuedArrayBufferReads.length)return;if(activeArrayBufferReads>=MAX_ARRAYBUFFER_READS)return;activeArrayBufferReads++;const job=queuedArrayBufferReads.shift();this._CordovaDoFetchLocalFileAsAsArrayBuffer(job.filename,job.successCallback,job.errorCallback)}CordovaFetchLocalFileAsArrayBuffer(filename){return new Promise((resolve, +reject)=>{queuedArrayBufferReads.push({filename:filename,successCallback:result=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();resolve(result)},errorCallback:err=>{activeArrayBufferReads--;this._CordovaMaybeStartNextArrayBufferRead();reject(err)}});this._CordovaMaybeStartNextArrayBufferRead()})}async _CordovaDoFetchLocalFileAsAsArrayBuffer(filename,successCallback,errorCallback){try{const file=await this.CordovaFetchLocalFile(filename);const arrayBuffer=await BlobToArrayBuffer(file); +successCallback(arrayBuffer)}catch(err){errorCallback(err)}}_SendWrapperMessage(o){if(this._exportType==="windows-webview2")window["chrome"]["webview"]["postMessage"](JSON.stringify(o));else if(this._exportType==="macos-wkwebview")window["webkit"]["messageHandlers"]["C3Wrapper"]["postMessage"](JSON.stringify(o));else throw new Error("cannot send wrapper message");}async _ConvertDataUrisToBlobs(){const promises=[];for(const [filename,data]of Object.entries(this._localFileBlobs))promises.push(this._ConvertDataUriToBlobs(filename, +data));await Promise.all(promises)}async _ConvertDataUriToBlobs(filename,data){if(typeof data==="object"){this._localFileBlobs[filename]=new Blob([data["str"]],{"type":data["type"]});this._localFileStrings[filename]=data["str"]}else{let blob=await this._FetchDataUri(data);if(!blob)blob=this._DataURIToBinaryBlobSync(data);this._localFileBlobs[filename]=blob}}async _FetchDataUri(dataUri){try{const response=await fetch(dataUri);return await response.blob()}catch(err){console.warn("Failed to fetch a data: URI. Falling back to a slower workaround. This is probably because the Content Security Policy unnecessarily blocked it. Allow data: URIs in your CSP to avoid this.", +err);return null}}_DataURIToBinaryBlobSync(datauri){const o=this._ParseDataURI(datauri);return this._BinaryStringToBlob(o.data,o.mime_type)}_ParseDataURI(datauri){const comma=datauri.indexOf(",");if(comma<0)throw new URIError("expected comma in data: uri");const typepart=datauri.substring(5,comma);const datapart=datauri.substring(comma+1);const typearr=typepart.split(";");const mimetype=typearr[0]||"";const encoding1=typearr[1];const encoding2=typearr[2];let decodeddata;if(encoding1==="base64"||encoding2=== +"base64")decodeddata=atob(datapart);else decodeddata=decodeURIComponent(datapart);return{mime_type:mimetype,data:decodeddata}}_BinaryStringToBlob(binstr,mime_type){let len=binstr.length;let len32=len>>2;let a8=new Uint8Array(len);let a32=new Uint32Array(a8.buffer,0,len32);let i,j;for(i=0,j=0;i{const styleLink=document.createElement("link");styleLink.onload=()=>resolve(styleLink);styleLink.onerror=err=>reject(err);styleLink.rel="stylesheet";styleLink.href=cssUrl;document.head.appendChild(styleLink)})}function FetchImage(url){return new Promise((resolve,reject)=>{const img=new Image;img.onload=()=>resolve(img);img.onerror=err=>reject(err);img.src=url})}async function BlobToImage(blob){const blobUrl= +URL.createObjectURL(blob);try{return await FetchImage(blobUrl)}finally{URL.revokeObjectURL(blobUrl)}}function BlobToString(blob){return new Promise((resolve,reject)=>{let fileReader=new FileReader;fileReader.onload=e=>resolve(e.target.result);fileReader.onerror=err=>reject(err);fileReader.readAsText(blob)})}async function BlobToSvgImage(blob,width,height){if(!/firefox/i.test(navigator.userAgent))return await BlobToImage(blob);let str=await BlobToString(blob);const parser=new DOMParser;const doc=parser.parseFromString(str, +"image/svg+xml");const rootElem=doc.documentElement;if(rootElem.hasAttribute("width")&&rootElem.hasAttribute("height")){const widthStr=rootElem.getAttribute("width");const heightStr=rootElem.getAttribute("height");if(!widthStr.includes("%")&&!heightStr.includes("%"))return await BlobToImage(blob)}rootElem.setAttribute("width",width+"px");rootElem.setAttribute("height",height+"px");const serializer=new XMLSerializer;str=serializer.serializeToString(doc);blob=new Blob([str],{type:"image/svg+xml"}); +return await BlobToImage(blob)}function IsInContentEditable(el){do{if(el.parentNode&&el.hasAttribute("contenteditable"))return true;el=el.parentNode}while(el);return false}const keyboardInputElementTagNames=new Set(["input","textarea","datalist","select"]);function IsKeyboardInputElement(elem){return keyboardInputElementTagNames.has(elem.tagName.toLowerCase())||IsInContentEditable(elem)}const canvasOrDocTags=new Set(["canvas","body","html"]);function PreventDefaultOnCanvasOrDoc(e){if(!e.target.tagName)return; +const tagName=e.target.tagName.toLowerCase();if(canvasOrDocTags.has(tagName))e.preventDefault()}function BlockWheelZoom(e){if(e.metaKey||e.ctrlKey)e.preventDefault()}self["C3_GetSvgImageSize"]=async function(blob){const img=await BlobToImage(blob);if(img.width>0&&img.height>0)return[img.width,img.height];else{img.style.position="absolute";img.style.left="0px";img.style.top="0px";img.style.visibility="hidden";document.body.appendChild(img);const rc=img.getBoundingClientRect();document.body.removeChild(img); +return[rc.width,rc.height]}};self["C3_RasterSvgImageBlob"]=async function(blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight){const img=await BlobToSvgImage(blob,imageWidth,imageHeight);const canvas=document.createElement("canvas");canvas.width=surfaceWidth;canvas.height=surfaceHeight;const ctx=canvas.getContext("2d");ctx.drawImage(img,0,0,imageWidth,imageHeight);return canvas};let isCordovaPaused=false;document.addEventListener("pause",()=>isCordovaPaused=true);document.addEventListener("resume", +()=>isCordovaPaused=false);function ParentHasFocus(){try{return window.parent&&window.parent.document.hasFocus()}catch(err){return false}}function KeyboardIsVisible(){const elem=document.activeElement;if(!elem)return false;const tagName=elem.tagName.toLowerCase();const inputTypes=new Set(["email","number","password","search","tel","text","url"]);if(tagName==="textarea")return true;if(tagName==="input")return inputTypes.has(elem.type.toLowerCase()||"text");return IsInContentEditable(elem)}const DOM_COMPONENT_ID= +"runtime";const HANDLER_CLASS=class RuntimeDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._isFirstSizeUpdate=true;this._enableWindowResizeEvent=false;this._simulatedResizeTimerId=-1;this._targetOrientation="any";this._attachedDeviceOrientationEvent=false;this._attachedDeviceMotionEvent=false;this._screenReaderTextWrap=document.createElement("div");this._screenReaderTextWrap.className="c3-screen-reader-text";this._screenReaderTextWrap.setAttribute("aria-live", +"polite");document.body.appendChild(this._screenReaderTextWrap);this._debugHighlightElem=null;this._isExportToVideo=false;this._exportVideoProgressMessage="";this._exportVideoUpdateTimerId=-1;this._enableAndroidVKDetection=false;this._lastWindowWidth=iRuntime._GetWindowInnerWidth();this._lastWindowHeight=iRuntime._GetWindowInnerHeight();this._virtualKeyboardHeight=0;this._vkTranslateYOffset=0;iRuntime.AddRuntimeComponentMessageHandler("canvas","update-size",e=>this._OnUpdateCanvasSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"invoke-download",e=>this._OnInvokeDownload(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","load-webfonts",e=>this._OnLoadWebFonts(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","raster-svg-image",e=>this._OnRasterSvgImage(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","get-svg-image-size",e=>this._OnGetSvgImageSize(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","set-target-orientation",e=>this._OnSetTargetOrientation(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"register-sw",()=>this._OnRegisterSW());iRuntime.AddRuntimeComponentMessageHandler("runtime","post-to-debugger",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","go-to-script",e=>this._OnPostToDebugger(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","before-start-ticking",()=>this._OnBeforeStartTicking());iRuntime.AddRuntimeComponentMessageHandler("runtime","debug-highlight",e=>this._OnDebugHighlight(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"enable-device-orientation",()=>this._AttachDeviceOrientationEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","enable-device-motion",()=>this._AttachDeviceMotionEvent());iRuntime.AddRuntimeComponentMessageHandler("runtime","add-stylesheet",e=>this._OnAddStylesheet(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","script-create-worker",e=>this._OnScriptCreateWorker(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","alert",e=>this._OnAlert(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"screen-reader-text",e=>this._OnScreenReaderTextEvent(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","hide-cordova-splash",()=>this._OnHideCordovaSplash());iRuntime.AddRuntimeComponentMessageHandler("runtime","set-exporting-to-video",e=>this._SetExportingToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","export-to-video-progress",e=>this._OnExportVideoProgress(e));iRuntime.AddRuntimeComponentMessageHandler("runtime","exported-to-video",e=>this._OnExportedToVideo(e));iRuntime.AddRuntimeComponentMessageHandler("runtime", +"exported-to-image-sequence",e=>this._OnExportedToImageSequence(e));const allowDefaultContextMenuTagNames=new Set(["input","textarea","datalist"]);window.addEventListener("contextmenu",e=>{const t=e.target;const name=t.tagName.toLowerCase();if(!allowDefaultContextMenuTagNames.has(name)&&!IsInContentEditable(t))e.preventDefault()});const canvas=iRuntime.GetCanvas();window.addEventListener("selectstart",PreventDefaultOnCanvasOrDoc);window.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc); +canvas.addEventListener("selectstart",PreventDefaultOnCanvasOrDoc);canvas.addEventListener("gesturehold",PreventDefaultOnCanvasOrDoc);window.addEventListener("touchstart",PreventDefaultOnCanvasOrDoc,{"passive":false});if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc,{"passive":false});canvas.addEventListener("pointerdown",PreventDefaultOnCanvasOrDoc)}else canvas.addEventListener("touchstart",PreventDefaultOnCanvasOrDoc);this._mousePointerLastButtons= +0;window.addEventListener("mousedown",e=>{if(e.button===1)e.preventDefault()});window.addEventListener("mousewheel",BlockWheelZoom,{"passive":false});window.addEventListener("wheel",BlockWheelZoom,{"passive":false});window.addEventListener("resize",()=>this._OnWindowResize());window.addEventListener("fullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("webkitfullscreenchange",()=>this._OnFullscreenChange());window.addEventListener("mozfullscreenchange",()=>this._OnFullscreenChange()); +window.addEventListener("fullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("webkitfullscreenerror",e=>this._OnFullscreenError(e));window.addEventListener("mozfullscreenerror",e=>this._OnFullscreenError(e));if(iRuntime.IsiOSWebView())if(window["visualViewport"]){let lastVisualViewportHeight=Infinity;window["visualViewport"].addEventListener("resize",()=>{const curVisualViewportHeight=window["visualViewport"].height;if(curVisualViewportHeight>lastVisualViewportHeight)document.scrollingElement.scrollTop= +0;lastVisualViewportHeight=curVisualViewportHeight})}else window.addEventListener("focusout",()=>{if(!KeyboardIsVisible())document.scrollingElement.scrollTop=0});self["C3WrapperOnMessage"]=msg=>this._OnWrapperMessage(msg);this._mediaPendingPlay=new Set;this._mediaRemovedPendingPlay=new WeakSet;this._isSilent=false}_OnBeforeStartTicking(){self.setTimeout(()=>{this._enableAndroidVKDetection=true},1E3);if(this._iRuntime.GetExportType()==="cordova"){document.addEventListener("pause",()=>this._OnVisibilityChange(true)); +document.addEventListener("resume",()=>this._OnVisibilityChange(false))}else document.addEventListener("visibilitychange",()=>this._OnVisibilityChange(document.hidden));return{"isSuspended":!!(document.hidden||isCordovaPaused)}}Attach(){window.addEventListener("focus",()=>this._PostRuntimeEvent("window-focus"));window.addEventListener("blur",()=>{this._PostRuntimeEvent("window-blur",{"parentHasFocus":ParentHasFocus()});this._mousePointerLastButtons=0});window.addEventListener("focusin",e=>{if(IsKeyboardInputElement(e.target))this._PostRuntimeEvent("keyboard-blur")}); +window.addEventListener("keydown",e=>this._OnKeyEvent("keydown",e));window.addEventListener("keyup",e=>this._OnKeyEvent("keyup",e));window.addEventListener("dblclick",e=>this._OnMouseEvent("dblclick",e,DISPATCH_RUNTIME_AND_SCRIPT));window.addEventListener("wheel",e=>this._OnMouseWheelEvent("wheel",e));if(typeof PointerEvent!=="undefined"){window.addEventListener("pointerdown",e=>{this._HandlePointerDownFocus(e);this._OnPointerEvent("pointerdown",e)});if(this._iRuntime.UsesWorker()&&typeof window["onpointerrawupdate"]!== +"undefined"&&self===self.top)window.addEventListener("pointerrawupdate",e=>this._OnPointerRawUpdate(e));else window.addEventListener("pointermove",e=>this._OnPointerEvent("pointermove",e));window.addEventListener("pointerup",e=>this._OnPointerEvent("pointerup",e));window.addEventListener("pointercancel",e=>this._OnPointerEvent("pointercancel",e))}else{window.addEventListener("mousedown",e=>{this._HandlePointerDownFocus(e);this._OnMouseEventAsPointer("pointerdown",e)});window.addEventListener("mousemove", +e=>this._OnMouseEventAsPointer("pointermove",e));window.addEventListener("mouseup",e=>this._OnMouseEventAsPointer("pointerup",e));window.addEventListener("touchstart",e=>{this._HandlePointerDownFocus(e);this._OnTouchEvent("pointerdown",e)});window.addEventListener("touchmove",e=>this._OnTouchEvent("pointermove",e));window.addEventListener("touchend",e=>this._OnTouchEvent("pointerup",e));window.addEventListener("touchcancel",e=>this._OnTouchEvent("pointercancel",e))}const playFunc=()=>this._PlayPendingMedia(); +window.addEventListener("pointerup",playFunc,true);window.addEventListener("touchend",playFunc,true);window.addEventListener("click",playFunc,true);window.addEventListener("keydown",playFunc,true);window.addEventListener("gamepadconnected",playFunc,true);if(this._iRuntime.IsAndroid()&&!this._iRuntime.IsAndroidWebView()&&navigator["virtualKeyboard"]){navigator["virtualKeyboard"]["overlaysContent"]=true;navigator["virtualKeyboard"].addEventListener("geometrychange",()=>{this._OnAndroidVirtualKeyboardChange(this._GetWindowInnerHeight(), +navigator["virtualKeyboard"]["boundingRect"]["height"])})}}_OnAndroidVirtualKeyboardChange(windowHeight,vkHeight){document.body.style.transform="";this._vkTranslateYOffset=0;if(vkHeight>0){const activeElement=document.activeElement;if(activeElement){const rc=activeElement.getBoundingClientRect();const rcMidY=(rc.top+rc.bottom)/2;const targetY=(windowHeight-vkHeight)/2;let shiftY=rcMidY-targetY;if(shiftY>vkHeight)shiftY=vkHeight;if(shiftY<0)shiftY=0;if(shiftY>0){document.body.style.transform=`translateY(${-shiftY}px)`; +this._vkTranslateYOffset=shiftY}}}}_PostRuntimeEvent(name,data){this.PostToRuntime(name,data||null,DISPATCH_RUNTIME_ONLY)}_GetWindowInnerWidth(){return this._iRuntime._GetWindowInnerWidth()}_GetWindowInnerHeight(){return this._iRuntime._GetWindowInnerHeight()}_EnableWindowResizeEvent(){this._enableWindowResizeEvent=true;this._lastWindowWidth=this._iRuntime._GetWindowInnerWidth();this._lastWindowHeight=this._iRuntime._GetWindowInnerHeight()}_OnWindowResize(){if(this._isExportToVideo)return;if(!this._enableWindowResizeEvent)return; +const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();if(this._iRuntime.IsAndroidWebView())if(this._enableAndroidVKDetection)if(this._lastWindowWidth===width&&height0){this._virtualKeyboardHeight=0;this._OnAndroidVirtualKeyboardChange(height,this._virtualKeyboardHeight)}this._lastWindowWidth= +width;this._lastWindowHeight=height}else{this._lastWindowWidth=width;this._lastWindowHeight=height}this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()});if(this._iRuntime.IsiOSWebView()){if(this._simulatedResizeTimerId!==-1)clearTimeout(this._simulatedResizeTimerId);this._OnSimulatedResize(width,height,0)}}_ScheduleSimulatedResize(width,height,count){if(this._simulatedResizeTimerId!== +-1)clearTimeout(this._simulatedResizeTimerId);this._simulatedResizeTimerId=setTimeout(()=>this._OnSimulatedResize(width,height,count),48)}_OnSimulatedResize(originalWidth,originalHeight,count){const width=this._GetWindowInnerWidth();const height=this._GetWindowInnerHeight();this._simulatedResizeTimerId=-1;if(width!=originalWidth||height!=originalHeight)this.PostToRuntime("window-resize",{"innerWidth":width,"innerHeight":height,"devicePixelRatio":window.devicePixelRatio,"isFullscreen":RuntimeInterface.IsDocumentFullscreen()}); +else if(count<10)this._ScheduleSimulatedResize(width,height,count+1)}_OnSetTargetOrientation(e){this._targetOrientation=e["targetOrientation"]}_TrySetTargetOrientation(){const orientation=this._targetOrientation;if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=>console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result= +screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result=screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ",err)}}_OnFullscreenChange(){if(this._isExportToVideo)return;const isDocFullscreen=RuntimeInterface.IsDocumentFullscreen();if(isDocFullscreen&&this._targetOrientation!== +"any")this._TrySetTargetOrientation();this.PostToRuntime("fullscreenchange",{"isFullscreen":isDocFullscreen,"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnFullscreenError(e){console.warn("[Construct] Fullscreen request failed: ",e);this.PostToRuntime("fullscreenerror",{"isFullscreen":RuntimeInterface.IsDocumentFullscreen(),"innerWidth":this._GetWindowInnerWidth(),"innerHeight":this._GetWindowInnerHeight()})}_OnVisibilityChange(isHidden){if(isHidden)this._iRuntime._CancelAnimationFrame(); +else this._iRuntime._RequestAnimationFrame();this.PostToRuntime("visibilitychange",{"hidden":isHidden})}_OnKeyEvent(name,e){if(e.key==="Backspace")PreventDefaultOnCanvasOrDoc(e);if(this._isExportToVideo)return;const code=KEY_CODE_ALIASES.get(e.code)||e.code;this._PostToRuntimeMaybeSync(name,{"code":code,"key":e.key,"which":e.which,"repeat":e.repeat,"altKey":e.altKey,"ctrlKey":e.ctrlKey,"metaKey":e.metaKey,"shiftKey":e.shiftKey,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseWheelEvent(name, +e){if(this._isExportToVideo)return;this.PostToRuntime(name,{"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"deltaX":e.deltaX,"deltaY":e.deltaY,"deltaZ":e.deltaZ,"deltaMode":e.deltaMode,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnMouseEvent(name,e,opts){if(this._isExportToVideo)return;if(IsCompatibilityMouseEvent(e))return;this._PostToRuntimeMaybeSync(name,{"button":e.button,"buttons":e.buttons,"clientX":e.clientX, +"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"timeStamp":e.timeStamp},opts)}_OnMouseEventAsPointer(name,e){if(this._isExportToVideo)return;if(IsCompatibilityMouseEvent(e))return;const pointerId=1;const lastButtons=this._mousePointerLastButtons;if(name==="pointerdown"&&lastButtons!==0)name="pointermove";else if(name==="pointerup"&&e.buttons!==0)name="pointermove";this._PostToRuntimeMaybeSync(name, +{"pointerId":pointerId,"pointerType":"mouse","button":e.button,"buttons":e.buttons,"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"width":0,"height":0,"pressure":0,"tangentialPressure":0,"tiltX":0,"tiltY":0,"twist":0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT);this._mousePointerLastButtons=e.buttons;this._OnMouseEvent(e.type,e,DISPATCH_SCRIPT_ONLY)}_OnPointerEvent(name, +e){if(this._isExportToVideo)return;let lastButtons=0;if(e.pointerType==="mouse")lastButtons=this._mousePointerLastButtons;this._PostToRuntimeMaybeSync(name,{"pointerId":e.pointerId,"pointerType":e.pointerType,"button":e.button,"buttons":e.buttons,"lastButtons":lastButtons,"clientX":e.clientX,"clientY":e.clientY+this._vkTranslateYOffset,"pageX":e.pageX,"pageY":e.pageY+this._vkTranslateYOffset,"movementX":e.movementX||0,"movementY":e.movementY||0,"width":e.width||0,"height":e.height||0,"pressure":e.pressure|| +0,"tangentialPressure":e["tangentialPressure"]||0,"tiltX":e.tiltX||0,"tiltY":e.tiltY||0,"twist":e["twist"]||0,"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT);if(e.pointerType==="mouse"){let mouseEventName="mousemove";if(name==="pointerdown")mouseEventName="mousedown";else if(name==="pointerup")mouseEventName="mouseup";this._OnMouseEvent(mouseEventName,e,DISPATCH_SCRIPT_ONLY);this._mousePointerLastButtons=e.buttons}}_OnPointerRawUpdate(e){this._OnPointerEvent("pointermove",e)}_OnTouchEvent(fireName, +e){if(this._isExportToVideo)return;for(let i=0,len=e.changedTouches.length;ithis._OnDeviceOrientation(e));window.addEventListener("deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e))}_AttachDeviceMotionEvent(){if(this._attachedDeviceMotionEvent)return;this._attachedDeviceMotionEvent=true;window.addEventListener("devicemotion",e=>this._OnDeviceMotion(e))}_OnDeviceOrientation(e){if(this._isExportToVideo)return; +this.PostToRuntime("deviceorientation",{"absolute":!!e["absolute"],"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp,"webkitCompassHeading":e["webkitCompassHeading"],"webkitCompassAccuracy":e["webkitCompassAccuracy"]},DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceOrientationAbsolute(e){if(this._isExportToVideo)return;this.PostToRuntime("deviceorientationabsolute",{"absolute":!!e["absolute"],"alpha":e["alpha"]||0,"beta":e["beta"]||0,"gamma":e["gamma"]||0,"timeStamp":e.timeStamp}, +DISPATCH_RUNTIME_AND_SCRIPT)}_OnDeviceMotion(e){if(this._isExportToVideo)return;let accProp=null;const acc=e["acceleration"];if(acc)accProp={"x":acc["x"]||0,"y":acc["y"]||0,"z":acc["z"]||0};let withGProp=null;const withG=e["accelerationIncludingGravity"];if(withG)withGProp={"x":withG["x"]||0,"y":withG["y"]||0,"z":withG["z"]||0};let rotationRateProp=null;const rotationRate=e["rotationRate"];if(rotationRate)rotationRateProp={"alpha":rotationRate["alpha"]||0,"beta":rotationRate["beta"]||0,"gamma":rotationRate["gamma"]|| +0};this.PostToRuntime("devicemotion",{"acceleration":accProp,"accelerationIncludingGravity":withGProp,"rotationRate":rotationRateProp,"interval":e["interval"],"timeStamp":e.timeStamp},DISPATCH_RUNTIME_AND_SCRIPT)}_OnUpdateCanvasSize(e){const runtimeInterface=this.GetRuntimeInterface();if(runtimeInterface.IsExportingToVideo())return;const canvas=runtimeInterface.GetCanvas();canvas.style.width=e["styleWidth"]+"px";canvas.style.height=e["styleHeight"]+"px";canvas.style.marginLeft=e["marginLeft"]+"px"; +canvas.style.marginTop=e["marginTop"]+"px";document.documentElement.style.setProperty("--construct-scale",e["displayScale"]);if(this._isFirstSizeUpdate){canvas.style.display="";this._isFirstSizeUpdate=false}}_OnInvokeDownload(e){const url=e["url"];const filename=e["filename"];const a=document.createElement("a");const body=document.body;a.textContent=filename;a.href=url;a.download=filename;body.appendChild(a);a.click();body.removeChild(a)}async _OnLoadWebFonts(e){const webfonts=e["webfonts"];await Promise.all(webfonts.map(async info=> +{const fontFace=new FontFace(info.name,`url('${info.url}')`);document.fonts.add(fontFace);await fontFace.load()}))}async _OnRasterSvgImage(e){const blob=e["blob"];const imageWidth=e["imageWidth"];const imageHeight=e["imageHeight"];const surfaceWidth=e["surfaceWidth"];const surfaceHeight=e["surfaceHeight"];const imageBitmapOpts=e["imageBitmapOpts"];const canvas=await self["C3_RasterSvgImageBlob"](blob,imageWidth,imageHeight,surfaceWidth,surfaceHeight);let ret;if(imageBitmapOpts)ret=await createImageBitmap(canvas, +imageBitmapOpts);else ret=await createImageBitmap(canvas);return{"imageBitmap":ret,"transferables":[ret]}}async _OnGetSvgImageSize(e){return await self["C3_GetSvgImageSize"](e["blob"])}async _OnAddStylesheet(e){await AddStyleSheet(e["url"])}_PlayPendingMedia(){const mediaToTryPlay=[...this._mediaPendingPlay];this._mediaPendingPlay.clear();if(!this._isSilent)for(const mediaElem of mediaToTryPlay){const playRet=mediaElem.play();if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}}TryPlayMedia(mediaElem){if(typeof mediaElem.play!== +"function")throw new Error("missing play function");this._mediaRemovedPendingPlay.delete(mediaElem);let playRet;try{playRet=mediaElem.play()}catch(err){this._mediaPendingPlay.add(mediaElem);return}if(playRet)playRet.catch(err=>{if(!this._mediaRemovedPendingPlay.has(mediaElem))this._mediaPendingPlay.add(mediaElem)})}RemovePendingPlay(mediaElem){this._mediaPendingPlay.delete(mediaElem);this._mediaRemovedPendingPlay.add(mediaElem)}SetSilent(s){this._isSilent=!!s}_OnHideCordovaSplash(){if(navigator["splashscreen"]&& +navigator["splashscreen"]["hide"])navigator["splashscreen"]["hide"]()}_OnDebugHighlight(e){const show=e["show"];if(!show){if(this._debugHighlightElem)this._debugHighlightElem.style.display="none";return}if(!this._debugHighlightElem){this._debugHighlightElem=document.createElement("div");this._debugHighlightElem.id="inspectOutline";document.body.appendChild(this._debugHighlightElem)}const elem=this._debugHighlightElem;elem.style.display="";elem.style.left=e["left"]-1+"px";elem.style.top=e["top"]-1+ +"px";elem.style.width=e["width"]+2+"px";elem.style.height=e["height"]+2+"px";elem.textContent=e["name"]}_OnRegisterSW(){if(window["C3_RegisterSW"])window["C3_RegisterSW"]()}_OnPostToDebugger(data){if(!window["c3_postToMessagePort"])return;data["from"]="runtime";window["c3_postToMessagePort"](data)}_InvokeFunctionFromJS(name,params){return this.PostToRuntimeAsync("js-invoke-function",{"name":name,"params":params})}_OnScriptCreateWorker(e){const url=e["url"];const opts=e["opts"];const port2=e["port2"]; +const worker=new Worker(url,opts);worker.postMessage({"type":"construct-worker-init","port2":port2},[port2])}_OnAlert(e){alert(e["message"])}_OnWrapperMessage(msg){if(msg==="entered-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._OnFullscreenChange()}else if(msg==="exited-fullscreen"){RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._OnFullscreenChange()}else console.warn("Unknown wrapper message: ",msg)}_OnScreenReaderTextEvent(e){const type=e["type"];if(type==="create"){const p= +document.createElement("p");p.id="c3-sr-"+e["id"];p.textContent=e["text"];this._screenReaderTextWrap.appendChild(p)}else if(type==="update"){const p=document.getElementById("c3-sr-"+e["id"]);if(p)p.textContent=e["text"];else console.warn(`[Construct] Missing screen reader text with id ${e["id"]}`)}else if(type==="release"){const p=document.getElementById("c3-sr-"+e["id"]);if(p)p.remove();else console.warn(`[Construct] Missing screen reader text with id ${e["id"]}`)}else console.warn(`[Construct] Unknown screen reader text update '${type}'`)}_SetExportingToVideo(e){this._isExportToVideo= +true;const headerElem=document.createElement("h1");headerElem.id="exportToVideoMessage";headerElem.textContent=e["message"];document.body.prepend(headerElem);document.body.classList.add("exportingToVideo");this.GetRuntimeInterface().GetCanvas().style.display="";this._iRuntime.SetIsExportingToVideo(e["duration"])}_OnExportVideoProgress(e){this._exportVideoProgressMessage=e["message"];if(this._exportVideoUpdateTimerId===-1)this._exportVideoUpdateTimerId=setTimeout(()=>this._DoUpdateExportVideoProgressMessage(), +250)}_DoUpdateExportVideoProgressMessage(){this._exportVideoUpdateTimerId=-1;const headerElem=document.getElementById("exportToVideoMessage");if(headerElem)headerElem.textContent=this._exportVideoProgressMessage}_OnExportedToVideo(e){window.c3_postToMessagePort({"type":"exported-video","arrayBuffer":e["arrayBuffer"],"contentType":e["contentType"],"time":e["time"]})}_OnExportedToImageSequence(e){window.c3_postToMessagePort({"type":"exported-image-sequence","blobArr":e["blobArr"],"time":e["time"],"gif":e["gif"]})}}; +RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; + + +'use strict';{const DISPATCH_WORKER_SCRIPT_NAME="dispatchworker.js";const JOB_WORKER_SCRIPT_NAME="jobworker.js";self.JobSchedulerDOM=class JobSchedulerDOM{constructor(runtimeInterface){this._runtimeInterface=runtimeInterface;this._baseUrl=runtimeInterface.GetRuntimeBaseURL();if(runtimeInterface.GetExportType()==="preview")this._baseUrl+="workers/";else this._baseUrl+=runtimeInterface.GetScriptFolder();this._maxNumWorkers=Math.min(navigator.hardwareConcurrency||2,16);this._dispatchWorker=null;this._jobWorkers= +[];this._inputPort=null;this._outputPort=null}_GetWorkerScriptFolder(){if(this._runtimeInterface.GetExportType()==="playable-ad")return this._runtimeInterface.GetScriptFolder();else return""}async Init(){if(this._hasInitialised)throw new Error("already initialised");this._hasInitialised=true;const dispatchWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+DISPATCH_WORKER_SCRIPT_NAME);this._dispatchWorker=await this._runtimeInterface.CreateWorker(dispatchWorkerScriptUrl, +this._baseUrl,{name:"DispatchWorker"});const messageChannel=new MessageChannel;this._inputPort=messageChannel.port1;this._dispatchWorker.postMessage({"type":"_init","in-port":messageChannel.port2},[messageChannel.port2]);this._outputPort=await this._CreateJobWorker()}async _CreateJobWorker(){const number=this._jobWorkers.length;const jobWorkerScriptUrl=this._runtimeInterface._GetWorkerURL(this._GetWorkerScriptFolder()+JOB_WORKER_SCRIPT_NAME);const jobWorker=await this._runtimeInterface.CreateWorker(jobWorkerScriptUrl, +this._baseUrl,{name:"JobWorker"+number});const dispatchChannel=new MessageChannel;const outputChannel=new MessageChannel;this._dispatchWorker.postMessage({"type":"_addJobWorker","port":dispatchChannel.port1},[dispatchChannel.port1]);jobWorker.postMessage({"type":"init","number":number,"dispatch-port":dispatchChannel.port2,"output-port":outputChannel.port2},[dispatchChannel.port2,outputChannel.port2]);this._jobWorkers.push(jobWorker);return outputChannel.port1}GetPortData(){return{"inputPort":this._inputPort, +"outputPort":this._outputPort,"maxNumWorkers":this._maxNumWorkers}}GetPortTransferables(){return[this._inputPort,this._outputPort]}}}; + + +'use strict';{if(window["C3_IsSupported"]){const enableWorker=false;window["c3_runtimeInterface"]=new self.RuntimeInterface({useWorker:enableWorker,workerMainUrl:"workermain.js",engineScripts:["scripts/c3runtime.js"],projectScripts:[["scripts/project/FrameRateLimit.js"], ["scripts/project/scriptsInEvents.js"]],mainProjectScript:"scripts/project/FrameRateLimit.js",scriptFolder:"scripts/",workerDependencyScripts:[],exportType:"html5"})}}; +'use strict';{const R_TO_D=180/Math.PI;const DOM_COMPONENT_ID="audio";self.AudioDOMHandler=class AudioDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._audioContext=null;this._destinationNode=null;this._hasUnblocked=false;this._hasAttachedUnblockEvents=false;this._unblockFunc=()=>this._UnblockAudioContext();this._audioBuffers=[];this._audioInstances=[];this._lastAudioInstance=null;this._lastPlayedTags=[];this._loadedAudioUrls=new Set;this._lastTickCount= +-1;this._pendingTags=new Map;this._masterVolume=1;this._isSilent=false;this._timeScaleMode=0;this._timeScale=1;this._gameTime=0;this._panningModel="HRTF";this._distanceModel="inverse";this._refDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._lastListenerPos=[0,0,0];this._lastListenerOrientation=[0,0,-1,0,1,0];this._playMusicAsSound=false;this._hasAnySoftwareDecodedMusic=false;this._supportsWebMOpus=this._iRuntime.IsAudioFormatSupported("audio/webm; codecs=opus");this._effects=new Map; +this._analysers=new Set;this._isPendingPostFxState=false;this._hasStartedOfflineRender=false;this._microphoneTag="";this._microphoneSource=null;self["C3Audio_OnMicrophoneStream"]=(localMediaStream,tag)=>this._OnMicrophoneStream(localMediaStream,tag);this._destMediaStreamNode=null;self["C3Audio_GetOutputStream"]=()=>this._OnGetOutputStream();self["C3Audio_DOMInterface"]=this;this.AddRuntimeMessageHandlers([["create-audio-context",e=>this._CreateAudioContext(e)],["play",e=>this._Play(e)],["stop",e=> +this._Stop(e)],["stop-all",()=>this._StopAll()],["set-paused",e=>this._SetPaused(e)],["set-volume",e=>this._SetVolume(e)],["fade-volume",e=>this._FadeVolume(e)],["set-master-volume",e=>this._SetMasterVolume(e)],["set-muted",e=>this._SetMuted(e)],["set-silent",e=>this._SetSilent(e)],["set-looping",e=>this._SetLooping(e)],["set-playback-rate",e=>this._SetPlaybackRate(e)],["set-stereo-pan",e=>this._SetStereoPan(e)],["seek",e=>this._Seek(e)],["preload",e=>this._Preload(e)],["unload",e=>this._Unload(e)], +["unload-all",()=>this._UnloadAll()],["set-suspended",e=>this._SetSuspended(e)],["add-effect",e=>this._AddEffect(e)],["set-effect-param",e=>this._SetEffectParam(e)],["remove-effects",e=>this._RemoveEffects(e)],["tick",e=>this._OnTick(e)],["load-state",e=>this._OnLoadState(e)],["offline-render-audio",e=>this._OnOfflineRenderAudio(e)],["offline-render-finish",()=>this._OnOfflineRenderFinish()]])}async _CreateAudioContext(e){if(e["isiOSCordova"]||e["isSafari"])this._playMusicAsSound=true;this._timeScaleMode= +e["timeScaleMode"];this._panningModel=["equalpower","HRTF","soundfield"][e["panningModel"]];this._distanceModel=["linear","inverse","exponential"][e["distanceModel"]];this._refDistance=e["refDistance"];this._maxDistance=e["maxDistance"];this._rolloffFactor=e["rolloffFactor"];if(this._iRuntime.IsExportingToVideo()){this._playMusicAsSound=true;const sampleRate=48E3;this._audioContext=new OfflineAudioContext({"numberOfChannels":2,"sampleRate":sampleRate,"length":Math.ceil(this._iRuntime.GetExportToVideoDuration()* +sampleRate)})}else{const opts={"latencyHint":e["latencyHint"]};if(!this.SupportsWebMOpus())opts["sampleRate"]=48E3;if(typeof AudioContext!=="undefined")this._audioContext=new AudioContext(opts);else if(typeof webkitAudioContext!=="undefined")this._audioContext=new webkitAudioContext(opts);else throw new Error("Web Audio API not supported");this._AttachUnblockEvents();this._audioContext.onstatechange=()=>{if(this._audioContext.state!=="running")this._AttachUnblockEvents();this.PostToRuntime("audiocontext-state", +{"audioContextState":this._audioContext.state})}}this._destinationNode=this._audioContext["createGain"]();this._destinationNode["connect"](this._audioContext["destination"]);const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]);this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation); +self["C3_GetAudioContextCurrentTime"]=()=>this.GetAudioCurrentTime();try{await Promise.all(e["preloadList"].map(o=>this._GetAudioBuffer(o["originalUrl"],o["url"],o["type"],false)))}catch(err){console.error("[Construct] Preloading sounds failed: ",err)}return{"sampleRate":this._audioContext["sampleRate"],"audioContextState":this._audioContext.state,"outputLatency":this._audioContext["outputLatency"]||0}}_AttachUnblockEvents(){if(this._hasAttachedUnblockEvents)return;this._hasUnblocked=false;window.addEventListener("pointerup", +this._unblockFunc,true);window.addEventListener("touchend",this._unblockFunc,true);window.addEventListener("click",this._unblockFunc,true);window.addEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=true}_DetachUnblockEvents(){if(!this._hasAttachedUnblockEvents)return;this._hasUnblocked=true;window.removeEventListener("pointerup",this._unblockFunc,true);window.removeEventListener("touchend",this._unblockFunc,true);window.removeEventListener("click",this._unblockFunc,true); +window.removeEventListener("keydown",this._unblockFunc,true);this._hasAttachedUnblockEvents=false}_UnblockAudioContext(){if(this._hasUnblocked)return;const audioContext=this._audioContext;if(audioContext["state"]==="suspended"&&audioContext["resume"])audioContext["resume"]();const buffer=audioContext["createBuffer"](1,220,22050);const source=audioContext["createBufferSource"]();source["buffer"]=buffer;source["connect"](audioContext["destination"]);source["start"](0);if(audioContext["state"]==="running")this._DetachUnblockEvents()}_MatchTagLists(tagArr1, +tagArr2){for(const t2 of tagArr2){let found=false;for(const t1 of tagArr1)if(self.AudioDOMHandler.EqualsNoCase(t1,t2)){found=true;break}if(!found)return false}return true}GetAudioContext(){return this._audioContext}GetAudioCurrentTime(){return this._audioContext["currentTime"]}GetDestinationNode(){return this._destinationNode}GetDestinationForTag(tag){const fxChain=this._effects.get(tag.toLowerCase());if(fxChain)return fxChain[0].GetInputNode();else return this.GetDestinationNode()}AddEffectForTag(tag, +effect){tag=tag.toLowerCase();let fxChain=this._effects.get(tag);if(!fxChain){fxChain=[];this._effects.set(tag,fxChain)}effect._SetIndex(fxChain.length);effect._SetTag(tag);fxChain.push(effect);this._ReconnectEffects(tag)}_ReconnectEffects(tag){tag=tag.toLowerCase();let destNode=this.GetDestinationNode();const fxChain=this._effects.get(tag);if(fxChain&&fxChain.length){destNode=fxChain[0].GetInputNode();for(let i=0,len=fxChain.length;i{const audioBuffer=this._audioContext["createBuffer"](1,rawAudio.length,48E3);const channelBuffer=audioBuffer["getChannelData"](0);channelBuffer.set(rawAudio); +return audioBuffer});else return new Promise((resolve,reject)=>{this._audioContext["decodeAudioData"](audioData,resolve,reject)})}TryPlayMedia(mediaElem){this._iRuntime.TryPlayMedia(mediaElem)}RemovePendingPlay(mediaElem){this._iRuntime.RemovePendingPlay(mediaElem)}ReleaseInstancesForBuffer(buffer){let j=0;for(let i=0,len=this._audioInstances.length;i0)for(const ai of this._audioInstances){if(this._MatchTagLists(ai.GetTags(),tags))yield ai}else if(this._lastAudioInstance&&!this._lastAudioInstance.HasEnded())yield this._lastAudioInstance}*audioInstancesByEffectTag(tag){if(tag)for(const ai of this._audioInstances){if(self.AudioDOMHandler.EqualsNoCase(ai.GetEffectTag(), +tag))yield ai}else if(this._lastAudioInstance&&!this._lastAudioInstance.HasEnded())yield this._lastAudioInstance}async _GetAudioBuffer(originalUrl,url,type,isMusic,dontCreate){for(const ab of this._audioBuffers)if(ab.GetUrl()===url){await ab.Load();return ab}if(dontCreate)return null;if(isMusic&&(this._playMusicAsSound||this._hasAnySoftwareDecodedMusic))this.ReleaseAllMusicBuffers();const ret=self.C3AudioBuffer.Create(this,originalUrl,url,type,isMusic);this._audioBuffers.push(ret);await ret.Load(); +if(!this._loadedAudioUrls.has(originalUrl)){this.PostToRuntime("buffer-metadata",{"originalUrl":originalUrl,"duration":ret.GetDuration()});this._loadedAudioUrls.add(originalUrl)}return ret}async _GetAudioInstance(originalUrl,url,type,tags,isMusic){for(const ai of this._audioInstances)if(ai.GetUrl()===url&&(ai.CanBeRecycled()||isMusic)){ai.SetTags(tags);return ai}const buffer=await this._GetAudioBuffer(originalUrl,url,type,isMusic);const ret=buffer.CreateInstance(tags);this._audioInstances.push(ret); +return ret}_AddPendingTags(tags){const tagStr=tags.join(" ");let info=this._pendingTags.get(tagStr);if(!info){let resolve=null;const promise=new Promise(r=>resolve=r);info={pendingCount:0,promise,resolve};this._pendingTags.set(tagStr,info)}info.pendingCount++}_RemovePendingTags(tags){const tagStr=tags.join(" ");const info=this._pendingTags.get(tagStr);if(!info)throw new Error("expected pending tag");info.pendingCount--;if(info.pendingCount===0){info.resolve();this._pendingTags.delete(tagStr)}}TagsReady(tags){const tagStr= +(tags.length===0?this._lastPlayedTags:tags).join(" ");const info=this._pendingTags.get(tagStr);if(info)return info.promise;else return Promise.resolve()}_MaybeStartTicking(){if(this._analysers.size>0){this._StartTicking();return}for(const ai of this._audioInstances)if(ai.IsActive()){this._StartTicking();return}}Tick(){for(const a of this._analysers)a.Tick();const currentTime=this.GetAudioCurrentTime();for(const ai of this._audioInstances)ai.Tick(currentTime);const instStates=this._audioInstances.filter(a=> +a.IsActive()).map(a=>a.GetState());this.PostToRuntime("state",{"tickCount":this._lastTickCount,"outputLatency":this._audioContext["outputLatency"]||0,"audioInstances":instStates,"analysers":[...this._analysers].map(a=>a.GetData())});if(instStates.length===0&&this._analysers.size===0)this._StopTicking()}PostTrigger(type,tags,aiid){this.PostToRuntime("trigger",{"type":type,"tags":tags,"aiid":aiid})}async _Play(e){const originalUrl=e["originalUrl"];const url=e["url"];const type=e["type"];const isMusic= +e["isMusic"];const tags=e["tags"];const isLooping=e["isLooping"];const volume=e["vol"];const position=e["pos"];const panning=e["panning"];const stereoPan=e["stereoPan"];let startTime=e["off"];if(startTime>0&&!e["trueClock"])if(this._audioContext["getOutputTimestamp"]){const outputTimestamp=this._audioContext["getOutputTimestamp"]();startTime=startTime-outputTimestamp["performanceTime"]/1E3+outputTimestamp["contextTime"]}else startTime=startTime-performance.now()/1E3+this._audioContext["currentTime"]; +this._lastPlayedTags=tags.slice(0);this._AddPendingTags(tags);try{this._lastAudioInstance=await this._GetAudioInstance(originalUrl,url,type,tags,isMusic);if(panning){this._lastAudioInstance.SetPannerEnabled(true);this._lastAudioInstance.SetPan(panning["x"],panning["y"],panning["z"],panning["angle"],panning["innerAngle"],panning["outerAngle"],panning["outerGain"]);if(panning.hasOwnProperty("uid"))this._lastAudioInstance.SetUID(panning["uid"])}else if(typeof stereoPan==="number"&&stereoPan!==0){this._lastAudioInstance.SetStereoPannerEnabled(true); +this._lastAudioInstance.SetStereoPan(stereoPan)}else{this._lastAudioInstance.SetPannerEnabled(false);this._lastAudioInstance.SetStereoPannerEnabled(false)}this._lastAudioInstance.Play(isLooping,volume,position,startTime)}catch(err){console.error("[Construct] Audio: error starting playback: ",err);return}finally{this._RemovePendingTags(tags)}this._StartTicking()}_Stop(e){const tags=e["tags"];for(const ai of this.audioInstancesMatchingTags(tags))ai.Stop()}_StopAll(){for(const ai of this._audioInstances)ai.Stop()}_SetPaused(e){const tags= +e["tags"];const paused=e["paused"];for(const ai of this.audioInstancesMatchingTags(tags))if(paused)ai.Pause();else ai.Resume();this._MaybeStartTicking()}_SetVolume(e){const tags=e["tags"];const vol=e["vol"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetVolume(vol)}_SetStereoPan(e){const tags=e["tags"];const p=e["p"];for(const ai of this.audioInstancesMatchingTags(tags)){ai.SetStereoPannerEnabled(true);ai.SetStereoPan(p)}}async _FadeVolume(e){const tags=e["tags"];const vol=e["vol"];const duration= +e["duration"];const stopOnEnd=e["stopOnEnd"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.FadeVolume(vol,duration,stopOnEnd);this._MaybeStartTicking()}_SetMasterVolume(e){this._masterVolume=e["vol"];this._destinationNode["gain"]["value"]=this._masterVolume}_SetMuted(e){const tags=e["tags"];const isMuted=e["isMuted"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetMuted(isMuted)}_SetSilent(e){this._isSilent=e["isSilent"];this._iRuntime.SetSilent(this._isSilent); +for(const ai of this._audioInstances)ai._UpdateMuted()}_SetLooping(e){const tags=e["tags"];const isLooping=e["isLooping"];for(const ai of this.audioInstancesMatchingTags(tags))ai.SetLooping(isLooping)}async _SetPlaybackRate(e){const tags=e["tags"];const rate=e["rate"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.SetPlaybackRate(rate)}async _Seek(e){const tags=e["tags"];const pos=e["pos"];await this.TagsReady(tags);for(const ai of this.audioInstancesMatchingTags(tags))ai.Seek(pos)}async _Preload(e){const originalUrl= +e["originalUrl"];const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];try{await this._GetAudioInstance(originalUrl,url,type,"",isMusic)}catch(err){console.error("[Construct] Audio: error preloading: ",err)}}async _Unload(e){const url=e["url"];const type=e["type"];const isMusic=e["isMusic"];const buffer=await this._GetAudioBuffer("",url,type,isMusic,true);if(!buffer)return;buffer.Release();const i=this._audioBuffers.indexOf(buffer);if(i!==-1)this._audioBuffers.splice(i,1)}_UnloadAll(){for(const buffer of this._audioBuffers)buffer.Release(); +this._audioBuffers.length=0}_SetSuspended(e){const isSuspended=e["isSuspended"];if(!isSuspended&&this._audioContext["resume"])this._audioContext["resume"]();for(const ai of this._audioInstances)ai.SetSuspended(isSuspended);if(isSuspended&&this._audioContext["suspend"])this._audioContext["suspend"]()}_OnTick(e){this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];this._lastTickCount=e["tickCount"];if(this._timeScaleMode!==0)for(const ai of this._audioInstances)ai._UpdatePlaybackRate();const listenerPos= +e["listenerPos"];if(listenerPos&&(this._lastListenerPos[0]!==listenerPos[0]||this._lastListenerPos[1]!==listenerPos[1]||this._lastListenerPos[2]!==listenerPos[2])){this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2])}const listenerOrientation=e["listenerOrientation"];if(listenerOrientation&&(this._lastListenerOrientation[0]!==listenerOrientation[0]|| +this._lastListenerOrientation[1]!==listenerOrientation[1]||this._lastListenerOrientation[2]!==listenerOrientation[2]||this._lastListenerOrientation[3]!==listenerOrientation[3]||this._lastListenerOrientation[4]!==listenerOrientation[4]||this._lastListenerOrientation[5]!==listenerOrientation[5])){for(let i=0;i<6;++i)this._lastListenerOrientation[i]=listenerOrientation[i];this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation)}for(const instPan of e["instPans"]){const uid= +instPan["uid"];for(const ai of this._audioInstances)if(ai.GetUID()===uid)ai.SetPanXYZA(instPan["x"],instPan["y"],instPan["z"],instPan["angle"])}}async _AddEffect(e){const type=e["type"];const tags=e["tags"];const params=e["params"];let effect;let convolutionBuffer;if(type==="convolution")try{convolutionBuffer=await this._GetAudioBuffer(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"],false)}catch(err){console.log("[Construct] Audio: error loading convolution: ",err);return}for(const tag of tags){if(type=== +"filter")effect=new self.C3AudioFilterFX(this,...params);else if(type==="delay")effect=new self.C3AudioDelayFX(this,...params);else if(type==="convolution"){effect=new self.C3AudioConvolveFX(this,convolutionBuffer.GetAudioBuffer(),...params);effect._SetBufferInfo(e["bufferOriginalUrl"],e["bufferUrl"],e["bufferType"])}else if(type==="flanger")effect=new self.C3AudioFlangerFX(this,...params);else if(type==="phaser")effect=new self.C3AudioPhaserFX(this,...params);else if(type==="gain")effect=new self.C3AudioGainFX(this, +...params);else if(type==="stereopan")effect=new self.C3AudioStereoPanFX(this,...params);else if(type==="tremolo")effect=new self.C3AudioTremoloFX(this,...params);else if(type==="ringmod")effect=new self.C3AudioRingModFX(this,...params);else if(type==="distortion")effect=new self.C3AudioDistortionFX(this,...params);else if(type==="compressor")effect=new self.C3AudioCompressorFX(this,...params);else if(type==="analyser")effect=new self.C3AudioAnalyserFX(this,...params);else throw new Error("invalid effect type"); +this.AddEffectForTag(tag,effect)}this._PostUpdatedFxState()}_SetEffectParam(e){const tags=e["tags"];const index=e["index"];const param=e["param"];const value=e["value"];const ramp=e["ramp"];const time=e["time"];for(const tag of tags){const fxChain=this._effects.get(tag.toLowerCase());if(!fxChain||index<0||index>=fxChain.length)continue;fxChain[index].SetParam(param,value,ramp,time)}this._PostUpdatedFxState()}_RemoveEffects(e){const tags=e["tags"];for(const tag of tags){const lowerTag=tag.toLowerCase(); +const fxChain=this._effects.get(lowerTag);if(!fxChain||!fxChain.length)return;for(const effect of fxChain)effect.Release();this._effects.delete(lowerTag);this._ReconnectEffects(lowerTag)}}_AddAnalyser(analyser){this._analysers.add(analyser);this._MaybeStartTicking()}_RemoveAnalyser(analyser){this._analysers.delete(analyser)}_PostUpdatedFxState(){if(this._isPendingPostFxState)return;this._isPendingPostFxState=true;Promise.resolve().then(()=>this._DoPostUpdatedFxState())}_DoPostUpdatedFxState(){const fxstate= +{};for(const [tag,fxChain]of this._effects)fxstate[tag]=fxChain.map(e=>e.GetState());this.PostToRuntime("fxstate",{"fxstate":fxstate});this._isPendingPostFxState=false}async _OnLoadState(e){const saveLoadMode=e["saveLoadMode"];if(saveLoadMode!==3){const keepAudioInstances=[];for(const ai of this._audioInstances)if(ai.IsMusic()&&saveLoadMode===1||!ai.IsMusic()&&saveLoadMode===2)keepAudioInstances.push(ai);else ai.Release();this._audioInstances=keepAudioInstances}for(const fxChain of this._effects.values())for(const effect of fxChain)effect.Release(); +this._effects.clear();this._timeScale=e["timeScale"];this._gameTime=e["gameTime"];const listenerPos=e["listenerPos"];this._lastListenerPos[0]=listenerPos[0];this._lastListenerPos[1]=listenerPos[1];this._lastListenerPos[2]=listenerPos[2];this._audioContext["listener"]["setPosition"](listenerPos[0],listenerPos[1],listenerPos[2]);const listenerOrientation=e["listenerOrientation"];if(Array.isArray(listenerOrientation)){for(let i=0;i<6;++i)this._lastListenerOrientation[i]=listenerOrientation[i];this._audioContext["listener"]["setOrientation"](...this._lastListenerOrientation)}this._isSilent= +e["isSilent"];this._iRuntime.SetSilent(this._isSilent);this._masterVolume=e["masterVolume"];this._destinationNode["gain"]["value"]=this._masterVolume;const promises=[];for(const fxChainData of Object.values(e["effects"]))promises.push(Promise.all(fxChainData.map(d=>this._AddEffect(d))));await Promise.all(promises);await Promise.all(e["playing"].map(d=>this._LoadAudioInstance(d,saveLoadMode)));this._MaybeStartTicking()}async _LoadAudioInstance(d,saveLoadMode){if(saveLoadMode===3)return;const originalUrl= +d["bufferOriginalUrl"];const url=d["bufferUrl"];const type=d["bufferType"];const isMusic=d["isMusic"];const tags=d["tags"];const isLooping=d["isLooping"];const volume=d["volume"];const position=d["playbackTime"];if(isMusic&&saveLoadMode===1)return;if(!isMusic&&saveLoadMode===2)return;let ai=null;try{ai=await this._GetAudioInstance(originalUrl,url,type,tags,isMusic)}catch(err){console.error("[Construct] Audio: error loading audio state: ",err);return}ai.LoadPanState(d["pan"]);ai.LoadStereoPanState(d["stereoPan"]); +ai.Play(isLooping,volume,position,0);if(!d["isPlaying"])ai.Pause();ai._LoadAdditionalState(d)}_OnMicrophoneStream(localMediaStream,tag){if(this._microphoneSource)this._microphoneSource["disconnect"]();this._microphoneTag=tag.toLowerCase();this._microphoneSource=this._audioContext["createMediaStreamSource"](localMediaStream);this._microphoneSource["connect"](this.GetDestinationForTag(this._microphoneTag))}_OnGetOutputStream(){if(!this._destMediaStreamNode){this._destMediaStreamNode=this._audioContext["createMediaStreamDestination"](); +this._destinationNode["connect"](this._destMediaStreamNode)}return this._destMediaStreamNode["stream"]}async _OnOfflineRenderAudio(e){try{const time=e["time"];const suspendPromise=this._audioContext["suspend"](time);if(!this._hasStartedOfflineRender){this._audioContext["startRendering"]().then(buffer=>this._OnOfflineRenderCompleted(buffer)).catch(err=>this._OnOfflineRenderError(err));this._hasStartedOfflineRender=true}else this._audioContext["resume"]();await suspendPromise}catch(err){this._OnOfflineRenderError(err)}}_OnOfflineRenderFinish(){this._audioContext["resume"]()}_OnOfflineRenderCompleted(buffer){const channelArrayBuffers= +[];for(let i=0,len=buffer["numberOfChannels"];ithis._reachedCanPlayThrough= +true);this._outNode=this.GetAudioContext()["createGain"]();this._mediaSourceNode=null;this._audioElem.addEventListener("canplay",()=>{if(this._loadResolve){this._loadState="loaded";this._loadResolve();this._loadResolve=null;this._loadReject=null}if(this._mediaSourceNode||!this._audioElem)return;this._mediaSourceNode=this.GetAudioContext()["createMediaElementSource"](this._audioElem);this._mediaSourceNode["connect"](this._outNode)});this.onended=null;this._audioElem.addEventListener("ended",()=>{if(this.onended)this.onended()}); +this._audioElem.addEventListener("error",e=>this._OnError(e))}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._outNode["disconnect"]();this._outNode=null;this._mediaSourceNode["disconnect"]();this._mediaSourceNode=null;if(this._audioElem&&!this._audioElem.paused)this._audioElem.pause();this.onended=null;this._audioElem=null;super.Release()}_Load(){this._loadState="loading";return new Promise((resolve,reject)=>{this._loadResolve=resolve;this._loadReject=reject;this._audioElem.src= +this._url})}_OnError(e){console.error(`[Construct] Audio '${this._url}' error: `,e);if(this._loadReject){this._loadState="failed";this._loadReject(e);this._loadResolve=null;this._loadReject=null}}IsLoaded(){const ret=this._audioElem["readyState"]>=4;if(ret)this._reachedCanPlayThrough=true;return ret||this._reachedCanPlayThrough}IsLoadedAndDecoded(){return this.IsLoaded()}GetAudioElement(){return this._audioElem}GetOutputNode(){return this._outNode}GetDuration(){return this._audioElem["duration"]}}}; +'use strict';{self.C3WebAudioBuffer=class C3WebAudioBuffer extends self.C3AudioBuffer{constructor(audioDomHandler,originalUrl,url,type,isMusic,needsSoftwareDecode){super(audioDomHandler,originalUrl,url,type,isMusic);this._api="webaudio";this._audioData=null;this._audioBuffer=null;this._needsSoftwareDecode=!!needsSoftwareDecode}Release(){this._audioDomHandler.ReleaseInstancesForBuffer(this);this._audioData=null;this._audioBuffer=null;super.Release()}async _Fetch(){if(this._audioData)return this._audioData; +const iRuntime=this._audioDomHandler.GetRuntimeInterface();if(iRuntime.GetExportType()==="cordova"&&iRuntime.IsRelativeURL(this._url)&&iRuntime.IsFileProtocol())this._audioData=await iRuntime.CordovaFetchLocalFileAsArrayBuffer(this._url);else{const response=await fetch(this._url);if(!response.ok)throw new Error(`error fetching audio data: ${response.status} ${response.statusText}`);this._audioData=await response.arrayBuffer()}}async _Decode(){if(this._audioBuffer)return this._audioBuffer;this._audioBuffer= +await this._audioDomHandler.DecodeAudioData(this._audioData,this._needsSoftwareDecode);this._audioData=null}async _Load(){try{this._loadState="loading";await this._Fetch();await this._Decode();this._loadState="loaded"}catch(err){this._loadState="failed";console.error(`[Construct] Failed to load audio '${this._url}': `,err)}}IsLoaded(){return!!(this._audioData||this._audioBuffer)}IsLoadedAndDecoded(){return!!this._audioBuffer}GetAudioBuffer(){return this._audioBuffer}GetDuration(){return this._audioBuffer? +this._audioBuffer["duration"]:0}}}; +'use strict';{let nextAiId=0;self.C3AudioInstance=class C3AudioInstance{constructor(audioDomHandler,buffer,tags){this._audioDomHandler=audioDomHandler;this._buffer=buffer;this._tags=tags;this._aiId=nextAiId++;this._gainNode=this.GetAudioContext()["createGain"]();this._gainNode["connect"](this.GetDestinationNode());this._pannerNode=null;this._isPannerEnabled=false;this._pannerPosition=[0,0,0];this._pannerOrientation=[0,0,0];this._pannerConeParams=[0,0,0];this._stereoPannerNode=null;this._isStereoPannerEnabled= +false;this._stereoPan=0;this._isStopped=true;this._isPaused=false;this._resumeMe=false;this._isLooping=false;this._volume=1;this._isMuted=false;this._playbackRate=1;const timeScaleMode=this._audioDomHandler.GetTimeScaleMode();this._isTimescaled=timeScaleMode===1&&!this.IsMusic()||timeScaleMode===2;this._instUid=-1;this._fadeEndTime=-1;this._stopOnFadeEnd=false}Release(){this._audioDomHandler=null;this._buffer=null;if(this._pannerNode){this._pannerNode["disconnect"]();this._pannerNode=null}if(this._stereoPannerNode){this._stereoPannerNode["disconnect"](); +this._stereoPannerNode=null}this._gainNode["disconnect"]();this._gainNode=null}GetAudioContext(){return this._audioDomHandler.GetAudioContext()}SetTags(tags){this._tags=tags}GetTags(){return this._tags}GetEffectTag(){return this._tags.length>0?this._tags[0]:""}GetDestinationNode(){return this._audioDomHandler.GetDestinationForTag(this.GetEffectTag())}GetCurrentTime(){if(this._isTimescaled)return this._audioDomHandler.GetGameTime();else return performance.now()/1E3}GetOriginalUrl(){return this._buffer.GetOriginalUrl()}GetUrl(){return this._buffer.GetUrl()}GetContentType(){return this._buffer.GetContentType()}GetBuffer(){return this._buffer}IsMusic(){return this._buffer.IsMusic()}GetAiId(){return this._aiId}HasEnded(){}CanBeRecycled(){}IsPlaying(){return!this._isStopped&& +!this._isPaused&&!this.HasEnded()}IsActive(){return!this._isStopped&&!this.HasEnded()}GetPlaybackTime(){}GetDuration(applyPlaybackRate){let ret=this._buffer.GetDuration();if(applyPlaybackRate)ret/=this._playbackRate||.001;return ret}Play(isLooping,vol,seekPos,scheduledTime){}Stop(){}Pause(){}IsPaused(){return this._isPaused}Resume(){}SetVolume(v){this._volume=v;this._gainNode["gain"]["cancelScheduledValues"](0);this._fadeEndTime=-1;this._gainNode["gain"]["value"]=this.GetOutputVolume()}FadeVolume(vol, +duration,stopOnEnd){if(this.IsMuted())return;const gainParam=this._gainNode["gain"];gainParam["cancelScheduledValues"](0);const currentTime=this._audioDomHandler.GetAudioCurrentTime();const endTime=currentTime+duration;gainParam["setValueAtTime"](gainParam["value"],currentTime);gainParam["linearRampToValueAtTime"](vol,endTime);this._volume=vol;this._fadeEndTime=endTime;this._stopOnFadeEnd=stopOnEnd}_UpdateVolume(){this.SetVolume(this._volume)}Tick(currentTime){if(this._fadeEndTime!==-1&¤tTime>= +this._fadeEndTime){this._fadeEndTime=-1;if(this._stopOnFadeEnd)this.Stop();this._audioDomHandler.PostTrigger("fade-ended",this._tags,this._aiId)}}GetOutputVolume(){const ret=this._volume;return isFinite(ret)?ret:0}SetMuted(m){m=!!m;if(this._isMuted===m)return;this._isMuted=m;this._UpdateMuted()}IsMuted(){return this._isMuted}IsSilent(){return this._audioDomHandler.IsSilent()}_UpdateMuted(){}SetLooping(l){}IsLooping(){return this._isLooping}SetPlaybackRate(r){if(this._playbackRate===r)return;this._playbackRate= +r;this._UpdatePlaybackRate()}_UpdatePlaybackRate(){}GetPlaybackRate(){return this._playbackRate}Seek(pos){}SetSuspended(s){}SetPannerEnabled(e){e=!!e;if(this._isPannerEnabled===e)return;this._isPannerEnabled=e;if(this._isPannerEnabled){this.SetStereoPannerEnabled(false);if(!this._pannerNode){this._pannerNode=this.GetAudioContext()["createPanner"]();this._pannerNode["panningModel"]=this._audioDomHandler.GetPanningModel();this._pannerNode["distanceModel"]=this._audioDomHandler.GetDistanceModel();this._pannerNode["refDistance"]= +this._audioDomHandler.GetReferenceDistance();this._pannerNode["maxDistance"]=this._audioDomHandler.GetMaxDistance();this._pannerNode["rolloffFactor"]=this._audioDomHandler.GetRolloffFactor()}this._gainNode["disconnect"]();this._gainNode["connect"](this._pannerNode);this._pannerNode["connect"](this.GetDestinationNode())}else{this._pannerNode["disconnect"]();this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetPan(x,y,z,angle,innerAngle,outerAngle,outerGain){if(!this._isPannerEnabled)return; +this.SetPanXYZA(x,y,z,angle);const toDegrees=self.AudioDOMHandler.ToDegrees;if(this._pannerConeParams[0]!==toDegrees(innerAngle)){this._pannerConeParams[0]=toDegrees(innerAngle);this._pannerNode["coneInnerAngle"]=toDegrees(innerAngle)}if(this._pannerConeParams[1]!==toDegrees(outerAngle)){this._pannerConeParams[1]=toDegrees(outerAngle);this._pannerNode["coneOuterAngle"]=toDegrees(outerAngle)}if(this._pannerConeParams[2]!==outerGain){this._pannerConeParams[2]=outerGain;this._pannerNode["coneOuterGain"]= +outerGain}}SetPanXYZA(x,y,z,angle){if(!this._isPannerEnabled)return;const pos=this._pannerPosition;const orient=this._pannerOrientation;const cosa=Math.cos(angle);const sina=Math.sin(angle);if(pos[0]!==x||pos[1]!==y||pos[2]!==z){pos[0]=x;pos[1]=y;pos[2]=z;this._pannerNode["setPosition"](...pos)}if(orient[0]!==cosa||orient[1]!==sina||orient[2]!==0){orient[0]=cosa;orient[1]=sina;orient[2]=0;this._pannerNode["setOrientation"](...orient)}}SetStereoPannerEnabled(e){e=!!e;if(this._isStereoPannerEnabled=== +e)return;this._isStereoPannerEnabled=e;if(this._isStereoPannerEnabled){this.SetPannerEnabled(false);this._stereoPannerNode=this.GetAudioContext()["createStereoPanner"]();this._gainNode["disconnect"]();this._gainNode["connect"](this._stereoPannerNode);this._stereoPannerNode["connect"](this.GetDestinationNode())}else{this._stereoPannerNode["disconnect"]();this._stereoPannerNode=null;this._gainNode["disconnect"]();this._gainNode["connect"](this.GetDestinationNode())}}SetStereoPan(p){if(!this._isStereoPannerEnabled)return; +if(this._stereoPan===p)return;this._stereoPannerNode["pan"]["value"]=p;this._stereoPan=p}SetUID(uid){this._instUid=uid}GetUID(){return this._instUid}GetResumePosition(){}Reconnect(toNode){const outNode=this._stereoPannerNode||this._pannerNode||this._gainNode;outNode["disconnect"]();outNode["connect"](toNode)}GetState(){return{"aiid":this.GetAiId(),"tags":this._tags,"duration":this.GetDuration(),"volume":this._fadeEndTime===-1?this._volume:this._gainNode["gain"]["value"],"isPlaying":this.IsPlaying(), +"playbackTime":this.GetPlaybackTime(),"playbackRate":this.GetPlaybackRate(),"uid":this._instUid,"bufferOriginalUrl":this.GetOriginalUrl(),"bufferUrl":"","bufferType":this.GetContentType(),"isMusic":this.IsMusic(),"isLooping":this.IsLooping(),"isMuted":this.IsMuted(),"resumePosition":this.GetResumePosition(),"pan":this.GetPanState(),"stereoPan":this.GetStereoPanState()}}_LoadAdditionalState(d){this.SetPlaybackRate(d["playbackRate"]);this.SetMuted(d["isMuted"])}GetPanState(){if(!this._pannerNode)return null; +const pn=this._pannerNode;return{"pos":this._pannerPosition,"orient":this._pannerOrientation,"cia":pn["coneInnerAngle"],"coa":pn["coneOuterAngle"],"cog":pn["coneOuterGain"],"uid":this._instUid}}LoadPanState(d){if(!d){this.SetPannerEnabled(false);return}this.SetPannerEnabled(true);const pn=this._pannerNode;const panPos=d["pos"];this._pannerPosition[0]=panPos[0];this._pannerPosition[1]=panPos[1];this._pannerPosition[2]=panPos[2];const panOrient=d["orient"];this._pannerOrientation[0]=panOrient[0];this._pannerOrientation[1]= +panOrient[1];this._pannerOrientation[2]=panOrient[2];pn["setPosition"](...this._pannerPosition);pn["setOrientation"](...this._pannerOrientation);this._pannerConeParams[0]=d["cia"];this._pannerConeParams[1]=d["coa"];this._pannerConeParams[2]=d["cog"];pn["coneInnerAngle"]=d["cia"];pn["coneOuterAngle"]=d["coa"];pn["coneOuterGain"]=d["cog"];this._instUid=d["uid"]}GetStereoPanState(){if(this._stereoPannerNode)return this._stereoPan;else return null}LoadStereoPanState(p){if(typeof p!=="number"){this.SetStereoPannerEnabled(false); +return}this.SetStereoPannerEnabled(true);this.SetStereoPan(p)}}}; +'use strict';{self.C3Html5AudioInstance=class C3Html5AudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tags){super(audioDomHandler,buffer,tags);this._buffer.GetOutputNode()["connect"](this._gainNode);this._buffer.onended=()=>this._OnEnded()}Release(){this.Stop();this._buffer.GetOutputNode()["disconnect"]();super.Release()}GetAudioElement(){return this._buffer.GetAudioElement()}_OnEnded(){this._isStopped=true;this._instUid=-1;this._audioDomHandler.PostTrigger("ended",this._tags, +this._aiId)}HasEnded(){return this.GetAudioElement()["ended"]}CanBeRecycled(){if(this._isStopped)return true;return this.HasEnded()}GetPlaybackTime(){let ret=this.GetAudioElement()["currentTime"];if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){const audioElem=this.GetAudioElement();if(audioElem.playbackRate!==1)audioElem.playbackRate=1;if(audioElem.loop!==isLooping)audioElem.loop=isLooping;this.SetVolume(vol);if(audioElem.muted)audioElem.muted= +false;if(audioElem.currentTime!==seekPos)try{audioElem.currentTime=seekPos}catch(err){console.warn(`[Construct] Exception seeking audio '${this._buffer.GetUrl()}' to position '${seekPos}': `,err)}this._audioDomHandler.TryPlayMedia(audioElem);this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1}Stop(){const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isStopped=true;this._isPaused= +false;this._instUid=-1}Pause(){if(this._isPaused||this._isStopped||this.HasEnded())return;const audioElem=this.GetAudioElement();if(!audioElem.paused)audioElem.pause();this._audioDomHandler.RemovePendingPlay(audioElem);this._isPaused=true}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._isPaused=false}_UpdateMuted(){this.GetAudioElement().muted=this._isMuted||this.IsSilent()}SetLooping(l){l=!!l;if(this._isLooping=== +l)return;this._isLooping=l;this.GetAudioElement().loop=l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();try{this.GetAudioElement()["playbackRate"]=r}catch(err){console.warn(`[Construct] Unable to set playback rate '${r}':`,err)}}Seek(pos){if(this._isStopped||this.HasEnded())return;try{this.GetAudioElement()["currentTime"]=pos}catch(err){console.warn(`[Construct] Error seeking audio to '${pos}': `,err)}}GetResumePosition(){return this.GetPlaybackTime()}SetSuspended(s){if(s)if(this.IsPlaying()){this.GetAudioElement()["pause"](); +this._resumeMe=true}else this._resumeMe=false;else if(this._resumeMe){this._audioDomHandler.TryPlayMedia(this.GetAudioElement());this._resumeMe=false}}}}; +'use strict';{self.C3WebAudioInstance=class C3WebAudioInstance extends self.C3AudioInstance{constructor(audioDomHandler,buffer,tags){super(audioDomHandler,buffer,tags);this._bufferSource=null;this._onended_handler=e=>this._OnEnded(e);this._hasPlaybackEnded=true;this._activeSource=null;this._playStartTime=0;this._playFromSeekPos=0;this._resumePosition=0;this._muteVol=1}Release(){this.Stop();this._ReleaseBufferSource();this._onended_handler=null;super.Release()}_ReleaseBufferSource(){if(this._bufferSource){this._bufferSource["onended"]= +null;this._bufferSource["disconnect"]();this._bufferSource["buffer"]=null}this._bufferSource=null;this._activeSource=null}_OnEnded(e){if(this._isPaused||this._resumeMe)return;if(e.target!==this._activeSource)return;this._hasPlaybackEnded=true;this._isStopped=true;this._instUid=-1;this._ReleaseBufferSource();this._audioDomHandler.PostTrigger("ended",this._tags,this._aiId)}HasEnded(){if(!this._isStopped&&this._bufferSource&&this._bufferSource["loop"])return false;if(this._isPaused)return false;return this._hasPlaybackEnded}CanBeRecycled(){if(!this._bufferSource|| +this._isStopped)return true;return this.HasEnded()}GetPlaybackTime(){let ret=0;if(this._isPaused)ret=this._resumePosition;else ret=this._playFromSeekPos+(this.GetCurrentTime()-this._playStartTime)*this._playbackRate;if(!this._isLooping)ret=Math.min(ret,this.GetDuration());return ret}Play(isLooping,vol,seekPos,scheduledTime){this._muteVol=1;this.SetVolume(vol);this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer(); +this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=isLooping;this._bufferSource["start"](scheduledTime,seekPos);this._hasPlaybackEnded=false;this._isStopped=false;this._isPaused=false;this._isLooping=isLooping;this._playbackRate=1;this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=seekPos}Stop(){if(this._bufferSource)try{this._bufferSource["stop"](0)}catch(err){}this._isStopped= +true;this._isPaused=false;this._instUid=-1}Pause(){if(this._isPaused||this._isStopped||this.HasEnded())return;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%=this.GetDuration();this._isPaused=true;this._bufferSource["stop"](0)}Resume(){if(!this._isPaused||this._isStopped||this.HasEnded())return;this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode); +this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]=this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0,this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._isPaused=false}GetOutputVolume(){return super.GetOutputVolume()*this._muteVol}_UpdateMuted(){this._muteVol=this._isMuted||this.IsSilent()?0:1;this._UpdateVolume()}SetLooping(l){l= +!!l;if(this._isLooping===l)return;this._isLooping=l;if(this._bufferSource)this._bufferSource["loop"]=l}_UpdatePlaybackRate(){let r=this._playbackRate;if(this._isTimescaled)r*=this._audioDomHandler.GetTimeScale();if(this._bufferSource)this._bufferSource["playbackRate"]["value"]=r}Seek(pos){if(this._isStopped||this.HasEnded())return;if(this._isPaused)this._resumePosition=pos;else{this.Pause();this._resumePosition=pos;this.Resume()}}GetResumePosition(){return this._resumePosition}SetSuspended(s){if(s)if(this.IsPlaying()){this._resumeMe= +true;this._resumePosition=this.GetPlaybackTime();if(this._isLooping)this._resumePosition%=this.GetDuration();this._bufferSource["stop"](0)}else this._resumeMe=false;else if(this._resumeMe){this._ReleaseBufferSource();this._bufferSource=this.GetAudioContext()["createBufferSource"]();this._bufferSource["buffer"]=this._buffer.GetAudioBuffer();this._bufferSource["connect"](this._gainNode);this._activeSource=this._bufferSource;this._bufferSource["onended"]=this._onended_handler;this._bufferSource["loop"]= +this._isLooping;this._UpdateVolume();this._UpdatePlaybackRate();this._bufferSource["start"](0,this._resumePosition);this._playStartTime=this.GetCurrentTime();this._playFromSeekPos=this._resumePosition;this._resumeMe=false}}_LoadAdditionalState(d){super._LoadAdditionalState(d);this._resumePosition=d["resumePosition"]}}}; +'use strict';{class AudioFXBase{constructor(audioDomHandler){this._audioDomHandler=audioDomHandler;this._audioContext=audioDomHandler.GetAudioContext();this._index=-1;this._tag="";this._type="";this._params=null}Release(){this._audioContext=null}_SetIndex(i){this._index=i}GetIndex(){return this._index}_SetTag(t){this._tag=t}GetTag(){return this._tag}CreateGain(){return this._audioContext["createGain"]()}GetInputNode(){}ConnectTo(node){}SetAudioParam(ap,value,ramp,time){ap["cancelScheduledValues"](0); +if(time===0){ap["value"]=value;return}const curTime=this._audioContext["currentTime"];time+=curTime;switch(ramp){case 0:ap["setValueAtTime"](value,time);break;case 1:ap["setValueAtTime"](ap["value"],curTime);ap["linearRampToValueAtTime"](value,time);break;case 2:ap["setValueAtTime"](ap["value"],curTime);ap["exponentialRampToValueAtTime"](value,time);break}}GetState(){return{"type":this._type,"tag":this._tag,"params":this._params}}}self.C3AudioFilterFX=class C3AudioFilterFX extends AudioFXBase{constructor(audioDomHandler, +type,freq,detune,q,gain,mix){super(audioDomHandler);this._type="filter";this._params=[type,freq,detune,q,gain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]=type;this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._filterNode["gain"]["vlaue"]= +gain;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value= +Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break;case 1:this._params[1]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[2]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[3]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 4:this._params[4]=value; +this.SetAudioParam(this._filterNode["gain"],value,ramp,time);break}}};self.C3AudioDelayFX=class C3AudioDelayFX extends AudioFXBase{constructor(audioDomHandler,delayTime,delayGain,mix){super(audioDomHandler);this._type="delay";this._params=[delayTime,delayGain,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._mainNode=this.CreateGain();this._delayNode=this._audioContext["createDelay"](delayTime); +this._delayNode["delayTime"]["value"]=delayTime;this._delayGainNode=this.CreateGain();this._delayGainNode["gain"]["value"]=delayGain;this._inputNode["connect"](this._mainNode);this._inputNode["connect"](this._dryNode);this._mainNode["connect"](this._wetNode);this._mainNode["connect"](this._delayNode);this._delayNode["connect"](this._delayGainNode);this._delayGainNode["connect"](this._mainNode)}Release(){this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();this._mainNode["disconnect"](); +this._delayNode["disconnect"]();this._delayGainNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[2]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 4:this._params[1]=DbToLinear(value);this.SetAudioParam(this._delayGainNode["gain"],DbToLinear(value),ramp,time);break;case 5:this._params[0]=value;this.SetAudioParam(this._delayNode["delayTime"],value,ramp,time);break}}};self.C3AudioConvolveFX=class C3AudioConvolveFX extends AudioFXBase{constructor(audioDomHandler,buffer,normalize,mix){super(audioDomHandler);this._type="convolution";this._params=[normalize,mix];this._bufferOriginalUrl="";this._bufferUrl="";this._bufferType= +"";this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._convolveNode=this._audioContext["createConvolver"]();this._convolveNode["normalize"]=normalize;this._convolveNode["buffer"]=buffer;this._inputNode["connect"](this._convolveNode);this._inputNode["connect"](this._dryNode);this._convolveNode["connect"](this._wetNode)}Release(){this._inputNode["disconnect"]();this._convolveNode["disconnect"](); +this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"],1-value,ramp,time);break}}_SetBufferInfo(bufferOriginalUrl, +bufferUrl,bufferType){this._bufferOriginalUrl=bufferOriginalUrl;this._bufferUrl=bufferUrl;this._bufferType=bufferType}GetState(){const ret=super.GetState();ret["bufferOriginalUrl"]=this._bufferOriginalUrl;ret["bufferUrl"]="";ret["bufferType"]=this._bufferType;return ret}};self.C3AudioFlangerFX=class C3AudioFlangerFX extends AudioFXBase{constructor(audioDomHandler,delay,modulation,freq,feedback,mix){super(audioDomHandler);this._type="flanger";this._params=[delay,modulation,freq,feedback,mix];this._inputNode= +this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._feedbackNode=this.CreateGain();this._feedbackNode["gain"]["value"]=feedback;this._delayNode=this._audioContext["createDelay"](delay+modulation);this._delayNode["delayTime"]["value"]=delay;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]= +modulation;this._inputNode["connect"](this._delayNode);this._inputNode["connect"](this._dryNode);this._delayNode["connect"](this._wetNode);this._delayNode["connect"](this._feedbackNode);this._feedbackNode["connect"](this._delayNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._delayNode["delayTime"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._delayNode["disconnect"]();this._oscNode["disconnect"]();this._oscGainNode["disconnect"](); +this._dryNode["disconnect"]();this._wetNode["disconnect"]();this._feedbackNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[4]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 6:this._params[1]=value/1E3;this.SetAudioParam(this._oscGainNode["gain"],value/1E3,ramp,time);break;case 7:this._params[2]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break;case 8:this._params[3]=value/100;this.SetAudioParam(this._feedbackNode["gain"],value/100,ramp,time);break}}};self.C3AudioPhaserFX=class C3AudioPhaserFX extends AudioFXBase{constructor(audioDomHandler,freq,detune,q,modulation,modfreq,mix){super(audioDomHandler);this._type= +"phaser";this._params=[freq,detune,q,modulation,modfreq,mix];this._inputNode=this.CreateGain();this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix/2;this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]=mix/2;this._filterNode=this._audioContext["createBiquadFilter"]();this._filterNode["type"]="allpass";this._filterNode["frequency"]["value"]=freq;this._filterNode["detune"]["value"]=detune;this._filterNode["Q"]["value"]=q;this._oscNode=this._audioContext["createOscillator"](); +this._oscNode["frequency"]["value"]=modfreq;this._oscGainNode=this.CreateGain();this._oscGainNode["gain"]["value"]=modulation;this._inputNode["connect"](this._filterNode);this._inputNode["connect"](this._dryNode);this._filterNode["connect"](this._wetNode);this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._filterNode["frequency"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._inputNode["disconnect"]();this._filterNode["disconnect"]();this._oscNode["disconnect"](); +this._oscGainNode["disconnect"]();this._dryNode["disconnect"]();this._wetNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[5]=value;this.SetAudioParam(this._wetNode["gain"],value/2,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value/2,ramp,time);break;case 1:this._params[0]=value;this.SetAudioParam(this._filterNode["frequency"],value,ramp,time);break;case 2:this._params[1]=value;this.SetAudioParam(this._filterNode["detune"],value,ramp,time);break;case 3:this._params[2]=value;this.SetAudioParam(this._filterNode["Q"],value,ramp,time);break;case 6:this._params[3]=value;this.SetAudioParam(this._oscGainNode["gain"],value,ramp,time);break;case 7:this._params[4]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp, +time);break}}};self.C3AudioGainFX=class C3AudioGainFX extends AudioFXBase{constructor(audioDomHandler,g){super(audioDomHandler);this._type="gain";this._params=[g];this._node=this.CreateGain();this._node["gain"]["value"]=g}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){const DbToLinear=self.AudioDOMHandler.DbToLinear;switch(param){case 4:this._params[0]=DbToLinear(value); +this.SetAudioParam(this._node["gain"],DbToLinear(value),ramp,time);break}}};self.C3AudioStereoPanFX=class C3AudioStereoPanFX extends AudioFXBase{constructor(audioDomHandler,p){super(audioDomHandler);this._type="stereopan";this._params=[p];this._node=this._audioContext["createStereoPanner"]();this._node["pan"]["value"]=p}Release(){this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp, +time){value=Math.min(Math.max(value/100,-1),1);switch(param){case 9:this._params[0]=value;this.SetAudioParam(this._node["pan"],value,ramp,time);break}}};self.C3AudioTremoloFX=class C3AudioTremoloFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="tremolo";this._params=[freq,mix];this._node=this.CreateGain();this._node["gain"]["value"]=1-mix/2;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscGainNode= +this.CreateGain();this._oscGainNode["gain"]["value"]=mix/2;this._oscNode["connect"](this._oscGainNode);this._oscGainNode["connect"](this._node["gain"]);this._oscNode["start"](0)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"]();this._oscGainNode["disconnect"]();this._node["disconnect"]();super.Release()}ConnectTo(node){this._node["disconnect"]();this._node["connect"](node)}GetInputNode(){return this._node}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/ +100,1),0);this._params[1]=value;this.SetAudioParam(this._node["gain"],1-value/2,ramp,time);this.SetAudioParam(this._oscGainNode["gain"],value/2,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioRingModFX=class C3AudioRingModFX extends AudioFXBase{constructor(audioDomHandler,freq,mix){super(audioDomHandler);this._type="ringmod";this._params=[freq,mix];this._inputNode=this.CreateGain();this._wetNode=this.CreateGain();this._wetNode["gain"]["value"]= +mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._ringNode=this.CreateGain();this._ringNode["gain"]["value"]=0;this._oscNode=this._audioContext["createOscillator"]();this._oscNode["frequency"]["value"]=freq;this._oscNode["connect"](this._ringNode["gain"]);this._oscNode["start"](0);this._inputNode["connect"](this._ringNode);this._inputNode["connect"](this._dryNode);this._ringNode["connect"](this._wetNode)}Release(){this._oscNode["stop"](0);this._oscNode["disconnect"](); +this._ringNode["disconnect"]();this._inputNode["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}ConnectTo(node){this._wetNode["disconnect"]();this._wetNode["connect"](node);this._dryNode["disconnect"]();this._dryNode["connect"](node)}GetInputNode(){return this._inputNode}SetParam(param,value,ramp,time){switch(param){case 0:value=Math.max(Math.min(value/100,1),0);this._params[1]=value;this.SetAudioParam(this._wetNode["gain"],value,ramp,time);this.SetAudioParam(this._dryNode["gain"], +1-value,ramp,time);break;case 7:this._params[0]=value;this.SetAudioParam(this._oscNode["frequency"],value,ramp,time);break}}};self.C3AudioDistortionFX=class C3AudioDistortionFX extends AudioFXBase{constructor(audioDomHandler,threshold,headroom,drive,makeupgain,mix){super(audioDomHandler);this._type="distortion";this._params=[threshold,headroom,drive,makeupgain,mix];this._inputNode=this.CreateGain();this._preGain=this.CreateGain();this._postGain=this.CreateGain();this._SetDrive(drive,makeupgain);this._wetNode= +this.CreateGain();this._wetNode["gain"]["value"]=mix;this._dryNode=this.CreateGain();this._dryNode["gain"]["value"]=1-mix;this._waveShaper=this._audioContext["createWaveShaper"]();this._curve=new Float32Array(65536);this._GenerateColortouchCurve(threshold,headroom);this._waveShaper.curve=this._curve;this._inputNode["connect"](this._preGain);this._inputNode["connect"](this._dryNode);this._preGain["connect"](this._waveShaper);this._waveShaper["connect"](this._postGain);this._postGain["connect"](this._wetNode)}Release(){this._inputNode["disconnect"](); +this._preGain["disconnect"]();this._waveShaper["disconnect"]();this._postGain["disconnect"]();this._wetNode["disconnect"]();this._dryNode["disconnect"]();super.Release()}_SetDrive(drive,makeupgain){if(drive<.01)drive=.01;this._preGain["gain"]["value"]=drive;this._postGain["gain"]["value"]=Math.pow(1/drive,.6)*makeupgain}_GenerateColortouchCurve(threshold,headroom){const n=65536;const n2=n/2;for(let i=0;ithis._OnChangeCursorStyle(e)],["request-pointer-lock",()=>this._OnRequestPointerLock()],["release-pointer-lock",()=>this._OnReleasePointerLock()]]);document.addEventListener("pointerlockchange",e=>this._OnPointerLockChange());document.addEventListener("pointerlockerror",e=>this._OnPointerLockError())}_OnChangeCursorStyle(e){document.documentElement.style.cursor= +e}_OnRequestPointerLock(){this._iRuntime.GetCanvas().requestPointerLock()}_OnReleasePointerLock(){document.exitPointerLock()}_OnPointerLockChange(){this.PostToRuntime("pointer-lock-change",{"has-pointer-lock":!!document.pointerLockElement})}_OnPointerLockError(){this.PostToRuntime("pointer-lock-error",{"has-pointer-lock":!!document.pointerLockElement})}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{const DOM_COMPONENT_ID="touch";const HANDLER_CLASS=class TouchDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this.AddRuntimeMessageHandler("request-permission",e=>this._OnRequestPermission(e))}async _OnRequestPermission(e){const type=e["type"];let result=true;if(type===0)result=await this._RequestOrientationPermission();else if(type===1)result=await this._RequestMotionPermission();this.PostToRuntime("permission-result",{"type":type,"result":result})}async _RequestOrientationPermission(){if(!self["DeviceOrientationEvent"]|| +!self["DeviceOrientationEvent"]["requestPermission"])return true;try{const state=await self["DeviceOrientationEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request orientation permission: ",err);return false}}async _RequestMotionPermission(){if(!self["DeviceMotionEvent"]||!self["DeviceMotionEvent"]["requestPermission"])return true;try{const state=await self["DeviceMotionEvent"]["requestPermission"]();return state==="granted"}catch(err){console.warn("[Touch] Failed to request motion permission: ", +err);return false}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; +'use strict';{function elemsForSelector(selector,isAll){if(!selector)return[document.documentElement];else if(isAll)return Array.from(document.querySelectorAll(selector));else{const e=document.querySelector(selector);return e?[e]:[]}}function noop(){}const DOM_COMPONENT_ID="browser";const HANDLER_CLASS=class BrowserDOMHandler extends self.DOMHandler{constructor(iRuntime){super(iRuntime,DOM_COMPONENT_ID);this._exportType="";this.AddRuntimeMessageHandlers([["get-initial-state",e=>this._OnGetInitialState(e)], +["ready-for-sw-messages",()=>this._OnReadyForSWMessages()],["alert",e=>this._OnAlert(e)],["close",()=>this._OnClose()],["set-focus",e=>this._OnSetFocus(e)],["vibrate",e=>this._OnVibrate(e)],["lock-orientation",e=>this._OnLockOrientation(e)],["unlock-orientation",()=>this._OnUnlockOrientation()],["navigate",e=>this._OnNavigate(e)],["request-fullscreen",e=>this._OnRequestFullscreen(e)],["exit-fullscreen",()=>this._OnExitFullscreen()],["set-hash",e=>this._OnSetHash(e)],["set-document-css-style",e=>this._OnSetDocumentCSSStyle(e)], +["get-document-css-style",e=>this._OnGetDocumentCSSStyle(e)]]);window.addEventListener("online",()=>this._OnOnlineStateChanged(true));window.addEventListener("offline",()=>this._OnOnlineStateChanged(false));window.addEventListener("hashchange",()=>this._OnHashChange());document.addEventListener("backbutton",()=>this._OnCordovaBackButton())}_OnGetInitialState(e){this._exportType=e["exportType"];return{"location":location.toString(),"isOnline":!!navigator.onLine,"referrer":document.referrer,"title":document.title, +"isCookieEnabled":!!navigator.cookieEnabled,"screenWidth":screen.width,"screenHeight":screen.height,"windowOuterWidth":window.outerWidth,"windowOuterHeight":window.outerHeight,"isConstructArcade":typeof window["is_scirra_arcade"]!=="undefined"}}_OnReadyForSWMessages(){if(!window["C3_RegisterSW"]||!window["OfflineClientInfo"])return;window["OfflineClientInfo"]["SetMessageCallback"](e=>this.PostToRuntime("sw-message",e["data"]))}_OnOnlineStateChanged(isOnline){this.PostToRuntime("online-state",{"isOnline":isOnline})}_OnCordovaBackButton(){this.PostToRuntime("backbutton")}GetNWjsWindow(){if(this._exportType=== +"nwjs")return nw["Window"]["get"]();else return null}_OnAlert(e){alert(e["message"])}_OnClose(){if(navigator["app"]&&navigator["app"]["exitApp"])navigator["app"]["exitApp"]();else if(navigator["device"]&&navigator["device"]["exitApp"])navigator["device"]["exitApp"]();else window.close()}_OnSetFocus(e){const isFocus=e["isFocus"];if(this._exportType==="nwjs"){const win=this.GetNWjsWindow();if(isFocus)win["focus"]();else win["blur"]()}else if(isFocus)window.focus();else window.blur()}_OnVibrate(e){if(navigator["vibrate"])navigator["vibrate"](e["pattern"])}_OnLockOrientation(e){const orientation= +e["orientation"];if(screen["orientation"]&&screen["orientation"]["lock"])screen["orientation"]["lock"](orientation).catch(err=>console.warn("[Construct] Failed to lock orientation: ",err));else try{let result=false;if(screen["lockOrientation"])result=screen["lockOrientation"](orientation);else if(screen["webkitLockOrientation"])result=screen["webkitLockOrientation"](orientation);else if(screen["mozLockOrientation"])result=screen["mozLockOrientation"](orientation);else if(screen["msLockOrientation"])result= +screen["msLockOrientation"](orientation);if(!result)console.warn("[Construct] Failed to lock orientation")}catch(err){console.warn("[Construct] Failed to lock orientation: ",err)}}_OnUnlockOrientation(){try{if(screen["orientation"]&&screen["orientation"]["unlock"])screen["orientation"]["unlock"]();else if(screen["unlockOrientation"])screen["unlockOrientation"]();else if(screen["webkitUnlockOrientation"])screen["webkitUnlockOrientation"]();else if(screen["mozUnlockOrientation"])screen["mozUnlockOrientation"](); +else if(screen["msUnlockOrientation"])screen["msUnlockOrientation"]()}catch(err){}}_OnNavigate(e){const type=e["type"];if(type==="back")if(navigator["app"]&&navigator["app"]["backHistory"])navigator["app"]["backHistory"]();else window.history.back();else if(type==="forward")window.history.forward();else if(type==="reload")location.reload();else if(type==="url"){const url=e["url"];const target=e["target"];const exportType=e["exportType"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url, +"_system");else if(exportType==="preview"||exportType==="windows-webview2")window.open(url,"_blank");else if(!this._isConstructArcade)if(target===2)window.top.location=url;else if(target===1)window.parent.location=url;else window.location=url}else if(type==="new-window"){const url=e["url"];const tag=e["tag"];if(self["cordova"]&&self["cordova"]["InAppBrowser"])self["cordova"]["InAppBrowser"]["open"](url,"_system");else window.open(url,tag)}}_OnRequestFullscreen(e){if(this._exportType==="windows-webview2"|| +this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(true);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen","fullscreen":true})}else{const opts={"navigationUI":"auto"};const navUI=e["navUI"];if(navUI===1)opts["navigationUI"]="hide";else if(navUI===2)opts["navigationUI"]="show";const elem=document.documentElement;let ret;if(elem["requestFullscreen"])ret=elem["requestFullscreen"](opts);else if(elem["mozRequestFullScreen"])ret=elem["mozRequestFullScreen"](opts); +else if(elem["msRequestFullscreen"])ret=elem["msRequestFullscreen"](opts);else if(elem["webkitRequestFullScreen"])if(typeof Element["ALLOW_KEYBOARD_INPUT"]!=="undefined")ret=elem["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]);else ret=elem["webkitRequestFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnExitFullscreen(){if(this._exportType==="windows-webview2"||this._exportType==="macos-wkwebview"){self.RuntimeInterface._SetWrapperIsFullscreenFlag(false);this._iRuntime._SendWrapperMessage({"type":"set-fullscreen", +"fullscreen":false})}else{let ret;if(document["exitFullscreen"])ret=document["exitFullscreen"]();else if(document["mozCancelFullScreen"])ret=document["mozCancelFullScreen"]();else if(document["msExitFullscreen"])ret=document["msExitFullscreen"]();else if(document["webkitCancelFullScreen"])ret=document["webkitCancelFullScreen"]();if(ret instanceof Promise)ret.catch(noop)}}_OnSetHash(e){location.hash=e["hash"]}_OnHashChange(){this.PostToRuntime("hashchange",{"location":location.toString()})}_OnSetDocumentCSSStyle(e){const prop= +e["prop"];const value=e["value"];const selector=e["selector"];const isAll=e["is-all"];try{const arr=elemsForSelector(selector,isAll);for(const e of arr)if(prop.startsWith("--"))e.style.setProperty(prop,value);else e.style[prop]=value}catch(err){console.warn("[Browser] Failed to set style: ",err)}}_OnGetDocumentCSSStyle(e){const prop=e["prop"];const selector=e["selector"];try{const elem=document.querySelector(selector);if(elem){const computedStyle=window.getComputedStyle(elem);return{"isOk":true,"result":computedStyle.getPropertyValue(prop)}}else return{"isOk":false}}catch(err){console.warn("[Browser] Failed to get style: ", +err);return{"isOk":false}}}};self.RuntimeInterface.AddDOMHandlerClass(HANDLER_CLASS)}; diff --git a/soccerrandom/scripts/offlineclient.js b/soccerrandom/scripts/offlineclient.js new file mode 100644 index 00000000..8a6145d1 --- /dev/null +++ b/soccerrandom/scripts/offlineclient.js @@ -0,0 +1,2 @@ +'use strict';{class OfflineClient{constructor(){this._broadcastChannel=typeof BroadcastChannel==="undefined"?null:new BroadcastChannel("offline");this._queuedMessages=[];this._onMessageCallback=null;if(this._broadcastChannel)this._broadcastChannel.onmessage=e=>this._OnBroadcastChannelMessage(e)}_OnBroadcastChannelMessage(e){if(this._onMessageCallback){this._onMessageCallback(e);return}this._queuedMessages.push(e)}SetMessageCallback(f){this._onMessageCallback=f;for(let e of this._queuedMessages)this._onMessageCallback(e); +this._queuedMessages.length=0}}window.OfflineClientInfo=new OfflineClient}; diff --git a/soccerrandom/scripts/project/FrameRateLimit.js b/soccerrandom/scripts/project/FrameRateLimit.js new file mode 100644 index 00000000..3a9253c8 --- /dev/null +++ b/soccerrandom/scripts/project/FrameRateLimit.js @@ -0,0 +1,92 @@ + +// Import any other script files here, e.g.: +// import * as myModule from "./mymodule.js"; + +runOnStartup(async runtime => +{ + runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime)); +}); + +async function OnBeforeProjectStart(runtime) +{ + // Code to run just before 'On start of layout' on + // the first layout. Loading has finished and initial + // instances are created and available to use here. + + var timestep = 1 / 60; // 60 Hz time step + var accumulator = 0; + + requestAnimationFrame(function gameLoop(timestamp) { + accumulator += (timestamp - lastFrameTimeMs) / 1000; + while (accumulator > timestep) { + accumulator -= timestep; + } + + lastFrameTimeMs = timestamp; + requestAnimationFrame(gameLoop); + }); + + runtime.addEventListener("tick", () => Tick(runtime)); +} + +var lastFrameTimeMs = 0; + +function Tick(runtime) +{ + // Code to run every tick + getScreenRefreshRate(function(FPS){ + //console.log(`${FPS} FPS`); + runtime.globalVars.ScnRefreshRate = FPS; + //console.log("FPS = "+runtime.globalVars.ScnRefreshRate); + + }); +} + +/** + * Allows to obtain the estimated Hz of the primary monitor in the system. + * + * @param {Function} callback The function triggered after obtaining the estimated Hz of the monitor. + * @param {Boolean} runIndefinitely If set to true, the callback will be triggered indefinitely (for live counter). + */ +function getScreenRefreshRate(callback, runIndefinitely){ + let requestId = null; + let callbackTriggered = false; + runIndefinitely = runIndefinitely || false; + + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame; + } + + let DOMHighResTimeStampCollection = []; + + let triggerAnimation = function(DOMHighResTimeStamp){ + DOMHighResTimeStampCollection.unshift(DOMHighResTimeStamp); + + if (DOMHighResTimeStampCollection.length > 10) { + let t0 = DOMHighResTimeStampCollection.pop(); + let fps = Math.floor(1000 * 10 / (DOMHighResTimeStamp - t0)); + + if(!callbackTriggered){ + callback.call(undefined, fps, DOMHighResTimeStampCollection); + } + + if(runIndefinitely){ + callbackTriggered = false; + }else{ + callbackTriggered = true; + } + } + + requestId = window.requestAnimationFrame(triggerAnimation); + }; + + window.requestAnimationFrame(triggerAnimation); + + // Stop after half second if it shouldn't run indefinitely + if(!runIndefinitely){ + window.setTimeout(function(){ + window.cancelAnimationFrame(requestId); + requestId = null; + }, 500); + } +} \ No newline at end of file diff --git a/soccerrandom/scripts/project/scriptsInEvents.js b/soccerrandom/scripts/project/scriptsInEvents.js new file mode 100644 index 00000000..85ccec95 --- /dev/null +++ b/soccerrandom/scripts/project/scriptsInEvents.js @@ -0,0 +1,19 @@ + + + +const scriptsInEvents = { + + async Rhm_ads_Event1_Act1(runtime, localVars) + { + CallInterstitialAds(); + }, + + async Rhm_ads_Event2_Act1(runtime, localVars) + { + CallRewardedAds(); + } + +}; + +self.C3.ScriptsInEvents = scriptsInEvents; + diff --git a/soccerrandom/scripts/register-sw.js b/soccerrandom/scripts/register-sw.js new file mode 100644 index 00000000..f152b5ff --- /dev/null +++ b/soccerrandom/scripts/register-sw.js @@ -0,0 +1 @@ +'use strict';{window.C3_RegisterSW=async function C3_RegisterSW(){if(!navigator.serviceWorker)return;try{const reg=await navigator.serviceWorker.register("sw.js",{scope:"./"});console.info("Registered service worker on "+reg.scope)}catch(err){console.warn("Failed to register service worker: ",err)}}}; diff --git a/soccerrandom/scripts/supportcheck.js b/soccerrandom/scripts/supportcheck.js new file mode 100644 index 00000000..886cbc95 --- /dev/null +++ b/soccerrandom/scripts/supportcheck.js @@ -0,0 +1,5 @@ +'use strict';(function(){var isKasperskyScriptInjected=!!document.querySelector('script[src*="kaspersky"]');var tmpCanvas=document.createElement("canvas");var hasWebGL=!!tmpCanvas.getContext("webgl");var missingFeatures=[];if(!hasWebGL)missingFeatures.push("WebGL");if(typeof WebAssembly==="undefined")missingFeatures.push("WebAssembly");if(!("noModule"in HTMLScriptElement.prototype))missingFeatures.push("JavaScript Modules");if(missingFeatures.length===0&&!isKasperskyScriptInjected)window["C3_IsSupported"]= +true;else{var msgWrap=document.createElement("div");msgWrap.id="notSupportedWrap";document.body.appendChild(msgWrap);var msgTitle=document.createElement("h2");msgTitle.id="notSupportedTitle";if(isKasperskyScriptInjected)msgTitle.textContent="Kaspersky Internet Security broke this export";else msgTitle.textContent="Software update needed";msgWrap.appendChild(msgTitle);var msgBody=document.createElement("p");msgBody.className="notSupportedMessage";var msgText="This content is not supported because your device's software appears to be out-of-date. "; +var ua=navigator.userAgent;if(/android/i.test(ua))msgText+='

      On Android, fix this by making sure the
      Android System Webview app has updates enabled and is up-to-date.';else if(/iphone|ipad|ipod/i.test(ua)){msgText+="Alternatively if Lockdown mode is enabled, try turning it off to view this content.";msgText+="

      Note: using the iOS simulator requires Xcode 12+. Otherwise try testing on a real device instead."}else if(/msie/i.test(ua)|| +/trident/i.test(ua)||/edge\//i.test(ua))msgText+="

      Note: Internet Explorer and the legacy Edge browser are not supported. Try using Chrome or Firefox instead.";else if(isKasperskyScriptInjected)msgText="It appears a script was added to this export by Kaspersky software. This prevents the exported project from working. Try disabling Kaspersky and exporting again.";else msgText+= +"Try installing any available software updates. Alternatively try on a different device.";msgText+="

      Missing features: "+missingFeatures.join(", ")+"
      User agent: "+navigator.userAgent+"
      ";msgBody.innerHTML=msgText;msgWrap.appendChild(msgBody)}})(); diff --git a/soccerrandom/test.png b/soccerrandom/test.png new file mode 100644 index 00000000..dfde1524 Binary files /dev/null and b/soccerrandom/test.png differ diff --git a/stickmanboost/animate.css b/stickmanboost/animate.css new file mode 100644 index 00000000..57141b16 --- /dev/null +++ b/stickmanboost/animate.css @@ -0,0 +1,3504 @@ +@charset "UTF-8"; + +/*! + * animate.css -http://daneden.me/animate + * Version - 3.5.0 + * Licensed under the MIT license - http://opensource.org/licenses/MIT + * + * Copyright (c) 2015 Daniel Eden + */ + +.animated { + -webkit-animation-duration: 1s; + animation-duration: 1s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} + +.animated.infinite { + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; +} + +.animated.hinge { + -webkit-animation-duration: 2s; + animation-duration: 2s; +} + +.animated.flipOutX, +.animated.flipOutY, +.animated.bounceIn, +.animated.bounceOut { + -webkit-animation-duration: .75s; + animation-duration: .75s; +} + +@-webkit-keyframes bounce { + from, 20%, 53%, 80%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + -webkit-transform: translate3d(0,0,0); + transform: translate3d(0,0,0); + } + + 40%, 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + + 90% { + -webkit-transform: translate3d(0,-4px,0); + transform: translate3d(0,-4px,0); + } +} + +@keyframes bounce { + from, 20%, 53%, 80%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + -webkit-transform: translate3d(0,0,0); + transform: translate3d(0,0,0); + } + + 40%, 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + + 90% { + -webkit-transform: translate3d(0,-4px,0); + transform: translate3d(0,-4px,0); + } +} + +.bounce { + -webkit-animation-name: bounce; + animation-name: bounce; + -webkit-transform-origin: center bottom; + transform-origin: center bottom; +} + +@-webkit-keyframes flash { + from, 50%, to { + opacity: 1; + } + + 25%, 75% { + opacity: 0; + } +} + +@keyframes flash { + from, 50%, to { + opacity: 1; + } + + 25%, 75% { + opacity: 0; + } +} + +.flash { + -webkit-animation-name: flash; + animation-name: flash; +} + +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ + +@-webkit-keyframes pulse { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 50% { + -webkit-transform: scale3d(1.05, 1.05, 1.05); + transform: scale3d(1.05, 1.05, 1.05); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +@keyframes pulse { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 50% { + -webkit-transform: scale3d(1.05, 1.05, 1.05); + transform: scale3d(1.05, 1.05, 1.05); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +.pulse { + -webkit-animation-name: pulse; + animation-name: pulse; +} + +@-webkit-keyframes rubberBand { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 30% { + -webkit-transform: scale3d(1.25, 0.75, 1); + transform: scale3d(1.25, 0.75, 1); + } + + 40% { + -webkit-transform: scale3d(0.75, 1.25, 1); + transform: scale3d(0.75, 1.25, 1); + } + + 50% { + -webkit-transform: scale3d(1.15, 0.85, 1); + transform: scale3d(1.15, 0.85, 1); + } + + 65% { + -webkit-transform: scale3d(.95, 1.05, 1); + transform: scale3d(.95, 1.05, 1); + } + + 75% { + -webkit-transform: scale3d(1.05, .95, 1); + transform: scale3d(1.05, .95, 1); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +@keyframes rubberBand { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 30% { + -webkit-transform: scale3d(1.25, 0.75, 1); + transform: scale3d(1.25, 0.75, 1); + } + + 40% { + -webkit-transform: scale3d(0.75, 1.25, 1); + transform: scale3d(0.75, 1.25, 1); + } + + 50% { + -webkit-transform: scale3d(1.15, 0.85, 1); + transform: scale3d(1.15, 0.85, 1); + } + + 65% { + -webkit-transform: scale3d(.95, 1.05, 1); + transform: scale3d(.95, 1.05, 1); + } + + 75% { + -webkit-transform: scale3d(1.05, .95, 1); + transform: scale3d(1.05, .95, 1); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +.rubberBand { + -webkit-animation-name: rubberBand; + animation-name: rubberBand; +} + +@-webkit-keyframes shake { + from, to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + 10%, 30%, 50%, 70%, 90% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 20%, 40%, 60%, 80% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } +} + +@keyframes shake { + from, to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + 10%, 30%, 50%, 70%, 90% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 20%, 40%, 60%, 80% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } +} + +.shake { + -webkit-animation-name: shake; + animation-name: shake; +} + +@-webkit-keyframes headShake { + 0% { + -webkit-transform: translateX(0); + transform: translateX(0); + } + + 6.5% { + -webkit-transform: translateX(-6px) rotateY(-9deg); + transform: translateX(-6px) rotateY(-9deg); + } + + 18.5% { + -webkit-transform: translateX(5px) rotateY(7deg); + transform: translateX(5px) rotateY(7deg); + } + + 31.5% { + -webkit-transform: translateX(-3px) rotateY(-5deg); + transform: translateX(-3px) rotateY(-5deg); + } + + 43.5% { + -webkit-transform: translateX(2px) rotateY(3deg); + transform: translateX(2px) rotateY(3deg); + } + + 50% { + -webkit-transform: translateX(0); + transform: translateX(0); + } +} + +@keyframes headShake { + 0% { + -webkit-transform: translateX(0); + transform: translateX(0); + } + + 6.5% { + -webkit-transform: translateX(-6px) rotateY(-9deg); + transform: translateX(-6px) rotateY(-9deg); + } + + 18.5% { + -webkit-transform: translateX(5px) rotateY(7deg); + transform: translateX(5px) rotateY(7deg); + } + + 31.5% { + -webkit-transform: translateX(-3px) rotateY(-5deg); + transform: translateX(-3px) rotateY(-5deg); + } + + 43.5% { + -webkit-transform: translateX(2px) rotateY(3deg); + transform: translateX(2px) rotateY(3deg); + } + + 50% { + -webkit-transform: translateX(0); + transform: translateX(0); + } +} + +.headShake { + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + -webkit-animation-name: headShake; + animation-name: headShake; +} + +@-webkit-keyframes swing { + 20% { + -webkit-transform: rotate3d(0, 0, 1, 15deg); + transform: rotate3d(0, 0, 1, 15deg); + } + + 40% { + -webkit-transform: rotate3d(0, 0, 1, -10deg); + transform: rotate3d(0, 0, 1, -10deg); + } + + 60% { + -webkit-transform: rotate3d(0, 0, 1, 5deg); + transform: rotate3d(0, 0, 1, 5deg); + } + + 80% { + -webkit-transform: rotate3d(0, 0, 1, -5deg); + transform: rotate3d(0, 0, 1, -5deg); + } + + to { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } +} + +@keyframes swing { + 20% { + -webkit-transform: rotate3d(0, 0, 1, 15deg); + transform: rotate3d(0, 0, 1, 15deg); + } + + 40% { + -webkit-transform: rotate3d(0, 0, 1, -10deg); + transform: rotate3d(0, 0, 1, -10deg); + } + + 60% { + -webkit-transform: rotate3d(0, 0, 1, 5deg); + transform: rotate3d(0, 0, 1, 5deg); + } + + 80% { + -webkit-transform: rotate3d(0, 0, 1, -5deg); + transform: rotate3d(0, 0, 1, -5deg); + } + + to { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } +} + +.swing { + -webkit-transform-origin: top center; + transform-origin: top center; + -webkit-animation-name: swing; + animation-name: swing; +} + +@-webkit-keyframes tada { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 10%, 20% { + -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg); + transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg); + } + + 30%, 50%, 70%, 90% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + } + + 40%, 60%, 80% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +@keyframes tada { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + + 10%, 20% { + -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg); + transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg); + } + + 30%, 50%, 70%, 90% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + } + + 40%, 60%, 80% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + } + + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +.tada { + -webkit-animation-name: tada; + animation-name: tada; +} + +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ + +@-webkit-keyframes wobble { + from { + -webkit-transform: none; + transform: none; + } + + 15% { + -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + } + + 30% { + -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + } + + 45% { + -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + } + + 60% { + -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + } + + 75% { + -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +@keyframes wobble { + from { + -webkit-transform: none; + transform: none; + } + + 15% { + -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + } + + 30% { + -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + } + + 45% { + -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + } + + 60% { + -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + } + + 75% { + -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +.wobble { + -webkit-animation-name: wobble; + animation-name: wobble; +} + +@-webkit-keyframes jello { + from, 11.1%, to { + -webkit-transform: none; + transform: none; + } + + 22.2% { + -webkit-transform: skewX(-12.5deg) skewY(-12.5deg); + transform: skewX(-12.5deg) skewY(-12.5deg); + } + + 33.3% { + -webkit-transform: skewX(6.25deg) skewY(6.25deg); + transform: skewX(6.25deg) skewY(6.25deg); + } + + 44.4% { + -webkit-transform: skewX(-3.125deg) skewY(-3.125deg); + transform: skewX(-3.125deg) skewY(-3.125deg); + } + + 55.5% { + -webkit-transform: skewX(1.5625deg) skewY(1.5625deg); + transform: skewX(1.5625deg) skewY(1.5625deg); + } + + 66.6% { + -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg); + transform: skewX(-0.78125deg) skewY(-0.78125deg); + } + + 77.7% { + -webkit-transform: skewX(0.390625deg) skewY(0.390625deg); + transform: skewX(0.390625deg) skewY(0.390625deg); + } + + 88.8% { + -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + } +} + +@keyframes jello { + from, 11.1%, to { + -webkit-transform: none; + transform: none; + } + + 22.2% { + -webkit-transform: skewX(-12.5deg) skewY(-12.5deg); + transform: skewX(-12.5deg) skewY(-12.5deg); + } + + 33.3% { + -webkit-transform: skewX(6.25deg) skewY(6.25deg); + transform: skewX(6.25deg) skewY(6.25deg); + } + + 44.4% { + -webkit-transform: skewX(-3.125deg) skewY(-3.125deg); + transform: skewX(-3.125deg) skewY(-3.125deg); + } + + 55.5% { + -webkit-transform: skewX(1.5625deg) skewY(1.5625deg); + transform: skewX(1.5625deg) skewY(1.5625deg); + } + + 66.6% { + -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg); + transform: skewX(-0.78125deg) skewY(-0.78125deg); + } + + 77.7% { + -webkit-transform: skewX(0.390625deg) skewY(0.390625deg); + transform: skewX(0.390625deg) skewY(0.390625deg); + } + + 88.8% { + -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + } +} + +.jello { + -webkit-animation-name: jello; + animation-name: jello; + -webkit-transform-origin: center; + transform-origin: center; +} + +@-webkit-keyframes bounceIn { + from, 20%, 40%, 60%, 80%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + -webkit-transform: scale3d(.9, .9, .9); + transform: scale3d(.9, .9, .9); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + -webkit-transform: scale3d(.97, .97, .97); + transform: scale3d(.97, .97, .97); + } + + to { + opacity: 1; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +@keyframes bounceIn { + from, 20%, 40%, 60%, 80%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + -webkit-transform: scale3d(.9, .9, .9); + transform: scale3d(.9, .9, .9); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + -webkit-transform: scale3d(.97, .97, .97); + transform: scale3d(.97, .97, .97); + } + + to { + opacity: 1; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +.bounceIn { + -webkit-animation-name: bounceIn; + animation-name: bounceIn; +} + +@-webkit-keyframes bounceInDown { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +@keyframes bounceInDown { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +.bounceInDown { + -webkit-animation-name: bounceInDown; + animation-name: bounceInDown; +} + +@-webkit-keyframes bounceInLeft { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +@keyframes bounceInLeft { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + 0% { + opacity: 0; + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +.bounceInLeft { + -webkit-animation-name: bounceInLeft; + animation-name: bounceInLeft; +} + +@-webkit-keyframes bounceInRight { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + from { + opacity: 0; + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +@keyframes bounceInRight { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + from { + opacity: 0; + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + + to { + -webkit-transform: none; + transform: none; + } +} + +.bounceInRight { + -webkit-animation-name: bounceInRight; + animation-name: bounceInRight; +} + +@-webkit-keyframes bounceInUp { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + from { + opacity: 0; + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes bounceInUp { + from, 60%, 75%, 90%, to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); + } + + from { + opacity: 0; + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + } + + 60% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.bounceInUp { + -webkit-animation-name: bounceInUp; + animation-name: bounceInUp; +} + +@-webkit-keyframes bounceOut { + 20% { + -webkit-transform: scale3d(.9, .9, .9); + transform: scale3d(.9, .9, .9); + } + + 50%, 55% { + opacity: 1; + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } +} + +@keyframes bounceOut { + 20% { + -webkit-transform: scale3d(.9, .9, .9); + transform: scale3d(.9, .9, .9); + } + + 50%, 55% { + opacity: 1; + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } +} + +.bounceOut { + -webkit-animation-name: bounceOut; + animation-name: bounceOut; +} + +@-webkit-keyframes bounceOutDown { + 20% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 40%, 45% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} + +@keyframes bounceOutDown { + 20% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 40%, 45% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} + +.bounceOutDown { + -webkit-animation-name: bounceOutDown; + animation-name: bounceOutDown; +} + +@-webkit-keyframes bounceOutLeft { + 20% { + opacity: 1; + -webkit-transform: translate3d(20px, 0, 0); + transform: translate3d(20px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} + +@keyframes bounceOutLeft { + 20% { + opacity: 1; + -webkit-transform: translate3d(20px, 0, 0); + transform: translate3d(20px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} + +.bounceOutLeft { + -webkit-animation-name: bounceOutLeft; + animation-name: bounceOutLeft; +} + +@-webkit-keyframes bounceOutRight { + 20% { + opacity: 1; + -webkit-transform: translate3d(-20px, 0, 0); + transform: translate3d(-20px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} + +@keyframes bounceOutRight { + 20% { + opacity: 1; + -webkit-transform: translate3d(-20px, 0, 0); + transform: translate3d(-20px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} + +.bounceOutRight { + -webkit-animation-name: bounceOutRight; + animation-name: bounceOutRight; +} + +@-webkit-keyframes bounceOutUp { + 20% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 40%, 45% { + opacity: 1; + -webkit-transform: translate3d(0, 20px, 0); + transform: translate3d(0, 20px, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} + +@keyframes bounceOutUp { + 20% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 40%, 45% { + opacity: 1; + -webkit-transform: translate3d(0, 20px, 0); + transform: translate3d(0, 20px, 0); + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} + +.bounceOutUp { + -webkit-animation-name: bounceOutUp; + animation-name: bounceOutUp; +} + +@-webkit-keyframes fadeIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes fadeIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +.fadeIn { + -webkit-animation-name: fadeIn; + animation-name: fadeIn; +} + +@-webkit-keyframes fadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInDown { + -webkit-animation-name: fadeInDown; + animation-name: fadeInDown; +} + +@-webkit-keyframes fadeInDownBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInDownBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInDownBig { + -webkit-animation-name: fadeInDownBig; + animation-name: fadeInDownBig; +} + +@-webkit-keyframes fadeInLeft { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInLeft { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInLeft { + -webkit-animation-name: fadeInLeft; + animation-name: fadeInLeft; +} + +@-webkit-keyframes fadeInLeftBig { + from { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInLeftBig { + from { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInLeftBig { + -webkit-animation-name: fadeInLeftBig; + animation-name: fadeInLeftBig; +} + +@-webkit-keyframes fadeInRight { + from { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInRight { + from { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInRight { + -webkit-animation-name: fadeInRight; + animation-name: fadeInRight; +} + +@-webkit-keyframes fadeInRightBig { + from { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInRightBig { + from { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInRightBig { + -webkit-animation-name: fadeInRightBig; + animation-name: fadeInRightBig; +} + +@-webkit-keyframes fadeInUp { + from { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInUp { + from { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInUp { + -webkit-animation-name: fadeInUp; + animation-name: fadeInUp; +} + +@-webkit-keyframes fadeInUpBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes fadeInUpBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.fadeInUpBig { + -webkit-animation-name: fadeInUpBig; + animation-name: fadeInUpBig; +} + +@-webkit-keyframes fadeOut { + from { + opacity: 1; + } + + to { + opacity: 0; + } +} + +@keyframes fadeOut { + from { + opacity: 1; + } + + to { + opacity: 0; + } +} + +.fadeOut { + -webkit-animation-name: fadeOut; + animation-name: fadeOut; +} + +@-webkit-keyframes fadeOutDown { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} + +@keyframes fadeOutDown { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} + +.fadeOutDown { + -webkit-animation-name: fadeOutDown; + animation-name: fadeOutDown; +} + +@-webkit-keyframes fadeOutDownBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} + +@keyframes fadeOutDownBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} + +.fadeOutDownBig { + -webkit-animation-name: fadeOutDownBig; + animation-name: fadeOutDownBig; +} + +@-webkit-keyframes fadeOutLeft { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} + +@keyframes fadeOutLeft { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} + +.fadeOutLeft { + -webkit-animation-name: fadeOutLeft; + animation-name: fadeOutLeft; +} + +@-webkit-keyframes fadeOutLeftBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} + +@keyframes fadeOutLeftBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} + +.fadeOutLeftBig { + -webkit-animation-name: fadeOutLeftBig; + animation-name: fadeOutLeftBig; +} + +@-webkit-keyframes fadeOutRight { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} + +@keyframes fadeOutRight { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} + +.fadeOutRight { + -webkit-animation-name: fadeOutRight; + animation-name: fadeOutRight; +} + +@-webkit-keyframes fadeOutRightBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} + +@keyframes fadeOutRightBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} + +.fadeOutRightBig { + -webkit-animation-name: fadeOutRightBig; + animation-name: fadeOutRightBig; +} + +@-webkit-keyframes fadeOutUp { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} + +@keyframes fadeOutUp { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} + +.fadeOutUp { + -webkit-animation-name: fadeOutUp; + animation-name: fadeOutUp; +} + +@-webkit-keyframes fadeOutUpBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} + +@keyframes fadeOutUpBig { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} + +.fadeOutUpBig { + -webkit-animation-name: fadeOutUpBig; + animation-name: fadeOutUpBig; +} + +@-webkit-keyframes flip { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + + 40% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + + 50% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 80% { + -webkit-transform: perspective(400px) scale3d(.95, .95, .95); + transform: perspective(400px) scale3d(.95, .95, .95); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} + +@keyframes flip { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + + 40% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + + 50% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 80% { + -webkit-transform: perspective(400px) scale3d(.95, .95, .95); + transform: perspective(400px) scale3d(.95, .95, .95); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} + +.animated.flip { + -webkit-backface-visibility: visible; + backface-visibility: visible; + -webkit-animation-name: flip; + animation-name: flip; +} + +@-webkit-keyframes flipInX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipInX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +.flipInX { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInX; + animation-name: flipInX; +} + +/************************************/ + +.animated.flipOutXX, +.animated.flipInXX, +.animated.flipInYY, +.animated.flipOutYY +{ + -webkit-animation-duration: .30s !important; + animation-duration: .30s !important; +} + +@-webkit-keyframes flipInXX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 270deg); + transform: perspective(400px) rotate3d(1, 0, 0, 270deg); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + opacity: 0; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 360deg); + transform: perspective(400px) rotate3d(1, 0, 0, 360deg); + } +} + +@keyframes flipInXX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 270deg); + transform: perspective(400px) rotate3d(1, 0, 0, 270deg); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + opacity: 0; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 360deg); + transform: perspective(400px) rotate3d(1, 0, 0, 360deg); + } +} + +.flipInXX { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInXX; + animation-name: flipInXX; +} + +@-webkit-keyframes flipOutXX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 0deg); + transform: perspective(400px) rotate3d(1, 0, 0, 0deg); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +@keyframes flipOutXX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 0deg); + transform: perspective(400px) rotate3d(1, 0, 0, 0deg); + -webkit-animation-timing-function: linear; + animation-timing-function: linear; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +.flipOutXX { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipOutXX; + animation-name: flipOutXX; +} + + +@-webkit-keyframes flipInYY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + opacity: 0; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 360deg); + transform: perspective(400px) rotate3d(0, 1, 0, 360deg); + } +} + +@keyframes flipInYY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 270deg); + transform: perspective(400px) rotate3d(0, 1, 0, 270deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + opacity: 0; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 360deg); + transform: perspective(400px) rotate3d(0, 1, 0, 360deg); + } +} + +.flipInYY { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInYY; + animation-name: flipInYY; +} + + +@-webkit-keyframes flipOutYY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 0deg); + transform: perspective(400px) rotate3d(0, 1, 0, 0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} + +@keyframes flipOutYY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 0deg); + transform: perspective(400px) rotate3d(0, 1, 0, 0deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} + +.flipOutYY { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipOutYY; + animation-name: flipOutYY; +} + + + + + + + + + + +/**************************************/ + +@-webkit-keyframes flipInY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipInY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +.flipInY { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInY; + animation-name: flipInY; +} + +@-webkit-keyframes flipOutX { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + + 30% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +@keyframes flipOutX { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + + 30% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +.flipOutX { + -webkit-animation-name: flipOutX; + animation-name: flipOutX; + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; +} + +@-webkit-keyframes flipOutY { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + + 30% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + opacity: 1; + } + + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} + +@keyframes flipOutY { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + + 30% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + opacity: 1; + } + + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} + +.flipOutY { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipOutY; + animation-name: flipOutY; +} + +@-webkit-keyframes lightSpeedIn { + from { + -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg); + transform: translate3d(100%, 0, 0) skewX(-30deg); + opacity: 0; + } + + 60% { + -webkit-transform: skewX(20deg); + transform: skewX(20deg); + opacity: 1; + } + + 80% { + -webkit-transform: skewX(-5deg); + transform: skewX(-5deg); + opacity: 1; + } + + to { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes lightSpeedIn { + from { + -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg); + transform: translate3d(100%, 0, 0) skewX(-30deg); + opacity: 0; + } + + 60% { + -webkit-transform: skewX(20deg); + transform: skewX(20deg); + opacity: 1; + } + + 80% { + -webkit-transform: skewX(-5deg); + transform: skewX(-5deg); + opacity: 1; + } + + to { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.lightSpeedIn { + -webkit-animation-name: lightSpeedIn; + animation-name: lightSpeedIn; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; +} + +@-webkit-keyframes lightSpeedOut { + from { + opacity: 1; + } + + to { + -webkit-transform: translate3d(100%, 0, 0) skewX(30deg); + transform: translate3d(100%, 0, 0) skewX(30deg); + opacity: 0; + } +} + +@keyframes lightSpeedOut { + from { + opacity: 1; + } + + to { + -webkit-transform: translate3d(100%, 0, 0) skewX(30deg); + transform: translate3d(100%, 0, 0) skewX(30deg); + opacity: 0; + } +} + +.lightSpeedOut { + -webkit-animation-name: lightSpeedOut; + animation-name: lightSpeedOut; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; +} + +@-webkit-keyframes rotateIn { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes rotateIn { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.rotateIn { + -webkit-animation-name: rotateIn; + animation-name: rotateIn; +} + +@-webkit-keyframes rotateInDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes rotateInDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.rotateInDownLeft { + -webkit-animation-name: rotateInDownLeft; + animation-name: rotateInDownLeft; +} + +@-webkit-keyframes rotateInDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes rotateInDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.rotateInDownRight { + -webkit-animation-name: rotateInDownRight; + animation-name: rotateInDownRight; +} + +@-webkit-keyframes rotateInUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes rotateInUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.rotateInUpLeft { + -webkit-animation-name: rotateInUpLeft; + animation-name: rotateInUpLeft; +} + +@-webkit-keyframes rotateInUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +@keyframes rotateInUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} + +.rotateInUpRight { + -webkit-animation-name: rotateInUpRight; + animation-name: rotateInUpRight; +} + +@-webkit-keyframes rotateOut { + from { + -webkit-transform-origin: center; + transform-origin: center; + opacity: 1; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, 200deg); + transform: rotate3d(0, 0, 1, 200deg); + opacity: 0; + } +} + +@keyframes rotateOut { + from { + -webkit-transform-origin: center; + transform-origin: center; + opacity: 1; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, 200deg); + transform: rotate3d(0, 0, 1, 200deg); + opacity: 0; + } +} + +.rotateOut { + -webkit-animation-name: rotateOut; + animation-name: rotateOut; +} + +@-webkit-keyframes rotateOutDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } +} + +@keyframes rotateOutDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } +} + +.rotateOutDownLeft { + -webkit-animation-name: rotateOutDownLeft; + animation-name: rotateOutDownLeft; +} + +@-webkit-keyframes rotateOutDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +@keyframes rotateOutDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +.rotateOutDownRight { + -webkit-animation-name: rotateOutDownRight; + animation-name: rotateOutDownRight; +} + +@-webkit-keyframes rotateOutUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +@keyframes rotateOutUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +.rotateOutUpLeft { + -webkit-animation-name: rotateOutUpLeft; + animation-name: rotateOutUpLeft; +} + +@-webkit-keyframes rotateOutUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 90deg); + transform: rotate3d(0, 0, 1, 90deg); + opacity: 0; + } +} + +@keyframes rotateOutUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 90deg); + transform: rotate3d(0, 0, 1, 90deg); + opacity: 0; + } +} + +.rotateOutUpRight { + -webkit-animation-name: rotateOutUpRight; + animation-name: rotateOutUpRight; +} + +@-webkit-keyframes hinge { + 0% { + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + + 20%, 60% { + -webkit-transform: rotate3d(0, 0, 1, 80deg); + transform: rotate3d(0, 0, 1, 80deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + + 40%, 80% { + -webkit-transform: rotate3d(0, 0, 1, 60deg); + transform: rotate3d(0, 0, 1, 60deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + opacity: 1; + } + + to { + -webkit-transform: translate3d(0, 700px, 0); + transform: translate3d(0, 700px, 0); + opacity: 0; + } +} + +@keyframes hinge { + 0% { + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + + 20%, 60% { + -webkit-transform: rotate3d(0, 0, 1, 80deg); + transform: rotate3d(0, 0, 1, 80deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + + 40%, 80% { + -webkit-transform: rotate3d(0, 0, 1, 60deg); + transform: rotate3d(0, 0, 1, 60deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + opacity: 1; + } + + to { + -webkit-transform: translate3d(0, 700px, 0); + transform: translate3d(0, 700px, 0); + opacity: 0; + } +} + +.hinge { + -webkit-animation-name: hinge; + animation-name: hinge; +} + +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ + +@-webkit-keyframes rollIn { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +@keyframes rollIn { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + } + + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} + +.rollIn { + -webkit-animation-name: rollIn; + animation-name: rollIn; +} + +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ + +@-webkit-keyframes rollOut { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + } +} + +@keyframes rollOut { + from { + opacity: 1; + } + + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + } +} + +.rollOut { + -webkit-animation-name: rollOut; + animation-name: rollOut; +} + +@-webkit-keyframes zoomIn { + from { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + 50% { + opacity: 1; + } +} + +@keyframes zoomIn { + from { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + 50% { + opacity: 1; + } +} + +.zoomIn { + -webkit-animation-name: zoomIn; + animation-name: zoomIn; +} + +@-webkit-keyframes zoomInDown { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomInDown { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomInDown { + -webkit-animation-name: zoomInDown; + animation-name: zoomInDown; +} + +@-webkit-keyframes zoomInLeft { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0); + transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomInLeft { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0); + transform: scale3d(.1, .1, .1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomInLeft { + -webkit-animation-name: zoomInLeft; + animation-name: zoomInLeft; +} + +@-webkit-keyframes zoomInRight { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0); + transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomInRight { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0); + transform: scale3d(.1, .1, .1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomInRight { + -webkit-animation-name: zoomInRight; + animation-name: zoomInRight; +} + +@-webkit-keyframes zoomInUp { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomInUp { + from { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + 60% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomInUp { + -webkit-animation-name: zoomInUp; + animation-name: zoomInUp; +} + +@-webkit-keyframes zoomOut { + from { + opacity: 1; + } + + 50% { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + to { + opacity: 0; + } +} + +@keyframes zoomOut { + from { + opacity: 1; + } + + 50% { + opacity: 0; + -webkit-transform: scale3d(.3, .3, .3); + transform: scale3d(.3, .3, .3); + } + + to { + opacity: 0; + } +} + +.zoomOut { + -webkit-animation-name: zoomOut; + animation-name: zoomOut; +} + +@-webkit-keyframes zoomOutDown { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomOutDown { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, 2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomOutDown { + -webkit-animation-name: zoomOutDown; + animation-name: zoomOutDown; +} + +@-webkit-keyframes zoomOutLeft { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: scale(.1) translate3d(-2000px, 0, 0); + transform: scale(.1) translate3d(-2000px, 0, 0); + -webkit-transform-origin: left center; + transform-origin: left center; + } +} + +@keyframes zoomOutLeft { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(42px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: scale(.1) translate3d(-2000px, 0, 0); + transform: scale(.1) translate3d(-2000px, 0, 0); + -webkit-transform-origin: left center; + transform-origin: left center; + } +} + +.zoomOutLeft { + -webkit-animation-name: zoomOutLeft; + animation-name: zoomOutLeft; +} + +@-webkit-keyframes zoomOutRight { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: scale(.1) translate3d(2000px, 0, 0); + transform: scale(.1) translate3d(2000px, 0, 0); + -webkit-transform-origin: right center; + transform-origin: right center; + } +} + +@keyframes zoomOutRight { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0); + transform: scale3d(.475, .475, .475) translate3d(-42px, 0, 0); + } + + to { + opacity: 0; + -webkit-transform: scale(.1) translate3d(2000px, 0, 0); + transform: scale(.1) translate3d(2000px, 0, 0); + -webkit-transform-origin: right center; + transform-origin: right center; + } +} + +.zoomOutRight { + -webkit-animation-name: zoomOutRight; + animation-name: zoomOutRight; +} + +@-webkit-keyframes zoomOutUp { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +@keyframes zoomOutUp { + 40% { + opacity: 1; + -webkit-transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + transform: scale3d(.475, .475, .475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + animation-timing-function: cubic-bezier(0.550, 0.055, 0.675, 0.190); + } + + to { + opacity: 0; + -webkit-transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0); + transform: scale3d(.1, .1, .1) translate3d(0, -2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + } +} + +.zoomOutUp { + -webkit-animation-name: zoomOutUp; + animation-name: zoomOutUp; +} + +@-webkit-keyframes slideInDown { + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideInDown { + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideInDown { + -webkit-animation-name: slideInDown; + animation-name: slideInDown; +} + +@-webkit-keyframes slideInLeft { + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideInLeft { + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideInLeft { + -webkit-animation-name: slideInLeft; + animation-name: slideInLeft; +} + +@-webkit-keyframes slideInRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideInRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideInRight { + -webkit-animation-name: slideInRight; + animation-name: slideInRight; +} + +@-webkit-keyframes slideInUp { + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideInUp { + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideInUp { + -webkit-animation-name: slideInUp; + animation-name: slideInUp; +} + +@-webkit-keyframes slideOutDown { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} + +@keyframes slideOutDown { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} + +.slideOutDown { + -webkit-animation-name: slideOutDown; + animation-name: slideOutDown; +} + +@-webkit-keyframes slideOutLeft { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} + +@keyframes slideOutLeft { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} + +.slideOutLeft { + -webkit-animation-name: slideOutLeft; + animation-name: slideOutLeft; +} + +@-webkit-keyframes slideOutRight { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} + +@keyframes slideOutRight { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} + +.slideOutRight { + -webkit-animation-name: slideOutRight; + animation-name: slideOutRight; +} + +@-webkit-keyframes slideOutUp { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} + +@keyframes slideOutUp { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} + +.slideOutUp { + -webkit-animation-name: slideOutUp; + animation-name: slideOutUp; +} \ No newline at end of file diff --git a/stickmanboost/base/img1.jpg b/stickmanboost/base/img1.jpg new file mode 100644 index 00000000..55e57d40 Binary files /dev/null and b/stickmanboost/base/img1.jpg differ diff --git a/stickmanboost/base/img2.jpeg b/stickmanboost/base/img2.jpeg new file mode 100644 index 00000000..1a18cb54 Binary files /dev/null and b/stickmanboost/base/img2.jpeg differ diff --git a/stickmanboost/base/img3.jpeg b/stickmanboost/base/img3.jpeg new file mode 100644 index 00000000..669b8063 Binary files /dev/null and b/stickmanboost/base/img3.jpeg differ diff --git a/stickmanboost/base/img4.jpeg b/stickmanboost/base/img4.jpeg new file mode 100644 index 00000000..3f0017e1 Binary files /dev/null and b/stickmanboost/base/img4.jpeg differ diff --git a/stickmanboost/c2runtime.js b/stickmanboost/c2runtime.js new file mode 100644 index 00000000..9d26c692 --- /dev/null +++ b/stickmanboost/c2runtime.js @@ -0,0 +1,37303 @@ +// Generated by Construct 2, the HTML5 game and app creator :: http://www.scirra.com +var cr = {}; +cr.plugins_ = {}; +cr.behaviors = {}; +if (typeof Object.getPrototypeOf !== "function") +{ + if (typeof "test".__proto__ === "object") + { + Object.getPrototypeOf = function(object) { + return object.__proto__; + }; + } + else + { + Object.getPrototypeOf = function(object) { + return object.constructor.prototype; + }; + } +} +(function(){ + cr.logexport = function (msg) + { + if (window.console && window.console.log) + window.console.log(msg); + }; + cr.logerror = function (msg) + { + if (window.console && window.console.error) + window.console.error(msg); + }; + cr.seal = function(x) + { + return x; + }; + cr.freeze = function(x) + { + return x; + }; + cr.is_undefined = function (x) + { + return typeof x === "undefined"; + }; + cr.is_number = function (x) + { + return typeof x === "number"; + }; + cr.is_string = function (x) + { + return typeof x === "string"; + }; + cr.isPOT = function (x) + { + return x > 0 && ((x - 1) & x) === 0; + }; + cr.nextHighestPowerOfTwo = function(x) { + --x; + for (var i = 1; i < 32; i <<= 1) { + x = x | x >> i; + } + return x + 1; + } + cr.abs = function (x) + { + return (x < 0 ? -x : x); + }; + cr.max = function (a, b) + { + return (a > b ? a : b); + }; + cr.min = function (a, b) + { + return (a < b ? a : b); + }; + cr.PI = Math.PI; + cr.round = function (x) + { + return (x + 0.5) | 0; + }; + cr.floor = function (x) + { + if (x >= 0) + return x | 0; + else + return (x | 0) - 1; // correctly round down when negative + }; + cr.ceil = function (x) + { + var f = x | 0; + return (f === x ? f : f + 1); + }; + function Vector2(x, y) + { + this.x = x; + this.y = y; + cr.seal(this); + }; + Vector2.prototype.offset = function (px, py) + { + this.x += px; + this.y += py; + return this; + }; + Vector2.prototype.mul = function (px, py) + { + this.x *= px; + this.y *= py; + return this; + }; + cr.vector2 = Vector2; + cr.segments_intersect = function(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) + { + var max_ax, min_ax, max_ay, min_ay, max_bx, min_bx, max_by, min_by; + if (a1x < a2x) + { + min_ax = a1x; + max_ax = a2x; + } + else + { + min_ax = a2x; + max_ax = a1x; + } + if (b1x < b2x) + { + min_bx = b1x; + max_bx = b2x; + } + else + { + min_bx = b2x; + max_bx = b1x; + } + if (max_ax < min_bx || min_ax > max_bx) + return false; + if (a1y < a2y) + { + min_ay = a1y; + max_ay = a2y; + } + else + { + min_ay = a2y; + max_ay = a1y; + } + if (b1y < b2y) + { + min_by = b1y; + max_by = b2y; + } + else + { + min_by = b2y; + max_by = b1y; + } + if (max_ay < min_by || min_ay > max_by) + return false; + var dpx = b1x - a1x + b2x - a2x; + var dpy = b1y - a1y + b2y - a2y; + var qax = a2x - a1x; + var qay = a2y - a1y; + var qbx = b2x - b1x; + var qby = b2y - b1y; + var d = cr.abs(qay * qbx - qby * qax); + var la = qbx * dpy - qby * dpx; + if (cr.abs(la) > d) + return false; + var lb = qax * dpy - qay * dpx; + return cr.abs(lb) <= d; + }; + function Rect(left, top, right, bottom) + { + this.set(left, top, right, bottom); + cr.seal(this); + }; + Rect.prototype.set = function (left, top, right, bottom) + { + this.left = left; + this.top = top; + this.right = right; + this.bottom = bottom; + }; + Rect.prototype.copy = function (r) + { + this.left = r.left; + this.top = r.top; + this.right = r.right; + this.bottom = r.bottom; + }; + Rect.prototype.width = function () + { + return this.right - this.left; + }; + Rect.prototype.height = function () + { + return this.bottom - this.top; + }; + Rect.prototype.offset = function (px, py) + { + this.left += px; + this.top += py; + this.right += px; + this.bottom += py; + return this; + }; + Rect.prototype.normalize = function () + { + var temp = 0; + if (this.left > this.right) + { + temp = this.left; + this.left = this.right; + this.right = temp; + } + if (this.top > this.bottom) + { + temp = this.top; + this.top = this.bottom; + this.bottom = temp; + } + }; + Rect.prototype.intersects_rect = function (rc) + { + return !(rc.right < this.left || rc.bottom < this.top || rc.left > this.right || rc.top > this.bottom); + }; + Rect.prototype.intersects_rect_off = function (rc, ox, oy) + { + return !(rc.right + ox < this.left || rc.bottom + oy < this.top || rc.left + ox > this.right || rc.top + oy > this.bottom); + }; + Rect.prototype.contains_pt = function (x, y) + { + return (x >= this.left && x <= this.right) && (y >= this.top && y <= this.bottom); + }; + Rect.prototype.equals = function (r) + { + return this.left === r.left && this.top === r.top && this.right === r.right && this.bottom === r.bottom; + }; + cr.rect = Rect; + function Quad() + { + this.tlx = 0; + this.tly = 0; + this.trx = 0; + this.try_ = 0; // is a keyword otherwise! + this.brx = 0; + this.bry = 0; + this.blx = 0; + this.bly = 0; + cr.seal(this); + }; + Quad.prototype.set_from_rect = function (rc) + { + this.tlx = rc.left; + this.tly = rc.top; + this.trx = rc.right; + this.try_ = rc.top; + this.brx = rc.right; + this.bry = rc.bottom; + this.blx = rc.left; + this.bly = rc.bottom; + }; + Quad.prototype.set_from_rotated_rect = function (rc, a) + { + if (a === 0) + { + this.set_from_rect(rc); + } + else + { + var sin_a = Math.sin(a); + var cos_a = Math.cos(a); + var left_sin_a = rc.left * sin_a; + var top_sin_a = rc.top * sin_a; + var right_sin_a = rc.right * sin_a; + var bottom_sin_a = rc.bottom * sin_a; + var left_cos_a = rc.left * cos_a; + var top_cos_a = rc.top * cos_a; + var right_cos_a = rc.right * cos_a; + var bottom_cos_a = rc.bottom * cos_a; + this.tlx = left_cos_a - top_sin_a; + this.tly = top_cos_a + left_sin_a; + this.trx = right_cos_a - top_sin_a; + this.try_ = top_cos_a + right_sin_a; + this.brx = right_cos_a - bottom_sin_a; + this.bry = bottom_cos_a + right_sin_a; + this.blx = left_cos_a - bottom_sin_a; + this.bly = bottom_cos_a + left_sin_a; + } + }; + Quad.prototype.offset = function (px, py) + { + this.tlx += px; + this.tly += py; + this.trx += px; + this.try_ += py; + this.brx += px; + this.bry += py; + this.blx += px; + this.bly += py; + return this; + }; + var minresult = 0; + var maxresult = 0; + function minmax4(a, b, c, d) + { + if (a < b) + { + if (c < d) + { + if (a < c) + minresult = a; + else + minresult = c; + if (b > d) + maxresult = b; + else + maxresult = d; + } + else + { + if (a < d) + minresult = a; + else + minresult = d; + if (b > c) + maxresult = b; + else + maxresult = c; + } + } + else + { + if (c < d) + { + if (b < c) + minresult = b; + else + minresult = c; + if (a > d) + maxresult = a; + else + maxresult = d; + } + else + { + if (b < d) + minresult = b; + else + minresult = d; + if (a > c) + maxresult = a; + else + maxresult = c; + } + } + }; + Quad.prototype.bounding_box = function (rc) + { + minmax4(this.tlx, this.trx, this.brx, this.blx); + rc.left = minresult; + rc.right = maxresult; + minmax4(this.tly, this.try_, this.bry, this.bly); + rc.top = minresult; + rc.bottom = maxresult; + }; + Quad.prototype.contains_pt = function (x, y) + { + var tlx = this.tlx; + var tly = this.tly; + var v0x = this.trx - tlx; + var v0y = this.try_ - tly; + var v1x = this.brx - tlx; + var v1y = this.bry - tly; + var v2x = x - tlx; + var v2y = y - tly; + var dot00 = v0x * v0x + v0y * v0y + var dot01 = v0x * v1x + v0y * v1y + var dot02 = v0x * v2x + v0y * v2y + var dot11 = v1x * v1x + v1y * v1y + var dot12 = v1x * v2x + v1y * v2y + var invDenom = 1.0 / (dot00 * dot11 - dot01 * dot01); + var u = (dot11 * dot02 - dot01 * dot12) * invDenom; + var v = (dot00 * dot12 - dot01 * dot02) * invDenom; + if ((u >= 0.0) && (v > 0.0) && (u + v < 1)) + return true; + v0x = this.blx - tlx; + v0y = this.bly - tly; + var dot00 = v0x * v0x + v0y * v0y + var dot01 = v0x * v1x + v0y * v1y + var dot02 = v0x * v2x + v0y * v2y + invDenom = 1.0 / (dot00 * dot11 - dot01 * dot01); + u = (dot11 * dot02 - dot01 * dot12) * invDenom; + v = (dot00 * dot12 - dot01 * dot02) * invDenom; + return (u >= 0.0) && (v > 0.0) && (u + v < 1); + }; + Quad.prototype.at = function (i, xory) + { + if (xory) + { + switch (i) + { + case 0: return this.tlx; + case 1: return this.trx; + case 2: return this.brx; + case 3: return this.blx; + case 4: return this.tlx; + default: return this.tlx; + } + } + else + { + switch (i) + { + case 0: return this.tly; + case 1: return this.try_; + case 2: return this.bry; + case 3: return this.bly; + case 4: return this.tly; + default: return this.tly; + } + } + }; + Quad.prototype.midX = function () + { + return (this.tlx + this.trx + this.brx + this.blx) / 4; + }; + Quad.prototype.midY = function () + { + return (this.tly + this.try_ + this.bry + this.bly) / 4; + }; + Quad.prototype.intersects_segment = function (x1, y1, x2, y2) + { + if (this.contains_pt(x1, y1) || this.contains_pt(x2, y2)) + return true; + var a1x, a1y, a2x, a2y; + var i; + for (i = 0; i < 4; i++) + { + a1x = this.at(i, true); + a1y = this.at(i, false); + a2x = this.at(i + 1, true); + a2y = this.at(i + 1, false); + if (cr.segments_intersect(x1, y1, x2, y2, a1x, a1y, a2x, a2y)) + return true; + } + return false; + }; + Quad.prototype.intersects_quad = function (rhs) + { + var midx = rhs.midX(); + var midy = rhs.midY(); + if (this.contains_pt(midx, midy)) + return true; + midx = this.midX(); + midy = this.midY(); + if (rhs.contains_pt(midx, midy)) + return true; + var a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y; + var i, j; + for (i = 0; i < 4; i++) + { + for (j = 0; j < 4; j++) + { + a1x = this.at(i, true); + a1y = this.at(i, false); + a2x = this.at(i + 1, true); + a2y = this.at(i + 1, false); + b1x = rhs.at(j, true); + b1y = rhs.at(j, false); + b2x = rhs.at(j + 1, true); + b2y = rhs.at(j + 1, false); + if (cr.segments_intersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y)) + return true; + } + } + return false; + }; + cr.quad = Quad; + cr.RGB = function (red, green, blue) + { + return Math.max(Math.min(red, 255), 0) + | (Math.max(Math.min(green, 255), 0) << 8) + | (Math.max(Math.min(blue, 255), 0) << 16); + }; + cr.GetRValue = function (rgb) + { + return rgb & 0xFF; + }; + cr.GetGValue = function (rgb) + { + return (rgb & 0xFF00) >> 8; + }; + cr.GetBValue = function (rgb) + { + return (rgb & 0xFF0000) >> 16; + }; + cr.shallowCopy = function (a, b, allowOverwrite) + { + var attr; + for (attr in b) + { + if (b.hasOwnProperty(attr)) + { +; + a[attr] = b[attr]; + } + } + return a; + }; + cr.arrayRemove = function (arr, index) + { + var i, len; + index = cr.floor(index); + if (index < 0 || index >= arr.length) + return; // index out of bounds + for (i = index, len = arr.length - 1; i < len; i++) + arr[i] = arr[i + 1]; + cr.truncateArray(arr, len); + }; + cr.truncateArray = function (arr, index) + { + arr.length = index; + }; + cr.clearArray = function (arr) + { + cr.truncateArray(arr, 0); + }; + cr.shallowAssignArray = function (dest, src) + { + cr.clearArray(dest); + var i, len; + for (i = 0, len = src.length; i < len; ++i) + dest[i] = src[i]; + }; + cr.appendArray = function (a, b) + { + a.push.apply(a, b); + }; + cr.fastIndexOf = function (arr, item) + { + var i, len; + for (i = 0, len = arr.length; i < len; ++i) + { + if (arr[i] === item) + return i; + } + return -1; + }; + cr.arrayFindRemove = function (arr, item) + { + var index = cr.fastIndexOf(arr, item); + if (index !== -1) + cr.arrayRemove(arr, index); + }; + cr.clamp = function(x, a, b) + { + if (x < a) + return a; + else if (x > b) + return b; + else + return x; + }; + cr.to_radians = function(x) + { + return x / (180.0 / cr.PI); + }; + cr.to_degrees = function(x) + { + return x * (180.0 / cr.PI); + }; + cr.clamp_angle_degrees = function (a) + { + a %= 360; // now in (-360, 360) range + if (a < 0) + a += 360; // now in [0, 360) range + return a; + }; + cr.clamp_angle = function (a) + { + a %= 2 * cr.PI; // now in (-2pi, 2pi) range + if (a < 0) + a += 2 * cr.PI; // now in [0, 2pi) range + return a; + }; + cr.to_clamped_degrees = function (x) + { + return cr.clamp_angle_degrees(cr.to_degrees(x)); + }; + cr.to_clamped_radians = function (x) + { + return cr.clamp_angle(cr.to_radians(x)); + }; + cr.angleTo = function(x1, y1, x2, y2) + { + var dx = x2 - x1; + var dy = y2 - y1; + return Math.atan2(dy, dx); + }; + cr.angleDiff = function (a1, a2) + { + if (a1 === a2) + return 0; + var s1 = Math.sin(a1); + var c1 = Math.cos(a1); + var s2 = Math.sin(a2); + var c2 = Math.cos(a2); + var n = s1 * s2 + c1 * c2; + if (n >= 1) + return 0; + if (n <= -1) + return cr.PI; + return Math.acos(n); + }; + cr.angleRotate = function (start, end, step) + { + var ss = Math.sin(start); + var cs = Math.cos(start); + var se = Math.sin(end); + var ce = Math.cos(end); + if (Math.acos(ss * se + cs * ce) > step) + { + if (cs * se - ss * ce > 0) + return cr.clamp_angle(start + step); + else + return cr.clamp_angle(start - step); + } + else + return cr.clamp_angle(end); + }; + cr.angleClockwise = function (a1, a2) + { + var s1 = Math.sin(a1); + var c1 = Math.cos(a1); + var s2 = Math.sin(a2); + var c2 = Math.cos(a2); + return c1 * s2 - s1 * c2 <= 0; + }; + cr.rotatePtAround = function (px, py, a, ox, oy, getx) + { + if (a === 0) + return getx ? px : py; + var sin_a = Math.sin(a); + var cos_a = Math.cos(a); + px -= ox; + py -= oy; + var left_sin_a = px * sin_a; + var top_sin_a = py * sin_a; + var left_cos_a = px * cos_a; + var top_cos_a = py * cos_a; + px = left_cos_a - top_sin_a; + py = top_cos_a + left_sin_a; + px += ox; + py += oy; + return getx ? px : py; + } + cr.distanceTo = function(x1, y1, x2, y2) + { + var dx = x2 - x1; + var dy = y2 - y1; + return Math.sqrt(dx*dx + dy*dy); + }; + cr.xor = function (x, y) + { + return !x !== !y; + }; + cr.lerp = function (a, b, x) + { + return a + (b - a) * x; + }; + cr.unlerp = function (a, b, c) + { + if (a === b) + return 0; // avoid divide by 0 + return (c - a) / (b - a); + }; + cr.anglelerp = function (a, b, x) + { + var diff = cr.angleDiff(a, b); + if (cr.angleClockwise(b, a)) + { + return a + diff * x; + } + else + { + return a - diff * x; + } + }; + cr.qarp = function (a, b, c, x) + { + return cr.lerp(cr.lerp(a, b, x), cr.lerp(b, c, x), x); + }; + cr.cubic = function (a, b, c, d, x) + { + return cr.lerp(cr.qarp(a, b, c, x), cr.qarp(b, c, d, x), x); + }; + cr.cosp = function (a, b, x) + { + return (a + b + (a - b) * Math.cos(x * Math.PI)) / 2; + }; + cr.hasAnyOwnProperty = function (o) + { + var p; + for (p in o) + { + if (o.hasOwnProperty(p)) + return true; + } + return false; + }; + cr.wipe = function (obj) + { + var p; + for (p in obj) + { + if (obj.hasOwnProperty(p)) + delete obj[p]; + } + }; + var startup_time = +(new Date()); + cr.performance_now = function() + { + if (typeof window["performance"] !== "undefined") + { + var winperf = window["performance"]; + if (typeof winperf.now !== "undefined") + return winperf.now(); + else if (typeof winperf["webkitNow"] !== "undefined") + return winperf["webkitNow"](); + else if (typeof winperf["mozNow"] !== "undefined") + return winperf["mozNow"](); + else if (typeof winperf["msNow"] !== "undefined") + return winperf["msNow"](); + } + return Date.now() - startup_time; + }; + var isChrome = false; + var isSafari = false; + var isiOS = false; + var isEjecta = false; + if (typeof window !== "undefined") // not c2 editor + { + isChrome = /chrome/i.test(navigator.userAgent) || /chromium/i.test(navigator.userAgent); + isSafari = !isChrome && /safari/i.test(navigator.userAgent); + isiOS = /(iphone|ipod|ipad)/i.test(navigator.userAgent); + isEjecta = window["c2ejecta"]; + } + var supports_set = ((!isSafari && !isEjecta && !isiOS) && (typeof Set !== "undefined" && typeof Set.prototype["forEach"] !== "undefined")); + function ObjectSet_() + { + this.s = null; + this.items = null; // lazy allocated (hopefully results in better GC performance) + this.item_count = 0; + if (supports_set) + { + this.s = new Set(); + } + this.values_cache = []; + this.cache_valid = true; + cr.seal(this); + }; + ObjectSet_.prototype.contains = function (x) + { + if (this.isEmpty()) + return false; + if (supports_set) + return this.s["has"](x); + else + return (this.items && this.items.hasOwnProperty(x)); + }; + ObjectSet_.prototype.add = function (x) + { + if (supports_set) + { + if (!this.s["has"](x)) + { + this.s["add"](x); + this.cache_valid = false; + } + } + else + { + var str = x.toString(); + var items = this.items; + if (!items) + { + this.items = {}; + this.items[str] = x; + this.item_count = 1; + this.cache_valid = false; + } + else if (!items.hasOwnProperty(str)) + { + items[str] = x; + this.item_count++; + this.cache_valid = false; + } + } + }; + ObjectSet_.prototype.remove = function (x) + { + if (this.isEmpty()) + return; + if (supports_set) + { + if (this.s["has"](x)) + { + this.s["delete"](x); + this.cache_valid = false; + } + } + else if (this.items) + { + var str = x.toString(); + var items = this.items; + if (items.hasOwnProperty(str)) + { + delete items[str]; + this.item_count--; + this.cache_valid = false; + } + } + }; + ObjectSet_.prototype.clear = function (/*wipe_*/) + { + if (this.isEmpty()) + return; + if (supports_set) + { + this.s["clear"](); // best! + } + else + { + this.items = null; // creates garbage; will lazy allocate on next add() + this.item_count = 0; + } + cr.clearArray(this.values_cache); + this.cache_valid = true; + }; + ObjectSet_.prototype.isEmpty = function () + { + return this.count() === 0; + }; + ObjectSet_.prototype.count = function () + { + if (supports_set) + return this.s["size"]; + else + return this.item_count; + }; + var current_arr = null; + var current_index = 0; + function set_append_to_arr(x) + { + current_arr[current_index++] = x; + }; + ObjectSet_.prototype.update_cache = function () + { + if (this.cache_valid) + return; + if (supports_set) + { + cr.clearArray(this.values_cache); + current_arr = this.values_cache; + current_index = 0; + this.s["forEach"](set_append_to_arr); +; + current_arr = null; + current_index = 0; + } + else + { + var values_cache = this.values_cache; + cr.clearArray(values_cache); + var p, n = 0, items = this.items; + if (items) + { + for (p in items) + { + if (items.hasOwnProperty(p)) + values_cache[n++] = items[p]; + } + } +; + } + this.cache_valid = true; + }; + ObjectSet_.prototype.valuesRef = function () + { + this.update_cache(); + return this.values_cache; + }; + cr.ObjectSet = ObjectSet_; + var tmpSet = new cr.ObjectSet(); + cr.removeArrayDuplicates = function (arr) + { + var i, len; + for (i = 0, len = arr.length; i < len; ++i) + { + tmpSet.add(arr[i]); + } + cr.shallowAssignArray(arr, tmpSet.valuesRef()); + tmpSet.clear(); + }; + cr.arrayRemoveAllFromObjectSet = function (arr, remset) + { + if (supports_set) + cr.arrayRemoveAll_set(arr, remset.s); + else + cr.arrayRemoveAll_arr(arr, remset.valuesRef()); + }; + cr.arrayRemoveAll_set = function (arr, s) + { + var i, j, len, item; + for (i = 0, j = 0, len = arr.length; i < len; ++i) + { + item = arr[i]; + if (!s["has"](item)) // not an item to remove + arr[j++] = item; // keep it + } + cr.truncateArray(arr, j); + }; + cr.arrayRemoveAll_arr = function (arr, rem) + { + var i, j, len, item; + for (i = 0, j = 0, len = arr.length; i < len; ++i) + { + item = arr[i]; + if (cr.fastIndexOf(rem, item) === -1) // not an item to remove + arr[j++] = item; // keep it + } + cr.truncateArray(arr, j); + }; + function KahanAdder_() + { + this.c = 0; + this.y = 0; + this.t = 0; + this.sum = 0; + cr.seal(this); + }; + KahanAdder_.prototype.add = function (v) + { + this.y = v - this.c; + this.t = this.sum + this.y; + this.c = (this.t - this.sum) - this.y; + this.sum = this.t; + }; + KahanAdder_.prototype.reset = function () + { + this.c = 0; + this.y = 0; + this.t = 0; + this.sum = 0; + }; + cr.KahanAdder = KahanAdder_; + cr.regexp_escape = function(text) + { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + }; + function CollisionPoly_(pts_array_) + { + this.pts_cache = []; + this.bboxLeft = 0; + this.bboxTop = 0; + this.bboxRight = 0; + this.bboxBottom = 0; + this.convexpolys = null; // for physics behavior to cache separated polys + this.set_pts(pts_array_); + cr.seal(this); + }; + CollisionPoly_.prototype.set_pts = function(pts_array_) + { + this.pts_array = pts_array_; + this.pts_count = pts_array_.length / 2; // x, y, x, y... in array + this.pts_cache.length = pts_array_.length; + this.cache_width = -1; + this.cache_height = -1; + this.cache_angle = 0; + }; + CollisionPoly_.prototype.is_empty = function() + { + return !this.pts_array.length; + }; + CollisionPoly_.prototype.update_bbox = function () + { + var myptscache = this.pts_cache; + var bboxLeft_ = myptscache[0]; + var bboxRight_ = bboxLeft_; + var bboxTop_ = myptscache[1]; + var bboxBottom_ = bboxTop_; + var x, y, i = 1, i2, len = this.pts_count; + for ( ; i < len; ++i) + { + i2 = i*2; + x = myptscache[i2]; + y = myptscache[i2+1]; + if (x < bboxLeft_) + bboxLeft_ = x; + if (x > bboxRight_) + bboxRight_ = x; + if (y < bboxTop_) + bboxTop_ = y; + if (y > bboxBottom_) + bboxBottom_ = y; + } + this.bboxLeft = bboxLeft_; + this.bboxRight = bboxRight_; + this.bboxTop = bboxTop_; + this.bboxBottom = bboxBottom_; + }; + CollisionPoly_.prototype.set_from_rect = function(rc, offx, offy) + { + this.pts_cache.length = 8; + this.pts_count = 4; + var myptscache = this.pts_cache; + myptscache[0] = rc.left - offx; + myptscache[1] = rc.top - offy; + myptscache[2] = rc.right - offx; + myptscache[3] = rc.top - offy; + myptscache[4] = rc.right - offx; + myptscache[5] = rc.bottom - offy; + myptscache[6] = rc.left - offx; + myptscache[7] = rc.bottom - offy; + this.cache_width = rc.right - rc.left; + this.cache_height = rc.bottom - rc.top; + this.update_bbox(); + }; + CollisionPoly_.prototype.set_from_quad = function(q, offx, offy, w, h) + { + this.pts_cache.length = 8; + this.pts_count = 4; + var myptscache = this.pts_cache; + myptscache[0] = q.tlx - offx; + myptscache[1] = q.tly - offy; + myptscache[2] = q.trx - offx; + myptscache[3] = q.try_ - offy; + myptscache[4] = q.brx - offx; + myptscache[5] = q.bry - offy; + myptscache[6] = q.blx - offx; + myptscache[7] = q.bly - offy; + this.cache_width = w; + this.cache_height = h; + this.update_bbox(); + }; + CollisionPoly_.prototype.set_from_poly = function (r) + { + this.pts_count = r.pts_count; + cr.shallowAssignArray(this.pts_cache, r.pts_cache); + this.bboxLeft = r.bboxLeft; + this.bboxTop - r.bboxTop; + this.bboxRight = r.bboxRight; + this.bboxBottom = r.bboxBottom; + }; + CollisionPoly_.prototype.cache_poly = function(w, h, a) + { + if (this.cache_width === w && this.cache_height === h && this.cache_angle === a) + return; // cache up-to-date + this.cache_width = w; + this.cache_height = h; + this.cache_angle = a; + var i, i2, i21, len, x, y; + var sina = 0; + var cosa = 1; + var myptsarray = this.pts_array; + var myptscache = this.pts_cache; + if (a !== 0) + { + sina = Math.sin(a); + cosa = Math.cos(a); + } + for (i = 0, len = this.pts_count; i < len; i++) + { + i2 = i*2; + i21 = i2+1; + x = myptsarray[i2] * w; + y = myptsarray[i21] * h; + myptscache[i2] = (x * cosa) - (y * sina); + myptscache[i21] = (y * cosa) + (x * sina); + } + this.update_bbox(); + }; + CollisionPoly_.prototype.contains_pt = function (a2x, a2y) + { + var myptscache = this.pts_cache; + if (a2x === myptscache[0] && a2y === myptscache[1]) + return true; + var i, i2, imod, len = this.pts_count; + var a1x = this.bboxLeft - 110; + var a1y = this.bboxTop - 101; + var a3x = this.bboxRight + 131 + var a3y = this.bboxBottom + 120; + var b1x, b1y, b2x, b2y; + var count1 = 0, count2 = 0; + for (i = 0; i < len; i++) + { + i2 = i*2; + imod = ((i+1)%len)*2; + b1x = myptscache[i2]; + b1y = myptscache[i2+1]; + b2x = myptscache[imod]; + b2y = myptscache[imod+1]; + if (cr.segments_intersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y)) + count1++; + if (cr.segments_intersect(a3x, a3y, a2x, a2y, b1x, b1y, b2x, b2y)) + count2++; + } + return (count1 % 2 === 1) || (count2 % 2 === 1); + }; + CollisionPoly_.prototype.intersects_poly = function (rhs, offx, offy) + { + var rhspts = rhs.pts_cache; + var mypts = this.pts_cache; + if (this.contains_pt(rhspts[0] + offx, rhspts[1] + offy)) + return true; + if (rhs.contains_pt(mypts[0] - offx, mypts[1] - offy)) + return true; + var i, i2, imod, leni, j, j2, jmod, lenj; + var a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y; + for (i = 0, leni = this.pts_count; i < leni; i++) + { + i2 = i*2; + imod = ((i+1)%leni)*2; + a1x = mypts[i2]; + a1y = mypts[i2+1]; + a2x = mypts[imod]; + a2y = mypts[imod+1]; + for (j = 0, lenj = rhs.pts_count; j < lenj; j++) + { + j2 = j*2; + jmod = ((j+1)%lenj)*2; + b1x = rhspts[j2] + offx; + b1y = rhspts[j2+1] + offy; + b2x = rhspts[jmod] + offx; + b2y = rhspts[jmod+1] + offy; + if (cr.segments_intersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y)) + return true; + } + } + return false; + }; + CollisionPoly_.prototype.intersects_segment = function (offx, offy, x1, y1, x2, y2) + { + var mypts = this.pts_cache; + if (this.contains_pt(x1 - offx, y1 - offy)) + return true; + var i, leni, i2, imod; + var a1x, a1y, a2x, a2y; + for (i = 0, leni = this.pts_count; i < leni; i++) + { + i2 = i*2; + imod = ((i+1)%leni)*2; + a1x = mypts[i2] + offx; + a1y = mypts[i2+1] + offy; + a2x = mypts[imod] + offx; + a2y = mypts[imod+1] + offy; + if (cr.segments_intersect(x1, y1, x2, y2, a1x, a1y, a2x, a2y)) + return true; + } + return false; + }; + CollisionPoly_.prototype.mirror = function (px) + { + var i, leni, i2; + for (i = 0, leni = this.pts_count; i < leni; ++i) + { + i2 = i*2; + this.pts_cache[i2] = px * 2 - this.pts_cache[i2]; + } + }; + CollisionPoly_.prototype.flip = function (py) + { + var i, leni, i21; + for (i = 0, leni = this.pts_count; i < leni; ++i) + { + i21 = i*2+1; + this.pts_cache[i21] = py * 2 - this.pts_cache[i21]; + } + }; + CollisionPoly_.prototype.diag = function () + { + var i, leni, i2, i21, temp; + for (i = 0, leni = this.pts_count; i < leni; ++i) + { + i2 = i*2; + i21 = i2+1; + temp = this.pts_cache[i2]; + this.pts_cache[i2] = this.pts_cache[i21]; + this.pts_cache[i21] = temp; + } + }; + cr.CollisionPoly = CollisionPoly_; + function SparseGrid_(cellwidth_, cellheight_) + { + this.cellwidth = cellwidth_; + this.cellheight = cellheight_; + this.cells = {}; + }; + SparseGrid_.prototype.totalCellCount = 0; + SparseGrid_.prototype.getCell = function (x_, y_, create_if_missing) + { + var ret; + var col = this.cells[x_]; + if (!col) + { + if (create_if_missing) + { + ret = allocGridCell(this, x_, y_); + this.cells[x_] = {}; + this.cells[x_][y_] = ret; + return ret; + } + else + return null; + } + ret = col[y_]; + if (ret) + return ret; + else if (create_if_missing) + { + ret = allocGridCell(this, x_, y_); + this.cells[x_][y_] = ret; + return ret; + } + else + return null; + }; + SparseGrid_.prototype.XToCell = function (x_) + { + return cr.floor(x_ / this.cellwidth); + }; + SparseGrid_.prototype.YToCell = function (y_) + { + return cr.floor(y_ / this.cellheight); + }; + SparseGrid_.prototype.update = function (inst, oldrange, newrange) + { + var x, lenx, y, leny, cell; + if (oldrange) + { + for (x = oldrange.left, lenx = oldrange.right; x <= lenx; ++x) + { + for (y = oldrange.top, leny = oldrange.bottom; y <= leny; ++y) + { + if (newrange && newrange.contains_pt(x, y)) + continue; // is still in this cell + cell = this.getCell(x, y, false); // don't create if missing + if (!cell) + continue; // cell does not exist yet + cell.remove(inst); + if (cell.isEmpty()) + { + freeGridCell(cell); + this.cells[x][y] = null; + } + } + } + } + if (newrange) + { + for (x = newrange.left, lenx = newrange.right; x <= lenx; ++x) + { + for (y = newrange.top, leny = newrange.bottom; y <= leny; ++y) + { + if (oldrange && oldrange.contains_pt(x, y)) + continue; // is still in this cell + this.getCell(x, y, true).insert(inst); + } + } + } + }; + SparseGrid_.prototype.queryRange = function (rc, result) + { + var x, lenx, ystart, y, leny, cell; + x = this.XToCell(rc.left); + ystart = this.YToCell(rc.top); + lenx = this.XToCell(rc.right); + leny = this.YToCell(rc.bottom); + for ( ; x <= lenx; ++x) + { + for (y = ystart; y <= leny; ++y) + { + cell = this.getCell(x, y, false); + if (!cell) + continue; + cell.dump(result); + } + } + }; + cr.SparseGrid = SparseGrid_; + function RenderGrid_(cellwidth_, cellheight_) + { + this.cellwidth = cellwidth_; + this.cellheight = cellheight_; + this.cells = {}; + }; + RenderGrid_.prototype.totalCellCount = 0; + RenderGrid_.prototype.getCell = function (x_, y_, create_if_missing) + { + var ret; + var col = this.cells[x_]; + if (!col) + { + if (create_if_missing) + { + ret = allocRenderCell(this, x_, y_); + this.cells[x_] = {}; + this.cells[x_][y_] = ret; + return ret; + } + else + return null; + } + ret = col[y_]; + if (ret) + return ret; + else if (create_if_missing) + { + ret = allocRenderCell(this, x_, y_); + this.cells[x_][y_] = ret; + return ret; + } + else + return null; + }; + RenderGrid_.prototype.XToCell = function (x_) + { + return cr.floor(x_ / this.cellwidth); + }; + RenderGrid_.prototype.YToCell = function (y_) + { + return cr.floor(y_ / this.cellheight); + }; + RenderGrid_.prototype.update = function (inst, oldrange, newrange) + { + var x, lenx, y, leny, cell; + if (oldrange) + { + for (x = oldrange.left, lenx = oldrange.right; x <= lenx; ++x) + { + for (y = oldrange.top, leny = oldrange.bottom; y <= leny; ++y) + { + if (newrange && newrange.contains_pt(x, y)) + continue; // is still in this cell + cell = this.getCell(x, y, false); // don't create if missing + if (!cell) + continue; // cell does not exist yet + cell.remove(inst); + if (cell.isEmpty()) + { + freeRenderCell(cell); + this.cells[x][y] = null; + } + } + } + } + if (newrange) + { + for (x = newrange.left, lenx = newrange.right; x <= lenx; ++x) + { + for (y = newrange.top, leny = newrange.bottom; y <= leny; ++y) + { + if (oldrange && oldrange.contains_pt(x, y)) + continue; // is still in this cell + this.getCell(x, y, true).insert(inst); + } + } + } + }; + RenderGrid_.prototype.queryRange = function (left, top, right, bottom, result) + { + var x, lenx, ystart, y, leny, cell; + x = this.XToCell(left); + ystart = this.YToCell(top); + lenx = this.XToCell(right); + leny = this.YToCell(bottom); + for ( ; x <= lenx; ++x) + { + for (y = ystart; y <= leny; ++y) + { + cell = this.getCell(x, y, false); + if (!cell) + continue; + cell.dump(result); + } + } + }; + RenderGrid_.prototype.markRangeChanged = function (rc) + { + var x, lenx, ystart, y, leny, cell; + x = rc.left; + ystart = rc.top; + lenx = rc.right; + leny = rc.bottom; + for ( ; x <= lenx; ++x) + { + for (y = ystart; y <= leny; ++y) + { + cell = this.getCell(x, y, false); + if (!cell) + continue; + cell.is_sorted = false; + } + } + }; + cr.RenderGrid = RenderGrid_; + var gridcellcache = []; + function allocGridCell(grid_, x_, y_) + { + var ret; + SparseGrid_.prototype.totalCellCount++; + if (gridcellcache.length) + { + ret = gridcellcache.pop(); + ret.grid = grid_; + ret.x = x_; + ret.y = y_; + return ret; + } + else + return new cr.GridCell(grid_, x_, y_); + }; + function freeGridCell(c) + { + SparseGrid_.prototype.totalCellCount--; + c.objects.clear(); + if (gridcellcache.length < 1000) + gridcellcache.push(c); + }; + function GridCell_(grid_, x_, y_) + { + this.grid = grid_; + this.x = x_; + this.y = y_; + this.objects = new cr.ObjectSet(); + }; + GridCell_.prototype.isEmpty = function () + { + return this.objects.isEmpty(); + }; + GridCell_.prototype.insert = function (inst) + { + this.objects.add(inst); + }; + GridCell_.prototype.remove = function (inst) + { + this.objects.remove(inst); + }; + GridCell_.prototype.dump = function (result) + { + cr.appendArray(result, this.objects.valuesRef()); + }; + cr.GridCell = GridCell_; + var rendercellcache = []; + function allocRenderCell(grid_, x_, y_) + { + var ret; + RenderGrid_.prototype.totalCellCount++; + if (rendercellcache.length) + { + ret = rendercellcache.pop(); + ret.grid = grid_; + ret.x = x_; + ret.y = y_; + return ret; + } + else + return new cr.RenderCell(grid_, x_, y_); + }; + function freeRenderCell(c) + { + RenderGrid_.prototype.totalCellCount--; + c.reset(); + if (rendercellcache.length < 1000) + rendercellcache.push(c); + }; + function RenderCell_(grid_, x_, y_) + { + this.grid = grid_; + this.x = x_; + this.y = y_; + this.objects = []; // array which needs to be sorted by Z order + this.is_sorted = true; // whether array is in correct sort order or not + this.pending_removal = new cr.ObjectSet(); + this.any_pending_removal = false; + }; + RenderCell_.prototype.isEmpty = function () + { + if (!this.objects.length) + { +; +; + return true; + } + if (this.objects.length > this.pending_removal.count()) + return false; +; + this.flush_pending(); // takes fast path and just resets state + return true; + }; + RenderCell_.prototype.insert = function (inst) + { + if (this.pending_removal.contains(inst)) + { + this.pending_removal.remove(inst); + if (this.pending_removal.isEmpty()) + this.any_pending_removal = false; + return; + } + if (this.objects.length) + { + var top = this.objects[this.objects.length - 1]; + if (top.get_zindex() > inst.get_zindex()) + this.is_sorted = false; // 'inst' should be somewhere beneath 'top' + this.objects.push(inst); + } + else + { + this.objects.push(inst); + this.is_sorted = true; + } +; + }; + RenderCell_.prototype.remove = function (inst) + { + this.pending_removal.add(inst); + this.any_pending_removal = true; + if (this.pending_removal.count() >= 30) + this.flush_pending(); + }; + RenderCell_.prototype.flush_pending = function () + { +; + if (!this.any_pending_removal) + return; // not changed + if (this.pending_removal.count() === this.objects.length) + { + this.reset(); + return; + } + cr.arrayRemoveAllFromObjectSet(this.objects, this.pending_removal); + this.pending_removal.clear(); + this.any_pending_removal = false; + }; + function sortByInstanceZIndex(a, b) + { + return a.zindex - b.zindex; + }; + RenderCell_.prototype.ensure_sorted = function () + { + if (this.is_sorted) + return; // already sorted + this.objects.sort(sortByInstanceZIndex); + this.is_sorted = true; + }; + RenderCell_.prototype.reset = function () + { + cr.clearArray(this.objects); + this.is_sorted = true; + this.pending_removal.clear(); + this.any_pending_removal = false; + }; + RenderCell_.prototype.dump = function (result) + { + this.flush_pending(); + this.ensure_sorted(); + if (this.objects.length) + result.push(this.objects); + }; + cr.RenderCell = RenderCell_; + var fxNames = [ "lighter", + "xor", + "copy", + "destination-over", + "source-in", + "destination-in", + "source-out", + "destination-out", + "source-atop", + "destination-atop"]; + cr.effectToCompositeOp = function(effect) + { + if (effect <= 0 || effect >= 11) + return "source-over"; + return fxNames[effect - 1]; // not including "none" so offset by 1 + }; + cr.setGLBlend = function(this_, effect, gl) + { + if (!gl) + return; + this_.srcBlend = gl.ONE; + this_.destBlend = gl.ONE_MINUS_SRC_ALPHA; + switch (effect) { + case 1: // lighter (additive) + this_.srcBlend = gl.ONE; + this_.destBlend = gl.ONE; + break; + case 2: // xor + break; // todo + case 3: // copy + this_.srcBlend = gl.ONE; + this_.destBlend = gl.ZERO; + break; + case 4: // destination-over + this_.srcBlend = gl.ONE_MINUS_DST_ALPHA; + this_.destBlend = gl.ONE; + break; + case 5: // source-in + this_.srcBlend = gl.DST_ALPHA; + this_.destBlend = gl.ZERO; + break; + case 6: // destination-in + this_.srcBlend = gl.ZERO; + this_.destBlend = gl.SRC_ALPHA; + break; + case 7: // source-out + this_.srcBlend = gl.ONE_MINUS_DST_ALPHA; + this_.destBlend = gl.ZERO; + break; + case 8: // destination-out + this_.srcBlend = gl.ZERO; + this_.destBlend = gl.ONE_MINUS_SRC_ALPHA; + break; + case 9: // source-atop + this_.srcBlend = gl.DST_ALPHA; + this_.destBlend = gl.ONE_MINUS_SRC_ALPHA; + break; + case 10: // destination-atop + this_.srcBlend = gl.ONE_MINUS_DST_ALPHA; + this_.destBlend = gl.SRC_ALPHA; + break; + } + }; + cr.round6dp = function (x) + { + return Math.round(x * 1000000) / 1000000; + }; + /* + var localeCompare_options = { + "usage": "search", + "sensitivity": "accent" + }; + var has_localeCompare = !!"a".localeCompare; + var localeCompare_works1 = (has_localeCompare && "a".localeCompare("A", undefined, localeCompare_options) === 0); + var localeCompare_works2 = (has_localeCompare && "a".localeCompare("á", undefined, localeCompare_options) !== 0); + var supports_localeCompare = (has_localeCompare && localeCompare_works1 && localeCompare_works2); + */ + cr.equals_nocase = function (a, b) + { + if (typeof a !== "string" || typeof b !== "string") + return false; + if (a.length !== b.length) + return false; + if (a === b) + return true; + /* + if (supports_localeCompare) + { + return (a.localeCompare(b, undefined, localeCompare_options) === 0); + } + else + { + */ + return a.toLowerCase() === b.toLowerCase(); + }; + cr.isCanvasInputEvent = function (e) + { + var target = e.target; + if (!target) + return true; + if (target === document || target === window) + return true; + if (document && document.body && target === document.body) + return true; + if (cr.equals_nocase(target.tagName, "canvas")) + return true; + return false; + }; +}()); +var MatrixArray=typeof Float32Array!=="undefined"?Float32Array:Array,glMatrixArrayType=MatrixArray,vec3={},mat3={},mat4={},quat4={};vec3.create=function(a){var b=new MatrixArray(3);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2]);return b};vec3.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};vec3.add=function(a,b,c){if(!c||a===c)return a[0]+=b[0],a[1]+=b[1],a[2]+=b[2],a;c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];return c}; +vec3.subtract=function(a,b,c){if(!c||a===c)return a[0]-=b[0],a[1]-=b[1],a[2]-=b[2],a;c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];return c};vec3.negate=function(a,b){b||(b=a);b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];return b};vec3.scale=function(a,b,c){if(!c||a===c)return a[0]*=b,a[1]*=b,a[2]*=b,a;c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;return c}; +vec3.normalize=function(a,b){b||(b=a);var c=a[0],d=a[1],e=a[2],g=Math.sqrt(c*c+d*d+e*e);if(g){if(g===1)return b[0]=c,b[1]=d,b[2]=e,b}else return b[0]=0,b[1]=0,b[2]=0,b;g=1/g;b[0]=c*g;b[1]=d*g;b[2]=e*g;return b};vec3.cross=function(a,b,c){c||(c=a);var d=a[0],e=a[1],a=a[2],g=b[0],f=b[1],b=b[2];c[0]=e*b-a*f;c[1]=a*g-d*b;c[2]=d*f-e*g;return c};vec3.length=function(a){var b=a[0],c=a[1],a=a[2];return Math.sqrt(b*b+c*c+a*a)};vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}; +vec3.direction=function(a,b,c){c||(c=a);var d=a[0]-b[0],e=a[1]-b[1],a=a[2]-b[2],b=Math.sqrt(d*d+e*e+a*a);if(!b)return c[0]=0,c[1]=0,c[2]=0,c;b=1/b;c[0]=d*b;c[1]=e*b;c[2]=a*b;return c};vec3.lerp=function(a,b,c,d){d||(d=a);d[0]=a[0]+c*(b[0]-a[0]);d[1]=a[1]+c*(b[1]-a[1]);d[2]=a[2]+c*(b[2]-a[2]);return d};vec3.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+"]"}; +mat3.create=function(a){var b=new MatrixArray(9);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8]);return b};mat3.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};mat3.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a}; +mat3.transpose=function(a,b){if(!b||a===b){var c=a[1],d=a[2],e=a[5];a[1]=a[3];a[2]=a[6];a[3]=c;a[5]=a[7];a[6]=d;a[7]=e;return a}b[0]=a[0];b[1]=a[3];b[2]=a[6];b[3]=a[1];b[4]=a[4];b[5]=a[7];b[6]=a[2];b[7]=a[5];b[8]=a[8];return b};mat3.toMat4=function(a,b){b||(b=mat4.create());b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=a[8];b[9]=a[7];b[8]=a[6];b[7]=0;b[6]=a[5];b[5]=a[4];b[4]=a[3];b[3]=0;b[2]=a[2];b[1]=a[1];b[0]=a[0];return b}; +mat3.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+"]"};mat4.create=function(a){var b=new MatrixArray(16);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15]);return b}; +mat4.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};mat4.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}; +mat4.transpose=function(a,b){if(!b||a===b){var c=a[1],d=a[2],e=a[3],g=a[6],f=a[7],h=a[11];a[1]=a[4];a[2]=a[8];a[3]=a[12];a[4]=c;a[6]=a[9];a[7]=a[13];a[8]=d;a[9]=g;a[11]=a[14];a[12]=e;a[13]=f;a[14]=h;return a}b[0]=a[0];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=a[1];b[5]=a[5];b[6]=a[9];b[7]=a[13];b[8]=a[2];b[9]=a[6];b[10]=a[10];b[11]=a[14];b[12]=a[3];b[13]=a[7];b[14]=a[11];b[15]=a[15];return b}; +mat4.determinant=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],g=a[4],f=a[5],h=a[6],i=a[7],j=a[8],k=a[9],l=a[10],n=a[11],o=a[12],m=a[13],p=a[14],a=a[15];return o*k*h*e-j*m*h*e-o*f*l*e+g*m*l*e+j*f*p*e-g*k*p*e-o*k*d*i+j*m*d*i+o*c*l*i-b*m*l*i-j*c*p*i+b*k*p*i+o*f*d*n-g*m*d*n-o*c*h*n+b*m*h*n+g*c*p*n-b*f*p*n-j*f*d*a+g*k*d*a+j*c*h*a-b*k*h*a-g*c*l*a+b*f*l*a}; +mat4.inverse=function(a,b){b||(b=a);var c=a[0],d=a[1],e=a[2],g=a[3],f=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],n=a[10],o=a[11],m=a[12],p=a[13],r=a[14],s=a[15],A=c*h-d*f,B=c*i-e*f,t=c*j-g*f,u=d*i-e*h,v=d*j-g*h,w=e*j-g*i,x=k*p-l*m,y=k*r-n*m,z=k*s-o*m,C=l*r-n*p,D=l*s-o*p,E=n*s-o*r,q=1/(A*E-B*D+t*C+u*z-v*y+w*x);b[0]=(h*E-i*D+j*C)*q;b[1]=(-d*E+e*D-g*C)*q;b[2]=(p*w-r*v+s*u)*q;b[3]=(-l*w+n*v-o*u)*q;b[4]=(-f*E+i*z-j*y)*q;b[5]=(c*E-e*z+g*y)*q;b[6]=(-m*w+r*t-s*B)*q;b[7]=(k*w-n*t+o*B)*q;b[8]=(f*D-h*z+j*x)*q; +b[9]=(-c*D+d*z-g*x)*q;b[10]=(m*v-p*t+s*A)*q;b[11]=(-k*v+l*t-o*A)*q;b[12]=(-f*C+h*y-i*x)*q;b[13]=(c*C-d*y+e*x)*q;b[14]=(-m*u+p*B-r*A)*q;b[15]=(k*u-l*B+n*A)*q;return b};mat4.toRotationMat=function(a,b){b||(b=mat4.create());b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b}; +mat4.toMat3=function(a,b){b||(b=mat3.create());b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[4];b[4]=a[5];b[5]=a[6];b[6]=a[8];b[7]=a[9];b[8]=a[10];return b};mat4.toInverseMat3=function(a,b){var c=a[0],d=a[1],e=a[2],g=a[4],f=a[5],h=a[6],i=a[8],j=a[9],k=a[10],l=k*f-h*j,n=-k*g+h*i,o=j*g-f*i,m=c*l+d*n+e*o;if(!m)return null;m=1/m;b||(b=mat3.create());b[0]=l*m;b[1]=(-k*d+e*j)*m;b[2]=(h*d-e*f)*m;b[3]=n*m;b[4]=(k*c-e*i)*m;b[5]=(-h*c+e*g)*m;b[6]=o*m;b[7]=(-j*c+d*i)*m;b[8]=(f*c-d*g)*m;return b}; +mat4.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],g=a[2],f=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],n=a[9],o=a[10],m=a[11],p=a[12],r=a[13],s=a[14],a=a[15],A=b[0],B=b[1],t=b[2],u=b[3],v=b[4],w=b[5],x=b[6],y=b[7],z=b[8],C=b[9],D=b[10],E=b[11],q=b[12],F=b[13],G=b[14],b=b[15];c[0]=A*d+B*h+t*l+u*p;c[1]=A*e+B*i+t*n+u*r;c[2]=A*g+B*j+t*o+u*s;c[3]=A*f+B*k+t*m+u*a;c[4]=v*d+w*h+x*l+y*p;c[5]=v*e+w*i+x*n+y*r;c[6]=v*g+w*j+x*o+y*s;c[7]=v*f+w*k+x*m+y*a;c[8]=z*d+C*h+D*l+E*p;c[9]=z*e+C*i+D*n+E*r;c[10]=z*g+C* +j+D*o+E*s;c[11]=z*f+C*k+D*m+E*a;c[12]=q*d+F*h+G*l+b*p;c[13]=q*e+F*i+G*n+b*r;c[14]=q*g+F*j+G*o+b*s;c[15]=q*f+F*k+G*m+b*a;return c};mat4.multiplyVec3=function(a,b,c){c||(c=b);var d=b[0],e=b[1],b=b[2];c[0]=a[0]*d+a[4]*e+a[8]*b+a[12];c[1]=a[1]*d+a[5]*e+a[9]*b+a[13];c[2]=a[2]*d+a[6]*e+a[10]*b+a[14];return c}; +mat4.multiplyVec4=function(a,b,c){c||(c=b);var d=b[0],e=b[1],g=b[2],b=b[3];c[0]=a[0]*d+a[4]*e+a[8]*g+a[12]*b;c[1]=a[1]*d+a[5]*e+a[9]*g+a[13]*b;c[2]=a[2]*d+a[6]*e+a[10]*g+a[14]*b;c[3]=a[3]*d+a[7]*e+a[11]*g+a[15]*b;return c}; +mat4.translate=function(a,b,c){var d=b[0],e=b[1],b=b[2],g,f,h,i,j,k,l,n,o,m,p,r;if(!c||a===c)return a[12]=a[0]*d+a[4]*e+a[8]*b+a[12],a[13]=a[1]*d+a[5]*e+a[9]*b+a[13],a[14]=a[2]*d+a[6]*e+a[10]*b+a[14],a[15]=a[3]*d+a[7]*e+a[11]*b+a[15],a;g=a[0];f=a[1];h=a[2];i=a[3];j=a[4];k=a[5];l=a[6];n=a[7];o=a[8];m=a[9];p=a[10];r=a[11];c[0]=g;c[1]=f;c[2]=h;c[3]=i;c[4]=j;c[5]=k;c[6]=l;c[7]=n;c[8]=o;c[9]=m;c[10]=p;c[11]=r;c[12]=g*d+j*e+o*b+a[12];c[13]=f*d+k*e+m*b+a[13];c[14]=h*d+l*e+p*b+a[14];c[15]=i*d+n*e+r*b+a[15]; +return c};mat4.scale=function(a,b,c){var d=b[0],e=b[1],b=b[2];if(!c||a===c)return a[0]*=d,a[1]*=d,a[2]*=d,a[3]*=d,a[4]*=e,a[5]*=e,a[6]*=e,a[7]*=e,a[8]*=b,a[9]*=b,a[10]*=b,a[11]*=b,a;c[0]=a[0]*d;c[1]=a[1]*d;c[2]=a[2]*d;c[3]=a[3]*d;c[4]=a[4]*e;c[5]=a[5]*e;c[6]=a[6]*e;c[7]=a[7]*e;c[8]=a[8]*b;c[9]=a[9]*b;c[10]=a[10]*b;c[11]=a[11]*b;c[12]=a[12];c[13]=a[13];c[14]=a[14];c[15]=a[15];return c}; +mat4.rotate=function(a,b,c,d){var e=c[0],g=c[1],c=c[2],f=Math.sqrt(e*e+g*g+c*c),h,i,j,k,l,n,o,m,p,r,s,A,B,t,u,v,w,x,y,z;if(!f)return null;f!==1&&(f=1/f,e*=f,g*=f,c*=f);h=Math.sin(b);i=Math.cos(b);j=1-i;b=a[0];f=a[1];k=a[2];l=a[3];n=a[4];o=a[5];m=a[6];p=a[7];r=a[8];s=a[9];A=a[10];B=a[11];t=e*e*j+i;u=g*e*j+c*h;v=c*e*j-g*h;w=e*g*j-c*h;x=g*g*j+i;y=c*g*j+e*h;z=e*c*j+g*h;e=g*c*j-e*h;g=c*c*j+i;d?a!==d&&(d[12]=a[12],d[13]=a[13],d[14]=a[14],d[15]=a[15]):d=a;d[0]=b*t+n*u+r*v;d[1]=f*t+o*u+s*v;d[2]=k*t+m*u+A* +v;d[3]=l*t+p*u+B*v;d[4]=b*w+n*x+r*y;d[5]=f*w+o*x+s*y;d[6]=k*w+m*x+A*y;d[7]=l*w+p*x+B*y;d[8]=b*z+n*e+r*g;d[9]=f*z+o*e+s*g;d[10]=k*z+m*e+A*g;d[11]=l*z+p*e+B*g;return d};mat4.rotateX=function(a,b,c){var d=Math.sin(b),b=Math.cos(b),e=a[4],g=a[5],f=a[6],h=a[7],i=a[8],j=a[9],k=a[10],l=a[11];c?a!==c&&(c[0]=a[0],c[1]=a[1],c[2]=a[2],c[3]=a[3],c[12]=a[12],c[13]=a[13],c[14]=a[14],c[15]=a[15]):c=a;c[4]=e*b+i*d;c[5]=g*b+j*d;c[6]=f*b+k*d;c[7]=h*b+l*d;c[8]=e*-d+i*b;c[9]=g*-d+j*b;c[10]=f*-d+k*b;c[11]=h*-d+l*b;return c}; +mat4.rotateY=function(a,b,c){var d=Math.sin(b),b=Math.cos(b),e=a[0],g=a[1],f=a[2],h=a[3],i=a[8],j=a[9],k=a[10],l=a[11];c?a!==c&&(c[4]=a[4],c[5]=a[5],c[6]=a[6],c[7]=a[7],c[12]=a[12],c[13]=a[13],c[14]=a[14],c[15]=a[15]):c=a;c[0]=e*b+i*-d;c[1]=g*b+j*-d;c[2]=f*b+k*-d;c[3]=h*b+l*-d;c[8]=e*d+i*b;c[9]=g*d+j*b;c[10]=f*d+k*b;c[11]=h*d+l*b;return c}; +mat4.rotateZ=function(a,b,c){var d=Math.sin(b),b=Math.cos(b),e=a[0],g=a[1],f=a[2],h=a[3],i=a[4],j=a[5],k=a[6],l=a[7];c?a!==c&&(c[8]=a[8],c[9]=a[9],c[10]=a[10],c[11]=a[11],c[12]=a[12],c[13]=a[13],c[14]=a[14],c[15]=a[15]):c=a;c[0]=e*b+i*d;c[1]=g*b+j*d;c[2]=f*b+k*d;c[3]=h*b+l*d;c[4]=e*-d+i*b;c[5]=g*-d+j*b;c[6]=f*-d+k*b;c[7]=h*-d+l*b;return c}; +mat4.frustum=function(a,b,c,d,e,g,f){f||(f=mat4.create());var h=b-a,i=d-c,j=g-e;f[0]=e*2/h;f[1]=0;f[2]=0;f[3]=0;f[4]=0;f[5]=e*2/i;f[6]=0;f[7]=0;f[8]=(b+a)/h;f[9]=(d+c)/i;f[10]=-(g+e)/j;f[11]=-1;f[12]=0;f[13]=0;f[14]=-(g*e*2)/j;f[15]=0;return f};mat4.perspective=function(a,b,c,d,e){a=c*Math.tan(a*Math.PI/360);b*=a;return mat4.frustum(-b,b,-a,a,c,d,e)}; +mat4.ortho=function(a,b,c,d,e,g,f){f||(f=mat4.create());var h=b-a,i=d-c,j=g-e;f[0]=2/h;f[1]=0;f[2]=0;f[3]=0;f[4]=0;f[5]=2/i;f[6]=0;f[7]=0;f[8]=0;f[9]=0;f[10]=-2/j;f[11]=0;f[12]=-(a+b)/h;f[13]=-(d+c)/i;f[14]=-(g+e)/j;f[15]=1;return f}; +mat4.lookAt=function(a,b,c,d){d||(d=mat4.create());var e,g,f,h,i,j,k,l,n=a[0],o=a[1],a=a[2];g=c[0];f=c[1];e=c[2];c=b[1];j=b[2];if(n===b[0]&&o===c&&a===j)return mat4.identity(d);c=n-b[0];j=o-b[1];k=a-b[2];l=1/Math.sqrt(c*c+j*j+k*k);c*=l;j*=l;k*=l;b=f*k-e*j;e=e*c-g*k;g=g*j-f*c;(l=Math.sqrt(b*b+e*e+g*g))?(l=1/l,b*=l,e*=l,g*=l):g=e=b=0;f=j*g-k*e;h=k*b-c*g;i=c*e-j*b;(l=Math.sqrt(f*f+h*h+i*i))?(l=1/l,f*=l,h*=l,i*=l):i=h=f=0;d[0]=b;d[1]=f;d[2]=c;d[3]=0;d[4]=e;d[5]=h;d[6]=j;d[7]=0;d[8]=g;d[9]=i;d[10]=k;d[11]= +0;d[12]=-(b*n+e*o+g*a);d[13]=-(f*n+h*o+i*a);d[14]=-(c*n+j*o+k*a);d[15]=1;return d};mat4.fromRotationTranslation=function(a,b,c){c||(c=mat4.create());var d=a[0],e=a[1],g=a[2],f=a[3],h=d+d,i=e+e,j=g+g,a=d*h,k=d*i;d*=j;var l=e*i;e*=j;g*=j;h*=f;i*=f;f*=j;c[0]=1-(l+g);c[1]=k+f;c[2]=d-i;c[3]=0;c[4]=k-f;c[5]=1-(a+g);c[6]=e+h;c[7]=0;c[8]=d+i;c[9]=e-h;c[10]=1-(a+l);c[11]=0;c[12]=b[0];c[13]=b[1];c[14]=b[2];c[15]=1;return c}; +mat4.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+"]"};quat4.create=function(a){var b=new MatrixArray(4);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3]);return b};quat4.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b}; +quat4.calculateW=function(a,b){var c=a[0],d=a[1],e=a[2];if(!b||a===b)return a[3]=-Math.sqrt(Math.abs(1-c*c-d*d-e*e)),a;b[0]=c;b[1]=d;b[2]=e;b[3]=-Math.sqrt(Math.abs(1-c*c-d*d-e*e));return b};quat4.inverse=function(a,b){if(!b||a===b)return a[0]*=-1,a[1]*=-1,a[2]*=-1,a;b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];b[3]=a[3];return b};quat4.length=function(a){var b=a[0],c=a[1],d=a[2],a=a[3];return Math.sqrt(b*b+c*c+d*d+a*a)}; +quat4.normalize=function(a,b){b||(b=a);var c=a[0],d=a[1],e=a[2],g=a[3],f=Math.sqrt(c*c+d*d+e*e+g*g);if(f===0)return b[0]=0,b[1]=0,b[2]=0,b[3]=0,b;f=1/f;b[0]=c*f;b[1]=d*f;b[2]=e*f;b[3]=g*f;return b};quat4.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],g=a[2],a=a[3],f=b[0],h=b[1],i=b[2],b=b[3];c[0]=d*b+a*f+e*i-g*h;c[1]=e*b+a*h+g*f-d*i;c[2]=g*b+a*i+d*h-e*f;c[3]=a*b-d*f-e*h-g*i;return c}; +quat4.multiplyVec3=function(a,b,c){c||(c=b);var d=b[0],e=b[1],g=b[2],b=a[0],f=a[1],h=a[2],a=a[3],i=a*d+f*g-h*e,j=a*e+h*d-b*g,k=a*g+b*e-f*d,d=-b*d-f*e-h*g;c[0]=i*a+d*-b+j*-h-k*-f;c[1]=j*a+d*-f+k*-b-i*-h;c[2]=k*a+d*-h+i*-f-j*-b;return c};quat4.toMat3=function(a,b){b||(b=mat3.create());var c=a[0],d=a[1],e=a[2],g=a[3],f=c+c,h=d+d,i=e+e,j=c*f,k=c*h;c*=i;var l=d*h;d*=i;e*=i;f*=g;h*=g;g*=i;b[0]=1-(l+e);b[1]=k+g;b[2]=c-h;b[3]=k-g;b[4]=1-(j+e);b[5]=d+f;b[6]=c+h;b[7]=d-f;b[8]=1-(j+l);return b}; +quat4.toMat4=function(a,b){b||(b=mat4.create());var c=a[0],d=a[1],e=a[2],g=a[3],f=c+c,h=d+d,i=e+e,j=c*f,k=c*h;c*=i;var l=d*h;d*=i;e*=i;f*=g;h*=g;g*=i;b[0]=1-(l+e);b[1]=k+g;b[2]=c-h;b[3]=0;b[4]=k-g;b[5]=1-(j+e);b[6]=d+f;b[7]=0;b[8]=c+h;b[9]=d-f;b[10]=1-(j+l);b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b}; +quat4.slerp=function(a,b,c,d){d||(d=a);var e=a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3],g,f;if(Math.abs(e)>=1)return d!==a&&(d[0]=a[0],d[1]=a[1],d[2]=a[2],d[3]=a[3]),d;g=Math.acos(e);f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return d[0]=a[0]*0.5+b[0]*0.5,d[1]=a[1]*0.5+b[1]*0.5,d[2]=a[2]*0.5+b[2]*0.5,d[3]=a[3]*0.5+b[3]*0.5,d;e=Math.sin((1-c)*g)/f;c=Math.sin(c*g)/f;d[0]=a[0]*e+b[0]*c;d[1]=a[1]*e+b[1]*c;d[2]=a[2]*e+b[2]*c;d[3]=a[3]*e+b[3]*c;return d}; +quat4.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+"]"}; +(function() +{ + var MAX_VERTICES = 8000; // equates to 2500 objects being drawn + var MAX_INDICES = (MAX_VERTICES / 2) * 3; // 6 indices for every 4 vertices + var MAX_POINTS = 8000; + var MULTI_BUFFERS = 4; // cycle 4 buffers to try and avoid blocking + var BATCH_NULL = 0; + var BATCH_QUAD = 1; + var BATCH_SETTEXTURE = 2; + var BATCH_SETOPACITY = 3; + var BATCH_SETBLEND = 4; + var BATCH_UPDATEMODELVIEW = 5; + var BATCH_RENDERTOTEXTURE = 6; + var BATCH_CLEAR = 7; + var BATCH_POINTS = 8; + var BATCH_SETPROGRAM = 9; + var BATCH_SETPROGRAMPARAMETERS = 10; + var BATCH_SETTEXTURE1 = 11; + var BATCH_SETCOLOR = 12; + var BATCH_SETDEPTHTEST = 13; + var BATCH_SETEARLYZMODE = 14; + /* + var lose_ext = null; + window.lose_context = function () + { + if (!lose_ext) + { + console.log("WEBGL_lose_context not supported"); + return; + } + lose_ext.loseContext(); + }; + window.restore_context = function () + { + if (!lose_ext) + { + console.log("WEBGL_lose_context not supported"); + return; + } + lose_ext.restoreContext(); + }; + */ + var tempMat4 = mat4.create(); + function GLWrap_(gl, isMobile, enableFrontToBack) + { + this.isIE = /msie/i.test(navigator.userAgent) || /trident/i.test(navigator.userAgent); + this.width = 0; // not yet known, wait for call to setSize() + this.height = 0; + this.enableFrontToBack = !!enableFrontToBack; + this.isEarlyZPass = false; + this.isBatchInEarlyZPass = false; + this.currentZ = 0; + this.zNear = 1; + this.zFar = 1000; + this.zIncrement = ((this.zFar - this.zNear) / 32768); + this.zA = this.zFar / (this.zFar - this.zNear); + this.zB = this.zFar * this.zNear / (this.zNear - this.zFar); + this.kzA = 65536 * this.zA; + this.kzB = 65536 * this.zB; + this.cam = vec3.create([0, 0, 100]); // camera position + this.look = vec3.create([0, 0, 0]); // lookat position + this.up = vec3.create([0, 1, 0]); // up vector + this.worldScale = vec3.create([1, 1, 1]); // world scaling factor + this.enable_mipmaps = true; + this.matP = mat4.create(); // perspective matrix + this.matMV = mat4.create(); // model view matrix + this.lastMV = mat4.create(); + this.currentMV = mat4.create(); + this.gl = gl; + this.version = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2") === 0 ? 2 : 1); + this.initState(); + }; + GLWrap_.prototype.initState = function () + { + var gl = this.gl; + var i, len; + this.lastOpacity = 1; + this.lastTexture0 = null; // last bound to TEXTURE0 + this.lastTexture1 = null; // last bound to TEXTURE1 + this.currentOpacity = 1; + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.enable(gl.BLEND); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.disable(gl.CULL_FACE); + gl.disable(gl.STENCIL_TEST); + gl.disable(gl.DITHER); + if (this.enableFrontToBack) + { + gl.enable(gl.DEPTH_TEST); + gl.depthFunc(gl.LEQUAL); + } + else + { + gl.disable(gl.DEPTH_TEST); + } + this.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + this.lastSrcBlend = gl.ONE; + this.lastDestBlend = gl.ONE_MINUS_SRC_ALPHA; + this.vertexData = new Float32Array(MAX_VERTICES * (this.enableFrontToBack ? 3 : 2)); + this.texcoordData = new Float32Array(MAX_VERTICES * 2); + this.pointData = new Float32Array(MAX_POINTS * 4); + this.pointBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this.pointBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this.pointData.byteLength, gl.DYNAMIC_DRAW); + this.vertexBuffers = new Array(MULTI_BUFFERS); + this.texcoordBuffers = new Array(MULTI_BUFFERS); + for (i = 0; i < MULTI_BUFFERS; i++) + { + this.vertexBuffers[i] = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffers[i]); + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData.byteLength, gl.DYNAMIC_DRAW); + this.texcoordBuffers[i] = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this.texcoordBuffers[i]); + gl.bufferData(gl.ARRAY_BUFFER, this.texcoordData.byteLength, gl.DYNAMIC_DRAW); + } + this.curBuffer = 0; + this.indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + var indexData = new Uint16Array(MAX_INDICES); + i = 0, len = MAX_INDICES; + var fv = 0; + while (i < len) + { + indexData[i++] = fv; // top left + indexData[i++] = fv + 1; // top right + indexData[i++] = fv + 2; // bottom right (first tri) + indexData[i++] = fv; // top left + indexData[i++] = fv + 2; // bottom right + indexData[i++] = fv + 3; // bottom left + fv += 4; + } + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indexData, gl.STATIC_DRAW); + this.vertexPtr = 0; + this.texPtr = 0; + this.pointPtr = 0; + var fsSource, vsSource; + this.shaderPrograms = []; + fsSource = [ + "varying mediump vec2 vTex;", + "uniform lowp float opacity;", + "uniform lowp sampler2D samplerFront;", + "void main(void) {", + " gl_FragColor = texture2D(samplerFront, vTex);", + " gl_FragColor *= opacity;", + "}" + ].join("\n"); + if (this.enableFrontToBack) + { + vsSource = [ + "attribute highp vec3 aPos;", + "attribute mediump vec2 aTex;", + "varying mediump vec2 vTex;", + "uniform highp mat4 matP;", + "uniform highp mat4 matMV;", + "void main(void) {", + " gl_Position = matP * matMV * vec4(aPos.x, aPos.y, aPos.z, 1.0);", + " vTex = aTex;", + "}" + ].join("\n"); + } + else + { + vsSource = [ + "attribute highp vec2 aPos;", + "attribute mediump vec2 aTex;", + "varying mediump vec2 vTex;", + "uniform highp mat4 matP;", + "uniform highp mat4 matMV;", + "void main(void) {", + " gl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);", + " vTex = aTex;", + "}" + ].join("\n"); + } + var shaderProg = this.createShaderProgram({src: fsSource}, vsSource, ""); +; + this.shaderPrograms.push(shaderProg); // Default shader is always shader 0 + fsSource = [ + "uniform mediump sampler2D samplerFront;", + "varying lowp float opacity;", + "void main(void) {", + " gl_FragColor = texture2D(samplerFront, gl_PointCoord);", + " gl_FragColor *= opacity;", + "}" + ].join("\n"); + var pointVsSource = [ + "attribute vec4 aPos;", + "varying float opacity;", + "uniform mat4 matP;", + "uniform mat4 matMV;", + "void main(void) {", + " gl_Position = matP * matMV * vec4(aPos.x, aPos.y, 0.0, 1.0);", + " gl_PointSize = aPos.z;", + " opacity = aPos.w;", + "}" + ].join("\n"); + shaderProg = this.createShaderProgram({src: fsSource}, pointVsSource, ""); +; + this.shaderPrograms.push(shaderProg); // Point shader is always shader 1 + fsSource = [ + "varying mediump vec2 vTex;", + "uniform lowp sampler2D samplerFront;", + "void main(void) {", + " if (texture2D(samplerFront, vTex).a < 1.0)", + " discard;", // discarding non-opaque fragments + "}" + ].join("\n"); + var shaderProg = this.createShaderProgram({src: fsSource}, vsSource, ""); +; + this.shaderPrograms.push(shaderProg); // Early-Z shader is always shader 2 + fsSource = [ + "uniform lowp vec4 colorFill;", + "void main(void) {", + " gl_FragColor = colorFill;", + "}" + ].join("\n"); + var shaderProg = this.createShaderProgram({src: fsSource}, vsSource, ""); +; + this.shaderPrograms.push(shaderProg); // Fill-color shader is always shader 3 + for (var shader_name in cr.shaders) + { + if (cr.shaders.hasOwnProperty(shader_name)) + this.shaderPrograms.push(this.createShaderProgram(cr.shaders[shader_name], vsSource, shader_name)); + } + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, null); + this.batch = []; + this.batchPtr = 0; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + this.lastProgram = -1; // start -1 so first switchProgram can do work + this.currentProgram = -1; // current program during batch execution + this.currentShader = null; + this.fbo = gl.createFramebuffer(); + this.renderToTex = null; + this.depthBuffer = null; + this.attachedDepthBuffer = false; // wait until first size call to attach, otherwise it has no storage + if (this.enableFrontToBack) + { + this.depthBuffer = gl.createRenderbuffer(); + } + this.tmpVec3 = vec3.create([0, 0, 0]); +; + var pointsizes = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE); + this.minPointSize = pointsizes[0]; + this.maxPointSize = pointsizes[1]; + if (this.maxPointSize > 2048) + this.maxPointSize = 2048; +; + this.switchProgram(0); + cr.seal(this); + }; + function GLShaderProgram(gl, shaderProgram, name) + { + this.gl = gl; + this.shaderProgram = shaderProgram; + this.name = name; + this.locAPos = gl.getAttribLocation(shaderProgram, "aPos"); + this.locATex = gl.getAttribLocation(shaderProgram, "aTex"); + this.locMatP = gl.getUniformLocation(shaderProgram, "matP"); + this.locMatMV = gl.getUniformLocation(shaderProgram, "matMV"); + this.locOpacity = gl.getUniformLocation(shaderProgram, "opacity"); + this.locColorFill = gl.getUniformLocation(shaderProgram, "colorFill"); + this.locSamplerFront = gl.getUniformLocation(shaderProgram, "samplerFront"); + this.locSamplerBack = gl.getUniformLocation(shaderProgram, "samplerBack"); + this.locDestStart = gl.getUniformLocation(shaderProgram, "destStart"); + this.locDestEnd = gl.getUniformLocation(shaderProgram, "destEnd"); + this.locSeconds = gl.getUniformLocation(shaderProgram, "seconds"); + this.locPixelWidth = gl.getUniformLocation(shaderProgram, "pixelWidth"); + this.locPixelHeight = gl.getUniformLocation(shaderProgram, "pixelHeight"); + this.locLayerScale = gl.getUniformLocation(shaderProgram, "layerScale"); + this.locLayerAngle = gl.getUniformLocation(shaderProgram, "layerAngle"); + this.locViewOrigin = gl.getUniformLocation(shaderProgram, "viewOrigin"); + this.locScrollPos = gl.getUniformLocation(shaderProgram, "scrollPos"); + this.hasAnyOptionalUniforms = !!(this.locPixelWidth || this.locPixelHeight || this.locSeconds || this.locSamplerBack || this.locDestStart || this.locDestEnd || this.locLayerScale || this.locLayerAngle || this.locViewOrigin || this.locScrollPos); + this.lpPixelWidth = -999; // set to something unlikely so never counts as cached on first set + this.lpPixelHeight = -999; + this.lpOpacity = 1; + this.lpDestStartX = 0.0; + this.lpDestStartY = 0.0; + this.lpDestEndX = 1.0; + this.lpDestEndY = 1.0; + this.lpLayerScale = 1.0; + this.lpLayerAngle = 0.0; + this.lpViewOriginX = 0.0; + this.lpViewOriginY = 0.0; + this.lpScrollPosX = 0.0; + this.lpScrollPosY = 0.0; + this.lpSeconds = 0.0; + this.lastCustomParams = []; + this.lpMatMV = mat4.create(); + if (this.locOpacity) + gl.uniform1f(this.locOpacity, 1); + if (this.locColorFill) + gl.uniform4f(this.locColorFill, 1.0, 1.0, 1.0, 1.0); + if (this.locSamplerFront) + gl.uniform1i(this.locSamplerFront, 0); + if (this.locSamplerBack) + gl.uniform1i(this.locSamplerBack, 1); + if (this.locDestStart) + gl.uniform2f(this.locDestStart, 0.0, 0.0); + if (this.locDestEnd) + gl.uniform2f(this.locDestEnd, 1.0, 1.0); + if (this.locLayerScale) + gl.uniform1f(this.locLayerScale, 1.0); + if (this.locLayerAngle) + gl.uniform1f(this.locLayerAngle, 0.0); + if (this.locViewOrigin) + gl.uniform2f(this.locViewOrigin, 0.0, 0.0); + if (this.locScrollPos) + gl.uniform2f(this.locScrollPos, 0.0, 0.0); + if (this.locSeconds) + gl.uniform1f(this.locSeconds, 0.0); + this.hasCurrentMatMV = false; // matMV needs updating + }; + function areMat4sEqual(a, b) + { + return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&& + a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&& + a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&& + a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]; + }; + GLShaderProgram.prototype.updateMatMV = function (mv) + { + if (areMat4sEqual(this.lpMatMV, mv)) + return; // no change, save the expensive GL call + mat4.set(mv, this.lpMatMV); + this.gl.uniformMatrix4fv(this.locMatMV, false, mv); + }; + GLWrap_.prototype.createShaderProgram = function(shaderEntry, vsSource, name) + { + var gl = this.gl; + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, shaderEntry.src); + gl.compileShader(fragmentShader); + if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) + { +; + gl.deleteShader(fragmentShader); + return null; + } + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vsSource); + gl.compileShader(vertexShader); + if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) + { +; + gl.deleteShader(fragmentShader); + gl.deleteShader(vertexShader); + return null; + } + var shaderProgram = gl.createProgram(); + gl.attachShader(shaderProgram, fragmentShader); + gl.attachShader(shaderProgram, vertexShader); + gl.linkProgram(shaderProgram); + if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) + { +; + gl.deleteShader(fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteProgram(shaderProgram); + return null; + } + gl.useProgram(shaderProgram); + gl.deleteShader(fragmentShader); + gl.deleteShader(vertexShader); + var ret = new GLShaderProgram(gl, shaderProgram, name); + ret.extendBoxHorizontal = shaderEntry.extendBoxHorizontal || 0; + ret.extendBoxVertical = shaderEntry.extendBoxVertical || 0; + ret.crossSampling = !!shaderEntry.crossSampling; + ret.preservesOpaqueness = !!shaderEntry.preservesOpaqueness; + ret.animated = !!shaderEntry.animated; + ret.parameters = shaderEntry.parameters || []; + var i, len; + for (i = 0, len = ret.parameters.length; i < len; i++) + { + ret.parameters[i][1] = gl.getUniformLocation(shaderProgram, ret.parameters[i][0]); + ret.lastCustomParams.push(0); + gl.uniform1f(ret.parameters[i][1], 0); + } + cr.seal(ret); + return ret; + }; + GLWrap_.prototype.getShaderIndex = function(name_) + { + var i, len; + for (i = 0, len = this.shaderPrograms.length; i < len; i++) + { + if (this.shaderPrograms[i].name === name_) + return i; + } + return -1; + }; + GLWrap_.prototype.project = function (x, y, out) + { + var mv = this.matMV; + var proj = this.matP; + var fTempo = [0, 0, 0, 0, 0, 0, 0, 0]; + fTempo[0] = mv[0]*x+mv[4]*y+mv[12]; + fTempo[1] = mv[1]*x+mv[5]*y+mv[13]; + fTempo[2] = mv[2]*x+mv[6]*y+mv[14]; + fTempo[3] = mv[3]*x+mv[7]*y+mv[15]; + fTempo[4] = proj[0]*fTempo[0]+proj[4]*fTempo[1]+proj[8]*fTempo[2]+proj[12]*fTempo[3]; + fTempo[5] = proj[1]*fTempo[0]+proj[5]*fTempo[1]+proj[9]*fTempo[2]+proj[13]*fTempo[3]; + fTempo[6] = proj[2]*fTempo[0]+proj[6]*fTempo[1]+proj[10]*fTempo[2]+proj[14]*fTempo[3]; + fTempo[7] = -fTempo[2]; + if(fTempo[7]===0.0) //The w value + return; + fTempo[7]=1.0/fTempo[7]; + fTempo[4]*=fTempo[7]; + fTempo[5]*=fTempo[7]; + fTempo[6]*=fTempo[7]; + out[0]=(fTempo[4]*0.5+0.5)*this.width; + out[1]=(fTempo[5]*0.5+0.5)*this.height; + }; + GLWrap_.prototype.setSize = function(w, h, force) + { + if (this.width === w && this.height === h && !force) + return; + this.endBatch(); + var gl = this.gl; + this.width = w; + this.height = h; + gl.viewport(0, 0, w, h); + mat4.lookAt(this.cam, this.look, this.up, this.matMV); + if (this.enableFrontToBack) + { + mat4.ortho(-w/2, w/2, h/2, -h/2, this.zNear, this.zFar, this.matP); + this.worldScale[0] = 1; + this.worldScale[1] = 1; + } + else + { + mat4.perspective(45, w / h, this.zNear, this.zFar, this.matP); + var tl = [0, 0]; + var br = [0, 0]; + this.project(0, 0, tl); + this.project(1, 1, br); + this.worldScale[0] = 1 / (br[0] - tl[0]); + this.worldScale[1] = -1 / (br[1] - tl[1]); + } + var i, len, s; + for (i = 0, len = this.shaderPrograms.length; i < len; i++) + { + s = this.shaderPrograms[i]; + s.hasCurrentMatMV = false; + if (s.locMatP) + { + gl.useProgram(s.shaderProgram); + gl.uniformMatrix4fv(s.locMatP, false, this.matP); + } + } + gl.useProgram(this.shaderPrograms[this.lastProgram].shaderProgram); + gl.bindTexture(gl.TEXTURE_2D, null); + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, null); + gl.activeTexture(gl.TEXTURE0); + this.lastTexture0 = null; + this.lastTexture1 = null; + if (this.depthBuffer) + { + gl.bindFramebuffer(gl.FRAMEBUFFER, this.fbo); + gl.bindRenderbuffer(gl.RENDERBUFFER, this.depthBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.width, this.height); + if (!this.attachedDepthBuffer) + { + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depthBuffer); + this.attachedDepthBuffer = true; + } + gl.bindRenderbuffer(gl.RENDERBUFFER, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + this.renderToTex = null; + } + }; + GLWrap_.prototype.resetModelView = function () + { + mat4.lookAt(this.cam, this.look, this.up, this.matMV); + mat4.scale(this.matMV, this.worldScale); + }; + GLWrap_.prototype.translate = function (x, y) + { + if (x === 0 && y === 0) + return; + this.tmpVec3[0] = x;// * this.worldScale[0]; + this.tmpVec3[1] = y;// * this.worldScale[1]; + this.tmpVec3[2] = 0; + mat4.translate(this.matMV, this.tmpVec3); + }; + GLWrap_.prototype.scale = function (x, y) + { + if (x === 1 && y === 1) + return; + this.tmpVec3[0] = x; + this.tmpVec3[1] = y; + this.tmpVec3[2] = 1; + mat4.scale(this.matMV, this.tmpVec3); + }; + GLWrap_.prototype.rotateZ = function (a) + { + if (a === 0) + return; + mat4.rotateZ(this.matMV, a); + }; + GLWrap_.prototype.updateModelView = function() + { + if (areMat4sEqual(this.lastMV, this.matMV)) + return; + var b = this.pushBatch(); + b.type = BATCH_UPDATEMODELVIEW; + if (b.mat4param) + mat4.set(this.matMV, b.mat4param); + else + b.mat4param = mat4.create(this.matMV); + mat4.set(this.matMV, this.lastMV); + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + /* + var debugBatch = false; + jQuery(document).mousedown( + function(info) { + if (info.which === 2) + debugBatch = true; + } + ); + */ + GLWrap_.prototype.setEarlyZIndex = function (i) + { + if (!this.enableFrontToBack) + return; + if (i > 32760) + i = 32760; + this.currentZ = this.cam[2] - this.zNear - i * this.zIncrement; + }; + function GLBatchJob(type_, glwrap_) + { + this.type = type_; + this.glwrap = glwrap_; + this.gl = glwrap_.gl; + this.opacityParam = 0; // for setOpacity() + this.startIndex = 0; // for quad() + this.indexCount = 0; // " + this.texParam = null; // for setTexture() + this.mat4param = null; // for updateModelView() + this.shaderParams = []; // for user parameters + cr.seal(this); + }; + GLBatchJob.prototype.doSetEarlyZPass = function () + { + var gl = this.gl; + var glwrap = this.glwrap; + if (this.startIndex !== 0) // enable + { + gl.depthMask(true); // enable depth writes + gl.colorMask(false, false, false, false); // disable color writes + gl.disable(gl.BLEND); // no color writes so disable blend + gl.bindFramebuffer(gl.FRAMEBUFFER, glwrap.fbo); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0); + gl.clear(gl.DEPTH_BUFFER_BIT); // auto-clear depth buffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + glwrap.isBatchInEarlyZPass = true; + } + else + { + gl.depthMask(false); // disable depth writes, only test existing depth values + gl.colorMask(true, true, true, true); // enable color writes + gl.enable(gl.BLEND); // turn blending back on + glwrap.isBatchInEarlyZPass = false; + } + }; + GLBatchJob.prototype.doSetTexture = function () + { + this.gl.bindTexture(this.gl.TEXTURE_2D, this.texParam); + }; + GLBatchJob.prototype.doSetTexture1 = function () + { + var gl = this.gl; + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, this.texParam); + gl.activeTexture(gl.TEXTURE0); + }; + GLBatchJob.prototype.doSetOpacity = function () + { + var o = this.opacityParam; + var glwrap = this.glwrap; + glwrap.currentOpacity = o; + var curProg = glwrap.currentShader; + if (curProg.locOpacity && curProg.lpOpacity !== o) + { + curProg.lpOpacity = o; + this.gl.uniform1f(curProg.locOpacity, o); + } + }; + GLBatchJob.prototype.doQuad = function () + { + this.gl.drawElements(this.gl.TRIANGLES, this.indexCount, this.gl.UNSIGNED_SHORT, this.startIndex); + }; + GLBatchJob.prototype.doSetBlend = function () + { + this.gl.blendFunc(this.startIndex, this.indexCount); + }; + GLBatchJob.prototype.doUpdateModelView = function () + { + var i, len, s, shaderPrograms = this.glwrap.shaderPrograms, currentProgram = this.glwrap.currentProgram; + for (i = 0, len = shaderPrograms.length; i < len; i++) + { + s = shaderPrograms[i]; + if (i === currentProgram && s.locMatMV) + { + s.updateMatMV(this.mat4param); + s.hasCurrentMatMV = true; + } + else + s.hasCurrentMatMV = false; + } + mat4.set(this.mat4param, this.glwrap.currentMV); + }; + GLBatchJob.prototype.doRenderToTexture = function () + { + var gl = this.gl; + var glwrap = this.glwrap; + if (this.texParam) + { + if (glwrap.lastTexture1 === this.texParam) + { + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, null); + glwrap.lastTexture1 = null; + gl.activeTexture(gl.TEXTURE0); + } + gl.bindFramebuffer(gl.FRAMEBUFFER, glwrap.fbo); + if (!glwrap.isBatchInEarlyZPass) + { + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texParam, 0); + } + } + else + { + if (!glwrap.enableFrontToBack) + { + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0); + } + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + }; + GLBatchJob.prototype.doClear = function () + { + var gl = this.gl; + var mode = this.startIndex; + if (mode === 0) // clear whole surface + { + gl.clearColor(this.mat4param[0], this.mat4param[1], this.mat4param[2], this.mat4param[3]); + gl.clear(gl.COLOR_BUFFER_BIT); + } + else if (mode === 1) // clear rectangle + { + gl.enable(gl.SCISSOR_TEST); + gl.scissor(this.mat4param[0], this.mat4param[1], this.mat4param[2], this.mat4param[3]); + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.disable(gl.SCISSOR_TEST); + } + else // clear depth + { + gl.clear(gl.DEPTH_BUFFER_BIT); + } + }; + GLBatchJob.prototype.doSetDepthTestEnabled = function () + { + var gl = this.gl; + var enable = this.startIndex; + if (enable !== 0) + { + gl.enable(gl.DEPTH_TEST); + } + else + { + gl.disable(gl.DEPTH_TEST); + } + }; + GLBatchJob.prototype.doPoints = function () + { + var gl = this.gl; + var glwrap = this.glwrap; + if (glwrap.enableFrontToBack) + gl.disable(gl.DEPTH_TEST); + var s = glwrap.shaderPrograms[1]; + gl.useProgram(s.shaderProgram); + if (!s.hasCurrentMatMV && s.locMatMV) + { + s.updateMatMV(glwrap.currentMV); + s.hasCurrentMatMV = true; + } + gl.enableVertexAttribArray(s.locAPos); + gl.bindBuffer(gl.ARRAY_BUFFER, glwrap.pointBuffer); + gl.vertexAttribPointer(s.locAPos, 4, gl.FLOAT, false, 0, 0); + gl.drawArrays(gl.POINTS, this.startIndex / 4, this.indexCount); + s = glwrap.currentShader; + gl.useProgram(s.shaderProgram); + if (s.locAPos >= 0) + { + gl.enableVertexAttribArray(s.locAPos); + gl.bindBuffer(gl.ARRAY_BUFFER, glwrap.vertexBuffers[glwrap.curBuffer]); + gl.vertexAttribPointer(s.locAPos, glwrap.enableFrontToBack ? 3 : 2, gl.FLOAT, false, 0, 0); + } + if (s.locATex >= 0) + { + gl.enableVertexAttribArray(s.locATex); + gl.bindBuffer(gl.ARRAY_BUFFER, glwrap.texcoordBuffers[glwrap.curBuffer]); + gl.vertexAttribPointer(s.locATex, 2, gl.FLOAT, false, 0, 0); + } + if (glwrap.enableFrontToBack) + gl.enable(gl.DEPTH_TEST); + }; + GLBatchJob.prototype.doSetProgram = function () + { + var gl = this.gl; + var glwrap = this.glwrap; + var s = glwrap.shaderPrograms[this.startIndex]; // recycled param to save memory + glwrap.currentProgram = this.startIndex; // current batch program + glwrap.currentShader = s; + gl.useProgram(s.shaderProgram); // switch to + if (!s.hasCurrentMatMV && s.locMatMV) + { + s.updateMatMV(glwrap.currentMV); + s.hasCurrentMatMV = true; + } + if (s.locOpacity && s.lpOpacity !== glwrap.currentOpacity) + { + s.lpOpacity = glwrap.currentOpacity; + gl.uniform1f(s.locOpacity, glwrap.currentOpacity); + } + if (s.locAPos >= 0) + { + gl.enableVertexAttribArray(s.locAPos); + gl.bindBuffer(gl.ARRAY_BUFFER, glwrap.vertexBuffers[glwrap.curBuffer]); + gl.vertexAttribPointer(s.locAPos, glwrap.enableFrontToBack ? 3 : 2, gl.FLOAT, false, 0, 0); + } + if (s.locATex >= 0) + { + gl.enableVertexAttribArray(s.locATex); + gl.bindBuffer(gl.ARRAY_BUFFER, glwrap.texcoordBuffers[glwrap.curBuffer]); + gl.vertexAttribPointer(s.locATex, 2, gl.FLOAT, false, 0, 0); + } + } + GLBatchJob.prototype.doSetColor = function () + { + var s = this.glwrap.currentShader; + var mat4param = this.mat4param; + this.gl.uniform4f(s.locColorFill, mat4param[0], mat4param[1], mat4param[2], mat4param[3]); + }; + GLBatchJob.prototype.doSetProgramParameters = function () + { + var i, len, s = this.glwrap.currentShader; + var gl = this.gl; + var mat4param = this.mat4param; + if (s.locSamplerBack && this.glwrap.lastTexture1 !== this.texParam) + { + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, this.texParam); + this.glwrap.lastTexture1 = this.texParam; + gl.activeTexture(gl.TEXTURE0); + } + var v = mat4param[0]; + var v2; + if (s.locPixelWidth && v !== s.lpPixelWidth) + { + s.lpPixelWidth = v; + gl.uniform1f(s.locPixelWidth, v); + } + v = mat4param[1]; + if (s.locPixelHeight && v !== s.lpPixelHeight) + { + s.lpPixelHeight = v; + gl.uniform1f(s.locPixelHeight, v); + } + v = mat4param[2]; + v2 = mat4param[3]; + if (s.locDestStart && (v !== s.lpDestStartX || v2 !== s.lpDestStartY)) + { + s.lpDestStartX = v; + s.lpDestStartY = v2; + gl.uniform2f(s.locDestStart, v, v2); + } + v = mat4param[4]; + v2 = mat4param[5]; + if (s.locDestEnd && (v !== s.lpDestEndX || v2 !== s.lpDestEndY)) + { + s.lpDestEndX = v; + s.lpDestEndY = v2; + gl.uniform2f(s.locDestEnd, v, v2); + } + v = mat4param[6]; + if (s.locLayerScale && v !== s.lpLayerScale) + { + s.lpLayerScale = v; + gl.uniform1f(s.locLayerScale, v); + } + v = mat4param[7]; + if (s.locLayerAngle && v !== s.lpLayerAngle) + { + s.lpLayerAngle = v; + gl.uniform1f(s.locLayerAngle, v); + } + v = mat4param[8]; + v2 = mat4param[9]; + if (s.locViewOrigin && (v !== s.lpViewOriginX || v2 !== s.lpViewOriginY)) + { + s.lpViewOriginX = v; + s.lpViewOriginY = v2; + gl.uniform2f(s.locViewOrigin, v, v2); + } + v = mat4param[10]; + v2 = mat4param[11]; + if (s.locScrollPos && (v !== s.lpScrollPosX || v2 !== s.lpScrollPosY)) + { + s.lpScrollPosX = v; + s.lpScrollPosY = v2; + gl.uniform2f(s.locScrollPos, v, v2); + } + v = mat4param[12]; + if (s.locSeconds && v !== s.lpSeconds) + { + s.lpSeconds = v; + gl.uniform1f(s.locSeconds, v); + } + if (s.parameters.length) + { + for (i = 0, len = s.parameters.length; i < len; i++) + { + v = this.shaderParams[i]; + if (v !== s.lastCustomParams[i]) + { + s.lastCustomParams[i] = v; + gl.uniform1f(s.parameters[i][1], v); + } + } + } + }; + GLWrap_.prototype.pushBatch = function () + { + if (this.batchPtr === this.batch.length) + this.batch.push(new GLBatchJob(BATCH_NULL, this)); + return this.batch[this.batchPtr++]; + }; + GLWrap_.prototype.endBatch = function () + { + if (this.batchPtr === 0) + return; + if (this.gl.isContextLost()) + return; + var gl = this.gl; + if (this.pointPtr > 0) + { + gl.bindBuffer(gl.ARRAY_BUFFER, this.pointBuffer); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.pointData.subarray(0, this.pointPtr)); + if (s && s.locAPos >= 0 && s.name === "") + gl.vertexAttribPointer(s.locAPos, 4, gl.FLOAT, false, 0, 0); + } + if (this.vertexPtr > 0) + { + var s = this.currentShader; + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffers[this.curBuffer]); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertexData.subarray(0, this.vertexPtr)); + if (s && s.locAPos >= 0 && s.name !== "") + gl.vertexAttribPointer(s.locAPos, this.enableFrontToBack ? 3 : 2, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ARRAY_BUFFER, this.texcoordBuffers[this.curBuffer]); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.texcoordData.subarray(0, this.texPtr)); + if (s && s.locATex >= 0 && s.name !== "") + gl.vertexAttribPointer(s.locATex, 2, gl.FLOAT, false, 0, 0); + } + var i, len, b; + for (i = 0, len = this.batchPtr; i < len; i++) + { + b = this.batch[i]; + switch (b.type) { + case 1: + b.doQuad(); + break; + case 2: + b.doSetTexture(); + break; + case 3: + b.doSetOpacity(); + break; + case 4: + b.doSetBlend(); + break; + case 5: + b.doUpdateModelView(); + break; + case 6: + b.doRenderToTexture(); + break; + case 7: + b.doClear(); + break; + case 8: + b.doPoints(); + break; + case 9: + b.doSetProgram(); + break; + case 10: + b.doSetProgramParameters(); + break; + case 11: + b.doSetTexture1(); + break; + case 12: + b.doSetColor(); + break; + case 13: + b.doSetDepthTestEnabled(); + break; + case 14: + b.doSetEarlyZPass(); + break; + } + } + this.batchPtr = 0; + this.vertexPtr = 0; + this.texPtr = 0; + this.pointPtr = 0; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + this.isBatchInEarlyZPass = false; + this.curBuffer++; + if (this.curBuffer >= MULTI_BUFFERS) + this.curBuffer = 0; + }; + GLWrap_.prototype.setOpacity = function (op) + { + if (op === this.lastOpacity) + return; + if (this.isEarlyZPass) + return; // ignore + var b = this.pushBatch(); + b.type = BATCH_SETOPACITY; + b.opacityParam = op; + this.lastOpacity = op; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.setTexture = function (tex) + { + if (tex === this.lastTexture0) + return; +; + var b = this.pushBatch(); + b.type = BATCH_SETTEXTURE; + b.texParam = tex; + this.lastTexture0 = tex; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.setBlend = function (s, d) + { + if (s === this.lastSrcBlend && d === this.lastDestBlend) + return; + if (this.isEarlyZPass) + return; // ignore + var b = this.pushBatch(); + b.type = BATCH_SETBLEND; + b.startIndex = s; // recycle params to save memory + b.indexCount = d; + this.lastSrcBlend = s; + this.lastDestBlend = d; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.isPremultipliedAlphaBlend = function () + { + return (this.lastSrcBlend === this.gl.ONE && this.lastDestBlend === this.gl.ONE_MINUS_SRC_ALPHA); + }; + GLWrap_.prototype.setAlphaBlend = function () + { + this.setBlend(this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA); + }; + GLWrap_.prototype.setNoPremultiplyAlphaBlend = function () + { + this.setBlend(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA); + }; + var LAST_VERTEX = MAX_VERTICES * 2 - 8; + GLWrap_.prototype.quad = function(tlx, tly, trx, try_, brx, bry, blx, bly) + { + if (this.vertexPtr >= LAST_VERTEX) + this.endBatch(); + var v = this.vertexPtr; // vertex cursor + var t = this.texPtr; + var vd = this.vertexData; // vertex data array + var td = this.texcoordData; // texture coord data array + var currentZ = this.currentZ; + if (this.hasQuadBatchTop) + { + this.batch[this.batchPtr - 1].indexCount += 6; + } + else + { + var b = this.pushBatch(); + b.type = BATCH_QUAD; + b.startIndex = this.enableFrontToBack ? v : (v / 2) * 3; + b.indexCount = 6; + this.hasQuadBatchTop = true; + this.hasPointBatchTop = false; + } + if (this.enableFrontToBack) + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = currentZ; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = currentZ; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = currentZ; + vd[v++] = blx; + vd[v++] = bly; + vd[v++] = currentZ; + } + else + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = blx; + vd[v++] = bly; + } + td[t++] = 0; + td[t++] = 0; + td[t++] = 1; + td[t++] = 0; + td[t++] = 1; + td[t++] = 1; + td[t++] = 0; + td[t++] = 1; + this.vertexPtr = v; + this.texPtr = t; + }; + GLWrap_.prototype.quadTex = function(tlx, tly, trx, try_, brx, bry, blx, bly, rcTex) + { + if (this.vertexPtr >= LAST_VERTEX) + this.endBatch(); + var v = this.vertexPtr; // vertex cursor + var t = this.texPtr; + var vd = this.vertexData; // vertex data array + var td = this.texcoordData; // texture coord data array + var currentZ = this.currentZ; + if (this.hasQuadBatchTop) + { + this.batch[this.batchPtr - 1].indexCount += 6; + } + else + { + var b = this.pushBatch(); + b.type = BATCH_QUAD; + b.startIndex = this.enableFrontToBack ? v : (v / 2) * 3; + b.indexCount = 6; + this.hasQuadBatchTop = true; + this.hasPointBatchTop = false; + } + var rc_left = rcTex.left; + var rc_top = rcTex.top; + var rc_right = rcTex.right; + var rc_bottom = rcTex.bottom; + if (this.enableFrontToBack) + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = currentZ; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = currentZ; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = currentZ; + vd[v++] = blx; + vd[v++] = bly; + vd[v++] = currentZ; + } + else + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = blx; + vd[v++] = bly; + } + td[t++] = rc_left; + td[t++] = rc_top; + td[t++] = rc_right; + td[t++] = rc_top; + td[t++] = rc_right; + td[t++] = rc_bottom; + td[t++] = rc_left; + td[t++] = rc_bottom; + this.vertexPtr = v; + this.texPtr = t; + }; + GLWrap_.prototype.quadTexUV = function(tlx, tly, trx, try_, brx, bry, blx, bly, tlu, tlv, tru, trv, bru, brv, blu, blv) + { + if (this.vertexPtr >= LAST_VERTEX) + this.endBatch(); + var v = this.vertexPtr; // vertex cursor + var t = this.texPtr; + var vd = this.vertexData; // vertex data array + var td = this.texcoordData; // texture coord data array + var currentZ = this.currentZ; + if (this.hasQuadBatchTop) + { + this.batch[this.batchPtr - 1].indexCount += 6; + } + else + { + var b = this.pushBatch(); + b.type = BATCH_QUAD; + b.startIndex = this.enableFrontToBack ? v : (v / 2) * 3; + b.indexCount = 6; + this.hasQuadBatchTop = true; + this.hasPointBatchTop = false; + } + if (this.enableFrontToBack) + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = currentZ; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = currentZ; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = currentZ; + vd[v++] = blx; + vd[v++] = bly; + vd[v++] = currentZ; + } + else + { + vd[v++] = tlx; + vd[v++] = tly; + vd[v++] = trx; + vd[v++] = try_; + vd[v++] = brx; + vd[v++] = bry; + vd[v++] = blx; + vd[v++] = bly; + } + td[t++] = tlu; + td[t++] = tlv; + td[t++] = tru; + td[t++] = trv; + td[t++] = bru; + td[t++] = brv; + td[t++] = blu; + td[t++] = blv; + this.vertexPtr = v; + this.texPtr = t; + }; + GLWrap_.prototype.convexPoly = function(pts) + { + var pts_count = pts.length / 2; +; + var tris = pts_count - 2; // 3 points = 1 tri, 4 points = 2 tris, 5 points = 3 tris etc. + var last_tri = tris - 1; + var p0x = pts[0]; + var p0y = pts[1]; + var i, i2, p1x, p1y, p2x, p2y, p3x, p3y; + for (i = 0; i < tris; i += 2) // draw 2 triangles at a time + { + i2 = i * 2; + p1x = pts[i2 + 2]; + p1y = pts[i2 + 3]; + p2x = pts[i2 + 4]; + p2y = pts[i2 + 5]; + if (i === last_tri) + { + this.quad(p0x, p0y, p1x, p1y, p2x, p2y, p2x, p2y); + } + else + { + p3x = pts[i2 + 6]; + p3y = pts[i2 + 7]; + this.quad(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y); + } + } + }; + var LAST_POINT = MAX_POINTS - 4; + GLWrap_.prototype.point = function(x_, y_, size_, opacity_) + { + if (this.pointPtr >= LAST_POINT) + this.endBatch(); + var p = this.pointPtr; // point cursor + var pd = this.pointData; // point data array + if (this.hasPointBatchTop) + { + this.batch[this.batchPtr - 1].indexCount++; + } + else + { + var b = this.pushBatch(); + b.type = BATCH_POINTS; + b.startIndex = p; + b.indexCount = 1; + this.hasPointBatchTop = true; + this.hasQuadBatchTop = false; + } + pd[p++] = x_; + pd[p++] = y_; + pd[p++] = size_; + pd[p++] = opacity_; + this.pointPtr = p; + }; + GLWrap_.prototype.switchProgram = function (progIndex) + { + if (this.lastProgram === progIndex) + return; // no change + var shaderProg = this.shaderPrograms[progIndex]; + if (!shaderProg) + { + if (this.lastProgram === 0) + return; // already on default shader + progIndex = 0; + shaderProg = this.shaderPrograms[0]; + } + var b = this.pushBatch(); + b.type = BATCH_SETPROGRAM; + b.startIndex = progIndex; + this.lastProgram = progIndex; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.programUsesDest = function (progIndex) + { + var s = this.shaderPrograms[progIndex]; + return !!(s.locDestStart || s.locDestEnd); + }; + GLWrap_.prototype.programUsesCrossSampling = function (progIndex) + { + var s = this.shaderPrograms[progIndex]; + return !!(s.locDestStart || s.locDestEnd || s.crossSampling); + }; + GLWrap_.prototype.programPreservesOpaqueness = function (progIndex) + { + return this.shaderPrograms[progIndex].preservesOpaqueness; + }; + GLWrap_.prototype.programExtendsBox = function (progIndex) + { + var s = this.shaderPrograms[progIndex]; + return s.extendBoxHorizontal !== 0 || s.extendBoxVertical !== 0; + }; + GLWrap_.prototype.getProgramBoxExtendHorizontal = function (progIndex) + { + return this.shaderPrograms[progIndex].extendBoxHorizontal; + }; + GLWrap_.prototype.getProgramBoxExtendVertical = function (progIndex) + { + return this.shaderPrograms[progIndex].extendBoxVertical; + }; + GLWrap_.prototype.getProgramParameterType = function (progIndex, paramIndex) + { + return this.shaderPrograms[progIndex].parameters[paramIndex][2]; + }; + GLWrap_.prototype.programIsAnimated = function (progIndex) + { + return this.shaderPrograms[progIndex].animated; + }; + GLWrap_.prototype.setProgramParameters = function (backTex, pixelWidth, pixelHeight, destStartX, destStartY, destEndX, destEndY, layerScale, layerAngle, viewOriginLeft, viewOriginTop, scrollPosX, scrollPosY, seconds, params) + { + var i, len; + var s = this.shaderPrograms[this.lastProgram]; + var b, mat4param, shaderParams; + if (s.hasAnyOptionalUniforms || params.length) + { + b = this.pushBatch(); + b.type = BATCH_SETPROGRAMPARAMETERS; + if (b.mat4param) + mat4.set(this.matMV, b.mat4param); + else + b.mat4param = mat4.create(); + mat4param = b.mat4param; + mat4param[0] = pixelWidth; + mat4param[1] = pixelHeight; + mat4param[2] = destStartX; + mat4param[3] = destStartY; + mat4param[4] = destEndX; + mat4param[5] = destEndY; + mat4param[6] = layerScale; + mat4param[7] = layerAngle; + mat4param[8] = viewOriginLeft; + mat4param[9] = viewOriginTop; + mat4param[10] = scrollPosX; + mat4param[11] = scrollPosY; + mat4param[12] = seconds; + if (s.locSamplerBack) + { +; + b.texParam = backTex; + } + else + b.texParam = null; + if (params.length) + { + shaderParams = b.shaderParams; + shaderParams.length = params.length; + for (i = 0, len = params.length; i < len; i++) + shaderParams[i] = params[i]; + } + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + } + }; + GLWrap_.prototype.clear = function (r, g, b_, a) + { + var b = this.pushBatch(); + b.type = BATCH_CLEAR; + b.startIndex = 0; // clear all mode + if (!b.mat4param) + b.mat4param = mat4.create(); + b.mat4param[0] = r; + b.mat4param[1] = g; + b.mat4param[2] = b_; + b.mat4param[3] = a; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.clearRect = function (x, y, w, h) + { + if (w < 0 || h < 0) + return; // invalid clear area + var b = this.pushBatch(); + b.type = BATCH_CLEAR; + b.startIndex = 1; // clear rect mode + if (!b.mat4param) + b.mat4param = mat4.create(); + b.mat4param[0] = x; + b.mat4param[1] = y; + b.mat4param[2] = w; + b.mat4param[3] = h; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.clearDepth = function () + { + var b = this.pushBatch(); + b.type = BATCH_CLEAR; + b.startIndex = 2; // clear depth mode + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.setEarlyZPass = function (e) + { + if (!this.enableFrontToBack) + return; // no depth buffer in use + e = !!e; + if (this.isEarlyZPass === e) + return; // no change + var b = this.pushBatch(); + b.type = BATCH_SETEARLYZMODE; + b.startIndex = (e ? 1 : 0); + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + this.isEarlyZPass = e; + this.renderToTex = null; + if (this.isEarlyZPass) + { + this.switchProgram(2); // early Z program + } + else + { + this.switchProgram(0); // normal rendering + } + }; + GLWrap_.prototype.setDepthTestEnabled = function (e) + { + if (!this.enableFrontToBack) + return; // no depth buffer in use + var b = this.pushBatch(); + b.type = BATCH_SETDEPTHTEST; + b.startIndex = (e ? 1 : 0); + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.fullscreenQuad = function () + { + mat4.set(this.lastMV, tempMat4); + this.resetModelView(); + this.updateModelView(); + var halfw = this.width / 2; + var halfh = this.height / 2; + this.quad(-halfw, halfh, halfw, halfh, halfw, -halfh, -halfw, -halfh); + mat4.set(tempMat4, this.matMV); + this.updateModelView(); + }; + GLWrap_.prototype.setColorFillMode = function (r_, g_, b_, a_) + { + this.switchProgram(3); + var b = this.pushBatch(); + b.type = BATCH_SETCOLOR; + if (!b.mat4param) + b.mat4param = mat4.create(); + b.mat4param[0] = r_; + b.mat4param[1] = g_; + b.mat4param[2] = b_; + b.mat4param[3] = a_; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + GLWrap_.prototype.setTextureFillMode = function () + { +; + this.switchProgram(0); + }; + GLWrap_.prototype.restoreEarlyZMode = function () + { +; + this.switchProgram(2); + }; + GLWrap_.prototype.present = function () + { + this.endBatch(); + this.gl.flush(); + /* + if (debugBatch) + { +; + debugBatch = false; + } + */ + }; + function nextHighestPowerOfTwo(x) { + --x; + for (var i = 1; i < 32; i <<= 1) { + x = x | x >> i; + } + return x + 1; + } + var all_textures = []; + var textures_by_src = {}; + GLWrap_.prototype.contextLost = function () + { + cr.clearArray(all_textures); + textures_by_src = {}; + }; + var BF_RGBA8 = 0; + var BF_RGB8 = 1; + var BF_RGBA4 = 2; + var BF_RGB5_A1 = 3; + var BF_RGB565 = 4; + GLWrap_.prototype.loadTexture = function (img, tiling, linearsampling, pixelformat, tiletype, nomip) + { + tiling = !!tiling; + linearsampling = !!linearsampling; + var tex_key = img.src + "," + tiling + "," + linearsampling + (tiling ? ("," + tiletype) : ""); + var webGL_texture = null; + if (typeof img.src !== "undefined" && textures_by_src.hasOwnProperty(tex_key)) + { + webGL_texture = textures_by_src[tex_key]; + webGL_texture.c2refcount++; + return webGL_texture; + } + this.endBatch(); +; + var gl = this.gl; + var isPOT = (cr.isPOT(img.width) && cr.isPOT(img.height)); + webGL_texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, webGL_texture); + gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"], true); + var internalformat = gl.RGBA; + var format = gl.RGBA; + var type = gl.UNSIGNED_BYTE; + if (pixelformat && !this.isIE) + { + switch (pixelformat) { + case BF_RGB8: + internalformat = gl.RGB; + format = gl.RGB; + break; + case BF_RGBA4: + type = gl.UNSIGNED_SHORT_4_4_4_4; + break; + case BF_RGB5_A1: + type = gl.UNSIGNED_SHORT_5_5_5_1; + break; + case BF_RGB565: + internalformat = gl.RGB; + format = gl.RGB; + type = gl.UNSIGNED_SHORT_5_6_5; + break; + } + } + if (this.version === 1 && !isPOT && tiling) + { + var canvas = document.createElement("canvas"); + canvas.width = cr.nextHighestPowerOfTwo(img.width); + canvas.height = cr.nextHighestPowerOfTwo(img.height); + var ctx = canvas.getContext("2d"); + if (typeof ctx["imageSmoothingEnabled"] !== "undefined") + { + ctx["imageSmoothingEnabled"] = linearsampling; + } + else + { + ctx["webkitImageSmoothingEnabled"] = linearsampling; + ctx["mozImageSmoothingEnabled"] = linearsampling; + ctx["msImageSmoothingEnabled"] = linearsampling; + } + ctx.drawImage(img, + 0, 0, img.width, img.height, + 0, 0, canvas.width, canvas.height); + gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, format, type, canvas); + } + else + gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, format, type, img); + if (tiling) + { + if (tiletype === "repeat-x") + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + else if (tiletype === "repeat-y") + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + } + else + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + } + } + else + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + if (linearsampling) + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + if ((isPOT || this.version >= 2) && this.enable_mipmaps && !nomip) + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR); + gl.generateMipmap(gl.TEXTURE_2D); + } + else + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + } + else + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + } + gl.bindTexture(gl.TEXTURE_2D, null); + this.lastTexture0 = null; + webGL_texture.c2width = img.width; + webGL_texture.c2height = img.height; + webGL_texture.c2refcount = 1; + webGL_texture.c2texkey = tex_key; + all_textures.push(webGL_texture); + textures_by_src[tex_key] = webGL_texture; + return webGL_texture; + }; + GLWrap_.prototype.createEmptyTexture = function (w, h, linearsampling, _16bit, tiling) + { + this.endBatch(); + var gl = this.gl; + if (this.isIE) + _16bit = false; + var webGL_texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, webGL_texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, w, h, 0, gl.RGBA, _16bit ? gl.UNSIGNED_SHORT_4_4_4_4 : gl.UNSIGNED_BYTE, null); + if (tiling) + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + } + else + { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, linearsampling ? gl.LINEAR : gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, linearsampling ? gl.LINEAR : gl.NEAREST); + gl.bindTexture(gl.TEXTURE_2D, null); + this.lastTexture0 = null; + webGL_texture.c2width = w; + webGL_texture.c2height = h; + all_textures.push(webGL_texture); + return webGL_texture; + }; + GLWrap_.prototype.videoToTexture = function (video_, texture_, _16bit) + { + this.endBatch(); + var gl = this.gl; + if (this.isIE) + _16bit = false; + gl.bindTexture(gl.TEXTURE_2D, texture_); + gl.pixelStorei(gl["UNPACK_PREMULTIPLY_ALPHA_WEBGL"], true); + try { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, _16bit ? gl.UNSIGNED_SHORT_4_4_4_4 : gl.UNSIGNED_BYTE, video_); + } + catch (e) + { + if (console && console.error) + console.error("Error updating WebGL texture: ", e); + } + gl.bindTexture(gl.TEXTURE_2D, null); + this.lastTexture0 = null; + }; + GLWrap_.prototype.deleteTexture = function (tex) + { + if (!tex) + return; + if (typeof tex.c2refcount !== "undefined" && tex.c2refcount > 1) + { + tex.c2refcount--; + return; + } + this.endBatch(); + if (tex === this.lastTexture0) + { + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + this.lastTexture0 = null; + } + if (tex === this.lastTexture1) + { + this.gl.activeTexture(this.gl.TEXTURE1); + this.gl.bindTexture(this.gl.TEXTURE_2D, null); + this.gl.activeTexture(this.gl.TEXTURE0); + this.lastTexture1 = null; + } + cr.arrayFindRemove(all_textures, tex); + if (typeof tex.c2texkey !== "undefined") + delete textures_by_src[tex.c2texkey]; + this.gl.deleteTexture(tex); + }; + GLWrap_.prototype.estimateVRAM = function () + { + var total = this.width * this.height * 4 * 2; + var i, len, t; + for (i = 0, len = all_textures.length; i < len; i++) + { + t = all_textures[i]; + total += (t.c2width * t.c2height * 4); + } + return total; + }; + GLWrap_.prototype.textureCount = function () + { + return all_textures.length; + }; + GLWrap_.prototype.setRenderingToTexture = function (tex) + { + if (tex === this.renderToTex) + return; +; + var b = this.pushBatch(); + b.type = BATCH_RENDERTOTEXTURE; + b.texParam = tex; + this.renderToTex = tex; + this.hasQuadBatchTop = false; + this.hasPointBatchTop = false; + }; + cr.GLWrap = GLWrap_; +}()); +; +(function() +{ + var raf = window["requestAnimationFrame"] || + window["mozRequestAnimationFrame"] || + window["webkitRequestAnimationFrame"] || + window["msRequestAnimationFrame"] || + window["oRequestAnimationFrame"]; + function Runtime(canvas) + { + if (!canvas || (!canvas.getContext && !canvas["dc"])) + return; + if (canvas["c2runtime"]) + return; + else + canvas["c2runtime"] = this; + var self = this; + this.isCrosswalk = /crosswalk/i.test(navigator.userAgent) || /xwalk/i.test(navigator.userAgent) || !!(typeof window["c2isCrosswalk"] !== "undefined" && window["c2isCrosswalk"]); + this.isCordova = this.isCrosswalk || (typeof window["device"] !== "undefined" && (typeof window["device"]["cordova"] !== "undefined" || typeof window["device"]["phonegap"] !== "undefined")) || (typeof window["c2iscordova"] !== "undefined" && window["c2iscordova"]); + this.isPhoneGap = this.isCordova; + this.isDirectCanvas = !!canvas["dc"]; + this.isAppMobi = (typeof window["AppMobi"] !== "undefined" || this.isDirectCanvas); + this.isCocoonJs = !!window["c2cocoonjs"]; + this.isEjecta = !!window["c2ejecta"]; + if (this.isCocoonJs) + { + CocoonJS["App"]["onSuspended"].addEventListener(function() { + self["setSuspended"](true); + }); + CocoonJS["App"]["onActivated"].addEventListener(function () { + self["setSuspended"](false); + }); + } + if (this.isEjecta) + { + document.addEventListener("pagehide", function() { + self["setSuspended"](true); + }); + document.addEventListener("pageshow", function() { + self["setSuspended"](false); + }); + document.addEventListener("resize", function () { + self["setSize"](window.innerWidth, window.innerHeight); + }); + } + this.isDomFree = (this.isDirectCanvas || this.isCocoonJs || this.isEjecta); + this.isMicrosoftEdge = /edge\//i.test(navigator.userAgent); + this.isIE = (/msie/i.test(navigator.userAgent) || /trident/i.test(navigator.userAgent) || /iemobile/i.test(navigator.userAgent)) && !this.isMicrosoftEdge; + this.isTizen = /tizen/i.test(navigator.userAgent); + this.isAndroid = /android/i.test(navigator.userAgent) && !this.isTizen && !this.isIE && !this.isMicrosoftEdge; // IE mobile and Tizen masquerade as Android + this.isiPhone = (/iphone/i.test(navigator.userAgent) || /ipod/i.test(navigator.userAgent)) && !this.isIE && !this.isMicrosoftEdge; // treat ipod as an iphone; IE mobile masquerades as iPhone + this.isiPad = /ipad/i.test(navigator.userAgent); + this.isiOS = this.isiPhone || this.isiPad || this.isEjecta; + this.isiPhoneiOS6 = (this.isiPhone && /os\s6/i.test(navigator.userAgent)); + this.isChrome = (/chrome/i.test(navigator.userAgent) || /chromium/i.test(navigator.userAgent)) && !this.isIE && !this.isMicrosoftEdge; // note true on Chromium-based webview on Android 4.4+; IE 'Edge' mode also pretends to be Chrome + this.isAmazonWebApp = /amazonwebappplatform/i.test(navigator.userAgent); + this.isFirefox = /firefox/i.test(navigator.userAgent); + this.isSafari = /safari/i.test(navigator.userAgent) && !this.isChrome && !this.isIE && !this.isMicrosoftEdge; // Chrome and IE Mobile masquerade as Safari + this.isWindows = /windows/i.test(navigator.userAgent); + this.isNWjs = (typeof window["c2nodewebkit"] !== "undefined" || typeof window["c2nwjs"] !== "undefined" || /nodewebkit/i.test(navigator.userAgent) || /nwjs/i.test(navigator.userAgent)); + this.isNodeWebkit = this.isNWjs; // old name for backwards compat + this.isArcade = (typeof window["is_scirra_arcade"] !== "undefined"); + this.isWindows8App = !!(typeof window["c2isWindows8"] !== "undefined" && window["c2isWindows8"]); + this.isWindows8Capable = !!(typeof window["c2isWindows8Capable"] !== "undefined" && window["c2isWindows8Capable"]); + this.isWindowsPhone8 = !!(typeof window["c2isWindowsPhone8"] !== "undefined" && window["c2isWindowsPhone8"]); + this.isWindowsPhone81 = !!(typeof window["c2isWindowsPhone81"] !== "undefined" && window["c2isWindowsPhone81"]); + this.isWindows10 = !!window["cr_windows10"]; + this.isWinJS = (this.isWindows8App || this.isWindows8Capable || this.isWindowsPhone81 || this.isWindows10); // note not WP8.0 + this.isBlackberry10 = !!(typeof window["c2isBlackberry10"] !== "undefined" && window["c2isBlackberry10"]); + this.isAndroidStockBrowser = (this.isAndroid && !this.isChrome && !this.isCrosswalk && !this.isFirefox && !this.isAmazonWebApp && !this.isDomFree); + this.devicePixelRatio = 1; + this.isMobile = (this.isCordova || this.isCrosswalk || this.isAppMobi || this.isCocoonJs || this.isAndroid || this.isiOS || this.isWindowsPhone8 || this.isWindowsPhone81 || this.isBlackberry10 || this.isTizen || this.isEjecta); + if (!this.isMobile) + { + this.isMobile = /(blackberry|bb10|playbook|palm|symbian|nokia|windows\s+ce|phone|mobile|tablet|kindle|silk)/i.test(navigator.userAgent); + } + this.isWKWebView = !!(this.isiOS && this.isCordova && window["webkit"]); + this.httpServer = null; + this.httpServerUrl = ""; + if (this.isWKWebView) + { + this.httpServer = (cordova && cordova["plugins"] && cordova["plugins"]["CorHttpd"]) ? cordova["plugins"]["CorHttpd"] : null; + } + if (typeof cr_is_preview !== "undefined" && !this.isNWjs && (window.location.search === "?nw" || /nodewebkit/i.test(navigator.userAgent) || /nwjs/i.test(navigator.userAgent))) + { + this.isNWjs = true; + } + this.isDebug = (typeof cr_is_preview !== "undefined" && window.location.search.indexOf("debug") > -1); + this.canvas = canvas; + this.canvasdiv = document.getElementById("c2canvasdiv"); + this.gl = null; + this.glwrap = null; + this.glUnmaskedRenderer = "(unavailable)"; + this.enableFrontToBack = false; + this.earlyz_index = 0; + this.ctx = null; + this.fullscreenOldMarginCss = ""; + this.firstInFullscreen = false; + this.oldWidth = 0; // for restoring non-fullscreen canvas after fullscreen + this.oldHeight = 0; + this.canvas.oncontextmenu = function (e) { if (e.preventDefault) e.preventDefault(); return false; }; + this.canvas.onselectstart = function (e) { if (e.preventDefault) e.preventDefault(); return false; }; + if (this.isDirectCanvas) + window["c2runtime"] = this; + if (this.isNWjs) + { + window["ondragover"] = function(e) { e.preventDefault(); return false; }; + window["ondrop"] = function(e) { e.preventDefault(); return false; }; + if (window["nwgui"] && window["nwgui"]["App"]["clearCache"]) + window["nwgui"]["App"]["clearCache"](); + } + if (this.isAndroidStockBrowser && typeof jQuery !== "undefined") + { + jQuery("canvas").parents("*").css("overflow", "visible"); + } + this.width = canvas.width; + this.height = canvas.height; + this.draw_width = this.width; + this.draw_height = this.height; + this.cssWidth = this.width; + this.cssHeight = this.height; + this.lastWindowWidth = window.innerWidth; + this.lastWindowHeight = window.innerHeight; + this.forceCanvasAlpha = false; // note: now unused, left for backwards compat since plugins could modify it + this.redraw = true; + this.isSuspended = false; + if (!Date.now) { + Date.now = function now() { + return +new Date(); + }; + } + this.plugins = []; + this.types = {}; + this.types_by_index = []; + this.behaviors = []; + this.layouts = {}; + this.layouts_by_index = []; + this.eventsheets = {}; + this.eventsheets_by_index = []; + this.wait_for_textures = []; // for blocking until textures loaded + this.triggers_to_postinit = []; + this.all_global_vars = []; + this.all_local_vars = []; + this.solidBehavior = null; + this.jumpthruBehavior = null; + this.shadowcasterBehavior = null; + this.deathRow = {}; + this.hasPendingInstances = false; // true if anything exists in create row or death row + this.isInClearDeathRow = false; + this.isInOnDestroy = 0; // needs to support recursion so increments and decrements and is true if > 0 + this.isRunningEvents = false; + this.isEndingLayout = false; + this.createRow = []; + this.isLoadingState = false; + this.saveToSlot = ""; + this.loadFromSlot = ""; + this.loadFromJson = null; // set to string when there is something to try to load + this.lastSaveJson = ""; + this.signalledContinuousPreview = false; + this.suspendDrawing = false; // for hiding display until continuous preview loads + this.fireOnCreateAfterLoad = []; // for delaying "On create" triggers until loading complete + this.dt = 0; + this.dt1 = 0; + this.minimumFramerate = 30; + this.logictime = 0; // used to calculate CPUUtilisation + this.cpuutilisation = 0; + this.timescale = 1.0; + this.kahanTime = new cr.KahanAdder(); + this.wallTime = new cr.KahanAdder(); + this.last_tick_time = 0; + this.fps = 0; + this.last_fps_time = 0; + this.tickcount = 0; + this.execcount = 0; + this.framecount = 0; // for fps + this.objectcount = 0; + this.changelayout = null; + this.destroycallbacks = []; + this.event_stack = []; + this.event_stack_index = -1; + this.localvar_stack = [[]]; + this.localvar_stack_index = 0; + this.trigger_depth = 0; // recursion depth for triggers + this.pushEventStack(null); + this.loop_stack = []; + this.loop_stack_index = -1; + this.next_uid = 0; + this.next_puid = 0; // permanent unique ids + this.layout_first_tick = true; + this.family_count = 0; + this.suspend_events = []; + this.raf_id = -1; + this.timeout_id = -1; + this.isloading = true; + this.loadingprogress = 0; + this.isNodeFullscreen = false; + this.stackLocalCount = 0; // number of stack-based local vars for recursion + this.audioInstance = null; + this.had_a_click = false; + this.isInUserInputEvent = false; + this.objects_to_pretick = new cr.ObjectSet(); + this.objects_to_tick = new cr.ObjectSet(); + this.objects_to_tick2 = new cr.ObjectSet(); + this.registered_collisions = []; + this.temp_poly = new cr.CollisionPoly([]); + this.temp_poly2 = new cr.CollisionPoly([]); + this.allGroups = []; // array of all event groups + this.groups_by_name = {}; + this.cndsBySid = {}; + this.actsBySid = {}; + this.varsBySid = {}; + this.blocksBySid = {}; + this.running_layout = null; // currently running layout + this.layer_canvas = null; // for layers "render-to-texture" + this.layer_ctx = null; + this.layer_tex = null; + this.layout_tex = null; + this.layout_canvas = null; + this.layout_ctx = null; + this.is_WebGL_context_lost = false; + this.uses_background_blending = false; // if any shader uses background blending, so entire layout renders to texture + this.fx_tex = [null, null]; + this.fullscreen_scaling = 0; + this.files_subfolder = ""; // path with project files + this.objectsByUid = {}; // maps every in-use UID (as a string) to its instance + this.loaderlogos = null; + this.snapshotCanvas = null; + this.snapshotData = ""; + this.objectRefTable = []; + this.requestProjectData(); + }; + Runtime.prototype.requestProjectData = function () + { + var self = this; + if (this.isWKWebView) + { + var loadDataJsFn = function () + { + self.fetchLocalFileViaCordovaAsText("data.js", function (str) + { + self.loadProject(JSON.parse(str)); + }, function (err) + { + alert("Error fetching data.js"); + }); + }; + if (this.httpServer) + { + this.httpServer["startServer"]({ + "port": 0, + "localhost_only": true + }, function (url) + { + self.httpServerUrl = url; + loadDataJsFn(); + }, function (err) + { + console.log("Error starting local server: " + err + ". Video playback will not work."); + loadDataJsFn(); + }); + } + else + { + console.log("Local server unavailable. Video playback will not work."); + loadDataJsFn(); + } + return; + } + var xhr; + if (this.isWindowsPhone8) + xhr = new ActiveXObject("Microsoft.XMLHTTP"); + else + xhr = new XMLHttpRequest(); + var datajs_filename = "data.js"; + if (this.isWindows8App || this.isWindowsPhone8 || this.isWindowsPhone81 || this.isWindows10) + datajs_filename = "data.json"; + xhr.open("GET", datajs_filename, true); + var supportsJsonResponse = false; + if (!this.isDomFree && ("response" in xhr) && ("responseType" in xhr)) + { + try { + xhr["responseType"] = "json"; + supportsJsonResponse = (xhr["responseType"] === "json"); + } + catch (e) { + supportsJsonResponse = false; + } + } + if (!supportsJsonResponse && ("responseType" in xhr)) + { + try { + xhr["responseType"] = "text"; + } + catch (e) {} + } + if ("overrideMimeType" in xhr) + { + try { + xhr["overrideMimeType"]("application/json; charset=utf-8"); + } + catch (e) {} + } + if (this.isWindowsPhone8) + { + xhr.onreadystatechange = function () + { + if (xhr.readyState !== 4) + return; + self.loadProject(JSON.parse(xhr["responseText"])); + }; + } + else + { + xhr.onload = function () + { + if (supportsJsonResponse) + { + self.loadProject(xhr["response"]); // already parsed by browser + } + else + { + if (self.isEjecta) + { + var str = xhr["responseText"]; + str = str.substr(str.indexOf("{")); // trim any BOM + self.loadProject(JSON.parse(str)); + } + else + { + self.loadProject(JSON.parse(xhr["responseText"])); // forced to sync parse JSON + } + } + }; + xhr.onerror = function (e) + { + cr.logerror("Error requesting " + datajs_filename + ":"); + cr.logerror(e); + }; + } + xhr.send(); + }; + Runtime.prototype.initRendererAndLoader = function () + { + var self = this; + var i, len, j, lenj, k, lenk, t, s, l, y; + this.isRetina = ((!this.isDomFree || this.isEjecta || this.isCordova) && this.useHighDpi && !this.isAndroidStockBrowser); + if (this.fullscreen_mode === 0 && this.isiOS) + this.isRetina = false; + this.devicePixelRatio = (this.isRetina ? (window["devicePixelRatio"] || window["webkitDevicePixelRatio"] || window["mozDevicePixelRatio"] || window["msDevicePixelRatio"] || 1) : 1); + this.ClearDeathRow(); + var attribs; + if (this.fullscreen_mode > 0) + this["setSize"](window.innerWidth, window.innerHeight, true); + this.canvas.addEventListener("webglcontextlost", function (ev) { + ev.preventDefault(); + self.onContextLost(); + cr.logexport("[Construct 2] WebGL context lost"); + window["cr_setSuspended"](true); // stop rendering + }, false); + this.canvas.addEventListener("webglcontextrestored", function (ev) { + self.glwrap.initState(); + self.glwrap.setSize(self.glwrap.width, self.glwrap.height, true); + self.layer_tex = null; + self.layout_tex = null; + self.fx_tex[0] = null; + self.fx_tex[1] = null; + self.onContextRestored(); + self.redraw = true; + cr.logexport("[Construct 2] WebGL context restored"); + window["cr_setSuspended"](false); // resume rendering + }, false); + try { + if (this.enableWebGL && (this.isCocoonJs || this.isEjecta || !this.isDomFree)) + { + attribs = { + "alpha": true, + "depth": false, + "antialias": false, + "powerPreference": "high-performance", + "failIfMajorPerformanceCaveat": true + }; + this.gl = (this.canvas.getContext("webgl2", attribs) || + this.canvas.getContext("webgl", attribs) || + this.canvas.getContext("experimental-webgl", attribs)); + } + } + catch (e) { + } + if (this.gl) + { + var isWebGL2 = (this.gl.getParameter(this.gl.VERSION).indexOf("WebGL 2") === 0); + var debug_ext = this.gl.getExtension("WEBGL_debug_renderer_info"); + if (debug_ext) + { + var unmasked_vendor = this.gl.getParameter(debug_ext.UNMASKED_VENDOR_WEBGL); + var unmasked_renderer = this.gl.getParameter(debug_ext.UNMASKED_RENDERER_WEBGL); + this.glUnmaskedRenderer = unmasked_renderer + " [" + unmasked_vendor + "]"; + } + if (this.enableFrontToBack) + this.glUnmaskedRenderer += " [front-to-back enabled]"; +; + if (!this.isDomFree) + { + this.overlay_canvas = document.createElement("canvas"); + jQuery(this.overlay_canvas).appendTo(this.canvas.parentNode); + this.overlay_canvas.oncontextmenu = function (e) { return false; }; + this.overlay_canvas.onselectstart = function (e) { return false; }; + this.overlay_canvas.width = Math.round(this.cssWidth * this.devicePixelRatio); + this.overlay_canvas.height = Math.round(this.cssHeight * this.devicePixelRatio); + jQuery(this.overlay_canvas).css({"width": this.cssWidth + "px", + "height": this.cssHeight + "px"}); + this.positionOverlayCanvas(); + this.overlay_ctx = this.overlay_canvas.getContext("2d"); + } + this.glwrap = new cr.GLWrap(this.gl, this.isMobile, this.enableFrontToBack); + this.glwrap.setSize(this.canvas.width, this.canvas.height); + this.glwrap.enable_mipmaps = (this.downscalingQuality !== 0); + this.ctx = null; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + for (j = 0, lenj = t.effect_types.length; j < lenj; j++) + { + s = t.effect_types[j]; + s.shaderindex = this.glwrap.getShaderIndex(s.id); + s.preservesOpaqueness = this.glwrap.programPreservesOpaqueness(s.shaderindex); + this.uses_background_blending = this.uses_background_blending || this.glwrap.programUsesDest(s.shaderindex); + } + } + for (i = 0, len = this.layouts_by_index.length; i < len; i++) + { + l = this.layouts_by_index[i]; + for (j = 0, lenj = l.effect_types.length; j < lenj; j++) + { + s = l.effect_types[j]; + s.shaderindex = this.glwrap.getShaderIndex(s.id); + s.preservesOpaqueness = this.glwrap.programPreservesOpaqueness(s.shaderindex); + } + l.updateActiveEffects(); // update preserves opaqueness flag + for (j = 0, lenj = l.layers.length; j < lenj; j++) + { + y = l.layers[j]; + for (k = 0, lenk = y.effect_types.length; k < lenk; k++) + { + s = y.effect_types[k]; + s.shaderindex = this.glwrap.getShaderIndex(s.id); + s.preservesOpaqueness = this.glwrap.programPreservesOpaqueness(s.shaderindex); + this.uses_background_blending = this.uses_background_blending || this.glwrap.programUsesDest(s.shaderindex); + } + y.updateActiveEffects(); // update preserves opaqueness flag + } + } + } + else + { + if (this.fullscreen_mode > 0 && this.isDirectCanvas) + { +; + this.canvas = null; + document.oncontextmenu = function (e) { return false; }; + document.onselectstart = function (e) { return false; }; + this.ctx = AppMobi["canvas"]["getContext"]("2d"); + try { + this.ctx["samplingMode"] = this.linearSampling ? "smooth" : "sharp"; + this.ctx["globalScale"] = 1; + this.ctx["HTML5CompatibilityMode"] = true; + this.ctx["imageSmoothingEnabled"] = this.linearSampling; + } catch(e){} + if (this.width !== 0 && this.height !== 0) + { + this.ctx.width = this.width; + this.ctx.height = this.height; + } + } + if (!this.ctx) + { +; + if (this.isCocoonJs) + { + attribs = { + "antialias": !!this.linearSampling, + "alpha": true + }; + this.ctx = this.canvas.getContext("2d", attribs); + } + else + { + attribs = { + "alpha": true + }; + this.ctx = this.canvas.getContext("2d", attribs); + } + this.setCtxImageSmoothingEnabled(this.ctx, this.linearSampling); + } + this.overlay_canvas = null; + this.overlay_ctx = null; + } + this.tickFunc = function (timestamp) { self.tick(false, timestamp); }; + if (window != window.top && !this.isDomFree && !this.isWinJS && !this.isWindowsPhone8) + { + document.addEventListener("mousedown", function () { + window.focus(); + }, true); + document.addEventListener("touchstart", function () { + window.focus(); + }, true); + } + if (typeof cr_is_preview !== "undefined") + { + if (this.isCocoonJs) + console.log("[Construct 2] In preview-over-wifi via CocoonJS mode"); + if (window.location.search.indexOf("continuous") > -1) + { + cr.logexport("Reloading for continuous preview"); + this.loadFromSlot = "__c2_continuouspreview"; + this.suspendDrawing = true; + } + if (this.pauseOnBlur && !this.isMobile) + { + jQuery(window).focus(function () + { + self["setSuspended"](false); + }); + jQuery(window).blur(function () + { + var parent = window.parent; + if (!parent || !parent.document.hasFocus()) + self["setSuspended"](true); + }); + } + } + window.addEventListener("blur", function () { + self.onWindowBlur(); + }); + if (!this.isDomFree) + { + var unfocusFormControlFunc = function (e) { + if (cr.isCanvasInputEvent(e) && document["activeElement"] && document["activeElement"] !== document.getElementsByTagName("body")[0] && document["activeElement"].blur) + { + try { + document["activeElement"].blur(); + } + catch (e) {} + } + } + if (typeof PointerEvent !== "undefined") + { + document.addEventListener("pointerdown", unfocusFormControlFunc); + } + else if (window.navigator["msPointerEnabled"]) + { + document.addEventListener("MSPointerDown", unfocusFormControlFunc); + } + else + { + document.addEventListener("touchstart", unfocusFormControlFunc); + } + document.addEventListener("mousedown", unfocusFormControlFunc); + } + if (this.fullscreen_mode === 0 && this.isRetina && this.devicePixelRatio > 1) + { + this["setSize"](this.original_width, this.original_height, true); + } + this.tryLockOrientation(); + this.getready(); // determine things to preload + this.go(); // run loading screen + this.extra = {}; + cr.seal(this); + }; + var webkitRepaintFlag = false; + Runtime.prototype["setSize"] = function (w, h, force) + { + var offx = 0, offy = 0; + var neww = 0, newh = 0, intscale = 0; + if (this.lastWindowWidth === w && this.lastWindowHeight === h && !force) + return; + this.lastWindowWidth = w; + this.lastWindowHeight = h; + var mode = this.fullscreen_mode; + var orig_aspect, cur_aspect; + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || !!document["msFullscreenElement"] || document["fullScreen"] || this.isNodeFullscreen) && !this.isCordova; + if (!isfullscreen && this.fullscreen_mode === 0 && !force) + return; // ignore size events when not fullscreen and not using a fullscreen-in-browser mode + if (isfullscreen && this.fullscreen_scaling > 0) + mode = this.fullscreen_scaling; + var dpr = this.devicePixelRatio; + if (mode >= 4) + { + orig_aspect = this.original_width / this.original_height; + cur_aspect = w / h; + if (cur_aspect > orig_aspect) + { + neww = h * orig_aspect; + if (mode === 5) // integer scaling + { + intscale = (neww * dpr) / this.original_width; + if (intscale > 1) + intscale = Math.floor(intscale); + else if (intscale < 1) + intscale = 1 / Math.ceil(1 / intscale); + neww = this.original_width * intscale / dpr; + newh = this.original_height * intscale / dpr; + offx = (w - neww) / 2; + offy = (h - newh) / 2; + w = neww; + h = newh; + } + else + { + offx = (w - neww) / 2; + w = neww; + } + } + else + { + newh = w / orig_aspect; + if (mode === 5) // integer scaling + { + intscale = (newh * dpr) / this.original_height; + if (intscale > 1) + intscale = Math.floor(intscale); + else if (intscale < 1) + intscale = 1 / Math.ceil(1 / intscale); + neww = this.original_width * intscale / dpr; + newh = this.original_height * intscale / dpr; + offx = (w - neww) / 2; + offy = (h - newh) / 2; + w = neww; + h = newh; + } + else + { + offy = (h - newh) / 2; + h = newh; + } + } + if (isfullscreen && !this.isNWjs) + { + offx = 0; + offy = 0; + } + } + else if (this.isNWjs && this.isNodeFullscreen && this.fullscreen_mode_set === 0) + { + offx = Math.floor((w - this.original_width) / 2); + offy = Math.floor((h - this.original_height) / 2); + w = this.original_width; + h = this.original_height; + } + if (mode < 2) + this.aspect_scale = dpr; + this.cssWidth = Math.round(w); + this.cssHeight = Math.round(h); + this.width = Math.round(w * dpr); + this.height = Math.round(h * dpr); + this.redraw = true; + if (this.wantFullscreenScalingQuality) + { + this.draw_width = this.width; + this.draw_height = this.height; + this.fullscreenScalingQuality = true; + } + else + { + if ((this.width < this.original_width && this.height < this.original_height) || mode === 1) + { + this.draw_width = this.width; + this.draw_height = this.height; + this.fullscreenScalingQuality = true; + } + else + { + this.draw_width = this.original_width; + this.draw_height = this.original_height; + this.fullscreenScalingQuality = false; + /*var orig_aspect = this.original_width / this.original_height; + var cur_aspect = this.width / this.height; + if ((this.fullscreen_mode !== 2 && cur_aspect > orig_aspect) || (this.fullscreen_mode === 2 && cur_aspect < orig_aspect)) + this.aspect_scale = this.height / this.original_height; + else + this.aspect_scale = this.width / this.original_width;*/ + if (mode === 2) // scale inner + { + orig_aspect = this.original_width / this.original_height; + cur_aspect = this.lastWindowWidth / this.lastWindowHeight; + if (cur_aspect < orig_aspect) + this.draw_width = this.draw_height * cur_aspect; + else if (cur_aspect > orig_aspect) + this.draw_height = this.draw_width / cur_aspect; + } + else if (mode === 3) + { + orig_aspect = this.original_width / this.original_height; + cur_aspect = this.lastWindowWidth / this.lastWindowHeight; + if (cur_aspect > orig_aspect) + this.draw_width = this.draw_height * cur_aspect; + else if (cur_aspect < orig_aspect) + this.draw_height = this.draw_width / cur_aspect; + } + } + } + if (this.canvasdiv && !this.isDomFree) + { + jQuery(this.canvasdiv).css({"width": Math.round(w) + "px", + "height": Math.round(h) + "px", + "margin-left": Math.floor(offx) + "px", + "margin-top": Math.floor(offy) + "px"}); + if (typeof cr_is_preview !== "undefined") + { + jQuery("#borderwrap").css({"width": Math.round(w) + "px", + "height": Math.round(h) + "px"}); + } + } + if (this.canvas) + { + this.canvas.width = Math.round(w * dpr); + this.canvas.height = Math.round(h * dpr); + if (this.isEjecta) + { + this.canvas.style.left = Math.floor(offx) + "px"; + this.canvas.style.top = Math.floor(offy) + "px"; + this.canvas.style.width = Math.round(w) + "px"; + this.canvas.style.height = Math.round(h) + "px"; + } + else if (this.isRetina && !this.isDomFree) + { + this.canvas.style.width = Math.round(w) + "px"; + this.canvas.style.height = Math.round(h) + "px"; + } + } + if (this.overlay_canvas) + { + this.overlay_canvas.width = Math.round(w * dpr); + this.overlay_canvas.height = Math.round(h * dpr); + this.overlay_canvas.style.width = this.cssWidth + "px"; + this.overlay_canvas.style.height = this.cssHeight + "px"; + } + if (this.glwrap) + { + this.glwrap.setSize(Math.round(w * dpr), Math.round(h * dpr)); + } + if (this.isDirectCanvas && this.ctx) + { + this.ctx.width = Math.round(w); + this.ctx.height = Math.round(h); + } + if (this.ctx) + { + this.setCtxImageSmoothingEnabled(this.ctx, this.linearSampling); + } + this.tryLockOrientation(); + if (this.isiPhone && !this.isCordova) + { + window.scrollTo(0, 0); + } + }; + Runtime.prototype.tryLockOrientation = function () + { + if (!this.autoLockOrientation || this.orientations === 0) + return; + var orientation = "portrait"; + if (this.orientations === 2) + orientation = "landscape"; + try { + if (screen["orientation"] && screen["orientation"]["lock"]) + screen["orientation"]["lock"](orientation).catch(function(){}); + else if (screen["lockOrientation"]) + screen["lockOrientation"](orientation); + else if (screen["webkitLockOrientation"]) + screen["webkitLockOrientation"](orientation); + else if (screen["mozLockOrientation"]) + screen["mozLockOrientation"](orientation); + else if (screen["msLockOrientation"]) + screen["msLockOrientation"](orientation); + } + catch (e) + { + if (console && console.warn) + console.warn("Failed to lock orientation: ", e); + } + }; + Runtime.prototype.onContextLost = function () + { + this.glwrap.contextLost(); + this.is_WebGL_context_lost = true; + var i, len, t; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + if (t.onLostWebGLContext) + t.onLostWebGLContext(); + } + }; + Runtime.prototype.onContextRestored = function () + { + this.is_WebGL_context_lost = false; + var i, len, t; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + if (t.onRestoreWebGLContext) + t.onRestoreWebGLContext(); + } + }; + Runtime.prototype.positionOverlayCanvas = function() + { + if (this.isDomFree) + return; + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || document["fullScreen"] || !!document["msFullscreenElement"] || this.isNodeFullscreen) && !this.isCordova; + var overlay_position = isfullscreen ? jQuery(this.canvas).offset() : jQuery(this.canvas).position(); + overlay_position.position = "absolute"; + jQuery(this.overlay_canvas).css(overlay_position); + }; + var caf = window["cancelAnimationFrame"] || + window["mozCancelAnimationFrame"] || + window["webkitCancelAnimationFrame"] || + window["msCancelAnimationFrame"] || + window["oCancelAnimationFrame"]; + Runtime.prototype["setSuspended"] = function (s) + { + var i, len; + var self = this; + if (s && !this.isSuspended) + { + cr.logexport("[Construct 2] Suspending"); + this.isSuspended = true; // next tick will be last + if (this.raf_id !== -1 && caf) // note: CocoonJS does not implement cancelAnimationFrame + caf(this.raf_id); + if (this.timeout_id !== -1) + clearTimeout(this.timeout_id); + for (i = 0, len = this.suspend_events.length; i < len; i++) + this.suspend_events[i](true); + } + else if (!s && this.isSuspended) + { + cr.logexport("[Construct 2] Resuming"); + this.isSuspended = false; + this.last_tick_time = cr.performance_now(); // ensure first tick is a zero-dt one + this.last_fps_time = cr.performance_now(); // reset FPS counter + this.framecount = 0; + this.logictime = 0; + for (i = 0, len = this.suspend_events.length; i < len; i++) + this.suspend_events[i](false); + this.tick(false); // kick off runtime again + } + }; + Runtime.prototype.addSuspendCallback = function (f) + { + this.suspend_events.push(f); + }; + Runtime.prototype.GetObjectReference = function (i) + { +; + return this.objectRefTable[i]; + }; + Runtime.prototype.loadProject = function (data_response) + { +; + if (!data_response || !data_response["project"]) + cr.logerror("Project model unavailable"); + var pm = data_response["project"]; + this.name = pm[0]; + this.first_layout = pm[1]; + this.fullscreen_mode = pm[12]; // 0 = off, 1 = crop, 2 = scale inner, 3 = scale outer, 4 = letterbox scale, 5 = integer letterbox scale + this.fullscreen_mode_set = pm[12]; + this.original_width = pm[10]; + this.original_height = pm[11]; + this.parallax_x_origin = this.original_width / 2; + this.parallax_y_origin = this.original_height / 2; + if (this.isDomFree && !this.isEjecta && (pm[12] >= 4 || pm[12] === 0)) + { + cr.logexport("[Construct 2] Letterbox scale fullscreen modes are not supported on this platform - falling back to 'Scale outer'"); + this.fullscreen_mode = 3; + this.fullscreen_mode_set = 3; + } + this.uses_loader_layout = pm[18]; + this.loaderstyle = pm[19]; + if (this.loaderstyle === 0) + { + var loaderImage = new Image(); + loaderImage.crossOrigin = "anonymous"; + this.setImageSrc(loaderImage, "loading-logo.png"); + this.loaderlogos = { + logo: loaderImage + }; + } + else if (this.loaderstyle === 4) // c2 splash + { + var loaderC2logo_1024 = new Image(); + loaderC2logo_1024.src = ""; + var loaderC2logo_512 = new Image(); + loaderC2logo_512.src = ""; + var loaderC2logo_256 = new Image(); + loaderC2logo_256.src = ""; + var loaderC2logo_128 = new Image(); + loaderC2logo_128.src = ""; + var loaderPowered_1024 = new Image(); + loaderPowered_1024.src = ""; + var loaderPowered_512 = new Image(); + loaderPowered_512.src = ""; + var loaderPowered_256 = new Image(); + loaderPowered_256.src = ""; + var loaderPowered_128 = new Image(); + loaderPowered_128.src = ""; + var loaderWebsite_1024 = new Image(); + loaderWebsite_1024.src = ""; + var loaderWebsite_512 = new Image(); + loaderWebsite_512.src = ""; + var loaderWebsite_256 = new Image(); + loaderWebsite_256.src = ""; + var loaderWebsite_128 = new Image(); + loaderWebsite_128.src = ""; + this.loaderlogos = { + logo: [loaderC2logo_1024, loaderC2logo_512, loaderC2logo_256, loaderC2logo_128], + powered: [loaderPowered_1024, loaderPowered_512, loaderPowered_256, loaderPowered_128], + website: [loaderWebsite_1024, loaderWebsite_512, loaderWebsite_256, loaderWebsite_128] + }; + } + this.next_uid = pm[21]; + this.objectRefTable = cr.getObjectRefTable(); + this.system = new cr.system_object(this); + var i, len, j, lenj, k, lenk, idstr, m, b, t, f, p; + var plugin, plugin_ctor; + for (i = 0, len = pm[2].length; i < len; i++) + { + m = pm[2][i]; + p = this.GetObjectReference(m[0]); +; + cr.add_common_aces(m, p.prototype); + plugin = new p(this); + plugin.singleglobal = m[1]; + plugin.is_world = m[2]; + plugin.is_rotatable = m[5]; + plugin.must_predraw = m[9]; + if (plugin.onCreate) + plugin.onCreate(); // opportunity to override default ACEs + cr.seal(plugin); + this.plugins.push(plugin); + } + this.objectRefTable = cr.getObjectRefTable(); + for (i = 0, len = pm[3].length; i < len; i++) + { + m = pm[3][i]; + plugin_ctor = this.GetObjectReference(m[1]); +; + plugin = null; + for (j = 0, lenj = this.plugins.length; j < lenj; j++) + { + if (this.plugins[j] instanceof plugin_ctor) + { + plugin = this.plugins[j]; + break; + } + } +; +; + var type_inst = new plugin.Type(plugin); +; + type_inst.name = m[0]; + type_inst.is_family = m[2]; + type_inst.instvar_sids = m[3].slice(0); + type_inst.vars_count = m[3].length; + type_inst.behs_count = m[4]; + type_inst.fx_count = m[5]; + type_inst.sid = m[11]; + if (type_inst.is_family) + { + type_inst.members = []; // types in this family + type_inst.family_index = this.family_count++; + type_inst.families = null; + } + else + { + type_inst.members = null; + type_inst.family_index = -1; + type_inst.families = []; // families this type belongs to + } + type_inst.family_var_map = null; + type_inst.family_beh_map = null; + type_inst.family_fx_map = null; + type_inst.is_contained = false; + type_inst.container = null; + if (m[6]) + { + type_inst.texture_file = m[6][0]; + type_inst.texture_filesize = m[6][1]; + type_inst.texture_pixelformat = m[6][2]; + } + else + { + type_inst.texture_file = null; + type_inst.texture_filesize = 0; + type_inst.texture_pixelformat = 0; // rgba8 + } + if (m[7]) + { + type_inst.animations = m[7]; + } + else + { + type_inst.animations = null; + } + type_inst.index = i; // save index in to types array in type + type_inst.instances = []; // all instances of this type + type_inst.deadCache = []; // destroyed instances to recycle next create + type_inst.solstack = [new cr.selection(type_inst)]; // initialise SOL stack with one empty SOL + type_inst.cur_sol = 0; + type_inst.default_instance = null; + type_inst.default_layerindex = 0; + type_inst.stale_iids = true; + type_inst.updateIIDs = cr.type_updateIIDs; + type_inst.getFirstPicked = cr.type_getFirstPicked; + type_inst.getPairedInstance = cr.type_getPairedInstance; + type_inst.getCurrentSol = cr.type_getCurrentSol; + type_inst.pushCleanSol = cr.type_pushCleanSol; + type_inst.pushCopySol = cr.type_pushCopySol; + type_inst.popSol = cr.type_popSol; + type_inst.getBehaviorByName = cr.type_getBehaviorByName; + type_inst.getBehaviorIndexByName = cr.type_getBehaviorIndexByName; + type_inst.getEffectIndexByName = cr.type_getEffectIndexByName; + type_inst.applySolToContainer = cr.type_applySolToContainer; + type_inst.getInstanceByIID = cr.type_getInstanceByIID; + type_inst.collision_grid = new cr.SparseGrid(this.original_width, this.original_height); + type_inst.any_cell_changed = true; + type_inst.any_instance_parallaxed = false; + type_inst.extra = {}; + type_inst.toString = cr.type_toString; + type_inst.behaviors = []; + for (j = 0, lenj = m[8].length; j < lenj; j++) + { + b = m[8][j]; + var behavior_ctor = this.GetObjectReference(b[1]); + var behavior_plugin = null; + for (k = 0, lenk = this.behaviors.length; k < lenk; k++) + { + if (this.behaviors[k] instanceof behavior_ctor) + { + behavior_plugin = this.behaviors[k]; + break; + } + } + if (!behavior_plugin) + { + behavior_plugin = new behavior_ctor(this); + behavior_plugin.my_types = []; // types using this behavior + behavior_plugin.my_instances = new cr.ObjectSet(); // instances of this behavior + if (behavior_plugin.onCreate) + behavior_plugin.onCreate(); + cr.seal(behavior_plugin); + this.behaviors.push(behavior_plugin); + if (cr.behaviors.solid && behavior_plugin instanceof cr.behaviors.solid) + this.solidBehavior = behavior_plugin; + if (cr.behaviors.jumpthru && behavior_plugin instanceof cr.behaviors.jumpthru) + this.jumpthruBehavior = behavior_plugin; + if (cr.behaviors.shadowcaster && behavior_plugin instanceof cr.behaviors.shadowcaster) + this.shadowcasterBehavior = behavior_plugin; + } + if (behavior_plugin.my_types.indexOf(type_inst) === -1) + behavior_plugin.my_types.push(type_inst); + var behavior_type = new behavior_plugin.Type(behavior_plugin, type_inst); + behavior_type.name = b[0]; + behavior_type.sid = b[2]; + behavior_type.onCreate(); + cr.seal(behavior_type); + type_inst.behaviors.push(behavior_type); + } + type_inst.global = m[9]; + type_inst.isOnLoaderLayout = m[10]; + type_inst.effect_types = []; + for (j = 0, lenj = m[12].length; j < lenj; j++) + { + type_inst.effect_types.push({ + id: m[12][j][0], + name: m[12][j][1], + shaderindex: -1, + preservesOpaqueness: false, + active: true, + index: j + }); + } + type_inst.tile_poly_data = m[13]; + if (!this.uses_loader_layout || type_inst.is_family || type_inst.isOnLoaderLayout || !plugin.is_world) + { + type_inst.onCreate(); + cr.seal(type_inst); + } + if (type_inst.name) + this.types[type_inst.name] = type_inst; + this.types_by_index.push(type_inst); + if (plugin.singleglobal) + { + var instance = new plugin.Instance(type_inst); + instance.uid = this.next_uid++; + instance.puid = this.next_puid++; + instance.iid = 0; + instance.get_iid = cr.inst_get_iid; + instance.toString = cr.inst_toString; + instance.properties = m[14]; + instance.onCreate(); + cr.seal(instance); + type_inst.instances.push(instance); + this.objectsByUid[instance.uid.toString()] = instance; + } + } + for (i = 0, len = pm[4].length; i < len; i++) + { + var familydata = pm[4][i]; + var familytype = this.types_by_index[familydata[0]]; + var familymember; + for (j = 1, lenj = familydata.length; j < lenj; j++) + { + familymember = this.types_by_index[familydata[j]]; + familymember.families.push(familytype); + familytype.members.push(familymember); + } + } + for (i = 0, len = pm[28].length; i < len; i++) + { + var containerdata = pm[28][i]; + var containertypes = []; + for (j = 0, lenj = containerdata.length; j < lenj; j++) + containertypes.push(this.types_by_index[containerdata[j]]); + for (j = 0, lenj = containertypes.length; j < lenj; j++) + { + containertypes[j].is_contained = true; + containertypes[j].container = containertypes; + } + } + if (this.family_count > 0) + { + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + if (t.is_family || !t.families.length) + continue; + t.family_var_map = new Array(this.family_count); + t.family_beh_map = new Array(this.family_count); + t.family_fx_map = new Array(this.family_count); + var all_fx = []; + var varsum = 0; + var behsum = 0; + var fxsum = 0; + for (j = 0, lenj = t.families.length; j < lenj; j++) + { + f = t.families[j]; + t.family_var_map[f.family_index] = varsum; + varsum += f.vars_count; + t.family_beh_map[f.family_index] = behsum; + behsum += f.behs_count; + t.family_fx_map[f.family_index] = fxsum; + fxsum += f.fx_count; + for (k = 0, lenk = f.effect_types.length; k < lenk; k++) + all_fx.push(cr.shallowCopy({}, f.effect_types[k])); + } + t.effect_types = all_fx.concat(t.effect_types); + for (j = 0, lenj = t.effect_types.length; j < lenj; j++) + t.effect_types[j].index = j; + } + } + for (i = 0, len = pm[5].length; i < len; i++) + { + m = pm[5][i]; + var layout = new cr.layout(this, m); + cr.seal(layout); + this.layouts[layout.name] = layout; + this.layouts_by_index.push(layout); + } + for (i = 0, len = pm[6].length; i < len; i++) + { + m = pm[6][i]; + var sheet = new cr.eventsheet(this, m); + cr.seal(sheet); + this.eventsheets[sheet.name] = sheet; + this.eventsheets_by_index.push(sheet); + } + for (i = 0, len = this.eventsheets_by_index.length; i < len; i++) + this.eventsheets_by_index[i].postInit(); + for (i = 0, len = this.eventsheets_by_index.length; i < len; i++) + this.eventsheets_by_index[i].updateDeepIncludes(); + for (i = 0, len = this.triggers_to_postinit.length; i < len; i++) + this.triggers_to_postinit[i].postInit(); + cr.clearArray(this.triggers_to_postinit) + this.audio_to_preload = pm[7]; + this.files_subfolder = pm[8]; + this.pixel_rounding = pm[9]; + this.aspect_scale = 1.0; + this.enableWebGL = pm[13]; + this.linearSampling = pm[14]; + this.clearBackground = pm[15]; + this.versionstr = pm[16]; + this.useHighDpi = pm[17]; + this.orientations = pm[20]; // 0 = any, 1 = portrait, 2 = landscape + this.autoLockOrientation = (this.orientations > 0); + this.pauseOnBlur = pm[22]; + this.wantFullscreenScalingQuality = pm[23]; // false = low quality, true = high quality + this.fullscreenScalingQuality = this.wantFullscreenScalingQuality; + this.downscalingQuality = pm[24]; // 0 = low (mips off), 1 = medium (mips on, dense spritesheet), 2 = high (mips on, sparse spritesheet) + this.preloadSounds = pm[25]; // 0 = no, 1 = yes + this.projectName = pm[26]; + this.enableFrontToBack = pm[27] && !this.isIE; // front-to-back renderer disabled in IE (but not Edge) + this.start_time = Date.now(); + cr.clearArray(this.objectRefTable); + this.initRendererAndLoader(); + }; + var anyImageHadError = false; + Runtime.prototype.waitForImageLoad = function (img_, src_) + { + img_["cocoonLazyLoad"] = true; + img_.onerror = function (e) + { + img_.c2error = true; + anyImageHadError = true; + if (console && console.error) + console.error("Error loading image '" + img_.src + "': ", e); + }; + if (this.isEjecta) + { + img_.src = src_; + } + else if (!img_.src) + { + if (typeof XAPKReader !== "undefined") + { + XAPKReader.get(src_, function (expanded_url) + { + img_.src = expanded_url; + }, function (e) + { + img_.c2error = true; + anyImageHadError = true; + if (console && console.error) + console.error("Error extracting image '" + src_ + "' from expansion file: ", e); + }); + } + else + { + img_.crossOrigin = "anonymous"; // required for Arcade sandbox compatibility + this.setImageSrc(img_, src_); // work around WKWebView problems + } + } + this.wait_for_textures.push(img_); + }; + Runtime.prototype.findWaitingTexture = function (src_) + { + var i, len; + for (i = 0, len = this.wait_for_textures.length; i < len; i++) + { + if (this.wait_for_textures[i].cr_src === src_) + return this.wait_for_textures[i]; + } + return null; + }; + var audio_preload_totalsize = 0; + var audio_preload_started = false; + Runtime.prototype.getready = function () + { + if (!this.audioInstance) + return; + audio_preload_totalsize = this.audioInstance.setPreloadList(this.audio_to_preload); + }; + Runtime.prototype.areAllTexturesAndSoundsLoaded = function () + { + var totalsize = audio_preload_totalsize; + var completedsize = 0; + var audiocompletedsize = 0; + var ret = true; + var i, len, img; + for (i = 0, len = this.wait_for_textures.length; i < len; i++) + { + img = this.wait_for_textures[i]; + var filesize = img.cr_filesize; + if (!filesize || filesize <= 0) + filesize = 50000; + totalsize += filesize; + if (!!img.src && (img.complete || img["loaded"]) && !img.c2error) + completedsize += filesize; + else + ret = false; // not all textures loaded + } + if (ret && this.preloadSounds && this.audioInstance) + { + if (!audio_preload_started) + { + this.audioInstance.startPreloads(); + audio_preload_started = true; + } + audiocompletedsize = this.audioInstance.getPreloadedSize(); + completedsize += audiocompletedsize; + if (audiocompletedsize < audio_preload_totalsize) + ret = false; // not done yet + } + if (totalsize == 0) + this.progress = 1; // indicate to C2 splash loader that it can finish now + else + this.progress = (completedsize / totalsize); + return ret; + }; + var isC2SplashDone = false; + Runtime.prototype.go = function () + { + if (!this.ctx && !this.glwrap) + return; + var ctx = this.ctx || this.overlay_ctx; + if (this.overlay_canvas) + this.positionOverlayCanvas(); + var curwidth = window.innerWidth; + var curheight = window.innerHeight; + if (this.lastWindowWidth !== curwidth || this.lastWindowHeight !== curheight) + { + this["setSize"](curwidth, curheight); + } + this.progress = 0; + this.last_progress = -1; + var self = this; + if (this.areAllTexturesAndSoundsLoaded() && (this.loaderstyle !== 4 || isC2SplashDone)) + { + this.go_loading_finished(); + } + else + { + var ms_elapsed = Date.now() - this.start_time; + if (ctx) + { + var overlay_width = this.width; + var overlay_height = this.height; + var dpr = this.devicePixelRatio; + if (this.loaderstyle < 3 && (this.isCocoonJs || (ms_elapsed >= 500 && this.last_progress != this.progress))) + { + ctx.clearRect(0, 0, overlay_width, overlay_height); + var mx = overlay_width / 2; + var my = overlay_height / 2; + var haslogo = (this.loaderstyle === 0 && this.loaderlogos.logo.complete); + var hlw = 40 * dpr; + var hlh = 0; + var logowidth = 80 * dpr; + var logoheight; + if (haslogo) + { + var loaderLogoImage = this.loaderlogos.logo; + logowidth = loaderLogoImage.width * dpr; + logoheight = loaderLogoImage.height * dpr; + hlw = logowidth / 2; + hlh = logoheight / 2; + ctx.drawImage(loaderLogoImage, cr.floor(mx - hlw), cr.floor(my - hlh), logowidth, logoheight); + } + if (this.loaderstyle <= 1) + { + my += hlh + (haslogo ? 12 * dpr : 0); + mx -= hlw; + mx = cr.floor(mx) + 0.5; + my = cr.floor(my) + 0.5; + ctx.fillStyle = anyImageHadError ? "red" : "DodgerBlue"; + ctx.fillRect(mx, my, Math.floor(logowidth * this.progress), 6 * dpr); + ctx.strokeStyle = "black"; + ctx.strokeRect(mx, my, logowidth, 6 * dpr); + ctx.strokeStyle = "white"; + ctx.strokeRect(mx - 1 * dpr, my - 1 * dpr, logowidth + 2 * dpr, 8 * dpr); + } + else if (this.loaderstyle === 2) + { + ctx.font = (this.isEjecta ? "12pt ArialMT" : "12pt Arial"); + ctx.fillStyle = anyImageHadError ? "#f00" : "#999"; + ctx.textBaseLine = "middle"; + var percent_text = Math.round(this.progress * 100) + "%"; + var text_dim = ctx.measureText ? ctx.measureText(percent_text) : null; + var text_width = text_dim ? text_dim.width : 0; + ctx.fillText(percent_text, mx - (text_width / 2), my); + } + this.last_progress = this.progress; + } + else if (this.loaderstyle === 4) + { + this.draw_c2_splash_loader(ctx); + if (raf) + raf(function() { self.go(); }); + else + setTimeout(function() { self.go(); }, 16); + return; + } + } + setTimeout(function() { self.go(); }, (this.isCocoonJs ? 10 : 100)); + } + }; + var splashStartTime = -1; + var splashFadeInDuration = 300; + var splashFadeOutDuration = 300; + var splashAfterFadeOutWait = (typeof cr_is_preview === "undefined" ? 200 : 0); + var splashIsFadeIn = true; + var splashIsFadeOut = false; + var splashFadeInFinish = 0; + var splashFadeOutStart = 0; + var splashMinDisplayTime = (typeof cr_is_preview === "undefined" ? 3000 : 0); + var renderViaCanvas = null; + var renderViaCtx = null; + var splashFrameNumber = 0; + function maybeCreateRenderViaCanvas(w, h) + { + if (!renderViaCanvas || renderViaCanvas.width !== w || renderViaCanvas.height !== h) + { + renderViaCanvas = document.createElement("canvas"); + renderViaCanvas.width = w; + renderViaCanvas.height = h; + renderViaCtx = renderViaCanvas.getContext("2d"); + } + }; + function mipImage(arr, size) + { + if (size <= 128) + return arr[3]; + else if (size <= 256) + return arr[2]; + else if (size <= 512) + return arr[1]; + else + return arr[0]; + }; + Runtime.prototype.draw_c2_splash_loader = function(ctx) + { + if (isC2SplashDone) + return; + var w = Math.ceil(this.width); + var h = Math.ceil(this.height); + var dpr = this.devicePixelRatio; + var logoimages = this.loaderlogos.logo; + var poweredimages = this.loaderlogos.powered; + var websiteimages = this.loaderlogos.website; + for (var i = 0; i < 4; ++i) + { + if (!logoimages[i].complete || !poweredimages[i].complete || !websiteimages[i].complete) + return; + } + if (splashFrameNumber === 0) + splashStartTime = Date.now(); + var nowTime = Date.now(); + var isRenderingVia = false; + var renderToCtx = ctx; + var drawW, drawH; + if (splashIsFadeIn || splashIsFadeOut) + { + ctx.clearRect(0, 0, w, h); + maybeCreateRenderViaCanvas(w, h); + renderToCtx = renderViaCtx; + isRenderingVia = true; + if (splashIsFadeIn && splashFrameNumber === 1) + splashStartTime = Date.now(); + } + else + { + ctx.globalAlpha = 1; + } + renderToCtx.fillStyle = "#333333"; + renderToCtx.fillRect(0, 0, w, h); + if (this.cssHeight > 256) + { + drawW = cr.clamp(h * 0.22, 105, w * 0.6); + drawH = drawW * 0.25; + renderToCtx.drawImage(mipImage(poweredimages, drawW), w * 0.5 - drawW/2, h * 0.2 - drawH/2, drawW, drawH); + drawW = Math.min(h * 0.395, w * 0.95); + drawH = drawW; + renderToCtx.drawImage(mipImage(logoimages, drawW), w * 0.5 - drawW/2, h * 0.485 - drawH/2, drawW, drawH); + drawW = cr.clamp(h * 0.22, 105, w * 0.6); + drawH = drawW * 0.25; + renderToCtx.drawImage(mipImage(websiteimages, drawW), w * 0.5 - drawW/2, h * 0.868 - drawH/2, drawW, drawH); + renderToCtx.fillStyle = "#3C3C3C"; + drawW = w; + drawH = Math.max(h * 0.005, 2); + renderToCtx.fillRect(0, h * 0.8 - drawH/2, drawW, drawH); + renderToCtx.fillStyle = anyImageHadError ? "red" : "#E0FF65"; + drawW = w * this.progress; + renderToCtx.fillRect(w * 0.5 - drawW/2, h * 0.8 - drawH/2, drawW, drawH); + } + else + { + drawW = h * 0.55; + drawH = drawW; + renderToCtx.drawImage(mipImage(logoimages, drawW), w * 0.5 - drawW/2, h * 0.45 - drawH/2, drawW, drawH); + renderToCtx.fillStyle = "#3C3C3C"; + drawW = w; + drawH = Math.max(h * 0.005, 2); + renderToCtx.fillRect(0, h * 0.85 - drawH/2, drawW, drawH); + renderToCtx.fillStyle = anyImageHadError ? "red" : "#E0FF65"; + drawW = w * this.progress; + renderToCtx.fillRect(w * 0.5 - drawW/2, h * 0.85 - drawH/2, drawW, drawH); + } + if (isRenderingVia) + { + if (splashIsFadeIn) + { + if (splashFrameNumber === 0) + ctx.globalAlpha = 0; + else + ctx.globalAlpha = Math.min((nowTime - splashStartTime) / splashFadeInDuration, 1); + } + else if (splashIsFadeOut) + { + ctx.globalAlpha = Math.max(1 - (nowTime - splashFadeOutStart) / splashFadeOutDuration, 0); + } + ctx.drawImage(renderViaCanvas, 0, 0, w, h); + } + if (splashIsFadeIn && nowTime - splashStartTime >= splashFadeInDuration && splashFrameNumber >= 2) + { + splashIsFadeIn = false; + splashFadeInFinish = nowTime; + } + if (!splashIsFadeIn && nowTime - splashFadeInFinish >= splashMinDisplayTime && !splashIsFadeOut && this.progress >= 1) + { + splashIsFadeOut = true; + splashFadeOutStart = nowTime; + } + if ((splashIsFadeOut && nowTime - splashFadeOutStart >= splashFadeOutDuration + splashAfterFadeOutWait) || + (typeof cr_is_preview !== "undefined" && this.progress >= 1 && Date.now() - splashStartTime < 500)) + { + isC2SplashDone = true; + splashIsFadeIn = false; + splashIsFadeOut = false; + renderViaCanvas = null; + renderViaCtx = null; + this.loaderlogos = null; + } + ++splashFrameNumber; + }; + Runtime.prototype.go_loading_finished = function () + { + if (this.overlay_canvas) + { + this.canvas.parentNode.removeChild(this.overlay_canvas); + this.overlay_ctx = null; + this.overlay_canvas = null; + } + this.start_time = Date.now(); + this.last_fps_time = cr.performance_now(); // for counting framerate + var i, len, t; + if (this.uses_loader_layout) + { + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + if (!t.is_family && !t.isOnLoaderLayout && t.plugin.is_world) + { + t.onCreate(); + cr.seal(t); + } + } + } + else + this.isloading = false; + for (i = 0, len = this.layouts_by_index.length; i < len; i++) + { + this.layouts_by_index[i].createGlobalNonWorlds(); + } + if (this.fullscreen_mode >= 2) + { + var orig_aspect = this.original_width / this.original_height; + var cur_aspect = this.width / this.height; + if ((this.fullscreen_mode !== 2 && cur_aspect > orig_aspect) || (this.fullscreen_mode === 2 && cur_aspect < orig_aspect)) + this.aspect_scale = this.height / this.original_height; + else + this.aspect_scale = this.width / this.original_width; + } + if (this.first_layout) + this.layouts[this.first_layout].startRunning(); + else + this.layouts_by_index[0].startRunning(); +; + if (!this.uses_loader_layout) + { + this.loadingprogress = 1; + this.trigger(cr.system_object.prototype.cnds.OnLoadFinished, null); + if (window["C2_RegisterSW"]) // note not all platforms use SW + window["C2_RegisterSW"](); + } + if (navigator["splashscreen"] && navigator["splashscreen"]["hide"]) + navigator["splashscreen"]["hide"](); + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + t = this.types_by_index[i]; + if (t.onAppBegin) + t.onAppBegin(); + } + if (document["hidden"] || document["webkitHidden"] || document["mozHidden"] || document["msHidden"]) + { + window["cr_setSuspended"](true); // stop rendering + } + else + { + this.tick(false); + } + if (this.isDirectCanvas) + AppMobi["webview"]["execute"]("onGameReady();"); + }; + Runtime.prototype.tick = function (background_wake, timestamp, debug_step) + { + if (!this.running_layout) + return; + var nowtime = cr.performance_now(); + var logic_start = nowtime; + if (!debug_step && this.isSuspended && !background_wake) + return; + if (!background_wake) + { + if (raf) + this.raf_id = raf(this.tickFunc); + else + { + this.timeout_id = setTimeout(this.tickFunc, this.isMobile ? 1 : 16); + } + } + var raf_time = timestamp || nowtime; + var fsmode = this.fullscreen_mode; + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || document["fullScreen"] || !!document["msFullscreenElement"]) && !this.isCordova; + if ((isfullscreen || this.isNodeFullscreen) && this.fullscreen_scaling > 0) + fsmode = this.fullscreen_scaling; + if (fsmode > 0) // r222: experimentally enabling this workaround for all platforms + { + var curwidth = window.innerWidth; + var curheight = window.innerHeight; + if (this.lastWindowWidth !== curwidth || this.lastWindowHeight !== curheight) + { + this["setSize"](curwidth, curheight); + } + } + if (!this.isDomFree) + { + if (isfullscreen) + { + if (!this.firstInFullscreen) + { + this.fullscreenOldMarginCss = jQuery(this.canvas).css("margin") || "0"; + this.firstInFullscreen = true; + } + if (!this.isChrome && !this.isNWjs) + { + jQuery(this.canvas).css({ + "margin-left": "" + Math.floor((screen.width - (this.width / this.devicePixelRatio)) / 2) + "px", + "margin-top": "" + Math.floor((screen.height - (this.height / this.devicePixelRatio)) / 2) + "px" + }); + } + } + else + { + if (this.firstInFullscreen) + { + if (!this.isChrome && !this.isNWjs) + { + jQuery(this.canvas).css("margin", this.fullscreenOldMarginCss); + } + this.fullscreenOldMarginCss = ""; + this.firstInFullscreen = false; + if (this.fullscreen_mode === 0) + { + this["setSize"](Math.round(this.oldWidth / this.devicePixelRatio), Math.round(this.oldHeight / this.devicePixelRatio), true); + } + } + else + { + this.oldWidth = this.width; + this.oldHeight = this.height; + } + } + } + if (this.isloading) + { + var done = this.areAllTexturesAndSoundsLoaded(); // updates this.progress + this.loadingprogress = this.progress; + if (done) + { + this.isloading = false; + this.progress = 1; + this.trigger(cr.system_object.prototype.cnds.OnLoadFinished, null); + if (window["C2_RegisterSW"]) + window["C2_RegisterSW"](); + } + } + this.logic(raf_time); + if ((this.redraw || this.isCocoonJs) && !this.is_WebGL_context_lost && !this.suspendDrawing && !background_wake) + { + this.redraw = false; + if (this.glwrap) + this.drawGL(); + else + this.draw(); + if (this.snapshotCanvas) + { + if (this.canvas && this.canvas.toDataURL) + { + this.snapshotData = this.canvas.toDataURL(this.snapshotCanvas[0], this.snapshotCanvas[1]); + if (window["cr_onSnapshot"]) + window["cr_onSnapshot"](this.snapshotData); + this.trigger(cr.system_object.prototype.cnds.OnCanvasSnapshot, null); + } + this.snapshotCanvas = null; + } + } + if (!this.hit_breakpoint) + { + this.tickcount++; + this.execcount++; + this.framecount++; + } + this.logictime += cr.performance_now() - logic_start; + }; + Runtime.prototype.logic = function (cur_time) + { + var i, leni, j, lenj, k, lenk, type, inst, binst; + if (cur_time - this.last_fps_time >= 1000) // every 1 second + { + this.last_fps_time += 1000; + if (cur_time - this.last_fps_time >= 1000) + this.last_fps_time = cur_time; + this.fps = this.framecount; + this.framecount = 0; + this.cpuutilisation = this.logictime; + this.logictime = 0; + } + var wallDt = 0; + if (this.last_tick_time !== 0) + { + var ms_diff = cur_time - this.last_tick_time; + if (ms_diff < 0) + ms_diff = 0; + wallDt = ms_diff / 1000.0; // dt measured in seconds + this.dt1 = wallDt; + if (this.dt1 > 0.5) + this.dt1 = 0; + else if (this.dt1 > 1 / this.minimumFramerate) + this.dt1 = 1 / this.minimumFramerate; + } + this.last_tick_time = cur_time; + this.dt = this.dt1 * this.timescale; + this.kahanTime.add(this.dt); + this.wallTime.add(wallDt); // prevent min/max framerate affecting wall clock + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || document["fullScreen"] || !!document["msFullscreenElement"] || this.isNodeFullscreen) && !this.isCordova; + if (this.fullscreen_mode >= 2 /* scale */ || (isfullscreen && this.fullscreen_scaling > 0)) + { + var orig_aspect = this.original_width / this.original_height; + var cur_aspect = this.width / this.height; + var mode = this.fullscreen_mode; + if (isfullscreen && this.fullscreen_scaling > 0) + mode = this.fullscreen_scaling; + if ((mode !== 2 && cur_aspect > orig_aspect) || (mode === 2 && cur_aspect < orig_aspect)) + { + this.aspect_scale = this.height / this.original_height; + } + else + { + this.aspect_scale = this.width / this.original_width; + } + if (this.running_layout) + { + this.running_layout.scrollToX(this.running_layout.scrollX); + this.running_layout.scrollToY(this.running_layout.scrollY); + } + } + else + this.aspect_scale = (this.isRetina ? this.devicePixelRatio : 1); + this.ClearDeathRow(); + this.isInOnDestroy++; + this.system.runWaits(); // prevent instance list changing + this.isInOnDestroy--; + this.ClearDeathRow(); // allow instance list changing + this.isInOnDestroy++; + var tickarr = this.objects_to_pretick.valuesRef(); + for (i = 0, leni = tickarr.length; i < leni; i++) + tickarr[i].pretick(); + for (i = 0, leni = this.types_by_index.length; i < leni; i++) + { + type = this.types_by_index[i]; + if (type.is_family || (!type.behaviors.length && !type.families.length)) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + inst.behavior_insts[k].tick(); + } + } + } + for (i = 0, leni = this.types_by_index.length; i < leni; i++) + { + type = this.types_by_index[i]; + if (type.is_family || (!type.behaviors.length && !type.families.length)) + continue; // type doesn't have any behaviors + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + binst = inst.behavior_insts[k]; + if (binst.posttick) + binst.posttick(); + } + } + } + tickarr = this.objects_to_tick.valuesRef(); + for (i = 0, leni = tickarr.length; i < leni; i++) + tickarr[i].tick(); + this.isInOnDestroy--; // end preventing instance lists from being changed + this.handleSaveLoad(); // save/load now if queued + i = 0; + while (this.changelayout && i++ < 10) + { + this.doChangeLayout(this.changelayout); + } + for (i = 0, leni = this.eventsheets_by_index.length; i < leni; i++) + this.eventsheets_by_index[i].hasRun = false; + if (this.running_layout.event_sheet) + this.running_layout.event_sheet.run(); + cr.clearArray(this.registered_collisions); + this.layout_first_tick = false; + this.isInOnDestroy++; // prevent instance lists from being changed + for (i = 0, leni = this.types_by_index.length; i < leni; i++) + { + type = this.types_by_index[i]; + if (type.is_family || (!type.behaviors.length && !type.families.length)) + continue; // type doesn't have any behaviors + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + var inst = type.instances[j]; + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + binst = inst.behavior_insts[k]; + if (binst.tick2) + binst.tick2(); + } + } + } + tickarr = this.objects_to_tick2.valuesRef(); + for (i = 0, leni = tickarr.length; i < leni; i++) + tickarr[i].tick2(); + this.isInOnDestroy--; // end preventing instance lists from being changed + }; + Runtime.prototype.onWindowBlur = function () + { + var i, leni, j, lenj, k, lenk, type, inst, binst; + for (i = 0, leni = this.types_by_index.length; i < leni; i++) + { + type = this.types_by_index[i]; + if (type.is_family) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + if (inst.onWindowBlur) + inst.onWindowBlur(); + if (!inst.behavior_insts) + continue; // single-globals don't have behavior_insts + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + binst = inst.behavior_insts[k]; + if (binst.onWindowBlur) + binst.onWindowBlur(); + } + } + } + }; + Runtime.prototype.doChangeLayout = function (changeToLayout) + { + var prev_layout = this.running_layout; + this.running_layout.stopRunning(); + var i, len, j, lenj, k, lenk, type, inst, binst; + if (this.glwrap) + { + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + type = this.types_by_index[i]; + if (type.is_family) + continue; + if (type.unloadTextures && (!type.global || type.instances.length === 0) && changeToLayout.initial_types.indexOf(type) === -1) + { + type.unloadTextures(); + } + } + } + if (prev_layout == changeToLayout) + cr.clearArray(this.system.waits); + cr.clearArray(this.registered_collisions); + this.runLayoutChangeMethods(true); + changeToLayout.startRunning(); + this.runLayoutChangeMethods(false); + this.redraw = true; + this.layout_first_tick = true; + this.ClearDeathRow(); + }; + Runtime.prototype.runLayoutChangeMethods = function (isBeforeChange) + { + var i, len, beh, type, j, lenj, inst, k, lenk, binst; + for (i = 0, len = this.behaviors.length; i < len; i++) + { + beh = this.behaviors[i]; + if (isBeforeChange) + { + if (beh.onBeforeLayoutChange) + beh.onBeforeLayoutChange(); + } + else + { + if (beh.onLayoutChange) + beh.onLayoutChange(); + } + } + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + type = this.types_by_index[i]; + if (!type.global && !type.plugin.singleglobal) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + if (isBeforeChange) + { + if (inst.onBeforeLayoutChange) + inst.onBeforeLayoutChange(); + } + else + { + if (inst.onLayoutChange) + inst.onLayoutChange(); + } + if (inst.behavior_insts) + { + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + binst = inst.behavior_insts[k]; + if (isBeforeChange) + { + if (binst.onBeforeLayoutChange) + binst.onBeforeLayoutChange(); + } + else + { + if (binst.onLayoutChange) + binst.onLayoutChange(); + } + } + } + } + } + }; + Runtime.prototype.pretickMe = function (inst) + { + this.objects_to_pretick.add(inst); + }; + Runtime.prototype.unpretickMe = function (inst) + { + this.objects_to_pretick.remove(inst); + }; + Runtime.prototype.tickMe = function (inst) + { + this.objects_to_tick.add(inst); + }; + Runtime.prototype.untickMe = function (inst) + { + this.objects_to_tick.remove(inst); + }; + Runtime.prototype.tick2Me = function (inst) + { + this.objects_to_tick2.add(inst); + }; + Runtime.prototype.untick2Me = function (inst) + { + this.objects_to_tick2.remove(inst); + }; + Runtime.prototype.getDt = function (inst) + { + if (!inst || inst.my_timescale === -1.0) + return this.dt; + return this.dt1 * inst.my_timescale; + }; + Runtime.prototype.draw = function () + { + this.running_layout.draw(this.ctx); + if (this.isDirectCanvas) + this.ctx["present"](); + }; + Runtime.prototype.drawGL = function () + { + if (this.enableFrontToBack) + { + this.earlyz_index = 1; // start from front, 1-based to avoid exactly equalling near plane Z value + this.running_layout.drawGL_earlyZPass(this.glwrap); + } + this.running_layout.drawGL(this.glwrap); + this.glwrap.present(); + }; + Runtime.prototype.addDestroyCallback = function (f) + { + if (f) + this.destroycallbacks.push(f); + }; + Runtime.prototype.removeDestroyCallback = function (f) + { + cr.arrayFindRemove(this.destroycallbacks, f); + }; + Runtime.prototype.getObjectByUID = function (uid_) + { +; + var uidstr = uid_.toString(); + if (this.objectsByUid.hasOwnProperty(uidstr)) + return this.objectsByUid[uidstr]; + else + return null; + }; + var objectset_cache = []; + function alloc_objectset() + { + if (objectset_cache.length) + return objectset_cache.pop(); + else + return new cr.ObjectSet(); + }; + function free_objectset(s) + { + s.clear(); + objectset_cache.push(s); + }; + Runtime.prototype.DestroyInstance = function (inst) + { + var i, len; + var type = inst.type; + var typename = type.name; + var has_typename = this.deathRow.hasOwnProperty(typename); + var obj_set = null; + if (has_typename) + { + obj_set = this.deathRow[typename]; + if (obj_set.contains(inst)) + return; // already had DestroyInstance called + } + else + { + obj_set = alloc_objectset(); + this.deathRow[typename] = obj_set; + } + obj_set.add(inst); + this.hasPendingInstances = true; + if (inst.is_contained) + { + for (i = 0, len = inst.siblings.length; i < len; i++) + { + this.DestroyInstance(inst.siblings[i]); + } + } + if (this.isInClearDeathRow) + obj_set.values_cache.push(inst); + if (!this.isEndingLayout) + { + this.isInOnDestroy++; // support recursion + this.trigger(Object.getPrototypeOf(inst.type.plugin).cnds.OnDestroyed, inst); + this.isInOnDestroy--; + } + }; + Runtime.prototype.ClearDeathRow = function () + { + if (!this.hasPendingInstances) + return; + var inst, type, instances; + var i, j, leni, lenj, obj_set; + this.isInClearDeathRow = true; + for (i = 0, leni = this.createRow.length; i < leni; ++i) + { + inst = this.createRow[i]; + type = inst.type; + type.instances.push(inst); + for (j = 0, lenj = type.families.length; j < lenj; ++j) + { + type.families[j].instances.push(inst); + type.families[j].stale_iids = true; + } + } + cr.clearArray(this.createRow); + this.IterateDeathRow(); // moved to separate function so for-in performance doesn't hobble entire function + cr.wipe(this.deathRow); // all objectsets have already been recycled + this.isInClearDeathRow = false; + this.hasPendingInstances = false; + }; + Runtime.prototype.IterateDeathRow = function () + { + for (var p in this.deathRow) + { + if (this.deathRow.hasOwnProperty(p)) + { + this.ClearDeathRowForType(this.deathRow[p]); + } + } + }; + Runtime.prototype.ClearDeathRowForType = function (obj_set) + { + var arr = obj_set.valuesRef(); // get array of items from set +; + var type = arr[0].type; +; +; + var i, len, j, lenj, w, f, layer_instances, inst; + cr.arrayRemoveAllFromObjectSet(type.instances, obj_set); + type.stale_iids = true; + if (type.instances.length === 0) + type.any_instance_parallaxed = false; + for (i = 0, len = type.families.length; i < len; ++i) + { + f = type.families[i]; + cr.arrayRemoveAllFromObjectSet(f.instances, obj_set); + f.stale_iids = true; + } + for (i = 0, len = this.system.waits.length; i < len; ++i) + { + w = this.system.waits[i]; + if (w.sols.hasOwnProperty(type.index)) + cr.arrayRemoveAllFromObjectSet(w.sols[type.index].insts, obj_set); + if (!type.is_family) + { + for (j = 0, lenj = type.families.length; j < lenj; ++j) + { + f = type.families[j]; + if (w.sols.hasOwnProperty(f.index)) + cr.arrayRemoveAllFromObjectSet(w.sols[f.index].insts, obj_set); + } + } + } + var first_layer = arr[0].layer; + if (first_layer) + { + if (first_layer.useRenderCells) + { + layer_instances = first_layer.instances; + for (i = 0, len = layer_instances.length; i < len; ++i) + { + inst = layer_instances[i]; + if (!obj_set.contains(inst)) + continue; // not destroying this instance + inst.update_bbox(); + first_layer.render_grid.update(inst, inst.rendercells, null); + inst.rendercells.set(0, 0, -1, -1); + } + } + cr.arrayRemoveAllFromObjectSet(first_layer.instances, obj_set); + first_layer.setZIndicesStaleFrom(0); + } + for (i = 0; i < arr.length; ++i) // check array length every time in case it changes + { + this.ClearDeathRowForSingleInstance(arr[i], type); + } + free_objectset(obj_set); + this.redraw = true; + }; + Runtime.prototype.ClearDeathRowForSingleInstance = function (inst, type) + { + var i, len, binst; + for (i = 0, len = this.destroycallbacks.length; i < len; ++i) + this.destroycallbacks[i](inst); + if (inst.collcells) + { + type.collision_grid.update(inst, inst.collcells, null); + } + var layer = inst.layer; + if (layer) + { + layer.removeFromInstanceList(inst, true); // remove from both instance list and render grid + } + if (inst.behavior_insts) + { + for (i = 0, len = inst.behavior_insts.length; i < len; ++i) + { + binst = inst.behavior_insts[i]; + if (binst.onDestroy) + binst.onDestroy(); + binst.behavior.my_instances.remove(inst); + } + } + this.objects_to_pretick.remove(inst); + this.objects_to_tick.remove(inst); + this.objects_to_tick2.remove(inst); + if (inst.onDestroy) + inst.onDestroy(); + if (this.objectsByUid.hasOwnProperty(inst.uid.toString())) + delete this.objectsByUid[inst.uid.toString()]; + this.objectcount--; + if (type.deadCache.length < 100) + type.deadCache.push(inst); + }; + Runtime.prototype.createInstance = function (type, layer, sx, sy) + { + if (type.is_family) + { + var i = cr.floor(Math.random() * type.members.length); + return this.createInstance(type.members[i], layer, sx, sy); + } + if (!type.default_instance) + { + return null; + } + return this.createInstanceFromInit(type.default_instance, layer, false, sx, sy, false); + }; + var all_behaviors = []; + Runtime.prototype.createInstanceFromInit = function (initial_inst, layer, is_startup_instance, sx, sy, skip_siblings) + { + var i, len, j, lenj, p, effect_fallback, x, y; + if (!initial_inst) + return null; + var type = this.types_by_index[initial_inst[1]]; +; +; + var is_world = type.plugin.is_world; +; + if (this.isloading && is_world && !type.isOnLoaderLayout) + return null; + if (is_world && !this.glwrap && initial_inst[0][11] === 11) + return null; + var original_layer = layer; + if (!is_world) + layer = null; + var inst; + if (type.deadCache.length) + { + inst = type.deadCache.pop(); + inst.recycled = true; + type.plugin.Instance.call(inst, type); + } + else + { + inst = new type.plugin.Instance(type); + inst.recycled = false; + } + if (is_startup_instance && !skip_siblings && !this.objectsByUid.hasOwnProperty(initial_inst[2].toString())) + inst.uid = initial_inst[2]; + else + inst.uid = this.next_uid++; + this.objectsByUid[inst.uid.toString()] = inst; + inst.puid = this.next_puid++; + inst.iid = type.instances.length; + for (i = 0, len = this.createRow.length; i < len; ++i) + { + if (this.createRow[i].type === type) + inst.iid++; + } + inst.get_iid = cr.inst_get_iid; + inst.toString = cr.inst_toString; + var initial_vars = initial_inst[3]; + if (inst.recycled) + { + cr.wipe(inst.extra); + } + else + { + inst.extra = {}; + if (typeof cr_is_preview !== "undefined") + { + inst.instance_var_names = []; + inst.instance_var_names.length = initial_vars.length; + for (i = 0, len = initial_vars.length; i < len; i++) + inst.instance_var_names[i] = initial_vars[i][1]; + } + inst.instance_vars = []; + inst.instance_vars.length = initial_vars.length; + } + for (i = 0, len = initial_vars.length; i < len; i++) + inst.instance_vars[i] = initial_vars[i][0]; + if (is_world) + { + var wm = initial_inst[0]; +; + inst.x = cr.is_undefined(sx) ? wm[0] : sx; + inst.y = cr.is_undefined(sy) ? wm[1] : sy; + inst.z = wm[2]; + inst.width = wm[3]; + inst.height = wm[4]; + inst.depth = wm[5]; + inst.angle = wm[6]; + inst.opacity = wm[7]; + inst.hotspotX = wm[8]; + inst.hotspotY = wm[9]; + inst.blend_mode = wm[10]; + effect_fallback = wm[11]; + if (!this.glwrap && type.effect_types.length) // no WebGL renderer and shaders used + inst.blend_mode = effect_fallback; // use fallback blend mode - destroy mode was handled above + inst.compositeOp = cr.effectToCompositeOp(inst.blend_mode); + if (this.gl) + cr.setGLBlend(inst, inst.blend_mode, this.gl); + if (inst.recycled) + { + for (i = 0, len = wm[12].length; i < len; i++) + { + for (j = 0, lenj = wm[12][i].length; j < lenj; j++) + inst.effect_params[i][j] = wm[12][i][j]; + } + inst.bbox.set(0, 0, 0, 0); + inst.collcells.set(0, 0, -1, -1); + inst.rendercells.set(0, 0, -1, -1); + inst.bquad.set_from_rect(inst.bbox); + cr.clearArray(inst.bbox_changed_callbacks); + } + else + { + inst.effect_params = wm[12].slice(0); + for (i = 0, len = inst.effect_params.length; i < len; i++) + inst.effect_params[i] = wm[12][i].slice(0); + inst.active_effect_types = []; + inst.active_effect_flags = []; + inst.active_effect_flags.length = type.effect_types.length; + inst.bbox = new cr.rect(0, 0, 0, 0); + inst.collcells = new cr.rect(0, 0, -1, -1); + inst.rendercells = new cr.rect(0, 0, -1, -1); + inst.bquad = new cr.quad(); + inst.bbox_changed_callbacks = []; + inst.set_bbox_changed = cr.set_bbox_changed; + inst.add_bbox_changed_callback = cr.add_bbox_changed_callback; + inst.contains_pt = cr.inst_contains_pt; + inst.update_bbox = cr.update_bbox; + inst.update_render_cell = cr.update_render_cell; + inst.update_collision_cell = cr.update_collision_cell; + inst.get_zindex = cr.inst_get_zindex; + } + inst.tilemap_exists = false; + inst.tilemap_width = 0; + inst.tilemap_height = 0; + inst.tilemap_data = null; + if (wm.length === 14) + { + inst.tilemap_exists = true; + inst.tilemap_width = wm[13][0]; + inst.tilemap_height = wm[13][1]; + inst.tilemap_data = wm[13][2]; + } + for (i = 0, len = type.effect_types.length; i < len; i++) + inst.active_effect_flags[i] = true; + inst.shaders_preserve_opaqueness = true; + inst.updateActiveEffects = cr.inst_updateActiveEffects; + inst.updateActiveEffects(); + inst.uses_shaders = !!inst.active_effect_types.length; + inst.bbox_changed = true; + inst.cell_changed = true; + type.any_cell_changed = true; + inst.visible = true; + inst.my_timescale = -1.0; + inst.layer = layer; + inst.zindex = layer.instances.length; // will be placed at top of current layer + inst.earlyz_index = 0; + if (typeof inst.collision_poly === "undefined") + inst.collision_poly = null; + inst.collisionsEnabled = true; + this.redraw = true; + } + var initial_props, binst; + cr.clearArray(all_behaviors); + for (i = 0, len = type.families.length; i < len; i++) + { + all_behaviors.push.apply(all_behaviors, type.families[i].behaviors); + } + all_behaviors.push.apply(all_behaviors, type.behaviors); + if (inst.recycled) + { + for (i = 0, len = all_behaviors.length; i < len; i++) + { + var btype = all_behaviors[i]; + binst = inst.behavior_insts[i]; + binst.recycled = true; + btype.behavior.Instance.call(binst, btype, inst); + initial_props = initial_inst[4][i]; + for (j = 0, lenj = initial_props.length; j < lenj; j++) + binst.properties[j] = initial_props[j]; + binst.onCreate(); + btype.behavior.my_instances.add(inst); + } + } + else + { + inst.behavior_insts = []; + for (i = 0, len = all_behaviors.length; i < len; i++) + { + var btype = all_behaviors[i]; + var binst = new btype.behavior.Instance(btype, inst); + binst.recycled = false; + binst.properties = initial_inst[4][i].slice(0); + binst.onCreate(); + cr.seal(binst); + inst.behavior_insts.push(binst); + btype.behavior.my_instances.add(inst); + } + } + initial_props = initial_inst[5]; + if (inst.recycled) + { + for (i = 0, len = initial_props.length; i < len; i++) + inst.properties[i] = initial_props[i]; + } + else + inst.properties = initial_props.slice(0); + this.createRow.push(inst); + this.hasPendingInstances = true; + if (layer) + { +; + layer.appendToInstanceList(inst, true); + if (layer.parallaxX !== 1 || layer.parallaxY !== 1) + type.any_instance_parallaxed = true; + } + this.objectcount++; + if (type.is_contained) + { + inst.is_contained = true; + if (inst.recycled) + cr.clearArray(inst.siblings); + else + inst.siblings = []; // note: should not include self in siblings + if (!is_startup_instance && !skip_siblings) // layout links initial instances + { + for (i = 0, len = type.container.length; i < len; i++) + { + if (type.container[i] === type) + continue; + if (!type.container[i].default_instance) + { + return null; + } + inst.siblings.push(this.createInstanceFromInit(type.container[i].default_instance, original_layer, false, is_world ? inst.x : sx, is_world ? inst.y : sy, true)); + } + for (i = 0, len = inst.siblings.length; i < len; i++) + { + inst.siblings[i].siblings.push(inst); + for (j = 0; j < len; j++) + { + if (i !== j) + inst.siblings[i].siblings.push(inst.siblings[j]); + } + } + } + } + else + { + inst.is_contained = false; + inst.siblings = null; + } + inst.onCreate(); + if (!inst.recycled) + cr.seal(inst); + for (i = 0, len = inst.behavior_insts.length; i < len; i++) + { + if (inst.behavior_insts[i].postCreate) + inst.behavior_insts[i].postCreate(); + } + return inst; + }; + Runtime.prototype.getLayerByName = function (layer_name) + { + var i, len; + for (i = 0, len = this.running_layout.layers.length; i < len; i++) + { + var layer = this.running_layout.layers[i]; + if (cr.equals_nocase(layer.name, layer_name)) + return layer; + } + return null; + }; + Runtime.prototype.getLayerByNumber = function (index) + { + index = cr.floor(index); + if (index < 0) + index = 0; + if (index >= this.running_layout.layers.length) + index = this.running_layout.layers.length - 1; + return this.running_layout.layers[index]; + }; + Runtime.prototype.getLayer = function (l) + { + if (cr.is_number(l)) + return this.getLayerByNumber(l); + else + return this.getLayerByName(l.toString()); + }; + Runtime.prototype.clearSol = function (solModifiers) + { + var i, len; + for (i = 0, len = solModifiers.length; i < len; i++) + { + solModifiers[i].getCurrentSol().select_all = true; + } + }; + Runtime.prototype.pushCleanSol = function (solModifiers) + { + var i, len; + for (i = 0, len = solModifiers.length; i < len; i++) + { + solModifiers[i].pushCleanSol(); + } + }; + Runtime.prototype.pushCopySol = function (solModifiers) + { + var i, len; + for (i = 0, len = solModifiers.length; i < len; i++) + { + solModifiers[i].pushCopySol(); + } + }; + Runtime.prototype.popSol = function (solModifiers) + { + var i, len; + for (i = 0, len = solModifiers.length; i < len; i++) + { + solModifiers[i].popSol(); + } + }; + Runtime.prototype.updateAllCells = function (type) + { + if (!type.any_cell_changed) + return; // all instances must already be up-to-date + var i, len, instances = type.instances; + for (i = 0, len = instances.length; i < len; ++i) + { + instances[i].update_collision_cell(); + } + var createRow = this.createRow; + for (i = 0, len = createRow.length; i < len; ++i) + { + if (createRow[i].type === type) + createRow[i].update_collision_cell(); + } + type.any_cell_changed = false; + }; + Runtime.prototype.getCollisionCandidates = function (layer, rtype, bbox, candidates) + { + var i, len, t; + var is_parallaxed = (layer ? (layer.parallaxX !== 1 || layer.parallaxY !== 1) : false); + if (rtype.is_family) + { + for (i = 0, len = rtype.members.length; i < len; ++i) + { + t = rtype.members[i]; + if (is_parallaxed || t.any_instance_parallaxed) + { + cr.appendArray(candidates, t.instances); + } + else + { + this.updateAllCells(t); + t.collision_grid.queryRange(bbox, candidates); + } + } + } + else + { + if (is_parallaxed || rtype.any_instance_parallaxed) + { + cr.appendArray(candidates, rtype.instances); + } + else + { + this.updateAllCells(rtype); + rtype.collision_grid.queryRange(bbox, candidates); + } + } + }; + Runtime.prototype.getTypesCollisionCandidates = function (layer, types, bbox, candidates) + { + var i, len; + for (i = 0, len = types.length; i < len; ++i) + { + this.getCollisionCandidates(layer, types[i], bbox, candidates); + } + }; + Runtime.prototype.getSolidCollisionCandidates = function (layer, bbox, candidates) + { + var solid = this.getSolidBehavior(); + if (!solid) + return null; + this.getTypesCollisionCandidates(layer, solid.my_types, bbox, candidates); + }; + Runtime.prototype.getJumpthruCollisionCandidates = function (layer, bbox, candidates) + { + var jumpthru = this.getJumpthruBehavior(); + if (!jumpthru) + return null; + this.getTypesCollisionCandidates(layer, jumpthru.my_types, bbox, candidates); + }; + Runtime.prototype.testAndSelectCanvasPointOverlap = function (type, ptx, pty, inverted) + { + var sol = type.getCurrentSol(); + var i, j, inst, len; + var orblock = this.getCurrentEventStack().current_event.orblock; + var lx, ly, arr; + if (sol.select_all) + { + if (!inverted) + { + sol.select_all = false; + cr.clearArray(sol.instances); // clear contents + } + for (i = 0, len = type.instances.length; i < len; i++) + { + inst = type.instances[i]; + inst.update_bbox(); + lx = inst.layer.canvasToLayer(ptx, pty, true); + ly = inst.layer.canvasToLayer(ptx, pty, false); + if (inst.contains_pt(lx, ly)) + { + if (inverted) + return false; + else + sol.instances.push(inst); + } + else if (orblock) + sol.else_instances.push(inst); + } + } + else + { + j = 0; + arr = (orblock ? sol.else_instances : sol.instances); + for (i = 0, len = arr.length; i < len; i++) + { + inst = arr[i]; + inst.update_bbox(); + lx = inst.layer.canvasToLayer(ptx, pty, true); + ly = inst.layer.canvasToLayer(ptx, pty, false); + if (inst.contains_pt(lx, ly)) + { + if (inverted) + return false; + else if (orblock) + sol.instances.push(inst); + else + { + sol.instances[j] = sol.instances[i]; + j++; + } + } + } + if (!inverted) + arr.length = j; + } + type.applySolToContainer(); + if (inverted) + return true; // did not find anything overlapping + else + return sol.hasObjects(); + }; + Runtime.prototype.testOverlap = function (a, b) + { + if (!a || !b || a === b || !a.collisionsEnabled || !b.collisionsEnabled) + return false; + a.update_bbox(); + b.update_bbox(); + var layera = a.layer; + var layerb = b.layer; + var different_layers = (layera !== layerb && (layera.parallaxX !== layerb.parallaxX || layerb.parallaxY !== layerb.parallaxY || layera.scale !== layerb.scale || layera.angle !== layerb.angle || layera.zoomRate !== layerb.zoomRate)); + var i, len, i2, i21, x, y, haspolya, haspolyb, polya, polyb; + if (!different_layers) // same layers: easy check + { + if (!a.bbox.intersects_rect(b.bbox)) + return false; + if (!a.bquad.intersects_quad(b.bquad)) + return false; + if (a.tilemap_exists && b.tilemap_exists) + return false; + if (a.tilemap_exists) + return this.testTilemapOverlap(a, b); + if (b.tilemap_exists) + return this.testTilemapOverlap(b, a); + haspolya = (a.collision_poly && !a.collision_poly.is_empty()); + haspolyb = (b.collision_poly && !b.collision_poly.is_empty()); + if (!haspolya && !haspolyb) + return true; + if (haspolya) + { + a.collision_poly.cache_poly(a.width, a.height, a.angle); + polya = a.collision_poly; + } + else + { + this.temp_poly.set_from_quad(a.bquad, a.x, a.y, a.width, a.height); + polya = this.temp_poly; + } + if (haspolyb) + { + b.collision_poly.cache_poly(b.width, b.height, b.angle); + polyb = b.collision_poly; + } + else + { + this.temp_poly.set_from_quad(b.bquad, b.x, b.y, b.width, b.height); + polyb = this.temp_poly; + } + return polya.intersects_poly(polyb, b.x - a.x, b.y - a.y); + } + else // different layers: need to do full translated check + { + haspolya = (a.collision_poly && !a.collision_poly.is_empty()); + haspolyb = (b.collision_poly && !b.collision_poly.is_empty()); + if (haspolya) + { + a.collision_poly.cache_poly(a.width, a.height, a.angle); + this.temp_poly.set_from_poly(a.collision_poly); + } + else + { + this.temp_poly.set_from_quad(a.bquad, a.x, a.y, a.width, a.height); + } + polya = this.temp_poly; + if (haspolyb) + { + b.collision_poly.cache_poly(b.width, b.height, b.angle); + this.temp_poly2.set_from_poly(b.collision_poly); + } + else + { + this.temp_poly2.set_from_quad(b.bquad, b.x, b.y, b.width, b.height); + } + polyb = this.temp_poly2; + for (i = 0, len = polya.pts_count; i < len; i++) + { + i2 = i * 2; + i21 = i2 + 1; + x = polya.pts_cache[i2]; + y = polya.pts_cache[i21]; + polya.pts_cache[i2] = layera.layerToCanvas(x + a.x, y + a.y, true); + polya.pts_cache[i21] = layera.layerToCanvas(x + a.x, y + a.y, false); + } + polya.update_bbox(); + for (i = 0, len = polyb.pts_count; i < len; i++) + { + i2 = i * 2; + i21 = i2 + 1; + x = polyb.pts_cache[i2]; + y = polyb.pts_cache[i21]; + polyb.pts_cache[i2] = layerb.layerToCanvas(x + b.x, y + b.y, true); + polyb.pts_cache[i21] = layerb.layerToCanvas(x + b.x, y + b.y, false); + } + polyb.update_bbox(); + return polya.intersects_poly(polyb, 0, 0); + } + }; + var tmpQuad = new cr.quad(); + var tmpRect = new cr.rect(0, 0, 0, 0); + var collrect_candidates = []; + Runtime.prototype.testTilemapOverlap = function (tm, a) + { + var i, len, c, rc; + var bbox = a.bbox; + var tmx = tm.x; + var tmy = tm.y; + tm.getCollisionRectCandidates(bbox, collrect_candidates); + var collrects = collrect_candidates; + var haspolya = (a.collision_poly && !a.collision_poly.is_empty()); + for (i = 0, len = collrects.length; i < len; ++i) + { + c = collrects[i]; + rc = c.rc; + if (bbox.intersects_rect_off(rc, tmx, tmy)) + { + tmpQuad.set_from_rect(rc); + tmpQuad.offset(tmx, tmy); + if (tmpQuad.intersects_quad(a.bquad)) + { + if (haspolya) + { + a.collision_poly.cache_poly(a.width, a.height, a.angle); + if (c.poly) + { + if (c.poly.intersects_poly(a.collision_poly, a.x - (tmx + rc.left), a.y - (tmy + rc.top))) + { + cr.clearArray(collrect_candidates); + return true; + } + } + else + { + this.temp_poly.set_from_quad(tmpQuad, 0, 0, rc.right - rc.left, rc.bottom - rc.top); + if (this.temp_poly.intersects_poly(a.collision_poly, a.x, a.y)) + { + cr.clearArray(collrect_candidates); + return true; + } + } + } + else + { + if (c.poly) + { + this.temp_poly.set_from_quad(a.bquad, 0, 0, a.width, a.height); + if (c.poly.intersects_poly(this.temp_poly, -(tmx + rc.left), -(tmy + rc.top))) + { + cr.clearArray(collrect_candidates); + return true; + } + } + else + { + cr.clearArray(collrect_candidates); + return true; + } + } + } + } + } + cr.clearArray(collrect_candidates); + return false; + }; + Runtime.prototype.testRectOverlap = function (r, b) + { + if (!b || !b.collisionsEnabled) + return false; + b.update_bbox(); + var layerb = b.layer; + var haspolyb, polyb; + if (!b.bbox.intersects_rect(r)) + return false; + if (b.tilemap_exists) + { + b.getCollisionRectCandidates(r, collrect_candidates); + var collrects = collrect_candidates; + var i, len, c, tilerc; + var tmx = b.x; + var tmy = b.y; + for (i = 0, len = collrects.length; i < len; ++i) + { + c = collrects[i]; + tilerc = c.rc; + if (r.intersects_rect_off(tilerc, tmx, tmy)) + { + if (c.poly) + { + this.temp_poly.set_from_rect(r, 0, 0); + if (c.poly.intersects_poly(this.temp_poly, -(tmx + tilerc.left), -(tmy + tilerc.top))) + { + cr.clearArray(collrect_candidates); + return true; + } + } + else + { + cr.clearArray(collrect_candidates); + return true; + } + } + } + cr.clearArray(collrect_candidates); + return false; + } + else + { + tmpQuad.set_from_rect(r); + if (!b.bquad.intersects_quad(tmpQuad)) + return false; + haspolyb = (b.collision_poly && !b.collision_poly.is_empty()); + if (!haspolyb) + return true; + b.collision_poly.cache_poly(b.width, b.height, b.angle); + tmpQuad.offset(-r.left, -r.top); + this.temp_poly.set_from_quad(tmpQuad, 0, 0, 1, 1); + return b.collision_poly.intersects_poly(this.temp_poly, r.left - b.x, r.top - b.y); + } + }; + Runtime.prototype.testSegmentOverlap = function (x1, y1, x2, y2, b) + { + if (!b || !b.collisionsEnabled) + return false; + b.update_bbox(); + var layerb = b.layer; + var haspolyb, polyb; + tmpRect.set(cr.min(x1, x2), cr.min(y1, y2), cr.max(x1, x2), cr.max(y1, y2)); + if (!b.bbox.intersects_rect(tmpRect)) + return false; + if (b.tilemap_exists) + { + b.getCollisionRectCandidates(tmpRect, collrect_candidates); + var collrects = collrect_candidates; + var i, len, c, tilerc; + var tmx = b.x; + var tmy = b.y; + for (i = 0, len = collrects.length; i < len; ++i) + { + c = collrects[i]; + tilerc = c.rc; + if (tmpRect.intersects_rect_off(tilerc, tmx, tmy)) + { + tmpQuad.set_from_rect(tilerc); + tmpQuad.offset(tmx, tmy); + if (tmpQuad.intersects_segment(x1, y1, x2, y2)) + { + if (c.poly) + { + if (c.poly.intersects_segment(tmx + tilerc.left, tmy + tilerc.top, x1, y1, x2, y2)) + { + cr.clearArray(collrect_candidates); + return true; + } + } + else + { + cr.clearArray(collrect_candidates); + return true; + } + } + } + } + cr.clearArray(collrect_candidates); + return false; + } + else + { + if (!b.bquad.intersects_segment(x1, y1, x2, y2)) + return false; + haspolyb = (b.collision_poly && !b.collision_poly.is_empty()); + if (!haspolyb) + return true; + b.collision_poly.cache_poly(b.width, b.height, b.angle); + return b.collision_poly.intersects_segment(b.x, b.y, x1, y1, x2, y2); + } + }; + Runtime.prototype.typeHasBehavior = function (t, b) + { + if (!b) + return false; + var i, len, j, lenj, f; + for (i = 0, len = t.behaviors.length; i < len; i++) + { + if (t.behaviors[i].behavior instanceof b) + return true; + } + if (!t.is_family) + { + for (i = 0, len = t.families.length; i < len; i++) + { + f = t.families[i]; + for (j = 0, lenj = f.behaviors.length; j < lenj; j++) + { + if (f.behaviors[j].behavior instanceof b) + return true; + } + } + } + return false; + }; + Runtime.prototype.typeHasNoSaveBehavior = function (t) + { + return this.typeHasBehavior(t, cr.behaviors.NoSave); + }; + Runtime.prototype.typeHasPersistBehavior = function (t) + { + return this.typeHasBehavior(t, cr.behaviors.Persist); + }; + Runtime.prototype.getSolidBehavior = function () + { + return this.solidBehavior; + }; + Runtime.prototype.getJumpthruBehavior = function () + { + return this.jumpthruBehavior; + }; + var candidates = []; + Runtime.prototype.testOverlapSolid = function (inst) + { + var i, len, s; + inst.update_bbox(); + this.getSolidCollisionCandidates(inst.layer, inst.bbox, candidates); + for (i = 0, len = candidates.length; i < len; ++i) + { + s = candidates[i]; + if (!s.extra["solidEnabled"]) + continue; + if (this.testOverlap(inst, s)) + { + cr.clearArray(candidates); + return s; + } + } + cr.clearArray(candidates); + return null; + }; + Runtime.prototype.testRectOverlapSolid = function (r) + { + var i, len, s; + this.getSolidCollisionCandidates(null, r, candidates); + for (i = 0, len = candidates.length; i < len; ++i) + { + s = candidates[i]; + if (!s.extra["solidEnabled"]) + continue; + if (this.testRectOverlap(r, s)) + { + cr.clearArray(candidates); + return s; + } + } + cr.clearArray(candidates); + return null; + }; + var jumpthru_array_ret = []; + Runtime.prototype.testOverlapJumpThru = function (inst, all) + { + var ret = null; + if (all) + { + ret = jumpthru_array_ret; + cr.clearArray(ret); + } + inst.update_bbox(); + this.getJumpthruCollisionCandidates(inst.layer, inst.bbox, candidates); + var i, len, j; + for (i = 0, len = candidates.length; i < len; ++i) + { + j = candidates[i]; + if (!j.extra["jumpthruEnabled"]) + continue; + if (this.testOverlap(inst, j)) + { + if (all) + ret.push(j); + else + { + cr.clearArray(candidates); + return j; + } + } + } + cr.clearArray(candidates); + return ret; + }; + Runtime.prototype.pushOutSolid = function (inst, xdir, ydir, dist, include_jumpthrus, specific_jumpthru) + { + var push_dist = dist || 50; + var oldx = inst.x + var oldy = inst.y; + var i; + var last_overlapped = null, secondlast_overlapped = null; + for (i = 0; i < push_dist; i++) + { + inst.x = (oldx + (xdir * i)); + inst.y = (oldy + (ydir * i)); + inst.set_bbox_changed(); + if (!this.testOverlap(inst, last_overlapped)) + { + last_overlapped = this.testOverlapSolid(inst); + if (last_overlapped) + secondlast_overlapped = last_overlapped; + if (!last_overlapped) + { + if (include_jumpthrus) + { + if (specific_jumpthru) + last_overlapped = (this.testOverlap(inst, specific_jumpthru) ? specific_jumpthru : null); + else + last_overlapped = this.testOverlapJumpThru(inst); + if (last_overlapped) + secondlast_overlapped = last_overlapped; + } + if (!last_overlapped) + { + if (secondlast_overlapped) + this.pushInFractional(inst, xdir, ydir, secondlast_overlapped, 16); + return true; + } + } + } + } + inst.x = oldx; + inst.y = oldy; + inst.set_bbox_changed(); + return false; + }; + Runtime.prototype.pushOut = function (inst, xdir, ydir, dist, otherinst) + { + var push_dist = dist || 50; + var oldx = inst.x + var oldy = inst.y; + var i; + for (i = 0; i < push_dist; i++) + { + inst.x = (oldx + (xdir * i)); + inst.y = (oldy + (ydir * i)); + inst.set_bbox_changed(); + if (!this.testOverlap(inst, otherinst)) + return true; + } + inst.x = oldx; + inst.y = oldy; + inst.set_bbox_changed(); + return false; + }; + Runtime.prototype.pushInFractional = function (inst, xdir, ydir, obj, limit) + { + var divisor = 2; + var frac; + var forward = false; + var overlapping = false; + var bestx = inst.x; + var besty = inst.y; + while (divisor <= limit) + { + frac = 1 / divisor; + divisor *= 2; + inst.x += xdir * frac * (forward ? 1 : -1); + inst.y += ydir * frac * (forward ? 1 : -1); + inst.set_bbox_changed(); + if (this.testOverlap(inst, obj)) + { + forward = true; + overlapping = true; + } + else + { + forward = false; + overlapping = false; + bestx = inst.x; + besty = inst.y; + } + } + if (overlapping) + { + inst.x = bestx; + inst.y = besty; + inst.set_bbox_changed(); + } + }; + Runtime.prototype.pushOutSolidNearest = function (inst, max_dist_) + { + var max_dist = (cr.is_undefined(max_dist_) ? 100 : max_dist_); + var dist = 0; + var oldx = inst.x + var oldy = inst.y; + var dir = 0; + var dx = 0, dy = 0; + var last_overlapped = this.testOverlapSolid(inst); + if (!last_overlapped) + return true; // already clear of solids + while (dist <= max_dist) + { + switch (dir) { + case 0: dx = 0; dy = -1; dist++; break; + case 1: dx = 1; dy = -1; break; + case 2: dx = 1; dy = 0; break; + case 3: dx = 1; dy = 1; break; + case 4: dx = 0; dy = 1; break; + case 5: dx = -1; dy = 1; break; + case 6: dx = -1; dy = 0; break; + case 7: dx = -1; dy = -1; break; + } + dir = (dir + 1) % 8; + inst.x = cr.floor(oldx + (dx * dist)); + inst.y = cr.floor(oldy + (dy * dist)); + inst.set_bbox_changed(); + if (!this.testOverlap(inst, last_overlapped)) + { + last_overlapped = this.testOverlapSolid(inst); + if (!last_overlapped) + return true; + } + } + inst.x = oldx; + inst.y = oldy; + inst.set_bbox_changed(); + return false; + }; + Runtime.prototype.registerCollision = function (a, b) + { + if (!a.collisionsEnabled || !b.collisionsEnabled) + return; + this.registered_collisions.push([a, b]); + }; + Runtime.prototype.checkRegisteredCollision = function (a, b) + { + var i, len, x; + for (i = 0, len = this.registered_collisions.length; i < len; i++) + { + x = this.registered_collisions[i]; + if ((x[0] == a && x[1] == b) || (x[0] == b && x[1] == a)) + return true; + } + return false; + }; + Runtime.prototype.calculateSolidBounceAngle = function(inst, startx, starty, obj) + { + var objx = inst.x; + var objy = inst.y; + var radius = cr.max(10, cr.distanceTo(startx, starty, objx, objy)); + var startangle = cr.angleTo(startx, starty, objx, objy); + var firstsolid = obj || this.testOverlapSolid(inst); + if (!firstsolid) + return cr.clamp_angle(startangle + cr.PI); + var cursolid = firstsolid; + var i, curangle, anticlockwise_free_angle, clockwise_free_angle; + var increment = cr.to_radians(5); // 5 degree increments + for (i = 1; i < 36; i++) + { + curangle = startangle - i * increment; + inst.x = startx + Math.cos(curangle) * radius; + inst.y = starty + Math.sin(curangle) * radius; + inst.set_bbox_changed(); + if (!this.testOverlap(inst, cursolid)) + { + cursolid = obj ? null : this.testOverlapSolid(inst); + if (!cursolid) + { + anticlockwise_free_angle = curangle; + break; + } + } + } + if (i === 36) + anticlockwise_free_angle = cr.clamp_angle(startangle + cr.PI); + var cursolid = firstsolid; + for (i = 1; i < 36; i++) + { + curangle = startangle + i * increment; + inst.x = startx + Math.cos(curangle) * radius; + inst.y = starty + Math.sin(curangle) * radius; + inst.set_bbox_changed(); + if (!this.testOverlap(inst, cursolid)) + { + cursolid = obj ? null : this.testOverlapSolid(inst); + if (!cursolid) + { + clockwise_free_angle = curangle; + break; + } + } + } + if (i === 36) + clockwise_free_angle = cr.clamp_angle(startangle + cr.PI); + inst.x = objx; + inst.y = objy; + inst.set_bbox_changed(); + if (clockwise_free_angle === anticlockwise_free_angle) + return clockwise_free_angle; + var half_diff = cr.angleDiff(clockwise_free_angle, anticlockwise_free_angle) / 2; + var normal; + if (cr.angleClockwise(clockwise_free_angle, anticlockwise_free_angle)) + { + normal = cr.clamp_angle(anticlockwise_free_angle + half_diff + cr.PI); + } + else + { + normal = cr.clamp_angle(clockwise_free_angle + half_diff); + } +; + var vx = Math.cos(startangle); + var vy = Math.sin(startangle); + var nx = Math.cos(normal); + var ny = Math.sin(normal); + var v_dot_n = vx * nx + vy * ny; + var rx = vx - 2 * v_dot_n * nx; + var ry = vy - 2 * v_dot_n * ny; + return cr.angleTo(0, 0, rx, ry); + }; + var triggerSheetIndex = -1; + Runtime.prototype.trigger = function (method, inst, value /* for fast triggers */) + { +; + if (!this.running_layout) + return false; + var sheet = this.running_layout.event_sheet; + if (!sheet) + return false; // no event sheet active; nothing to trigger + var ret = false; + var r, i, len; + triggerSheetIndex++; + var deep_includes = sheet.deep_includes; + for (i = 0, len = deep_includes.length; i < len; ++i) + { + r = this.triggerOnSheet(method, inst, deep_includes[i], value); + ret = ret || r; + } + r = this.triggerOnSheet(method, inst, sheet, value); + ret = ret || r; + triggerSheetIndex--; + return ret; + }; + Runtime.prototype.triggerOnSheet = function (method, inst, sheet, value) + { + var ret = false; + var i, leni, r, families; + if (!inst) + { + r = this.triggerOnSheetForTypeName(method, inst, "system", sheet, value); + ret = ret || r; + } + else + { + r = this.triggerOnSheetForTypeName(method, inst, inst.type.name, sheet, value); + ret = ret || r; + families = inst.type.families; + for (i = 0, leni = families.length; i < leni; ++i) + { + r = this.triggerOnSheetForTypeName(method, inst, families[i].name, sheet, value); + ret = ret || r; + } + } + return ret; // true if anything got triggered + }; + Runtime.prototype.triggerOnSheetForTypeName = function (method, inst, type_name, sheet, value) + { + var i, leni; + var ret = false, ret2 = false; + var trig, index; + var fasttrigger = (typeof value !== "undefined"); + var triggers = (fasttrigger ? sheet.fasttriggers : sheet.triggers); + var obj_entry = triggers[type_name]; + if (!obj_entry) + return ret; + var triggers_list = null; + for (i = 0, leni = obj_entry.length; i < leni; ++i) + { + if (obj_entry[i].method == method) + { + triggers_list = obj_entry[i].evs; + break; + } + } + if (!triggers_list) + return ret; + var triggers_to_fire; + if (fasttrigger) + { + triggers_to_fire = triggers_list[value]; + } + else + { + triggers_to_fire = triggers_list; + } + if (!triggers_to_fire) + return null; + for (i = 0, leni = triggers_to_fire.length; i < leni; i++) + { + trig = triggers_to_fire[i][0]; + index = triggers_to_fire[i][1]; + ret2 = this.executeSingleTrigger(inst, type_name, trig, index); + ret = ret || ret2; + } + return ret; + }; + Runtime.prototype.executeSingleTrigger = function (inst, type_name, trig, index) + { + var i, leni; + var ret = false; + this.trigger_depth++; + var current_event = this.getCurrentEventStack().current_event; + if (current_event) + this.pushCleanSol(current_event.solModifiersIncludingParents); + var isrecursive = (this.trigger_depth > 1); // calling trigger from inside another trigger + this.pushCleanSol(trig.solModifiersIncludingParents); + if (isrecursive) + this.pushLocalVarStack(); + var event_stack = this.pushEventStack(trig); + event_stack.current_event = trig; + if (inst) + { + var sol = this.types[type_name].getCurrentSol(); + sol.select_all = false; + cr.clearArray(sol.instances); + sol.instances[0] = inst; + this.types[type_name].applySolToContainer(); + } + var ok_to_run = true; + if (trig.parent) + { + var temp_parents_arr = event_stack.temp_parents_arr; + var cur_parent = trig.parent; + while (cur_parent) + { + temp_parents_arr.push(cur_parent); + cur_parent = cur_parent.parent; + } + temp_parents_arr.reverse(); + for (i = 0, leni = temp_parents_arr.length; i < leni; i++) + { + if (!temp_parents_arr[i].run_pretrigger()) // parent event failed + { + ok_to_run = false; + break; + } + } + } + if (ok_to_run) + { + this.execcount++; + if (trig.orblock) + trig.run_orblocktrigger(index); + else + trig.run(); + ret = ret || event_stack.last_event_true; + } + this.popEventStack(); + if (isrecursive) + this.popLocalVarStack(); + this.popSol(trig.solModifiersIncludingParents); + if (current_event) + this.popSol(current_event.solModifiersIncludingParents); + if (this.hasPendingInstances && this.isInOnDestroy === 0 && triggerSheetIndex === 0 && !this.isRunningEvents) + { + this.ClearDeathRow(); + } + this.trigger_depth--; + return ret; + }; + Runtime.prototype.getCurrentCondition = function () + { + var evinfo = this.getCurrentEventStack(); + return evinfo.current_event.conditions[evinfo.cndindex]; + }; + Runtime.prototype.getCurrentConditionObjectType = function () + { + var cnd = this.getCurrentCondition(); + return cnd.type; + }; + Runtime.prototype.isCurrentConditionFirst = function () + { + var evinfo = this.getCurrentEventStack(); + return evinfo.cndindex === 0; + }; + Runtime.prototype.getCurrentAction = function () + { + var evinfo = this.getCurrentEventStack(); + return evinfo.current_event.actions[evinfo.actindex]; + }; + Runtime.prototype.pushLocalVarStack = function () + { + this.localvar_stack_index++; + if (this.localvar_stack_index >= this.localvar_stack.length) + this.localvar_stack.push([]); + }; + Runtime.prototype.popLocalVarStack = function () + { +; + this.localvar_stack_index--; + }; + Runtime.prototype.getCurrentLocalVarStack = function () + { + return this.localvar_stack[this.localvar_stack_index]; + }; + Runtime.prototype.pushEventStack = function (cur_event) + { + this.event_stack_index++; + if (this.event_stack_index >= this.event_stack.length) + this.event_stack.push(new cr.eventStackFrame()); + var ret = this.getCurrentEventStack(); + ret.reset(cur_event); + return ret; + }; + Runtime.prototype.popEventStack = function () + { +; + this.event_stack_index--; + }; + Runtime.prototype.getCurrentEventStack = function () + { + return this.event_stack[this.event_stack_index]; + }; + Runtime.prototype.pushLoopStack = function (name_) + { + this.loop_stack_index++; + if (this.loop_stack_index >= this.loop_stack.length) + { + this.loop_stack.push(cr.seal({ name: name_, index: 0, stopped: false })); + } + var ret = this.getCurrentLoop(); + ret.name = name_; + ret.index = 0; + ret.stopped = false; + return ret; + }; + Runtime.prototype.popLoopStack = function () + { +; + this.loop_stack_index--; + }; + Runtime.prototype.getCurrentLoop = function () + { + return this.loop_stack[this.loop_stack_index]; + }; + Runtime.prototype.getEventVariableByName = function (name, scope) + { + var i, leni, j, lenj, sheet, e; + while (scope) + { + for (i = 0, leni = scope.subevents.length; i < leni; i++) + { + e = scope.subevents[i]; + if (e instanceof cr.eventvariable && cr.equals_nocase(name, e.name)) + return e; + } + scope = scope.parent; + } + for (i = 0, leni = this.eventsheets_by_index.length; i < leni; i++) + { + sheet = this.eventsheets_by_index[i]; + for (j = 0, lenj = sheet.events.length; j < lenj; j++) + { + e = sheet.events[j]; + if (e instanceof cr.eventvariable && cr.equals_nocase(name, e.name)) + return e; + } + } + return null; + }; + Runtime.prototype.getLayoutBySid = function (sid_) + { + var i, len; + for (i = 0, len = this.layouts_by_index.length; i < len; i++) + { + if (this.layouts_by_index[i].sid === sid_) + return this.layouts_by_index[i]; + } + return null; + }; + Runtime.prototype.getObjectTypeBySid = function (sid_) + { + var i, len; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + if (this.types_by_index[i].sid === sid_) + return this.types_by_index[i]; + } + return null; + }; + Runtime.prototype.getGroupBySid = function (sid_) + { + var i, len; + for (i = 0, len = this.allGroups.length; i < len; i++) + { + if (this.allGroups[i].sid === sid_) + return this.allGroups[i]; + } + return null; + }; + Runtime.prototype.doCanvasSnapshot = function (format_, quality_) + { + this.snapshotCanvas = [format_, quality_]; + this.redraw = true; // force redraw so snapshot is always taken + }; + function IsIndexedDBAvailable() + { + try { + return !!window.indexedDB; + } + catch (e) + { + return false; + } + }; + function makeSaveDb(e) + { + var db = e.target.result; + db.createObjectStore("saves", { keyPath: "slot" }); + }; + function IndexedDB_WriteSlot(slot_, data_, oncomplete_, onerror_) + { + try { + var request = indexedDB.open("_C2SaveStates"); + request.onupgradeneeded = makeSaveDb; + request.onerror = onerror_; + request.onsuccess = function (e) + { + var db = e.target.result; + db.onerror = onerror_; + var transaction = db.transaction(["saves"], "readwrite"); + var objectStore = transaction.objectStore("saves"); + var putReq = objectStore.put({"slot": slot_, "data": data_ }); + putReq.onsuccess = oncomplete_; + }; + } + catch (err) + { + onerror_(err); + } + }; + function IndexedDB_ReadSlot(slot_, oncomplete_, onerror_) + { + try { + var request = indexedDB.open("_C2SaveStates"); + request.onupgradeneeded = makeSaveDb; + request.onerror = onerror_; + request.onsuccess = function (e) + { + var db = e.target.result; + db.onerror = onerror_; + var transaction = db.transaction(["saves"]); + var objectStore = transaction.objectStore("saves"); + var readReq = objectStore.get(slot_); + readReq.onsuccess = function (e) + { + if (readReq.result) + oncomplete_(readReq.result["data"]); + else + oncomplete_(null); + }; + }; + } + catch (err) + { + onerror_(err); + } + }; + Runtime.prototype.signalContinuousPreview = function () + { + this.signalledContinuousPreview = true; + }; + function doContinuousPreviewReload() + { + cr.logexport("Reloading for continuous preview"); + if (!!window["c2cocoonjs"]) + { + CocoonJS["App"]["reload"](); + } + else + { + if (window.location.search.indexOf("continuous") > -1) + window.location.reload(true); + else + window.location = window.location + "?continuous"; + } + }; + Runtime.prototype.handleSaveLoad = function () + { + var self = this; + var savingToSlot = this.saveToSlot; + var savingJson = this.lastSaveJson; + var loadingFromSlot = this.loadFromSlot; + var continuous = false; + if (this.signalledContinuousPreview) + { + continuous = true; + savingToSlot = "__c2_continuouspreview"; + this.signalledContinuousPreview = false; + } + if (savingToSlot.length) + { + this.ClearDeathRow(); + savingJson = this.saveToJSONString(); + if (IsIndexedDBAvailable() && !this.isCocoonJs) + { + IndexedDB_WriteSlot(savingToSlot, savingJson, function () + { + cr.logexport("Saved state to IndexedDB storage (" + savingJson.length + " bytes)"); + self.lastSaveJson = savingJson; + self.trigger(cr.system_object.prototype.cnds.OnSaveComplete, null); + self.lastSaveJson = ""; + if (continuous) + doContinuousPreviewReload(); + }, function (e) + { + try { + localStorage.setItem("__c2save_" + savingToSlot, savingJson); + cr.logexport("Saved state to WebStorage (" + savingJson.length + " bytes)"); + self.lastSaveJson = savingJson; + self.trigger(cr.system_object.prototype.cnds.OnSaveComplete, null); + self.lastSaveJson = ""; + if (continuous) + doContinuousPreviewReload(); + } + catch (f) + { + cr.logexport("Failed to save game state: " + e + "; " + f); + self.trigger(cr.system_object.prototype.cnds.OnSaveFailed, null); + } + }); + } + else + { + try { + localStorage.setItem("__c2save_" + savingToSlot, savingJson); + cr.logexport("Saved state to WebStorage (" + savingJson.length + " bytes)"); + self.lastSaveJson = savingJson; + this.trigger(cr.system_object.prototype.cnds.OnSaveComplete, null); + self.lastSaveJson = ""; + if (continuous) + doContinuousPreviewReload(); + } + catch (e) + { + cr.logexport("Error saving to WebStorage: " + e); + self.trigger(cr.system_object.prototype.cnds.OnSaveFailed, null); + } + } + this.saveToSlot = ""; + this.loadFromSlot = ""; + this.loadFromJson = null; + } + if (loadingFromSlot.length) + { + if (IsIndexedDBAvailable() && !this.isCocoonJs) + { + IndexedDB_ReadSlot(loadingFromSlot, function (result_) + { + if (result_) + { + self.loadFromJson = result_; + cr.logexport("Loaded state from IndexedDB storage (" + self.loadFromJson.length + " bytes)"); + } + else + { + self.loadFromJson = localStorage.getItem("__c2save_" + loadingFromSlot) || ""; + cr.logexport("Loaded state from WebStorage (" + self.loadFromJson.length + " bytes)"); + } + self.suspendDrawing = false; + if (!self.loadFromJson) + { + self.loadFromJson = null; + self.trigger(cr.system_object.prototype.cnds.OnLoadFailed, null); + } + }, function (e) + { + self.loadFromJson = localStorage.getItem("__c2save_" + loadingFromSlot) || ""; + cr.logexport("Loaded state from WebStorage (" + self.loadFromJson.length + " bytes)"); + self.suspendDrawing = false; + if (!self.loadFromJson) + { + self.loadFromJson = null; + self.trigger(cr.system_object.prototype.cnds.OnLoadFailed, null); + } + }); + } + else + { + try { + this.loadFromJson = localStorage.getItem("__c2save_" + loadingFromSlot) || ""; + cr.logexport("Loaded state from WebStorage (" + this.loadFromJson.length + " bytes)"); + } + catch (e) + { + this.loadFromJson = null; + } + this.suspendDrawing = false; + if (!self.loadFromJson) + { + self.loadFromJson = null; + self.trigger(cr.system_object.prototype.cnds.OnLoadFailed, null); + } + } + this.loadFromSlot = ""; + this.saveToSlot = ""; + } + if (this.loadFromJson !== null) + { + this.ClearDeathRow(); + var ok = this.loadFromJSONString(this.loadFromJson); + if (ok) + { + this.lastSaveJson = this.loadFromJson; + this.trigger(cr.system_object.prototype.cnds.OnLoadComplete, null); + this.lastSaveJson = ""; + } + else + { + self.trigger(cr.system_object.prototype.cnds.OnLoadFailed, null); + } + this.loadFromJson = null; + } + }; + function CopyExtraObject(extra) + { + var p, ret = {}; + for (p in extra) + { + if (extra.hasOwnProperty(p)) + { + if (extra[p] instanceof cr.ObjectSet) + continue; + if (extra[p] && typeof extra[p].c2userdata !== "undefined") + continue; + if (p === "spriteCreatedDestroyCallback") + continue; + ret[p] = extra[p]; + } + } + return ret; + }; + Runtime.prototype.saveToJSONString = function() + { + var i, len, j, lenj, type, layout, typeobj, g, c, a, v, p; + var o = { + "c2save": true, + "version": 1, + "rt": { + "time": this.kahanTime.sum, + "walltime": this.wallTime.sum, + "timescale": this.timescale, + "tickcount": this.tickcount, + "execcount": this.execcount, + "next_uid": this.next_uid, + "running_layout": this.running_layout.sid, + "start_time_offset": (Date.now() - this.start_time) + }, + "types": {}, + "layouts": {}, + "events": { + "groups": {}, + "cnds": {}, + "acts": {}, + "vars": {} + } + }; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + type = this.types_by_index[i]; + if (type.is_family || this.typeHasNoSaveBehavior(type)) + continue; + typeobj = { + "instances": [] + }; + if (cr.hasAnyOwnProperty(type.extra)) + typeobj["ex"] = CopyExtraObject(type.extra); + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + typeobj["instances"].push(this.saveInstanceToJSON(type.instances[j])); + } + o["types"][type.sid.toString()] = typeobj; + } + for (i = 0, len = this.layouts_by_index.length; i < len; i++) + { + layout = this.layouts_by_index[i]; + o["layouts"][layout.sid.toString()] = layout.saveToJSON(); + } + var ogroups = o["events"]["groups"]; + for (i = 0, len = this.allGroups.length; i < len; i++) + { + g = this.allGroups[i]; + ogroups[g.sid.toString()] = this.groups_by_name[g.group_name].group_active; + } + var ocnds = o["events"]["cnds"]; + for (p in this.cndsBySid) + { + if (this.cndsBySid.hasOwnProperty(p)) + { + c = this.cndsBySid[p]; + if (cr.hasAnyOwnProperty(c.extra)) + ocnds[p] = { "ex": CopyExtraObject(c.extra) }; + } + } + var oacts = o["events"]["acts"]; + for (p in this.actsBySid) + { + if (this.actsBySid.hasOwnProperty(p)) + { + a = this.actsBySid[p]; + if (cr.hasAnyOwnProperty(a.extra)) + oacts[p] = { "ex": CopyExtraObject(a.extra) }; + } + } + var ovars = o["events"]["vars"]; + for (p in this.varsBySid) + { + if (this.varsBySid.hasOwnProperty(p)) + { + v = this.varsBySid[p]; + if (!v.is_constant && (!v.parent || v.is_static)) + ovars[p] = v.data; + } + } + o["system"] = this.system.saveToJSON(); + return JSON.stringify(o); + }; + Runtime.prototype.refreshUidMap = function () + { + var i, len, type, j, lenj, inst; + this.objectsByUid = {}; + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + type = this.types_by_index[i]; + if (type.is_family) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + this.objectsByUid[inst.uid.toString()] = inst; + } + } + }; + Runtime.prototype.loadFromJSONString = function (str) + { + var o; + try { + o = JSON.parse(str); + } + catch (e) { + return false; + } + if (!o["c2save"]) + return false; // probably not a c2 save state + if (o["version"] > 1) + return false; // from future version of c2; assume not compatible + this.isLoadingState = true; + var rt = o["rt"]; + this.kahanTime.reset(); + this.kahanTime.sum = rt["time"]; + this.wallTime.reset(); + this.wallTime.sum = rt["walltime"] || 0; + this.timescale = rt["timescale"]; + this.tickcount = rt["tickcount"]; + this.execcount = rt["execcount"]; + this.start_time = Date.now() - rt["start_time_offset"]; + var layout_sid = rt["running_layout"]; + if (layout_sid !== this.running_layout.sid) + { + var changeToLayout = this.getLayoutBySid(layout_sid); + if (changeToLayout) + this.doChangeLayout(changeToLayout); + else + return; // layout that was saved on has gone missing (deleted?) + } + var i, len, j, lenj, k, lenk, p, type, existing_insts, load_insts, inst, binst, layout, layer, g, iid, t; + var otypes = o["types"]; + for (p in otypes) + { + if (otypes.hasOwnProperty(p)) + { + type = this.getObjectTypeBySid(parseInt(p, 10)); + if (!type || type.is_family || this.typeHasNoSaveBehavior(type)) + continue; + if (otypes[p]["ex"]) + type.extra = otypes[p]["ex"]; + else + cr.wipe(type.extra); + existing_insts = type.instances; + load_insts = otypes[p]["instances"]; + for (i = 0, len = cr.min(existing_insts.length, load_insts.length); i < len; i++) + { + this.loadInstanceFromJSON(existing_insts[i], load_insts[i]); + } + for (i = load_insts.length, len = existing_insts.length; i < len; i++) + this.DestroyInstance(existing_insts[i]); + for (i = existing_insts.length, len = load_insts.length; i < len; i++) + { + layer = null; + if (type.plugin.is_world) + { + layer = this.running_layout.getLayerBySid(load_insts[i]["w"]["l"]); + if (!layer) + continue; + } + inst = this.createInstanceFromInit(type.default_instance, layer, false, 0, 0, true); + this.loadInstanceFromJSON(inst, load_insts[i]); + } + type.stale_iids = true; + } + } + this.ClearDeathRow(); + this.refreshUidMap(); + var olayouts = o["layouts"]; + for (p in olayouts) + { + if (olayouts.hasOwnProperty(p)) + { + layout = this.getLayoutBySid(parseInt(p, 10)); + if (!layout) + continue; // must've gone missing + layout.loadFromJSON(olayouts[p]); + } + } + var ogroups = o["events"]["groups"]; + for (p in ogroups) + { + if (ogroups.hasOwnProperty(p)) + { + g = this.getGroupBySid(parseInt(p, 10)); + if (g && this.groups_by_name[g.group_name]) + this.groups_by_name[g.group_name].setGroupActive(ogroups[p]); + } + } + var ocnds = o["events"]["cnds"]; + for (p in this.cndsBySid) + { + if (this.cndsBySid.hasOwnProperty(p)) + { + if (ocnds.hasOwnProperty(p)) + { + this.cndsBySid[p].extra = ocnds[p]["ex"]; + } + else + { + this.cndsBySid[p].extra = {}; + } + } + } + var oacts = o["events"]["acts"]; + for (p in this.actsBySid) + { + if (this.actsBySid.hasOwnProperty(p)) + { + if (oacts.hasOwnProperty(p)) + { + this.actsBySid[p].extra = oacts[p]["ex"]; + } + else + { + this.actsBySid[p].extra = {}; + } + } + } + var ovars = o["events"]["vars"]; + for (p in ovars) + { + if (ovars.hasOwnProperty(p) && this.varsBySid.hasOwnProperty(p)) + { + this.varsBySid[p].data = ovars[p]; + } + } + this.next_uid = rt["next_uid"]; + this.isLoadingState = false; + for (i = 0, len = this.fireOnCreateAfterLoad.length; i < len; ++i) + { + inst = this.fireOnCreateAfterLoad[i]; + this.trigger(Object.getPrototypeOf(inst.type.plugin).cnds.OnCreated, inst); + } + cr.clearArray(this.fireOnCreateAfterLoad); + this.system.loadFromJSON(o["system"]); + for (i = 0, len = this.types_by_index.length; i < len; i++) + { + type = this.types_by_index[i]; + if (type.is_family || this.typeHasNoSaveBehavior(type)) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + { + inst = type.instances[j]; + if (type.is_contained) + { + iid = inst.get_iid(); + cr.clearArray(inst.siblings); + for (k = 0, lenk = type.container.length; k < lenk; k++) + { + t = type.container[k]; + if (type === t) + continue; +; + inst.siblings.push(t.instances[iid]); + } + } + if (inst.afterLoad) + inst.afterLoad(); + if (inst.behavior_insts) + { + for (k = 0, lenk = inst.behavior_insts.length; k < lenk; k++) + { + binst = inst.behavior_insts[k]; + if (binst.afterLoad) + binst.afterLoad(); + } + } + } + } + this.redraw = true; + return true; + }; + Runtime.prototype.saveInstanceToJSON = function(inst, state_only) + { + var i, len, world, behinst, et; + var type = inst.type; + var plugin = type.plugin; + var o = {}; + if (state_only) + o["c2"] = true; // mark as known json data from Construct 2 + else + o["uid"] = inst.uid; + if (cr.hasAnyOwnProperty(inst.extra)) + o["ex"] = CopyExtraObject(inst.extra); + if (inst.instance_vars && inst.instance_vars.length) + { + o["ivs"] = {}; + for (i = 0, len = inst.instance_vars.length; i < len; i++) + { + o["ivs"][inst.type.instvar_sids[i].toString()] = inst.instance_vars[i]; + } + } + if (plugin.is_world) + { + world = { + "x": inst.x, + "y": inst.y, + "w": inst.width, + "h": inst.height, + "l": inst.layer.sid, + "zi": inst.get_zindex() + }; + if (inst.angle !== 0) + world["a"] = inst.angle; + if (inst.opacity !== 1) + world["o"] = inst.opacity; + if (inst.hotspotX !== 0.5) + world["hX"] = inst.hotspotX; + if (inst.hotspotY !== 0.5) + world["hY"] = inst.hotspotY; + if (inst.blend_mode !== 0) + world["bm"] = inst.blend_mode; + if (!inst.visible) + world["v"] = inst.visible; + if (!inst.collisionsEnabled) + world["ce"] = inst.collisionsEnabled; + if (inst.my_timescale !== -1) + world["mts"] = inst.my_timescale; + if (type.effect_types.length) + { + world["fx"] = []; + for (i = 0, len = type.effect_types.length; i < len; i++) + { + et = type.effect_types[i]; + world["fx"].push({"name": et.name, + "active": inst.active_effect_flags[et.index], + "params": inst.effect_params[et.index] }); + } + } + o["w"] = world; + } + if (inst.behavior_insts && inst.behavior_insts.length) + { + o["behs"] = {}; + for (i = 0, len = inst.behavior_insts.length; i < len; i++) + { + behinst = inst.behavior_insts[i]; + if (behinst.saveToJSON) + o["behs"][behinst.type.sid.toString()] = behinst.saveToJSON(); + } + } + if (inst.saveToJSON) + o["data"] = inst.saveToJSON(); + return o; + }; + Runtime.prototype.getInstanceVarIndexBySid = function (type, sid_) + { + var i, len; + for (i = 0, len = type.instvar_sids.length; i < len; i++) + { + if (type.instvar_sids[i] === sid_) + return i; + } + return -1; + }; + Runtime.prototype.getBehaviorIndexBySid = function (inst, sid_) + { + var i, len; + for (i = 0, len = inst.behavior_insts.length; i < len; i++) + { + if (inst.behavior_insts[i].type.sid === sid_) + return i; + } + return -1; + }; + Runtime.prototype.loadInstanceFromJSON = function(inst, o, state_only) + { + var p, i, len, iv, oivs, world, fxindex, obehs, behindex; + var oldlayer; + var type = inst.type; + var plugin = type.plugin; + if (state_only) + { + if (!o["c2"]) + return; + } + else + inst.uid = o["uid"]; + if (o["ex"]) + inst.extra = o["ex"]; + else + cr.wipe(inst.extra); + oivs = o["ivs"]; + if (oivs) + { + for (p in oivs) + { + if (oivs.hasOwnProperty(p)) + { + iv = this.getInstanceVarIndexBySid(type, parseInt(p, 10)); + if (iv < 0 || iv >= inst.instance_vars.length) + continue; // must've gone missing + inst.instance_vars[iv] = oivs[p]; + } + } + } + if (plugin.is_world) + { + world = o["w"]; + if (inst.layer.sid !== world["l"]) + { + oldlayer = inst.layer; + inst.layer = this.running_layout.getLayerBySid(world["l"]); + if (inst.layer) + { + oldlayer.removeFromInstanceList(inst, true); + inst.layer.appendToInstanceList(inst, true); + inst.set_bbox_changed(); + inst.layer.setZIndicesStaleFrom(0); + } + else + { + inst.layer = oldlayer; + if (!state_only) + this.DestroyInstance(inst); + } + } + inst.x = world["x"]; + inst.y = world["y"]; + inst.width = world["w"]; + inst.height = world["h"]; + inst.zindex = world["zi"]; + inst.angle = world.hasOwnProperty("a") ? world["a"] : 0; + inst.opacity = world.hasOwnProperty("o") ? world["o"] : 1; + inst.hotspotX = world.hasOwnProperty("hX") ? world["hX"] : 0.5; + inst.hotspotY = world.hasOwnProperty("hY") ? world["hY"] : 0.5; + inst.visible = world.hasOwnProperty("v") ? world["v"] : true; + inst.collisionsEnabled = world.hasOwnProperty("ce") ? world["ce"] : true; + inst.my_timescale = world.hasOwnProperty("mts") ? world["mts"] : -1; + inst.blend_mode = world.hasOwnProperty("bm") ? world["bm"] : 0;; + inst.compositeOp = cr.effectToCompositeOp(inst.blend_mode); + if (this.gl) + cr.setGLBlend(inst, inst.blend_mode, this.gl); + inst.set_bbox_changed(); + if (world.hasOwnProperty("fx")) + { + for (i = 0, len = world["fx"].length; i < len; i++) + { + fxindex = type.getEffectIndexByName(world["fx"][i]["name"]); + if (fxindex < 0) + continue; // must've gone missing + inst.active_effect_flags[fxindex] = world["fx"][i]["active"]; + inst.effect_params[fxindex] = world["fx"][i]["params"]; + } + } + inst.updateActiveEffects(); + } + obehs = o["behs"]; + if (obehs) + { + for (p in obehs) + { + if (obehs.hasOwnProperty(p)) + { + behindex = this.getBehaviorIndexBySid(inst, parseInt(p, 10)); + if (behindex < 0) + continue; // must've gone missing + inst.behavior_insts[behindex].loadFromJSON(obehs[p]); + } + } + } + if (o["data"]) + inst.loadFromJSON(o["data"]); + }; + Runtime.prototype.fetchLocalFileViaCordova = function (filename, successCallback, errorCallback) + { + var path = cordova["file"]["applicationDirectory"] + "www/" + filename; + window["resolveLocalFileSystemURL"](path, function (entry) + { + entry.file(successCallback, errorCallback); + }, errorCallback); + }; + Runtime.prototype.fetchLocalFileViaCordovaAsText = function (filename, successCallback, errorCallback) + { + this.fetchLocalFileViaCordova(filename, function (file) + { + var reader = new FileReader(); + reader.onload = function (e) + { + successCallback(e.target.result); + }; + reader.onerror = errorCallback; + reader.readAsText(file); + }, errorCallback); + }; + var queuedArrayBufferReads = []; + var activeArrayBufferReads = 0; + var MAX_ARRAYBUFFER_READS = 8; + Runtime.prototype.maybeStartNextArrayBufferRead = function() + { + if (!queuedArrayBufferReads.length) + return; // none left + if (activeArrayBufferReads >= MAX_ARRAYBUFFER_READS) + return; // already got maximum number in-flight + activeArrayBufferReads++; + var job = queuedArrayBufferReads.shift(); + this.doFetchLocalFileViaCordovaAsArrayBuffer(job.filename, job.successCallback, job.errorCallback); + }; + Runtime.prototype.fetchLocalFileViaCordovaAsArrayBuffer = function (filename, successCallback_, errorCallback_) + { + var self = this; + queuedArrayBufferReads.push({ + filename: filename, + successCallback: function (result) + { + activeArrayBufferReads--; + self.maybeStartNextArrayBufferRead(); + successCallback_(result); + }, + errorCallback: function (err) + { + activeArrayBufferReads--; + self.maybeStartNextArrayBufferRead(); + errorCallback_(err); + } + }); + this.maybeStartNextArrayBufferRead(); + }; + Runtime.prototype.doFetchLocalFileViaCordovaAsArrayBuffer = function (filename, successCallback, errorCallback) + { + this.fetchLocalFileViaCordova(filename, function (file) + { + var reader = new FileReader(); + reader.onload = function (e) + { + successCallback(e.target.result); + }; + reader.readAsArrayBuffer(file); + }, errorCallback); + }; + Runtime.prototype.fetchLocalFileViaCordovaAsURL = function (filename, successCallback, errorCallback) + { + this.fetchLocalFileViaCordovaAsArrayBuffer(filename, function (arrayBuffer) + { + var blob = new Blob([arrayBuffer]); + var url = URL.createObjectURL(blob); + successCallback(url); + }, errorCallback); + }; + Runtime.prototype.isAbsoluteUrl = function (url) + { + return /^(?:[a-z]+:)?\/\//.test(url) || url.substr(0, 5) === "data:" || url.substr(0, 5) === "blob:"; + }; + Runtime.prototype.setImageSrc = function (img, src) + { + if (this.isWKWebView && !this.isAbsoluteUrl(src)) + { + this.fetchLocalFileViaCordovaAsURL(src, function (url) + { + img.src = url; + }, function (err) + { + alert("Failed to load image: " + err); + }); + } + else + { + img.src = src; + } + }; + Runtime.prototype.setCtxImageSmoothingEnabled = function (ctx, e) + { + if (typeof ctx["imageSmoothingEnabled"] !== "undefined") + { + ctx["imageSmoothingEnabled"] = e; + } + else + { + ctx["webkitImageSmoothingEnabled"] = e; + ctx["mozImageSmoothingEnabled"] = e; + ctx["msImageSmoothingEnabled"] = e; + } + }; + cr.runtime = Runtime; + cr.createRuntime = function (canvasid) + { + return new Runtime(document.getElementById(canvasid)); + }; + cr.createDCRuntime = function (w, h) + { + return new Runtime({ "dc": true, "width": w, "height": h }); + }; + window["cr_createRuntime"] = cr.createRuntime; + window["cr_createDCRuntime"] = cr.createDCRuntime; + window["createCocoonJSRuntime"] = function () + { + window["c2cocoonjs"] = true; + var canvas = document.createElement("screencanvas") || document.createElement("canvas"); + canvas.screencanvas = true; + document.body.appendChild(canvas); + var rt = new Runtime(canvas); + window["c2runtime"] = rt; + window.addEventListener("orientationchange", function () { + window["c2runtime"]["setSize"](window.innerWidth, window.innerHeight); + }); + window["c2runtime"]["setSize"](window.innerWidth, window.innerHeight); + return rt; + }; + window["createEjectaRuntime"] = function () + { + var canvas = document.getElementById("canvas"); + var rt = new Runtime(canvas); + window["c2runtime"] = rt; + window["c2runtime"]["setSize"](window.innerWidth, window.innerHeight); + return rt; + }; +}()); +window["cr_getC2Runtime"] = function() +{ + var canvas = document.getElementById("c2canvas"); + if (canvas) + return canvas["c2runtime"]; + else if (window["c2runtime"]) + return window["c2runtime"]; + else + return null; +} +window["cr_getSnapshot"] = function (format_, quality_) +{ + var runtime = window["cr_getC2Runtime"](); + if (runtime) + runtime.doCanvasSnapshot(format_, quality_); +} +window["cr_sizeCanvas"] = function(w, h) +{ + if (w === 0 || h === 0) + return; + var runtime = window["cr_getC2Runtime"](); + if (runtime) + runtime["setSize"](w, h); +} +window["cr_setSuspended"] = function(s) +{ + var runtime = window["cr_getC2Runtime"](); + if (runtime) + runtime["setSuspended"](s); +} +; +(function() +{ + function Layout(runtime, m) + { + this.runtime = runtime; + this.event_sheet = null; + this.scrollX = (this.runtime.original_width / 2); + this.scrollY = (this.runtime.original_height / 2); + this.scale = 1.0; + this.angle = 0; + this.first_visit = true; + this.name = m[0]; + this.originalWidth = m[1]; + this.originalHeight = m[2]; + this.width = m[1]; + this.height = m[2]; + this.unbounded_scrolling = m[3]; + this.sheetname = m[4]; + this.sid = m[5]; + var lm = m[6]; + var i, len; + this.layers = []; + this.initial_types = []; + for (i = 0, len = lm.length; i < len; i++) + { + var layer = new cr.layer(this, lm[i]); + layer.number = i; + cr.seal(layer); + this.layers.push(layer); + } + var im = m[7]; + this.initial_nonworld = []; + for (i = 0, len = im.length; i < len; i++) + { + var inst = im[i]; + var type = this.runtime.types_by_index[inst[1]]; +; + if (!type.default_instance) + type.default_instance = inst; + this.initial_nonworld.push(inst); + if (this.initial_types.indexOf(type) === -1) + this.initial_types.push(type); + } + this.effect_types = []; + this.active_effect_types = []; + this.shaders_preserve_opaqueness = true; + this.effect_params = []; + for (i = 0, len = m[8].length; i < len; i++) + { + this.effect_types.push({ + id: m[8][i][0], + name: m[8][i][1], + shaderindex: -1, + preservesOpaqueness: false, + active: true, + index: i + }); + this.effect_params.push(m[8][i][2].slice(0)); + } + this.updateActiveEffects(); + this.rcTex = new cr.rect(0, 0, 1, 1); + this.rcTex2 = new cr.rect(0, 0, 1, 1); + this.persist_data = {}; + }; + Layout.prototype.saveObjectToPersist = function (inst) + { + var sidStr = inst.type.sid.toString(); + if (!this.persist_data.hasOwnProperty(sidStr)) + this.persist_data[sidStr] = []; + var type_persist = this.persist_data[sidStr]; + type_persist.push(this.runtime.saveInstanceToJSON(inst)); + }; + Layout.prototype.hasOpaqueBottomLayer = function () + { + var layer = this.layers[0]; + return !layer.transparent && layer.opacity === 1.0 && !layer.forceOwnTexture && layer.visible; + }; + Layout.prototype.updateActiveEffects = function () + { + cr.clearArray(this.active_effect_types); + this.shaders_preserve_opaqueness = true; + var i, len, et; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + if (et.active) + { + this.active_effect_types.push(et); + if (!et.preservesOpaqueness) + this.shaders_preserve_opaqueness = false; + } + } + }; + Layout.prototype.getEffectByName = function (name_) + { + var i, len, et; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + if (et.name === name_) + return et; + } + return null; + }; + var created_instances = []; + function sort_by_zindex(a, b) + { + return a.zindex - b.zindex; + }; + var first_layout = true; + Layout.prototype.startRunning = function () + { + if (this.sheetname) + { + this.event_sheet = this.runtime.eventsheets[this.sheetname]; +; + this.event_sheet.updateDeepIncludes(); + } + this.runtime.running_layout = this; + this.width = this.originalWidth; + this.height = this.originalHeight; + this.scrollX = (this.runtime.original_width / 2); + this.scrollY = (this.runtime.original_height / 2); + var i, k, len, lenk, type, type_instances, inst, iid, t, s, p, q, type_data, layer; + for (i = 0, len = this.runtime.types_by_index.length; i < len; i++) + { + type = this.runtime.types_by_index[i]; + if (type.is_family) + continue; // instances are only transferred for their real type + type_instances = type.instances; + for (k = 0, lenk = type_instances.length; k < lenk; k++) + { + inst = type_instances[k]; + if (inst.layer) + { + var num = inst.layer.number; + if (num >= this.layers.length) + num = this.layers.length - 1; + inst.layer = this.layers[num]; + if (inst.layer.instances.indexOf(inst) === -1) + inst.layer.instances.push(inst); + inst.layer.zindices_stale = true; + } + } + } + if (!first_layout) + { + for (i = 0, len = this.layers.length; i < len; ++i) + { + this.layers[i].instances.sort(sort_by_zindex); + } + } + var layer; + cr.clearArray(created_instances); + this.boundScrolling(); + for (i = 0, len = this.layers.length; i < len; i++) + { + layer = this.layers[i]; + layer.createInitialInstances(); // fills created_instances + layer.updateViewport(null); + } + var uids_changed = false; + if (!this.first_visit) + { + for (p in this.persist_data) + { + if (this.persist_data.hasOwnProperty(p)) + { + type = this.runtime.getObjectTypeBySid(parseInt(p, 10)); + if (!type || type.is_family || !this.runtime.typeHasPersistBehavior(type)) + continue; + type_data = this.persist_data[p]; + for (i = 0, len = type_data.length; i < len; i++) + { + layer = null; + if (type.plugin.is_world) + { + layer = this.getLayerBySid(type_data[i]["w"]["l"]); + if (!layer) + continue; + } + inst = this.runtime.createInstanceFromInit(type.default_instance, layer, false, 0, 0, true); + this.runtime.loadInstanceFromJSON(inst, type_data[i]); + uids_changed = true; + created_instances.push(inst); + } + cr.clearArray(type_data); + } + } + for (i = 0, len = this.layers.length; i < len; i++) + { + this.layers[i].instances.sort(sort_by_zindex); + this.layers[i].zindices_stale = true; // in case of duplicates/holes + } + } + if (uids_changed) + { + this.runtime.ClearDeathRow(); + this.runtime.refreshUidMap(); + } + for (i = 0; i < created_instances.length; i++) + { + inst = created_instances[i]; + if (!inst.type.is_contained) + continue; + iid = inst.get_iid(); + for (k = 0, lenk = inst.type.container.length; k < lenk; k++) + { + t = inst.type.container[k]; + if (inst.type === t) + continue; + if (t.instances.length > iid) + inst.siblings.push(t.instances[iid]); + else + { + if (!t.default_instance) + { + } + else + { + s = this.runtime.createInstanceFromInit(t.default_instance, inst.layer, true, inst.x, inst.y, true); + this.runtime.ClearDeathRow(); + t.updateIIDs(); + inst.siblings.push(s); + created_instances.push(s); // come back around and link up its own instances too + } + } + } + } + for (i = 0, len = this.initial_nonworld.length; i < len; i++) + { + inst = this.runtime.createInstanceFromInit(this.initial_nonworld[i], null, true); +; + } + this.runtime.changelayout = null; + this.runtime.ClearDeathRow(); + if (this.runtime.ctx && !this.runtime.isDomFree) + { + for (i = 0, len = this.runtime.types_by_index.length; i < len; i++) + { + t = this.runtime.types_by_index[i]; + if (t.is_family || !t.instances.length || !t.preloadCanvas2D) + continue; + t.preloadCanvas2D(this.runtime.ctx); + } + } + /* + if (this.runtime.glwrap) + { + console.log("Estimated VRAM at layout start: " + this.runtime.glwrap.textureCount() + " textures, approx. " + Math.round(this.runtime.glwrap.estimateVRAM() / 1024) + " kb"); + } + */ + if (this.runtime.isLoadingState) + { + cr.shallowAssignArray(this.runtime.fireOnCreateAfterLoad, created_instances); + } + else + { + for (i = 0, len = created_instances.length; i < len; i++) + { + inst = created_instances[i]; + this.runtime.trigger(Object.getPrototypeOf(inst.type.plugin).cnds.OnCreated, inst); + } + } + cr.clearArray(created_instances); + if (!this.runtime.isLoadingState) + { + this.runtime.trigger(cr.system_object.prototype.cnds.OnLayoutStart, null); + } + this.first_visit = false; + }; + Layout.prototype.createGlobalNonWorlds = function () + { + var i, k, len, initial_inst, inst, type; + for (i = 0, k = 0, len = this.initial_nonworld.length; i < len; i++) + { + initial_inst = this.initial_nonworld[i]; + type = this.runtime.types_by_index[initial_inst[1]]; + if (type.global) + { + if (!type.is_contained) + { + inst = this.runtime.createInstanceFromInit(initial_inst, null, true); + } + } + else + { + this.initial_nonworld[k] = initial_inst; + k++; + } + } + cr.truncateArray(this.initial_nonworld, k); + }; + Layout.prototype.stopRunning = function () + { +; + /* + if (this.runtime.glwrap) + { + console.log("Estimated VRAM at layout end: " + this.runtime.glwrap.textureCount() + " textures, approx. " + Math.round(this.runtime.glwrap.estimateVRAM() / 1024) + " kb"); + } + */ + if (!this.runtime.isLoadingState) + { + this.runtime.trigger(cr.system_object.prototype.cnds.OnLayoutEnd, null); + } + this.runtime.isEndingLayout = true; + cr.clearArray(this.runtime.system.waits); + var i, leni, j, lenj; + var layer_instances, inst, type; + if (!this.first_visit) + { + for (i = 0, leni = this.layers.length; i < leni; i++) + { + this.layers[i].updateZIndices(); + layer_instances = this.layers[i].instances; + for (j = 0, lenj = layer_instances.length; j < lenj; j++) + { + inst = layer_instances[j]; + if (!inst.type.global) + { + if (this.runtime.typeHasPersistBehavior(inst.type)) + this.saveObjectToPersist(inst); + } + } + } + } + for (i = 0, leni = this.layers.length; i < leni; i++) + { + layer_instances = this.layers[i].instances; + for (j = 0, lenj = layer_instances.length; j < lenj; j++) + { + inst = layer_instances[j]; + if (!inst.type.global) + { + this.runtime.DestroyInstance(inst); + } + } + this.runtime.ClearDeathRow(); + cr.clearArray(layer_instances); + this.layers[i].zindices_stale = true; + } + for (i = 0, leni = this.runtime.types_by_index.length; i < leni; i++) + { + type = this.runtime.types_by_index[i]; + if (type.global || type.plugin.is_world || type.plugin.singleglobal || type.is_family) + continue; + for (j = 0, lenj = type.instances.length; j < lenj; j++) + this.runtime.DestroyInstance(type.instances[j]); + this.runtime.ClearDeathRow(); + } + first_layout = false; + this.runtime.isEndingLayout = false; + }; + var temp_rect = new cr.rect(0, 0, 0, 0); + Layout.prototype.recreateInitialObjects = function (type, x1, y1, x2, y2) + { + temp_rect.set(x1, y1, x2, y2); + var i, len; + for (i = 0, len = this.layers.length; i < len; i++) + { + this.layers[i].recreateInitialObjects(type, temp_rect); + } + }; + Layout.prototype.draw = function (ctx) + { + var layout_canvas; + var layout_ctx = ctx; + var ctx_changed = false; + var render_offscreen = !this.runtime.fullscreenScalingQuality; + if (render_offscreen) + { + if (!this.runtime.layout_canvas) + { + this.runtime.layout_canvas = document.createElement("canvas"); + layout_canvas = this.runtime.layout_canvas; + layout_canvas.width = this.runtime.draw_width; + layout_canvas.height = this.runtime.draw_height; + this.runtime.layout_ctx = layout_canvas.getContext("2d"); + ctx_changed = true; + } + layout_canvas = this.runtime.layout_canvas; + layout_ctx = this.runtime.layout_ctx; + if (layout_canvas.width !== this.runtime.draw_width) + { + layout_canvas.width = this.runtime.draw_width; + ctx_changed = true; + } + if (layout_canvas.height !== this.runtime.draw_height) + { + layout_canvas.height = this.runtime.draw_height; + ctx_changed = true; + } + if (ctx_changed) + { + this.runtime.setCtxImageSmoothingEnabled(layout_ctx, this.runtime.linearSampling); + } + } + layout_ctx.globalAlpha = 1; + layout_ctx.globalCompositeOperation = "source-over"; + if (this.runtime.clearBackground && !this.hasOpaqueBottomLayer()) + layout_ctx.clearRect(0, 0, this.runtime.draw_width, this.runtime.draw_height); + var i, len, l; + for (i = 0, len = this.layers.length; i < len; i++) + { + l = this.layers[i]; + if (l.visible && l.opacity > 0 && l.blend_mode !== 11 && (l.instances.length || !l.transparent)) + l.draw(layout_ctx); + else + l.updateViewport(null); // even if not drawing, keep viewport up to date + } + if (render_offscreen) + { + ctx.drawImage(layout_canvas, 0, 0, this.runtime.width, this.runtime.height); + } + }; + Layout.prototype.drawGL_earlyZPass = function (glw) + { + glw.setEarlyZPass(true); + if (!this.runtime.layout_tex) + { + this.runtime.layout_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + if (this.runtime.layout_tex.c2width !== this.runtime.draw_width || this.runtime.layout_tex.c2height !== this.runtime.draw_height) + { + glw.deleteTexture(this.runtime.layout_tex); + this.runtime.layout_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + glw.setRenderingToTexture(this.runtime.layout_tex); + if (!this.runtime.fullscreenScalingQuality) + { + glw.setSize(this.runtime.draw_width, this.runtime.draw_height); + } + var i, l; + for (i = this.layers.length - 1; i >= 0; --i) + { + l = this.layers[i]; + if (l.visible && l.opacity === 1 && l.shaders_preserve_opaqueness && + l.blend_mode === 0 && (l.instances.length || !l.transparent)) + { + l.drawGL_earlyZPass(glw); + } + else + { + l.updateViewport(null); // even if not drawing, keep viewport up to date + } + } + glw.setEarlyZPass(false); + }; + Layout.prototype.drawGL = function (glw) + { + var render_to_texture = (this.active_effect_types.length > 0 || + this.runtime.uses_background_blending || + !this.runtime.fullscreenScalingQuality || + this.runtime.enableFrontToBack); + if (render_to_texture) + { + if (!this.runtime.layout_tex) + { + this.runtime.layout_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + if (this.runtime.layout_tex.c2width !== this.runtime.draw_width || this.runtime.layout_tex.c2height !== this.runtime.draw_height) + { + glw.deleteTexture(this.runtime.layout_tex); + this.runtime.layout_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + glw.setRenderingToTexture(this.runtime.layout_tex); + if (!this.runtime.fullscreenScalingQuality) + { + glw.setSize(this.runtime.draw_width, this.runtime.draw_height); + } + } + else + { + if (this.runtime.layout_tex) + { + glw.setRenderingToTexture(null); + glw.deleteTexture(this.runtime.layout_tex); + this.runtime.layout_tex = null; + } + } + if (this.runtime.clearBackground && !this.hasOpaqueBottomLayer()) + glw.clear(0, 0, 0, 0); + var i, len, l; + for (i = 0, len = this.layers.length; i < len; i++) + { + l = this.layers[i]; + if (l.visible && l.opacity > 0 && (l.instances.length || !l.transparent)) + l.drawGL(glw); + else + l.updateViewport(null); // even if not drawing, keep viewport up to date + } + if (render_to_texture) + { + if (this.active_effect_types.length === 0 || + (this.active_effect_types.length === 1 && this.runtime.fullscreenScalingQuality)) + { + if (this.active_effect_types.length === 1) + { + var etindex = this.active_effect_types[0].index; + glw.switchProgram(this.active_effect_types[0].shaderindex); + glw.setProgramParameters(null, // backTex + 1.0 / this.runtime.draw_width, // pixelWidth + 1.0 / this.runtime.draw_height, // pixelHeight + 0.0, 0.0, // destStart + 1.0, 1.0, // destEnd + this.scale, // layerScale + this.angle, // layerAngle + 0.0, 0.0, // viewOrigin + this.runtime.draw_width / 2, this.runtime.draw_height / 2, // scrollPos + this.runtime.kahanTime.sum, // seconds + this.effect_params[etindex]); // fx parameters + if (glw.programIsAnimated(this.active_effect_types[0].shaderindex)) + this.runtime.redraw = true; + } + else + glw.switchProgram(0); + if (!this.runtime.fullscreenScalingQuality) + { + glw.setSize(this.runtime.width, this.runtime.height); + } + glw.setRenderingToTexture(null); // to backbuffer + glw.setDepthTestEnabled(false); // ignore depth buffer, copy full texture + glw.setOpacity(1); + glw.setTexture(this.runtime.layout_tex); + glw.setAlphaBlend(); + glw.resetModelView(); + glw.updateModelView(); + var halfw = this.runtime.width / 2; + var halfh = this.runtime.height / 2; + glw.quad(-halfw, halfh, halfw, halfh, halfw, -halfh, -halfw, -halfh); + glw.setTexture(null); + glw.setDepthTestEnabled(true); // turn depth test back on + } + else + { + this.renderEffectChain(glw, null, null, null); + } + } + }; + Layout.prototype.getRenderTarget = function() + { + if (this.active_effect_types.length > 0 || + this.runtime.uses_background_blending || + !this.runtime.fullscreenScalingQuality || + this.runtime.enableFrontToBack) + { + return this.runtime.layout_tex; + } + else + { + return null; + } + }; + Layout.prototype.getMinLayerScale = function () + { + var m = this.layers[0].getScale(); + var i, len, l; + for (i = 1, len = this.layers.length; i < len; i++) + { + l = this.layers[i]; + if (l.parallaxX === 0 && l.parallaxY === 0) + continue; + if (l.getScale() < m) + m = l.getScale(); + } + return m; + }; + Layout.prototype.scrollToX = function (x) + { + if (!this.unbounded_scrolling) + { + var widthBoundary = (this.runtime.draw_width * (1 / this.getMinLayerScale()) / 2); + if (x > this.width - widthBoundary) + x = this.width - widthBoundary; + if (x < widthBoundary) + x = widthBoundary; + } + if (this.scrollX !== x) + { + this.scrollX = x; + this.runtime.redraw = true; + } + }; + Layout.prototype.scrollToY = function (y) + { + if (!this.unbounded_scrolling) + { + var heightBoundary = (this.runtime.draw_height * (1 / this.getMinLayerScale()) / 2); + if (y > this.height - heightBoundary) + y = this.height - heightBoundary; + if (y < heightBoundary) + y = heightBoundary; + } + if (this.scrollY !== y) + { + this.scrollY = y; + this.runtime.redraw = true; + } + }; + Layout.prototype.boundScrolling = function () + { + this.scrollToX(this.scrollX); + this.scrollToY(this.scrollY); + }; + Layout.prototype.renderEffectChain = function (glw, layer, inst, rendertarget) + { + var active_effect_types = inst ? + inst.active_effect_types : + layer ? + layer.active_effect_types : + this.active_effect_types; + var layerScale = 1, layerAngle = 0, viewOriginLeft = 0, viewOriginTop = 0, viewOriginRight = this.runtime.draw_width, viewOriginBottom = this.runtime.draw_height; + if (inst) + { + layerScale = inst.layer.getScale(); + layerAngle = inst.layer.getAngle(); + viewOriginLeft = inst.layer.viewLeft; + viewOriginTop = inst.layer.viewTop; + viewOriginRight = inst.layer.viewRight; + viewOriginBottom = inst.layer.viewBottom; + } + else if (layer) + { + layerScale = layer.getScale(); + layerAngle = layer.getAngle(); + viewOriginLeft = layer.viewLeft; + viewOriginTop = layer.viewTop; + viewOriginRight = layer.viewRight; + viewOriginBottom = layer.viewBottom; + } + var fx_tex = this.runtime.fx_tex; + var i, len, last, temp, fx_index = 0, other_fx_index = 1; + var y, h; + var windowWidth = this.runtime.draw_width; + var windowHeight = this.runtime.draw_height; + var halfw = windowWidth / 2; + var halfh = windowHeight / 2; + var rcTex = layer ? layer.rcTex : this.rcTex; + var rcTex2 = layer ? layer.rcTex2 : this.rcTex2; + var screenleft = 0, clearleft = 0; + var screentop = 0, cleartop = 0; + var screenright = windowWidth, clearright = windowWidth; + var screenbottom = windowHeight, clearbottom = windowHeight; + var boxExtendHorizontal = 0; + var boxExtendVertical = 0; + var inst_layer_angle = inst ? inst.layer.getAngle() : 0; + if (inst) + { + for (i = 0, len = active_effect_types.length; i < len; i++) + { + boxExtendHorizontal += glw.getProgramBoxExtendHorizontal(active_effect_types[i].shaderindex); + boxExtendVertical += glw.getProgramBoxExtendVertical(active_effect_types[i].shaderindex); + } + var bbox = inst.bbox; + screenleft = layer.layerToCanvas(bbox.left, bbox.top, true, true); + screentop = layer.layerToCanvas(bbox.left, bbox.top, false, true); + screenright = layer.layerToCanvas(bbox.right, bbox.bottom, true, true); + screenbottom = layer.layerToCanvas(bbox.right, bbox.bottom, false, true); + if (inst_layer_angle !== 0) + { + var screentrx = layer.layerToCanvas(bbox.right, bbox.top, true, true); + var screentry = layer.layerToCanvas(bbox.right, bbox.top, false, true); + var screenblx = layer.layerToCanvas(bbox.left, bbox.bottom, true, true); + var screenbly = layer.layerToCanvas(bbox.left, bbox.bottom, false, true); + temp = Math.min(screenleft, screenright, screentrx, screenblx); + screenright = Math.max(screenleft, screenright, screentrx, screenblx); + screenleft = temp; + temp = Math.min(screentop, screenbottom, screentry, screenbly); + screenbottom = Math.max(screentop, screenbottom, screentry, screenbly); + screentop = temp; + } + screenleft -= boxExtendHorizontal; + screentop -= boxExtendVertical; + screenright += boxExtendHorizontal; + screenbottom += boxExtendVertical; + rcTex2.left = screenleft / windowWidth; + rcTex2.top = 1 - screentop / windowHeight; + rcTex2.right = screenright / windowWidth; + rcTex2.bottom = 1 - screenbottom / windowHeight; + clearleft = screenleft = cr.floor(screenleft); + cleartop = screentop = cr.floor(screentop); + clearright = screenright = cr.ceil(screenright); + clearbottom = screenbottom = cr.ceil(screenbottom); + clearleft -= boxExtendHorizontal; + cleartop -= boxExtendVertical; + clearright += boxExtendHorizontal; + clearbottom += boxExtendVertical; + if (screenleft < 0) screenleft = 0; + if (screentop < 0) screentop = 0; + if (screenright > windowWidth) screenright = windowWidth; + if (screenbottom > windowHeight) screenbottom = windowHeight; + if (clearleft < 0) clearleft = 0; + if (cleartop < 0) cleartop = 0; + if (clearright > windowWidth) clearright = windowWidth; + if (clearbottom > windowHeight) clearbottom = windowHeight; + rcTex.left = screenleft / windowWidth; + rcTex.top = 1 - screentop / windowHeight; + rcTex.right = screenright / windowWidth; + rcTex.bottom = 1 - screenbottom / windowHeight; + } + else + { + rcTex.left = rcTex2.left = 0; + rcTex.top = rcTex2.top = 0; + rcTex.right = rcTex2.right = 1; + rcTex.bottom = rcTex2.bottom = 1; + } + var pre_draw = (inst && (glw.programUsesDest(active_effect_types[0].shaderindex) || boxExtendHorizontal !== 0 || boxExtendVertical !== 0 || inst.opacity !== 1 || inst.type.plugin.must_predraw)) || (layer && !inst && layer.opacity !== 1); + glw.setAlphaBlend(); + if (pre_draw) + { + if (!fx_tex[fx_index]) + { + fx_tex[fx_index] = glw.createEmptyTexture(windowWidth, windowHeight, this.runtime.linearSampling); + } + if (fx_tex[fx_index].c2width !== windowWidth || fx_tex[fx_index].c2height !== windowHeight) + { + glw.deleteTexture(fx_tex[fx_index]); + fx_tex[fx_index] = glw.createEmptyTexture(windowWidth, windowHeight, this.runtime.linearSampling); + } + glw.switchProgram(0); + glw.setRenderingToTexture(fx_tex[fx_index]); + h = clearbottom - cleartop; + y = (windowHeight - cleartop) - h; + glw.clearRect(clearleft, y, clearright - clearleft, h); + if (inst) + { + inst.drawGL(glw); + } + else + { + glw.setTexture(this.runtime.layer_tex); + glw.setOpacity(layer.opacity); + glw.resetModelView(); + glw.translate(-halfw, -halfh); + glw.updateModelView(); + glw.quadTex(screenleft, screenbottom, screenright, screenbottom, screenright, screentop, screenleft, screentop, rcTex); + } + rcTex2.left = rcTex2.top = 0; + rcTex2.right = rcTex2.bottom = 1; + if (inst) + { + temp = rcTex.top; + rcTex.top = rcTex.bottom; + rcTex.bottom = temp; + } + fx_index = 1; + other_fx_index = 0; + } + glw.setOpacity(1); + var last = active_effect_types.length - 1; + var post_draw = glw.programUsesCrossSampling(active_effect_types[last].shaderindex) || + (!layer && !inst && !this.runtime.fullscreenScalingQuality); + var etindex = 0; + for (i = 0, len = active_effect_types.length; i < len; i++) + { + if (!fx_tex[fx_index]) + { + fx_tex[fx_index] = glw.createEmptyTexture(windowWidth, windowHeight, this.runtime.linearSampling); + } + if (fx_tex[fx_index].c2width !== windowWidth || fx_tex[fx_index].c2height !== windowHeight) + { + glw.deleteTexture(fx_tex[fx_index]); + fx_tex[fx_index] = glw.createEmptyTexture(windowWidth, windowHeight, this.runtime.linearSampling); + } + glw.switchProgram(active_effect_types[i].shaderindex); + etindex = active_effect_types[i].index; + if (glw.programIsAnimated(active_effect_types[i].shaderindex)) + this.runtime.redraw = true; + if (i == 0 && !pre_draw) + { + glw.setRenderingToTexture(fx_tex[fx_index]); + h = clearbottom - cleartop; + y = (windowHeight - cleartop) - h; + glw.clearRect(clearleft, y, clearright - clearleft, h); + if (inst) + { + var pixelWidth; + var pixelHeight; + if (inst.curFrame && inst.curFrame.texture_img) + { + var img = inst.curFrame.texture_img; + pixelWidth = 1.0 / img.width; + pixelHeight = 1.0 / img.height; + } + else + { + pixelWidth = 1.0 / inst.width; + pixelHeight = 1.0 / inst.height; + } + glw.setProgramParameters(rendertarget, // backTex + pixelWidth, + pixelHeight, + rcTex2.left, rcTex2.top, // destStart + rcTex2.right, rcTex2.bottom, // destEnd + layerScale, + layerAngle, + viewOriginLeft, viewOriginTop, + (viewOriginLeft + viewOriginRight) / 2, (viewOriginTop + viewOriginBottom) / 2, + this.runtime.kahanTime.sum, + inst.effect_params[etindex]); // fx params + inst.drawGL(glw); + } + else + { + glw.setProgramParameters(rendertarget, // backTex + 1.0 / windowWidth, // pixelWidth + 1.0 / windowHeight, // pixelHeight + 0.0, 0.0, // destStart + 1.0, 1.0, // destEnd + layerScale, + layerAngle, + viewOriginLeft, viewOriginTop, + (viewOriginLeft + viewOriginRight) / 2, (viewOriginTop + viewOriginBottom) / 2, + this.runtime.kahanTime.sum, + layer ? // fx params + layer.effect_params[etindex] : + this.effect_params[etindex]); + glw.setTexture(layer ? this.runtime.layer_tex : this.runtime.layout_tex); + glw.resetModelView(); + glw.translate(-halfw, -halfh); + glw.updateModelView(); + glw.quadTex(screenleft, screenbottom, screenright, screenbottom, screenright, screentop, screenleft, screentop, rcTex); + } + rcTex2.left = rcTex2.top = 0; + rcTex2.right = rcTex2.bottom = 1; + if (inst && !post_draw) + { + temp = screenbottom; + screenbottom = screentop; + screentop = temp; + } + } + else + { + glw.setProgramParameters(rendertarget, // backTex + 1.0 / windowWidth, // pixelWidth + 1.0 / windowHeight, // pixelHeight + rcTex2.left, rcTex2.top, // destStart + rcTex2.right, rcTex2.bottom, // destEnd + layerScale, + layerAngle, + viewOriginLeft, viewOriginTop, + (viewOriginLeft + viewOriginRight) / 2, (viewOriginTop + viewOriginBottom) / 2, + this.runtime.kahanTime.sum, + inst ? // fx params + inst.effect_params[etindex] : + layer ? + layer.effect_params[etindex] : + this.effect_params[etindex]); + glw.setTexture(null); + if (i === last && !post_draw) + { + if (inst) + glw.setBlend(inst.srcBlend, inst.destBlend); + else if (layer) + glw.setBlend(layer.srcBlend, layer.destBlend); + glw.setRenderingToTexture(rendertarget); + } + else + { + glw.setRenderingToTexture(fx_tex[fx_index]); + h = clearbottom - cleartop; + y = (windowHeight - cleartop) - h; + glw.clearRect(clearleft, y, clearright - clearleft, h); + } + glw.setTexture(fx_tex[other_fx_index]); + glw.resetModelView(); + glw.translate(-halfw, -halfh); + glw.updateModelView(); + glw.quadTex(screenleft, screenbottom, screenright, screenbottom, screenright, screentop, screenleft, screentop, rcTex); + if (i === last && !post_draw) + glw.setTexture(null); + } + fx_index = (fx_index === 0 ? 1 : 0); + other_fx_index = (fx_index === 0 ? 1 : 0); // will be opposite to fx_index since it was just assigned + } + if (post_draw) + { + glw.switchProgram(0); + if (inst) + glw.setBlend(inst.srcBlend, inst.destBlend); + else if (layer) + glw.setBlend(layer.srcBlend, layer.destBlend); + else + { + if (!this.runtime.fullscreenScalingQuality) + { + glw.setSize(this.runtime.width, this.runtime.height); + halfw = this.runtime.width / 2; + halfh = this.runtime.height / 2; + screenleft = 0; + screentop = 0; + screenright = this.runtime.width; + screenbottom = this.runtime.height; + } + } + glw.setRenderingToTexture(rendertarget); + glw.setTexture(fx_tex[other_fx_index]); + glw.resetModelView(); + glw.translate(-halfw, -halfh); + glw.updateModelView(); + if (inst && active_effect_types.length === 1 && !pre_draw) + glw.quadTex(screenleft, screentop, screenright, screentop, screenright, screenbottom, screenleft, screenbottom, rcTex); + else + glw.quadTex(screenleft, screenbottom, screenright, screenbottom, screenright, screentop, screenleft, screentop, rcTex); + glw.setTexture(null); + } + }; + Layout.prototype.getLayerBySid = function (sid_) + { + var i, len; + for (i = 0, len = this.layers.length; i < len; i++) + { + if (this.layers[i].sid === sid_) + return this.layers[i]; + } + return null; + }; + Layout.prototype.saveToJSON = function () + { + var i, len, layer, et; + var o = { + "sx": this.scrollX, + "sy": this.scrollY, + "s": this.scale, + "a": this.angle, + "w": this.width, + "h": this.height, + "fv": this.first_visit, // added r127 + "persist": this.persist_data, + "fx": [], + "layers": {} + }; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + o["fx"].push({"name": et.name, "active": et.active, "params": this.effect_params[et.index] }); + } + for (i = 0, len = this.layers.length; i < len; i++) + { + layer = this.layers[i]; + o["layers"][layer.sid.toString()] = layer.saveToJSON(); + } + return o; + }; + Layout.prototype.loadFromJSON = function (o) + { + var i, j, len, fx, p, layer; + this.scrollX = o["sx"]; + this.scrollY = o["sy"]; + this.scale = o["s"]; + this.angle = o["a"]; + this.width = o["w"]; + this.height = o["h"]; + this.persist_data = o["persist"]; + if (typeof o["fv"] !== "undefined") + this.first_visit = o["fv"]; + var ofx = o["fx"]; + for (i = 0, len = ofx.length; i < len; i++) + { + fx = this.getEffectByName(ofx[i]["name"]); + if (!fx) + continue; // must've gone missing + fx.active = ofx[i]["active"]; + this.effect_params[fx.index] = ofx[i]["params"]; + } + this.updateActiveEffects(); + var olayers = o["layers"]; + for (p in olayers) + { + if (olayers.hasOwnProperty(p)) + { + layer = this.getLayerBySid(parseInt(p, 10)); + if (!layer) + continue; // must've gone missing + layer.loadFromJSON(olayers[p]); + } + } + }; + cr.layout = Layout; + function Layer(layout, m) + { + this.layout = layout; + this.runtime = layout.runtime; + this.instances = []; // running instances + this.scale = 1.0; + this.angle = 0; + this.disableAngle = false; + this.tmprect = new cr.rect(0, 0, 0, 0); + this.tmpquad = new cr.quad(); + this.viewLeft = 0; + this.viewRight = 0; + this.viewTop = 0; + this.viewBottom = 0; + this.zindices_stale = false; + this.zindices_stale_from = -1; // first index that has changed, or -1 if no bound + this.clear_earlyz_index = 0; + this.name = m[0]; + this.index = m[1]; + this.sid = m[2]; + this.visible = m[3]; // initially visible + this.background_color = m[4]; + this.transparent = m[5]; + this.parallaxX = m[6]; + this.parallaxY = m[7]; + this.opacity = m[8]; + this.forceOwnTexture = m[9]; + this.useRenderCells = m[10]; + this.zoomRate = m[11]; + this.blend_mode = m[12]; + this.effect_fallback = m[13]; + this.compositeOp = "source-over"; + this.srcBlend = 0; + this.destBlend = 0; + this.render_grid = null; + this.last_render_list = alloc_arr(); + this.render_list_stale = true; + this.last_render_cells = new cr.rect(0, 0, -1, -1); + this.cur_render_cells = new cr.rect(0, 0, -1, -1); + if (this.useRenderCells) + { + this.render_grid = new cr.RenderGrid(this.runtime.original_width, this.runtime.original_height); + } + this.render_offscreen = false; + var im = m[14]; + var i, len; + this.startup_initial_instances = []; // for restoring initial_instances after load + this.initial_instances = []; + this.created_globals = []; // global object UIDs already created - for save/load to avoid recreating + for (i = 0, len = im.length; i < len; i++) + { + var inst = im[i]; + var type = this.runtime.types_by_index[inst[1]]; +; + if (!type.default_instance) + { + type.default_instance = inst; + type.default_layerindex = this.index; + } + this.initial_instances.push(inst); + if (this.layout.initial_types.indexOf(type) === -1) + this.layout.initial_types.push(type); + } + cr.shallowAssignArray(this.startup_initial_instances, this.initial_instances); + this.effect_types = []; + this.active_effect_types = []; + this.shaders_preserve_opaqueness = true; + this.effect_params = []; + for (i = 0, len = m[15].length; i < len; i++) + { + this.effect_types.push({ + id: m[15][i][0], + name: m[15][i][1], + shaderindex: -1, + preservesOpaqueness: false, + active: true, + index: i + }); + this.effect_params.push(m[15][i][2].slice(0)); + } + this.updateActiveEffects(); + this.rcTex = new cr.rect(0, 0, 1, 1); + this.rcTex2 = new cr.rect(0, 0, 1, 1); + }; + Layer.prototype.updateActiveEffects = function () + { + cr.clearArray(this.active_effect_types); + this.shaders_preserve_opaqueness = true; + var i, len, et; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + if (et.active) + { + this.active_effect_types.push(et); + if (!et.preservesOpaqueness) + this.shaders_preserve_opaqueness = false; + } + } + }; + Layer.prototype.getEffectByName = function (name_) + { + var i, len, et; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + if (et.name === name_) + return et; + } + return null; + }; + Layer.prototype.createInitialInstances = function () + { + var i, k, len, inst, initial_inst, type, keep, hasPersistBehavior; + for (i = 0, k = 0, len = this.initial_instances.length; i < len; i++) + { + initial_inst = this.initial_instances[i]; + type = this.runtime.types_by_index[initial_inst[1]]; +; + hasPersistBehavior = this.runtime.typeHasPersistBehavior(type); + keep = true; + if (!hasPersistBehavior || this.layout.first_visit) + { + inst = this.runtime.createInstanceFromInit(initial_inst, this, true); + if (!inst) + continue; // may have skipped creation due to fallback effect "destroy" + created_instances.push(inst); + if (inst.type.global) + { + keep = false; + this.created_globals.push(inst.uid); + } + } + if (keep) + { + this.initial_instances[k] = this.initial_instances[i]; + k++; + } + } + this.initial_instances.length = k; + this.runtime.ClearDeathRow(); // flushes creation row so IIDs will be correct + if (!this.runtime.glwrap && this.effect_types.length) // no WebGL renderer and shaders used + this.blend_mode = this.effect_fallback; // use fallback blend mode + this.compositeOp = cr.effectToCompositeOp(this.blend_mode); + if (this.runtime.gl) + cr.setGLBlend(this, this.blend_mode, this.runtime.gl); + this.render_list_stale = true; + }; + Layer.prototype.recreateInitialObjects = function (only_type, rc) + { + var i, len, initial_inst, type, wm, x, y, inst, j, lenj, s; + var types_by_index = this.runtime.types_by_index; + var only_type_is_family = only_type.is_family; + var only_type_members = only_type.members; + for (i = 0, len = this.initial_instances.length; i < len; ++i) + { + initial_inst = this.initial_instances[i]; + wm = initial_inst[0]; + x = wm[0]; + y = wm[1]; + if (!rc.contains_pt(x, y)) + continue; // not in the given area + type = types_by_index[initial_inst[1]]; + if (type !== only_type) + { + if (only_type_is_family) + { + if (only_type_members.indexOf(type) < 0) + continue; + } + else + continue; // only_type is not a family, and the initial inst type does not match + } + inst = this.runtime.createInstanceFromInit(initial_inst, this, false); + this.runtime.isInOnDestroy++; + this.runtime.trigger(Object.getPrototypeOf(type.plugin).cnds.OnCreated, inst); + if (inst.is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[i]; + this.runtime.trigger(Object.getPrototypeOf(s.type.plugin).cnds.OnCreated, s); + } + } + this.runtime.isInOnDestroy--; + } + }; + Layer.prototype.removeFromInstanceList = function (inst, remove_from_grid) + { + var index = cr.fastIndexOf(this.instances, inst); + if (index < 0) + return; // not found + if (remove_from_grid && this.useRenderCells && inst.rendercells && inst.rendercells.right >= inst.rendercells.left) + { + inst.update_bbox(); // make sure actually in its current rendercells + this.render_grid.update(inst, inst.rendercells, null); // no new range provided - remove only + inst.rendercells.set(0, 0, -1, -1); // set to invalid state to indicate not inserted + } + if (index === this.instances.length - 1) + this.instances.pop(); + else + { + cr.arrayRemove(this.instances, index); + this.setZIndicesStaleFrom(index); + } + this.render_list_stale = true; + }; + Layer.prototype.appendToInstanceList = function (inst, add_to_grid) + { +; + inst.zindex = this.instances.length; + this.instances.push(inst); + if (add_to_grid && this.useRenderCells && inst.rendercells) + { + inst.set_bbox_changed(); // will cause immediate update and new insertion to grid + } + this.render_list_stale = true; + }; + Layer.prototype.prependToInstanceList = function (inst, add_to_grid) + { +; + this.instances.unshift(inst); + this.setZIndicesStaleFrom(0); + if (add_to_grid && this.useRenderCells && inst.rendercells) + { + inst.set_bbox_changed(); // will cause immediate update and new insertion to grid + } + }; + Layer.prototype.moveInstanceAdjacent = function (inst, other, isafter) + { +; + var myZ = inst.get_zindex(); + var insertZ = other.get_zindex(); + cr.arrayRemove(this.instances, myZ); + if (myZ < insertZ) + insertZ--; + if (isafter) + insertZ++; + if (insertZ === this.instances.length) + this.instances.push(inst); + else + this.instances.splice(insertZ, 0, inst); + this.setZIndicesStaleFrom(myZ < insertZ ? myZ : insertZ); + }; + Layer.prototype.setZIndicesStaleFrom = function (index) + { + if (this.zindices_stale_from === -1) // not yet set + this.zindices_stale_from = index; + else if (index < this.zindices_stale_from) // determine minimum z index affected + this.zindices_stale_from = index; + this.zindices_stale = true; + this.render_list_stale = true; + }; + Layer.prototype.updateZIndices = function () + { + if (!this.zindices_stale) + return; + if (this.zindices_stale_from === -1) + this.zindices_stale_from = 0; + var i, len, inst; + if (this.useRenderCells) + { + for (i = this.zindices_stale_from, len = this.instances.length; i < len; ++i) + { + inst = this.instances[i]; + inst.zindex = i; + this.render_grid.markRangeChanged(inst.rendercells); + } + } + else + { + for (i = this.zindices_stale_from, len = this.instances.length; i < len; ++i) + { + this.instances[i].zindex = i; + } + } + this.zindices_stale = false; + this.zindices_stale_from = -1; + }; + Layer.prototype.getScale = function (include_aspect) + { + return this.getNormalScale() * (this.runtime.fullscreenScalingQuality || include_aspect ? this.runtime.aspect_scale : 1); + }; + Layer.prototype.getNormalScale = function () + { + return ((this.scale * this.layout.scale) - 1) * this.zoomRate + 1; + }; + Layer.prototype.getAngle = function () + { + if (this.disableAngle) + return 0; + return cr.clamp_angle(this.layout.angle + this.angle); + }; + var arr_cache = []; + function alloc_arr() + { + if (arr_cache.length) + return arr_cache.pop(); + else + return []; + } + function free_arr(a) + { + cr.clearArray(a); + arr_cache.push(a); + }; + function mergeSortedZArrays(a, b, out) + { + var i = 0, j = 0, k = 0, lena = a.length, lenb = b.length, ai, bj; + out.length = lena + lenb; + for ( ; i < lena && j < lenb; ++k) + { + ai = a[i]; + bj = b[j]; + if (ai.zindex < bj.zindex) + { + out[k] = ai; + ++i; + } + else + { + out[k] = bj; + ++j; + } + } + for ( ; i < lena; ++i, ++k) + out[k] = a[i]; + for ( ; j < lenb; ++j, ++k) + out[k] = b[j]; + }; + var next_arr = []; + function mergeAllSortedZArrays_pass(arr, first_pass) + { + var i, len, arr1, arr2, out; + for (i = 0, len = arr.length; i < len - 1; i += 2) + { + arr1 = arr[i]; + arr2 = arr[i+1]; + out = alloc_arr(); + mergeSortedZArrays(arr1, arr2, out); + if (!first_pass) + { + free_arr(arr1); + free_arr(arr2); + } + next_arr.push(out); + } + if (len % 2 === 1) + { + if (first_pass) + { + arr1 = alloc_arr(); + cr.shallowAssignArray(arr1, arr[len - 1]); + next_arr.push(arr1); + } + else + { + next_arr.push(arr[len - 1]); + } + } + cr.shallowAssignArray(arr, next_arr); + cr.clearArray(next_arr); + }; + function mergeAllSortedZArrays(arr) + { + var first_pass = true; + while (arr.length > 1) + { + mergeAllSortedZArrays_pass(arr, first_pass); + first_pass = false; + } + return arr[0]; + }; + var render_arr = []; + Layer.prototype.getRenderCellInstancesToDraw = function () + { +; + this.updateZIndices(); + this.render_grid.queryRange(this.viewLeft, this.viewTop, this.viewRight, this.viewBottom, render_arr); + if (!render_arr.length) + return alloc_arr(); + if (render_arr.length === 1) + { + var a = alloc_arr(); + cr.shallowAssignArray(a, render_arr[0]); + cr.clearArray(render_arr); + return a; + } + var draw_list = mergeAllSortedZArrays(render_arr); + cr.clearArray(render_arr); + return draw_list; + }; + Layer.prototype.draw = function (ctx) + { + this.render_offscreen = (this.forceOwnTexture || this.opacity !== 1.0 || this.blend_mode !== 0); + var layer_canvas = this.runtime.canvas; + var layer_ctx = ctx; + var ctx_changed = false; + if (this.render_offscreen) + { + if (!this.runtime.layer_canvas) + { + this.runtime.layer_canvas = document.createElement("canvas"); +; + layer_canvas = this.runtime.layer_canvas; + layer_canvas.width = this.runtime.draw_width; + layer_canvas.height = this.runtime.draw_height; + this.runtime.layer_ctx = layer_canvas.getContext("2d"); +; + ctx_changed = true; + } + layer_canvas = this.runtime.layer_canvas; + layer_ctx = this.runtime.layer_ctx; + if (layer_canvas.width !== this.runtime.draw_width) + { + layer_canvas.width = this.runtime.draw_width; + ctx_changed = true; + } + if (layer_canvas.height !== this.runtime.draw_height) + { + layer_canvas.height = this.runtime.draw_height; + ctx_changed = true; + } + if (ctx_changed) + { + this.runtime.setCtxImageSmoothingEnabled(layer_ctx, this.runtime.linearSampling); + } + if (this.transparent) + layer_ctx.clearRect(0, 0, this.runtime.draw_width, this.runtime.draw_height); + } + layer_ctx.globalAlpha = 1; + layer_ctx.globalCompositeOperation = "source-over"; + if (!this.transparent) + { + layer_ctx.fillStyle = "rgb(" + this.background_color[0] + "," + this.background_color[1] + "," + this.background_color[2] + ")"; + layer_ctx.fillRect(0, 0, this.runtime.draw_width, this.runtime.draw_height); + } + layer_ctx.save(); + this.disableAngle = true; + var px = this.canvasToLayer(0, 0, true, true); + var py = this.canvasToLayer(0, 0, false, true); + this.disableAngle = false; + if (this.runtime.pixel_rounding) + { + px = Math.round(px); + py = Math.round(py); + } + this.rotateViewport(px, py, layer_ctx); + var myscale = this.getScale(); + layer_ctx.scale(myscale, myscale); + layer_ctx.translate(-px, -py); + var instances_to_draw; + if (this.useRenderCells) + { + this.cur_render_cells.left = this.render_grid.XToCell(this.viewLeft); + this.cur_render_cells.top = this.render_grid.YToCell(this.viewTop); + this.cur_render_cells.right = this.render_grid.XToCell(this.viewRight); + this.cur_render_cells.bottom = this.render_grid.YToCell(this.viewBottom); + if (this.render_list_stale || !this.cur_render_cells.equals(this.last_render_cells)) + { + free_arr(this.last_render_list); + instances_to_draw = this.getRenderCellInstancesToDraw(); + this.render_list_stale = false; + this.last_render_cells.copy(this.cur_render_cells); + } + else + instances_to_draw = this.last_render_list; + } + else + instances_to_draw = this.instances; + var i, len, inst, last_inst = null; + for (i = 0, len = instances_to_draw.length; i < len; ++i) + { + inst = instances_to_draw[i]; + if (inst === last_inst) + continue; + this.drawInstance(inst, layer_ctx); + last_inst = inst; + } + if (this.useRenderCells) + this.last_render_list = instances_to_draw; + layer_ctx.restore(); + if (this.render_offscreen) + { + ctx.globalCompositeOperation = this.compositeOp; + ctx.globalAlpha = this.opacity; + ctx.drawImage(layer_canvas, 0, 0); + } + }; + Layer.prototype.drawInstance = function(inst, layer_ctx) + { + if (!inst.visible || inst.width === 0 || inst.height === 0) + return; + inst.update_bbox(); + var bbox = inst.bbox; + if (bbox.right < this.viewLeft || bbox.bottom < this.viewTop || bbox.left > this.viewRight || bbox.top > this.viewBottom) + return; + layer_ctx.globalCompositeOperation = inst.compositeOp; + inst.draw(layer_ctx); + }; + Layer.prototype.updateViewport = function (ctx) + { + this.disableAngle = true; + var px = this.canvasToLayer(0, 0, true, true); + var py = this.canvasToLayer(0, 0, false, true); + this.disableAngle = false; + if (this.runtime.pixel_rounding) + { + px = Math.round(px); + py = Math.round(py); + } + this.rotateViewport(px, py, ctx); + }; + Layer.prototype.rotateViewport = function (px, py, ctx) + { + var myscale = this.getScale(); + this.viewLeft = px; + this.viewTop = py; + this.viewRight = px + (this.runtime.draw_width * (1 / myscale)); + this.viewBottom = py + (this.runtime.draw_height * (1 / myscale)); + var temp; + if (this.viewLeft > this.viewRight) + { + temp = this.viewLeft; + this.viewLeft = this.viewRight; + this.viewRight = temp; + } + if (this.viewTop > this.viewBottom) + { + temp = this.viewTop; + this.viewTop = this.viewBottom; + this.viewBottom = temp; + } + var myAngle = this.getAngle(); + if (myAngle !== 0) + { + if (ctx) + { + ctx.translate(this.runtime.draw_width / 2, this.runtime.draw_height / 2); + ctx.rotate(-myAngle); + ctx.translate(this.runtime.draw_width / -2, this.runtime.draw_height / -2); + } + this.tmprect.set(this.viewLeft, this.viewTop, this.viewRight, this.viewBottom); + this.tmprect.offset((this.viewLeft + this.viewRight) / -2, (this.viewTop + this.viewBottom) / -2); + this.tmpquad.set_from_rotated_rect(this.tmprect, myAngle); + this.tmpquad.bounding_box(this.tmprect); + this.tmprect.offset((this.viewLeft + this.viewRight) / 2, (this.viewTop + this.viewBottom) / 2); + this.viewLeft = this.tmprect.left; + this.viewTop = this.tmprect.top; + this.viewRight = this.tmprect.right; + this.viewBottom = this.tmprect.bottom; + } + } + Layer.prototype.drawGL_earlyZPass = function (glw) + { + var windowWidth = this.runtime.draw_width; + var windowHeight = this.runtime.draw_height; + var shaderindex = 0; + var etindex = 0; + this.render_offscreen = this.forceOwnTexture; + if (this.render_offscreen) + { + if (!this.runtime.layer_tex) + { + this.runtime.layer_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + if (this.runtime.layer_tex.c2width !== this.runtime.draw_width || this.runtime.layer_tex.c2height !== this.runtime.draw_height) + { + glw.deleteTexture(this.runtime.layer_tex); + this.runtime.layer_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + glw.setRenderingToTexture(this.runtime.layer_tex); + } + this.disableAngle = true; + var px = this.canvasToLayer(0, 0, true, true); + var py = this.canvasToLayer(0, 0, false, true); + this.disableAngle = false; + if (this.runtime.pixel_rounding) + { + px = Math.round(px); + py = Math.round(py); + } + this.rotateViewport(px, py, null); + var myscale = this.getScale(); + glw.resetModelView(); + glw.scale(myscale, myscale); + glw.rotateZ(-this.getAngle()); + glw.translate((this.viewLeft + this.viewRight) / -2, (this.viewTop + this.viewBottom) / -2); + glw.updateModelView(); + var instances_to_draw; + if (this.useRenderCells) + { + this.cur_render_cells.left = this.render_grid.XToCell(this.viewLeft); + this.cur_render_cells.top = this.render_grid.YToCell(this.viewTop); + this.cur_render_cells.right = this.render_grid.XToCell(this.viewRight); + this.cur_render_cells.bottom = this.render_grid.YToCell(this.viewBottom); + if (this.render_list_stale || !this.cur_render_cells.equals(this.last_render_cells)) + { + free_arr(this.last_render_list); + instances_to_draw = this.getRenderCellInstancesToDraw(); + this.render_list_stale = false; + this.last_render_cells.copy(this.cur_render_cells); + } + else + instances_to_draw = this.last_render_list; + } + else + instances_to_draw = this.instances; + var i, inst, last_inst = null; + for (i = instances_to_draw.length - 1; i >= 0; --i) + { + inst = instances_to_draw[i]; + if (inst === last_inst) + continue; + this.drawInstanceGL_earlyZPass(instances_to_draw[i], glw); + last_inst = inst; + } + if (this.useRenderCells) + this.last_render_list = instances_to_draw; + if (!this.transparent) + { + this.clear_earlyz_index = this.runtime.earlyz_index++; + glw.setEarlyZIndex(this.clear_earlyz_index); + glw.setColorFillMode(1, 1, 1, 1); + glw.fullscreenQuad(); // fill remaining space in depth buffer with current Z value + glw.restoreEarlyZMode(); + } + }; + Layer.prototype.drawGL = function (glw) + { + var windowWidth = this.runtime.draw_width; + var windowHeight = this.runtime.draw_height; + var shaderindex = 0; + var etindex = 0; + this.render_offscreen = (this.forceOwnTexture || this.opacity !== 1.0 || this.active_effect_types.length > 0 || this.blend_mode !== 0); + if (this.render_offscreen) + { + if (!this.runtime.layer_tex) + { + this.runtime.layer_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + if (this.runtime.layer_tex.c2width !== this.runtime.draw_width || this.runtime.layer_tex.c2height !== this.runtime.draw_height) + { + glw.deleteTexture(this.runtime.layer_tex); + this.runtime.layer_tex = glw.createEmptyTexture(this.runtime.draw_width, this.runtime.draw_height, this.runtime.linearSampling); + } + glw.setRenderingToTexture(this.runtime.layer_tex); + if (this.transparent) + glw.clear(0, 0, 0, 0); + } + if (!this.transparent) + { + if (this.runtime.enableFrontToBack) + { + glw.setEarlyZIndex(this.clear_earlyz_index); + glw.setColorFillMode(this.background_color[0] / 255, this.background_color[1] / 255, this.background_color[2] / 255, 1); + glw.fullscreenQuad(); + glw.setTextureFillMode(); + } + else + { + glw.clear(this.background_color[0] / 255, this.background_color[1] / 255, this.background_color[2] / 255, 1); + } + } + this.disableAngle = true; + var px = this.canvasToLayer(0, 0, true, true); + var py = this.canvasToLayer(0, 0, false, true); + this.disableAngle = false; + if (this.runtime.pixel_rounding) + { + px = Math.round(px); + py = Math.round(py); + } + this.rotateViewport(px, py, null); + var myscale = this.getScale(); + glw.resetModelView(); + glw.scale(myscale, myscale); + glw.rotateZ(-this.getAngle()); + glw.translate((this.viewLeft + this.viewRight) / -2, (this.viewTop + this.viewBottom) / -2); + glw.updateModelView(); + var instances_to_draw; + if (this.useRenderCells) + { + this.cur_render_cells.left = this.render_grid.XToCell(this.viewLeft); + this.cur_render_cells.top = this.render_grid.YToCell(this.viewTop); + this.cur_render_cells.right = this.render_grid.XToCell(this.viewRight); + this.cur_render_cells.bottom = this.render_grid.YToCell(this.viewBottom); + if (this.render_list_stale || !this.cur_render_cells.equals(this.last_render_cells)) + { + free_arr(this.last_render_list); + instances_to_draw = this.getRenderCellInstancesToDraw(); + this.render_list_stale = false; + this.last_render_cells.copy(this.cur_render_cells); + } + else + instances_to_draw = this.last_render_list; + } + else + instances_to_draw = this.instances; + var i, len, inst, last_inst = null; + for (i = 0, len = instances_to_draw.length; i < len; ++i) + { + inst = instances_to_draw[i]; + if (inst === last_inst) + continue; + this.drawInstanceGL(instances_to_draw[i], glw); + last_inst = inst; + } + if (this.useRenderCells) + this.last_render_list = instances_to_draw; + if (this.render_offscreen) + { + shaderindex = this.active_effect_types.length ? this.active_effect_types[0].shaderindex : 0; + etindex = this.active_effect_types.length ? this.active_effect_types[0].index : 0; + if (this.active_effect_types.length === 0 || (this.active_effect_types.length === 1 && + !glw.programUsesCrossSampling(shaderindex) && this.opacity === 1)) + { + if (this.active_effect_types.length === 1) + { + glw.switchProgram(shaderindex); + glw.setProgramParameters(this.layout.getRenderTarget(), // backTex + 1.0 / this.runtime.draw_width, // pixelWidth + 1.0 / this.runtime.draw_height, // pixelHeight + 0.0, 0.0, // destStart + 1.0, 1.0, // destEnd + myscale, // layerScale + this.getAngle(), + this.viewLeft, this.viewTop, + (this.viewLeft + this.viewRight) / 2, (this.viewTop + this.viewBottom) / 2, + this.runtime.kahanTime.sum, + this.effect_params[etindex]); // fx parameters + if (glw.programIsAnimated(shaderindex)) + this.runtime.redraw = true; + } + else + glw.switchProgram(0); + glw.setRenderingToTexture(this.layout.getRenderTarget()); + glw.setOpacity(this.opacity); + glw.setTexture(this.runtime.layer_tex); + glw.setBlend(this.srcBlend, this.destBlend); + glw.resetModelView(); + glw.updateModelView(); + var halfw = this.runtime.draw_width / 2; + var halfh = this.runtime.draw_height / 2; + glw.quad(-halfw, halfh, halfw, halfh, halfw, -halfh, -halfw, -halfh); + glw.setTexture(null); + } + else + { + this.layout.renderEffectChain(glw, this, null, this.layout.getRenderTarget()); + } + } + }; + Layer.prototype.drawInstanceGL = function (inst, glw) + { +; + if (!inst.visible || inst.width === 0 || inst.height === 0) + return; + inst.update_bbox(); + var bbox = inst.bbox; + if (bbox.right < this.viewLeft || bbox.bottom < this.viewTop || bbox.left > this.viewRight || bbox.top > this.viewBottom) + return; + glw.setEarlyZIndex(inst.earlyz_index); + if (inst.uses_shaders) + { + this.drawInstanceWithShadersGL(inst, glw); + } + else + { + glw.switchProgram(0); // un-set any previously set shader + glw.setBlend(inst.srcBlend, inst.destBlend); + inst.drawGL(glw); + } + }; + Layer.prototype.drawInstanceGL_earlyZPass = function (inst, glw) + { +; + if (!inst.visible || inst.width === 0 || inst.height === 0) + return; + inst.update_bbox(); + var bbox = inst.bbox; + if (bbox.right < this.viewLeft || bbox.bottom < this.viewTop || bbox.left > this.viewRight || bbox.top > this.viewBottom) + return; + inst.earlyz_index = this.runtime.earlyz_index++; + if (inst.blend_mode !== 0 || inst.opacity !== 1 || !inst.shaders_preserve_opaqueness || !inst.drawGL_earlyZPass) + return; + glw.setEarlyZIndex(inst.earlyz_index); + inst.drawGL_earlyZPass(glw); + }; + Layer.prototype.drawInstanceWithShadersGL = function (inst, glw) + { + var shaderindex = inst.active_effect_types[0].shaderindex; + var etindex = inst.active_effect_types[0].index; + var myscale = this.getScale(); + if (inst.active_effect_types.length === 1 && !glw.programUsesCrossSampling(shaderindex) && + !glw.programExtendsBox(shaderindex) && ((!inst.angle && !inst.layer.getAngle()) || !glw.programUsesDest(shaderindex)) && + inst.opacity === 1 && !inst.type.plugin.must_predraw) + { + glw.switchProgram(shaderindex); + glw.setBlend(inst.srcBlend, inst.destBlend); + if (glw.programIsAnimated(shaderindex)) + this.runtime.redraw = true; + var destStartX = 0, destStartY = 0, destEndX = 0, destEndY = 0; + if (glw.programUsesDest(shaderindex)) + { + var bbox = inst.bbox; + var screenleft = this.layerToCanvas(bbox.left, bbox.top, true, true); + var screentop = this.layerToCanvas(bbox.left, bbox.top, false, true); + var screenright = this.layerToCanvas(bbox.right, bbox.bottom, true, true); + var screenbottom = this.layerToCanvas(bbox.right, bbox.bottom, false, true); + destStartX = screenleft / windowWidth; + destStartY = 1 - screentop / windowHeight; + destEndX = screenright / windowWidth; + destEndY = 1 - screenbottom / windowHeight; + } + var pixelWidth; + var pixelHeight; + if (inst.curFrame && inst.curFrame.texture_img) + { + var img = inst.curFrame.texture_img; + pixelWidth = 1.0 / img.width; + pixelHeight = 1.0 / img.height; + } + else + { + pixelWidth = 1.0 / inst.width; + pixelHeight = 1.0 / inst.height; + } + glw.setProgramParameters(this.render_offscreen ? this.runtime.layer_tex : this.layout.getRenderTarget(), // backTex + pixelWidth, + pixelHeight, + destStartX, destStartY, + destEndX, destEndY, + myscale, + this.getAngle(), + this.viewLeft, this.viewTop, + (this.viewLeft + this.viewRight) / 2, (this.viewTop + this.viewBottom) / 2, + this.runtime.kahanTime.sum, + inst.effect_params[etindex]); + inst.drawGL(glw); + } + else + { + this.layout.renderEffectChain(glw, this, inst, this.render_offscreen ? this.runtime.layer_tex : this.layout.getRenderTarget()); + glw.resetModelView(); + glw.scale(myscale, myscale); + glw.rotateZ(-this.getAngle()); + glw.translate((this.viewLeft + this.viewRight) / -2, (this.viewTop + this.viewBottom) / -2); + glw.updateModelView(); + } + }; + Layer.prototype.canvasToLayer = function (ptx, pty, getx, using_draw_area) + { + var multiplier = this.runtime.devicePixelRatio; + if (this.runtime.isRetina) + { + ptx *= multiplier; + pty *= multiplier; + } + var ox = this.runtime.parallax_x_origin; + var oy = this.runtime.parallax_y_origin; + var par_x = ((this.layout.scrollX - ox) * this.parallaxX) + ox; + var par_y = ((this.layout.scrollY - oy) * this.parallaxY) + oy; + var x = par_x; + var y = par_y; + var invScale = 1 / this.getScale(!using_draw_area); + if (using_draw_area) + { + x -= (this.runtime.draw_width * invScale) / 2; + y -= (this.runtime.draw_height * invScale) / 2; + } + else + { + x -= (this.runtime.width * invScale) / 2; + y -= (this.runtime.height * invScale) / 2; + } + x += ptx * invScale; + y += pty * invScale; + var a = this.getAngle(); + if (a !== 0) + { + x -= par_x; + y -= par_y; + var cosa = Math.cos(a); + var sina = Math.sin(a); + var x_temp = (x * cosa) - (y * sina); + y = (y * cosa) + (x * sina); + x = x_temp; + x += par_x; + y += par_y; + } + return getx ? x : y; + }; + Layer.prototype.layerToCanvas = function (ptx, pty, getx, using_draw_area) + { + var ox = this.runtime.parallax_x_origin; + var oy = this.runtime.parallax_y_origin; + var par_x = ((this.layout.scrollX - ox) * this.parallaxX) + ox; + var par_y = ((this.layout.scrollY - oy) * this.parallaxY) + oy; + var x = par_x; + var y = par_y; + var a = this.getAngle(); + if (a !== 0) + { + ptx -= par_x; + pty -= par_y; + var cosa = Math.cos(-a); + var sina = Math.sin(-a); + var x_temp = (ptx * cosa) - (pty * sina); + pty = (pty * cosa) + (ptx * sina); + ptx = x_temp; + ptx += par_x; + pty += par_y; + } + var invScale = 1 / this.getScale(!using_draw_area); + if (using_draw_area) + { + x -= (this.runtime.draw_width * invScale) / 2; + y -= (this.runtime.draw_height * invScale) / 2; + } + else + { + x -= (this.runtime.width * invScale) / 2; + y -= (this.runtime.height * invScale) / 2; + } + x = (ptx - x) / invScale; + y = (pty - y) / invScale; + var multiplier = this.runtime.devicePixelRatio; + if (this.runtime.isRetina && !using_draw_area) + { + x /= multiplier; + y /= multiplier; + } + return getx ? x : y; + }; + Layer.prototype.rotatePt = function (x_, y_, getx) + { + if (this.getAngle() === 0) + return getx ? x_ : y_; + var nx = this.layerToCanvas(x_, y_, true); + var ny = this.layerToCanvas(x_, y_, false); + this.disableAngle = true; + var px = this.canvasToLayer(nx, ny, true); + var py = this.canvasToLayer(nx, ny, true); + this.disableAngle = false; + return getx ? px : py; + }; + Layer.prototype.saveToJSON = function () + { + var i, len, et; + var o = { + "s": this.scale, + "a": this.angle, + "vl": this.viewLeft, + "vt": this.viewTop, + "vr": this.viewRight, + "vb": this.viewBottom, + "v": this.visible, + "bc": this.background_color, + "t": this.transparent, + "px": this.parallaxX, + "py": this.parallaxY, + "o": this.opacity, + "zr": this.zoomRate, + "fx": [], + "cg": this.created_globals, // added r197; list of global UIDs already created + "instances": [] + }; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + et = this.effect_types[i]; + o["fx"].push({"name": et.name, "active": et.active, "params": this.effect_params[et.index] }); + } + return o; + }; + Layer.prototype.loadFromJSON = function (o) + { + var i, j, len, p, inst, fx; + this.scale = o["s"]; + this.angle = o["a"]; + this.viewLeft = o["vl"]; + this.viewTop = o["vt"]; + this.viewRight = o["vr"]; + this.viewBottom = o["vb"]; + this.visible = o["v"]; + this.background_color = o["bc"]; + this.transparent = o["t"]; + this.parallaxX = o["px"]; + this.parallaxY = o["py"]; + this.opacity = o["o"]; + this.zoomRate = o["zr"]; + this.created_globals = o["cg"] || []; // added r197 + cr.shallowAssignArray(this.initial_instances, this.startup_initial_instances); + var temp_set = new cr.ObjectSet(); + for (i = 0, len = this.created_globals.length; i < len; ++i) + temp_set.add(this.created_globals[i]); + for (i = 0, j = 0, len = this.initial_instances.length; i < len; ++i) + { + if (!temp_set.contains(this.initial_instances[i][2])) // UID in element 2 + { + this.initial_instances[j] = this.initial_instances[i]; + ++j; + } + } + cr.truncateArray(this.initial_instances, j); + var ofx = o["fx"]; + for (i = 0, len = ofx.length; i < len; i++) + { + fx = this.getEffectByName(ofx[i]["name"]); + if (!fx) + continue; // must've gone missing + fx.active = ofx[i]["active"]; + this.effect_params[fx.index] = ofx[i]["params"]; + } + this.updateActiveEffects(); + this.instances.sort(sort_by_zindex); + this.zindices_stale = true; + }; + cr.layer = Layer; +}()); +; +(function() +{ + var allUniqueSolModifiers = []; + function testSolsMatch(arr1, arr2) + { + var i, len = arr1.length; + switch (len) { + case 0: + return true; + case 1: + return arr1[0] === arr2[0]; + case 2: + return arr1[0] === arr2[0] && arr1[1] === arr2[1]; + default: + for (i = 0; i < len; i++) + { + if (arr1[i] !== arr2[i]) + return false; + } + return true; + } + }; + function solArraySorter(t1, t2) + { + return t1.index - t2.index; + }; + function findMatchingSolModifier(arr) + { + var i, len, u, temp, subarr; + if (arr.length === 2) + { + if (arr[0].index > arr[1].index) + { + temp = arr[0]; + arr[0] = arr[1]; + arr[1] = temp; + } + } + else if (arr.length > 2) + arr.sort(solArraySorter); // so testSolsMatch compares in same order + if (arr.length >= allUniqueSolModifiers.length) + allUniqueSolModifiers.length = arr.length + 1; + if (!allUniqueSolModifiers[arr.length]) + allUniqueSolModifiers[arr.length] = []; + subarr = allUniqueSolModifiers[arr.length]; + for (i = 0, len = subarr.length; i < len; i++) + { + u = subarr[i]; + if (testSolsMatch(arr, u)) + return u; + } + subarr.push(arr); + return arr; + }; + function EventSheet(runtime, m) + { + this.runtime = runtime; + this.triggers = {}; + this.fasttriggers = {}; + this.hasRun = false; + this.includes = new cr.ObjectSet(); // all event sheets included by this sheet, at first-level indirection only + this.deep_includes = []; // all includes from this sheet recursively, in trigger order + this.already_included_sheets = []; // used while building deep_includes + this.name = m[0]; + var em = m[1]; // events model + this.events = []; // triggers won't make it to this array + var i, len; + for (i = 0, len = em.length; i < len; i++) + this.init_event(em[i], null, this.events); + }; + EventSheet.prototype.toString = function () + { + return this.name; + }; + EventSheet.prototype.init_event = function (m, parent, nontriggers) + { + switch (m[0]) { + case 0: // event block + { + var block = new cr.eventblock(this, parent, m); + cr.seal(block); + if (block.orblock) + { + nontriggers.push(block); + var i, len; + for (i = 0, len = block.conditions.length; i < len; i++) + { + if (block.conditions[i].trigger) + this.init_trigger(block, i); + } + } + else + { + if (block.is_trigger()) + this.init_trigger(block, 0); + else + nontriggers.push(block); + } + break; + } + case 1: // variable + { + var v = new cr.eventvariable(this, parent, m); + cr.seal(v); + nontriggers.push(v); + break; + } + case 2: // include + { + var inc = new cr.eventinclude(this, parent, m); + cr.seal(inc); + nontriggers.push(inc); + break; + } + default: +; + } + }; + EventSheet.prototype.postInit = function () + { + var i, len; + for (i = 0, len = this.events.length; i < len; i++) + { + this.events[i].postInit(i < len - 1 && this.events[i + 1].is_else_block); + } + }; + EventSheet.prototype.updateDeepIncludes = function () + { + cr.clearArray(this.deep_includes); + cr.clearArray(this.already_included_sheets); + this.addDeepIncludes(this); + cr.clearArray(this.already_included_sheets); + }; + EventSheet.prototype.addDeepIncludes = function (root_sheet) + { + var i, len, inc, sheet; + var deep_includes = root_sheet.deep_includes; + var already_included_sheets = root_sheet.already_included_sheets; + var arr = this.includes.valuesRef(); + for (i = 0, len = arr.length; i < len; ++i) + { + inc = arr[i]; + sheet = inc.include_sheet; + if (!inc.isActive() || root_sheet === sheet || already_included_sheets.indexOf(sheet) > -1) + continue; + already_included_sheets.push(sheet); + sheet.addDeepIncludes(root_sheet); + deep_includes.push(sheet); + } + }; + EventSheet.prototype.run = function (from_include) + { + if (!this.runtime.resuming_breakpoint) + { + this.hasRun = true; + if (!from_include) + this.runtime.isRunningEvents = true; + } + var i, len; + for (i = 0, len = this.events.length; i < len; i++) + { + var ev = this.events[i]; + ev.run(); + this.runtime.clearSol(ev.solModifiers); + if (this.runtime.hasPendingInstances) + this.runtime.ClearDeathRow(); + } + if (!from_include) + this.runtime.isRunningEvents = false; + }; + function isPerformanceSensitiveTrigger(method) + { + if (cr.plugins_.Sprite && method === cr.plugins_.Sprite.prototype.cnds.OnFrameChanged) + { + return true; + } + return false; + }; + EventSheet.prototype.init_trigger = function (trig, index) + { + if (!trig.orblock) + this.runtime.triggers_to_postinit.push(trig); // needs to be postInit'd later + var i, len; + var cnd = trig.conditions[index]; + var type_name; + if (cnd.type) + type_name = cnd.type.name; + else + type_name = "system"; + var fasttrigger = cnd.fasttrigger; + var triggers = (fasttrigger ? this.fasttriggers : this.triggers); + if (!triggers[type_name]) + triggers[type_name] = []; + var obj_entry = triggers[type_name]; + var method = cnd.func; + if (fasttrigger) + { + if (!cnd.parameters.length) // no parameters + return; + var firstparam = cnd.parameters[0]; + if (firstparam.type !== 1 || // not a string param + firstparam.expression.type !== 2) // not a string literal node + { + return; + } + var fastevs; + var firstvalue = firstparam.expression.value.toLowerCase(); + var i, len; + for (i = 0, len = obj_entry.length; i < len; i++) + { + if (obj_entry[i].method == method) + { + fastevs = obj_entry[i].evs; + if (!fastevs[firstvalue]) + fastevs[firstvalue] = [[trig, index]]; + else + fastevs[firstvalue].push([trig, index]); + return; + } + } + fastevs = {}; + fastevs[firstvalue] = [[trig, index]]; + obj_entry.push({ method: method, evs: fastevs }); + } + else + { + for (i = 0, len = obj_entry.length; i < len; i++) + { + if (obj_entry[i].method == method) + { + obj_entry[i].evs.push([trig, index]); + return; + } + } + if (isPerformanceSensitiveTrigger(method)) + obj_entry.unshift({ method: method, evs: [[trig, index]]}); + else + obj_entry.push({ method: method, evs: [[trig, index]]}); + } + }; + cr.eventsheet = EventSheet; + function Selection(type) + { + this.type = type; + this.instances = []; // subset of picked instances + this.else_instances = []; // subset of unpicked instances + this.select_all = true; + }; + Selection.prototype.hasObjects = function () + { + if (this.select_all) + return this.type.instances.length; + else + return this.instances.length; + }; + Selection.prototype.getObjects = function () + { + if (this.select_all) + return this.type.instances; + else + return this.instances; + }; + /* + Selection.prototype.ensure_picked = function (inst, skip_siblings) + { + var i, len; + var orblock = inst.runtime.getCurrentEventStack().current_event.orblock; + if (this.select_all) + { + this.select_all = false; + if (orblock) + { + cr.shallowAssignArray(this.else_instances, inst.type.instances); + cr.arrayFindRemove(this.else_instances, inst); + } + this.instances.length = 1; + this.instances[0] = inst; + } + else + { + if (orblock) + { + i = this.else_instances.indexOf(inst); + if (i !== -1) + { + this.instances.push(this.else_instances[i]); + this.else_instances.splice(i, 1); + } + } + else + { + if (this.instances.indexOf(inst) === -1) + this.instances.push(inst); + } + } + if (!skip_siblings) + { + } + }; + */ + Selection.prototype.pick_one = function (inst) + { + if (!inst) + return; + if (inst.runtime.getCurrentEventStack().current_event.orblock) + { + if (this.select_all) + { + cr.clearArray(this.instances); + cr.shallowAssignArray(this.else_instances, inst.type.instances); + this.select_all = false; + } + var i = this.else_instances.indexOf(inst); + if (i !== -1) + { + this.instances.push(this.else_instances[i]); + this.else_instances.splice(i, 1); + } + } + else + { + this.select_all = false; + cr.clearArray(this.instances); + this.instances[0] = inst; + } + }; + cr.selection = Selection; + function EventBlock(sheet, parent, m) + { + this.sheet = sheet; + this.parent = parent; + this.runtime = sheet.runtime; + this.solModifiers = []; + this.solModifiersIncludingParents = []; + this.solWriterAfterCnds = false; // block does not change SOL after running its conditions + this.group = false; // is group of events + this.initially_activated = false; // if a group, is active on startup + this.toplevelevent = false; // is an event block parented only by a top-level group + this.toplevelgroup = false; // is parented only by other groups or is top-level (i.e. not in a subevent) + this.has_else_block = false; // is followed by else +; + this.conditions = []; + this.actions = []; + this.subevents = []; + this.group_name = ""; + this.group = false; + this.initially_activated = false; + this.group_active = false; + this.contained_includes = null; + if (m[1]) + { + this.group_name = m[1][1].toLowerCase(); + this.group = true; + this.initially_activated = !!m[1][0]; + this.contained_includes = []; + this.group_active = this.initially_activated; + this.runtime.allGroups.push(this); + this.runtime.groups_by_name[this.group_name] = this; + } + this.orblock = m[2]; + this.sid = m[4]; + if (!this.group) + this.runtime.blocksBySid[this.sid.toString()] = this; + var i, len; + var cm = m[5]; + for (i = 0, len = cm.length; i < len; i++) + { + var cnd = new cr.condition(this, cm[i]); + cnd.index = i; + cr.seal(cnd); + this.conditions.push(cnd); + /* + if (cnd.is_logical()) + this.is_logical = true; + if (cnd.type && !cnd.type.plugin.singleglobal && this.cndReferences.indexOf(cnd.type) === -1) + this.cndReferences.push(cnd.type); + */ + this.addSolModifier(cnd.type); + } + var am = m[6]; + for (i = 0, len = am.length; i < len; i++) + { + var act = new cr.action(this, am[i]); + act.index = i; + cr.seal(act); + this.actions.push(act); + } + if (m.length === 8) + { + var em = m[7]; + for (i = 0, len = em.length; i < len; i++) + this.sheet.init_event(em[i], this, this.subevents); + } + this.is_else_block = false; + if (this.conditions.length) + { + this.is_else_block = (this.conditions[0].type == null && this.conditions[0].func == cr.system_object.prototype.cnds.Else); + } + }; + window["_c2hh_"] = "3142B1E7D97A3706CD2EEDCB7012C2BFDE9A7D25"; + EventBlock.prototype.postInit = function (hasElse/*, prevBlock_*/) + { + var i, len; + var p = this.parent; + if (this.group) + { + this.toplevelgroup = true; + while (p) + { + if (!p.group) + { + this.toplevelgroup = false; + break; + } + p = p.parent; + } + } + this.toplevelevent = !this.is_trigger() && (!this.parent || (this.parent.group && this.parent.toplevelgroup)); + this.has_else_block = !!hasElse; + this.solModifiersIncludingParents = this.solModifiers.slice(0); + p = this.parent; + while (p) + { + for (i = 0, len = p.solModifiers.length; i < len; i++) + this.addParentSolModifier(p.solModifiers[i]); + p = p.parent; + } + this.solModifiers = findMatchingSolModifier(this.solModifiers); + this.solModifiersIncludingParents = findMatchingSolModifier(this.solModifiersIncludingParents); + var i, len/*, s*/; + for (i = 0, len = this.conditions.length; i < len; i++) + this.conditions[i].postInit(); + for (i = 0, len = this.actions.length; i < len; i++) + this.actions[i].postInit(); + for (i = 0, len = this.subevents.length; i < len; i++) + { + this.subevents[i].postInit(i < len - 1 && this.subevents[i + 1].is_else_block); + } + /* + if (this.is_else_block && this.prev_block) + { + for (i = 0, len = this.prev_block.solModifiers.length; i < len; i++) + { + s = this.prev_block.solModifiers[i]; + if (this.solModifiers.indexOf(s) === -1) + this.solModifiers.push(s); + } + } + */ + }; + EventBlock.prototype.setGroupActive = function (a) + { + if (this.group_active === !!a) + return; // same state + this.group_active = !!a; + var i, len; + for (i = 0, len = this.contained_includes.length; i < len; ++i) + { + this.contained_includes[i].updateActive(); + } + if (len > 0 && this.runtime.running_layout.event_sheet) + this.runtime.running_layout.event_sheet.updateDeepIncludes(); + }; + function addSolModifierToList(type, arr) + { + var i, len, t; + if (!type) + return; + if (arr.indexOf(type) === -1) + arr.push(type); + if (type.is_contained) + { + for (i = 0, len = type.container.length; i < len; i++) + { + t = type.container[i]; + if (type === t) + continue; // already handled + if (arr.indexOf(t) === -1) + arr.push(t); + } + } + }; + EventBlock.prototype.addSolModifier = function (type) + { + addSolModifierToList(type, this.solModifiers); + }; + EventBlock.prototype.addParentSolModifier = function (type) + { + addSolModifierToList(type, this.solModifiersIncludingParents); + }; + EventBlock.prototype.setSolWriterAfterCnds = function () + { + this.solWriterAfterCnds = true; + if (this.parent) + this.parent.setSolWriterAfterCnds(); + }; + EventBlock.prototype.is_trigger = function () + { + if (!this.conditions.length) // no conditions + return false; + else + return this.conditions[0].trigger; + }; + EventBlock.prototype.run = function () + { + var i, len, c, any_true = false, cnd_result; + var runtime = this.runtime; + var evinfo = this.runtime.getCurrentEventStack(); + evinfo.current_event = this; + var conditions = this.conditions; + if (!this.is_else_block) + evinfo.else_branch_ran = false; + if (this.orblock) + { + if (conditions.length === 0) + any_true = true; // be sure to run if empty block + evinfo.cndindex = 0 + for (len = conditions.length; evinfo.cndindex < len; evinfo.cndindex++) + { + c = conditions[evinfo.cndindex]; + if (c.trigger) // skip triggers when running OR block + continue; + cnd_result = c.run(); + if (cnd_result) // make sure all conditions run and run if any were true + any_true = true; + } + evinfo.last_event_true = any_true; + if (any_true) + this.run_actions_and_subevents(); + } + else + { + evinfo.cndindex = 0 + for (len = conditions.length; evinfo.cndindex < len; evinfo.cndindex++) + { + cnd_result = conditions[evinfo.cndindex].run(); + if (!cnd_result) // condition failed + { + evinfo.last_event_true = false; + if (this.toplevelevent && runtime.hasPendingInstances) + runtime.ClearDeathRow(); + return; // bail out now + } + } + evinfo.last_event_true = true; + this.run_actions_and_subevents(); + } + this.end_run(evinfo); + }; + EventBlock.prototype.end_run = function (evinfo) + { + if (evinfo.last_event_true && this.has_else_block) + evinfo.else_branch_ran = true; + if (this.toplevelevent && this.runtime.hasPendingInstances) + this.runtime.ClearDeathRow(); + }; + EventBlock.prototype.run_orblocktrigger = function (index) + { + var evinfo = this.runtime.getCurrentEventStack(); + evinfo.current_event = this; + if (this.conditions[index].run()) + { + this.run_actions_and_subevents(); + this.runtime.getCurrentEventStack().last_event_true = true; + } + }; + EventBlock.prototype.run_actions_and_subevents = function () + { + var evinfo = this.runtime.getCurrentEventStack(); + var len; + for (evinfo.actindex = 0, len = this.actions.length; evinfo.actindex < len; evinfo.actindex++) + { + if (this.actions[evinfo.actindex].run()) + return; + } + this.run_subevents(); + }; + EventBlock.prototype.resume_actions_and_subevents = function () + { + var evinfo = this.runtime.getCurrentEventStack(); + var len; + for (len = this.actions.length; evinfo.actindex < len; evinfo.actindex++) + { + if (this.actions[evinfo.actindex].run()) + return; + } + this.run_subevents(); + }; + EventBlock.prototype.run_subevents = function () + { + if (!this.subevents.length) + return; + var i, len, subev, pushpop/*, skipped_pop = false, pop_modifiers = null*/; + var last = this.subevents.length - 1; + this.runtime.pushEventStack(this); + if (this.solWriterAfterCnds) + { + for (i = 0, len = this.subevents.length; i < len; i++) + { + subev = this.subevents[i]; + pushpop = (!this.toplevelgroup || (!this.group && i < last)); + if (pushpop) + this.runtime.pushCopySol(subev.solModifiers); + subev.run(); + if (pushpop) + this.runtime.popSol(subev.solModifiers); + else + this.runtime.clearSol(subev.solModifiers); + } + } + else + { + for (i = 0, len = this.subevents.length; i < len; i++) + { + this.subevents[i].run(); + } + } + this.runtime.popEventStack(); + }; + EventBlock.prototype.run_pretrigger = function () + { + var evinfo = this.runtime.getCurrentEventStack(); + evinfo.current_event = this; + var any_true = false; + var i, len; + for (evinfo.cndindex = 0, len = this.conditions.length; evinfo.cndindex < len; evinfo.cndindex++) + { +; + if (this.conditions[evinfo.cndindex].run()) + any_true = true; + else if (!this.orblock) // condition failed (let OR blocks run all conditions anyway) + return false; // bail out + } + return this.orblock ? any_true : true; + }; + EventBlock.prototype.retrigger = function () + { + this.runtime.execcount++; + var prevcndindex = this.runtime.getCurrentEventStack().cndindex; + var len; + var evinfo = this.runtime.pushEventStack(this); + if (!this.orblock) + { + for (evinfo.cndindex = prevcndindex + 1, len = this.conditions.length; evinfo.cndindex < len; evinfo.cndindex++) + { + if (!this.conditions[evinfo.cndindex].run()) // condition failed + { + this.runtime.popEventStack(); // moving up level of recursion + return false; // bail out + } + } + } + this.run_actions_and_subevents(); + this.runtime.popEventStack(); + return true; // ran an iteration + }; + EventBlock.prototype.isFirstConditionOfType = function (cnd) + { + var cndindex = cnd.index; + if (cndindex === 0) + return true; + --cndindex; + for ( ; cndindex >= 0; --cndindex) + { + if (this.conditions[cndindex].type === cnd.type) + return false; + } + return true; + }; + cr.eventblock = EventBlock; + function Condition(block, m) + { + this.block = block; + this.sheet = block.sheet; + this.runtime = block.runtime; + this.parameters = []; + this.results = []; + this.extra = {}; // for plugins to stow away some custom info + this.index = -1; + this.anyParamVariesPerInstance = false; + this.func = this.runtime.GetObjectReference(m[1]); +; + this.trigger = (m[3] > 0); + this.fasttrigger = (m[3] === 2); + this.looping = m[4]; + this.inverted = m[5]; + this.isstatic = m[6]; + this.sid = m[7]; + this.runtime.cndsBySid[this.sid.toString()] = this; + if (m[0] === -1) // system object + { + this.type = null; + this.run = this.run_system; + this.behaviortype = null; + this.beh_index = -1; + } + else + { + this.type = this.runtime.types_by_index[m[0]]; +; + if (this.isstatic) + this.run = this.run_static; + else + this.run = this.run_object; + if (m[2]) + { + this.behaviortype = this.type.getBehaviorByName(m[2]); +; + this.beh_index = this.type.getBehaviorIndexByName(m[2]); +; + } + else + { + this.behaviortype = null; + this.beh_index = -1; + } + if (this.block.parent) + this.block.parent.setSolWriterAfterCnds(); + } + if (this.fasttrigger) + this.run = this.run_true; + if (m.length === 10) + { + var i, len; + var em = m[9]; + for (i = 0, len = em.length; i < len; i++) + { + var param = new cr.parameter(this, em[i]); + cr.seal(param); + this.parameters.push(param); + } + this.results.length = em.length; + } + }; + Condition.prototype.postInit = function () + { + var i, len, p; + for (i = 0, len = this.parameters.length; i < len; i++) + { + p = this.parameters[i]; + p.postInit(); + if (p.variesPerInstance) + this.anyParamVariesPerInstance = true; + } + }; + /* + Condition.prototype.is_logical = function () + { + return !this.type || this.type.plugin.singleglobal; + }; + */ + Condition.prototype.run_true = function () + { + return true; + }; + Condition.prototype.run_system = function () + { + var i, len; + for (i = 0, len = this.parameters.length; i < len; i++) + this.results[i] = this.parameters[i].get(); + return cr.xor(this.func.apply(this.runtime.system, this.results), this.inverted); + }; + Condition.prototype.run_static = function () + { + var i, len; + for (i = 0, len = this.parameters.length; i < len; i++) + this.results[i] = this.parameters[i].get(); + var ret = this.func.apply(this.behaviortype ? this.behaviortype : this.type, this.results); + this.type.applySolToContainer(); + return ret; + }; + Condition.prototype.run_object = function () + { + var i, j, k, leni, lenj, p, ret, met, inst, s, sol2; + var type = this.type; + var sol = type.getCurrentSol(); + var is_orblock = this.block.orblock && !this.trigger; // triggers in OR blocks need to work normally + var offset = 0; + var is_contained = type.is_contained; + var is_family = type.is_family; + var family_index = type.family_index; + var beh_index = this.beh_index; + var is_beh = (beh_index > -1); + var params_vary = this.anyParamVariesPerInstance; + var parameters = this.parameters; + var results = this.results; + var inverted = this.inverted; + var func = this.func; + var arr, container; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + { + p = parameters[j]; + if (!p.variesPerInstance) + results[j] = p.get(0); + } + } + else + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + results[j] = parameters[j].get(0); + } + if (sol.select_all) { + cr.clearArray(sol.instances); // clear contents + cr.clearArray(sol.else_instances); + arr = type.instances; + for (i = 0, leni = arr.length; i < leni; ++i) + { + inst = arr[i]; +; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + { + p = parameters[j]; + if (p.variesPerInstance) + results[j] = p.get(i); // default SOL index is current object + } + } + if (is_beh) + { + offset = 0; + if (is_family) + { + offset = inst.type.family_beh_map[family_index]; + } + ret = func.apply(inst.behavior_insts[beh_index + offset], results); + } + else + ret = func.apply(inst, results); + met = cr.xor(ret, inverted); + if (met) + sol.instances.push(inst); + else if (is_orblock) // in OR blocks, keep the instances not meeting the condition for subsequent testing + sol.else_instances.push(inst); + } + if (type.finish) + type.finish(true); + sol.select_all = false; + type.applySolToContainer(); + return sol.hasObjects(); + } + else { + k = 0; + var using_else_instances = (is_orblock && !this.block.isFirstConditionOfType(this)); + arr = (using_else_instances ? sol.else_instances : sol.instances); + var any_true = false; + for (i = 0, leni = arr.length; i < leni; ++i) + { + inst = arr[i]; +; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + { + p = parameters[j]; + if (p.variesPerInstance) + results[j] = p.get(i); // default SOL index is current object + } + } + if (is_beh) + { + offset = 0; + if (is_family) + { + offset = inst.type.family_beh_map[family_index]; + } + ret = func.apply(inst.behavior_insts[beh_index + offset], results); + } + else + ret = func.apply(inst, results); + if (cr.xor(ret, inverted)) + { + any_true = true; + if (using_else_instances) + { + sol.instances.push(inst); + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + s.type.getCurrentSol().instances.push(s); + } + } + } + else + { + arr[k] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + s.type.getCurrentSol().instances[k] = s; + } + } + k++; + } + } + else + { + if (using_else_instances) + { + arr[k] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + s.type.getCurrentSol().else_instances[k] = s; + } + } + k++; + } + else if (is_orblock) + { + sol.else_instances.push(inst); + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + s.type.getCurrentSol().else_instances.push(s); + } + } + } + } + } + cr.truncateArray(arr, k); + if (is_contained) + { + container = type.container; + for (i = 0, leni = container.length; i < leni; i++) + { + sol2 = container[i].getCurrentSol(); + if (using_else_instances) + cr.truncateArray(sol2.else_instances, k); + else + cr.truncateArray(sol2.instances, k); + } + } + var pick_in_finish = any_true; // don't pick in finish() if we're only doing the logic test below + if (using_else_instances && !any_true) + { + for (i = 0, leni = sol.instances.length; i < leni; i++) + { + inst = sol.instances[i]; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; j++) + { + p = parameters[j]; + if (p.variesPerInstance) + results[j] = p.get(i); + } + } + if (is_beh) + ret = func.apply(inst.behavior_insts[beh_index], results); + else + ret = func.apply(inst, results); + if (cr.xor(ret, inverted)) + { + any_true = true; + break; // got our flag, don't need to test any more + } + } + } + if (type.finish) + type.finish(pick_in_finish || is_orblock); + return is_orblock ? any_true : sol.hasObjects(); + } + }; + cr.condition = Condition; + function Action(block, m) + { + this.block = block; + this.sheet = block.sheet; + this.runtime = block.runtime; + this.parameters = []; + this.results = []; + this.extra = {}; // for plugins to stow away some custom info + this.index = -1; + this.anyParamVariesPerInstance = false; + this.func = this.runtime.GetObjectReference(m[1]); +; + if (m[0] === -1) // system + { + this.type = null; + this.run = this.run_system; + this.behaviortype = null; + this.beh_index = -1; + } + else + { + this.type = this.runtime.types_by_index[m[0]]; +; + this.run = this.run_object; + if (m[2]) + { + this.behaviortype = this.type.getBehaviorByName(m[2]); +; + this.beh_index = this.type.getBehaviorIndexByName(m[2]); +; + } + else + { + this.behaviortype = null; + this.beh_index = -1; + } + } + this.sid = m[3]; + this.runtime.actsBySid[this.sid.toString()] = this; + if (m.length === 6) + { + var i, len; + var em = m[5]; + for (i = 0, len = em.length; i < len; i++) + { + var param = new cr.parameter(this, em[i]); + cr.seal(param); + this.parameters.push(param); + } + this.results.length = em.length; + } + }; + Action.prototype.postInit = function () + { + var i, len, p; + for (i = 0, len = this.parameters.length; i < len; i++) + { + p = this.parameters[i]; + p.postInit(); + if (p.variesPerInstance) + this.anyParamVariesPerInstance = true; + } + }; + Action.prototype.run_system = function () + { + var runtime = this.runtime; + var i, len; + var parameters = this.parameters; + var results = this.results; + for (i = 0, len = parameters.length; i < len; ++i) + results[i] = parameters[i].get(); + return this.func.apply(runtime.system, results); + }; + Action.prototype.run_object = function () + { + var type = this.type; + var beh_index = this.beh_index; + var family_index = type.family_index; + var params_vary = this.anyParamVariesPerInstance; + var parameters = this.parameters; + var results = this.results; + var func = this.func; + var instances = type.getCurrentSol().getObjects(); + var is_family = type.is_family; + var is_beh = (beh_index > -1); + var i, j, leni, lenj, p, inst, offset; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + { + p = parameters[j]; + if (!p.variesPerInstance) + results[j] = p.get(0); + } + } + else + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + results[j] = parameters[j].get(0); + } + for (i = 0, leni = instances.length; i < leni; ++i) + { + inst = instances[i]; + if (params_vary) + { + for (j = 0, lenj = parameters.length; j < lenj; ++j) + { + p = parameters[j]; + if (p.variesPerInstance) + results[j] = p.get(i); // pass i to use as default SOL index + } + } + if (is_beh) + { + offset = 0; + if (is_family) + { + offset = inst.type.family_beh_map[family_index]; + } + func.apply(inst.behavior_insts[beh_index + offset], results); + } + else + func.apply(inst, results); + } + return false; + }; + cr.action = Action; + var tempValues = []; + var tempValuesPtr = -1; + function pushTempValue() + { + tempValuesPtr++; + if (tempValues.length === tempValuesPtr) + tempValues.push(new cr.expvalue()); + return tempValues[tempValuesPtr]; + }; + function popTempValue() + { + tempValuesPtr--; + }; + function Parameter(owner, m) + { + this.owner = owner; + this.block = owner.block; + this.sheet = owner.sheet; + this.runtime = owner.runtime; + this.type = m[0]; + this.expression = null; + this.solindex = 0; + this.get = null; + this.combosel = 0; + this.layout = null; + this.key = 0; + this.object = null; + this.index = 0; + this.varname = null; + this.eventvar = null; + this.fileinfo = null; + this.subparams = null; + this.variadicret = null; + this.subparams = null; + this.variadicret = null; + this.variesPerInstance = false; + var i, len, param; + switch (m[0]) + { + case 0: // number + case 7: // any + this.expression = new cr.expNode(this, m[1]); + this.solindex = 0; + this.get = this.get_exp; + break; + case 1: // string + this.expression = new cr.expNode(this, m[1]); + this.solindex = 0; + this.get = this.get_exp_str; + break; + case 5: // layer + this.expression = new cr.expNode(this, m[1]); + this.solindex = 0; + this.get = this.get_layer; + break; + case 3: // combo + case 8: // cmp + this.combosel = m[1]; + this.get = this.get_combosel; + break; + case 6: // layout + this.layout = this.runtime.layouts[m[1]]; +; + this.get = this.get_layout; + break; + case 9: // keyb + this.key = m[1]; + this.get = this.get_key; + break; + case 4: // object + this.object = this.runtime.types_by_index[m[1]]; +; + this.get = this.get_object; + this.block.addSolModifier(this.object); + if (this.owner instanceof cr.action) + this.block.setSolWriterAfterCnds(); + else if (this.block.parent) + this.block.parent.setSolWriterAfterCnds(); + break; + case 10: // instvar + this.index = m[1]; + if (owner.type && owner.type.is_family) + { + this.get = this.get_familyvar; + this.variesPerInstance = true; + } + else + this.get = this.get_instvar; + break; + case 11: // eventvar + this.varname = m[1]; + this.eventvar = null; + this.get = this.get_eventvar; + break; + case 2: // audiofile ["name", ismusic] + case 12: // fileinfo "name" + this.fileinfo = m[1]; + this.get = this.get_audiofile; + break; + case 13: // variadic + this.get = this.get_variadic; + this.subparams = []; + this.variadicret = []; + for (i = 1, len = m.length; i < len; i++) + { + param = new cr.parameter(this.owner, m[i]); + cr.seal(param); + this.subparams.push(param); + this.variadicret.push(0); + } + break; + default: +; + } + }; + Parameter.prototype.postInit = function () + { + var i, len; + if (this.type === 11) // eventvar + { + this.eventvar = this.runtime.getEventVariableByName(this.varname, this.block.parent); +; + } + else if (this.type === 13) // variadic, postInit all sub-params + { + for (i = 0, len = this.subparams.length; i < len; i++) + this.subparams[i].postInit(); + } + if (this.expression) + this.expression.postInit(); + }; + Parameter.prototype.maybeVaryForType = function (t) + { + if (this.variesPerInstance) + return; // already varies per instance, no need to check again + if (!t) + return; // never vary for system type + if (!t.plugin.singleglobal) + { + this.variesPerInstance = true; + return; + } + }; + Parameter.prototype.setVaries = function () + { + this.variesPerInstance = true; + }; + Parameter.prototype.get_exp = function (solindex) + { + this.solindex = solindex || 0; // default SOL index to use + var temp = pushTempValue(); + this.expression.get(temp); + popTempValue(); + return temp.data; // return actual JS value, not expvalue + }; + Parameter.prototype.get_exp_str = function (solindex) + { + this.solindex = solindex || 0; // default SOL index to use + var temp = pushTempValue(); + this.expression.get(temp); + popTempValue(); + if (cr.is_string(temp.data)) + return temp.data; + else + return ""; + }; + Parameter.prototype.get_object = function () + { + return this.object; + }; + Parameter.prototype.get_combosel = function () + { + return this.combosel; + }; + Parameter.prototype.get_layer = function (solindex) + { + this.solindex = solindex || 0; // default SOL index to use + var temp = pushTempValue(); + this.expression.get(temp); + popTempValue(); + if (temp.is_number()) + return this.runtime.getLayerByNumber(temp.data); + else + return this.runtime.getLayerByName(temp.data); + } + Parameter.prototype.get_layout = function () + { + return this.layout; + }; + Parameter.prototype.get_key = function () + { + return this.key; + }; + Parameter.prototype.get_instvar = function () + { + return this.index; + }; + Parameter.prototype.get_familyvar = function (solindex_) + { + var solindex = solindex_ || 0; + var familytype = this.owner.type; + var realtype = null; + var sol = familytype.getCurrentSol(); + var objs = sol.getObjects(); + if (objs.length) + realtype = objs[solindex % objs.length].type; + else if (sol.else_instances.length) + realtype = sol.else_instances[solindex % sol.else_instances.length].type; + else if (familytype.instances.length) + realtype = familytype.instances[solindex % familytype.instances.length].type; + else + return 0; + return this.index + realtype.family_var_map[familytype.family_index]; + }; + Parameter.prototype.get_eventvar = function () + { + return this.eventvar; + }; + Parameter.prototype.get_audiofile = function () + { + return this.fileinfo; + }; + Parameter.prototype.get_variadic = function () + { + var i, len; + for (i = 0, len = this.subparams.length; i < len; i++) + { + this.variadicret[i] = this.subparams[i].get(); + } + return this.variadicret; + }; + cr.parameter = Parameter; + function EventVariable(sheet, parent, m) + { + this.sheet = sheet; + this.parent = parent; + this.runtime = sheet.runtime; + this.solModifiers = []; + this.name = m[1]; + this.vartype = m[2]; + this.initial = m[3]; + this.is_static = !!m[4]; + this.is_constant = !!m[5]; + this.sid = m[6]; + this.runtime.varsBySid[this.sid.toString()] = this; + this.data = this.initial; // note: also stored in event stack frame for local nonstatic nonconst vars + if (this.parent) // local var + { + if (this.is_static || this.is_constant) + this.localIndex = -1; + else + this.localIndex = this.runtime.stackLocalCount++; + this.runtime.all_local_vars.push(this); + } + else // global var + { + this.localIndex = -1; + this.runtime.all_global_vars.push(this); + } + }; + EventVariable.prototype.postInit = function () + { + this.solModifiers = findMatchingSolModifier(this.solModifiers); + }; + EventVariable.prototype.setValue = function (x) + { +; + var lvs = this.runtime.getCurrentLocalVarStack(); + if (!this.parent || this.is_static || !lvs) + this.data = x; + else // local nonstatic variable: use event stack to keep value at this level of recursion + { + if (this.localIndex >= lvs.length) + lvs.length = this.localIndex + 1; + lvs[this.localIndex] = x; + } + }; + EventVariable.prototype.getValue = function () + { + var lvs = this.runtime.getCurrentLocalVarStack(); + if (!this.parent || this.is_static || !lvs || this.is_constant) + return this.data; + else // local nonstatic variable + { + if (this.localIndex >= lvs.length) + { + return this.initial; + } + if (typeof lvs[this.localIndex] === "undefined") + { + return this.initial; + } + return lvs[this.localIndex]; + } + }; + EventVariable.prototype.run = function () + { + if (this.parent && !this.is_static && !this.is_constant) + this.setValue(this.initial); + }; + cr.eventvariable = EventVariable; + function EventInclude(sheet, parent, m) + { + this.sheet = sheet; + this.parent = parent; + this.runtime = sheet.runtime; + this.solModifiers = []; + this.include_sheet = null; // determined in postInit + this.include_sheet_name = m[1]; + this.active = true; + }; + EventInclude.prototype.toString = function () + { + return "include:" + this.include_sheet.toString(); + }; + EventInclude.prototype.postInit = function () + { + this.include_sheet = this.runtime.eventsheets[this.include_sheet_name]; +; +; + this.sheet.includes.add(this); + this.solModifiers = findMatchingSolModifier(this.solModifiers); + var p = this.parent; + while (p) + { + if (p.group) + p.contained_includes.push(this); + p = p.parent; + } + this.updateActive(); + }; + EventInclude.prototype.run = function () + { + if (this.parent) + this.runtime.pushCleanSol(this.runtime.types_by_index); + if (!this.include_sheet.hasRun) + this.include_sheet.run(true); // from include + if (this.parent) + this.runtime.popSol(this.runtime.types_by_index); + }; + EventInclude.prototype.updateActive = function () + { + var p = this.parent; + while (p) + { + if (p.group && !p.group_active) + { + this.active = false; + return; + } + p = p.parent; + } + this.active = true; + }; + EventInclude.prototype.isActive = function () + { + return this.active; + }; + cr.eventinclude = EventInclude; + function EventStackFrame() + { + this.temp_parents_arr = []; + this.reset(null); + cr.seal(this); + }; + EventStackFrame.prototype.reset = function (cur_event) + { + this.current_event = cur_event; + this.cndindex = 0; + this.actindex = 0; + cr.clearArray(this.temp_parents_arr); + this.last_event_true = false; + this.else_branch_ran = false; + this.any_true_state = false; + }; + EventStackFrame.prototype.isModifierAfterCnds = function () + { + if (this.current_event.solWriterAfterCnds) + return true; + if (this.cndindex < this.current_event.conditions.length - 1) + return !!this.current_event.solModifiers.length; + return false; + }; + cr.eventStackFrame = EventStackFrame; +}()); +(function() +{ + function ExpNode(owner_, m) + { + this.owner = owner_; + this.runtime = owner_.runtime; + this.type = m[0]; +; + this.get = [this.eval_int, + this.eval_float, + this.eval_string, + this.eval_unaryminus, + this.eval_add, + this.eval_subtract, + this.eval_multiply, + this.eval_divide, + this.eval_mod, + this.eval_power, + this.eval_and, + this.eval_or, + this.eval_equal, + this.eval_notequal, + this.eval_less, + this.eval_lessequal, + this.eval_greater, + this.eval_greaterequal, + this.eval_conditional, + this.eval_system_exp, + this.eval_object_exp, + this.eval_instvar_exp, + this.eval_behavior_exp, + this.eval_eventvar_exp][this.type]; + var paramsModel = null; + this.value = null; + this.first = null; + this.second = null; + this.third = null; + this.func = null; + this.results = null; + this.parameters = null; + this.object_type = null; + this.beh_index = -1; + this.instance_expr = null; + this.varindex = -1; + this.behavior_type = null; + this.varname = null; + this.eventvar = null; + this.return_string = false; + switch (this.type) { + case 0: // int + case 1: // float + case 2: // string + this.value = m[1]; + break; + case 3: // unaryminus + this.first = new cr.expNode(owner_, m[1]); + break; + case 18: // conditional + this.first = new cr.expNode(owner_, m[1]); + this.second = new cr.expNode(owner_, m[2]); + this.third = new cr.expNode(owner_, m[3]); + break; + case 19: // system_exp + this.func = this.runtime.GetObjectReference(m[1]); +; + if (this.func === cr.system_object.prototype.exps.random + || this.func === cr.system_object.prototype.exps.choose) + { + this.owner.setVaries(); + } + this.results = []; + this.parameters = []; + if (m.length === 3) + { + paramsModel = m[2]; + this.results.length = paramsModel.length + 1; // must also fit 'ret' + } + else + this.results.length = 1; // to fit 'ret' + break; + case 20: // object_exp + this.object_type = this.runtime.types_by_index[m[1]]; +; + this.beh_index = -1; + this.func = this.runtime.GetObjectReference(m[2]); + this.return_string = m[3]; + if (cr.plugins_.Function && this.func === cr.plugins_.Function.prototype.exps.Call) + { + this.owner.setVaries(); + } + if (m[4]) + this.instance_expr = new cr.expNode(owner_, m[4]); + else + this.instance_expr = null; + this.results = []; + this.parameters = []; + if (m.length === 6) + { + paramsModel = m[5]; + this.results.length = paramsModel.length + 1; + } + else + this.results.length = 1; // to fit 'ret' + break; + case 21: // instvar_exp + this.object_type = this.runtime.types_by_index[m[1]]; +; + this.return_string = m[2]; + if (m[3]) + this.instance_expr = new cr.expNode(owner_, m[3]); + else + this.instance_expr = null; + this.varindex = m[4]; + break; + case 22: // behavior_exp + this.object_type = this.runtime.types_by_index[m[1]]; +; + this.behavior_type = this.object_type.getBehaviorByName(m[2]); +; + this.beh_index = this.object_type.getBehaviorIndexByName(m[2]); + this.func = this.runtime.GetObjectReference(m[3]); + this.return_string = m[4]; + if (m[5]) + this.instance_expr = new cr.expNode(owner_, m[5]); + else + this.instance_expr = null; + this.results = []; + this.parameters = []; + if (m.length === 7) + { + paramsModel = m[6]; + this.results.length = paramsModel.length + 1; + } + else + this.results.length = 1; // to fit 'ret' + break; + case 23: // eventvar_exp + this.varname = m[1]; + this.eventvar = null; // assigned in postInit + break; + } + this.owner.maybeVaryForType(this.object_type); + if (this.type >= 4 && this.type <= 17) + { + this.first = new cr.expNode(owner_, m[1]); + this.second = new cr.expNode(owner_, m[2]); + } + if (paramsModel) + { + var i, len; + for (i = 0, len = paramsModel.length; i < len; i++) + this.parameters.push(new cr.expNode(owner_, paramsModel[i])); + } + cr.seal(this); + }; + ExpNode.prototype.postInit = function () + { + if (this.type === 23) // eventvar_exp + { + this.eventvar = this.owner.runtime.getEventVariableByName(this.varname, this.owner.block.parent); +; + } + if (this.first) + this.first.postInit(); + if (this.second) + this.second.postInit(); + if (this.third) + this.third.postInit(); + if (this.instance_expr) + this.instance_expr.postInit(); + if (this.parameters) + { + var i, len; + for (i = 0, len = this.parameters.length; i < len; i++) + this.parameters[i].postInit(); + } + }; + var tempValues = []; + var tempValuesPtr = -1; + function pushTempValue() + { + ++tempValuesPtr; + if (tempValues.length === tempValuesPtr) + tempValues.push(new cr.expvalue()); + return tempValues[tempValuesPtr]; + }; + function popTempValue() + { + --tempValuesPtr; + }; + function eval_params(parameters, results, temp) + { + var i, len; + for (i = 0, len = parameters.length; i < len; ++i) + { + parameters[i].get(temp); + results[i + 1] = temp.data; // passing actual javascript value as argument instead of expvalue + } + } + ExpNode.prototype.eval_system_exp = function (ret) + { + var parameters = this.parameters; + var results = this.results; + results[0] = ret; + var temp = pushTempValue(); + eval_params(parameters, results, temp); + popTempValue(); + this.func.apply(this.runtime.system, results); + }; + ExpNode.prototype.eval_object_exp = function (ret) + { + var object_type = this.object_type; + var results = this.results; + var parameters = this.parameters; + var instance_expr = this.instance_expr; + var func = this.func; + var index = this.owner.solindex; // default to parameter's intended SOL index + var sol = object_type.getCurrentSol(); + var instances = sol.getObjects(); + if (!instances.length) + { + if (sol.else_instances.length) + instances = sol.else_instances; + else + { + if (this.return_string) + ret.set_string(""); + else + ret.set_int(0); + return; + } + } + results[0] = ret; + ret.object_class = object_type; // so expression can access family type if need be + var temp = pushTempValue(); + eval_params(parameters, results, temp); + if (instance_expr) { + instance_expr.get(temp); + if (temp.is_number()) { + index = temp.data; + instances = object_type.instances; // pick from all instances, not SOL + } + } + popTempValue(); + var len = instances.length; + if (index >= len || index <= -len) + index %= len; // wraparound + if (index < 0) + index += len; + var returned_val = func.apply(instances[index], results); +; + }; + ExpNode.prototype.eval_behavior_exp = function (ret) + { + var object_type = this.object_type; + var results = this.results; + var parameters = this.parameters; + var instance_expr = this.instance_expr; + var beh_index = this.beh_index; + var func = this.func; + var index = this.owner.solindex; // default to parameter's intended SOL index + var sol = object_type.getCurrentSol(); + var instances = sol.getObjects(); + if (!instances.length) + { + if (sol.else_instances.length) + instances = sol.else_instances; + else + { + if (this.return_string) + ret.set_string(""); + else + ret.set_int(0); + return; + } + } + results[0] = ret; + ret.object_class = object_type; // so expression can access family type if need be + var temp = pushTempValue(); + eval_params(parameters, results, temp); + if (instance_expr) { + instance_expr.get(temp); + if (temp.is_number()) { + index = temp.data; + instances = object_type.instances; // pick from all instances, not SOL + } + } + popTempValue(); + var len = instances.length; + if (index >= len || index <= -len) + index %= len; // wraparound + if (index < 0) + index += len; + var inst = instances[index]; + var offset = 0; + if (object_type.is_family) + { + offset = inst.type.family_beh_map[object_type.family_index]; + } + var returned_val = func.apply(inst.behavior_insts[beh_index + offset], results); +; + }; + ExpNode.prototype.eval_instvar_exp = function (ret) + { + var instance_expr = this.instance_expr; + var object_type = this.object_type; + var varindex = this.varindex; + var index = this.owner.solindex; // default to parameter's intended SOL index + var sol = object_type.getCurrentSol(); + var instances = sol.getObjects(); + var inst; + if (!instances.length) + { + if (sol.else_instances.length) + instances = sol.else_instances; + else + { + if (this.return_string) + ret.set_string(""); + else + ret.set_int(0); + return; + } + } + if (instance_expr) + { + var temp = pushTempValue(); + instance_expr.get(temp); + if (temp.is_number()) + { + index = temp.data; + var type_instances = object_type.instances; + if (type_instances.length !== 0) // avoid NaN result with % + { + index %= type_instances.length; // wraparound + if (index < 0) // offset + index += type_instances.length; + } + inst = object_type.getInstanceByIID(index); + var to_ret = inst.instance_vars[varindex]; + if (cr.is_string(to_ret)) + ret.set_string(to_ret); + else + ret.set_float(to_ret); + popTempValue(); + return; // done + } + popTempValue(); + } + var len = instances.length; + if (index >= len || index <= -len) + index %= len; // wraparound + if (index < 0) + index += len; + inst = instances[index]; + var offset = 0; + if (object_type.is_family) + { + offset = inst.type.family_var_map[object_type.family_index]; + } + var to_ret = inst.instance_vars[varindex + offset]; + if (cr.is_string(to_ret)) + ret.set_string(to_ret); + else + ret.set_float(to_ret); + }; + ExpNode.prototype.eval_int = function (ret) + { + ret.type = cr.exptype.Integer; + ret.data = this.value; + }; + ExpNode.prototype.eval_float = function (ret) + { + ret.type = cr.exptype.Float; + ret.data = this.value; + }; + ExpNode.prototype.eval_string = function (ret) + { + ret.type = cr.exptype.String; + ret.data = this.value; + }; + ExpNode.prototype.eval_unaryminus = function (ret) + { + this.first.get(ret); // retrieve operand + if (ret.is_number()) + ret.data = -ret.data; + }; + ExpNode.prototype.eval_add = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data += temp.data; // both operands numbers: add + if (temp.is_float()) + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_subtract = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data -= temp.data; // both operands numbers: subtract + if (temp.is_float()) + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_multiply = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data *= temp.data; // both operands numbers: multiply + if (temp.is_float()) + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_divide = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data /= temp.data; // both operands numbers: divide + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_mod = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data %= temp.data; // both operands numbers: modulo + if (temp.is_float()) + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_power = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + ret.data = Math.pow(ret.data, temp.data); // both operands numbers: raise to power + if (temp.is_float()) + ret.make_float(); + } + popTempValue(); + }; + ExpNode.prototype.eval_and = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (temp.is_string() || ret.is_string()) + this.eval_and_stringconcat(ret, temp); + else + this.eval_and_logical(ret, temp); + popTempValue(); + }; + ExpNode.prototype.eval_and_stringconcat = function (ret, temp) + { + if (ret.is_string() && temp.is_string()) + this.eval_and_stringconcat_str_str(ret, temp); + else + this.eval_and_stringconcat_num(ret, temp); + }; + ExpNode.prototype.eval_and_stringconcat_str_str = function (ret, temp) + { + ret.data += temp.data; + }; + ExpNode.prototype.eval_and_stringconcat_num = function (ret, temp) + { + if (ret.is_string()) + { + ret.data += (Math.round(temp.data * 1e10) / 1e10).toString(); + } + else + { + ret.set_string(ret.data.toString() + temp.data); + } + }; + ExpNode.prototype.eval_and_logical = function (ret, temp) + { + ret.set_int(ret.data && temp.data ? 1 : 0); + }; + ExpNode.prototype.eval_or = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + if (ret.is_number() && temp.is_number()) + { + if (ret.data || temp.data) + ret.set_int(1); + else + ret.set_int(0); + } + popTempValue(); + }; + ExpNode.prototype.eval_conditional = function (ret) + { + this.first.get(ret); // condition operand + if (ret.data) // is true + this.second.get(ret); // evaluate second operand to ret + else + this.third.get(ret); // evaluate third operand to ret + }; + ExpNode.prototype.eval_equal = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data === temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_notequal = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data !== temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_less = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data < temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_lessequal = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data <= temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_greater = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data > temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_greaterequal = function (ret) + { + this.first.get(ret); // left operand + var temp = pushTempValue(); + this.second.get(temp); // right operand + ret.set_int(ret.data >= temp.data ? 1 : 0); + popTempValue(); + }; + ExpNode.prototype.eval_eventvar_exp = function (ret) + { + var val = this.eventvar.getValue(); + if (cr.is_number(val)) + ret.set_float(val); + else + ret.set_string(val); + }; + cr.expNode = ExpNode; + function ExpValue(type, data) + { + this.type = type || cr.exptype.Integer; + this.data = data || 0; + this.object_class = null; +; +; +; + if (this.type == cr.exptype.Integer) + this.data = Math.floor(this.data); + cr.seal(this); + }; + ExpValue.prototype.is_int = function () + { + return this.type === cr.exptype.Integer; + }; + ExpValue.prototype.is_float = function () + { + return this.type === cr.exptype.Float; + }; + ExpValue.prototype.is_number = function () + { + return this.type === cr.exptype.Integer || this.type === cr.exptype.Float; + }; + ExpValue.prototype.is_string = function () + { + return this.type === cr.exptype.String; + }; + ExpValue.prototype.make_int = function () + { + if (!this.is_int()) + { + if (this.is_float()) + this.data = Math.floor(this.data); // truncate float + else if (this.is_string()) + this.data = parseInt(this.data, 10); + this.type = cr.exptype.Integer; + } + }; + ExpValue.prototype.make_float = function () + { + if (!this.is_float()) + { + if (this.is_string()) + this.data = parseFloat(this.data); + this.type = cr.exptype.Float; + } + }; + ExpValue.prototype.make_string = function () + { + if (!this.is_string()) + { + this.data = this.data.toString(); + this.type = cr.exptype.String; + } + }; + ExpValue.prototype.set_int = function (val) + { +; + this.type = cr.exptype.Integer; + this.data = Math.floor(val); + }; + ExpValue.prototype.set_float = function (val) + { +; + this.type = cr.exptype.Float; + this.data = val; + }; + ExpValue.prototype.set_string = function (val) + { +; + this.type = cr.exptype.String; + this.data = val; + }; + ExpValue.prototype.set_any = function (val) + { + if (cr.is_number(val)) + { + this.type = cr.exptype.Float; + this.data = val; + } + else if (cr.is_string(val)) + { + this.type = cr.exptype.String; + this.data = val.toString(); + } + else + { + this.type = cr.exptype.Integer; + this.data = 0; + } + }; + cr.expvalue = ExpValue; + cr.exptype = { + Integer: 0, // emulated; no native integer support in javascript + Float: 1, + String: 2 + }; +}()); +; +cr.system_object = function (runtime) +{ + this.runtime = runtime; + this.waits = []; +}; +cr.system_object.prototype.saveToJSON = function () +{ + var o = {}; + var i, len, j, lenj, p, w, t, sobj; + o["waits"] = []; + var owaits = o["waits"]; + var waitobj; + for (i = 0, len = this.waits.length; i < len; i++) + { + w = this.waits[i]; + waitobj = { + "t": w.time, + "st": w.signaltag, + "s": w.signalled, + "ev": w.ev.sid, + "sm": [], + "sols": {} + }; + if (w.ev.actions[w.actindex]) + waitobj["act"] = w.ev.actions[w.actindex].sid; + for (j = 0, lenj = w.solModifiers.length; j < lenj; j++) + waitobj["sm"].push(w.solModifiers[j].sid); + for (p in w.sols) + { + if (w.sols.hasOwnProperty(p)) + { + t = this.runtime.types_by_index[parseInt(p, 10)]; +; + sobj = { + "sa": w.sols[p].sa, + "insts": [] + }; + for (j = 0, lenj = w.sols[p].insts.length; j < lenj; j++) + sobj["insts"].push(w.sols[p].insts[j].uid); + waitobj["sols"][t.sid.toString()] = sobj; + } + } + owaits.push(waitobj); + } + return o; +}; +cr.system_object.prototype.loadFromJSON = function (o) +{ + var owaits = o["waits"]; + var i, len, j, lenj, p, w, addWait, e, aindex, t, savedsol, nusol, inst; + cr.clearArray(this.waits); + for (i = 0, len = owaits.length; i < len; i++) + { + w = owaits[i]; + e = this.runtime.blocksBySid[w["ev"].toString()]; + if (!e) + continue; // event must've gone missing + aindex = -1; + for (j = 0, lenj = e.actions.length; j < lenj; j++) + { + if (e.actions[j].sid === w["act"]) + { + aindex = j; + break; + } + } + if (aindex === -1) + continue; // action must've gone missing + addWait = {}; + addWait.sols = {}; + addWait.solModifiers = []; + addWait.deleteme = false; + addWait.time = w["t"]; + addWait.signaltag = w["st"] || ""; + addWait.signalled = !!w["s"]; + addWait.ev = e; + addWait.actindex = aindex; + for (j = 0, lenj = w["sm"].length; j < lenj; j++) + { + t = this.runtime.getObjectTypeBySid(w["sm"][j]); + if (t) + addWait.solModifiers.push(t); + } + for (p in w["sols"]) + { + if (w["sols"].hasOwnProperty(p)) + { + t = this.runtime.getObjectTypeBySid(parseInt(p, 10)); + if (!t) + continue; // type must've been deleted + savedsol = w["sols"][p]; + nusol = { + sa: savedsol["sa"], + insts: [] + }; + for (j = 0, lenj = savedsol["insts"].length; j < lenj; j++) + { + inst = this.runtime.getObjectByUID(savedsol["insts"][j]); + if (inst) + nusol.insts.push(inst); + } + addWait.sols[t.index.toString()] = nusol; + } + } + this.waits.push(addWait); + } +}; +(function () +{ + var sysProto = cr.system_object.prototype; + function SysCnds() {}; + SysCnds.prototype.EveryTick = function() + { + return true; + }; + SysCnds.prototype.OnLayoutStart = function() + { + return true; + }; + SysCnds.prototype.OnLayoutEnd = function() + { + return true; + }; + SysCnds.prototype.Compare = function(x, cmp, y) + { + return cr.do_cmp(x, cmp, y); + }; + SysCnds.prototype.CompareTime = function (cmp, t) + { + var elapsed = this.runtime.kahanTime.sum; + if (cmp === 0) + { + var cnd = this.runtime.getCurrentCondition(); + if (!cnd.extra["CompareTime_executed"]) + { + if (elapsed >= t) + { + cnd.extra["CompareTime_executed"] = true; + return true; + } + } + return false; + } + return cr.do_cmp(elapsed, cmp, t); + }; + SysCnds.prototype.LayerVisible = function (layer) + { + if (!layer) + return false; + else + return layer.visible; + }; + SysCnds.prototype.LayerEmpty = function (layer) + { + if (!layer) + return false; + else + return !layer.instances.length; + }; + SysCnds.prototype.LayerCmpOpacity = function (layer, cmp, opacity_) + { + if (!layer) + return false; + return cr.do_cmp(layer.opacity * 100, cmp, opacity_); + }; + SysCnds.prototype.Repeat = function (count) + { + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var solModifierAfterCnds = current_frame.isModifierAfterCnds(); + var current_loop = this.runtime.pushLoopStack(); + var i; + if (solModifierAfterCnds) + { + for (i = 0; i < count && !current_loop.stopped; i++) + { + this.runtime.pushCopySol(current_event.solModifiers); + current_loop.index = i; + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + for (i = 0; i < count && !current_loop.stopped; i++) + { + current_loop.index = i; + current_event.retrigger(); + } + } + this.runtime.popLoopStack(); + return false; + }; + SysCnds.prototype.While = function (count) + { + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var solModifierAfterCnds = current_frame.isModifierAfterCnds(); + var current_loop = this.runtime.pushLoopStack(); + var i; + if (solModifierAfterCnds) + { + for (i = 0; !current_loop.stopped; i++) + { + this.runtime.pushCopySol(current_event.solModifiers); + current_loop.index = i; + if (!current_event.retrigger()) // one of the other conditions returned false + current_loop.stopped = true; // break + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + for (i = 0; !current_loop.stopped; i++) + { + current_loop.index = i; + if (!current_event.retrigger()) + current_loop.stopped = true; + } + } + this.runtime.popLoopStack(); + return false; + }; + SysCnds.prototype.For = function (name, start, end) + { + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var solModifierAfterCnds = current_frame.isModifierAfterCnds(); + var current_loop = this.runtime.pushLoopStack(name); + var i; + if (end < start) + { + if (solModifierAfterCnds) + { + for (i = start; i >= end && !current_loop.stopped; --i) // inclusive to end + { + this.runtime.pushCopySol(current_event.solModifiers); + current_loop.index = i; + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + for (i = start; i >= end && !current_loop.stopped; --i) // inclusive to end + { + current_loop.index = i; + current_event.retrigger(); + } + } + } + else + { + if (solModifierAfterCnds) + { + for (i = start; i <= end && !current_loop.stopped; ++i) // inclusive to end + { + this.runtime.pushCopySol(current_event.solModifiers); + current_loop.index = i; + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + for (i = start; i <= end && !current_loop.stopped; ++i) // inclusive to end + { + current_loop.index = i; + current_event.retrigger(); + } + } + } + this.runtime.popLoopStack(); + return false; + }; + var foreach_instancestack = []; + var foreach_instanceptr = -1; + SysCnds.prototype.ForEach = function (obj) + { + var sol = obj.getCurrentSol(); + foreach_instanceptr++; + if (foreach_instancestack.length === foreach_instanceptr) + foreach_instancestack.push([]); + var instances = foreach_instancestack[foreach_instanceptr]; + cr.shallowAssignArray(instances, sol.getObjects()); + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var solModifierAfterCnds = current_frame.isModifierAfterCnds(); + var current_loop = this.runtime.pushLoopStack(); + var i, len, j, lenj, inst, s, sol2; + var is_contained = obj.is_contained; + if (solModifierAfterCnds) + { + for (i = 0, len = instances.length; i < len && !current_loop.stopped; i++) + { + this.runtime.pushCopySol(current_event.solModifiers); + inst = instances[i]; + sol = obj.getCurrentSol(); + sol.select_all = false; + cr.clearArray(sol.instances); + sol.instances[0] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + sol2 = s.type.getCurrentSol(); + sol2.select_all = false; + cr.clearArray(sol2.instances); + sol2.instances[0] = s; + } + } + current_loop.index = i; + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + sol.select_all = false; + cr.clearArray(sol.instances); + for (i = 0, len = instances.length; i < len && !current_loop.stopped; i++) + { + inst = instances[i]; + sol.instances[0] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + sol2 = s.type.getCurrentSol(); + sol2.select_all = false; + cr.clearArray(sol2.instances); + sol2.instances[0] = s; + } + } + current_loop.index = i; + current_event.retrigger(); + } + } + cr.clearArray(instances); + this.runtime.popLoopStack(); + foreach_instanceptr--; + return false; + }; + function foreach_sortinstances(a, b) + { + var va = a.extra["c2_feo_val"]; + var vb = b.extra["c2_feo_val"]; + if (cr.is_number(va) && cr.is_number(vb)) + return va - vb; + else + { + va = "" + va; + vb = "" + vb; + if (va < vb) + return -1; + else if (va > vb) + return 1; + else + return 0; + } + }; + SysCnds.prototype.ForEachOrdered = function (obj, exp, order) + { + var sol = obj.getCurrentSol(); + foreach_instanceptr++; + if (foreach_instancestack.length === foreach_instanceptr) + foreach_instancestack.push([]); + var instances = foreach_instancestack[foreach_instanceptr]; + cr.shallowAssignArray(instances, sol.getObjects()); + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var current_condition = this.runtime.getCurrentCondition(); + var solModifierAfterCnds = current_frame.isModifierAfterCnds(); + var current_loop = this.runtime.pushLoopStack(); + var i, len, j, lenj, inst, s, sol2; + for (i = 0, len = instances.length; i < len; i++) + { + instances[i].extra["c2_feo_val"] = current_condition.parameters[1].get(i); + } + instances.sort(foreach_sortinstances); + if (order === 1) + instances.reverse(); + var is_contained = obj.is_contained; + if (solModifierAfterCnds) + { + for (i = 0, len = instances.length; i < len && !current_loop.stopped; i++) + { + this.runtime.pushCopySol(current_event.solModifiers); + inst = instances[i]; + sol = obj.getCurrentSol(); + sol.select_all = false; + cr.clearArray(sol.instances); + sol.instances[0] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + sol2 = s.type.getCurrentSol(); + sol2.select_all = false; + cr.clearArray(sol2.instances); + sol2.instances[0] = s; + } + } + current_loop.index = i; + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + } + } + else + { + sol.select_all = false; + cr.clearArray(sol.instances); + for (i = 0, len = instances.length; i < len && !current_loop.stopped; i++) + { + inst = instances[i]; + sol.instances[0] = inst; + if (is_contained) + { + for (j = 0, lenj = inst.siblings.length; j < lenj; j++) + { + s = inst.siblings[j]; + sol2 = s.type.getCurrentSol(); + sol2.select_all = false; + cr.clearArray(sol2.instances); + sol2.instances[0] = s; + } + } + current_loop.index = i; + current_event.retrigger(); + } + } + cr.clearArray(instances); + this.runtime.popLoopStack(); + foreach_instanceptr--; + return false; + }; + SysCnds.prototype.PickByComparison = function (obj_, exp_, cmp_, val_) + { + var i, len, k, inst; + if (!obj_) + return; + foreach_instanceptr++; + if (foreach_instancestack.length === foreach_instanceptr) + foreach_instancestack.push([]); + var tmp_instances = foreach_instancestack[foreach_instanceptr]; + var sol = obj_.getCurrentSol(); + cr.shallowAssignArray(tmp_instances, sol.getObjects()); + if (sol.select_all) + cr.clearArray(sol.else_instances); + var current_condition = this.runtime.getCurrentCondition(); + for (i = 0, k = 0, len = tmp_instances.length; i < len; i++) + { + inst = tmp_instances[i]; + tmp_instances[k] = inst; + exp_ = current_condition.parameters[1].get(i); + val_ = current_condition.parameters[3].get(i); + if (cr.do_cmp(exp_, cmp_, val_)) + { + k++; + } + else + { + sol.else_instances.push(inst); + } + } + cr.truncateArray(tmp_instances, k); + sol.select_all = false; + cr.shallowAssignArray(sol.instances, tmp_instances); + cr.clearArray(tmp_instances); + foreach_instanceptr--; + obj_.applySolToContainer(); + return !!sol.instances.length; + }; + SysCnds.prototype.PickByEvaluate = function (obj_, exp_) + { + var i, len, k, inst; + if (!obj_) + return; + foreach_instanceptr++; + if (foreach_instancestack.length === foreach_instanceptr) + foreach_instancestack.push([]); + var tmp_instances = foreach_instancestack[foreach_instanceptr]; + var sol = obj_.getCurrentSol(); + cr.shallowAssignArray(tmp_instances, sol.getObjects()); + if (sol.select_all) + cr.clearArray(sol.else_instances); + var current_condition = this.runtime.getCurrentCondition(); + for (i = 0, k = 0, len = tmp_instances.length; i < len; i++) + { + inst = tmp_instances[i]; + tmp_instances[k] = inst; + exp_ = current_condition.parameters[1].get(i); + if (exp_) + { + k++; + } + else + { + sol.else_instances.push(inst); + } + } + cr.truncateArray(tmp_instances, k); + sol.select_all = false; + cr.shallowAssignArray(sol.instances, tmp_instances); + cr.clearArray(tmp_instances); + foreach_instanceptr--; + obj_.applySolToContainer(); + return !!sol.instances.length; + }; + SysCnds.prototype.TriggerOnce = function () + { + var cndextra = this.runtime.getCurrentCondition().extra; + if (typeof cndextra["TriggerOnce_lastTick"] === "undefined") + cndextra["TriggerOnce_lastTick"] = -1; + var last_tick = cndextra["TriggerOnce_lastTick"]; + var cur_tick = this.runtime.tickcount; + cndextra["TriggerOnce_lastTick"] = cur_tick; + return this.runtime.layout_first_tick || last_tick !== cur_tick - 1; + }; + SysCnds.prototype.Every = function (seconds) + { + var cnd = this.runtime.getCurrentCondition(); + var last_time = cnd.extra["Every_lastTime"] || 0; + var cur_time = this.runtime.kahanTime.sum; + if (typeof cnd.extra["Every_seconds"] === "undefined") + cnd.extra["Every_seconds"] = seconds; + var this_seconds = cnd.extra["Every_seconds"]; + if (cur_time >= last_time + this_seconds) + { + cnd.extra["Every_lastTime"] = last_time + this_seconds; + if (cur_time >= cnd.extra["Every_lastTime"] + 0.04) + { + cnd.extra["Every_lastTime"] = cur_time; + } + cnd.extra["Every_seconds"] = seconds; + return true; + } + else if (cur_time < last_time - 0.1) + { + cnd.extra["Every_lastTime"] = cur_time; + } + return false; + }; + SysCnds.prototype.PickNth = function (obj, index) + { + if (!obj) + return false; + var sol = obj.getCurrentSol(); + var instances = sol.getObjects(); + index = cr.floor(index); + if (index < 0 || index >= instances.length) + return false; + var inst = instances[index]; + sol.pick_one(inst); + obj.applySolToContainer(); + return true; + }; + SysCnds.prototype.PickRandom = function (obj) + { + if (!obj) + return false; + var sol = obj.getCurrentSol(); + var instances = sol.getObjects(); + var index = cr.floor(Math.random() * instances.length); + if (index >= instances.length) + return false; + var inst = instances[index]; + sol.pick_one(inst); + obj.applySolToContainer(); + return true; + }; + SysCnds.prototype.CompareVar = function (v, cmp, val) + { + return cr.do_cmp(v.getValue(), cmp, val); + }; + SysCnds.prototype.IsGroupActive = function (group) + { + var g = this.runtime.groups_by_name[group.toLowerCase()]; + return g && g.group_active; + }; + SysCnds.prototype.IsPreview = function () + { + return typeof cr_is_preview !== "undefined"; + }; + SysCnds.prototype.PickAll = function (obj) + { + if (!obj) + return false; + if (!obj.instances.length) + return false; + var sol = obj.getCurrentSol(); + sol.select_all = true; + obj.applySolToContainer(); + return true; + }; + SysCnds.prototype.IsMobile = function () + { + return this.runtime.isMobile; + }; + SysCnds.prototype.CompareBetween = function (x, a, b) + { + return x >= a && x <= b; + }; + SysCnds.prototype.Else = function () + { + var current_frame = this.runtime.getCurrentEventStack(); + if (current_frame.else_branch_ran) + return false; // another event in this else-if chain has run + else + return !current_frame.last_event_true; + /* + var current_frame = this.runtime.getCurrentEventStack(); + var current_event = current_frame.current_event; + var prev_event = current_event.prev_block; + if (!prev_event) + return false; + if (prev_event.is_logical) + return !this.runtime.last_event_true; + var i, len, j, lenj, s, sol, temp, inst, any_picked = false; + for (i = 0, len = prev_event.cndReferences.length; i < len; i++) + { + s = prev_event.cndReferences[i]; + sol = s.getCurrentSol(); + if (sol.select_all || sol.instances.length === s.instances.length) + { + sol.select_all = false; + sol.instances.length = 0; + } + else + { + if (sol.instances.length === 1 && sol.else_instances.length === 0 && s.instances.length >= 2) + { + inst = sol.instances[0]; + sol.instances.length = 0; + for (j = 0, lenj = s.instances.length; j < lenj; j++) + { + if (s.instances[j] != inst) + sol.instances.push(s.instances[j]); + } + any_picked = true; + } + else + { + temp = sol.instances; + sol.instances = sol.else_instances; + sol.else_instances = temp; + any_picked = true; + } + } + } + return any_picked; + */ + }; + SysCnds.prototype.OnLoadFinished = function () + { + return true; + }; + SysCnds.prototype.OnCanvasSnapshot = function () + { + return true; + }; + SysCnds.prototype.EffectsSupported = function () + { + return !!this.runtime.glwrap; + }; + SysCnds.prototype.OnSaveComplete = function () + { + return true; + }; + SysCnds.prototype.OnSaveFailed = function () + { + return true; + }; + SysCnds.prototype.OnLoadComplete = function () + { + return true; + }; + SysCnds.prototype.OnLoadFailed = function () + { + return true; + }; + SysCnds.prototype.ObjectUIDExists = function (u) + { + return !!this.runtime.getObjectByUID(u); + }; + SysCnds.prototype.IsOnPlatform = function (p) + { + var rt = this.runtime; + switch (p) { + case 0: // HTML5 website + return !rt.isDomFree && !rt.isNodeWebkit && !rt.isCordova && !rt.isWinJS && !rt.isWindowsPhone8 && !rt.isBlackberry10 && !rt.isAmazonWebApp; + case 1: // iOS + return rt.isiOS; + case 2: // Android + return rt.isAndroid; + case 3: // Windows 8 + return rt.isWindows8App; + case 4: // Windows Phone 8 + return rt.isWindowsPhone8; + case 5: // Blackberry 10 + return rt.isBlackberry10; + case 6: // Tizen + return rt.isTizen; + case 7: // CocoonJS + return rt.isCocoonJs; + case 8: // Cordova + return rt.isCordova; + case 9: // Scirra Arcade + return rt.isArcade; + case 10: // node-webkit + return rt.isNodeWebkit; + case 11: // crosswalk + return rt.isCrosswalk; + case 12: // amazon webapp + return rt.isAmazonWebApp; + case 13: // windows 10 app + return rt.isWindows10; + default: // should not be possible + return false; + } + }; + var cacheRegex = null; + var lastRegex = ""; + var lastFlags = ""; + function getRegex(regex_, flags_) + { + if (!cacheRegex || regex_ !== lastRegex || flags_ !== lastFlags) + { + cacheRegex = new RegExp(regex_, flags_); + lastRegex = regex_; + lastFlags = flags_; + } + cacheRegex.lastIndex = 0; // reset + return cacheRegex; + }; + SysCnds.prototype.RegexTest = function (str_, regex_, flags_) + { + var regex = getRegex(regex_, flags_); + return regex.test(str_); + }; + var tmp_arr = []; + SysCnds.prototype.PickOverlappingPoint = function (obj_, x_, y_) + { + if (!obj_) + return false; + var sol = obj_.getCurrentSol(); + var instances = sol.getObjects(); + var current_event = this.runtime.getCurrentEventStack().current_event; + var orblock = current_event.orblock; + var cnd = this.runtime.getCurrentCondition(); + var i, len, inst, pick; + if (sol.select_all) + { + cr.shallowAssignArray(tmp_arr, instances); + cr.clearArray(sol.else_instances); + sol.select_all = false; + cr.clearArray(sol.instances); + } + else + { + if (orblock) + { + cr.shallowAssignArray(tmp_arr, sol.else_instances); + cr.clearArray(sol.else_instances); + } + else + { + cr.shallowAssignArray(tmp_arr, instances); + cr.clearArray(sol.instances); + } + } + for (i = 0, len = tmp_arr.length; i < len; ++i) + { + inst = tmp_arr[i]; + inst.update_bbox(); + pick = cr.xor(inst.contains_pt(x_, y_), cnd.inverted); + if (pick) + sol.instances.push(inst); + else + sol.else_instances.push(inst); + } + obj_.applySolToContainer(); + return cr.xor(!!sol.instances.length, cnd.inverted); + }; + SysCnds.prototype.IsNaN = function (n) + { + return !!isNaN(n); + }; + SysCnds.prototype.AngleWithin = function (a1, within, a2) + { + return cr.angleDiff(cr.to_radians(a1), cr.to_radians(a2)) <= cr.to_radians(within); + }; + SysCnds.prototype.IsClockwiseFrom = function (a1, a2) + { + return cr.angleClockwise(cr.to_radians(a1), cr.to_radians(a2)); + }; + SysCnds.prototype.IsBetweenAngles = function (a, la, ua) + { + var angle = cr.to_clamped_radians(a); + var lower = cr.to_clamped_radians(la); + var upper = cr.to_clamped_radians(ua); + var obtuse = (!cr.angleClockwise(upper, lower)); + if (obtuse) + return !(!cr.angleClockwise(angle, lower) && cr.angleClockwise(angle, upper)); + else + return cr.angleClockwise(angle, lower) && !cr.angleClockwise(angle, upper); + }; + SysCnds.prototype.IsValueType = function (x, t) + { + if (typeof x === "number") + return t === 0; + else // string + return t === 1; + }; + sysProto.cnds = new SysCnds(); + function SysActs() {}; + SysActs.prototype.GoToLayout = function (to) + { + if (this.runtime.isloading) + return; // cannot change layout while loading on loader layout + if (this.runtime.changelayout) + return; // already changing to a different layout +; + this.runtime.changelayout = to; + }; + SysActs.prototype.NextPrevLayout = function (prev) + { + if (this.runtime.isloading) + return; // cannot change layout while loading on loader layout + if (this.runtime.changelayout) + return; // already changing to a different layout + var index = this.runtime.layouts_by_index.indexOf(this.runtime.running_layout); + if (prev && index === 0) + return; // cannot go to previous layout from first layout + if (!prev && index === this.runtime.layouts_by_index.length - 1) + return; // cannot go to next layout from last layout + var to = this.runtime.layouts_by_index[index + (prev ? -1 : 1)]; +; + this.runtime.changelayout = to; + }; + SysActs.prototype.CreateObject = function (obj, layer, x, y) + { + if (!layer || !obj) + return; + var inst = this.runtime.createInstance(obj, layer, x, y); + if (!inst) + return; + this.runtime.isInOnDestroy++; + var i, len, s; + this.runtime.trigger(Object.getPrototypeOf(obj.plugin).cnds.OnCreated, inst); + if (inst.is_contained) + { + for (i = 0, len = inst.siblings.length; i < len; i++) + { + s = inst.siblings[i]; + this.runtime.trigger(Object.getPrototypeOf(s.type.plugin).cnds.OnCreated, s); + } + } + this.runtime.isInOnDestroy--; + var sol = obj.getCurrentSol(); + sol.select_all = false; + cr.clearArray(sol.instances); + sol.instances[0] = inst; + if (inst.is_contained) + { + for (i = 0, len = inst.siblings.length; i < len; i++) + { + s = inst.siblings[i]; + sol = s.type.getCurrentSol(); + sol.select_all = false; + cr.clearArray(sol.instances); + sol.instances[0] = s; + } + } + }; + SysActs.prototype.SetLayerVisible = function (layer, visible_) + { + if (!layer) + return; + if (layer.visible !== visible_) + { + layer.visible = visible_; + this.runtime.redraw = true; + } + }; + SysActs.prototype.SetLayerOpacity = function (layer, opacity_) + { + if (!layer) + return; + opacity_ = cr.clamp(opacity_ / 100, 0, 1); + if (layer.opacity !== opacity_) + { + layer.opacity = opacity_; + this.runtime.redraw = true; + } + }; + SysActs.prototype.SetLayerScaleRate = function (layer, sr) + { + if (!layer) + return; + if (layer.zoomRate !== sr) + { + layer.zoomRate = sr; + this.runtime.redraw = true; + } + }; + SysActs.prototype.SetLayerForceOwnTexture = function (layer, f) + { + if (!layer) + return; + f = !!f; + if (layer.forceOwnTexture !== f) + { + layer.forceOwnTexture = f; + this.runtime.redraw = true; + } + }; + SysActs.prototype.SetLayoutScale = function (s) + { + if (!this.runtime.running_layout) + return; + if (this.runtime.running_layout.scale !== s) + { + this.runtime.running_layout.scale = s; + this.runtime.running_layout.boundScrolling(); + this.runtime.redraw = true; + } + }; + SysActs.prototype.ScrollX = function(x) + { + this.runtime.running_layout.scrollToX(x); + }; + SysActs.prototype.ScrollY = function(y) + { + this.runtime.running_layout.scrollToY(y); + }; + SysActs.prototype.Scroll = function(x, y) + { + this.runtime.running_layout.scrollToX(x); + this.runtime.running_layout.scrollToY(y); + }; + SysActs.prototype.ScrollToObject = function(obj) + { + var inst = obj.getFirstPicked(); + if (inst) + { + this.runtime.running_layout.scrollToX(inst.x); + this.runtime.running_layout.scrollToY(inst.y); + } + }; + SysActs.prototype.SetVar = function(v, x) + { +; + if (v.vartype === 0) + { + if (cr.is_number(x)) + v.setValue(x); + else + v.setValue(parseFloat(x)); + } + else if (v.vartype === 1) + v.setValue(x.toString()); + }; + SysActs.prototype.AddVar = function(v, x) + { +; + if (v.vartype === 0) + { + if (cr.is_number(x)) + v.setValue(v.getValue() + x); + else + v.setValue(v.getValue() + parseFloat(x)); + } + else if (v.vartype === 1) + v.setValue(v.getValue() + x.toString()); + }; + SysActs.prototype.SubVar = function(v, x) + { +; + if (v.vartype === 0) + { + if (cr.is_number(x)) + v.setValue(v.getValue() - x); + else + v.setValue(v.getValue() - parseFloat(x)); + } + }; + SysActs.prototype.SetGroupActive = function (group, active) + { + var g = this.runtime.groups_by_name[group.toLowerCase()]; + if (!g) + return; + switch (active) { + case 0: + g.setGroupActive(false); + break; + case 1: + g.setGroupActive(true); + break; + case 2: + g.setGroupActive(!g.group_active); + break; + } + }; + SysActs.prototype.SetTimescale = function (ts_) + { + var ts = ts_; + if (ts < 0) + ts = 0; + this.runtime.timescale = ts; + }; + SysActs.prototype.SetObjectTimescale = function (obj, ts_) + { + var ts = ts_; + if (ts < 0) + ts = 0; + if (!obj) + return; + var sol = obj.getCurrentSol(); + var instances = sol.getObjects(); + var i, len; + for (i = 0, len = instances.length; i < len; i++) + { + instances[i].my_timescale = ts; + } + }; + SysActs.prototype.RestoreObjectTimescale = function (obj) + { + if (!obj) + return false; + var sol = obj.getCurrentSol(); + var instances = sol.getObjects(); + var i, len; + for (i = 0, len = instances.length; i < len; i++) + { + instances[i].my_timescale = -1.0; + } + }; + var waitobjrecycle = []; + function allocWaitObject() + { + var w; + if (waitobjrecycle.length) + w = waitobjrecycle.pop(); + else + { + w = {}; + w.sols = {}; + w.solModifiers = []; + } + w.deleteme = false; + return w; + }; + function freeWaitObject(w) + { + cr.wipe(w.sols); + cr.clearArray(w.solModifiers); + waitobjrecycle.push(w); + }; + var solstateobjects = []; + function allocSolStateObject() + { + var s; + if (solstateobjects.length) + s = solstateobjects.pop(); + else + { + s = {}; + s.insts = []; + } + s.sa = false; + return s; + }; + function freeSolStateObject(s) + { + cr.clearArray(s.insts); + solstateobjects.push(s); + }; + SysActs.prototype.Wait = function (seconds) + { + if (seconds < 0) + return; + var i, len, s, t, ss; + var evinfo = this.runtime.getCurrentEventStack(); + var waitobj = allocWaitObject(); + waitobj.time = this.runtime.kahanTime.sum + seconds; + waitobj.signaltag = ""; + waitobj.signalled = false; + waitobj.ev = evinfo.current_event; + waitobj.actindex = evinfo.actindex + 1; // pointing at next action + for (i = 0, len = this.runtime.types_by_index.length; i < len; i++) + { + t = this.runtime.types_by_index[i]; + s = t.getCurrentSol(); + if (s.select_all && evinfo.current_event.solModifiers.indexOf(t) === -1) + continue; + waitobj.solModifiers.push(t); + ss = allocSolStateObject(); + ss.sa = s.select_all; + cr.shallowAssignArray(ss.insts, s.instances); + waitobj.sols[i.toString()] = ss; + } + this.waits.push(waitobj); + return true; + }; + SysActs.prototype.WaitForSignal = function (tag) + { + var i, len, s, t, ss; + var evinfo = this.runtime.getCurrentEventStack(); + var waitobj = allocWaitObject(); + waitobj.time = -1; + waitobj.signaltag = tag.toLowerCase(); + waitobj.signalled = false; + waitobj.ev = evinfo.current_event; + waitobj.actindex = evinfo.actindex + 1; // pointing at next action + for (i = 0, len = this.runtime.types_by_index.length; i < len; i++) + { + t = this.runtime.types_by_index[i]; + s = t.getCurrentSol(); + if (s.select_all && evinfo.current_event.solModifiers.indexOf(t) === -1) + continue; + waitobj.solModifiers.push(t); + ss = allocSolStateObject(); + ss.sa = s.select_all; + cr.shallowAssignArray(ss.insts, s.instances); + waitobj.sols[i.toString()] = ss; + } + this.waits.push(waitobj); + return true; + }; + SysActs.prototype.Signal = function (tag) + { + var lowertag = tag.toLowerCase(); + var i, len, w; + for (i = 0, len = this.waits.length; i < len; ++i) + { + w = this.waits[i]; + if (w.time !== -1) + continue; // timer wait, ignore + if (w.signaltag === lowertag) // waiting for this signal + w.signalled = true; // will run on next check + } + }; + SysActs.prototype.SetLayerScale = function (layer, scale) + { + if (!layer) + return; + if (layer.scale === scale) + return; + layer.scale = scale; + this.runtime.redraw = true; + }; + SysActs.prototype.ResetGlobals = function () + { + var i, len, g; + for (i = 0, len = this.runtime.all_global_vars.length; i < len; i++) + { + g = this.runtime.all_global_vars[i]; + g.data = g.initial; + } + }; + SysActs.prototype.SetLayoutAngle = function (a) + { + a = cr.to_radians(a); + a = cr.clamp_angle(a); + if (this.runtime.running_layout) + { + if (this.runtime.running_layout.angle !== a) + { + this.runtime.running_layout.angle = a; + this.runtime.redraw = true; + } + } + }; + SysActs.prototype.SetLayerAngle = function (layer, a) + { + if (!layer) + return; + a = cr.to_radians(a); + a = cr.clamp_angle(a); + if (layer.angle === a) + return; + layer.angle = a; + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerParallax = function (layer, px, py) + { + if (!layer) + return; + if (layer.parallaxX === px / 100 && layer.parallaxY === py / 100) + return; + layer.parallaxX = px / 100; + layer.parallaxY = py / 100; + if (layer.parallaxX !== 1 || layer.parallaxY !== 1) + { + var i, len, instances = layer.instances; + for (i = 0, len = instances.length; i < len; ++i) + { + instances[i].type.any_instance_parallaxed = true; + } + } + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerBackground = function (layer, c) + { + if (!layer) + return; + var r = cr.GetRValue(c); + var g = cr.GetGValue(c); + var b = cr.GetBValue(c); + if (layer.background_color[0] === r && layer.background_color[1] === g && layer.background_color[2] === b) + return; + layer.background_color[0] = r; + layer.background_color[1] = g; + layer.background_color[2] = b; + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerTransparent = function (layer, t) + { + if (!layer) + return; + if (!!t === !!layer.transparent) + return; + layer.transparent = !!t; + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerBlendMode = function (layer, bm) + { + if (!layer) + return; + if (layer.blend_mode === bm) + return; + layer.blend_mode = bm; + layer.compositeOp = cr.effectToCompositeOp(layer.blend_mode); + if (this.runtime.gl) + cr.setGLBlend(layer, layer.blend_mode, this.runtime.gl); + this.runtime.redraw = true; + }; + SysActs.prototype.StopLoop = function () + { + if (this.runtime.loop_stack_index < 0) + return; // no loop currently running + this.runtime.getCurrentLoop().stopped = true; + }; + SysActs.prototype.GoToLayoutByName = function (layoutname) + { + if (this.runtime.isloading) + return; // cannot change layout while loading on loader layout + if (this.runtime.changelayout) + return; // already changing to different layout +; + var l; + for (l in this.runtime.layouts) + { + if (this.runtime.layouts.hasOwnProperty(l) && cr.equals_nocase(l, layoutname)) + { + this.runtime.changelayout = this.runtime.layouts[l]; + return; + } + } + }; + SysActs.prototype.RestartLayout = function (layoutname) + { + if (this.runtime.isloading) + return; // cannot restart loader layouts + if (this.runtime.changelayout) + return; // already changing to a different layout +; + if (!this.runtime.running_layout) + return; + this.runtime.changelayout = this.runtime.running_layout; + var i, len, g; + for (i = 0, len = this.runtime.allGroups.length; i < len; i++) + { + g = this.runtime.allGroups[i]; + g.setGroupActive(g.initially_activated); + } + }; + SysActs.prototype.SnapshotCanvas = function (format_, quality_) + { + this.runtime.doCanvasSnapshot(format_ === 0 ? "image/png" : "image/jpeg", quality_ / 100); + }; + SysActs.prototype.SetCanvasSize = function (w, h) + { + if (w <= 0 || h <= 0) + return; + var mode = this.runtime.fullscreen_mode; + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || !!document["msFullscreenElement"] || document["fullScreen"] || this.runtime.isNodeFullscreen); + if (isfullscreen && this.runtime.fullscreen_scaling > 0) + mode = this.runtime.fullscreen_scaling; + if (mode === 0) + { + this.runtime["setSize"](w, h, true); + } + else + { + this.runtime.original_width = w; + this.runtime.original_height = h; + this.runtime["setSize"](this.runtime.lastWindowWidth, this.runtime.lastWindowHeight, true); + } + }; + SysActs.prototype.SetLayoutEffectEnabled = function (enable_, effectname_) + { + if (!this.runtime.running_layout || !this.runtime.glwrap) + return; + var et = this.runtime.running_layout.getEffectByName(effectname_); + if (!et) + return; // effect name not found + var enable = (enable_ === 1); + if (et.active == enable) + return; // no change + et.active = enable; + this.runtime.running_layout.updateActiveEffects(); + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerEffectEnabled = function (layer, enable_, effectname_) + { + if (!layer || !this.runtime.glwrap) + return; + var et = layer.getEffectByName(effectname_); + if (!et) + return; // effect name not found + var enable = (enable_ === 1); + if (et.active == enable) + return; // no change + et.active = enable; + layer.updateActiveEffects(); + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayoutEffectParam = function (effectname_, index_, value_) + { + if (!this.runtime.running_layout || !this.runtime.glwrap) + return; + var et = this.runtime.running_layout.getEffectByName(effectname_); + if (!et) + return; // effect name not found + var params = this.runtime.running_layout.effect_params[et.index]; + index_ = Math.floor(index_); + if (index_ < 0 || index_ >= params.length) + return; // effect index out of bounds + if (this.runtime.glwrap.getProgramParameterType(et.shaderindex, index_) === 1) + value_ /= 100.0; + if (params[index_] === value_) + return; // no change + params[index_] = value_; + if (et.active) + this.runtime.redraw = true; + }; + SysActs.prototype.SetLayerEffectParam = function (layer, effectname_, index_, value_) + { + if (!layer || !this.runtime.glwrap) + return; + var et = layer.getEffectByName(effectname_); + if (!et) + return; // effect name not found + var params = layer.effect_params[et.index]; + index_ = Math.floor(index_); + if (index_ < 0 || index_ >= params.length) + return; // effect index out of bounds + if (this.runtime.glwrap.getProgramParameterType(et.shaderindex, index_) === 1) + value_ /= 100.0; + if (params[index_] === value_) + return; // no change + params[index_] = value_; + if (et.active) + this.runtime.redraw = true; + }; + SysActs.prototype.SaveState = function (slot_) + { + this.runtime.saveToSlot = slot_; + }; + SysActs.prototype.LoadState = function (slot_) + { + this.runtime.loadFromSlot = slot_; + }; + SysActs.prototype.LoadStateJSON = function (jsonstr_) + { + this.runtime.loadFromJson = jsonstr_; + }; + SysActs.prototype.SetHalfFramerateMode = function (set_) + { + this.runtime.halfFramerateMode = (set_ !== 0); + }; + SysActs.prototype.SetFullscreenQuality = function (q) + { + var isfullscreen = (document["mozFullScreen"] || document["webkitIsFullScreen"] || !!document["msFullscreenElement"] || document["fullScreen"] || this.isNodeFullscreen); + if (!isfullscreen && this.runtime.fullscreen_mode === 0) + return; + this.runtime.wantFullscreenScalingQuality = (q !== 0); + this.runtime["setSize"](this.runtime.lastWindowWidth, this.runtime.lastWindowHeight, true); + }; + SysActs.prototype.ResetPersisted = function () + { + var i, len; + for (i = 0, len = this.runtime.layouts_by_index.length; i < len; ++i) + { + this.runtime.layouts_by_index[i].persist_data = {}; + this.runtime.layouts_by_index[i].first_visit = true; + } + }; + SysActs.prototype.RecreateInitialObjects = function (obj, x1, y1, x2, y2) + { + if (!obj) + return; + this.runtime.running_layout.recreateInitialObjects(obj, x1, y1, x2, y2); + }; + SysActs.prototype.SetPixelRounding = function (m) + { + this.runtime.pixel_rounding = (m !== 0); + this.runtime.redraw = true; + }; + SysActs.prototype.SetMinimumFramerate = function (f) + { + if (f < 1) + f = 1; + if (f > 120) + f = 120; + this.runtime.minimumFramerate = f; + }; + function SortZOrderList(a, b) + { + var layerA = a[0]; + var layerB = b[0]; + var diff = layerA - layerB; + if (diff !== 0) + return diff; + var indexA = a[1]; + var indexB = b[1]; + return indexA - indexB; + }; + function SortInstancesByValue(a, b) + { + return a[1] - b[1]; + }; + SysActs.prototype.SortZOrderByInstVar = function (obj, iv) + { + if (!obj) + return; + var i, len, inst, value, r, layer, toZ; + var sol = obj.getCurrentSol(); + var pickedInstances = sol.getObjects(); + var zOrderList = []; + var instValues = []; + var layout = this.runtime.running_layout; + var isFamily = obj.is_family; + var familyIndex = obj.family_index; + for (i = 0, len = pickedInstances.length; i < len; ++i) + { + inst = pickedInstances[i]; + if (!inst.layer) + continue; // not a world instance + if (isFamily) + value = inst.instance_vars[iv + inst.type.family_var_map[familyIndex]]; + else + value = inst.instance_vars[iv]; + zOrderList.push([ + inst.layer.index, + inst.get_zindex() + ]); + instValues.push([ + inst, + value + ]); + } + if (!zOrderList.length) + return; // no instances were world instances + zOrderList.sort(SortZOrderList); + instValues.sort(SortInstancesByValue); + for (i = 0, len = zOrderList.length; i < len; ++i) + { + inst = instValues[i][0]; // instance in the order we want + layer = layout.layers[zOrderList[i][0]]; // layer to put it on + toZ = zOrderList[i][1]; // Z index on that layer to put it + if (layer.instances[toZ] !== inst) // not already got this instance there + { + layer.instances[toZ] = inst; // update instance + inst.layer = layer; // update instance's layer reference (could have changed) + layer.setZIndicesStaleFrom(toZ); // mark Z indices stale from this point since they have changed + } + } + }; + sysProto.acts = new SysActs(); + function SysExps() {}; + SysExps.prototype["int"] = function(ret, x) + { + if (cr.is_string(x)) + { + ret.set_int(parseInt(x, 10)); + if (isNaN(ret.data)) + ret.data = 0; + } + else + ret.set_int(x); + }; + SysExps.prototype["float"] = function(ret, x) + { + if (cr.is_string(x)) + { + ret.set_float(parseFloat(x)); + if (isNaN(ret.data)) + ret.data = 0; + } + else + ret.set_float(x); + }; + SysExps.prototype.str = function(ret, x) + { + if (cr.is_string(x)) + ret.set_string(x); + else + ret.set_string(x.toString()); + }; + SysExps.prototype.len = function(ret, x) + { + ret.set_int(x.length || 0); + }; + SysExps.prototype.random = function (ret, a, b) + { + if (b === undefined) + { + ret.set_float(Math.random() * a); + } + else + { + ret.set_float(Math.random() * (b - a) + a); + } + }; + SysExps.prototype.sqrt = function(ret, x) + { + ret.set_float(Math.sqrt(x)); + }; + SysExps.prototype.abs = function(ret, x) + { + ret.set_float(Math.abs(x)); + }; + SysExps.prototype.round = function(ret, x) + { + ret.set_int(Math.round(x)); + }; + SysExps.prototype.floor = function(ret, x) + { + ret.set_int(Math.floor(x)); + }; + SysExps.prototype.ceil = function(ret, x) + { + ret.set_int(Math.ceil(x)); + }; + SysExps.prototype.sin = function(ret, x) + { + ret.set_float(Math.sin(cr.to_radians(x))); + }; + SysExps.prototype.cos = function(ret, x) + { + ret.set_float(Math.cos(cr.to_radians(x))); + }; + SysExps.prototype.tan = function(ret, x) + { + ret.set_float(Math.tan(cr.to_radians(x))); + }; + SysExps.prototype.asin = function(ret, x) + { + ret.set_float(cr.to_degrees(Math.asin(x))); + }; + SysExps.prototype.acos = function(ret, x) + { + ret.set_float(cr.to_degrees(Math.acos(x))); + }; + SysExps.prototype.atan = function(ret, x) + { + ret.set_float(cr.to_degrees(Math.atan(x))); + }; + SysExps.prototype.exp = function(ret, x) + { + ret.set_float(Math.exp(x)); + }; + SysExps.prototype.ln = function(ret, x) + { + ret.set_float(Math.log(x)); + }; + SysExps.prototype.log10 = function(ret, x) + { + ret.set_float(Math.log(x) / Math.LN10); + }; + SysExps.prototype.max = function(ret) + { + var max_ = arguments[1]; + if (typeof max_ !== "number") + max_ = 0; + var i, len, a; + for (i = 2, len = arguments.length; i < len; i++) + { + a = arguments[i]; + if (typeof a !== "number") + continue; // ignore non-numeric types + if (max_ < a) + max_ = a; + } + ret.set_float(max_); + }; + SysExps.prototype.min = function(ret) + { + var min_ = arguments[1]; + if (typeof min_ !== "number") + min_ = 0; + var i, len, a; + for (i = 2, len = arguments.length; i < len; i++) + { + a = arguments[i]; + if (typeof a !== "number") + continue; // ignore non-numeric types + if (min_ > a) + min_ = a; + } + ret.set_float(min_); + }; + SysExps.prototype.dt = function(ret) + { + ret.set_float(this.runtime.dt); + }; + SysExps.prototype.timescale = function(ret) + { + ret.set_float(this.runtime.timescale); + }; + SysExps.prototype.wallclocktime = function(ret) + { + ret.set_float((Date.now() - this.runtime.start_time) / 1000.0); + }; + SysExps.prototype.time = function(ret) + { + ret.set_float(this.runtime.kahanTime.sum); + }; + SysExps.prototype.tickcount = function(ret) + { + ret.set_int(this.runtime.tickcount); + }; + SysExps.prototype.objectcount = function(ret) + { + ret.set_int(this.runtime.objectcount); + }; + SysExps.prototype.fps = function(ret) + { + ret.set_int(this.runtime.fps); + }; + SysExps.prototype.loopindex = function(ret, name_) + { + var loop, i, len; + if (!this.runtime.loop_stack.length) + { + ret.set_int(0); + return; + } + if (name_) + { + for (i = this.runtime.loop_stack_index; i >= 0; --i) + { + loop = this.runtime.loop_stack[i]; + if (loop.name === name_) + { + ret.set_int(loop.index); + return; + } + } + ret.set_int(0); + } + else + { + loop = this.runtime.getCurrentLoop(); + ret.set_int(loop ? loop.index : -1); + } + }; + SysExps.prototype.distance = function(ret, x1, y1, x2, y2) + { + ret.set_float(cr.distanceTo(x1, y1, x2, y2)); + }; + SysExps.prototype.angle = function(ret, x1, y1, x2, y2) + { + ret.set_float(cr.to_degrees(cr.angleTo(x1, y1, x2, y2))); + }; + SysExps.prototype.scrollx = function(ret) + { + ret.set_float(this.runtime.running_layout.scrollX); + }; + SysExps.prototype.scrolly = function(ret) + { + ret.set_float(this.runtime.running_layout.scrollY); + }; + SysExps.prototype.newline = function(ret) + { + ret.set_string("\n"); + }; + SysExps.prototype.lerp = function(ret, a, b, x) + { + ret.set_float(cr.lerp(a, b, x)); + }; + SysExps.prototype.qarp = function(ret, a, b, c, x) + { + ret.set_float(cr.qarp(a, b, c, x)); + }; + SysExps.prototype.cubic = function(ret, a, b, c, d, x) + { + ret.set_float(cr.cubic(a, b, c, d, x)); + }; + SysExps.prototype.cosp = function(ret, a, b, x) + { + ret.set_float(cr.cosp(a, b, x)); + }; + SysExps.prototype.windowwidth = function(ret) + { + ret.set_int(this.runtime.width); + }; + SysExps.prototype.windowheight = function(ret) + { + ret.set_int(this.runtime.height); + }; + SysExps.prototype.uppercase = function(ret, str) + { + ret.set_string(cr.is_string(str) ? str.toUpperCase() : ""); + }; + SysExps.prototype.lowercase = function(ret, str) + { + ret.set_string(cr.is_string(str) ? str.toLowerCase() : ""); + }; + SysExps.prototype.clamp = function(ret, x, l, u) + { + if (x < l) + ret.set_float(l); + else if (x > u) + ret.set_float(u); + else + ret.set_float(x); + }; + SysExps.prototype.layerscale = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(layer.scale); + }; + SysExps.prototype.layeropacity = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(layer.opacity * 100); + }; + SysExps.prototype.layerscalerate = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(layer.zoomRate); + }; + SysExps.prototype.layerparallaxx = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(layer.parallaxX * 100); + }; + SysExps.prototype.layerparallaxy = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(layer.parallaxY * 100); + }; + SysExps.prototype.layerindex = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_int(-1); + else + ret.set_int(layer.index); + }; + SysExps.prototype.layoutscale = function (ret) + { + if (this.runtime.running_layout) + ret.set_float(this.runtime.running_layout.scale); + else + ret.set_float(0); + }; + SysExps.prototype.layoutangle = function (ret) + { + ret.set_float(cr.to_degrees(this.runtime.running_layout.angle)); + }; + SysExps.prototype.layerangle = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + if (!layer) + ret.set_float(0); + else + ret.set_float(cr.to_degrees(layer.angle)); + }; + SysExps.prototype.layoutwidth = function (ret) + { + ret.set_int(this.runtime.running_layout.width); + }; + SysExps.prototype.layoutheight = function (ret) + { + ret.set_int(this.runtime.running_layout.height); + }; + SysExps.prototype.find = function (ret, text, searchstr) + { + if (cr.is_string(text) && cr.is_string(searchstr)) + ret.set_int(text.search(new RegExp(cr.regexp_escape(searchstr), "i"))); + else + ret.set_int(-1); + }; + SysExps.prototype.findcase = function (ret, text, searchstr) + { + if (cr.is_string(text) && cr.is_string(searchstr)) + ret.set_int(text.search(new RegExp(cr.regexp_escape(searchstr), ""))); + else + ret.set_int(-1); + }; + SysExps.prototype.left = function (ret, text, n) + { + ret.set_string(cr.is_string(text) ? text.substr(0, n) : ""); + }; + SysExps.prototype.right = function (ret, text, n) + { + ret.set_string(cr.is_string(text) ? text.substr(text.length - n) : ""); + }; + SysExps.prototype.mid = function (ret, text, index_, length_) + { + ret.set_string(cr.is_string(text) ? text.substr(index_, length_) : ""); + }; + SysExps.prototype.tokenat = function (ret, text, index_, sep) + { + if (cr.is_string(text) && cr.is_string(sep)) + { + var arr = text.split(sep); + var i = cr.floor(index_); + if (i < 0 || i >= arr.length) + ret.set_string(""); + else + ret.set_string(arr[i]); + } + else + ret.set_string(""); + }; + SysExps.prototype.tokencount = function (ret, text, sep) + { + if (cr.is_string(text) && text.length) + ret.set_int(text.split(sep).length); + else + ret.set_int(0); + }; + SysExps.prototype.replace = function (ret, text, find_, replace_) + { + if (cr.is_string(text) && cr.is_string(find_) && cr.is_string(replace_)) + ret.set_string(text.replace(new RegExp(cr.regexp_escape(find_), "gi"), replace_)); + else + ret.set_string(cr.is_string(text) ? text : ""); + }; + SysExps.prototype.trim = function (ret, text) + { + ret.set_string(cr.is_string(text) ? text.trim() : ""); + }; + SysExps.prototype.pi = function (ret) + { + ret.set_float(cr.PI); + }; + SysExps.prototype.layoutname = function (ret) + { + if (this.runtime.running_layout) + ret.set_string(this.runtime.running_layout.name); + else + ret.set_string(""); + }; + SysExps.prototype.renderer = function (ret) + { + ret.set_string(this.runtime.gl ? "webgl" : "canvas2d"); + }; + SysExps.prototype.rendererdetail = function (ret) + { + ret.set_string(this.runtime.glUnmaskedRenderer); + }; + SysExps.prototype.anglediff = function (ret, a, b) + { + ret.set_float(cr.to_degrees(cr.angleDiff(cr.to_radians(a), cr.to_radians(b)))); + }; + SysExps.prototype.choose = function (ret) + { + var index = cr.floor(Math.random() * (arguments.length - 1)); + ret.set_any(arguments[index + 1]); + }; + SysExps.prototype.rgb = function (ret, r, g, b) + { + ret.set_int(cr.RGB(r, g, b)); + }; + SysExps.prototype.projectversion = function (ret) + { + ret.set_string(this.runtime.versionstr); + }; + SysExps.prototype.projectname = function (ret) + { + ret.set_string(this.runtime.projectName); + }; + SysExps.prototype.anglelerp = function (ret, a, b, x) + { + a = cr.to_radians(a); + b = cr.to_radians(b); + var diff = cr.angleDiff(a, b); + if (cr.angleClockwise(b, a)) + { + ret.set_float(cr.to_clamped_degrees(a + diff * x)); + } + else + { + ret.set_float(cr.to_clamped_degrees(a - diff * x)); + } + }; + SysExps.prototype.anglerotate = function (ret, a, b, c) + { + a = cr.to_radians(a); + b = cr.to_radians(b); + c = cr.to_radians(c); + ret.set_float(cr.to_clamped_degrees(cr.angleRotate(a, b, c))); + }; + SysExps.prototype.zeropad = function (ret, n, d) + { + var s = (n < 0 ? "-" : ""); + if (n < 0) n = -n; + var zeroes = d - n.toString().length; + for (var i = 0; i < zeroes; i++) + s += "0"; + ret.set_string(s + n.toString()); + }; + SysExps.prototype.cpuutilisation = function (ret) + { + ret.set_float(this.runtime.cpuutilisation / 1000); + }; + SysExps.prototype.viewportleft = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.viewLeft : 0); + }; + SysExps.prototype.viewporttop = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.viewTop : 0); + }; + SysExps.prototype.viewportright = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.viewRight : 0); + }; + SysExps.prototype.viewportbottom = function (ret, layerparam) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.viewBottom : 0); + }; + SysExps.prototype.loadingprogress = function (ret) + { + ret.set_float(this.runtime.loadingprogress); + }; + SysExps.prototype.unlerp = function(ret, a, b, y) + { + ret.set_float(cr.unlerp(a, b, y)); + }; + SysExps.prototype.canvassnapshot = function (ret) + { + ret.set_string(this.runtime.snapshotData); + }; + SysExps.prototype.urlencode = function (ret, s) + { + ret.set_string(encodeURIComponent(s)); + }; + SysExps.prototype.urldecode = function (ret, s) + { + ret.set_string(decodeURIComponent(s)); + }; + SysExps.prototype.canvastolayerx = function (ret, layerparam, x, y) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.canvasToLayer(x, y, true) : 0); + }; + SysExps.prototype.canvastolayery = function (ret, layerparam, x, y) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.canvasToLayer(x, y, false) : 0); + }; + SysExps.prototype.layertocanvasx = function (ret, layerparam, x, y) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.layerToCanvas(x, y, true) : 0); + }; + SysExps.prototype.layertocanvasy = function (ret, layerparam, x, y) + { + var layer = this.runtime.getLayer(layerparam); + ret.set_float(layer ? layer.layerToCanvas(x, y, false) : 0); + }; + SysExps.prototype.savestatejson = function (ret) + { + ret.set_string(this.runtime.lastSaveJson); + }; + SysExps.prototype.imagememoryusage = function (ret) + { + if (this.runtime.glwrap) + ret.set_float(Math.round(100 * this.runtime.glwrap.estimateVRAM() / (1024 * 1024)) / 100); + else + ret.set_float(0); + }; + SysExps.prototype.regexsearch = function (ret, str_, regex_, flags_) + { + var regex = getRegex(regex_, flags_); + ret.set_int(str_ ? str_.search(regex) : -1); + }; + SysExps.prototype.regexreplace = function (ret, str_, regex_, flags_, replace_) + { + var regex = getRegex(regex_, flags_); + ret.set_string(str_ ? str_.replace(regex, replace_) : ""); + }; + var regexMatches = []; + var lastMatchesStr = ""; + var lastMatchesRegex = ""; + var lastMatchesFlags = ""; + function updateRegexMatches(str_, regex_, flags_) + { + if (str_ === lastMatchesStr && regex_ === lastMatchesRegex && flags_ === lastMatchesFlags) + return; + var regex = getRegex(regex_, flags_); + regexMatches = str_.match(regex); + lastMatchesStr = str_; + lastMatchesRegex = regex_; + lastMatchesFlags = flags_; + }; + SysExps.prototype.regexmatchcount = function (ret, str_, regex_, flags_) + { + var regex = getRegex(regex_, flags_); + updateRegexMatches(str_, regex_, flags_); + ret.set_int(regexMatches ? regexMatches.length : 0); + }; + SysExps.prototype.regexmatchat = function (ret, str_, regex_, flags_, index_) + { + index_ = Math.floor(index_); + var regex = getRegex(regex_, flags_); + updateRegexMatches(str_, regex_, flags_); + if (!regexMatches || index_ < 0 || index_ >= regexMatches.length) + ret.set_string(""); + else + ret.set_string(regexMatches[index_]); + }; + SysExps.prototype.infinity = function (ret) + { + ret.set_float(Infinity); + }; + SysExps.prototype.setbit = function (ret, n, b, v) + { + n = n | 0; + b = b | 0; + v = (v !== 0 ? 1 : 0); + ret.set_int((n & ~(1 << b)) | (v << b)); + }; + SysExps.prototype.togglebit = function (ret, n, b) + { + n = n | 0; + b = b | 0; + ret.set_int(n ^ (1 << b)); + }; + SysExps.prototype.getbit = function (ret, n, b) + { + n = n | 0; + b = b | 0; + ret.set_int((n & (1 << b)) ? 1 : 0); + }; + SysExps.prototype.originalwindowwidth = function (ret) + { + ret.set_int(this.runtime.original_width); + }; + SysExps.prototype.originalwindowheight = function (ret) + { + ret.set_int(this.runtime.original_height); + }; + sysProto.exps = new SysExps(); + sysProto.runWaits = function () + { + var i, j, len, w, k, s, ss; + var evinfo = this.runtime.getCurrentEventStack(); + for (i = 0, len = this.waits.length; i < len; i++) + { + w = this.waits[i]; + if (w.time === -1) // signalled wait + { + if (!w.signalled) + continue; // not yet signalled + } + else // timer wait + { + if (w.time > this.runtime.kahanTime.sum) + continue; // timer not yet expired + } + evinfo.current_event = w.ev; + evinfo.actindex = w.actindex; + evinfo.cndindex = 0; + for (k in w.sols) + { + if (w.sols.hasOwnProperty(k)) + { + s = this.runtime.types_by_index[parseInt(k, 10)].getCurrentSol(); + ss = w.sols[k]; + s.select_all = ss.sa; + cr.shallowAssignArray(s.instances, ss.insts); + freeSolStateObject(ss); + } + } + w.ev.resume_actions_and_subevents(); + this.runtime.clearSol(w.solModifiers); + w.deleteme = true; + } + for (i = 0, j = 0, len = this.waits.length; i < len; i++) + { + w = this.waits[i]; + this.waits[j] = w; + if (w.deleteme) + freeWaitObject(w); + else + j++; + } + cr.truncateArray(this.waits, j); + }; +}()); +; +(function () { + cr.add_common_aces = function (m, pluginProto) + { + var singleglobal_ = m[1]; + var position_aces = m[3]; + var size_aces = m[4]; + var angle_aces = m[5]; + var appearance_aces = m[6]; + var zorder_aces = m[7]; + var effects_aces = m[8]; + if (!pluginProto.cnds) + pluginProto.cnds = {}; + if (!pluginProto.acts) + pluginProto.acts = {}; + if (!pluginProto.exps) + pluginProto.exps = {}; + var cnds = pluginProto.cnds; + var acts = pluginProto.acts; + var exps = pluginProto.exps; + if (position_aces) + { + cnds.CompareX = function (cmp, x) + { + return cr.do_cmp(this.x, cmp, x); + }; + cnds.CompareY = function (cmp, y) + { + return cr.do_cmp(this.y, cmp, y); + }; + cnds.IsOnScreen = function () + { + var layer = this.layer; + this.update_bbox(); + var bbox = this.bbox; + return !(bbox.right < layer.viewLeft || bbox.bottom < layer.viewTop || bbox.left > layer.viewRight || bbox.top > layer.viewBottom); + }; + cnds.IsOutsideLayout = function () + { + this.update_bbox(); + var bbox = this.bbox; + var layout = this.runtime.running_layout; + return (bbox.right < 0 || bbox.bottom < 0 || bbox.left > layout.width || bbox.top > layout.height); + }; + cnds.PickDistance = function (which, x, y) + { + var sol = this.getCurrentSol(); + var instances = sol.getObjects(); + if (!instances.length) + return false; + var inst = instances[0]; + var pickme = inst; + var dist = cr.distanceTo(inst.x, inst.y, x, y); + var i, len, d; + for (i = 1, len = instances.length; i < len; i++) + { + inst = instances[i]; + d = cr.distanceTo(inst.x, inst.y, x, y); + if ((which === 0 && d < dist) || (which === 1 && d > dist)) + { + dist = d; + pickme = inst; + } + } + sol.pick_one(pickme); + return true; + }; + acts.SetX = function (x) + { + if (this.x !== x) + { + this.x = x; + this.set_bbox_changed(); + } + }; + acts.SetY = function (y) + { + if (this.y !== y) + { + this.y = y; + this.set_bbox_changed(); + } + }; + acts.SetPos = function (x, y) + { + if (this.x !== x || this.y !== y) + { + this.x = x; + this.y = y; + this.set_bbox_changed(); + } + }; + acts.SetPosToObject = function (obj, imgpt) + { + var inst = obj.getPairedInstance(this); + if (!inst) + return; + var newx, newy; + if (inst.getImagePoint) + { + newx = inst.getImagePoint(imgpt, true); + newy = inst.getImagePoint(imgpt, false); + } + else + { + newx = inst.x; + newy = inst.y; + } + if (this.x !== newx || this.y !== newy) + { + this.x = newx; + this.y = newy; + this.set_bbox_changed(); + } + }; + acts.MoveForward = function (dist) + { + if (dist !== 0) + { + this.x += Math.cos(this.angle) * dist; + this.y += Math.sin(this.angle) * dist; + this.set_bbox_changed(); + } + }; + acts.MoveAtAngle = function (a, dist) + { + if (dist !== 0) + { + this.x += Math.cos(cr.to_radians(a)) * dist; + this.y += Math.sin(cr.to_radians(a)) * dist; + this.set_bbox_changed(); + } + }; + exps.X = function (ret) + { + ret.set_float(this.x); + }; + exps.Y = function (ret) + { + ret.set_float(this.y); + }; + exps.dt = function (ret) + { + ret.set_float(this.runtime.getDt(this)); + }; + } + if (size_aces) + { + cnds.CompareWidth = function (cmp, w) + { + return cr.do_cmp(this.width, cmp, w); + }; + cnds.CompareHeight = function (cmp, h) + { + return cr.do_cmp(this.height, cmp, h); + }; + acts.SetWidth = function (w) + { + if (this.width !== w) + { + this.width = w; + this.set_bbox_changed(); + } + }; + acts.SetHeight = function (h) + { + if (this.height !== h) + { + this.height = h; + this.set_bbox_changed(); + } + }; + acts.SetSize = function (w, h) + { + if (this.width !== w || this.height !== h) + { + this.width = w; + this.height = h; + this.set_bbox_changed(); + } + }; + exps.Width = function (ret) + { + ret.set_float(this.width); + }; + exps.Height = function (ret) + { + ret.set_float(this.height); + }; + exps.BBoxLeft = function (ret) + { + this.update_bbox(); + ret.set_float(this.bbox.left); + }; + exps.BBoxTop = function (ret) + { + this.update_bbox(); + ret.set_float(this.bbox.top); + }; + exps.BBoxRight = function (ret) + { + this.update_bbox(); + ret.set_float(this.bbox.right); + }; + exps.BBoxBottom = function (ret) + { + this.update_bbox(); + ret.set_float(this.bbox.bottom); + }; + } + if (angle_aces) + { + cnds.AngleWithin = function (within, a) + { + return cr.angleDiff(this.angle, cr.to_radians(a)) <= cr.to_radians(within); + }; + cnds.IsClockwiseFrom = function (a) + { + return cr.angleClockwise(this.angle, cr.to_radians(a)); + }; + cnds.IsBetweenAngles = function (a, b) + { + var lower = cr.to_clamped_radians(a); + var upper = cr.to_clamped_radians(b); + var angle = cr.clamp_angle(this.angle); + var obtuse = (!cr.angleClockwise(upper, lower)); + if (obtuse) + return !(!cr.angleClockwise(angle, lower) && cr.angleClockwise(angle, upper)); + else + return cr.angleClockwise(angle, lower) && !cr.angleClockwise(angle, upper); + }; + acts.SetAngle = function (a) + { + var newangle = cr.to_radians(cr.clamp_angle_degrees(a)); + if (isNaN(newangle)) + return; + if (this.angle !== newangle) + { + this.angle = newangle; + this.set_bbox_changed(); + } + }; + acts.RotateClockwise = function (a) + { + if (a !== 0 && !isNaN(a)) + { + this.angle += cr.to_radians(a); + this.angle = cr.clamp_angle(this.angle); + this.set_bbox_changed(); + } + }; + acts.RotateCounterclockwise = function (a) + { + if (a !== 0 && !isNaN(a)) + { + this.angle -= cr.to_radians(a); + this.angle = cr.clamp_angle(this.angle); + this.set_bbox_changed(); + } + }; + acts.RotateTowardAngle = function (amt, target) + { + var newangle = cr.angleRotate(this.angle, cr.to_radians(target), cr.to_radians(amt)); + if (isNaN(newangle)) + return; + if (this.angle !== newangle) + { + this.angle = newangle; + this.set_bbox_changed(); + } + }; + acts.RotateTowardPosition = function (amt, x, y) + { + var dx = x - this.x; + var dy = y - this.y; + var target = Math.atan2(dy, dx); + var newangle = cr.angleRotate(this.angle, target, cr.to_radians(amt)); + if (isNaN(newangle)) + return; + if (this.angle !== newangle) + { + this.angle = newangle; + this.set_bbox_changed(); + } + }; + acts.SetTowardPosition = function (x, y) + { + var dx = x - this.x; + var dy = y - this.y; + var newangle = Math.atan2(dy, dx); + if (isNaN(newangle)) + return; + if (this.angle !== newangle) + { + this.angle = newangle; + this.set_bbox_changed(); + } + }; + exps.Angle = function (ret) + { + ret.set_float(cr.to_clamped_degrees(this.angle)); + }; + } + if (!singleglobal_) + { + cnds.CompareInstanceVar = function (iv, cmp, val) + { + return cr.do_cmp(this.instance_vars[iv], cmp, val); + }; + cnds.IsBoolInstanceVarSet = function (iv) + { + return this.instance_vars[iv]; + }; + cnds.PickInstVarHiLow = function (which, iv) + { + var sol = this.getCurrentSol(); + var instances = sol.getObjects(); + if (!instances.length) + return false; + var inst = instances[0]; + var pickme = inst; + var val = inst.instance_vars[iv]; + var i, len, v; + for (i = 1, len = instances.length; i < len; i++) + { + inst = instances[i]; + v = inst.instance_vars[iv]; + if ((which === 0 && v < val) || (which === 1 && v > val)) + { + val = v; + pickme = inst; + } + } + sol.pick_one(pickme); + return true; + }; + cnds.PickByUID = function (u) + { + var i, len, j, inst, families, instances, sol; + var cnd = this.runtime.getCurrentCondition(); + if (cnd.inverted) + { + sol = this.getCurrentSol(); + if (sol.select_all) + { + sol.select_all = false; + cr.clearArray(sol.instances); + cr.clearArray(sol.else_instances); + instances = this.instances; + for (i = 0, len = instances.length; i < len; i++) + { + inst = instances[i]; + if (inst.uid === u) + sol.else_instances.push(inst); + else + sol.instances.push(inst); + } + this.applySolToContainer(); + return !!sol.instances.length; + } + else + { + for (i = 0, j = 0, len = sol.instances.length; i < len; i++) + { + inst = sol.instances[i]; + sol.instances[j] = inst; + if (inst.uid === u) + { + sol.else_instances.push(inst); + } + else + j++; + } + cr.truncateArray(sol.instances, j); + this.applySolToContainer(); + return !!sol.instances.length; + } + } + else + { + inst = this.runtime.getObjectByUID(u); + if (!inst) + return false; + sol = this.getCurrentSol(); + if (!sol.select_all && sol.instances.indexOf(inst) === -1) + return false; // not picked + if (this.is_family) + { + families = inst.type.families; + for (i = 0, len = families.length; i < len; i++) + { + if (families[i] === this) + { + sol.pick_one(inst); + this.applySolToContainer(); + return true; + } + } + } + else if (inst.type === this) + { + sol.pick_one(inst); + this.applySolToContainer(); + return true; + } + return false; + } + }; + cnds.OnCreated = function () + { + return true; + }; + cnds.OnDestroyed = function () + { + return true; + }; + acts.SetInstanceVar = function (iv, val) + { + var myinstvars = this.instance_vars; + if (cr.is_number(myinstvars[iv])) + { + if (cr.is_number(val)) + myinstvars[iv] = val; + else + myinstvars[iv] = parseFloat(val); + } + else if (cr.is_string(myinstvars[iv])) + { + if (cr.is_string(val)) + myinstvars[iv] = val; + else + myinstvars[iv] = val.toString(); + } + else +; + }; + acts.AddInstanceVar = function (iv, val) + { + var myinstvars = this.instance_vars; + if (cr.is_number(myinstvars[iv])) + { + if (cr.is_number(val)) + myinstvars[iv] += val; + else + myinstvars[iv] += parseFloat(val); + } + else if (cr.is_string(myinstvars[iv])) + { + if (cr.is_string(val)) + myinstvars[iv] += val; + else + myinstvars[iv] += val.toString(); + } + else +; + }; + acts.SubInstanceVar = function (iv, val) + { + var myinstvars = this.instance_vars; + if (cr.is_number(myinstvars[iv])) + { + if (cr.is_number(val)) + myinstvars[iv] -= val; + else + myinstvars[iv] -= parseFloat(val); + } + else +; + }; + acts.SetBoolInstanceVar = function (iv, val) + { + this.instance_vars[iv] = val ? 1 : 0; + }; + acts.ToggleBoolInstanceVar = function (iv) + { + this.instance_vars[iv] = 1 - this.instance_vars[iv]; + }; + acts.Destroy = function () + { + this.runtime.DestroyInstance(this); + }; + if (!acts.LoadFromJsonString) + { + acts.LoadFromJsonString = function (str_) + { + var o, i, len, binst; + try { + o = JSON.parse(str_); + } + catch (e) { + return; + } + this.runtime.loadInstanceFromJSON(this, o, true); + if (this.afterLoad) + this.afterLoad(); + if (this.behavior_insts) + { + for (i = 0, len = this.behavior_insts.length; i < len; ++i) + { + binst = this.behavior_insts[i]; + if (binst.afterLoad) + binst.afterLoad(); + } + } + }; + } + exps.Count = function (ret) + { + var count = ret.object_class.instances.length; + var i, len, inst; + for (i = 0, len = this.runtime.createRow.length; i < len; i++) + { + inst = this.runtime.createRow[i]; + if (ret.object_class.is_family) + { + if (inst.type.families.indexOf(ret.object_class) >= 0) + count++; + } + else + { + if (inst.type === ret.object_class) + count++; + } + } + ret.set_int(count); + }; + exps.PickedCount = function (ret) + { + ret.set_int(ret.object_class.getCurrentSol().getObjects().length); + }; + exps.UID = function (ret) + { + ret.set_int(this.uid); + }; + exps.IID = function (ret) + { + ret.set_int(this.get_iid()); + }; + if (!exps.AsJSON) + { + exps.AsJSON = function (ret) + { + ret.set_string(JSON.stringify(this.runtime.saveInstanceToJSON(this, true))); + }; + } + } + if (appearance_aces) + { + cnds.IsVisible = function () + { + return this.visible; + }; + acts.SetVisible = function (v) + { + if (!v !== !this.visible) + { + this.visible = !!v; + this.runtime.redraw = true; + } + }; + cnds.CompareOpacity = function (cmp, x) + { + return cr.do_cmp(cr.round6dp(this.opacity * 100), cmp, x); + }; + acts.SetOpacity = function (x) + { + var new_opacity = x / 100.0; + if (new_opacity < 0) + new_opacity = 0; + else if (new_opacity > 1) + new_opacity = 1; + if (new_opacity !== this.opacity) + { + this.opacity = new_opacity; + this.runtime.redraw = true; + } + }; + exps.Opacity = function (ret) + { + ret.set_float(cr.round6dp(this.opacity * 100.0)); + }; + } + if (zorder_aces) + { + cnds.IsOnLayer = function (layer_) + { + if (!layer_) + return false; + return this.layer === layer_; + }; + cnds.PickTopBottom = function (which_) + { + var sol = this.getCurrentSol(); + var instances = sol.getObjects(); + if (!instances.length) + return false; + var inst = instances[0]; + var pickme = inst; + var i, len; + for (i = 1, len = instances.length; i < len; i++) + { + inst = instances[i]; + if (which_ === 0) + { + if (inst.layer.index > pickme.layer.index || (inst.layer.index === pickme.layer.index && inst.get_zindex() > pickme.get_zindex())) + { + pickme = inst; + } + } + else + { + if (inst.layer.index < pickme.layer.index || (inst.layer.index === pickme.layer.index && inst.get_zindex() < pickme.get_zindex())) + { + pickme = inst; + } + } + } + sol.pick_one(pickme); + return true; + }; + acts.MoveToTop = function () + { + var layer = this.layer; + var layer_instances = layer.instances; + if (layer_instances.length && layer_instances[layer_instances.length - 1] === this) + return; // is already at top + layer.removeFromInstanceList(this, false); + layer.appendToInstanceList(this, false); + this.runtime.redraw = true; + }; + acts.MoveToBottom = function () + { + var layer = this.layer; + var layer_instances = layer.instances; + if (layer_instances.length && layer_instances[0] === this) + return; // is already at bottom + layer.removeFromInstanceList(this, false); + layer.prependToInstanceList(this, false); + this.runtime.redraw = true; + }; + acts.MoveToLayer = function (layerMove) + { + if (!layerMove || layerMove == this.layer) + return; + this.layer.removeFromInstanceList(this, true); + this.layer = layerMove; + layerMove.appendToInstanceList(this, true); + this.runtime.redraw = true; + }; + acts.ZMoveToObject = function (where_, obj_) + { + var isafter = (where_ === 0); + if (!obj_) + return; + var other = obj_.getFirstPicked(this); + if (!other || other.uid === this.uid) + return; + if (this.layer.index !== other.layer.index) + { + this.layer.removeFromInstanceList(this, true); + this.layer = other.layer; + other.layer.appendToInstanceList(this, true); + } + this.layer.moveInstanceAdjacent(this, other, isafter); + this.runtime.redraw = true; + }; + exps.LayerNumber = function (ret) + { + ret.set_int(this.layer.number); + }; + exps.LayerName = function (ret) + { + ret.set_string(this.layer.name); + }; + exps.ZIndex = function (ret) + { + ret.set_int(this.get_zindex()); + }; + } + if (effects_aces) + { + acts.SetEffectEnabled = function (enable_, effectname_) + { + if (!this.runtime.glwrap) + return; + var i = this.type.getEffectIndexByName(effectname_); + if (i < 0) + return; // effect name not found + var enable = (enable_ === 1); + if (this.active_effect_flags[i] === enable) + return; // no change + this.active_effect_flags[i] = enable; + this.updateActiveEffects(); + this.runtime.redraw = true; + }; + acts.SetEffectParam = function (effectname_, index_, value_) + { + if (!this.runtime.glwrap) + return; + var i = this.type.getEffectIndexByName(effectname_); + if (i < 0) + return; // effect name not found + var et = this.type.effect_types[i]; + var params = this.effect_params[i]; + index_ = Math.floor(index_); + if (index_ < 0 || index_ >= params.length) + return; // effect index out of bounds + if (this.runtime.glwrap.getProgramParameterType(et.shaderindex, index_) === 1) + value_ /= 100.0; + if (params[index_] === value_) + return; // no change + params[index_] = value_; + if (et.active) + this.runtime.redraw = true; + }; + } + }; + cr.set_bbox_changed = function () + { + this.bbox_changed = true; // will recreate next time box requested + this.cell_changed = true; + this.type.any_cell_changed = true; // avoid unnecessary updateAllBBox() calls + this.runtime.redraw = true; // assume runtime needs to redraw + var i, len, callbacks = this.bbox_changed_callbacks; + for (i = 0, len = callbacks.length; i < len; ++i) + { + callbacks[i](this); + } + if (this.layer.useRenderCells) + this.update_bbox(); + }; + cr.add_bbox_changed_callback = function (f) + { + if (f) + { + this.bbox_changed_callbacks.push(f); + } + }; + cr.update_bbox = function () + { + if (!this.bbox_changed) + return; // bounding box not changed + var bbox = this.bbox; + var bquad = this.bquad; + bbox.set(this.x, this.y, this.x + this.width, this.y + this.height); + bbox.offset(-this.hotspotX * this.width, -this.hotspotY * this.height); + if (!this.angle) + { + bquad.set_from_rect(bbox); // make bounding quad from box + } + else + { + bbox.offset(-this.x, -this.y); // translate to origin + bquad.set_from_rotated_rect(bbox, this.angle); // rotate around origin + bquad.offset(this.x, this.y); // translate back to original position + bquad.bounding_box(bbox); + } + bbox.normalize(); + this.bbox_changed = false; // bounding box up to date + this.update_render_cell(); + }; + var tmprc = new cr.rect(0, 0, 0, 0); + cr.update_render_cell = function () + { + if (!this.layer.useRenderCells) + return; + var mygrid = this.layer.render_grid; + var bbox = this.bbox; + tmprc.set(mygrid.XToCell(bbox.left), mygrid.YToCell(bbox.top), mygrid.XToCell(bbox.right), mygrid.YToCell(bbox.bottom)); + if (this.rendercells.equals(tmprc)) + return; + if (this.rendercells.right < this.rendercells.left) + mygrid.update(this, null, tmprc); // first insertion with invalid rect: don't provide old range + else + mygrid.update(this, this.rendercells, tmprc); + this.rendercells.copy(tmprc); + this.layer.render_list_stale = true; + }; + cr.update_collision_cell = function () + { + if (!this.cell_changed || !this.collisionsEnabled) + return; + this.update_bbox(); + var mygrid = this.type.collision_grid; + var bbox = this.bbox; + tmprc.set(mygrid.XToCell(bbox.left), mygrid.YToCell(bbox.top), mygrid.XToCell(bbox.right), mygrid.YToCell(bbox.bottom)); + if (this.collcells.equals(tmprc)) + return; + if (this.collcells.right < this.collcells.left) + mygrid.update(this, null, tmprc); // first insertion with invalid rect: don't provide old range + else + mygrid.update(this, this.collcells, tmprc); + this.collcells.copy(tmprc); + this.cell_changed = false; + }; + cr.inst_contains_pt = function (x, y) + { + if (!this.bbox.contains_pt(x, y)) + return false; + if (!this.bquad.contains_pt(x, y)) + return false; + if (this.collision_poly && !this.collision_poly.is_empty()) + { + this.collision_poly.cache_poly(this.width, this.height, this.angle); + return this.collision_poly.contains_pt(x - this.x, y - this.y); + } + else + return true; + }; + cr.inst_get_iid = function () + { + this.type.updateIIDs(); + return this.iid; + }; + cr.inst_get_zindex = function () + { + this.layer.updateZIndices(); + return this.zindex; + }; + cr.inst_updateActiveEffects = function () + { + cr.clearArray(this.active_effect_types); + var i, len, et; + var preserves_opaqueness = true; + for (i = 0, len = this.active_effect_flags.length; i < len; i++) + { + if (this.active_effect_flags[i]) + { + et = this.type.effect_types[i]; + this.active_effect_types.push(et); + if (!et.preservesOpaqueness) + preserves_opaqueness = false; + } + } + this.uses_shaders = !!this.active_effect_types.length; + this.shaders_preserve_opaqueness = preserves_opaqueness; + }; + cr.inst_toString = function () + { + return "Inst" + this.puid; + }; + cr.type_getFirstPicked = function (frominst) + { + if (frominst && frominst.is_contained && frominst.type != this) + { + var i, len, s; + for (i = 0, len = frominst.siblings.length; i < len; i++) + { + s = frominst.siblings[i]; + if (s.type == this) + return s; + } + } + var instances = this.getCurrentSol().getObjects(); + if (instances.length) + return instances[0]; + else + return null; + }; + cr.type_getPairedInstance = function (inst) + { + var instances = this.getCurrentSol().getObjects(); + if (instances.length) + return instances[inst.get_iid() % instances.length]; + else + return null; + }; + cr.type_updateIIDs = function () + { + if (!this.stale_iids || this.is_family) + return; // up to date or is family - don't want family to overwrite IIDs + var i, len; + for (i = 0, len = this.instances.length; i < len; i++) + this.instances[i].iid = i; + var next_iid = i; + var createRow = this.runtime.createRow; + for (i = 0, len = createRow.length; i < len; ++i) + { + if (createRow[i].type === this) + createRow[i].iid = next_iid++; + } + this.stale_iids = false; + }; + cr.type_getInstanceByIID = function (i) + { + if (i < this.instances.length) + return this.instances[i]; + i -= this.instances.length; + var createRow = this.runtime.createRow; + var j, lenj; + for (j = 0, lenj = createRow.length; j < lenj; ++j) + { + if (createRow[j].type === this) + { + if (i === 0) + return createRow[j]; + --i; + } + } +; + return null; + }; + cr.type_getCurrentSol = function () + { + return this.solstack[this.cur_sol]; + }; + cr.type_pushCleanSol = function () + { + this.cur_sol++; + if (this.cur_sol === this.solstack.length) + { + this.solstack.push(new cr.selection(this)); + } + else + { + this.solstack[this.cur_sol].select_all = true; // else clear next SOL + cr.clearArray(this.solstack[this.cur_sol].else_instances); + } + }; + cr.type_pushCopySol = function () + { + this.cur_sol++; + if (this.cur_sol === this.solstack.length) + this.solstack.push(new cr.selection(this)); + var clonesol = this.solstack[this.cur_sol]; + var prevsol = this.solstack[this.cur_sol - 1]; + if (prevsol.select_all) + { + clonesol.select_all = true; + cr.clearArray(clonesol.else_instances); + } + else + { + clonesol.select_all = false; + cr.shallowAssignArray(clonesol.instances, prevsol.instances); + cr.shallowAssignArray(clonesol.else_instances, prevsol.else_instances); + } + }; + cr.type_popSol = function () + { +; + this.cur_sol--; + }; + cr.type_getBehaviorByName = function (behname) + { + var i, len, j, lenj, f, index = 0; + if (!this.is_family) + { + for (i = 0, len = this.families.length; i < len; i++) + { + f = this.families[i]; + for (j = 0, lenj = f.behaviors.length; j < lenj; j++) + { + if (behname === f.behaviors[j].name) + { + this.extra["lastBehIndex"] = index; + return f.behaviors[j]; + } + index++; + } + } + } + for (i = 0, len = this.behaviors.length; i < len; i++) { + if (behname === this.behaviors[i].name) + { + this.extra["lastBehIndex"] = index; + return this.behaviors[i]; + } + index++; + } + return null; + }; + cr.type_getBehaviorIndexByName = function (behname) + { + var b = this.getBehaviorByName(behname); + if (b) + return this.extra["lastBehIndex"]; + else + return -1; + }; + cr.type_getEffectIndexByName = function (name_) + { + var i, len; + for (i = 0, len = this.effect_types.length; i < len; i++) + { + if (this.effect_types[i].name === name_) + return i; + } + return -1; + }; + cr.type_applySolToContainer = function () + { + if (!this.is_contained || this.is_family) + return; + var i, len, j, lenj, t, sol, sol2; + this.updateIIDs(); + sol = this.getCurrentSol(); + var select_all = sol.select_all; + var es = this.runtime.getCurrentEventStack(); + var orblock = es && es.current_event && es.current_event.orblock; + for (i = 0, len = this.container.length; i < len; i++) + { + t = this.container[i]; + if (t === this) + continue; + t.updateIIDs(); + sol2 = t.getCurrentSol(); + sol2.select_all = select_all; + if (!select_all) + { + cr.clearArray(sol2.instances); + for (j = 0, lenj = sol.instances.length; j < lenj; ++j) + sol2.instances[j] = t.getInstanceByIID(sol.instances[j].iid); + if (orblock) + { + cr.clearArray(sol2.else_instances); + for (j = 0, lenj = sol.else_instances.length; j < lenj; ++j) + sol2.else_instances[j] = t.getInstanceByIID(sol.else_instances[j].iid); + } + } + } + }; + cr.type_toString = function () + { + return "Type" + this.sid; + }; + cr.do_cmp = function (x, cmp, y) + { + if (typeof x === "undefined" || typeof y === "undefined") + return false; + switch (cmp) + { + case 0: // equal + return x === y; + case 1: // not equal + return x !== y; + case 2: // less + return x < y; + case 3: // less/equal + return x <= y; + case 4: // greater + return x > y; + case 5: // greater/equal + return x >= y; + default: +; + return false; + } + }; +})(); +cr.shaders = {}; +cr.shaders["blurhorizontal"] = {src: ["varying mediump vec2 vTex;", +"uniform mediump sampler2D samplerFront;", +"uniform mediump float pixelWidth;", +"uniform mediump float intensity;", +"void main(void)", +"{", +"mediump vec4 sum = vec4(0.0);", +"mediump float halfPixelWidth = pixelWidth / 2.0;", +"sum += texture2D(samplerFront, vTex - vec2(pixelWidth * 7.0 + halfPixelWidth, 0.0)) * 0.06;", +"sum += texture2D(samplerFront, vTex - vec2(pixelWidth * 5.0 + halfPixelWidth, 0.0)) * 0.10;", +"sum += texture2D(samplerFront, vTex - vec2(pixelWidth * 3.0 + halfPixelWidth, 0.0)) * 0.13;", +"sum += texture2D(samplerFront, vTex - vec2(pixelWidth * 1.0 + halfPixelWidth, 0.0)) * 0.16;", +"mediump vec4 front = texture2D(samplerFront, vTex);", +"sum += front * 0.10;", +"sum += texture2D(samplerFront, vTex + vec2(pixelWidth * 1.0 + halfPixelWidth, 0.0)) * 0.16;", +"sum += texture2D(samplerFront, vTex + vec2(pixelWidth * 3.0 + halfPixelWidth, 0.0)) * 0.13;", +"sum += texture2D(samplerFront, vTex + vec2(pixelWidth * 5.0 + halfPixelWidth, 0.0)) * 0.10;", +"sum += texture2D(samplerFront, vTex + vec2(pixelWidth * 7.0 + halfPixelWidth, 0.0)) * 0.06;", +"gl_FragColor = mix(front, sum, intensity);", +"}" +].join("\n"), + extendBoxHorizontal: 8, + extendBoxVertical: 0, + crossSampling: false, + preservesOpaqueness: false, + animated: false, + parameters: [["intensity", 0, 1]] } +cr.shaders["blurvertical"] = {src: ["varying mediump vec2 vTex;", +"uniform mediump sampler2D samplerFront;", +"uniform mediump float pixelHeight;", +"uniform mediump float intensity;", +"void main(void)", +"{", +"mediump vec4 sum = vec4(0.0);", +"mediump float halfPixelHeight = pixelHeight / 2.0;", +"sum += texture2D(samplerFront, vTex - vec2(0.0, pixelHeight * 7.0 + halfPixelHeight)) * 0.06;", +"sum += texture2D(samplerFront, vTex - vec2(0.0, pixelHeight * 5.0 + halfPixelHeight)) * 0.10;", +"sum += texture2D(samplerFront, vTex - vec2(0.0, pixelHeight * 3.0 + halfPixelHeight)) * 0.13;", +"sum += texture2D(samplerFront, vTex - vec2(0.0, pixelHeight * 1.0 + halfPixelHeight)) * 0.16;", +"mediump vec4 front = texture2D(samplerFront, vTex);", +"sum += front * 0.10;", +"sum += texture2D(samplerFront, vTex + vec2(0.0, pixelHeight * 1.0 + halfPixelHeight)) * 0.16;", +"sum += texture2D(samplerFront, vTex + vec2(0.0, pixelHeight * 3.0 + halfPixelHeight)) * 0.13;", +"sum += texture2D(samplerFront, vTex + vec2(0.0, pixelHeight * 5.0 + halfPixelHeight)) * 0.10;", +"sum += texture2D(samplerFront, vTex + vec2(0.0, pixelHeight * 7.0 + halfPixelHeight)) * 0.06;", +"gl_FragColor = mix(front, sum, intensity);", +"}" +].join("\n"), + extendBoxHorizontal: 0, + extendBoxVertical: 8, + crossSampling: false, + preservesOpaqueness: false, + animated: false, + parameters: [["intensity", 0, 1]] } +cr.shaders["brightness"] = {src: ["varying mediump vec2 vTex;", +"uniform lowp sampler2D samplerFront;", +"uniform lowp float brightness;", +"void main(void)", +"{", +"lowp vec4 front = texture2D(samplerFront, vTex);", +"lowp float a = front.a;", +"if (a != 0.0)", +"front.rgb /= front.a;", +"front.rgb += (brightness - 1.0);", +"front.rgb *= a;", +"gl_FragColor = front;", +"}" +].join("\n"), + extendBoxHorizontal: 0, + extendBoxVertical: 0, + crossSampling: false, + preservesOpaqueness: true, + animated: false, + parameters: [["brightness", 0, 1]] } +cr.shaders["setcolor"] = {src: ["varying mediump vec2 vTex;", +"uniform lowp sampler2D samplerFront;", +"uniform lowp float red;", +"uniform lowp float green;", +"uniform lowp float blue;", +"void main(void)", +"{", +"lowp float a = texture2D(samplerFront, vTex).a;", +"gl_FragColor = vec4(red * a, green * a, blue * a, a);", +"}" +].join("\n"), + extendBoxHorizontal: 0, + extendBoxVertical: 0, + crossSampling: false, + preservesOpaqueness: true, + animated: false, + parameters: [["red", 0, 1], ["green", 0, 1], ["blue", 0, 1]] } +cr.shaders["tint"] = {src: ["varying mediump vec2 vTex;", +"uniform lowp sampler2D samplerFront;", +"uniform lowp float red;", +"uniform lowp float green;", +"uniform lowp float blue;", +"void main(void)", +"{", +"lowp vec4 front = texture2D(samplerFront, vTex);", +"gl_FragColor = front * vec4(red, green, blue, 1.0);", +"}" +].join("\n"), + extendBoxHorizontal: 0, + extendBoxVertical: 0, + crossSampling: false, + preservesOpaqueness: true, + animated: false, + parameters: [["red", 0, 1], ["green", 0, 1], ["blue", 0, 1]] } +cr.shaders["waterbg"] = {src: ["varying mediump vec2 vTex;", +"uniform lowp sampler2D samplerFront;", +"uniform lowp sampler2D samplerBack;", +"uniform mediump vec2 destStart;", +"uniform mediump vec2 destEnd;", +"precision mediump float;", +"uniform float seconds;", +"uniform float pixelWidth;", +"uniform float pixelHeight;", +"const float PI = 3.1415926535897932;", +"uniform float speed;", +"uniform float speed_x;", +"uniform float speed_y;", +"uniform float intensity;", +"const int steps = 8;", +"uniform float frequency;", +"uniform float angle; // better when a prime", +"uniform float delta;", +"uniform float intence;", +"uniform float emboss;", +"float col(vec2 coord)", +"{", +"float delta_theta = 2.0 * PI / angle;", +"float col = 0.0;", +"float theta = 0.0;", +"for (int i = 0; i < steps; i++)", +"{", +"vec2 adjc = coord;", +"theta = delta_theta*float(i);", +"adjc.x += cos(theta)*seconds*speed + seconds * speed_x;", +"adjc.y -= sin(theta)*seconds*speed - seconds * speed_y;", +"col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity;", +"}", +"return cos(col);", +"}", +"void main(void)", +"{", +"vec2 p = vTex, c1 = p, c2 = p;", +"float cc1 = col(c1);", +"c2.x += (1.0 / pixelWidth) / delta;", +"float dx = emboss*(cc1-col(c2))/delta;", +"c2.x = p.x;", +"c2.y += (1.0 / pixelHeight) / delta;", +"float dy = emboss*(cc1-col(c2))/delta;", +"c1.x += dx;", +"c1.y = -(c1.y+dy);", +"float alpha = 1.+dot(dx,dy)*intence;", +"c1.y = -c1.y;", +"lowp vec4 front = texture2D(samplerFront,c1) * alpha;", +"lowp vec4 result;", +"if (front.a == 0.0)", +"result = front + texture2D(samplerBack, mix(destStart, destEnd, vTex)) * (1.0 - front.a);", +"else", +"result = front + texture2D(samplerBack, mix(destStart, destEnd, c1)) * (1.0 - front.a);", +"gl_FragColor = result;", +"}" +].join("\n"), + extendBoxHorizontal: 25, + extendBoxVertical: 25, + crossSampling: true, + preservesOpaqueness: false, + animated: true, + parameters: [["speed", 0, 1], ["speed_x", 0, 1], ["speed_y", 0, 1], ["intensity", 0, 0], ["frequency", 0, 0], ["angle", 0, 0], ["delta", 0, 0], ["intence", 0, 0], ["emboss", 0, 1]] } +; +; +cr.plugins_.Arr = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Arr.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + var arrCache = []; + function allocArray() + { + if (arrCache.length) + return arrCache.pop(); + else + return []; + }; + if (!Array.isArray) + { + Array.isArray = function (vArg) { + return Object.prototype.toString.call(vArg) === "[object Array]"; + }; + } + function freeArray(a) + { + var i, len; + for (i = 0, len = a.length; i < len; i++) + { + if (Array.isArray(a[i])) + freeArray(a[i]); + } + cr.clearArray(a); + arrCache.push(a); + }; + instanceProto.onCreate = function() + { + this.cx = this.properties[0]; + this.cy = this.properties[1]; + this.cz = this.properties[2]; + if (!this.recycled) + this.arr = allocArray(); + var a = this.arr; + a.length = this.cx; + var x, y, z; + for (x = 0; x < this.cx; x++) + { + if (!a[x]) + a[x] = allocArray(); + a[x].length = this.cy; + for (y = 0; y < this.cy; y++) + { + if (!a[x][y]) + a[x][y] = allocArray(); + a[x][y].length = this.cz; + for (z = 0; z < this.cz; z++) + a[x][y][z] = 0; + } + } + this.forX = []; + this.forY = []; + this.forZ = []; + this.forDepth = -1; + }; + instanceProto.onDestroy = function () + { + var x; + for (x = 0; x < this.cx; x++) + freeArray(this.arr[x]); // will recurse down and recycle other arrays + cr.clearArray(this.arr); + }; + instanceProto.at = function (x, y, z) + { + x = Math.floor(x); + y = Math.floor(y); + z = Math.floor(z); + if (isNaN(x) || x < 0 || x > this.cx - 1) + return 0; + if (isNaN(y) || y < 0 || y > this.cy - 1) + return 0; + if (isNaN(z) || z < 0 || z > this.cz - 1) + return 0; + return this.arr[x][y][z]; + }; + instanceProto.set = function (x, y, z, val) + { + x = Math.floor(x); + y = Math.floor(y); + z = Math.floor(z); + if (isNaN(x) || x < 0 || x > this.cx - 1) + return; + if (isNaN(y) || y < 0 || y > this.cy - 1) + return; + if (isNaN(z) || z < 0 || z > this.cz - 1) + return; + this.arr[x][y][z] = val; + }; + instanceProto.getAsJSON = function () + { + return JSON.stringify({ + "c2array": true, + "size": [this.cx, this.cy, this.cz], + "data": this.arr + }); + }; + instanceProto.saveToJSON = function () + { + return { + "size": [this.cx, this.cy, this.cz], + "data": this.arr + }; + }; + instanceProto.loadFromJSON = function (o) + { + var sz = o["size"]; + this.cx = sz[0]; + this.cy = sz[1]; + this.cz = sz[2]; + this.arr = o["data"]; + }; + instanceProto.setSize = function (w, h, d) + { + if (w < 0) w = 0; + if (h < 0) h = 0; + if (d < 0) d = 0; + if (this.cx === w && this.cy === h && this.cz === d) + return; // no change + this.cx = w; + this.cy = h; + this.cz = d; + var x, y, z; + var a = this.arr; + a.length = w; + for (x = 0; x < this.cx; x++) + { + if (cr.is_undefined(a[x])) + a[x] = allocArray(); + a[x].length = h; + for (y = 0; y < this.cy; y++) + { + if (cr.is_undefined(a[x][y])) + a[x][y] = allocArray(); + a[x][y].length = d; + for (z = 0; z < this.cz; z++) + { + if (cr.is_undefined(a[x][y][z])) + a[x][y][z] = 0; + } + } + } + }; + instanceProto.getForX = function () + { + if (this.forDepth >= 0 && this.forDepth < this.forX.length) + return this.forX[this.forDepth]; + else + return 0; + }; + instanceProto.getForY = function () + { + if (this.forDepth >= 0 && this.forDepth < this.forY.length) + return this.forY[this.forDepth]; + else + return 0; + }; + instanceProto.getForZ = function () + { + if (this.forDepth >= 0 && this.forDepth < this.forZ.length) + return this.forZ[this.forDepth]; + else + return 0; + }; + function Cnds() {}; + Cnds.prototype.CompareX = function (x, cmp, val) + { + return cr.do_cmp(this.at(x, 0, 0), cmp, val); + }; + Cnds.prototype.CompareXY = function (x, y, cmp, val) + { + return cr.do_cmp(this.at(x, y, 0), cmp, val); + }; + Cnds.prototype.CompareXYZ = function (x, y, z, cmp, val) + { + return cr.do_cmp(this.at(x, y, z), cmp, val); + }; + instanceProto.doForEachTrigger = function (current_event) + { + this.runtime.pushCopySol(current_event.solModifiers); + current_event.retrigger(); + this.runtime.popSol(current_event.solModifiers); + }; + Cnds.prototype.ArrForEach = function (dims) + { + var current_event = this.runtime.getCurrentEventStack().current_event; + this.forDepth++; + var forDepth = this.forDepth; + if (forDepth === this.forX.length) + { + this.forX.push(0); + this.forY.push(0); + this.forZ.push(0); + } + else + { + this.forX[forDepth] = 0; + this.forY[forDepth] = 0; + this.forZ[forDepth] = 0; + } + switch (dims) { + case 0: + for (this.forX[forDepth] = 0; this.forX[forDepth] < this.cx; this.forX[forDepth]++) + { + for (this.forY[forDepth] = 0; this.forY[forDepth] < this.cy; this.forY[forDepth]++) + { + for (this.forZ[forDepth] = 0; this.forZ[forDepth] < this.cz; this.forZ[forDepth]++) + { + this.doForEachTrigger(current_event); + } + } + } + break; + case 1: + for (this.forX[forDepth] = 0; this.forX[forDepth] < this.cx; this.forX[forDepth]++) + { + for (this.forY[forDepth] = 0; this.forY[forDepth] < this.cy; this.forY[forDepth]++) + { + this.doForEachTrigger(current_event); + } + } + break; + case 2: + for (this.forX[forDepth] = 0; this.forX[forDepth] < this.cx; this.forX[forDepth]++) + { + this.doForEachTrigger(current_event); + } + break; + } + this.forDepth--; + return false; + }; + Cnds.prototype.CompareCurrent = function (cmp, val) + { + return cr.do_cmp(this.at(this.getForX(), this.getForY(), this.getForZ()), cmp, val); + }; + Cnds.prototype.Contains = function(val) + { + var x, y, z; + for (x = 0; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + for (z = 0; z < this.cz; z++) + { + if (this.arr[x][y][z] === val) + return true; + } + } + } + return false; + }; + Cnds.prototype.IsEmpty = function () + { + return this.cx === 0 || this.cy === 0 || this.cz === 0; + }; + Cnds.prototype.CompareSize = function (axis, cmp, value) + { + var s = 0; + switch (axis) { + case 0: + s = this.cx; + break; + case 1: + s = this.cy; + break; + case 2: + s = this.cz; + break; + } + return cr.do_cmp(s, cmp, value); + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Clear = function () + { + var x, y, z; + for (x = 0; x < this.cx; x++) + for (y = 0; y < this.cy; y++) + for (z = 0; z < this.cz; z++) + this.arr[x][y][z] = 0; + }; + Acts.prototype.SetSize = function (w, h, d) + { + this.setSize(w, h, d); + }; + Acts.prototype.SetX = function (x, val) + { + this.set(x, 0, 0, val); + }; + Acts.prototype.SetXY = function (x, y, val) + { + this.set(x, y, 0, val); + }; + Acts.prototype.SetXYZ = function (x, y, z, val) + { + this.set(x, y, z, val); + }; + Acts.prototype.Push = function (where, value, axis) + { + var x = 0, y = 0, z = 0; + var a = this.arr; + switch (axis) { + case 0: // X axis + if (where === 0) // back + { + x = a.length; + a.push(allocArray()); + } + else // front + { + x = 0; + a.unshift(allocArray()); + } + a[x].length = this.cy; + for ( ; y < this.cy; y++) + { + a[x][y] = allocArray(); + a[x][y].length = this.cz; + for (z = 0; z < this.cz; z++) + a[x][y][z] = value; + } + this.cx++; + break; + case 1: // Y axis + for ( ; x < this.cx; x++) + { + if (where === 0) // back + { + y = a[x].length; + a[x].push(allocArray()); + } + else // front + { + y = 0; + a[x].unshift(allocArray()); + } + a[x][y].length = this.cz; + for (z = 0; z < this.cz; z++) + a[x][y][z] = value; + } + this.cy++; + break; + case 2: // Z axis + for ( ; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + if (where === 0) // back + { + a[x][y].push(value); + } + else // front + { + a[x][y].unshift(value); + } + } + } + this.cz++; + break; + } + }; + Acts.prototype.Pop = function (where, axis) + { + var x = 0, y = 0, z = 0; + var a = this.arr; + switch (axis) { + case 0: // X axis + if (this.cx === 0) + break; + if (where === 0) // back + { + freeArray(a.pop()); + } + else // front + { + freeArray(a.shift()); + } + this.cx--; + break; + case 1: // Y axis + if (this.cy === 0) + break; + for ( ; x < this.cx; x++) + { + if (where === 0) // back + { + freeArray(a[x].pop()); + } + else // front + { + freeArray(a[x].shift()); + } + } + this.cy--; + break; + case 2: // Z axis + if (this.cz === 0) + break; + for ( ; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + if (where === 0) // back + { + a[x][y].pop(); + } + else // front + { + a[x][y].shift(); + } + } + } + this.cz--; + break; + } + }; + Acts.prototype.Reverse = function (axis) + { + var x = 0, y = 0, z = 0; + var a = this.arr; + if (this.cx === 0 || this.cy === 0 || this.cz === 0) + return; // no point reversing empty array + switch (axis) { + case 0: // X axis + a.reverse(); + break; + case 1: // Y axis + for ( ; x < this.cx; x++) + a[x].reverse(); + break; + case 2: // Z axis + for ( ; x < this.cx; x++) + for (y = 0; y < this.cy; y++) + a[x][y].reverse(); + this.cz--; + break; + } + }; + function compareValues(va, vb) + { + if (cr.is_number(va) && cr.is_number(vb)) + return va - vb; + else + { + var sa = "" + va; + var sb = "" + vb; + if (sa < sb) + return -1; + else if (sa > sb) + return 1; + else + return 0; + } + } + Acts.prototype.Sort = function (axis) + { + var x = 0, y = 0, z = 0; + var a = this.arr; + if (this.cx === 0 || this.cy === 0 || this.cz === 0) + return; // no point sorting empty array + switch (axis) { + case 0: // X axis + a.sort(function (a, b) { + return compareValues(a[0][0], b[0][0]); + }); + break; + case 1: // Y axis + for ( ; x < this.cx; x++) + { + a[x].sort(function (a, b) { + return compareValues(a[0], b[0]); + }); + } + break; + case 2: // Z axis + for ( ; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + a[x][y].sort(compareValues); + } + } + break; + } + }; + Acts.prototype.Delete = function (index, axis) + { + var x = 0, y = 0, z = 0; + index = Math.floor(index); + var a = this.arr; + if (index < 0) + return; + switch (axis) { + case 0: // X axis + if (index >= this.cx) + break; + freeArray(a[index]); + a.splice(index, 1); + this.cx--; + break; + case 1: // Y axis + if (index >= this.cy) + break; + for ( ; x < this.cx; x++) + { + freeArray(a[x][index]); + a[x].splice(index, 1); + } + this.cy--; + break; + case 2: // Z axis + if (index >= this.cz) + break; + for ( ; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + a[x][y].splice(index, 1); + } + } + this.cz--; + break; + } + }; + Acts.prototype.Insert = function (value, index, axis) + { + var x = 0, y = 0, z = 0; + index = Math.floor(index); + var a = this.arr; + if (index < 0) + return; + switch (axis) { + case 0: // X axis + if (index > this.cx) + return; + x = index; + a.splice(x, 0, allocArray()); + a[x].length = this.cy; + for ( ; y < this.cy; y++) + { + a[x][y] = allocArray(); + a[x][y].length = this.cz; + for (z = 0; z < this.cz; z++) + a[x][y][z] = value; + } + this.cx++; + break; + case 1: // Y axis + if (index > this.cy) + return; + for ( ; x < this.cx; x++) + { + y = index; + a[x].splice(y, 0, allocArray()); + a[x][y].length = this.cz; + for (z = 0; z < this.cz; z++) + a[x][y][z] = value; + } + this.cy++; + break; + case 2: // Z axis + if (index > this.cz) + return; + for ( ; x < this.cx; x++) + { + for (y = 0; y < this.cy; y++) + { + a[x][y].splice(index, 0, value); + } + } + this.cz++; + break; + } + }; + Acts.prototype.JSONLoad = function (json_) + { + var o; + try { + o = JSON.parse(json_); + } + catch(e) { return; } + if (!o["c2array"]) // presumably not a c2array object + return; + var sz = o["size"]; + this.cx = sz[0]; + this.cy = sz[1]; + this.cz = sz[2]; + this.arr = o["data"]; + }; + Acts.prototype.JSONDownload = function (filename) + { + + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.At = function (ret, x, y_, z_) + { + var y = y_ || 0; + var z = z_ || 0; + ret.set_any(this.at(x, y, z)); + }; + Exps.prototype.Width = function (ret) + { + ret.set_int(this.cx); + }; + Exps.prototype.Height = function (ret) + { + ret.set_int(this.cy); + }; + Exps.prototype.Depth = function (ret) + { + ret.set_int(this.cz); + }; + Exps.prototype.CurX = function (ret) + { + ret.set_int(this.getForX()); + }; + Exps.prototype.CurY = function (ret) + { + ret.set_int(this.getForY()); + }; + Exps.prototype.CurZ = function (ret) + { + ret.set_int(this.getForZ()); + }; + Exps.prototype.CurValue = function (ret) + { + ret.set_any(this.at(this.getForX(), this.getForY(), this.getForZ())); + }; + Exps.prototype.Front = function (ret) + { + ret.set_any(this.at(0, 0, 0)); + }; + Exps.prototype.Back = function (ret) + { + ret.set_any(this.at(this.cx - 1, 0, 0)); + }; + Exps.prototype.IndexOf = function (ret, v) + { + for (var i = 0; i < this.cx; i++) + { + if (this.arr[i][0][0] === v) + { + ret.set_int(i); + return; + } + } + ret.set_int(-1); + }; + Exps.prototype.LastIndexOf = function (ret, v) + { + for (var i = this.cx - 1; i >= 0; i--) + { + if (this.arr[i][0][0] === v) + { + ret.set_int(i); + return; + } + } + ret.set_int(-1); + }; + Exps.prototype.AsJSON = function (ret) + { + ret.set_string(this.getAsJSON()); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Audio = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Audio.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + var audRuntime = null; + var audInst = null; + var audTag = ""; + var appPath = ""; // for Cordova only + var API_HTML5 = 0; + var API_WEBAUDIO = 1; + var API_CORDOVA = 2; + var API_APPMOBI = 3; + var api = API_HTML5; + var context = null; + var audioBuffers = []; // cache of buffers + var audioInstances = []; // cache of instances + var lastAudio = null; + var useOgg = false; // determined at create time + var timescale_mode = 0; + var silent = false; + var masterVolume = 1; + var listenerX = 0; + var listenerY = 0; + var isContextSuspended = false; + var panningModel = 1; // HRTF + var distanceModel = 1; // Inverse + var refDistance = 10; + var maxDistance = 10000; + var rolloffFactor = 1; + var micSource = null; + var micTag = ""; + var isMusicWorkaround = false; + var musicPlayNextTouch = []; + var playMusicAsSoundWorkaround = false; // play music tracks with Web Audio API + function dbToLinear(x) + { + var v = dbToLinear_nocap(x); + if (!isFinite(v)) // accidentally passing a string can result in NaN; set volume to 0 if so + v = 0; + if (v < 0) + v = 0; + if (v > 1) + v = 1; + return v; + }; + function linearToDb(x) + { + if (x < 0) + x = 0; + if (x > 1) + x = 1; + return linearToDb_nocap(x); + }; + function dbToLinear_nocap(x) + { + return Math.pow(10, x / 20); + }; + function linearToDb_nocap(x) + { + return (Math.log(x) / Math.log(10)) * 20; + }; + var effects = {}; + function getDestinationForTag(tag) + { + tag = tag.toLowerCase(); + if (effects.hasOwnProperty(tag)) + { + if (effects[tag].length) + return effects[tag][0].getInputNode(); + } + return context["destination"]; + }; + function createGain() + { + if (context["createGain"]) + return context["createGain"](); + else + return context["createGainNode"](); + }; + function createDelay(d) + { + if (context["createDelay"]) + return context["createDelay"](d); + else + return context["createDelayNode"](d); + }; + function startSource(s, scheduledTime) + { + if (s["start"]) + s["start"](scheduledTime || 0); + else + s["noteOn"](scheduledTime || 0); + }; + function startSourceAt(s, x, d, scheduledTime) + { + if (s["start"]) + s["start"](scheduledTime || 0, x); + else + s["noteGrainOn"](scheduledTime || 0, x, d - x); + }; + function stopSource(s) + { + try { + if (s["stop"]) + s["stop"](0); + else + s["noteOff"](0); + } + catch (e) {} + }; + function setAudioParam(ap, value, ramp, time) + { + if (!ap) + return; // iOS is missing some parameters + ap["cancelScheduledValues"](0); + if (time === 0) + { + ap["value"] = value; + return; + } + var curTime = context["currentTime"]; + time += curTime; + switch (ramp) { + case 0: // step + ap["setValueAtTime"](value, time); + break; + case 1: // linear + ap["setValueAtTime"](ap["value"], curTime); // to set what to ramp from + ap["linearRampToValueAtTime"](value, time); + break; + case 2: // exponential + ap["setValueAtTime"](ap["value"], curTime); // to set what to ramp from + ap["exponentialRampToValueAtTime"](value, time); + break; + } + }; + var filterTypes = ["lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass"]; + function FilterEffect(type, freq, detune, q, gain, mix) + { + this.type = "filter"; + this.params = [type, freq, detune, q, gain, mix]; + this.inputNode = createGain(); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix; + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - mix; + this.filterNode = context["createBiquadFilter"](); + if (typeof this.filterNode["type"] === "number") + this.filterNode["type"] = type; + else + this.filterNode["type"] = filterTypes[type]; + this.filterNode["frequency"]["value"] = freq; + if (this.filterNode["detune"]) // iOS 6 doesn't have detune yet + this.filterNode["detune"]["value"] = detune; + this.filterNode["Q"]["value"] = q; + this.filterNode["gain"]["value"] = gain; + this.inputNode["connect"](this.filterNode); + this.inputNode["connect"](this.dryNode); + this.filterNode["connect"](this.wetNode); + }; + FilterEffect.prototype.connectTo = function (node) + { + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + }; + FilterEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.filterNode["disconnect"](); + this.wetNode["disconnect"](); + this.dryNode["disconnect"](); + }; + FilterEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + FilterEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[5] = value; + setAudioParam(this.wetNode["gain"], value, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - value, ramp, time); + break; + case 1: // filter frequency + this.params[1] = value; + setAudioParam(this.filterNode["frequency"], value, ramp, time); + break; + case 2: // filter detune + this.params[2] = value; + setAudioParam(this.filterNode["detune"], value, ramp, time); + break; + case 3: // filter Q + this.params[3] = value; + setAudioParam(this.filterNode["Q"], value, ramp, time); + break; + case 4: // filter/delay gain (note value is in dB here) + this.params[4] = value; + setAudioParam(this.filterNode["gain"], value, ramp, time); + break; + } + }; + function DelayEffect(delayTime, delayGain, mix) + { + this.type = "delay"; + this.params = [delayTime, delayGain, mix]; + this.inputNode = createGain(); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix; + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - mix; + this.mainNode = createGain(); + this.delayNode = createDelay(delayTime); + this.delayNode["delayTime"]["value"] = delayTime; + this.delayGainNode = createGain(); + this.delayGainNode["gain"]["value"] = delayGain; + this.inputNode["connect"](this.mainNode); + this.inputNode["connect"](this.dryNode); + this.mainNode["connect"](this.wetNode); + this.mainNode["connect"](this.delayNode); + this.delayNode["connect"](this.delayGainNode); + this.delayGainNode["connect"](this.mainNode); + }; + DelayEffect.prototype.connectTo = function (node) + { + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + }; + DelayEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.mainNode["disconnect"](); + this.delayNode["disconnect"](); + this.delayGainNode["disconnect"](); + this.wetNode["disconnect"](); + this.dryNode["disconnect"](); + }; + DelayEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + DelayEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[2] = value; + setAudioParam(this.wetNode["gain"], value, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - value, ramp, time); + break; + case 4: // filter/delay gain (note value is passed in dB but needs to be linear here) + this.params[1] = dbToLinear(value); + setAudioParam(this.delayGainNode["gain"], dbToLinear(value), ramp, time); + break; + case 5: // delay time + this.params[0] = value; + setAudioParam(this.delayNode["delayTime"], value, ramp, time); + break; + } + }; + function ConvolveEffect(buffer, normalize, mix, src) + { + this.type = "convolve"; + this.params = [normalize, mix, src]; + this.inputNode = createGain(); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix; + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - mix; + this.convolveNode = context["createConvolver"](); + if (buffer) + { + this.convolveNode["normalize"] = normalize; + this.convolveNode["buffer"] = buffer; + } + this.inputNode["connect"](this.convolveNode); + this.inputNode["connect"](this.dryNode); + this.convolveNode["connect"](this.wetNode); + }; + ConvolveEffect.prototype.connectTo = function (node) + { + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + }; + ConvolveEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.convolveNode["disconnect"](); + this.wetNode["disconnect"](); + this.dryNode["disconnect"](); + }; + ConvolveEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + ConvolveEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[1] = value; + setAudioParam(this.wetNode["gain"], value, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - value, ramp, time); + break; + } + }; + function FlangerEffect(delay, modulation, freq, feedback, mix) + { + this.type = "flanger"; + this.params = [delay, modulation, freq, feedback, mix]; + this.inputNode = createGain(); + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - (mix / 2); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix / 2; + this.feedbackNode = createGain(); + this.feedbackNode["gain"]["value"] = feedback; + this.delayNode = createDelay(delay + modulation); + this.delayNode["delayTime"]["value"] = delay; + this.oscNode = context["createOscillator"](); + this.oscNode["frequency"]["value"] = freq; + this.oscGainNode = createGain(); + this.oscGainNode["gain"]["value"] = modulation; + this.inputNode["connect"](this.delayNode); + this.inputNode["connect"](this.dryNode); + this.delayNode["connect"](this.wetNode); + this.delayNode["connect"](this.feedbackNode); + this.feedbackNode["connect"](this.delayNode); + this.oscNode["connect"](this.oscGainNode); + this.oscGainNode["connect"](this.delayNode["delayTime"]); + startSource(this.oscNode); + }; + FlangerEffect.prototype.connectTo = function (node) + { + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + }; + FlangerEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.delayNode["disconnect"](); + this.oscNode["disconnect"](); + this.oscGainNode["disconnect"](); + this.dryNode["disconnect"](); + this.wetNode["disconnect"](); + this.feedbackNode["disconnect"](); + }; + FlangerEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + FlangerEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[4] = value; + setAudioParam(this.wetNode["gain"], value / 2, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - (value / 2), ramp, time); + break; + case 6: // modulation + this.params[1] = value / 1000; + setAudioParam(this.oscGainNode["gain"], value / 1000, ramp, time); + break; + case 7: // modulation frequency + this.params[2] = value; + setAudioParam(this.oscNode["frequency"], value, ramp, time); + break; + case 8: // feedback + this.params[3] = value / 100; + setAudioParam(this.feedbackNode["gain"], value / 100, ramp, time); + break; + } + }; + function PhaserEffect(freq, detune, q, modulation, modfreq, mix) + { + this.type = "phaser"; + this.params = [freq, detune, q, modulation, modfreq, mix]; + this.inputNode = createGain(); + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - (mix / 2); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix / 2; + this.filterNode = context["createBiquadFilter"](); + if (typeof this.filterNode["type"] === "number") + this.filterNode["type"] = 7; // all-pass + else + this.filterNode["type"] = "allpass"; + this.filterNode["frequency"]["value"] = freq; + if (this.filterNode["detune"]) // iOS 6 doesn't have detune yet + this.filterNode["detune"]["value"] = detune; + this.filterNode["Q"]["value"] = q; + this.oscNode = context["createOscillator"](); + this.oscNode["frequency"]["value"] = modfreq; + this.oscGainNode = createGain(); + this.oscGainNode["gain"]["value"] = modulation; + this.inputNode["connect"](this.filterNode); + this.inputNode["connect"](this.dryNode); + this.filterNode["connect"](this.wetNode); + this.oscNode["connect"](this.oscGainNode); + this.oscGainNode["connect"](this.filterNode["frequency"]); + startSource(this.oscNode); + }; + PhaserEffect.prototype.connectTo = function (node) + { + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + }; + PhaserEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.filterNode["disconnect"](); + this.oscNode["disconnect"](); + this.oscGainNode["disconnect"](); + this.dryNode["disconnect"](); + this.wetNode["disconnect"](); + }; + PhaserEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + PhaserEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[5] = value; + setAudioParam(this.wetNode["gain"], value / 2, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - (value / 2), ramp, time); + break; + case 1: // filter frequency + this.params[0] = value; + setAudioParam(this.filterNode["frequency"], value, ramp, time); + break; + case 2: // filter detune + this.params[1] = value; + setAudioParam(this.filterNode["detune"], value, ramp, time); + break; + case 3: // filter Q + this.params[2] = value; + setAudioParam(this.filterNode["Q"], value, ramp, time); + break; + case 6: // modulation + this.params[3] = value; + setAudioParam(this.oscGainNode["gain"], value, ramp, time); + break; + case 7: // modulation frequency + this.params[4] = value; + setAudioParam(this.oscNode["frequency"], value, ramp, time); + break; + } + }; + function GainEffect(g) + { + this.type = "gain"; + this.params = [g]; + this.node = createGain(); + this.node["gain"]["value"] = g; + }; + GainEffect.prototype.connectTo = function (node_) + { + this.node["disconnect"](); + this.node["connect"](node_); + }; + GainEffect.prototype.remove = function () + { + this.node["disconnect"](); + }; + GainEffect.prototype.getInputNode = function () + { + return this.node; + }; + GainEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 4: // gain + this.params[0] = dbToLinear(value); + setAudioParam(this.node["gain"], dbToLinear(value), ramp, time); + break; + } + }; + function TremoloEffect(freq, mix) + { + this.type = "tremolo"; + this.params = [freq, mix]; + this.node = createGain(); + this.node["gain"]["value"] = 1 - (mix / 2); + this.oscNode = context["createOscillator"](); + this.oscNode["frequency"]["value"] = freq; + this.oscGainNode = createGain(); + this.oscGainNode["gain"]["value"] = mix / 2; + this.oscNode["connect"](this.oscGainNode); + this.oscGainNode["connect"](this.node["gain"]); + startSource(this.oscNode); + }; + TremoloEffect.prototype.connectTo = function (node_) + { + this.node["disconnect"](); + this.node["connect"](node_); + }; + TremoloEffect.prototype.remove = function () + { + this.oscNode["disconnect"](); + this.oscGainNode["disconnect"](); + this.node["disconnect"](); + }; + TremoloEffect.prototype.getInputNode = function () + { + return this.node; + }; + TremoloEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[1] = value; + setAudioParam(this.node["gain"]["value"], 1 - (value / 2), ramp, time); + setAudioParam(this.oscGainNode["gain"]["value"], value / 2, ramp, time); + break; + case 7: // modulation frequency + this.params[0] = value; + setAudioParam(this.oscNode["frequency"], value, ramp, time); + break; + } + }; + function RingModulatorEffect(freq, mix) + { + this.type = "ringmod"; + this.params = [freq, mix]; + this.inputNode = createGain(); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix; + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - mix; + this.ringNode = createGain(); + this.ringNode["gain"]["value"] = 0; + this.oscNode = context["createOscillator"](); + this.oscNode["frequency"]["value"] = freq; + this.oscNode["connect"](this.ringNode["gain"]); + startSource(this.oscNode); + this.inputNode["connect"](this.ringNode); + this.inputNode["connect"](this.dryNode); + this.ringNode["connect"](this.wetNode); + }; + RingModulatorEffect.prototype.connectTo = function (node_) + { + this.wetNode["disconnect"](); + this.wetNode["connect"](node_); + this.dryNode["disconnect"](); + this.dryNode["connect"](node_); + }; + RingModulatorEffect.prototype.remove = function () + { + this.oscNode["disconnect"](); + this.ringNode["disconnect"](); + this.inputNode["disconnect"](); + this.wetNode["disconnect"](); + this.dryNode["disconnect"](); + }; + RingModulatorEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + RingModulatorEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[1] = value; + setAudioParam(this.wetNode["gain"], value, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - value, ramp, time); + break; + case 7: // modulation frequency + this.params[0] = value; + setAudioParam(this.oscNode["frequency"], value, ramp, time); + break; + } + }; + function DistortionEffect(threshold, headroom, drive, makeupgain, mix) + { + this.type = "distortion"; + this.params = [threshold, headroom, drive, makeupgain, mix]; + this.inputNode = createGain(); + this.preGain = createGain(); + this.postGain = createGain(); + this.setDrive(drive, dbToLinear_nocap(makeupgain)); + this.wetNode = createGain(); + this.wetNode["gain"]["value"] = mix; + this.dryNode = createGain(); + this.dryNode["gain"]["value"] = 1 - mix; + this.waveShaper = context["createWaveShaper"](); + this.curve = new Float32Array(65536); + this.generateColortouchCurve(threshold, headroom); + this.waveShaper.curve = this.curve; + this.inputNode["connect"](this.preGain); + this.inputNode["connect"](this.dryNode); + this.preGain["connect"](this.waveShaper); + this.waveShaper["connect"](this.postGain); + this.postGain["connect"](this.wetNode); + }; + DistortionEffect.prototype.setDrive = function (drive, makeupgain) + { + if (drive < 0.01) + drive = 0.01; + this.preGain["gain"]["value"] = drive; + this.postGain["gain"]["value"] = Math.pow(1 / drive, 0.6) * makeupgain; + }; + function e4(x, k) + { + return 1.0 - Math.exp(-k * x); + } + DistortionEffect.prototype.shape = function (x, linearThreshold, linearHeadroom) + { + var maximum = 1.05 * linearHeadroom * linearThreshold; + var kk = (maximum - linearThreshold); + var sign = x < 0 ? -1 : +1; + var absx = x < 0 ? -x : x; + var shapedInput = absx < linearThreshold ? absx : linearThreshold + kk * e4(absx - linearThreshold, 1.0 / kk); + shapedInput *= sign; + return shapedInput; + }; + DistortionEffect.prototype.generateColortouchCurve = function (threshold, headroom) + { + var linearThreshold = dbToLinear_nocap(threshold); + var linearHeadroom = dbToLinear_nocap(headroom); + var n = 65536; + var n2 = n / 2; + var x = 0; + for (var i = 0; i < n2; ++i) { + x = i / n2; + x = this.shape(x, linearThreshold, linearHeadroom); + this.curve[n2 + i] = x; + this.curve[n2 - i - 1] = -x; + } + }; + DistortionEffect.prototype.connectTo = function (node) + { + this.wetNode["disconnect"](); + this.wetNode["connect"](node); + this.dryNode["disconnect"](); + this.dryNode["connect"](node); + }; + DistortionEffect.prototype.remove = function () + { + this.inputNode["disconnect"](); + this.preGain["disconnect"](); + this.waveShaper["disconnect"](); + this.postGain["disconnect"](); + this.wetNode["disconnect"](); + this.dryNode["disconnect"](); + }; + DistortionEffect.prototype.getInputNode = function () + { + return this.inputNode; + }; + DistortionEffect.prototype.setParam = function(param, value, ramp, time) + { + switch (param) { + case 0: // mix + value = value / 100; + if (value < 0) value = 0; + if (value > 1) value = 1; + this.params[4] = value; + setAudioParam(this.wetNode["gain"], value, ramp, time); + setAudioParam(this.dryNode["gain"], 1 - value, ramp, time); + break; + } + }; + function CompressorEffect(threshold, knee, ratio, attack, release) + { + this.type = "compressor"; + this.params = [threshold, knee, ratio, attack, release]; + this.node = context["createDynamicsCompressor"](); + try { + this.node["threshold"]["value"] = threshold; + this.node["knee"]["value"] = knee; + this.node["ratio"]["value"] = ratio; + this.node["attack"]["value"] = attack; + this.node["release"]["value"] = release; + } + catch (e) {} + }; + CompressorEffect.prototype.connectTo = function (node_) + { + this.node["disconnect"](); + this.node["connect"](node_); + }; + CompressorEffect.prototype.remove = function () + { + this.node["disconnect"](); + }; + CompressorEffect.prototype.getInputNode = function () + { + return this.node; + }; + CompressorEffect.prototype.setParam = function(param, value, ramp, time) + { + }; + function AnalyserEffect(fftSize, smoothing) + { + this.type = "analyser"; + this.params = [fftSize, smoothing]; + this.node = context["createAnalyser"](); + this.node["fftSize"] = fftSize; + this.node["smoothingTimeConstant"] = smoothing; + this.freqBins = new Float32Array(this.node["frequencyBinCount"]); + this.signal = new Uint8Array(fftSize); + this.peak = 0; + this.rms = 0; + }; + AnalyserEffect.prototype.tick = function () + { + this.node["getFloatFrequencyData"](this.freqBins); + this.node["getByteTimeDomainData"](this.signal); + var fftSize = this.node["fftSize"]; + var i = 0; + this.peak = 0; + var rmsSquaredSum = 0; + var s = 0; + for ( ; i < fftSize; i++) + { + s = (this.signal[i] - 128) / 128; + if (s < 0) + s = -s; + if (this.peak < s) + this.peak = s; + rmsSquaredSum += s * s; + } + this.peak = linearToDb(this.peak); + this.rms = linearToDb(Math.sqrt(rmsSquaredSum / fftSize)); + }; + AnalyserEffect.prototype.connectTo = function (node_) + { + this.node["disconnect"](); + this.node["connect"](node_); + }; + AnalyserEffect.prototype.remove = function () + { + this.node["disconnect"](); + }; + AnalyserEffect.prototype.getInputNode = function () + { + return this.node; + }; + AnalyserEffect.prototype.setParam = function(param, value, ramp, time) + { + }; + function ObjectTracker() + { + this.obj = null; + this.loadUid = 0; + }; + ObjectTracker.prototype.setObject = function (obj_) + { + this.obj = obj_; + }; + ObjectTracker.prototype.hasObject = function () + { + return !!this.obj; + }; + ObjectTracker.prototype.tick = function (dt) + { + }; + var iOShadtouchstart = false; // has had touch start input on iOS <=8 to work around web audio API muting + var iOShadtouchend = false; // has had touch end input on iOS 9+ to work around web audio API muting + function C2AudioBuffer(src_, is_music) + { + this.src = src_; + this.myapi = api; + this.is_music = is_music; + this.added_end_listener = false; + var self = this; + this.outNode = null; + this.mediaSourceNode = null; + this.panWhenReady = []; // for web audio API positioned sounds + this.seekWhenReady = 0; + this.pauseWhenReady = false; + this.supportWebAudioAPI = false; + this.failedToLoad = false; + this.wasEverReady = false; // if a buffer is ever marked as ready, it's permanently considered ready after then. + if (api === API_WEBAUDIO && is_music && !playMusicAsSoundWorkaround) + { + this.myapi = API_HTML5; + this.outNode = createGain(); + } + this.bufferObject = null; // actual audio object + this.audioData = null; // web audio api: ajax request result (compressed audio that needs decoding) + var request; + switch (this.myapi) { + case API_HTML5: + this.bufferObject = new Audio(); + this.bufferObject.crossOrigin = "anonymous"; + this.bufferObject.addEventListener("canplaythrough", function () { + self.wasEverReady = true; // update loaded state so preload is considered complete + }); + if (api === API_WEBAUDIO && context["createMediaElementSource"] && !/wiiu/i.test(navigator.userAgent)) + { + this.supportWebAudioAPI = true; // can be routed through web audio api + this.bufferObject.addEventListener("canplay", function () + { + if (!self.mediaSourceNode) // protect against this event firing twice + { + self.mediaSourceNode = context["createMediaElementSource"](self.bufferObject); + self.mediaSourceNode["connect"](self.outNode); + } + }); + } + this.bufferObject.autoplay = false; // this is only a source buffer, not an instance + this.bufferObject.preload = "auto"; + this.bufferObject.src = src_; + break; + case API_WEBAUDIO: + if (audRuntime.isWKWebView) + { + audRuntime.fetchLocalFileViaCordovaAsArrayBuffer(src_, function (arrayBuffer) + { + self.audioData = arrayBuffer; + self.decodeAudioBuffer(); + }, function (err) + { + self.failedToLoad = true; + }); + } + else + { + request = new XMLHttpRequest(); + request.open("GET", src_, true); + request.responseType = "arraybuffer"; + request.onload = function () { + self.audioData = request.response; + self.decodeAudioBuffer(); + }; + request.onerror = function () { + self.failedToLoad = true; + }; + request.send(); + } + break; + case API_CORDOVA: + this.bufferObject = true; + break; + case API_APPMOBI: + this.bufferObject = true; + break; + } + }; + C2AudioBuffer.prototype.release = function () + { + var i, len, j, a; + for (i = 0, j = 0, len = audioInstances.length; i < len; ++i) + { + a = audioInstances[i]; + audioInstances[j] = a; + if (a.buffer === this) + a.stop(); + else + ++j; // keep + } + audioInstances.length = j; + this.bufferObject = null; + this.audioData = null; + }; + C2AudioBuffer.prototype.decodeAudioBuffer = function () + { + if (this.bufferObject || !this.audioData) + return; // audio already decoded or AJAX request not yet complete + var self = this; + if (context["decodeAudioData"]) + { + context["decodeAudioData"](this.audioData, function (buffer) { + self.bufferObject = buffer; + self.audioData = null; // clear AJAX response to allow GC and save memory, only need the bufferObject now + var p, i, len, a; + if (!cr.is_undefined(self.playTagWhenReady) && !silent) + { + if (self.panWhenReady.length) + { + for (i = 0, len = self.panWhenReady.length; i < len; i++) + { + p = self.panWhenReady[i]; + a = new C2AudioInstance(self, p.thistag); + a.setPannerEnabled(true); + if (typeof p.objUid !== "undefined") + { + p.obj = audRuntime.getObjectByUID(p.objUid); + if (!p.obj) + continue; + } + if (p.obj) + { + var px = cr.rotatePtAround(p.obj.x, p.obj.y, -p.obj.layer.getAngle(), listenerX, listenerY, true); + var py = cr.rotatePtAround(p.obj.x, p.obj.y, -p.obj.layer.getAngle(), listenerX, listenerY, false); + a.setPan(px, py, cr.to_degrees(p.obj.angle - p.obj.layer.getAngle()), p.ia, p.oa, p.og); + a.setObject(p.obj); + } + else + { + a.setPan(p.x, p.y, p.a, p.ia, p.oa, p.og); + } + a.play(self.loopWhenReady, self.volumeWhenReady, self.seekWhenReady); + if (self.pauseWhenReady) + a.pause(); + audioInstances.push(a); + } + cr.clearArray(self.panWhenReady); + } + else + { + a = new C2AudioInstance(self, self.playTagWhenReady || ""); // sometimes playTagWhenReady is not set - TODO: why? + a.play(self.loopWhenReady, self.volumeWhenReady, self.seekWhenReady); + if (self.pauseWhenReady) + a.pause(); + audioInstances.push(a); + } + } + else if (!cr.is_undefined(self.convolveWhenReady)) + { + var convolveNode = self.convolveWhenReady.convolveNode; + convolveNode["normalize"] = self.normalizeWhenReady; + convolveNode["buffer"] = buffer; + } + }, function (e) { + self.failedToLoad = true; + }); + } + else + { + this.bufferObject = context["createBuffer"](this.audioData, false); + this.audioData = null; // clear AJAX response to allow GC and save memory, only need the bufferObject now + if (!cr.is_undefined(this.playTagWhenReady) && !silent) + { + var a = new C2AudioInstance(this, this.playTagWhenReady); + a.play(this.loopWhenReady, this.volumeWhenReady, this.seekWhenReady); + if (this.pauseWhenReady) + a.pause(); + audioInstances.push(a); + } + else if (!cr.is_undefined(this.convolveWhenReady)) + { + var convolveNode = this.convolveWhenReady.convolveNode; + convolveNode["normalize"] = this.normalizeWhenReady; + convolveNode["buffer"] = this.bufferObject; + } + } + }; + C2AudioBuffer.prototype.isLoaded = function () + { + switch (this.myapi) { + case API_HTML5: + var ret = this.bufferObject["readyState"] >= 4; // HAVE_ENOUGH_DATA + if (ret) + this.wasEverReady = true; + return ret || this.wasEverReady; + case API_WEBAUDIO: + return !!this.audioData || !!this.bufferObject; + case API_CORDOVA: + return true; + case API_APPMOBI: + return true; + } + return false; + }; + C2AudioBuffer.prototype.isLoadedAndDecoded = function () + { + switch (this.myapi) { + case API_HTML5: + return this.isLoaded(); // no distinction between loaded and decoded in HTML5 audio, just rely on ready state + case API_WEBAUDIO: + return !!this.bufferObject; + case API_CORDOVA: + return true; + case API_APPMOBI: + return true; + } + return false; + }; + C2AudioBuffer.prototype.hasFailedToLoad = function () + { + switch (this.myapi) { + case API_HTML5: + return !!this.bufferObject["error"]; + case API_WEBAUDIO: + return this.failedToLoad; + } + return false; + }; + function C2AudioInstance(buffer_, tag_) + { + var self = this; + this.tag = tag_; + this.fresh = true; + this.stopped = true; + this.src = buffer_.src; + this.buffer = buffer_; + this.myapi = api; + this.is_music = buffer_.is_music; + this.playbackRate = 1; + this.hasPlaybackEnded = true; // ended flag + this.resume_me = false; // make sure resumes when leaving suspend + this.is_paused = false; + this.resume_position = 0; // for web audio api to resume from correct playback position + this.looping = false; + this.is_muted = false; + this.is_silent = false; + this.volume = 1; + this.onended_handler = function (e) + { + if (self.is_paused || self.resume_me) + return; + var bufferThatEnded = this; + if (!bufferThatEnded) + bufferThatEnded = e.target; + if (bufferThatEnded !== self.active_buffer) + return; + self.hasPlaybackEnded = true; + self.stopped = true; + audTag = self.tag; + audRuntime.trigger(cr.plugins_.Audio.prototype.cnds.OnEnded, audInst); + }; + this.active_buffer = null; + this.isTimescaled = ((timescale_mode === 1 && !this.is_music) || timescale_mode === 2); + this.mutevol = 1; + this.startTime = (this.isTimescaled ? audRuntime.kahanTime.sum : audRuntime.wallTime.sum); + this.gainNode = null; + this.pannerNode = null; + this.pannerEnabled = false; + this.objectTracker = null; + this.panX = 0; + this.panY = 0; + this.panAngle = 0; + this.panConeInner = 0; + this.panConeOuter = 0; + this.panConeOuterGain = 0; + this.instanceObject = null; + var add_end_listener = false; + if (this.myapi === API_WEBAUDIO && this.buffer.myapi === API_HTML5 && !this.buffer.supportWebAudioAPI) + this.myapi = API_HTML5; + switch (this.myapi) { + case API_HTML5: + if (this.is_music) + { + this.instanceObject = buffer_.bufferObject; + add_end_listener = !buffer_.added_end_listener; + buffer_.added_end_listener = true; + } + else + { + this.instanceObject = new Audio(); + this.instanceObject.crossOrigin = "anonymous"; + this.instanceObject.autoplay = false; + this.instanceObject.src = buffer_.bufferObject.src; + add_end_listener = true; + } + if (add_end_listener) + { + this.instanceObject.addEventListener('ended', function () { + audTag = self.tag; + self.stopped = true; + audRuntime.trigger(cr.plugins_.Audio.prototype.cnds.OnEnded, audInst); + }); + } + break; + case API_WEBAUDIO: + this.gainNode = createGain(); + this.gainNode["connect"](getDestinationForTag(tag_)); + if (this.buffer.myapi === API_WEBAUDIO) + { + if (buffer_.bufferObject) + { + this.instanceObject = context["createBufferSource"](); + this.instanceObject["buffer"] = buffer_.bufferObject; + this.instanceObject["connect"](this.gainNode); + } + } + else + { + this.instanceObject = this.buffer.bufferObject; // reference the audio element + this.buffer.outNode["connect"](this.gainNode); + if (!this.buffer.added_end_listener) + { + this.buffer.added_end_listener = true; + this.buffer.bufferObject.addEventListener('ended', function () { + audTag = self.tag; + self.stopped = true; + audRuntime.trigger(cr.plugins_.Audio.prototype.cnds.OnEnded, audInst); + }); + } + } + break; + case API_CORDOVA: + this.instanceObject = new window["Media"](appPath + this.src, null, null, function (status) { + if (status === window["Media"]["MEDIA_STOPPED"]) + { + self.hasPlaybackEnded = true; + self.stopped = true; + audTag = self.tag; + audRuntime.trigger(cr.plugins_.Audio.prototype.cnds.OnEnded, audInst); + } + }); + break; + case API_APPMOBI: + this.instanceObject = true; + break; + } + }; + C2AudioInstance.prototype.hasEnded = function () + { + var time; + switch (this.myapi) { + case API_HTML5: + return this.instanceObject.ended; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + if (!this.fresh && !this.stopped && this.instanceObject["loop"]) + return false; + if (this.is_paused) + return false; + return this.hasPlaybackEnded; + } + else + return this.instanceObject.ended; + case API_CORDOVA: + return this.hasPlaybackEnded; + case API_APPMOBI: + true; // recycling an AppMobi sound does not matter because it will just do another throwaway playSound + } + return true; + }; + C2AudioInstance.prototype.canBeRecycled = function () + { + if (this.fresh || this.stopped) + return true; // not yet used or is not playing + return this.hasEnded(); + }; + C2AudioInstance.prototype.setPannerEnabled = function (enable_) + { + if (api !== API_WEBAUDIO) + return; + if (!this.pannerEnabled && enable_) + { + if (!this.gainNode) + return; + if (!this.pannerNode) + { + this.pannerNode = context["createPanner"](); + if (typeof this.pannerNode["panningModel"] === "number") + this.pannerNode["panningModel"] = panningModel; + else + this.pannerNode["panningModel"] = ["equalpower", "HRTF", "soundfield"][panningModel]; + if (typeof this.pannerNode["distanceModel"] === "number") + this.pannerNode["distanceModel"] = distanceModel; + else + this.pannerNode["distanceModel"] = ["linear", "inverse", "exponential"][distanceModel]; + this.pannerNode["refDistance"] = refDistance; + this.pannerNode["maxDistance"] = maxDistance; + this.pannerNode["rolloffFactor"] = rolloffFactor; + } + this.gainNode["disconnect"](); + this.gainNode["connect"](this.pannerNode); + this.pannerNode["connect"](getDestinationForTag(this.tag)); + this.pannerEnabled = true; + } + else if (this.pannerEnabled && !enable_) + { + if (!this.gainNode) + return; + this.pannerNode["disconnect"](); + this.gainNode["disconnect"](); + this.gainNode["connect"](getDestinationForTag(this.tag)); + this.pannerEnabled = false; + } + }; + C2AudioInstance.prototype.setPan = function (x, y, angle, innerangle, outerangle, outergain) + { + if (!this.pannerEnabled || api !== API_WEBAUDIO) + return; + this.pannerNode["setPosition"](x, y, 0); + this.pannerNode["setOrientation"](Math.cos(cr.to_radians(angle)), Math.sin(cr.to_radians(angle)), 0); + this.pannerNode["coneInnerAngle"] = innerangle; + this.pannerNode["coneOuterAngle"] = outerangle; + this.pannerNode["coneOuterGain"] = outergain; + this.panX = x; + this.panY = y; + this.panAngle = angle; + this.panConeInner = innerangle; + this.panConeOuter = outerangle; + this.panConeOuterGain = outergain; + }; + C2AudioInstance.prototype.setObject = function (o) + { + if (!this.pannerEnabled || api !== API_WEBAUDIO) + return; + if (!this.objectTracker) + this.objectTracker = new ObjectTracker(); + this.objectTracker.setObject(o); + }; + C2AudioInstance.prototype.tick = function (dt) + { + if (!this.pannerEnabled || api !== API_WEBAUDIO || !this.objectTracker || !this.objectTracker.hasObject() || !this.isPlaying()) + { + return; + } + this.objectTracker.tick(dt); + var inst = this.objectTracker.obj; + var px = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, true); + var py = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, false); + this.pannerNode["setPosition"](px, py, 0); + var a = 0; + if (typeof this.objectTracker.obj.angle !== "undefined") + { + a = inst.angle - inst.layer.getAngle(); + this.pannerNode["setOrientation"](Math.cos(a), Math.sin(a), 0); + } + }; + C2AudioInstance.prototype.play = function (looping, vol, fromPosition, scheduledTime) + { + var instobj = this.instanceObject; + this.looping = looping; + this.volume = vol; + var seekPos = fromPosition || 0; + scheduledTime = scheduledTime || 0; + switch (this.myapi) { + case API_HTML5: + if (instobj.playbackRate !== 1.0) + instobj.playbackRate = 1.0; + if (instobj.volume !== vol * masterVolume) + instobj.volume = vol * masterVolume; + if (instobj.loop !== looping) + instobj.loop = looping; + if (instobj.muted) + instobj.muted = false; + if (instobj.currentTime !== seekPos) + { + try { + instobj.currentTime = seekPos; + } + catch (err) + { +; + } + } + if (this.is_music && isMusicWorkaround && !audRuntime.isInUserInputEvent) + musicPlayNextTouch.push(this); + else + { + try { + this.instanceObject.play(); + } + catch (e) { // sometimes throws on WP8.1... try not to kill the app + if (console && console.log) + console.log("[C2] WARNING: exception trying to play audio '" + this.buffer.src + "': ", e); + } + } + break; + case API_WEBAUDIO: + this.muted = false; + this.mutevol = 1; + if (this.buffer.myapi === API_WEBAUDIO) + { + this.gainNode["gain"]["value"] = vol * masterVolume; + if (!this.fresh) + { + this.instanceObject = context["createBufferSource"](); + this.instanceObject["buffer"] = this.buffer.bufferObject; + this.instanceObject["connect"](this.gainNode); + } + this.instanceObject["onended"] = this.onended_handler; + this.active_buffer = this.instanceObject; + this.instanceObject.loop = looping; + this.hasPlaybackEnded = false; + if (seekPos === 0) + startSource(this.instanceObject, scheduledTime); + else + startSourceAt(this.instanceObject, seekPos, this.getDuration(), scheduledTime); + } + else + { + if (instobj.playbackRate !== 1.0) + instobj.playbackRate = 1.0; + if (instobj.loop !== looping) + instobj.loop = looping; + instobj.volume = vol * masterVolume; + if (instobj.currentTime !== seekPos) + { + try { + instobj.currentTime = seekPos; + } + catch (err) + { +; + } + } + if (this.is_music && isMusicWorkaround && !audRuntime.isInUserInputEvent) + musicPlayNextTouch.push(this); + else + instobj.play(); + } + break; + case API_CORDOVA: + if ((!this.fresh && this.stopped) || seekPos !== 0) + instobj["seekTo"](seekPos); + instobj["play"](); + this.hasPlaybackEnded = false; + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["playSound"](this.src, looping); + else + AppMobi["player"]["playSound"](this.src, looping); + break; + } + this.playbackRate = 1; + this.startTime = (this.isTimescaled ? audRuntime.kahanTime.sum : audRuntime.wallTime.sum) - seekPos; + this.fresh = false; + this.stopped = false; + this.is_paused = false; + }; + C2AudioInstance.prototype.stop = function () + { + switch (this.myapi) { + case API_HTML5: + if (!this.instanceObject.paused) + this.instanceObject.pause(); + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + stopSource(this.instanceObject); + else + { + if (!this.instanceObject.paused) + this.instanceObject.pause(); + } + break; + case API_CORDOVA: + this.instanceObject["stop"](); + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["stopSound"](this.src); + break; + } + this.stopped = true; + this.is_paused = false; + }; + C2AudioInstance.prototype.pause = function () + { + if (this.fresh || this.stopped || this.hasEnded() || this.is_paused) + return; + switch (this.myapi) { + case API_HTML5: + if (!this.instanceObject.paused) + this.instanceObject.pause(); + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + this.resume_position = this.getPlaybackTime(true); + if (this.looping) + this.resume_position = this.resume_position % this.getDuration(); + this.is_paused = true; + stopSource(this.instanceObject); + } + else + { + if (!this.instanceObject.paused) + this.instanceObject.pause(); + } + break; + case API_CORDOVA: + this.instanceObject["pause"](); + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["stopSound"](this.src); + break; + } + this.is_paused = true; + }; + C2AudioInstance.prototype.resume = function () + { + if (this.fresh || this.stopped || this.hasEnded() || !this.is_paused) + return; + switch (this.myapi) { + case API_HTML5: + this.instanceObject.play(); + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + this.instanceObject = context["createBufferSource"](); + this.instanceObject["buffer"] = this.buffer.bufferObject; + this.instanceObject["connect"](this.gainNode); + this.instanceObject["onended"] = this.onended_handler; + this.active_buffer = this.instanceObject; + this.instanceObject.loop = this.looping; + this.gainNode["gain"]["value"] = masterVolume * this.volume * this.mutevol; + this.updatePlaybackRate(); + this.startTime = (this.isTimescaled ? audRuntime.kahanTime.sum : audRuntime.wallTime.sum) - (this.resume_position / (this.playbackRate || 0.001)); + startSourceAt(this.instanceObject, this.resume_position, this.getDuration()); + } + else + { + this.instanceObject.play(); + } + break; + case API_CORDOVA: + this.instanceObject["play"](); + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["resumeSound"](this.src); + break; + } + this.is_paused = false; + }; + C2AudioInstance.prototype.seek = function (pos) + { + if (this.fresh || this.stopped || this.hasEnded()) + return; + switch (this.myapi) { + case API_HTML5: + try { + this.instanceObject.currentTime = pos; + } + catch (e) {} + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + if (this.is_paused) + this.resume_position = pos; + else + { + this.pause(); + this.resume_position = pos; + this.resume(); + } + } + else + { + try { + this.instanceObject.currentTime = pos; + } + catch (e) {} + } + break; + case API_CORDOVA: + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["seekSound"](this.src, pos); + break; + } + }; + C2AudioInstance.prototype.reconnect = function (toNode) + { + if (this.myapi !== API_WEBAUDIO) + return; + if (this.pannerEnabled) + { + this.pannerNode["disconnect"](); + this.pannerNode["connect"](toNode); + } + else + { + this.gainNode["disconnect"](); + this.gainNode["connect"](toNode); + } + }; + C2AudioInstance.prototype.getDuration = function (applyPlaybackRate) + { + var ret = 0; + switch (this.myapi) { + case API_HTML5: + if (typeof this.instanceObject.duration !== "undefined") + ret = this.instanceObject.duration; + break; + case API_WEBAUDIO: + ret = this.buffer.bufferObject["duration"]; + break; + case API_CORDOVA: + ret = this.instanceObject["getDuration"](); + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + ret = AppMobi["context"]["getDurationSound"](this.src); + break; + } + if (applyPlaybackRate) + ret /= (this.playbackRate || 0.001); // avoid divide-by-zero + return ret; + }; + C2AudioInstance.prototype.getPlaybackTime = function (applyPlaybackRate) + { + var duration = this.getDuration(); + var ret = 0; + switch (this.myapi) { + case API_HTML5: + if (typeof this.instanceObject.currentTime !== "undefined") + ret = this.instanceObject.currentTime; + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + if (this.is_paused) + return this.resume_position; + else + ret = (this.isTimescaled ? audRuntime.kahanTime.sum : audRuntime.wallTime.sum) - this.startTime; + } + else if (typeof this.instanceObject.currentTime !== "undefined") + ret = this.instanceObject.currentTime; + break; + case API_CORDOVA: + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + ret = AppMobi["context"]["getPlaybackTimeSound"](this.src); + break; + } + if (applyPlaybackRate) + ret *= this.playbackRate; + if (!this.looping && ret > duration) + ret = duration; + return ret; + }; + C2AudioInstance.prototype.isPlaying = function () + { + return !this.is_paused && !this.fresh && !this.stopped && !this.hasEnded(); + }; + C2AudioInstance.prototype.shouldSave = function () + { + return !this.fresh && !this.stopped && !this.hasEnded(); + }; + C2AudioInstance.prototype.setVolume = function (v) + { + this.volume = v; + this.updateVolume(); + }; + C2AudioInstance.prototype.updateVolume = function () + { + var volToSet = this.volume * masterVolume; + if (!isFinite(volToSet)) + volToSet = 0; // HTMLMediaElement throws if setting non-finite volume + switch (this.myapi) { + case API_HTML5: + if (typeof this.instanceObject.volume !== "undefined" && this.instanceObject.volume !== volToSet) + this.instanceObject.volume = volToSet; + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + this.gainNode["gain"]["value"] = volToSet * this.mutevol; + } + else + { + if (typeof this.instanceObject.volume !== "undefined" && this.instanceObject.volume !== volToSet) + this.instanceObject.volume = volToSet; + } + break; + case API_CORDOVA: + break; + case API_APPMOBI: + break; + } + }; + C2AudioInstance.prototype.getVolume = function () + { + return this.volume; + }; + C2AudioInstance.prototype.doSetMuted = function (m) + { + switch (this.myapi) { + case API_HTML5: + if (this.instanceObject.muted !== !!m) + this.instanceObject.muted = !!m; + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + this.mutevol = (m ? 0 : 1); + this.gainNode["gain"]["value"] = masterVolume * this.volume * this.mutevol; + } + else + { + if (this.instanceObject.muted !== !!m) + this.instanceObject.muted = !!m; + } + break; + case API_CORDOVA: + break; + case API_APPMOBI: + break; + } + }; + C2AudioInstance.prototype.setMuted = function (m) + { + this.is_muted = !!m; + this.doSetMuted(this.is_muted || this.is_silent); + }; + C2AudioInstance.prototype.setSilent = function (m) + { + this.is_silent = !!m; + this.doSetMuted(this.is_muted || this.is_silent); + }; + C2AudioInstance.prototype.setLooping = function (l) + { + this.looping = l; + switch (this.myapi) { + case API_HTML5: + if (this.instanceObject.loop !== !!l) + this.instanceObject.loop = !!l; + break; + case API_WEBAUDIO: + if (this.instanceObject.loop !== !!l) + this.instanceObject.loop = !!l; + break; + case API_CORDOVA: + break; + case API_APPMOBI: + if (audRuntime.isDirectCanvas) + AppMobi["context"]["setLoopingSound"](this.src, l); + break; + } + }; + C2AudioInstance.prototype.setPlaybackRate = function (r) + { + this.playbackRate = r; + this.updatePlaybackRate(); + }; + C2AudioInstance.prototype.updatePlaybackRate = function () + { + var r = this.playbackRate; + if (this.isTimescaled) + r *= audRuntime.timescale; + switch (this.myapi) { + case API_HTML5: + if (this.instanceObject.playbackRate !== r) + this.instanceObject.playbackRate = r; + break; + case API_WEBAUDIO: + if (this.buffer.myapi === API_WEBAUDIO) + { + if (this.instanceObject["playbackRate"]["value"] !== r) + this.instanceObject["playbackRate"]["value"] = r; + } + else + { + if (this.instanceObject.playbackRate !== r) + this.instanceObject.playbackRate = r; + } + break; + case API_CORDOVA: + break; + case API_APPMOBI: + break; + } + }; + C2AudioInstance.prototype.setSuspended = function (s) + { + switch (this.myapi) { + case API_HTML5: + if (s) + { + if (this.isPlaying()) + { + this.resume_me = true; + this.instanceObject["pause"](); + } + else + this.resume_me = false; + } + else + { + if (this.resume_me) + { + this.instanceObject["play"](); + this.resume_me = false; + } + } + break; + case API_WEBAUDIO: + if (s) + { + if (this.isPlaying()) + { + this.resume_me = true; + if (this.buffer.myapi === API_WEBAUDIO) + { + this.resume_position = this.getPlaybackTime(true); + if (this.looping) + this.resume_position = this.resume_position % this.getDuration(); + stopSource(this.instanceObject); + } + else + this.instanceObject["pause"](); + } + else + this.resume_me = false; + } + else + { + if (this.resume_me) + { + if (this.buffer.myapi === API_WEBAUDIO) + { + this.instanceObject = context["createBufferSource"](); + this.instanceObject["buffer"] = this.buffer.bufferObject; + this.instanceObject["connect"](this.gainNode); + this.instanceObject["onended"] = this.onended_handler; + this.active_buffer = this.instanceObject; + this.instanceObject.loop = this.looping; + this.gainNode["gain"]["value"] = masterVolume * this.volume * this.mutevol; + this.updatePlaybackRate(); + this.startTime = (this.isTimescaled ? audRuntime.kahanTime.sum : audRuntime.wallTime.sum) - (this.resume_position / (this.playbackRate || 0.001)); + startSourceAt(this.instanceObject, this.resume_position, this.getDuration()); + } + else + { + this.instanceObject["play"](); + } + this.resume_me = false; + } + } + break; + case API_CORDOVA: + if (s) + { + if (this.isPlaying()) + { + this.instanceObject["pause"](); + this.resume_me = true; + } + else + this.resume_me = false; + } + else + { + if (this.resume_me) + { + this.resume_me = false; + this.instanceObject["play"](); + } + } + break; + case API_APPMOBI: + break; + } + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + audRuntime = this.runtime; + audInst = this; + this.listenerTracker = null; + this.listenerZ = -600; + if (this.runtime.isWKWebView) + playMusicAsSoundWorkaround = true; + if ((this.runtime.isiOS || (this.runtime.isAndroid && (this.runtime.isChrome || this.runtime.isAndroidStockBrowser))) && !this.runtime.isCrosswalk && !this.runtime.isDomFree && !this.runtime.isAmazonWebApp && !playMusicAsSoundWorkaround) + { + isMusicWorkaround = true; + } + context = null; + if (typeof AudioContext !== "undefined") + { + api = API_WEBAUDIO; + context = new AudioContext(); + } + else if (typeof webkitAudioContext !== "undefined") + { + api = API_WEBAUDIO; + context = new webkitAudioContext(); + } + if (this.runtime.isiOS && context) + { + if (context.close) + context.close(); + if (typeof AudioContext !== "undefined") + context = new AudioContext(); + else if (typeof webkitAudioContext !== "undefined") + context = new webkitAudioContext(); + } + var isAndroid = this.runtime.isAndroid; + var playDummyBuffer = function () + { + if (isContextSuspended || !context["createBuffer"]) + return; + var buffer = context["createBuffer"](1, 220, 22050); + var source = context["createBufferSource"](); + source["buffer"] = buffer; + source["connect"](context["destination"]); + startSource(source); + }; + if (isMusicWorkaround) + { + var playQueuedMusic = function () + { + var i, len, m; + if (isMusicWorkaround) + { + if (!silent) + { + for (i = 0, len = musicPlayNextTouch.length; i < len; ++i) + { + m = musicPlayNextTouch[i]; + if (!m.stopped && !m.is_paused) + m.instanceObject.play(); + } + } + cr.clearArray(musicPlayNextTouch); + } + }; + document.addEventListener("touchend", function () + { + if (!iOShadtouchend && context) + { + playDummyBuffer(); + iOShadtouchend = true; + } + playQueuedMusic(); + }, true); + } + else if (playMusicAsSoundWorkaround) + { + document.addEventListener("touchend", function () + { + if (!iOShadtouchend && context) + { + playDummyBuffer(); + iOShadtouchend = true; + } + }, true); + } + if (api !== API_WEBAUDIO) + { + if (this.runtime.isCordova && typeof window["Media"] !== "undefined") + api = API_CORDOVA; + else if (this.runtime.isAppMobi) + api = API_APPMOBI; + } + if (api === API_CORDOVA) + { + appPath = location.href; + var i = appPath.lastIndexOf("/"); + if (i > -1) + appPath = appPath.substr(0, i + 1); + appPath = appPath.replace("file://", ""); + } + if (this.runtime.isSafari && this.runtime.isWindows && typeof Audio === "undefined") + { + alert("It looks like you're using Safari for Windows without Quicktime. Audio cannot be played until Quicktime is installed."); + this.runtime.DestroyInstance(this); + } + else + { + if (this.runtime.isDirectCanvas) + useOgg = this.runtime.isAndroid; // AAC on iOS, OGG on Android + else + { + try { + useOgg = !!(new Audio().canPlayType('audio/ogg; codecs="vorbis"')); + } + catch (e) + { + useOgg = false; + } + } + switch (api) { + case API_HTML5: +; + break; + case API_WEBAUDIO: +; + break; + case API_CORDOVA: +; + break; + case API_APPMOBI: +; + break; + default: +; + } + this.runtime.tickMe(this); + } + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function () + { + this.runtime.audioInstance = this; + timescale_mode = this.properties[0]; // 0 = off, 1 = sounds only, 2 = all + this.saveload = this.properties[1]; // 0 = all, 1 = sounds only, 2 = music only, 3 = none + this.playinbackground = (this.properties[2] !== 0); + this.nextPlayTime = 0; + panningModel = this.properties[3]; // 0 = equalpower, 1 = hrtf, 3 = soundfield + distanceModel = this.properties[4]; // 0 = linear, 1 = inverse, 2 = exponential + this.listenerZ = -this.properties[5]; + refDistance = this.properties[6]; + maxDistance = this.properties[7]; + rolloffFactor = this.properties[8]; + this.listenerTracker = new ObjectTracker(); + var draw_width = (this.runtime.draw_width || this.runtime.width); + var draw_height = (this.runtime.draw_height || this.runtime.height); + if (api === API_WEBAUDIO) + { + context["listener"]["setPosition"](draw_width / 2, draw_height / 2, this.listenerZ); + context["listener"]["setOrientation"](0, 0, 1, 0, -1, 0); + window["c2OnAudioMicStream"] = function (localMediaStream, tag) + { + if (micSource) + micSource["disconnect"](); + micTag = tag.toLowerCase(); + micSource = context["createMediaStreamSource"](localMediaStream); + micSource["connect"](getDestinationForTag(micTag)); + }; + } + this.runtime.addSuspendCallback(function(s) + { + audInst.onSuspend(s); + }); + var self = this; + this.runtime.addDestroyCallback(function (inst) + { + self.onInstanceDestroyed(inst); + }); + }; + instanceProto.onInstanceDestroyed = function (inst) + { + var i, len, a; + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + if (a.objectTracker) + { + if (a.objectTracker.obj === inst) + { + a.objectTracker.obj = null; + if (a.pannerEnabled && a.isPlaying() && a.looping) + a.stop(); + } + } + } + if (this.listenerTracker.obj === inst) + this.listenerTracker.obj = null; + }; + instanceProto.saveToJSON = function () + { + var o = { + "silent": silent, + "masterVolume": masterVolume, + "listenerZ": this.listenerZ, + "listenerUid": this.listenerTracker.hasObject() ? this.listenerTracker.obj.uid : -1, + "playing": [], + "effects": {} + }; + var playingarr = o["playing"]; + var i, len, a, d, p, panobj, playbackTime; + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + if (!a.shouldSave()) + continue; // no need to save stopped sounds + if (this.saveload === 3) // not saving/loading any sounds/music + continue; + if (a.is_music && this.saveload === 1) // not saving/loading music + continue; + if (!a.is_music && this.saveload === 2) // not saving/loading sound + continue; + playbackTime = a.getPlaybackTime(); + if (a.looping) + playbackTime = playbackTime % a.getDuration(); + d = { + "tag": a.tag, + "buffersrc": a.buffer.src, + "is_music": a.is_music, + "playbackTime": playbackTime, + "volume": a.volume, + "looping": a.looping, + "muted": a.is_muted, + "playbackRate": a.playbackRate, + "paused": a.is_paused, + "resume_position": a.resume_position + }; + if (a.pannerEnabled) + { + d["pan"] = {}; + panobj = d["pan"]; + if (a.objectTracker && a.objectTracker.hasObject()) + { + panobj["objUid"] = a.objectTracker.obj.uid; + } + else + { + panobj["x"] = a.panX; + panobj["y"] = a.panY; + panobj["a"] = a.panAngle; + } + panobj["ia"] = a.panConeInner; + panobj["oa"] = a.panConeOuter; + panobj["og"] = a.panConeOuterGain; + } + playingarr.push(d); + } + var fxobj = o["effects"]; + var fxarr; + for (p in effects) + { + if (effects.hasOwnProperty(p)) + { + fxarr = []; + for (i = 0, len = effects[p].length; i < len; i++) + { + fxarr.push({ "type": effects[p][i].type, "params": effects[p][i].params }); + } + fxobj[p] = fxarr; + } + } + return o; + }; + var objectTrackerUidsToLoad = []; + instanceProto.loadFromJSON = function (o) + { + var setSilent = o["silent"]; + masterVolume = o["masterVolume"]; + this.listenerZ = o["listenerZ"]; + this.listenerTracker.setObject(null); + var listenerUid = o["listenerUid"]; + if (listenerUid !== -1) + { + this.listenerTracker.loadUid = listenerUid; + objectTrackerUidsToLoad.push(this.listenerTracker); + } + var playingarr = o["playing"]; + var i, len, d, src, is_music, tag, playbackTime, looping, vol, b, a, p, pan, panObjUid; + if (this.saveload !== 3) + { + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + if (a.is_music && this.saveload === 1) + continue; // only saving/loading sound: leave music playing + if (!a.is_music && this.saveload === 2) + continue; // only saving/loading music: leave sound playing + a.stop(); + } + } + var fxarr, fxtype, fxparams, fx; + for (p in effects) + { + if (effects.hasOwnProperty(p)) + { + for (i = 0, len = effects[p].length; i < len; i++) + effects[p][i].remove(); + } + } + cr.wipe(effects); + for (p in o["effects"]) + { + if (o["effects"].hasOwnProperty(p)) + { + fxarr = o["effects"][p]; + for (i = 0, len = fxarr.length; i < len; i++) + { + fxtype = fxarr[i]["type"]; + fxparams = fxarr[i]["params"]; + switch (fxtype) { + case "filter": + addEffectForTag(p, new FilterEffect(fxparams[0], fxparams[1], fxparams[2], fxparams[3], fxparams[4], fxparams[5])); + break; + case "delay": + addEffectForTag(p, new DelayEffect(fxparams[0], fxparams[1], fxparams[2])); + break; + case "convolve": + src = fxparams[2]; + b = this.getAudioBuffer(src, false); + if (b.bufferObject) + { + fx = new ConvolveEffect(b.bufferObject, fxparams[0], fxparams[1], src); + } + else + { + fx = new ConvolveEffect(null, fxparams[0], fxparams[1], src); + b.normalizeWhenReady = fxparams[0]; + b.convolveWhenReady = fx; + } + addEffectForTag(p, fx); + break; + case "flanger": + addEffectForTag(p, new FlangerEffect(fxparams[0], fxparams[1], fxparams[2], fxparams[3], fxparams[4])); + break; + case "phaser": + addEffectForTag(p, new PhaserEffect(fxparams[0], fxparams[1], fxparams[2], fxparams[3], fxparams[4], fxparams[5])); + break; + case "gain": + addEffectForTag(p, new GainEffect(fxparams[0])); + break; + case "tremolo": + addEffectForTag(p, new TremoloEffect(fxparams[0], fxparams[1])); + break; + case "ringmod": + addEffectForTag(p, new RingModulatorEffect(fxparams[0], fxparams[1])); + break; + case "distortion": + addEffectForTag(p, new DistortionEffect(fxparams[0], fxparams[1], fxparams[2], fxparams[3], fxparams[4])); + break; + case "compressor": + addEffectForTag(p, new CompressorEffect(fxparams[0], fxparams[1], fxparams[2], fxparams[3], fxparams[4])); + break; + case "analyser": + addEffectForTag(p, new AnalyserEffect(fxparams[0], fxparams[1])); + break; + } + } + } + } + for (i = 0, len = playingarr.length; i < len; i++) + { + if (this.saveload === 3) // not saving/loading any sounds/music + continue; + d = playingarr[i]; + src = d["buffersrc"]; + is_music = d["is_music"]; + tag = d["tag"]; + playbackTime = d["playbackTime"]; + looping = d["looping"]; + vol = d["volume"]; + pan = d["pan"]; + panObjUid = (pan && pan.hasOwnProperty("objUid")) ? pan["objUid"] : -1; + if (is_music && this.saveload === 1) // not saving/loading music + continue; + if (!is_music && this.saveload === 2) // not saving/loading sound + continue; + a = this.getAudioInstance(src, tag, is_music, looping, vol); + if (!a) + { + b = this.getAudioBuffer(src, is_music); + b.seekWhenReady = playbackTime; + b.pauseWhenReady = d["paused"]; + if (pan) + { + if (panObjUid !== -1) + { + b.panWhenReady.push({ objUid: panObjUid, ia: pan["ia"], oa: pan["oa"], og: pan["og"], thistag: tag }); + } + else + { + b.panWhenReady.push({ x: pan["x"], y: pan["y"], a: pan["a"], ia: pan["ia"], oa: pan["oa"], og: pan["og"], thistag: tag }); + } + } + continue; + } + a.resume_position = d["resume_position"]; + a.setPannerEnabled(!!pan); + a.play(looping, vol, playbackTime); + a.updatePlaybackRate(); + a.updateVolume(); + a.doSetMuted(a.is_muted || a.is_silent); + if (d["paused"]) + a.pause(); + if (d["muted"]) + a.setMuted(true); + a.doSetMuted(a.is_muted || a.is_silent); + if (pan) + { + if (panObjUid !== -1) + { + a.objectTracker = a.objectTracker || new ObjectTracker(); + a.objectTracker.loadUid = panObjUid; + objectTrackerUidsToLoad.push(a.objectTracker); + } + else + { + a.setPan(pan["x"], pan["y"], pan["a"], pan["ia"], pan["oa"], pan["og"]); + } + } + } + if (setSilent && !silent) // setting silent + { + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].setSilent(true); + silent = true; + } + else if (!setSilent && silent) // setting not silent + { + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].setSilent(false); + silent = false; + } + }; + instanceProto.afterLoad = function () + { + var i, len, ot, inst; + for (i = 0, len = objectTrackerUidsToLoad.length; i < len; i++) + { + ot = objectTrackerUidsToLoad[i]; + inst = this.runtime.getObjectByUID(ot.loadUid); + ot.setObject(inst); + ot.loadUid = -1; + if (inst) + { + listenerX = inst.x; + listenerY = inst.y; + } + } + cr.clearArray(objectTrackerUidsToLoad); + }; + instanceProto.onSuspend = function (s) + { + if (this.playinbackground) + return; + if (!s && context && context["resume"]) + { + context["resume"](); + isContextSuspended = false; + } + var i, len; + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].setSuspended(s); + if (s && context && context["suspend"]) + { + context["suspend"](); + isContextSuspended = true; + } + }; + instanceProto.tick = function () + { + var dt = this.runtime.dt; + var i, len, a; + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + a.tick(dt); + if (timescale_mode !== 0) + a.updatePlaybackRate(); + } + var p, arr, f; + for (p in effects) + { + if (effects.hasOwnProperty(p)) + { + arr = effects[p]; + for (i = 0, len = arr.length; i < len; i++) + { + f = arr[i]; + if (f.tick) + f.tick(); + } + } + } + if (api === API_WEBAUDIO && this.listenerTracker.hasObject()) + { + this.listenerTracker.tick(dt); + listenerX = this.listenerTracker.obj.x; + listenerY = this.listenerTracker.obj.y; + context["listener"]["setPosition"](this.listenerTracker.obj.x, this.listenerTracker.obj.y, this.listenerZ); + } + }; + var preload_list = []; + instanceProto.setPreloadList = function (arr) + { + var i, len, p, filename, size, isOgg; + var total_size = 0; + for (i = 0, len = arr.length; i < len; ++i) + { + p = arr[i]; + filename = p[0]; + size = p[1] * 2; + isOgg = (filename.length > 4 && filename.substr(filename.length - 4) === ".ogg"); + if ((isOgg && useOgg) || (!isOgg && !useOgg)) + { + preload_list.push({ + filename: filename, + size: size, + obj: null + }); + total_size += size; + } + } + return total_size; + }; + instanceProto.startPreloads = function () + { + var i, len, p, src; + for (i = 0, len = preload_list.length; i < len; ++i) + { + p = preload_list[i]; + src = this.runtime.files_subfolder + p.filename; + p.obj = this.getAudioBuffer(src, false); + } + }; + instanceProto.getPreloadedSize = function () + { + var completed = 0; + var i, len, p; + for (i = 0, len = preload_list.length; i < len; ++i) + { + p = preload_list[i]; + if (p.obj.isLoadedAndDecoded() || p.obj.hasFailedToLoad() || this.runtime.isDomFree || this.runtime.isAndroidStockBrowser) + { + completed += p.size; + } + else if (p.obj.isLoaded()) // downloaded but not decoded: only happens in Web Audio API, count as half-way progress + { + completed += Math.floor(p.size / 2); + } + }; + return completed; + }; + instanceProto.releaseAllMusicBuffers = function () + { + var i, len, j, b; + for (i = 0, j = 0, len = audioBuffers.length; i < len; ++i) + { + b = audioBuffers[i]; + audioBuffers[j] = b; + if (b.is_music) + b.release(); + else + ++j; // keep + } + audioBuffers.length = j; + }; + instanceProto.getAudioBuffer = function (src_, is_music, dont_create) + { + var i, len, a, ret = null, j, k, lenj, ai; + for (i = 0, len = audioBuffers.length; i < len; i++) + { + a = audioBuffers[i]; + if (a.src === src_) + { + ret = a; + break; + } + } + if (!ret && !dont_create) + { + if (playMusicAsSoundWorkaround && is_music) + this.releaseAllMusicBuffers(); + ret = new C2AudioBuffer(src_, is_music); + audioBuffers.push(ret); + } + return ret; + }; + instanceProto.getAudioInstance = function (src_, tag, is_music, looping, vol) + { + var i, len, a; + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + if (a.src === src_ && (a.canBeRecycled() || is_music)) + { + a.tag = tag; + return a; + } + } + var b = this.getAudioBuffer(src_, is_music); + if (!b.bufferObject) + { + if (tag !== "") + { + b.playTagWhenReady = tag; + b.loopWhenReady = looping; + b.volumeWhenReady = vol; + } + return null; + } + a = new C2AudioInstance(b, tag); + audioInstances.push(a); + return a; + }; + var taggedAudio = []; + function SortByIsPlaying(a, b) + { + var an = a.isPlaying() ? 1 : 0; + var bn = b.isPlaying() ? 1 : 0; + if (an === bn) + return 0; + else if (an < bn) + return 1; + else + return -1; + }; + function getAudioByTag(tag, sort_by_playing) + { + cr.clearArray(taggedAudio); + if (!tag.length) + { + if (!lastAudio || lastAudio.hasEnded()) + return; + else + { + cr.clearArray(taggedAudio); + taggedAudio[0] = lastAudio; + return; + } + } + var i, len, a; + for (i = 0, len = audioInstances.length; i < len; i++) + { + a = audioInstances[i]; + if (cr.equals_nocase(tag, a.tag)) + taggedAudio.push(a); + } + if (sort_by_playing) + taggedAudio.sort(SortByIsPlaying); + }; + function reconnectEffects(tag) + { + var i, len, arr, n, toNode = context["destination"]; + if (effects.hasOwnProperty(tag)) + { + arr = effects[tag]; + if (arr.length) + { + toNode = arr[0].getInputNode(); + for (i = 0, len = arr.length; i < len; i++) + { + n = arr[i]; + if (i + 1 === len) + n.connectTo(context["destination"]); + else + n.connectTo(arr[i + 1].getInputNode()); + } + } + } + getAudioByTag(tag); + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].reconnect(toNode); + if (micSource && micTag === tag) + { + micSource["disconnect"](); + micSource["connect"](toNode); + } + }; + function addEffectForTag(tag, fx) + { + if (!effects.hasOwnProperty(tag)) + effects[tag] = [fx]; + else + effects[tag].push(fx); + reconnectEffects(tag); + }; + function Cnds() {}; + Cnds.prototype.OnEnded = function (t) + { + return cr.equals_nocase(audTag, t); + }; + Cnds.prototype.PreloadsComplete = function () + { + var i, len; + for (i = 0, len = audioBuffers.length; i < len; i++) + { + if (!audioBuffers[i].isLoadedAndDecoded() && !audioBuffers[i].hasFailedToLoad()) + return false; + } + return true; + }; + Cnds.prototype.AdvancedAudioSupported = function () + { + return api === API_WEBAUDIO; + }; + Cnds.prototype.IsSilent = function () + { + return silent; + }; + Cnds.prototype.IsAnyPlaying = function () + { + var i, len; + for (i = 0, len = audioInstances.length; i < len; i++) + { + if (audioInstances[i].isPlaying()) + return true; + } + return false; + }; + Cnds.prototype.IsTagPlaying = function (tag) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + { + if (taggedAudio[i].isPlaying()) + return true; + } + return false; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Play = function (file, looping, vol, tag) + { + if (silent) + return; + var v = dbToLinear(vol); + var is_music = file[1]; + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + return; + lastAudio.setPannerEnabled(false); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.PlayAtPosition = function (file, looping, vol, x_, y_, angle_, innerangle_, outerangle_, outergain_, tag) + { + if (silent) + return; + var v = dbToLinear(vol); + var is_music = file[1]; + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + { + var b = this.getAudioBuffer(src, is_music); + b.panWhenReady.push({ x: x_, y: y_, a: angle_, ia: innerangle_, oa: outerangle_, og: dbToLinear(outergain_), thistag: tag }); + return; + } + lastAudio.setPannerEnabled(true); + lastAudio.setPan(x_, y_, angle_, innerangle_, outerangle_, dbToLinear(outergain_)); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.PlayAtObject = function (file, looping, vol, obj, innerangle, outerangle, outergain, tag) + { + if (silent || !obj) + return; + var inst = obj.getFirstPicked(); + if (!inst) + return; + var v = dbToLinear(vol); + var is_music = file[1]; + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + { + var b = this.getAudioBuffer(src, is_music); + b.panWhenReady.push({ obj: inst, ia: innerangle, oa: outerangle, og: dbToLinear(outergain), thistag: tag }); + return; + } + lastAudio.setPannerEnabled(true); + var px = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, true); + var py = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, false); + lastAudio.setPan(px, py, cr.to_degrees(inst.angle - inst.layer.getAngle()), innerangle, outerangle, dbToLinear(outergain)); + lastAudio.setObject(inst); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.PlayByName = function (folder, filename, looping, vol, tag) + { + if (silent) + return; + var v = dbToLinear(vol); + var is_music = (folder === 1); + var src = this.runtime.files_subfolder + filename.toLowerCase() + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + return; + lastAudio.setPannerEnabled(false); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.PlayAtPositionByName = function (folder, filename, looping, vol, x_, y_, angle_, innerangle_, outerangle_, outergain_, tag) + { + if (silent) + return; + var v = dbToLinear(vol); + var is_music = (folder === 1); + var src = this.runtime.files_subfolder + filename.toLowerCase() + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + { + var b = this.getAudioBuffer(src, is_music); + b.panWhenReady.push({ x: x_, y: y_, a: angle_, ia: innerangle_, oa: outerangle_, og: dbToLinear(outergain_), thistag: tag }); + return; + } + lastAudio.setPannerEnabled(true); + lastAudio.setPan(x_, y_, angle_, innerangle_, outerangle_, dbToLinear(outergain_)); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.PlayAtObjectByName = function (folder, filename, looping, vol, obj, innerangle, outerangle, outergain, tag) + { + if (silent || !obj) + return; + var inst = obj.getFirstPicked(); + if (!inst) + return; + var v = dbToLinear(vol); + var is_music = (folder === 1); + var src = this.runtime.files_subfolder + filename.toLowerCase() + (useOgg ? ".ogg" : ".m4a"); + lastAudio = this.getAudioInstance(src, tag, is_music, looping!==0, v); + if (!lastAudio) + { + var b = this.getAudioBuffer(src, is_music); + b.panWhenReady.push({ obj: inst, ia: innerangle, oa: outerangle, og: dbToLinear(outergain), thistag: tag }); + return; + } + lastAudio.setPannerEnabled(true); + var px = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, true); + var py = cr.rotatePtAround(inst.x, inst.y, -inst.layer.getAngle(), listenerX, listenerY, false); + lastAudio.setPan(px, py, cr.to_degrees(inst.angle - inst.layer.getAngle()), innerangle, outerangle, dbToLinear(outergain)); + lastAudio.setObject(inst); + lastAudio.play(looping!==0, v, 0, this.nextPlayTime); + this.nextPlayTime = 0; + }; + Acts.prototype.SetLooping = function (tag, looping) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].setLooping(looping === 0); + }; + Acts.prototype.SetMuted = function (tag, muted) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].setMuted(muted === 0); + }; + Acts.prototype.SetVolume = function (tag, vol) + { + getAudioByTag(tag); + var v = dbToLinear(vol); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].setVolume(v); + }; + Acts.prototype.Preload = function (file) + { + if (silent) + return; + var is_music = file[1]; + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + if (api === API_APPMOBI) + { + if (this.runtime.isDirectCanvas) + AppMobi["context"]["loadSound"](src); + else + AppMobi["player"]["loadSound"](src); + return; + } + else if (api === API_CORDOVA) + { + return; + } + this.getAudioInstance(src, "", is_music, false); + }; + Acts.prototype.PreloadByName = function (folder, filename) + { + if (silent) + return; + var is_music = (folder === 1); + var src = this.runtime.files_subfolder + filename.toLowerCase() + (useOgg ? ".ogg" : ".m4a"); + if (api === API_APPMOBI) + { + if (this.runtime.isDirectCanvas) + AppMobi["context"]["loadSound"](src); + else + AppMobi["player"]["loadSound"](src); + return; + } + else if (api === API_CORDOVA) + { + return; + } + this.getAudioInstance(src, "", is_music, false); + }; + Acts.prototype.SetPlaybackRate = function (tag, rate) + { + getAudioByTag(tag); + if (rate < 0.0) + rate = 0; + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].setPlaybackRate(rate); + }; + Acts.prototype.Stop = function (tag) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + taggedAudio[i].stop(); + }; + Acts.prototype.StopAll = function () + { + var i, len; + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].stop(); + }; + Acts.prototype.SetPaused = function (tag, state) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + { + if (state === 0) + taggedAudio[i].pause(); + else + taggedAudio[i].resume(); + } + }; + Acts.prototype.Seek = function (tag, pos) + { + getAudioByTag(tag); + var i, len; + for (i = 0, len = taggedAudio.length; i < len; i++) + { + taggedAudio[i].seek(pos); + } + }; + Acts.prototype.SetSilent = function (s) + { + var i, len; + if (s === 2) // toggling + s = (silent ? 1 : 0); // choose opposite state + if (s === 0 && !silent) // setting silent + { + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].setSilent(true); + silent = true; + } + else if (s === 1 && silent) // setting not silent + { + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].setSilent(false); + silent = false; + } + }; + Acts.prototype.SetMasterVolume = function (vol) + { + masterVolume = dbToLinear(vol); + var i, len; + for (i = 0, len = audioInstances.length; i < len; i++) + audioInstances[i].updateVolume(); + }; + Acts.prototype.AddFilterEffect = function (tag, type, freq, detune, q, gain, mix) + { + if (api !== API_WEBAUDIO || type < 0 || type >= filterTypes.length || !context["createBiquadFilter"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new FilterEffect(type, freq, detune, q, gain, mix)); + }; + Acts.prototype.AddDelayEffect = function (tag, delay, gain, mix) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new DelayEffect(delay, dbToLinear(gain), mix)); + }; + Acts.prototype.AddFlangerEffect = function (tag, delay, modulation, freq, feedback, mix) + { + if (api !== API_WEBAUDIO || !context["createOscillator"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new FlangerEffect(delay / 1000, modulation / 1000, freq, feedback / 100, mix)); + }; + Acts.prototype.AddPhaserEffect = function (tag, freq, detune, q, mod, modfreq, mix) + { + if (api !== API_WEBAUDIO || !context["createOscillator"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new PhaserEffect(freq, detune, q, mod, modfreq, mix)); + }; + Acts.prototype.AddConvolutionEffect = function (tag, file, norm, mix) + { + if (api !== API_WEBAUDIO || !context["createConvolver"]) + return; + var doNormalize = (norm === 0); + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + var b = this.getAudioBuffer(src, false); + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + var fx; + if (b.bufferObject) + { + fx = new ConvolveEffect(b.bufferObject, doNormalize, mix, src); + } + else + { + fx = new ConvolveEffect(null, doNormalize, mix, src); + b.normalizeWhenReady = doNormalize; + b.convolveWhenReady = fx; + } + addEffectForTag(tag, fx); + }; + Acts.prototype.AddGainEffect = function (tag, g) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + addEffectForTag(tag, new GainEffect(dbToLinear(g))); + }; + Acts.prototype.AddMuteEffect = function (tag) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + addEffectForTag(tag, new GainEffect(0)); // re-use gain effect with 0 gain + }; + Acts.prototype.AddTremoloEffect = function (tag, freq, mix) + { + if (api !== API_WEBAUDIO || !context["createOscillator"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new TremoloEffect(freq, mix)); + }; + Acts.prototype.AddRingModEffect = function (tag, freq, mix) + { + if (api !== API_WEBAUDIO || !context["createOscillator"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new RingModulatorEffect(freq, mix)); + }; + Acts.prototype.AddDistortionEffect = function (tag, threshold, headroom, drive, makeupgain, mix) + { + if (api !== API_WEBAUDIO || !context["createWaveShaper"]) + return; + tag = tag.toLowerCase(); + mix = mix / 100; + if (mix < 0) mix = 0; + if (mix > 1) mix = 1; + addEffectForTag(tag, new DistortionEffect(threshold, headroom, drive, makeupgain, mix)); + }; + Acts.prototype.AddCompressorEffect = function (tag, threshold, knee, ratio, attack, release) + { + if (api !== API_WEBAUDIO || !context["createDynamicsCompressor"]) + return; + tag = tag.toLowerCase(); + addEffectForTag(tag, new CompressorEffect(threshold, knee, ratio, attack / 1000, release / 1000)); + }; + Acts.prototype.AddAnalyserEffect = function (tag, fftSize, smoothing) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + addEffectForTag(tag, new AnalyserEffect(fftSize, smoothing)); + }; + Acts.prototype.RemoveEffects = function (tag) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + var i, len, arr; + if (effects.hasOwnProperty(tag)) + { + arr = effects[tag]; + if (arr.length) + { + for (i = 0, len = arr.length; i < len; i++) + arr[i].remove(); + cr.clearArray(arr); + reconnectEffects(tag); + } + } + }; + Acts.prototype.SetEffectParameter = function (tag, index, param, value, ramp, time) + { + if (api !== API_WEBAUDIO) + return; + tag = tag.toLowerCase(); + index = Math.floor(index); + var arr; + if (!effects.hasOwnProperty(tag)) + return; + arr = effects[tag]; + if (index < 0 || index >= arr.length) + return; + arr[index].setParam(param, value, ramp, time); + }; + Acts.prototype.SetListenerObject = function (obj_) + { + if (!obj_ || api !== API_WEBAUDIO) + return; + var inst = obj_.getFirstPicked(); + if (!inst) + return; + this.listenerTracker.setObject(inst); + listenerX = inst.x; + listenerY = inst.y; + }; + Acts.prototype.SetListenerZ = function (z) + { + this.listenerZ = z; + }; + Acts.prototype.ScheduleNextPlay = function (t) + { + if (!context) + return; // needs Web Audio API + this.nextPlayTime = t; + }; + Acts.prototype.UnloadAudio = function (file) + { + var is_music = file[1]; + var src = this.runtime.files_subfolder + file[0] + (useOgg ? ".ogg" : ".m4a"); + var b = this.getAudioBuffer(src, is_music, true /* don't create if missing */); + if (!b) + return; // not loaded + b.release(); + cr.arrayFindRemove(audioBuffers, b); + }; + Acts.prototype.UnloadAudioByName = function (folder, filename) + { + var is_music = (folder === 1); + var src = this.runtime.files_subfolder + filename.toLowerCase() + (useOgg ? ".ogg" : ".m4a"); + var b = this.getAudioBuffer(src, is_music, true /* don't create if missing */); + if (!b) + return; // not loaded + b.release(); + cr.arrayFindRemove(audioBuffers, b); + }; + Acts.prototype.UnloadAll = function () + { + var i, len; + for (i = 0, len = audioBuffers.length; i < len; ++i) + { + audioBuffers[i].release(); + }; + cr.clearArray(audioBuffers); + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Duration = function (ret, tag) + { + getAudioByTag(tag, true); + if (taggedAudio.length) + ret.set_float(taggedAudio[0].getDuration()); + else + ret.set_float(0); + }; + Exps.prototype.PlaybackTime = function (ret, tag) + { + getAudioByTag(tag, true); + if (taggedAudio.length) + ret.set_float(taggedAudio[0].getPlaybackTime(true)); + else + ret.set_float(0); + }; + Exps.prototype.Volume = function (ret, tag) + { + getAudioByTag(tag, true); + if (taggedAudio.length) + { + var v = taggedAudio[0].getVolume(); + ret.set_float(linearToDb(v)); + } + else + ret.set_float(0); + }; + Exps.prototype.MasterVolume = function (ret) + { + ret.set_float(linearToDb(masterVolume)); + }; + Exps.prototype.EffectCount = function (ret, tag) + { + tag = tag.toLowerCase(); + var arr = null; + if (effects.hasOwnProperty(tag)) + arr = effects[tag]; + ret.set_int(arr ? arr.length : 0); + }; + function getAnalyser(tag, index) + { + var arr = null; + if (effects.hasOwnProperty(tag)) + arr = effects[tag]; + if (arr && index >= 0 && index < arr.length && arr[index].freqBins) + return arr[index]; + else + return null; + }; + Exps.prototype.AnalyserFreqBinCount = function (ret, tag, index) + { + tag = tag.toLowerCase(); + index = Math.floor(index); + var analyser = getAnalyser(tag, index); + ret.set_int(analyser ? analyser.node["frequencyBinCount"] : 0); + }; + Exps.prototype.AnalyserFreqBinAt = function (ret, tag, index, bin) + { + tag = tag.toLowerCase(); + index = Math.floor(index); + bin = Math.floor(bin); + var analyser = getAnalyser(tag, index); + if (!analyser) + ret.set_float(0); + else if (bin < 0 || bin >= analyser.node["frequencyBinCount"]) + ret.set_float(0); + else + ret.set_float(analyser.freqBins[bin]); + }; + Exps.prototype.AnalyserPeakLevel = function (ret, tag, index) + { + tag = tag.toLowerCase(); + index = Math.floor(index); + var analyser = getAnalyser(tag, index); + if (analyser) + ret.set_float(analyser.peak); + else + ret.set_float(0); + }; + Exps.prototype.AnalyserRMSLevel = function (ret, tag, index) + { + tag = tag.toLowerCase(); + index = Math.floor(index); + var analyser = getAnalyser(tag, index); + if (analyser) + ret.set_float(analyser.rms); + else + ret.set_float(0); + }; + Exps.prototype.SampleRate = function (ret) + { + ret.set_int(context ? context.sampleRate : 0); + }; + Exps.prototype.CurrentTime = function (ret) + { + ret.set_float(context ? context.currentTime : cr.performance_now()); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Browser = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Browser.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + var offlineScriptReady = false; + var browserPluginReady = false; + document.addEventListener("DOMContentLoaded", function () + { + if (window["C2_RegisterSW"] && navigator.serviceWorker) + { + var offlineClientScript = document.createElement("script"); + offlineClientScript.onload = function () + { + offlineScriptReady = true; + checkReady() + }; + offlineClientScript.src = "offlineClient.js"; + document.head.appendChild(offlineClientScript); + } + }); + var browserInstance = null; + typeProto.onAppBegin = function () + { + browserPluginReady = true; + checkReady(); + }; + function checkReady() + { + if (offlineScriptReady && browserPluginReady && window["OfflineClientInfo"]) + { + window["OfflineClientInfo"]["SetMessageCallback"](function (e) + { + browserInstance.onSWMessage(e); + }); + } + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + var self = this; + window.addEventListener("resize", function () { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnResize, self); + }); + browserInstance = this; + if (typeof navigator.onLine !== "undefined") + { + window.addEventListener("online", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOnline, self); + }); + window.addEventListener("offline", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOffline, self); + }); + } + if (typeof window.applicationCache !== "undefined") + { + window.applicationCache.addEventListener('updateready', function() { + self.runtime.loadingprogress = 1; + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateReady, self); + }); + window.applicationCache.addEventListener('progress', function(e) { + self.runtime.loadingprogress = (e["loaded"] / e["total"]) || 0; + }); + } + if (!this.runtime.isDirectCanvas) + { + document.addEventListener("appMobi.device.update.available", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateReady, self); + }); + document.addEventListener("backbutton", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton, self); + }); + document.addEventListener("menubutton", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnMenuButton, self); + }); + document.addEventListener("searchbutton", function() { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnSearchButton, self); + }); + document.addEventListener("tizenhwkey", function (e) { + var ret; + switch (e["keyName"]) { + case "back": + ret = self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton, self); + if (!ret) + { + if (window["tizen"]) + window["tizen"]["application"]["getCurrentApplication"]()["exit"](); + } + break; + case "menu": + ret = self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnMenuButton, self); + if (!ret) + e.preventDefault(); + break; + } + }); + } + if (this.runtime.isWindows10 && typeof Windows !== "undefined") + { + Windows["UI"]["Core"]["SystemNavigationManager"]["getForCurrentView"]().addEventListener("backrequested", function (e) + { + var ret = self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton, self); + if (ret) + e.handled = true; + }); + } + else if (this.runtime.isWinJS && WinJS["Application"]) + { + WinJS["Application"]["onbackclick"] = function (e) + { + return !!self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnBackButton, self); + }; + } + this.runtime.addSuspendCallback(function(s) { + if (s) + { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnPageHidden, self); + } + else + { + self.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnPageVisible, self); + } + }); + this.is_arcade = (typeof window["is_scirra_arcade"] !== "undefined"); + }; + instanceProto.onSWMessage = function (e) + { + var messageType = e.data.type; + if (messageType === "downloading-update") + this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateFound, this); + else if (messageType === "update-ready" || messageType === "update-pending") + this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnUpdateReady, this); + else if (messageType === "offline-ready") + this.runtime.trigger(cr.plugins_.Browser.prototype.cnds.OnOfflineReady, this); + }; + var batteryManager = null; + var loadedBatteryManager = false; + function maybeLoadBatteryManager() + { + if (loadedBatteryManager) + return; + if (!navigator["getBattery"]) + return; + var promise = navigator["getBattery"](); + loadedBatteryManager = true; + if (promise) + { + promise.then(function (manager) { + batteryManager = manager; + }); + } + }; + function Cnds() {}; + Cnds.prototype.CookiesEnabled = function() + { + return navigator ? navigator.cookieEnabled : false; + }; + Cnds.prototype.IsOnline = function() + { + return navigator ? navigator.onLine : false; + }; + Cnds.prototype.HasJava = function() + { + return navigator ? navigator.javaEnabled() : false; + }; + Cnds.prototype.OnOnline = function() + { + return true; + }; + Cnds.prototype.OnOffline = function() + { + return true; + }; + Cnds.prototype.IsDownloadingUpdate = function () + { + if (typeof window["applicationCache"] === "undefined") + return false; + else + return window["applicationCache"]["status"] === window["applicationCache"]["DOWNLOADING"]; + }; + Cnds.prototype.OnUpdateReady = function () + { + return true; + }; + Cnds.prototype.PageVisible = function () + { + return !this.runtime.isSuspended; + }; + Cnds.prototype.OnPageVisible = function () + { + return true; + }; + Cnds.prototype.OnPageHidden = function () + { + return true; + }; + Cnds.prototype.OnResize = function () + { + return true; + }; + Cnds.prototype.IsFullscreen = function () + { + return !!(document["mozFullScreen"] || document["webkitIsFullScreen"] || document["fullScreen"] || this.runtime.isNodeFullscreen); + }; + Cnds.prototype.OnBackButton = function () + { + return true; + }; + Cnds.prototype.OnMenuButton = function () + { + return true; + }; + Cnds.prototype.OnSearchButton = function () + { + return true; + }; + Cnds.prototype.IsMetered = function () + { + var connection = navigator["connection"] || navigator["mozConnection"] || navigator["webkitConnection"]; + if (!connection) + return false; + return !!connection["metered"]; + }; + Cnds.prototype.IsCharging = function () + { + var battery = navigator["battery"] || navigator["mozBattery"] || navigator["webkitBattery"]; + if (battery) + { + return !!battery["charging"] + } + else + { + maybeLoadBatteryManager(); + if (batteryManager) + { + return !!batteryManager["charging"]; + } + else + { + return true; // if unknown, default to charging (powered) + } + } + }; + Cnds.prototype.IsPortraitLandscape = function (p) + { + var current = (window.innerWidth <= window.innerHeight ? 0 : 1); + return current === p; + }; + Cnds.prototype.SupportsFullscreen = function () + { + if (this.runtime.isNodeWebkit) + return true; + var elem = this.runtime.canvasdiv || this.runtime.canvas; + return !!(elem["requestFullscreen"] || elem["mozRequestFullScreen"] || elem["msRequestFullscreen"] || elem["webkitRequestFullScreen"]); + }; + Cnds.prototype.OnUpdateFound = function () + { + return true; + }; + Cnds.prototype.OnUpdateReady = function () + { + return true; + }; + Cnds.prototype.OnOfflineReady = function () + { + return true; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Alert = function (msg) + { + if (!this.runtime.isDomFree) + alert(msg.toString()); + }; + Acts.prototype.Close = function () + { + if (this.runtime.isCocoonJs) + CocoonJS["App"]["forceToFinish"](); + else if (window["tizen"]) + window["tizen"]["application"]["getCurrentApplication"]()["exit"](); + else if (navigator["app"] && navigator["app"]["exitApp"]) + navigator["app"]["exitApp"](); + else if (navigator["device"] && navigator["device"]["exitApp"]) + navigator["device"]["exitApp"](); + else if (!this.is_arcade && !this.runtime.isDomFree) + window.close(); + }; + Acts.prototype.Focus = function () + { + if (this.runtime.isNodeWebkit) + { + var win = window["nwgui"]["Window"]["get"](); + win["focus"](); + } + else if (!this.is_arcade && !this.runtime.isDomFree) + window.focus(); + }; + Acts.prototype.Blur = function () + { + if (this.runtime.isNodeWebkit) + { + var win = window["nwgui"]["Window"]["get"](); + win["blur"](); + } + else if (!this.is_arcade && !this.runtime.isDomFree) + window.blur(); + }; + Acts.prototype.GoBack = function () + { + if (navigator["app"] && navigator["app"]["backHistory"]) + navigator["app"]["backHistory"](); + else if (!this.is_arcade && !this.runtime.isDomFree && window.back) + window.back(); + }; + Acts.prototype.GoForward = function () + { + if (!this.is_arcade && !this.runtime.isDomFree && window.forward) + window.forward(); + }; + Acts.prototype.GoHome = function () + { + if (!this.is_arcade && !this.runtime.isDomFree && window.home) + window.home(); + }; + Acts.prototype.GoToURL = function (url, target) + { + + }; + Acts.prototype.GoToURLWindow = function (url, tag) + { + + }; + Acts.prototype.Reload = function () + { + if (!this.is_arcade && !this.runtime.isDomFree) + window.location.reload(); + }; + var firstRequestFullscreen = true; + var crruntime = null; + function onFullscreenError(e) + { + if (console && console.warn) + console.warn("Fullscreen request failed: ", e); + crruntime["setSize"](window.innerWidth, window.innerHeight); + }; + Acts.prototype.RequestFullScreen = function (stretchmode) + { + if (this.runtime.isDomFree) + { + cr.logexport("[Construct 2] Requesting fullscreen is not supported on this platform - the request has been ignored"); + return; + } + if (stretchmode >= 2) + stretchmode += 1; + if (stretchmode === 6) + stretchmode = 2; + if (this.runtime.isNodeWebkit) + { + if (this.runtime.isDebug) + { + debuggerFullscreen(true); + } + else if (!this.runtime.isNodeFullscreen && window["nwgui"]) + { + window["nwgui"]["Window"]["get"]()["enterFullscreen"](); + this.runtime.isNodeFullscreen = true; + this.runtime.fullscreen_scaling = (stretchmode >= 2 ? stretchmode : 0); + } + } + else + { + if (document["mozFullScreen"] || document["webkitIsFullScreen"] || !!document["msFullscreenElement"] || document["fullScreen"] || document["fullScreenElement"]) + { + return; + } + this.runtime.fullscreen_scaling = (stretchmode >= 2 ? stretchmode : 0); + var elem = this.runtime.canvasdiv || this.runtime.canvas; + if (firstRequestFullscreen) + { + firstRequestFullscreen = false; + crruntime = this.runtime; + elem.addEventListener("mozfullscreenerror", onFullscreenError); + elem.addEventListener("webkitfullscreenerror", onFullscreenError); + elem.addEventListener("MSFullscreenError", onFullscreenError); + elem.addEventListener("fullscreenerror", onFullscreenError); + } + if (elem["requestFullscreen"]) + elem["requestFullscreen"](); + else if (elem["mozRequestFullScreen"]) + elem["mozRequestFullScreen"](); + else if (elem["msRequestFullscreen"]) + elem["msRequestFullscreen"](); + else if (elem["webkitRequestFullScreen"]) + { + if (typeof Element !== "undefined" && typeof Element["ALLOW_KEYBOARD_INPUT"] !== "undefined") + elem["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]); + else + elem["webkitRequestFullScreen"](); + } + } + }; + Acts.prototype.CancelFullScreen = function () + { + if (this.runtime.isDomFree) + { + cr.logexport("[Construct 2] Exiting fullscreen is not supported on this platform - the request has been ignored"); + return; + } + if (this.runtime.isNodeWebkit) + { + if (this.runtime.isDebug) + { + debuggerFullscreen(false); + } + else if (this.runtime.isNodeFullscreen && window["nwgui"]) + { + window["nwgui"]["Window"]["get"]()["leaveFullscreen"](); + this.runtime.isNodeFullscreen = false; + } + } + else + { + if (document["exitFullscreen"]) + document["exitFullscreen"](); + else if (document["mozCancelFullScreen"]) + document["mozCancelFullScreen"](); + else if (document["msExitFullscreen"]) + document["msExitFullscreen"](); + else if (document["webkitCancelFullScreen"]) + document["webkitCancelFullScreen"](); + } + }; + Acts.prototype.Vibrate = function (pattern_) + { + try { + var arr = pattern_.split(","); + var i, len; + for (i = 0, len = arr.length; i < len; i++) + { + arr[i] = parseInt(arr[i], 10); + } + if (navigator["vibrate"]) + navigator["vibrate"](arr); + else if (navigator["mozVibrate"]) + navigator["mozVibrate"](arr); + else if (navigator["webkitVibrate"]) + navigator["webkitVibrate"](arr); + else if (navigator["msVibrate"]) + navigator["msVibrate"](arr); + } + catch (e) {} + }; + Acts.prototype.InvokeDownload = function (url_, filename_) + { + + }; + Acts.prototype.InvokeDownloadString = function (str_, mimetype_, filename_) + { + + }; + Acts.prototype.ConsoleLog = function (type_, msg_) + { + if (typeof console === "undefined") + return; + if (type_ === 0 && console.log) + console.log(msg_.toString()); + if (type_ === 1 && console.warn) + console.warn(msg_.toString()); + if (type_ === 2 && console.error) + console.error(msg_.toString()); + }; + Acts.prototype.ConsoleGroup = function (name_) + { + if (console && console.group) + console.group(name_); + }; + Acts.prototype.ConsoleGroupEnd = function () + { + if (console && console.groupEnd) + console.groupEnd(); + }; + Acts.prototype.ExecJs = function (js_) + { + try { + if (eval) + eval(js_); + } + catch (e) + { + if (console && console.error) + console.error("Error executing Javascript: ", e); + } + }; + var orientations = [ + "portrait", + "landscape", + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" + ]; + Acts.prototype.LockOrientation = function (o) + { + o = Math.floor(o); + if (o < 0 || o >= orientations.length) + return; + this.runtime.autoLockOrientation = false; + var orientation = orientations[o]; + if (screen["orientation"] && screen["orientation"]["lock"]) + screen["orientation"]["lock"](orientation); + else if (screen["lockOrientation"]) + screen["lockOrientation"](orientation); + else if (screen["webkitLockOrientation"]) + screen["webkitLockOrientation"](orientation); + else if (screen["mozLockOrientation"]) + screen["mozLockOrientation"](orientation); + else if (screen["msLockOrientation"]) + screen["msLockOrientation"](orientation); + }; + Acts.prototype.UnlockOrientation = function () + { + this.runtime.autoLockOrientation = false; + if (screen["orientation"] && screen["orientation"]["unlock"]) + screen["orientation"]["unlock"](); + else if (screen["unlockOrientation"]) + screen["unlockOrientation"](); + else if (screen["webkitUnlockOrientation"]) + screen["webkitUnlockOrientation"](); + else if (screen["mozUnlockOrientation"]) + screen["mozUnlockOrientation"](); + else if (screen["msUnlockOrientation"]) + screen["msUnlockOrientation"](); + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.URL = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.toString()); + }; + Exps.prototype.Protocol = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.protocol); + }; + Exps.prototype.Domain = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.hostname); + }; + Exps.prototype.PathName = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.pathname); + }; + Exps.prototype.Hash = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.hash); + }; + Exps.prototype.Referrer = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : document.referrer); + }; + Exps.prototype.Title = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : document.title); + }; + Exps.prototype.Name = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : navigator.appName); + }; + Exps.prototype.Version = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : navigator.appVersion); + }; + Exps.prototype.Language = function (ret) + { + if (navigator && navigator.language) + ret.set_string(navigator.language); + else + ret.set_string(""); + }; + Exps.prototype.Platform = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : navigator.platform); + }; + Exps.prototype.Product = function (ret) + { + if (navigator && navigator.product) + ret.set_string(navigator.product); + else + ret.set_string(""); + }; + Exps.prototype.Vendor = function (ret) + { + if (navigator && navigator.vendor) + ret.set_string(navigator.vendor); + else + ret.set_string(""); + }; + Exps.prototype.UserAgent = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : navigator.userAgent); + }; + Exps.prototype.QueryString = function (ret) + { + ret.set_string(this.runtime.isDomFree ? "" : window.location.search); + }; + Exps.prototype.QueryParam = function (ret, paramname) + { + if (this.runtime.isDomFree) + { + ret.set_string(""); + return; + } + var match = RegExp('[?&]' + paramname + '=([^&]*)').exec(window.location.search); + if (match) + ret.set_string(decodeURIComponent(match[1].replace(/\+/g, ' '))); + else + ret.set_string(""); + }; + Exps.prototype.Bandwidth = function (ret) + { + var connection = navigator["connection"] || navigator["mozConnection"] || navigator["webkitConnection"]; + if (!connection) + ret.set_float(Number.POSITIVE_INFINITY); + else + { + if (typeof connection["bandwidth"] !== "undefined") + ret.set_float(connection["bandwidth"]); + else if (typeof connection["downlinkMax"] !== "undefined") + ret.set_float(connection["downlinkMax"]); + else + ret.set_float(Number.POSITIVE_INFINITY); + } + }; + Exps.prototype.ConnectionType = function (ret) + { + var connection = navigator["connection"] || navigator["mozConnection"] || navigator["webkitConnection"]; + if (!connection) + ret.set_string("unknown"); + else + { + ret.set_string(connection["type"] || "unknown"); + } + }; + Exps.prototype.BatteryLevel = function (ret) + { + var battery = navigator["battery"] || navigator["mozBattery"] || navigator["webkitBattery"]; + if (battery) + { + ret.set_float(battery["level"]); + } + else + { + maybeLoadBatteryManager(); + if (batteryManager) + { + ret.set_float(batteryManager["level"]); + } + else + { + ret.set_float(1); // not supported/unknown: assume charged + } + } + }; + Exps.prototype.BatteryTimeLeft = function (ret) + { + var battery = navigator["battery"] || navigator["mozBattery"] || navigator["webkitBattery"]; + if (battery) + { + ret.set_float(battery["dischargingTime"]); + } + else + { + maybeLoadBatteryManager(); + if (batteryManager) + { + ret.set_float(batteryManager["dischargingTime"]); + } + else + { + ret.set_float(Number.POSITIVE_INFINITY); // not supported/unknown: assume infinite time left + } + } + }; + Exps.prototype.ExecJS = function (ret, js_) + { + if (!eval) + { + ret.set_any(0); + return; + } + var result = 0; + try { + result = eval(js_); + } + catch (e) + { + if (console && console.error) + console.error("Error executing Javascript: ", e); + } + if (typeof result === "number") + ret.set_any(result); + else if (typeof result === "string") + ret.set_any(result); + else if (typeof result === "boolean") + ret.set_any(result ? 1 : 0); + else + ret.set_any(0); + }; + Exps.prototype.ScreenWidth = function (ret) + { + ret.set_int(screen.width); + }; + Exps.prototype.ScreenHeight = function (ret) + { + ret.set_int(screen.height); + }; + Exps.prototype.DevicePixelRatio = function (ret) + { + ret.set_float(this.runtime.devicePixelRatio); + }; + Exps.prototype.WindowInnerWidth = function (ret) + { + ret.set_int(window.innerWidth); + }; + Exps.prototype.WindowInnerHeight = function (ret) + { + ret.set_int(window.innerHeight); + }; + Exps.prototype.WindowOuterWidth = function (ret) + { + ret.set_int(window.outerWidth); + }; + Exps.prototype.WindowOuterHeight = function (ret) + { + ret.set_int(window.outerHeight); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Function = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Function.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + var funcStack = []; + var funcStackPtr = -1; + var isInPreview = false; // set in onCreate + function FuncStackEntry() + { + this.name = ""; + this.retVal = 0; + this.params = []; + }; + function pushFuncStack() + { + funcStackPtr++; + if (funcStackPtr === funcStack.length) + funcStack.push(new FuncStackEntry()); + return funcStack[funcStackPtr]; + }; + function getCurrentFuncStack() + { + if (funcStackPtr < 0) + return null; + return funcStack[funcStackPtr]; + }; + function getOneAboveFuncStack() + { + if (!funcStack.length) + return null; + var i = funcStackPtr + 1; + if (i >= funcStack.length) + i = funcStack.length - 1; + return funcStack[i]; + }; + function popFuncStack() + { +; + funcStackPtr--; + }; + instanceProto.onCreate = function() + { + isInPreview = (typeof cr_is_preview !== "undefined"); + var self = this; + window["c2_callFunction"] = function (name_, params_) + { + var i, len, v; + var fs = pushFuncStack(); + fs.name = name_.toLowerCase(); + fs.retVal = 0; + if (params_) + { + fs.params.length = params_.length; + for (i = 0, len = params_.length; i < len; ++i) + { + v = params_[i]; + if (typeof v === "number" || typeof v === "string") + fs.params[i] = v; + else if (typeof v === "boolean") + fs.params[i] = (v ? 1 : 0); + else + fs.params[i] = 0; + } + } + else + { + cr.clearArray(fs.params); + } + self.runtime.trigger(cr.plugins_.Function.prototype.cnds.OnFunction, self, fs.name); + popFuncStack(); + return fs.retVal; + }; + }; + function Cnds() {}; + Cnds.prototype.OnFunction = function (name_) + { + var fs = getCurrentFuncStack(); + if (!fs) + return false; + return cr.equals_nocase(name_, fs.name); + }; + Cnds.prototype.CompareParam = function (index_, cmp_, value_) + { + var fs = getCurrentFuncStack(); + if (!fs) + return false; + index_ = cr.floor(index_); + if (index_ < 0 || index_ >= fs.params.length) + return false; + return cr.do_cmp(fs.params[index_], cmp_, value_); + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.CallFunction = function (name_, params_) + { + var fs = pushFuncStack(); + fs.name = name_.toLowerCase(); + fs.retVal = 0; + cr.shallowAssignArray(fs.params, params_); + var ran = this.runtime.trigger(cr.plugins_.Function.prototype.cnds.OnFunction, this, fs.name); + if (isInPreview && !ran) + { +; + } + popFuncStack(); + }; + Acts.prototype.SetReturnValue = function (value_) + { + var fs = getCurrentFuncStack(); + if (fs) + fs.retVal = value_; + else +; + }; + Acts.prototype.CallExpression = function (unused) + { + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.ReturnValue = function (ret) + { + var fs = getOneAboveFuncStack(); + if (fs) + ret.set_any(fs.retVal); + else + ret.set_int(0); + }; + Exps.prototype.ParamCount = function (ret) + { + var fs = getCurrentFuncStack(); + if (fs) + ret.set_int(fs.params.length); + else + { +; + ret.set_int(0); + } + }; + Exps.prototype.Param = function (ret, index_) + { + index_ = cr.floor(index_); + var fs = getCurrentFuncStack(); + if (fs) + { + if (index_ >= 0 && index_ < fs.params.length) + { + ret.set_any(fs.params[index_]); + } + else + { +; + ret.set_int(0); + } + } + else + { +; + ret.set_int(0); + } + }; + Exps.prototype.Call = function (ret, name_) + { + var fs = pushFuncStack(); + fs.name = name_.toLowerCase(); + fs.retVal = 0; + cr.clearArray(fs.params); + var i, len; + for (i = 2, len = arguments.length; i < len; i++) + fs.params.push(arguments[i]); + var ran = this.runtime.trigger(cr.plugins_.Function.prototype.cnds.OnFunction, this, fs.name); + if (isInPreview && !ran) + { +; + } + popFuncStack(); + ret.set_any(fs.retVal); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.IDNet = function(runtime) { + this.runtime = runtime; +}; +(function() { + var pluginProto = cr.plugins_.IDNet.prototype; + pluginProto.Type = function(plugin) { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + var _document = null; + var _unsafeWindow = null; + var idNetRuntime = null; + var idNetInst = null; + var idnetUserName = "Guest"; + var authorized = false; + var userAuthorized = false; + var idnetSessionKey = ""; + var onlineSavesData = ""; + var isBlacklisted = 0; + var isSponsor = 0; + var gotSaveData = 0; + typeProto.onCreate = function() { + }; + pluginProto.Instance = function(type) { + this.type = type; + this.runtime = type.runtime; + idNetRuntime = this.runtime; + idNetInst = this; + this._document = window.document; + this._unsafeWindow = this._document.defaultView; + }; + function ShowLeaderBoardCallback(response) { + } + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + }; + instanceProto.onDestroy = function () + { + }; + instanceProto.draw = function(ctx) + { + }; + instanceProto.drawGL = function (glw) + { + }; + function Cnds() {}; + Cnds.prototype.isAuthorized = function () { + return idNetInst.authorized; + }; + Cnds.prototype.isNotAuthorized = function () { + return !idNetInst.authorized; + }; + Cnds.prototype.UserIsAuthorized = function () { + return idNetInst.userAuthorized; + }; + Cnds.prototype.UserIsNotAuthorized = function () { + return !idNetInst.userAuthorized; + }; + Cnds.prototype.blacklisted = function () { + return idNetInst.isBlacklisted; + }; + Cnds.prototype.sponsored = function () { + return idNetInst.isSponsor; + }; + Cnds.prototype.dataReady = function () { + if (idNetInst.gotSaveData === 1) { + idNetInst.gotSaveData = 0; + return 1; + } + }; + Cnds.prototype.menuVisible = function() { + if (window.ID && ID.isVisible()) { + return 1; + } + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Inititalize = function(appid_) {/* + console.log('init with appid ' + appid_); + (function(d, s, id){ + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = document.location.protocol == 'https:' ? "https://scdn.id.net/api/sdk.js" : "http://cdn.id.net/api/sdk.js"; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'id-jssdk')); + window.idAsyncInit = function() { + ID.Event.subscribe("id.init",function() { + window.idnet_autologin = function(response) { + if (response != null && response.user != null) { + console.log("id.net autologin"); + idNetInst.idnetUserName = response.user.nickname; + idNetInst.userAuthorized = true; + ID.login(function(response) {}); + } + } + var fjs = document.head.getElementsByTagName('meta')[0]; + if (document.getElementById('id-autologin')) { + var js_auto = document.getElementById('id-autologin'); + } else { + var js_auto = document.createElement('script'); + js_auto.id = 'id-autologin'; + js_auto.src = "https://www.id.net/api/user_data/autologin?app_id=" + appid_ + "&callback=window.idnet_autologin"; + fjs.parentNode.insertBefore(js_auto, fjs); + } + console.log("id.net initialized"); + ID.Protection.isBlacklisted(function(blacklisted) { + idNetInst.isBlacklisted = blacklisted; + }); + ID.Protection.isSponsor(function(sponsor) { + idNetInst.isSponsor = sponsor; + }); + }); + ID.init({ + appId : appid_ + }); + idNetInst.authorized = true; + }*/ + }; + Acts.prototype.RegisterPopup = function() {/* + console.log("open registration menu"); + if (idNetInst.authorized) + ID.register(function (response) { + if(response == null) { + } else { + console.log("Registration complete"); + idNetInst.idnetUserName = response.authResponse.details.nickname; + idNetInst.userAuthorized = true; + } + });*/ + }; + Acts.prototype.LoginPopup = function() {/* + console.log("open login menu"); + if (idNetInst.authorized){ + ID.login(function (response) { + if(response == null) { + } else { + console.log("Login complete"); + idNetInst.idnetUserName = response.authResponse.details.nickname; + idNetInst.userAuthorized = true; + } + }); + }*/ + }; + Acts.prototype.ShowLeaderBoard = function(table, mode, highest, allowduplicates) {/* + if (idNetInst.authorized) { + console.log('oi') + var options = { table: table, mode: mode, highest: !!highest, allowduplicates: !!allowduplicates }; + ID.GameAPI.Leaderboards.list(options); + }*/ + }; + Acts.prototype.SubmitScore = function(score, table, allowduplicates, highest, playername) {/* + if (idNetInst.authorized) { + var score = { + table: table, + points: score, + allowduplicates: !!allowduplicates, + highest: !!highest, + playername: playername || idNetInst.idnetUserName + }; + ID.GameAPI.Leaderboards.save(score, function(response) { + console.log("score submitted", response); + }); + }*/ + }; + Acts.prototype.SubmitProfileImage = function(image_) {/* + if (idNetInst.authorized) + ID.submit_image(image_, function(response){ + console.log("screenshot submitted", response); + });*/ + }; + Acts.prototype.AchievementSave = function(achievementTitle_, achievementKey_, overwrite_, allowduplicates_) {/* + if (idNetInst.authorized) { + var achievementData = { + achievement: achievementTitle_, + achievementkey: achievementKey_, + overwrite: overwrite_, + allowduplicates: allowduplicates_ + }; + ID.GameAPI.Achievements.save(achievementData, function(response) { + console.log("achievement saved", response); + }); + }*/ + }; + Acts.prototype.ShowAchievements = function() {/* + if (idNetInst.authorized) { + ID.GameAPI.Achievements.list(); + }*/ + }; + Acts.prototype.OnlineSavesSave = function(key_, value_) {/* + if (idNetInst.authorized) { + ID.api('user_data/submit', 'POST', {key: key_, value: value_}, function(response) { + console.log("save submitted", response); + }); + }*/ + }; + Acts.prototype.OnlineSavesRemove = function(key_) {/* + if (idNetInst.authorized) { + ID.api('user_data/remove', 'POST', {key: key_}, function(response) { + console.log("save deleted", response); + }); + }*/ + }; + Acts.prototype.OnlineSavesLoad = function(key_) {/* + if (idNetInst.authorized) { + ID.api('user_data/retrieve', 'POST', {key: key_}, function(response) { + if(response) { + idNetInst.onlineSavesData = response.jsondata; + idNetInst.gotSaveData = 1; + console.log("save loaded", response); + } + }); + }*/ + }; + Acts.prototype.CheckIsBlacklisted = function () { + ID.Protection.isBlacklisted(function(blacklisted){ + console.log("check blacklist called", blacklisted); + idNetInst.isBlacklisted = blacklisted; + }); + }; + Acts.prototype.CheckIsSponsor = function () { + ID.Protection.isSponsor(function(sponsor){ + console.log("check sponser called", sponser); + idNetInst.isSponsor = sponsor; + }); + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.UserName = function(ret) { + if(idNetInst.idnetUserName != undefined) { + ret.set_string(idNetInst.idnetUserName); + } + }; + Exps.prototype.SessionKey = function(ret) { + if(idnetSessionKey != undefined) { + ret.set_string(idnetSessionKey); + } + }; + Exps.prototype.GateOnlineSavesData = function (ret) { + ret.set_string(String(idNetInst.onlineSavesData)); + }; + Exps.prototype.GetIsBlacklisted = function(ret) { + // if(idNetInst.isBlacklisted) { + // ret.set_int(1); + // } else { + // ret.set_int(0); + // } + }; + Exps.prototype.GetIsSponsor = function(ret) { + if(idNetInst.isSponsor) { + ret.set_int(1); + } else { + ret.set_int(0); + } + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Keyboard = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Keyboard.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + this.keyMap = new Array(256); // stores key up/down state + this.usedKeys = new Array(256); + this.triggerKey = 0; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + var self = this; + if (!this.runtime.isDomFree) + { + jQuery(document).keydown( + function(info) { + self.onKeyDown(info); + } + ); + jQuery(document).keyup( + function(info) { + self.onKeyUp(info); + } + ); + } + }; + var keysToBlockWhenFramed = [32, 33, 34, 35, 36, 37, 38, 39, 40, 44]; + instanceProto.onKeyDown = function (info) + { + var alreadyPreventedDefault = false; + if (window != window.top && keysToBlockWhenFramed.indexOf(info.which) > -1) + { + info.preventDefault(); + alreadyPreventedDefault = true; + info.stopPropagation(); + } + if (this.keyMap[info.which]) + { + if (this.usedKeys[info.which] && !alreadyPreventedDefault) + info.preventDefault(); + return; + } + this.keyMap[info.which] = true; + this.triggerKey = info.which; + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnAnyKey, this); + var eventRan = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKey, this); + var eventRan2 = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKeyCode, this); + this.runtime.isInUserInputEvent = false; + if (eventRan || eventRan2) + { + this.usedKeys[info.which] = true; + if (!alreadyPreventedDefault) + info.preventDefault(); + } + }; + instanceProto.onKeyUp = function (info) + { + this.keyMap[info.which] = false; + this.triggerKey = info.which; + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnAnyKeyReleased, this); + var eventRan = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKeyReleased, this); + var eventRan2 = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKeyCodeReleased, this); + this.runtime.isInUserInputEvent = false; + if (eventRan || eventRan2 || this.usedKeys[info.which]) + { + this.usedKeys[info.which] = true; + info.preventDefault(); + } + }; + instanceProto.onWindowBlur = function () + { + var i; + for (i = 0; i < 256; ++i) + { + if (!this.keyMap[i]) + continue; // key already up + this.keyMap[i] = false; + this.triggerKey = i; + this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnAnyKeyReleased, this); + var eventRan = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKeyReleased, this); + var eventRan2 = this.runtime.trigger(cr.plugins_.Keyboard.prototype.cnds.OnKeyCodeReleased, this); + if (eventRan || eventRan2) + this.usedKeys[i] = true; + } + }; + instanceProto.saveToJSON = function () + { + return { "triggerKey": this.triggerKey }; + }; + instanceProto.loadFromJSON = function (o) + { + this.triggerKey = o["triggerKey"]; + }; + function Cnds() {}; + Cnds.prototype.IsKeyDown = function(key) + { + return this.keyMap[key]; + }; + Cnds.prototype.OnKey = function(key) + { + return (key === this.triggerKey); + }; + Cnds.prototype.OnAnyKey = function(key) + { + return true; + }; + Cnds.prototype.OnAnyKeyReleased = function(key) + { + return true; + }; + Cnds.prototype.OnKeyReleased = function(key) + { + return (key === this.triggerKey); + }; + Cnds.prototype.IsKeyCodeDown = function(key) + { + key = Math.floor(key); + if (key < 0 || key >= this.keyMap.length) + return false; + return this.keyMap[key]; + }; + Cnds.prototype.OnKeyCode = function(key) + { + return (key === this.triggerKey); + }; + Cnds.prototype.OnKeyCodeReleased = function(key) + { + return (key === this.triggerKey); + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.LastKeyCode = function (ret) + { + ret.set_int(this.triggerKey); + }; + function fixedStringFromCharCode(kc) + { + kc = Math.floor(kc); + switch (kc) { + case 8: return "backspace"; + case 9: return "tab"; + case 13: return "enter"; + case 16: return "shift"; + case 17: return "control"; + case 18: return "alt"; + case 19: return "pause"; + case 20: return "capslock"; + case 27: return "esc"; + case 33: return "pageup"; + case 34: return "pagedown"; + case 35: return "end"; + case 36: return "home"; + case 37: return "←"; + case 38: return "↑"; + case 39: return "→"; + case 40: return "↓"; + case 45: return "insert"; + case 46: return "del"; + case 91: return "left window key"; + case 92: return "right window key"; + case 93: return "select"; + case 96: return "numpad 0"; + case 97: return "numpad 1"; + case 98: return "numpad 2"; + case 99: return "numpad 3"; + case 100: return "numpad 4"; + case 101: return "numpad 5"; + case 102: return "numpad 6"; + case 103: return "numpad 7"; + case 104: return "numpad 8"; + case 105: return "numpad 9"; + case 106: return "numpad *"; + case 107: return "numpad +"; + case 109: return "numpad -"; + case 110: return "numpad ."; + case 111: return "numpad /"; + case 112: return "F1"; + case 113: return "F2"; + case 114: return "F3"; + case 115: return "F4"; + case 116: return "F5"; + case 117: return "F6"; + case 118: return "F7"; + case 119: return "F8"; + case 120: return "F9"; + case 121: return "F10"; + case 122: return "F11"; + case 123: return "F12"; + case 144: return "numlock"; + case 145: return "scroll lock"; + case 186: return ";"; + case 187: return "="; + case 188: return ","; + case 189: return "-"; + case 190: return "."; + case 191: return "/"; + case 192: return "'"; + case 219: return "["; + case 220: return "\\"; + case 221: return "]"; + case 222: return "#"; + case 223: return "`"; + default: return String.fromCharCode(kc); + } + }; + Exps.prototype.StringFromKeyCode = function (ret, kc) + { + ret.set_string(fixedStringFromCharCode(kc)); + }; + pluginProto.exps = new Exps(); +}()); +; +; +var localForageInitFailed = false; +try { +/*! + localForage -- Offline Storage, Improved + Version 1.4.0 + https://mozilla.github.io/localForage + (c) 2013-2015 Mozilla, Apache License 2.0 +*/ +!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;jc;c++){var e=a[c];this.supports(e)&&b.push(e)}return b},a.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0;ae;e++)d[e]=a.charCodeAt(e);return c}function d(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.withCredentials=!0,d.responseType="arraybuffer",d.onreadystatechange=function(){return 4===d.readyState?200===d.status?b({response:d.response,type:d.getResponseHeader("Content-Type")}):void c({status:d.status,response:d.response}):void 0},d.send()})}function e(a){return new Promise(function(c,e){var f=b([""],{type:"image/png"}),g=a.transaction([D],"readwrite");g.objectStore(D).put(f,"key"),g.oncomplete=function(){var b=a.transaction([D],"readwrite"),f=b.objectStore(D).get("key");f.onerror=e,f.onsuccess=function(a){var b=a.target.result,e=URL.createObjectURL(b);d(e).then(function(a){c(!(!a||"image/png"!==a.type))},function(){c(!1)}).then(function(){URL.revokeObjectURL(e)})}},g.onerror=g.onabort=e})["catch"](function(){return!1})}function f(a){return"boolean"==typeof B?Promise.resolve(B):e(a).then(function(a){return B=a})}function g(a){return new Promise(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function h(a){var d=c(atob(a.data));return b([d],{type:a.type})}function i(a){return a&&a.__local_forage_encoded_blob}function j(a){var b=this,c=b._initReady().then(function(){var a=C[b._dbInfo.name];return a&&a.dbReady?a.dbReady:void 0});return c.then(a,a),c}function k(a){var b=C[a.name],c={};c.promise=new Promise(function(a){c.resolve=a}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function l(a){var b=C[a.name],c=b.deferredOperations.pop();c&&c.resolve()}function m(a){function b(){return Promise.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];C||(C={});var f=C[d.name];f||(f={forages:[],db:null,dbReady:null,deferredOperations:[]},C[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=j);for(var g=[],h=0;hb.db.version;if(e&&(b.version!==c&&a.console.warn('The database "'+b.name+"\" can't be downgraded from version "+b.db.version+" to version "+b.version+"."),b.version=b.db.version),f||d){if(d){var g=b.db.version+1;g>b.version&&(b.version=g)}return!0}return!1}function r(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(b);g.onsuccess=function(){var b=g.result;void 0===b&&(b=null),i(b)&&(b=h(b)),a(b)},g.onerror=function(){c(g.error)}})["catch"](c)});return z(e,c),e}function s(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.openCursor(),j=1;g.onsuccess=function(){var c=g.result;if(c){var d=c.value;i(d)&&(d=h(d));var e=a(d,c.key,j++);void 0!==e?b(e):c["continue"]()}else b()},g.onerror=function(){d(g.error)}})["catch"](d)});return z(d,b),d}function t(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var h=new Promise(function(a,d){var h;e.ready().then(function(){return h=e._dbInfo,c instanceof Blob?f(h.db).then(function(a){return a?c:g(c)}):c}).then(function(c){var e=h.db.transaction(h.storeName,"readwrite"),f=e.objectStore(h.storeName);null===c&&(c=void 0),e.oncomplete=function(){void 0===c&&(c=null),a(c)},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;d(a)};var g=f.put(c,b)})["catch"](d)});return z(h,d),h}function u(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo,f=e.db.transaction(e.storeName,"readwrite"),g=f.objectStore(e.storeName),h=g["delete"](b);f.oncomplete=function(){a()},f.onerror=function(){c(h.error)},f.onabort=function(){var a=h.error?h.error:h.transaction.error;c(a)}})["catch"](c)});return z(e,c),e}function v(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite"),f=e.objectStore(d.storeName),g=f.clear();e.oncomplete=function(){a()},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;c(a)}})["catch"](c)});return z(c,a),c}function w(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return z(c,a),c}function x(a,b){var c=this,d=new Promise(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return z(d,b),d}function y(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return z(c,a),c}function z(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var A=A||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB;if(A){var B,C,D="local-forage-detect-blob-support",E={_driver:"asyncStorage",_initStorage:m,iterate:s,getItem:r,setItem:t,removeItem:u,clear:v,length:w,key:x,keys:y};return E}}("undefined"!=typeof window?window:self);b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=function(a){function b(a){var b=this,d={};if(a)for(var e in a)d[e]=a[e];return d.keyPrefix=d.name+"/",d.storeName!==b._defaultConfig.storeName&&(d.keyPrefix+=d.storeName+"/"),b._dbInfo=d,new Promise(function(a,b){a(c(3))}).then(function(a){return d.serializer=a,Promise.resolve()})}function d(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=m.length-1;c>=0;c--){var d=m.key(c);0===d.indexOf(a)&&m.removeItem(d)}});return l(c,a),c}function e(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=d.ready().then(function(){var a=d._dbInfo,c=m.getItem(a.keyPrefix+b);return c&&(c=a.serializer.deserialize(c)),c});return l(e,c),e}function f(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=m.length,g=1,h=0;f>h;h++){var i=m.key(h);if(0===i.indexOf(d)){var j=m.getItem(i);if(j&&(j=b.serializer.deserialize(j)),j=a(j,i.substring(e),g++),void 0!==j)return j}}});return l(d,b),d}function g(a,b){var c=this,d=c.ready().then(function(){var b,d=c._dbInfo;try{b=m.key(a)}catch(e){b=null}return b&&(b=b.substring(d.keyPrefix.length)),b});return l(d,b),d}function h(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo,c=m.length,d=[],e=0;c>e;e++)0===m.key(e).indexOf(a.keyPrefix)&&d.push(m.key(e).substring(a.keyPrefix.length));return d});return l(c,a),c}function i(a){var b=this,c=b.keys().then(function(a){return a.length});return l(c,a),c}function j(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=d.ready().then(function(){var a=d._dbInfo;m.removeItem(a.keyPrefix+b)});return l(e,c),e}function k(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var f=e.ready().then(function(){void 0===c&&(c=null);var a=c;return new Promise(function(d,f){var g=e._dbInfo;g.serializer.serialize(c,function(c,e){if(e)f(e);else try{m.setItem(g.keyPrefix+b,c),d(a)}catch(h){("QuotaExceededError"===h.name||"NS_ERROR_DOM_QUOTA_REACHED"===h.name)&&f(h),f(h)}})})});return l(f,d),f}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m=null;try{if(!(a.localStorage&&"setItem"in a.localStorage))return;m=a.localStorage}catch(n){return}var o={_driver:"localStorageWrapper",_initStorage:b,iterate:f,getItem:e,setItem:k,removeItem:j,clear:d,length:i,key:g,keys:h};return o}("undefined"!=typeof window?window:self);b["default"]=d,a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0;var c=function(a){function b(b,c){b=b||[],c=c||{};try{return new Blob(b,c)}catch(d){if("TypeError"!==d.name)throw d;for(var e=a.BlobBuilder||a.MSBlobBuilder||a.MozBlobBuilder||a.WebKitBlobBuilder,f=new e,g=0;gb;b+=4)c=g.indexOf(a[b]),d=g.indexOf(a[b+1]),e=g.indexOf(a[b+2]),f=g.indexOf(a[b+3]),l[j++]=c<<2|d>>4,l[j++]=(15&d)<<4|e>>2,l[j++]=(3&e)<<6|63&f;return k}function f(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=g[(3&c[b])<<4|c[b+1]>>4],d+=g[(15&c[b+1])<<2|c[b+2]>>6],d+=g[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="~~local_forage_type~",i=/^~~local_forage_type~([^~]+)~/,j="__lfsc__:",k=j.length,l="arbf",m="blob",n="si08",o="ui08",p="uic8",q="si16",r="si32",s="ur16",t="ui32",u="fl32",v="fl64",w=k+l.length,x={serialize:c,deserialize:d,stringToBuffer:e,bufferToString:f};return x}("undefined"!=typeof window?window:self);b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=function(a){function b(a){var b=this,d={db:null};if(a)for(var e in a)d[e]="string"!=typeof a[e]?a[e].toString():a[e];var f=new Promise(function(a,c){try{d.db=m(d.name,String(d.version),d.description,d.size)}catch(e){return c(e)}d.db.transaction(function(e){e.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=d,a()},function(a,b){c(b)})})});return new Promise(function(a,b){a(c(3))}).then(function(a){return d.serializer=a,f})}function d(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo;e.db.transaction(function(d){d.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[b],function(b,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),a(d)},function(a,b){c(b)})})})["catch"](c)});return l(e,c),e}function e(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;g>h;h++){var i=f.item(h),j=i.value;if(j&&(j=e.serializer.deserialize(j)),j=a(j,i.key,h+1),void 0!==j)return void b(j)}b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function f(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var f=new Promise(function(a,d){e.ready().then(function(){void 0===c&&(c=null);var f=c,g=e._dbInfo;g.serializer.serialize(c,function(c,e){e?d(e):g.db.transaction(function(e){e.executeSql("INSERT OR REPLACE INTO "+g.storeName+" (key, value) VALUES (?, ?)",[b,c],function(){a(f)},function(a,b){d(b)})},function(a){a.code===a.QUOTA_ERR&&d(a)})})})["catch"](d)});return l(f,d),f}function g(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo;e.db.transaction(function(d){d.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[b],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(e,c),e}function h(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function j(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function k(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e 0; + }; + Cnds.prototype.IsProcessingGets = function () + { + return this.pendingGets > 0; + }; + Cnds.prototype.OnAllSetsComplete = function () + { + return true; + }; + Cnds.prototype.OnAllGetsComplete = function () + { + return true; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetItem = function (keyNoPrefix, value) + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + var keyPrefix = prefix + keyNoPrefix; + this.pendingSets++; + var self = this; + localforage["setItem"](keyPrefix, value, function (err, valueSet) + { + debugDataChanged = true; + self.pendingSets--; + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + currentKey = keyNoPrefix; + lastValue = valueSet; + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemSet, self); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemSet, self); + currentKey = ""; + lastValue = ""; + } + if (self.pendingSets === 0) + { + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllSetsComplete, self); + } + }); + }; + Acts.prototype.GetItem = function (keyNoPrefix) + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + var keyPrefix = prefix + keyNoPrefix; + this.pendingGets++; + var self = this; + localforage["getItem"](keyPrefix, function (err, value) + { + self.pendingGets--; + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + currentKey = keyNoPrefix; + lastValue = value; + if (typeof lastValue === "undefined" || lastValue === null) + lastValue = ""; + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemGet, self); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemGet, self); + currentKey = ""; + lastValue = ""; + } + if (self.pendingGets === 0) + { + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllGetsComplete, self); + } + }); + }; + Acts.prototype.CheckItemExists = function (keyNoPrefix) + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + var keyPrefix = prefix + keyNoPrefix; + var self = this; + localforage["getItem"](keyPrefix, function (err, value) + { + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + currentKey = keyNoPrefix; + if (value === null) // null value indicates key missing + { + lastValue = ""; // prevent ItemValue meaning anything + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemMissing, self); + } + else + { + lastValue = value; // make available to ItemValue expression + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemExists, self); + } + currentKey = ""; + lastValue = ""; + } + }); + }; + Acts.prototype.RemoveItem = function (keyNoPrefix) + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + var keyPrefix = prefix + keyNoPrefix; + var self = this; + localforage["removeItem"](keyPrefix, function (err) + { + debugDataChanged = true; + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + currentKey = keyNoPrefix; + lastValue = ""; + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAnyItemRemoved, self); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnItemRemoved, self); + currentKey = ""; + } + }); + }; + Acts.prototype.ClearStorage = function () + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + if (is_arcade) + return; + var self = this; + localforage["clear"](function (err) + { + debugDataChanged = true; + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + currentKey = ""; + lastValue = ""; + cr.clearArray(keyNamesList); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnCleared, self); + } + }); + }; + Acts.prototype.GetAllKeyNames = function () + { + if (localForageInitFailed) + { + TriggerStorageError(this, "storage failed to initialise - may be disabled in browser settings"); + return; + } + var self = this; + localforage["keys"](function (err, keyList) + { + var i, len, k; + if (err) + { + errorMessage = getErrorString(err); + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnError, self); + } + else + { + cr.clearArray(keyNamesList); + for (i = 0, len = keyList.length; i < len; ++i) + { + k = keyList[i]; + if (!hasRequiredPrefix(k)) + continue; + keyNamesList.push(removePrefix(k)); + } + self.runtime.trigger(cr.plugins_.LocalStorage.prototype.cnds.OnAllKeyNamesLoaded, self); + } + }); + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.ItemValue = function (ret) + { + ret.set_any(lastValue); + }; + Exps.prototype.Key = function (ret) + { + ret.set_string(currentKey); + }; + Exps.prototype.KeyCount = function (ret) + { + ret.set_int(keyNamesList.length); + }; + Exps.prototype.KeyAt = function (ret, i) + { + i = Math.floor(i); + if (i < 0 || i >= keyNamesList.length) + { + ret.set_string(""); + return; + } + ret.set_string(keyNamesList[i]); + }; + Exps.prototype.ErrorMessage = function (ret) + { + ret.set_string(errorMessage); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Mouse = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Mouse.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + this.buttonMap = new Array(4); // mouse down states + this.mouseXcanvas = 0; // mouse position relative to canvas + this.mouseYcanvas = 0; + this.triggerButton = 0; + this.triggerType = 0; + this.triggerDir = 0; + this.handled = false; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + var self = this; + if (!this.runtime.isDomFree) + { + jQuery(document).mousemove( + function(info) { + self.onMouseMove(info); + } + ); + jQuery(document).mousedown( + function(info) { + self.onMouseDown(info); + } + ); + jQuery(document).mouseup( + function(info) { + self.onMouseUp(info); + } + ); + jQuery(document).dblclick( + function(info) { + self.onDoubleClick(info); + } + ); + var wheelevent = function(info) { + self.onWheel(info); + }; + document.addEventListener("mousewheel", wheelevent, false); + document.addEventListener("DOMMouseScroll", wheelevent, false); + } + }; + var dummyoffset = {left: 0, top: 0}; + instanceProto.onMouseMove = function(info) + { + var offset = this.runtime.isDomFree ? dummyoffset : jQuery(this.runtime.canvas).offset(); + this.mouseXcanvas = info.pageX - offset.left; + this.mouseYcanvas = info.pageY - offset.top; + }; + instanceProto.mouseInGame = function () + { + if (this.runtime.fullscreen_mode > 0) + return true; + return this.mouseXcanvas >= 0 && this.mouseYcanvas >= 0 + && this.mouseXcanvas < this.runtime.width && this.mouseYcanvas < this.runtime.height; + }; + instanceProto.onMouseDown = function(info) + { + if (!this.mouseInGame()) + return; + this.buttonMap[info.which] = true; + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnAnyClick, this); + this.triggerButton = info.which - 1; // 1-based + this.triggerType = 0; // single click + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnClick, this); + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnObjectClicked, this); + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onMouseUp = function(info) + { + if (!this.buttonMap[info.which]) + return; + if (this.runtime.had_a_click && !this.runtime.isMobile) + info.preventDefault(); + this.runtime.had_a_click = true; + this.buttonMap[info.which] = false; + this.runtime.isInUserInputEvent = true; + this.triggerButton = info.which - 1; // 1-based + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnRelease, this); + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onDoubleClick = function(info) + { + if (!this.mouseInGame()) + return; + info.preventDefault(); + this.runtime.isInUserInputEvent = true; + this.triggerButton = info.which - 1; // 1-based + this.triggerType = 1; // double click + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnClick, this); + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnObjectClicked, this); + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onWheel = function (info) + { + var delta = info.wheelDelta ? info.wheelDelta : info.detail ? -info.detail : 0; + this.triggerDir = (delta < 0 ? 0 : 1); + this.handled = false; + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnWheel, this); + this.runtime.isInUserInputEvent = false; + if (this.handled && cr.isCanvasInputEvent(info)) + info.preventDefault(); + }; + instanceProto.onWindowBlur = function () + { + var i, len; + for (i = 0, len = this.buttonMap.length; i < len; ++i) + { + if (!this.buttonMap[i]) + continue; + this.buttonMap[i] = false; + this.triggerButton = i - 1; + this.runtime.trigger(cr.plugins_.Mouse.prototype.cnds.OnRelease, this); + } + }; + function Cnds() {}; + Cnds.prototype.OnClick = function (button, type) + { + return button === this.triggerButton && type === this.triggerType; + }; + Cnds.prototype.OnAnyClick = function () + { + return true; + }; + Cnds.prototype.IsButtonDown = function (button) + { + return this.buttonMap[button + 1]; // jQuery uses 1-based buttons for some reason + }; + Cnds.prototype.OnRelease = function (button) + { + return button === this.triggerButton; + }; + Cnds.prototype.IsOverObject = function (obj) + { + var cnd = this.runtime.getCurrentCondition(); + var mx = this.mouseXcanvas; + var my = this.mouseYcanvas; + return cr.xor(this.runtime.testAndSelectCanvasPointOverlap(obj, mx, my, cnd.inverted), cnd.inverted); + }; + Cnds.prototype.OnObjectClicked = function (button, type, obj) + { + if (button !== this.triggerButton || type !== this.triggerType) + return false; // wrong click type + return this.runtime.testAndSelectCanvasPointOverlap(obj, this.mouseXcanvas, this.mouseYcanvas, false); + }; + Cnds.prototype.OnWheel = function (dir) + { + this.handled = true; + return dir === this.triggerDir; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + var lastSetCursor = null; + Acts.prototype.SetCursor = function (c) + { + if (this.runtime.isDomFree) + return; + var cursor_style = ["auto", "pointer", "text", "crosshair", "move", "help", "wait", "none"][c]; + if (lastSetCursor === cursor_style) + return; // redundant + lastSetCursor = cursor_style; + document.body.style.cursor = cursor_style; + }; + Acts.prototype.SetCursorSprite = function (obj) + { + if (this.runtime.isDomFree || this.runtime.isMobile || !obj) + return; + var inst = obj.getFirstPicked(); + if (!inst || !inst.curFrame) + return; + var frame = inst.curFrame; + if (lastSetCursor === frame) + return; // already set this frame + lastSetCursor = frame; + var datauri = frame.getDataUri(); + var cursor_style = "url(" + datauri + ") " + Math.round(frame.hotspotX * frame.width) + " " + Math.round(frame.hotspotY * frame.height) + ", auto"; + document.body.style.cursor = ""; + document.body.style.cursor = cursor_style; + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.X = function (ret, layerparam) + { + var layer, oldScale, oldZoomRate, oldParallaxX, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxX = layer.parallaxX; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxX = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.mouseXcanvas, this.mouseYcanvas, true)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxX = oldParallaxX; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.mouseXcanvas, this.mouseYcanvas, true)); + else + ret.set_float(0); + } + }; + Exps.prototype.Y = function (ret, layerparam) + { + var layer, oldScale, oldZoomRate, oldParallaxY, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxY = layer.parallaxY; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxY = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.mouseXcanvas, this.mouseYcanvas, false)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxY = oldParallaxY; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.mouseXcanvas, this.mouseYcanvas, false)); + else + ret.set_float(0); + } + }; + Exps.prototype.AbsoluteX = function (ret) + { + ret.set_float(this.mouseXcanvas); + }; + Exps.prototype.AbsoluteY = function (ret) + { + ret.set_float(this.mouseYcanvas); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Particles = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Particles.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + if (this.is_family) + return; + this.texture_img = new Image(); + this.texture_img.cr_filesize = this.texture_filesize; + this.webGL_texture = null; + this.runtime.waitForImageLoad(this.texture_img, this.texture_file); + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + this.webGL_texture = null; + }; + typeProto.onRestoreWebGLContext = function () + { + if (this.is_family || !this.instances.length) + return; + if (!this.webGL_texture) + { + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, true, this.runtime.linearSampling, this.texture_pixelformat); + } + }; + typeProto.loadTextures = function () + { + if (this.is_family || this.webGL_texture || !this.runtime.glwrap) + return; + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, true, this.runtime.linearSampling, this.texture_pixelformat); + }; + typeProto.unloadTextures = function () + { + if (this.is_family || this.instances.length || !this.webGL_texture) + return; + this.runtime.glwrap.deleteTexture(this.webGL_texture); + this.webGL_texture = null; + }; + typeProto.preloadCanvas2D = function (ctx) + { + ctx.drawImage(this.texture_img, 0, 0); + }; + function Particle(owner) + { + this.owner = owner; + this.active = false; + this.x = 0; + this.y = 0; + this.speed = 0; + this.angle = 0; + this.opacity = 1; + this.grow = 0; + this.size = 0; + this.gs = 0; // gravity speed + this.age = 0; + cr.seal(this); + }; + Particle.prototype.init = function () + { + var owner = this.owner; + this.x = owner.x - (owner.xrandom / 2) + (Math.random() * owner.xrandom); + this.y = owner.y - (owner.yrandom / 2) + (Math.random() * owner.yrandom); + this.speed = owner.initspeed - (owner.speedrandom / 2) + (Math.random() * owner.speedrandom); + this.angle = owner.angle - (owner.spraycone / 2) + (Math.random() * owner.spraycone); + this.opacity = owner.initopacity; + this.size = owner.initsize - (owner.sizerandom / 2) + (Math.random() * owner.sizerandom); + this.grow = owner.growrate - (owner.growrandom / 2) + (Math.random() * owner.growrandom); + this.gs = 0; + this.age = 0; + }; + Particle.prototype.tick = function (dt) + { + var owner = this.owner; + this.x += Math.cos(this.angle) * this.speed * dt; + this.y += Math.sin(this.angle) * this.speed * dt; + this.y += this.gs * dt; + this.speed += owner.acc * dt; + this.size += this.grow * dt; + this.gs += owner.g * dt; + this.age += dt; + if (this.size < 1) + { + this.active = false; + return; + } + if (owner.lifeanglerandom !== 0) + this.angle += (Math.random() * owner.lifeanglerandom * dt) - (owner.lifeanglerandom * dt / 2); + if (owner.lifespeedrandom !== 0) + this.speed += (Math.random() * owner.lifespeedrandom * dt) - (owner.lifespeedrandom * dt / 2); + if (owner.lifeopacityrandom !== 0) + { + this.opacity += (Math.random() * owner.lifeopacityrandom * dt) - (owner.lifeopacityrandom * dt / 2); + if (this.opacity < 0) + this.opacity = 0; + else if (this.opacity > 1) + this.opacity = 1; + } + if (owner.destroymode <= 1 && this.age >= owner.timeout) + { + this.active = false; + } + if (owner.destroymode === 2 && this.speed <= 0) + { + this.active = false; + } + }; + Particle.prototype.draw = function (ctx) + { + var curopacity = this.owner.opacity * this.opacity; + if (curopacity === 0) + return; + if (this.owner.destroymode === 0) + curopacity *= 1 - (this.age / this.owner.timeout); + ctx.globalAlpha = curopacity; + var drawx = this.x - this.size / 2; + var drawy = this.y - this.size / 2; + if (this.owner.runtime.pixel_rounding) + { + drawx = (drawx + 0.5) | 0; + drawy = (drawy + 0.5) | 0; + } + ctx.drawImage(this.owner.type.texture_img, drawx, drawy, this.size, this.size); + }; + Particle.prototype.drawGL = function (glw) + { + var curopacity = this.owner.opacity * this.opacity; + if (this.owner.destroymode === 0) + curopacity *= 1 - (this.age / this.owner.timeout); + var drawsize = this.size; + var scaleddrawsize = drawsize * this.owner.particlescale; + var drawx = this.x - drawsize / 2; + var drawy = this.y - drawsize / 2; + if (this.owner.runtime.pixel_rounding) + { + drawx = (drawx + 0.5) | 0; + drawy = (drawy + 0.5) | 0; + } + if (scaleddrawsize < 1 || curopacity === 0) + return; + if (scaleddrawsize < glw.minPointSize || scaleddrawsize > glw.maxPointSize) + { + glw.setOpacity(curopacity); + glw.quad(drawx, drawy, drawx + drawsize, drawy, drawx + drawsize, drawy + drawsize, drawx, drawy + drawsize); + } + else + glw.point(this.x, this.y, scaleddrawsize, curopacity); + }; + Particle.prototype.left = function () + { + return this.x - this.size / 2; + }; + Particle.prototype.right = function () + { + return this.x + this.size / 2; + }; + Particle.prototype.top = function () + { + return this.y - this.size / 2; + }; + Particle.prototype.bottom = function () + { + return this.y + this.size / 2; + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + var deadparticles = []; + instanceProto.onCreate = function() + { + var props = this.properties; + this.rate = props[0]; + this.spraycone = cr.to_radians(props[1]); + this.spraytype = props[2]; // 0 = continuous, 1 = one-shot + this.spraying = true; // for continuous mode only + this.initspeed = props[3]; + this.initsize = props[4]; + this.initopacity = props[5] / 100.0; + this.growrate = props[6]; + this.xrandom = props[7]; + this.yrandom = props[8]; + this.speedrandom = props[9]; + this.sizerandom = props[10]; + this.growrandom = props[11]; + this.acc = props[12]; + this.g = props[13]; + this.lifeanglerandom = props[14]; + this.lifespeedrandom = props[15]; + this.lifeopacityrandom = props[16]; + this.destroymode = props[17]; // 0 = fade, 1 = timeout, 2 = stopped + this.timeout = props[18]; + this.particleCreateCounter = 0; + this.particlescale = 1; + this.particleBoxLeft = this.x; + this.particleBoxTop = this.y; + this.particleBoxRight = this.x; + this.particleBoxBottom = this.y; + this.add_bbox_changed_callback(function (self) { + self.bbox.set(self.particleBoxLeft, self.particleBoxTop, self.particleBoxRight, self.particleBoxBottom); + self.bquad.set_from_rect(self.bbox); + self.bbox_changed = false; + self.update_collision_cell(); + self.update_render_cell(); + }); + if (!this.recycled) + this.particles = []; + this.runtime.tickMe(this); + this.type.loadTextures(); + if (this.spraytype === 1) + { + for (var i = 0; i < this.rate; i++) + this.allocateParticle().opacity = 0; + } + this.first_tick = true; // for re-init'ing one-shot particles on first tick so they assume any new angle/position + }; + instanceProto.saveToJSON = function () + { + var o = { + "r": this.rate, + "sc": this.spraycone, + "st": this.spraytype, + "s": this.spraying, + "isp": this.initspeed, + "isz": this.initsize, + "io": this.initopacity, + "gr": this.growrate, + "xr": this.xrandom, + "yr": this.yrandom, + "spr": this.speedrandom, + "szr": this.sizerandom, + "grnd": this.growrandom, + "acc": this.acc, + "g": this.g, + "lar": this.lifeanglerandom, + "lsr": this.lifespeedrandom, + "lor": this.lifeopacityrandom, + "dm": this.destroymode, + "to": this.timeout, + "pcc": this.particleCreateCounter, + "ft": this.first_tick, + "p": [] + }; + var i, len, p; + var arr = o["p"]; + for (i = 0, len = this.particles.length; i < len; i++) + { + p = this.particles[i]; + arr.push([p.x, p.y, p.speed, p.angle, p.opacity, p.grow, p.size, p.gs, p.age]); + } + return o; + }; + instanceProto.loadFromJSON = function (o) + { + this.rate = o["r"]; + this.spraycone = o["sc"]; + this.spraytype = o["st"]; + this.spraying = o["s"]; + this.initspeed = o["isp"]; + this.initsize = o["isz"]; + this.initopacity = o["io"]; + this.growrate = o["gr"]; + this.xrandom = o["xr"]; + this.yrandom = o["yr"]; + this.speedrandom = o["spr"]; + this.sizerandom = o["szr"]; + this.growrandom = o["grnd"]; + this.acc = o["acc"]; + this.g = o["g"]; + this.lifeanglerandom = o["lar"]; + this.lifespeedrandom = o["lsr"]; + this.lifeopacityrandom = o["lor"]; + this.destroymode = o["dm"]; + this.timeout = o["to"]; + this.particleCreateCounter = o["pcc"]; + this.first_tick = o["ft"]; + deadparticles.push.apply(deadparticles, this.particles); + cr.clearArray(this.particles); + var i, len, p, d; + var arr = o["p"]; + for (i = 0, len = arr.length; i < len; i++) + { + p = this.allocateParticle(); + d = arr[i]; + p.x = d[0]; + p.y = d[1]; + p.speed = d[2]; + p.angle = d[3]; + p.opacity = d[4]; + p.grow = d[5]; + p.size = d[6]; + p.gs = d[7]; + p.age = d[8]; + } + }; + instanceProto.onDestroy = function () + { + deadparticles.push.apply(deadparticles, this.particles); + cr.clearArray(this.particles); + }; + instanceProto.allocateParticle = function () + { + var p; + if (deadparticles.length) + { + p = deadparticles.pop(); + p.owner = this; + } + else + p = new Particle(this); + this.particles.push(p); + p.active = true; + return p; + }; + instanceProto.tick = function() + { + var dt = this.runtime.getDt(this); + var i, len, p, n, j; + if (this.spraytype === 0 && this.spraying) + { + this.particleCreateCounter += dt * this.rate; + n = cr.floor(this.particleCreateCounter); + this.particleCreateCounter -= n; + for (i = 0; i < n; i++) + { + p = this.allocateParticle(); + p.init(); + } + } + this.particleBoxLeft = this.x; + this.particleBoxTop = this.y; + this.particleBoxRight = this.x; + this.particleBoxBottom = this.y; + for (i = 0, j = 0, len = this.particles.length; i < len; i++) + { + p = this.particles[i]; + this.particles[j] = p; + this.runtime.redraw = true; + if (this.spraytype === 1 && this.first_tick) + p.init(); + p.tick(dt); + if (!p.active) + { + deadparticles.push(p); + continue; + } + if (p.left() < this.particleBoxLeft) + this.particleBoxLeft = p.left(); + if (p.right() > this.particleBoxRight) + this.particleBoxRight = p.right(); + if (p.top() < this.particleBoxTop) + this.particleBoxTop = p.top(); + if (p.bottom() > this.particleBoxBottom) + this.particleBoxBottom = p.bottom(); + j++; + } + cr.truncateArray(this.particles, j); + this.set_bbox_changed(); + this.first_tick = false; + if (this.spraytype === 1 && this.particles.length === 0) + this.runtime.DestroyInstance(this); + }; + instanceProto.draw = function (ctx) + { + var i, len, p, layer = this.layer; + for (i = 0, len = this.particles.length; i < len; i++) + { + p = this.particles[i]; + if (p.right() >= layer.viewLeft && p.bottom() >= layer.viewTop && p.left() <= layer.viewRight && p.top() <= layer.viewBottom) + { + p.draw(ctx); + } + } + }; + instanceProto.drawGL = function (glw) + { + this.particlescale = this.layer.getScale(); + glw.setTexture(this.type.webGL_texture); + var i, len, p, layer = this.layer; + for (i = 0, len = this.particles.length; i < len; i++) + { + p = this.particles[i]; + if (p.right() >= layer.viewLeft && p.bottom() >= layer.viewTop && p.left() <= layer.viewRight && p.top() <= layer.viewBottom) + { + p.drawGL(glw); + } + } + }; + function Cnds() {}; + Cnds.prototype.IsSpraying = function () + { + return this.spraying; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetSpraying = function (set_) + { + this.spraying = (set_ !== 0); + }; + Acts.prototype.SetEffect = function (effect) + { + this.blend_mode = effect; + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + Acts.prototype.SetRate = function (x) + { + this.rate = x; + var diff, i; + if (this.spraytype === 1 && this.first_tick) + { + if (x < this.particles.length) + { + diff = this.particles.length - x; + for (i = 0; i < diff; i++) + deadparticles.push(this.particles.pop()); + } + else if (x > this.particles.length) + { + diff = x - this.particles.length; + for (i = 0; i < diff; i++) + this.allocateParticle().opacity = 0; + } + } + }; + Acts.prototype.SetSprayCone = function (x) + { + this.spraycone = cr.to_radians(x); + }; + Acts.prototype.SetInitSpeed = function (x) + { + this.initspeed = x; + }; + Acts.prototype.SetInitSize = function (x) + { + this.initsize = x; + }; + Acts.prototype.SetInitOpacity = function (x) + { + this.initopacity = x / 100; + }; + Acts.prototype.SetGrowRate = function (x) + { + this.growrate = x; + }; + Acts.prototype.SetXRandomiser = function (x) + { + this.xrandom = x; + }; + Acts.prototype.SetYRandomiser = function (x) + { + this.yrandom = x; + }; + Acts.prototype.SetSpeedRandomiser = function (x) + { + this.speedrandom = x; + }; + Acts.prototype.SetSizeRandomiser = function (x) + { + this.sizerandom = x; + }; + Acts.prototype.SetGrowRateRandomiser = function (x) + { + this.growrandom = x; + }; + Acts.prototype.SetParticleAcc = function (x) + { + this.acc = x; + }; + Acts.prototype.SetGravity = function (x) + { + this.g = x; + }; + Acts.prototype.SetAngleRandomiser = function (x) + { + this.lifeanglerandom = x; + }; + Acts.prototype.SetLifeSpeedRandomiser = function (x) + { + this.lifespeedrandom = x; + }; + Acts.prototype.SetOpacityRandomiser = function (x) + { + this.lifeopacityrandom = x; + }; + Acts.prototype.SetTimeout = function (x) + { + this.timeout = x; + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.ParticleCount = function (ret) + { + ret.set_int(this.particles.length); + }; + Exps.prototype.Rate = function (ret) + { + ret.set_float(this.rate); + }; + Exps.prototype.SprayCone = function (ret) + { + ret.set_float(cr.to_degrees(this.spraycone)); + }; + Exps.prototype.InitSpeed = function (ret) + { + ret.set_float(this.initspeed); + }; + Exps.prototype.InitSize = function (ret) + { + ret.set_float(this.initsize); + }; + Exps.prototype.InitOpacity = function (ret) + { + ret.set_float(this.initopacity * 100); + }; + Exps.prototype.InitGrowRate = function (ret) + { + ret.set_float(this.growrate); + }; + Exps.prototype.XRandom = function (ret) + { + ret.set_float(this.xrandom); + }; + Exps.prototype.YRandom = function (ret) + { + ret.set_float(this.yrandom); + }; + Exps.prototype.InitSpeedRandom = function (ret) + { + ret.set_float(this.speedrandom); + }; + Exps.prototype.InitSizeRandom = function (ret) + { + ret.set_float(this.sizerandom); + }; + Exps.prototype.InitGrowRandom = function (ret) + { + ret.set_float(this.growrandom); + }; + Exps.prototype.ParticleAcceleration = function (ret) + { + ret.set_float(this.acc); + }; + Exps.prototype.Gravity = function (ret) + { + ret.set_float(this.g); + }; + Exps.prototype.ParticleAngleRandom = function (ret) + { + ret.set_float(this.lifeanglerandom); + }; + Exps.prototype.ParticleSpeedRandom = function (ret) + { + ret.set_float(this.lifespeedrandom); + }; + Exps.prototype.ParticleOpacityRandom = function (ret) + { + ret.set_float(this.lifeopacityrandom); + }; + Exps.prototype.Timeout = function (ret) + { + ret.set_float(this.timeout); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Sprite = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Sprite.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + function frame_getDataUri() + { + if (this.datauri.length === 0) + { + var tmpcanvas = document.createElement("canvas"); + tmpcanvas.width = this.width; + tmpcanvas.height = this.height; + var tmpctx = tmpcanvas.getContext("2d"); + if (this.spritesheeted) + { + tmpctx.drawImage(this.texture_img, this.offx, this.offy, this.width, this.height, + 0, 0, this.width, this.height); + } + else + { + tmpctx.drawImage(this.texture_img, 0, 0, this.width, this.height); + } + this.datauri = tmpcanvas.toDataURL("image/png"); + } + return this.datauri; + }; + typeProto.onCreate = function() + { + if (this.is_family) + return; + var i, leni, j, lenj; + var anim, frame, animobj, frameobj, wt, uv; + this.all_frames = []; + this.has_loaded_textures = false; + for (i = 0, leni = this.animations.length; i < leni; i++) + { + anim = this.animations[i]; + animobj = {}; + animobj.name = anim[0]; + animobj.speed = anim[1]; + animobj.loop = anim[2]; + animobj.repeatcount = anim[3]; + animobj.repeatto = anim[4]; + animobj.pingpong = anim[5]; + animobj.sid = anim[6]; + animobj.frames = []; + for (j = 0, lenj = anim[7].length; j < lenj; j++) + { + frame = anim[7][j]; + frameobj = {}; + frameobj.texture_file = frame[0]; + frameobj.texture_filesize = frame[1]; + frameobj.offx = frame[2]; + frameobj.offy = frame[3]; + frameobj.width = frame[4]; + frameobj.height = frame[5]; + frameobj.duration = frame[6]; + frameobj.hotspotX = frame[7]; + frameobj.hotspotY = frame[8]; + frameobj.image_points = frame[9]; + frameobj.poly_pts = frame[10]; + frameobj.pixelformat = frame[11]; + frameobj.spritesheeted = (frameobj.width !== 0); + frameobj.datauri = ""; // generated on demand and cached + frameobj.getDataUri = frame_getDataUri; + uv = {}; + uv.left = 0; + uv.top = 0; + uv.right = 1; + uv.bottom = 1; + frameobj.sheetTex = uv; + frameobj.webGL_texture = null; + wt = this.runtime.findWaitingTexture(frame[0]); + if (wt) + { + frameobj.texture_img = wt; + } + else + { + frameobj.texture_img = new Image(); + frameobj.texture_img.cr_src = frame[0]; + frameobj.texture_img.cr_filesize = frame[1]; + frameobj.texture_img.c2webGL_texture = null; + this.runtime.waitForImageLoad(frameobj.texture_img, frame[0]); + } + cr.seal(frameobj); + animobj.frames.push(frameobj); + this.all_frames.push(frameobj); + } + cr.seal(animobj); + this.animations[i] = animobj; // swap array data for object + } + }; + typeProto.updateAllCurrentTexture = function () + { + var i, len, inst; + for (i = 0, len = this.instances.length; i < len; i++) + { + inst = this.instances[i]; + inst.curWebGLTexture = inst.curFrame.webGL_texture; + } + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + var i, len, frame; + for (i = 0, len = this.all_frames.length; i < len; ++i) + { + frame = this.all_frames[i]; + frame.texture_img.c2webGL_texture = null; + frame.webGL_texture = null; + } + this.has_loaded_textures = false; + this.updateAllCurrentTexture(); + }; + typeProto.onRestoreWebGLContext = function () + { + if (this.is_family || !this.instances.length) + return; + var i, len, frame; + for (i = 0, len = this.all_frames.length; i < len; ++i) + { + frame = this.all_frames[i]; + frame.webGL_texture = this.runtime.glwrap.loadTexture(frame.texture_img, false, this.runtime.linearSampling, frame.pixelformat); + } + this.updateAllCurrentTexture(); + }; + typeProto.loadTextures = function () + { + if (this.is_family || this.has_loaded_textures || !this.runtime.glwrap) + return; + var i, len, frame; + for (i = 0, len = this.all_frames.length; i < len; ++i) + { + frame = this.all_frames[i]; + frame.webGL_texture = this.runtime.glwrap.loadTexture(frame.texture_img, false, this.runtime.linearSampling, frame.pixelformat); + } + this.has_loaded_textures = true; + }; + typeProto.unloadTextures = function () + { + if (this.is_family || this.instances.length || !this.has_loaded_textures) + return; + var i, len, frame; + for (i = 0, len = this.all_frames.length; i < len; ++i) + { + frame = this.all_frames[i]; + this.runtime.glwrap.deleteTexture(frame.webGL_texture); + frame.webGL_texture = null; + } + this.has_loaded_textures = false; + }; + var already_drawn_images = []; + typeProto.preloadCanvas2D = function (ctx) + { + var i, len, frameimg; + cr.clearArray(already_drawn_images); + for (i = 0, len = this.all_frames.length; i < len; ++i) + { + frameimg = this.all_frames[i].texture_img; + if (already_drawn_images.indexOf(frameimg) !== -1) + continue; + ctx.drawImage(frameimg, 0, 0); + already_drawn_images.push(frameimg); + } + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + var poly_pts = this.type.animations[0].frames[0].poly_pts; + if (this.recycled) + this.collision_poly.set_pts(poly_pts); + else + this.collision_poly = new cr.CollisionPoly(poly_pts); + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + this.visible = (this.properties[0] === 0); // 0=visible, 1=invisible + this.isTicking = false; + this.inAnimTrigger = false; + this.collisionsEnabled = (this.properties[3] !== 0); + this.cur_animation = this.getAnimationByName(this.properties[1]) || this.type.animations[0]; + this.cur_frame = this.properties[2]; + if (this.cur_frame < 0) + this.cur_frame = 0; + if (this.cur_frame >= this.cur_animation.frames.length) + this.cur_frame = this.cur_animation.frames.length - 1; + var curanimframe = this.cur_animation.frames[this.cur_frame]; + this.collision_poly.set_pts(curanimframe.poly_pts); + this.hotspotX = curanimframe.hotspotX; + this.hotspotY = curanimframe.hotspotY; + this.cur_anim_speed = this.cur_animation.speed; + this.cur_anim_repeatto = this.cur_animation.repeatto; + if (!(this.type.animations.length === 1 && this.type.animations[0].frames.length === 1) && this.cur_anim_speed !== 0) + { + this.runtime.tickMe(this); + this.isTicking = true; + } + if (this.recycled) + this.animTimer.reset(); + else + this.animTimer = new cr.KahanAdder(); + this.frameStart = this.getNowTime(); + this.animPlaying = true; + this.animRepeats = 0; + this.animForwards = true; + this.animTriggerName = ""; + this.changeAnimName = ""; + this.changeAnimFrom = 0; + this.changeAnimFrame = -1; + this.type.loadTextures(); + var i, leni, j, lenj; + var anim, frame, uv, maintex; + for (i = 0, leni = this.type.animations.length; i < leni; i++) + { + anim = this.type.animations[i]; + for (j = 0, lenj = anim.frames.length; j < lenj; j++) + { + frame = anim.frames[j]; + if (frame.width === 0) + { + frame.width = frame.texture_img.width; + frame.height = frame.texture_img.height; + } + if (frame.spritesheeted) + { + maintex = frame.texture_img; + uv = frame.sheetTex; + uv.left = frame.offx / maintex.width; + uv.top = frame.offy / maintex.height; + uv.right = (frame.offx + frame.width) / maintex.width; + uv.bottom = (frame.offy + frame.height) / maintex.height; + if (frame.offx === 0 && frame.offy === 0 && frame.width === maintex.width && frame.height === maintex.height) + { + frame.spritesheeted = false; + } + } + } + } + this.curFrame = this.cur_animation.frames[this.cur_frame]; + this.curWebGLTexture = this.curFrame.webGL_texture; + }; + instanceProto.saveToJSON = function () + { + var o = { + "a": this.cur_animation.sid, + "f": this.cur_frame, + "cas": this.cur_anim_speed, + "fs": this.frameStart, + "ar": this.animRepeats, + "at": this.animTimer.sum, + "rt": this.cur_anim_repeatto + }; + if (!this.animPlaying) + o["ap"] = this.animPlaying; + if (!this.animForwards) + o["af"] = this.animForwards; + return o; + }; + instanceProto.loadFromJSON = function (o) + { + var anim = this.getAnimationBySid(o["a"]); + if (anim) + this.cur_animation = anim; + this.cur_frame = o["f"]; + if (this.cur_frame < 0) + this.cur_frame = 0; + if (this.cur_frame >= this.cur_animation.frames.length) + this.cur_frame = this.cur_animation.frames.length - 1; + this.cur_anim_speed = o["cas"]; + this.frameStart = o["fs"]; + this.animRepeats = o["ar"]; + this.animTimer.reset(); + this.animTimer.sum = o["at"]; + this.animPlaying = o.hasOwnProperty("ap") ? o["ap"] : true; + this.animForwards = o.hasOwnProperty("af") ? o["af"] : true; + if (o.hasOwnProperty("rt")) + this.cur_anim_repeatto = o["rt"]; + else + this.cur_anim_repeatto = this.cur_animation.repeatto; + this.curFrame = this.cur_animation.frames[this.cur_frame]; + this.curWebGLTexture = this.curFrame.webGL_texture; + this.collision_poly.set_pts(this.curFrame.poly_pts); + this.hotspotX = this.curFrame.hotspotX; + this.hotspotY = this.curFrame.hotspotY; + }; + instanceProto.animationFinish = function (reverse) + { + this.cur_frame = reverse ? 0 : this.cur_animation.frames.length - 1; + this.animPlaying = false; + this.animTriggerName = this.cur_animation.name; + this.inAnimTrigger = true; + this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnAnyAnimFinished, this); + this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnAnimFinished, this); + this.inAnimTrigger = false; + this.animRepeats = 0; + }; + instanceProto.getNowTime = function() + { + return this.animTimer.sum; + }; + instanceProto.tick = function() + { + this.animTimer.add(this.runtime.getDt(this)); + if (this.changeAnimName.length) + this.doChangeAnim(); + if (this.changeAnimFrame >= 0) + this.doChangeAnimFrame(); + var now = this.getNowTime(); + var cur_animation = this.cur_animation; + var prev_frame = cur_animation.frames[this.cur_frame]; + var next_frame; + var cur_frame_time = prev_frame.duration / this.cur_anim_speed; + if (this.animPlaying && now >= this.frameStart + cur_frame_time) + { + if (this.animForwards) + { + this.cur_frame++; + } + else + { + this.cur_frame--; + } + this.frameStart += cur_frame_time; + if (this.cur_frame >= cur_animation.frames.length) + { + if (cur_animation.pingpong) + { + this.animForwards = false; + this.cur_frame = cur_animation.frames.length - 2; + } + else if (cur_animation.loop) + { + this.cur_frame = this.cur_anim_repeatto; + } + else + { + this.animRepeats++; + if (this.animRepeats >= cur_animation.repeatcount) + { + this.animationFinish(false); + } + else + { + this.cur_frame = this.cur_anim_repeatto; + } + } + } + if (this.cur_frame < 0) + { + if (cur_animation.pingpong) + { + this.cur_frame = 1; + this.animForwards = true; + if (!cur_animation.loop) + { + this.animRepeats++; + if (this.animRepeats >= cur_animation.repeatcount) + { + this.animationFinish(true); + } + } + } + else + { + if (cur_animation.loop) + { + this.cur_frame = this.cur_anim_repeatto; + } + else + { + this.animRepeats++; + if (this.animRepeats >= cur_animation.repeatcount) + { + this.animationFinish(true); + } + else + { + this.cur_frame = this.cur_anim_repeatto; + } + } + } + } + if (this.cur_frame < 0) + this.cur_frame = 0; + else if (this.cur_frame >= cur_animation.frames.length) + this.cur_frame = cur_animation.frames.length - 1; + if (now > this.frameStart + (cur_animation.frames[this.cur_frame].duration / this.cur_anim_speed)) + { + this.frameStart = now; + } + next_frame = cur_animation.frames[this.cur_frame]; + this.OnFrameChanged(prev_frame, next_frame); + this.runtime.redraw = true; + } + }; + instanceProto.getAnimationByName = function (name_) + { + var i, len, a; + for (i = 0, len = this.type.animations.length; i < len; i++) + { + a = this.type.animations[i]; + if (cr.equals_nocase(a.name, name_)) + return a; + } + return null; + }; + instanceProto.getAnimationBySid = function (sid_) + { + var i, len, a; + for (i = 0, len = this.type.animations.length; i < len; i++) + { + a = this.type.animations[i]; + if (a.sid === sid_) + return a; + } + return null; + }; + instanceProto.doChangeAnim = function () + { + var prev_frame = this.cur_animation.frames[this.cur_frame]; + var anim = this.getAnimationByName(this.changeAnimName); + this.changeAnimName = ""; + if (!anim) + return; + if (cr.equals_nocase(anim.name, this.cur_animation.name) && this.animPlaying) + return; + this.cur_animation = anim; + this.cur_anim_speed = anim.speed; + this.cur_anim_repeatto = anim.repeatto; + if (this.cur_frame < 0) + this.cur_frame = 0; + if (this.cur_frame >= this.cur_animation.frames.length) + this.cur_frame = this.cur_animation.frames.length - 1; + if (this.changeAnimFrom === 1) + this.cur_frame = 0; + this.animPlaying = true; + this.frameStart = this.getNowTime(); + this.animForwards = true; + this.OnFrameChanged(prev_frame, this.cur_animation.frames[this.cur_frame]); + this.runtime.redraw = true; + }; + instanceProto.doChangeAnimFrame = function () + { + var prev_frame = this.cur_animation.frames[this.cur_frame]; + var prev_frame_number = this.cur_frame; + this.cur_frame = cr.floor(this.changeAnimFrame); + if (this.cur_frame < 0) + this.cur_frame = 0; + if (this.cur_frame >= this.cur_animation.frames.length) + this.cur_frame = this.cur_animation.frames.length - 1; + if (prev_frame_number !== this.cur_frame) + { + this.OnFrameChanged(prev_frame, this.cur_animation.frames[this.cur_frame]); + this.frameStart = this.getNowTime(); + this.runtime.redraw = true; + } + this.changeAnimFrame = -1; + }; + instanceProto.OnFrameChanged = function (prev_frame, next_frame) + { + var oldw = prev_frame.width; + var oldh = prev_frame.height; + var neww = next_frame.width; + var newh = next_frame.height; + if (oldw != neww) + this.width *= (neww / oldw); + if (oldh != newh) + this.height *= (newh / oldh); + this.hotspotX = next_frame.hotspotX; + this.hotspotY = next_frame.hotspotY; + this.collision_poly.set_pts(next_frame.poly_pts); + this.set_bbox_changed(); + this.curFrame = next_frame; + this.curWebGLTexture = next_frame.webGL_texture; + var i, len, b; + for (i = 0, len = this.behavior_insts.length; i < len; i++) + { + b = this.behavior_insts[i]; + if (b.onSpriteFrameChanged) + b.onSpriteFrameChanged(prev_frame, next_frame); + } + this.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnFrameChanged, this); + }; + instanceProto.draw = function(ctx) + { + ctx.globalAlpha = this.opacity; + var cur_frame = this.curFrame; + var spritesheeted = cur_frame.spritesheeted; + var cur_image = cur_frame.texture_img; + var myx = this.x; + var myy = this.y; + var w = this.width; + var h = this.height; + if (this.angle === 0 && w >= 0 && h >= 0) + { + myx -= this.hotspotX * w; + myy -= this.hotspotY * h; + if (this.runtime.pixel_rounding) + { + myx = Math.round(myx); + myy = Math.round(myy); + } + if (spritesheeted) + { + ctx.drawImage(cur_image, cur_frame.offx, cur_frame.offy, cur_frame.width, cur_frame.height, + myx, myy, w, h); + } + else + { + ctx.drawImage(cur_image, myx, myy, w, h); + } + } + else + { + if (this.runtime.pixel_rounding) + { + myx = Math.round(myx); + myy = Math.round(myy); + } + ctx.save(); + var widthfactor = w > 0 ? 1 : -1; + var heightfactor = h > 0 ? 1 : -1; + ctx.translate(myx, myy); + if (widthfactor !== 1 || heightfactor !== 1) + ctx.scale(widthfactor, heightfactor); + ctx.rotate(this.angle * widthfactor * heightfactor); + var drawx = 0 - (this.hotspotX * cr.abs(w)) + var drawy = 0 - (this.hotspotY * cr.abs(h)); + if (spritesheeted) + { + ctx.drawImage(cur_image, cur_frame.offx, cur_frame.offy, cur_frame.width, cur_frame.height, + drawx, drawy, cr.abs(w), cr.abs(h)); + } + else + { + ctx.drawImage(cur_image, drawx, drawy, cr.abs(w), cr.abs(h)); + } + ctx.restore(); + } + /* + ctx.strokeStyle = "#f00"; + ctx.lineWidth = 3; + ctx.beginPath(); + this.collision_poly.cache_poly(this.width, this.height, this.angle); + var i, len, ax, ay, bx, by; + for (i = 0, len = this.collision_poly.pts_count; i < len; i++) + { + ax = this.collision_poly.pts_cache[i*2] + this.x; + ay = this.collision_poly.pts_cache[i*2+1] + this.y; + bx = this.collision_poly.pts_cache[((i+1)%len)*2] + this.x; + by = this.collision_poly.pts_cache[((i+1)%len)*2+1] + this.y; + ctx.moveTo(ax, ay); + ctx.lineTo(bx, by); + } + ctx.stroke(); + ctx.closePath(); + */ + /* + if (this.behavior_insts.length >= 1 && this.behavior_insts[0].draw) + { + this.behavior_insts[0].draw(ctx); + } + */ + }; + instanceProto.drawGL_earlyZPass = function(glw) + { + this.drawGL(glw); + }; + instanceProto.drawGL = function(glw) + { + glw.setTexture(this.curWebGLTexture); + glw.setOpacity(this.opacity); + var cur_frame = this.curFrame; + var q = this.bquad; + if (this.runtime.pixel_rounding) + { + var ox = Math.round(this.x) - this.x; + var oy = Math.round(this.y) - this.y; + if (cur_frame.spritesheeted) + glw.quadTex(q.tlx + ox, q.tly + oy, q.trx + ox, q.try_ + oy, q.brx + ox, q.bry + oy, q.blx + ox, q.bly + oy, cur_frame.sheetTex); + else + glw.quad(q.tlx + ox, q.tly + oy, q.trx + ox, q.try_ + oy, q.brx + ox, q.bry + oy, q.blx + ox, q.bly + oy); + } + else + { + if (cur_frame.spritesheeted) + glw.quadTex(q.tlx, q.tly, q.trx, q.try_, q.brx, q.bry, q.blx, q.bly, cur_frame.sheetTex); + else + glw.quad(q.tlx, q.tly, q.trx, q.try_, q.brx, q.bry, q.blx, q.bly); + } + }; + instanceProto.getImagePointIndexByName = function(name_) + { + var cur_frame = this.curFrame; + var i, len; + for (i = 0, len = cur_frame.image_points.length; i < len; i++) + { + if (cr.equals_nocase(name_, cur_frame.image_points[i][0])) + return i; + } + return -1; + }; + instanceProto.getImagePoint = function(imgpt, getX) + { + var cur_frame = this.curFrame; + var image_points = cur_frame.image_points; + var index; + if (cr.is_string(imgpt)) + index = this.getImagePointIndexByName(imgpt); + else + index = imgpt - 1; // 0 is origin + index = cr.floor(index); + if (index < 0 || index >= image_points.length) + return getX ? this.x : this.y; // return origin + var x = (image_points[index][1] - cur_frame.hotspotX) * this.width; + var y = image_points[index][2]; + y = (y - cur_frame.hotspotY) * this.height; + var cosa = Math.cos(this.angle); + var sina = Math.sin(this.angle); + var x_temp = (x * cosa) - (y * sina); + y = (y * cosa) + (x * sina); + x = x_temp; + x += this.x; + y += this.y; + return getX ? x : y; + }; + function Cnds() {}; + var arrCache = []; + function allocArr() + { + if (arrCache.length) + return arrCache.pop(); + else + return [0, 0, 0]; + }; + function freeArr(a) + { + a[0] = 0; + a[1] = 0; + a[2] = 0; + arrCache.push(a); + }; + function makeCollKey(a, b) + { + if (a < b) + return "" + a + "," + b; + else + return "" + b + "," + a; + }; + function collmemory_add(collmemory, a, b, tickcount) + { + var a_uid = a.uid; + var b_uid = b.uid; + var key = makeCollKey(a_uid, b_uid); + if (collmemory.hasOwnProperty(key)) + { + collmemory[key][2] = tickcount; + return; + } + var arr = allocArr(); + arr[0] = a_uid; + arr[1] = b_uid; + arr[2] = tickcount; + collmemory[key] = arr; + }; + function collmemory_remove(collmemory, a, b) + { + var key = makeCollKey(a.uid, b.uid); + if (collmemory.hasOwnProperty(key)) + { + freeArr(collmemory[key]); + delete collmemory[key]; + } + }; + function collmemory_removeInstance(collmemory, inst) + { + var uid = inst.uid; + var p, entry; + for (p in collmemory) + { + if (collmemory.hasOwnProperty(p)) + { + entry = collmemory[p]; + if (entry[0] === uid || entry[1] === uid) + { + freeArr(collmemory[p]); + delete collmemory[p]; + } + } + } + }; + var last_coll_tickcount = -2; + function collmemory_has(collmemory, a, b) + { + var key = makeCollKey(a.uid, b.uid); + if (collmemory.hasOwnProperty(key)) + { + last_coll_tickcount = collmemory[key][2]; + return true; + } + else + { + last_coll_tickcount = -2; + return false; + } + }; + var candidates1 = []; + Cnds.prototype.OnCollision = function (rtype) + { + if (!rtype) + return false; + var runtime = this.runtime; + var cnd = runtime.getCurrentCondition(); + var ltype = cnd.type; + var collmemory = null; + if (cnd.extra["collmemory"]) + { + collmemory = cnd.extra["collmemory"]; + } + else + { + collmemory = {}; + cnd.extra["collmemory"] = collmemory; + } + if (!cnd.extra["spriteCreatedDestroyCallback"]) + { + cnd.extra["spriteCreatedDestroyCallback"] = true; + runtime.addDestroyCallback(function(inst) { + collmemory_removeInstance(cnd.extra["collmemory"], inst); + }); + } + var lsol = ltype.getCurrentSol(); + var rsol = rtype.getCurrentSol(); + var linstances = lsol.getObjects(); + var rinstances; + var l, linst, r, rinst; + var curlsol, currsol; + var tickcount = this.runtime.tickcount; + var lasttickcount = tickcount - 1; + var exists, run; + var current_event = runtime.getCurrentEventStack().current_event; + var orblock = current_event.orblock; + for (l = 0; l < linstances.length; l++) + { + linst = linstances[l]; + if (rsol.select_all) + { + linst.update_bbox(); + this.runtime.getCollisionCandidates(linst.layer, rtype, linst.bbox, candidates1); + rinstances = candidates1; + } + else + rinstances = rsol.getObjects(); + for (r = 0; r < rinstances.length; r++) + { + rinst = rinstances[r]; + if (runtime.testOverlap(linst, rinst) || runtime.checkRegisteredCollision(linst, rinst)) + { + exists = collmemory_has(collmemory, linst, rinst); + run = (!exists || (last_coll_tickcount < lasttickcount)); + collmemory_add(collmemory, linst, rinst, tickcount); + if (run) + { + runtime.pushCopySol(current_event.solModifiers); + curlsol = ltype.getCurrentSol(); + currsol = rtype.getCurrentSol(); + curlsol.select_all = false; + currsol.select_all = false; + if (ltype === rtype) + { + curlsol.instances.length = 2; // just use lsol, is same reference as rsol + curlsol.instances[0] = linst; + curlsol.instances[1] = rinst; + ltype.applySolToContainer(); + } + else + { + curlsol.instances.length = 1; + currsol.instances.length = 1; + curlsol.instances[0] = linst; + currsol.instances[0] = rinst; + ltype.applySolToContainer(); + rtype.applySolToContainer(); + } + current_event.retrigger(); + runtime.popSol(current_event.solModifiers); + } + } + else + { + collmemory_remove(collmemory, linst, rinst); + } + } + cr.clearArray(candidates1); + } + return false; + }; + var rpicktype = null; + var rtopick = new cr.ObjectSet(); + var needscollisionfinish = false; + var candidates2 = []; + var temp_bbox = new cr.rect(0, 0, 0, 0); + function DoOverlapCondition(rtype, offx, offy) + { + if (!rtype) + return false; + var do_offset = (offx !== 0 || offy !== 0); + var oldx, oldy, ret = false, r, lenr, rinst; + var cnd = this.runtime.getCurrentCondition(); + var ltype = cnd.type; + var inverted = cnd.inverted; + var rsol = rtype.getCurrentSol(); + var orblock = this.runtime.getCurrentEventStack().current_event.orblock; + var rinstances; + if (rsol.select_all) + { + this.update_bbox(); + temp_bbox.copy(this.bbox); + temp_bbox.offset(offx, offy); + this.runtime.getCollisionCandidates(this.layer, rtype, temp_bbox, candidates2); + rinstances = candidates2; + } + else if (orblock) + { + if (this.runtime.isCurrentConditionFirst() && !rsol.else_instances.length && rsol.instances.length) + rinstances = rsol.instances; + else + rinstances = rsol.else_instances; + } + else + { + rinstances = rsol.instances; + } + rpicktype = rtype; + needscollisionfinish = (ltype !== rtype && !inverted); + if (do_offset) + { + oldx = this.x; + oldy = this.y; + this.x += offx; + this.y += offy; + this.set_bbox_changed(); + } + for (r = 0, lenr = rinstances.length; r < lenr; r++) + { + rinst = rinstances[r]; + if (this.runtime.testOverlap(this, rinst)) + { + ret = true; + if (inverted) + break; + if (ltype !== rtype) + rtopick.add(rinst); + } + } + if (do_offset) + { + this.x = oldx; + this.y = oldy; + this.set_bbox_changed(); + } + cr.clearArray(candidates2); + return ret; + }; + typeProto.finish = function (do_pick) + { + if (!needscollisionfinish) + return; + if (do_pick) + { + var orblock = this.runtime.getCurrentEventStack().current_event.orblock; + var sol = rpicktype.getCurrentSol(); + var topick = rtopick.valuesRef(); + var i, len, inst; + if (sol.select_all) + { + sol.select_all = false; + cr.clearArray(sol.instances); + for (i = 0, len = topick.length; i < len; ++i) + { + sol.instances[i] = topick[i]; + } + if (orblock) + { + cr.clearArray(sol.else_instances); + for (i = 0, len = rpicktype.instances.length; i < len; ++i) + { + inst = rpicktype.instances[i]; + if (!rtopick.contains(inst)) + sol.else_instances.push(inst); + } + } + } + else + { + if (orblock) + { + var initsize = sol.instances.length; + for (i = 0, len = topick.length; i < len; ++i) + { + sol.instances[initsize + i] = topick[i]; + cr.arrayFindRemove(sol.else_instances, topick[i]); + } + } + else + { + cr.shallowAssignArray(sol.instances, topick); + } + } + rpicktype.applySolToContainer(); + } + rtopick.clear(); + needscollisionfinish = false; + }; + Cnds.prototype.IsOverlapping = function (rtype) + { + return DoOverlapCondition.call(this, rtype, 0, 0); + }; + Cnds.prototype.IsOverlappingOffset = function (rtype, offx, offy) + { + return DoOverlapCondition.call(this, rtype, offx, offy); + }; + Cnds.prototype.IsAnimPlaying = function (animname) + { + if (this.changeAnimName.length) + return cr.equals_nocase(this.changeAnimName, animname); + else + return cr.equals_nocase(this.cur_animation.name, animname); + }; + Cnds.prototype.CompareFrame = function (cmp, framenum) + { + return cr.do_cmp(this.cur_frame, cmp, framenum); + }; + Cnds.prototype.CompareAnimSpeed = function (cmp, x) + { + var s = (this.animForwards ? this.cur_anim_speed : -this.cur_anim_speed); + return cr.do_cmp(s, cmp, x); + }; + Cnds.prototype.OnAnimFinished = function (animname) + { + return cr.equals_nocase(this.animTriggerName, animname); + }; + Cnds.prototype.OnAnyAnimFinished = function () + { + return true; + }; + Cnds.prototype.OnFrameChanged = function () + { + return true; + }; + Cnds.prototype.IsMirrored = function () + { + return this.width < 0; + }; + Cnds.prototype.IsFlipped = function () + { + return this.height < 0; + }; + Cnds.prototype.OnURLLoaded = function () + { + return true; + }; + Cnds.prototype.IsCollisionEnabled = function () + { + return this.collisionsEnabled; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Spawn = function (obj, layer, imgpt) + { + if (!obj || !layer) + return; + var inst = this.runtime.createInstance(obj, layer, this.getImagePoint(imgpt, true), this.getImagePoint(imgpt, false)); + if (!inst) + return; + if (typeof inst.angle !== "undefined") + { + inst.angle = this.angle; + inst.set_bbox_changed(); + } + this.runtime.isInOnDestroy++; + var i, len, s; + this.runtime.trigger(Object.getPrototypeOf(obj.plugin).cnds.OnCreated, inst); + if (inst.is_contained) + { + for (i = 0, len = inst.siblings.length; i < len; i++) + { + s = inst.siblings[i]; + this.runtime.trigger(Object.getPrototypeOf(s.type.plugin).cnds.OnCreated, s); + } + } + this.runtime.isInOnDestroy--; + var cur_act = this.runtime.getCurrentAction(); + var reset_sol = false; + if (cr.is_undefined(cur_act.extra["Spawn_LastExec"]) || cur_act.extra["Spawn_LastExec"] < this.runtime.execcount) + { + reset_sol = true; + cur_act.extra["Spawn_LastExec"] = this.runtime.execcount; + } + var sol; + if (obj != this.type) + { + sol = obj.getCurrentSol(); + sol.select_all = false; + if (reset_sol) + { + cr.clearArray(sol.instances); + sol.instances[0] = inst; + } + else + sol.instances.push(inst); + if (inst.is_contained) + { + for (i = 0, len = inst.siblings.length; i < len; i++) + { + s = inst.siblings[i]; + sol = s.type.getCurrentSol(); + sol.select_all = false; + if (reset_sol) + { + cr.clearArray(sol.instances); + sol.instances[0] = s; + } + else + sol.instances.push(s); + } + } + } + }; + Acts.prototype.SetEffect = function (effect) + { + this.blend_mode = effect; + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + Acts.prototype.StopAnim = function () + { + this.animPlaying = false; + }; + Acts.prototype.StartAnim = function (from) + { + this.animPlaying = true; + this.frameStart = this.getNowTime(); + if (from === 1 && this.cur_frame !== 0) + { + this.changeAnimFrame = 0; + if (!this.inAnimTrigger) + this.doChangeAnimFrame(); + } + if (!this.isTicking) + { + this.runtime.tickMe(this); + this.isTicking = true; + } + }; + Acts.prototype.SetAnim = function (animname, from) + { + this.changeAnimName = animname; + this.changeAnimFrom = from; + if (!this.isTicking) + { + this.runtime.tickMe(this); + this.isTicking = true; + } + if (!this.inAnimTrigger) + this.doChangeAnim(); + }; + Acts.prototype.SetAnimFrame = function (framenumber) + { + this.changeAnimFrame = framenumber; + if (!this.isTicking) + { + this.runtime.tickMe(this); + this.isTicking = true; + } + if (!this.inAnimTrigger) + this.doChangeAnimFrame(); + }; + Acts.prototype.SetAnimSpeed = function (s) + { + this.cur_anim_speed = cr.abs(s); + this.animForwards = (s >= 0); + if (!this.isTicking) + { + this.runtime.tickMe(this); + this.isTicking = true; + } + }; + Acts.prototype.SetAnimRepeatToFrame = function (s) + { + s = Math.floor(s); + if (s < 0) + s = 0; + if (s >= this.cur_animation.frames.length) + s = this.cur_animation.frames.length - 1; + this.cur_anim_repeatto = s; + }; + Acts.prototype.SetMirrored = function (m) + { + var neww = cr.abs(this.width) * (m === 0 ? -1 : 1); + if (this.width === neww) + return; + this.width = neww; + this.set_bbox_changed(); + }; + Acts.prototype.SetFlipped = function (f) + { + var newh = cr.abs(this.height) * (f === 0 ? -1 : 1); + if (this.height === newh) + return; + this.height = newh; + this.set_bbox_changed(); + }; + Acts.prototype.SetScale = function (s) + { + var cur_frame = this.curFrame; + var mirror_factor = (this.width < 0 ? -1 : 1); + var flip_factor = (this.height < 0 ? -1 : 1); + var new_width = cur_frame.width * s * mirror_factor; + var new_height = cur_frame.height * s * flip_factor; + if (this.width !== new_width || this.height !== new_height) + { + this.width = new_width; + this.height = new_height; + this.set_bbox_changed(); + } + }; + Acts.prototype.LoadURL = function (url_, resize_, crossOrigin_) + { + var img = new Image(); + var self = this; + var curFrame_ = this.curFrame; + img.onload = function () + { + if (curFrame_.texture_img.src === img.src) + { + if (self.runtime.glwrap && self.curFrame === curFrame_) + self.curWebGLTexture = curFrame_.webGL_texture; + if (resize_ === 0) // resize to image size + { + self.width = img.width; + self.height = img.height; + self.set_bbox_changed(); + } + self.runtime.redraw = true; + self.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnURLLoaded, self); + return; + } + curFrame_.texture_img = img; + curFrame_.offx = 0; + curFrame_.offy = 0; + curFrame_.width = img.width; + curFrame_.height = img.height; + curFrame_.spritesheeted = false; + curFrame_.datauri = ""; + curFrame_.pixelformat = 0; // reset to RGBA, since we don't know what type of image will have come in + if (self.runtime.glwrap) + { + if (curFrame_.webGL_texture) + self.runtime.glwrap.deleteTexture(curFrame_.webGL_texture); + curFrame_.webGL_texture = self.runtime.glwrap.loadTexture(img, false, self.runtime.linearSampling); + if (self.curFrame === curFrame_) + self.curWebGLTexture = curFrame_.webGL_texture; + self.type.updateAllCurrentTexture(); + } + if (resize_ === 0) // resize to image size + { + self.width = img.width; + self.height = img.height; + self.set_bbox_changed(); + } + self.runtime.redraw = true; + self.runtime.trigger(cr.plugins_.Sprite.prototype.cnds.OnURLLoaded, self); + }; + if (url_.substr(0, 5) !== "data:" && crossOrigin_ === 0) + img["crossOrigin"] = "anonymous"; + this.runtime.setImageSrc(img, url_); + }; + Acts.prototype.SetCollisions = function (set_) + { + if (this.collisionsEnabled === (set_ !== 0)) + return; // no change + this.collisionsEnabled = (set_ !== 0); + if (this.collisionsEnabled) + this.set_bbox_changed(); // needs to be added back to cells + else + { + if (this.collcells.right >= this.collcells.left) + this.type.collision_grid.update(this, this.collcells, null); + this.collcells.set(0, 0, -1, -1); + } + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.AnimationFrame = function (ret) + { + ret.set_int(this.cur_frame); + }; + Exps.prototype.AnimationFrameCount = function (ret) + { + ret.set_int(this.cur_animation.frames.length); + }; + Exps.prototype.AnimationName = function (ret) + { + ret.set_string(this.cur_animation.name); + }; + Exps.prototype.AnimationSpeed = function (ret) + { + ret.set_float(this.animForwards ? this.cur_anim_speed : -this.cur_anim_speed); + }; + Exps.prototype.ImagePointX = function (ret, imgpt) + { + ret.set_float(this.getImagePoint(imgpt, true)); + }; + Exps.prototype.ImagePointY = function (ret, imgpt) + { + ret.set_float(this.getImagePoint(imgpt, false)); + }; + Exps.prototype.ImagePointCount = function (ret) + { + ret.set_int(this.curFrame.image_points.length); + }; + Exps.prototype.ImageWidth = function (ret) + { + ret.set_float(this.curFrame.width); + }; + Exps.prototype.ImageHeight = function (ret) + { + ret.set_float(this.curFrame.height); + }; + pluginProto.exps = new Exps(); +}()); +/* global cr,log,assert2 */ +/* jshint globalstrict: true */ +/* jshint strict: true */ +; +; +var jText = ''; +cr.plugins_.SpriteFontPlus = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.SpriteFontPlus.prototype; + pluginProto.onCreate = function () + { + }; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + if (this.is_family) + return; + this.texture_img = new Image(); + this.texture_img["idtkLoadDisposed"] = true; + this.texture_img.src = this.texture_file; + this.runtime.wait_for_textures.push(this.texture_img); + this.webGL_texture = null; + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + this.webGL_texture = null; + }; + typeProto.onRestoreWebGLContext = function () + { + if (this.is_family || !this.instances.length) + return; + if (!this.webGL_texture) + { + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, false, this.runtime.linearSampling, this.texture_pixelformat); + } + var i, len; + for (i = 0, len = this.instances.length; i < len; i++) + this.instances[i].webGL_texture = this.webGL_texture; + }; + typeProto.unloadTextures = function () + { + if (this.is_family || this.instances.length || !this.webGL_texture) + return; + this.runtime.glwrap.deleteTexture(this.webGL_texture); + this.webGL_texture = null; + }; + typeProto.preloadCanvas2D = function (ctx) + { + ctx.drawImage(this.texture_img, 0, 0); + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onDestroy = function() + { + freeAllLines (this.lines); + freeAllClip (this.clipList); + freeAllClipUV(this.clipUV); + cr.wipe(this.characterWidthList); + }; + instanceProto.onCreate = function() + { + this.texture_img = this.type.texture_img; + this.characterWidth = this.properties[0]; + this.characterHeight = this.properties[1]; + this.characterSet = this.properties[2]; + this.text = this.properties[3]; + this.characterScale = this.properties[4]; + this.visible = (this.properties[5] === 0); // 0=visible, 1=invisible + this.halign = this.properties[6]/2.0; // 0=left, 1=center, 2=right + this.valign = this.properties[7]/2.0; // 0=top, 1=center, 2=bottom + this.wrapbyword = (this.properties[9] === 0); // 0=word, 1=character + this.characterSpacing = this.properties[10]; + this.lineHeight = this.properties[11]; + this.textWidth = 0; + this.textHeight = 0; + this.charWidthJSON = this.properties[12]; + this.spaceWidth = this.properties[13]; + console.log(this.charWidthJSON); + jText = this.charWidthJSON; + if (this.recycled) + { + this.lines.length = 0; + cr.wipe(this.clipList); + cr.wipe(this.clipUV); + cr.wipe(this.characterWidthList); + } + else + { + this.lines = []; + this.clipList = {}; + this.clipUV = {}; + this.characterWidthList = {}; + } + try{ + if(this.charWidthJSON){ + if(this.charWidthJSON.indexOf('""c2array""') !== -1) { + var jStr = jQuery.parseJSON(this.charWidthJSON.replace(/""/g,'"')); + var l = jStr.size[1]; + for(var s = 0; s < l; s++) { + var cs = jStr.data[1][s][0]; + var w = jStr.data[0][s][0]; + for(var c = 0; c < cs.length; c++) { + this.characterWidthList[cs.charAt(c)] = w + } + } + } else { + var jStr = jQuery.parseJSON(this.charWidthJSON); + var l = jStr.length; + for(var s = 0; s < l; s++) { + var cs = jStr[s][1]; + var w = jStr[s][0]; + for(var c = 0; c < cs.length; c++) { + this.characterWidthList[cs.charAt(c)] = w + } + } + } + } + if(this.spaceWidth !== -1) { + this.characterWidthList[' '] = this.spaceWidth; + } + } + catch(e){ + if(window.console && window.console.log) { + window.console.log('SpriteFont+ Failure: ' + e); + } + } + this.text_changed = true; + this.lastwrapwidth = this.width; + if (this.runtime.glwrap) + { + if (!this.type.webGL_texture) + { + this.type.webGL_texture = this.runtime.glwrap.loadTexture(this.type.texture_img, false, this.runtime.linearSampling, this.type.texture_pixelformat); + } + this.webGL_texture = this.type.webGL_texture; + } + this.SplitSheet(); + }; + instanceProto.saveToJSON = function () + { + var save = { + "t": this.text, + "csc": this.characterScale, + "csp": this.characterSpacing, + "lh": this.lineHeight, + "tw": this.textWidth, + "th": this.textHeight, + "lrt": this.last_render_tick, + "cw": {} + }; + for (var ch in this.characterWidthList) + save["cw"][ch] = this.characterWidthList[ch]; + return save; + }; + instanceProto.loadFromJSON = function (o) + { + this.text = o["t"]; + this.characterScale = o["csc"]; + this.characterSpacing = o["csp"]; + this.lineHeight = o["lh"]; + this.textWidth = o["tw"]; + this.textHeight = o["th"]; + this.last_render_tick = o["lrt"]; + for(var ch in o["cw"]) + this.characterWidthList[ch] = o["cw"][ch]; + this.text_changed = true; + this.lastwrapwidth = this.width; + }; + function trimRight(text) + { + return text.replace(/\s\s*$/, ''); + } + var MAX_CACHE_SIZE = 1000; + function alloc(cache,Constructor) + { + if (cache.length) + return cache.pop(); + else + return new Constructor(); + } + function free(cache,data) + { + if (cache.length < MAX_CACHE_SIZE) + { + cache.push(data); + } + } + function freeAll(cache,dataList,isArray) + { + if (isArray) { + var i, len; + for (i = 0, len = dataList.length; i < len; i++) + { + free(cache,dataList[i]); + } + dataList.length = 0; + } else { + var prop; + for(prop in dataList) { + if(Object.prototype.hasOwnProperty.call(dataList,prop)) { + free(cache,dataList[prop]); + delete dataList[prop]; + } + } + } + } + function addLine(inst,lineIndex,cur_line) { + var lines = inst.lines; + var line; + cur_line = trimRight(cur_line); + if (lineIndex >= lines.length) + lines.push(allocLine()); + line = lines[lineIndex]; + line.text = cur_line; + line.width = inst.measureWidth(cur_line); + inst.textWidth = cr.max(inst.textWidth,line.width); + } + var linesCache = []; + function allocLine() { return alloc(linesCache,Object); } + function freeLine(l) { free(linesCache,l); } + function freeAllLines(arr) { freeAll(linesCache,arr,true); } + function addClip(obj,property,x,y,w,h) { + if (obj[property] === undefined) { + obj[property] = alloc(clipCache,Object); + } + obj[property].x = x; + obj[property].y = y; + obj[property].w = w; + obj[property].h = h; + } + var clipCache = []; + function allocClip() { return alloc(clipCache,Object); } + function freeAllClip(obj) { freeAll(clipCache,obj,false);} + function addClipUV(obj,property,left,top,right,bottom) { + if (obj[property] === undefined) { + obj[property] = alloc(clipUVCache,cr.rect); + } + obj[property].left = left; + obj[property].top = top; + obj[property].right = right; + obj[property].bottom = bottom; + } + var clipUVCache = []; + function allocClipUV() { return alloc(clipUVCache,cr.rect);} + function freeAllClipUV(obj) { freeAll(clipUVCache,obj,false);} + instanceProto.SplitSheet = function() { + var texture = this.texture_img; + var texWidth = texture.width; + var texHeight = texture.height; + var charWidth = this.characterWidth; + var charHeight = this.characterHeight; + var charU = charWidth /texWidth; + var charV = charHeight/texHeight; + var charSet = this.characterSet ; + var cols = Math.floor(texWidth/charWidth); + var rows = Math.floor(texHeight/charHeight); + for ( var c = 0; c < charSet.length; c++) { + if (c >= cols * rows) break; + var x = c%cols; + var y = Math.floor(c/cols); + var letter = charSet.charAt(c); + if (this.runtime.glwrap) { + addClipUV( + this.clipUV, letter, + x * charU , + y * charV , + (x+1) * charU , + (y+1) * charV + ); + } else { + addClip( + this.clipList, letter, + x * charWidth, + y * charHeight, + charWidth, + charHeight + ); + } + } + }; + /* + * Word-Wrapping + */ + var wordsCache = []; + pluginProto.TokeniseWords = function (text) + { + wordsCache.length = 0; + var cur_word = ""; + var ch; + var i = 0; + while (i < text.length) + { + ch = text.charAt(i); + if (ch === "\n") + { + if (cur_word.length) + { + wordsCache.push(cur_word); + cur_word = ""; + } + wordsCache.push("\n"); + ++i; + } + else if (ch === " " || ch === "\t" || ch === "-") + { + do { + cur_word += text.charAt(i); + i++; + } + while (i < text.length && (text.charAt(i) === " " || text.charAt(i) === "\t")); + wordsCache.push(cur_word); + cur_word = ""; + } + else if (i < text.length) + { + cur_word += ch; + i++; + } + } + if (cur_word.length) + wordsCache.push(cur_word); + }; + pluginProto.WordWrap = function (inst) + { + var text = inst.text; + var lines = inst.lines; + if (!text || !text.length) + { + freeAllLines(lines); + return; + } + var width = inst.width; + if (width <= 2.0) + { + freeAllLines(lines); + return; + } + var charWidth = inst.characterWidth; + var charScale = inst.characterScale; + var charSpacing = inst.characterSpacing; + if ( (text.length * (charWidth * charScale + charSpacing) - charSpacing) <= width && text.indexOf("\n") === -1) + { + var all_width = inst.measureWidth(text); + if (all_width <= width) + { + freeAllLines(lines); + lines.push(allocLine()); + lines[0].text = text; + lines[0].width = all_width; + inst.textWidth = all_width; + inst.textHeight = inst.characterHeight * charScale + inst.lineHeight; + return; + } + } + var wrapbyword = inst.wrapbyword; + this.WrapText(inst); + inst.textHeight = lines.length * (inst.characterHeight * charScale + inst.lineHeight); + }; + pluginProto.WrapText = function (inst) + { + var wrapbyword = inst.wrapbyword; + var text = inst.text; + var lines = inst.lines; + var width = inst.width; + var wordArray; + if (wrapbyword) { + this.TokeniseWords(text); // writes to wordsCache + wordArray = wordsCache; + } else { + wordArray = text; + } + var cur_line = ""; + var prev_line; + var line_width; + var i; + var lineIndex = 0; + var line; + var ignore_newline = false; + for (i = 0; i < wordArray.length; i++) + { + if (wordArray[i] === "\n") + { + if (ignore_newline === true) { + ignore_newline = false; + } else { + addLine(inst,lineIndex,cur_line); + lineIndex++; + } + cur_line = ""; + continue; + } + ignore_newline = false; + prev_line = cur_line; + cur_line += wordArray[i]; + line_width = inst.measureWidth(trimRight(cur_line)); + if (line_width > width) + { + if (prev_line === "") { + addLine(inst,lineIndex,cur_line); + cur_line = ""; + ignore_newline = true; + } else { + addLine(inst,lineIndex,prev_line); + cur_line = wordArray[i]; + } + lineIndex++; + if (!wrapbyword && cur_line === " ") + cur_line = ""; + } + } + if (trimRight(cur_line).length) + { + addLine(inst,lineIndex,cur_line); + lineIndex++; + } + for (i = lineIndex; i < lines.length; i++) + freeLine(lines[i]); + lines.length = lineIndex; + }; + instanceProto.measureWidth = function(text) { + var spacing = this.characterSpacing; + var len = text.length; + var width = 0; + for (var i = 0; i < len; i++) { + width += this.getCharacterWidth(text.charAt(i)) * this.characterScale + spacing; + } + width -= (width > 0) ? spacing : 0; + return width; + }; + /***/ + instanceProto.getCharacterWidth = function(character) { + var widthList = this.characterWidthList; + if (widthList[character] !== undefined) { + return widthList[character]; + } else { + return this.characterWidth; + } + }; + instanceProto.rebuildText = function() { + if (this.text_changed || this.width !== this.lastwrapwidth) { + this.textWidth = 0; + this.textHeight = 0; + this.type.plugin.WordWrap(this); + this.text_changed = false; + this.lastwrapwidth = this.width; + } + }; + var EPSILON = 0.00001; + instanceProto.draw = function(ctx, glmode) + { + var texture = this.texture_img; + if (this.text !== "" && texture != null) { + this.rebuildText(); + if (this.height < this.characterHeight*this.characterScale + this.lineHeight) { + return; + } + ctx.globalAlpha = this.opacity; + var myx = this.x; + var myy = this.y; + if (this.runtime.pixel_rounding) + { + myx = (myx + 0.5) | 0; + myy = (myy + 0.5) | 0; + } + ctx.save(); + ctx.translate(myx, myy); + ctx.rotate(this.angle); + var ha = this.halign; + var va = this.valign; + var scale = this.characterScale; + var charHeight = this.characterHeight * scale; + var lineHeight = this.lineHeight; + var charSpace = this.characterSpacing; + var lines = this.lines; + var textHeight = this.textHeight; + var halign; + var valign = va * cr.max(0,(this.height - textHeight)); + var offx = -(this.hotspotX * this.width); + var offy = -(this.hotspotY * this.height); + offy += valign; + var drawX ; + var drawY = offy; + for(var i = 0; i < lines.length; i++) { + var line = lines[i].text; + var len = lines[i].width; + halign = ha * cr.max(0,this.width - len); + drawX = offx + halign; + drawY += lineHeight; + for(var j = 0; j < line.length; j++) { + var letter = line.charAt(j); + var clip = this.clipList[letter]; + if ( drawX + this.getCharacterWidth(letter) * scale > this.width + EPSILON ) { + break; + } + if (clip !== undefined) { + ctx.drawImage( this.texture_img, + clip.x, clip.y, clip.w, clip.h, + Math.round(drawX),Math.round(drawY),clip.w*scale,clip.h*scale); + } + drawX += this.getCharacterWidth(letter) * scale + charSpace; + } + drawY += charHeight; + if ( drawY + charHeight + lineHeight > this.height) { + break; + } + } + ctx.restore(); + } + }; + var dQuad = new cr.quad(); + function rotateQuad(quad,cosa,sina) { + var x_temp; + x_temp = (quad.tlx * cosa) - (quad.tly * sina); + quad.tly = (quad.tly * cosa) + (quad.tlx * sina); + quad.tlx = x_temp; + x_temp = (quad.trx * cosa) - (quad.try_ * sina); + quad.try_ = (quad.try_ * cosa) + (quad.trx * sina); + quad.trx = x_temp; + x_temp = (quad.blx * cosa) - (quad.bly * sina); + quad.bly = (quad.bly * cosa) + (quad.blx * sina); + quad.blx = x_temp; + x_temp = (quad.brx * cosa) - (quad.bry * sina); + quad.bry = (quad.bry * cosa) + (quad.brx * sina); + quad.brx = x_temp; + } + instanceProto.drawGL = function(glw) + { + glw.setTexture(this.webGL_texture); + glw.setOpacity(this.opacity); + if (this.text !== "") { + this.rebuildText(); + if (this.height < this.characterHeight*this.characterScale + this.lineHeight) { + return; + } + this.update_bbox(); + var q = this.bquad; + var ox = 0; + var oy = 0; + if (this.runtime.pixel_rounding) + { + ox = ((this.x + 0.5) | 0) - this.x; + oy = ((this.y + 0.5) | 0) - this.y; + } + var angle = this.angle; + var ha = this.halign; + var va = this.valign; + var scale = this.characterScale; + var charHeight = this.characterHeight * scale; // to precalculate in onCreate or on change + var lineHeight = this.lineHeight; + var charSpace = this.characterSpacing; + var lines = this.lines; + var textHeight = this.textHeight; + var cosa,sina; + if (angle !== 0) + { + cosa = Math.cos(angle); + sina = Math.sin(angle); + } + var halign; + var valign = va * cr.max(0,(this.height - textHeight)); + var offx = q.tlx + ox; + var offy = q.tly + oy; + var drawX ; + var drawY = valign; + for(var i = 0; i < lines.length; i++) { + var line = lines[i].text; + var lineWidth = lines[i].width; + halign = ha * cr.max(0,this.width - lineWidth); + drawX = halign; + drawY += lineHeight; + for(var j = 0; j < line.length; j++) { + var letter = line.charAt(j); + var clipUV = this.clipUV[letter]; + if ( drawX + this.getCharacterWidth(letter) * scale > this.width + EPSILON) { + break; + } + if (clipUV !== undefined) { + var clipWidth = this.characterWidth*scale; + var clipHeight = this.characterHeight*scale; + dQuad.tlx = drawX; + dQuad.tly = drawY; + dQuad.trx = drawX + clipWidth; + dQuad.try_ = drawY ; + dQuad.blx = drawX; + dQuad.bly = drawY + clipHeight; + dQuad.brx = drawX + clipWidth; + dQuad.bry = drawY + clipHeight; + if(angle !== 0) + { + rotateQuad(dQuad,cosa,sina); + } + dQuad.offset(offx,offy); + glw.quadTex( + dQuad.tlx, dQuad.tly, + dQuad.trx, dQuad.try_, + dQuad.brx, dQuad.bry, + dQuad.blx, dQuad.bly, + clipUV + ); + } + drawX += this.getCharacterWidth(letter) * scale + charSpace; + } + drawY += charHeight; + if ( drawY + charHeight + lineHeight > this.height) { + break; + } + } + } + }; + function Cnds() {} + Cnds.prototype.CompareText = function(text_to_compare, case_sensitive) + { + if (case_sensitive) + return this.text == text_to_compare; + else + return cr.equals_nocase(this.text, text_to_compare); + }; + pluginProto.cnds = new Cnds(); + function Acts() {} + Acts.prototype.SetText = function(param) + { + if (cr.is_number(param) && param < 1e9) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_set = param.toString(); + if (this.text !== text_to_set) + { + this.text = text_to_set; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.AppendText = function(param) + { + if (cr.is_number(param)) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_append = param.toString(); + if (text_to_append) // not empty + { + this.text += text_to_append; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetScale = function(param) + { + if (param !== this.characterScale) { + this.characterScale = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetCharacterSpacing = function(param) + { + if (param !== this.CharacterSpacing) { + this.characterSpacing = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetLineHeight = function(param) + { + if (param !== this.lineHeight) { + this.lineHeight = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + instanceProto.SetCharWidth = function(character,width) { + var w = parseInt(width,10); + if (this.characterWidthList[character] !== w) { + this.characterWidthList[character] = w; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetCharacterWidth = function(characterSet,width) + { + if (characterSet !== "") { + for(var c = 0; c < characterSet.length; c++) { + this.SetCharWidth(characterSet.charAt(c),width); + } + } + }; + Acts.prototype.SetEffect = function (effect) + { + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + pluginProto.acts = new Acts(); + function Exps() {} + Exps.prototype.CharacterWidth = function(ret,character) + { + ret.set_int(this.getCharacterWidth(character)); + }; + Exps.prototype.CharacterHeight = function(ret) + { + ret.set_int(this.characterHeight); + }; + Exps.prototype.CharacterScale = function(ret) + { + ret.set_float(this.characterScale); + }; + Exps.prototype.CharacterSpacing = function(ret) + { + ret.set_int(this.characterSpacing); + }; + Exps.prototype.LineHeight = function(ret) + { + ret.set_int(this.lineHeight); + }; + Exps.prototype.Text = function(ret) + { + ret.set_string(this.text); + }; + Exps.prototype.TextWidth = function (ret) + { + this.rebuildText(); + ret.set_float(this.textWidth); + }; + Exps.prototype.TextHeight = function (ret) + { + this.rebuildText(); + ret.set_float(this.textHeight); + }; + pluginProto.exps = new Exps(); +}()); +/* global cr,log,assert2 */ +/* jshint globalstrict: true */ +/* jshint strict: true */ +; +; +cr.plugins_.Spritefont2 = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Spritefont2.prototype; + pluginProto.onCreate = function () + { + }; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + if (this.is_family) + return; + this.texture_img = new Image(); + this.runtime.waitForImageLoad(this.texture_img, this.texture_file); + this.webGL_texture = null; + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + this.webGL_texture = null; + }; + typeProto.onRestoreWebGLContext = function () + { + if (this.is_family || !this.instances.length) + return; + if (!this.webGL_texture) + { + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, false, this.runtime.linearSampling, this.texture_pixelformat); + } + var i, len; + for (i = 0, len = this.instances.length; i < len; i++) + this.instances[i].webGL_texture = this.webGL_texture; + }; + typeProto.unloadTextures = function () + { + if (this.is_family || this.instances.length || !this.webGL_texture) + return; + this.runtime.glwrap.deleteTexture(this.webGL_texture); + this.webGL_texture = null; + }; + typeProto.preloadCanvas2D = function (ctx) + { + ctx.drawImage(this.texture_img, 0, 0); + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onDestroy = function() + { + freeAllLines (this.lines); + freeAllClip (this.clipList); + freeAllClipUV(this.clipUV); + cr.wipe(this.characterWidthList); + }; + instanceProto.onCreate = function() + { + this.texture_img = this.type.texture_img; + this.characterWidth = this.properties[0]; + this.characterHeight = this.properties[1]; + this.characterSet = this.properties[2]; + this.text = this.properties[3]; + this.characterScale = this.properties[4]; + this.visible = (this.properties[5] === 0); // 0=visible, 1=invisible + this.halign = this.properties[6]/2.0; // 0=left, 1=center, 2=right + this.valign = this.properties[7]/2.0; // 0=top, 1=center, 2=bottom + this.wrapbyword = (this.properties[9] === 0); // 0=word, 1=character + this.characterSpacing = this.properties[10]; + this.lineHeight = this.properties[11]; + this.textWidth = 0; + this.textHeight = 0; + if (this.recycled) + { + cr.clearArray(this.lines); + cr.wipe(this.clipList); + cr.wipe(this.clipUV); + cr.wipe(this.characterWidthList); + } + else + { + this.lines = []; + this.clipList = {}; + this.clipUV = {}; + this.characterWidthList = {}; + } + this.text_changed = true; + this.lastwrapwidth = this.width; + if (this.runtime.glwrap) + { + if (!this.type.webGL_texture) + { + this.type.webGL_texture = this.runtime.glwrap.loadTexture(this.type.texture_img, false, this.runtime.linearSampling, this.type.texture_pixelformat); + } + this.webGL_texture = this.type.webGL_texture; + } + this.SplitSheet(); + }; + instanceProto.saveToJSON = function () + { + var save = { + "t": this.text, + "csc": this.characterScale, + "csp": this.characterSpacing, + "lh": this.lineHeight, + "tw": this.textWidth, + "th": this.textHeight, + "lrt": this.last_render_tick, + "ha": this.halign, + "va": this.valign, + "cw": {} + }; + for (var ch in this.characterWidthList) + save["cw"][ch] = this.characterWidthList[ch]; + return save; + }; + instanceProto.loadFromJSON = function (o) + { + this.text = o["t"]; + this.characterScale = o["csc"]; + this.characterSpacing = o["csp"]; + this.lineHeight = o["lh"]; + this.textWidth = o["tw"]; + this.textHeight = o["th"]; + this.last_render_tick = o["lrt"]; + if (o.hasOwnProperty("ha")) + this.halign = o["ha"]; + if (o.hasOwnProperty("va")) + this.valign = o["va"]; + for(var ch in o["cw"]) + this.characterWidthList[ch] = o["cw"][ch]; + this.text_changed = true; + this.lastwrapwidth = this.width; + }; + function trimRight(text) + { + return text.replace(/\s\s*$/, ''); + } + var MAX_CACHE_SIZE = 1000; + function alloc(cache,Constructor) + { + if (cache.length) + return cache.pop(); + else + return new Constructor(); + } + function free(cache,data) + { + if (cache.length < MAX_CACHE_SIZE) + { + cache.push(data); + } + } + function freeAll(cache,dataList,isArray) + { + if (isArray) { + var i, len; + for (i = 0, len = dataList.length; i < len; i++) + { + free(cache,dataList[i]); + } + cr.clearArray(dataList); + } else { + var prop; + for(prop in dataList) { + if(Object.prototype.hasOwnProperty.call(dataList,prop)) { + free(cache,dataList[prop]); + delete dataList[prop]; + } + } + } + } + function addLine(inst,lineIndex,cur_line) { + var lines = inst.lines; + var line; + cur_line = trimRight(cur_line); + if (lineIndex >= lines.length) + lines.push(allocLine()); + line = lines[lineIndex]; + line.text = cur_line; + line.width = inst.measureWidth(cur_line); + inst.textWidth = cr.max(inst.textWidth,line.width); + } + var linesCache = []; + function allocLine() { return alloc(linesCache,Object); } + function freeLine(l) { free(linesCache,l); } + function freeAllLines(arr) { freeAll(linesCache,arr,true); } + function addClip(obj,property,x,y,w,h) { + if (obj[property] === undefined) { + obj[property] = alloc(clipCache,Object); + } + obj[property].x = x; + obj[property].y = y; + obj[property].w = w; + obj[property].h = h; + } + var clipCache = []; + function allocClip() { return alloc(clipCache,Object); } + function freeAllClip(obj) { freeAll(clipCache,obj,false);} + function addClipUV(obj,property,left,top,right,bottom) { + if (obj[property] === undefined) { + obj[property] = alloc(clipUVCache,cr.rect); + } + obj[property].left = left; + obj[property].top = top; + obj[property].right = right; + obj[property].bottom = bottom; + } + var clipUVCache = []; + function allocClipUV() { return alloc(clipUVCache,cr.rect);} + function freeAllClipUV(obj) { freeAll(clipUVCache,obj,false);} + instanceProto.SplitSheet = function() { + var texture = this.texture_img; + var texWidth = texture.width; + var texHeight = texture.height; + var charWidth = this.characterWidth; + var charHeight = this.characterHeight; + var charU = charWidth /texWidth; + var charV = charHeight/texHeight; + var charSet = this.characterSet ; + var cols = Math.floor(texWidth/charWidth); + var rows = Math.floor(texHeight/charHeight); + for ( var c = 0; c < charSet.length; c++) { + if (c >= cols * rows) break; + var x = c%cols; + var y = Math.floor(c/cols); + var letter = charSet.charAt(c); + if (this.runtime.glwrap) { + addClipUV( + this.clipUV, letter, + x * charU , + y * charV , + (x+1) * charU , + (y+1) * charV + ); + } else { + addClip( + this.clipList, letter, + x * charWidth, + y * charHeight, + charWidth, + charHeight + ); + } + } + }; + /* + * Word-Wrapping + */ + var wordsCache = []; + pluginProto.TokeniseWords = function (text) + { + cr.clearArray(wordsCache); + var cur_word = ""; + var ch; + var i = 0; + while (i < text.length) + { + ch = text.charAt(i); + if (ch === "\n") + { + if (cur_word.length) + { + wordsCache.push(cur_word); + cur_word = ""; + } + wordsCache.push("\n"); + ++i; + } + else if (ch === " " || ch === "\t" || ch === "-") + { + do { + cur_word += text.charAt(i); + i++; + } + while (i < text.length && (text.charAt(i) === " " || text.charAt(i) === "\t")); + wordsCache.push(cur_word); + cur_word = ""; + } + else if (i < text.length) + { + cur_word += ch; + i++; + } + } + if (cur_word.length) + wordsCache.push(cur_word); + }; + pluginProto.WordWrap = function (inst) + { + var text = inst.text; + var lines = inst.lines; + if (!text || !text.length) + { + freeAllLines(lines); + return; + } + var width = inst.width; + if (width <= 2.0) + { + freeAllLines(lines); + return; + } + var charWidth = inst.characterWidth; + var charScale = inst.characterScale; + var charSpacing = inst.characterSpacing; + if ( (text.length * (charWidth * charScale + charSpacing) - charSpacing) <= width && text.indexOf("\n") === -1) + { + var all_width = inst.measureWidth(text); + if (all_width <= width) + { + freeAllLines(lines); + lines.push(allocLine()); + lines[0].text = text; + lines[0].width = all_width; + inst.textWidth = all_width; + inst.textHeight = inst.characterHeight * charScale + inst.lineHeight; + return; + } + } + var wrapbyword = inst.wrapbyword; + this.WrapText(inst); + inst.textHeight = lines.length * (inst.characterHeight * charScale + inst.lineHeight); + }; + pluginProto.WrapText = function (inst) + { + var wrapbyword = inst.wrapbyword; + var text = inst.text; + var lines = inst.lines; + var width = inst.width; + var wordArray; + if (wrapbyword) { + this.TokeniseWords(text); // writes to wordsCache + wordArray = wordsCache; + } else { + wordArray = text; + } + var cur_line = ""; + var prev_line; + var line_width; + var i; + var lineIndex = 0; + var line; + var ignore_newline = false; + for (i = 0; i < wordArray.length; i++) + { + if (wordArray[i] === "\n") + { + if (ignore_newline === true) { + ignore_newline = false; + } else { + addLine(inst,lineIndex,cur_line); + lineIndex++; + } + cur_line = ""; + continue; + } + ignore_newline = false; + prev_line = cur_line; + cur_line += wordArray[i]; + line_width = inst.measureWidth(trimRight(cur_line)); + if (line_width > width) + { + if (prev_line === "") { + addLine(inst,lineIndex,cur_line); + cur_line = ""; + ignore_newline = true; + } else { + addLine(inst,lineIndex,prev_line); + cur_line = wordArray[i]; + } + lineIndex++; + if (!wrapbyword && cur_line === " ") + cur_line = ""; + } + } + if (trimRight(cur_line).length) + { + addLine(inst,lineIndex,cur_line); + lineIndex++; + } + for (i = lineIndex; i < lines.length; i++) + freeLine(lines[i]); + lines.length = lineIndex; + }; + instanceProto.measureWidth = function(text) { + var spacing = this.characterSpacing; + var len = text.length; + var width = 0; + for (var i = 0; i < len; i++) { + width += this.getCharacterWidth(text.charAt(i)) * this.characterScale + spacing; + } + width -= (width > 0) ? spacing : 0; + return width; + }; + /***/ + instanceProto.getCharacterWidth = function(character) { + var widthList = this.characterWidthList; + if (widthList[character] !== undefined) { + return widthList[character]; + } else { + return this.characterWidth; + } + }; + instanceProto.rebuildText = function() { + if (this.text_changed || this.width !== this.lastwrapwidth) { + this.textWidth = 0; + this.textHeight = 0; + this.type.plugin.WordWrap(this); + this.text_changed = false; + this.lastwrapwidth = this.width; + } + }; + var EPSILON = 0.00001; + instanceProto.draw = function(ctx, glmode) + { + var texture = this.texture_img; + if (this.text !== "" && texture != null) { + this.rebuildText(); + if (this.height < this.characterHeight*this.characterScale + this.lineHeight) { + return; + } + ctx.globalAlpha = this.opacity; + var myx = this.x; + var myy = this.y; + if (this.runtime.pixel_rounding) + { + myx = Math.round(myx); + myy = Math.round(myy); + } + var viewLeft = this.layer.viewLeft; + var viewTop = this.layer.viewTop; + var viewRight = this.layer.viewRight; + var viewBottom = this.layer.viewBottom; + ctx.save(); + ctx.translate(myx, myy); + ctx.rotate(this.angle); + var angle = this.angle; + var ha = this.halign; + var va = this.valign; + var scale = this.characterScale; + var charHeight = this.characterHeight * scale; + var lineHeight = this.lineHeight; + var charSpace = this.characterSpacing; + var lines = this.lines; + var textHeight = this.textHeight; + var letterWidth; + var halign; + var valign = va * cr.max(0,(this.height - textHeight)); + var offx = -(this.hotspotX * this.width); + var offy = -(this.hotspotY * this.height); + offy += valign; + var drawX ; + var drawY = offy; + var roundX, roundY; + for(var i = 0; i < lines.length; i++) { + var line = lines[i].text; + var len = lines[i].width; + halign = ha * cr.max(0,this.width - len); + drawX = offx + halign; + drawY += lineHeight; + if (angle === 0 && myy + drawY + charHeight < viewTop) + { + drawY += charHeight; + continue; + } + for(var j = 0; j < line.length; j++) { + var letter = line.charAt(j); + letterWidth = this.getCharacterWidth(letter); + var clip = this.clipList[letter]; + if (angle === 0 && myx + drawX + letterWidth * scale + charSpace < viewLeft) + { + drawX += letterWidth * scale + charSpace; + continue; + } + if ( drawX + letterWidth * scale > this.width + EPSILON ) { + break; + } + if (clip !== undefined) { + roundX = drawX; + roundY = drawY; + if (angle === 0 && scale === 1) + { + roundX = Math.round(roundX); + roundY = Math.round(roundY); + } + ctx.drawImage( this.texture_img, + clip.x, clip.y, clip.w, clip.h, + roundX,roundY,clip.w*scale,clip.h*scale); + } + drawX += letterWidth * scale + charSpace; + if (angle === 0 && myx + drawX > viewRight) + break; + } + drawY += charHeight; + if (angle === 0 && (drawY + charHeight + lineHeight > this.height || myy + drawY > viewBottom)) + { + break; + } + } + ctx.restore(); + } + }; + var dQuad = new cr.quad(); + function rotateQuad(quad,cosa,sina) { + var x_temp; + x_temp = (quad.tlx * cosa) - (quad.tly * sina); + quad.tly = (quad.tly * cosa) + (quad.tlx * sina); + quad.tlx = x_temp; + x_temp = (quad.trx * cosa) - (quad.try_ * sina); + quad.try_ = (quad.try_ * cosa) + (quad.trx * sina); + quad.trx = x_temp; + x_temp = (quad.blx * cosa) - (quad.bly * sina); + quad.bly = (quad.bly * cosa) + (quad.blx * sina); + quad.blx = x_temp; + x_temp = (quad.brx * cosa) - (quad.bry * sina); + quad.bry = (quad.bry * cosa) + (quad.brx * sina); + quad.brx = x_temp; + } + instanceProto.drawGL = function(glw) + { + glw.setTexture(this.webGL_texture); + glw.setOpacity(this.opacity); + if (!this.text) + return; + this.rebuildText(); + if (this.height < this.characterHeight*this.characterScale + this.lineHeight) { + return; + } + this.update_bbox(); + var q = this.bquad; + var ox = 0; + var oy = 0; + if (this.runtime.pixel_rounding) + { + ox = Math.round(this.x) - this.x; + oy = Math.round(this.y) - this.y; + } + var viewLeft = this.layer.viewLeft; + var viewTop = this.layer.viewTop; + var viewRight = this.layer.viewRight; + var viewBottom = this.layer.viewBottom; + var angle = this.angle; + var ha = this.halign; + var va = this.valign; + var scale = this.characterScale; + var charHeight = this.characterHeight * scale; // to precalculate in onCreate or on change + var lineHeight = this.lineHeight; + var charSpace = this.characterSpacing; + var lines = this.lines; + var textHeight = this.textHeight; + var letterWidth; + var cosa,sina; + if (angle !== 0) + { + cosa = Math.cos(angle); + sina = Math.sin(angle); + } + var halign; + var valign = va * cr.max(0,(this.height - textHeight)); + var offx = q.tlx + ox; + var offy = q.tly + oy; + var drawX ; + var drawY = valign; + var roundX, roundY; + for(var i = 0; i < lines.length; i++) { + var line = lines[i].text; + var lineWidth = lines[i].width; + halign = ha * cr.max(0,this.width - lineWidth); + drawX = halign; + drawY += lineHeight; + if (angle === 0 && offy + drawY + charHeight < viewTop) + { + drawY += charHeight; + continue; + } + for(var j = 0; j < line.length; j++) { + var letter = line.charAt(j); + letterWidth = this.getCharacterWidth(letter); + var clipUV = this.clipUV[letter]; + if (angle === 0 && offx + drawX + letterWidth * scale + charSpace < viewLeft) + { + drawX += letterWidth * scale + charSpace; + continue; + } + if (drawX + letterWidth * scale > this.width + EPSILON) + { + break; + } + if (clipUV !== undefined) { + var clipWidth = this.characterWidth*scale; + var clipHeight = this.characterHeight*scale; + roundX = drawX; + roundY = drawY; + if (angle === 0 && scale === 1) + { + roundX = Math.round(roundX); + roundY = Math.round(roundY); + } + dQuad.tlx = roundX; + dQuad.tly = roundY; + dQuad.trx = roundX + clipWidth; + dQuad.try_ = roundY ; + dQuad.blx = roundX; + dQuad.bly = roundY + clipHeight; + dQuad.brx = roundX + clipWidth; + dQuad.bry = roundY + clipHeight; + if(angle !== 0) + { + rotateQuad(dQuad,cosa,sina); + } + dQuad.offset(offx,offy); + glw.quadTex( + dQuad.tlx, dQuad.tly, + dQuad.trx, dQuad.try_, + dQuad.brx, dQuad.bry, + dQuad.blx, dQuad.bly, + clipUV + ); + } + drawX += letterWidth * scale + charSpace; + if (angle === 0 && offx + drawX > viewRight) + break; + } + drawY += charHeight; + if (angle === 0 && (drawY + charHeight + lineHeight > this.height || offy + drawY > viewBottom)) + { + break; + } + } + }; + function Cnds() {} + Cnds.prototype.CompareText = function(text_to_compare, case_sensitive) + { + if (case_sensitive) + return this.text == text_to_compare; + else + return cr.equals_nocase(this.text, text_to_compare); + }; + pluginProto.cnds = new Cnds(); + function Acts() {} + Acts.prototype.SetText = function(param) + { + if (cr.is_number(param) && param < 1e9) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_set = param.toString(); + if (this.text !== text_to_set) + { + this.text = text_to_set; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.AppendText = function(param) + { + if (cr.is_number(param)) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_append = param.toString(); + if (text_to_append) // not empty + { + this.text += text_to_append; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetScale = function(param) + { + if (param !== this.characterScale) { + this.characterScale = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetCharacterSpacing = function(param) + { + if (param !== this.CharacterSpacing) { + this.characterSpacing = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetLineHeight = function(param) + { + if (param !== this.lineHeight) { + this.lineHeight = param; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + instanceProto.SetCharWidth = function(character,width) { + var w = parseInt(width,10); + if (this.characterWidthList[character] !== w) { + this.characterWidthList[character] = w; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetCharacterWidth = function(characterSet,width) + { + if (characterSet !== "") { + for(var c = 0; c < characterSet.length; c++) { + this.SetCharWidth(characterSet.charAt(c),width); + } + } + }; + Acts.prototype.SetEffect = function (effect) + { + this.blend_mode = effect; + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + Acts.prototype.SetHAlign = function (a) + { + this.halign = a / 2.0; + this.text_changed = true; + this.runtime.redraw = true; + }; + Acts.prototype.SetVAlign = function (a) + { + this.valign = a / 2.0; + this.text_changed = true; + this.runtime.redraw = true; + }; + pluginProto.acts = new Acts(); + function Exps() {} + Exps.prototype.CharacterWidth = function(ret,character) + { + ret.set_int(this.getCharacterWidth(character)); + }; + Exps.prototype.CharacterHeight = function(ret) + { + ret.set_int(this.characterHeight); + }; + Exps.prototype.CharacterScale = function(ret) + { + ret.set_float(this.characterScale); + }; + Exps.prototype.CharacterSpacing = function(ret) + { + ret.set_int(this.characterSpacing); + }; + Exps.prototype.LineHeight = function(ret) + { + ret.set_int(this.lineHeight); + }; + Exps.prototype.Text = function(ret) + { + ret.set_string(this.text); + }; + Exps.prototype.TextWidth = function (ret) + { + this.rebuildText(); + ret.set_float(this.textWidth); + }; + Exps.prototype.TextHeight = function (ret) + { + this.rebuildText(); + ret.set_float(this.textHeight); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Text = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Text.prototype; + pluginProto.onCreate = function () + { + pluginProto.acts.SetWidth = function (w) + { + if (this.width !== w) + { + this.width = w; + this.text_changed = true; // also recalculate text wrapping + this.set_bbox_changed(); + } + }; + }; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + var i, len, inst; + for (i = 0, len = this.instances.length; i < len; i++) + { + inst = this.instances[i]; + inst.mycanvas = null; + inst.myctx = null; + inst.mytex = null; + } + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + if (this.recycled) + cr.clearArray(this.lines); + else + this.lines = []; // for word wrapping + this.text_changed = true; + }; + var instanceProto = pluginProto.Instance.prototype; + var requestedWebFonts = {}; // already requested web fonts have an entry here + instanceProto.onCreate = function() + { + this.text = this.properties[0]; + this.visible = (this.properties[1] === 0); // 0=visible, 1=invisible + this.font = this.properties[2]; + this.color = this.properties[3]; + this.halign = this.properties[4]; // 0=left, 1=center, 2=right + this.valign = this.properties[5]; // 0=top, 1=center, 2=bottom + this.wrapbyword = (this.properties[7] === 0); // 0=word, 1=character + this.lastwidth = this.width; + this.lastwrapwidth = this.width; + this.lastheight = this.height; + this.line_height_offset = this.properties[8]; + this.facename = ""; + this.fontstyle = ""; + this.ptSize = 0; + this.textWidth = 0; + this.textHeight = 0; + this.parseFont(); + this.mycanvas = null; + this.myctx = null; + this.mytex = null; + this.need_text_redraw = false; + this.last_render_tick = this.runtime.tickcount; + if (this.recycled) + this.rcTex.set(0, 0, 1, 1); + else + this.rcTex = new cr.rect(0, 0, 1, 1); + if (this.runtime.glwrap) + this.runtime.tickMe(this); +; + }; + instanceProto.parseFont = function () + { + var arr = this.font.split(" "); + var i; + for (i = 0; i < arr.length; i++) + { + if (arr[i].substr(arr[i].length - 2, 2) === "pt") + { + this.ptSize = parseInt(arr[i].substr(0, arr[i].length - 2)); + this.pxHeight = Math.ceil((this.ptSize / 72.0) * 96.0) + 4; // assume 96dpi... + if (i > 0) + this.fontstyle = arr[i - 1]; + this.facename = arr[i + 1]; + for (i = i + 2; i < arr.length; i++) + this.facename += " " + arr[i]; + break; + } + } + }; + instanceProto.saveToJSON = function () + { + return { + "t": this.text, + "f": this.font, + "c": this.color, + "ha": this.halign, + "va": this.valign, + "wr": this.wrapbyword, + "lho": this.line_height_offset, + "fn": this.facename, + "fs": this.fontstyle, + "ps": this.ptSize, + "pxh": this.pxHeight, + "tw": this.textWidth, + "th": this.textHeight, + "lrt": this.last_render_tick + }; + }; + instanceProto.loadFromJSON = function (o) + { + this.text = o["t"]; + this.font = o["f"]; + this.color = o["c"]; + this.halign = o["ha"]; + this.valign = o["va"]; + this.wrapbyword = o["wr"]; + this.line_height_offset = o["lho"]; + this.facename = o["fn"]; + this.fontstyle = o["fs"]; + this.ptSize = o["ps"]; + this.pxHeight = o["pxh"]; + this.textWidth = o["tw"]; + this.textHeight = o["th"]; + this.last_render_tick = o["lrt"]; + this.text_changed = true; + this.lastwidth = this.width; + this.lastwrapwidth = this.width; + this.lastheight = this.height; + }; + instanceProto.tick = function () + { + if (this.runtime.glwrap && this.mytex && (this.runtime.tickcount - this.last_render_tick >= 300)) + { + var layer = this.layer; + this.update_bbox(); + var bbox = this.bbox; + if (bbox.right < layer.viewLeft || bbox.bottom < layer.viewTop || bbox.left > layer.viewRight || bbox.top > layer.viewBottom) + { + this.runtime.glwrap.deleteTexture(this.mytex); + this.mytex = null; + this.myctx = null; + this.mycanvas = null; + } + } + }; + instanceProto.onDestroy = function () + { + this.myctx = null; + this.mycanvas = null; + if (this.runtime.glwrap && this.mytex) + this.runtime.glwrap.deleteTexture(this.mytex); + this.mytex = null; + }; + instanceProto.updateFont = function () + { + this.font = this.fontstyle + " " + this.ptSize.toString() + "pt " + this.facename; + this.text_changed = true; + this.runtime.redraw = true; + }; + instanceProto.draw = function(ctx, glmode) + { + ctx.font = this.font; + ctx.textBaseline = "top"; + ctx.fillStyle = this.color; + ctx.globalAlpha = glmode ? 1 : this.opacity; + var myscale = 1; + if (glmode) + { + myscale = Math.abs(this.layer.getScale()); + ctx.save(); + ctx.scale(myscale, myscale); + } + if (this.text_changed || this.width !== this.lastwrapwidth) + { + this.type.plugin.WordWrap(this.text, this.lines, ctx, this.width, this.wrapbyword); + this.text_changed = false; + this.lastwrapwidth = this.width; + } + this.update_bbox(); + var penX = glmode ? 0 : this.bquad.tlx; + var penY = glmode ? 0 : this.bquad.tly; + if (this.runtime.pixel_rounding) + { + penX = (penX + 0.5) | 0; + penY = (penY + 0.5) | 0; + } + if (this.angle !== 0 && !glmode) + { + ctx.save(); + ctx.translate(penX, penY); + ctx.rotate(this.angle); + penX = 0; + penY = 0; + } + var endY = penY + this.height; + var line_height = this.pxHeight; + line_height += this.line_height_offset; + var drawX; + var i; + if (this.valign === 1) // center + penY += Math.max(this.height / 2 - (this.lines.length * line_height) / 2, 0); + else if (this.valign === 2) // bottom + penY += Math.max(this.height - (this.lines.length * line_height) - 2, 0); + for (i = 0; i < this.lines.length; i++) + { + drawX = penX; + if (this.halign === 1) // center + drawX = penX + (this.width - this.lines[i].width) / 2; + else if (this.halign === 2) // right + drawX = penX + (this.width - this.lines[i].width); + ctx.fillText(this.lines[i].text, drawX, penY); + penY += line_height; + if (penY >= endY - line_height) + break; + } + if (this.angle !== 0 || glmode) + ctx.restore(); + this.last_render_tick = this.runtime.tickcount; + }; + instanceProto.drawGL = function(glw) + { + if (this.width < 1 || this.height < 1) + return; + var need_redraw = this.text_changed || this.need_text_redraw; + this.need_text_redraw = false; + var layer_scale = this.layer.getScale(); + var layer_angle = this.layer.getAngle(); + var rcTex = this.rcTex; + var floatscaledwidth = layer_scale * this.width; + var floatscaledheight = layer_scale * this.height; + var scaledwidth = Math.ceil(floatscaledwidth); + var scaledheight = Math.ceil(floatscaledheight); + var absscaledwidth = Math.abs(scaledwidth); + var absscaledheight = Math.abs(scaledheight); + var halfw = this.runtime.draw_width / 2; + var halfh = this.runtime.draw_height / 2; + if (!this.myctx) + { + this.mycanvas = document.createElement("canvas"); + this.mycanvas.width = absscaledwidth; + this.mycanvas.height = absscaledheight; + this.lastwidth = absscaledwidth; + this.lastheight = absscaledheight; + need_redraw = true; + this.myctx = this.mycanvas.getContext("2d"); + } + if (absscaledwidth !== this.lastwidth || absscaledheight !== this.lastheight) + { + this.mycanvas.width = absscaledwidth; + this.mycanvas.height = absscaledheight; + if (this.mytex) + { + glw.deleteTexture(this.mytex); + this.mytex = null; + } + need_redraw = true; + } + if (need_redraw) + { + this.myctx.clearRect(0, 0, absscaledwidth, absscaledheight); + this.draw(this.myctx, true); + if (!this.mytex) + this.mytex = glw.createEmptyTexture(absscaledwidth, absscaledheight, this.runtime.linearSampling, this.runtime.isMobile); + glw.videoToTexture(this.mycanvas, this.mytex, this.runtime.isMobile); + } + this.lastwidth = absscaledwidth; + this.lastheight = absscaledheight; + glw.setTexture(this.mytex); + glw.setOpacity(this.opacity); + glw.resetModelView(); + glw.translate(-halfw, -halfh); + glw.updateModelView(); + var q = this.bquad; + var tlx = this.layer.layerToCanvas(q.tlx, q.tly, true, true); + var tly = this.layer.layerToCanvas(q.tlx, q.tly, false, true); + var trx = this.layer.layerToCanvas(q.trx, q.try_, true, true); + var try_ = this.layer.layerToCanvas(q.trx, q.try_, false, true); + var brx = this.layer.layerToCanvas(q.brx, q.bry, true, true); + var bry = this.layer.layerToCanvas(q.brx, q.bry, false, true); + var blx = this.layer.layerToCanvas(q.blx, q.bly, true, true); + var bly = this.layer.layerToCanvas(q.blx, q.bly, false, true); + if (this.runtime.pixel_rounding || (this.angle === 0 && layer_angle === 0)) + { + var ox = ((tlx + 0.5) | 0) - tlx; + var oy = ((tly + 0.5) | 0) - tly + tlx += ox; + tly += oy; + trx += ox; + try_ += oy; + brx += ox; + bry += oy; + blx += ox; + bly += oy; + } + if (this.angle === 0 && layer_angle === 0) + { + trx = tlx + scaledwidth; + try_ = tly; + brx = trx; + bry = tly + scaledheight; + blx = tlx; + bly = bry; + rcTex.right = 1; + rcTex.bottom = 1; + } + else + { + rcTex.right = floatscaledwidth / scaledwidth; + rcTex.bottom = floatscaledheight / scaledheight; + } + glw.quadTex(tlx, tly, trx, try_, brx, bry, blx, bly, rcTex); + glw.resetModelView(); + glw.scale(layer_scale, layer_scale); + glw.rotateZ(-this.layer.getAngle()); + glw.translate((this.layer.viewLeft + this.layer.viewRight) / -2, (this.layer.viewTop + this.layer.viewBottom) / -2); + glw.updateModelView(); + this.last_render_tick = this.runtime.tickcount; + }; + var wordsCache = []; + pluginProto.TokeniseWords = function (text) + { + cr.clearArray(wordsCache); + var cur_word = ""; + var ch; + var i = 0; + while (i < text.length) + { + ch = text.charAt(i); + if (ch === "\n") + { + if (cur_word.length) + { + wordsCache.push(cur_word); + cur_word = ""; + } + wordsCache.push("\n"); + ++i; + } + else if (ch === " " || ch === "\t" || ch === "-") + { + do { + cur_word += text.charAt(i); + i++; + } + while (i < text.length && (text.charAt(i) === " " || text.charAt(i) === "\t")); + wordsCache.push(cur_word); + cur_word = ""; + } + else if (i < text.length) + { + cur_word += ch; + i++; + } + } + if (cur_word.length) + wordsCache.push(cur_word); + }; + var linesCache = []; + function allocLine() + { + if (linesCache.length) + return linesCache.pop(); + else + return {}; + }; + function freeLine(l) + { + linesCache.push(l); + }; + function freeAllLines(arr) + { + var i, len; + for (i = 0, len = arr.length; i < len; i++) + { + freeLine(arr[i]); + } + cr.clearArray(arr); + }; + pluginProto.WordWrap = function (text, lines, ctx, width, wrapbyword) + { + if (!text || !text.length) + { + freeAllLines(lines); + return; + } + if (width <= 2.0) + { + freeAllLines(lines); + return; + } + if (text.length <= 100 && text.indexOf("\n") === -1) + { + var all_width = ctx.measureText(text).width; + if (all_width <= width) + { + freeAllLines(lines); + lines.push(allocLine()); + lines[0].text = text; + lines[0].width = all_width; + return; + } + } + this.WrapText(text, lines, ctx, width, wrapbyword); + }; + function trimSingleSpaceRight(str) + { + if (!str.length || str.charAt(str.length - 1) !== " ") + return str; + return str.substring(0, str.length - 1); + }; + pluginProto.WrapText = function (text, lines, ctx, width, wrapbyword) + { + var wordArray; + if (wrapbyword) + { + this.TokeniseWords(text); // writes to wordsCache + wordArray = wordsCache; + } + else + wordArray = text; + var cur_line = ""; + var prev_line; + var line_width; + var i; + var lineIndex = 0; + var line; + for (i = 0; i < wordArray.length; i++) + { + if (wordArray[i] === "\n") + { + if (lineIndex >= lines.length) + lines.push(allocLine()); + cur_line = trimSingleSpaceRight(cur_line); // for correct center/right alignment + line = lines[lineIndex]; + line.text = cur_line; + line.width = ctx.measureText(cur_line).width; + lineIndex++; + cur_line = ""; + continue; + } + prev_line = cur_line; + cur_line += wordArray[i]; + line_width = ctx.measureText(cur_line).width; + if (line_width >= width) + { + if (lineIndex >= lines.length) + lines.push(allocLine()); + prev_line = trimSingleSpaceRight(prev_line); + line = lines[lineIndex]; + line.text = prev_line; + line.width = ctx.measureText(prev_line).width; + lineIndex++; + cur_line = wordArray[i]; + if (!wrapbyword && cur_line === " ") + cur_line = ""; + } + } + if (cur_line.length) + { + if (lineIndex >= lines.length) + lines.push(allocLine()); + cur_line = trimSingleSpaceRight(cur_line); + line = lines[lineIndex]; + line.text = cur_line; + line.width = ctx.measureText(cur_line).width; + lineIndex++; + } + for (i = lineIndex; i < lines.length; i++) + freeLine(lines[i]); + lines.length = lineIndex; + }; + function Cnds() {}; + Cnds.prototype.CompareText = function(text_to_compare, case_sensitive) + { + if (case_sensitive) + return this.text == text_to_compare; + else + return cr.equals_nocase(this.text, text_to_compare); + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetText = function(param) + { + if (cr.is_number(param) && param < 1e9) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_set = param.toString(); + if (this.text !== text_to_set) + { + this.text = text_to_set; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.AppendText = function(param) + { + if (cr.is_number(param)) + param = Math.round(param * 1e10) / 1e10; // round to nearest ten billionth - hides floating point errors + var text_to_append = param.toString(); + if (text_to_append) // not empty + { + this.text += text_to_append; + this.text_changed = true; + this.runtime.redraw = true; + } + }; + Acts.prototype.SetFontFace = function (face_, style_) + { + var newstyle = ""; + switch (style_) { + case 1: newstyle = "bold"; break; + case 2: newstyle = "italic"; break; + case 3: newstyle = "bold italic"; break; + } + if (face_ === this.facename && newstyle === this.fontstyle) + return; // no change + this.facename = face_; + this.fontstyle = newstyle; + this.updateFont(); + }; + Acts.prototype.SetFontSize = function (size_) + { + if (this.ptSize === size_) + return; + this.ptSize = size_; + this.pxHeight = Math.ceil((this.ptSize / 72.0) * 96.0) + 4; // assume 96dpi... + this.updateFont(); + }; + Acts.prototype.SetFontColor = function (rgb) + { + var newcolor = "rgb(" + cr.GetRValue(rgb).toString() + "," + cr.GetGValue(rgb).toString() + "," + cr.GetBValue(rgb).toString() + ")"; + if (newcolor === this.color) + return; + this.color = newcolor; + this.need_text_redraw = true; + this.runtime.redraw = true; + }; + Acts.prototype.SetWebFont = function (familyname_, cssurl_) + { + if (this.runtime.isDomFree) + { + cr.logexport("[Construct 2] Text plugin: 'Set web font' not supported on this platform - the action has been ignored"); + return; // DC todo + } + var self = this; + var refreshFunc = (function () { + self.runtime.redraw = true; + self.text_changed = true; + }); + if (requestedWebFonts.hasOwnProperty(cssurl_)) + { + var newfacename = "'" + familyname_ + "'"; + if (this.facename === newfacename) + return; // no change + this.facename = newfacename; + this.updateFont(); + for (var i = 1; i < 10; i++) + { + setTimeout(refreshFunc, i * 100); + setTimeout(refreshFunc, i * 1000); + } + return; + } + var wf = document.createElement("link"); + wf.href = cssurl_; + wf.rel = "stylesheet"; + wf.type = "text/css"; + wf.onload = refreshFunc; + document.getElementsByTagName('head')[0].appendChild(wf); + requestedWebFonts[cssurl_] = true; + this.facename = "'" + familyname_ + "'"; + this.updateFont(); + for (var i = 1; i < 10; i++) + { + setTimeout(refreshFunc, i * 100); + setTimeout(refreshFunc, i * 1000); + } +; + }; + Acts.prototype.SetEffect = function (effect) + { + this.blend_mode = effect; + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Text = function(ret) + { + ret.set_string(this.text); + }; + Exps.prototype.FaceName = function (ret) + { + ret.set_string(this.facename); + }; + Exps.prototype.FaceSize = function (ret) + { + ret.set_int(this.ptSize); + }; + Exps.prototype.TextWidth = function (ret) + { + var w = 0; + var i, len, x; + for (i = 0, len = this.lines.length; i < len; i++) + { + x = this.lines[i].width; + if (w < x) + w = x; + } + ret.set_int(w); + }; + Exps.prototype.TextHeight = function (ret) + { + ret.set_int(this.lines.length * (this.pxHeight + this.line_height_offset) - this.line_height_offset); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.TextBox = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.TextBox.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + var elemTypes = ["text", "password", "email", "number", "tel", "url"]; + if (navigator.userAgent.indexOf("MSIE 9") > -1) + { + elemTypes[2] = "text"; + elemTypes[3] = "text"; + elemTypes[4] = "text"; + elemTypes[5] = "text"; + } + instanceProto.onCreate = function() + { + if (this.runtime.isDomFree) + { + cr.logexport("[Construct 2] Textbox plugin not supported on this platform - the object will not be created"); + return; + } + if (this.properties[7] === 6) // textarea + { + this.elem = document.createElement("textarea"); + jQuery(this.elem).css("resize", "none"); + } + else + { + this.elem = document.createElement("input"); + this.elem.type = elemTypes[this.properties[7]]; + } + this.elem.id = this.properties[9]; + jQuery(this.elem).appendTo(this.runtime.canvasdiv ? this.runtime.canvasdiv : "body"); + this.elem["autocomplete"] = "off"; + this.elem.value = this.properties[0]; + this.elem["placeholder"] = this.properties[1]; + this.elem.title = this.properties[2]; + this.elem.disabled = (this.properties[4] === 0); + this.elem["readOnly"] = (this.properties[5] === 1); + this.elem["spellcheck"] = (this.properties[6] === 1); + this.autoFontSize = (this.properties[8] !== 0); + this.element_hidden = false; + if (this.properties[3] === 0) + { + jQuery(this.elem).hide(); + this.visible = false; + this.element_hidden = true; + } + var onchangetrigger = (function (self) { + return function() { + self.runtime.trigger(cr.plugins_.TextBox.prototype.cnds.OnTextChanged, self); + }; + })(this); + this.elem["oninput"] = onchangetrigger; + if (navigator.userAgent.indexOf("MSIE") !== -1) + this.elem["oncut"] = onchangetrigger; + this.elem.onclick = (function (self) { + return function(e) { + e.stopPropagation(); + self.runtime.isInUserInputEvent = true; + self.runtime.trigger(cr.plugins_.TextBox.prototype.cnds.OnClicked, self); + self.runtime.isInUserInputEvent = false; + }; + })(this); + this.elem.ondblclick = (function (self) { + return function(e) { + e.stopPropagation(); + self.runtime.isInUserInputEvent = true; + self.runtime.trigger(cr.plugins_.TextBox.prototype.cnds.OnDoubleClicked, self); + self.runtime.isInUserInputEvent = false; + }; + })(this); + this.elem.addEventListener("touchstart", function (e) { + e.stopPropagation(); + }, false); + this.elem.addEventListener("touchmove", function (e) { + e.stopPropagation(); + }, false); + this.elem.addEventListener("touchend", function (e) { + e.stopPropagation(); + }, false); + jQuery(this.elem).mousedown(function (e) { + e.stopPropagation(); + }); + jQuery(this.elem).mouseup(function (e) { + e.stopPropagation(); + }); + jQuery(this.elem).keydown(function (e) { + if (e.which !== 13 && e.which != 27) // allow enter and escape + e.stopPropagation(); + }); + jQuery(this.elem).keyup(function (e) { + if (e.which !== 13 && e.which != 27) // allow enter and escape + e.stopPropagation(); + }); + this.lastLeft = 0; + this.lastTop = 0; + this.lastRight = 0; + this.lastBottom = 0; + this.lastWinWidth = 0; + this.lastWinHeight = 0; + this.updatePosition(true); + this.runtime.tickMe(this); + }; + instanceProto.saveToJSON = function () + { + return { + "text": this.elem.value, + "placeholder": this.elem.placeholder, + "tooltip": this.elem.title, + "disabled": !!this.elem.disabled, + "readonly": !!this.elem.readOnly, + "spellcheck": !!this.elem["spellcheck"] + }; + }; + instanceProto.loadFromJSON = function (o) + { + this.elem.value = o["text"]; + this.elem.placeholder = o["placeholder"]; + this.elem.title = o["tooltip"]; + this.elem.disabled = o["disabled"]; + this.elem.readOnly = o["readonly"]; + this.elem["spellcheck"] = o["spellcheck"]; + }; + instanceProto.onDestroy = function () + { + if (this.runtime.isDomFree) + return; + jQuery(this.elem).remove(); + this.elem = null; + }; + instanceProto.tick = function () + { + this.updatePosition(); + }; + instanceProto.updatePosition = function (first) + { + if (this.runtime.isDomFree) + return; + var left = this.layer.layerToCanvas(this.x, this.y, true); + var top = this.layer.layerToCanvas(this.x, this.y, false); + var right = this.layer.layerToCanvas(this.x + this.width, this.y + this.height, true); + var bottom = this.layer.layerToCanvas(this.x + this.width, this.y + this.height, false); + var rightEdge = this.runtime.width / this.runtime.devicePixelRatio; + var bottomEdge = this.runtime.height / this.runtime.devicePixelRatio; + if (!this.visible || !this.layer.visible || right <= 0 || bottom <= 0 || left >= rightEdge || top >= bottomEdge) + { + if (!this.element_hidden) + jQuery(this.elem).hide(); + this.element_hidden = true; + return; + } + if (left < 1) + left = 1; + if (top < 1) + top = 1; + if (right >= rightEdge) + right = rightEdge - 1; + if (bottom >= bottomEdge) + bottom = bottomEdge - 1; + var curWinWidth = window.innerWidth; + var curWinHeight = window.innerHeight; + if (!first && this.lastLeft === left && this.lastTop === top && this.lastRight === right && this.lastBottom === bottom && this.lastWinWidth === curWinWidth && this.lastWinHeight === curWinHeight) + { + if (this.element_hidden) + { + jQuery(this.elem).show(); + this.element_hidden = false; + } + return; + } + this.lastLeft = left; + this.lastTop = top; + this.lastRight = right; + this.lastBottom = bottom; + this.lastWinWidth = curWinWidth; + this.lastWinHeight = curWinHeight; + if (this.element_hidden) + { + jQuery(this.elem).show(); + this.element_hidden = false; + } + var offx = Math.round(left) + jQuery(this.runtime.canvas).offset().left; + var offy = Math.round(top) + jQuery(this.runtime.canvas).offset().top; + jQuery(this.elem).css("position", "absolute"); + jQuery(this.elem).offset({left: offx, top: offy}); + jQuery(this.elem).width(Math.round(right - left)); + jQuery(this.elem).height(Math.round(bottom - top)); + if (this.autoFontSize) + jQuery(this.elem).css("font-size", ((this.layer.getScale(true) / this.runtime.devicePixelRatio) - 0.2) + "em"); + }; + instanceProto.draw = function(ctx) + { + }; + instanceProto.drawGL = function(glw) + { + }; + function Cnds() {}; + Cnds.prototype.CompareText = function (text, case_) + { + if (this.runtime.isDomFree) + return false; + if (case_ === 0) // insensitive + return cr.equals_nocase(this.elem.value, text); + else + return this.elem.value === text; + }; + Cnds.prototype.OnTextChanged = function () + { + return true; + }; + Cnds.prototype.OnClicked = function () + { + return true; + }; + Cnds.prototype.OnDoubleClicked = function () + { + return true; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetText = function (text) + { + if (this.runtime.isDomFree) + return; + this.elem.value = text; + }; + Acts.prototype.SetPlaceholder = function (text) + { + if (this.runtime.isDomFree) + return; + this.elem.placeholder = text; + }; + Acts.prototype.SetTooltip = function (text) + { + if (this.runtime.isDomFree) + return; + this.elem.title = text; + }; + Acts.prototype.SetVisible = function (vis) + { + if (this.runtime.isDomFree) + return; + this.visible = (vis !== 0); + }; + Acts.prototype.SetEnabled = function (en) + { + if (this.runtime.isDomFree) + return; + this.elem.disabled = (en === 0); + }; + Acts.prototype.SetReadOnly = function (ro) + { + if (this.runtime.isDomFree) + return; + this.elem.readOnly = (ro === 0); + }; + Acts.prototype.SetFocus = function () + { + if (this.runtime.isDomFree) + return; + this.elem.focus(); + }; + Acts.prototype.SetBlur = function () + { + if (this.runtime.isDomFree) + return; + this.elem.blur(); + }; + Acts.prototype.SetCSSStyle = function (p, v) + { + if (this.runtime.isDomFree) + return; + jQuery(this.elem).css(p, v); + }; + Acts.prototype.ScrollToBottom = function () + { + if (this.runtime.isDomFree) + return; + this.elem.scrollTop = this.elem.scrollHeight; + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Text = function (ret) + { + if (this.runtime.isDomFree) + { + ret.set_string(""); + return; + } + ret.set_string(this.elem.value); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.TiledBg = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.TiledBg.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + if (this.is_family) + return; + this.texture_img = new Image(); + this.texture_img.cr_filesize = this.texture_filesize; + this.runtime.waitForImageLoad(this.texture_img, this.texture_file); + this.pattern = null; + this.webGL_texture = null; + }; + typeProto.onLostWebGLContext = function () + { + if (this.is_family) + return; + this.webGL_texture = null; + }; + typeProto.onRestoreWebGLContext = function () + { + if (this.is_family || !this.instances.length) + return; + if (!this.webGL_texture) + { + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, true, this.runtime.linearSampling, this.texture_pixelformat); + } + var i, len; + for (i = 0, len = this.instances.length; i < len; i++) + this.instances[i].webGL_texture = this.webGL_texture; + }; + typeProto.loadTextures = function () + { + if (this.is_family || this.webGL_texture || !this.runtime.glwrap) + return; + this.webGL_texture = this.runtime.glwrap.loadTexture(this.texture_img, true, this.runtime.linearSampling, this.texture_pixelformat); + }; + typeProto.unloadTextures = function () + { + if (this.is_family || this.instances.length || !this.webGL_texture) + return; + this.runtime.glwrap.deleteTexture(this.webGL_texture); + this.webGL_texture = null; + }; + typeProto.preloadCanvas2D = function (ctx) + { + ctx.drawImage(this.texture_img, 0, 0); + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + this.visible = (this.properties[0] === 0); // 0=visible, 1=invisible + this.rcTex = new cr.rect(0, 0, 0, 0); + this.has_own_texture = false; // true if a texture loaded in from URL + this.texture_img = this.type.texture_img; + if (this.runtime.glwrap) + { + this.type.loadTextures(); + this.webGL_texture = this.type.webGL_texture; + } + else + { + if (!this.type.pattern) + this.type.pattern = this.runtime.ctx.createPattern(this.type.texture_img, "repeat"); + this.pattern = this.type.pattern; + } + }; + instanceProto.afterLoad = function () + { + this.has_own_texture = false; + this.texture_img = this.type.texture_img; + }; + instanceProto.onDestroy = function () + { + if (this.runtime.glwrap && this.has_own_texture && this.webGL_texture) + { + this.runtime.glwrap.deleteTexture(this.webGL_texture); + this.webGL_texture = null; + } + }; + instanceProto.draw = function(ctx) + { + ctx.globalAlpha = this.opacity; + ctx.save(); + ctx.fillStyle = this.pattern; + var myx = this.x; + var myy = this.y; + if (this.runtime.pixel_rounding) + { + myx = Math.round(myx); + myy = Math.round(myy); + } + var drawX = -(this.hotspotX * this.width); + var drawY = -(this.hotspotY * this.height); + var offX = drawX % this.texture_img.width; + var offY = drawY % this.texture_img.height; + if (offX < 0) + offX += this.texture_img.width; + if (offY < 0) + offY += this.texture_img.height; + ctx.translate(myx, myy); + ctx.rotate(this.angle); + ctx.translate(offX, offY); + ctx.fillRect(drawX - offX, + drawY - offY, + this.width, + this.height); + ctx.restore(); + }; + instanceProto.drawGL_earlyZPass = function(glw) + { + this.drawGL(glw); + }; + instanceProto.drawGL = function(glw) + { + glw.setTexture(this.webGL_texture); + glw.setOpacity(this.opacity); + var rcTex = this.rcTex; + rcTex.right = this.width / this.texture_img.width; + rcTex.bottom = this.height / this.texture_img.height; + var q = this.bquad; + if (this.runtime.pixel_rounding) + { + var ox = Math.round(this.x) - this.x; + var oy = Math.round(this.y) - this.y; + glw.quadTex(q.tlx + ox, q.tly + oy, q.trx + ox, q.try_ + oy, q.brx + ox, q.bry + oy, q.blx + ox, q.bly + oy, rcTex); + } + else + glw.quadTex(q.tlx, q.tly, q.trx, q.try_, q.brx, q.bry, q.blx, q.bly, rcTex); + }; + function Cnds() {}; + Cnds.prototype.OnURLLoaded = function () + { + return true; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetEffect = function (effect) + { + this.blend_mode = effect; + this.compositeOp = cr.effectToCompositeOp(effect); + cr.setGLBlend(this, effect, this.runtime.gl); + this.runtime.redraw = true; + }; + Acts.prototype.LoadURL = function (url_, crossOrigin_) + { + var img = new Image(); + var self = this; + img.onload = function () + { + self.texture_img = img; + if (self.runtime.glwrap) + { + if (self.has_own_texture && self.webGL_texture) + self.runtime.glwrap.deleteTexture(self.webGL_texture); + self.webGL_texture = self.runtime.glwrap.loadTexture(img, true, self.runtime.linearSampling); + } + else + { + self.pattern = self.runtime.ctx.createPattern(img, "repeat"); + } + self.has_own_texture = true; + self.runtime.redraw = true; + self.runtime.trigger(cr.plugins_.TiledBg.prototype.cnds.OnURLLoaded, self); + }; + if (url_.substr(0, 5) !== "data:" && crossOrigin_ === 0) + img.crossOrigin = "anonymous"; + this.runtime.setImageSrc(img, url_); + }; + pluginProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.ImageWidth = function (ret) + { + ret.set_float(this.texture_img.width); + }; + Exps.prototype.ImageHeight = function (ret) + { + ret.set_float(this.texture_img.height); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.Touch = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.Touch.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + this.touches = []; + this.mouseDown = false; + }; + var instanceProto = pluginProto.Instance.prototype; + var dummyoffset = {left: 0, top: 0}; + instanceProto.findTouch = function (id) + { + var i, len; + for (i = 0, len = this.touches.length; i < len; i++) + { + if (this.touches[i]["id"] === id) + return i; + } + return -1; + }; + var appmobi_accx = 0; + var appmobi_accy = 0; + var appmobi_accz = 0; + function AppMobiGetAcceleration(evt) + { + appmobi_accx = evt.x; + appmobi_accy = evt.y; + appmobi_accz = evt.z; + }; + var pg_accx = 0; + var pg_accy = 0; + var pg_accz = 0; + function PhoneGapGetAcceleration(evt) + { + pg_accx = evt.x; + pg_accy = evt.y; + pg_accz = evt.z; + }; + var theInstance = null; + var touchinfo_cache = []; + function AllocTouchInfo(x, y, id, index) + { + var ret; + if (touchinfo_cache.length) + ret = touchinfo_cache.pop(); + else + ret = new TouchInfo(); + ret.init(x, y, id, index); + return ret; + }; + function ReleaseTouchInfo(ti) + { + if (touchinfo_cache.length < 100) + touchinfo_cache.push(ti); + }; + var GESTURE_HOLD_THRESHOLD = 15; // max px motion for hold gesture to register + var GESTURE_HOLD_TIMEOUT = 500; // time for hold gesture to register + var GESTURE_TAP_TIMEOUT = 333; // time for tap gesture to register + var GESTURE_DOUBLETAP_THRESHOLD = 25; // max distance apart for taps to be + function TouchInfo() + { + this.starttime = 0; + this.time = 0; + this.lasttime = 0; + this.startx = 0; + this.starty = 0; + this.x = 0; + this.y = 0; + this.lastx = 0; + this.lasty = 0; + this["id"] = 0; + this.startindex = 0; + this.triggeredHold = false; + this.tooFarForHold = false; + }; + TouchInfo.prototype.init = function (x, y, id, index) + { + var nowtime = cr.performance_now(); + this.time = nowtime; + this.lasttime = nowtime; + this.starttime = nowtime; + this.startx = x; + this.starty = y; + this.x = x; + this.y = y; + this.lastx = x; + this.lasty = y; + this.width = 0; + this.height = 0; + this.pressure = 0; + this["id"] = id; + this.startindex = index; + this.triggeredHold = false; + this.tooFarForHold = false; + }; + TouchInfo.prototype.update = function (nowtime, x, y, width, height, pressure) + { + this.lasttime = this.time; + this.time = nowtime; + this.lastx = this.x; + this.lasty = this.y; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.pressure = pressure; + if (!this.tooFarForHold && cr.distanceTo(this.startx, this.starty, this.x, this.y) >= GESTURE_HOLD_THRESHOLD) + { + this.tooFarForHold = true; + } + }; + TouchInfo.prototype.maybeTriggerHold = function (inst, index) + { + if (this.triggeredHold) + return; // already triggered this gesture + var nowtime = cr.performance_now(); + if (nowtime - this.starttime >= GESTURE_HOLD_TIMEOUT && !this.tooFarForHold && cr.distanceTo(this.startx, this.starty, this.x, this.y) < GESTURE_HOLD_THRESHOLD) + { + this.triggeredHold = true; + inst.trigger_index = this.startindex; + inst.trigger_id = this["id"]; + inst.getTouchIndex = index; + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnHoldGesture, inst); + inst.curTouchX = this.x; + inst.curTouchY = this.y; + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnHoldGestureObject, inst); + inst.getTouchIndex = 0; + } + }; + var lastTapX = -1000; + var lastTapY = -1000; + var lastTapTime = -10000; + TouchInfo.prototype.maybeTriggerTap = function (inst, index) + { + if (this.triggeredHold) + return; + var nowtime = cr.performance_now(); + if (nowtime - this.starttime <= GESTURE_TAP_TIMEOUT && !this.tooFarForHold && cr.distanceTo(this.startx, this.starty, this.x, this.y) < GESTURE_HOLD_THRESHOLD) + { + inst.trigger_index = this.startindex; + inst.trigger_id = this["id"]; + inst.getTouchIndex = index; + if ((nowtime - lastTapTime <= GESTURE_TAP_TIMEOUT * 2) && cr.distanceTo(lastTapX, lastTapY, this.x, this.y) < GESTURE_DOUBLETAP_THRESHOLD) + { + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnDoubleTapGesture, inst); + inst.curTouchX = this.x; + inst.curTouchY = this.y; + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnDoubleTapGestureObject, inst); + lastTapX = -1000; + lastTapY = -1000; + lastTapTime = -10000; + } + else + { + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTapGesture, inst); + inst.curTouchX = this.x; + inst.curTouchY = this.y; + inst.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTapGestureObject, inst); + lastTapX = this.x; + lastTapY = this.y; + lastTapTime = nowtime; + } + inst.getTouchIndex = 0; + } + }; + instanceProto.onCreate = function() + { + theInstance = this; + this.isWindows8 = !!(typeof window["c2isWindows8"] !== "undefined" && window["c2isWindows8"]); + this.orient_alpha = 0; + this.orient_beta = 0; + this.orient_gamma = 0; + this.acc_g_x = 0; + this.acc_g_y = 0; + this.acc_g_z = 0; + this.acc_x = 0; + this.acc_y = 0; + this.acc_z = 0; + this.curTouchX = 0; + this.curTouchY = 0; + this.trigger_index = 0; + this.trigger_id = 0; + this.getTouchIndex = 0; + this.useMouseInput = (this.properties[0] !== 0); + var elem = (this.runtime.fullscreen_mode > 0) ? document : this.runtime.canvas; + var elem2 = document; + if (this.runtime.isDirectCanvas) + elem2 = elem = window["Canvas"]; + else if (this.runtime.isCocoonJs) + elem2 = elem = window; + var self = this; + if (typeof PointerEvent !== "undefined") + { + elem.addEventListener("pointerdown", + function(info) { + self.onPointerStart(info); + }, + false + ); + elem.addEventListener("pointermove", + function(info) { + self.onPointerMove(info); + }, + false + ); + elem2.addEventListener("pointerup", + function(info) { + self.onPointerEnd(info, false); + }, + false + ); + elem2.addEventListener("pointercancel", + function(info) { + self.onPointerEnd(info, true); + }, + false + ); + if (this.runtime.canvas) + { + this.runtime.canvas.addEventListener("MSGestureHold", function(e) { + e.preventDefault(); + }, false); + document.addEventListener("MSGestureHold", function(e) { + e.preventDefault(); + }, false); + this.runtime.canvas.addEventListener("gesturehold", function(e) { + e.preventDefault(); + }, false); + document.addEventListener("gesturehold", function(e) { + e.preventDefault(); + }, false); + } + } + else if (window.navigator["msPointerEnabled"]) + { + elem.addEventListener("MSPointerDown", + function(info) { + self.onPointerStart(info); + }, + false + ); + elem.addEventListener("MSPointerMove", + function(info) { + self.onPointerMove(info); + }, + false + ); + elem2.addEventListener("MSPointerUp", + function(info) { + self.onPointerEnd(info, false); + }, + false + ); + elem2.addEventListener("MSPointerCancel", + function(info) { + self.onPointerEnd(info, true); + }, + false + ); + if (this.runtime.canvas) + { + this.runtime.canvas.addEventListener("MSGestureHold", function(e) { + e.preventDefault(); + }, false); + document.addEventListener("MSGestureHold", function(e) { + e.preventDefault(); + }, false); + } + } + else + { + elem.addEventListener("touchstart", + function(info) { + self.onTouchStart(info); + }, + false + ); + elem.addEventListener("touchmove", + function(info) { + self.onTouchMove(info); + }, + false + ); + elem2.addEventListener("touchend", + function(info) { + self.onTouchEnd(info, false); + }, + false + ); + elem2.addEventListener("touchcancel", + function(info) { + self.onTouchEnd(info, true); + }, + false + ); + } + if (this.isWindows8) + { + var win8accelerometerFn = function(e) { + var reading = e["reading"]; + self.acc_x = reading["accelerationX"]; + self.acc_y = reading["accelerationY"]; + self.acc_z = reading["accelerationZ"]; + }; + var win8inclinometerFn = function(e) { + var reading = e["reading"]; + self.orient_alpha = reading["yawDegrees"]; + self.orient_beta = reading["pitchDegrees"]; + self.orient_gamma = reading["rollDegrees"]; + }; + var accelerometer = Windows["Devices"]["Sensors"]["Accelerometer"]["getDefault"](); + if (accelerometer) + { + accelerometer["reportInterval"] = Math.max(accelerometer["minimumReportInterval"], 16); + accelerometer.addEventListener("readingchanged", win8accelerometerFn); + } + var inclinometer = Windows["Devices"]["Sensors"]["Inclinometer"]["getDefault"](); + if (inclinometer) + { + inclinometer["reportInterval"] = Math.max(inclinometer["minimumReportInterval"], 16); + inclinometer.addEventListener("readingchanged", win8inclinometerFn); + } + document.addEventListener("visibilitychange", function(e) { + if (document["hidden"] || document["msHidden"]) + { + if (accelerometer) + accelerometer.removeEventListener("readingchanged", win8accelerometerFn); + if (inclinometer) + inclinometer.removeEventListener("readingchanged", win8inclinometerFn); + } + else + { + if (accelerometer) + accelerometer.addEventListener("readingchanged", win8accelerometerFn); + if (inclinometer) + inclinometer.addEventListener("readingchanged", win8inclinometerFn); + } + }, false); + } + else + { + window.addEventListener("deviceorientation", function (eventData) { + self.orient_alpha = eventData["alpha"] || 0; + self.orient_beta = eventData["beta"] || 0; + self.orient_gamma = eventData["gamma"] || 0; + }, false); + window.addEventListener("devicemotion", function (eventData) { + if (eventData["accelerationIncludingGravity"]) + { + self.acc_g_x = eventData["accelerationIncludingGravity"]["x"] || 0; + self.acc_g_y = eventData["accelerationIncludingGravity"]["y"] || 0; + self.acc_g_z = eventData["accelerationIncludingGravity"]["z"] || 0; + } + if (eventData["acceleration"]) + { + self.acc_x = eventData["acceleration"]["x"] || 0; + self.acc_y = eventData["acceleration"]["y"] || 0; + self.acc_z = eventData["acceleration"]["z"] || 0; + } + }, false); + } + if (this.useMouseInput && !this.runtime.isDomFree) + { + jQuery(document).mousemove( + function(info) { + self.onMouseMove(info); + } + ); + jQuery(document).mousedown( + function(info) { + self.onMouseDown(info); + } + ); + jQuery(document).mouseup( + function(info) { + self.onMouseUp(info); + } + ); + } + if (!this.runtime.isiOS && this.runtime.isCordova && navigator["accelerometer"] && navigator["accelerometer"]["watchAcceleration"]) + { + navigator["accelerometer"]["watchAcceleration"](PhoneGapGetAcceleration, null, { "frequency": 40 }); + } + this.runtime.tick2Me(this); + }; + instanceProto.onPointerMove = function (info) + { + if (info["pointerType"] === info["MSPOINTER_TYPE_MOUSE"] || info["pointerType"] === "mouse") + return; + if (info.preventDefault) + info.preventDefault(); + var i = this.findTouch(info["pointerId"]); + var nowtime = cr.performance_now(); + if (i >= 0) + { + var offset = this.runtime.isDomFree ? dummyoffset : jQuery(this.runtime.canvas).offset(); + var t = this.touches[i]; + if (nowtime - t.time < 2) + return; + t.update(nowtime, info.pageX - offset.left, info.pageY - offset.top, info.width || 0, info.height || 0, info.pressure || 0); + } + }; + instanceProto.onPointerStart = function (info) + { + if (info["pointerType"] === info["MSPOINTER_TYPE_MOUSE"] || info["pointerType"] === "mouse") + return; + if (info.preventDefault && cr.isCanvasInputEvent(info)) + info.preventDefault(); + var offset = this.runtime.isDomFree ? dummyoffset : jQuery(this.runtime.canvas).offset(); + var touchx = info.pageX - offset.left; + var touchy = info.pageY - offset.top; + var nowtime = cr.performance_now(); + this.trigger_index = this.touches.length; + this.trigger_id = info["pointerId"]; + this.touches.push(AllocTouchInfo(touchx, touchy, info["pointerId"], this.trigger_index)); + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchStart, this); + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchStart, this); + this.curTouchX = touchx; + this.curTouchY = touchy; + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchObject, this); + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onPointerEnd = function (info, isCancel) + { + if (info["pointerType"] === info["MSPOINTER_TYPE_MOUSE"] || info["pointerType"] === "mouse") + return; + if (info.preventDefault && cr.isCanvasInputEvent(info)) + info.preventDefault(); + var i = this.findTouch(info["pointerId"]); + this.trigger_index = (i >= 0 ? this.touches[i].startindex : -1); + this.trigger_id = (i >= 0 ? this.touches[i]["id"] : -1); + this.runtime.isInUserInputEvent = true; + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchEnd, this); + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchEnd, this); + if (i >= 0) + { + if (!isCancel) + this.touches[i].maybeTriggerTap(this, i); + ReleaseTouchInfo(this.touches[i]); + this.touches.splice(i, 1); + } + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onTouchMove = function (info) + { + if (info.preventDefault) + info.preventDefault(); + var nowtime = cr.performance_now(); + var i, len, t, u; + for (i = 0, len = info.changedTouches.length; i < len; i++) + { + t = info.changedTouches[i]; + var j = this.findTouch(t["identifier"]); + if (j >= 0) + { + var offset = this.runtime.isDomFree ? dummyoffset : jQuery(this.runtime.canvas).offset(); + u = this.touches[j]; + if (nowtime - u.time < 2) + continue; + var touchWidth = (t.radiusX || t.webkitRadiusX || t.mozRadiusX || t.msRadiusX || 0) * 2; + var touchHeight = (t.radiusY || t.webkitRadiusY || t.mozRadiusY || t.msRadiusY || 0) * 2; + var touchForce = t.force || t.webkitForce || t.mozForce || t.msForce || 0; + u.update(nowtime, t.pageX - offset.left, t.pageY - offset.top, touchWidth, touchHeight, touchForce); + } + } + }; + instanceProto.onTouchStart = function (info) + { + if (info.preventDefault && cr.isCanvasInputEvent(info)) + info.preventDefault(); + var offset = this.runtime.isDomFree ? dummyoffset : jQuery(this.runtime.canvas).offset(); + var nowtime = cr.performance_now(); + this.runtime.isInUserInputEvent = true; + var i, len, t, j; + for (i = 0, len = info.changedTouches.length; i < len; i++) + { + t = info.changedTouches[i]; + j = this.findTouch(t["identifier"]); + if (j !== -1) + continue; + var touchx = t.pageX - offset.left; + var touchy = t.pageY - offset.top; + this.trigger_index = this.touches.length; + this.trigger_id = t["identifier"]; + this.touches.push(AllocTouchInfo(touchx, touchy, t["identifier"], this.trigger_index)); + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchStart, this); + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchStart, this); + this.curTouchX = touchx; + this.curTouchY = touchy; + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchObject, this); + } + this.runtime.isInUserInputEvent = false; + }; + instanceProto.onTouchEnd = function (info, isCancel) + { + if (info.preventDefault && cr.isCanvasInputEvent(info)) + info.preventDefault(); + this.runtime.isInUserInputEvent = true; + var i, len, t, j; + for (i = 0, len = info.changedTouches.length; i < len; i++) + { + t = info.changedTouches[i]; + j = this.findTouch(t["identifier"]); + if (j >= 0) + { + this.trigger_index = this.touches[j].startindex; + this.trigger_id = this.touches[j]["id"]; + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnNthTouchEnd, this); + this.runtime.trigger(cr.plugins_.Touch.prototype.cnds.OnTouchEnd, this); + if (!isCancel) + this.touches[j].maybeTriggerTap(this, j); + ReleaseTouchInfo(this.touches[j]); + this.touches.splice(j, 1); + } + } + this.runtime.isInUserInputEvent = false; + }; + instanceProto.getAlpha = function () + { + if (this.runtime.isCordova && this.orient_alpha === 0 && pg_accz !== 0) + return pg_accz * 90; + else + return this.orient_alpha; + }; + instanceProto.getBeta = function () + { + if (this.runtime.isCordova && this.orient_beta === 0 && pg_accy !== 0) + return pg_accy * 90; + else + return this.orient_beta; + }; + instanceProto.getGamma = function () + { + if (this.runtime.isCordova && this.orient_gamma === 0 && pg_accx !== 0) + return pg_accx * 90; + else + return this.orient_gamma; + }; + var noop_func = function(){}; + instanceProto.onMouseDown = function(info) + { + var t = { pageX: info.pageX, pageY: info.pageY, "identifier": 0 }; + var fakeinfo = { changedTouches: [t] }; + this.onTouchStart(fakeinfo); + this.mouseDown = true; + }; + instanceProto.onMouseMove = function(info) + { + if (!this.mouseDown) + return; + var t = { pageX: info.pageX, pageY: info.pageY, "identifier": 0 }; + var fakeinfo = { changedTouches: [t] }; + this.onTouchMove(fakeinfo); + }; + instanceProto.onMouseUp = function(info) + { + if (info.preventDefault && this.runtime.had_a_click && !this.runtime.isMobile) + info.preventDefault(); + this.runtime.had_a_click = true; + var t = { pageX: info.pageX, pageY: info.pageY, "identifier": 0 }; + var fakeinfo = { changedTouches: [t] }; + this.onTouchEnd(fakeinfo); + this.mouseDown = false; + }; + instanceProto.tick2 = function() + { + var i, len, t; + var nowtime = cr.performance_now(); + for (i = 0, len = this.touches.length; i < len; ++i) + { + t = this.touches[i]; + if (t.time <= nowtime - 50) + t.lasttime = nowtime; + t.maybeTriggerHold(this, i); + } + }; + function Cnds() {}; + Cnds.prototype.OnTouchStart = function () + { + return true; + }; + Cnds.prototype.OnTouchEnd = function () + { + return true; + }; + Cnds.prototype.IsInTouch = function () + { + return this.touches.length; + }; + Cnds.prototype.OnTouchObject = function (type) + { + if (!type) + return false; + return this.runtime.testAndSelectCanvasPointOverlap(type, this.curTouchX, this.curTouchY, false); + }; + var touching = []; + Cnds.prototype.IsTouchingObject = function (type) + { + if (!type) + return false; + var sol = type.getCurrentSol(); + var instances = sol.getObjects(); + var px, py; + var i, leni, j, lenj; + for (i = 0, leni = instances.length; i < leni; i++) + { + var inst = instances[i]; + inst.update_bbox(); + for (j = 0, lenj = this.touches.length; j < lenj; j++) + { + var touch = this.touches[j]; + px = inst.layer.canvasToLayer(touch.x, touch.y, true); + py = inst.layer.canvasToLayer(touch.x, touch.y, false); + if (inst.contains_pt(px, py)) + { + touching.push(inst); + break; + } + } + } + if (touching.length) + { + sol.select_all = false; + cr.shallowAssignArray(sol.instances, touching); + type.applySolToContainer(); + cr.clearArray(touching); + return true; + } + else + return false; + }; + Cnds.prototype.CompareTouchSpeed = function (index, cmp, s) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + return false; + var t = this.touches[index]; + var dist = cr.distanceTo(t.x, t.y, t.lastx, t.lasty); + var timediff = (t.time - t.lasttime) / 1000; + var speed = 0; + if (timediff > 0) + speed = dist / timediff; + return cr.do_cmp(speed, cmp, s); + }; + Cnds.prototype.OrientationSupported = function () + { + return typeof window["DeviceOrientationEvent"] !== "undefined"; + }; + Cnds.prototype.MotionSupported = function () + { + return typeof window["DeviceMotionEvent"] !== "undefined"; + }; + Cnds.prototype.CompareOrientation = function (orientation_, cmp_, angle_) + { + var v = 0; + if (orientation_ === 0) + v = this.getAlpha(); + else if (orientation_ === 1) + v = this.getBeta(); + else + v = this.getGamma(); + return cr.do_cmp(v, cmp_, angle_); + }; + Cnds.prototype.CompareAcceleration = function (acceleration_, cmp_, angle_) + { + var v = 0; + if (acceleration_ === 0) + v = this.acc_g_x; + else if (acceleration_ === 1) + v = this.acc_g_y; + else if (acceleration_ === 2) + v = this.acc_g_z; + else if (acceleration_ === 3) + v = this.acc_x; + else if (acceleration_ === 4) + v = this.acc_y; + else if (acceleration_ === 5) + v = this.acc_z; + return cr.do_cmp(v, cmp_, angle_); + }; + Cnds.prototype.OnNthTouchStart = function (touch_) + { + touch_ = Math.floor(touch_); + return touch_ === this.trigger_index; + }; + Cnds.prototype.OnNthTouchEnd = function (touch_) + { + touch_ = Math.floor(touch_); + return touch_ === this.trigger_index; + }; + Cnds.prototype.HasNthTouch = function (touch_) + { + touch_ = Math.floor(touch_); + return this.touches.length >= touch_ + 1; + }; + Cnds.prototype.OnHoldGesture = function () + { + return true; + }; + Cnds.prototype.OnTapGesture = function () + { + return true; + }; + Cnds.prototype.OnDoubleTapGesture = function () + { + return true; + }; + Cnds.prototype.OnHoldGestureObject = function (type) + { + if (!type) + return false; + return this.runtime.testAndSelectCanvasPointOverlap(type, this.curTouchX, this.curTouchY, false); + }; + Cnds.prototype.OnTapGestureObject = function (type) + { + if (!type) + return false; + return this.runtime.testAndSelectCanvasPointOverlap(type, this.curTouchX, this.curTouchY, false); + }; + Cnds.prototype.OnDoubleTapGestureObject = function (type) + { + if (!type) + return false; + return this.runtime.testAndSelectCanvasPointOverlap(type, this.curTouchX, this.curTouchY, false); + }; + pluginProto.cnds = new Cnds(); + function Exps() {}; + Exps.prototype.TouchCount = function (ret) + { + ret.set_int(this.touches.length); + }; + Exps.prototype.X = function (ret, layerparam) + { + var index = this.getTouchIndex; + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var layer, oldScale, oldZoomRate, oldParallaxX, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxX = layer.parallaxX; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxX = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, true)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxX = oldParallaxX; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, true)); + else + ret.set_float(0); + } + }; + Exps.prototype.XAt = function (ret, index, layerparam) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var layer, oldScale, oldZoomRate, oldParallaxX, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxX = layer.parallaxX; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxX = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, true)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxX = oldParallaxX; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, true)); + else + ret.set_float(0); + } + }; + Exps.prototype.XForID = function (ret, id, layerparam) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + var layer, oldScale, oldZoomRate, oldParallaxX, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxX = layer.parallaxX; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxX = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(touch.x, touch.y, true)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxX = oldParallaxX; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(touch.x, touch.y, true)); + else + ret.set_float(0); + } + }; + Exps.prototype.Y = function (ret, layerparam) + { + var index = this.getTouchIndex; + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var layer, oldScale, oldZoomRate, oldParallaxY, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxY = layer.parallaxY; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxY = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, false)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxY = oldParallaxY; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, false)); + else + ret.set_float(0); + } + }; + Exps.prototype.YAt = function (ret, index, layerparam) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var layer, oldScale, oldZoomRate, oldParallaxY, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxY = layer.parallaxY; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxY = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, false)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxY = oldParallaxY; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(this.touches[index].x, this.touches[index].y, false)); + else + ret.set_float(0); + } + }; + Exps.prototype.YForID = function (ret, id, layerparam) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + var layer, oldScale, oldZoomRate, oldParallaxY, oldAngle; + if (cr.is_undefined(layerparam)) + { + layer = this.runtime.getLayerByNumber(0); + oldScale = layer.scale; + oldZoomRate = layer.zoomRate; + oldParallaxY = layer.parallaxY; + oldAngle = layer.angle; + layer.scale = 1; + layer.zoomRate = 1.0; + layer.parallaxY = 1.0; + layer.angle = 0; + ret.set_float(layer.canvasToLayer(touch.x, touch.y, false)); + layer.scale = oldScale; + layer.zoomRate = oldZoomRate; + layer.parallaxY = oldParallaxY; + layer.angle = oldAngle; + } + else + { + if (cr.is_number(layerparam)) + layer = this.runtime.getLayerByNumber(layerparam); + else + layer = this.runtime.getLayerByName(layerparam); + if (layer) + ret.set_float(layer.canvasToLayer(touch.x, touch.y, false)); + else + ret.set_float(0); + } + }; + Exps.prototype.AbsoluteX = function (ret) + { + if (this.touches.length) + ret.set_float(this.touches[0].x); + else + ret.set_float(0); + }; + Exps.prototype.AbsoluteXAt = function (ret, index) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + ret.set_float(this.touches[index].x); + }; + Exps.prototype.AbsoluteXForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(touch.x); + }; + Exps.prototype.AbsoluteY = function (ret) + { + if (this.touches.length) + ret.set_float(this.touches[0].y); + else + ret.set_float(0); + }; + Exps.prototype.AbsoluteYAt = function (ret, index) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + ret.set_float(this.touches[index].y); + }; + Exps.prototype.AbsoluteYForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(touch.y); + }; + Exps.prototype.SpeedAt = function (ret, index) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var t = this.touches[index]; + var dist = cr.distanceTo(t.x, t.y, t.lastx, t.lasty); + var timediff = (t.time - t.lasttime) / 1000; + if (timediff === 0) + ret.set_float(0); + else + ret.set_float(dist / timediff); + }; + Exps.prototype.SpeedForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + var dist = cr.distanceTo(touch.x, touch.y, touch.lastx, touch.lasty); + var timediff = (touch.time - touch.lasttime) / 1000; + if (timediff === 0) + ret.set_float(0); + else + ret.set_float(dist / timediff); + }; + Exps.prototype.AngleAt = function (ret, index) + { + index = Math.floor(index); + if (index < 0 || index >= this.touches.length) + { + ret.set_float(0); + return; + } + var t = this.touches[index]; + ret.set_float(cr.to_degrees(cr.angleTo(t.lastx, t.lasty, t.x, t.y))); + }; + Exps.prototype.AngleForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(cr.to_degrees(cr.angleTo(touch.lastx, touch.lasty, touch.x, touch.y))); + }; + Exps.prototype.Alpha = function (ret) + { + ret.set_float(this.getAlpha()); + }; + Exps.prototype.Beta = function (ret) + { + ret.set_float(this.getBeta()); + }; + Exps.prototype.Gamma = function (ret) + { + ret.set_float(this.getGamma()); + }; + Exps.prototype.AccelerationXWithG = function (ret) + { + ret.set_float(this.acc_g_x); + }; + Exps.prototype.AccelerationYWithG = function (ret) + { + ret.set_float(this.acc_g_y); + }; + Exps.prototype.AccelerationZWithG = function (ret) + { + ret.set_float(this.acc_g_z); + }; + Exps.prototype.AccelerationX = function (ret) + { + ret.set_float(this.acc_x); + }; + Exps.prototype.AccelerationY = function (ret) + { + ret.set_float(this.acc_y); + }; + Exps.prototype.AccelerationZ = function (ret) + { + ret.set_float(this.acc_z); + }; + Exps.prototype.TouchIndex = function (ret) + { + ret.set_int(this.trigger_index); + }; + Exps.prototype.TouchID = function (ret) + { + ret.set_float(this.trigger_id); + }; + Exps.prototype.WidthForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(touch.width); + }; + Exps.prototype.HeightForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(touch.height); + }; + Exps.prototype.PressureForID = function (ret, id) + { + var index = this.findTouch(id); + if (index < 0) + { + ret.set_float(0); + return; + } + var touch = this.touches[index]; + ret.set_float(touch.pressure); + }; + pluginProto.exps = new Exps(); +}()); +; +; +cr.plugins_.hmmg_layoutTransition_v2 = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var pluginProto = cr.plugins_.hmmg_layoutTransition_v2.prototype; + pluginProto.Type = function(plugin) + { + this.plugin = plugin; + this.runtime = plugin.runtime; + }; + var typeProto = pluginProto.Type.prototype; + typeProto.onCreate = function() + { + }; + pluginProto.Instance = function(type) + { + this.type = type; + this.runtime = type.runtime; + }; + var instanceProto = pluginProto.Instance.prototype; + instanceProto.onCreate = function() + { + var time = this.properties[0] || null; + if(time != null) + if(time >0) + $("head").append(""); + }; + instanceProto.onDestroy = function () + { + }; + instanceProto.saveToJSON = function () + { + return { + }; + }; + instanceProto.loadFromJSON = function (o) + { + }; + instanceProto.draw = function(ctx) + { + }; + instanceProto.drawGL = function (glw) + { + }; + function Cnds() {}; + Cnds.prototype.isTransitionReady = function () + { + return true; + }; + Cnds.prototype.didTransitionStart = function () + { + return true; + }; + Cnds.prototype.didTransitionFinish = function () + { + return true; + }; + pluginProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.prepareTransition = function () + { + var self = this ; + function prepareCanvas(elem,callback1) + { + self.runtime.doCanvasSnapshot("image/jpeg", 100/100); + setTimeout(function() + { + callback1(self.runtime.snapshotData); + },50); + } + function isCanvasReady(callback) + { + prepareCanvas(self,function(returnedPic) + { + if($("#fakeCanvas")[0] == undefined) + { + var c2canvasdiv = $("#c2canvasdiv") ; + var fakeCanvas = $("
      "); + var fakeBody = $("
      "); + var marginLeft = parseFloat(c2canvasdiv.css("margin-left")); + fakeBody.css( + { + "top":c2canvasdiv.offset().top, + "left":c2canvasdiv.offset().left, + "width":c2canvasdiv.width(), + "height":c2canvasdiv.height() + }); + c2canvasdiv.addClass("prepared").find(" > :not(canvas)").each(function() + { + $(this).css("left",($(this).offset().left-marginLeft)+"px"); + }); + fakeBody.appendTo(document.body).append(c2canvasdiv).append(fakeCanvas); + if(callback) + callback(); + } + }); + } + isCanvasReady(function() + { + self.runtime.trigger(cr.plugins_.hmmg_layoutTransition_v2.prototype.cnds.isTransitionReady, self); + }); + }; + Acts.prototype.startTransition = function (transID) + { + var fakeBody = $("#fakeBody"); + var c2canvasdiv = fakeBody.find("#c2canvasdiv") ; + var fakeCanvas = fakeBody.find("#fakeCanvas"); + var self = this ; + function darkTheFakeCanvas(callback) + { + setTimeout(function() + { + fakeCanvas.find("div").addClass("darker"); + if(callback) + callback(); + },1); + } + function removeChanges() + { + c2canvasdiv.appendTo(document.body).removeClass("prepared"); + fakeBody.remove(); + self.runtime.trigger(cr.plugins_.hmmg_layoutTransition_v2.prototype.cnds.didTransitionFinish, self) + } + self.runtime.trigger(cr.plugins_.hmmg_layoutTransition_v2.prototype.cnds.didTransitionStart, self) + if(transID == 14) + { + c2canvasdiv.addClass("hidden"); + fakeCanvas.addClass('animated rotateOut').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + }); + c2canvasdiv.removeClass("hidden").addClass('animated rotateIn').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated rotateIn"); + removeChanges(); + }); + } + else if(transID == 13) + { + fakeCanvas.addClass('animated rollOut').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + }); + c2canvasdiv.addClass('animated rollIn').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated rollIn"); + removeChanges(); + }); + } + else if(transID == 12) + { + fakeCanvas.addClass('animated zoomOut').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + }); + c2canvasdiv.addClass('animated zoomIn').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated zoomIn"); + removeChanges(); + }); + } + else if(transID == 11) + { + c2canvasdiv.addClass("hidden"); + fakeCanvas.addClass('animated fadeOut').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + c2canvasdiv.removeClass("hidden").addClass('animated fadeIn').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated fadeIn"); + removeChanges(); + }); + }); + } + else if(transID == 10) + { + c2canvasdiv.addClass("hidden"); + fakeCanvas.addClass('animated fadeOut').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + }); + c2canvasdiv.removeClass("hidden").addClass('animated fadeIn').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated fadeIn"); + removeChanges(); + }); + } + else if(transID == 9) + { + c2canvasdiv.addClass("hidden"); + fakeCanvas.addClass('animated flipOutYY').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + c2canvasdiv.removeClass("hidden").addClass('animated flipInYY').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated flipInYY"); + removeChanges(); + }); + }); + } + else if(transID == 8) + { + c2canvasdiv.addClass("hidden"); + fakeCanvas.addClass('animated flipOutXX').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + fakeCanvas.addClass("hidden"); + c2canvasdiv.removeClass("hidden").addClass('animated flipInXX').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + c2canvasdiv.removeClass("animated flipInXX"); + removeChanges(); + }); + }); + } + else if(transID == 7) + { + c2canvasdiv.addClass('animated slideInRight').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + c2canvasdiv.removeClass("animated slideInRight"); + }); + } + else if(transID == 6) + { + c2canvasdiv.addClass('animated slideInLeft').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + c2canvasdiv.removeClass('animated slideInLeft'); + }); + } + else if(transID == 5) + { + c2canvasdiv.addClass('animated slideInDown').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + c2canvasdiv.removeClass('animated slideInDown'); + }); + } + else if(transID == 4) + { + c2canvasdiv.addClass('animated slideInUp').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + c2canvasdiv.removeClass('animated slideInUp'); + }); + } + else if(transID == 3) + { + c2canvasdiv.addClass('animated slideInRight').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + c2canvasdiv.removeClass("animated slideInRight"); + fakeCanvas.removeClass('animated slideOutLeft'); + }); + fakeCanvas.addClass('animated slideOutLeft'); + } + else if(transID == 2) + { + c2canvasdiv.addClass('animated slideInLeft').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + fakeCanvas.removeClass("animated slideOutRight"); + c2canvasdiv.removeClass('animated slideInLeft'); + }); + fakeCanvas.addClass('animated slideOutRight'); + } + else if(transID == 1) + { + c2canvasdiv.addClass('animated slideInDown').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + fakeCanvas.removeClass("animated slideOutDown"); + c2canvasdiv.removeClass('animated slideInDown'); + }); + fakeCanvas.addClass('animated slideOutDown'); + } + else if(transID == 0) + { + c2canvasdiv.addClass('animated slideInUp').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() + { + removeChanges(); + fakeCanvas.removeClass("animated slideOutUp"); + c2canvasdiv.removeClass('animated slideInUp'); + }); + fakeCanvas.addClass('animated slideOutUp'); + } + }; + pluginProto.acts = new Acts(); + function Exps() {}; + pluginProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Bullet = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Bullet.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + var speed = this.properties[0]; + this.acc = this.properties[1]; + this.g = this.properties[2]; + this.bounceOffSolid = (this.properties[3] !== 0); + this.setAngle = (this.properties[4] !== 0); + this.dx = Math.cos(this.inst.angle) * speed; + this.dy = Math.sin(this.inst.angle) * speed; + this.lastx = this.inst.x; + this.lasty = this.inst.y; + this.lastKnownAngle = this.inst.angle; + this.travelled = 0; + this.enabled = (this.properties[5] !== 0); + }; + behinstProto.saveToJSON = function () + { + return { + "acc": this.acc, + "g": this.g, + "dx": this.dx, + "dy": this.dy, + "lx": this.lastx, + "ly": this.lasty, + "lka": this.lastKnownAngle, + "t": this.travelled, + "e": this.enabled + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.acc = o["acc"]; + this.g = o["g"]; + this.dx = o["dx"]; + this.dy = o["dy"]; + this.lastx = o["lx"]; + this.lasty = o["ly"]; + this.lastKnownAngle = o["lka"]; + this.travelled = o["t"]; + this.enabled = o["e"]; + }; + behinstProto.tick = function () + { + if (!this.enabled) + return; + var dt = this.runtime.getDt(this.inst); + var s, a; + var bounceSolid, bounceAngle; + if (this.inst.angle !== this.lastKnownAngle) + { + if (this.setAngle) + { + s = cr.distanceTo(0, 0, this.dx, this.dy); + this.dx = Math.cos(this.inst.angle) * s; + this.dy = Math.sin(this.inst.angle) * s; + } + this.lastKnownAngle = this.inst.angle; + } + if (this.acc !== 0) + { + s = cr.distanceTo(0, 0, this.dx, this.dy); + if (this.dx === 0 && this.dy === 0) + a = this.inst.angle; + else + a = cr.angleTo(0, 0, this.dx, this.dy); + s += this.acc * dt; + if (s < 0) + s = 0; + this.dx = Math.cos(a) * s; + this.dy = Math.sin(a) * s; + } + if (this.g !== 0) + this.dy += this.g * dt; + this.lastx = this.inst.x; + this.lasty = this.inst.y; + if (this.dx !== 0 || this.dy !== 0) + { + this.inst.x += this.dx * dt; + this.inst.y += this.dy * dt; + this.travelled += cr.distanceTo(0, 0, this.dx * dt, this.dy * dt) + if (this.setAngle) + { + this.inst.angle = cr.angleTo(0, 0, this.dx, this.dy); + this.inst.set_bbox_changed(); + this.lastKnownAngle = this.inst.angle; + } + this.inst.set_bbox_changed(); + if (this.bounceOffSolid) + { + bounceSolid = this.runtime.testOverlapSolid(this.inst); + if (bounceSolid) + { + this.runtime.registerCollision(this.inst, bounceSolid); + s = cr.distanceTo(0, 0, this.dx, this.dy); + bounceAngle = this.runtime.calculateSolidBounceAngle(this.inst, this.lastx, this.lasty); + this.dx = Math.cos(bounceAngle) * s; + this.dy = Math.sin(bounceAngle) * s; + this.inst.x += this.dx * dt; // move out for one tick since the object can't have spent a tick in the solid + this.inst.y += this.dy * dt; + this.inst.set_bbox_changed(); + if (this.setAngle) + { + this.inst.angle = bounceAngle; + this.lastKnownAngle = bounceAngle; + this.inst.set_bbox_changed(); + } + if (!this.runtime.pushOutSolid(this.inst, this.dx / s, this.dy / s, Math.max(s * 2.5 * dt, 30))) + this.runtime.pushOutSolidNearest(this.inst, 100); + } + } + } + }; + function Cnds() {}; + Cnds.prototype.CompareSpeed = function (cmp, s) + { + return cr.do_cmp(cr.distanceTo(0, 0, this.dx, this.dy), cmp, s); + }; + Cnds.prototype.CompareTravelled = function (cmp, d) + { + return cr.do_cmp(this.travelled, cmp, d); + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetSpeed = function (s) + { + var a = cr.angleTo(0, 0, this.dx, this.dy); + this.dx = Math.cos(a) * s; + this.dy = Math.sin(a) * s; + }; + Acts.prototype.SetAcceleration = function (a) + { + this.acc = a; + }; + Acts.prototype.SetGravity = function (g) + { + this.g = g; + }; + Acts.prototype.SetAngleOfMotion = function (a) + { + a = cr.to_radians(a); + var s = cr.distanceTo(0, 0, this.dx, this.dy) + this.dx = Math.cos(a) * s; + this.dy = Math.sin(a) * s; + }; + Acts.prototype.Bounce = function (objtype) + { + if (!objtype) + return; + var otherinst = objtype.getFirstPicked(this.inst); + if (!otherinst) + return; + var dt = this.runtime.getDt(this.inst); + var s = cr.distanceTo(0, 0, this.dx, this.dy); + var bounceAngle = this.runtime.calculateSolidBounceAngle(this.inst, this.lastx, this.lasty, otherinst); + this.dx = Math.cos(bounceAngle) * s; + this.dy = Math.sin(bounceAngle) * s; + this.inst.x += this.dx * dt; // move out for one tick since the object can't have spent a tick in the solid + this.inst.y += this.dy * dt; + this.inst.set_bbox_changed(); + if (this.setAngle) + { + this.inst.angle = bounceAngle; + this.lastKnownAngle = bounceAngle; + this.inst.set_bbox_changed(); + } + if (this.bounceOffSolid) + { + if (!this.runtime.pushOutSolid(this.inst, this.dx / s, this.dy / s, Math.max(s * 2.5 * dt, 30))) + this.runtime.pushOutSolidNearest(this.inst, 100); + } + else if (s !== 0) + { + this.runtime.pushOut(this.inst, this.dx / s, this.dy / s, Math.max(s * 2.5 * dt, 30), otherinst) + } + }; + Acts.prototype.SetDistanceTravelled = function (d) + { + this.travelled = d; + }; + Acts.prototype.SetEnabled = function (en) + { + this.enabled = (en === 1); + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Speed = function (ret) + { + var s = cr.distanceTo(0, 0, this.dx, this.dy); + s = cr.round6dp(s); + ret.set_float(s); + }; + Exps.prototype.Acceleration = function (ret) + { + ret.set_float(this.acc); + }; + Exps.prototype.AngleOfMotion = function (ret) + { + ret.set_float(cr.to_degrees(cr.angleTo(0, 0, this.dx, this.dy))); + }; + Exps.prototype.DistanceTravelled = function (ret) + { + ret.set_float(this.travelled); + }; + Exps.prototype.Gravity = function (ret) + { + ret.set_float(this.g); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Car = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Car.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + this.upkey = false; + this.downkey = false; + this.leftkey = false; + this.rightkey = false; + this.ignoreInput = false; + this.simup = false; + this.simdown = false; + this.simleft = false; + this.simright = false; + this.s = 0; + this.a = this.inst.angle; + this.m = this.inst.angle; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.maxspeed = this.properties[0]; + this.acc = this.properties[1]; + this.dec = this.properties[2]; + this.steerSpeed = cr.to_radians(this.properties[3]); + this.driftRecover = cr.to_radians(this.properties[4]); + this.friction = this.properties[5]; + this.setAngle = (this.properties[6] === 1); // 0=no, 1=yes + this.defaultControls = (this.properties[7] === 1); // 0=no, 1=yes + this.enabled = (this.properties[8] !== 0); + this.lastx = this.inst.x; + this.lasty = this.inst.y; + this.lastAngle = this.inst.angle; + if (this.defaultControls && !this.runtime.isDomFree) + { + jQuery(document).keydown( + (function (self) { + return function(info) { + self.onKeyDown(info); + }; + })(this) + ); + jQuery(document).keyup( + (function (self) { + return function(info) { + self.onKeyUp(info); + }; + })(this) + ); + } + }; + behinstProto.saveToJSON = function () + { + return { + "ignoreInput": this.ignoreInput, + "enabled": this.enabled, + "s": this.s, + "a": this.a, + "m": this.m, + "maxspeed": this.maxspeed, + "acc": this.acc, + "dec": this.dec, + "steerSpeed": this.steerSpeed, + "driftRecover": this.driftRecover, + "friction": this.friction, + "lastx": this.lastx, + "lasty": this.lasty, + "lastAngle": this.lastAngle + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.ignoreInput = o["ignoreInput"]; + this.enabled = o["enabled"]; + this.s = o["s"]; + this.a = o["a"]; + this.m = o["m"]; + this.maxspeed = o["maxspeed"]; + this.acc = o["acc"]; + this.dec = o["dec"]; + this.steerSpeed = o["steerSpeed"]; + this.driftRecover = o["driftRecover"]; + this.friction = o["friction"]; + this.lastx = o["lastx"]; + this.lasty = o["lasty"]; + this.lastAngle = o["lastAngle"]; + this.upkey = false; + this.downkey = false; + this.leftkey = false; + this.rightkey = false; + this.simup = false; + this.simdown = false; + this.simleft = false; + this.simright = false; + }; + behinstProto.onKeyDown = function (info) + { + switch (info.which) { + case 37: // left + info.preventDefault(); + this.leftkey = true; + break; + case 38: // up + info.preventDefault(); + this.upkey = true; + break; + case 39: // right + info.preventDefault(); + this.rightkey = true; + break; + case 40: // down + info.preventDefault(); + this.downkey = true; + break; + } + }; + behinstProto.onKeyUp = function (info) + { + switch (info.which) { + case 37: // left + info.preventDefault(); + this.leftkey = false; + break; + case 38: // up + info.preventDefault(); + this.upkey = false; + break; + case 39: // right + info.preventDefault(); + this.rightkey = false; + break; + case 40: // down + info.preventDefault(); + this.downkey = false; + break; + } + }; + behinstProto.onWindowBlur = function () + { + this.upkey = false; + this.downkey = false; + this.leftkey = false; + this.rightkey = false; + }; + behinstProto.tick = function () + { + var dt = this.runtime.getDt(this.inst); + var left = this.leftkey || this.simleft; + var right = this.rightkey || this.simright; + var up = this.upkey || this.simup; + var down = this.downkey || this.simdown; + this.simleft = false; + this.simright = false; + this.simup = false; + this.simdown = false; + if (!this.enabled) + return; + if (this.setAngle && this.inst.angle !== this.lastAngle) + { + this.a = this.inst.angle; + this.m = this.inst.angle; + this.lastAngle = this.inst.angle; + } + var collobj = this.runtime.testOverlapSolid(this.inst); + if (collobj) + { + this.runtime.registerCollision(this.inst, collobj); + if (!this.runtime.pushOutSolidNearest(this.inst)) + return; // must be stuck in solid + } + if (this.ignoreInput) + { + left = false; + right = false; + up = false; + down = false; + } + if (up && !down) + { + this.s += this.acc * dt; + if (this.s > this.maxspeed) + this.s = this.maxspeed; + } + if (down && !up) + { + this.s -= this.dec * dt; + if (this.s < -this.maxspeed) + this.s = -this.maxspeed; + } + if (down === up) + { + if (this.s > 0) + { + this.s -= this.dec * dt * 0.1; + if (this.s < 0) + this.s = 0; + } + else if (this.s < 0) + { + this.s += this.dec * dt * 0.1; + if (this.s > 0) + this.s = 0; + } + } + if (this.s < 0) + { + var temp = left; + left = right; + right = temp; + } + if (left && !right) + { + this.a = cr.clamp_angle(this.a - this.steerSpeed * dt * (Math.abs(this.s) / this.maxspeed)); + } + if (right && !left) + { + this.a = cr.clamp_angle(this.a + this.steerSpeed * dt * (Math.abs(this.s) / this.maxspeed)); + } + var recover = this.driftRecover * dt; + var diff = cr.angleDiff(this.a, this.m); + if (diff > cr.to_radians(90)) + recover += (diff - cr.to_radians(90)); + if (diff <= recover) + this.m = cr.clamp_angle(this.a); + else if (cr.angleClockwise(this.a, this.m)) + this.m = cr.clamp_angle(this.m + recover); + else + this.m = cr.clamp_angle(this.m - recover); + this.lastx = this.inst.x; + this.lasty = this.inst.y; + if (this.s !== 0 && dt !== 0) + { + this.inst.x += Math.cos(this.m) * this.s * dt; + this.inst.y += Math.sin(this.m) * this.s * dt; + if (this.setAngle) + { + this.inst.angle = this.a; + this.lastAngle = this.a; + } + this.inst.set_bbox_changed(); + var hitsolid = this.runtime.testOverlapSolid(this.inst); + if (hitsolid) + { + this.runtime.registerCollision(this.inst, hitsolid); + this.s = Math.abs(this.s); + this.m = this.runtime.calculateSolidBounceAngle(this.inst, this.lastx, this.lasty); + this.inst.x += Math.cos(this.m) * this.s * dt; // move out for another tick to try and avoid solid + this.inst.y += Math.sin(this.m) * this.s * dt; + this.inst.set_bbox_changed(); + this.s *= (1 - this.friction); + if (!this.runtime.pushOutSolid(this.inst, Math.cos(this.m), Math.sin(this.m), Math.max(this.s * 2.5 * dt, 30))) + this.runtime.pushOutSolidNearest(this.inst, 100); + } + } + else if (this.setAngle && this.inst.angle !== this.a) + { + this.inst.angle = this.a; + this.lastAngle = this.a; + this.inst.set_bbox_changed(); + if (this.runtime.testOverlapSolid(this.inst)) + this.runtime.pushOutSolidNearest(this.inst, 100); + } + }; + function Cnds() {}; + Cnds.prototype.IsMoving = function () + { + return this.s !== 0; + }; + Cnds.prototype.CompareSpeed = function (cmp, s) + { + return cr.do_cmp(this.s, cmp, s); + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Stop = function () + { + this.s = 0; + }; + Acts.prototype.SetIgnoreInput = function (ignoring) + { + this.ignoreInput = ignoring; + }; + Acts.prototype.SetSpeed = function (speed) + { + if (speed < -this.maxspeed) + speed = -this.maxspeed; + if (speed > this.maxspeed) + speed = this.maxspeed; + this.s = speed; + }; + Acts.prototype.SetMaxSpeed = function (maxspeed) + { + this.maxspeed = maxspeed; + if (this.maxspeed < 0) + this.maxspeed = 0; + }; + Acts.prototype.SetAcceleration = function (acc) + { + this.acc = acc; + if (this.acc < 0) + this.acc = 0; + }; + Acts.prototype.SetDeceleration = function (dec) + { + this.dec = dec; + if (this.dec < 0) + this.dec = 0; + }; + Acts.prototype.SimulateControl = function (ctrl) + { + switch (ctrl) { + case 0: this.simleft = true; break; + case 1: this.simright = true; break; + case 2: this.simup = true; break; + case 3: this.simdown = true; break; + } + }; + Acts.prototype.SetEnabled = function (en) + { + this.enabled = (en === 1); + }; + Acts.prototype.SetSteerSpeed = function (x) + { + this.steerSpeed = cr.to_radians(x); + }; + Acts.prototype.SetDriftRecover = function (x) + { + this.driftRecover = cr.to_radians(x); + }; + Acts.prototype.SetFriction = function (x) + { + this.friction = x; + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Speed = function (ret) + { + ret.set_float(this.s); + }; + Exps.prototype.MaxSpeed = function (ret) + { + ret.set_float(this.maxspeed); + }; + Exps.prototype.Acceleration = function (ret) + { + ret.set_float(this.acc); + }; + Exps.prototype.Deceleration = function (ret) + { + ret.set_float(this.dec); + }; + Exps.prototype.MovingAngle = function (ret) + { + ret.set_float(cr.to_degrees(this.m)); + }; + Exps.prototype.VectorX = function (ret) + { + ret.set_float(Math.cos(this.m) * this.s); + }; + Exps.prototype.VectorY = function (ret) + { + ret.set_float(Math.sin(this.m) * this.s); + }; + Exps.prototype.SteerSpeed = function (ret) + { + ret.set_float(cr.to_degrees(this.steerSpeed)); + }; + Exps.prototype.DriftRecover = function (ret) + { + ret.set_float(cr.to_degrees(this.driftRecover)); + }; + Exps.prototype.Friction = function (ret) + { + ret.set_float(this.friction); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Fade = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Fade.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.activeAtStart = this.properties[0] === 1; + this.setMaxOpacity = false; // used to retrieve maxOpacity once in first 'Start fade' action if initially inactive + this.fadeInTime = this.properties[1]; + this.waitTime = this.properties[2]; + this.fadeOutTime = this.properties[3]; + this.destroy = this.properties[4]; // 0 = no, 1 = after fade out + this.stage = this.activeAtStart ? 0 : 3; // 0 = fade in, 1 = wait, 2 = fade out, 3 = done + if (this.recycled) + this.stageTime.reset(); + else + this.stageTime = new cr.KahanAdder(); + this.maxOpacity = (this.inst.opacity ? this.inst.opacity : 1.0); + if (this.activeAtStart) + { + if (this.fadeInTime === 0) + { + this.stage = 1; + if (this.waitTime === 0) + this.stage = 2; + } + else + { + this.inst.opacity = 0; + this.runtime.redraw = true; + } + } + }; + behinstProto.saveToJSON = function () + { + return { + "fit": this.fadeInTime, + "wt": this.waitTime, + "fot": this.fadeOutTime, + "s": this.stage, + "st": this.stageTime.sum, + "mo": this.maxOpacity, + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.fadeInTime = o["fit"]; + this.waitTime = o["wt"]; + this.fadeOutTime = o["fot"]; + this.stage = o["s"]; + this.stageTime.reset(); + this.stageTime.sum = o["st"]; + this.maxOpacity = o["mo"]; + }; + behinstProto.tick = function () + { + this.stageTime.add(this.runtime.getDt(this.inst)); + if (this.stage === 0) + { + this.inst.opacity = (this.stageTime.sum / this.fadeInTime) * this.maxOpacity; + this.runtime.redraw = true; + if (this.inst.opacity >= this.maxOpacity) + { + this.inst.opacity = this.maxOpacity; + this.stage = 1; // wait stage + this.stageTime.reset(); + this.runtime.trigger(cr.behaviors.Fade.prototype.cnds.OnFadeInEnd, this.inst); + } + } + if (this.stage === 1) + { + if (this.stageTime.sum >= this.waitTime) + { + this.stage = 2; // fade out stage + this.stageTime.reset(); + this.runtime.trigger(cr.behaviors.Fade.prototype.cnds.OnWaitEnd, this.inst); + } + } + if (this.stage === 2) + { + if (this.fadeOutTime !== 0) + { + this.inst.opacity = this.maxOpacity - ((this.stageTime.sum / this.fadeOutTime) * this.maxOpacity); + this.runtime.redraw = true; + if (this.inst.opacity < 0) + { + this.inst.opacity = 0; + this.stage = 3; // done + this.stageTime.reset(); + this.runtime.trigger(cr.behaviors.Fade.prototype.cnds.OnFadeOutEnd, this.inst); + if (this.destroy === 1) + this.runtime.DestroyInstance(this.inst); + } + } + } + }; + behinstProto.doStart = function () + { + this.stage = 0; + this.stageTime.reset(); + if (this.fadeInTime === 0) + { + this.stage = 1; + if (this.waitTime === 0) + this.stage = 2; + } + else + { + this.inst.opacity = 0; + this.runtime.redraw = true; + } + }; + function Cnds() {}; + Cnds.prototype.OnFadeOutEnd = function () + { + return true; + }; + Cnds.prototype.OnFadeInEnd = function () + { + return true; + }; + Cnds.prototype.OnWaitEnd = function () + { + return true; + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.StartFade = function () + { + if (!this.activeAtStart && !this.setMaxOpacity) + { + this.maxOpacity = (this.inst.opacity ? this.inst.opacity : 1.0); + this.setMaxOpacity = true; + } + if (this.stage === 3) + this.doStart(); + }; + Acts.prototype.RestartFade = function () + { + this.doStart(); + }; + Acts.prototype.SetFadeInTime = function (t) + { + if (t < 0) + t = 0; + this.fadeInTime = t; + }; + Acts.prototype.SetWaitTime = function (t) + { + if (t < 0) + t = 0; + this.waitTime = t; + }; + Acts.prototype.SetFadeOutTime = function (t) + { + if (t < 0) + t = 0; + this.fadeOutTime = t; + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.FadeInTime = function (ret) + { + ret.set_float(this.fadeInTime); + }; + Exps.prototype.WaitTime = function (ret) + { + ret.set_float(this.waitTime); + }; + Exps.prototype.FadeOutTime = function (ret) + { + ret.set_float(this.fadeOutTime); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Pin = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Pin.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.pinObject = null; + this.pinObjectUid = -1; // for loading + this.pinAngle = 0; + this.pinDist = 0; + this.myStartAngle = 0; + this.theirStartAngle = 0; + this.lastKnownAngle = 0; + this.mode = 0; // 0 = position & angle; 1 = position; 2 = angle; 3 = rope; 4 = bar + var self = this; + if (!this.recycled) + { + this.myDestroyCallback = (function(inst) { + self.onInstanceDestroyed(inst); + }); + } + this.runtime.addDestroyCallback(this.myDestroyCallback); + }; + behinstProto.saveToJSON = function () + { + return { + "uid": this.pinObject ? this.pinObject.uid : -1, + "pa": this.pinAngle, + "pd": this.pinDist, + "msa": this.myStartAngle, + "tsa": this.theirStartAngle, + "lka": this.lastKnownAngle, + "m": this.mode + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.pinObjectUid = o["uid"]; // wait until afterLoad to look up + this.pinAngle = o["pa"]; + this.pinDist = o["pd"]; + this.myStartAngle = o["msa"]; + this.theirStartAngle = o["tsa"]; + this.lastKnownAngle = o["lka"]; + this.mode = o["m"]; + }; + behinstProto.afterLoad = function () + { + if (this.pinObjectUid === -1) + this.pinObject = null; + else + { + this.pinObject = this.runtime.getObjectByUID(this.pinObjectUid); +; + } + this.pinObjectUid = -1; + }; + behinstProto.onInstanceDestroyed = function (inst) + { + if (this.pinObject == inst) + this.pinObject = null; + }; + behinstProto.onDestroy = function() + { + this.pinObject = null; + this.runtime.removeDestroyCallback(this.myDestroyCallback); + }; + behinstProto.tick = function () + { + }; + behinstProto.tick2 = function () + { + if (!this.pinObject) + return; + if (this.lastKnownAngle !== this.inst.angle) + this.myStartAngle = cr.clamp_angle(this.myStartAngle + (this.inst.angle - this.lastKnownAngle)); + var newx = this.inst.x; + var newy = this.inst.y; + if (this.mode === 3 || this.mode === 4) // rope mode or bar mode + { + var dist = cr.distanceTo(this.inst.x, this.inst.y, this.pinObject.x, this.pinObject.y); + if ((dist > this.pinDist) || (this.mode === 4 && dist < this.pinDist)) + { + var a = cr.angleTo(this.pinObject.x, this.pinObject.y, this.inst.x, this.inst.y); + newx = this.pinObject.x + Math.cos(a) * this.pinDist; + newy = this.pinObject.y + Math.sin(a) * this.pinDist; + } + } + else + { + newx = this.pinObject.x + Math.cos(this.pinObject.angle + this.pinAngle) * this.pinDist; + newy = this.pinObject.y + Math.sin(this.pinObject.angle + this.pinAngle) * this.pinDist; + } + var newangle = cr.clamp_angle(this.myStartAngle + (this.pinObject.angle - this.theirStartAngle)); + this.lastKnownAngle = newangle; + if ((this.mode === 0 || this.mode === 1 || this.mode === 3 || this.mode === 4) + && (this.inst.x !== newx || this.inst.y !== newy)) + { + this.inst.x = newx; + this.inst.y = newy; + this.inst.set_bbox_changed(); + } + if ((this.mode === 0 || this.mode === 2) && (this.inst.angle !== newangle)) + { + this.inst.angle = newangle; + this.inst.set_bbox_changed(); + } + }; + function Cnds() {}; + Cnds.prototype.IsPinned = function () + { + return !!this.pinObject; + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.Pin = function (obj, mode_) + { + if (!obj) + return; + var otherinst = obj.getFirstPicked(this.inst); + if (!otherinst) + return; + this.pinObject = otherinst; + this.pinAngle = cr.angleTo(otherinst.x, otherinst.y, this.inst.x, this.inst.y) - otherinst.angle; + this.pinDist = cr.distanceTo(otherinst.x, otherinst.y, this.inst.x, this.inst.y); + this.myStartAngle = this.inst.angle; + this.lastKnownAngle = this.inst.angle; + this.theirStartAngle = otherinst.angle; + this.mode = mode_; + }; + Acts.prototype.Unpin = function () + { + this.pinObject = null; + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.PinnedUID = function (ret) + { + ret.set_int(this.pinObject ? this.pinObject.uid : -1); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Platform = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Platform.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + var ANIMMODE_STOPPED = 0; + var ANIMMODE_MOVING = 1; + var ANIMMODE_JUMPING = 2; + var ANIMMODE_FALLING = 3; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + this.leftkey = false; + this.rightkey = false; + this.jumpkey = false; + this.jumped = false; // prevent bunnyhopping + this.doubleJumped = false; + this.canDoubleJump = false; + this.ignoreInput = false; + this.simleft = false; + this.simright = false; + this.simjump = false; + this.lastFloorObject = null; + this.loadFloorObject = -1; + this.lastFloorX = 0; + this.lastFloorY = 0; + this.floorIsJumpthru = false; + this.animMode = ANIMMODE_STOPPED; + this.fallthrough = 0; // fall through jump-thru. >0 to disable, lasts a few ticks + this.firstTick = true; + this.dx = 0; + this.dy = 0; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.updateGravity = function() + { + this.downx = Math.cos(this.ga); + this.downy = Math.sin(this.ga); + this.rightx = Math.cos(this.ga - Math.PI / 2); + this.righty = Math.sin(this.ga - Math.PI / 2); + this.downx = cr.round6dp(this.downx); + this.downy = cr.round6dp(this.downy); + this.rightx = cr.round6dp(this.rightx); + this.righty = cr.round6dp(this.righty); + this.g1 = this.g; + if (this.g < 0) + { + this.downx *= -1; + this.downy *= -1; + this.g = Math.abs(this.g); + } + }; + behinstProto.onCreate = function() + { + this.maxspeed = this.properties[0]; + this.acc = this.properties[1]; + this.dec = this.properties[2]; + this.jumpStrength = this.properties[3]; + this.g = this.properties[4]; + this.g1 = this.g; + this.maxFall = this.properties[5]; + this.enableDoubleJump = (this.properties[6] !== 0); // 0=disabled, 1=enabled + this.jumpSustain = (this.properties[7] / 1000); // convert ms to s + this.defaultControls = (this.properties[8] === 1); // 0=no, 1=yes + this.enabled = (this.properties[9] !== 0); + this.wasOnFloor = false; + this.wasOverJumpthru = this.runtime.testOverlapJumpThru(this.inst); + this.loadOverJumpthru = -1; + this.sustainTime = 0; // time of jump sustain remaining + this.ga = cr.to_radians(90); + this.updateGravity(); + var self = this; + if (this.defaultControls && !this.runtime.isDomFree) + { + jQuery(document).keydown(function(info) { + self.onKeyDown(info); + }); + jQuery(document).keyup(function(info) { + self.onKeyUp(info); + }); + } + if (!this.recycled) + { + this.myDestroyCallback = function(inst) { + self.onInstanceDestroyed(inst); + }; + } + this.runtime.addDestroyCallback(this.myDestroyCallback); + this.inst.extra["isPlatformBehavior"] = true; + }; + behinstProto.saveToJSON = function () + { + return { + "ii": this.ignoreInput, + "lfx": this.lastFloorX, + "lfy": this.lastFloorY, + "lfo": (this.lastFloorObject ? this.lastFloorObject.uid : -1), + "am": this.animMode, + "en": this.enabled, + "fall": this.fallthrough, + "ft": this.firstTick, + "dx": this.dx, + "dy": this.dy, + "ms": this.maxspeed, + "acc": this.acc, + "dec": this.dec, + "js": this.jumpStrength, + "g": this.g, + "g1": this.g1, + "mf": this.maxFall, + "wof": this.wasOnFloor, + "woj": (this.wasOverJumpthru ? this.wasOverJumpthru.uid : -1), + "ga": this.ga, + "edj": this.enableDoubleJump, + "cdj": this.canDoubleJump, + "dj": this.doubleJumped, + "sus": this.jumpSustain + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.ignoreInput = o["ii"]; + this.lastFloorX = o["lfx"]; + this.lastFloorY = o["lfy"]; + this.loadFloorObject = o["lfo"]; + this.animMode = o["am"]; + this.enabled = o["en"]; + this.fallthrough = o["fall"]; + this.firstTick = o["ft"]; + this.dx = o["dx"]; + this.dy = o["dy"]; + this.maxspeed = o["ms"]; + this.acc = o["acc"]; + this.dec = o["dec"]; + this.jumpStrength = o["js"]; + this.g = o["g"]; + this.g1 = o["g1"]; + this.maxFall = o["mf"]; + this.wasOnFloor = o["wof"]; + this.loadOverJumpthru = o["woj"]; + this.ga = o["ga"]; + this.enableDoubleJump = o["edj"]; + this.canDoubleJump = o["cdj"]; + this.doubleJumped = o["dj"]; + this.jumpSustain = o["sus"]; + this.leftkey = false; + this.rightkey = false; + this.jumpkey = false; + this.jumped = false; + this.simleft = false; + this.simright = false; + this.simjump = false; + this.sustainTime = 0; + this.updateGravity(); + }; + behinstProto.afterLoad = function () + { + if (this.loadFloorObject === -1) + this.lastFloorObject = null; + else + this.lastFloorObject = this.runtime.getObjectByUID(this.loadFloorObject); + if (this.loadOverJumpthru === -1) + this.wasOverJumpthru = null; + else + this.wasOverJumpthru = this.runtime.getObjectByUID(this.loadOverJumpthru); + }; + behinstProto.onInstanceDestroyed = function (inst) + { + if (this.lastFloorObject == inst) + this.lastFloorObject = null; + }; + behinstProto.onDestroy = function () + { + this.lastFloorObject = null; + this.runtime.removeDestroyCallback(this.myDestroyCallback); + }; + behinstProto.onKeyDown = function (info) + { + switch (info.which) { + case 38: // up + info.preventDefault(); + this.jumpkey = true; + break; + case 37: // left + info.preventDefault(); + this.leftkey = true; + break; + case 39: // right + info.preventDefault(); + this.rightkey = true; + break; + } + }; + behinstProto.onKeyUp = function (info) + { + switch (info.which) { + case 38: // up + info.preventDefault(); + this.jumpkey = false; + this.jumped = false; + break; + case 37: // left + info.preventDefault(); + this.leftkey = false; + break; + case 39: // right + info.preventDefault(); + this.rightkey = false; + break; + } + }; + behinstProto.onWindowBlur = function () + { + this.leftkey = false; + this.rightkey = false; + this.jumpkey = false; + }; + behinstProto.getGDir = function () + { + if (this.g < 0) + return -1; + else + return 1; + }; + behinstProto.isOnFloor = function () + { + var ret = null; + var ret2 = null; + var i, len, j; + var oldx = this.inst.x; + var oldy = this.inst.y; + this.inst.x += this.downx; + this.inst.y += this.downy; + this.inst.set_bbox_changed(); + if (this.lastFloorObject && this.runtime.testOverlap(this.inst, this.lastFloorObject) && + (!this.runtime.typeHasBehavior(this.lastFloorObject.type, cr.behaviors.solid) || this.lastFloorObject.extra["solidEnabled"])) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + return this.lastFloorObject; + } + else + { + ret = this.runtime.testOverlapSolid(this.inst); + if (!ret && this.fallthrough === 0) + ret2 = this.runtime.testOverlapJumpThru(this.inst, true); + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + if (ret) // was overlapping solid + { + if (this.runtime.testOverlap(this.inst, ret)) + return null; + else + { + this.floorIsJumpthru = false; + return ret; + } + } + if (ret2 && ret2.length) + { + for (i = 0, j = 0, len = ret2.length; i < len; i++) + { + ret2[j] = ret2[i]; + if (!this.runtime.testOverlap(this.inst, ret2[i])) + j++; + } + if (j >= 1) + { + this.floorIsJumpthru = true; + return ret2[0]; + } + } + return null; + } + }; + behinstProto.tick = function () + { + }; + behinstProto.posttick = function () + { + var dt = this.runtime.getDt(this.inst); + var mx, my, obstacle, mag, allover, i, len, j, oldx, oldy; + if (!this.jumpkey && !this.simjump) + this.jumped = false; + var left = this.leftkey || this.simleft; + var right = this.rightkey || this.simright; + var jumpkey = (this.jumpkey || this.simjump); + var jump = jumpkey && !this.jumped; + this.simleft = false; + this.simright = false; + this.simjump = false; + if (!this.enabled) + return; + if (this.ignoreInput) + { + left = false; + right = false; + jumpkey = false; + jump = false; + } + if (!jumpkey) + this.sustainTime = 0; + var lastFloor = this.lastFloorObject; + var floor_moved = false; + if (this.firstTick) + { + if (this.runtime.testOverlapSolid(this.inst) || this.runtime.testOverlapJumpThru(this.inst)) + { + this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy, 4, true); + } + this.firstTick = false; + } + if (lastFloor && this.dy === 0 && (lastFloor.y !== this.lastFloorY || lastFloor.x !== this.lastFloorX)) + { + mx = (lastFloor.x - this.lastFloorX); + my = (lastFloor.y - this.lastFloorY); + this.inst.x += mx; + this.inst.y += my; + this.inst.set_bbox_changed(); + this.lastFloorX = lastFloor.x; + this.lastFloorY = lastFloor.y; + floor_moved = true; + if (this.runtime.testOverlapSolid(this.inst)) + { + this.runtime.pushOutSolid(this.inst, -mx, -my, Math.sqrt(mx * mx + my * my) * 2.5); + } + } + var floor_ = this.isOnFloor(); + var collobj = this.runtime.testOverlapSolid(this.inst); + if (collobj) + { + if (this.inst.extra["inputPredicted"]) + { + this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy, 10, false); + } + else if (this.runtime.pushOutSolidNearest(this.inst, Math.max(this.inst.width, this.inst.height) / 2)) + { + this.runtime.registerCollision(this.inst, collobj); + } + else + return; + } + if (floor_) + { + this.doubleJumped = false; // reset double jump flags for next jump + this.canDoubleJump = false; + if (this.dy > 0) + { + if (!this.wasOnFloor) + { + this.runtime.pushInFractional(this.inst, -this.downx, -this.downy, floor_, 16); + this.wasOnFloor = true; + } + this.dy = 0; + } + if (lastFloor != floor_) + { + this.lastFloorObject = floor_; + this.lastFloorX = floor_.x; + this.lastFloorY = floor_.y; + this.runtime.registerCollision(this.inst, floor_); + } + else if (floor_moved) + { + collobj = this.runtime.testOverlapSolid(this.inst); + if (collobj) + { + this.runtime.registerCollision(this.inst, collobj); + if (mx !== 0) + { + if (mx > 0) + this.runtime.pushOutSolid(this.inst, -this.rightx, -this.righty); + else + this.runtime.pushOutSolid(this.inst, this.rightx, this.righty); + } + this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy); + } + } + } + else + { + if (!jumpkey) + this.canDoubleJump = true; + } + if ((floor_ && jump) || (!floor_ && this.enableDoubleJump && jumpkey && this.canDoubleJump && !this.doubleJumped)) + { + oldx = this.inst.x; + oldy = this.inst.y; + this.inst.x -= this.downx; + this.inst.y -= this.downy; + this.inst.set_bbox_changed(); + if (!this.runtime.testOverlapSolid(this.inst)) + { + this.sustainTime = this.jumpSustain; + this.runtime.trigger(cr.behaviors.Platform.prototype.cnds.OnJump, this.inst); + this.animMode = ANIMMODE_JUMPING; + this.dy = -this.jumpStrength; + jump = true; // set in case is double jump + if (floor_) + this.jumped = true; + else + this.doubleJumped = true; + } + else + jump = false; + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + } + if (!floor_) + { + if (jumpkey && this.sustainTime > 0) + { + this.dy = -this.jumpStrength; + this.sustainTime -= dt; + } + else + { + this.lastFloorObject = null; + this.dy += this.g * dt; + if (this.dy > this.maxFall) + this.dy = this.maxFall; + } + if (jump) + this.jumped = true; + } + this.wasOnFloor = !!floor_; + if (left == right) // both up or both down + { + if (this.dx < 0) + { + this.dx += this.dec * dt; + if (this.dx > 0) + this.dx = 0; + } + else if (this.dx > 0) + { + this.dx -= this.dec * dt; + if (this.dx < 0) + this.dx = 0; + } + } + if (left && !right) + { + if (this.dx > 0) + this.dx -= (this.acc + this.dec) * dt; + else + this.dx -= this.acc * dt; + } + if (right && !left) + { + if (this.dx < 0) + this.dx += (this.acc + this.dec) * dt; + else + this.dx += this.acc * dt; + } + if (this.dx > this.maxspeed) + this.dx = this.maxspeed; + else if (this.dx < -this.maxspeed) + this.dx = -this.maxspeed; + var landed = false; + if (this.dx !== 0) + { + oldx = this.inst.x; + oldy = this.inst.y; + mx = this.dx * dt * this.rightx; + my = this.dx * dt * this.righty; + this.inst.x += this.rightx * (this.dx > 1 ? 1 : -1) - this.downx; + this.inst.y += this.righty * (this.dx > 1 ? 1 : -1) - this.downy; + this.inst.set_bbox_changed(); + var is_jumpthru = false; + var slope_too_steep = this.runtime.testOverlapSolid(this.inst); + /* + if (!slope_too_steep && floor_) + { + slope_too_steep = this.runtime.testOverlapJumpThru(this.inst); + is_jumpthru = true; + if (slope_too_steep) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + if (this.runtime.testOverlap(this.inst, slope_too_steep)) + { + slope_too_steep = null; + is_jumpthru = false; + } + } + } + */ + this.inst.x = oldx + mx; + this.inst.y = oldy + my; + this.inst.set_bbox_changed(); + obstacle = this.runtime.testOverlapSolid(this.inst); + if (!obstacle && floor_) + { + obstacle = this.runtime.testOverlapJumpThru(this.inst); + if (obstacle) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + if (this.runtime.testOverlap(this.inst, obstacle)) + { + obstacle = null; + is_jumpthru = false; + } + else + is_jumpthru = true; + this.inst.x = oldx + mx; + this.inst.y = oldy + my; + this.inst.set_bbox_changed(); + } + } + if (obstacle) + { + var push_dist = Math.abs(this.dx * dt) + 2; + if (slope_too_steep || !this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy, push_dist, is_jumpthru, obstacle)) + { + this.runtime.registerCollision(this.inst, obstacle); + push_dist = Math.max(Math.abs(this.dx * dt * 2.5), 30); + if (!this.runtime.pushOutSolid(this.inst, this.rightx * (this.dx < 0 ? 1 : -1), this.righty * (this.dx < 0 ? 1 : -1), push_dist, false)) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + } + else if (floor_ && !is_jumpthru && !this.floorIsJumpthru) + { + oldx = this.inst.x; + oldy = this.inst.y; + this.inst.x += this.downx; + this.inst.y += this.downy; + if (this.runtime.testOverlapSolid(this.inst)) + { + if (!this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy, 3, false)) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + } + } + else + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + } + } + if (!is_jumpthru) + this.dx = 0; // stop + } + else if (!slope_too_steep && !jump && (Math.abs(this.dy) < Math.abs(this.jumpStrength / 4))) + { + this.dy = 0; + if (!floor_) + landed = true; + } + } + else + { + var newfloor = this.isOnFloor(); + if (floor_ && !newfloor) + { + mag = Math.ceil(Math.abs(this.dx * dt)) + 2; + oldx = this.inst.x; + oldy = this.inst.y; + this.inst.x += this.downx * mag; + this.inst.y += this.downy * mag; + this.inst.set_bbox_changed(); + if (this.runtime.testOverlapSolid(this.inst) || this.runtime.testOverlapJumpThru(this.inst)) + this.runtime.pushOutSolid(this.inst, -this.downx, -this.downy, mag + 2, true); + else + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + } + } + else if (newfloor && this.dy === 0) + { + this.runtime.pushInFractional(this.inst, -this.downx, -this.downy, newfloor, 16); + } + } + } + if (this.dy !== 0) + { + oldx = this.inst.x; + oldy = this.inst.y; + this.inst.x += this.dy * dt * this.downx; + this.inst.y += this.dy * dt * this.downy; + var newx = this.inst.x; + var newy = this.inst.y; + this.inst.set_bbox_changed(); + collobj = this.runtime.testOverlapSolid(this.inst); + var fell_on_jumpthru = false; + if (!collobj && (this.dy > 0) && !floor_) + { + allover = this.fallthrough > 0 ? null : this.runtime.testOverlapJumpThru(this.inst, true); + if (allover && allover.length) + { + if (this.wasOverJumpthru) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + for (i = 0, j = 0, len = allover.length; i < len; i++) + { + allover[j] = allover[i]; + if (!this.runtime.testOverlap(this.inst, allover[i])) + j++; + } + allover.length = j; + this.inst.x = newx; + this.inst.y = newy; + this.inst.set_bbox_changed(); + } + if (allover.length >= 1) + collobj = allover[0]; + } + fell_on_jumpthru = !!collobj; + } + if (collobj) + { + this.runtime.registerCollision(this.inst, collobj); + this.sustainTime = 0; + var push_dist = (fell_on_jumpthru ? Math.abs(this.dy * dt * 2.5 + 10) : Math.max(Math.abs(this.dy * dt * 2.5 + 10), 30)); + if (!this.runtime.pushOutSolid(this.inst, this.downx * (this.dy < 0 ? 1 : -1), this.downy * (this.dy < 0 ? 1 : -1), push_dist, fell_on_jumpthru, collobj)) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + this.wasOnFloor = true; // prevent adjustment for unexpected floor landings + if (!fell_on_jumpthru) + this.dy = 0; // stop + } + else + { + this.lastFloorObject = collobj; + this.lastFloorX = collobj.x; + this.lastFloorY = collobj.y; + this.floorIsJumpthru = fell_on_jumpthru; + if (fell_on_jumpthru) + landed = true; + this.dy = 0; // stop + } + } + } + if (this.animMode !== ANIMMODE_FALLING && this.dy > 0 && !floor_) + { + this.runtime.trigger(cr.behaviors.Platform.prototype.cnds.OnFall, this.inst); + this.animMode = ANIMMODE_FALLING; + } + if (floor_ || landed) + { + if (this.animMode === ANIMMODE_FALLING || landed || (jump && this.dy === 0)) + { + this.runtime.trigger(cr.behaviors.Platform.prototype.cnds.OnLand, this.inst); + if (this.dx === 0 && this.dy === 0) + this.animMode = ANIMMODE_STOPPED; + else + this.animMode = ANIMMODE_MOVING; + } + else + { + if (this.animMode !== ANIMMODE_STOPPED && this.dx === 0 && this.dy === 0) + { + this.runtime.trigger(cr.behaviors.Platform.prototype.cnds.OnStop, this.inst); + this.animMode = ANIMMODE_STOPPED; + } + if (this.animMode !== ANIMMODE_MOVING && (this.dx !== 0 || this.dy !== 0) && !jump) + { + this.runtime.trigger(cr.behaviors.Platform.prototype.cnds.OnMove, this.inst); + this.animMode = ANIMMODE_MOVING; + } + } + } + if (this.fallthrough > 0) + this.fallthrough--; + this.wasOverJumpthru = this.runtime.testOverlapJumpThru(this.inst); + }; + function Cnds() {}; + Cnds.prototype.IsMoving = function () + { + return this.dx !== 0 || this.dy !== 0; + }; + Cnds.prototype.CompareSpeed = function (cmp, s) + { + var speed = Math.sqrt(this.dx * this.dx + this.dy * this.dy); + return cr.do_cmp(speed, cmp, s); + }; + Cnds.prototype.IsOnFloor = function () + { + if (this.dy !== 0) + return false; + var ret = null; + var ret2 = null; + var i, len, j; + var oldx = this.inst.x; + var oldy = this.inst.y; + this.inst.x += this.downx; + this.inst.y += this.downy; + this.inst.set_bbox_changed(); + ret = this.runtime.testOverlapSolid(this.inst); + if (!ret && this.fallthrough === 0) + ret2 = this.runtime.testOverlapJumpThru(this.inst, true); + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + if (ret) // was overlapping solid + { + return !this.runtime.testOverlap(this.inst, ret); + } + if (ret2 && ret2.length) + { + for (i = 0, j = 0, len = ret2.length; i < len; i++) + { + ret2[j] = ret2[i]; + if (!this.runtime.testOverlap(this.inst, ret2[i])) + j++; + } + if (j >= 1) + return true; + } + return false; + }; + Cnds.prototype.IsByWall = function (side) + { + var ret = false; + var oldx = this.inst.x; + var oldy = this.inst.y; + this.inst.x -= this.downx * 3; + this.inst.y -= this.downy * 3; + this.inst.set_bbox_changed(); + if (this.runtime.testOverlapSolid(this.inst)) + { + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + return false; + } + if (side === 0) // left + { + this.inst.x -= this.rightx * 2; + this.inst.y -= this.righty * 2; + } + else + { + this.inst.x += this.rightx * 2; + this.inst.y += this.righty * 2; + } + this.inst.set_bbox_changed(); + ret = this.runtime.testOverlapSolid(this.inst); + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + return ret; + }; + Cnds.prototype.IsJumping = function () + { + return this.dy < 0; + }; + Cnds.prototype.IsFalling = function () + { + return this.dy > 0; + }; + Cnds.prototype.OnJump = function () + { + return true; + }; + Cnds.prototype.OnFall = function () + { + return true; + }; + Cnds.prototype.OnStop = function () + { + return true; + }; + Cnds.prototype.OnMove = function () + { + return true; + }; + Cnds.prototype.OnLand = function () + { + return true; + }; + Cnds.prototype.IsDoubleJumpEnabled = function () + { + return this.enableDoubleJump; + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetIgnoreInput = function (ignoring) + { + this.ignoreInput = ignoring; + }; + Acts.prototype.SetMaxSpeed = function (maxspeed) + { + this.maxspeed = maxspeed; + if (this.maxspeed < 0) + this.maxspeed = 0; + }; + Acts.prototype.SetAcceleration = function (acc) + { + this.acc = acc; + if (this.acc < 0) + this.acc = 0; + }; + Acts.prototype.SetDeceleration = function (dec) + { + this.dec = dec; + if (this.dec < 0) + this.dec = 0; + }; + Acts.prototype.SetJumpStrength = function (js) + { + this.jumpStrength = js; + if (this.jumpStrength < 0) + this.jumpStrength = 0; + }; + Acts.prototype.SetGravity = function (grav) + { + if (this.g1 === grav) + return; // no change + this.g = grav; + this.updateGravity(); + if (this.runtime.testOverlapSolid(this.inst)) + { + this.runtime.pushOutSolid(this.inst, this.downx, this.downy, 10); + this.inst.x += this.downx * 2; + this.inst.y += this.downy * 2; + this.inst.set_bbox_changed(); + } + this.lastFloorObject = null; + }; + Acts.prototype.SetMaxFallSpeed = function (mfs) + { + this.maxFall = mfs; + if (this.maxFall < 0) + this.maxFall = 0; + }; + Acts.prototype.SimulateControl = function (ctrl) + { + switch (ctrl) { + case 0: this.simleft = true; break; + case 1: this.simright = true; break; + case 2: this.simjump = true; break; + } + }; + Acts.prototype.SetVectorX = function (vx) + { + this.dx = vx; + }; + Acts.prototype.SetVectorY = function (vy) + { + this.dy = vy; + }; + Acts.prototype.SetGravityAngle = function (a) + { + a = cr.to_radians(a); + a = cr.clamp_angle(a); + if (this.ga === a) + return; // no change + this.ga = a; + this.updateGravity(); + this.lastFloorObject = null; + }; + Acts.prototype.SetEnabled = function (en) + { + if (this.enabled !== (en === 1)) + { + this.enabled = (en === 1); + if (!this.enabled) + this.lastFloorObject = null; + } + }; + Acts.prototype.FallThrough = function () + { + var oldx = this.inst.x; + var oldy = this.inst.y; + this.inst.x += this.downx; + this.inst.y += this.downy; + this.inst.set_bbox_changed(); + var overlaps = this.runtime.testOverlapJumpThru(this.inst, false); + this.inst.x = oldx; + this.inst.y = oldy; + this.inst.set_bbox_changed(); + if (!overlaps) + return; + this.fallthrough = 3; // disable jumpthrus for 3 ticks (1 doesn't do it, 2 does, 3 to be on safe side) + this.lastFloorObject = null; + }; + Acts.prototype.SetDoubleJumpEnabled = function (e) + { + this.enableDoubleJump = (e !== 0); + }; + Acts.prototype.SetJumpSustain = function (s) + { + this.jumpSustain = s / 1000; // convert to ms + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Speed = function (ret) + { + ret.set_float(Math.sqrt(this.dx * this.dx + this.dy * this.dy)); + }; + Exps.prototype.MaxSpeed = function (ret) + { + ret.set_float(this.maxspeed); + }; + Exps.prototype.Acceleration = function (ret) + { + ret.set_float(this.acc); + }; + Exps.prototype.Deceleration = function (ret) + { + ret.set_float(this.dec); + }; + Exps.prototype.JumpStrength = function (ret) + { + ret.set_float(this.jumpStrength); + }; + Exps.prototype.Gravity = function (ret) + { + ret.set_float(this.g); + }; + Exps.prototype.GravityAngle = function (ret) + { + ret.set_float(cr.to_degrees(this.ga)); + }; + Exps.prototype.MaxFallSpeed = function (ret) + { + ret.set_float(this.maxFall); + }; + Exps.prototype.MovingAngle = function (ret) + { + ret.set_float(cr.to_degrees(Math.atan2(this.dy, this.dx))); + }; + Exps.prototype.VectorX = function (ret) + { + ret.set_float(this.dx); + }; + Exps.prototype.VectorY = function (ret) + { + ret.set_float(this.dy); + }; + Exps.prototype.JumpSustain = function (ret) + { + ret.set_float(this.jumpSustain * 1000); // convert back to ms + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Rotate = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Rotate.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.speed = cr.to_radians(this.properties[0]); + this.acc = cr.to_radians(this.properties[1]); + }; + behinstProto.saveToJSON = function () + { + return { + "speed": this.speed, + "acc": this.acc + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.speed = o["speed"]; + this.acc = o["acc"]; + }; + behinstProto.tick = function () + { + var dt = this.runtime.getDt(this.inst); + if (dt === 0) + return; + if (this.acc !== 0) + this.speed += this.acc * dt; + if (this.speed !== 0) + { + this.inst.angle = cr.clamp_angle(this.inst.angle + this.speed * dt); + this.inst.set_bbox_changed(); + } + }; + function Cnds() {}; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetSpeed = function (s) + { + this.speed = cr.to_radians(s); + }; + Acts.prototype.SetAcceleration = function (a) + { + this.acc = cr.to_radians(a); + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.Speed = function (ret) + { + ret.set_float(cr.to_degrees(this.speed)); + }; + Exps.prototype.Acceleration = function (ret) + { + ret.set_float(cr.to_degrees(this.acc)); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Sin = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Sin.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + this.i = 0; // period offset (radians) + }; + var behinstProto = behaviorProto.Instance.prototype; + var _2pi = 2 * Math.PI; + var _pi_2 = Math.PI / 2; + var _3pi_2 = (3 * Math.PI) / 2; + behinstProto.onCreate = function() + { + this.active = (this.properties[0] === 1); + this.movement = this.properties[1]; // 0=Horizontal|1=Vertical|2=Size|3=Width|4=Height|5=Angle|6=Opacity|7=Value only + this.wave = this.properties[2]; // 0=Sine|1=Triangle|2=Sawtooth|3=Reverse sawtooth|4=Square + this.period = this.properties[3]; + this.period += Math.random() * this.properties[4]; // period random + if (this.period === 0) + this.i = 0; + else + { + this.i = (this.properties[5] / this.period) * _2pi; // period offset + this.i += ((Math.random() * this.properties[6]) / this.period) * _2pi; // period offset random + } + this.mag = this.properties[7]; // magnitude + this.mag += Math.random() * this.properties[8]; // magnitude random + this.initialValue = 0; + this.initialValue2 = 0; + this.ratio = 0; + this.init(); + }; + behinstProto.saveToJSON = function () + { + return { + "i": this.i, + "a": this.active, + "mv": this.movement, + "w": this.wave, + "p": this.period, + "mag": this.mag, + "iv": this.initialValue, + "iv2": this.initialValue2, + "r": this.ratio, + "lkv": this.lastKnownValue, + "lkv2": this.lastKnownValue2 + }; + }; + behinstProto.loadFromJSON = function (o) + { + this.i = o["i"]; + this.active = o["a"]; + this.movement = o["mv"]; + this.wave = o["w"]; + this.period = o["p"]; + this.mag = o["mag"]; + this.initialValue = o["iv"]; + this.initialValue2 = o["iv2"] || 0; + this.ratio = o["r"]; + this.lastKnownValue = o["lkv"]; + this.lastKnownValue2 = o["lkv2"] || 0; + }; + behinstProto.init = function () + { + switch (this.movement) { + case 0: // horizontal + this.initialValue = this.inst.x; + break; + case 1: // vertical + this.initialValue = this.inst.y; + break; + case 2: // size + this.initialValue = this.inst.width; + this.ratio = this.inst.height / this.inst.width; + break; + case 3: // width + this.initialValue = this.inst.width; + break; + case 4: // height + this.initialValue = this.inst.height; + break; + case 5: // angle + this.initialValue = this.inst.angle; + this.mag = cr.to_radians(this.mag); // convert magnitude from degrees to radians + break; + case 6: // opacity + this.initialValue = this.inst.opacity; + break; + case 7: + this.initialValue = 0; + break; + case 8: // forwards/backwards + this.initialValue = this.inst.x; + this.initialValue2 = this.inst.y; + break; + default: +; + } + this.lastKnownValue = this.initialValue; + this.lastKnownValue2 = this.initialValue2; + }; + behinstProto.waveFunc = function (x) + { + x = x % _2pi; + switch (this.wave) { + case 0: // sine + return Math.sin(x); + case 1: // triangle + if (x <= _pi_2) + return x / _pi_2; + else if (x <= _3pi_2) + return 1 - (2 * (x - _pi_2) / Math.PI); + else + return (x - _3pi_2) / _pi_2 - 1; + case 2: // sawtooth + return 2 * x / _2pi - 1; + case 3: // reverse sawtooth + return -2 * x / _2pi + 1; + case 4: // square + return x < Math.PI ? -1 : 1; + }; + return 0; + }; + behinstProto.tick = function () + { + var dt = this.runtime.getDt(this.inst); + if (!this.active || dt === 0) + return; + if (this.period === 0) + this.i = 0; + else + { + this.i += (dt / this.period) * _2pi; + this.i = this.i % _2pi; + } + this.updateFromPhase(); + }; + behinstProto.updateFromPhase = function () + { + switch (this.movement) { + case 0: // horizontal + if (this.inst.x !== this.lastKnownValue) + this.initialValue += this.inst.x - this.lastKnownValue; + this.inst.x = this.initialValue + this.waveFunc(this.i) * this.mag; + this.lastKnownValue = this.inst.x; + break; + case 1: // vertical + if (this.inst.y !== this.lastKnownValue) + this.initialValue += this.inst.y - this.lastKnownValue; + this.inst.y = this.initialValue + this.waveFunc(this.i) * this.mag; + this.lastKnownValue = this.inst.y; + break; + case 2: // size + this.inst.width = this.initialValue + this.waveFunc(this.i) * this.mag; + this.inst.height = this.inst.width * this.ratio; + break; + case 3: // width + this.inst.width = this.initialValue + this.waveFunc(this.i) * this.mag; + break; + case 4: // height + this.inst.height = this.initialValue + this.waveFunc(this.i) * this.mag; + break; + case 5: // angle + if (this.inst.angle !== this.lastKnownValue) + this.initialValue = cr.clamp_angle(this.initialValue + (this.inst.angle - this.lastKnownValue)); + this.inst.angle = cr.clamp_angle(this.initialValue + this.waveFunc(this.i) * this.mag); + this.lastKnownValue = this.inst.angle; + break; + case 6: // opacity + this.inst.opacity = this.initialValue + (this.waveFunc(this.i) * this.mag) / 100; + if (this.inst.opacity < 0) + this.inst.opacity = 0; + else if (this.inst.opacity > 1) + this.inst.opacity = 1; + break; + case 8: // forwards/backwards + if (this.inst.x !== this.lastKnownValue) + this.initialValue += this.inst.x - this.lastKnownValue; + if (this.inst.y !== this.lastKnownValue2) + this.initialValue2 += this.inst.y - this.lastKnownValue2; + this.inst.x = this.initialValue + Math.cos(this.inst.angle) * this.waveFunc(this.i) * this.mag; + this.inst.y = this.initialValue2 + Math.sin(this.inst.angle) * this.waveFunc(this.i) * this.mag; + this.lastKnownValue = this.inst.x; + this.lastKnownValue2 = this.inst.y; + break; + } + this.inst.set_bbox_changed(); + }; + behinstProto.onSpriteFrameChanged = function (prev_frame, next_frame) + { + switch (this.movement) { + case 2: // size + this.initialValue *= (next_frame.width / prev_frame.width); + this.ratio = next_frame.height / next_frame.width; + break; + case 3: // width + this.initialValue *= (next_frame.width / prev_frame.width); + break; + case 4: // height + this.initialValue *= (next_frame.height / prev_frame.height); + break; + } + }; + function Cnds() {}; + Cnds.prototype.IsActive = function () + { + return this.active; + }; + Cnds.prototype.CompareMovement = function (m) + { + return this.movement === m; + }; + Cnds.prototype.ComparePeriod = function (cmp, v) + { + return cr.do_cmp(this.period, cmp, v); + }; + Cnds.prototype.CompareMagnitude = function (cmp, v) + { + if (this.movement === 5) + return cr.do_cmp(this.mag, cmp, cr.to_radians(v)); + else + return cr.do_cmp(this.mag, cmp, v); + }; + Cnds.prototype.CompareWave = function (w) + { + return this.wave === w; + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.SetActive = function (a) + { + this.active = (a === 1); + }; + Acts.prototype.SetPeriod = function (x) + { + this.period = x; + }; + Acts.prototype.SetMagnitude = function (x) + { + this.mag = x; + if (this.movement === 5) // angle + this.mag = cr.to_radians(this.mag); + }; + Acts.prototype.SetMovement = function (m) + { + if (this.movement === 5) + this.mag = cr.to_degrees(this.mag); + this.movement = m; + this.init(); + }; + Acts.prototype.SetWave = function (w) + { + this.wave = w; + }; + Acts.prototype.SetPhase = function (x) + { + this.i = (x * _2pi) % _2pi; + this.updateFromPhase(); + }; + Acts.prototype.UpdateInitialState = function () + { + this.init(); + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.CyclePosition = function (ret) + { + ret.set_float(this.i / _2pi); + }; + Exps.prototype.Period = function (ret) + { + ret.set_float(this.period); + }; + Exps.prototype.Magnitude = function (ret) + { + if (this.movement === 5) // angle + ret.set_float(cr.to_degrees(this.mag)); + else + ret.set_float(this.mag); + }; + Exps.prototype.Value = function (ret) + { + ret.set_float(this.waveFunc(this.i) * this.mag); + }; + behaviorProto.exps = new Exps(); +}()); +; +; +cr.behaviors.Timer = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.Timer.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.timers = {}; + }; + behinstProto.onDestroy = function () + { + cr.wipe(this.timers); + }; + behinstProto.saveToJSON = function () + { + var o = {}; + var p, t; + for (p in this.timers) + { + if (this.timers.hasOwnProperty(p)) + { + t = this.timers[p]; + o[p] = { + "c": t.current.sum, + "t": t.total.sum, + "d": t.duration, + "r": t.regular + }; + } + } + return o; + }; + behinstProto.loadFromJSON = function (o) + { + this.timers = {}; + var p; + for (p in o) + { + if (o.hasOwnProperty(p)) + { + this.timers[p] = { + current: new cr.KahanAdder(), + total: new cr.KahanAdder(), + duration: o[p]["d"], + regular: o[p]["r"] + }; + this.timers[p].current.sum = o[p]["c"]; + this.timers[p].total.sum = o[p]["t"]; + } + } + }; + behinstProto.tick = function () + { + var dt = this.runtime.getDt(this.inst); + var p, t; + for (p in this.timers) + { + if (this.timers.hasOwnProperty(p)) + { + t = this.timers[p]; + t.current.add(dt); + t.total.add(dt); + } + } + }; + behinstProto.tick2 = function () + { + var p, t; + for (p in this.timers) + { + if (this.timers.hasOwnProperty(p)) + { + t = this.timers[p]; + if (t.current.sum >= t.duration) + { + if (t.regular) + t.current.sum -= t.duration; + else + delete this.timers[p]; + } + } + } + }; + function Cnds() {}; + Cnds.prototype.OnTimer = function (tag_) + { + tag_ = tag_.toLowerCase(); + var t = this.timers[tag_]; + if (!t) + return false; + return t.current.sum >= t.duration; + }; + behaviorProto.cnds = new Cnds(); + function Acts() {}; + Acts.prototype.StartTimer = function (duration_, type_, tag_) + { + this.timers[tag_.toLowerCase()] = { + current: new cr.KahanAdder(), + total: new cr.KahanAdder(), + duration: duration_, + regular: (type_ === 1) + }; + }; + Acts.prototype.StopTimer = function (tag_) + { + tag_ = tag_.toLowerCase(); + if (this.timers.hasOwnProperty(tag_)) + delete this.timers[tag_]; + }; + behaviorProto.acts = new Acts(); + function Exps() {}; + Exps.prototype.CurrentTime = function (ret, tag_) + { + var t = this.timers[tag_.toLowerCase()]; + ret.set_float(t ? t.current.sum : 0); + }; + Exps.prototype.TotalTime = function (ret, tag_) + { + var t = this.timers[tag_.toLowerCase()]; + ret.set_float(t ? t.total.sum : 0); + }; + Exps.prototype.Duration = function (ret, tag_) + { + var t = this.timers[tag_.toLowerCase()]; + ret.set_float(t ? t.duration : 0); + }; + behaviorProto.exps = new Exps(); +}()); +var easeOutBounceArray = []; +var easeInElasticArray = []; +var easeOutElasticArray = []; +var easeInOutElasticArray = []; +var easeInCircle = []; +var easeOutCircle = []; +var easeInOutCircle = []; +var easeInBack = []; +var easeOutBack = []; +var easeInOutBack = []; +var litetween_precision = 10000; +var updateLimit = 0; //0.0165; +function easeOutBouncefunc(t) { + var b=0.0; + var c=1.0; + var d=1.0; + if ((t/=d) < (1/2.75)) { + result = c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + result = c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + result = c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + result = c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + return result; +} +function integerize(t, d) +{ + return Math.round(t/d*litetween_precision); +} +function easeFunc(easing, t, b, c, d, flip, param) +{ + var ret_ease = 0; + switch (easing) { + case 0: // linear + ret_ease = c*t/d + b; + break; + case 1: // easeInQuad + ret_ease = c*(t/=d)*t + b; + break; + case 2: // easeOutQuad + ret_ease = -c *(t/=d)*(t-2) + b; + break; + case 3: // easeInOutQuad + if ((t/=d/2) < 1) + ret_ease = c/2*t*t + b + else + ret_ease = -c/2 * ((--t)*(t-2) - 1) + b; + break; + case 4: // easeInCubic + ret_ease = c*(t/=d)*t*t + b; + break; + case 5: // easeOutCubic + ret_ease = c*((t=t/d-1)*t*t + 1) + b; + break; + case 6: // easeInOutCubic + if ((t/=d/2) < 1) + ret_ease = c/2*t*t*t + b + else + ret_ease = c/2*((t-=2)*t*t + 2) + b; + break; + case 7: // easeInQuart + ret_ease = c*(t/=d)*t*t*t + b; + break; + case 8: // easeOutQuart + ret_ease = -c * ((t=t/d-1)*t*t*t - 1) + b; + break; + case 9: // easeInOutQuart + if ((t/=d/2) < 1) + ret_ease = c/2*t*t*t*t + b + else + ret_ease = -c/2 * ((t-=2)*t*t*t - 2) + b; + break; + case 10: // easeInQuint + ret_ease = c*(t/=d)*t*t*t*t + b; + break; + case 11: // easeOutQuint + ret_ease = c*((t=t/d-1)*t*t*t*t + 1) + b; + break; + case 12: // easeInOutQuint + if ((t/=d/2) < 1) + ret_ease = c/2*t*t*t*t*t + b + else + ret_ease = c/2*((t-=2)*t*t*t*t + 2) + b; + break; + case 13: // easeInCircle + if (param.optimized) { + ret_ease = easeInCircle[integerize(t,d)]; + } else { + ret_ease = -(Math.sqrt(1-t*t) - 1); + } + break; + case 14: // easeOutCircle + if (param.optimized) { + ret_ease = easeOutCircle[integerize(t,d)]; + } else { + ret_ease = Math.sqrt(1 - ((t-1)*(t-1))); + } + break; + case 15: // easeInOutCircle + if (param.optimized) { + ret_ease = easeInOutCircle[integerize(t,d)]; + } else { + if ((t/=d/2) < 1) ret_ease = -c/2 * (Math.sqrt(1 - t*t) - 1) + b + else ret_ease = c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + } + break; + case 16: // easeInBack + if (param.optimized) { + ret_ease = easeInBack[integerize(t,d)]; + } else { + var s = param.s; + ret_ease = c*(t/=d)*t*((s+1)*t - s) + b; + } + break; + case 17: // easeOutBack + if (param.optimized) { + ret_ease = easeOutBack[integerize(t,d)]; + } else { + var s = param.s; + ret_ease = c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + } + break; + case 18: // easeInOutBack + if (param.optimized) { + ret_ease = easeInOutBack[integerize(t,d)]; + } else { + var s = param.s + if ((t/=d/2) < 1) + ret_ease = c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b + else + ret_ease = c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + } + break; + case 19: //easeInElastic + if (param.optimized) { + ret_ease = easeInElasticArray[integerize(t, d)]; + } else { + var a = param.a; + var p = param.p; + var s = 0; + if (t==0) ret_ease = b; if ((t/=d)==1) ret_ease = b+c; + if (p==0) p=d*.3; if (a==0 || a < Math.abs(c)) { a=c; s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + ret_ease = -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + } + break; + case 20: //easeOutElastic + if (param.optimized) { + ret_ease = easeOutElasticArray[integerize(t,d)]; + } else { + var a = param.a; + var p = param.p; + var s = 0; + if (t==0) ret_ease= b; if ((t/=d)==1) ret_ease= b+c; if (p == 0) p=d*.3; + if (a==0 || a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + ret_ease= (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b); + } + break; + case 21: //easeInOutElastic + if (param.optimized) { + ret_ease = easeInOutElasticArray[integerize(t,d)]; + } else { + var a = param.a; + var p = param.p; + var s = 0; + if (t==0) ret_ease = b; + if ((t/=d/2)==2) ret_ease = b+c; + if (p==0) p=d*(.3*1.5); + if (a==0 || a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) + ret_ease = -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b + else + ret_ease = a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + } + break; + case 22: //easeInBounce + if (param.optimized) { + ret_ease = c - easeOutBounceArray[integerize(d-t, d)] + b; + } else { + ret_ease = c - easeOutBouncefunc(d-t/d) + b; + } + break; + case 23: //easeOutBounce + if (param.optimized) { + ret_ease = easeOutBounceArray[integerize(t, d)]; + } else { + ret_ease = easeOutBouncefunc(t/d); + } + break; + case 24: //easeInOutBounce + if (param.optimized) { + if (t < d/2) + ret_ease = (c - easeOutBounceArray[integerize(d-(t*2), d)] + b) * 0.5 +b; + else + ret_ease = easeOutBounceArray[integerize(t*2-d, d)] * .5 + c*.5 + b; + } else { + if (t < d/2) + ret_ease = (c - easeOutBouncefunc(d-(t*2)) + b) * 0.5 +b; + else + ret_ease = easeOutBouncefunc((t*2-d)/d) * .5 + c *.5 + b; + } + break; + case 25: //easeInSmoothstep + var mt = (t/d) / 2; + ret_ease = (2*(mt * mt * (3 - 2*mt))); + break; + case 26: //easeOutSmoothstep + var mt = ((t/d) + 1) / 2; + ret_ease = ((2*(mt * mt * (3 - 2*mt))) - 1); + break; + case 27: //easeInOutSmoothstep + var mt = (t / d); + ret_ease = (mt * mt * (3 - 2*mt)); + break; + }; + if (flip) + return (c - b) - ret_ease + else + return ret_ease; +}; +(function preCalculateArray() { + var d = 1.0; + var b = 0.0; + var c = 1.0; + var result = 0.0; + var a = 0.0; + var p = 0.0; + var t = 0.0; + var s = 0.0; + for (var ti = 0; ti <= litetween_precision; ti++) { + t = ti/litetween_precision; + if ((t/=d) < (1/2.75)) { + result = c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + result = c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + result = c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + result = c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + easeOutBounceArray[ti] = result; + t = ti/litetween_precision; a = 0; p = 0; + if (t==0) result = b; if ((t/=d)==1) result = b+c; + if (p==0) p=d*.3; if (a==0 || a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + result = -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + easeInElasticArray[ti] = result; + t = ti/litetween_precision; a = 0; p = 0; + if (t==0) result= b; if ((t/=d)==1) result= b+c; if (p == 0) p=d*.3; + if (a==0 || a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + result= (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b); + easeOutElasticArray[ti] = result; + t = ti/litetween_precision; a = 0; p = 0; + if (t==0) result = b; + if ((t/=d/2)==2) result = b+c; + if (p==0) p=d*(.3*1.5); + if (a==0 || a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) + result = -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b + else + result = a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + easeInOutElasticArray[ti] = result; + t = ti/litetween_precision; easeInCircle[ti] = -(Math.sqrt(1-t*t) - 1); + t = ti/litetween_precision; easeOutCircle[ti] = Math.sqrt(1 - ((t-1)*(t-1))); + t = ti/litetween_precision; + if ((t/=d/2) < 1) result = -c/2 * (Math.sqrt(1 - t*t) - 1) + b + else result = c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + easeInOutCircle[ti] = result; + t = ti/litetween_precision; s = 0; + if (s==0) s = 1.70158; + result = c*(t/=d)*t*((s+1)*t - s) + b; + easeInBack[ti] = result; + t = ti/litetween_precision; s = 0; + if (s==0) s = 1.70158; + result = c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + easeOutBack[ti] = result; + t = ti/litetween_precision; s = 0; if (s==0) s = 1.70158; + if ((t/=d/2) < 1) + result = c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b + else + result = c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + easeInOutBack[ti] = result; + } +}()); +var TweenObject = function() +{ + var constructor = function (tname, tweened, easefunc, initial, target, duration, enforce) + { + this.name = tname; + this.value = 0; + this.setInitial(initial); + this.setTarget(target); + this.easefunc = easefunc; + this.tweened = tweened; + this.duration = duration; + this.progress = 0; + this.state = 0; + this.onStart = false; + this.onEnd = false; + this.onReverseStart = false; + this.onReverseEnd = false; + this.lastKnownValue = 0; + this.lastKnownValue2 = 0; + this.enforce = enforce; + this.pingpong = 1.0; + this.flipEase = false; + this.easingparam = []; + this.lastState = 1; + for (var i=0; i<28; i++) { + this.easingparam[i] = {}; + this.easingparam[i].a = 0.0; + this.easingparam[i].p = 0.0; + this.easingparam[i].t = 0.0; + this.easingparam[i].s = 0.0; + this.easingparam[i].optimized = true; + } + } + return constructor; +}(); +(function () { + TweenObject.prototype = { + }; + TweenObject.prototype.flipTarget = function () + { + var x1 = this.initialparam1; + var x2 = this.initialparam2; + this.initialparam1 = this.targetparam1; + this.initialparam2 = this.targetparam2; + this.targetparam1 = x1; + this.targetparam2 = x2; + this.lastKnownValue = 0; + this.lastKnownValue2 = 0; + } + TweenObject.prototype.setInitial = function (initial) + { + this.initialparam1 = parseFloat(initial.split(",")[0]); + this.initialparam2 = parseFloat(initial.split(",")[1]); + this.lastKnownValue = 0; + this.lastKnownValue2 = 0; + } + TweenObject.prototype.setTarget = function (target) + { + this.targetparam1 = parseFloat(target.split(",")[0]); + this.targetparam2 = parseFloat(target.split(",")[1]); + if (isNaN(this.targetparam2)) this.targetparam2 = this.targetparam1; + } + TweenObject.prototype.OnTick = function(dt) + { + if (this.state === 0) return -1.0; + if (this.state === 1) + this.progress += dt; + if (this.state === 2) + this.progress -= dt; + if (this.state === 3) { + this.state = 0; + } + if ((this.state === 4) || (this.state === 6)) { + this.progress += dt * this.pingpong; + } + if (this.state === 5) { + this.progress += dt * this.pingpong; + } + if (this.progress < 0) { + this.progress = 0; + if (this.state === 4) { + this.pingpong = 1; + } else if (this.state === 6) { + this.pingpong = 1; + this.flipEase = false; + } else { + this.state = 0; + } + this.onReverseEnd = true; + return 0.0; + } else if (this.progress > this.duration) { + this.progress = this.duration; + if (this.state === 4) { + this.pingpong = -1; + } else if (this.state === 6) { + this.pingpong = -1; + this.flipEase = true; + } else if (this.state === 5) { + this.progress = 0.0; + } else { + this.state = 0; + } + this.onEnd = true; + return 1.0; + } else { + if (this.flipEase) { + var factor = easeFunc(this.easefunc, this.duration - this.progress, 0, 1, this.duration, this.flipEase, this.easingparam[this.easefunc]); + } else { + var factor = easeFunc(this.easefunc, this.progress, 0, 1, this.duration, this.flipEase, this.easingparam[this.easefunc]); + } + return factor; + } + }; +}()); +; +; +function trim (str) { + return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); +} +cr.behaviors.lunarray_LiteTween = function(runtime) +{ + this.runtime = runtime; +}; +(function () +{ + var behaviorProto = cr.behaviors.lunarray_LiteTween.prototype; + behaviorProto.Type = function(behavior, objtype) + { + this.behavior = behavior; + this.objtype = objtype; + this.runtime = behavior.runtime; + }; + var behtypeProto = behaviorProto.Type.prototype; + behtypeProto.onCreate = function() + { + }; + behaviorProto.Instance = function(type, inst) + { + this.type = type; + this.behavior = type.behavior; + this.inst = inst; // associated object instance to modify + this.runtime = type.runtime; + this.i = 0; // progress + }; + var behinstProto = behaviorProto.Instance.prototype; + behinstProto.onCreate = function() + { + this.playmode = this.properties[0]; + this.active = (this.playmode == 1) || (this.playmode == 2) || (this.playmode == 3) || (this.playmode == 4); + this.tweened = this.properties[1]; // 0=Position|1=Size|2=Width|3=Height|4=Angle|5=Opacity|6=Value only|7=Horizontal|8=Vertical|9=Scale + this.easing = this.properties[2]; + this.target = this.properties[3]; + this.targetmode = this.properties[4]; + this.useCurrent = false; + if (this.targetmode === 1) this.target = "relative("+this.target+")"; + this.duration = this.properties[5]; + this.enforce = (this.properties[6] === 1); + this.value = 0; + this.tween_list = {}; + this.addToTweenList("default", this.tweened, this.easing, "current", this.target, this.duration, this.enforce); + if (this.properties[0] === 1) this.startTween(0) + if (this.properties[0] === 2) this.startTween(2) + if (this.properties[0] === 3) this.startTween(3) + if (this.properties[0] === 4) this.startTween(4) + }; + behinstProto.parseCurrent = function(tweened, parseText) + { + if (parseText === undefined) parseText = "current"; + var parsed = trim(parseText); + parseText = trim(parseText); + var value = this.value; + if (parseText === "current") { + switch (tweened) { + case 0: parsed = this.inst.x + "," + this.inst.y; break; + case 1: parsed = this.inst.width + "," + this.inst.height; break; + case 2: parsed = this.inst.width + "," + this.inst.height; break; + case 3: parsed = this.inst.width + "," + this.inst.height; break; + case 4: parsed = cr.to_degrees(this.inst.angle) + "," + cr.to_degrees(this.inst.angle); break; + case 5: parsed = (this.inst.opacity*100) + "," + (this.inst.opacity*100); break; + case 6: parsed = value + "," + value; break; + case 7: parsed = this.inst.x + "," + this.inst.y; break; + case 8: parsed = this.inst.x + "," + this.inst.y; break; + case 9: + if (this.inst.curFrame !== undefined) + parsed = (this.inst.width/this.inst.curFrame.width) + "," +(this.inst.height/this.inst.curFrame.height) + else + parsed = "1,1"; + break; + default: break; + } + } + if (parseText.substring(0,8) === "relative") { + var param1 = parseText.match(/\((.*?)\)/); + if (param1) { + var relativex = parseFloat(param1[1].split(",")[0]); + var relativey = parseFloat(param1[1].split(",")[1]); + } + if (isNaN(relativex)) relativex = 0; + if (isNaN(relativey)) relativey = 0; + switch (tweened) { + case 0: parsed = (this.inst.x+relativex) + "," + (this.inst.y+relativey); break; + case 1: parsed = (this.inst.width+relativex) + "," + (this.inst.height+relativey); break; + case 2: parsed = (this.inst.width+relativex) + "," + (this.inst.height+relativey); break; + case 3: parsed = (this.inst.width+relativex) + "," + (this.inst.height+relativey); break; + case 4: parsed = (cr.to_degrees(this.inst.angle)+relativex) + "," + (cr.to_degrees(this.inst.angle)+relativey); break; + case 5: parsed = (this.inst.opacity*100+relativex) + "," + (this.inst.opacity*100+relativey); break; + case 6: parsed = value+relativex + "," + value+relativex; break; + case 7: parsed = (this.inst.x+relativex) + "," + (this.inst.y); break; + case 8: parsed = (this.inst.x) + "," + (this.inst.y+relativex); break; + case 9: parsed = (relativex) + "," + (relativey); break; + default: break; + } + } + return parsed; + }; + behinstProto.addToTweenList = function(tname, tweened, easing, init, targ, duration, enforce) + { + init = this.parseCurrent(tweened, init); + targ = this.parseCurrent(tweened, targ); + if (this.tween_list[tname] !== undefined) { + delete this.tween_list[tname] + } + this.tween_list[tname] = new TweenObject(tname, tweened, easing, init, targ, duration, enforce); + this.tween_list[tname].dt = 0; + }; + behinstProto.saveToJSON = function () + { + var v = JSON.stringify(this.tween_list["default"]); + return { + "playmode": this.playmode, + "active": this.active, + "tweened": this.tweened, + "easing": this.easing, + "target": this.target, + "targetmode": this.targetmode, + "useCurrent": this.useCurrent, + "duration": this.duration, + "enforce": this.enforce, + "value": this.value, + "tweenlist": JSON.stringify(this.tween_list["default"]) + }; + }; + TweenObject.Load = function(rawObj, tname, tweened, easing, init, targ, duration, enforce) + { + var obj = new TweenObject(tname, tweened, easing, init, targ, duration, enforce); + for(var i in rawObj) + obj[i] = rawObj[i]; + return obj; + }; + behinstProto.loadFromJSON = function (o) + { + var x = JSON.parse(o["tweenlist"]); + var tempObj = TweenObject.Load(x, x.name, x.tweened, x.easefunc, x.initialparam1+","+x.initialparam2, x.targetparam1+","+x.targetparam2, x.duration, x.enforce); + this.tween_list["default"] = tempObj; + this.playmode = o["playmode"]; + this.active = o["active"]; + this.movement = o["tweened"]; + this.easing = o["easing"]; + this.target = o["target"]; + this.targetmode = o["targetmode"]; + this.useCurrent = o["useCurrent"]; + this.duration = o["duration"]; + this.enforce = o["enforce"]; + this.value = o["value"]; + }; + behinstProto.setProgressTo = function (mark) + { + if (mark > 1.0) mark = 1.0; + if (mark < 0.0) mark = 0.0; + for (var i in this.tween_list) { + var inst = this.tween_list[i]; + inst.lastKnownValue = 0; + inst.lastKnownValue2 = 0; + inst.state = 3; + inst.progress = mark * inst.duration; + var factor = inst.OnTick(0); + this.updateTween(inst, factor); + } + } + behinstProto.startTween = function (startMode) + { + for (var i in this.tween_list) { + var inst = this.tween_list[i]; + if (this.useCurrent) { + var init = this.parseCurrent(inst.tweened, "current"); + var target = this.parseCurrent(inst.tweened, this.target); + inst.setInitial(init); + inst.setTarget(target); + } + if (startMode === 0) { + inst.progress = 0.000001; + inst.lastKnownValue = 0; + inst.lastKnownValue2 = 0; + inst.onStart = true; + inst.state = 1; + } + if (startMode === 1) { + inst.state = inst.lastState; + } + if ((startMode === 2) || (startMode === 4)) { + inst.progress = 0.000001; + inst.lastKnownValue = 0; + inst.lastKnownValue2 = 0; + inst.onStart = true; + if (startMode == 2) inst.state = 4; //state ping pong + if (startMode == 4) inst.state = 6; //state flip flop + } + if (startMode === 3) { + inst.progress = 0.000001; + inst.lastKnownValue = 0; + inst.lastKnownValue2 = 0; + inst.onStart = true; + inst.state = 5; + } + } + } + behinstProto.stopTween = function (stopMode) + { + for (var i in this.tween_list) { + var inst = this.tween_list[i]; + if ((inst.state != 3) && (inst.state != 0)) //don't save paused/seek state + inst.lastState = inst.state; + if (stopMode === 1) inst.progress = 0.0; + if (stopMode === 2) inst.progress = inst.duration; + inst.state = 3; + var factor = inst.OnTick(0); + this.updateTween(inst, factor); + } + } + behinstProto.reverseTween = function(reverseMode) + { + for (var i in this.tween_list) { + var inst = this.tween_list[i]; + if (reverseMode === 1) { + inst.progress = inst.duration; + inst.lastKnownValue = 0; + inst.lastKnownValue2 = 0; + inst.onReverseStart = true; + } + inst.state = 2; + } + } + behinstProto.updateTween = function (inst, factor) + { + if (inst.tweened === 0) { + if (inst.enforce) { + this.inst.x = inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor; + this.inst.y = inst.initialparam2 + (inst.targetparam2 - inst.initialparam2) * factor; + } else { + this.inst.x += ((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue; + this.inst.y += ((inst.targetparam2 - inst.initialparam2) * factor) - inst.lastKnownValue2; + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + inst.lastKnownValue2 = ((inst.targetparam2 - inst.initialparam2) * factor); + } + } else if (inst.tweened === 1) { + if (inst.enforce) { + this.inst.width = (inst.initialparam1 + ((inst.targetparam1 - inst.initialparam1) * (factor))); + this.inst.height = (inst.initialparam2 + ((inst.targetparam2 - inst.initialparam2) * (factor))); + } else { + this.inst.width += ((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue; + this.inst.height += ((inst.targetparam2 - inst.initialparam2) * factor) - inst.lastKnownValue2; + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + inst.lastKnownValue2 = ((inst.targetparam2 - inst.initialparam2) * factor); + } + } else if (inst.tweened === 2) { + if (inst.enforce) { + this.inst.width = (inst.initialparam1 + ((inst.targetparam1 - inst.initialparam1) * (factor))); + } else { + this.inst.width += ((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue; + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + } + } else if (inst.tweened === 3) { + if (inst.enforce) { + this.inst.height = (inst.initialparam2 + ((inst.targetparam2 - inst.initialparam2) * (factor))); + } else { + this.inst.height += ((inst.targetparam2 - inst.initialparam2) * factor) - inst.lastKnownValue2; + inst.lastKnownValue2 = ((inst.targetparam2 - inst.initialparam2) * factor); + } + } else if (inst.tweened === 4) { + if (inst.enforce) { + var tangle = inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor; + this.inst.angle = cr.clamp_angle(cr.to_radians(tangle)); + } else { + var tangle = ((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue; + this.inst.angle = cr.clamp_angle(this.inst.angle + cr.to_radians(tangle)); + inst.lastKnownValue = (inst.targetparam1 - inst.initialparam1) * factor; + } + } else if (inst.tweened === 5) { + if (inst.enforce) { + this.inst.opacity = (inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor) / 100; + } else { + this.inst.opacity += (((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue) / 100; + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + } + } else if (inst.tweened === 6) { + if (inst.enforce) { + this.value = (inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor); + } else { + this.value += (((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue); + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + } + } else if (inst.tweened === 7) { + if (inst.enforce) { + this.inst.x = inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor; + } else { + this.inst.x += ((inst.targetparam1 - inst.initialparam1) * factor) - inst.lastKnownValue; + inst.lastKnownValue = ((inst.targetparam1 - inst.initialparam1) * factor); + } + } else if (inst.tweened === 8) { + if (inst.enforce) { + this.inst.y = inst.initialparam2 + (inst.targetparam2 - inst.initialparam2) * factor; + } else { + this.inst.y += ((inst.targetparam2 - inst.initialparam2) * factor) - inst.lastKnownValue2; + inst.lastKnownValue2 = ((inst.targetparam2 - inst.initialparam2) * factor); + } + } else if (inst.tweened === 9) { + var scalex = inst.initialparam1 + (inst.targetparam1 - inst.initialparam1) * factor; + var scaley = inst.initialparam2 + (inst.targetparam2 - inst.initialparam2) * factor; + if (this.inst.width < 0) scalex = inst.initialparam1 + (inst.targetparam1 + inst.initialparam1) * -factor; + if (this.inst.height < 0) scaley = inst.initialparam2 + (inst.targetparam2 + inst.initialparam2) * -factor; + if (inst.enforce) { + this.inst.width = this.inst.curFrame.width * scalex; + this.inst.height = this.inst.curFrame.height * scaley; + } else { + if (this.inst.width < 0) { + this.inst.width = scalex * (this.inst.width / (-1+inst.lastKnownValue)); + inst.lastKnownValue = scalex + 1 + } else { + this.inst.width = scalex * (this.inst.width / (1+inst.lastKnownValue)); + inst.lastKnownValue = scalex - 1; + } + if (this.inst.height < 0) { + this.inst.height = scaley * (this.inst.height / (-1+inst.lastKnownValue2)); + inst.lastKnownValue2 = scaley + 1 + } else { + this.inst.height = scaley * (this.inst.height / (1+inst.lastKnownValue2)); + inst.lastKnownValue2 = scaley - 1; + } + } + } + this.inst.set_bbox_changed(); + } + behinstProto.tick = function () + { + var dt = this.runtime.getDt(this.inst); + var inst = this.tween_list["default"]; + if (inst.state !== 0) { + if (inst.onStart) { + this.runtime.trigger(cr.behaviors.lunarray_LiteTween.prototype.cnds.OnStart, this.inst); + inst.onStart = false; + } + if (inst.onReverseStart) { + this.runtime.trigger(cr.behaviors.lunarray_LiteTween.prototype.cnds.OnReverseStart, this.inst); + inst.onReverseStart = false; + } + this.active = (inst.state == 1) || (inst.state == 2) || (inst.state == 4) || (inst.state == 5) || (inst.state == 6); + var factor = inst.OnTick(dt); + this.updateTween(inst, factor); + if (inst.onEnd) { + this.runtime.trigger(cr.behaviors.lunarray_LiteTween.prototype.cnds.OnEnd, this.inst); + inst.onEnd = false; + } + if (inst.onReverseEnd) { + this.runtime.trigger(cr.behaviors.lunarray_LiteTween.prototype.cnds.OnReverseEnd, this.inst); + inst.onReverseEnd = false; + } + } + }; + behaviorProto.cnds = {}; + var cnds = behaviorProto.cnds; + cnds.IsActive = function () + { + return (this.tween_list["default"].state !== 0); + }; + cnds.IsReversing = function () + { + return (this.tween_list["default"].state == 2); + }; + cnds.CompareProgress = function (cmp, v) + { + var inst = this.tween_list["default"]; + return cr.do_cmp((inst.progress / inst.duration), cmp, v); + }; + cnds.OnThreshold = function (cmp, v) + { + var inst = this.tween_list["default"]; + this.threshold = (cr.do_cmp((inst.progress / inst.duration), cmp, v)); + var ret = (this.oldthreshold != this.threshold) && (this.threshold); + if (ret) { + this.oldthreshold = this.threshold; + } + return ret; + }; + cnds.OnStart = function () + { + if (this.tween_list["default"] === undefined) + return false; + return this.tween_list["default"].onStart; + }; + cnds.OnReverseStart = function () + { + if (this.tween_list["default"] === undefined) + return false; + return this.tween_list["default"].onReverseStart; + }; + cnds.OnEnd = function () + { + if (this.tween_list["default"] === undefined) + return false; + return this.tween_list["default"].onEnd; + }; + cnds.OnReverseEnd = function () + { + if (this.tween_list["default"] === undefined) + return false; + return this.tween_list["default"].onReverseEnd; + }; + behaviorProto.acts = {}; + var acts = behaviorProto.acts; + acts.Start = function (startmode, current) + { + this.threshold = false; + this.oldthreshold = false; + this.useCurrent = (current == 1); + this.startTween(startmode); + }; + acts.Stop = function (stopmode) + { + this.stopTween(stopmode); + }; + acts.Reverse = function (revMode) + { + this.threshold = false; + this.oldthreshold = false; + this.reverseTween(revMode); + }; + acts.ProgressTo = function (progress) + { + this.setProgressTo(progress); + }; + acts.SetDuration = function (x) + { + if (isNaN(x)) return; + if (x < 0) return; + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].duration = x; + }; + acts.SetEnforce = function (x) + { + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].enforce = (x===1); + }; + acts.SetInitial = function (x) + { + if (this.tween_list["default"] === undefined) return; + var init = this.parseCurrent(this.tween_list["default"].tweened, x); + this.tween_list["default"].setInitial(init); + }; + acts.SetTarget = function (targettype, absrel, x) + { + if (this.tween_list["default"] === undefined) return; + if (isNaN(x)) return; + var inst = this.tween_list["default"]; + var parsed = x + ""; + this.targetmode = absrel; + var x1 = ""; + var x2 = ""; + if (absrel === 1) { + this.target = "relative(" + parsed + ")"; + switch (targettype) { + case 0: x1 = (this.inst.x + x); x2 = inst.targetparam2; break; + case 1: x1 = inst.targetparam1; x2 = (this.inst.y + x); break; + case 2: x1 = "" + cr.to_degrees(this.inst.angle + cr.to_radians(x)); x2 = x1; break; //angle + case 3: x1 = "" + (this.inst.opacity*100) + x; x2 = x1; break; //opacity + case 4: x1 = (this.inst.width + x); x2 = inst.targetparam2; break; //width + case 5: x1 = inst.targetparam1; x2 = (this.inst.height + x); break; //height + case 6: x1 = x; x2 = x; break; //value + default: break; + } + parsed = x1 + "," + x2; + } else { + switch (targettype) { + case 0: x1 = x; x2 = inst.targetparam2; break; + case 1: x1 = inst.targetparam1; x2 = x; break; + case 2: x1 = x; x2 = x; break; //angle + case 3: x1 = x; x2 = x; break; //opacity + case 4: x1 = x; x2 = inst.targetparam2; break; //width + case 5: x1 = inst.targetparam1; x2 = x; break; //height + case 6: x1 = x; x2 = x; break; //value + default: break; + } + parsed = x1 + "," + x2; + this.target = parsed; + } + var init = this.parseCurrent(this.tween_list["default"].tweened, "current"); + var targ = this.parseCurrent(this.tween_list["default"].tweened, parsed); + inst.setInitial(init); + inst.setTarget(targ); + }; + acts.SetTweenedProperty = function (x) + { + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].tweened = x; + }; + acts.SetEasing = function (x) + { + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].easefunc = x; + }; + acts.SetEasingParam = function (x, a, p, t, s) + { + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].easingparam[x].optimized = false; + this.tween_list["default"].easingparam[x].a = a; + this.tween_list["default"].easingparam[x].p = p; + this.tween_list["default"].easingparam[x].t = t; + this.tween_list["default"].easingparam[x].s = s; + }; + acts.ResetEasingParam = function () + { + if (this.tween_list["default"] === undefined) return; + this.tween_list["default"].optimized = true; + }; + acts.SetValue = function (x) + { + var inst = this.tween_list["default"]; + this.value = x; + if (inst.tweened === 6) + inst.setInitial( this.parseCurrent(inst.tweened, "current") ); + }; + acts.SetParameter = function (tweened, easefunction, target, duration, enforce) + { + if (this.tween_list["default"] === undefined) { + this.addToTweenList("default", tweened, easefunction, initial, target, duration, enforce, 0); + } else { + var inst = this.tween_list["default"]; + inst.tweened = tweened; + inst.easefunc = easefunction; + inst.setInitial( this.parseCurrent(tweened, "current") ); + inst.setTarget( this.parseCurrent(tweened, target) ); + inst.duration = duration; + inst.enforce = (enforce === 1); + } + }; + behaviorProto.exps = {}; + var exps = behaviorProto.exps; + exps.State = function (ret) + { + var parsed = "N/A"; + switch (this.tween_list["default"].state) { + case 0: parsed = "paused"; break; + case 1: parsed = "playing"; break; + case 2: parsed = "reversing"; break; + case 3: parsed = "seeking"; break; + default: break; + } + ret.set_string(parsed); + }; + exps.Progress = function (ret) + { + var progress = this.tween_list["default"].progress/this.tween_list["default"].duration; + ret.set_float(progress); + }; + exps.Duration = function (ret) + { + ret.set_float(this.tween_list["default"].duration); + }; + exps.Target = function (ret) + { + var inst = this.tween_list["default"]; + var parsed = "N/A"; + switch (inst.tweened) { + case 0: parsed = inst.targetparam1; break; + case 1: parsed = inst.targetparam2; break; + case 2: parsed = inst.targetparam1; break; + case 3: parsed = inst.targetparam1; break; + case 4: parsed = inst.targetparam1; break; + case 5: parsed = inst.targetparam2; break; + case 6: parsed = inst.targetparam1; break; + default: break; + } + ret.set_float(parsed); + }; + exps.Value = function (ret) + { + var tval = this.value; + ret.set_float(tval); + }; + exps.Tween = function (ret, a_, b_, x_, easefunc_) + { + var currX = (x_>1.0?1.0:x_); + var factor = easeFunc(easefunc_, currX<0.0?0.0:currX, 0.0, 1.0, 1.0, false, false); + ret.set_float(a_ + factor * (b_-a_)); + }; +}()); +(function(){ +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +Object.create = Object.create || function(o) { + function F() {} + F.prototype = o; + return new F(); +}; +var cp; +if(typeof exports === 'undefined'){ + cp = {}; + if(typeof window === 'object'){ + window["cp"] = cp; + } +} else { + cp = exports; +} +var assert = function(value, message) +{ + if (!value) { + throw new Error('Assertion failed: ' + message); + } +}; +var assertSoft = function(value, message) +{ + if(!value && console && console.warn) { + console.warn("ASSERTION FAILED: " + message); + if(console.trace) { + console.trace(); + } + } +}; +var mymin = function(a, b) +{ + return a < b ? a : b; +}; +var mymax = function(a, b) +{ + return a > b ? a : b; +}; +var min, max; +if (typeof window === 'object' && window.navigator.userAgent.indexOf('Firefox') > -1){ + min = Math.min; + max = Math.max; +} else { + min = mymin; + max = mymax; +} +/* The hashpair function takes two numbers and returns a hash code for them. + * Required that hashPair(a, b) === hashPair(b, a). + * Chipmunk's hashPair function is defined as: + * #define CP_HASH_COEF (3344921057ul) + * #define CP_HASH_PAIR(A, B) ((cpHashValue)(A)*CP_HASH_COEF ^ (cpHashValue)(B)*CP_HASH_COEF) + * But thats not suitable in javascript because multiplying by a large number will make the number + * a large float. + * + * The result of hashPair is used as the key in objects, so it returns a string. + */ +var hashPair = function(a, b) +{ + return a < b ? a + ' ' + b : b + ' ' + a; +}; +var deleteObjFromList = function(arr, obj) +{ + for(var i=0; i> 1; + for(var i=1; i maxx || (x == maxx && y > maxy)){ + maxx = x; + maxy = y; + end = i; + } + } + return [start, end]; +}; +var SWAP = function(arr, idx1, idx2) +{ + var tmp = arr[idx1*2]; + arr[idx1*2] = arr[idx2*2]; + arr[idx2*2] = tmp; + tmp = arr[idx1*2+1]; + arr[idx1*2+1] = arr[idx2*2+1]; + arr[idx2*2+1] = tmp; +}; +var QHullPartition = function(verts, offs, count, a, b, tol) +{ + if(count === 0) return 0; + var max = 0; + var pivot = offs; + var delta = vsub(b, a); + var valueTol = tol * vlength(delta); + var head = offs; + for(var tail = offs+count-1; head <= tail;){ + var v = new Vect(verts[head * 2], verts[head * 2 + 1]); + var value = vcross(delta, vsub(v, a)); + if(value > valueTol){ + if(value > max){ + max = value; + pivot = head; + } + head++; + } else { + SWAP(verts, head, tail); + tail--; + } + } + if(pivot != offs) SWAP(verts, offs, pivot); + return head - offs; +}; +var QHullReduce = function(tol, verts, offs, count, a, pivot, b, resultPos) +{ + if(count < 0){ + return 0; + } else if(count == 0) { + verts[resultPos*2] = pivot.x; + verts[resultPos*2+1] = pivot.y; + return 1; + } else { + var left_count = QHullPartition(verts, offs, count, a, pivot, tol); + var left = new Vect(verts[offs*2], verts[offs*2+1]); + var index = QHullReduce(tol, verts, offs + 1, left_count - 1, a, left, pivot, resultPos); + var pivotPos = resultPos + index++; + verts[pivotPos*2] = pivot.x; + verts[pivotPos*2+1] = pivot.y; + var right_count = QHullPartition(verts, offs + left_count, count - left_count, pivot, b, tol); + var right = new Vect(verts[(offs+left_count)*2], verts[(offs+left_count)*2+1]); + return index + QHullReduce(tol, verts, offs + left_count + 1, right_count - 1, pivot, right, b, resultPos + index); + } +}; +cp.convexHull = function(verts, result, tolerance) +{ + if(result){ + for (var i = 0; i < verts.length; i++){ + result[i] = verts[i]; + } + } else { + result = verts; + } + var indexes = loopIndexes(verts); + var start = indexes[0], end = indexes[1]; + if(start == end){ + result.length = 2; + return result; + } + SWAP(result, 0, start); + SWAP(result, 1, end == 0 ? start : end); + var a = new Vect(result[0], result[1]); + var b = new Vect(result[2], result[3]); + var count = verts.length >> 1; + var resultCount = QHullReduce(tolerance, result, 2, count - 2, a, b, a, 1) + 1; + result.length = resultCount*2; + assertSoft(polyValidate(result), + "Internal error: cpConvexHull() and cpPolyValidate() did not agree." + + "Please report this error with as much info as you can."); + return result; +}; +var clamp = function(f, minv, maxv) +{ + return min(max(f, minv), maxv); +}; +var clamp01 = function(f) +{ + return max(0, min(f, 1)); +}; +var lerp = function(f1, f2, t) +{ + return f1*(1 - t) + f2*t; +}; +var lerpconst = function(f1, f2, d) +{ + return f1 + clamp(f2 - f1, -d, d); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var Vect = cp.Vect = function(x, y) +{ + this.x = x; + this.y = y; +}; +cp.v = function (x,y) { return new Vect(x, y) }; +var vzero = cp.vzero = new Vect(0,0); +var vdot = cp.v.dot = function(v1, v2) +{ + return v1.x*v2.x + v1.y*v2.y; +}; +var vdot2 = function(x1, y1, x2, y2) +{ + return x1*x2 + y1*y2; +}; +var vlength = cp.v.len = function(v) +{ + return Math.sqrt(vdot(v, v)); +}; +var vlength2 = cp.v.len2 = function(x, y) +{ + return Math.sqrt(x*x + y*y); +}; +var veql = cp.v.eql = function(v1, v2) +{ + return (v1.x === v2.x && v1.y === v2.y); +}; +var vadd = cp.v.add = function(v1, v2) +{ + return new Vect(v1.x + v2.x, v1.y + v2.y); +}; +Vect.prototype.add = function(v2) +{ + this.x += v2.x; + this.y += v2.y; + return this; +}; +var vsub = cp.v.sub = function(v1, v2) +{ + return new Vect(v1.x - v2.x, v1.y - v2.y); +}; +Vect.prototype.sub = function(v2) +{ + this.x -= v2.x; + this.y -= v2.y; + return this; +}; +var vneg = cp.v.neg = function(v) +{ + return new Vect(-v.x, -v.y); +}; +Vect.prototype.neg = function() +{ + this.x = -this.x; + this.y = -this.y; + return this; +}; +var vmult = cp.v.mult = function(v, s) +{ + return new Vect(v.x*s, v.y*s); +}; +Vect.prototype.mult = function(s) +{ + this.x *= s; + this.y *= s; + return this; +}; +var vcross = cp.v.cross = function(v1, v2) +{ + return v1.x*v2.y - v1.y*v2.x; +}; +var vcross2 = function(x1, y1, x2, y2) +{ + return x1*y2 - y1*x2; +}; +var vperp = cp.v.perp = function(v) +{ + return new Vect(-v.y, v.x); +}; +var vpvrperp = cp.v.pvrperp = function(v) +{ + return new Vect(v.y, -v.x); +}; +var vproject = cp.v.project = function(v1, v2) +{ + return vmult(v2, vdot(v1, v2)/vlengthsq(v2)); +}; +Vect.prototype.project = function(v2) +{ + this.mult(vdot(this, v2) / vlengthsq(v2)); + return this; +}; +var vrotate = cp.v.rotate = function(v1, v2) +{ + return new Vect(v1.x*v2.x - v1.y*v2.y, v1.x*v2.y + v1.y*v2.x); +}; +Vect.prototype.rotate = function(v2) +{ + this.x = this.x * v2.x - this.y * v2.y; + this.y = this.x * v2.y + this.y * v2.x; + return this; +}; +var vunrotate = cp.v.unrotate = function(v1, v2) +{ + return new Vect(v1.x*v2.x + v1.y*v2.y, v1.y*v2.x - v1.x*v2.y); +}; +var vlengthsq = cp.v.lengthsq = function(v) +{ + return vdot(v, v); +}; +var vlengthsq2 = cp.v.lengthsq2 = function(x, y) +{ + return x*x + y*y; +}; +var vlerp = cp.v.lerp = function(v1, v2, t) +{ + return vadd(vmult(v1, 1 - t), vmult(v2, t)); +}; +var vnormalize = cp.v.normalize = function(v) +{ + return vmult(v, 1/vlength(v)); +}; +var vnormalize_safe = cp.v.normalize_safe = function(v) +{ + return (v.x === 0 && v.y === 0 ? vzero : vnormalize(v)); +}; +var vclamp = cp.v.clamp = function(v, len) +{ + return (vdot(v,v) > len*len) ? vmult(vnormalize(v), len) : v; +}; +var vlerpconst = cp.v.lerpconst = function(v1, v2, d) +{ + return vadd(v1, vclamp(vsub(v2, v1), d)); +}; +var vdist = cp.v.dist = function(v1, v2) +{ + return vlength(vsub(v1, v2)); +}; +var vdistsq = cp.v.distsq = function(v1, v2) +{ + return vlengthsq(vsub(v1, v2)); +}; +var vnear = cp.v.near = function(v1, v2, dist) +{ + return vdistsq(v1, v2) < dist*dist; +}; +var vslerp = cp.v.slerp = function(v1, v2, t) +{ + var omega = Math.acos(vdot(v1, v2)); + if(omega) { + var denom = 1/Math.sin(omega); + return vadd(vmult(v1, Math.sin((1 - t)*omega)*denom), vmult(v2, Math.sin(t*omega)*denom)); + } else { + return v1; + } +}; +var vslerpconst = cp.v.slerpconst = function(v1, v2, a) +{ + var angle = Math.acos(vdot(v1, v2)); + return vslerp(v1, v2, min(a, angle)/angle); +}; +var vforangle = cp.v.forangle = function(a) +{ + return new Vect(Math.cos(a), Math.sin(a)); +}; +var vtoangle = cp.v.toangle = function(v) +{ + return Math.atan2(v.y, v.x); +}; +var vstr = cp.v.str = function(v) +{ + return "(" + v.x.toFixed(3) + ", " + v.y.toFixed(3) + ")"; +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var numBB = 0; +var BB = cp.BB = function(l, b, r, t) +{ + this.l = l; + this.b = b; + this.r = r; + this.t = t; + numBB++; +}; +cp.bb = function(l, b, r, t) { return new BB(l, b, r, t); }; +var bbNewForCircle = function(p, r) +{ + return new BB( + p.x - r, + p.y - r, + p.x + r, + p.y + r + ); +}; +var bbIntersects = function(a, b) +{ + return (a.l <= b.r && b.l <= a.r && a.b <= b.t && b.b <= a.t); +}; +var bbIntersects2 = function(bb, l, b, r, t) +{ + return (bb.l <= r && l <= bb.r && bb.b <= t && b <= bb.t); +}; +var bbContainsBB = function(bb, other) +{ + return (bb.l <= other.l && bb.r >= other.r && bb.b <= other.b && bb.t >= other.t); +}; +var bbContainsVect = function(bb, v) +{ + return (bb.l <= v.x && bb.r >= v.x && bb.b <= v.y && bb.t >= v.y); +}; +var bbContainsVect2 = function(l, b, r, t, v) +{ + return (l <= v.x && r >= v.x && b <= v.y && t >= v.y); +}; +var bbMerge = function(a, b){ + return new BB( + min(a.l, b.l), + min(a.b, b.b), + max(a.r, b.r), + max(a.t, b.t) + ); +}; +var bbExpand = function(bb, v){ + return new BB( + min(bb.l, v.x), + min(bb.b, v.y), + max(bb.r, v.x), + max(bb.t, v.y) + ); +}; +var bbArea = function(bb) +{ + return (bb.r - bb.l)*(bb.t - bb.b); +}; +var bbMergedArea = function(a, b) +{ + return (max(a.r, b.r) - min(a.l, b.l))*(max(a.t, b.t) - min(a.b, b.b)); +}; +var bbMergedArea2 = function(bb, l, b, r, t) +{ + return (max(bb.r, r) - min(bb.l, l))*(max(bb.t, t) - min(bb.b, b)); +}; +var bbIntersectsSegment = function(bb, a, b) +{ + return (bbSegmentQuery(bb, a, b) != Infinity); +}; +var bbClampVect = function(bb, v) +{ + var x = min(max(bb.l, v.x), bb.r); + var y = min(max(bb.b, v.y), bb.t); + return new Vect(x, y); +}; +var bbWrapVect = function(bb, v) +{ + var ix = Math.abs(bb.r - bb.l); + var modx = (v.x - bb.l) % ix; + var x = (modx > 0) ? modx : modx + ix; + var iy = Math.abs(bb.t - bb.b); + var mody = (v.y - bb.b) % iy; + var y = (mody > 0) ? mody : mody + iy; + return new Vect(x + bb.l, y + bb.b); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/* These are created using literals where needed. +typedef struct cpSegmentQueryInfo { + cpShape *shape; + cpFloat t; + cpVect n; +} cpSegmentQueryInfo; +*/ +var shapeIDCounter = 0; +var CP_NO_GROUP = cp.NO_GROUP = 0; +var CP_ALL_LAYERS = cp.ALL_LAYERS = ~0; +cp.resetShapeIdCounter = function() +{ + shapeIDCounter = 0; +}; +var Shape = cp.Shape = function(body) { + this.body = body; + this.bb_l = this.bb_b = this.bb_r = this.bb_t = 0; + this.hashid = shapeIDCounter++; + this.sensor = false; + this.e = 0; + this.u = 0; + this.surface_v = vzero; + this.collision_type = 0; + this.group = 0; + this.layers = CP_ALL_LAYERS; + this.space = null; + this.isAdded = false; + this.collisionCode = this.collisionCode; +}; +Shape.prototype.setElasticity = function(e) { this.e = e; }; +Shape.prototype.setFriction = function(u) { this.body.activate(); this.u = u; }; +Shape.prototype.setLayers = function(layers) { this.body.activate(); this.layers = layers; }; +Shape.prototype.setSensor = function(sensor) { this.body.activate(); this.sensor = sensor; }; +Shape.prototype.setCollisionType = function(collision_type) { this.body.activate(); this.collision_type = collision_type; }; +Shape.prototype.getBody = function() { return this.body; }; +Shape.prototype.active = function() +{ + return this.body && this.body.shapeList.indexOf(this) !== -1; +}; +Shape.prototype.setBody = function(body) +{ + assert(!this.active(), "You cannot change the body on an active shape. You must remove the shape from the space before changing the body."); + this.body = body; +}; +Shape.prototype.cacheBB = function() +{ + return this.update(this.body.p, this.body.rot); +}; +Shape.prototype.update = function(pos, rot) +{ + assert(!isNaN(rot.x), 'Rotation is NaN'); + assert(!isNaN(pos.x), 'Position is NaN'); + this.cacheData(pos, rot); +}; +Shape.prototype.pointQuery = function(p) +{ + var info = this.nearestPointQuery(p); + if (info.d < 0) return info; +}; +Shape.prototype.getBB = function() +{ + return new BB(this.bb_l, this.bb_b, this.bb_r, this.bb_t); +}; +/* Not implemented - all these getters and setters. Just edit the object directly. +CP_DefineShapeStructGetter(cpBody*, body, Body); +void cpShapeSetBody(cpShape *shape, cpBody *body); +CP_DefineShapeStructGetter(cpBB, bb, BB); +CP_DefineShapeStructProperty(cpBool, sensor, Sensor, cpTrue); +CP_DefineShapeStructProperty(cpFloat, e, Elasticity, cpFalse); +CP_DefineShapeStructProperty(cpFloat, u, Friction, cpTrue); +CP_DefineShapeStructProperty(cpVect, surface_v, SurfaceVelocity, cpTrue); +CP_DefineShapeStructProperty(cpDataPointer, data, UserData, cpFalse); +CP_DefineShapeStructProperty(cpCollisionType, collision_type, CollisionType, cpTrue); +CP_DefineShapeStructProperty(cpGroup, group, Group, cpTrue); +CP_DefineShapeStructProperty(cpLayers, layers, Layers, cpTrue); +*/ +var PointQueryExtendedInfo = function(shape) +{ + this.shape = shape; + this.d = Infinity; + this.n = vzero; +}; +var NearestPointQueryInfo = cp.NearestPointQueryInfo = function(shape, p, d) +{ + this.shape = shape; + this.p = p; + this.d = d; +}; +var SegmentQueryInfo = cp.SegmentQueryInfo = function(shape, t, n) +{ + this.shape = shape; + this.t = t; + this.n = n; +}; +SegmentQueryInfo.prototype.hitPoint = function(start, end) +{ + return vlerp(start, end, this.t); +}; +SegmentQueryInfo.prototype.hitDist = function(start, end) +{ + return vdist(start, end) * this.t; +}; +var CircleShape = cp.CircleShape = function(body, radius, offset) +{ + this.c = this.tc = offset; + this.r = radius; + this.type = 'circle'; + Shape.call(this, body); +}; +CircleShape.prototype = Object.create(Shape.prototype); +CircleShape.prototype.cacheData = function(p, rot) +{ + var c = this.tc = vrotate(this.c, rot).add(p); + var r = this.r; + this.bb_l = c.x - r; + this.bb_b = c.y - r; + this.bb_r = c.x + r; + this.bb_t = c.y + r; +}; +/*CircleShape.prototype.pointQuery = function(p) +{ + var delta = vsub(p, this.tc); + var distsq = vlengthsq(delta); + var r = this.r; + if(distsq < r*r){ + var info = new PointQueryExtendedInfo(this); + var dist = Math.sqrt(distsq); + info.d = r - dist; + info.n = vmult(delta, 1/dist); + return info; + } +};*/ +CircleShape.prototype.nearestPointQuery = function(p) +{ + var deltax = p.x - this.tc.x; + var deltay = p.y - this.tc.y; + var d = vlength2(deltax, deltay); + var r = this.r; + var nearestp = new Vect(this.tc.x + deltax * r/d, this.tc.y + deltay * r/d); + return new NearestPointQueryInfo(this, nearestp, d - r); +}; +var circleSegmentQuery = function(shape, center, r, a, b, info) +{ + a = vsub(a, center); + b = vsub(b, center); + var qa = vdot(a, a) - 2*vdot(a, b) + vdot(b, b); + var qb = -2*vdot(a, a) + 2*vdot(a, b); + var qc = vdot(a, a) - r*r; + var det = qb*qb - 4*qa*qc; + if(det >= 0) + { + var t = (-qb - Math.sqrt(det))/(2*qa); + if(0 <= t && t <= 1){ + return new SegmentQueryInfo(shape, t, vnormalize(vlerp(a, b, t))); + } + } +}; +CircleShape.prototype.segmentQuery = function(a, b) +{ + return circleSegmentQuery(this, this.tc, this.r, a, b); +}; +/* +CircleShape.prototype.setRadius = function(radius) +{ + this.r = radius; +} +CircleShape.prototype.setOffset = function(offset) +{ + this.c = offset; +}*/ +var SegmentShape = cp.SegmentShape = function(body, a, b, r) +{ + this.a = a; + this.b = b; + this.n = vperp(vnormalize(vsub(b, a))); + this.ta = this.tb = this.tn = null; + this.r = r; + this.a_tangent = vzero; + this.b_tangent = vzero; + this.type = 'segment'; + Shape.call(this, body); +}; +SegmentShape.prototype = Object.create(Shape.prototype); +SegmentShape.prototype.cacheData = function(p, rot) +{ + this.ta = vadd(p, vrotate(this.a, rot)); + this.tb = vadd(p, vrotate(this.b, rot)); + this.tn = vrotate(this.n, rot); + var l,r,b,t; + if(this.ta.x < this.tb.x){ + l = this.ta.x; + r = this.tb.x; + } else { + l = this.tb.x; + r = this.ta.x; + } + if(this.ta.y < this.tb.y){ + b = this.ta.y; + t = this.tb.y; + } else { + b = this.tb.y; + t = this.ta.y; + } + var rad = this.r; + this.bb_l = l - rad; + this.bb_b = b - rad; + this.bb_r = r + rad; + this.bb_t = t + rad; +}; +SegmentShape.prototype.nearestPointQuery = function(p) +{ + var closest = closestPointOnSegment(p, this.ta, this.tb); + var deltax = p.x - closest.x; + var deltay = p.y - closest.y; + var d = vlength2(deltax, deltay); + var r = this.r; + var nearestp = (d ? vadd(closest, vmult(new Vect(deltax, deltay), r/d)) : closest); + return new NearestPointQueryInfo(this, nearestp, d - r); +}; +SegmentShape.prototype.segmentQuery = function(a, b) +{ + var n = this.tn; + var d = vdot(vsub(this.ta, a), n); + var r = this.r; + var flipped_n = (d > 0 ? vneg(n) : n); + var n_offset = vsub(vmult(flipped_n, r), a); + var seg_a = vadd(this.ta, n_offset); + var seg_b = vadd(this.tb, n_offset); + var delta = vsub(b, a); + if(vcross(delta, seg_a)*vcross(delta, seg_b) <= 0){ + var d_offset = d + (d > 0 ? -r : r); + var ad = -d_offset; + var bd = vdot(delta, n) - d_offset; + if(ad*bd < 0){ + return new SegmentQueryInfo(this, ad/(ad - bd), flipped_n); + } + } else if(r !== 0){ + var info1 = circleSegmentQuery(this, this.ta, this.r, a, b); + var info2 = circleSegmentQuery(this, this.tb, this.r, a, b); + if (info1){ + return info2 && info2.t < info1.t ? info2 : info1; + } else { + return info2; + } + } +}; +SegmentShape.prototype.setNeighbors = function(prev, next) +{ + this.a_tangent = vsub(prev, this.a); + this.b_tangent = vsub(next, this.b); +}; +SegmentShape.prototype.setEndpoints = function(a, b) +{ + this.a = a; + this.b = b; + this.n = vperp(vnormalize(vsub(b, a))); +}; +/* +cpSegmentShapeSetRadius(cpShape *shape, cpFloat radius) +{ + this.r = radius; +}*/ +/* +CP_DeclareShapeGetter(cpSegmentShape, cpVect, A); +CP_DeclareShapeGetter(cpSegmentShape, cpVect, B); +CP_DeclareShapeGetter(cpSegmentShape, cpVect, Normal); +CP_DeclareShapeGetter(cpSegmentShape, cpFloat, Radius); +*/ +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var polyValidate = cr.polyValidate = function(verts) +{ + var len = verts.length; + for(var i=0; i 0){ + return false; + } + } + return true; +}; +var PolyShape = cp.PolyShape = function(body, verts, offset) +{ + this.setVerts(verts, offset); + this.type = 'poly'; + Shape.call(this, body); +}; +PolyShape.prototype = Object.create(Shape.prototype); +var SplittingPlane = function(n, d) +{ + this.n = n; + this.d = d; +}; +SplittingPlane.prototype.compare = function(v) +{ + return vdot(this.n, v) - this.d; +}; +PolyShape.prototype.setVerts = function(verts, offset) +{ + assert(verts.length >= 4, "Polygons require some verts"); + assert(typeof(verts[0]) === 'number', + 'Polygon verticies should be specified in a flattened list (eg [x1,y1,x2,y2,x3,y3,...])'); + assert(polyValidate(verts), "Polygon is concave or has a reversed winding. Consider using cpConvexHull()"); + var len = verts.length; + var numVerts = len >> 1; + this.verts = new Array(len); + this.tVerts = new Array(len); + this.planes = new Array(numVerts); + this.tPlanes = new Array(numVerts); + for(var i=0; i>1] = new SplittingPlane(n, vdot2(n.x, n.y, ax, ay)); + this.tPlanes[i>>1] = new SplittingPlane(new Vect(0,0), 0); + } +}; +var BoxShape = cp.BoxShape = function(body, width, height) +{ + var hw = width/2; + var hh = height/2; + return BoxShape2(body, new BB(-hw, -hh, hw, hh)); +}; +var BoxShape2 = cp.BoxShape2 = function(body, box) +{ + var verts = [ + box.l, box.b, + box.l, box.t, + box.r, box.t, + box.r, box.b, + ]; + return new PolyShape(body, verts, vzero); +}; +PolyShape.prototype.transformVerts = function(p, rot) +{ + var src = this.verts; + var dst = this.tVerts; + var l = Infinity, r = -Infinity; + var b = Infinity, t = -Infinity; + for(var i=0; i 0) outside = true; + var v1x = verts[i*2]; + var v1y = verts[i*2 + 1]; + var closest = closestPointOnSegment2(p.x, p.y, v0x, v0y, v1x, v1y); + var dist = vdist(p, closest); + if(dist < minDist){ + minDist = dist; + closestPoint = closest; + } + v0x = v1x; + v0y = v1y; + } + return new NearestPointQueryInfo(this, closestPoint, (outside ? minDist : -minDist)); +}; +PolyShape.prototype.segmentQuery = function(a, b) +{ + var axes = this.tPlanes; + var verts = this.tVerts; + var numVerts = axes.length; + var len = numVerts * 2; + for(var i=0; i an) continue; + var bn = vdot(b, n); + var t = (axes[i].d - an)/(bn - an); + if(t < 0 || 1 < t) continue; + var point = vlerp(a, b, t); + var dt = -vcross(n, point); + var dtMin = -vcross2(n.x, n.y, verts[i*2], verts[i*2+1]); + var dtMax = -vcross2(n.x, n.y, verts[(i*2+2)%len], verts[(i*2+3)%len]); + if(dtMin <= dt && dt <= dtMax){ + return new SegmentQueryInfo(this, t, n); + } + } +}; +PolyShape.prototype.valueOnAxis = function(n, d) +{ + var verts = this.tVerts; + var m = vdot2(n.x, n.y, verts[0], verts[1]); + for(var i=2; i 0) return false; + } + return true; +}; +PolyShape.prototype.containsVertPartial = function(vx, vy, n) +{ + var planes = this.tPlanes; + for(var i=0; i 0) return false; + } + return true; +}; +PolyShape.prototype.getNumVerts = function() { return this.verts.length / 2; }; +PolyShape.prototype.getVert = function(i) +{ + return new Vect(this.verts[i * 2], this.verts[i * 2 + 1]); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var Body = cp.Body = function(m, i) { + this.p = new Vect(0,0); + this.vx = this.vy = 0; + this.f = new Vect(0,0); + this.w = 0; + this.t = 0; + this.v_limit = Infinity; + this.w_limit = Infinity; + this.v_biasx = this.v_biasy = 0; + this.w_bias = 0; + this.space = null; + this.isAdded = false; + this.shapeList = []; + this.arbiterList = null; // These are both wacky linked lists. + this.constraintList = null; + this.nodeRoot = null; + this.nodeNext = null; + this.nodeIdleTime = 0; + this.setMass(m); + this.setMoment(i); + this.rot = new Vect(0,0); + this.setAngle(0); +}; +var createStaticBody = function() +{ + var body = new Body(Infinity, Infinity); + body.nodeIdleTime = Infinity; + return body; +}; +if (typeof DEBUG !== 'undefined' && DEBUG) { + var v_assert_nan = function(v, message){assert(v.x == v.x && v.y == v.y, message); }; + var v_assert_infinite = function(v, message){assert(Math.abs(v.x) !== Infinity && Math.abs(v.y) !== Infinity, message);}; + var v_assert_sane = function(v, message){v_assert_nan(v, message); v_assert_infinite(v, message);}; + Body.prototype.sanityCheck = function() + { + assert(this.m === this.m && this.m_inv === this.m_inv, "Body's mass is invalid."); + assert(this.i === this.i && this.i_inv === this.i_inv, "Body's moment is invalid."); + v_assert_sane(this.p, "Body's position is invalid."); + v_assert_sane(this.f, "Body's force is invalid."); + assert(this.vx === this.vx && Math.abs(this.vx) !== Infinity, "Body's velocity is invalid."); + assert(this.vy === this.vy && Math.abs(this.vy) !== Infinity, "Body's velocity is invalid."); + assert(this.a === this.a && Math.abs(this.a) !== Infinity, "Body's angle is invalid."); + assert(this.w === this.w && Math.abs(this.w) !== Infinity, "Body's angular velocity is invalid."); + assert(this.t === this.t && Math.abs(this.t) !== Infinity, "Body's torque is invalid."); + v_assert_sane(this.rot, "Body's rotation vector is invalid."); + assert(this.v_limit === this.v_limit, "Body's velocity limit is invalid."); + assert(this.w_limit === this.w_limit, "Body's angular velocity limit is invalid."); + }; +} else { + Body.prototype.sanityCheck = function(){}; +} +Body.prototype.getPos = function() { return this.p; }; +Body.prototype.getAngle=function(){return cp.v.toangle(this.rot)}, +Body.prototype.getVel = function() { return new Vect(this.vx, this.vy); }; +Body.prototype.getAngVel = function() { return this.w; }; +Body.prototype.isSleeping = function() +{ + return this.nodeRoot !== null; +}; +Body.prototype.isStatic = function() +{ + return this.nodeIdleTime === Infinity; +}; +Body.prototype.isRogue = function() +{ + return this.space === null; +}; +Body.prototype.setMass = function(mass) +{ + assert(mass > 0, "Mass must be positive and non-zero."); + this.activate(); + this.m = mass; + this.m_inv = 1/mass; +}; +Body.prototype.setMoment = function(moment) +{ + assert(moment > 0, "Moment of Inertia must be positive and non-zero."); + this.activate(); + this.i = moment; + this.i_inv = 1/moment; +}; +Body.prototype.addShape = function(shape) +{ + this.shapeList.push(shape); +}; +Body.prototype.removeShape = function(shape) +{ + deleteObjFromList(this.shapeList, shape); +}; +var filterConstraints = function(node, body, filter) +{ + if(node === filter){ + return node.next(body); + } else if(node.a === body){ + node.next_a = filterConstraints(node.next_a, body, filter); + } else { + node.next_b = filterConstraints(node.next_b, body, filter); + } + return node; +}; +Body.prototype.removeConstraint = function(constraint) +{ + this.constraintList = filterConstraints(this.constraintList, this, constraint); +}; +Body.prototype.setPos = function(pos) +{ + this.activate(); + this.sanityCheck(); + if (pos === vzero) { + pos = cp.v(0,0); + } + this.p = pos; +}; +Body.prototype.setVel = function(velocity) +{ + this.activate(); + this.vx = velocity.x; + this.vy = velocity.y; +}; +Body.prototype.setAngVel = function(w) +{ + this.activate(); + this.w = w; +}; +Body.prototype.setAngleInternal = function(angle) +{ + assert(!isNaN(angle), "Internal Error: Attempting to set body's angle to NaN"); + this.a = angle;//fmod(a, (cpFloat)M_PI*2.0f); + this.rot.x = Math.cos(angle); + this.rot.y = Math.sin(angle); +}; +Body.prototype.setAngle = function(angle) +{ + this.activate(); + this.sanityCheck(); + this.setAngleInternal(angle); +}; +Body.prototype.velocity_func = function(gravity, damping, dt) +{ + var vx = this.vx * damping + (gravity.x + this.f.x * this.m_inv) * dt; + var vy = this.vy * damping + (gravity.y + this.f.y * this.m_inv) * dt; + var v_limit = this.v_limit; + var lensq = vx * vx + vy * vy; + var scale = (lensq > v_limit*v_limit) ? v_limit / Math.sqrt(lensq) : 1; + this.vx = vx * scale; + this.vy = vy * scale; + var w_limit = this.w_limit; + this.w = clamp(this.w*damping + this.t*this.i_inv*dt, -w_limit, w_limit); + this.sanityCheck(); +}; +Body.prototype.position_func = function(dt) +{ + this.p.x += (this.vx + this.v_biasx) * dt; + this.p.y += (this.vy + this.v_biasy) * dt; + this.setAngleInternal(this.a + (this.w + this.w_bias)*dt); + this.v_biasx = this.v_biasy = 0; + this.w_bias = 0; + this.sanityCheck(); +}; +Body.prototype.resetForces = function() +{ + this.activate(); + this.f = new Vect(0,0); + this.t = 0; +}; +Body.prototype.applyForce = function(force, r) +{ + this.activate(); + this.f = vadd(this.f, force); + this.t += vcross(r, force); +}; +Body.prototype.applyImpulse = function(j, r) +{ + this.activate(); + apply_impulse(this, j.x, j.y, r); +}; +Body.prototype.getVelAtPoint = function(r) +{ + return vadd(new Vect(this.vx, this.vy), vmult(vperp(r), this.w)); +}; +Body.prototype.getVelAtWorldPoint = function(point) +{ + return this.getVelAtPoint(vsub(point, this.p)); +}; +Body.prototype.getVelAtLocalPoint = function(point) +{ + return this.getVelAtPoint(vrotate(point, this.rot)); +}; +Body.prototype.eachShape = function(func) +{ + for(var i = 0, len = this.shapeList.length; i < len; i++) { + func(this.shapeList[i]); + } +}; +Body.prototype.eachConstraint = function(func) +{ + var constraint = this.constraintList; + while(constraint) { + var next = constraint.next(this); + func(constraint); + constraint = next; + } +}; +Body.prototype.eachArbiter = function(func) +{ + var arb = this.arbiterList; + while(arb){ + var next = arb.next(this); + arb.swappedColl = (this === arb.body_b); + func.call(this, arb); + arb = next; + } +}; +Body.prototype.local2World = function(v) +{ + return vadd(this.p, vrotate(v, this.rot)); +}; +Body.prototype.world2Local = function(v) +{ + return vunrotate(vsub(v, this.p), this.rot); +}; +Body.prototype.kineticEnergy = function() +{ + var vsq = this.vx*this.vx + this.vy*this.vy; + var wsq = this.w * this.w; + return (vsq ? vsq*this.m : 0) + (wsq ? wsq*this.i : 0); +}; +/* Copyright (c) 2010 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +/** + @defgroup cpSpatialIndex cpSpatialIndex + Spatial indexes are data structures that are used to accelerate collision detection + and spatial queries. Chipmunk provides a number of spatial index algorithms to pick from + and they are programmed in a generic way so that you can use them for holding more than + just Shapes. + It works by using pointers to the objects you add and using a callback to ask your code + for bounding boxes when it needs them. Several types of queries can be performed an index as well + as reindexing and full collision information. All communication to the spatial indexes is performed + through callback functions. + Spatial indexes should be treated as opaque structs. + This means you shouldn't be reading any of the fields directly. + All spatial indexes define the following methods: + count = 0; + each(func); + contains(obj, hashid); + insert(obj, hashid); + remove(obj, hashid); + reindex(); + reindexObject(obj, hashid); + pointQuery(point, func); + segmentQuery(vect a, vect b, t_exit, func); + query(bb, func); + reindexQuery(func); +*/ +var SpatialIndex = cp.SpatialIndex = function(staticIndex) +{ + this.staticIndex = staticIndex; + if(staticIndex){ + if(staticIndex.dynamicIndex){ + throw new Error("This static index is already associated with a dynamic index."); + } + staticIndex.dynamicIndex = this; + } +}; +SpatialIndex.prototype.collideStatic = function(staticIndex, func) +{ + if(staticIndex.count > 0){ + var query = staticIndex.query; + this.each(function(obj) { + query(obj, new BB(obj.bb_l, obj.bb_b, obj.bb_r, obj.bb_t), func); + }); + } +}; +/* Copyright (c) 2009 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var BBTree = cp.BBTree = function(staticIndex) +{ + SpatialIndex.call(this, staticIndex); + this.velocityFunc = null; + this.leaves = {}; + this.count = 0; + this.root = null; + this.pooledNodes = null; + this.pooledPairs = null; + this.stamp = 0; +}; +BBTree.prototype = Object.create(SpatialIndex.prototype); +var numNodes = 0; +var Node = function(tree, a, b) +{ + this.obj = null; + this.bb_l = min(a.bb_l, b.bb_l); + this.bb_b = min(a.bb_b, b.bb_b); + this.bb_r = max(a.bb_r, b.bb_r); + this.bb_t = max(a.bb_t, b.bb_t); + this.parent = null; + this.setA(a); + this.setB(b); +}; +BBTree.prototype.makeNode = function(a, b) +{ + var node = this.pooledNodes; + if(node){ + this.pooledNodes = node.parent; + node.constructor(this, a, b); + return node; + } else { + numNodes++; + return new Node(this, a, b); + } +}; +var numLeaves = 0; +var Leaf = function(tree, obj) +{ + this.obj = obj; + tree.getBB(obj, this); + this.parent = null; + this.stamp = 1; + this.pairs = null; + numLeaves++; +}; +BBTree.prototype.getBB = function(obj, dest) +{ + var velocityFunc = this.velocityFunc; + if(velocityFunc){ + var coef = 0.1; + var x = (obj.bb_r - obj.bb_l)*coef; + var y = (obj.bb_t - obj.bb_b)*coef; + var v = vmult(velocityFunc(obj), 0.1); + dest.bb_l = obj.bb_l + min(-x, v.x); + dest.bb_b = obj.bb_b + min(-y, v.y); + dest.bb_r = obj.bb_r + max( x, v.x); + dest.bb_t = obj.bb_t + max( y, v.y); + } else { + dest.bb_l = obj.bb_l; + dest.bb_b = obj.bb_b; + dest.bb_r = obj.bb_r; + dest.bb_t = obj.bb_t; + } +}; +BBTree.prototype.getStamp = function() +{ + var dynamic = this.dynamicIndex; + return (dynamic && dynamic.stamp ? dynamic.stamp : this.stamp); +}; +BBTree.prototype.incrementStamp = function() +{ + if(this.dynamicIndex && this.dynamicIndex.stamp){ + this.dynamicIndex.stamp++; + } else { + this.stamp++; + } +} +var numPairs = 0; +var Pair = function(leafA, nextA, leafB, nextB) +{ + this.prevA = null; + this.leafA = leafA; + this.nextA = nextA; + this.prevB = null; + this.leafB = leafB; + this.nextB = nextB; +}; +BBTree.prototype.makePair = function(leafA, nextA, leafB, nextB) +{ + var pair = this.pooledPairs; + if (pair) + { + this.pooledPairs = pair.prevA; + pair.prevA = null; + pair.leafA = leafA; + pair.nextA = nextA; + pair.prevB = null; + pair.leafB = leafB; + pair.nextB = nextB; + return pair; + } else { + numPairs++; + return new Pair(leafA, nextA, leafB, nextB); + } +}; +Pair.prototype.recycle = function(tree) +{ + this.prevA = tree.pooledPairs; + tree.pooledPairs = this; +}; +var unlinkThread = function(prev, leaf, next) +{ + if(next){ + if(next.leafA === leaf) next.prevA = prev; else next.prevB = prev; + } + if(prev){ + if(prev.leafA === leaf) prev.nextA = next; else prev.nextB = next; + } else { + leaf.pairs = next; + } +}; +Leaf.prototype.clearPairs = function(tree) +{ + var pair = this.pairs, + next; + this.pairs = null; + while(pair){ + if(pair.leafA === this){ + next = pair.nextA; + unlinkThread(pair.prevB, pair.leafB, pair.nextB); + } else { + next = pair.nextB; + unlinkThread(pair.prevA, pair.leafA, pair.nextA); + } + pair.recycle(tree); + pair = next; + } +}; +var pairInsert = function(a, b, tree) +{ + var nextA = a.pairs, nextB = b.pairs; + var pair = tree.makePair(a, nextA, b, nextB); + a.pairs = b.pairs = pair; + if(nextA){ + if(nextA.leafA === a) nextA.prevA = pair; else nextA.prevB = pair; + } + if(nextB){ + if(nextB.leafA === b) nextB.prevA = pair; else nextB.prevB = pair; + } +}; +Node.prototype.recycle = function(tree) +{ + this.parent = tree.pooledNodes; + tree.pooledNodes = this; +}; +Leaf.prototype.recycle = function(tree) +{ +}; +Node.prototype.setA = function(value) +{ + this.A = value; + value.parent = this; +}; +Node.prototype.setB = function(value) +{ + this.B = value; + value.parent = this; +}; +Leaf.prototype.isLeaf = true; +Node.prototype.isLeaf = false; +Node.prototype.otherChild = function(child) +{ + return (this.A == child ? this.B : this.A); +}; +Node.prototype.replaceChild = function(child, value, tree) +{ + assertSoft(child == this.A || child == this.B, "Node is not a child of parent."); + if(this.A == child){ + this.A.recycle(tree); + this.setA(value); + } else { + this.B.recycle(tree); + this.setB(value); + } + for(var node=this; node; node = node.parent){ + var a = node.A; + var b = node.B; + node.bb_l = min(a.bb_l, b.bb_l); + node.bb_b = min(a.bb_b, b.bb_b); + node.bb_r = max(a.bb_r, b.bb_r); + node.bb_t = max(a.bb_t, b.bb_t); + } +}; +Node.prototype.bbArea = Leaf.prototype.bbArea = function() +{ + return (this.bb_r - this.bb_l)*(this.bb_t - this.bb_b); +}; +var bbTreeMergedArea = function(a, b) +{ + return (max(a.bb_r, b.bb_r) - min(a.bb_l, b.bb_l))*(max(a.bb_t, b.bb_t) - min(a.bb_b, b.bb_b)); +}; +var bbProximity = function(a, b) +{ + return Math.abs(a.bb_l + a.bb_r - b.bb_l - b.bb_r) + Math.abs(a.bb_b + a.bb_t - b.bb_b - b.bb_t); +}; +var subtreeInsert = function(subtree, leaf, tree) +{ + if(subtree == null){ + return leaf; + } else if(subtree.isLeaf){ + return tree.makeNode(leaf, subtree); + } else { + var cost_a = subtree.B.bbArea() + bbTreeMergedArea(subtree.A, leaf); + var cost_b = subtree.A.bbArea() + bbTreeMergedArea(subtree.B, leaf); + if(cost_a === cost_b){ + cost_a = bbProximity(subtree.A, leaf); + cost_b = bbProximity(subtree.B, leaf); + } + if(cost_b < cost_a){ + subtree.setB(subtreeInsert(subtree.B, leaf, tree)); + } else { + subtree.setA(subtreeInsert(subtree.A, leaf, tree)); + } + subtree.bb_l = min(subtree.bb_l, leaf.bb_l); + subtree.bb_b = min(subtree.bb_b, leaf.bb_b); + subtree.bb_r = max(subtree.bb_r, leaf.bb_r); + subtree.bb_t = max(subtree.bb_t, leaf.bb_t); + return subtree; + } +}; +Node.prototype.intersectsBB = Leaf.prototype.intersectsBB = function(bb) +{ + return (this.bb_l <= bb.r && bb.l <= this.bb_r && this.bb_b <= bb.t && bb.b <= this.bb_t); +}; +var subtreeQuery = function(subtree, bb, func) +{ + if(subtree.intersectsBB(bb)){ + if(subtree.isLeaf){ + func(subtree.obj); + } else { + subtreeQuery(subtree.A, bb, func); + subtreeQuery(subtree.B, bb, func); + } + } +}; +var nodeSegmentQuery = function(node, a, b) +{ + var idx = 1/(b.x - a.x); + var tx1 = (/*node.bb_l == a.x ? -Infinity :*/ (node.bb_l - a.x)*idx); + var tx2 = (/*node.bb_r == a.x ? Infinity :*/ (node.bb_r - a.x)*idx); + var txmin = min(tx1, tx2); + var txmax = max(tx1, tx2); + var idy = 1/(b.y - a.y); + var ty1 = (/*node.bb_b == a.y ? -Infinity :*/ (node.bb_b - a.y)*idy); + var ty2 = (/*node.bb_t == a.y ? Infinity :*/ (node.bb_t - a.y)*idy); + var tymin = min(ty1, ty2); + var tymax = max(ty1, ty2); + if(tymin <= txmax && txmin <= tymax){ + var min_ = max(txmin, tymin); + var max_ = min(txmax, tymax); + if(0.0 <= max_ && min_ <= 1.0) return max(min_, 0.0); + } + return Infinity; +}; +var subtreeSegmentQuery = function(subtree, a, b, t_exit, func) +{ + if(subtree.isLeaf){ + return func(subtree.obj); + } else { + var t_a = nodeSegmentQuery(subtree.A, a, b); + var t_b = nodeSegmentQuery(subtree.B, a, b); + if(t_a < t_b){ + if(t_a < t_exit) t_exit = min(t_exit, subtreeSegmentQuery(subtree.A, a, b, t_exit, func)); + if(t_b < t_exit) t_exit = min(t_exit, subtreeSegmentQuery(subtree.B, a, b, t_exit, func)); + } else { + if(t_b < t_exit) t_exit = min(t_exit, subtreeSegmentQuery(subtree.B, a, b, t_exit, func)); + if(t_a < t_exit) t_exit = min(t_exit, subtreeSegmentQuery(subtree.A, a, b, t_exit, func)); + } + return t_exit; + } +}; +BBTree.prototype.subtreeRecycle = function(node) +{ + if(node.isLeaf){ + this.subtreeRecycle(node.A); + this.subtreeRecycle(node.B); + node.recycle(this); + } +}; +var subtreeRemove = function(subtree, leaf, tree) +{ + if(leaf == subtree){ + return null; + } else { + var parent = leaf.parent; + if(parent == subtree){ + var other = subtree.otherChild(leaf); + other.parent = subtree.parent; + subtree.recycle(tree); + return other; + } else { + parent.parent.replaceChild(parent, parent.otherChild(leaf), tree); + return subtree; + } + } +}; +/* +typedef struct MarkContext { + bbTree *tree; + Node *staticRoot; + cpSpatialIndexQueryFunc func; +} MarkContext; +*/ +var bbTreeIntersectsNode = function(a, b) +{ + return (a.bb_l <= b.bb_r && b.bb_l <= a.bb_r && a.bb_b <= b.bb_t && b.bb_b <= a.bb_t); +}; +Leaf.prototype.markLeafQuery = function(leaf, left, tree, func) +{ + if(bbTreeIntersectsNode(leaf, this)){ + if(left){ + pairInsert(leaf, this, tree); + } else { + if(this.stamp < leaf.stamp) pairInsert(this, leaf, tree); + if(func) func(leaf.obj, this.obj); + } + } +}; +Node.prototype.markLeafQuery = function(leaf, left, tree, func) +{ + if(bbTreeIntersectsNode(leaf, this)){ + this.A.markLeafQuery(leaf, left, tree, func); + this.B.markLeafQuery(leaf, left, tree, func); + } +}; +Leaf.prototype.markSubtree = function(tree, staticRoot, func) +{ + if(this.stamp == tree.getStamp()){ + if(staticRoot) staticRoot.markLeafQuery(this, false, tree, func); + for(var node = this; node.parent; node = node.parent){ + if(node == node.parent.A){ + node.parent.B.markLeafQuery(this, true, tree, func); + } else { + node.parent.A.markLeafQuery(this, false, tree, func); + } + } + } else { + var pair = this.pairs; + while(pair){ + if(this === pair.leafB){ + if(func) func(pair.leafA.obj, this.obj); + pair = pair.nextB; + } else { + pair = pair.nextA; + } + } + } +}; +Node.prototype.markSubtree = function(tree, staticRoot, func) +{ + this.A.markSubtree(tree, staticRoot, func); + this.B.markSubtree(tree, staticRoot, func); +}; +Leaf.prototype.containsObj = function(obj) +{ + return (this.bb_l <= obj.bb_l && this.bb_r >= obj.bb_r && this.bb_b <= obj.bb_b && this.bb_t >= obj.bb_t); +}; +Leaf.prototype.update = function(tree) +{ + var root = tree.root; + var obj = this.obj; + if(!this.containsObj(obj)){ + tree.getBB(this.obj, this); + root = subtreeRemove(root, this, tree); + tree.root = subtreeInsert(root, this, tree); + this.clearPairs(tree); + this.stamp = tree.getStamp(); + return true; + } + return false; +}; +Leaf.prototype.addPairs = function(tree) +{ + var dynamicIndex = tree.dynamicIndex; + if(dynamicIndex){ + var dynamicRoot = dynamicIndex.root; + if(dynamicRoot){ + dynamicRoot.markLeafQuery(this, true, dynamicIndex, null); + } + } else { + var staticRoot = tree.staticIndex.root; + this.markSubtree(tree, staticRoot, null); + } +}; +BBTree.prototype.insert = function(obj, hashid) +{ + var leaf = new Leaf(this, obj); + this.leaves[hashid] = leaf; + this.root = subtreeInsert(this.root, leaf, this); + this.count++; + leaf.stamp = this.getStamp(); + leaf.addPairs(this); + this.incrementStamp(); +}; +BBTree.prototype.remove = function(obj, hashid) +{ + var leaf = this.leaves[hashid]; + delete this.leaves[hashid]; + this.root = subtreeRemove(this.root, leaf, this); + this.count--; + leaf.clearPairs(this); + leaf.recycle(this); +}; +BBTree.prototype.contains = function(obj, hashid) +{ + return this.leaves[hashid] != null; +}; +var voidQueryFunc = function(obj1, obj2){}; +BBTree.prototype.reindexQuery = function(func) +{ + if(/*!this ||*/ !this.root) return; + var hashid, + leaves = this.leaves; + for (hashid in leaves) + { + leaves[hashid].update(this); + } + var staticIndex = this.staticIndex; + var staticRoot = staticIndex && staticIndex.root; + this.root.markSubtree(this, staticRoot, func); + if(staticIndex && !staticRoot) this.collideStatic(this, staticIndex, func); + this.incrementStamp(); +}; +BBTree.prototype.reindex = function() +{ + this.reindexQuery(voidQueryFunc); +}; +BBTree.prototype.reindexObject = function(obj, hashid) +{ + var leaf = this.leaves[hashid]; + if(leaf){ + if(leaf.update(this)) leaf.addPairs(this); + this.incrementStamp(); + } +}; +BBTree.prototype.pointQuery = function(point, func) +{ + this.query(new BB(point.x, point.y, point.x, point.y), func); +}; +BBTree.prototype.segmentQuery = function(a, b, t_exit, func) +{ + if(this.root) subtreeSegmentQuery(this.root, a, b, t_exit, func); +}; +BBTree.prototype.query = function(bb, func) +{ + if(this && this.root && this instanceof cp.BBTree) subtreeQuery(this.root, bb, func); +}; +BBTree.prototype.count = function() +{ + return this.count; +}; +BBTree.prototype.each = function(func) +{ + var hashid; + for(hashid in this.leaves) + { + func(this.leaves[hashid].obj); + } +}; +var bbTreeMergedArea2 = function(node, l, b, r, t) +{ + return (max(node.bb_r, r) - min(node.bb_l, l))*(max(node.bb_t, t) - min(node.bb_b, b)); +}; +var partitionNodes = function(tree, nodes, offset, count) +{ + if(count == 1){ + return nodes[offset]; + } else if(count == 2) { + return tree.makeNode(nodes[offset], nodes[offset + 1]); + } + var node = nodes[offset]; + var bb_l = node.bb_l, + bb_b = node.bb_b, + bb_r = node.bb_r, + bb_t = node.bb_t; + var end = offset + count; + for(var i=offset + 1; i bb_t - bb_b); + var bounds = new Array(count*2); + if(splitWidth){ + for(var i=offset; i= mindist*mindist) return; + var dist = Math.sqrt(distsq); + return new Contact( + vadd(p1, vmult(delta, 0.5 + (r1 - 0.5*mindist)/(dist ? dist : Infinity))), + (dist ? vmult(delta, 1/dist) : new Vect(1, 0)), + dist - mindist, + 0 + ); +}; +var circle2circle = function(circ1, circ2) +{ + var contact = circle2circleQuery(circ1.tc, circ2.tc, circ1.r, circ2.r); + return contact ? [contact] : NONE; +}; +var circle2segment = function(circleShape, segmentShape) +{ + var seg_a = segmentShape.ta; + var seg_b = segmentShape.tb; + var center = circleShape.tc; + var seg_delta = vsub(seg_b, seg_a); + var closest_t = clamp01(vdot(seg_delta, vsub(center, seg_a))/vlengthsq(seg_delta)); + var closest = vadd(seg_a, vmult(seg_delta, closest_t)); + var contact = circle2circleQuery(center, closest, circleShape.r, segmentShape.r); + if(contact){ + var n = contact.n; + return ( + (closest_t === 0 && vdot(n, segmentShape.a_tangent) < 0) || + (closest_t === 1 && vdot(n, segmentShape.b_tangent) < 0) + ) ? NONE : [contact]; + } else { + return NONE; + } +} +var last_MSA_min = 0; +var findMSA = function(poly, planes) +{ + var min_index = 0; + var min = poly.valueOnAxis(planes[0].n, planes[0].d); + if(min > 0) return -1; + for(var i=1; i 0) { + return -1; + } else if(dist > min){ + min = dist; + min_index = i; + } + } + last_MSA_min = min; + return min_index; +}; +var findVertsFallback = function(poly1, poly2, n, dist) +{ + var arr = []; + var verts1 = poly1.tVerts; + for(var i=0; i>1))); + } + } + var verts2 = poly2.tVerts; + for(var i=0; i>1))); + } + } + return (arr.length ? arr : findVertsFallback(poly1, poly2, n, dist)); +}; +var poly2poly = function(poly1, poly2) +{ + var mini1 = findMSA(poly2, poly1.tPlanes); + if(mini1 == -1) return NONE; + var min1 = last_MSA_min; + var mini2 = findMSA(poly1, poly2.tPlanes); + if(mini2 == -1) return NONE; + var min2 = last_MSA_min; + if(min1 > min2) + return findVerts(poly1, poly2, poly1.tPlanes[mini1].n, min1); + else + return findVerts(poly1, poly2, vneg(poly2.tPlanes[mini2].n), min2); +}; +var segValueOnAxis = function(seg, n, d) +{ + var a = vdot(n, seg.ta) - seg.r; + var b = vdot(n, seg.tb) - seg.r; + return min(a, b) - d; +}; +var findPointsBehindSeg = function(arr, seg, poly, pDist, coef) +{ + var dta = vcross(seg.tn, seg.ta); + var dtb = vcross(seg.tn, seg.tb); + var n = vmult(seg.tn, coef); + var verts = poly.tVerts; + for(var i=0; i= dt && dt >= dtb){ + arr.push(new Contact(new Vect(vx, vy), n, pDist, hashPair(poly.hashid, i))); + } + } + } +}; +var seg2poly = function(seg, poly) +{ + var arr = []; + var planes = poly.tPlanes; + var numVerts = planes.length; + var segD = vdot(seg.tn, seg.ta); + var minNorm = poly.valueOnAxis(seg.tn, segD) - seg.r; + var minNeg = poly.valueOnAxis(vneg(seg.tn), -segD) - seg.r; + if(minNeg > 0 || minNorm > 0) return NONE; + var mini = 0; + var poly_min = segValueOnAxis(seg, planes[0].n, planes[0].d); + if(poly_min > 0) return NONE; + for(var i=0; i 0){ + return NONE; + } else if(dist > poly_min){ + poly_min = dist; + mini = i; + } + } + var poly_n = vneg(planes[mini].n); + var va = vadd(seg.ta, vmult(poly_n, seg.r)); + var vb = vadd(seg.tb, vmult(poly_n, seg.r)); + if(poly.containsVert(va.x, va.y)) + arr.push(new Contact(va, poly_n, poly_min, hashPair(seg.hashid, 0))); + if(poly.containsVert(vb.x, vb.y)) + arr.push(new Contact(vb, poly_n, poly_min, hashPair(seg.hashid, 1))); + if(minNorm >= poly_min || minNeg >= poly_min) { + if(minNorm > minNeg) + findPointsBehindSeg(arr, seg, poly, minNorm, 1); + else + findPointsBehindSeg(arr, seg, poly, minNeg, -1); + } + if(arr.length === 0){ + var mini2 = mini * 2; + var verts = poly.tVerts; + var poly_a = new Vect(verts[mini2], verts[mini2+1]); + var con; + if((con = circle2circleQuery(seg.ta, poly_a, seg.r, 0, arr))) return [con]; + if((con = circle2circleQuery(seg.tb, poly_a, seg.r, 0, arr))) return [con]; + var len = numVerts * 2; + var poly_b = new Vect(verts[(mini2+2)%len], verts[(mini2+3)%len]); + if((con = circle2circleQuery(seg.ta, poly_b, seg.r, 0, arr))) return [con]; + if((con = circle2circleQuery(seg.tb, poly_b, seg.r, 0, arr))) return [con]; + } + return arr; +}; +var circle2poly = function(circ, poly) +{ + var planes = poly.tPlanes; + var mini = 0; + var min = vdot(planes[0].n, circ.tc) - planes[0].d - circ.r; + for(var i=0; i 0){ + return NONE; + } else if(dist > min) { + min = dist; + mini = i; + } + } + var n = planes[mini].n; + var verts = poly.tVerts; + var len = verts.length; + var mini2 = mini<<1; + var ax = verts[mini2]; + var ay = verts[mini2+1]; + var bx = verts[(mini2+2)%len]; + var by = verts[(mini2+3)%len]; + var dta = vcross2(n.x, n.y, ax, ay); + var dtb = vcross2(n.x, n.y, bx, by); + var dt = vcross(n, circ.tc); + if(dt < dtb){ + var con = circle2circleQuery(circ.tc, new Vect(bx, by), circ.r, 0, con); + return con ? [con] : NONE; + } else if(dt < dta) { + return [new Contact( + vsub(circ.tc, vmult(n, circ.r + min/2)), + vneg(n), + min, + 0 + )]; + } else { + var con = circle2circleQuery(circ.tc, new Vect(ax, ay), circ.r, 0, con); + return con ? [con] : NONE; + } +}; +CircleShape.prototype.collisionCode = 0; +SegmentShape.prototype.collisionCode = 1; +PolyShape.prototype.collisionCode = 2; +CircleShape.prototype.collisionTable = [ + circle2circle, + circle2segment, + circle2poly +]; +SegmentShape.prototype.collisionTable = [ + null, + function(segA, segB) { return NONE; }, // seg2seg + seg2poly +]; +PolyShape.prototype.collisionTable = [ + null, + null, + poly2poly +]; +var collideShapes = cp.collideShapes = function(a, b) +{ + assert(a.collisionCode <= b.collisionCode, 'Collided shapes must be sorted by type'); + return a.collisionTable[b.collisionCode](a, b); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var defaultCollisionHandler = new CollisionHandler(); +var Space = cp.Space = function() { + this.stamp = 0; + this.curr_dt = 0; + this.bodies = []; + this.rousedBodies = []; + this.sleepingComponents = []; + this.staticShapes = new BBTree(null); + this.activeShapes = new BBTree(this.staticShapes); + this.arbiters = []; + this.contactBuffersHead = null; + this.cachedArbiters = {}; + this.constraints = []; + this.locked = 0; + this.collisionHandlers = {}; + this.defaultHandler = defaultCollisionHandler; + this.postStepCallbacks = []; + this.delayedAddRemove = []; + this.iterations = 10; + this.gravity = vzero; + this.damping = 1; + this.idleSpeedThreshold = 0; + this.sleepTimeThreshold = Infinity; + this.collisionSlop = 0.1; + this.collisionBias = Math.pow(1 - 0.1, 60); + this.collisionPersistence = 3; + this.enableContactGraph = false; + this.staticBody = new Body(Infinity, Infinity); + this.staticBody.nodeIdleTime = Infinity; + this.collideShapes = this.makeCollideShapes(); +}; +Space.prototype.getCurrentTimeStep = function() { return this.curr_dt; }; +Space.prototype.setIterations = function(iter) { this.iterations = iter; }; +Space.prototype.isLocked = function() +{ + return this.locked; +}; +var assertSpaceUnlocked = function(space) +{ + assert(!space.locked, "This addition/removal cannot be done safely during a call to cpSpaceStep() \ + or during a query. Put these calls into a post-step callback."); +}; +Space.prototype.addCollisionHandler = function(a, b, begin, preSolve, postSolve, separate) +{ + assertSpaceUnlocked(this); + this.removeCollisionHandler(a, b); + var handler = new CollisionHandler(); + handler.a = a; + handler.b = b; + if(begin) handler.begin = begin; + if(preSolve) handler.preSolve = preSolve; + if(postSolve) handler.postSolve = postSolve; + if(separate) handler.separate = separate; + this.collisionHandlers[hashPair(a, b)] = handler; +}; +Space.prototype.removeCollisionHandler = function(a, b) +{ + assertSpaceUnlocked(this); + delete this.collisionHandlers[hashPair(a, b)]; +}; +Space.prototype.setDefaultCollisionHandler = function(begin, preSolve, postSolve, separate) +{ + assertSpaceUnlocked(this); + var handler = new CollisionHandler(); + if(begin) handler.begin = begin; + if(preSolve) handler.preSolve = preSolve; + if(postSolve) handler.postSolve = postSolve; + if(separate) handler.separate = separate; + this.defaultHandler = handler; +}; +Space.prototype.lookupHandler = function(a, b) +{ + return this.collisionHandlers[hashPair(a, b)] || this.defaultHandler; +}; +Space.prototype.addShape = function(shape) +{ + var body = shape.body; + if(body.isStatic()) return this.addStaticShape(shape); + if(this.locked) + { + if(!shape.isAdded) + { + shape.isAdded = true; + this.delayedAddRemove.push(this.addShape); + this.delayedAddRemove.push(shape); + } + return shape; + } + shape.isAdded = true; + assert(!shape.space, "This shape is already added to a space and cannot be added to another."); + assertSpaceUnlocked(this); + body.activate(); + body.addShape(shape); + shape.update(body.p, body.rot); + this.activeShapes.insert(shape, shape.hashid); + shape.space = this; + return shape; +}; +Space.prototype.addStaticShape = function(shape) +{ + if(this.locked) + { + if(!shape.isAdded) + { + shape.isAdded = true; + this.delayedAddRemove.push(this.addStaticShape); + this.delayedAddRemove.push(shape); + } + return shape; + } + shape.isAdded = true; + assert(!shape.space, "This shape is already added to a space and cannot be added to another."); + assertSpaceUnlocked(this); + var body = shape.body; + body.addShape(shape); + shape.update(body.p, body.rot); + this.staticShapes.insert(shape, shape.hashid); + shape.space = this; + return shape; +}; +Space.prototype.addBody = function(body) +{ + assert(!body.isStatic(), "Static bodies cannot be added to a space as they are not meant to be simulated."); + if(this.locked) + { + if(!body.isAdded) + { + body.isAdded = true; + this.delayedAddRemove.push(this.addBody); + this.delayedAddRemove.push(body); + } + return body; + } + body.isAdded = true; + assert(!body.space, "This body is already added to a space and cannot be added to another."); + assertSpaceUnlocked(this); + this.bodies.push(body); + body.space = this; + return body; +}; +Space.prototype.addConstraint = function(constraint) +{ + if(this.locked) + { + if(!constraint.isAdded) + { + constraint.isAdded = true; + this.delayedAddRemove.push(this.addConstraint); + this.delayedAddRemove.push(constraint); + } + return constraint; + } + constraint.isAdded = true; + assert(!constraint.space, "This shape is already added to a space and cannot be added to another."); + assertSpaceUnlocked(this); + var a = constraint.a, b = constraint.b; + a.activate(); + b.activate(); + this.constraints.push(constraint); + constraint.next_a = a.constraintList; a.constraintList = constraint; + constraint.next_b = b.constraintList; b.constraintList = constraint; + constraint.space = this; + return constraint; +}; +Space.prototype.filterArbiters = function(body, filter) +{ + for (var hash in this.cachedArbiters) + { + var arb = this.cachedArbiters[hash]; + if( + (body === arb.body_a && (filter === arb.a || filter === null)) || + (body === arb.body_b && (filter === arb.b || filter === null)) + ){ + if(filter && arb.state !== 'cached') arb.callSeparate(this); + arb.unthread(); + deleteObjFromList(this.arbiters, arb); + delete this.cachedArbiters[hash]; + } + } +}; +Space.prototype.removeShape = function(shape) +{ + var body = shape.body; + if(body.isStatic()){ + this.removeStaticShape(shape); + } else { + if(this.locked) + { + if(shape.isAdded) + { + shape.isAdded = false; + this.delayedAddRemove.push(this.removeShape); + this.delayedAddRemove.push(shape); + } + return; + } + shape.isAdded = false; + assert(this.containsShape(shape), + "Cannot remove a shape that was not added to the space. (Removed twice maybe?)"); + assertSpaceUnlocked(this); + body.activate(); + body.removeShape(shape); + this.filterArbiters(body, shape); + this.activeShapes.remove(shape, shape.hashid); + shape.space = null; + } +}; +Space.prototype.removeStaticShape = function(shape) +{ + if(this.locked) + { + if(shape.isAdded) + { + shape.isAdded = false; + this.delayedAddRemove.push(this.removeStaticShape); + this.delayedAddRemove.push(shape); + } + return; + } + shape.isAdded = false; + assert(this.containsShape(shape), + "Cannot remove a static or sleeping shape that was not added to the space. (Removed twice maybe?)"); + assertSpaceUnlocked(this); + var body = shape.body; + if(body.isStatic()) body.activateStatic(shape); + body.removeShape(shape); + this.filterArbiters(body, shape); + this.staticShapes.remove(shape, shape.hashid); + shape.space = null; +}; +Space.prototype.removeBody = function(body) +{ + if(this.locked) + { + if(body.isAdded) + { + body.isAdded = false; + this.delayedAddRemove.push(this.removeBody); + this.delayedAddRemove.push(body); + } + return; + } + body.isAdded = false; + assert(this.containsBody(body), + "Cannot remove a body that was not added to the space. (Removed twice maybe?)"); + assertSpaceUnlocked(this); + body.activate(); + deleteObjFromList(this.bodies, body); + body.space = null; +}; +Space.prototype.removeConstraint = function(constraint) +{ + if(this.locked) + { + if(constraint.isAdded) + { + constraint.isAdded = false; + this.delayedAddRemove.push(this.removeConstraint); + this.delayedAddRemove.push(constraint); + } + return; + } + constraint.isAdded = false; + assert(this.containsConstraint(constraint), + "Cannot remove a constraint that was not added to the space. (Removed twice maybe?)"); + assertSpaceUnlocked(this); + constraint.a.activate(); + constraint.b.activate(); + deleteObjFromList(this.constraints, constraint); + constraint.a.removeConstraint(constraint); + constraint.b.removeConstraint(constraint); + constraint.space = null; +}; +Space.prototype.containsShape = function(shape) +{ + return (shape.space === this); +}; +Space.prototype.containsBody = function(body) +{ + return (body.space == this); +}; +Space.prototype.containsConstraint = function(constraint) +{ + return (constraint.space == this); +}; +Space.prototype.uncacheArbiter = function(arb) +{ + delete this.cachedArbiters[hashPair(arb.a.hashid, arb.b.hashid)]; + deleteObjFromList(this.arbiters, arb); +}; +Space.prototype.eachBody = function(func, mythis) +{ + this.lock(); { + var bodies = this.bodies; + for(var i=0; i keThreshold ? 0 : body.nodeIdleTime + dt); + } + else + body.nodeIdleTime = Infinity; + } + } + var arbiters = this.arbiters; + for(var i=0, count=arbiters.length; i= 0, "Internal Error: Space lock underflow."); + if(this.locked === 0 && runPostStep){ + var waking = this.rousedBodies; + for(var i=0; i this.collisionPersistence){ + var tail = head.next; + tail.stamp = stamp; + tail.contacts.length = 0; + this.contactBuffersHead = tail; + } else { + var buffer = new ContactBuffer(stamp, head); + this.contactBuffersHead = head.next = buffer; + } +}; +cpContact * +cpContactBufferGetArray(cpSpace *space) +{ + if(space.contactBuffersHead.numContacts + CP_MAX_CONTACTS_PER_ARBITER > CP_CONTACTS_BUFFER_SIZE){ + space.pushFreshContactBuffer(); + } + cpContactBufferHeader *head = space.contactBuffersHead; + return ((cpContactBuffer *)head)->contacts + head.numContacts; +} +void +cpSpacePushContacts(cpSpace *space, int count) +{ + cpAssertHard(count <= CP_MAX_CONTACTS_PER_ARBITER, "Internal Error: Contact buffer overflow!"); + space.contactBuffersHead.numContacts += count; +} +static void +cpSpacePopContacts(cpSpace *space, int count){ + space.contactBuffersHead.numContacts -= count; +} +*/ +/* Use this to re-enable object pools. +static void * +cpSpaceArbiterSetTrans(cpShape **shapes, cpSpace *space) +{ + if(space.pooledArbiters.num == 0){ + int count = CP_BUFFER_BYTES/sizeof(cpArbiter); + cpAssertHard(count, "Internal Error: Buffer size too small."); + cpArbiter *buffer = (cpArbiter *)cpcalloc(1, CP_BUFFER_BYTES); + cpArrayPush(space.allocatedBuffers, buffer); + for(int i=0; i b.collisionCode){ + var temp = a; + a = b; + b = temp; + } + var contacts = collideShapes(a, b); + if(contacts.length === 0) return; // Shapes are not colliding. + var arbHash = hashPair(a.hashid, b.hashid); + var arb = space.cachedArbiters[arbHash]; + if (!arb){ + arb = space.cachedArbiters[arbHash] = new Arbiter(a, b); + } + arb.update(contacts, handler, a, b); + if(arb.state == 'first coll' && !handler.begin(arb, space)){ + arb.ignore(); // permanently ignore the collision until separation + } + if( + (arb.state !== 'ignore') && + handler.preSolve(arb, space) && + !sensor + ){ + space.arbiters.push(arb); + } else { + arb.contacts = null; + if(arb.state !== 'ignore') arb.state = 'normal'; + } + arb.stamp = space.stamp; +}; +Space.prototype.makeCollideShapes = function() +{ + space_ = this; + return anon_func; +}; +Space.prototype.arbiterSetFilter = function(arb) +{ + var ticks = this.stamp - arb.stamp; + var a = arb.body_a, b = arb.body_b; + if( + (a.isStatic() || a.isSleeping()) && + (b.isStatic() || b.isSleeping()) + ){ + return true; + } + if(ticks >= 1 && arb.state != 'cached'){ + arb.callSeparate(this); + arb.state = 'cached'; + } + if(ticks >= this.collisionPersistence){ + arb.contacts = null; + return false; + } + return true; +}; +var updateFunc = function(shape) +{ + var body = shape.body; + shape.update(body.p, body.rot); +}; +Space.prototype.step = function(dt) +{ + if(dt === 0) return; + assert(vzero.x === 0 && vzero.y === 0, "vzero is invalid"); + this.stamp++; + var prev_dt = this.curr_dt; + this.curr_dt = dt; + var i; + var j; + var hash; + var bodies = this.bodies; + var constraints = this.constraints; + var arbiters = this.arbiters; + for(i=0; i 0, "You created a 0 length pin joint. A pivot joint will be much more stable."); + this.r1 = this.r2 = null; + this.n = null; + this.nMass = 0; + this.jnAcc = this.jnMax = 0; + this.bias = 0; +}; +PinJoint.prototype = Object.create(Constraint.prototype); +PinJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + this.r1 = vrotate(this.anchr1, a.rot); + this.r2 = vrotate(this.anchr2, b.rot); + var delta = vsub(vadd(b.p, this.r2), vadd(a.p, this.r1)); + var dist = vlength(delta); + this.n = vmult(delta, 1/(dist ? dist : Infinity)); + this.nMass = 1/k_scalar(a, b, this.r1, this.r2, this.n); + var maxBias = this.maxBias; + this.bias = clamp(-bias_coef(this.errorBias, dt)*(dist - this.dist)/dt, -maxBias, maxBias); + this.jnMax = this.maxForce * dt; +}; +PinJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + var j = vmult(this.n, this.jnAcc*dt_coef); + apply_impulses(this.a, this.b, this.r1, this.r2, j.x, j.y); +}; +PinJoint.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var n = this.n; + var vrn = normal_relative_velocity(a, b, this.r1, this.r2, n); + var jn = (this.bias - vrn)*this.nMass; + var jnOld = this.jnAcc; + this.jnAcc = clamp(jnOld + jn, -this.jnMax, this.jnMax); + jn = this.jnAcc - jnOld; + apply_impulses(a, b, this.r1, this.r2, n.x*jn, n.y*jn); +}; +PinJoint.prototype.getImpulse = function() +{ + return Math.abs(this.jnAcc); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var SlideJoint = cp.SlideJoint = function(a, b, anchr1, anchr2, min, max) +{ + Constraint.call(this, a, b); + this.anchr1 = anchr1; + this.anchr2 = anchr2; + this.min = min; + this.max = max; + this.r1 = this.r2 = this.n = null; + this.nMass = 0; + this.jnAcc = this.jnMax = 0; + this.bias = 0; +}; +SlideJoint.prototype = Object.create(Constraint.prototype); +SlideJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + this.r1 = vrotate(this.anchr1, a.rot); + this.r2 = vrotate(this.anchr2, b.rot); + var delta = vsub(vadd(b.p, this.r2), vadd(a.p, this.r1)); + var dist = vlength(delta); + var pdist = 0; + if(dist > this.max) { + pdist = dist - this.max; + this.n = vnormalize_safe(delta); + } else if(dist < this.min) { + pdist = this.min - dist; + this.n = vneg(vnormalize_safe(delta)); + } else { + this.n = vzero; + this.jnAcc = 0; + } + this.nMass = 1/k_scalar(a, b, this.r1, this.r2, this.n); + var maxBias = this.maxBias; + this.bias = clamp(-bias_coef(this.errorBias, dt)*pdist/dt, -maxBias, maxBias); + this.jnMax = this.maxForce * dt; +}; +SlideJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + var jn = this.jnAcc * dt_coef; + apply_impulses(this.a, this.b, this.r1, this.r2, this.n.x * jn, this.n.y * jn); +}; +SlideJoint.prototype.applyImpulse = function() +{ + if(this.n.x === 0 && this.n.y === 0) return; // early exit + var a = this.a; + var b = this.b; + var n = this.n; + var r1 = this.r1; + var r2 = this.r2; + var vr = relative_velocity(a, b, r1, r2); + var vrn = vdot(vr, n); + var jn = (this.bias - vrn)*this.nMass; + var jnOld = this.jnAcc; + this.jnAcc = clamp(jnOld + jn, -this.jnMax, 0); + jn = this.jnAcc - jnOld; + apply_impulses(a, b, this.r1, this.r2, n.x * jn, n.y * jn); +}; +SlideJoint.prototype.getImpulse = function() +{ + return Math.abs(this.jnAcc); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var PivotJoint = cp.PivotJoint = function(a, b, anchr1, anchr2) +{ + Constraint.call(this, a, b); + if(typeof anchr2 === 'undefined') { + var pivot = anchr1; + anchr1 = (a ? a.world2Local(pivot) : pivot); + anchr2 = (b ? b.world2Local(pivot) : pivot); + } + this.anchr1 = anchr1; + this.anchr2 = anchr2; + this.r1 = this.r2 = vzero; + this.k1 = new Vect(0,0); this.k2 = new Vect(0,0); + this.jAcc = vzero; + this.jMaxLen = 0; + this.bias = vzero; +}; +PivotJoint.prototype = Object.create(Constraint.prototype); +PivotJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + this.r1 = vrotate(this.anchr1, a.rot); + this.r2 = vrotate(this.anchr2, b.rot); + k_tensor(a, b, this.r1, this.r2, this.k1, this.k2); + this.jMaxLen = this.maxForce * dt; + var delta = vsub(vadd(b.p, this.r2), vadd(a.p, this.r1)); + this.bias = vclamp(vmult(delta, -bias_coef(this.errorBias, dt)/dt), this.maxBias); +}; +PivotJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + apply_impulses(this.a, this.b, this.r1, this.r2, this.jAcc.x * dt_coef, this.jAcc.y * dt_coef); +}; +PivotJoint.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var r1 = this.r1; + var r2 = this.r2; + var vr = relative_velocity(a, b, r1, r2); + var j = mult_k(vsub(this.bias, vr), this.k1, this.k2); + var jOld = this.jAcc; + this.jAcc = vclamp(vadd(this.jAcc, j), this.jMaxLen); + apply_impulses(a, b, this.r1, this.r2, this.jAcc.x - jOld.x, this.jAcc.y - jOld.y); +}; +PivotJoint.prototype.getImpulse = function() +{ + return vlength(this.jAcc); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var GrooveJoint = cp.GrooveJoint = function(a, b, groove_a, groove_b, anchr2) +{ + Constraint.call(this, a, b); + this.grv_a = groove_a; + this.grv_b = groove_b; + this.grv_n = vperp(vnormalize(vsub(groove_b, groove_a))); + this.anchr2 = anchr2; + this.grv_tn = null; + this.clamp = 0; + this.r1 = this.r2 = null; + this.k1 = new Vect(0,0); + this.k2 = new Vect(0,0); + this.jAcc = vzero; + this.jMaxLen = 0; + this.bias = null; +}; +GrooveJoint.prototype = Object.create(Constraint.prototype); +GrooveJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + var ta = a.local2World(this.grv_a); + var tb = a.local2World(this.grv_b); + var n = vrotate(this.grv_n, a.rot); + var d = vdot(ta, n); + this.grv_tn = n; + this.r2 = vrotate(this.anchr2, b.rot); + var td = vcross(vadd(b.p, this.r2), n); + if(td <= vcross(ta, n)){ + this.clamp = 1; + this.r1 = vsub(ta, a.p); + } else if(td >= vcross(tb, n)){ + this.clamp = -1; + this.r1 = vsub(tb, a.p); + } else { + this.clamp = 0; + this.r1 = vsub(vadd(vmult(vperp(n), -td), vmult(n, d)), a.p); + } + k_tensor(a, b, this.r1, this.r2, this.k1, this.k2); + this.jMaxLen = this.maxForce * dt; + var delta = vsub(vadd(b.p, this.r2), vadd(a.p, this.r1)); + this.bias = vclamp(vmult(delta, -bias_coef(this.errorBias, dt)/dt), this.maxBias); +}; +GrooveJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + apply_impulses(this.a, this.b, this.r1, this.r2, this.jAcc.x * dt_coef, this.jAcc.y * dt_coef); +}; +GrooveJoint.prototype.grooveConstrain = function(j){ + var n = this.grv_tn; + var jClamp = (this.clamp*vcross(j, n) > 0) ? j : vproject(j, n); + return vclamp(jClamp, this.jMaxLen); +}; +GrooveJoint.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var r1 = this.r1; + var r2 = this.r2; + var vr = relative_velocity(a, b, r1, r2); + var j = mult_k(vsub(this.bias, vr), this.k1, this.k2); + var jOld = this.jAcc; + this.jAcc = this.grooveConstrain(vadd(jOld, j)); + apply_impulses(a, b, this.r1, this.r2, this.jAcc.x - jOld.x, this.jAcc.y - jOld.y); +}; +GrooveJoint.prototype.getImpulse = function() +{ + return vlength(this.jAcc); +}; +GrooveJoint.prototype.setGrooveA = function(value) +{ + this.grv_a = value; + this.grv_n = vperp(vnormalize(vsub(this.grv_b, value))); + this.activateBodies(); +}; +GrooveJoint.prototype.setGrooveB = function(value) +{ + this.grv_b = value; + this.grv_n = vperp(vnormalize(vsub(value, this.grv_a))); + this.activateBodies(); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var defaultSpringForce = function(spring, dist){ + return (spring.restLength - dist)*spring.stiffness; +}; +var DampedSpring = cp.DampedSpring = function(a, b, anchr1, anchr2, restLength, stiffness, damping) +{ + Constraint.call(this, a, b); + this.anchr1 = anchr1; + this.anchr2 = anchr2; + this.restLength = restLength; + this.stiffness = stiffness; + this.damping = damping; + this.springForceFunc = defaultSpringForce; + this.target_vrn = this.v_coef = 0; + this.r1 = this.r2 = null; + this.nMass = 0; + this.n = null; +}; +DampedSpring.prototype = Object.create(Constraint.prototype); +DampedSpring.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + this.r1 = vrotate(this.anchr1, a.rot); + this.r2 = vrotate(this.anchr2, b.rot); + var delta = vsub(vadd(b.p, this.r2), vadd(a.p, this.r1)); + var dist = vlength(delta); + this.n = vmult(delta, 1/(dist ? dist : Infinity)); + var k = k_scalar(a, b, this.r1, this.r2, this.n); + assertSoft(k !== 0, "Unsolvable this."); + this.nMass = 1/k; + this.target_vrn = 0; + this.v_coef = 1 - Math.exp(-this.damping*dt*k); + var f_spring = this.springForceFunc(this, dist); + apply_impulses(a, b, this.r1, this.r2, this.n.x * f_spring * dt, this.n.y * f_spring * dt); +}; +DampedSpring.prototype.applyCachedImpulse = function(dt_coef){}; +DampedSpring.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var n = this.n; + var r1 = this.r1; + var r2 = this.r2; + var vrn = normal_relative_velocity(a, b, r1, r2, n); + var v_damp = (this.target_vrn - vrn)*this.v_coef; + this.target_vrn = vrn + v_damp; + v_damp *= this.nMass; + apply_impulses(a, b, this.r1, this.r2, this.n.x * v_damp, this.n.y * v_damp); +}; +DampedSpring.prototype.getImpulse = function() +{ + return 0; +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var defaultSpringTorque = function(spring, relativeAngle){ + return (relativeAngle - spring.restAngle)*spring.stiffness; +} +var DampedRotarySpring = cp.DampedRotarySpring = function(a, b, restAngle, stiffness, damping) +{ + Constraint.call(this, a, b); + this.restAngle = restAngle; + this.stiffness = stiffness; + this.damping = damping; + this.springTorqueFunc = defaultSpringTorque; + this.target_wrn = 0; + this.w_coef = 0; + this.iSum = 0; +}; +DampedRotarySpring.prototype = Object.create(Constraint.prototype); +DampedRotarySpring.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + var moment = a.i_inv + b.i_inv; + assertSoft(moment !== 0, "Unsolvable spring."); + this.iSum = 1/moment; + this.w_coef = 1 - Math.exp(-this.damping*dt*moment); + this.target_wrn = 0; + var j_spring = this.springTorqueFunc(this, a.a - b.a)*dt; + a.w -= j_spring*a.i_inv; + b.w += j_spring*b.i_inv; +}; +DampedRotarySpring.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var wrn = a.w - b.w;//normal_relative_velocity(a, b, r1, r2, n) - this.target_vrn; + var w_damp = (this.target_wrn - wrn)*this.w_coef; + this.target_wrn = wrn + w_damp; + var j_damp = w_damp*this.iSum; + a.w += j_damp*a.i_inv; + b.w -= j_damp*b.i_inv; +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var RotaryLimitJoint = cp.RotaryLimitJoint = function(a, b, min, max) +{ + Constraint.call(this, a, b); + this.min = min; + this.max = max; + this.jAcc = 0; + this.iSum = this.bias = this.jMax = 0; +}; +RotaryLimitJoint.prototype = Object.create(Constraint.prototype); +RotaryLimitJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + var dist = b.a - a.a; + var pdist = 0; + if(dist > this.max) { + pdist = this.max - dist; + } else if(dist < this.min) { + pdist = this.min - dist; + } + this.iSum = 1/(1/a.i + 1/b.i); + var maxBias = this.maxBias; + this.bias = clamp(-bias_coef(this.errorBias, dt)*pdist/dt, -maxBias, maxBias); + this.jMax = this.maxForce * dt; + if(!this.bias) this.jAcc = 0; +}; +RotaryLimitJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + var a = this.a; + var b = this.b; + var j = this.jAcc*dt_coef; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +RotaryLimitJoint.prototype.applyImpulse = function() +{ + if(!this.bias) return; // early exit + var a = this.a; + var b = this.b; + var wr = b.w - a.w; + var j = -(this.bias + wr)*this.iSum; + var jOld = this.jAcc; + if(this.bias < 0){ + this.jAcc = clamp(jOld + j, 0, this.jMax); + } else { + this.jAcc = clamp(jOld + j, -this.jMax, 0); + } + j = this.jAcc - jOld; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +RotaryLimitJoint.prototype.getImpulse = function() +{ + return Math.abs(joint.jAcc); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var RatchetJoint = cp.RatchetJoint = function(a, b, phase, ratchet) +{ + Constraint.call(this, a, b); + this.angle = 0; + this.phase = phase; + this.ratchet = ratchet; + this.angle = (b ? b.a : 0) - (a ? a.a : 0); + this.iSum = this.bias = this.jAcc = this.jMax = 0; +}; +RatchetJoint.prototype = Object.create(Constraint.prototype); +RatchetJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + var angle = this.angle; + var phase = this.phase; + var ratchet = this.ratchet; + var delta = b.a - a.a; + var diff = angle - delta; + var pdist = 0; + if(diff*ratchet > 0){ + pdist = diff; + } else { + this.angle = Math.floor((delta - phase)/ratchet)*ratchet + phase; + } + this.iSum = 1/(a.i_inv + b.i_inv); + var maxBias = this.maxBias; + this.bias = clamp(-bias_coef(this.errorBias, dt)*pdist/dt, -maxBias, maxBias); + this.jMax = this.maxForce * dt; + if(!this.bias) this.jAcc = 0; +}; +RatchetJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + var a = this.a; + var b = this.b; + var j = this.jAcc*dt_coef; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +RatchetJoint.prototype.applyImpulse = function() +{ + if(!this.bias) return; // early exit + var a = this.a; + var b = this.b; + var wr = b.w - a.w; + var ratchet = this.ratchet; + var j = -(this.bias + wr)*this.iSum; + var jOld = this.jAcc; + this.jAcc = clamp((jOld + j)*ratchet, 0, this.jMax*Math.abs(ratchet))/ratchet; + j = this.jAcc - jOld; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +RatchetJoint.prototype.getImpulse = function(joint) +{ + return Math.abs(joint.jAcc); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var GearJoint = cp.GearJoint = function(a, b, phase, ratio) +{ + Constraint.call(this, a, b); + this.phase = phase; + this.ratio = ratio; + this.ratio_inv = 1/ratio; + this.jAcc = 0; + this.iSum = this.bias = this.jMax = 0; +}; +GearJoint.prototype = Object.create(Constraint.prototype); +GearJoint.prototype.preStep = function(dt) +{ + var a = this.a; + var b = this.b; + if(a.isRogue() && b.isRogue()) + return; + this.iSum = 1/(a.i_inv*this.ratio_inv + this.ratio*b.i_inv); + var maxBias = this.maxBias; + this.bias = clamp(-bias_coef(this.errorBias, dt)*(b.a*this.ratio - a.a - this.phase)/dt, -maxBias, maxBias); + this.jMax = this.maxForce * dt; +}; +GearJoint.prototype.applyCachedImpulse = function(dt_coef) +{ + var a = this.a; + var b = this.b; + var j = this.jAcc*dt_coef; + a.w -= j*a.i_inv*this.ratio_inv; + b.w += j*b.i_inv; +}; +GearJoint.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var wr = b.w*this.ratio - a.w; + var j = (this.bias - wr)*this.iSum; + var jOld = this.jAcc; + this.jAcc = clamp(jOld + j, -this.jMax, this.jMax); + j = this.jAcc - jOld; + a.w -= j*a.i_inv*this.ratio_inv; + b.w += j*b.i_inv; +}; +GearJoint.prototype.getImpulse = function() +{ + return Math.abs(this.jAcc); +}; +GearJoint.prototype.setRatio = function(value) +{ + this.ratio = value; + this.ratio_inv = 1/value; + this.activateBodies(); +}; +/* Copyright (c) 2007 Scott Lembcke + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +var SimpleMotor = cp.SimpleMotor = function(a, b, rate) +{ + Constraint.call(this, a, b); + this.rate = rate; + this.jAcc = 0; + this.iSum = this.jMax = 0; +}; +SimpleMotor.prototype = Object.create(Constraint.prototype); +SimpleMotor.prototype.preStep = function(dt) +{ + this.iSum = 1/(this.a.i_inv + this.b.i_inv); + this.jMax = this.maxForce * dt; +}; +SimpleMotor.prototype.applyCachedImpulse = function(dt_coef) +{ + var a = this.a; + var b = this.b; + var j = this.jAcc*dt_coef; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +SimpleMotor.prototype.applyImpulse = function() +{ + var a = this.a; + var b = this.b; + var wr = b.w - a.w + this.rate; + var j = -wr*this.iSum; + var jOld = this.jAcc; + this.jAcc = clamp(jOld + j, -this.jMax, this.jMax); + j = this.jAcc - jOld; + a.w -= j*a.i_inv; + b.w += j*b.i_inv; +}; +SimpleMotor.prototype.getImpulse = function() +{ + return Math.abs(this.jAcc); +}; +})(); +function isReversed(tri) +{ + var A = tri[0]; + var B = tri[1]; + var C = tri[2]; + var v1 = cp.v.sub(B, A); + var v2 = cp.v.sub(C, B); + return cp.v.cross(v1, v2) <0; +} +function pointsInTriangle (poly, tri) +{ + var pnt, result; + for(var i=0; i= 0) && (v >= 0) && (u + v < 1); +} +function triangulate (source_poly) +{ + var poly = source_poly.slice(0); + var triangles = []; + var i = 0, tri; + while (poly.length >= 3) + { + tri = [poly[i], + poly[(i+1)%poly.length], + poly[(i+2)%poly.length] + ]; + if (!isReversed(tri) && !pointsInTriangle(poly, tri)) + { + poly.splice((i+1)%poly.length, 1); //remove point + triangles.push(tri); + } + else + i++; + i = i%poly.length; + } + return triangles; +} +function add_tri_2_poly (poly, tri) +{ + var i, found_cnt=0; + var not_found; + var after_not_found; + for(i=0; i<3; i++) + { + if( poly.indexOf(tri[i]) == -1) + { + not_found = tri[i]; + after_not_found = tri[(i+1)%3]; + } + else + found_cnt++; + } + if ( found_cnt != 2) + return false; + i = poly.indexOf(after_not_found); + var len = poly.length; + if ( isReversed([poly[(i-2+len)%len], poly[(i-1+len)%len], not_found]) || + isReversed([not_found, poly[i], poly[(i+1)%len]]) ) + { + return false; + } + poly.splice(i, 0, not_found); + return true; +} +function triangles2convex (source_triangles) +{ + var triangles = source_triangles;//.slice(0); + var convex_polys = []; + while (triangles.length>0) + { + var convex = triangles[0]; + triangles.shift(); + for(var i=0; i this.behavior.lastUpdateTick && timescale > 0) + { + this.space.eachBody(eachBodyPrestep, this); + this.behavior.rogues.forEach(this.updateCOM); + this.space.eachBody(this.updateCOM); + this.behavior.rogues.forEach(this.changeShapeCheck); + this.space.bodies.forEach(this.changeShapeCheck); //dosen't cover sleeping bodies + if (!this.space.stepping_mode) + this.space.step(this.space.fixed_step * timescale); + else + this.space.step(this.runtime.getDt(this.inst)); + var delayedAddRemove = this.space.delayedAddRemove; + for(var i=0, len=delayedAddRemove.length/2; i=0 && index=0 && index=0 && index=0 && index=0 && index%","",0.5,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]]],[]],["MENUGAMEMODE",7,943412463390593,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[160,378,0,194,108,0,0,1,0.5,0.5092592835426331,0,0,[[1.15],[0,1,1]]],27,17,[[10],[549]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[400,474,0,194,95,0,0,1,0.5,0.5052631497383118,0,0,[[1.15],[0,1,1]]],28,23,[[10],[548]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[655,231,0,194,114,0,0,1,0.5,0.5087719559669495,0,0,[[1.15],[0,1,1]]],29,478,[[10],[547]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[656,411,0,194,114,0,0,1,0.5,0.5087719559669495,0,0,[[1.15],[0,1,1]]],30,479,[[10],[546]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[160,258,0,194,105,0,0,1,0.5,0.5047619342803955,0,0,[[1.15],[0,1,1]]],7,480,[[10],[550]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[400,335,0,210,78,0,0,1,0.5,0.5128205418586731,0,0,[[1.15]]],8,481,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[657,409,0,194,114,0,0,1,0.5,0.5,0,0,[]],34,546,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[655,231,0,194,114,0,0,1,0.5,0.5,0,0,[]],37,547,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[400,472,0,194,95,0,0,1,0.5,0.5052631497383118,0,0,[]],35,548,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[156,376,0,194,108,0,0,1,0.5,0.5092592835426331,0,0,[]],38,549,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[157,258,0,194,105,0,0,1,0.5,0.5047619342803955,0,0,[]],36,550,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[394,125,0,479.3939819335938,217.9063568115234,0,0,1,0.5,0.5,0,0,[]],46,24,[],[],[0,"Default",0,1]]],[]],["MENUSTATISTICS",8,870632429065030,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[244,296,0,320,320,0,0,1,0.5,0.5,0,0,[[0,1,1]]],60,551,[],[],[0,"Default",0,1]],[[572,346,0,320,320,0,0,1,0.5,0.5,0,0,[[0,1,1]]],60,552,[],[],[0,"Default",0,1]],[[513,152,0,182,53,0,0,1,0.5,0.5094339847564697,0,0,[[0,1,1]]],63,553,[],[],[0,"Default",0,1]],[[515,150,0,182,53,0,0,1,0.5,0.5094339847564697,0,0,[]],64,554,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[249,295,0,320,320,0,0,1,0.5,0.5,0,0,[]],75,555,[],[],[0,"Default",0,1]],[[575,345,0,320,320,0,0,1,0.5,0.5,0,0,[]],74,556,[],[],[0,"Default",0,1]],[[641.7816162109375,142.6555786132813,0,47.43416595458984,47.43416595458984,0,0.04914944246411324,1,0.5,0.5,0,0,[[1.15]]],6,615,[[10],[0],["statistics"]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[322.7414855957031,172.9501953125,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4656,[["stat0"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","00 : 00 : 00",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[322.10302734375,228.4115447998047,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4659,[["stat1"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0m",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[323.2316284179688,347.950927734375,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4665,[["stat3"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0/12",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[323.2308044433594,404.52734375,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4668,[["stat4"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[650.6273803710938,221.3792572021484,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4671,[["stat5"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[649.4970703125,279.214599609375,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4674,[["stat6"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[651.7559204101563,336.791015625,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4677,[["stat7"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0/600",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[650.4970092773438,396.62548828125,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4683,[["stat8"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[650.62646484375,452.94384765625,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4685,[["stat9"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[322.1021728515625,284.8584594726563,0,113.8800659179688,38.93576049804688,0,0,1,0.5,0.5,0,0,[[1,1,1]]],195,4662,[["stat2"]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]]],[]],["LEVELSPAGE1",9,930138366077152,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[750,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],39,558,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[210,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,211,[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[405,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,569,[[1],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[600,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,570,[[2],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[164,-190,0,42,42,0,0,1,0.5,0.5,0,0,[]],76,587,[[0]],[],[0,"Default",0,1]],[[159,-447,0,123,27,0,0,1,0.5040650367736816,0.5185185074806213,0,0,[]],78,590,[],[],[0,"Default",0,1]],[[-130.3392333984375,-248.1235961914063,0,230,352,0,0,1,0.5,0.5,0,0,[]],69,591,[],[],[0,"Default",0,1]],[[162,-267,0,118,36,0,0,1,0.5,0.5,0,0,[]],77,592,[[0]],[],[0,"Default",0,1]],[[162,-386,0,100,18,0,0,1,0.5,1,0,0,[]],79,593,[[0],[0]],[],["00 : 00 : 00",0,"12pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[175,-355,0,100,18,0,0,1,0.5,1,0,0,[]],79,594,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[176,-325,0,100,18,0,0,1,0.5,1,0,0,[]],79,595,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[174,-218,0,100,18,0,0,1,0.5,1,0,0,[]],79,597,[[0],[0]],[],["10/50",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[178,-142,0,100,18,0,0,1,0.5,1,0,0,[]],79,598,[[0],[0]],[],["x 10",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[162,-74,0,162,68,0,0,1,0.5,0.5147058963775635,0,0,[[1.15]]],33,599,[[10],[0],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[404,-264,0,230,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],71,600,[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[406,-265,0,186,352,0,0,1,0.5,0.5,0,0,[]],70,605,[],[],[0,"Default",0,1]],[[409,-383,0,100,18,0,0,1,0.5,1,0,0,[]],79,606,[[0],[0]],[],["00 : 00 : 00",0,"12pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[410,-263,0,118,36,0,0,1,0.5,0.5,0,0,[]],77,607,[[0]],[],[0,"Default",0,1]],[[423,-351,0,100,18,0,0,1,0.5,1,0,0,[]],79,608,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[424,-321,0,100,18,0,0,1,0.5,1,0,0,[]],79,609,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[423,-291,0,100,18,0,0,1,0.5,1,0,0,[]],79,610,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[422,-216,0,100,18,0,0,1,0.5,1,0,0,[]],79,611,[[0],[0]],[],["10/50",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[426,-138,0,100,18,0,0,1,0.5,1,0,0,[]],79,612,[[0],[0]],[],["x 10",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[404,-73,0,162,68,0,0,1,0.5,0.5147058963775635,0,0,[[1.15]]],33,613,[[10],[0],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[168,-308,0,100,18,0,0,1,0.5,1,0,0,[]],79,596,[[0],[0]],[],["00 : 00 : 00",0,"11pt Granstander Clean","rgb(255,255,255)",1,0,7,0,0]],[[756.2002563476563,-142.1820526123047,0,161.5151824951172,40.9680290222168,0,0,1,0.5,0.5,0,0,[[1,1,1]]],196,617,[[0],[0]],[],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]]],[]],["LEVELSPAGE2",10,114662663131236,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[750,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],39,571,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[45,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],40,572,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[210,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,573,[[3],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[405,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,574,[[4],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[600,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,575,[[5],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]]],[]],["LEVELSPAGE3",11,471470084870207,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[750,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],39,576,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[45,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],40,577,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[210,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,578,[[6],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[405,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,579,[[7],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[600,300,0,186,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],73,580,[[8],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]]],[]],["LEVELSPAGE4",12,126687702225074,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[750,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],39,581,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[45,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],40,582,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[410,300,0,230,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],71,583,[[9],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]]],[]],["LEVELSPAGE5",13,775640977159975,true,[255,255,255],true,1,1,1,false,false,1,0,0,[[[287,300,0,230,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],71,584,[[10],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[526,300,0,230,352,0,0,1,0.5,0.5,0,0,[[0,1,1]]],71,585,[[11],[0],[0],[0],[0],[0],[0],[0],[0],[0]],[],[0,"Default",0,1]],[[45,281,0,55,70,0,0,1,0.5090909004211426,0.5,0,0,[[1.15]]],40,588,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]]],[]],["cheker",14,214592930063095,true,[255,255,255],true,1,1,1,false,false,1,0,0,[],[]],["GUI",15,107213776786855,true,[255,255,255],true,1,1,1,false,false,1,0,0,[],[]]],[[null,100,48,[],[],[15,4,1]],[null,101,614,[],[],[3,3,1]],[null,102,568,[],[],[12,5,1]],[null,103,629,[],[],[12,5,1]]],[]],["BlackScreen",800,576,false,null,218488994149691,[["Layer 0",0,323899870262805,true,[255,255,255],false,1,1,1,false,false,1,0,0,[[[-1,-1,0,802,580,0,0,1,0,0,0,0,[]],47,33,[],[],[0,0]],[[395,120,0,406.9664306640625,184.9847564697266,0,0,1,0.5,0.5,0,0,[]],46,34,[],[],[0,"Default",0,1]],[[157,244,0,502,86,0,0,1,0,0,0,0,[]],52,35,[],[],["THIS WEBSITE IS BLACKLISTED PLEASE GO TO:",0,"bold 22pt Arial","rgb(255,255,255)",1,0,0,0,0]],[[56,376,0,698,56,0,0,1,0,0,0,0,[]],52,36,[],[],["TO PLAY THIS GAME",0,"bold 22pt Arial","rgb(255,255,255)",1,0,0,0,0]],[[102,424,0,617,123,0,0,1,0,0,0,0,[]],52,37,[],[],["If you are a website owner, please unblock games link and request Y8.COM to remove your website from black list",0,"bold 22pt Arial","rgb(255,255,255)",1,0,0,0,-10]],[[243.9642944335938,334,0,322.3770141601563,24,0,0,1,0,0,0,0,[]],53,38,[],[],["http://www.y8.com/games/stickman_boost","","",1,1,1,0,0,1,""]]],[]]],[],[]],["allSource",1708,960,false,null,459459726330211,[["background",0,651874621335439,true,[255,255,255],false,1,1,1,false,false,1,0,0,[[[969,1214,0,127,62,0,0,1,0.5039370059967041,0.5161290168762207,0,0,[[1.15]]],16,19,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[973,1288,0,127,62,0,0,1,0.5039370059967041,0.5161290168762207,0,0,[[1.15]]],15,20,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[23,975,0,805,800,0,0,1,0,0,0,0,[]],55,21,[],[],[0,"Default",0,1]],[[-415,-167,0,223.4592895507813,112.7453689575195,0,0,1,0.5181818008422852,0.5585585832595825,0,0,[[0,1,1]]],57,22,[[0],[0],[0]],[[1,8,26,"0",0,0.6,1]],[0,"Default",0,0]],[[-476,-167,0,62,62,0,-0.02689666301012039,1,0.5,0.5,0,0,[]],56,41,[],[[]],[0,"Default",0,0]],[[1198,1195,0,190,59,0,0,1,0.5,0.5254237055778503,0,0,[[0,1,1]]],54,42,[],[],[0,"Default",0,1]],[[900,1142,0,50,50,0,0,1,0.5,0.5,0,0,[[1.15]]],6,43,[[10],[0],[""]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[866,1260,0,28,28,0,0,1,0.5,0.5,0,0,[[1.15]]],13,44,[[10],[0],[0],[1]],[[0,1,2,"100,100",0,0.05,1],[0,0,11,"-50,0",1,0.35,1]],[0,"Default",0,1]],[[866,1205,0,28,28,0,0,1,0.5,0.5,0,0,[[1.15]]],14,45,[[10],[0],[0],[1]],[[0,1,2,"100,100",0,0.05,1],[0,0,11,"-50,0",1,0.35,1]],[0,"Default",0,1]],[[1480,1171,0,179,49,0,0,1,0.5,0.5,0,0,[]],58,46,[],[[]],[42,48,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.!/()","World Champion",0.38,0,1,0,4,0,-5,0]],[[1478,1206,0,146,59,0,0,1,0.5,0.5,0,0,[]],59,47,[],[[]],[42,48,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.!/()","beat first chellenge",0.4,0,1,0,4,0,-8,0]],[[-172,972,0,80,80,0,0,1,0.5,0.5,0,0,[]],157,50,[[0],[0],[0]],[[]],[0,"Default",0,1]],[[29,436,0,94,94,0,0,1,0,0,0,0,[]],113,51,[[1],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[145,440,0,94,94,0,0,1,0,0,0,0,[]],114,52,[[1],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[-253,769,0,132,32,0,0,1,0,0,0,0,[]],105,53,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[-247,819,0,132,32,0,0,1,0,0,0,0,[]],106,54,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[-279,870,0,319,32,0,0,1,0,0,0,0,[]],107,55,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[-178,715,0,247,149,0,0,1,0,0,0,0,[[0.1,0.3,0.3,3,4,7,20,400,0.03]]],134,56,[],[],[0,0]],[[340,466,0,98,112,0,0,1,0.5,0.5,0,0,[]],110,57,[[0],[200],[0],[750]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",3,1]],[[-54,998,0,32,64,0,0,1,0.5,0.5,0,0,[]],130,58,[[0],[0],[1],[0.5],[1],[0],[1],[0.5],[0.5]],[[0,0,1,"0.0",1,0.5,1],[],[]],[0,"Default",0,1]],[[492,313,0,96,44,0,0,1,0.5,0.5,0,0,[]],123,59,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[514,370,0,128,31,0,0,1,0.5,0.5161290168762207,0,0,[]],122,60,[[0],[0],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[518,415,0,128,31,0,0,1,0.5,0.5161290168762207,0,0,[]],121,61,[[0],[0],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[17,969,0,39,64,0,0,1,0.5128205418586731,0.5,0,0,[]],127,62,[[1]],[],[0,"Default",0,1]],[[308,570,0,16,16,0,0,1,0.5,0.5,0,0,[]],112,63,[],[],[0,"Default",0,1]],[[44,583,0,24,24,0,0,1,0.5,0.5,0,0,[]],164,64,[],[],[0,"Default",0,0]],[[578,257,0,96,258,0,0,1,0.5,0.9728682041168213,0,0,[]],117,65,[[0],[0]],[],[0,"Default",0,1]],[[692,201,0,96,202,0,0,1,0.5,0.9603960514068604,0,0,[]],118,66,[[0],[0]],[],[0,"Default",0,1]],[[669,296,0,162,34,0,0,1,0.5,0.5,0,0,[]],119,67,[[0],[0]],[[1,0,1,4,0,0,0,50,0]],[0,"Default",0,1]],[[731,340,0,288,34,0,0,1,0.5,0.5,0,0,[]],120,68,[[0],[0]],[[1,0,1,4,0,0,0,50,0]],[0,"Default",0,1]],[[632,397,0,32,32,0,0,1,0.5,0.5,0,0,[]],129,69,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[9,578,0,10,13,0,0,1,0.5,0.4615384638309479,0,0,[]],165,70,[],[[0,3,0,"ffffffff",1,0,0.8,0,0,0],[0,5,1,"0",0,1,1]],[0,"Default",0,1]],[[971,834,0,102,72,0,0,1,0.5,0.5,0,0,[]],133,71,[[10],[448]],[],[0,"Default",0,1]],[[307,634,0,64,64,0,0,1,0.5,0.5,0,0,[]],126,72,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[1,0,1,4,0,0,0,50,0]],[0,"Default",0,1]],[[392,634,0,64,64,0,0,1,0.5,0.5,0,0,[]],124,73,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[1,0,1,4,0,0,0,50,0]],[0,"Default",0,1]],[[498,481,0,26,30,0,0,1,0.5,0.5,0,0,[]],154,74,[[0]],[[400,0,0,0,1,1]],[0,"Default",0,1]],[[619,476,0,192,20,0,0,1,0.5,0.5,0,0,[]],156,75,[],[],[0,"Default",0,1]],[[741,481,0,32,32,0,0,1,0.5,0.5,0,0,[]],155,76,[[1],[150],[0]],[],[0,"Default",0,1]],[[132,628,0,97,57,0,0,1,0.8041236996650696,0.4561403393745422,0,0,[]],131,77,[[0],[14],[0]],[],[0,"Default",0,1]],[[233,625,0,40,59,0,0,1,0.5,0.508474588394165,0,0,[]],158,78,[],[[400,0,0,0,1,1]],[0,"Default",0,1]],[[287,624,0,40,59,0,0,1,0.5,0.508474588394165,0,0,[]],166,79,[],[],[0,"Default",0,0]],[[362,621,0,25,38,0,0,1,-0.6399999856948853,0.4473684132099152,0,0,[]],168,80,[],[[0,5,1,"0",0,1,1]],[0,"Default",0,1]],[[481,643,0,138,138,0,0,1,0.5,0.5,0,0,[]],128,81,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[577,670,0,66,120,0,0,1,0.5,0.5,0,0,[]],109,82,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[0,5,4,"100",0,1.3,1]],[0,"Default",0,1]],[[152,748,0,96,96,0,0,1,0.5,0.5,0,0,[]],125,83,[[0],[0],[1],[0],[0],[1],[0.5],[1],[0.1],[1],[0.2],[0.5]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[0,0,1,"0.0",1,0.5,1],[],[]],[0,"Default",0,1]],[[232,790,0,33,192,0,0,1,0.5151515007019043,0.5,0,0,[]],115,84,[],[],[0,"Default",0,1]],[[369,722,0,25,25,0,0,1,0.5199999809265137,0.5199999809265137,0,0,[]],111,85,[],[],[0,"Default",0,1]],[[353,800,0,100,100,0,0,1,0.5,0.5,0,0,[]],167,86,[],[],[0,"Default",0,1]],[[434,751,0,24,51,0,0,1,0.5,0.2549019753932953,0,0,[]],140,87,[[0]],[[180,0]],[0,"Default",0,1]],[[563,778,0,97,97,0,0,1,0.5051546096801758,0.5051546096801758,0,0,[]],116,89,[[0],[0]],[[1,0,0,4,0,0,0,50,0]],[0,"Default",0,1]]],[]],["trapsBack",1,923044474173292,true,[255,255,255],true,1,1,1,false,false,1,0,0,[],[]],["traps",2,694476761496834,true,[255,255,255],true,1,1,1,false,false,1,0,0,[],[]],["hero",3,216242001954857,true,[255,255,255],true,1,1,1,false,false,1,0,0,[],[]],["GUI",4,613787953576200,true,[255,255,255],true,0,0,1,false,false,1,0,0,[[[924,53,0,512,512,0,0,1,0,0,0,0,[[1],[1]]],160,92,[],[],[0,0]],[[853,433,0,64.48255920410156,64.48255920410156,0,0,0.699999988079071,0.5,0.5,0,0,[]],169,148,[],[],[0,"Default",0,1]],[[862,847,0,80,365,0,0,1,0.5,1,0,0,[]],132,152,[[0]],[],[1,"Default",0,1]],[[749,646,0,14,32,0,0,1,1,0.5,0,0,[]],159,153,[],[[]],[0,"Default",0,1]],[[264,-103,0,48,48,0,0,1,0.5,0.5,0,0,[]],136,154,[],[],[0,"Default",0,1]],[[321,-104,0,48,48,0,0,1,0.5,0.5,0,0,[]],137,158,[[0.5]],[],[0,"Default",0,1]],[[862,-107,0,128,128,0,0,1,0,0.5,0,0,[]],171,156,[],[[]],[10,16,0,50,5,50,0,40,40,10,0,0,-150,-300,0,800,0,0,0.5]],[[718,-159,0,128,128,0,1.570796370506287,1,0,0.5,0,0,[]],170,159,[],[[]],[100,10,0,200,32,100,0,0,0,0,0,0,-150,50,0,800,0,0,1]],[[812,-156,0,128,128,0,1.570796370506287,1,0,0.5,0,0,[]],172,160,[],[[]],[100,10,0,200,32,100,0,0,0,0,0,0,-150,50,0,800,0,0,1]],[[379,-102,0,48,48,0,0,1,0.5,0.5,0,0,[]],138,155,[],[],[0,"Default",0,1]],[[437,-103,0,48,48,0,0,1,0.5,0.5,0,0,[]],135,161,[],[],[0,"Default",0,1]],[[784,142,0,6,6,0,0,1,0.5,0.5,0,0,[]],161,230,[],[[]],[1,"Default",0,1]],[[-429,619,0,64,64,0,0,1,0,0,0,0,[]],147,144,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[1,0,1,4,0,0,0,50,0]],[0,0]],[[-325,618,0,64,64,0,0,1,0,0,0,0,[]],148,232,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[1,1,1,4,0,0,0,50,0]],[0,0]],[[-376,732,0,64,64,0,0,1,0,0,0,0,[]],150,233,[[0],[0],[1],[1],[0],[0],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[0,0,4,"0,1000",1,1.3,1]],[0,0]],[[-251,769,0,64,64,0,0,1,0.5,0.5,0,0,[]],108,88,[[0],[0],[1],[1],[0],[0],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0],[0,0,4,"0,1000",1,1.3,1]],[0,"Default",0,1]],[[1065,701,0,112,66,0,0,1,0.5,0.5,0,0,[]],142,237,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[1091,803,0,66,34,0,0,1,0.5,0.5,0,0,[]],143,239,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[1146,759,0,28,26,0,0,1,0.5,0.5,0,0,[]],146,240,[],[],[0,"Default",0,1]],[[1193,806,0,66,34,0,0,1,0.5,0.5,0,0,[]],145,241,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[1230,675,0,112,66,0,0,1,0.5,0.5,0,0,[]],144,242,[[0],[0],[1]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[1403,732,0,32,96,0,0,1,0,0,0,0,[]],151,244,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[1486,717,0,96,32,0,0,1,0,0,0,0,[]],149,245,[[0],[0],[1],[1],[0]],[[1],[1,1,0,"00000011",1,0,0.8,0,0,0]],[0,0]],[[598,-83,0,43,65,0,0,1,0.5116279125213623,0.5076923370361328,0,0,[]],153,351,[],[],[0,"Default",0,1]],[[-289,954,0,128,128,0,0,1,0,0.5,0,0,[]],173,142,[],[],[50,360,1,200,10,100,0,0,0,0,20,0,-150,0,0,800,0,0,1]],[[865,-285,0,90,52,0,0,1,0.5,0.5,0,0,[]],62,589,[],[],[0,"Default",0,1]],[[1411.943359375,-210.7852172851563,0,186,352,0,0,1,0.5,0.5,0,0,[]],70,601,[],[],[0,"Default",0,1]],[[1474.32861328125,-255.5971069335938,0,230,352,0,0,1,0.5,0.5,0,0,[]],69,602,[],[],[0,"Default",0,1]],[[1207,-180,0,118,36,0,0,1,0.5,0.5,0,0,[]],77,603,[[0]],[],[0,"Default",0,1]],[[1032,-209,0,42,42,0,0,1,0.5,0.5,0,0,[]],76,604,[[0]],[],[0,"Default",0,1]],[[1016,-284,0,123,27,0,0,1,0.5040650367736816,0.5185185074806213,0,0,[]],78,586,[],[],[0,"Default",0,1]],[[1752,-103,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],21,468,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1720,-36,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],22,470,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1807,126,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],23,471,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1937,-45,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15],[0,1,1]]],17,472,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1862,-45,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15],[0,1,1]]],19,473,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1847,5,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],20,474,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1749,44,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],24,475,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1762,221,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],25,476,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1765,306,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15]]],26,477,[[10],[0]],[[0,1,2,"100,100",0,0.05,1],[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-390,1105,0,190,59,0,0,1,0.5,0.5254237055778503,0,0,[[0,1,1]]],54,557,[],[],[0,"Default",0,1]],[[-266,1094,0,50,50,0,0,1,0.5,0.5,0,0,[[1.15]]],6,559,[[10],[0],[""]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-393,1102,0,190,59,0,0,1,0.5,0.508474588394165,0,0,[]],68,560,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-206,1178,0,280,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],66,561,[],[],[0,"Default",0,1]],[[-301,1304,0,280,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],72,562,[],[],[0,"Default",0,1]],[[-142,1422,0,280,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],67,563,[],[],[0,"Default",0,1]],[[-220,1308,0,28,28,0,0,1,0.5,0.5,0,0,[[1.15]]],31,564,[[10],[0],[0],[1]],[[0,1,2,"100,100",0,0.05,1],[0,0,11,"-50,0",1,0.35,1]],[0,"Default",0,1]],[[-112,1156,0,28,28,0,0,1,0.5,0.5,0,0,[[1.15]]],13,565,[[10],[0],[0],[1]],[[0,1,2,"100,100",0,0.05,1],[0,0,11,"-50,0",1,0.35,1]],[0,"Default",0,1]],[[-110,1197,0,28,28,0,0,1,0.5,0.5,0,0,[[1.15]]],14,566,[[10],[0],[0],[1]],[[0,1,2,"100,100",0,0.05,1],[0,0,11,"-50,0",1,0.35,1]],[0,"Default",0,1]],[[-139,1481,0,120,50,0,0,1,0.5,0.5199999809265137,0,0,[[1.15]]],32,567,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-171,-170,0,398,49,0,-0.03053567558526993,1,0.5,0.5,0,0,[]],65,632,[["stat0"]],[[]],["World Champion!",0,"11pt Granstander Clean","rgb(255,255,255)",1,1,4,0,0]],[[545,-259,0,398,49,0,0,1,0.5,0.5,0,0,[]],65,633,[["stat0"]],[[]],["username",0,"16pt Granstander Clean","rgb(0,0,0)",1,1,4,0,0]],[[-171,-135,0,144.6636962890625,49,0,0,1,0.5,0.5,0,0,[]],65,634,[["stat0"]],[[]],["Achieve gold time on the all stage",0,"8pt Granstander Clean","rgb(255,255,255)",1,1,4,0,0]],[[-171,152,0,315,285,0,0,1,0.5015873312950134,0.5017544031143189,0,0,[[0,1,1]]],87,635,[],[],[0,"Default",0,1]],[[-928,467,0,24,23,0,0,1,0.5,0.52173912525177,0,0,[]],81,637,[],[[]],[0,"Default",0,1]],[[-956,546,0,135,50,0,0,1,0.5037037134170532,0.5,0,0,[]],86,639,[],[[]],[0,"Default",0,1]],[[-935,610,0,146,54,0,0,1,0.5,0.5,0,0,[[0,1,1]]],82,640,[],[],[0,"Default",0,1]],[[-901,673,0,235,52,0,0,1,0.5021276473999023,0.5,0,0,[[0,1,1]]],83,641,[],[],[0,"Default",0,1]],[[-978,733,0,135,50,0,0,1,0.5037037134170532,0.5,0,0,[[0,1,1]]],84,642,[],[],[0,"Default",0,1]],[[-1008,784,0,190,52,0,0,1,0.5,0.5,0,0,[[0,1,1]]],85,643,[],[],[0,"Default",0,1]],[[-185,444,0,315,285,0,0,1,0.5015873312950134,0.5017544031143189,0,0,[]],88,644,[],[],[0,"Default",0,1]],[[-971,60,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],89,645,[],[],[0,"Default",0,1]],[[-965,223,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[]],90,646,[],[],[0,"Default",0,1]],[[867,-415,0,398,51,0,0,1,0.5,0.5,0,0,[]],80,663,[["username"]],[[]],["inGame",0,"14pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[667,-297,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],42,677,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[731,-297,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],44,678,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[668,-232,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],43,679,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[733,-231,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],45,680,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-241,-292,0,146,54,0,0,1,0.5,0.5,0,0,[[0,1,1]]],82,638,[],[],[0,"Default",0,1]],[[-197,-332,0,235,52,0,0,1,0.5021276473999023,0.5,0,0,[[0,1,1]]],83,651,[],[],[0,"Default",0,1]],[[24,-382,0,135,50,0,0,1,0.5037037134170532,0.5,0,0,[[0,1,1]]],84,652,[],[],[0,"Default",0,1]],[[-5,-417,0,190,52,0,0,1,0.5,0.5,0,0,[[0,1,1]]],85,653,[],[],[0,"Default",0,1]],[[15,-382,0,135,50,0,0,1,0.5037037134170532,0.5,0,0,[]],86,654,[],[[]],[0,"Default",0,1]],[[185,-538,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,655,[["username"]],[[]],["01 : 10 : 95",0,"16pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[164,-504,0,179.8779907226563,51,0,-0.05884236842393875,1,0.5,0.5,0,0,[]],80,656,[["username"]],[[]],["00 : 10 : 00",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[-273,-295,0,16,16,0,0,1,0.5,0.52173912525177,0,0,[]],81,657,[],[[]],[0,"Default",0,1]],[[491,-544,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,658,[["username"]],[[]],["Stage 1",0,"14pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[566,-496,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,662,[["username"]],[[]],["x 7",0,"12pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[1949,283,0,200,30,0,0,1,0,0,0,0,[]],177,692,[],[],["Text",0,"12pt Arial","rgb(0,0,0)",0,0,0,0,0]],[[2136,565,0,315,285,0,0,1,0.5015873312950134,0.5017544031143189,0,0,[[0,1,1]]],87,693,[],[],[0,"Default",0,1]],[[2410,707,0,315,285,0,0,1,0.5015873312950134,0.5017544031143189,0,0,[]],88,694,[],[],[0,"Default",0,1]],[[2746,513,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],89,695,[],[],[0,"Default",0,1]],[[2744,510,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[]],90,696,[],[],[0,"Default",0,1]],[[1571,183,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15],[0,1,1]]],12,697,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1521,183,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15],[0,1,1]]],17,698,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1621,183,0,44,48,0,0,1,0.5,0.5,0,0,[[1.15],[0,1,1]]],19,699,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1688,395,0,118,36,0,0,1,0.5,0.5,0,0,[]],77,700,[[0]],[],[0,"Default",0,1]],[[1602.172973632813,-8.78143310546875,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,701,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2219,100,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,702,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2204.244140625,145.33984375,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,703,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2222,187,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,704,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2106,242,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,705,[["username"]],[[]],["10/50",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2112,289,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,706,[["username"]],[[]],["0/1",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2253,244,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,707,[["username"]],[[]],["x 77",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[1751,654,0,194,95,0,0,1,0.5,0.5052631497383118,0,0,[[1.15],[0,1,1]]],28,708,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1432,1335,0,194,95,0,0,1,0.5,0.5052631497383118,0,0,[]],35,709,[],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1639,557,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],42,710,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1885,549,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],44,711,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1721,552,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],43,712,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1802,552,0,58,60,0,0,1,0.5,0.5,0,0,[[1.15]]],45,713,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[2908.44189453125,484.5843505859375,0,97.89330291748047,55.1620979309082,0,0,1,0.5039682388305664,0.5211267471313477,0,0,[[1.15]]],3,715,[[0],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[2752,611,0,162,68,0,0,1,0.5,0.5147058963775635,0,0,[[1]]],41,716,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[1870,818,0,42,42,0,0,1,0.5,0.5,0,0,[]],76,717,[[0]],[],[0,"Default",0,1]],[[2281,28,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,636,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2435,-89,0,179.8779907226563,51,0,0,1,0.5,0.5,0,0,[]],80,648,[["username"]],[[]],["01 : 59 : 00 ",0,"10pt Granstander Clean","rgb(255,255,255)",0,1,4,0,0]],[[2003,-273,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[[0,1,1]]],89,649,[],[],[0,"Default",0,1]],[[2001,-276,0,282,135,0,0,1,0.5,0.5037037134170532,0,0,[]],90,650,[],[],[0,"Default",0,1]],[[2012,-175,0,162,68,0,0,1,0.5,0.5147058963775635,0,0,[[1]]],41,660,[[10],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[2354.144287109375,-294.5294799804688,0,165.0211334228516,92.98809814453125,0,0,1,0.5039682388305664,0.5211267471313477,0,0,[[1.15]]],3,661,[[0],[0]],[[0,1,2,"100,100",0,0.05,1]],[0,"Default",0,1]],[[-393,876,0,80,80,0,0,1,0.5,0.5,0,0,[]],141,669,[[1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[1],[0],[0],[1],[0],[1],[0],[1],[0],[0],[0],[0],[0],[0],[1]],[[400,1200,2500,360,1000,1000,0,0,0,1],[250,200,4000,225,300,0.4,1,0,0],[]],[1,"Default",0,1]],[[72.0736083984375,16.33900451660156,0,120,22,0,0,1,0.5,0.5,0,0,[]],178,728,[],[],[0,"Default",0,1]],[[69.59442138671875,51.04957580566406,0,120,36,0,0,1,0.5,0.5,0,0,[]],179,729,[],[],[0,"Default",0,1]],[[169.5939025878906,34.52017211914063,0,50,65,0,0,1,0.5,0.5076923370361328,0,0,[]],180,730,[],[],[0,"Default",0,1]],[[472.0733947753906,100.6359100341797,0,420,365,0,0,1,0.5,0.501369833946228,0,0,[]],181,731,[],[],[0,"Default",0,1]],[[73.72660827636719,113.0331192016602,0,96,37,0,0,1,0.5,0.5135135054588318,0,0,[]],182,732,[],[],[0,"Default",0,1]],[[75.37960815429688,170.8838348388672,0,96,37,0,0,1,0.5,0.5135135054588318,0,0,[]],183,733,[],[],[0,"Default",0,1]],[[72.07360076904297,214.6862335205078,0,95,36,0,0,1,0.5052631497383118,0.5,0,0,[]],184,734,[],[],[0,"Default",0,1]],[[77.85816955566406,268.4047546386719,0,120,28,0,0,1,0.5,0.5,0,0,[]],185,735,[],[],[0,"Default",0,1]],[[164.6355133056641,108.0747375488281,0,66,18,0,0,1,0.5,0.5,0,0,[]],186,736,[],[],[0,"Default",0,1]],[[174.5529022216797,240.3055725097656,0,128,26,0,0,1,0.5,0.5,0,0,[]],187,737,[],[],[0,"Default",0,1]],[[246,170,0,128,128,0,-1.570796370506287,1,0,0.5,0,0,[]],175,1077,[],[[]],[50,60,0,100,5,50,0,80,80,0,0,0,-150,0,0,800,0,0,1]],[[713,792,0,80,80,0,0,0.5,0.5,0.5,0,0,[]],162,2860,[[0]],[[]],[0,"Default",0,1]],[[294,381,0,128,128,0,-1.570796370506287,1,0,0.5,0,0,[]],176,1141,[],[[]],[50,60,1,200,10,100,0,30,0,50,20,0,-150,400,0,1000,20,0,1]],[[765,221,0,14,32,0,0,1,1,0.5,0,0,[]],163,2859,[],[[],[0,3,0,"ffffffff",1,0,0.8,0,0,0]],[0,"Default",0,1]],[[71.77729797363281,-223.0133972167969,0,130,130,0,0,1,0.5,0.5,0,0,[]],191,2980,[],[],[0,"Default",0,1]],[[168.1235961914063,-226.1107177734375,0,130,130,0,0,1,0.5,0.5,0,0,[]],192,2981,[],[],[0,"Default",0,1]],[[280.4462890625,-221,0,130,130,0,0,1,0.5,0.5,0,0,[]],193,2982,[],[],[0,"Default",0,1]],[[392,-228,0,130,130,0,0,1,0.5,0.5,0,0,[]],194,2983,[[-1]],[],[0,"Default",0,1]],[[1527.13916015625,-59.91599273681641,0,90.25883483886719,47.57831954956055,0,0,1,0.5,0.5,0,0,[[1,1,1]]],197,618,[["stat2"]],[[]],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","0",0.45,0,0,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[-171.4019317626953,-42.78420257568359,0,137.803955078125,51,0,0,1,0.5,0.5,0,0,[[1,1,1]]],198,28,[["stat2"]],[[]],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","Achieve gold time on the all stage",0.31,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[-171.237060546875,-74.36176300048828,0,198.0888519287109,51,0,-0.03865482658147812,1,0.5,0.5,0,0,[[1,1,1]]],198,619,[["stat2"]],[[]],[41,69,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@°+=*$£€<>%","World Champion!",0.43,0,1,1,1,0,0,0,"{\"\"c2array\"\":true,\"\"size\"\":[2,28,1],\"\"data\"\":[[[11],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[31],[32],[33],[38],[39]],[[\"\" \"\"],[\"\"'\"\"],[\"\"|\"\"],[\"\"il\"\"],[\"\".\"\"],[\"\",;:!(\"\"],[\"\")\"\"],[\"\"]`\"\"],[\"\"\\\"\"[\"\"],[\"\"I1<>\"\"],[\"\"°\"\"],[\"\"EFr\"\"],[\"\"Lf*\"\"],[\"\"Pst23\\\\\"\"],[\"\"HZcvz079$\"\"],[\"\"BRTehj46/\"\"],[\"\"CDJKSUYbuy5?~=£\"\"],[\"\"Ndkox8+\"\"],[\"\"AGVXq-\"\"],[\"\"Qagn€\"\"],[\"\"OWp\"\"],[\"\"M%\"\"],[\"\"&\"\"],[\"\"w\"\"],[\"\"_\"\"],[\"\"#\"\"],[\"\"m\"\"],[\"\"@\"\"]]]}",-1]],[[209,-104,0,46,51,0,0,1,0.5,0.5098039507865906,0,0,[]],204,4,[[4]],[],[0,"Default",0,1]],[[2231,1362,0,1000,1000,0,0,1,0.5,0.5,1,0,[]],205,5080,[],[[1,0.1,0,0,0],[0,0,0,0.1,1]],[0,"Default",0,1]]],[]]],[],[]]],[["FunctionTransitions",[[0,null,false,null,358708107974304,[[92,28,null,2,false,false,false,278730696536677,false,[[1,[2,"goToSceneWithTransition"]]]]],[[91,29,null,746002461368373,false,[[3,10]]],[-1,30,null,585415826190721,false,[[1,[20,92,31,false,null,[[0,0]]]]]]]],[0,null,false,null,426331628193143,[[92,28,null,2,false,false,false,544323912640066,false,[[1,[2,"addTransitionEffect"]]]]],[[91,32,null,506143074887837,false]]]]],["FunctionBase",[[0,null,false,null,898241123373853,[[92,28,null,2,false,false,false,552585792918548,false,[[1,[2,"FunctionSplitToMSM"]]]]],[],[[1,"msecs",0,0,false,false,544609472545447,false],[1,"seconds",0,0,false,false,238769218352724,false],[1,"minutes",0,0,false,false,765893482062075,false],[0,null,false,null,790692996179676,[],[[-1,33,null,822089878037049,false,[[11,"msecs"],[7,[20,92,31,false,null,[[0,0]]]]]],[-1,33,null,765238543118542,false,[[11,"minutes"],[7,[19,34,[[7,[23,"msecs"],[0,6000]]]]]]],[-1,33,null,159812777519944,false,[[11,"seconds"],[7,[5,[19,34,[[7,[23,"msecs"],[0,100]]]],[6,[23,"minutes"],[0,60]]]]]],[-1,33,null,618788321540760,false,[[11,"msecs"],[7,[19,35,[[10,[2,"00"],[23,"msecs"]],[0,2]]]]]],[92,36,null,757845959203661,false,[[7,[10,[10,[10,[10,[19,35,[[10,[2,"00"],[23,"minutes"]],[0,2]]],[2," : "]],[19,35,[[10,[2,"00"],[23,"seconds"]],[0,2]]]],[2," : "]],[19,35,[[10,[2,"00"],[23,"msecs"]],[0,2]]]]]]]]]]],[0,null,false,null,164196139561322,[[92,28,null,2,false,false,false,845306917780954,false,[[1,[2,"FunctionSplitToHMS"]]]]],[],[[1,"seconds",0,0,false,false,309949764795459,false],[1,"minutes",0,0,false,false,485667608098178,false],[1,"hours",0,0,false,false,884696288376785,false],[0,null,false,null,242597983914438,[],[[-1,33,null,632645226631880,false,[[11,"seconds"],[7,[20,92,31,false,null,[[0,0]]]]]],[-1,33,null,856119593762240,false,[[11,"hours"],[7,[19,34,[[7,[23,"seconds"],[0,3600]]]]]]],[-1,33,null,662370337484225,false,[[11,"minutes"],[7,[5,[19,34,[[7,[23,"seconds"],[0,60]]]],[6,[23,"hours"],[0,60]]]]]],[-1,33,null,239424263456435,false,[[11,"seconds"],[7,[19,35,[[10,[2,"00"],[5,[23,"seconds"],[4,[6,[23,"hours"],[0,60]],[6,[23,"minutes"],[0,60]]]]],[0,2]]]]]],[92,36,null,805269679293003,false,[[7,[10,[10,[10,[10,[19,35,[[10,[2,"00"],[23,"hours"]],[0,2]]],[2," : "]],[19,35,[[10,[2,"00"],[23,"minutes"]],[0,2]]]],[2," : "]],[19,35,[[10,[2,"00"],[23,"seconds"]],[0,2]]]]]]]]]]]]],["FunctionStatistics",[[0,null,false,null,645143841474459,[[-1,37,null,0,false,false,false,777178861516726,false,[[0,[1,1]]]]],[],[[0,null,false,null,894644939345059,[],[[92,38,null,121145885704237,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,0]],[7,[4,[20,104,39,false,null,[[0,0],[0,1]]],[0,1]]]]]]]],[0,null,false,null,508525776425413,[[-1,40,null,0,false,false,false,106857313951174,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[92,38,null,805198473201121,false,[[1,[2,"mainMenuUpdateStatistics"]],[13]]]]]]],[0,null,false,null,500733029647638,[[-1,37,null,0,false,false,false,785818259570124,false,[[0,[1,0.05]]]],[141,42,null,0,false,false,false,357206066427822,false,[[10,2],[8,0],[7,[23,"STATE_RUN"]]]]],[],[[0,null,false,null,973358823941896,[[-1,40,null,0,false,false,false,176049032539538,false,[[7,[19,34,[[7,[19,43,[[5,[20,141,44,false,null],[21,141,false,null,23]]]],[0,32]]]]],[8,5],[7,[0,1]]]]],[[92,38,null,247736693035760,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,1]],[7,[4,[20,104,39,false,null,[[0,1],[0,1]]],[0,1]]]]]],[141,45,null,660793498032175,false,[[10,23],[7,[20,141,44,false,null]]]]],[[0,null,false,null,938954834389644,[[-1,40,null,0,false,false,false,381476537400376,false,[[7,[20,104,39,false,null,[[0,1],[0,1]]]],[8,5],[7,[0,1000]]]]],[[92,38,null,692677695663855,false,[[1,[2,"showAchievement"]],[13,[7,[0,3]]]]]]],[0,null,false,null,671330771669298,[[-1,40,null,0,false,false,false,602127291286785,false,[[7,[20,104,39,false,null,[[0,1],[0,1]]]],[8,5],[7,[0,4000]]]]],[[92,38,null,996226728586527,false,[[1,[2,"showAchievement"]],[13,[7,[0,9]]]]]]]]]]],[0,null,false,null,396319269671998,[[141,42,null,0,false,true,false,291224947816107,false,[[10,2],[8,0],[7,[23,"STATE_RUN"]]]]],[[141,45,null,906317659101069,false,[[10,23],[7,[20,141,44,false,null]]]]]]]],["MainMenuEvents",[[1,"typeSave",0,0,false,false,236261074563191,false],[1,"globalScore",0,0,false,false,341756062278291,false],[1,"TypeMenu",0,6,false,false,684185874780761,false],[1,"Sounds",0,1,false,false,672489364244038,false],[1,"Music",0,1,false,false,512220428812955,false],[1,"Quality",0,1,false,false,154143440840700,false],[1,"MENUBACKBUTTON",0,3,false,true,103418646124383,false],[1,"MENUSETTING",0,10,false,true,658960309484863,false],[1,"MENUTOPPANEL",0,5,false,true,355224382872556,false],[1,"MENUCHOOSESLOT",0,6,false,true,350212478023817,false],[1,"MENUGAMEMODE",0,7,false,true,267556668806368,false],[1,"MENUSTATISTICS",0,8,false,true,379692205676934,false],[1,"MENULEVELPAGE1",0,9,false,true,837655114642025,false],[1,"MENULEVELPAGE2",0,10,false,true,461660221983028,false],[1,"MENULEVELPAGE3",0,11,false,true,576412461215650,false],[1,"MENULEVELPAGE4",0,12,false,true,479043876236485,false],[1,"MENULEVELPAGE5",0,13,false,true,631312545549186,false],[1,"MENUprevious",0,0,false,false,325249360947386,false],[1,"MENUlevelsPrevious",0,0,false,false,902887203850076,false],[0,[true,"IDnet"],false,null,225704389565351,[[-1,46,null,0,false,false,false,225704389565351,false,[[1,[2,"IDnet"]]]]],[],[[0,null,false,null,423238068775949,[[-1,47,null,1,false,false,false,674149701308904,false],[93,48,null,0,false,true,false,537855405963249,false]],[[93,49,null,842247269611974,false,[[1,[2,"59b0371cbbddbd26c17a9723"]]]]]],[0,null,false,null,600402588475997,[[93,50,null,0,false,false,false,556711457782207,false],[51,51,null,0,false,false,true,986927350630627,false,[[0,[0,23]]]]],[[51,52,null,750630046635441,false,[[7,[20,93,53,true,null]]]],[51,54,null,230939883741288,false,[[3,1]]],[50,55,null,617957498476729,false,[[1,[2,"welcome"]],[3,1]]]]],[0,null,false,null,785901247131336,[[92,28,null,2,false,false,false,908865573646524,false,[[1,[2,"showIDNETScoreboard"]]]]],[[93,56,null,767779175483887,false,[[1,[2,"Leaderboard"]],[1,[2,"alltime"]],[0,[0,1]]]]]],[0,null,false,null,217706473906357,[[92,28,null,2,false,false,false,446994757759894,false,[[1,[2,"showIDNETAchievement"]]]]],[[93,57,null,413083389808696,false]]],[0,null,false,null,375680895651833,[[92,28,null,2,false,false,false,757688686979697,false,[[1,[2,"showRegistration"]]]]],[[93,58,null,178501327613368,false]]],[0,null,false,null,914259923846230,[[92,28,null,2,false,false,false,599569415001273,false,[[1,[2,"addToScoreboard"]]]]],[[93,59,null,394787746501002,false,[[0,[20,92,31,false,null,[[0,0]]]],[1,[2,"Leaderboard"]],[0,[0,0]],[0,[0,1]],[1,[2,""]]]]]],[0,null,false,null,382163466001558,[[93,60,null,0,false,true,false,693763487679241,false],[-1,40,null,0,false,false,false,812384182045306,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[],[[0,null,false,null,728059600053669,[[97,61,null,1,false,false,false,527173276132602,false,[[4,4]]],[-1,62,null,0,false,false,false,706307544149264,false,[[5,[20,4,63,true,null]]]]],[[92,38,null,212139622968882,false,[[1,[2,"showIDNETAchievement"]],[13]]]]],[0,null,false,null,195303392295834,[[97,61,null,1,false,false,false,954027671905274,false,[[4,30]]],[-1,62,null,0,false,false,false,715965812454605,false,[[5,[20,30,63,true,null]]]]],[[92,38,null,445067972542101,false,[[1,[2,"showIDNETAchievement"]],[13]]]]],[0,null,false,null,654580176412924,[[97,61,null,1,false,false,false,574682473878352,false,[[4,11]]],[-1,62,null,0,false,false,false,140391028810647,false,[[5,[20,11,63,true,null]]]]],[[92,38,null,738694053392954,false,[[1,[2,"showIDNETScoreboard"]],[13]]]]],[0,null,false,null,750874759606080,[[97,61,null,1,false,false,false,654438028332299,false,[[4,29]]],[-1,62,null,0,false,false,false,194297662649711,false,[[5,[20,29,63,true,null]]]]],[[92,38,null,712673815950600,false,[[1,[2,"showIDNETScoreboard"]],[13]]]]]]],[0,null,false,null,176703440212767,[[-1,37,null,0,false,false,false,743593691089544,false,[[0,[1,1]]]]],[],[[0,null,false,null,330834178846501,[[93,64,null,0,false,false,false,480395461538170,false]],[[-1,65,null,788087984913345,false,[[6,"BlackScreen"]]]]]]]]],[0,[true,"Choose Type Slot"],false,null,800196327120838,[[-1,46,null,0,false,false,false,800196327120838,false,[[1,[2,"Choose Type Slot"]]]]],[],[[0,null,false,null,143082451737239,[[97,61,null,1,false,false,false,632608846443709,false,[[4,9]]],[-1,62,null,0,false,false,false,953866661980450,false,[[5,[20,9,63,true,null]]]],[93,60,null,0,false,true,false,833921418801265,false],[-1,40,null,0,false,false,false,324074949266963,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[-1,33,null,620644180827625,false,[[11,"typeSave"],[7,[0,0]]]],[92,38,null,833801761650225,false,[[1,[2,"loadGame"]],[13,[7,[23,"typeSave"]]]]],[92,38,null,756063781201208,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUGAMEMODE"]]]]]],[[0,null,false,null,480967599806025,[[93,66,null,0,false,false,false,367917789710877,false]],[[28,67,null,958815417537804,false],[35,67,null,880389137026960,false]]]]],[0,null,false,null,393366597126604,[[97,61,null,1,false,false,false,474482549438330,false,[[4,10]]],[-1,62,null,0,false,false,false,141824747270144,false,[[5,[20,10,63,true,null]]]],[93,60,null,0,false,true,false,508136694681711,false],[-1,40,null,0,false,false,false,859872775567322,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[],[[0,null,false,null,214169808493914,[[93,68,null,0,false,false,false,116211758285414,false]],[[92,38,null,618349027515559,false,[[1,[2,"showRegistration"]],[13]]]]],[0,null,false,null,294001934832778,[[-1,69,null,0,false,false,false,692584575793955,false]],[[-1,33,null,486810279609588,false,[[11,"typeSave"],[7,[0,1]]]],[92,38,null,436071228259041,false,[[1,[2,"loadGame"]],[13,[7,[23,"typeSave"]]]]],[92,38,null,570790744574004,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUGAMEMODE"]]]]]],[[0,null,false,null,275241376811573,[[93,66,null,0,false,false,false,738606625592851,false]],[[28,67,null,466253158578663,false],[35,67,null,592625247601122,false]]]]]]]]],[0,[true,"Choose Play"],false,null,241440610073998,[[-1,46,null,0,false,false,false,241440610073998,false,[[1,[2,"Choose Play"]]]]],[],[[0,null,false,null,210073375041515,[[97,61,null,1,false,false,false,701040434257007,false,[[4,8]]],[-1,62,null,0,false,false,false,307055703242249,false,[[5,[20,8,63,true,null]]]],[93,60,null,0,false,true,false,705077161243881,false],[-1,40,null,0,false,false,false,990044051248727,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[92,38,null,513332970899092,false,[[1,[2,"UpdateMenu"]],[13,[7,[18,[12,[23,"MENUlevelsPrevious"],[0,0]],[23,"MENULEVELPAGE1"],[23,"MENUlevelsPrevious"]]]]]]]]]],[0,[true,"Beginning and trans menu"],false,null,276186570947931,[[-1,46,null,0,false,false,false,276186570947931,false,[[1,[2,"Beginning and trans menu"]]]]],[],[[0,null,false,null,994015752331896,[[-1,47,null,1,false,false,false,187434932861759,false]],[[92,38,null,926210516696320,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"TypeMenu"]]]]]]],[0,null,false,null,543951975154684,[[92,28,null,2,false,false,false,162212510088904,false,[[1,[2,"UpdateMenu"]]]]],[[98,70,null,291134419281679,false,[[2,["ui_plop",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]],[-1,71,null,440592425272050,false,[[5,[23,"MENUTOPPANEL"]],[3,0]]],[-1,71,null,801474147514879,false,[[5,[23,"MENUCHOOSESLOT"]],[3,0]]],[-1,71,null,269965497622906,false,[[5,[23,"MENUGAMEMODE"]],[3,0]]],[-1,71,null,237738074752054,false,[[5,[23,"MENULEVELPAGE1"]],[3,0]]],[-1,71,null,249730315070338,false,[[5,[23,"MENULEVELPAGE2"]],[3,0]]],[-1,71,null,371382993365968,false,[[5,[23,"MENULEVELPAGE3"]],[3,0]]],[-1,71,null,549102352167766,false,[[5,[23,"MENULEVELPAGE4"]],[3,0]]],[-1,71,null,542195099626750,false,[[5,[23,"MENULEVELPAGE5"]],[3,0]]],[-1,71,null,560757734443696,false,[[5,[23,"MENUSTATISTICS"]],[3,0]]],[-1,71,null,440686930151145,false,[[5,[0,14]],[3,0]]]],[[0,null,false,null,121359364654691,[],[[-1,71,null,319663922670122,false,[[5,[23,"MENUBACKBUTTON"]],[3,1]]],[-1,71,null,387309151166636,false,[[5,[20,92,31,false,null,[[0,0]]]],[3,1]]],[-1,33,null,523353965399526,false,[[11,"TypeMenu"],[7,[20,92,31,false,null,[[0,0]]]]]]]],[0,null,false,null,365679415980386,[[-1,72,null,0,false,false,false,299355065361168,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENUCHOOSESLOT"]]]]],[[-1,71,null,215629360894163,false,[[5,[23,"MENUBACKBUTTON"]],[3,0]]]]],[0,null,true,null,917957588749736,[[-1,72,null,0,false,false,false,812272784882706,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE1"]]]],[-1,72,null,0,false,false,false,759635141587865,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE2"]]]],[-1,72,null,0,false,false,false,358448062751169,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE3"]]]],[-1,72,null,0,false,false,false,206247727179533,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE4"]]]],[-1,72,null,0,false,false,false,959487310423626,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE5"]]]]],[[-1,71,null,201512564229506,false,[[5,[23,"MENUTOPPANEL"]],[3,1]]],[-1,33,null,885429201774349,false,[[11,"MENUlevelsPrevious"],[7,[23,"TypeMenu"]]]],[92,38,null,268356579057463,false,[[1,[2,"menuUpdateLevelStats"]],[13]]]]],[0,null,false,null,157487569070260,[[-1,72,null,0,false,false,false,668177552001126,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENUSTATISTICS"]]]]],[[-1,71,null,712049907097268,false,[[5,[23,"MENUTOPPANEL"]],[3,1]]],[-1,71,null,139821943895054,false,[[5,[23,"MENUTOPPANEL"]],[3,0]]],[-1,71,null,397519964948728,false,[[5,[23,"MENUBACKBUTTON"]],[3,0]]]]],[0,null,false,null,110104331748644,[],[[92,38,null,762226144941103,false,[[1,[2,"UpdateEffects"]],[13]]]]]]],[1,"effectNumber",0,0,false,false,798631134071903,false],[0,null,false,null,949387828447732,[[92,28,null,2,false,false,false,952673597144660,false,[[1,[2,"UpdateEffects"]]]]],[],[[1,"effectPrevious",0,0,false,false,136372785655805,false],[0,null,false,null,887246928031923,[],[],[[0,null,false,null,434288450246604,[],[[-1,33,null,158788866286833,false,[[11,"effectPrevious"],[7,[23,"effectNumber"]]]],[-1,33,null,982308782124189,false,[[11,"effectNumber"],[7,[19,73,[[19,74,[[0,0],[0,3]]]]]]]]]],[0,null,false,null,623725217482295,[[-1,40,null,0,false,false,false,227336716924420,false,[[7,[23,"effectNumber"]],[8,0],[7,[23,"effectPrevious"]]]]],[],[[0,null,false,null,921237955739707,[[-1,40,null,0,false,false,false,883043366879262,false,[[7,[23,"effectPrevious"]],[8,0],[7,[0,2]]]]],[[-1,33,null,313211541404345,false,[[11,"effectNumber"],[7,[0,1]]]]]],[0,null,false,null,134194955562962,[[-1,40,null,0,false,false,false,118511468783529,false,[[7,[23,"effectPrevious"]],[8,0],[7,[0,1]]]]],[[-1,33,null,218180983015081,false,[[11,"effectNumber"],[7,[0,0]]]]]],[0,null,false,null,240842059178848,[[-1,40,null,0,false,false,false,514053214745914,false,[[7,[23,"effectPrevious"]],[8,0],[7,[0,0]]]]],[[-1,33,null,767763565132433,false,[[11,"effectNumber"],[7,[0,2]]]]]]]]]],[0,null,false,null,959709655962054,[],[[-1,33,null,424753257228633,false,[[11,"effectPrevious"],[7,[23,"effectNumber"]]]],[216,75,null,649050516148160,false,[[1,[2,"Tint"]],[0,[0,0]],[0,[20,101,39,false,null,[[23,"effectNumber"],[0,0]]]]]],[216,75,null,199466357546021,false,[[1,[2,"Tint"]],[0,[0,1]],[0,[20,101,39,false,null,[[23,"effectNumber"],[0,1]]]]]],[216,75,null,121353013007781,false,[[1,[2,"Tint"]],[0,[0,2]],[0,[20,101,39,false,null,[[23,"effectNumber"],[0,2]]]]]]]]]]]],[0,[true,"Back"],false,null,904125666568302,[[-1,46,null,0,false,false,false,904125666568302,false,[[1,[2,"Back"]]]]],[],[[0,null,false,null,887209792641333,[[97,61,null,1,false,false,false,190623857138667,false,[[4,5]]],[-1,62,null,0,false,false,false,196653795518768,false,[[5,[20,5,63,true,null]]]],[93,60,null,0,false,true,false,116204948128082,false],[-1,40,null,0,false,false,false,106753959559710,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[],[[0,null,false,null,199485272668112,[[-1,72,null,0,false,false,false,282338938226377,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENUGAMEMODE"]]]]],[[92,38,null,101820157338362,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUCHOOSESLOT"]]]]]]],[0,null,true,null,362839975839854,[[-1,72,null,0,false,false,false,910125425844816,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE1"]]]],[-1,72,null,0,false,false,false,358545381602593,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE2"]]]],[-1,72,null,0,false,false,false,189792347843970,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE3"]]]],[-1,72,null,0,false,false,false,716940724587785,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE4"]]]],[-1,72,null,0,false,false,false,919484937381696,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE5"]]]]],[[92,38,null,920653942595857,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUGAMEMODE"]]]]]]],[0,null,false,null,341299746192537,[[-1,72,null,0,false,false,false,103948338168540,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENUSTATISTICS"]]]]],[[92,38,null,141321048710606,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUprevious"]]]]]]]]]]],[0,[true,"chooseLevels"],false,null,835987463078811,[[-1,46,null,0,false,false,false,835987463078811,false,[[1,[2,"chooseLevels"]]]]],[],[[0,null,false,null,535036730876480,[[217,76,null,1,false,false,false,633383460869098,false]],[],[[0,null,false,null,192030845716612,[],[[-1,77,null,465678566575323,false,[[4,78],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,1]]],[0,[5,[20,217,78,false,null],[0,180]]]]],[-1,77,null,425623820579231,false,[[4,199],[5,[20,217,63,true,null]],[0,[20,217,44,false,null]],[0,[20,217,78,false,null]]]],[217,45,null,628386735434447,false,[[10,9],[7,[20,199,79,false,null]]]],[217,45,null,867050752699758,false,[[10,2],[7,[20,196,80,false,null]]]],[78,81,null,448599274618174,false,[[0,[21,217,false,null,0]]]],[-1,77,null,376550824410902,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,4]]],[0,[5,[20,217,78,false,null],[0,119]]]]],[217,45,null,531762646885933,false,[[10,1],[7,[20,196,80,false,null]]]],[196,82,null,387368046496851,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,819050523169469,false,[[10,1],[7,[0,0]]]],[-1,77,null,948756135636959,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,17]]],[0,[5,[20,217,78,false,null],[0,88]]]]],[217,45,null,906819577425263,false,[[10,2],[7,[20,196,80,false,null]]]],[196,82,null,716997752971262,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,639463506473883,false,[[10,1],[7,[0,1]]]],[-1,77,null,449470459718146,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,18]]],[0,[5,[20,217,78,false,null],[0,58]]]]],[217,45,null,114884240283802,false,[[10,3],[7,[20,196,80,false,null]]]],[196,82,null,492655770554878,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,760681311716492,false,[[10,1],[7,[0,2]]]],[-1,77,null,376067417567504,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,17]]],[0,[5,[20,217,78,false,null],[0,28]]]]],[217,45,null,775313229029517,false,[[10,4],[7,[20,196,80,false,null]]]],[196,82,null,519002475850456,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,211824894964389,false,[[10,1],[7,[0,3]]]],[-1,77,null,836587654359465,false,[[4,77],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,4]]],[0,[5,[20,217,78,false,null],[0,0]]]]],[217,45,null,667722895068025,false,[[10,5],[7,[20,77,79,false,null]]]],[77,45,null,734620611502278,false,[[10,0],[7,[21,217,false,null,0]]]],[77,83,null,156102726368468,false,[[3,0]]],[-1,77,null,645844929073740,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,16]]],[0,[4,[20,217,78,false,null],[0,49]]]]],[217,45,null,598088135310520,false,[[10,6],[7,[20,196,80,false,null]]]],[196,82,null,609565466146524,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,717710163925034,false,[[10,1],[7,[0,4]]]],[196,84,null,271664642093401,false,[[7,[2,"0/50"]]]],[-1,77,null,602644923444984,false,[[4,76],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,6]]],[0,[4,[20,217,78,false,null],[0,77]]]]],[217,45,null,298890707231773,false,[[10,7],[7,[20,76,79,false,null]]]],[76,45,null,190468078713633,false,[[10,0],[7,[21,217,false,null,0]]]],[76,83,null,600098015123487,false,[[3,0]]],[-1,77,null,757388778040902,false,[[4,196],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,20]]],[0,[4,[20,217,78,false,null],[0,125]]]]],[217,45,null,682736053007499,false,[[10,8],[7,[20,196,80,false,null]]]],[196,82,null,965058007164770,false,[[10,0],[7,[21,217,false,null,0]]]],[196,82,null,124731020428717,false,[[10,1],[7,[0,5]]]],[196,84,null,871360809454475,false,[[7,[2,"x 0"]]]],[-1,77,null,789659618386529,false,[[4,33],[5,[20,217,63,true,null]],[0,[4,[20,217,44,false,null],[0,4]]],[0,[4,[20,217,78,false,null],[0,193]]]]],[33,45,null,495190244821858,false,[[10,2],[7,[21,217,false,null,0]]]],[-1,77,null,416908066251421,false,[[4,69],[5,[20,217,63,true,null]],[0,[20,217,44,false,null]],[0,[20,217,78,false,null]]]]]]]],[0,null,false,null,889501430776855,[],[]],[0,null,false,null,373272596312386,[[97,61,null,1,false,false,false,843226139142515,false,[[4,39]]],[39,85,null,0,false,false,false,145663450324710,false,[[5,[23,"TypeMenu"]]]],[93,60,null,0,false,true,false,502046507712142,false],[-1,40,null,0,false,false,false,999111095903864,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[92,38,null,653138603443116,false,[[1,[2,"menuUpdateLevelStats"]],[13]]]],[[0,null,false,null,706324538031756,[[-1,72,null,0,false,false,false,671264834390144,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE4"]]]]],[[92,38,null,631160637355717,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE5"]]]]]]],[0,null,false,null,692982793000738,[[-1,72,null,0,false,false,false,530757330412259,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE3"]]]]],[[92,38,null,429181683388401,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE4"]]]]]]],[0,null,false,null,137962009235186,[[-1,72,null,0,false,false,false,452409929725871,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE2"]]]]],[[92,38,null,938727507931018,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE3"]]]]]]],[0,null,false,null,344902430235979,[[-1,72,null,0,false,false,false,801123881488945,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE1"]]]]],[[92,38,null,749408730079089,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE2"]]]]]]]]],[0,null,false,null,195882245434132,[[97,61,null,1,false,false,false,679262292415379,false,[[4,40]]],[40,85,null,0,false,false,false,112939054585130,false,[[5,[23,"TypeMenu"]]]],[93,60,null,0,false,true,false,113221638425970,false],[-1,40,null,0,false,false,false,536811172718964,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[92,38,null,618135118018829,false,[[1,[2,"menuUpdateLevelStats"]],[13]]]],[[0,null,false,null,543509892072575,[[-1,72,null,0,false,false,false,516766604303610,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE2"]]]]],[[92,38,null,100124355293970,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE1"]]]]]]],[0,null,false,null,823981359088437,[[-1,72,null,0,false,false,false,671773564519275,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE3"]]]]],[[92,38,null,221447829038311,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE2"]]]]]]],[0,null,false,null,277897904386803,[[-1,72,null,0,false,false,false,503762448824553,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE4"]]]]],[[92,38,null,503724721024036,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE3"]]]]]]],[0,null,false,null,118302058218565,[[-1,72,null,0,false,false,false,565832237541543,false,[[11,"TypeMenu"],[8,0],[7,[23,"MENULEVELPAGE5"]]]]],[[92,38,null,800436964941358,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENULEVELPAGE4"]]]]]]]]],[0,null,false,null,125065438296814,[[92,28,null,2,false,false,false,322921424327741,false,[[1,[2,"menuUpdateLevelStats"]]]]],[],[[0,null,false,null,673797209998666,[[-1,86,null,0,true,false,false,354536787913632,false,[[4,217]]]],[],[[0,null,false,null,269719132994291,[[196,87,null,0,false,false,true,491934479772637,false,[[0,[21,217,false,null,1]]]]],[[92,38,null,909995457185922,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]]]]],[196,84,null,821028842511829,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,942303267324989,[[196,87,null,0,false,false,true,560412735548222,false,[[0,[21,217,false,null,2]]]]],[[92,38,null,199330895115617,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[21,217,false,null,0],[0,0]]]]]]],[196,84,null,589117952744789,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,786862212577849,[[196,87,null,0,false,false,true,548693652534620,false,[[0,[21,217,false,null,3]]]]],[[92,38,null,575903319390906,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[21,217,false,null,0],[0,1]]]]]]],[196,84,null,711262446174702,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,882617330805642,[[196,87,null,0,false,false,true,307804141015797,false,[[0,[21,217,false,null,4]]]]],[[92,38,null,608852604459429,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[21,217,false,null,0],[0,2]]]]]]],[196,84,null,599465227283101,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,518028994574409,[[196,87,null,0,false,false,true,917759178477927,false,[[0,[21,217,false,null,6]]]]],[[196,84,null,668891273164506,false,[[7,[19,89,[[10,[10,[20,103,39,false,null,[[21,217,false,null,0],[0,1]]],[2,"/"]],[20,102,39,false,null,[[21,217,false,null,0],[0,3]]]]]]]]]]],[0,null,false,null,642843402094283,[[76,90,null,0,false,false,true,958003322793020,false,[[0,[21,217,false,null,7]]]]],[],[[0,null,false,null,645210389843723,[[-1,40,null,0,false,false,false,590493368159638,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,2]]]],[8,0],[7,[0,0]]]]],[[76,83,null,679997791167821,false,[[3,0]]]]],[0,null,false,null,420772272836716,[[-1,40,null,0,false,false,false,739604171953809,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,2]]]],[8,0],[7,[0,1]]]]],[[76,83,null,553482476142007,false,[[3,1]]]]]]],[0,null,false,null,741643121440524,[[196,87,null,0,false,false,true,524005170053604,false,[[0,[21,217,false,null,8]]]]],[[196,84,null,439338597524790,false,[[7,[10,[2,"x "],[20,103,39,false,null,[[21,217,false,null,0],[0,3]]]]]]]]],[0,null,false,null,550129835658264,[[77,90,null,0,false,false,true,675390957297070,false,[[0,[21,217,false,null,5]]]]],[],[[0,null,false,null,147364956195164,[[-1,40,null,0,false,false,false,552462176988825,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,1]]]],[8,5],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,3]]]]]],[-1,40,null,0,false,false,false,583171193837456,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,0]]]]]],[-1,40,null,0,false,true,false,191502763269888,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,0],[7,[0,0]]]],[-1,40,null,0,false,false,false,968400124619545,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,3]]]],[8,0],[7,[0,0]]]],[-1,40,null,0,false,false,false,966704626858590,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,2]]]],[8,5],[7,[0,1]]]]],[[77,83,null,397591363651540,false,[[3,1]]]]]]],[0,null,false,null,368230369685008,[[199,90,null,0,false,false,true,907357866712173,false,[[0,[21,217,false,null,9]]]]],[],[[0,null,false,null,747171793060313,[[-1,40,null,0,false,false,false,534621816207559,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,2]]]]]]],[[199,55,null,944264585626908,false,[[1,[2,"bronze"]],[3,1]]]]],[0,null,false,null,285367263919947,[[-1,40,null,0,false,false,false,620546061671762,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,1]]]]]]],[[199,55,null,718644924708566,false,[[1,[2,"silver"]],[3,1]]]]],[0,null,false,null,365178588272666,[[-1,40,null,0,false,false,false,602680775302915,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,0]]]]]]],[[199,55,null,162026327203587,false,[[1,[2,"gold"]],[3,1]]]]],[0,null,true,null,519938145914373,[[-1,40,null,0,false,false,false,119313943459815,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,4],[7,[20,102,39,false,null,[[21,217,false,null,0],[0,2]]]]]],[-1,40,null,0,false,false,false,729216441269221,false,[[7,[20,103,39,false,null,[[21,217,false,null,0],[0,0]]]],[8,0],[7,[0,0]]]]],[[199,55,null,377548898481463,false,[[1,[2,"none"]],[3,1]]]]]]]]]]],[0,null,false,null,631259062445627,[[97,61,null,1,false,false,false,850733052437988,false,[[4,33]]],[33,85,null,0,false,false,false,526150754579529,false,[[5,[23,"TypeMenu"]]]],[93,60,null,0,false,true,false,150858107296264,false],[-1,40,null,0,false,false,false,481745222134931,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]],[33,91,null,0,false,false,false,129957379791872,false,[[1,[2,"norm"]]]]],[],[[0,null,false,null,734482912695781,[],[[98,70,null,326679413844535,false,[[2,["ui_start",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]],[92,38,null,861032099389257,false,[[1,[2,"addTransitionEffect"]],[13]]],[-1,92,null,875165251849037,false,[[0,[1,0.1]]]],[92,38,null,815481878958582,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[10,[2,"level"],[21,33,false,null,2]]]]]]]]]],[0,null,false,null,530834968797979,[[97,61,null,1,false,false,false,805714922146814,false,[[4,33]]],[33,85,null,0,false,false,false,440466587819735,false,[[5,[23,"TypeMenu"]]]],[93,60,null,0,false,true,false,855129475964586,false],[-1,40,null,0,false,false,false,806175772398312,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]],[33,91,null,0,false,false,false,880932757296210,false,[[1,[2,"login"]]]]],[],[[0,null,false,null,743337638741920,[],[[98,70,null,872795771700333,false,[[2,["ui_start",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]],[93,58,null,590094638404401,false]]]]],[0,null,false,null,244667770782568,[[-1,86,null,0,true,false,false,282745209068565,false,[[4,33]]],[33,42,null,0,false,true,false,483277030032347,false,[[10,2],[8,0],[7,[0,0]]]]],[],[[0,null,false,null,619001838749708,[],[[33,55,null,253599838495882,false,[[1,[2,"block"]],[3,1]]]]],[0,null,false,null,732674789384363,[[-1,40,null,0,false,false,false,240544867320047,false,[[7,[20,103,39,false,null,[[5,[21,33,false,null,2],[0,1]],[0,0]]]],[8,4],[7,[0,0]]]]],[[33,55,null,432123702201625,false,[[1,[2,"norm"]],[3,1]]]]]]],[0,null,false,null,764461512682694,[[-1,86,null,0,true,false,false,386825916841709,false,[[4,33]]],[33,42,null,0,false,false,false,516500593968983,false,[[10,2],[8,5],[7,[0,10]]]]],[],[[0,null,false,null,483171406073658,[[93,68,null,0,false,false,false,471547016113866,false]],[[33,55,null,247743955877448,false,[[1,[2,"login"]],[3,1]]]]],[0,null,false,null,364004067167947,[[-1,69,null,0,false,false,false,320988093564908,false]],[[33,55,null,620681981319323,false,[[1,[2,"norm"]],[3,1]]]]]]]]],[0,[true,"statistics"],false,null,958374014661280,[[-1,46,null,0,false,false,false,958374014661280,false,[[1,[2,"statistics"]]]]],[],[[0,null,false,null,440490670761800,[[97,61,null,1,false,false,false,473846090567806,false,[[4,27]]],[27,85,null,0,false,false,false,405772559708836,false,[[5,[23,"TypeMenu"]]]],[93,60,null,0,false,true,false,382713920467529,false],[-1,40,null,0,false,false,false,592767522622094,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[92,38,null,570886905504875,false,[[1,[2,"mainMenuOpenStatistics"]],[13,[7,[23,"TypeMenu"]]]]]]],[0,null,false,null,306462008766923,[[97,61,null,1,false,false,false,876800908992370,false,[[4,18]]],[-1,62,null,0,false,false,false,632813817085846,false,[[5,[20,18,63,true,null]]]],[93,60,null,0,false,true,false,374888630945510,false],[-1,40,null,0,false,false,false,840604945732923,false,[[7,[23,"GameIsPaused"]],[8,0],[7,[0,0]]]]],[[92,38,null,947775847481927,false,[[1,[2,"mainMenuOpenStatistics"]],[13,[7,[23,"TypeMenu"]]]]]]],[0,null,false,null,728532185777617,[[92,28,null,2,false,false,false,517982977869444,false,[[1,[2,"mainMenuOpenStatistics"]]]]],[[92,38,null,846432936137849,false,[[1,[2,"mainMenuUpdateStatistics"]],[13]]]],[[0,null,false,null,543101686027661,[],[[-1,33,null,501369681059610,false,[[11,"MENUprevious"],[7,[18,[11,[12,[20,92,31,false,null,[[0,0]]],[0,7]],[10,[17,[20,92,31,false,null,[[0,0]]],[0,9]],[15,[20,92,31,false,null,[[0,0]]],[0,13]]]],[20,92,31,false,null,[[0,0]]],[23,"MENUprevious"]]]]]]],[0,null,false,null,888019713228310,[],[[92,38,null,959806556324559,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUSTATISTICS"]]]]]]]]],[0,null,false,null,223173629469658,[[97,61,null,1,false,false,false,212042512332988,false,[[4,6]]],[-1,62,null,0,false,false,false,827786297123980,false,[[5,[20,6,63,true,null]]]],[6,42,null,0,false,false,false,240503779178593,false,[[10,2],[8,0],[7,[2,"statistics"]]]]],[[92,38,null,156902549026721,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"MENUprevious"]]]]]]],[0,null,false,null,825187157534162,[],[]],[0,null,false,null,936764164225336,[[92,28,null,2,false,false,false,232442249225188,false,[[1,[2,"mainMenuUpdateStatistics"]]]]],[],[[0,null,false,null,799764193091116,[[195,93,null,0,false,false,false,695761139679488,false,[[10,0],[8,0],[7,[2,"stat0"]]]]],[[92,38,null,617153570959547,false,[[1,[2,"FunctionSplitToHMS"]],[13,[7,[20,104,39,false,null,[[0,0],[0,1]]]]]]],[195,84,null,406758539739238,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,573912765362979,[[195,93,null,0,false,false,false,610050151733914,false,[[10,0],[8,0],[7,[2,"stat1"]]]]],[[195,84,null,854229550424586,false,[[7,[10,[20,104,39,false,null,[[0,1],[0,1]]],[2,"m"]]]]]]],[0,null,false,null,716828682422174,[[195,93,null,0,false,false,false,241206366053209,false,[[10,0],[8,0],[7,[2,"stat2"]]]]],[[195,84,null,190025897861292,false,[[7,[20,104,39,false,null,[[0,2],[0,1]]]]]]]],[0,null,false,null,639767166039168,[[195,93,null,0,false,false,false,125917508716028,false,[[10,0],[8,0],[7,[2,"stat3"]]]]],[[195,84,null,827016845988392,false,[[7,[10,[20,104,39,false,null,[[0,3],[0,1]]],[2,"/12"]]]]]]],[0,null,false,null,170628802024924,[[195,93,null,0,false,false,false,507015903269075,false,[[10,0],[8,0],[7,[2,"stat4"]]]]],[[195,84,null,151366045366410,false,[[7,[10,[20,104,39,false,null,[[0,4],[0,1]]],[2,"/15"]]]]]]],[0,null,false,null,124903582715144,[[195,93,null,0,false,false,false,766815907223435,false,[[10,0],[8,0],[7,[2,"stat5"]]]]],[[195,84,null,788627248548098,false,[[7,[20,104,39,false,null,[[0,5],[0,1]]]]]]]],[0,null,false,null,758414046102607,[[195,93,null,0,false,false,false,492170053713143,false,[[10,0],[8,0],[7,[2,"stat6"]]]]],[[195,84,null,291741360079416,false,[[7,[20,104,39,false,null,[[0,6],[0,1]]]]]]]],[0,null,false,null,786923521637444,[[195,93,null,0,false,false,false,623787652381684,false,[[10,0],[8,0],[7,[2,"stat7"]]]]],[[195,84,null,649695957813212,false,[[7,[10,[20,104,39,false,null,[[0,7],[0,1]]],[2,"/700"]]]]]]],[0,null,false,null,900888798183917,[[195,93,null,0,false,false,false,754333681360648,false,[[10,0],[8,0],[7,[2,"stat8"]]]]],[[195,84,null,246787256655797,false,[[7,[10,[20,104,39,false,null,[[0,8],[0,1]]],[2,"/12"]]]]]]],[0,null,false,null,499337958083333,[[195,93,null,0,false,false,false,259004572762053,false,[[10,0],[8,0],[7,[2,"stat9"]]]]],[[195,84,null,474242982345295,false,[[7,[20,104,39,false,null,[[0,9],[0,1]]]]]]]]]]]],[0,null,false,null,959746561380123,[[196,94,null,1,false,false,false,172895088017587,false]],[[196,95,null,945237793933852,false,[[0,[20,196,96,false,null]],[0,[5,[20,196,97,false,null],[0,5]]]]]]]]],["SponsorLinks",[[1,"GAME",1,"stickman_boost",false,true,612358500251687,false],[0,null,false,null,953403908696527,[[94,98,null,0,false,false,false,144472192840792,false,[[4,3]]],[93,66,null,0,false,true,false,975840264035846,false]],[],[[0,null,true,null,769873447481886,[[-1,62,null,0,false,false,false,392389649151752,false,[[5,[0,2]]]],[-1,62,null,0,false,false,false,289254793982217,false,[[5,[0,0]]]]],[[94,99,null,180662214895905,false,[[3,1]]]]]]],[0,null,false,null,223998775224629,[[-1,69,null,0,false,false,false,838408325515991,false],[94,98,null,0,false,false,false,346234637933734,false,[[4,2]]]],[],[[0,null,true,null,737361470552229,[[-1,62,null,0,false,false,false,621675324602461,false,[[5,[0,2]]]],[-1,62,null,0,false,false,false,520276782978184,false,[[5,[0,0]]]]],[[94,99,null,825527035662365,false,[[3,1]]]]]]],[0,null,false,null,747992038335500,[[-1,69,null,0,false,false,false,303281431804487,false]],[[94,99,null,744395618972515,false,[[3,0]]]]],[0,null,false,null,906049940428880,[[97,61,null,1,false,false,false,540257237376281,false,[[4,3]]]],[],[[0,null,true,null,832622880815369,[[-1,62,null,0,false,false,false,696978857231004,false,[[5,[0,2]]]],[-1,62,null,0,false,false,false,789172059738009,false,[[5,[0,0]]]]],[]],[1,"place",1,"",false,false,101747284609100,false],[0,null,false,null,549918877259062,[],[],[[0,null,false,null,541247164770078,[[93,66,null,0,false,true,false,195297122619155,false]],[],[[0,null,false,null,422674920928503,[[-1,40,null,0,false,false,false,149699533804199,false,[[7,[19,41]],[8,0],[7,[2,"preloader"]]]]],[[-1,33,null,946564927458893,false,[[11,"place"],[7,[2,"g_prelogo"]]]]]],[0,null,false,null,217830454781311,[[-1,69,null,0,false,false,false,770504033109374,false]],[[-1,33,null,337291321265028,false,[[11,"place"],[7,[2,"g_menulogo"]]]]]],[0,null,false,null,691769143988080,[],[[96,100,null,243927007309887,false,[[1,[10,[10,[10,[10,[10,[2,"http://www.y8.com/?utm_source="],[20,96,101,true,null]],[2,"&utm_medium="]],[23,"place"]],[2,"&utm_campaign="]],[23,"GAME"]]],[1,[10,[10,[10,[10,[10,[2,"http://www.y8.com/?utm_source="],[20,96,101,true,null]],[2,"&utm_medium="]],[23,"place"]],[2,"&utm_campaign="]],[23,"GAME"]]]]]]]]]]]]],[0,null,false,null,586361650358224,[[97,61,null,1,false,false,false,985888975966826,false,[[4,2]]]],[],[[0,null,true,null,130813879377684,[[-1,62,null,0,false,false,false,440182733916055,false,[[5,[0,2]]]],[-1,62,null,0,false,false,false,184873845575388,false,[[5,[0,0]]]]],[[96,100,null,990360911033029,false,[[1,[2,"https://www.id.net"]],[1,[2,"https://www.id.net"]]]]]]]],[0,null,false,null,952572341262988,[[97,61,null,1,false,false,false,929823813208309,false,[[4,28]]],[-1,62,null,0,false,false,false,830322014576140,false,[[5,[20,28,63,true,null]]]]],[],[[1,"place",1,"",false,false,385687432662057,false],[0,null,false,null,153317943082982,[[93,66,null,0,false,true,false,970490231748590,false]],[[-1,33,null,556364895772835,false,[[11,"place"],[7,[2,"g_moregames"]]]]],[[0,null,false,null,912114867983051,[],[[96,100,null,291158882456751,false,[[1,[10,[10,[10,[10,[10,[2,"http://www.y8.com/?utm_source="],[20,96,101,true,null]],[2,"&utm_medium="]],[23,"place"]],[2,"&utm_campaign="]],[23,"GAME"]]],[1,[10,[10,[10,[10,[10,[2,"http://www.y8.com/?utm_source="],[20,96,101,true,null]],[2,"&utm_medium="]],[23,"place"]],[2,"&utm_campaign="]],[23,"GAME"]]]]]]]]]]],[0,null,false,null,759665723363315,[[195,87,null,0,false,false,true,305924409646336,false,[[0,[0,616]]]],[93,50,null,0,false,false,false,282725970405612,false]],[[195,84,null,731171331465694,false,[[7,[20,93,53,true,null]]]],[50,55,null,121072317162535,false,[[1,[2,"welcome"]],[3,1]]]]]]],["allButtons",[[0,null,false,null,328304286104617,[[-1,86,null,0,true,false,false,154679814991741,false,[[4,206]]],[94,98,null,0,false,true,false,720696755617467,false,[[4,206]]]],[],[[0,null,false,null,283090649961980,[],[[206,102,null,812705504480046,false,[[3,0],[1,[2,"Brightness"]]]]]],[0,null,false,null,674657311102347,[[206,42,null,0,false,true,false,516618469373732,false,[[10,0],[8,0],[7,[0,0]]]]],[[206,103,"LiteTween2",825964568984230,false,[[3,4],[3,0],[0,[20,206,104,false,null]]]],[206,103,"LiteTween2",970996681207254,false,[[3,5],[3,0],[0,[20,206,105,false,null]]]],[206,106,"LiteTween2",788983069895915,false,[[3,0],[3,0]]]]],[0,null,false,null,630382468691328,[[206,42,null,0,false,true,false,633719211110360,false,[[10,1],[8,0],[7,[0,0]]]],[218,90,null,0,false,false,true,457034323623692,false,[[0,[19,73,[[21,206,false,null,1]]]]]]],[[218,103,"LiteTween",730297064309316,false,[[3,4],[3,0],[0,[20,206,104,false,null]]]],[218,103,"LiteTween",400514568536796,false,[[3,5],[3,0],[0,[20,206,105,false,null]]]],[218,106,"LiteTween",390496418650749,false,[[3,0],[3,0]]]]]]],[0,null,false,null,440993016015286,[[94,98,null,0,false,false,false,249157419599397,false,[[4,206]]]],[],[[0,null,true,null,809110882850497,[[206,85,null,0,false,false,false,701061955604402,false,[[5,[23,"TypeMenu"]]]],[206,85,null,0,false,false,false,183506214683478,false,[[5,[0,5]]]],[206,85,null,0,false,false,false,185558246156570,false,[[5,[0,3]]]],[206,85,null,0,false,false,false,536866392830360,false,[[5,[0,2]]]],[206,85,null,0,false,false,false,824756969451030,false,[[5,[0,1]]]],[206,85,null,0,false,false,false,303562792846735,false,[[5,[2,"GUI"]]]]],[[206,102,null,586640325828111,false,[[3,1],[1,[2,"Brightness"]]]]],[[0,null,false,null,357993957003566,[[206,42,null,0,false,true,false,123380283385798,false,[[10,0],[8,0],[7,[0,0]]]]],[[206,103,"LiteTween2",655513397157944,false,[[3,4],[3,0],[0,[4,[20,206,104,false,null],[0,10]]]]],[206,103,"LiteTween2",921397207208005,false,[[3,5],[3,0],[0,[4,[20,206,105,false,null],[0,10]]]]],[206,106,"LiteTween2",915867586395435,false,[[3,0],[3,0]]]],[[0,null,false,null,449762585913479,[[206,42,null,0,false,true,false,486364768832697,false,[[10,1],[8,0],[7,[0,0]]]],[218,90,null,0,false,false,true,167769631772579,false,[[0,[19,73,[[21,206,false,null,1]]]]]]],[[218,103,"LiteTween",795992099311158,false,[[3,4],[3,0],[0,[4,[20,206,104,false,null],[0,10]]]]],[218,103,"LiteTween",115184348322089,false,[[3,5],[3,0],[0,[4,[20,206,105,false,null],[0,10]]]]],[218,106,"LiteTween",625438796762824,false,[[3,0],[3,0]]]]]]]]]]],[0,null,false,null,244991060763062,[[94,107,null,1,false,false,false,549144783507896,false,[[3,0],[3,0],[4,206]]]],[],[[0,null,true,null,986329938843520,[[206,85,null,0,false,false,false,122013640252003,false,[[5,[23,"TypeMenu"]]]],[206,85,null,0,false,false,false,384595022992857,false,[[5,[0,5]]]],[206,85,null,0,false,false,false,150973897810946,false,[[5,[0,3]]]],[206,85,null,0,false,false,false,604031174885052,false,[[5,[0,2]]]],[206,85,null,0,false,false,false,859819518668835,false,[[5,[0,1]]]],[206,85,null,0,false,false,false,256442438382171,false,[[5,[2,"GUI"]]]]],[]]]],[0,null,false,null,338574544041026,[[206,76,null,1,false,false,false,757355219125086,false]],[[206,108,null,815291737619455,false,[[0,[0,0]]]]]],[0,[true,"ButtonFaces"],false,null,171885303275228,[[-1,46,null,0,false,false,false,171885303275228,false,[[1,[2,"ButtonFaces"]]]]],[],[[0,null,false,null,896152132666019,[[4,76,null,1,false,false,false,783081293898235,false]],[[-1,77,null,544695195944286,false,[[4,23],[5,[20,4,63,true,null]],[0,[20,4,44,false,null]],[0,[20,4,78,false,null]]]],[4,45,null,734891597444902,false,[[10,1],[7,[20,23,79,false,null]]]]]],[0,null,false,null,822498634188456,[[19,76,null,1,false,false,false,613010776577574,false]],[[-1,77,null,191925676551413,false,[[4,26],[5,[20,19,63,true,null]],[0,[20,19,44,false,null]],[0,[20,19,78,false,null]]]],[19,45,null,223086790869344,false,[[10,1],[7,[20,19,79,false,null]]]]]],[0,null,false,null,624093601756762,[[17,76,null,1,false,false,false,328548567211417,false]],[[-1,77,null,120360284775222,false,[[4,24],[5,[20,17,63,true,null]],[0,[20,17,44,false,null]],[0,[20,17,78,false,null]]]],[17,45,null,291683911402791,false,[[10,1],[7,[20,17,79,false,null]]]]]],[0,null,false,null,428559645375470,[[11,76,null,1,false,false,false,282489331866699,false]],[[-1,77,null,885953694772041,false,[[4,22],[5,[20,11,63,true,null]],[0,[20,11,44,false,null]],[0,[20,11,78,false,null]]]],[11,45,null,536349252612021,false,[[10,1],[7,[20,22,79,false,null]]]]]],[0,null,false,null,655974768568412,[[12,76,null,1,false,false,false,894958555626771,false]],[[-1,77,null,169940520280678,false,[[4,21],[5,[20,12,63,true,null]],[0,[20,12,44,false,null]],[0,[20,12,78,false,null]]]],[12,45,null,897775180525106,false,[[10,1],[7,[20,21,79,false,null]]]]]],[0,null,false,null,980522842891207,[[18,76,null,1,false,false,false,820916117980233,false]],[[-1,77,null,441668747410157,false,[[4,25],[5,[20,18,63,true,null]],[0,[20,18,44,false,null]],[0,[20,18,78,false,null]]]],[18,45,null,442304721421779,false,[[10,1],[7,[20,25,79,false,null]]]]]],[0,null,false,null,667794411828055,[[5,76,null,1,false,false,false,307148191131728,false]],[[-1,77,null,437727659939442,false,[[4,20],[5,[20,5,63,true,null]],[0,[20,5,44,false,null]],[0,[20,5,78,false,null]]]],[5,45,null,713914076021112,false,[[10,1],[7,[20,5,79,false,null]]]]]]]]]],["GamePause",[[1,"GameIsPaused",0,0,false,false,171209413258582,false],[0,null,false,null,614103746739361,[[93,60,null,0,false,true,false,532427297743569,false]],[],[[0,null,false,null,786229034162510,[[97,61,null,1,false,false,false,971063392733799,false,[[4,12]]],[-1,62,null,0,false,false,false,825712961544992,false,[[5,[20,12,63,true,null]]]]],[[92,38,null,733553814792859,false,[[1,[2,"pauseSettingsGame"]],[13]]]]],[0,null,false,null,121462461077192,[[97,61,null,1,false,false,false,793751003377093,false,[[4,45]]]],[[93,59,null,103140840517909,false,[[0,[23,"ScoreForLeaderboard"]],[1,[2,"Leaderboard"]],[0,[0,0]],[0,[0,1]],[1,[20,93,53,true,null]]]],[93,56,null,533799643822190,false,[[1,[2,"Leaderboard"]],[1,[2,"alltime"]],[0,[0,1]]]]]],[0,null,false,null,540716461692166,[[97,61,null,1,false,false,false,408970486877226,false,[[4,7]]],[-1,62,null,0,false,false,false,111383304762957,false,[[5,[20,12,63,true,null]]]]],[[92,38,null,803849277467514,false,[[1,[2,"pauseSettingsGame"]],[13]]]]],[0,null,false,null,524313630606842,[[97,61,null,1,false,false,false,823293613566971,false,[[4,6]]],[-1,62,null,0,false,false,false,628865210891874,false,[[5,[20,6,63,true,null]]]],[6,42,null,0,false,false,false,146644014979761,false,[[10,2],[8,0],[7,[2,"settings"]]]]],[[92,38,null,101419826012010,false,[[1,[2,"pauseSettingsGame"]],[13]]]]],[0,null,false,null,114809931723376,[[97,61,null,1,false,false,false,569681197987786,false,[[4,41]]],[-1,62,null,0,false,false,false,586739620624478,false,[[5,[20,41,63,true,null]]]]],[[92,38,null,297548638536658,false,[[1,[2,"pauseStopGame"]],[13]]]]]]],[0,null,false,null,863146357050784,[[95,109,null,1,false,false,false,446460980378827,false,[[9,80]]]],[[92,38,null,218451915454545,false,[[1,[2,"pauseStopGame"]],[13]]]]],[0,null,false,null,395238977102129,[[94,107,null,1,false,false,false,479450669603406,false,[[3,0],[3,0],[4,15]]]],[],[[0,null,false,null,686069975732872,[],[[-1,65,null,766985569281730,false,[[6,"MainMenu"]]],[-1,33,null,312556188566126,false,[[11,"GameIsPaused"],[7,[0,0]]]],[-1,110,null,759299262311748,false,[[0,[0,1]]]]]]]],[0,null,false,null,843497200694839,[[92,28,null,2,false,false,false,470437281343140,false,[[1,[2,"pauseSettingsGame"]]]]],[],[[1,"pauseLayer",0,0,false,false,604373984207133,false],[0,null,false,null,664819320730489,[[-1,72,null,0,false,false,false,698012837436860,false,[[11,"GameIsPaused"],[8,0],[7,[0,0]]]]],[[98,70,null,758272306248734,false,[[2,["ui_pause",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]]],[[0,null,false,null,991486827321978,[[-1,40,null,0,false,false,false,709455618790666,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,33,null,680722189983190,false,[[11,"pauseLayer"],[7,[23,"TypeMenu"]]]]]],[0,null,false,null,580263099086131,[[-1,69,null,0,false,false,false,306235652418514,false]],[[-1,33,null,376944624665993,false,[[11,"pauseLayer"],[7,[0,0]]]]]],[0,null,false,null,281955501964248,[],[],[[0,null,false,null,214618220717623,[[-1,40,null,0,false,true,false,411357944911214,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,77,null,416428030783139,false,[[4,55],[5,[2,"GUI"]],[0,[0,0]],[0,[0,0]]]]]],[0,null,false,null,728869650071090,[[-1,69,null,0,false,false,false,642765544699173,false],[-1,111,null,0,true,false,false,690910742206249,false,[[0,[0,14]]]]],[[-1,71,null,956520763262803,false,[[5,[4,[19,112],[0,3]]],[3,0]]],[-1,71,null,572593526238324,false,[[5,[0,15]],[3,1]]]]],[0,null,false,null,223715238867731,[],[[-1,77,null,446451908120128,false,[[4,54],[5,[2,"GUI"]],[0,[0,233]],[0,[0,100]]]],[-1,77,null,698486975533178,false,[[4,68],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,0]]],[0,[4,[20,54,78,false,null],[0,0]]]]],[-1,77,null,443315990065585,false,[[4,6],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,125]]],[0,[5,[20,54,78,false,null],[0,10]]]]],[6,45,null,692177275271362,false,[[10,2],[7,[2,"settings"]]]],[-1,77,null,990454342976495,false,[[4,66],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,185]]],[0,[4,[20,54,78,false,null],[0,74]]]]],[-1,77,null,804849673516123,false,[[4,14],[5,[2,"GUI"]],[0,[4,[4,[20,54,44,false,null],[0,254]],[6,[23,"Sounds"],[0,25]]]],[0,[4,[20,54,78,false,null],[0,52]]]]],[-1,77,null,242936929434029,false,[[4,13],[5,[2,"GUI"]],[0,[4,[4,[20,54,44,false,null],[0,254]],[6,[23,"Music"],[0,25]]]],[0,[4,[20,54,78,false,null],[0,93]]]]],[-1,77,null,657738381442604,false,[[4,72],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,90]]],[0,[4,[20,54,78,false,null],[0,200]]]]],[-1,77,null,134603578205785,false,[[4,31],[5,[2,"GUI"]],[0,[4,[4,[20,54,44,false,null],[0,20]],[6,[23,"Quality"],[0,150]]]],[0,[4,[4,[20,54,78,false,null],[0,209]],[6,[23,"Quality"],[0,-5]]]]]],[-1,77,null,534950398043924,false,[[4,67],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,249]]],[0,[4,[20,54,78,false,null],[0,318]]]]],[-1,77,null,300557438547001,false,[[4,32],[5,[2,"GUI"]],[0,[4,[20,54,44,false,null],[0,252]]],[0,[4,[20,54,78,false,null],[0,377]]]]]],[[0,null,false,null,266544307094824,[],[[-1,113,null,275070640325596,false,[[4,13],[0,[1,1]]]],[-1,113,null,627641740859807,false,[[4,14],[0,[1,1]]]],[-1,113,null,331008190691341,false,[[4,31],[0,[1,1]]]],[-1,113,null,145486348727609,false,[[4,32],[0,[1,1]]]],[-1,113,null,910104673881759,false,[[4,6],[0,[1,1]]]],[-1,33,null,709444444790600,false,[[11,"GameIsPaused"],[7,[0,1]]]],[-1,92,null,392733924170043,false,[[0,[0,0]]]],[92,38,null,981818007055725,false,[[1,[2,"UpdateEffects"]],[13]]],[-1,114,null,863975006874930,false,[[4,141]]],[-1,114,null,219185563636922,false,[[4,157]]]],[[0,null,false,null,692528326296186,[[-1,40,null,0,false,true,false,299105423413816,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,110,null,140957212121185,false,[[0,[0,0]]]]]]]]]],[0,null,false,null,337548893506447,[],[]]]]]],[0,null,false,null,529851878680701,[[-1,69,null,0,false,false,false,123065079772209,false]],[[207,67,null,167591606290651,false],[-1,33,null,912546732502701,false,[[11,"GameIsPaused"],[7,[0,0]]]],[-1,110,null,539471118176875,false,[[0,[21,141,false,null,27]]]],[-1,113,null,723039557075766,false,[[4,141],[0,[0,1]]]],[-1,113,null,886512424169020,false,[[4,157],[0,[0,1]]]]],[[0,null,false,null,747159720567973,[[6,42,null,0,false,false,false,940128167475734,false,[[10,2],[8,0],[7,[2,"settings"]]]]],[[6,67,null,369429768043227,false]]],[0,null,false,null,245509177750750,[[3,115,null,0,false,false,false,497382518422903,false,[[8,0],[0,[20,54,44,false,null]]]]],[[3,67,null,900332130302898,false]]],[0,null,false,null,247561713227895,[[-1,40,null,0,false,false,false,254432029946304,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[92,38,null,414380126472132,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"TypeMenu"]]]]]]]]]]],[0,null,false,null,982632891554160,[[92,28,null,2,false,false,false,588025228935032,false,[[1,[2,"pauseStopGame"]]]]],[],[[1,"pauseLayer",0,0,false,false,906533508484548,false],[0,null,false,null,595788704357979,[[-1,72,null,0,false,false,false,444397885664496,false,[[11,"GameIsPaused"],[8,0],[7,[0,0]]]]],[[98,70,null,287334054920738,false,[[2,["ui_pause",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]]],[[0,null,false,null,232790688512576,[[-1,40,null,0,false,false,false,156935092964068,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,33,null,153334632454412,false,[[11,"pauseLayer"],[7,[23,"TypeMenu"]]]]]],[0,null,false,null,722626004582417,[[-1,69,null,0,false,false,false,785781202770037,false]],[[-1,33,null,994107574671320,false,[[11,"pauseLayer"],[7,[0,0]]]]]],[0,null,false,null,113130343605023,[],[],[[0,null,false,null,165093060091309,[[-1,40,null,0,false,true,false,143309670860721,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,77,null,784568851140021,false,[[4,55],[5,[2,"GUI"]],[0,[0,0]],[0,[0,0]]]]]],[0,null,false,null,500430009247744,[[-1,69,null,0,false,false,false,117825460807081,false],[-1,111,null,0,true,false,false,508343608364768,false,[[0,[0,14]]]]],[[-1,71,null,539580209636188,false,[[5,[4,[19,112],[0,3]]],[3,0]]],[-1,71,null,256307335464073,false,[[5,[0,15]],[3,1]]]]],[0,null,false,null,559540924898662,[],[[-1,77,null,156972480899157,false,[[4,89],[5,[2,"GUI"]],[0,[0,400]],[0,[0,280]]]],[-1,77,null,538194311837218,false,[[4,90],[5,[2,"GUI"]],[0,[4,[20,89,44,false,null],[0,0]]],[0,[4,[20,89,78,false,null],[0,0]]]]],[-1,77,null,933776898489346,false,[[4,41],[5,[2,"GUI"]],[0,[4,[20,89,44,false,null],[0,9]]],[0,[4,[20,89,78,false,null],[0,101]]]]],[-1,77,null,290369607660520,false,[[4,3],[5,[2,"GUI"]],[0,[4,[20,89,44,false,null],[0,76]]],[0,[5,[20,89,78,false,null],[0,65]]]]]],[[0,null,false,null,881079590687492,[],[[-1,33,null,981245292463817,false,[[11,"GameIsPaused"],[7,[0,1]]]],[-1,113,null,653904416326715,false,[[4,3],[0,[1,1]]]],[-1,113,null,397273760484352,false,[[4,41],[0,[1,1]]]],[-1,92,null,594457009120731,false,[[0,[0,0]]]],[3,116,null,952635297572995,false,[[0,[0,97]]]],[3,117,null,433601524021431,false,[[0,[0,66]]]],[3,45,null,797186444581541,false,[[10,0],[7,[0,0]]]],[92,38,null,540814572487023,false,[[1,[2,"UpdateEffects"]],[13]]],[-1,114,null,152583677627738,false,[[4,141]]],[-1,114,null,210993333794173,false,[[4,157]]]]],[0,null,false,null,777047801605025,[[-1,40,null,0,false,true,false,299402584927540,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,110,null,492556982219151,false,[[0,[0,0]]]]]]]],[0,null,false,null,382042092725634,[],[]]]]]],[0,null,false,null,207850292328383,[[-1,69,null,0,false,false,false,129529808558717,false]],[[207,67,null,747124116328190,false],[-1,33,null,289835125932682,false,[[11,"GameIsPaused"],[7,[0,0]]]],[-1,110,null,755968575477272,false,[[0,[21,141,false,null,27]]]],[-1,113,null,112086960256106,false,[[4,141],[0,[0,1]]]],[-1,113,null,412858389727792,false,[[4,157],[0,[0,1]]]]],[[0,null,false,null,311096727095281,[[3,115,null,0,false,false,false,648903983715105,false,[[8,0],[0,[0,476]]]]],[[3,67,null,664068254589475,false]]],[0,null,false,null,928969786083610,[[-1,40,null,0,false,false,false,758770970187038,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[92,38,null,958525723082117,false,[[1,[2,"UpdateMenu"]],[13,[7,[23,"TypeMenu"]]]]]]]]]]],[0,null,false,null,720294686214570,[[97,61,null,1,false,false,false,952339795597488,false,[[4,14]]],[14,118,null,0,false,false,false,744017674660218,false,[[10,3]]]],[[14,103,"LiteTween",903819504221568,false,[[3,0],[3,1],[0,[18,[21,14,false,null,2],[0,25],[0,-25]]]]],[14,119,null,742996987832103,false,[[10,2]]],[14,106,"LiteTween",208435011160419,false,[[3,0],[3,0]]],[-1,33,null,626306979185026,false,[[11,"Sounds"],[7,[18,[12,[23,"Sounds"],[0,1]],[0,0],[0,1]]]]]]],[0,null,false,null,716202528347968,[[97,61,null,1,false,false,false,203442534635212,false,[[4,13]]],[13,118,null,0,false,false,false,951680949189003,false,[[10,3]]]],[[13,103,"LiteTween",261342412369857,false,[[3,0],[3,1],[0,[18,[21,13,false,null,2],[0,25],[0,-25]]]]],[13,119,null,752674107093016,false,[[10,2]]],[13,106,"LiteTween",196856559469360,false,[[3,0],[3,0]]],[-1,33,null,235655528429660,false,[[11,"Music"],[7,[18,[12,[23,"Music"],[0,1]],[0,0],[0,1]]]]],[92,38,null,895703957273786,false,[[1,[2,"updateMusic"]],[13]]]]],[0,null,false,null,598384749606039,[[97,61,null,1,false,false,false,938122366501589,false,[[4,31]]],[31,118,null,0,false,false,false,899282294978740,false,[[10,3]]]],[[31,103,"LiteTween",659842526153328,false,[[3,0],[3,1],[0,[18,[21,31,false,null,2],[0,150],[0,-150]]]]],[31,103,"LiteTween",935942208953394,false,[[3,1],[3,1],[0,[18,[21,31,false,null,2],[0,-5],[0,5]]]]],[31,119,null,383454363699121,false,[[10,2]]],[31,106,"LiteTween",524121077956304,false,[[3,0],[3,0]]],[-1,33,null,994699891786464,false,[[11,"Quality"],[7,[18,[12,[23,"Quality"],[0,1]],[0,0],[0,1]]]]]],[[0,null,false,null,598514671482600,[[-1,72,null,0,false,false,false,759070221211304,false,[[11,"Quality"],[8,0],[7,[0,1]]]]],[[-1,120,null,452180229210906,false,[[3,1]]]]],[0,null,false,null,549541991000490,[[-1,72,null,0,false,false,false,990021724974199,false,[[11,"Quality"],[8,0],[7,[0,0]]]]],[[-1,120,null,637888998572367,false,[[3,0]]]]]]],[0,null,false,null,740862782238378,[[14,76,null,1,false,false,false,543546443185654,false],[-1,72,null,0,false,false,false,132237053356508,false,[[11,"Sounds"],[8,0],[7,[0,0]]]]],[[14,103,"LiteTween",778288656481730,false,[[3,0],[3,1],[0,[0,25]]]],[14,121,null,766151935815581,false,[[10,2],[3,1]]]]],[0,null,false,null,989665841247151,[[13,76,null,1,false,false,false,894387586717228,false],[-1,72,null,0,false,false,false,540655428034269,false,[[11,"Music"],[8,0],[7,[0,0]]]]],[[13,103,"LiteTween",591669715829689,false,[[3,0],[3,1],[0,[0,25]]]],[13,121,null,307344425797207,false,[[10,2],[3,1]]]]],[0,null,false,null,654998961098755,[[31,76,null,1,false,false,false,249087093238581,false],[-1,72,null,0,false,false,false,939236635071948,false,[[11,"Quality"],[8,0],[7,[0,0]]]]],[[31,103,"LiteTween",853903289001801,false,[[3,0],[3,1],[0,[0,150]]]],[31,121,null,502602960283895,false,[[10,2],[3,1]]]]],[0,null,false,null,223093889554485,[[-1,122,null,1,false,false,false,416283632194715,false]],[]],[0,null,false,null,558856152139181,[[97,61,null,1,false,false,false,188898361575932,false,[[4,32]]]],[[92,38,null,361391954216099,false,[[1,[2,"clearSaves"]],[13,[7,[23,"typeSave"]]]]]]],[0,null,false,null,275126169497030,[[-1,40,null,0,false,false,false,838656634243295,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]]],[[-1,110,null,610079026337127,false,[[0,[0,1]]]]]]]],["AchievementsAndArrays",[[0,[true,"Achievements"],false,null,842568134924911,[[-1,46,null,0,false,false,false,842568134924911,false,[[1,[2,"Achievements"]]]]],[],[[0,null,false,null,969572768927645,[[-1,47,null,1,false,false,false,462386090826616,false]],[],[[0,null,false,null,812510577204776,[],[[100,123,null,263275810413153,false,[[0,[0,0]],[0,[0,0]],[7,[2,"Graduate"]]]],[100,123,null,711551202590645,false,[[0,[0,1]],[0,[0,0]],[7,[2,"Invincible"]]]],[100,123,null,402885566123987,false,[[0,[0,2]],[0,[0,0]],[7,[2,"Stickman"]]]],[100,123,null,414558432007071,false,[[0,[0,3]],[0,[0,0]],[7,[2,"Champion"]]]],[100,123,null,522368725125733,false,[[0,[0,4]],[0,[0,0]],[7,[2,"Jumper"]]]],[100,123,null,404981633094251,false,[[0,[0,5]],[0,[0,0]],[7,[2,"Richman"]]]],[100,123,null,997793335415984,false,[[0,[0,6]],[0,[0,0]],[7,[2,"Bro!"]]]],[100,123,null,751459788949116,false,[[0,[0,7]],[0,[0,0]],[7,[2,"Perfectionist!"]]]],[100,123,null,588589272083753,false,[[0,[0,8]],[0,[0,0]],[7,[2,"Cosmonaut"]]]],[100,123,null,365675252278667,false,[[0,[0,9]],[0,[0,0]],[7,[2,"World Champion!"]]]],[100,123,null,242921531200726,false,[[0,[0,10]],[0,[0,0]],[7,[2,"Stick Jumper!"]]]],[100,123,null,709434401683750,false,[[0,[0,11]],[0,[0,0]],[7,[2,"Starman"]]]],[100,123,null,416459757440763,false,[[0,[0,12]],[0,[0,0]],[7,[2,"Collector"]]]],[100,123,null,351524921922309,false,[[0,[0,13]],[0,[0,0]],[7,[2,"Gold Medal"]]]],[100,123,null,683743469229935,false,[[0,[0,14]],[0,[0,0]],[7,[2,"Gold Champion"]]]]]],[0,null,false,null,696801581379814,[],[[100,123,null,957391378374375,false,[[0,[0,0]],[0,[0,1]],[7,[2,"Finish Tutorial"]]]],[100,123,null,894365184246321,false,[[0,[0,1]],[0,[0,1]],[7,[2,"Finish stage without dying"]]]],[100,123,null,823487632554608,false,[[0,[0,2]],[0,[0,1]],[7,[2,"Finish all stages"]]]],[100,123,null,579672006147407,false,[[0,[0,3]],[0,[0,1]],[7,[2,"Ran 1000m"]]]],[100,123,null,528136058643925,false,[[0,[0,4]],[0,[0,1]],[7,[2,"Jump 200 time"]]]],[100,123,null,704648588491924,false,[[0,[0,5]],[0,[0,1]],[7,[2,"Collect all coins"]]]],[100,123,null,147545659220799,false,[[0,[0,6]],[0,[0,1]],[7,[2,"Back to the game"]]]],[100,123,null,605008995526220,false,[[0,[0,7]],[0,[0,1]],[7,[2,"Finish any stage perfect"]]]],[100,123,null,397718786299219,false,[[0,[0,8]],[0,[0,1]],[7,[2,"Collect all stars"]]]],[100,123,null,106671071536571,false,[[0,[0,9]],[0,[0,1]],[7,[2,"Ran 4000m"]]]],[100,123,null,488272587177386,false,[[0,[0,10]],[0,[0,1]],[7,[2,"Jump 400 times"]]]],[100,123,null,483419322481803,false,[[0,[0,11]],[0,[0,1]],[7,[2,"Collect 1st Star"]]]],[100,123,null,988899768345191,false,[[0,[0,12]],[0,[0,1]],[7,[2,"Collect all coins on any stage"]]]],[100,123,null,772949405803725,false,[[0,[0,13]],[0,[0,1]],[7,[2,"Achieve gold time on any stage"]]]],[100,123,null,859747773928509,false,[[0,[0,14]],[0,[0,1]],[7,[2,"Achieve gold time on the all stage"]]]]]],[0,null,false,null,693841410395883,[],[[100,123,null,542133382071564,false,[[0,[0,0]],[0,[0,2]],[7,[2,"90dbeac387f428da07a5"]]]],[100,123,null,798988107086067,false,[[0,[0,1]],[0,[0,2]],[7,[2,"73692fd916cfc5118bc7"]]]],[100,123,null,268256528046785,false,[[0,[0,2]],[0,[0,2]],[7,[2,"31a1c802dd06acbef70f"]]]],[100,123,null,752097356253865,false,[[0,[0,3]],[0,[0,2]],[7,[2,"c0c5462f10ea571d4943"]]]],[100,123,null,248947991680386,false,[[0,[0,4]],[0,[0,2]],[7,[2,"0e60622d4114e7816fe3"]]]],[100,123,null,203649474897715,false,[[0,[0,5]],[0,[0,2]],[7,[2,"c908fb3bda50087d688c"]]]],[100,123,null,289574985660316,false,[[0,[0,6]],[0,[0,2]],[7,[2,"62eb025a197596006105"]]]],[100,123,null,898729934220905,false,[[0,[0,7]],[0,[0,2]],[7,[2,"affeeaef27f6d64d0fea"]]]],[100,123,null,199636021862125,false,[[0,[0,8]],[0,[0,2]],[7,[2,"cac3faf6324978021c32"]]]],[100,123,null,501601867039194,false,[[0,[0,9]],[0,[0,2]],[7,[2,"3bc294295b3b57d7341d"]]]],[100,123,null,276707326675233,false,[[0,[0,10]],[0,[0,2]],[7,[2,"e9b853105aac51a66d84"]]]],[100,123,null,321658801518891,false,[[0,[0,11]],[0,[0,2]],[7,[2,"e71638d4368d1bab0abc"]]]],[100,123,null,331248102013942,false,[[0,[0,12]],[0,[0,2]],[7,[2,"736b371cf08fb1b479a1"]]]],[100,123,null,466971996063167,false,[[0,[0,13]],[0,[0,2]],[7,[2,"b204ddc4b53f47d18a2d"]]]],[100,123,null,356218545507955,false,[[0,[0,14]],[0,[0,2]],[7,[2,"12c8e45203f69996969b"]]]]]],[0,null,false,null,362442496741606,[],[]]]],[0,null,false,null,112280345719574,[[92,28,null,2,false,false,false,861269076146823,false,[[1,[2,"showAchievement"]]]]],[],[[0,null,false,null,180317004749303,[[100,124,null,0,false,false,false,736786784072340,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,3]],[8,0],[7,[0,0]]]]],[[98,70,null,705429269592685,false,[[2,["ui_ach",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[1,[2,"gameplay"]]]],[100,123,null,756501868875453,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,3]],[7,[0,1]]]],[93,125,null,804106886160759,false,[[1,[20,100,39,false,null,[[20,92,31,false,null,[[0,0]]],[0,0]]]],[1,[20,100,39,false,null,[[20,92,31,false,null,[[0,0]]],[0,2]]]],[0,[0,0]],[0,[0,0]]]],[-1,77,null,926122719096292,false,[[4,57],[5,[2,"GUI"]],[0,[0,400]],[0,[0,-47]]]],[57,103,"LiteTween",658974754042274,false,[[3,1],[3,1],[0,[0,110]]]],[-1,77,null,652950888234827,false,[[4,56],[5,[2,"GUI"]],[0,[5,[20,57,44,false,null],[0,72]]],[0,[20,57,78,false,null]]]],[57,45,null,349907283159989,false,[[10,2],[7,[20,56,79,false,null]]]],[56,126,null,713713360927966,false,[[0,[1,358.5]]]],[56,127,"Pin",948662264256058,false,[[4,57],[3,1]]],[56,81,null,691350612213058,false,[[0,[20,92,31,false,null,[[0,0]]]]]],[-1,77,null,374424066721772,false,[[4,198],[5,[2,"GUI"]],[0,[4,[20,57,44,false,null],[0,31]]],[0,[5,[20,57,78,false,null],[0,24]]]]],[57,45,null,909356513699814,false,[[10,0],[7,[20,198,80,false,null]]]],[198,128,null,906752316479451,false,[[0,[0,398]],[0,[0,49]]]],[198,129,null,253395207839794,false,[[0,[1,0.43]]]],[198,130,null,151572598456189,false,[[0,[1,358.5]]]],[198,84,null,234477302166482,false,[[7,[20,100,39,false,null,[[20,92,31,false,null,[[0,0]]],[0,0]]]]]],[198,127,"Pin",854026924280465,false,[[4,57],[3,1]]],[-1,77,null,640442965502585,false,[[4,198],[5,[2,"GUI"]],[0,[4,[20,57,44,false,null],[0,31]]],[0,[4,[20,57,78,false,null],[0,11]]]]],[57,45,null,198110178851880,false,[[10,1],[7,[20,198,80,false,null]]]],[198,128,null,257009121045341,false,[[0,[0,144]],[0,[0,49]]]],[198,129,null,661663682098520,false,[[0,[1,0.31]]]],[198,84,null,293649199750247,false,[[7,[20,100,39,false,null,[[20,92,31,false,null,[[0,0]]],[0,1]]]]]],[198,127,"Pin",112878160095263,false,[[4,57],[3,1]]],[92,38,null,189523550028032,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,4]]]]]],[[0,null,false,null,656891953803275,[],[[-1,92,null,157910087730190,false,[[0,[0,4]]]],[57,103,"LiteTween",522943175952817,false,[[3,1],[3,1],[0,[0,-120]]]],[57,106,"LiteTween",703995298197265,false,[[3,0],[3,1]]],[-1,92,null,741317785315855,false,[[0,[0,1]]]]]]]]]],[0,null,false,null,254169191243688,[[57,76,null,1,false,false,false,706337387917993,false]],[[-1,92,null,269526146710906,false,[[0,[0,5]]]]],[[0,null,false,null,703040936438034,[[56,90,null,0,false,false,true,422257121958998,false,[[0,[21,57,false,null,2]]]]],[[56,67,null,218610441900431,false]]],[0,null,false,null,901446687953192,[[65,131,null,0,false,false,true,627625590923542,false,[[0,[21,57,false,null,0]]]]],[[65,132,null,581839500772906,false]]],[0,null,false,null,414549116998333,[[65,131,null,0,false,false,true,115686553553718,false,[[0,[21,57,false,null,1]]]]],[[65,132,null,189908599523870,false]]],[0,null,false,null,268331102688199,[],[[57,67,null,428766180561373,false]]]]]]],[0,[true,"Effects"],false,null,810531918535337,[[-1,46,null,0,false,false,false,810531918535337,false,[[1,[2,"Effects"]]]]],[],[[0,null,false,null,968162116533098,[[-1,47,null,1,false,false,false,332564057139981,false]],[[101,123,null,501325732004842,false,[[0,[0,0]],[0,[0,0]],[7,[0,0]]]],[101,123,null,268387105464446,false,[[0,[0,0]],[0,[0,1]],[7,[0,100]]]],[101,123,null,784736185270068,false,[[0,[0,0]],[0,[0,2]],[7,[0,100]]]],[101,123,null,303166595754769,false,[[0,[0,1]],[0,[0,0]],[7,[0,100]]]],[101,123,null,628035860464559,false,[[0,[0,1]],[0,[0,1]],[7,[0,0]]]],[101,123,null,838213055247612,false,[[0,[0,1]],[0,[0,2]],[7,[0,100]]]],[101,123,null,489903494436566,false,[[0,[0,2]],[0,[0,0]],[7,[0,100]]]],[101,123,null,697126450720757,false,[[0,[0,2]],[0,[0,1]],[7,[0,100]]]],[101,123,null,385112963348539,false,[[0,[0,2]],[0,[0,2]],[7,[0,0]]]]]]]],[0,[true,"StaticInformationLevels"],false,null,939638560980779,[[-1,46,null,0,false,false,false,939638560980779,false,[[1,[2,"StaticInformationLevels"]]]]],[],[[0,null,false,null,502803214609816,[[-1,111,null,0,true,false,false,210525967234209,false,[[0,[0,12]]]]],[[102,123,null,489693534305412,false,[[0,[19,112]],[0,[0,0]],[7,[19,133,[[2,"2000;3500;4000;5000;3800;6000;4500;6500;6000;8500;4000;4500"],[19,112],[2,";"]]]]]],[102,123,null,400178232282480,false,[[0,[19,112]],[0,[0,1]],[7,[19,133,[[2,"3700;6500;6000;7400;6000;8000;7000;8500;8000;10500;6000;6000"],[19,112],[2,";"]]]]]],[102,123,null,962189375895379,false,[[0,[19,112]],[0,[0,2]],[7,[19,133,[[2,"4700;8500;8000;9400;8000;10000;9000;10500;10000;12500;8000;8000"],[19,112],[2,";"]]]]]],[102,123,null,583512617720642,false,[[0,[19,112]],[0,[0,3]],[7,[19,133,[[2,"50;50;50;50;50;50;50;50;60;110;60;70"],[19,112],[2,";"]]]]]]]],[0,null,false,null,954393079543885,[],[]]]],[0,[true,"DynamicInformationLevels"],false,null,412290512394163,[[-1,46,null,0,false,false,false,412290512394163,false,[[1,[2,"DynamicInformationLevels"]]]]],[],[[0,null,false,null,567934721636597,[[92,28,null,2,false,false,false,691654155766937,false,[[1,[2,"arraysSetDynamicLevelInformation"]]]]],[],[[0,null,false,null,419256586578091,[],[]]]],[0,null,false,null,811674484496572,[[92,28,null,2,false,false,false,482242406741096,false,[[1,[2,"arraysUpdateStatistics"]]]]],[],[[0,null,true,null,470356369993335,[[92,134,null,0,false,false,false,266887812841277,false,[[0,[0,0]],[8,0],[7,[0,0]]]],[92,134,null,0,false,false,false,748733860036251,false,[[0,[0,0]],[8,0],[7,[0,1]]]],[92,134,null,0,false,false,false,681689065278549,false,[[0,[0,0]],[8,0],[7,[0,2]]]],[92,134,null,0,false,false,false,307122820629237,false,[[0,[0,0]],[8,0],[7,[0,6]]]],[92,134,null,0,false,false,false,207076144366827,false,[[0,[0,0]],[8,0],[7,[0,9]]]]],[[104,123,null,490289491522472,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[20,92,31,false,null,[[0,1]]]]]]]],[0,null,false,null,207590494945750,[[92,134,null,0,false,false,false,215388768698997,false,[[0,[0,0]],[8,0],[7,[0,3]]]]],[],[[1,"passedLevels",0,0,false,false,604248804615045,false],[0,null,false,null,746560954247700,[[-1,111,null,0,true,false,false,882259900401889,false,[[0,[0,12]]]],[103,135,null,0,false,false,false,291813147352056,false,[[0,[19,112]],[8,4],[7,[0,0]]]]],[[-1,136,null,355142402956089,false,[[11,"passedLevels"],[7,[0,1]]]]]],[0,null,false,null,672578982687355,[],[[104,123,null,801107941157367,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[23,"passedLevels"]]]]]]]],[0,null,false,null,711433376796884,[[92,134,null,0,false,false,false,371687860749974,false,[[0,[0,0]],[8,0],[7,[0,4]]]]],[],[[1,"passedAchievements",0,0,false,false,364233125015656,false],[0,null,false,null,467745896890731,[[-1,111,null,0,true,false,false,711540347445260,false,[[0,[0,15]]]],[100,124,null,0,false,false,false,215561402712767,false,[[0,[19,112]],[0,[0,3]],[8,0],[7,[0,1]]]]],[[-1,136,null,445937954869260,false,[[11,"passedAchievements"],[7,[0,1]]]]]],[0,null,false,null,346880439241350,[],[[104,123,null,525706024310660,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[23,"passedAchievements"]]]]]]]],[0,null,false,null,108650634089427,[[92,134,null,0,false,false,false,922285094092546,false,[[0,[0,0]],[8,0],[7,[0,5]]]]],[],[[1,"passedCheckpoints",0,0,false,false,178705896252902,false],[0,null,false,null,845808635793798,[[-1,111,null,0,true,false,false,829408604710263,false,[[0,[0,12]]]]],[[-1,33,null,737080123962379,false,[[11,"passedCheckpoints"],[7,[4,[23,"passedCheckpoints"],[20,103,39,false,null,[[19,112],[0,4]]]]]]]]],[0,null,false,null,964560451069094,[],[[104,123,null,713813775165077,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[23,"passedCheckpoints"]]]]]]]],[0,null,false,null,977726401061859,[[92,134,null,0,false,false,false,186080741920025,false,[[0,[0,0]],[8,0],[7,[0,7]]]]],[],[[1,"Coins",0,0,false,false,525898427844428,false],[0,null,false,null,322137231846364,[[-1,111,null,0,true,false,false,684998460274002,false,[[0,[0,12]]]]],[[-1,33,null,799718612664890,false,[[11,"Coins"],[7,[4,[23,"Coins"],[20,103,39,false,null,[[19,112],[0,1]]]]]]]]],[0,null,false,null,307043578213970,[],[[104,123,null,649974771895262,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[23,"Coins"]]]]]]]],[0,null,false,null,630661747384629,[[92,134,null,0,false,false,false,964889453909439,false,[[0,[0,0]],[8,0],[7,[0,8]]]]],[],[[1,"Stars",0,0,false,false,614022528172228,false],[0,null,false,null,474407741334615,[[-1,111,null,0,true,false,false,995693374405582,false,[[0,[0,12]]]]],[[-1,33,null,330224983879983,false,[[11,"Stars"],[7,[4,[23,"Stars"],[20,103,39,false,null,[[19,112],[0,2]]]]]]]]],[0,null,false,null,949154597725939,[],[[104,123,null,580897117548855,false,[[0,[20,92,31,false,null,[[0,0]]]],[0,[0,1]],[7,[23,"Stars"]]]]]]]]]]]]]],["HeroContoller",[[1,"PLAYER0RIGHTKEY",0,39,false,true,423944901016053,false],[1,"PLAYER0LEFTKEY",0,37,false,true,528315112256125,false],[1,"PLAYER0DOWNKEY",0,40,false,true,150079491546709,false],[1,"PLAYER0JUMPKEY",0,38,false,true,944347525862750,false],[1,"PLAYER1RIGHTKEY",0,68,false,true,808144772009363,false],[1,"PLAYER1LEFTKEY",0,65,false,true,988117396363646,false],[1,"PLAYER1DOWNKEY",0,83,false,true,605834119569276,false],[1,"PLAYER1JUMPKEY",0,87,false,true,761775935554644,false],[1,"STATE_IDLE",0,0,false,true,878366879499529,false],[1,"STATE_RUN",0,1,false,true,369895727669035,false],[1,"STATE_ROLL",0,2,false,true,828370574645066,false],[1,"STATE_JUMP",0,3,false,true,689060758004040,false],[1,"STATE_FALL",0,4,false,true,214551790731816,false],[1,"STATE_FLIP",0,5,false,true,456772594505868,false],[1,"STATE_SEAT_DOWN",0,6,false,true,343896405160283,false],[1,"STATE_SEAT_UP",0,7,false,true,270799734616015,false],[1,"STATE_FALL_DEATH",0,8,false,true,404218204484117,false],[1,"STATE_WALL_SLIDING",0,9,false,true,860031857787324,false],[1,"STATE_WALL_JOINT",0,10,false,true,670969574075546,false],[1,"STATE_MOTO",0,11,false,true,477851907324508,false],[1,"STATE_ROCKET",0,12,false,true,511937271672572,false],[1,"STATE_SUBMORINE",0,13,false,true,131217121038247,false],[1,"STATE_ROTATE_THING",0,14,false,true,200185294577696,false],[1,"STATE_JOINT_CONVEUR",0,15,false,true,232019753485482,false],[1,"STATE_JOINT_CONVEUR_UP",0,16,false,true,375955790154602,false],[1,"STATE_JOINT_CONVEUR_DOWN",0,17,false,true,181049003415357,false],[1,"STATE_FINISHED",0,18,false,true,393855942073433,false],[1,"STATE_ROTATE_SWING",0,19,false,true,367922692965225,false],[1,"STATE_DEATH",0,20,false,true,542416043950079,false],[1,"Current_state",0,0,false,false,260717991635929,false],[1,"HERO_ROLLSPEED",0,850,false,true,237142894801400,false],[1,"HERO_WALL_SLIDING",0,100,false,true,271096498999584,false],[1,"hero_SpeedMaxX",0,400,false,false,418925444819716,false],[1,"hero_swimmingAngleDelta",0,2.5,false,false,323354160324340,false],[1,"AAA",0,0,false,false,327956870508450,false],[1,"checkpointUID",0,0,false,false,110243867844897,false],[0,[true,"Initialisation Hero"],false,null,258511997487258,[[-1,46,null,0,false,false,false,258511997487258,false,[[1,[2,"Initialisation Hero"]]]]],[],[[0,null,false,null,838528829605780,[[-1,47,null,1,false,false,false,341449140289345,false]],[[-1,33,null,466433887638950,false,[[11,"checkpointUID"],[7,[0,0]]]],[141,45,null,492299361178364,false,[[10,27],[7,[0,1]]]],[-1,110,null,778006215329996,false,[[0,[21,141,false,null,27]]]],[98,137,null,468304133693807,false,[[1,[2,"gameplay"]],[0,[0,1]]]],[98,137,null,494683641164912,false,[[1,[2,"gameplayMusic"]],[0,[0,1]]]]]],[0,null,false,null,400705534279544,[[141,76,null,1,false,false,false,756828669486889,false]],[[157,138,null,677145011392231,false,[[4,141],[7,[0,0]]]],[157,127,"Pin",172755493781201,false,[[4,141],[3,1]]],[157,139,null,206109063066301,false,[[3,1],[4,141]]]],[[0,null,false,null,542687170385246,[],[[-1,92,null,373428562471630,false,[[0,[1,0.01]]]],[92,38,null,455378355041899,false,[[1,[2,"changefaceDir"]],[13,[7,[21,141,false,null,0]]]]]]],[0,null,false,null,714292132823994,[],[[92,38,null,899549194496176,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]],[92,38,null,840846058462138,false,[[1,[2,"heroActivateSubmorineEffect"]],[13,[7,[0,0]]]]],[92,38,null,120493810389740,false,[[1,[2,"heroUpdateJetpackVision"]],[13]]]]],[0,null,false,null,841068985524398,[],[[160,140,null,940799902402912,false,[[3,0],[1,[2,"BlurHorizontal"]]]],[160,140,null,860881016658312,false,[[3,0],[1,[2,"BlurVertical"]]]]]]]],[0,null,false,null,199121837966510,[[-1,141,null,0,false,false,false,953884036826956,false]],[[-1,33,null,493002308292639,false,[[11,"AAA"],[7,[19,142]]]]]]]],[0,[true,"EVERY TICK EVENTS"],false,null,718415779914495,[[-1,46,null,0,false,false,false,718415779914495,false,[[1,[2,"EVERY TICK EVENTS"]]]]],[],[[0,null,false,null,593848503637013,[],[[141,45,null,147308473390859,false,[[10,3],[7,[22,141,"Platform",143,false,null]]]],[141,45,null,222842264630287,false,[[10,4],[7,[22,141,"Platform",144,false,null]]]],[141,45,null,636024373714829,false,[[10,5],[7,[0,0]]]],[141,45,null,265684660884468,false,[[10,6],[7,[0,0]]]],[141,45,null,267531167508256,false,[[10,7],[7,[0,0]]]]],[[0,null,false,null,851011920378694,[[157,145,null,0,false,false,false,679139870548569,false,[[8,0],[0,[0,6]]]],[-1,146,null,0,false,false,false,623958249873741,false],[157,91,null,0,false,false,false,155506149806329,false,[[1,[2,"run"]]]]],[[98,147,null,207370365954381,false,[[2,["player_step1",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,108110369187660,[[157,145,null,0,false,false,false,125750330638057,false,[[8,0],[0,[0,1]]]],[-1,146,null,0,false,false,false,675206350912330,false],[157,91,null,0,false,false,false,404558465310861,false,[[1,[2,"run"]]]]],[[98,147,null,507734612683102,false,[[2,["player_step2",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]]]],[0,null,false,null,307821190095826,[[141,148,null,0,false,false,false,350386334371131,false,[[4,208],[0,[0,0]],[0,[0,1]]]]],[[141,45,null,154993181088152,false,[[10,5],[7,[0,1]]]],[141,45,null,962281802831469,false,[[10,8],[7,[0,0]]]],[141,149,"Platform",268813936324036,false,[[0,[21,208,false,null,1]]]]],[[0,null,false,null,278694808347596,[[208,42,null,0,false,false,false,312340898878761,false,[[10,1],[8,0],[7,[0,0]]]],[141,42,null,0,false,true,false,270130998578588,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,699766692060165,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]]],[[141,149,"Platform",988934463430000,false,[[0,[0,2500]]]]]],[0,null,false,null,866980485539121,[[141,42,null,0,false,false,false,336510767673692,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]]],[[141,149,"Platform",305968720841099,false,[[0,[0,1000]]]]]],[0,null,false,null,109053710415440,[[141,42,null,0,false,false,false,913353301280327,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[208,42,null,0,false,false,false,163370717413095,false,[[10,2],[8,0],[7,[0,1]]]]],[[92,38,null,220829880054961,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,null,false,null,895387488905687,[[141,148,null,0,false,false,false,670258893234243,false,[[4,209],[0,[0,0]],[0,[0,1]]]]],[[141,45,null,820993931434994,false,[[10,5],[7,[0,1]]]],[141,45,null,856872904634226,false,[[10,8],[7,[0,0]]]],[141,149,"Platform",550343728805287,false,[[0,[21,209,false,null,1]]]]],[[0,null,false,null,986984991835456,[[209,150,null,0,false,false,false,249226578043170,false,[[10,1],[8,0],[7,[0,0]]]],[141,42,null,0,false,true,false,800214615476713,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,994820868858654,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]]],[[141,149,"Platform",136816623246791,false,[[0,[0,2500]]]]]],[0,null,false,null,536284109941774,[[141,42,null,0,false,false,false,853018786002926,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]]],[[141,149,"Platform",342535492533834,false,[[0,[0,1000]]]]]],[0,null,false,null,314573179588249,[[141,42,null,0,false,false,false,311301639438497,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[209,150,null,0,false,false,false,642016969142085,false,[[10,2],[8,0],[7,[0,1]]]]],[[92,38,null,621078609145473,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,null,false,null,722132959311947,[[141,42,null,0,false,false,false,382869318213743,false,[[10,5],[8,0],[7,[0,0]]]],[141,42,null,0,false,false,false,297152936661808,false,[[10,11],[8,2],[7,[0,10]]]]],[[141,151,null,327705379955932,false,[[10,11],[7,[0,1]]]]],[[0,null,false,null,991152108481034,[[141,42,null,0,false,false,false,579806527046096,false,[[10,11],[8,0],[7,[0,10]]]]],[[141,121,null,780768307233172,false,[[10,10],[3,1]]]]]]],[0,null,false,null,746305781913404,[[141,42,null,0,false,false,false,868751786392125,false,[[10,5],[8,0],[7,[0,1]]]],[141,42,null,0,false,false,false,610294760523544,false,[[10,11],[8,4],[7,[0,0]]]]],[[141,151,null,957499575244608,false,[[10,11],[7,[0,-1]]]]],[[0,null,false,null,709678695260506,[[141,42,null,0,false,false,false,112878556125636,false,[[10,11],[8,0],[7,[0,0]]]]],[[141,121,null,407098053390075,false,[[10,10],[3,0]]],[92,38,null,723425991647763,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]]]]]],[0,null,false,null,776985778910385,[[141,42,null,0,false,false,false,883827727067151,false,[[10,5],[8,0],[7,[0,0]]]],[141,118,null,0,false,false,false,231955921298513,false,[[10,9]]]],[[157,126,null,867899607220473,false,[[0,[7,[21,141,false,null,3],[0,20]]]]],[170,152,null,937540233938724,false,[[0,[4,[0,90],[7,[21,141,false,null,3],[0,20]]]]]],[172,152,null,422217341018875,false,[[0,[4,[0,90],[7,[21,141,false,null,3],[0,20]]]]]]]],[0,null,true,null,899013476476746,[[141,42,null,0,false,true,false,210842780919454,false,[[10,5],[8,0],[7,[0,0]]]],[141,118,null,0,false,true,false,838595146050959,false,[[10,9]]]],[],[[0,null,false,null,469957267978856,[[141,118,null,0,false,true,false,175571934945301,false,[[10,14]]]],[[157,126,null,757066467280161,false,[[0,[0,0]]]]]]]],[0,null,false,null,757677682717619,[[141,148,null,0,false,false,false,662014835642655,false,[[4,209],[0,[0,1]],[0,[0,0]]]],[209,150,null,0,false,false,false,753148703658287,false,[[10,0],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,802437612446130,false,[[10,17],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,416112380242198,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,118,null,0,false,true,false,447799909929089,false,[[10,9]]],[141,42,null,0,false,true,false,379842229487804,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,42,null,0,false,false,false,285716203938927,false,[[10,4],[8,4],[7,[0,0]]]]],[[92,38,null,168830044311960,false,[[1,[2,"moveSliding"]],[13,[7,[0,1]]]]],[141,149,"Platform",565735006448932,false,[[0,[0,2500]]]]]],[0,null,false,null,357184571990901,[[141,148,null,0,false,false,false,234402623545441,false,[[4,208],[0,[0,1]],[0,[0,0]]]],[208,42,null,0,false,false,false,714464667986211,false,[[10,0],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,554705442775597,false,[[10,17],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,999300091831755,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,118,null,0,false,true,false,796115944922241,false,[[10,9]]],[141,42,null,0,false,true,false,732216353882374,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,42,null,0,false,false,false,915009862263788,false,[[10,4],[8,4],[7,[0,0]]]]],[[92,38,null,881717248770808,false,[[1,[2,"moveSliding"]],[13,[7,[0,1]]]]],[141,149,"Platform",927681759915476,false,[[0,[0,2500]]]]]],[0,null,false,null,955448731585820,[[141,148,null,0,false,false,false,942164928462798,false,[[4,209],[0,[0,-1]],[0,[0,0]]]],[209,150,null,0,false,false,false,860707628775004,false,[[10,0],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,519224000605883,false,[[10,17],[8,0],[7,[0,-1]]]],[141,42,null,0,false,true,false,262418297519145,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,118,null,0,false,true,false,897402115560378,false,[[10,9]]],[141,42,null,0,false,true,false,686432250260228,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,42,null,0,false,false,false,499619580552614,false,[[10,4],[8,4],[7,[0,0]]]]],[[92,38,null,927303929945215,false,[[1,[2,"moveSliding"]],[13,[7,[0,-1]]]]],[141,149,"Platform",809094895068792,false,[[0,[0,2500]]]]]],[0,null,false,null,766059848192916,[[141,148,null,0,false,false,false,117212552461200,false,[[4,208],[0,[0,-1]],[0,[0,0]]]],[208,42,null,0,false,false,false,968413406939997,false,[[10,0],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,545027000796310,false,[[10,17],[8,0],[7,[0,-1]]]],[141,42,null,0,false,true,false,688996157655888,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,118,null,0,false,true,false,200638874232819,false,[[10,9]]],[141,42,null,0,false,true,false,946874192801908,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,42,null,0,false,false,false,378731445355799,false,[[10,4],[8,4],[7,[0,0]]]]],[[92,38,null,447416435659985,false,[[1,[2,"moveSliding"]],[13,[7,[0,-1]]]]],[141,149,"Platform",206441165555418,false,[[0,[0,2500]]]]]],[0,null,false,null,406857278699154,[[-1,141,null,0,false,false,false,407035013265886,false]],[[177,153,null,783115189143523,false,[[7,[20,140,154,false,null]]]]]],[0,null,false,null,808706227015986,[[141,155,null,0,false,false,false,754875713379003,false,[[8,4],[0,[19,156]]]]],[[92,38,null,770069335144744,false,[[1,[2,"heroDeath"]],[13]]]]],[0,null,false,null,850659116857694,[[141,115,null,0,false,false,false,229075380252906,false,[[8,4],[0,[19,157]]]]],[[141,158,null,827922651870688,false,[[0,[19,157]]]]]],[0,null,false,null,410559342029016,[[141,115,null,0,false,false,false,639831670971625,false,[[8,2],[0,[0,0]]]]],[[141,158,null,947404999534591,false,[[0,[0,0]]]]]]]],[0,[true,"Controlling"],false,null,233048065710137,[[-1,46,null,0,false,false,false,233048065710137,false,[[1,[2,"Controlling"]]]]],[],[[0,null,true,null,992929593095676,[[95,159,null,1,false,false,false,116165102199155,false,[[0,[23,"PLAYER0JUMPKEY"]]]],[95,159,null,1,false,false,false,104201817887587,false,[[0,[23,"PLAYER1JUMPKEY"]]]],[97,61,null,1,false,false,false,256992483158784,false,[[4,194]]]],[[92,38,null,315796421904977,false,[[1,[2,"moveJump"]],[13]]]],[[0,null,false,null,292725440476105,[[-1,72,null,0,false,false,false,187127470096411,false,[[11,"GUIfinishLevel"],[8,0],[7,[0,0]]]]],[[-1,33,null,449066167670215,false,[[11,"GUIstopTimer"],[7,[0,0]]]]]]]],[0,null,true,null,223122488974830,[[95,160,null,0,false,false,false,453076989104386,false,[[0,[23,"PLAYER0LEFTKEY"]]]],[95,160,null,0,false,false,false,397246690865800,false,[[0,[23,"PLAYER1LEFTKEY"]]]],[97,161,null,0,false,false,false,159026461590683,false,[[4,192]]]],[[92,38,null,423614028423898,false,[[1,[2,"move"]],[13,[7,[0,-1]]]]]],[[0,null,true,null,287115386559468,[[95,159,null,1,false,false,false,273086912093382,false,[[0,[23,"PLAYER0DOWNKEY"]]]],[95,159,null,1,false,false,false,847443819669824,false,[[0,[23,"PLAYER1DOWNKEY"]]]],[141,162,null,0,false,false,false,355288988416462,false,[[4,188]]],[97,61,null,1,false,false,false,567722108408855,false,[[4,191]]]],[[92,38,null,306826106322601,false,[[1,[2,"moveRoll"]],[13,[7,[0,-1]]]]]]],[0,null,false,null,383567602725641,[[-1,72,null,0,false,false,false,793722748163796,false,[[11,"GUIfinishLevel"],[8,0],[7,[0,0]]]]],[[-1,33,null,931164059976335,false,[[11,"GUIstopTimer"],[7,[0,0]]]]]]]],[0,null,true,null,225466630508351,[[95,160,null,0,false,false,false,730209629849775,false,[[0,[23,"PLAYER0RIGHTKEY"]]]],[95,160,null,0,false,false,false,420469144324315,false,[[0,[23,"PLAYER1RIGHTKEY"]]]],[97,161,null,0,false,false,false,462040831049873,false,[[4,193]]]],[[92,38,null,294372780252193,false,[[1,[2,"move"]],[13,[7,[0,1]]]]]],[[0,null,true,null,933652747743925,[[95,159,null,1,false,false,false,795220022154366,false,[[0,[23,"PLAYER0DOWNKEY"]]]],[95,159,null,1,false,false,false,321536616083157,false,[[0,[23,"PLAYER1DOWNKEY"]]]],[141,162,null,0,false,false,false,334543145860819,false,[[4,188]]],[97,61,null,1,false,false,false,922640017428737,false,[[4,191]]]],[[92,38,null,908098821206293,false,[[1,[2,"moveRoll"]],[13,[7,[0,1]]]]]]],[0,null,false,null,580512881110149,[[-1,72,null,0,false,false,false,694022571552850,false,[[11,"GUIfinishLevel"],[8,0],[7,[0,0]]]]],[[-1,33,null,413549900835635,false,[[11,"GUIstopTimer"],[7,[0,0]]]]]]]],[0,null,true,null,965306084720354,[[95,160,null,0,false,false,false,838317361714752,false,[[0,[23,"PLAYER0DOWNKEY"]]]],[95,160,null,0,false,false,false,128211259440761,false,[[0,[23,"PLAYER1DOWNKEY"]]]],[141,162,null,0,false,false,false,103530655878127,false,[[4,188]]],[97,161,null,0,false,false,false,249520601978561,false,[[4,191]]]],[[92,38,null,228326200399808,false,[[1,[2,"moveDown"]],[13]]]],[[0,null,true,null,828365988302039,[[95,159,null,1,false,false,false,415893168629056,false,[[0,[23,"PLAYER0LEFTKEY"]]]],[95,159,null,1,false,false,false,802372024655565,false,[[0,[23,"PLAYER1LEFTKEY"]]]],[97,61,null,1,false,false,false,279235583962407,false,[[4,192]]]],[[92,38,null,662866152258880,false,[[1,[2,"moveRoll"]],[13,[7,[0,-1]]]]]]],[0,null,true,null,344032396053495,[[95,159,null,1,false,false,false,718746962837725,false,[[0,[23,"PLAYER0RIGHTKEY"]]]],[95,159,null,1,false,false,false,957299255515565,false,[[0,[23,"PLAYER1RIGHTKEY"]]]],[97,61,null,1,false,false,false,967518314161947,false,[[4,193]]]],[[92,38,null,108169107756303,false,[[1,[2,"moveRoll"]],[13,[7,[0,1]]]]]]],[0,null,false,null,478882737987915,[[-1,72,null,0,false,false,false,509963777303915,false,[[11,"GUIfinishLevel"],[8,0],[7,[0,0]]]]],[[-1,33,null,676451037371254,false,[[11,"GUIstopTimer"],[7,[0,0]]]]]]]],[0,null,false,null,177239486023080,[[95,160,null,0,false,true,false,643252262171142,false,[[0,[23,"PLAYER0DOWNKEY"]]]],[95,160,null,0,false,true,false,739341958869828,false,[[0,[23,"PLAYER1DOWNKEY"]]]],[97,161,null,0,false,true,false,203480122937266,false,[[4,191]]],[141,162,null,0,false,true,false,573483049428482,false,[[4,188]]]],[[92,38,null,406527502716346,false,[[1,[2,"moveUp"]],[13]]]]],[0,null,true,null,832482134624535,[[95,160,null,0,false,false,false,183794786614903,false,[[0,[23,"PLAYER0JUMPKEY"]]]],[95,160,null,0,false,false,false,270027668341736,false,[[0,[23,"PLAYER1JUMPKEY"]]]],[97,161,null,0,false,false,false,759269425724190,false,[[4,194]]]],[[92,38,null,567086217059718,false,[[1,[2,"heroJet"]],[13]]],[194,45,null,766714838700942,false,[[10,0],[7,[20,97,163,false,null]]]]]],[0,null,true,null,645355954942529,[[95,164,null,1,false,false,false,650638294052295,false,[[0,[23,"PLAYER0JUMPKEY"]]]],[95,164,null,1,false,false,false,309446411444306,false,[[0,[23,"PLAYER1JUMPKEY"]]]]],[[92,38,null,353523435263847,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]],[92,38,null,514142069793235,false,[[1,[2,"heroUpReleased"]],[13]]]]],[0,null,false,null,567347894058505,[[97,165,null,1,false,false,false,880419628455779,false,[[0,[21,194,false,null,0]]]]],[[194,45,null,603109923150166,false,[[10,0],[7,[0,-1]]]],[92,38,null,736851718712986,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]],[92,38,null,118374808584607,false,[[1,[2,"heroUpReleased"]],[13]]]]],[0,null,false,null,758143828223768,[[141,42,null,0,false,false,false,361667496410478,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]]],[],[[0,null,true,null,810913444610549,[[95,160,null,0,false,false,false,838627874739271,false,[[0,[23,"PLAYER0RIGHTKEY"]]]],[95,160,null,0,false,false,false,143535235001259,false,[[0,[23,"PLAYER1RIGHTKEY"]]]],[97,161,null,0,false,false,false,432954411938777,false,[[4,193]]]],[[92,38,null,158938756896015,false,[[1,[2,"heroSubmarineMoveHor"]],[13,[7,[0,1]]]]]]],[0,null,true,null,371680063461744,[[95,160,null,0,false,false,false,633000568505386,false,[[0,[23,"PLAYER0LEFTKEY"]]]],[95,160,null,0,false,false,false,757563379756300,false,[[0,[23,"PLAYER1LEFTKEY"]]]],[97,161,null,0,false,false,false,240630623945629,false,[[4,192]]]],[[92,38,null,852766023047953,false,[[1,[2,"heroSubmarineMoveHor"]],[13,[7,[0,-1]]]]]]],[0,null,true,null,575065502854910,[[95,160,null,0,false,false,false,912328562477489,false,[[0,[23,"PLAYER0JUMPKEY"]]]],[95,160,null,0,false,false,false,970669834469431,false,[[0,[23,"PLAYER1JUMPKEY"]]]],[97,161,null,0,false,false,false,210022257814157,false,[[4,194]]]],[[92,38,null,985473405572598,false,[[1,[2,"heroSubmarineMoveVer"]],[13,[7,[0,-1]]]]]]],[0,null,true,null,543897144598035,[[95,160,null,0,false,false,false,992896770341594,false,[[0,[23,"PLAYER0DOWNKEY"]]]],[95,160,null,0,false,false,false,581242758494556,false,[[0,[23,"PLAYER1DOWNKEY"]]]],[97,161,null,0,false,false,false,525938505482150,false,[[4,191]]]],[[92,38,null,914321301424095,false,[[1,[2,"heroSubmarineMoveVer"]],[13,[7,[0,1]]]]]]]]]]],[0,[true,"Moving"],false,null,109439163622034,[[-1,46,null,0,false,false,false,109439163622034,false,[[1,[2,"Moving"]]]]],[],[[0,[true,"Submarine"],false,null,780072573939247,[[-1,46,null,0,false,false,false,780072573939247,false,[[1,[2,"Submarine"]]]]],[],[[0,null,false,null,406202380237384,[[92,28,null,2,false,false,false,420999667209425,false,[[1,[2,"heroSubmarineMoveHor"]]]]],[],[[0,null,false,null,469443413210569,[[92,134,null,0,false,false,false,282991017397018,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[],[[0,null,false,null,502445442005625,[[141,42,null,0,false,false,false,868252598160136,false,[[10,0],[8,0],[7,[0,1]]]]],[[141,126,null,660930316399037,false,[[0,[4,[20,141,154,false,null],[23,"hero_swimmingAngleDelta"]]]]]]],[0,null,false,null,589813200781098,[[141,42,null,0,false,false,false,758027559466463,false,[[10,0],[8,0],[7,[0,-1]]]]],[[141,126,null,467254541627001,false,[[0,[4,[20,141,154,false,null],[23,"hero_swimmingAngleDelta"]]]]]]]]],[0,null,false,null,674341305669195,[[92,134,null,0,false,false,false,512498807101099,false,[[0,[0,0]],[8,0],[7,[0,-1]]]]],[],[[0,null,false,null,548527723432708,[[141,42,null,0,false,false,false,100723137834474,false,[[10,0],[8,0],[7,[0,1]]]]],[[141,126,null,703864214074321,false,[[0,[4,[20,141,154,false,null],[6,[23,"hero_swimmingAngleDelta"],[0,-1]]]]]]]],[0,null,false,null,527156961592888,[[141,42,null,0,false,false,false,118348154421497,false,[[10,0],[8,0],[7,[0,-1]]]]],[[141,126,null,269517230596662,false,[[0,[4,[20,141,154,false,null],[6,[23,"hero_swimmingAngleDelta"],[0,-1]]]]]]]]]]]],[0,null,false,null,709823510656651,[[92,28,null,2,false,false,false,871204046658010,false,[[1,[2,"heroSubmarineMoveVer"]]]]],[],[[0,null,false,null,453139745109575,[[92,134,null,0,false,false,false,936958842657063,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[],[[0,null,false,null,508898324815094,[[141,42,null,0,false,false,false,192444446043290,false,[[10,0],[8,0],[7,[0,1]]]]],[[141,166,"Car",357532565369634,false,[[3,3]]],[141,167,"Car",334288788780142,false,[[0,[0,100]]]],[141,168,"Car",563838447827459,false,[[0,[0,90]]]]]],[0,null,false,null,984582924224550,[[141,42,null,0,false,false,false,977457522650176,false,[[10,0],[8,0],[7,[0,-1]]]]],[[141,166,"Car",200987277373737,false,[[3,2]]],[141,167,"Car",187257984501755,false,[[0,[0,100]]]],[141,168,"Car",624938838655679,false,[[0,[0,90]]]]]]]],[0,null,false,null,347144012029453,[[92,134,null,0,false,false,false,629867816377647,false,[[0,[0,0]],[8,0],[7,[0,-1]]]]],[],[[0,null,false,null,141099340524422,[[141,42,null,0,false,false,false,441494610145888,false,[[10,0],[8,0],[7,[0,1]]]]],[[141,166,"Car",768473002899443,false,[[3,2]]],[141,167,"Car",267648201086936,false,[[0,[0,250]]]],[141,168,"Car",224392336137704,false,[[0,[0,225]]]]]],[0,null,false,null,983621680345519,[[141,42,null,0,false,false,false,628692426275960,false,[[10,0],[8,0],[7,[0,-1]]]]],[[141,166,"Car",920880956709734,false,[[3,3]]],[141,167,"Car",469436082610827,false,[[0,[0,250]]]],[141,168,"Car",930079785976655,false,[[0,[0,225]]]]]]]]]]]],[0,null,false,null,820857532560521,[[92,28,null,2,false,false,false,973369821197456,false,[[1,[2,"heroUpReleased"]]]]],[],[[0,null,false,null,277657935077370,[[141,42,null,0,false,false,false,410412853149807,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]]],[[141,45,null,464974080026383,false,[[10,2],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]]]]]],[0,null,false,null,858689681361470,[[92,28,null,2,false,false,false,776870683764336,false,[[1,[2,"heroJet"]]]],[141,42,null,0,false,true,false,572165625701686,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,168011983266966,[[141,42,null,0,false,false,false,274752439981046,false,[[10,5],[8,0],[7,[0,0]]]],[141,118,null,0,false,false,false,909215721902485,false,[[10,9]]],[141,118,null,0,false,false,false,287417882404980,false,[[10,10]]],[141,42,null,0,false,true,false,184845212633727,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,334631637999546,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,685016285894686,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,360458925758218,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,42,null,0,false,true,false,634528271534376,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,372719994727483,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,102374903564062,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,477288391434522,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,862995604148285,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,620970629186959,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]]],[[141,169,"Platform",202646415491109,false,[[0,[18,[14,[21,141,false,null,4],[0,-250]],[21,141,false,null,4],[5,[21,141,false,null,4],[6,[0,35],[6,[0,60],[7,[19,142],[19,170]]]]]]]]],[92,38,null,907879006273721,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,1]]]]]]],[0,null,false,null,279777214666723,[[141,42,null,0,false,false,false,218589016883713,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]]],[[141,45,null,827311819137460,false,[[10,2],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]]]]]],[0,null,false,null,324082970729345,[[92,28,null,2,false,false,false,564061841691130,false,[[1,[2,"moveJump"]]]],[141,42,null,0,false,true,false,433523858076140,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,397665835261691,[[141,42,null,0,false,false,false,487460955935640,false,[[10,5],[8,0],[7,[0,0]]]],[141,42,null,0,false,false,false,145887821944784,false,[[10,8],[8,0],[7,[0,0]]]],[141,42,null,0,false,true,false,749516059583747,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,489742826109609,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,460700951164619,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,304676687651731,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,42,null,0,false,true,false,590642408128260,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,118,null,0,false,true,false,462638963207082,false,[[10,9]]],[141,42,null,0,false,true,false,385316247447735,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,522700052727453,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,680265023087634,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,536191310279844,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,122553110426407,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,552295958521484,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,528898176481430,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,122478212900438,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,641563825659472,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]]],[[141,45,null,736066655933578,false,[[10,2],[7,[23,"STATE_FLIP"]]]],[141,169,"Platform",233348166980803,false,[[0,[18,[16,[21,141,false,null,4],[0,0]],[0,-430],[18,[14,[21,141,false,null,4],[0,-430]],[21,141,false,null,4],[0,-430]]]]]],[141,45,null,912520794261092,false,[[10,8],[7,[0,1]]]],[98,171,null,253109545466645,false,[[3,0],[1,[10,[2,"doublejump_"],[19,172,[[19,74,[[0,1],[0,2]]]]]]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,792030115784352,[[141,42,null,0,false,false,false,888851650332184,false,[[10,5],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,444733988234936,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,930586010692754,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,966418324208130,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,309966061140570,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,42,null,0,false,true,false,970478378449885,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,246072757333609,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,437440652192783,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,507389375155813,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,206882074579617,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,981820816760829,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,660072598272802,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,948716276538261,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,328913817674145,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,225290017398302,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]]],[[92,38,null,307800461037229,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,6]],[7,[4,[20,104,39,false,null,[[0,6],[0,1]]],[0,1]]]]]],[141,169,"Platform",198877623800042,false,[[0,[18,[16,[21,141,false,null,4],[0,0]],[0,-390],[18,[14,[21,141,false,null,4],[0,-390]],[21,141,false,null,4],[0,-390]]]]]],[98,171,null,807469257974977,false,[[3,0],[1,[10,[2,"jump_"],[19,172,[[19,74,[[0,1],[0,4]]]]]]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]],[[0,null,false,null,484610295140960,[[-1,40,null,0,false,false,false,662783324137906,false,[[7,[20,104,39,false,null,[[0,6],[0,1]]]],[8,5],[7,[0,200]]]]],[[92,38,null,483885417833745,false,[[1,[2,"showAchievement"]],[13,[7,[0,4]]]]]]],[0,null,false,null,830389157765554,[[-1,40,null,0,false,false,false,567035932324213,false,[[7,[20,104,39,false,null,[[0,6],[0,1]]]],[8,5],[7,[0,400]]]]],[[92,38,null,763994489823246,false,[[1,[2,"showAchievement"]],[13,[7,[0,10]]]]]]]]],[0,null,false,null,273865184192533,[[141,42,null,0,false,false,false,581707099685644,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]]],[[141,45,null,372569082517883,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,173,"Platform",784162164532181,false,[[0,[6,[21,141,false,null,0],[0,-420]]]]],[141,169,"Platform",213013315833958,false,[[0,[0,-420]]]],[141,45,null,861718011860988,false,[[10,17],[7,[21,141,false,null,0]]]]]],[0,null,false,null,951672620094295,[[141,42,null,0,false,false,false,634197352764025,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,118,null,0,false,false,false,118542957370205,false,[[10,14]]]],[[141,45,null,225593672508614,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,138,null,148119895142285,false,[[4,140],[7,[0,0]]]],[141,174,"Platform",513872625089859,false,[[3,1]]],[141,121,null,231909241492143,false,[[10,14],[3,0]]],[141,121,null,898624478945565,false,[[10,13],[3,0]]]],[[0,null,false,null,518567254210553,[[140,90,null,0,false,false,true,521176288695106,false,[[0,[21,141,false,null,15]]]]],[[140,121,null,610871560548536,false,[[10,0],[3,0]]],[141,138,null,198960880962950,false,[[4,140],[7,[0,1]]]],[141,45,null,624389886502271,false,[[10,15],[7,[0,0]]]],[141,173,"Platform",115329724757775,false,[[0,[6,[19,175,[[5,[20,140,154,false,null],[6,[21,141,false,null,0],[0,90]]]]],[0,-650]]]]],[141,169,"Platform",188886391816743,false,[[0,[6,[19,176,[[5,[20,140,154,false,null],[6,[21,141,false,null,0],[0,90]]]]],[0,650]]]]],[141,149,"Platform",779279757043961,false,[[0,[0,0]]]],[141,45,null,800707021729089,false,[[10,8],[7,[0,0]]]]]],[0,null,false,null,264849644161187,[],[[-1,92,null,372926020278006,false,[[0,[1,0.5]]]],[141,121,null,799855230504915,false,[[10,13],[3,1]]]]]]],[0,null,false,null,412956199998761,[[141,42,null,0,false,false,false,580831685775785,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,118,null,0,false,false,false,349281841240823,false,[[10,21]]]],[[141,45,null,158492805528172,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,138,null,420572943153050,false,[[4,152],[7,[0,0]]]],[141,174,"Platform",919547641849873,false,[[3,1]]],[141,121,null,119634265880807,false,[[10,21],[3,0]]],[141,121,null,516453239233343,false,[[10,20],[3,0]]]],[[0,null,false,null,491326893818949,[[152,90,null,0,false,false,true,302517016337453,false,[[0,[21,141,false,null,22]]]]],[[152,121,null,811049262570598,false,[[10,0],[3,0]]],[141,138,null,235540961183122,false,[[4,152],[7,[0,1]]]],[141,45,null,625776319644994,false,[[10,22],[7,[0,0]]]],[141,149,"Platform",167276694813941,false,[[0,[0,0]]]],[141,173,"Platform",823092412228675,false,[[0,[6,[19,175,[[20,152,154,false,null]]],[0,-500]]]]],[141,169,"Platform",137145408039460,false,[[0,[0,-300]]]],[141,45,null,571117622261564,false,[[10,8],[7,[0,0]]]]]],[0,null,false,null,270687787718795,[],[[-1,92,null,326564366198510,false,[[0,[1,0.2]]]],[141,121,null,306982870173759,false,[[10,20],[3,1]]]]]]],[0,null,false,null,768504732614020,[[141,42,null,0,false,false,false,633770259090514,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]]],[[141,55,null,626075737103514,false,[[1,[2,"jumpThroght"]],[3,1]]],[141,174,"Platform",414251627143183,false,[[3,1]]],[141,177,"Pin",948854448400171,false],[141,45,null,435694048089810,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,169,"Platform",409996428229312,false,[[0,[0,-500]]]],[141,173,"Platform",652839180973225,false,[[0,[6,[21,141,false,null,0],[0,800]]]]],[141,158,null,439729988576456,false,[[0,[4,[20,141,44,false,null],[6,[6,[21,141,false,null,0],[0,-1]],[0,5]]]]]],[141,178,null,252868987924848,false,[[0,[5,[20,141,78,false,null],[0,20]]]]]],[[0,null,false,null,943904968773849,[],[[141,121,null,448060267981548,false,[[10,16],[3,0]]],[-1,92,null,981502914376734,false,[[0,[1,0.3]]]],[141,55,null,663946075463147,false,[[1,[2,"normal"]],[3,1]]],[141,121,null,114918365972472,false,[[10,16],[3,1]]]]]]]]],[0,null,false,null,847960772330314,[[92,28,null,2,false,false,false,834603925558705,false,[[1,[2,"move"]]]],[141,42,null,0,false,true,false,228720555661145,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,966142039430266,false,[[10,6],[7,[20,92,31,false,null,[[0,0]]]]]]],[[0,null,false,null,882605173663759,[[141,42,null,0,false,true,false,819918912406994,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,105367807874904,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,740139185628892,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]],[141,42,null,0,false,true,false,936992490848115,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,455218120193192,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,329369112404418,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,612779339763433,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,631779651629093,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,397933213736756,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,120081501314677,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,509171184439510,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,542582275201168,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,206887464836589,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,158780066154547,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,950228554223743,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]]],[[92,38,null,612179097366527,false,[[1,[2,"changefaceDir"]],[13,[7,[20,92,31,false,null,[[0,0]]]]]]]],[[0,null,false,null,916430617955674,[[-1,40,null,0,false,false,false,800103186416247,false,[[7,[20,92,31,false,null,[[0,0]]]],[8,0],[7,[0,-1]]]]],[[141,179,"Platform",774137918528700,false,[[3,0]]]]],[0,null,false,null,225986627457466,[[-1,40,null,0,false,false,false,676097995606351,false,[[7,[20,92,31,false,null,[[0,0]]]],[8,0],[7,[0,1]]]]],[[141,179,"Platform",689723264103606,false,[[3,1]]]]]]]]],[0,null,false,null,142747914542257,[[92,28,null,2,false,false,false,654495193878526,false,[[1,[2,"moveRoll"]]]],[141,42,null,0,false,true,false,547593135731564,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,118,null,0,false,true,false,373385209399658,false,[[10,9]]]],[],[[0,null,false,null,888290967464232,[[141,42,null,0,false,false,false,378996615678306,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]]],[[92,38,null,455700171811034,false,[[1,[2,"changefaceDir"]],[13,[7,[20,92,31,false,null,[[0,0]]]]]]],[141,180,"Platform",654503611284668,false,[[0,[23,"HERO_ROLLSPEED"]]]],[141,173,"Platform",681375389585271,false,[[0,[6,[23,"HERO_ROLLSPEED"],[20,92,31,false,null,[[0,0]]]]]]],[141,45,null,535928937460367,false,[[10,2],[7,[23,"STATE_ROLL"]]]],[92,38,null,443696201451659,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,9]],[7,[4,[20,104,39,false,null,[[0,9],[0,1]]],[0,1]]]]]]]],[0,null,false,null,890093324829540,[[141,42,null,0,false,false,false,967874723750861,false,[[10,2],[8,0],[7,[23,"STATE_RUN"]]]]],[[92,38,null,431088928981380,false,[[1,[2,"changefaceDir"]],[13,[7,[20,92,31,false,null,[[0,0]]]]]]],[141,180,"Platform",499305945308264,false,[[0,[23,"HERO_ROLLSPEED"]]]],[141,173,"Platform",536248782182144,false,[[0,[6,[23,"HERO_ROLLSPEED"],[20,92,31,false,null,[[0,0]]]]]]],[141,45,null,750417765415202,false,[[10,2],[7,[23,"STATE_ROLL"]]]],[92,38,null,810434704136076,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,9]],[7,[4,[20,104,39,false,null,[[0,9],[0,1]]],[0,1]]]]]]]]]],[0,null,false,null,295800501861935,[[92,28,null,2,false,false,false,931281944095144,false,[[1,[2,"moveDown"]]]],[141,42,null,0,false,true,false,520403490293177,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,118,null,0,false,true,false,835839984453839,false,[[10,9]]]],[[141,45,null,864802748392774,false,[[10,1],[7,[0,1]]]]],[[0,null,false,null,249908743140635,[[141,42,null,0,false,false,false,220985543426646,false,[[10,2],[8,0],[7,[23,"STATE_IDLE"]]]]],[[141,45,null,507742798150623,false,[[10,2],[7,[23,"STATE_SEAT_DOWN"]]]]]],[0,null,true,null,418103008145297,[[141,42,null,0,false,false,false,422700746283991,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,false,false,983833187886140,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]]],[[141,174,"Platform",916360004991725,false,[[3,1]]],[141,177,"Pin",850466400235336,false],[141,45,null,347190039596553,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,173,"Platform",499602961513227,false,[[0,[0,0]]]],[141,169,"Platform",743501082453769,false,[[0,[0,0]]]],[141,158,null,768279406434367,false,[[0,[4,[20,141,44,false,null],[6,[6,[21,141,false,null,0],[0,-1]],[0,6]]]]]],[141,158,null,626700900067078,false,[[0,[4,[20,141,44,false,null],[6,[6,[21,141,false,null,0],[0,-1]],[0,6]]]]]],[141,178,null,256767821934472,false,[[0,[4,[20,141,78,false,null],[0,0]]]]]],[[0,null,false,null,531237346075423,[],[[141,121,null,567854826209723,false,[[10,16],[3,0]]],[-1,92,null,236778261787943,false,[[0,[1,0.3]]]],[141,121,null,507286360288155,false,[[10,16],[3,1]]]]]]],[0,null,false,null,972139372563203,[[141,42,null,0,false,false,false,611949390102012,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]]],[[141,121,null,202832929542920,false,[[10,18],[3,0]]],[141,174,"Platform",240593399538493,false,[[3,1]]],[141,177,"Pin",671841951062899,false],[141,45,null,998911087643710,false,[[10,2],[7,[23,"STATE_FALL"]]]],[141,173,"Platform",659383004576081,false,[[0,[0,0]]]],[141,169,"Platform",241246223341355,false,[[0,[0,0]]]]],[[0,null,false,null,609693225848841,[[154,90,null,0,false,false,true,903134568924211,false,[[0,[21,141,false,null,19]]]]],[[154,121,null,543655046022201,false,[[10,0],[3,0]]]]],[0,null,false,null,851128379841485,[],[[-1,92,null,253759344045323,false,[[0,[1,0.5]]]],[141,121,null,521535412812253,false,[[10,18],[3,1]]]]]]]]],[0,null,false,null,489418311471078,[[92,28,null,2,false,false,false,643784927777963,false,[[1,[2,"moveUp"]]]],[141,42,null,0,false,true,false,915552514992870,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,750896272938736,false,[[10,1],[7,[0,0]]]]],[[0,null,false,null,306230332713388,[[141,42,null,0,false,false,false,122494615706472,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]]],[[141,45,null,450587794390013,false,[[10,2],[7,[23,"STATE_SEAT_UP"]]]]]]]],[0,null,false,null,125668350644462,[[92,28,null,2,false,false,false,438340375974019,false,[[1,[2,"changefaceDir"]]]],[141,42,null,0,false,true,false,239525659580718,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,439514333278897,false,[[10,0],[7,[20,92,31,false,null,[[0,0]]]]]]],[[0,null,false,null,667833690562870,[[141,42,null,0,false,false,false,202240526913259,false,[[10,0],[8,0],[7,[0,1]]]]],[[159,181,null,356290139375595,false,[[3,1]]],[157,181,null,828987121880475,false,[[3,1]]]]],[0,null,false,null,113480332808788,[[141,42,null,0,false,false,false,506663874474630,false,[[10,0],[8,0],[7,[0,-1]]]]],[[159,181,null,611178462580393,false,[[3,0]]],[157,181,null,388957486063316,false,[[3,0]]]]]]],[0,null,false,null,282973188100220,[[92,28,null,2,false,false,false,338172949631584,false,[[1,[2,"moveSliding"]]]],[141,42,null,0,false,true,false,451082655814641,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,252815597689027,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,512106089637158,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]]],[[92,38,null,552802345258163,false,[[1,[2,"changefaceDir"]],[13,[7,[20,92,31,false,null,[[0,0]]]]]]]],[[0,null,false,null,184712292720786,[[141,42,null,0,false,false,false,175548676957120,false,[[10,5],[8,0],[7,[0,0]]]]],[[141,45,null,636721317772042,false,[[10,7],[7,[20,92,31,false,null,[[0,0]]]]]],[141,45,null,953989260966775,false,[[10,2],[7,[23,"STATE_WALL_SLIDING"]]]]]],[0,null,false,null,394229314383072,[],[]]]],[0,null,false,null,300445074799999,[],[]]]],[0,[true,"SWITCHES ANIMATION"],false,null,924577665734859,[[-1,46,null,0,false,false,false,924577665734859,false,[[1,[2,"SWITCHES ANIMATION"]]]]],[],[[0,null,false,null,102643734762645,[[141,42,null,0,false,false,false,960439592491728,false,[[10,5],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,507034264068056,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,201128548629723,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,578762717262222,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]],[141,42,null,0,false,true,false,789131772952587,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,659607715984775,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,445787748228159,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,413313278510592,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,243769119328483,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,148748001824980,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,748959562337676,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,874477337359539,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,768012431804716,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,748284784056945,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,717646792273562,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,290127437022992,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,198102026172676,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,241203755455090,[[141,42,null,0,false,false,false,335887288954700,false,[[10,3],[8,3],[7,[0,10]]]],[141,42,null,0,false,false,false,791391039489278,false,[[10,3],[8,5],[7,[0,-10]]]]],[[141,45,null,420553442421915,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]],[0,null,true,null,473648584032282,[[141,42,null,0,false,false,false,834031132862888,false,[[10,3],[8,2],[7,[0,-10]]]],[141,42,null,0,false,false,false,447638886569212,false,[[10,3],[8,4],[7,[0,10]]]]],[[141,45,null,590824905243008,false,[[10,2],[7,[23,"STATE_RUN"]]]]]],[0,null,false,null,834297984542034,[],[]]]],[0,null,false,null,717236263608946,[[141,42,null,0,false,false,false,572813856417231,false,[[10,5],[8,0],[7,[0,0]]]],[141,42,null,0,false,true,false,455843005398135,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,42,null,0,false,true,false,969335459835482,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,651612932210038,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,614731955333504,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,642557873828586,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,633328176841844,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,486912191903041,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,520512202862738,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,425897508623990,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]],[141,42,null,0,false,true,false,477026572640964,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,559770395369727,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,672524285493264,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,811441838011242,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,839992188396274,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,751783520153975,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,228046247741186,[[141,42,null,0,false,false,false,141506405097475,false,[[10,4],[8,4],[7,[0,0]]]]],[[141,45,null,592917588476960,false,[[10,2],[7,[23,"STATE_FALL"]]]]]],[0,null,false,null,396399826598566,[[141,42,null,0,false,false,false,709960960436558,false,[[10,4],[8,2],[7,[0,0]]]]],[[141,45,null,316756444654899,false,[[10,2],[7,[23,"STATE_JUMP"]]]]]]]],[0,null,false,null,190392297057857,[[157,182,null,1,false,false,false,790496756264334,false,[[1,[2,"flip"]]]],[141,42,null,0,false,false,false,750415788729215,false,[[10,5],[8,0],[7,[0,0]]]],[141,42,null,0,false,false,false,269011515450793,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]]],[[141,45,null,992676580187045,false,[[10,2],[7,[23,"STATE_FALL"]]]]]],[0,null,false,null,218233581328939,[[157,182,null,1,false,false,false,442908781947506,false,[[1,[2,"joint_down"]]]],[141,42,null,0,false,false,false,499012970363342,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]]],[[141,45,null,560778616805565,false,[[10,2],[7,[23,"STATE_JOINT_CONVEUR"]]]]]],[0,null,false,null,626906953892551,[[157,182,null,1,false,false,false,757540216429024,false,[[1,[2,"stand_up"]]]],[141,42,null,0,false,true,false,426693968494303,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,791806942829949,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,263559352203098,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,217959872752678,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,379665356566667,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,462706429150783,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,720269796650318,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,520651012334731,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,121865282716620,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,335436163765325,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,448854102028486,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]],[0,null,false,null,899485696461008,[[157,182,null,1,false,false,false,284598719918998,false,[[1,[2,"roll"]]]],[141,42,null,0,false,true,false,747180247241569,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,344555404445815,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,289958301371861,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,524407019192634,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,261953149183184,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,188616448400403,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,390154604750652,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,146433581662229,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,655506055247866,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,751600820411798,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,812327174593684,[[141,42,null,0,false,false,false,870513576195686,false,[[10,6],[8,0],[7,[0,0]]]]],[[141,45,null,693758759078984,false,[[10,2],[7,[23,"STATE_SEAT_DOWN"]]]],[157,55,null,815881954912008,false,[[1,[2,"sit"]],[3,1]]],[157,81,null,966291021521484,false,[[0,[0,2]]]]]],[0,null,false,null,476294173103808,[[141,42,null,0,false,true,false,768531436446998,false,[[10,6],[8,0],[7,[0,0]]]]],[[141,45,null,697856138442684,false,[[10,2],[7,[23,"STATE_RUN"]]]],[141,173,"Platform",739703027180620,false,[[0,[6,[21,141,false,null,0],[0,300]]]]]]]]],[0,null,false,null,223246725637763,[[141,42,null,0,false,false,false,621276394534581,false,[[10,4],[8,5],[7,[0,900]]]],[141,42,null,0,false,true,false,190788345290350,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,119952406634438,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,580741553177434,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,913753751893429,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,313732373129165,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,221264250567854,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,778525928926279,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,473255705413236,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,730104780269381,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,320013388086373,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,874962082326556,false,[[10,2],[7,[23,"STATE_FALL_DEATH"]]]],[141,169,"Platform",530775701334940,false,[[0,[0,900]]]]]],[0,null,false,null,113360678654854,[[141,42,null,0,false,false,false,709132679360797,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]],[141,42,null,0,false,true,false,485366463545483,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,629315798390546,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,792895473181821,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,776971986688465,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,447921051717565,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,291729552109205,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,897654349877355,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,42,null,0,false,true,false,656454907786603,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]],[141,42,null,0,false,true,false,443103543072128,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]],[141,42,null,0,false,true,false,825517365842337,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,771097562363749,[[141,42,null,0,false,false,false,413877659987868,false,[[10,4],[8,4],[7,[23,"HERO_WALL_SLIDING"]]]]],[[141,169,"Platform",211709103103238,false,[[0,[23,"HERO_WALL_SLIDING"]]]]]],[0,null,false,null,802037610195603,[[141,42,null,0,false,false,false,618615556800908,false,[[10,5],[8,0],[7,[0,1]]]]],[[141,45,null,263943251173521,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]],[0,null,false,null,119296194959418,[[141,42,null,0,false,false,false,341903725550488,false,[[10,7],[8,0],[7,[0,0]]]]],[[141,45,null,700836321066863,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]]]],[0,null,false,null,838696833047917,[[141,42,null,0,false,false,false,336910372047024,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]]],[[157,126,null,787426957506616,false,[[0,[4,[20,141,154,false,null],[6,[0,90],[21,141,false,null,0]]]]]]]],[0,null,false,null,530335217501345,[],[]]]],[0,[true,"STATES"],false,null,132634965133666,[[-1,46,null,0,false,false,false,132634965133666,false,[[1,[2,"STATES"]]]]],[],[[0,null,false,null,449700595446451,[[141,42,null,0,false,false,false,938420531135783,false,[[10,2],[8,0],[7,[23,"STATE_IDLE"]]]]],[[157,55,null,649555041241855,false,[[1,[2,"idle"]],[3,1]]],[141,180,"Platform",917446133702694,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,491999324472889,false,[[10,17],[7,[0,0]]]],[141,55,null,657905920890065,false,[[1,[2,"normal"]],[3,1]]]]],[0,null,false,null,615891969537086,[[141,42,null,0,false,false,false,218475189059938,false,[[10,2],[8,0],[7,[23,"STATE_RUN"]]]]],[[157,55,null,401671832829204,false,[[1,[2,"run"]],[3,1]]],[141,180,"Platform",495018086602502,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,728227846696357,false,[[10,17],[7,[0,0]]]],[141,55,null,794899978780149,false,[[1,[2,"normal"]],[3,1]]]]],[0,null,false,null,163659141444060,[[141,42,null,0,false,false,false,499160883383613,false,[[10,2],[8,0],[7,[23,"STATE_ROLL"]]]]],[[157,55,null,270734079169355,false,[[1,[2,"roll"]],[3,1]]],[141,45,null,981701362014012,false,[[10,17],[7,[0,0]]]],[141,55,null,590481217480284,false,[[1,[2,"setDown"]],[3,1]]]]],[0,null,false,null,968703271359652,[[141,42,null,0,false,false,false,653974245573970,false,[[10,2],[8,0],[7,[23,"STATE_JUMP"]]]]],[],[[0,null,false,null,163280220339613,[[157,91,null,0,false,true,false,170586456455473,false,[[1,[2,"jump"]]]]],[[157,55,null,336901688748387,false,[[1,[2,"jump"]],[3,1]]],[141,180,"Platform",380536959529539,false,[[0,[23,"hero_SpeedMaxX"]]]]]]]],[0,null,false,null,225022966503976,[[141,42,null,0,false,false,false,635893275645597,false,[[10,2],[8,0],[7,[23,"STATE_FALL"]]]]],[[157,55,null,576142095369486,false,[[1,[2,"fall"]],[3,1]]],[141,180,"Platform",872009142924237,false,[[0,[23,"hero_SpeedMaxX"]]]]]],[0,null,false,null,967919306734703,[[141,42,null,0,false,false,false,786330941585816,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]]],[[157,55,null,249043357666078,false,[[1,[2,"flip"]],[3,1]]],[141,180,"Platform",353105009650399,false,[[0,[23,"hero_SpeedMaxX"]]]]]],[0,null,false,null,152056428347163,[[141,42,null,0,false,false,false,945815512179134,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]]],[[157,55,null,330711847655988,false,[[1,[2,"sit"]],[3,1]]],[141,180,"Platform",751343918902141,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,454279863929183,false,[[10,17],[7,[0,0]]]],[141,55,null,166040977344378,false,[[1,[2,"setDown"]],[3,1]]]]],[0,null,false,null,200224429681610,[[141,42,null,0,false,false,false,806029314333416,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]]],[[157,55,null,129189995462021,false,[[1,[2,"stand_up"]],[3,1]]],[141,180,"Platform",884681870771525,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,140024101006933,false,[[10,17],[7,[0,0]]]],[141,55,null,699291729470146,false,[[1,[2,"setDown"]],[3,1]]]]],[0,null,false,null,279604350102094,[[141,42,null,0,false,false,false,434280186912822,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]]],[[157,55,null,866650964283452,false,[[1,[2,"stand_up"]],[3,1]]],[141,180,"Platform",675836585543235,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,726623590782347,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,960395855428948,[[141,42,null,0,false,false,false,635679987728779,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]]],[[157,55,null,835367307262798,false,[[1,[2,"fall_death"]],[3,1]]],[141,180,"Platform",996626922752160,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,889033760149795,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,997483098749977,[[141,42,null,0,false,false,false,701136087625592,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]]],[[157,55,null,803138850705657,false,[[1,[2,"joint_wall"]],[3,1]]],[141,180,"Platform",806402419812095,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,339286304023472,false,[[10,8],[7,[0,0]]]]]],[0,null,false,null,211296442100988,[[141,42,null,0,false,false,false,324088361528730,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]]],[[157,55,null,734135257634774,false,[[1,[2,"joint_wall"]],[3,1]]],[141,180,"Platform",852268527621158,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,343435434377758,false,[[10,17],[7,[0,0]]]],[141,45,null,576818432215043,false,[[10,8],[7,[0,0]]]]]],[0,null,false,null,666586250075810,[[141,42,null,0,false,false,false,190377275691589,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]]],[[157,55,null,464428191591180,false,[[1,[2,"moto"]],[3,1]]],[141,45,null,360873464820105,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,996122198482871,[[141,42,null,0,false,false,false,700760182136980,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]]],[[157,55,null,983082086865010,false,[[1,[2,"rocket"]],[3,1]]],[141,180,"Platform",628747333007017,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,113748733667965,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,808639420409266,[[141,42,null,0,false,false,false,421521351432864,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]]],[[141,180,"Platform",392522494872299,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,736443748864734,false,[[10,17],[7,[0,0]]]]],[[0,null,false,null,745133969970308,[[141,42,null,0,false,false,false,626259816950539,false,[[10,6],[8,0],[7,[0,-1]]]]],[[157,55,null,707885400580355,false,[[1,[18,[12,[21,141,false,null,0],[0,-1]],[2,"swiming_right"],[2,"swiming_left"]]],[3,1]]]]],[0,null,false,null,549161205599553,[[-1,69,null,0,false,false,false,983388684932500,false],[141,42,null,0,false,false,false,663408678587021,false,[[10,6],[8,0],[7,[0,1]]]]],[[157,55,null,918284032158781,false,[[1,[18,[12,[21,141,false,null,0],[0,-1]],[2,"swiming_left"],[2,"swiming_right"]]],[3,1]]]]],[0,null,false,null,383102409972168,[[-1,69,null,0,false,false,false,522354478074101,false]],[],[[0,null,false,null,715923723095419,[[141,183,"Car",0,false,false,false,278726734145534,false,[[8,4],[0,[0,2]]]]],[[157,55,null,580437266211125,false,[[1,[2,"swiming_go"]],[3,1]]]]],[0,null,false,null,997344454530356,[[-1,69,null,0,false,false,false,741124841785426,false],[141,42,null,0,false,false,false,154030497422866,false,[[10,6],[8,0],[7,[0,0]]]]],[[157,55,null,435189391198247,false,[[1,[2,"swiming_stay"]],[3,0]]]]]]]]],[0,null,false,null,749751593265124,[[141,42,null,0,false,false,false,561142975637488,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]]],[[157,55,null,705234287827379,false,[[1,[2,"jointRotateble"]],[3,1]]],[141,180,"Platform",753833615918164,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,767739371267907,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,906124199919366,[[141,42,null,0,false,false,false,902298841417357,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]]],[[157,55,null,672412009591407,false,[[1,[2,"joint_conveur"]],[3,1]]],[141,180,"Platform",325710230511249,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,538722976365456,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,561780199332126,[[141,42,null,0,false,false,false,225016130573944,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]]],[[157,55,null,777042329237285,false,[[1,[2,"joint_up"]],[3,1]]],[141,180,"Platform",159668909482120,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,270627982543612,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,225444214766236,[[141,42,null,0,false,false,false,940281653175137,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]]],[[157,55,null,168901968517611,false,[[1,[2,"joint_down"]],[3,1]]],[141,180,"Platform",324795019028684,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,455974459021555,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,946414234635999,[[141,42,null,0,false,false,false,130416537327265,false,[[10,2],[8,0],[7,[23,"STATE_FINISHED"]]]]],[[157,55,null,338514131460735,false,[[1,[2,"finish"]],[3,1]]],[141,180,"Platform",214095814356374,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,212258657856709,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,541968953263818,[[141,42,null,0,false,false,false,497266770377040,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_SWING"]]]]],[[157,55,null,462013250407331,false,[[1,[2,"jointRotateble"]],[3,1]]],[141,180,"Platform",319025633119751,false,[[0,[23,"hero_SpeedMaxX"]]]],[141,45,null,150241554705866,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,879780083397967,[[141,42,null,0,false,false,false,125966774244886,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[157,83,null,851169984295639,false,[[3,0]]],[159,83,null,656658139178826,false,[[3,0]]]]]]],[0,[true,"Group"],false,null,543212110682506,[[-1,46,null,0,false,false,false,543212110682506,false,[[1,[2,"Group"]]]]],[],[[0,null,false,null,976632576621323,[],[[159,126,null,292261983376908,false,[[0,[20,157,154,false,null]]]],[159,139,null,963795838689035,false,[[3,1],[4,157]]],[159,177,"Pin",409336042351632,false],[159,138,null,911484902446679,false,[[4,157],[7,[0,1]]]],[159,127,"Pin",396503716899979,false,[[4,157],[3,0]]],[172,184,null,233675619401041,false,[[4,159],[7,[0,1]]]],[170,184,null,325017460333081,false,[[4,159],[7,[0,1]]]],[171,184,null,775993510726916,false,[[4,157],[7,[0,1]]]],[171,152,null,396610094845604,false,[[0,[18,[12,[21,141,false,null,0],[0,1]],[4,[20,157,154,false,null],[0,180]],[20,157,154,false,null]]]]],[171,152,null,638894786054223,false,[[0,[18,[12,[21,141,false,null,0],[0,1]],[4,[20,157,154,false,null],[0,180]],[20,157,154,false,null]]]]],[172,185,null,118870207830746,false,[[3,1],[4,159]]],[171,185,null,721596142082620,false,[[3,1],[4,159]]],[170,185,null,216342906660942,false,[[3,1],[4,172]]]]]]],[0,[true,"Effect"],false,null,532296061581843,[[-1,46,null,0,false,false,false,532296061581843,false,[[1,[2,"Effect"]]]]],[],[[0,null,false,null,195243997248226,[[92,28,null,2,false,false,false,699515717210498,false,[[1,[2,"heroActivateJetpackEffect"]]]]],[],[[0,null,false,null,717970523248595,[[92,134,null,0,false,false,false,941658708627729,false,[[0,[0,0]],[8,0],[7,[0,0]]]]],[[170,186,null,387204903232132,false,[[3,0]]],[172,186,null,412989699424209,false,[[3,0]]]],[[0,null,false,null,393464733343395,[],[[98,187,null,265168597857629,false,[[1,[2,"jetpack"]]]]]]]],[0,null,false,null,118083912412508,[[92,134,null,0,false,false,false,897628023610504,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[[170,186,null,463877941003749,false,[[3,1]]],[172,186,null,746792922111041,false,[[3,1]]]],[[0,null,false,null,233557602605189,[[-1,146,null,0,false,false,false,241331295444803,false]],[[98,147,null,352655665654887,false,[[2,["jetpack_loop",false]],[3,1],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"jetpack"]]]]]]]]]],[0,null,false,null,165950350085433,[[92,28,null,2,false,false,false,614373927707101,false,[[1,[2,"heroActivateSubmorineEffect"]]]]],[],[[0,null,false,null,986434688821528,[[92,134,null,0,false,false,false,164996177949835,false,[[0,[0,0]],[8,0],[7,[0,0]]]]],[[171,186,null,407436688854651,false,[[3,0]]]]],[0,null,false,null,548077146663150,[[92,134,null,0,false,false,false,767548663054115,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[[171,186,null,829673115819254,false,[[3,1]]]]]]],[0,null,false,null,556778298801971,[[92,28,null,2,false,false,false,371184365163342,false,[[1,[2,"heroUpdateJetpackVision"]]]]],[],[[0,null,false,null,162196473511363,[[141,118,null,0,false,false,false,677440402175353,false,[[10,9]]]],[[159,83,null,219034211667313,false,[[3,1]]]]],[0,null,false,null,110038582071783,[[141,118,null,0,false,true,false,257952256016315,false,[[10,9]]]],[[159,83,null,693533454470513,false,[[3,0]]]]]]]]],[0,[true,"TakeSmth"],false,null,183341461380037,[[-1,46,null,0,false,false,false,183341461380037,false,[[1,[2,"TakeSmth"]]]]],[],[[0,null,false,null,751564272021992,[[141,188,null,0,false,false,true,570405765790225,false,[[4,112]]]],[[98,147,null,289463984904409,false,[[2,["pickup_diamond",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[-1,77,null,899465095142705,false,[[4,164],[5,[20,112,63,true,null]],[0,[20,112,44,false,null]],[0,[20,112,78,false,null]]]],[112,67,null,803267513282884,false],[-1,136,null,747046909739076,false,[[11,"GUIcurrentCoinsNumber"],[7,[0,1]]]]]],[0,null,false,null,540658556278878,[[141,188,null,0,false,false,true,690211817029411,false,[[4,146]]]],[[98,147,null,603686340834386,false,[[2,["pickup_star",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[-1,77,null,591727644496487,false,[[4,164],[5,[20,146,63,true,null]],[0,[20,146,44,false,null]],[0,[20,146,78,false,null]]]],[146,67,null,174921714621989,false],[-1,136,null,627659200802506,false,[[11,"GUIcurrentStarsNumber"],[7,[0,1]]]],[92,38,null,736266729464503,false,[[1,[2,"showAchievement"]],[13,[7,[0,11]]]]]]],[0,null,false,null,748766195994937,[[141,188,null,0,false,false,true,939655200558912,false,[[4,135]]]],[],[[0,null,false,null,528861995886916,[[141,118,null,0,false,true,false,585217248568002,false,[[10,9]]],[141,42,null,0,false,true,false,472893636470777,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]]],[[141,121,null,841045959144424,false,[[10,9],[3,1]]],[92,38,null,353347675668975,false,[[1,[2,"heroUpdateJetpackVision"]],[13]]]]]]],[0,null,false,null,854787516364375,[[141,188,null,0,false,false,true,911037440023305,false,[[4,136]]]],[],[[0,null,false,null,754791931211744,[[141,42,null,0,false,true,false,656247455732417,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,832314187374140,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]]],[[98,147,null,101028924965331,false,[[2,["moto_skid",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[141,45,null,400934346916619,false,[[10,2],[7,[23,"STATE_MOTO"]]]],[160,140,null,650464638864894,false,[[3,1],[1,[2,"BlurHorizontal"]]]],[160,189,null,656500953890130,false,[[1,[2,"BlurHorizontal"]],[0,[0,0]],[0,[0,100]]]],[141,149,"Platform",613264167181872,false,[[0,[0,0]]]],[141,173,"Platform",661862922867371,false,[[0,[6,[21,141,false,null,0],[0,1500]]]]],[141,180,"Platform",652235554452437,false,[[0,[0,1000]]]],[129,190,"Solid",158171870987123,false,[[3,0]]],[-1,92,null,261699578542558,false,[[0,[0,1]]]],[129,190,"Solid",123965749187424,false,[[3,1]]],[160,189,null,810633230439094,false,[[1,[2,"BlurHorizontal"]],[0,[0,0]],[0,[0,0]]]],[160,140,null,251663230942290,false,[[3,1],[1,[2,"BlurVertical"]]]],[141,149,"Platform",877383904318546,false,[[0,[0,2500]]]]],[[0,null,false,null,496758224450358,[[141,42,null,0,false,true,false,594661156566562,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]]],[[141,45,null,951008868841954,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]]]]]],[0,null,false,null,685312474665560,[[141,188,null,0,false,false,true,965276553172388,false,[[4,204]]],[141,42,null,0,false,true,false,858229540915074,false,[[10,27],[8,0],[7,[0,0]]]],[141,42,null,0,false,true,false,910315669756841,false,[[10,27],[8,0],[7,[1,0.2]]]]],[],[[0,null,false,null,672815431667651,[],[[-1,77,null,461348990515556,false,[[4,205],[5,[2,"GUI"]],[0,[7,[19,191],[0,2]]],[0,[7,[19,192],[0,2]]]]],[141,45,null,939800962726808,false,[[10,27],[7,[1,0.2]]]],[98,137,null,615587416476665,false,[[1,[2,"gameplay"]],[0,[1,0.5]]]],[98,137,null,649109830460886,false,[[1,[2,"gameplayMusic"]],[0,[1,0.5]]]],[-1,110,null,819774135207411,false,[[0,[21,141,false,null,27]]]],[-1,113,null,380023256622487,false,[[4,141],[0,[0,1]]]],[-1,113,null,758520446619806,false,[[4,157],[0,[0,1]]]],[-1,92,null,310417586058485,false,[[0,[21,204,false,null,0]]]],[205,193,"FadeOut",289521860175430,false],[141,45,null,379416864930594,false,[[10,27],[7,[0,1]]]],[98,137,null,397012849012782,false,[[1,[2,"gameplay"]],[0,[0,1]]]],[98,137,null,791886549756890,false,[[1,[2,"gameplayMusic"]],[0,[0,1]]]]],[[0,null,false,null,300475212835335,[[-1,40,null,0,false,true,false,956603075648256,false,[[7,[19,170]],[8,0],[7,[0,0]]]]],[[-1,110,null,392634714385350,false,[[0,[21,141,false,null,27]]]]]]]]]],[0,null,false,null,446232622952278,[[141,188,null,0,false,false,true,472411514199603,false,[[4,137]]]],[],[[0,null,false,null,288219284957664,[[141,42,null,0,false,true,false,805832075372550,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,446505824172552,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]]],[[98,147,null,404295759627471,false,[[2,["rocket",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[141,45,null,352926576597800,false,[[10,2],[7,[23,"STATE_ROCKET"]]]],[141,169,"Platform",368216584743580,false,[[0,[0,-1500]]]],[160,140,null,601606738141222,false,[[3,1],[1,[2,"BlurVertical"]]]],[160,189,null,838383661529315,false,[[1,[2,"BlurVertical"]],[0,[0,0]],[0,[0,100]]]],[129,190,"Solid",745885549931929,false,[[3,0]]],[-1,92,null,698747748885164,false,[[0,[21,137,false,null,0]]]],[129,190,"Solid",682824185878183,false,[[3,1]]],[160,189,null,102738254716482,false,[[1,[2,"BlurVertical"]],[0,[0,0]],[0,[0,0]]]],[160,140,null,900828029551041,false,[[3,0],[1,[2,"BlurVertical"]]]]],[[0,null,false,null,697856592526063,[[141,42,null,0,false,true,false,273983986555127,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]]],[[141,45,null,457787747247216,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]]]]]],[0,null,false,null,756596025743665,[[141,162,null,0,false,false,false,912015298605070,false,[[4,134]]],[141,42,null,0,false,true,false,198573073106895,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,253049517804737,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,false,null,435343252138019,[[141,155,null,0,false,false,false,899304761703589,false,[[8,4],[0,[4,[20,134,194,false,null],[0,20]]]]],[141,155,null,0,false,false,false,861927787813533,false,[[8,2],[0,[5,[4,[20,134,194,false,null],[20,134,195,false,null]],[0,20]]]]],[141,115,null,0,false,false,false,936303921022443,false,[[8,4],[0,[4,[20,134,196,false,null],[0,20]]]]],[141,115,null,0,false,false,false,544910028588431,false,[[8,2],[0,[5,[4,[20,134,196,false,null],[20,134,197,false,null]],[0,20]]]]]],[],[[0,null,false,null,809284314419991,[],[[141,126,null,638390956730208,false,[[0,[5,[20,141,154,false,null],[6,[21,141,false,null,0],[0,90]]]]]],[157,126,null,877967845922409,false,[[0,[4,[20,141,154,false,null],[6,[0,90],[21,141,false,null,0]]]]]],[141,45,null,777576027883459,false,[[10,2],[7,[23,"STATE_SUBMORINE"]]]],[141,174,"Platform",816143786535652,false,[[3,0]]],[141,198,"Car",173164964553052,false,[[3,1]]],[141,55,null,690045137438539,false,[[1,[2,"collSubmarine"]],[3,1]]],[141,199,"Car",300402170614156,false,[[0,[6,[6,[21,141,false,null,4],[21,141,false,null,0]],[0,-1]]]]],[141,45,null,365833523210434,false,[[10,24],[7,[20,134,200,false,null]]]],[92,38,null,305751289375123,false,[[1,[2,"heroActivateSubmorineEffect"]],[13,[7,[0,1]]]]]]],[0,null,false,null,123533736663865,[[141,155,null,0,false,false,false,239462356003580,false,[[8,4],[0,[4,[20,134,194,false,null],[0,20]]]]]],[[-1,77,null,674753226331291,false,[[4,176],[5,[20,141,63,true,null]],[0,[20,141,44,false,null]],[0,[20,141,78,false,null]]]],[98,147,null,775589251175050,false,[[2,["diving",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]]]]]],[0,null,false,null,785609755519381,[[141,42,null,0,false,false,false,491948994052198,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[134,201,null,0,false,false,true,623255873408664,false,[[0,[21,141,false,null,24]]]],[141,42,null,0,false,true,false,587918799514066,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[],[[0,null,true,null,255503309269527,[[141,155,null,0,false,false,false,677549276466402,false,[[8,2],[0,[4,[20,134,194,false,null],[0,10]]]]],[141,155,null,0,false,false,false,446450520473665,false,[[8,4],[0,[5,[4,[20,134,194,false,null],[20,134,195,false,null]],[0,10]]]]],[141,115,null,0,false,false,false,378294351210226,false,[[8,2],[0,[4,[20,134,196,false,null],[0,10]]]]],[141,115,null,0,false,false,false,363863288239154,false,[[8,4],[0,[5,[4,[20,134,196,false,null],[20,134,197,false,null]],[0,10]]]]]],[[141,55,null,761663038480369,false,[[1,[2,"normal"]],[3,1]]],[141,174,"Platform",562496184122359,false,[[3,1]]],[141,198,"Car",465272113999714,false,[[3,0]]],[141,45,null,581365650067678,false,[[10,2],[7,[23,"STATE_JUMP"]]]],[141,45,null,521218808658005,false,[[10,8],[7,[0,0]]]],[141,126,null,854132887059818,false,[[0,[0,0]]]],[92,38,null,425269023552139,false,[[1,[2,"heroActivateSubmorineEffect"]],[13,[7,[0,0]]]]]],[[0,null,false,null,549396547363092,[[141,155,null,0,false,false,false,890065747766210,false,[[8,2],[0,[4,[20,134,194,false,null],[0,15]]]]]],[[141,169,"Platform",841646968941752,false,[[0,[18,[16,[21,141,false,null,4],[0,0]],[0,-400],[18,[14,[21,141,false,null,4],[0,-400]],[21,141,false,null,4],[0,-400]]]]]],[-1,77,null,816371211743016,false,[[4,176],[5,[20,141,63,true,null]],[0,[20,141,44,false,null]],[0,[20,141,78,false,null]]]],[98,147,null,164419048053976,false,[[2,["diving",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,390073476384208,[[141,155,null,0,false,false,false,861618649578917,false,[[8,4],[0,[5,[4,[20,134,194,false,null],[20,134,195,false,null]],[0,15]]]]]],[[141,169,"Platform",489014329675067,false,[[0,[18,[16,[21,141,false,null,4],[0,0]],[0,400],[18,[14,[21,141,false,null,4],[0,400]],[21,141,false,null,4],[0,400]]]]]],[-1,77,null,865616429548197,false,[[4,176],[5,[20,141,63,true,null]],[0,[20,141,44,false,null]],[0,[20,141,78,false,null]]]],[98,147,null,437054098006629,false,[[2,["diving",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[176,152,null,138234385033640,false,[[0,[0,90]]]]]],[0,null,false,null,197501809362788,[[141,115,null,0,false,false,false,214177152124257,false,[[8,2],[0,[4,[20,134,196,false,null],[0,15]]]]]],[[141,173,"Platform",255566520052059,false,[[0,[0,-400]]]]]],[0,null,false,null,774651330622144,[[141,115,null,0,false,false,false,442429449428157,false,[[8,4],[0,[5,[4,[20,134,196,false,null],[20,134,197,false,null]],[0,15]]]]]],[[141,173,"Platform",244383541821732,false,[[0,[0,400]]]]]]]]]],[0,null,false,null,376808936782475,[[141,188,null,0,false,false,true,763455470788105,false,[[4,140]]]],[],[[0,null,false,null,956986260098062,[[141,42,null,0,false,true,false,849356933954572,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,118,null,0,false,false,false,474666813153879,false,[[10,13]]]],[[141,45,null,283144107339844,false,[[10,15],[7,[20,140,79,false,null]]]],[141,45,null,517130693198091,false,[[10,2],[7,[23,"STATE_ROTATE_THING"]]]],[141,138,null,850229895831023,false,[[4,140],[7,[0,0]]]],[141,174,"Platform",211703150028312,false,[[3,0]]],[141,121,null,155541749072091,false,[[10,14],[3,1]]],[140,121,null,547677857344292,false,[[10,0],[3,1]]]],[[0,null,false,null,425764624575325,[[141,42,null,0,false,false,false,850170407277485,false,[[10,0],[8,0],[7,[0,1]]]]],[[140,202,"Rotate",922943204724539,false,[[0,[0,-500]]]]]],[0,null,false,null,210605166789928,[[141,42,null,0,false,false,false,187002075714554,false,[[10,0],[8,0],[7,[0,-1]]]]],[[140,202,"Rotate",363429300047643,false,[[0,[0,500]]]]]]]]]],[0,null,false,null,791925125437611,[[140,118,null,0,false,true,false,787640744559066,false,[[10,0]]],[140,203,null,0,false,false,false,346929993328993,false,[[0,[0,5]],[0,[0,0]]]]],[[140,126,null,691485647349201,false,[[0,[0,0]]]],[140,202,"Rotate",834902224803494,false,[[0,[0,0]]]]]],[0,null,false,null,727253753001466,[[141,188,null,0,false,false,true,282212131343729,false,[[4,152]]]],[],[[0,null,false,null,158249623134592,[[141,42,null,0,false,true,false,289407221729171,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,118,null,0,false,false,false,636273455504089,false,[[10,20]]]],[[141,45,null,682452224824920,false,[[10,22],[7,[20,152,79,false,null]]]],[141,45,null,757211532273026,false,[[10,2],[7,[23,"STATE_ROTATE_SWING"]]]],[141,138,null,809460684397041,false,[[4,152],[7,[0,0]]]],[141,174,"Platform",605351490871930,false,[[3,0]]],[141,121,null,305429304063183,false,[[10,21],[3,1]]],[152,121,null,682448284205460,false,[[10,0],[3,1]]],[152,204,"Sine",644153675901492,false,[[3,1]]]],[[0,null,false,null,191488549370786,[[141,42,null,0,false,false,false,958697397683621,false,[[10,0],[8,0],[7,[0,1]]]]],[[152,205,"Sine",543836274152499,false,[[0,[0,-70]]]]]],[0,null,false,null,188941039756943,[[141,42,null,0,false,false,false,459053072626324,false,[[10,0],[8,0],[7,[0,-1]]]]],[[152,205,"Sine",348925827133049,false,[[0,[0,70]]]]]],[0,null,false,null,228380700064520,[],[]]]]]],[0,null,false,null,261874594097672,[[152,118,null,0,false,true,false,185081041101977,false,[[10,0]]],[152,203,null,0,false,false,false,565039030728043,false,[[0,[0,5]],[0,[0,0]]]]],[[152,126,null,130561443446189,false,[[0,[0,0]]]],[152,205,"Sine",419597936043960,false,[[0,[0,0]]]]]],[0,null,false,null,615599219363483,[[141,118,null,0,false,false,false,199562632699388,false,[[10,14]]]],[],[[0,null,false,null,727189431558245,[[140,90,null,0,false,false,true,601585944729754,false,[[0,[21,141,false,null,15]]]]],[[157,126,null,505137224725070,false,[[0,[20,140,154,false,null]]]]]]]],[0,null,false,null,361696054894496,[[141,118,null,0,false,false,false,348882318516939,false,[[10,21]]]],[],[[0,null,false,null,786630981898550,[[152,90,null,0,false,false,true,110807045204785,false,[[0,[21,141,false,null,22]]]]],[[157,126,null,681029378233645,false,[[0,[20,152,154,false,null]]]]]]]],[0,null,false,null,809405149850846,[[141,162,null,0,false,false,false,818397720576995,false,[[4,161]]]],[],[[0,null,false,null,119151246984034,[[141,42,null,0,false,true,false,146944832060043,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,980583195483061,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,556881805379317,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,646096345082977,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,678117262731948,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,792545918511952,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,429709861576491,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,826896648733230,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,912173717714389,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[141,42,null,0,false,true,false,492153870639471,false,[[10,2],[8,0],[7,[23,"STATE_FLIP"]]]],[141,118,null,0,false,false,false,464813951538044,false,[[10,16]]],[141,118,null,0,false,true,false,629861528739954,false,[[10,9]]]],[],[[0,null,false,null,641042105165026,[[141,155,null,0,false,false,false,377114500870982,false,[[8,4],[0,[5,[20,161,78,false,null],[0,13]]]]]],[[141,174,"Platform",403542161849823,false,[[3,0]]],[141,178,null,991037190672409,false,[[0,[4,[20,161,78,false,null],[0,10]]]]]],[[0,null,false,null,459484815029997,[[141,115,null,0,false,false,false,503197700010463,false,[[8,4],[0,[20,161,44,false,null]]]]],[[141,158,null,395459638328440,false,[[0,[4,[20,161,44,false,null],[0,10]]]]],[92,38,null,857817089586594,false,[[1,[2,"changefaceDir"]],[13,[7,[0,-1]]]]]]],[0,null,false,null,263517247528633,[[141,115,null,0,false,false,false,678753186632837,false,[[8,2],[0,[20,161,44,false,null]]]]],[[141,158,null,528350821886023,false,[[0,[5,[20,161,44,false,null],[0,10]]]]],[92,38,null,995009669236676,false,[[1,[2,"changefaceDir"]],[13,[7,[0,1]]]]]]],[0,null,false,null,655156121486246,[],[[141,45,null,206949968078137,false,[[10,2],[7,[23,"STATE_WALL_JOINT"]]]],[141,127,"Pin",367916966798311,false,[[4,161],[3,1]]]]]]]]]]],[0,null,false,null,737003870964863,[[141,188,null,0,false,false,true,156881083554988,false,[[4,154]]]],[],[[0,null,false,null,892796606991015,[[141,42,null,0,false,true,false,183101515621262,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_DOWN"]]]],[141,42,null,0,false,true,false,170409164648811,false,[[10,2],[8,0],[7,[23,"STATE_SEAT_UP"]]]],[141,42,null,0,false,true,false,140242249992048,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]],[141,42,null,0,false,true,false,621698007381117,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,772110393361053,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,880033494662984,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,153120279074724,false,[[10,2],[8,0],[7,[23,"STATE_ROTATE_THING"]]]],[141,42,null,0,false,true,false,504919397511167,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,201885531517837,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,42,null,0,false,true,false,517160264556070,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_DOWN"]]]],[141,42,null,0,false,true,false,566384050808143,false,[[10,2],[8,0],[7,[23,"STATE_JOINT_CONVEUR_UP"]]]],[141,118,null,0,false,false,false,979311266527048,false,[[10,18]]]],[[154,121,null,923820985704769,false,[[10,0],[3,1]]],[141,174,"Platform",849950026828976,false,[[3,0]]],[141,45,null,356119476720895,false,[[10,2],[7,[23,"STATE_JOINT_CONVEUR"]]]],[141,206,null,413174475490686,false,[[0,[20,154,44,false,null]],[0,[4,[20,154,78,false,null],[0,30]]]]],[141,127,"Pin",115007107917774,false,[[4,154],[3,1]]]]]]],[0,null,false,null,754688364557246,[[92,28,null,2,false,false,false,263143447395815,false,[[1,[2,"heroFinished"]]]]],[[141,45,null,633738840602711,false,[[10,2],[7,[23,"STATE_FINISHED"]]]]]],[0,null,false,null,122458408409838,[[141,188,null,0,false,false,true,481236483463924,false,[[4,189]]],[141,118,null,0,false,false,false,242565819010273,false,[[10,9]]]],[[141,121,null,957092847849794,false,[[10,9],[3,0]]],[92,38,null,369240502006882,false,[[1,[2,"heroUpdateJetpackVision"]],[13]]],[141,121,null,393910400590104,false,[[10,10],[3,0]]],[159,207,null,157765001771586,false,[[4,163],[5,[20,159,63,true,null]],[7,[0,0]]]],[92,38,null,970591769441365,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]]]]]],[0,[true,"Functions"],false,null,135840633212932,[[-1,46,null,0,false,false,false,135840633212932,false,[[1,[2,"Functions"]]]]],[],[[0,null,false,null,366216327989162,[[92,28,null,2,false,false,false,944190564824050,false,[[1,[2,"heroDeath"]]]],[141,42,null,0,false,true,false,259448594873684,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,45,null,252452764242110,false,[[10,2],[7,[23,"STATE_DEATH"]]]],[-1,77,null,256081074414505,false,[[4,173],[5,[20,141,63,true,null]],[0,[20,141,44,false,null]],[0,[20,141,78,false,null]]]],[141,177,"Pin",757023253318667,false],[141,208,"Car",966956558519465,false],[141,198,"Car",197858466985049,false,[[3,0]]],[141,174,"Platform",795559855893540,false,[[3,0]]],[141,173,"Platform",575689839348489,false,[[0,[0,0]]]],[141,169,"Platform",994796799122243,false,[[0,[0,0]]]],[92,38,null,797795206563078,false,[[1,[2,"heroActivateSubmorineEffect"]],[13,[7,[0,0]]]]],[92,38,null,702169799758621,false,[[1,[2,"heroActivateJetpackEffect"]],[13,[7,[0,0]]]]]],[[0,null,false,null,353543379665663,[],[[98,171,null,299494610116084,false,[[3,0],[1,[10,[2,"playerdies_"],[19,172,[[19,74,[[0,1],[0,8]]]]]]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[98,171,null,341743803688287,false,[[3,0],[1,[10,[2,"traphit_"],[19,172,[[19,74,[[0,1],[0,7]]]]]]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[-1,136,null,584738879077150,false,[[11,"GUIcurrentDeathNumber"],[7,[0,1]]]],[92,38,null,803535846248702,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,2]],[7,[4,[20,104,39,false,null,[[0,2],[0,1]]],[0,1]]]]]]],[[0,null,false,null,910305873512594,[[197,87,null,0,false,false,true,101678473192743,false,[[0,[23,"GUIdeathUID"]]]]],[[197,84,null,318421616828423,false,[[7,[10,[2," x "],[23,"GUIcurrentDeathNumber"]]]]]]],[0,null,false,null,345767967852792,[[127,90,null,0,false,false,true,147553250528917,false,[[0,[23,"checkpointUID"]]]],[-1,72,null,0,false,true,false,875702426637265,false,[[11,"checkpointUID"],[8,0],[7,[0,0]]]]],[[-1,92,null,935601660071373,false,[[0,[6,[1,1.7],[21,141,false,null,27]]]]],[141,126,null,345544749546447,false,[[0,[0,0]]]],[98,147,null,611698371798913,false,[[2,["character_reappear",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[92,38,null,311988913596035,false,[[1,[2,"heroUpdateJetpackVision"]],[13]]],[-1,92,null,794312935066848,false,[[0,[0,0]]]],[92,38,null,849727451423537,false,[[1,[2,"reset_BlueBoxes"]],[13]]],[205,193,"FadeOut",485593151591004,false],[141,45,null,874499989327908,false,[[10,27],[7,[0,1]]]],[98,137,null,228634110018076,false,[[1,[2,"gameplay"]],[0,[0,1]]]],[98,137,null,448322924499155,false,[[1,[2,"gameplayMusic"]],[0,[0,1]]]],[-1,110,null,383275453137068,false,[[0,[21,141,false,null,27]]]],[141,206,null,157471176669710,false,[[0,[20,127,44,false,null]],[0,[5,[20,127,78,false,null],[0,7]]]]],[141,45,null,409999365096398,false,[[10,0],[7,[21,127,false,null,0]]]],[92,38,null,866658438583790,false,[[1,[2,"changefaceDir"]],[13]]],[141,45,null,568743829624292,false,[[10,24],[7,[0,0]]]],[-1,92,null,682550236085778,false,[[0,[1,0.01]]]],[141,45,null,561392261249143,false,[[10,2],[7,[23,"STATE_IDLE"]]]],[157,83,null,941993847819137,false,[[3,1]]],[141,174,"Platform",557044835413304,false,[[3,1]]],[92,38,null,806795042197277,false,[[1,[2,"heroUpdateJetpackVision"]],[13]]],[141,45,null,210674829107990,false,[[10,27],[7,[0,1]]]]]],[0,null,false,null,958081605357950,[[-1,69,null,0,false,false,false,953315593970771,false]],[[-1,92,null,136086480733348,false,[[0,[6,[1,1.7],[21,141,false,null,27]]]]],[-1,209,null,524387159615486,false],[141,45,null,892553323959257,false,[[10,27],[7,[0,1]]]],[98,137,null,147786489460398,false,[[1,[2,"gameplay"]],[0,[0,1]]]],[98,137,null,461974526411250,false,[[1,[2,"gameplayMusic"]],[0,[0,1]]]]]]]]]],[0,null,false,null,385485316133768,[],[]]]],[0,[true,"Tutorial; Boost; Trail"],false,null,466020242240101,[[-1,46,null,0,false,false,false,466020242240101,false,[[1,[2,"Tutorial; Boost; Trail"]]]]],[],[[1,"disparitionSpeed",0,15,false,false,612186828463211,false],[0,null,false,null,727041077168101,[[-1,37,null,0,false,false,false,769435517858824,false,[[0,[1,0.1]]]],[141,42,null,0,false,false,false,569386202721135,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]]],[],[[0,null,false,null,271345016310725,[],[[-1,77,null,128631343079597,false,[[4,179],[5,[2,"traps"]],[0,[20,141,44,false,null]],[0,[5,[20,141,78,false,null],[19,74,[[0,100],[0,300]]]]]]],[-1,92,null,208509556254555,false,[[0,[1,1]]]],[179,67,null,676598051170034,false]]],[0,null,false,null,170974703483425,[],[[-1,77,null,490431134824746,false,[[4,179],[5,[2,"traps"]],[0,[20,141,44,false,null]],[0,[4,[20,141,78,false,null],[19,74,[[0,100],[0,300]]]]]]],[-1,92,null,521710201990708,false,[[0,[1,1]]]],[179,67,null,778866731810915,false]]]]],[0,null,false,null,473847711854453,[[-1,37,null,0,false,false,false,680690518904343,false,[[0,[1,0.1]]]],[141,42,null,0,false,false,false,160596120448736,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]]],[],[[0,null,false,null,919377823569162,[],[[-1,77,null,864076439979047,false,[[4,179],[5,[2,"traps"]],[0,[5,[20,141,44,false,null],[19,74,[[0,100],[0,300]]]]],[0,[20,141,78,false,null]]]],[-1,92,null,160873889135590,false,[[0,[1,1]]]],[179,67,null,104305624256290,false]]],[0,null,false,null,145123957923101,[],[[-1,77,null,947288897566823,false,[[4,179],[5,[2,"traps"]],[0,[4,[20,141,44,false,null],[19,74,[[0,100],[0,300]]]]],[0,[20,141,78,false,null]]]],[-1,92,null,709057089719756,false,[[0,[1,1]]]],[179,67,null,627372963667620,false]]]]],[0,null,false,null,801236388024337,[[141,210,"Platform",0,false,false,false,406410466371751,false]],[]],[0,null,false,null,901437795139377,[[-1,141,null,0,false,false,false,657960034449422,false]],[]],[1,"RES",0,2,false,true,499500930456990,false],[1,"dist",0,0,false,false,692127586986310,false],[0,null,false,null,957995553383236,[[-1,141,null,0,false,false,false,227044493967657,false]],[[-1,33,null,813786031990725,false,[[11,"dist"],[7,[19,211,[[20,157,44,false,null],[20,157,78,false,null],[21,157,false,null,0],[21,157,false,null,1]]]]]]],[[0,null,false,null,490228110031365,[[-1,72,null,0,false,false,false,817090605909942,false,[[11,"dist"],[8,0],[7,[0,0]]]],[157,42,null,0,false,true,false,232441129038663,false,[[10,2],[8,0],[7,[20,157,154,false,null]]]]],[[-1,33,null,641510941547716,false,[[11,"dist"],[7,[0,6]]]]]],[0,null,true,null,655778605996237,[[141,42,null,0,false,false,false,265555699569352,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]],[-1,72,null,0,false,false,false,170640687166050,false,[[11,"typeSave"],[8,0],[7,[0,0]]]]],[[-1,33,null,689213004293308,false,[[11,"dist"],[7,[0,0]]]]]],[0,null,false,null,708136279300372,[[-1,111,null,0,true,false,false,945073143567826,false,[[0,[7,[23,"dist"],[23,"RES"]]]]]],[],[[0,null,false,null,695467724141871,[],[[-1,77,null,299601782254374,false,[[4,162],[5,[20,157,63,true,null]],[0,[19,212,[[21,157,false,null,0],[20,157,44,false,null],[6,[19,112],[7,[23,"RES"],[23,"dist"]]]]]],[0,[19,212,[[21,157,false,null,1],[20,157,78,false,null],[6,[19,112],[7,[23,"RES"],[23,"dist"]]]]]]]],[162,126,null,180510904093437,false,[[0,[21,157,false,null,2]]]],[162,45,null,950012113090016,false,[[10,0],[7,[19,212,[[0,0],[19,142],[6,[19,112],[7,[23,"RES"],[23,"dist"]]]]]]]],[162,55,null,966928368427904,false,[[1,[20,157,213,true,null]],[3,1]]],[162,81,null,971545891275630,false,[[0,[20,157,214,false,null]]]],[162,108,null,933828202000842,false,[[0,[0,0]]]],[162,116,null,608372716056501,false,[[0,[20,157,215,false,null]]]]]]]]]],[0,null,false,null,165833812362757,[[-1,141,null,0,false,false,false,106582882108283,false]],[[162,151,null,950986552666832,false,[[10,0],[7,[6,[0,5],[19,142]]]]],[162,216,null,529003364374496,false,[[0,[5,[0,5],[6,[0,10],[21,162,false,null,0]]]]]]]],[0,null,false,null,121999419260524,[[162,42,null,0,false,false,false,895209397573900,false,[[10,0],[8,5],[7,[0,1]]]]],[[162,67,null,324935588090245,false]]],[0,null,true,null,660310095959748,[[-1,47,null,1,false,false,false,974913690378948,false],[-1,141,null,0,false,false,false,790797866853363,false]],[[157,45,null,108863707765267,false,[[10,0],[7,[20,157,44,false,null]]]],[157,45,null,312835291762832,false,[[10,1],[7,[20,157,78,false,null]]]],[157,45,null,728156183127349,false,[[10,2],[7,[20,157,154,false,null]]]]]]]],[0,[true,"Sensor Buttons"],false,null,383938029055078,[[-1,46,null,0,false,false,false,383938029055078,false,[[1,[2,"Sensor Buttons"]]]]],[],[[0,null,false,null,608416340021900,[[-1,47,null,1,false,false,false,141948498346416,false],[-1,217,null,0,false,false,false,533682682106288,false]],[[-1,77,null,904675357029157,false,[[4,192],[5,[2,"GUI"]],[0,[0,84]],[0,[0,494]]]],[-1,77,null,231401047538215,false,[[4,193],[5,[2,"GUI"]],[0,[0,220]],[0,[0,494]]]],[-1,77,null,543492311287044,false,[[4,191],[5,[2,"GUI"]],[0,[0,580]],[0,[0,494]]]],[-1,77,null,419456900995947,false,[[4,194],[5,[2,"GUI"]],[0,[0,716]],[0,[0,494]]]]]]]]]],["Camera",[[1,"camera_start",0,0,false,false,837599186680187,false],[1,"camera_maxZoom",0,1,false,false,326598457741014,false],[1,"CAMERA_DELAYCAMERA",0,6,false,true,298035130450453,false],[1,"camera_auxX",0,0,false,false,385625373834893,false],[1,"camera_auxY",0,0,false,false,726420590613689,false],[1,"camera_xCameraCenter",0,0,false,false,417971061592473,false],[1,"camera_yCameraCenter",0,0,false,false,983459628927553,false],[1,"camera_CurrentScrool",0,1,false,false,608826014900616,false],[1,"camera_Zoom",0,0.85,false,false,184344175554043,false],[1,"camera_add_zoom",0,0,false,false,254370224368516,false],[0,null,false,null,207257225460114,[[141,76,null,1,false,false,false,411264621451996,false]],[[-1,33,null,768589958718776,false,[[11,"camera_start"],[7,[0,0]]]],[-1,218,null,499169832785410,false,[[5,[0,0]],[0,[23,"camera_Zoom"]]]],[-1,218,null,363381572544198,false,[[5,[0,1]],[0,[23,"camera_Zoom"]]]],[-1,218,null,456731749975570,false,[[5,[0,2]],[0,[23,"camera_Zoom"]]]],[-1,218,null,795174037433330,false,[[5,[0,3]],[0,[23,"camera_Zoom"]]]],[-1,92,null,797824882866841,false,[[0,[0,0]]]],[-1,33,null,143048404276384,false,[[11,"camera_start"],[7,[0,1]]]],[-1,33,null,518197933939449,false,[[11,"camera_auxX"],[7,[20,141,44,false,null]]]],[-1,33,null,653981063265609,false,[[11,"camera_auxY"],[7,[20,141,78,false,null]]]],[-1,219,null,162731358114936,false,[[0,[23,"camera_auxX"]],[0,[23,"camera_auxY"]]]]]],[0,null,false,null,756347085945895,[[-1,141,null,0,false,false,false,295392432172172,false],[-1,40,null,0,false,false,false,279143276430193,false,[[7,[20,141,220,false,null]],[8,4],[7,[0,0]]]],[-1,72,null,0,false,false,false,536995193774801,false,[[11,"camera_start"],[8,0],[7,[0,1]]]],[141,42,null,0,false,true,false,833098087259243,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[-1,33,null,377561106716965,false,[[11,"camera_xCameraCenter"],[7,[20,141,44,false,null]]]],[-1,33,null,981108666416968,false,[[11,"camera_yCameraCenter"],[7,[20,141,78,false,null]]]],[-1,33,null,175100391591729,false,[[11,"camera_auxX"],[7,[4,[23,"camera_auxX"],[7,[5,[23,"camera_xCameraCenter"],[23,"camera_auxX"]],[23,"CAMERA_DELAYCAMERA"]]]]]],[-1,33,null,377910934674005,false,[[11,"camera_auxY"],[7,[4,[23,"camera_auxY"],[7,[5,[23,"camera_yCameraCenter"],[23,"camera_auxY"]],[23,"CAMERA_DELAYCAMERA"]]]]]],[-1,219,null,574286579745555,false,[[0,[23,"camera_auxX"]],[0,[23,"camera_auxY"]]]]],[[0,null,false,null,543686912672445,[[-1,72,null,0,false,false,false,734039536390344,false,[[11,"camera_add_zoom"],[8,2],[7,[7,[19,221,[[4,[9,[21,141,false,null,3],[0,2]],[9,[21,141,false,null,4],[0,2]]]]],[0,3500]]]]]],[[-1,136,null,459142191938188,false,[[11,"camera_add_zoom"],[7,[1,0.001]]]]]],[0,null,false,null,515218636606847,[[-1,69,null,0,false,false,false,832567592717599,false]],[[-1,136,null,716433130424316,false,[[11,"camera_add_zoom"],[7,[1,-0.001]]]]]],[0,null,false,null,916451739719556,[[-1,111,null,0,true,false,false,979382523684366,false,[[0,[0,4]]]]],[[-1,218,null,135392447692934,false,[[5,[19,112]],[0,[5,[23,"camera_Zoom"],[23,"camera_add_zoom"]]]]]]]]]]],["GameplayGUI",[[1,"GUIcurrentLevelNumber",0,0,false,false,952570903866181,false],[1,"GUIcurrentLevelTimerUID",0,0,false,false,569409410547142,false],[1,"GUIrateLevelTimerUID",0,0,false,false,964532884978569,false],[1,"GUIStageUID",0,0,false,false,304555558471280,false],[1,"GUIdeathUID",0,0,false,false,446182523603107,false],[1,"GUIfinishLevelcurrentTimeUID",0,0,false,false,468826746682571,false],[1,"GUIcurrentTimeProgress",0,0,false,false,855116280949681,false],[1,"GUIcurrentCoinsNumber",0,0,false,false,146890738769023,false],[1,"GUIcurrentStarsNumber",0,0,false,false,817819635909869,false],[1,"GUIcurrentDeathNumber",0,0,false,false,561018261591740,false],[1,"GUIcurrentCheckpointsNumber",0,0,false,false,873625767806255,false],[1,"GUIstopTimer",0,1,false,false,907431244585564,false],[1,"GUIfinishLevel",0,0,false,false,963385930830867,false],[1,"ScoreForLeaderboard",0,0,false,false,559428044578693,false],[0,null,false,null,299741863198645,[[95,222,null,0,false,false,false,742634258367396,false,[[9,82]]]],[[-1,209,null,129623352883736,false]]],[0,null,false,null,926405079770720,[[-1,47,null,1,false,false,false,526875419185673,false]],[[-1,77,null,816763676189466,false,[[4,19],[5,[2,"GUI"]],[0,[0,350]],[0,[0,30]]]],[-1,77,null,496182610305404,false,[[4,17],[5,[2,"GUI"]],[0,[0,400]],[0,[0,30]]]],[-1,77,null,298893383328437,false,[[4,12],[5,[2,"GUI"]],[0,[0,450]],[0,[0,30]]]],[-1,33,null,441169379457655,false,[[11,"GUIcurrentLevelNumber"],[7,[19,73,[[19,223,[[19,41],[2,"level"],[2,""]]]]]]]],[-1,33,null,905916276004464,false,[[11,"GUIcurrentCoinsNumber"],[7,[0,0]]]],[-1,33,null,479156142213387,false,[[11,"GUIcurrentStarsNumber"],[7,[0,0]]]],[-1,33,null,153118988023202,false,[[11,"GUIcurrentDeathNumber"],[7,[0,0]]]],[-1,33,null,297556029683502,false,[[11,"GUIcurrentTimeProgress"],[7,[0,0]]]],[-1,33,null,165865428254567,false,[[11,"GUIcurrentCheckpointsNumber"],[7,[0,0]]]],[-1,33,null,582611881766191,false,[[11,"GUIfinishLevel"],[7,[0,0]]]]]],[0,null,false,null,112078136463077,[[-1,47,null,1,false,false,false,619125315929698,false]],[],[[0,null,false,null,446493468636973,[],[[-1,77,null,509464549125188,false,[[4,83],[5,[2,"GUI"]],[0,[0,116]],[0,[0,34]]]],[-1,77,null,790878942523367,false,[[4,197],[5,[2,"GUI"]],[0,[0,184]],[0,[0,34]]]],[197,224,null,935250346111386,false,[[0,[0,128]]]],[197,84,null,399685546978239,false,[[7,[2,"00 : 00 : 00"]]]],[-1,33,null,353818890749740,false,[[11,"GUIcurrentLevelTimerUID"],[7,[20,197,80,false,null]]]],[197,127,"Pin",470327896667676,false,[[4,83],[3,1]]],[197,129,null,594942390166619,false,[[0,[1,0.6]]]],[-1,77,null,894110629016380,false,[[4,82],[5,[2,"GUI"]],[0,[0,71]],[0,[0,76]]]],[82,225,null,736526789135348,false],[-1,77,null,298091938722137,false,[[4,197],[5,[2,"GUI"]],[0,[0,147]],[0,[0,73]]]],[197,130,null,497241186855066,false,[[0,[0,357]]]],[197,84,null,365005263583087,false,[[7,[2,"00 : 00 : 00"]]]],[-1,33,null,886080464221672,false,[[11,"GUIrateLevelTimerUID"],[7,[20,197,80,false,null]]]],[197,127,"Pin",212564640981828,false,[[4,82],[3,1]]],[197,129,null,973502939843426,false,[[0,[1,0.4]]]],[-1,77,null,264455770099507,false,[[4,81],[5,[2,"GUI"]],[0,[0,40]],[0,[0,76]]]],[81,127,"Pin",130868860826192,false,[[4,82],[3,1]]],[-1,77,null,415686292301641,false,[[4,85],[5,[2,"GUI"]],[0,[0,708]],[0,[0,30]]]],[-1,77,null,170307437482296,false,[[4,197],[5,[2,"GUI"]],[0,[0,774]],[0,[0,29]]]],[197,84,null,583915274498844,false,[[7,[10,[2,"stage "],[4,[19,73,[[19,223,[[19,41],[2,"level"],[2,""]]]]],[0,1]]]]]],[197,224,null,794603101433016,false,[[0,[0,128]]]],[197,127,"Pin",665111908652813,false,[[4,85],[3,1]]],[197,129,null,372179100328237,false,[[0,[1,0.55]]]],[-1,33,null,312791529249898,false,[[11,"GUIStageUID"],[7,[20,197,80,false,null]]]],[-1,77,null,426380719859421,false,[[4,84],[5,[2,"GUI"]],[0,[0,736]],[0,[0,65]]]],[84,225,null,473286831041321,false],[197,127,"Pin",198082775584506,false,[[4,84],[3,1]]],[-1,77,null,115867185838620,false,[[4,86],[5,[2,"GUI"]],[0,[0,727]],[0,[0,65]]]],[86,127,"Pin",225936856090547,false,[[4,84],[3,1]]],[-1,77,null,213069707083843,false,[[4,197],[5,[2,"GUI"]],[0,[0,812]],[0,[0,66]]]],[197,127,"Pin",767247678669917,false,[[4,84],[3,1]]],[197,84,null,646671051125350,false,[[7,[2," x 0"]]]],[197,129,null,916848537273849,false,[[0,[1,0.5]]]],[-1,33,null,915015342794289,false,[[11,"GUIdeathUID"],[7,[20,197,80,false,null]]]],[83,158,null,472367338837009,false,[[0,[5,[20,83,44,false,null],[0,40]]]]],[82,158,null,537594445883386,false,[[0,[5,[20,82,44,false,null],[0,10]]]]],[85,158,null,739943757372774,false,[[0,[4,[20,85,44,false,null],[0,20]]]]],[84,158,null,992326611564470,false,[[0,[4,[20,84,44,false,null],[0,20]]]]]]]]],[0,null,false,null,720227698918520,[[92,28,null,2,false,false,false,843981604968426,false,[[1,[2,"GUIfinishLevel"]]]]],[],[[0,null,false,null,181489703892449,[],[[-1,77,null,751672715727476,false,[[4,87],[5,[2,"GUI"]],[0,[0,400]],[0,[0,260]]]],[-1,77,null,744512732861796,false,[[4,88],[5,[2,"GUI"]],[0,[20,87,44,false,null]],[0,[20,87,78,false,null]]]],[-1,77,null,933880595435326,false,[[4,199],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,68]]],[0,[5,[20,87,78,false,null],[0,15]]]]],[-1,77,null,797679731375746,false,[[4,197],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,14]]],[0,[5,[20,87,78,false,null],[0,61]]]]],[197,224,null,668918229308573,false,[[0,[0,96]]]],[92,38,null,947961417663928,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[23,"GUIcurrentTimeProgress"]]]]],[197,84,null,539945609644648,false,[[7,[20,92,88,false,null]]]],[-1,77,null,887022218395466,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,141]]],[0,[5,[20,87,78,false,null],[0,83]]]]],[92,38,null,539790585056833,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[197,84,null,521745470683708,false,[[7,[20,92,88,false,null]]]],[-1,77,null,901856691698737,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,141]]],[0,[5,[20,87,78,false,null],[0,54]]]]],[92,38,null,900530078802935,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,1]]]]]]],[197,84,null,557860504682640,false,[[7,[20,92,88,false,null]]]],[-1,77,null,918636256958716,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,141]]],[0,[5,[20,87,78,false,null],[0,26]]]]],[92,38,null,994442570880415,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[197,84,null,757589689992892,false,[[7,[20,92,88,false,null]]]],[-1,77,null,295076290094210,false,[[4,77],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,63]]],[0,[5,[20,87,78,false,null],[0,17]]]]],[77,83,null,816452945513016,false,[[3,0]]],[-1,77,null,419505278178179,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,25]]],[0,[4,[20,87,78,false,null],[0,29]]]]],[197,84,null,493589020381990,false,[[7,[10,[10,[23,"GUIcurrentCoinsNumber"],[2,"/"]],[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,3]]]]]]],[-1,77,null,826342790141865,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,31]]],[0,[4,[20,87,78,false,null],[0,76]]]]],[197,84,null,591423475336390,false,[[7,[10,[23,"GUIcurrentStarsNumber"],[2,"/1"]]]]],[-1,77,null,486050267516477,false,[[4,197],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,172]]],[0,[4,[20,87,78,false,null],[0,31]]]]],[197,84,null,372878760611866,false,[[7,[10,[2,"x "],[23,"GUIcurrentDeathNumber"]]]]],[-1,77,null,128122383305159,false,[[4,146],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,89]]],[0,[4,[20,87,78,false,null],[0,76]]]]],[-1,77,null,850614879993903,false,[[4,3],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,80]]],[0,[4,[20,87,78,false,null],[0,82]]]]],[-1,77,null,801371834313792,false,[[4,42],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,112]]],[0,[4,[20,87,78,false,null],[0,145]]]]],[-1,77,null,970118438616041,false,[[4,43],[5,[2,"GUI"]],[0,[5,[20,87,44,false,null],[0,30]]],[0,[4,[20,87,78,false,null],[0,140]]]]],[-1,77,null,994052203693737,false,[[4,45],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,51]]],[0,[4,[20,87,78,false,null],[0,140]]]]],[-1,77,null,411553891908649,false,[[4,44],[5,[2,"GUI"]],[0,[4,[20,87,44,false,null],[0,134]]],[0,[4,[20,87,78,false,null],[0,137]]]]],[3,116,null,429839649341190,false,[[0,[0,97]]]],[3,117,null,412016235066104,false,[[0,[0,55]]]]],[[0,null,false,null,957163708197715,[[93,66,null,0,false,true,false,160743787633320,false]],[[-1,77,null,389685719900645,false,[[4,28],[5,[2,"GUI"]],[0,[20,87,44,false,null]],[0,[4,[20,87,78,false,null],[0,242]]]]],[-1,77,null,933087299808241,false,[[4,35],[5,[2,"GUI"]],[0,[20,87,44,false,null]],[0,[4,[20,87,78,false,null],[0,242]]]]],[28,45,null,340281173921412,false,[[10,1],[7,[20,35,79,false,null]]]]]],[0,null,false,null,595760555468804,[[-1,40,null,0,false,false,false,855998951416202,false,[[7,[20,103,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]],[8,0],[7,[0,0]]]]],[[103,123,null,159101066811923,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,0]],[7,[23,"GUIcurrentTimeProgress"]]]],[103,123,null,919811317459942,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,1]],[7,[23,"GUIcurrentCoinsNumber"]]]],[103,123,null,554543562583874,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,2]],[7,[23,"GUIcurrentStarsNumber"]]]],[103,123,null,282535818852602,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,3]],[7,[23,"GUIcurrentDeathNumber"]]]]]],[0,null,false,null,129301712830026,[[-1,40,null,0,false,false,false,876963972682279,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,2],[7,[20,103,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[[103,123,null,205621314328339,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,0]],[7,[23,"GUIcurrentTimeProgress"]]]]]],[0,null,false,null,967817711018130,[[-1,40,null,0,false,false,false,970559183776141,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[[103,123,null,680181300648414,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,0]],[7,[23,"GUIcurrentTimeProgress"]]]],[103,123,null,367309260122459,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,1]],[7,[23,"GUIcurrentCoinsNumber"]]]],[103,123,null,307837215156645,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,2]],[7,[23,"GUIcurrentStarsNumber"]]]],[103,123,null,296594607243952,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,3]],[7,[23,"GUIcurrentDeathNumber"]]]]]],[0,null,false,null,401680320421513,[[-1,40,null,0,false,false,false,534891427326334,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]],[-1,40,null,0,false,false,false,622183814081450,false,[[7,[23,"GUIcurrentCoinsNumber"]],[8,5],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,3]]]]]],[-1,40,null,0,false,false,false,384183277871538,false,[[7,[23,"GUIcurrentStarsNumber"]],[8,5],[7,[0,1]]]],[-1,40,null,0,false,false,false,410638863936191,false,[[7,[23,"GUIcurrentDeathNumber"]],[8,0],[7,[0,0]]]]],[[103,123,null,505690664602053,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,0]],[7,[23,"GUIcurrentTimeProgress"]]]],[103,123,null,975144740532889,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,1]],[7,[23,"GUIcurrentCoinsNumber"]]]],[103,123,null,850788849365819,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,2]],[7,[0,1]]]],[103,123,null,292223730432026,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,3]],[7,[0,0]]]],[77,83,null,869176578675770,false,[[3,1]]],[92,38,null,146147159290003,false,[[1,[2,"showAchievement"]],[13,[7,[0,5]]]]]]],[0,null,false,null,724528008371354,[[-1,40,null,0,false,false,false,648050966063048,false,[[7,[23,"GUIcurrentCheckpointsNumber"]],[8,5],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,4]]]]]]],[[103,123,null,940320482127953,false,[[0,[23,"GUIcurrentLevelNumber"]],[0,[0,4]],[7,[23,"GUIcurrentCheckpointsNumber"]]]]]],[0,null,false,null,636782164164226,[],[[92,38,null,568752378700533,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,3]]]]],[92,38,null,869354082714006,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,5]]]]],[92,38,null,135540341892345,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,7]]]]],[92,38,null,801080077022346,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,8]]]]]]],[0,null,false,null,462983793440958,[[-1,40,null,0,false,false,false,854751264581314,false,[[7,[19,41]],[8,0],[7,[2,"level0"]]]]],[[92,38,null,244380056565339,false,[[1,[2,"showAchievement"]],[13,[7,[0,0]]]]]]],[0,null,false,null,406743390038983,[[-1,40,null,0,false,false,false,945676254957694,false,[[7,[23,"GUIcurrentDeathNumber"]],[8,0],[7,[0,0]]]]],[[92,38,null,880698822575182,false,[[1,[2,"showAchievement"]],[13,[7,[0,1]]]]]]],[0,null,false,null,473818818095523,[[-1,40,null,0,false,false,false,385958594992141,false,[[7,[19,41]],[8,0],[7,[2,"level11"]]]]],[[92,38,null,218648046654227,false,[[1,[2,"showAchievement"]],[13,[7,[0,2]]]]]]],[0,null,false,null,882409281460822,[[-1,40,null,0,false,false,false,688597723816248,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[[92,38,null,665954199170359,false,[[1,[2,"showAchievement"]],[13,[7,[0,13]]]]]]],[1,"doneGoldLevels",0,0,false,false,593289817524119,false],[0,null,false,null,982863771498902,[[-1,111,null,0,true,false,false,465018459388538,false,[[0,[0,12]]]],[-1,40,null,0,false,false,false,993627921624101,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[19,112],[0,0]]]]]],[-1,40,null,0,false,true,false,434948307999565,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,0],[7,[0,0]]]]],[[-1,136,null,862986369547354,false,[[11,"doneGoldLevels"],[7,[0,1]]]]],[[0,null,false,null,752893056800808,[[-1,72,null,0,false,false,false,555361136000031,false,[[11,"doneGoldLevels"],[8,5],[7,[0,12]]]]],[[92,38,null,733245315381915,false,[[1,[2,"showAchievement"]],[13,[7,[0,14]]]]]]]]],[0,null,false,null,917021455054937,[[-1,40,null,0,false,false,false,386789939265263,false,[[7,[23,"GUIcurrentCoinsNumber"]],[8,5],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,3]]]]]]],[[92,38,null,887694989210363,false,[[1,[2,"showAchievement"]],[13,[7,[0,12]]]]]]],[0,null,false,null,535908178698810,[],[[92,38,null,252314376094657,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,7]]]]]],[[0,null,false,null,926478280985768,[[-1,40,null,0,false,false,false,759268001015754,false,[[7,[20,104,39,false,null,[[0,7],[0,1]]]],[8,5],[7,[0,700]]]]],[[92,38,null,170969165472770,false,[[1,[2,"showAchievement"]],[13,[7,[0,5]]]]]]]]],[0,null,false,null,245469255492016,[],[[92,38,null,488140058057382,false,[[1,[2,"arraysUpdateStatistics"]],[13,[7,[0,8]]]]]],[[0,null,false,null,666533676583108,[[-1,40,null,0,false,false,false,133210135998551,false,[[7,[20,104,39,false,null,[[0,8],[0,1]]]],[8,5],[7,[0,12]]]]],[[92,38,null,438337699278577,false,[[1,[2,"showAchievement"]],[13,[7,[0,8]]]]]]]]],[0,null,false,null,200509860837894,[],[[92,38,null,626309400040881,false,[[1,[2,"saveGame"]],[13,[7,[23,"typeSave"]]]]]]],[0,null,false,null,869341540350063,[[-1,40,null,0,false,false,false,321288117353977,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[[199,55,null,383194928788293,false,[[1,[2,"bronze"]],[3,1]]]]],[0,null,false,null,693701269859749,[[-1,40,null,0,false,false,false,587181296714073,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,1]]]]]]],[[199,55,null,373203556577761,false,[[1,[2,"silver"]],[3,1]]]]],[0,null,false,null,266082574243545,[[-1,40,null,0,false,false,false,113337235980579,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[[199,55,null,862918192891295,false,[[1,[2,"gold"]],[3,1]]]]],[0,null,false,null,777024449851586,[[-1,40,null,0,false,false,false,811615563757260,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,4],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[[199,55,null,808210058929235,false,[[1,[2,"none"]],[3,1]]]]],[0,null,false,null,314081543762494,[],[[-1,33,null,464011910569561,false,[[11,"ScoreForLeaderboard"],[7,[0,0]]]]],[[0,null,false,null,574692147912948,[[-1,111,null,0,true,false,false,539946493917600,false,[[0,[0,12]]]]],[],[[0,null,false,null,669365306122822,[[-1,40,null,0,false,false,false,564452743712890,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]],[-1,40,null,0,false,true,false,202470326382083,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,0],[7,[0,0]]]]],[[-1,136,null,510854379283827,false,[[11,"ScoreForLeaderboard"],[7,[0,300]]]]]],[0,null,false,null,637555858966628,[[-1,40,null,0,false,false,false,855465070495624,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,1]]]]]],[-1,40,null,0,false,true,false,168914664651202,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,0],[7,[0,0]]]]],[[-1,136,null,150708575142291,false,[[11,"ScoreForLeaderboard"],[7,[0,200]]]]]],[0,null,false,null,128156060585407,[[-1,40,null,0,false,false,false,191228200857928,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,3],[7,[20,102,39,false,null,[[19,112],[0,2]]]]]],[-1,40,null,0,false,true,false,701043090438356,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,0],[7,[0,0]]]]],[[-1,136,null,661286345772918,false,[[11,"ScoreForLeaderboard"],[7,[0,100]]]]]],[0,null,false,null,258095857147387,[[-1,40,null,0,false,false,false,770182471036039,false,[[7,[20,103,39,false,null,[[19,112],[0,0]]]],[8,4],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[[-1,136,null,397145417925939,false,[[11,"ScoreForLeaderboard"],[7,[0,50]]]]]],[0,null,false,null,342037881528119,[],[[-1,136,null,286412396122649,false,[[11,"ScoreForLeaderboard"],[7,[6,[20,103,39,false,null,[[19,112],[0,1]]],[0,5]]]]],[-1,136,null,113603641333370,false,[[11,"ScoreForLeaderboard"],[7,[6,[20,103,39,false,null,[[19,112],[0,2]]],[0,500]]]]]]]]],[0,null,false,null,490417068129870,[],[[93,59,null,189226161563355,false,[[0,[23,"ScoreForLeaderboard"]],[1,[2,"Leaderboard"]],[0,[0,0]],[0,[0,1]],[1,[20,93,53,true,null]]]]]]]]]]]],[0,[true,"Time"],false,null,404224452402554,[[-1,46,null,0,false,false,false,404224452402554,false,[[1,[2,"Time"]]]]],[],[[0,null,false,null,192364800180449,[[-1,47,null,1,false,false,false,739108402456647,false]],[[-1,33,null,893258605232827,false,[[11,"GUIstopTimer"],[7,[0,1]]]]]],[0,null,false,null,319274526062526,[[-1,37,null,0,false,false,false,342614403316257,false,[[0,[1,0.01]]]],[-1,40,null,0,false,false,false,427792688720225,false,[[7,[23,"GUIstopTimer"]],[8,0],[7,[0,0]]]]],[[-1,136,null,853316193499094,false,[[11,"GUIcurrentTimeProgress"],[7,[0,1]]]],[92,38,null,851036756111908,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[23,"GUIcurrentTimeProgress"]]]]]],[[0,null,false,null,450765192254350,[[197,87,null,0,false,false,true,861588426244794,false,[[0,[23,"GUIcurrentLevelTimerUID"]]]]],[[197,84,null,648620775916682,false,[[7,[20,92,88,false,null]]]]]],[0,null,false,null,254775521448779,[[-1,40,null,0,false,false,false,501461568803451,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[[81,81,null,740244081812083,false,[[0,[0,0]]]]],[[0,null,false,null,140060862583091,[[197,87,null,0,false,false,true,599578471053453,false,[[0,[23,"GUIrateLevelTimerUID"]]]]],[[92,38,null,941139433418875,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,0]]]]]]],[197,84,null,173802415925325,false,[[7,[20,92,88,false,null]]]]]]]],[0,null,false,null,256548335238932,[[-1,69,null,0,false,false,false,457925024975188,false],[-1,40,null,0,false,false,false,870416693052715,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,1]]]]]]],[[81,81,null,999248192785921,false,[[0,[0,1]]]]],[[0,null,false,null,823150937022535,[[197,87,null,0,false,false,true,390116692174277,false,[[0,[23,"GUIrateLevelTimerUID"]]]]],[[92,38,null,921579410767383,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,1]]]]]]],[197,84,null,959428579855670,false,[[7,[20,92,88,false,null]]]]]]]],[0,null,false,null,124101029942555,[[-1,69,null,0,false,false,false,787716860297616,false],[-1,40,null,0,false,false,false,265518744865554,false,[[7,[23,"GUIcurrentTimeProgress"]],[8,3],[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[[81,81,null,607229230816638,false,[[0,[0,2]]]]],[[0,null,false,null,954380923430366,[[197,87,null,0,false,false,true,495828836662694,false,[[0,[23,"GUIrateLevelTimerUID"]]]]],[[92,38,null,855681632980402,false,[[1,[2,"FunctionSplitToMSM"]],[13,[7,[20,102,39,false,null,[[23,"GUIcurrentLevelNumber"],[0,2]]]]]]],[197,84,null,995268166088277,false,[[7,[20,92,88,false,null]]]]]]]],[0,null,false,null,727518217952061,[[-1,69,null,0,false,false,false,847425247621125,false]],[[81,83,null,873201662580667,false,[[3,0]]]]]]]]],[0,[true,"buttons"],false,null,197252800769969,[[-1,46,null,0,false,false,false,197252800769969,false,[[1,[2,"buttons"]]]]],[],[[0,null,true,null,521737439184813,[[97,226,null,1,false,false,false,164769105075471,false,[[4,42]]],[97,226,null,1,false,false,false,202024807169394,false,[[4,19]]]],[[92,38,null,968215565840800,false,[[1,[2,"addTransitionEffect"]],[13]]],[-1,92,null,257813087449825,false,[[0,[1,0.1]]]],[92,38,null,391398599844147,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[2,"MainMenu"]]]]]]],[0,null,true,null,683822273619630,[[97,226,null,1,false,false,false,431363914280074,false,[[4,43]]],[97,226,null,1,false,false,false,393483793200719,false,[[4,17]]]],[[92,38,null,774665231714168,false,[[1,[2,"addTransitionEffect"]],[13]]],[-1,92,null,758956799120516,false,[[0,[1,0.1]]]],[92,38,null,115635171560500,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[19,41]]]]]]],[0,null,true,null,503151011115998,[[97,226,null,1,false,false,false,336638963187829,false,[[4,44]]],[95,222,null,0,false,false,false,780664791533469,false,[[9,32]]]],[],[[0,null,false,null,421985194704467,[[87,227,null,0,false,false,false,692460336297492,false]],[[92,38,null,974706823879929,false,[[1,[2,"addTransitionEffect"]],[13]]],[-1,92,null,874819660012853,false,[[0,[1,0.1]]]]],[[0,null,false,null,911466623987434,[[93,50,null,0,false,false,false,603499170049349,false]],[[92,38,null,513412774941229,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[18,[12,[19,41],[2,"level11"]],[2,"MainMenu"],[10,[2,"level"],[4,[19,73,[[19,223,[[19,41],[2,"level"],[2,""]]]]],[0,1]]]]]]]]]],[0,null,false,null,476510131052154,[[-1,69,null,0,false,false,false,133594294542983,false]],[],[[0,null,false,null,761192871396021,[[-1,40,null,0,false,false,false,778848706023438,false,[[7,[19,41]],[8,0],[7,[2,"level9"]]]]],[[-1,33,null,390828586476949,false,[[11,"TypeMenu"],[7,[0,13]]]],[92,38,null,276174409820083,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[2,"MainMenu"]]]]]]],[0,null,false,null,147828197698378,[[-1,69,null,0,false,false,false,982550808377422,false]],[[92,38,null,242246304281495,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[18,[12,[19,41],[2,"level11"]],[2,"MainMenu"],[10,[2,"level"],[4,[19,73,[[19,223,[[19,41],[2,"level"],[2,""]]]]],[0,1]]]]]]]]]]]]]]]]]],[0,null,false,null,720342139981239,[[197,94,null,1,false,false,false,964149979541449,false]],[[197,95,null,417829818332432,false,[[0,[5,[20,197,96,false,null],[0,50]]],[0,[4,[20,197,97,false,null],[0,3]]]]]]]]],["Traps",[[0,[true,"Init All traps"],false,null,180398639829655,[[-1,46,null,0,false,false,false,180398639829655,false,[[1,[2,"Init All traps"]]]]],[],[[0,null,false,null,766861564625072,[[116,76,null,1,false,false,false,868744698418227,false],[116,42,null,0,false,false,false,160103948495755,false,[[10,0],[8,0],[7,[0,0]]]]],[[116,45,null,764709584918384,false,[[10,0],[7,[19,74,[[0,4],[0,7]]]]]]]],[0,null,false,null,794671724871461,[[116,76,null,1,false,false,false,770408007039109,false],[116,118,null,0,false,false,false,684110385903421,false,[[10,1]]]],[[-1,77,null,173645486019158,false,[[4,175],[5,[20,116,63,true,null]],[0,[20,116,44,false,null]],[0,[20,116,78,false,null]]]],[175,185,null,755927514517719,false,[[3,0],[4,116]]]]],[0,null,false,null,561883796516568,[[119,76,null,1,false,false,false,711376572638710,false],[119,118,null,0,false,false,false,369726926629391,false,[[10,1]]]],[[-1,77,null,124713497153015,false,[[4,175],[5,[20,119,63,true,null]],[0,[20,119,44,false,null]],[0,[20,119,78,false,null]]]],[175,228,null,829894992489472,false,[[0,[0,250]]]],[175,229,null,902881734357462,false,[[0,[0,250]]]]]],[0,null,false,null,783172837079583,[[120,76,null,1,false,false,false,419039165761836,false],[120,118,null,0,false,false,false,717818738580400,false,[[10,1]]]],[[-1,77,null,527149004653469,false,[[4,175],[5,[20,120,63,true,null]],[0,[20,120,44,false,null]],[0,[20,120,78,false,null]]]],[175,228,null,414034801190910,false,[[0,[0,250]]]],[175,229,null,405490434950075,false,[[0,[0,250]]]]]],[0,null,false,null,288434481801454,[[108,76,null,1,false,false,false,230848241322943,false]],[[108,45,null,515603286852946,false,[[10,5],[7,[20,108,44,false,null]]]],[108,45,null,504009809044313,false,[[10,6],[7,[20,108,78,false,null]]]]]],[0,null,false,null,113221355471488,[[150,230,null,1,false,false,false,389040701841053,false]],[[150,231,null,484164880231178,false,[[10,5],[7,[20,150,196,false,null]]]],[150,231,null,866812175073696,false,[[10,6],[7,[20,150,194,false,null]]]]]],[0,null,false,null,837259721769407,[[210,232,null,1,false,false,false,163491543422421,false]],[[210,67,null,423025681186882,false]]],[0,null,false,null,362708142192849,[[168,76,null,1,false,false,false,212750475942557,false]],[[-1,92,null,872632686071204,false,[[0,[0,1]]]],[168,106,"LiteTween",870530733468046,false,[[3,0],[3,1]]],[-1,92,null,637832685423616,false,[[0,[0,1]]]],[168,67,null,129418433935628,false]]],[0,null,false,null,232817152250607,[[213,76,null,1,false,false,false,574391023365911,false],[213,42,null,0,false,true,false,118697081668030,false,[[10,0],[8,0],[7,[0,0]]]]],[],[[0,null,false,null,415904984843313,[[208,90,null,0,false,false,true,331863543016251,false,[[0,[21,213,false,null,0]]]]],[[213,127,"Pin",931182677572932,false,[[4,208],[3,1]]]]],[0,null,false,null,192042315575330,[[209,201,null,0,false,false,true,758955068635835,false,[[0,[21,213,false,null,0]]]]],[[213,127,"Pin",602481479243631,false,[[4,208],[3,1]]]]]]],[0,null,false,null,187785698320837,[[127,76,null,1,false,false,false,785425401585262,false]],[[127,225,null,539239846093079,false]]]]],[0,[true,"Init All Pins"],false,null,599182297207600,[[-1,46,null,0,false,false,false,599182297207600,false,[[1,[2,"Init All Pins"]]]]],[],[[0,null,false,null,604329314971274,[[214,230,null,1,false,false,false,933155424737212,false],[214,233,null,0,false,false,false,800395429924693,false,[[0,[0,0]]]],[214,234,null,0,false,false,false,521117900293306,false,[[10,0]]]],[],[[0,null,true,null,598891148708132,[[214,150,null,0,false,false,false,204288510424902,false,[[10,1],[8,0],[7,[0,-1]]]],[214,150,null,0,false,false,false,154413142878948,false,[[10,1],[8,0],[7,[0,0]]]]],[[-1,77,null,656748850303600,false,[[4,161],[5,[20,214,235,true,null]],[0,[20,214,196,false,null]],[0,[20,214,194,false,null]]]],[161,127,"Pin",478376910204289,false,[[4,214],[3,1]]]]],[0,null,true,null,582672599480236,[[214,150,null,0,false,false,false,318171057688789,false,[[10,1],[8,0],[7,[0,1]]]],[214,150,null,0,false,false,false,983453730272786,false,[[10,1],[8,0],[7,[0,0]]]]],[[-1,77,null,294575684346560,false,[[4,161],[5,[20,214,235,true,null]],[0,[4,[20,214,196,false,null],[20,214,197,false,null]]],[0,[20,214,194,false,null]]]],[161,127,"Pin",704404819741409,false,[[4,214],[3,1]]]]]]],[0,null,false,null,414422594683374,[[215,76,null,1,false,false,false,583000975173691,false],[215,236,null,0,false,false,false,522894918065070,false,[[0,[0,0]]]],[215,118,null,0,false,false,false,727101086279758,false,[[10,0]]]],[],[[0,null,true,null,448570462669455,[[215,42,null,0,false,false,false,772711547073764,false,[[10,1],[8,0],[7,[0,-1]]]],[215,42,null,0,false,false,false,268352562265788,false,[[10,1],[8,0],[7,[0,0]]]]],[[-1,77,null,668190451966596,false,[[4,161],[5,[20,215,63,true,null]],[0,[20,215,237,false,null]],[0,[20,215,238,false,null]]]],[161,127,"Pin",503433271518560,false,[[4,215],[3,1]]]]],[0,null,true,null,888639116037164,[[215,42,null,0,false,false,false,897972023000840,false,[[10,1],[8,0],[7,[0,1]]]],[215,42,null,0,false,false,false,717658856653854,false,[[10,1],[8,0],[7,[0,0]]]]],[[-1,77,null,811766563831853,false,[[4,161],[5,[20,215,63,true,null]],[0,[20,215,239,false,null]],[0,[20,215,238,false,null]]]],[161,127,"Pin",351812957202673,false,[[4,215],[3,1]]]]]]]]],[0,[true,"JumpPlatform"],false,null,729433035440083,[[-1,46,null,0,false,false,false,729433035440083,false,[[1,[2,"JumpPlatform"]]]]],[],[[0,null,false,null,983242072539945,[[141,188,null,0,false,false,true,704503885836204,false,[[4,110]]],[110,145,null,0,false,false,false,151322753737961,false,[[8,0],[0,[0,3]]]],[141,42,null,0,false,true,false,846420665919038,false,[[10,2],[8,0],[7,[23,"STATE_SUBMORINE"]]]],[141,42,null,0,false,true,false,997017819467957,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,true,false,849381254842190,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]],[141,42,null,0,false,true,false,485004689630508,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[110,81,null,563141641162308,false,[[0,[0,0]]]],[110,240,null,828761891702086,false,[[3,0]]],[141,173,"Platform",983378325328497,false,[[0,[6,[19,175,[[20,110,154,false,null]]],[21,110,false,null,3]]]]],[141,169,"Platform",102264476170642,false,[[0,[6,[6,[19,176,[[20,110,154,false,null]]],[21,110,false,null,3]],[0,-1]]]]],[98,147,null,276539381440081,false,[[2,["trampoline",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]],[[0,null,false,null,176951679842904,[[-1,40,null,0,false,false,false,611731045007653,false,[[7,[19,175,[[20,110,154,false,null]]]],[8,4],[7,[0,0]]]]],[[92,38,null,172596675397633,false,[[1,[2,"changefaceDir"]],[13,[7,[0,1]]]]]]],[0,null,false,null,585385213024003,[[-1,40,null,0,false,false,false,115434844837794,false,[[7,[19,175,[[20,110,154,false,null]]]],[8,2],[7,[0,0]]]]],[[92,38,null,412277378003858,false,[[1,[2,"changefaceDir"]],[13,[7,[0,-1]]]]]]],[0,null,false,null,155179415042829,[[141,42,null,0,false,false,false,190790620375742,false,[[10,2],[8,0],[7,[23,"STATE_FALL_DEATH"]]]]],[[141,45,null,736350990896505,false,[[10,2],[7,[23,"STATE_IDLE"]]]]]],[0,null,false,null,798609508245518,[],[]]]]]],[0,[true,"TileFeel"],false,null,568025520517022,[[-1,46,null,0,false,false,false,568025520517022,false,[[1,[2,"TileFeel"]]]]],[],[[0,null,false,null,980515884301227,[[92,28,null,2,false,false,false,416796830510904,false,[[1,[2,"reset_BlueBoxes"]]]]],[],[[0,null,false,null,541135910254925,[[-1,86,null,0,true,false,false,975288482216744,false,[[4,108]]]],[[108,241,"LiteTween",382823411977639,false,[[3,0]]],[108,206,null,442690067022203,false,[[0,[21,108,false,null,5]],[0,[21,108,false,null,6]]]],[108,242,null,841482672997715,false,[[3,1]]],[108,216,null,793098780745479,false,[[0,[0,100]]]],[108,243,"LiteTween",823409863911305,false,[[3,0]]],[108,103,"LiteTween",769442901886818,false,[[3,0],[3,1],[0,[0,0]]]],[108,103,"LiteTween",664240672924986,false,[[3,1],[3,1],[0,[0,1000]]]]]]]],[0,null,false,null,639825965660483,[[141,188,null,0,false,false,true,601097704636041,false,[[4,108]]],[141,148,null,0,false,false,false,389468018052282,false,[[4,108],[0,[0,0]],[0,[0,1]]]],[108,244,"LiteTween",0,false,true,false,526788250101142,false],[141,42,null,0,false,true,false,514669910691574,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[-1,92,null,150179477032735,false,[[0,[1,0.2]]]],[108,106,"LiteTween",140710079587537,false,[[3,0],[3,0]]],[-1,92,null,348543732910274,false,[[0,[1,0.7]]]]],[[0,null,false,null,381413441245751,[[108,162,null,0,false,false,false,846696187679738,false,[[4,161]]],[161,162,null,0,false,false,false,882893131003222,false,[[4,141]]]],[[161,242,null,629787999052198,false,[[3,0]]],[141,177,"Pin",666128699557482,false],[141,174,"Platform",225423410860476,false,[[3,1]]],[141,45,null,215260219969619,false,[[10,2],[7,[23,"STATE_FALL"]]]]],[[0,null,false,null,670521202280909,[],[[-1,92,null,376924105400404,false,[[0,[1,2.3]]]],[161,242,null,944654544593459,false,[[3,1]]]]]]],[0,null,false,null,151568745928111,[],[[108,242,null,487726355694458,false,[[3,0]]],[-1,92,null,937090168266309,false,[[0,[1,0.6]]]],[108,216,null,649184329390768,false,[[0,[0,0]]]],[-1,92,null,405374308969531,false,[[0,[1,1.7]]]]],[[0,null,false,null,135284149138559,[[108,155,null,0,false,true,false,388466826803103,false,[[8,0],[0,[21,108,false,null,6]]]]],[[108,206,null,105325187537483,false,[[0,[21,108,false,null,5]],[0,[21,108,false,null,6]]]],[108,243,"LiteTween",649247292054956,false,[[3,5]]],[108,103,"LiteTween",194729135037632,false,[[3,3],[3,0],[0,[0,100]]]],[108,106,"LiteTween",301670506784811,false,[[3,0],[3,0]]],[-1,92,null,464156970579783,false,[[0,[1,1.3]]]]],[[0,null,false,null,608473929481817,[[108,245,null,0,false,true,false,838321226215006,false]],[[108,242,null,789800355981129,false,[[3,1]]],[108,243,"LiteTween",807425411135710,false,[[3,0]]],[108,103,"LiteTween",917255649857632,false,[[3,0],[3,1],[0,[0,0]]]],[108,103,"LiteTween",637158270639359,false,[[3,1],[3,1],[0,[0,1000]]]]]]]]]],[0,null,false,null,515786807987345,[],[]]]],[0,null,false,null,197473363762126,[[141,188,null,0,false,false,true,342821445878497,false,[[4,150]]],[141,148,null,0,false,false,false,950360922929204,false,[[4,150],[0,[0,0]],[0,[0,1]]]],[150,244,"LiteTween",0,false,true,false,624243323556510,false],[141,42,null,0,false,true,false,196112878039116,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[150,106,"LiteTween",413823450107663,false,[[3,0],[3,0]]],[-1,92,null,335322340700005,false,[[0,[1,0.7]]]],[150,190,"Solid",551750764232488,false,[[3,0]]],[-1,92,null,731094611570857,false,[[0,[0,1]]]],[108,216,null,347124265344256,false,[[0,[0,0]]]],[-1,92,null,296032227980288,false,[[0,[1,1.3]]]],[150,246,null,381699384476277,false,[[0,[21,150,false,null,5]],[0,[21,150,false,null,6]]]],[150,247,null,598746100463589,false,[[0,[0,0]]]],[150,243,"LiteTween",284536616408508,false,[[3,5]]],[150,103,"LiteTween",642786111578372,false,[[3,3],[3,0],[0,[0,100]]]],[150,106,"LiteTween",717242756515062,false,[[3,0],[3,0]]],[-1,92,null,930946393832697,false,[[0,[1,1.3]]]],[150,190,"Solid",713783867695144,false,[[3,1]]],[150,243,"LiteTween",184959152983015,false,[[3,0]]],[150,103,"LiteTween",913757646980561,false,[[3,0],[3,1],[0,[0,0]]]],[150,103,"LiteTween",289833685698601,false,[[3,1],[3,1],[0,[0,1000]]]]],[[0,null,false,null,779833388937061,[],[]]]]]],[0,[true,"TileCrash"],false,null,783598294307746,[[-1,46,null,0,false,false,false,783598294307746,false,[[1,[2,"TileCrash"]]]]],[],[[0,null,false,null,774845159428387,[[141,188,null,0,false,false,true,400736217523180,false,[[4,109]]],[141,148,null,0,false,false,false,123625789047646,false,[[4,109],[0,[0,0]],[0,[0,1]]]],[141,42,null,0,false,true,false,627504088648528,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[109,55,null,588708228346293,false,[[1,[2,"destroy"]],[3,1]]]],[[0,null,false,null,229573925552773,[],[]],[0,null,false,null,934597924408207,[],[[-1,92,null,227255267073846,false,[[0,[0,4]]]],[109,216,null,212564014392321,false,[[0,[0,0]]]],[109,55,null,625647717655795,false,[[1,[2,"norm"]],[3,1]]],[109,242,null,911170240573301,false,[[3,1]]],[109,106,"LiteTween",272931654003644,false,[[3,0],[3,1]]]]]]],[0,null,false,null,439120008730254,[[109,145,null,0,false,false,false,737207058442023,false,[[8,5],[0,[0,15]]]]],[[109,242,null,576132669560369,false,[[3,0]]]]],[0,null,false,null,617140491940465,[[109,91,null,0,false,false,false,680549592427918,false,[[1,[2,"destroy"]]]]],[],[[0,null,false,null,663570280487705,[[109,145,null,0,false,false,false,725907864174242,false,[[8,0],[0,[0,0]]]],[-1,146,null,0,false,false,false,571699532714473,false]],[[98,147,null,466947748157435,false,[[2,["block_collapse",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,109],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,638965936883721,[[109,145,null,0,false,false,false,792939603562924,false,[[8,0],[0,[0,4]]]],[-1,146,null,0,false,false,false,243731447005289,false]],[[98,147,null,372961511935948,false,[[2,["block_collapse",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,109],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,145696341135722,[[109,145,null,0,false,false,false,829202910662287,false,[[8,0],[0,[0,9]]]],[-1,146,null,0,false,false,false,374789238783251,false]],[[98,147,null,369708720216192,false,[[2,["block_collapse",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,109],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]],[0,null,false,null,675372511875832,[[109,145,null,0,false,false,false,999723120877297,false,[[8,0],[0,[0,14]]]],[-1,146,null,0,false,false,false,975848225359756,false]],[[98,147,null,564676088744917,false,[[2,["block_collapse",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,109],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]]]]]]]],[0,[true,"Mines"],false,null,873360263757934,[[-1,46,null,0,false,false,false,873360263757934,false,[[1,[2,"Mines"]]]]],[],[[0,null,false,null,117899711381888,[[141,188,null,0,false,false,true,296758511035595,false,[[4,111]]],[141,42,null,0,false,true,false,524741879060927,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[-1,77,null,820351899868675,false,[[4,167],[5,[20,111,63,true,null]],[0,[20,111,44,false,null]],[0,[20,111,78,false,null]]]],[111,67,null,610123413128116,false],[92,38,null,125820158593349,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Saws"],false,null,620013560840390,[[-1,46,null,0,false,false,false,620013560840390,false,[[1,[2,"Saws"]]]]],[],[[0,null,false,null,767476447272093,[[-1,37,null,0,false,false,false,342263333685681,false,[[0,[1,0.01666666666666667]]]]],[[211,126,null,500198682819732,false,[[0,[4,[20,211,154,false,null],[21,211,false,null,0]]]]]]],[0,null,false,null,242587308580535,[[211,188,null,0,false,false,true,489933192899170,false,[[4,141]]],[141,42,null,0,false,true,false,258638734968994,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,901368559619921,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Conveyr"],false,null,224617814234702,[[-1,46,null,0,false,false,false,224617814234702,false,[[1,[2,"Conveyr"]]]]],[],[[0,null,false,null,950033551179018,[[-1,37,null,0,false,false,false,401187996076074,false,[[0,[1,0.01666666666666667]]]]],[],[[0,null,false,null,246952733581295,[[141,148,null,0,false,false,false,281165167442286,false,[[4,212],[0,[0,0]],[0,[0,1]]]],[141,42,null,0,false,true,false,839371665218840,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,158,null,542598753600950,false,[[0,[4,[20,141,44,false,null],[6,[21,212,false,null,0],[0,8]]]]]]]]]]]],[0,[true,"Press"],false,null,101454218980967,[[-1,46,null,0,false,false,false,101454218980967,false,[[1,[2,"Press"]]]]],[],[[0,null,false,null,235196103922539,[[141,162,null,0,false,false,false,254750725968477,false,[[4,125]]],[141,42,null,0,false,true,false,414269892234863,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,827538929396127,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Tile Danger"],false,null,505720586772870,[[-1,46,null,0,false,false,false,505720586772870,false,[[1,[2,"Tile Danger"]]]]],[],[[0,null,true,null,461432963859860,[[141,148,null,0,false,false,false,937102266055403,false,[[4,128],[0,[0,0]],[0,[0,1]]]],[141,148,null,0,false,false,false,312790649606033,false,[[4,128],[0,[0,0]],[0,[0,-1]]]],[141,148,null,0,false,false,false,481364142919450,false,[[4,128],[0,[0,1]],[0,[0,0]]]],[141,148,null,0,false,false,false,888266299564344,false,[[4,128],[0,[0,-1]],[0,[0,0]]]]],[],[[0,null,false,null,720028310755960,[[128,145,null,0,false,false,false,383595421760329,false,[[8,5],[0,[0,5]]]],[128,145,null,0,false,false,false,809888140585939,false,[[8,3],[0,[0,9]]]],[141,42,null,0,false,true,false,639936150766422,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,386743794067197,false,[[1,[2,"heroDeath"]],[13]]]]]]]]],[0,[true,"CheckPoint and Finish"],false,null,187109986598046,[[-1,46,null,0,false,false,false,187109986598046,false,[[1,[2,"CheckPoint and Finish"]]]]],[],[[0,null,false,null,231897731330836,[[141,162,null,0,false,false,false,918138113922089,false,[[4,127]]],[141,42,null,0,false,true,false,214978181603499,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[-1,33,null,515590773578930,false,[[11,"checkpointUID"],[7,[20,127,79,false,null]]]],[98,147,null,516181462772009,false,[[2,["checkpoint",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[127,242,null,170879447754009,false,[[3,0]]],[127,55,null,178449604657503,false,[[1,[2,"active"]],[3,1]]],[-1,136,null,213909704806059,false,[[11,"GUIcurrentCheckpointsNumber"],[7,[0,1]]]]]],[0,null,false,null,798075870886541,[[141,162,null,0,false,false,false,730893229198307,false,[[4,153]]],[141,42,null,0,false,true,false,678927196484609,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[98,147,null,901221389936525,false,[[2,["checkpoint",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,157],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[-1,33,null,660257341722335,false,[[11,"GUIfinishLevel"],[7,[0,1]]]],[-1,33,null,183169743524192,false,[[11,"GUIstopTimer"],[7,[0,1]]]],[153,242,null,888208427257255,false,[[3,0]]],[153,55,null,169346239224255,false,[[1,[2,"active"]],[3,1]]],[-1,92,null,679092460135423,false,[[0,[1,0.5]]]],[92,38,null,358681178307771,false,[[1,[2,"heroFinished"]],[13]]],[-1,92,null,764112739042223,false,[[0,[0,2]]]],[92,38,null,830094559403148,false,[[1,[2,"GUIfinishLevel"]],[13]]]]]]],[0,[true,"Guns"],false,null,260851220359060,[[-1,46,null,0,false,false,false,260851220359060,false,[[1,[2,"Guns"]]]]],[],[[0,null,false,null,674071463158453,[[131,76,null,1,false,false,false,771575490333569,false]],[[-1,92,null,804198036357715,false,[[0,[21,131,false,null,0]]]]],[[0,null,false,null,559989288560323,[],[[131,55,null,995563724235686,false,[[1,[2,"shot"]],[3,1]]],[131,108,null,461289481848523,false,[[0,[21,131,false,null,1]]]]]]]],[0,null,false,null,867038702162935,[[131,145,null,0,false,false,false,731531233952552,false,[[8,0],[0,[0,6]]]],[-1,86,null,0,true,false,false,902848736328857,false,[[4,131]]],[131,42,null,0,false,false,false,739182727328324,false,[[10,2],[8,0],[7,[0,0]]]]],[[-1,77,null,357599806892651,false,[[4,158],[5,[20,131,63,true,null]],[0,[20,131,44,false,null]],[0,[20,131,78,false,null]]]],[158,248,"Bullet",506500138795557,false,[[0,[20,131,154,false,null]]]],[131,45,null,921723025447415,false,[[10,2],[7,[0,1]]]],[-1,92,null,242645868830679,false,[[0,[1,0.2]]]],[131,45,null,660084702855048,false,[[10,2],[7,[0,0]]]]]],[0,null,true,null,911731223905498,[[158,162,null,0,false,false,false,759980649322471,false,[[4,208]]],[158,162,null,0,false,false,false,177859852217510,false,[[4,209]]]],[[-1,77,null,774069224708845,false,[[4,166],[5,[20,158,63,true,null]],[0,[20,158,44,false,null]],[0,[20,158,78,false,null]]]],[166,126,null,274386378206981,false,[[0,[20,158,154,false,null]]]],[158,67,null,556189778230482,false]],[[0,null,false,null,904710914005912,[[158,162,null,0,false,false,false,877173280680723,false,[[4,209]]]],[[-1,77,null,507018104195483,false,[[4,168],[5,[2,"traps"]],[0,[20,158,44,false,null]],[0,[20,158,78,false,null]]]],[168,126,null,398787417093152,false,[[0,[20,158,154,false,null]]]]]]]],[0,null,false,null,354995490407317,[[158,188,null,0,false,false,true,626466210594597,false,[[4,141]]],[141,42,null,0,false,true,false,644800243035627,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,203151392469533,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Boxes"],false,null,963478374676902,[[-1,46,null,0,false,false,false,963478374676902,false,[[1,[2,"Boxes"]]]]],[],[[0,null,false,null,352151999696924,[[129,249,null,1,false,false,false,466367505016965,false]],[],[[0,null,false,null,975086919263804,[],[[-1,77,null,131210691755376,false,[[4,169],[5,[20,129,63,true,null]],[0,[20,129,44,false,null]],[0,[20,129,78,false,null]]]]]],[1,"delay",0,0,false,false,499163474238295,false],[0,null,false,null,529764067786146,[[-1,111,null,0,true,false,false,652000559610246,false,[[0,[0,10]]]]],[[-1,77,null,143418204511210,false,[[4,165],[5,[20,129,63,true,null]],[0,[20,129,44,false,null]],[0,[20,129,78,false,null]]]],[165,250,"Chipmunk",130348838871396,false,[[3,0],[0,[19,74,[[0,-500],[0,500]]]],[0,[19,74,[[0,-500],[0,0]]]],[3,0],[0,[0,0]],[0,[0,0]]]],[165,251,"Chipmunk",295715332713197,false,[[0,[19,74,[[0,-500],[0,500]]]]]],[165,81,null,604226321637621,false,[[0,[19,73,[[19,74,[[0,0],[0,5]]]]]]]],[-1,33,null,758269071930559,false,[[11,"delay"],[7,[19,74,[[0,2],[0,3]]]]]],[-1,92,null,481710154184920,false,[[0,[23,"delay"]]]],[165,106,"LiteTween",398101160813608,false,[[3,0],[3,1]]],[-1,92,null,130083748501558,false,[[0,[0,1]]]],[165,67,null,106103117771076,false]]]]],[0,null,false,null,731429162185728,[[157,188,null,0,false,false,true,231871855468259,false,[[4,129]]]],[],[[0,null,true,null,713655506665840,[[141,42,null,0,false,false,false,612297091757012,false,[[10,2],[8,0],[7,[23,"STATE_MOTO"]]]],[141,42,null,0,false,false,false,409346375800685,false,[[10,2],[8,0],[7,[23,"STATE_ROCKET"]]]]],[[98,147,null,869616331833055,false,[[2,["block_collapse",false]],[3,0],[0,[6,[0,200],[5,[23,"Sounds"],[0,1]]]],[4,129],[0,[0,360]],[0,[0,360]],[0,[0,0]],[1,[2,"gameplay"]]]],[129,67,null,387602419665520,false]]]]]]],[0,[true,"Spikes"],false,null,626954488636799,[[-1,46,null,0,false,false,false,626954488636799,false,[[1,[2,"Spikes"]]]]],[],[[0,null,false,null,428226233376979,[[213,76,null,1,false,false,false,686899655950593,false]],[],[[0,null,false,null,525824631941563,[[213,118,null,0,false,true,false,183519006660733,false,[[10,1]]]],[[213,138,null,713748263485296,false,[[4,213],[7,[0,1]]]],[213,121,null,435724701815697,false,[[10,1],[3,1]]],[213,45,null,333214462732665,false,[[10,6],[7,[0,0]]]]]],[0,null,false,null,206047604535583,[[213,118,null,0,false,false,false,971725597396296,false,[[10,2]]]],[],[[0,null,false,null,465797823199461,[[213,42,null,0,false,false,false,292466702676275,false,[[10,5],[8,1],[7,[0,0]]]]],[[213,252,"Timer",308092504800723,false,[[0,[21,213,false,null,5]],[3,0],[1,[2,"timerActStart"]]]]]],[0,null,false,null,308859085437354,[[-1,69,null,0,false,false,false,899977727111043,false]],[[213,252,"Timer",718681121633161,false,[[0,[21,213,false,null,3]],[3,0],[1,[2,"timerActTimeOn"]]]]]],[0,null,false,null,777025247587111,[],[]],[0,null,false,null,798168771219254,[],[]]]]]],[0,null,false,null,487794484141753,[[92,28,null,2,false,false,false,642254868646519,false,[[1,[2,"trapsActSpikes"]]]]],[],[[0,null,false,null,307576221570700,[[213,90,null,0,false,false,true,990378240392240,false,[[0,[20,92,31,false,null,[[0,0]]]]]]],[],[[0,null,false,null,418199952826049,[[213,42,null,0,false,false,false,369645982353171,false,[[10,6],[8,0],[7,[0,1]]]]],[[213,45,null,136514176892222,false,[[10,6],[7,[0,0]]]],[213,103,"LiteTween",885354329679421,false,[[3,0],[3,0],[0,[20,213,253,false,null,[[0,1]]]]]],[213,103,"LiteTween",708765049153585,false,[[3,1],[3,0],[0,[20,213,254,false,null,[[0,1]]]]]],[213,255,"LiteTween",900351902348161,false,[[0,[21,213,false,null,7]]]],[213,106,"LiteTween",689401512996497,false,[[3,0],[3,1]]]]],[0,null,false,null,185881779923465,[[-1,69,null,0,false,false,false,843091531565685,false],[213,42,null,0,false,false,false,768373223129243,false,[[10,6],[8,0],[7,[0,0]]]]],[[213,45,null,228494098967111,false,[[10,6],[7,[0,1]]]],[213,103,"LiteTween",776729503398624,false,[[3,0],[3,0],[0,[20,213,253,false,null,[[0,2]]]]]],[213,103,"LiteTween",480712676039755,false,[[3,1],[3,0],[0,[20,213,254,false,null,[[0,2]]]]]],[213,255,"LiteTween",296047038913234,false,[[0,[21,213,false,null,8]]]],[213,106,"LiteTween",490501328769419,false,[[3,0],[3,1]]]]]]],[0,null,false,null,628288495463337,[],[]]]],[0,null,false,null,322736236048658,[[213,256,"Timer",0,false,false,false,619552256173663,false,[[1,[2,"timerActStart"]]]],[-1,86,null,0,true,false,false,598042053769285,false,[[4,213]]],[213,118,null,0,false,false,false,774117599377892,false,[[10,2]]]],[[213,252,"Timer",976870802724647,false,[[0,[21,213,false,null,3]],[3,0],[1,[2,"timerActTimeOn"]]]],[92,38,null,906867487626448,false,[[1,[2,"trapsActSpikes"]],[13,[7,[20,213,79,false,null]]]]]]],[0,null,false,null,315252638521318,[[213,256,"Timer",0,false,false,false,523821553496044,false,[[1,[2,"timerActTimeOn"]]]],[-1,86,null,0,true,false,false,592069160821898,false,[[4,213]]],[213,118,null,0,false,false,false,738155871150978,false,[[10,2]]]],[[213,252,"Timer",509884728778621,false,[[0,[21,213,false,null,4]],[3,0],[1,[2,"timerActTimeOff"]]]],[92,38,null,286974573928743,false,[[1,[2,"trapsActSpikes"]],[13,[7,[20,213,79,false,null]]]]]]],[0,null,false,null,661651634903015,[[213,256,"Timer",0,false,false,false,727677677628644,false,[[1,[2,"timerActTimeOff"]]]],[-1,86,null,0,true,false,false,478139561040986,false,[[4,213]]],[213,118,null,0,false,false,false,243162296310492,false,[[10,2]]]],[[213,252,"Timer",945747466228104,false,[[0,[21,213,false,null,3]],[3,0],[1,[2,"timerActTimeOn"]]]],[92,38,null,827086249658006,false,[[1,[2,"trapsActSpikes"]],[13,[7,[20,213,79,false,null]]]]]]],[0,null,false,null,562690087961880,[[141,162,null,0,false,false,false,444730323482681,false,[[4,130]]],[141,42,null,0,false,true,false,218033661225055,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,700589543711004,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Fun"],false,null,990728620667231,[[-1,46,null,0,false,false,false,990728620667231,false,[[1,[2,"Fun"]]]]],[],[[0,null,false,null,477786852748744,[[133,76,null,1,false,false,false,732748937736883,false]],[[-1,77,null,541786392107194,false,[[4,132],[5,[20,133,63,true,null]],[0,[20,133,44,false,null]],[0,[20,133,78,false,null]]]],[132,117,null,639301201334999,false,[[0,[21,133,false,null,1]]]],[132,126,null,169834272642664,false,[[0,[20,133,154,false,null]]]],[132,45,null,869276804431016,false,[[10,0],[7,[21,133,false,null,0]]]]]],[0,null,false,null,453796167656560,[[141,162,null,0,false,false,false,793211796371948,false,[[4,132]]],[141,42,null,0,false,true,false,542140005781185,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[141,169,"Platform",228302134087906,false,[[0,[4,[21,141,false,null,4],[6,[6,[19,176,[[20,132,154,false,null]]],[21,132,false,null,0]],[0,-1]]]]]],[141,45,null,696506884694180,false,[[10,17],[7,[0,0]]]]]],[0,null,false,null,507063712445070,[[133,188,null,0,false,false,true,169382923859414,false,[[4,141]]],[141,42,null,0,false,true,false,551370513017694,false,[[10,2],[8,0],[7,[23,"STATE_DEATH"]]]]],[[92,38,null,170208323802422,false,[[1,[2,"heroDeath"]],[13]]]]]]],[0,[true,"Conveur"],false,null,159080591677888,[[-1,46,null,0,false,false,false,159080591677888,false,[[1,[2,"Conveur"]]]]],[],[[0,null,false,null,759221182040933,[[155,118,null,0,false,false,false,449032310356556,false,[[10,2]]]],[],[[0,null,false,null,541181785728108,[[-1,37,null,0,false,false,false,449157753290093,false,[[0,[21,155,false,null,0]]]]],[[-1,77,null,418345429018111,false,[[4,154],[5,[20,155,63,true,null]],[0,[20,155,44,false,null]],[0,[20,155,78,false,null]]]],[154,257,"Bullet",217211139691369,false,[[0,[21,155,false,null,1]]]],[154,225,null,353987447256988,false]]]]],[0,null,false,null,669846727645288,[[154,76,null,1,false,false,false,856973022709103,false]],[[-1,92,null,964512479540353,false,[[0,[0,20]]]],[154,67,null,631377037412850,false]]],[0,null,false,null,660679073640079,[[154,162,null,0,false,false,false,628588023155755,false,[[4,155]]],[155,118,null,0,false,true,false,359992504524878,false,[[10,2]]]],[],[[0,null,false,null,788957712292134,[[154,115,null,0,false,false,false,718936121532935,false,[[8,5],[0,[20,155,44,false,null]]]],[154,258,"Bullet",0,false,false,false,788941611104497,false,[[8,4],[0,[0,0]]]]],[[154,67,null,594199738153564,false]]],[0,null,false,null,185737928848074,[[154,115,null,0,false,false,false,502948169421826,false,[[8,3],[0,[20,155,44,false,null]]]],[154,258,"Bullet",0,false,false,false,757546874000654,false,[[8,2],[0,[0,0]]]]],[[154,67,null,781446920267767,false]]]]],[0,null,false,null,115218367255926,[[154,249,null,1,false,false,false,885282079105558,false],[154,118,null,0,false,false,false,946187485907412,false,[[10,0]]]],[[141,121,null,249119686878047,false,[[10,18],[3,0]]],[141,174,"Platform",829181369249805,false,[[3,1]]],[141,177,"Pin",543379755438605,false],[141,45,null,778727583098567,false,[[10,2],[7,[23,"STATE_FALL"]]]],[-1,92,null,742298750634723,false,[[0,[1,0.5]]]],[141,121,null,556769054207785,false,[[10,18],[3,1]]]]]]],[0,[true,"Water"],false,null,822941387676895,[[-1,46,null,0,false,false,false,822941387676895,false,[[1,[2,"Water"]]]]],[]],[0,null,false,null,132107926408663,[[141,162,null,0,false,false,false,497658615666741,false,[[4,124]]],[141,42,null,0,false,true,false,573462026788451,false,[[10,2],[8,0],[7,[23,"STATE_WALL_JOINT"]]]],[141,42,null,0,false,true,false,317986876284226,false,[[10,2],[8,0],[7,[23,"STATE_WALL_SLIDING"]]]]],[[92,38,null,816957442530957,false,[[1,[2,"heroDeath"]],[13]]]]]]],["SaveLoad",[[0,null,false,null,963078027517364,[[92,28,null,2,false,false,false,400492014122416,false,[[1,[2,"saveGame"]]]]],[],[[0,null,false,null,200740735868015,[[92,134,null,0,false,false,false,789832814804537,false,[[0,[0,0]],[8,0],[7,[0,0]]]]],[[99,259,null,782567801348081,false,[[1,[2,"arrays"]],[7,[10,[10,[10,[10,[20,100,260,true,null],[2,"separ"]],[20,103,260,true,null]],[2,"separ"]],[20,104,260,true,null]]]]]]],[0,null,false,null,257252636512140,[[92,134,null,0,false,false,false,163354880455689,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[[93,261,null,785468662850150,false,[[1,[2,"arrays"]],[1,[10,[10,[10,[10,[20,100,260,true,null],[2,"separ"]],[20,103,260,true,null]],[2,"separ"]],[20,104,260,true,null]]]]]]]]],[0,null,false,null,106862540142699,[[92,28,null,2,false,false,false,891517852373068,false,[[1,[2,"loadGame"]]]]],[],[[0,null,false,null,285867288476571,[[92,134,null,0,false,false,false,958982781016283,false,[[0,[0,0]],[8,0],[7,[0,0]]]]],[[99,262,null,155132575806105,false,[[1,[2,"arrays"]]]]]],[0,null,false,null,603119871751448,[[92,134,null,0,false,false,false,635101065714181,false,[[0,[0,0]],[8,0],[7,[0,1]]]]],[[103,263,null,983207314251061,false],[104,263,null,606385916567228,false],[93,264,null,277905419597622,false,[[1,[2,"arrays"]]]]]]]],[0,null,false,null,376521091864432,[[99,265,null,1,false,false,false,745950609352258,false,[[1,[2,"arrays"]]]]],[[100,266,null,307790471495582,false,[[1,[19,133,[[20,99,267,false,null],[0,0],[2,"separ"]]]]]],[103,266,null,671248084518737,false,[[1,[19,133,[[20,99,267,false,null],[0,1],[2,"separ"]]]]]],[104,266,null,136548428941799,false,[[1,[19,133,[[20,99,267,false,null],[0,2],[2,"separ"]]]]]]],[[0,null,false,null,861340044198071,[[-1,40,null,0,false,false,false,167677233431720,false,[[7,[20,104,39,false,null,[[0,1],[0,1]]]],[8,4],[7,[0,0]]]]],[[92,38,null,546176328521793,false,[[1,[2,"showAchievement"]],[13,[7,[0,6]]]]],[92,38,null,879781541766551,false,[[1,[2,"updateAchievements"]],[13]]]]]]],[0,null,false,null,688209049777927,[[93,268,null,0,false,false,false,190382259400905,false]],[[100,266,null,104891697185929,false,[[1,[19,133,[[20,93,269,true,null],[0,0],[2,"separ"]]]]]],[103,266,null,271698531679968,false,[[1,[19,133,[[20,93,269,true,null],[0,1],[2,"separ"]]]]]],[104,266,null,703521135752292,false,[[1,[19,133,[[20,93,269,true,null],[0,2],[2,"separ"]]]]]]],[[0,null,false,null,121179399557242,[[-1,40,null,0,false,false,false,864427324120207,false,[[7,[20,104,39,false,null,[[0,1],[0,1]]]],[8,4],[7,[0,0]]]]],[[92,38,null,329792075964835,false,[[1,[2,"showAchievement"]],[13,[7,[0,6]]]]],[92,38,null,776510264480221,false,[[1,[2,"updateAchievements"]],[13]]]]]]],[0,null,false,null,442969225984137,[[92,28,null,2,false,false,false,824165709359430,false,[[1,[2,"updateAchievements"]]]]],[],[[0,null,false,null,307328008859212,[[-1,111,null,0,true,false,false,917493019374561,false,[[0,[0,15]]]],[100,124,null,0,false,false,false,121701903600353,false,[[0,[19,112]],[0,[0,3]],[8,5],[7,[0,1]]]]],[[92,38,null,755370198318707,false,[[1,[2,"showAchievement"]],[13,[7,[19,112]]]]]]]]],[0,null,false,null,902087226123779,[[92,28,null,2,false,false,false,829415640885261,false,[[1,[2,"clearSaves"]]]]],[[103,263,null,364598409378193,false],[104,263,null,290757117965066,false]]]]],["PreloaderBar",[[2,"FunctionTransitions",false],[0,null,false,null,684731652724356,[[-1,141,null,0,false,false,false,328787871747679,false]],[[1,270,null,534376164988854,false,[[0,[19,271,[[0,0],[6,[19,272],[0,295]],[0,295]]]]]]]],[0,null,false,null,570924500618400,[[-1,273,null,1,false,false,false,354124098835637,false]],[[92,38,null,132870957262183,false,[[1,[2,"addTransitionEffect"]],[13]]],[-1,92,null,848699239006130,false,[[0,[1,0.1]]]],[92,38,null,301553109388870,false,[[1,[2,"goToSceneWithTransition"]],[13,[7,[2,"MainMenu"]]]]]]],[0,null,false,null,391378518443230,[[-1,47,null,1,false,false,false,623810111097292,false],[93,48,null,0,false,true,false,195678496257740,false]],[[93,49,null,821393652705291,false,[[1,[2,"59b0371cbbddbd26c17a9723"]]]]]]]],["Menu",[[2,"Music",false],[2,"SaveLoad",false],[2,"FunctionStatistics",false],[2,"FunctionTransitions",false],[2,"FunctionBase",false],[2,"AchievementsAndArrays",false],[2,"GamePause",false],[2,"allButtons",false],[2,"SponsorLinks",false],[2,"MainMenuEvents",false]]],["LevelsAll",[[2,"Music",false],[2,"SaveLoad",false],[2,"SponsorLinks",false],[2,"GamePause",false],[2,"AchievementsAndArrays",false],[2,"allButtons",false],[2,"FunctionStatistics",false],[2,"FunctionBase",false],[2,"FunctionTransitions",false],[2,"Traps",false],[2,"GameplayGUI",false],[2,"Camera",false],[2,"HeroContoller",false]]],["Music",[[0,null,false,null,634966169893123,[[-1,47,null,1,false,false,false,126615306650902,false]],[],[[0,null,false,null,767419846720473,[[-1,40,null,0,false,false,false,611698748987944,false,[[7,[19,41]],[8,0],[7,[2,"MainMenu"]]]],[98,274,null,0,false,true,false,130373540283983,false,[[1,[2,"mainMusic"]]]]],[[98,70,null,843306472326821,false,[[2,["menu_mx",true]],[3,1],[0,[0,-10]],[1,[2,"mainMusic"]]]],[98,187,null,592907558834261,false,[[1,[2,"gameplayMusic"]]]],[92,38,null,397093832034555,false,[[1,[2,"updateMusic"]],[13]]]]],[0,null,false,null,846963893306989,[[-1,40,null,0,false,false,false,917122082758235,false,[[7,[19,275,[[19,41],[0,5]]]],[8,0],[7,[2,"level"]]]],[98,274,null,0,false,true,false,103920644067829,false,[[1,[2,"gameplayMusic"]]]]],[[98,70,null,126704739119750,false,[[2,["game_mx",true]],[3,1],[0,[0,-10]],[1,[2,"gameplayMusic"]]]],[98,187,null,923746222598886,false,[[1,[2,"mainMusic"]]]],[92,38,null,114569611645069,false,[[1,[2,"updateMusic"]],[13]]]]]]],[0,null,false,null,651806025511368,[[92,28,null,2,false,false,false,502934237683900,false,[[1,[2,"updateMusic"]]]]],[],[[0,null,false,null,198851811248631,[[-1,40,null,0,false,false,false,264372452837418,false,[[7,[23,"Music"]],[8,0],[7,[0,0]]]]],[[98,276,null,733268458943686,false,[[1,[2,"gameplayMusic"]],[3,0]]],[98,276,null,675665525586489,false,[[1,[2,"mainMusic"]],[3,0]]]]],[0,null,false,null,217189927503426,[[-1,40,null,0,false,false,false,809657489402169,false,[[7,[23,"Music"]],[8,0],[7,[0,1]]]]],[[98,276,null,666212195971600,false,[[1,[2,"gameplayMusic"]],[3,1]]],[98,276,null,175162352462030,false,[[1,[2,"mainMusic"]],[3,1]]]]]]]]]],[["block_collapse.m4a",8295],["character_disappear.m4a",20496],["character_reappear.m4a",22617],["checkpoint.m4a",21236],["destroy_block_debris.m4a",46187],["diving.m4a",21266],["doublejump_1.m4a",4146],["doublejump_2.m4a",3217],["jetpack_loop.m4a",6156],["jump_1.m4a",2493],["jump_2.m4a",2673],["jump_3.m4a",2419],["jump_4.m4a",2239],["moto_skid.m4a",22192],["pickup_diamond.m4a",11783],["pickup_star.m4a",6481],["player_step1.m4a",1276],["player_step2.m4a",1522],["playerdies_1.m4a",38099],["playerdies_2.m4a",33467],["playerdies_3.m4a",32806],["playerdies_4.m4a",33872],["playerdies_5.m4a",47224],["playerdies_6.m4a",33866],["playerdies_7.m4a",34018],["playerdies_8.m4a",38618],["rocket.m4a",22500],["trampoline.m4a",4695],["traphit_1.m4a",14738],["traphit_2.m4a",20115],["traphit_3.m4a",12496],["traphit_4.m4a",11801],["traphit_5.m4a",11292],["traphit_6.m4a",11401],["traphit_7.m4a",8001],["ui_ach.m4a",1858],["ui_pause.m4a",3454],["ui_high.m4a",2765],["ui_plop.m4a",1801],["ui_start.m4a",7598],["block_collapse.ogg",8554],["character_disappear.ogg",14572],["character_reappear.ogg",16951],["checkpoint.ogg",18638],["destroy_block_debris.ogg",39413],["diving.ogg",13762],["doublejump_1.ogg",5802],["doublejump_2.ogg",5254],["jetpack_loop.ogg",7088],["jump_1.ogg",4785],["jump_2.ogg",4695],["jump_3.ogg",4409],["jump_4.ogg",4568],["moto_skid.ogg",16613],["pickup_diamond.ogg",8380],["pickup_star.ogg",7312],["playerdies_1.ogg",28820],["playerdies_2.ogg",26054],["playerdies_3.ogg",25618],["playerdies_4.ogg",27206],["playerdies_5.ogg",36166],["playerdies_6.ogg",26053],["playerdies_7.ogg",28092],["playerdies_8.ogg",30063],["rocket.ogg",17211],["trampoline.ogg",5801],["traphit_1.ogg",11858],["traphit_2.ogg",15944],["traphit_3.ogg",10877],["traphit_4.ogg",10269],["traphit_5.ogg",10267],["traphit_6.ogg",10891],["traphit_7.ogg",8770],["ui_ach.ogg",4867],["ui_pause.ogg",5705],["ui_high.ogg",5149],["ui_plop.ogg",4678],["ui_start.ogg",8876],["player_step1.ogg",4020],["player_step2.ogg",4157]],"media/",false,800,576,4,true,true,false,"1.0.0.0",true,true,3,0,5095,false,true,1,true,"Stickman Boost",0,[[159,171,141,157,170,172]]]} \ No newline at end of file diff --git a/stickmanboost/hmmg_layoutTransition.css b/stickmanboost/hmmg_layoutTransition.css new file mode 100644 index 00000000..22401333 --- /dev/null +++ b/stickmanboost/hmmg_layoutTransition.css @@ -0,0 +1,57 @@ +#c2canvasdiv.prepared +{ + position:absolute !important; + margin:0px !important; + z-index:49; +} + +#fakeBody +{ + position:absolute; + z-index:999999999; + overflow:hidden !important; +} + + +#fakeBody #fakeCanvas +{ + position:absolute; + top:0px; + z-index:50; + overflow:hidden !important; + height:100%; + width:100%; +} + + +#fakeCanvas div +{ + position:absolute; + width:100%; + height:100%; + top:0px; + left:0px; +} +#fakeCanvas div.darker +{ + -webkit-transition: background-color 100ms linear ; + -moz-transition: background-color 100ms linear ; + -o-transition: background-color 100ms linear ; + -ms-transition: background-color 100ms linear ; + transition: background-color 100ms linear ; + background-color:rgba(0,0,0,0.3); +} + +#c2canvasdiv.animated +{ + z-index:51; +} +#fakeCanvas.animated +{ + z-index:49; +} + +.hidden +{ + display:none; +} \ No newline at end of file diff --git a/stickmanboost/html2canvas.min.js b/stickmanboost/html2canvas.min.js new file mode 100644 index 00000000..fc84b2cb --- /dev/null +++ b/stickmanboost/html2canvas.min.js @@ -0,0 +1,8 @@ +/* + html2canvas 0.5.0-beta2 + Copyright (c) 2015 Niklas von Hertzen + + Released under License +*/ +!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.html2canvas=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[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:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g1&&(d=c[0]+"@",a=c[1]),a=a.replace(H,".");var e=a.split("."),f=g(e,b).join(".");return d+f}function i(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function j(a){return g(a,function(a){var b="";return a>65535&&(a-=65536,b+=L(a>>>10&1023|55296),a=56320|1023&a),b+=L(a)}).join("")}function k(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:x}function l(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function m(a,b,c){var d=0;for(a=c?K(a/B):a>>1,a+=K(a/b);a>J*z>>1;d+=x)a=K(a/J);return K(d+(J+1)*a/(a+A))}function n(a){var b,c,d,e,g,h,i,l,n,o,p=[],q=a.length,r=0,s=D,t=C;for(c=a.lastIndexOf(E),0>c&&(c=0),d=0;c>d;++d)a.charCodeAt(d)>=128&&f("not-basic"),p.push(a.charCodeAt(d));for(e=c>0?c+1:0;q>e;){for(g=r,h=1,i=x;e>=q&&f("invalid-input"),l=k(a.charCodeAt(e++)),(l>=x||l>K((w-r)/h))&&f("overflow"),r+=l*h,n=t>=i?y:i>=t+z?z:i-t,!(n>l);i+=x)o=x-n,h>K(w/o)&&f("overflow"),h*=o;b=p.length+1,t=m(r-g,b,0==g),K(r/b)>w-s&&f("overflow"),s+=K(r/b),r%=b,p.splice(r++,0,s)}return j(p)}function o(a){var b,c,d,e,g,h,j,k,n,o,p,q,r,s,t,u=[];for(a=i(a),q=a.length,b=D,c=0,g=C,h=0;q>h;++h)p=a[h],128>p&&u.push(L(p));for(d=e=u.length,e&&u.push(E);q>d;){for(j=w,h=0;q>h;++h)p=a[h],p>=b&&j>p&&(j=p);for(r=d+1,j-b>K((w-c)/r)&&f("overflow"),c+=(j-b)*r,b=j,h=0;q>h;++h)if(p=a[h],b>p&&++c>w&&f("overflow"),p==b){for(k=c,n=x;o=g>=n?y:n>=g+z?z:n-g,!(o>k);n+=x)t=k-o,s=x-o,u.push(L(l(o+t%s,0))),k=K(t/s);u.push(L(l(k,0))),g=m(c,r,d==e),c=0,++d}++c,++b}return u.join("")}function p(a){return h(a,function(a){return F.test(a)?n(a.slice(4).toLowerCase()):a})}function q(a){return h(a,function(a){return G.test(a)?"xn--"+o(a):a})}var r="object"==typeof d&&d&&!d.nodeType&&d,s="object"==typeof c&&c&&!c.nodeType&&c,t="object"==typeof b&&b;(t.global===t||t.window===t||t.self===t)&&(e=t);var u,v,w=2147483647,x=36,y=1,z=26,A=38,B=700,C=72,D=128,E="-",F=/^xn--/,G=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=x-y,K=Math.floor,L=String.fromCharCode;if(u={version:"1.3.2",ucs2:{decode:i,encode:j},decode:n,encode:o,toASCII:q,toUnicode:p},"function"==typeof a&&"object"==typeof a.amd&&a.amd)a("punycode",function(){return u});else if(r&&s)if(c.exports==r)s.exports=u;else for(v in u)u.hasOwnProperty(v)&&(r[v]=u[v]);else e.punycode=u}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(a,b,c){function d(a,b,c){!a.defaultView||b===a.defaultView.pageXOffset&&c===a.defaultView.pageYOffset||a.defaultView.scrollTo(b,c)}function e(a,b){try{b&&(b.width=a.width,b.height=a.height,b.getContext("2d").putImageData(a.getContext("2d").getImageData(0,0,a.width,a.height),0,0))}catch(c){h("Unable to copy canvas content from",a,c)}}function f(a,b){for(var c=3===a.nodeType?document.createTextNode(a.nodeValue):a.cloneNode(!1),d=a.firstChild;d;)(b===!0||1!==d.nodeType||"SCRIPT"!==d.nodeName)&&c.appendChild(f(d,b)),d=d.nextSibling;return 1===a.nodeType&&(c._scrollTop=a.scrollTop,c._scrollLeft=a.scrollLeft,"CANVAS"===a.nodeName?e(a,c):("TEXTAREA"===a.nodeName||"SELECT"===a.nodeName)&&(c.value=a.value)),c}function g(a){if(1===a.nodeType){a.scrollTop=a._scrollTop,a.scrollLeft=a._scrollLeft;for(var b=a.firstChild;b;)g(b),b=b.nextSibling}}var h=a("./log");b.exports=function(a,b,c,e,h,i,j){var k=f(a.documentElement,h.javascriptEnabled),l=b.createElement("iframe");return l.className="html2canvas-container",l.style.visibility="hidden",l.style.position="fixed",l.style.left="-10000px",l.style.top="0px",l.style.border="0",l.width=c,l.height=e,l.scrolling="no",b.body.appendChild(l),new Promise(function(b){var c=l.contentWindow.document;l.contentWindow.onload=l.onload=function(){var a=setInterval(function(){c.body.childNodes.length>0&&(g(c.documentElement),clearInterval(a),"view"===h.type&&(l.contentWindow.scrollTo(i,j),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||l.contentWindow.scrollY===j&&l.contentWindow.scrollX===i||(c.documentElement.style.top=-j+"px",c.documentElement.style.left=-i+"px",c.documentElement.style.position="absolute")),b(l))},50)},c.open(),c.write(""),d(a,i,j),c.replaceChild(c.adoptNode(k),c.documentElement),c.close()})}},{"./log":13}],3:[function(a,b,c){function d(a){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(a)||this.namedColor(a)||this.rgb(a)||this.rgba(a)||this.hex6(a)||this.hex3(a)}d.prototype.darken=function(a){var b=1-a;return new d([Math.round(this.r*b),Math.round(this.g*b),Math.round(this.b*b),this.a])},d.prototype.isTransparent=function(){return 0===this.a},d.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},d.prototype.fromArray=function(a){return Array.isArray(a)&&(this.r=Math.min(a[0],255),this.g=Math.min(a[1],255),this.b=Math.min(a[2],255),a.length>3&&(this.a=a[3])),Array.isArray(a)};var e=/^#([a-f0-9]{3})$/i;d.prototype.hex3=function(a){var b=null;return null!==(b=a.match(e))&&(this.r=parseInt(b[1][0]+b[1][0],16),this.g=parseInt(b[1][1]+b[1][1],16),this.b=parseInt(b[1][2]+b[1][2],16)),null!==b};var f=/^#([a-f0-9]{6})$/i;d.prototype.hex6=function(a){var b=null;return null!==(b=a.match(f))&&(this.r=parseInt(b[1].substring(0,2),16),this.g=parseInt(b[1].substring(2,4),16),this.b=parseInt(b[1].substring(4,6),16)),null!==b};var g=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;d.prototype.rgb=function(a){var b=null;return null!==(b=a.match(g))&&(this.r=Number(b[1]),this.g=Number(b[2]),this.b=Number(b[3])),null!==b};var h=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;d.prototype.rgba=function(a){var b=null;return null!==(b=a.match(h))&&(this.r=Number(b[1]),this.g=Number(b[2]),this.b=Number(b[3]),this.a=Number(b[4])),null!==b},d.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},d.prototype.namedColor=function(a){a=a.toLowerCase();var b=i[a];if(b)this.r=b[0],this.g=b[1],this.b=b[2];else if("transparent"===a)return this.r=this.g=this.b=this.a=0,!0;return!!b},d.prototype.isColor=!0;var i={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};b.exports=d},{}],4:[function(b,c,d){function e(a,b){var c=x++;if(b=b||{},b.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),b.async="undefined"==typeof b.async?!0:b.async,b.allowTaint="undefined"==typeof b.allowTaint?!1:b.allowTaint,b.removeContainer="undefined"==typeof b.removeContainer?!0:b.removeContainer,b.javascriptEnabled="undefined"==typeof b.javascriptEnabled?!1:b.javascriptEnabled,b.imageTimeout="undefined"==typeof b.imageTimeout?1e4:b.imageTimeout,b.renderer="function"==typeof b.renderer?b.renderer:n,b.strict=!!b.strict,"string"==typeof a){if("string"!=typeof b.proxy)return Promise.reject("Proxy must be used when rendering url");var d=null!=b.width?b.width:window.innerWidth,e=null!=b.height?b.height:window.innerHeight;return u(l(a),b.proxy,document,d,e,b).then(function(a){return g(a.contentWindow.document.documentElement,a,b,d,e)})}var h=(void 0===a?[document.documentElement]:a.length?a:[a])[0];return h.setAttribute(w+c,c),f(h.ownerDocument,b,h.ownerDocument.defaultView.innerWidth,h.ownerDocument.defaultView.innerHeight,c).then(function(a){return"function"==typeof b.onrendered&&(r("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),b.onrendered(a)),a})}function f(a,b,c,d,e){return t(a,a,c,d,b,a.defaultView.pageXOffset,a.defaultView.pageYOffset).then(function(f){r("Document cloned");var h=w+e,i="["+h+"='"+e+"']";a.querySelector(i).removeAttribute(h);var j=f.contentWindow,k=j.document.querySelector(i),l="function"==typeof b.onclone?Promise.resolve(b.onclone(j.document)):Promise.resolve(!0);return l.then(function(){return g(k,f,b,c,d)})})}function g(a,b,c,d,e){var f=b.contentWindow,g=new m(f.document),l=new o(c,g),n=v(a),q="view"===c.type?d:j(f.document),s="view"===c.type?e:k(f.document),t=new c.renderer(q,s,l,c,document),u=new p(a,t,g,l,c);return u.ready.then(function(){r("Finished rendering");var d;return d="view"===c.type?i(t.canvas,{width:t.canvas.width,height:t.canvas.height,top:0,left:0,x:0,y:0}):a===f.document.body||a===f.document.documentElement||null!=c.canvas?t.canvas:i(t.canvas,{width:null!=c.width?c.width:n.width,height:null!=c.height?c.height:n.height,top:n.top,left:n.left,x:f.pageXOffset,y:f.pageYOffset}),h(b,c),d})}function h(a,b){b.removeContainer&&(a.parentNode.removeChild(a),r("Cleaned up container"))}function i(a,b){var c=document.createElement("canvas"),d=Math.min(a.width-1,Math.max(0,b.left)),e=Math.min(a.width,Math.max(1,b.left+b.width)),f=Math.min(a.height-1,Math.max(0,b.top)),g=Math.min(a.height,Math.max(1,b.top+b.height));return c.width=b.width,c.height=b.height,r("Cropping canvas at:","left:",b.left,"top:",b.top,"width:",e-d,"height:",g-f),r("Resulting crop with width",b.width,"and height",b.height," with x",d,"and y",f),c.getContext("2d").drawImage(a,d,f,e-d,g-f,b.x,b.y,e-d,g-f),c}function j(a){return Math.max(Math.max(a.body.scrollWidth,a.documentElement.scrollWidth),Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),Math.max(a.body.clientWidth,a.documentElement.clientWidth))}function k(a){return Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight))}function l(a){var b=document.createElement("a");return b.href=a,b.href=b.href,b}var m=b("./support"),n=b("./renderers/canvas"),o=b("./imageloader"),p=b("./nodeparser"),q=b("./nodecontainer"),r=b("./log"),s=b("./utils"),t=b("./clone"),u=b("./proxy").loadUrlDocument,v=s.getBounds,w="data-html2canvas-node",x=0;e.CanvasRenderer=n,e.NodeContainer=q,e.log=r,e.utils=s;var y="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return Promise.reject("No canvas support")}:e;c.exports=y,"function"==typeof a&&a.amd&&a("html2canvas",[],function(){return y})},{"./clone":2,"./imageloader":11,"./log":13,"./nodecontainer":14,"./nodeparser":15,"./proxy":16,"./renderers/canvas":20,"./support":22,"./utils":26}],5:[function(a,b,c){function d(a){if(this.src=a,e("DummyImageContainer for",a),!this.promise||!this.image){e("Initiating DummyImageContainer"),d.prototype.image=new Image;var b=this.image;d.prototype.promise=new Promise(function(a,c){b.onload=a,b.onerror=c,b.src=f(),b.complete===!0&&a(b)})}}var e=a("./log"),f=a("./utils").smallImage;b.exports=d},{"./log":13,"./utils":26}],6:[function(a,b,c){function d(a,b){var c,d,f=document.createElement("div"),g=document.createElement("img"),h=document.createElement("span"),i="Hidden Text";f.style.visibility="hidden",f.style.fontFamily=a,f.style.fontSize=b,f.style.margin=0,f.style.padding=0,document.body.appendChild(f),g.src=e(),g.width=1,g.height=1,g.style.margin=0,g.style.padding=0,g.style.verticalAlign="baseline",h.style.fontFamily=a,h.style.fontSize=b,h.style.margin=0,h.style.padding=0,h.appendChild(document.createTextNode(i)),f.appendChild(h),f.appendChild(g),c=g.offsetTop-h.offsetTop+1,f.removeChild(h),f.appendChild(document.createTextNode(i)),f.style.lineHeight="normal",g.style.verticalAlign="super",d=g.offsetTop-f.offsetTop+1,document.body.removeChild(f),this.baseline=c,this.lineWidth=1,this.middle=d}var e=a("./utils").smallImage;b.exports=d},{"./utils":26}],7:[function(a,b,c){function d(){this.data={}}var e=a("./font");d.prototype.getMetrics=function(a,b){return void 0===this.data[a+"-"+b]&&(this.data[a+"-"+b]=new e(a,b)),this.data[a+"-"+b]},b.exports=d},{"./font":6}],8:[function(a,b,c){function d(b,c,d){this.image=null,this.src=b;var e=this,g=f(b);this.promise=(c?new Promise(function(a){"about:blank"===b.contentWindow.document.URL||null==b.contentWindow.document.documentElement?b.contentWindow.onload=b.onload=function(){a(b)}:a(b)}):this.proxyLoad(d.proxy,g,d)).then(function(b){var c=a("./core");return c(b.contentWindow.document.documentElement,{type:"view",width:b.width,height:b.height,proxy:d.proxy,javascriptEnabled:d.javascriptEnabled,removeContainer:d.removeContainer,allowTaint:d.allowTaint,imageTimeout:d.imageTimeout/2})}).then(function(a){return e.image=a})}var e=a("./utils"),f=e.getBounds,g=a("./proxy").loadUrlDocument;d.prototype.proxyLoad=function(a,b,c){var d=this.src;return g(d.src,a,d.ownerDocument,b.width,b.height,c)},b.exports=d},{"./core":4,"./proxy":16,"./utils":26}],9:[function(a,b,c){function d(a){this.src=a.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}d.TYPES={LINEAR:1,RADIAL:2},d.REGEXP_COLORSTOP=/^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i,b.exports=d},{}],10:[function(a,b,c){function d(a,b){this.src=a,this.image=new Image;var c=this;this.tainted=null,this.promise=new Promise(function(d,e){c.image.onload=d,c.image.onerror=e,b&&(c.image.crossOrigin="anonymous"),c.image.src=a,c.image.complete===!0&&d(c.image)})}b.exports=d},{}],11:[function(a,b,c){function d(a,b){this.link=null,this.options=a,this.support=b,this.origin=this.getOrigin(window.location.href)}var e=a("./log"),f=a("./imagecontainer"),g=a("./dummyimagecontainer"),h=a("./proxyimagecontainer"),i=a("./framecontainer"),j=a("./svgcontainer"),k=a("./svgnodecontainer"),l=a("./lineargradientcontainer"),m=a("./webkitgradientcontainer"),n=a("./utils").bind;d.prototype.findImages=function(a){var b=[];return a.reduce(function(a,b){switch(b.node.nodeName){case"IMG":return a.concat([{args:[b.node.src],method:"url"}]);case"svg":case"IFRAME":return a.concat([{args:[b.node],method:b.node.nodeName}])}return a},[]).forEach(this.addImage(b,this.loadImage),this),b},d.prototype.findBackgroundImage=function(a,b){return b.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(a,this.loadImage),this),a},d.prototype.addImage=function(a,b){return function(c){c.args.forEach(function(d){this.imageExists(a,d)||(a.splice(0,0,b.call(this,c)),e("Added image #"+a.length,"string"==typeof d?d.substring(0,100):d))},this)}},d.prototype.hasImageBackground=function(a){return"none"!==a.method},d.prototype.loadImage=function(a){if("url"===a.method){var b=a.args[0];return!this.isSVG(b)||this.support.svg||this.options.allowTaint?b.match(/data:image\/.*;base64,/i)?new f(b.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(b)||this.options.allowTaint===!0||this.isSVG(b)?new f(b,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new f(b,!0):this.options.proxy?new h(b,this.options.proxy):new g(b):new j(b)}return"linear-gradient"===a.method?new l(a):"gradient"===a.method?new m(a):"svg"===a.method?new k(a.args[0],this.support.svg):"IFRAME"===a.method?new i(a.args[0],this.isSameOrigin(a.args[0].src),this.options):new g(a)},d.prototype.isSVG=function(a){return"svg"===a.substring(a.length-3).toLowerCase()||j.prototype.isInline(a)},d.prototype.imageExists=function(a,b){return a.some(function(a){return a.src===b})},d.prototype.isSameOrigin=function(a){return this.getOrigin(a)===this.origin},d.prototype.getOrigin=function(a){var b=this.link||(this.link=document.createElement("a"));return b.href=a,b.href=b.href,b.protocol+b.hostname+b.port},d.prototype.getPromise=function(a){return this.timeout(a,this.options.imageTimeout)["catch"](function(){var b=new g(a.src);return b.promise.then(function(b){a.image=b})})},d.prototype.get=function(a){var b=null;return this.images.some(function(c){return(b=c).src===a})?b:null},d.prototype.fetch=function(a){return this.images=a.reduce(n(this.findBackgroundImage,this),this.findImages(a)),this.images.forEach(function(a,b){a.promise.then(function(){e("Succesfully loaded image #"+(b+1),a)},function(c){e("Failed loading image #"+(b+1),a,c)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),e("Finished searching images"),this},d.prototype.timeout=function(a,b){var c,d=Promise.race([a.promise,new Promise(function(d,f){c=setTimeout(function(){e("Timed out loading image",a),f(a)},b)})]).then(function(a){return clearTimeout(c),a});return d["catch"](function(){clearTimeout(c)}),d},b.exports=d},{"./dummyimagecontainer":5,"./framecontainer":8,"./imagecontainer":10,"./lineargradientcontainer":12,"./log":13,"./proxyimagecontainer":17,"./svgcontainer":23,"./svgnodecontainer":24,"./utils":26,"./webkitgradientcontainer":27}],12:[function(a,b,c){function d(a){e.apply(this,arguments),this.type=e.TYPES.LINEAR;var b=d.REGEXP_DIRECTION.test(a.args[0])||!e.REGEXP_COLORSTOP.test(a.args[0]);b?a.args[0].split(/\s+/).reverse().forEach(function(a,b){switch(a){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var c=this.y0,d=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=d,this.y1=c;break;case"center":break;default:var e=.01*parseFloat(a,10);if(isNaN(e))break;0===b?(this.y0=e,this.y1=1-this.y0):(this.x0=e,this.x1=1-this.x0)}},this):(this.y0=0,this.y1=1),this.colorStops=a.args.slice(b?1:0).map(function(a){var b=a.match(e.REGEXP_COLORSTOP),c=+b[2],d=0===c?"%":b[3];return{color:new f(b[1]),stop:"%"===d?c/100:null}}),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(a,b){null===a.stop&&this.colorStops.slice(b).some(function(c,d){return null!==c.stop?(a.stop=(c.stop-this.colorStops[b-1].stop)/(d+1)+this.colorStops[b-1].stop,!0):!1},this)},this)}var e=a("./gradientcontainer"),f=a("./color");d.prototype=Object.create(e.prototype),d.REGEXP_DIRECTION=/^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i,b.exports=d},{"./color":3,"./gradientcontainer":9}],13:[function(a,b,c){b.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],14:[function(a,b,c){function d(a,b){this.node=a,this.parent=b,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function e(a){var b=a.options[a.selectedIndex||0];return b?b.text||"":""}function f(a){if(a&&"matrix"===a[1])return a[2].split(",").map(function(a){return parseFloat(a.trim())});if(a&&"matrix3d"===a[1]){var b=a[2].split(",").map(function(a){return parseFloat(a.trim())});return[b[0],b[1],b[4],b[5],b[12],b[13]]}}function g(a){return-1!==a.toString().indexOf("%")}function h(a){return a.replace("px","")}function i(a){return parseFloat(a)}var j=a("./color"),k=a("./utils"),l=k.getBounds,m=k.parseBackgrounds,n=k.offsetBounds;d.prototype.cloneTo=function(a){a.visible=this.visible,a.borders=this.borders,a.bounds=this.bounds,a.clip=this.clip,a.backgroundClip=this.backgroundClip,a.computedStyles=this.computedStyles,a.styles=this.styles,a.backgroundImages=this.backgroundImages,a.opacity=this.opacity},d.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},d.prototype.assignStack=function(a){this.stack=a,a.children.push(this)},d.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},d.prototype.css=function(a){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[a]||(this.styles[a]=this.computedStyles[a])},d.prototype.prefixedCss=function(a){var b=["webkit","moz","ms","o"],c=this.css(a);return void 0===c&&b.some(function(b){return c=this.css(b+a.substr(0,1).toUpperCase()+a.substr(1)),void 0!==c},this),void 0===c?null:c},d.prototype.computedStyle=function(a){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,a)},d.prototype.cssInt=function(a){var b=parseInt(this.css(a),10);return isNaN(b)?0:b},d.prototype.color=function(a){return this.colors[a]||(this.colors[a]=new j(this.css(a)))},d.prototype.cssFloat=function(a){var b=parseFloat(this.css(a));return isNaN(b)?0:b},d.prototype.fontWeight=function(){var a=this.css("fontWeight");switch(parseInt(a,10)){case 401:a="bold";break;case 400:a="normal"}return a},d.prototype.parseClip=function(){var a=this.css("clip").match(this.CLIP);return a?{top:parseInt(a[1],10),right:parseInt(a[2],10),bottom:parseInt(a[3],10),left:parseInt(a[4],10)}:null},d.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=m(this.css("backgroundImage")))},d.prototype.cssList=function(a,b){var c=(this.css(a)||"").split(",");return c=c[b||0]||c[0]||"auto",c=c.trim().split(" "),1===c.length&&(c=[c[0],g(c[0])?"auto":c[0]]),c},d.prototype.parseBackgroundSize=function(a,b,c){var d,e,f=this.cssList("backgroundSize",c);if(g(f[0]))d=a.width*parseFloat(f[0])/100;else{if(/contain|cover/.test(f[0])){var h=a.width/a.height,i=b.width/b.height;return i>h^"contain"===f[0]?{width:a.height*i,height:a.height}:{width:a.width,height:a.width/i}}d=parseInt(f[0],10)}return e="auto"===f[0]&&"auto"===f[1]?b.height:"auto"===f[1]?d/b.width*b.height:g(f[1])?a.height*parseFloat(f[1])/100:parseInt(f[1],10),"auto"===f[0]&&(d=e/b.height*b.width),{width:d,height:e}},d.prototype.parseBackgroundPosition=function(a,b,c,d){var e,f,h=this.cssList("backgroundPosition",c);return e=g(h[0])?(a.width-(d||b).width)*(parseFloat(h[0])/100):parseInt(h[0],10),f="auto"===h[1]?e/b.width*b.height:g(h[1])?(a.height-(d||b).height)*parseFloat(h[1])/100:parseInt(h[1],10),"auto"===h[0]&&(e=f/b.height*b.width),{left:e,top:f}},d.prototype.parseBackgroundRepeat=function(a){return this.cssList("backgroundRepeat",a)[0]},d.prototype.parseTextShadows=function(){var a=this.css("textShadow"),b=[];if(a&&"none"!==a)for(var c=a.match(this.TEXT_SHADOW_PROPERTY),d=0;c&&d0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,a)):a():(this.renderQueue.forEach(this.paint,this),a())},this))},this))}function e(a){return a.parent&&a.parent.clip.length}function f(a){return a.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function g(){}function h(a,b,c,d){return a.map(function(e,f){if(e.width>0){var g=b.left,h=b.top,i=b.width,j=b.height-a[2].width;switch(f){case 0:j=a[0].width,e.args=l({c1:[g,h],c2:[g+i,h],c3:[g+i-a[1].width,h+j],c4:[g+a[3].width,h+j]},d[0],d[1],c.topLeftOuter,c.topLeftInner,c.topRightOuter,c.topRightInner);break;case 1:g=b.left+b.width-a[1].width,i=a[1].width,e.args=l({c1:[g+i,h],c2:[g+i,h+j+a[2].width],c3:[g,h+j],c4:[g,h+a[0].width]},d[1],d[2],c.topRightOuter,c.topRightInner,c.bottomRightOuter,c.bottomRightInner);break;case 2:h=h+b.height-a[2].width,j=a[2].width,e.args=l({c1:[g+i,h+j],c2:[g,h+j],c3:[g+a[3].width,h],c4:[g+i-a[3].width,h]},d[2],d[3],c.bottomRightOuter,c.bottomRightInner,c.bottomLeftOuter,c.bottomLeftInner);break;case 3:i=a[3].width,e.args=l({c1:[g,h+j+a[2].width],c2:[g,h],c3:[g+i,h+a[0].width],c4:[g+i,h+j]},d[3],d[0],c.bottomLeftOuter,c.bottomLeftInner,c.topLeftOuter,c.topLeftInner)}}return e})}function i(a,b,c,d){var e=4*((Math.sqrt(2)-1)/3),f=c*e,g=d*e,h=a+c,i=b+d;return{topLeft:k({x:a,y:i},{x:a,y:i-g},{x:h-f,y:b},{x:h,y:b}),topRight:k({x:a,y:b},{x:a+f,y:b},{x:h,y:i-g},{x:h,y:i}),bottomRight:k({x:h,y:b},{x:h,y:b+g},{x:a+f,y:i},{x:a,y:i}),bottomLeft:k({x:h,y:i},{x:h-f,y:i},{x:a,y:b+g},{x:a,y:b})}}function j(a,b,c){var d=a.left,e=a.top,f=a.width,g=a.height,h=b[0][0]f+c[3].width?0:k-c[3].width,l-c[0].width).topRight.subdivide(.5),bottomRightOuter:i(d+s,e+r,m,n).bottomRight.subdivide(.5),bottomRightInner:i(d+Math.min(s,f-c[3].width),e+Math.min(r,g+c[0].width),Math.max(0,m-c[1].width),n-c[2].width).bottomRight.subdivide(.5), +bottomLeftOuter:i(d,e+t,o,p).bottomLeft.subdivide(.5),bottomLeftInner:i(d+c[3].width,e+t,Math.max(0,o-c[3].width),p-c[2].width).bottomLeft.subdivide(.5)}}function k(a,b,c,d){var e=function(a,b,c){return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c}};return{start:a,startControl:b,endControl:c,end:d,subdivide:function(f){var g=e(a,b,f),h=e(b,c,f),i=e(c,d,f),j=e(g,h,f),l=e(h,i,f),m=e(j,l,f);return[k(a,g,j,m),k(m,l,i,d)]},curveTo:function(a){a.push(["bezierCurve",b.x,b.y,c.x,c.y,d.x,d.y])},curveToReversed:function(d){d.push(["bezierCurve",c.x,c.y,b.x,b.y,a.x,a.y])}}}function l(a,b,c,d,e,f,g){var h=[];return b[0]>0||b[1]>0?(h.push(["line",d[1].start.x,d[1].start.y]),d[1].curveTo(h)):h.push(["line",a.c1[0],a.c1[1]]),c[0]>0||c[1]>0?(h.push(["line",f[0].start.x,f[0].start.y]),f[0].curveTo(h),h.push(["line",g[0].end.x,g[0].end.y]),g[0].curveToReversed(h)):(h.push(["line",a.c2[0],a.c2[1]]),h.push(["line",a.c3[0],a.c3[1]])),b[0]>0||b[1]>0?(h.push(["line",e[1].end.x,e[1].end.y]),e[1].curveToReversed(h)):h.push(["line",a.c4[0],a.c4[1]]),h}function m(a,b,c,d,e,f,g){b[0]>0||b[1]>0?(a.push(["line",d[0].start.x,d[0].start.y]),d[0].curveTo(a),d[1].curveTo(a)):a.push(["line",f,g]),(c[0]>0||c[1]>0)&&a.push(["line",e[0].start.x,e[0].start.y])}function n(a){return a.cssInt("zIndex")<0}function o(a){return a.cssInt("zIndex")>0}function p(a){return 0===a.cssInt("zIndex")}function q(a){return-1!==["inline","inline-block","inline-table"].indexOf(a.css("display"))}function r(a){return a instanceof V}function s(a){return a.node.data.trim().length>0}function t(a){return/^(normal|none|0px)$/.test(a.parent.css("letterSpacing"))}function u(a){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(b){var c=a.css("border"+b+"Radius"),d=c.split(" ");return d.length<=1&&(d[1]=d[0]),d.map(G)})}function v(a){return a.nodeType===Node.TEXT_NODE||a.nodeType===Node.ELEMENT_NODE}function w(a){var b=a.css("position"),c=-1!==["absolute","relative","fixed"].indexOf(b)?a.css("zIndex"):"auto";return"auto"!==c}function x(a){return"static"!==a.css("position")}function y(a){return"none"!==a.css("float")}function z(a){return-1!==["inline-block","inline-table"].indexOf(a.css("display"))}function A(a){var b=this;return function(){return!a.apply(b,arguments)}}function B(a){return a.node.nodeType===Node.ELEMENT_NODE}function C(a){return a.isPseudoElement===!0}function D(a){return a.node.nodeType===Node.TEXT_NODE}function E(a){return function(b,c){return b.cssInt("zIndex")+a.indexOf(b)/a.length-(c.cssInt("zIndex")+a.indexOf(c)/a.length)}}function F(a){return a.getOpacity()<1}function G(a){return parseInt(a,10)}function H(a){return a.width}function I(a){return a.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(a.node.nodeName)}function J(a){return[].concat.apply([],a)}function K(a){var b=a.substr(0,1);return b===a.substr(a.length-1)&&b.match(/'|"/)?a.substr(1,a.length-2):a}function L(a){for(var b,c=[],d=0,e=!1;a.length;)M(a[d])===e?(b=a.splice(0,d),b.length&&c.push(P.ucs2.encode(b)),e=!e,d=0):d++,d>=a.length&&(b=a.splice(0,d),b.length&&c.push(P.ucs2.encode(b)));return c}function M(a){return-1!==[32,13,10,9,45].indexOf(a)}function N(a){return/[^\u0000-\u00ff]/.test(a)}var O=a("./log"),P=a("punycode"),Q=a("./nodecontainer"),R=a("./textcontainer"),S=a("./pseudoelementcontainer"),T=a("./fontmetrics"),U=a("./color"),V=a("./stackingcontext"),W=a("./utils"),X=W.bind,Y=W.getBounds,Z=W.parseBackgrounds,$=W.offsetBounds;d.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(a){if(B(a)){C(a)&&a.appendToDOM(),a.borders=this.parseBorders(a);var b="hidden"===a.css("overflow")?[a.borders.clip]:[],c=a.parseClip();c&&-1!==["absolute","fixed"].indexOf(a.css("position"))&&b.push([["rect",a.bounds.left+c.left,a.bounds.top+c.top,c.right-c.left,c.bottom-c.top]]),a.clip=e(a)?a.parent.clip.concat(b):b,a.backgroundClip="hidden"!==a.css("overflow")?a.clip.concat([a.borders.clip]):a.clip,C(a)&&a.cleanDOM()}else D(a)&&(a.clip=e(a)?a.parent.clip:[]);C(a)||(a.bounds=null)},this)},d.prototype.asyncRenderer=function(a,b,c){c=c||Date.now(),this.paint(a[this.renderIndex++]),a.length===this.renderIndex?b():c+20>Date.now()?this.asyncRenderer(a,b,c):setTimeout(X(function(){this.asyncRenderer(a,b)},this),0)},d.prototype.createPseudoHideStyles=function(a){this.createStyles(a,"."+S.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+S.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},d.prototype.disableAnimations=function(a){this.createStyles(a,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},d.prototype.createStyles=function(a,b){var c=a.createElement("style");c.innerHTML=b,a.body.appendChild(c)},d.prototype.getPseudoElements=function(a){var b=[[a]];if(a.node.nodeType===Node.ELEMENT_NODE){var c=this.getPseudoElement(a,":before"),d=this.getPseudoElement(a,":after");c&&b.push(c),d&&b.push(d)}return J(b)},d.prototype.getPseudoElement=function(a,b){var c=a.computedStyle(b);if(!c||!c.content||"none"===c.content||"-moz-alt-content"===c.content||"none"===c.display)return null;for(var d=K(c.content),e="url"===d.substr(0,3),g=document.createElement(e?"img":"html2canvaspseudoelement"),h=new S(g,a,b),i=c.length-1;i>=0;i--){var j=f(c.item(i));g.style[j]=c[j]}if(g.className=S.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+S.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,e)return g.src=Z(d)[0].args[0],[h];var k=document.createTextNode(d);return g.appendChild(k),[h,new R(k,h)]},d.prototype.getChildren=function(a){return J([].filter.call(a.node.childNodes,v).map(function(b){var c=[b.nodeType===Node.TEXT_NODE?new R(b,a):new Q(b,a)].filter(I);return b.nodeType===Node.ELEMENT_NODE&&c.length&&"TEXTAREA"!==b.tagName?c[0].isElementVisible()?c.concat(this.getChildren(c[0])):[]:c},this))},d.prototype.newStackingContext=function(a,b){var c=new V(b,a.getOpacity(),a.node,a.parent);a.cloneTo(c);var d=b?c.getParentStack(this):c.parent.stack;d.contexts.push(c),a.stack=c},d.prototype.createStackingContexts=function(){this.nodes.forEach(function(a){B(a)&&(this.isRootElement(a)||F(a)||w(a)||this.isBodyWithTransparentRoot(a)||a.hasTransform())?this.newStackingContext(a,!0):B(a)&&(x(a)&&p(a)||z(a)||y(a))?this.newStackingContext(a,!1):a.assignStack(a.parent.stack)},this)},d.prototype.isBodyWithTransparentRoot=function(a){return"BODY"===a.node.nodeName&&a.parent.color("backgroundColor").isTransparent()},d.prototype.isRootElement=function(a){return null===a.parent},d.prototype.sortStackingContexts=function(a){a.contexts.sort(E(a.contexts.slice(0))),a.contexts.forEach(this.sortStackingContexts,this)},d.prototype.parseTextBounds=function(a){return function(b,c,d){if("none"!==a.parent.css("textDecoration").substr(0,4)||0!==b.trim().length){if(this.support.rangeBounds&&!a.parent.hasTransform()){var e=d.slice(0,c).join("").length;return this.getRangeBounds(a.node,e,b.length)}if(a.node&&"string"==typeof a.node.data){var f=a.node.splitText(b.length),g=this.getWrapperBounds(a.node,a.parent.hasTransform());return a.node=f,g}}else(!this.support.rangeBounds||a.parent.hasTransform())&&(a.node=a.node.splitText(b.length));return{}}},d.prototype.getWrapperBounds=function(a,b){var c=a.ownerDocument.createElement("html2canvaswrapper"),d=a.parentNode,e=a.cloneNode(!0);c.appendChild(a.cloneNode(!0)),d.replaceChild(c,a);var f=b?$(c):Y(c);return d.replaceChild(e,c),f},d.prototype.getRangeBounds=function(a,b,c){var d=this.range||(this.range=a.ownerDocument.createRange());return d.setStart(a,b),d.setEnd(a,b+c),d.getBoundingClientRect()},d.prototype.parse=function(a){var b=a.contexts.filter(n),c=a.children.filter(B),d=c.filter(A(y)),e=d.filter(A(x)).filter(A(q)),f=c.filter(A(x)).filter(y),h=d.filter(A(x)).filter(q),i=a.contexts.concat(d.filter(x)).filter(p),j=a.children.filter(D).filter(s),k=a.contexts.filter(o);b.concat(e).concat(f).concat(h).concat(i).concat(j).concat(k).forEach(function(a){this.renderQueue.push(a),r(a)&&(this.parse(a),this.renderQueue.push(new g))},this)},d.prototype.paint=function(a){try{a instanceof g?this.renderer.ctx.restore():D(a)?(C(a.parent)&&a.parent.appendToDOM(),this.paintText(a),C(a.parent)&&a.parent.cleanDOM()):this.paintNode(a)}catch(b){if(O(b),this.options.strict)throw b}},d.prototype.paintNode=function(a){r(a)&&(this.renderer.setOpacity(a.opacity),this.renderer.ctx.save(),a.hasTransform()&&this.renderer.setTransform(a.parseTransform())),"INPUT"===a.node.nodeName&&"checkbox"===a.node.type?this.paintCheckbox(a):"INPUT"===a.node.nodeName&&"radio"===a.node.type?this.paintRadio(a):this.paintElement(a)},d.prototype.paintElement=function(a){var b=a.parseBounds();this.renderer.clip(a.backgroundClip,function(){this.renderer.renderBackground(a,b,a.borders.borders.map(H))},this),this.renderer.clip(a.clip,function(){this.renderer.renderBorders(a.borders.borders)},this),this.renderer.clip(a.backgroundClip,function(){switch(a.node.nodeName){case"svg":case"IFRAME":var c=this.images.get(a.node);c?this.renderer.renderImage(a,b,a.borders,c):O("Error loading <"+a.node.nodeName+">",a.node);break;case"IMG":var d=this.images.get(a.node.src);d?this.renderer.renderImage(a,b,a.borders,d):O("Error loading ",a.node.src);break;case"CANVAS":this.renderer.renderImage(a,b,a.borders,{image:a.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(a)}},this)},d.prototype.paintCheckbox=function(a){var b=a.parseBounds(),c=Math.min(b.width,b.height),d={width:c-1,height:c-1,top:b.top,left:b.left},e=[3,3],f=[e,e,e,e],g=[1,1,1,1].map(function(a){return{color:new U("#A5A5A5"),width:a}}),i=j(d,f,g);this.renderer.clip(a.backgroundClip,function(){this.renderer.rectangle(d.left+1,d.top+1,d.width-2,d.height-2,new U("#DEDEDE")),this.renderer.renderBorders(h(g,d,i,f)),a.node.checked&&(this.renderer.font(new U("#424242"),"normal","normal","bold",c-3+"px","arial"),this.renderer.text("✔",d.left+c/6,d.top+c-1))},this)},d.prototype.paintRadio=function(a){var b=a.parseBounds(),c=Math.min(b.width,b.height)-2;this.renderer.clip(a.backgroundClip,function(){this.renderer.circleStroke(b.left+1,b.top+1,c,new U("#DEDEDE"),1,new U("#A5A5A5")),a.node.checked&&this.renderer.circle(Math.ceil(b.left+c/4)+1,Math.ceil(b.top+c/4)+1,Math.floor(c/2),new U("#424242"))},this)},d.prototype.paintFormValue=function(a){var b=a.getValue();if(b.length>0){var c=a.node.ownerDocument,d=c.createElement("html2canvaswrapper"),e=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"];e.forEach(function(b){try{d.style[b]=a.css(b)}catch(c){O("html2canvas: Parse: Exception caught in renderFormValue: "+c.message)}});var f=a.parseBounds();d.style.position="fixed",d.style.left=f.left+"px",d.style.top=f.top+"px",d.textContent=b,c.body.appendChild(d),this.paintText(new R(d.firstChild,a)),c.body.removeChild(d)}},d.prototype.paintText=function(a){a.applyTextTransform();var b=P.ucs2.decode(a.node.data),c=this.options.letterRendering&&!t(a)||N(a.node.data)?b.map(function(a){return P.ucs2.encode([a])}):L(b),d=a.parent.fontWeight(),e=a.parent.css("fontSize"),f=a.parent.css("fontFamily"),g=a.parent.parseTextShadows();this.renderer.font(a.parent.color("color"),a.parent.css("fontStyle"),a.parent.css("fontVariant"),d,e,f),g.length?this.renderer.fontShadow(g[0].color,g[0].offsetX,g[0].offsetY,g[0].blur):this.renderer.clearShadow(),this.renderer.clip(a.parent.clip,function(){c.map(this.parseTextBounds(a),this).forEach(function(b,d){b&&(this.renderer.text(c[d],b.left,b.bottom),this.renderTextDecoration(a.parent,b,this.fontMetrics.getMetrics(f,e)))},this)},this)},d.prototype.renderTextDecoration=function(a,b,c){switch(a.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(b.left,Math.round(b.top+c.baseline+c.lineWidth),b.width,1,a.color("color"));break;case"overline":this.renderer.rectangle(b.left,Math.round(b.top),b.width,1,a.color("color"));break;case"line-through":this.renderer.rectangle(b.left,Math.ceil(b.top+c.middle+c.lineWidth),b.width,1,a.color("color"))}};var _={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};d.prototype.parseBorders=function(a){var b=a.parseBounds(),c=u(a),d=["Top","Right","Bottom","Left"].map(function(b,c){var d=a.css("border"+b+"Style"),e=a.color("border"+b+"Color");"inset"===d&&e.isBlack()&&(e=new U([255,255,255,e.a]));var f=_[d]?_[d][c]:null;return{width:a.cssInt("border"+b+"Width"),color:f?e[f[0]](f[1]):e,args:null}}),e=j(b,c,d);return{clip:this.parseBackgroundClip(a,e,d,c,b),borders:h(d,b,e,c)}},d.prototype.parseBackgroundClip=function(a,b,c,d,e){var f=a.css("backgroundClip"),g=[];switch(f){case"content-box":case"padding-box":m(g,d[0],d[1],b.topLeftInner,b.topRightInner,e.left+c[3].width,e.top+c[0].width),m(g,d[1],d[2],b.topRightInner,b.bottomRightInner,e.left+e.width-c[1].width,e.top+c[0].width),m(g,d[2],d[3],b.bottomRightInner,b.bottomLeftInner,e.left+e.width-c[1].width,e.top+e.height-c[2].width),m(g,d[3],d[0],b.bottomLeftInner,b.topLeftInner,e.left+c[3].width,e.top+e.height-c[2].width);break;default:m(g,d[0],d[1],b.topLeftOuter,b.topRightOuter,e.left,e.top),m(g,d[1],d[2],b.topRightOuter,b.bottomRightOuter,e.left+e.width,e.top),m(g,d[2],d[3],b.bottomRightOuter,b.bottomLeftOuter,e.left+e.width,e.top+e.height),m(g,d[3],d[0],b.bottomLeftOuter,b.topLeftOuter,e.left,e.top+e.height)}return g},b.exports=d},{"./color":3,"./fontmetrics":7,"./log":13,"./nodecontainer":14,"./pseudoelementcontainer":18,"./stackingcontext":21,"./textcontainer":25,"./utils":26,punycode:1}],16:[function(a,b,c){function d(a,b,c){var d="withCredentials"in new XMLHttpRequest;if(!b)return Promise.reject("No proxy configured");var e=g(d),i=h(b,a,e);return d?k(i):f(c,i,e).then(function(a){return o(a.content)})}function e(a,b,c){var d="crossOrigin"in new Image,e=g(d),i=h(b,a,e);return d?Promise.resolve(i):f(c,i,e).then(function(a){return"data:"+a.type+";base64,"+a.content})}function f(a,b,c){return new Promise(function(d,e){var f=a.createElement("script"),g=function(){delete window.html2canvas.proxy[c],a.body.removeChild(f)};window.html2canvas.proxy[c]=function(a){g(),d(a)},f.src=b,f.onerror=function(a){g(),e(a)},a.body.appendChild(f)})}function g(a){return a?"":"html2canvas_"+Date.now()+"_"+ ++p+"_"+Math.round(1e5*Math.random())}function h(a,b,c){return a+"?url="+encodeURIComponent(b)+(c.length?"&callback=html2canvas.proxy."+c:"")}function i(a){return function(b){var c,d=new DOMParser;try{c=d.parseFromString(b,"text/html")}catch(e){m("DOMParser not supported, falling back to createHTMLDocument"),c=document.implementation.createHTMLDocument("");try{c.open(),c.write(b),c.close()}catch(f){m("createHTMLDocument write not supported, falling back to document.body.innerHTML"),c.body.innerHTML=b}}var g=c.querySelector("base");if(!g||!g.href.host){var h=c.createElement("base");h.href=a,c.head.insertBefore(h,c.head.firstChild)}return c}}function j(a,b,c,e,f,g){return new d(a,b,window.document).then(i(a)).then(function(a){return n(a,c,e,f,g,0,0)})}var k=a("./xhr"),l=a("./utils"),m=a("./log"),n=a("./clone"),o=l.decode64,p=0;c.Proxy=d,c.ProxyURL=e,c.loadUrlDocument=j},{"./clone":2,"./log":13,"./utils":26,"./xhr":28}],17:[function(a,b,c){function d(a,b){var c=document.createElement("a");c.href=a,a=c.href,this.src=a,this.image=new Image;var d=this;this.promise=new Promise(function(c,f){d.image.crossOrigin="Anonymous",d.image.onload=c,d.image.onerror=f,new e(a,b,document).then(function(a){d.image.src=a})["catch"](f)})}var e=a("./proxy").ProxyURL;b.exports=d},{"./proxy":16}],18:[function(a,b,c){function d(a,b,c){e.call(this,a,b),this.isPseudoElement=!0,this.before=":before"===c}var e=a("./nodecontainer");d.prototype.cloneTo=function(a){d.prototype.cloneTo.call(this,a),a.isPseudoElement=!0,a.before=this.before},d.prototype=Object.create(e.prototype),d.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},d.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},d.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},d.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",d.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",b.exports=d},{"./nodecontainer":14}],19:[function(a,b,c){function d(a,b,c,d,e){this.width=a,this.height=b,this.images=c,this.options=d,this.document=e}var e=a("./log");d.prototype.renderImage=function(a,b,c,d){var e=a.cssInt("paddingLeft"),f=a.cssInt("paddingTop"),g=a.cssInt("paddingRight"),h=a.cssInt("paddingBottom"),i=c.borders,j=b.width-(i[1].width+i[3].width+e+g),k=b.height-(i[0].width+i[2].width+f+h);this.drawImage(d,0,0,d.image.width||j,d.image.height||k,b.left+e+i[3].width,b.top+f+i[0].width,j,k)},d.prototype.renderBackground=function(a,b,c){b.height>0&&b.width>0&&(this.renderBackgroundColor(a,b),this.renderBackgroundImage(a,b,c))},d.prototype.renderBackgroundColor=function(a,b){var c=a.color("backgroundColor");c.isTransparent()||this.rectangle(b.left,b.top,b.width,b.height,c)},d.prototype.renderBorders=function(a){a.forEach(this.renderBorder,this)},d.prototype.renderBorder=function(a){a.color.isTransparent()||null===a.args||this.drawShape(a.args,a.color)},d.prototype.renderBackgroundImage=function(a,b,c){var d=a.parseBackgroundImages();d.reverse().forEach(function(d,f,g){switch(d.method){case"url":var h=this.images.get(d.args[0]);h?this.renderBackgroundRepeating(a,b,h,g.length-(f+1),c):e("Error loading background-image",d.args[0]);break;case"linear-gradient":case"gradient":var i=this.images.get(d.value);i?this.renderBackgroundGradient(i,b,c):e("Error loading background-image",d.args[0]);break;case"none":break;default:e("Unknown background-image type",d.args[0])}},this)},d.prototype.renderBackgroundRepeating=function(a,b,c,d,e){var f=a.parseBackgroundSize(b,c.image,d),g=a.parseBackgroundPosition(b,c.image,d,f),h=a.parseBackgroundRepeat(d);switch(h){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+e[3],b.top+g.top+e[0],99999,f.height,e);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+e[0],f.width,99999,e);break;case"no-repeat":this.backgroundRepeatShape(c,g,f,b,b.left+g.left+e[3],b.top+g.top+e[0],f.width,f.height,e);break;default:this.renderBackgroundRepeat(c,g,f,{top:b.top,left:b.left},e[3],e[0])}},b.exports=d},{"./log":13}],20:[function(a,b,c){function d(a,b){f.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=a,this.canvas.height=b),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},h("Initialized CanvasRenderer with size",a,"x",b)}function e(a){return a.length>0}var f=a("../renderer"),g=a("../lineargradientcontainer"),h=a("../log");d.prototype=Object.create(f.prototype),d.prototype.setFillStyle=function(a){return this.ctx.fillStyle="object"==typeof a&&a.isColor?a.toString():a,this.ctx},d.prototype.rectangle=function(a,b,c,d,e){this.setFillStyle(e).fillRect(a,b,c,d)},d.prototype.circle=function(a,b,c,d){this.setFillStyle(d),this.ctx.beginPath(),this.ctx.arc(a+c/2,b+c/2,c/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},d.prototype.circleStroke=function(a,b,c,d,e,f){this.circle(a,b,c,d),this.ctx.strokeStyle=f.toString(),this.ctx.stroke()},d.prototype.drawShape=function(a,b){this.shape(a),this.setFillStyle(b).fill()},d.prototype.taints=function(a){if(null===a.tainted){this.taintCtx.drawImage(a.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),a.tainted=!1}catch(b){this.taintCtx=document.createElement("canvas").getContext("2d"),a.tainted=!0}}return a.tainted},d.prototype.drawImage=function(a,b,c,d,e,f,g,h,i){(!this.taints(a)||this.options.allowTaint)&&this.ctx.drawImage(a.image,b,c,d,e,f,g,h,i)},d.prototype.clip=function(a,b,c){this.ctx.save(),a.filter(e).forEach(function(a){this.shape(a).clip()},this),b.call(c),this.ctx.restore()},d.prototype.shape=function(a){return this.ctx.beginPath(),a.forEach(function(a,b){"rect"===a[0]?this.ctx.rect.apply(this.ctx,a.slice(1)):this.ctx[0===b?"moveTo":a[0]+"To"].apply(this.ctx,a.slice(1))},this),this.ctx.closePath(),this.ctx},d.prototype.font=function(a,b,c,d,e,f){this.setFillStyle(a).font=[b,c,d,e,f].join(" ").split(",")[0]},d.prototype.fontShadow=function(a,b,c,d){this.setVariable("shadowColor",a.toString()).setVariable("shadowOffsetY",b).setVariable("shadowOffsetX",c).setVariable("shadowBlur",d)},d.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},d.prototype.setOpacity=function(a){this.ctx.globalAlpha=a},d.prototype.setTransform=function(a){this.ctx.translate(a.origin[0],a.origin[1]),this.ctx.transform.apply(this.ctx,a.matrix),this.ctx.translate(-a.origin[0],-a.origin[1])},d.prototype.setVariable=function(a,b){return this.variables[a]!==b&&(this.variables[a]=this.ctx[a]=b),this},d.prototype.text=function(a,b,c){this.ctx.fillText(a,b,c)},d.prototype.backgroundRepeatShape=function(a,b,c,d,e,f,g,h,i){var j=[["line",Math.round(e),Math.round(f)],["line",Math.round(e+g),Math.round(f)],["line",Math.round(e+g),Math.round(h+f)],["line",Math.round(e),Math.round(h+f)]];this.clip([j],function(){this.renderBackgroundRepeat(a,b,c,d,i[3],i[0])},this)},d.prototype.renderBackgroundRepeat=function(a,b,c,d,e,f){var g=Math.round(d.left+b.left+e),h=Math.round(d.top+b.top+f);this.setFillStyle(this.ctx.createPattern(this.resizeImage(a,c),"repeat")),this.ctx.translate(g,h),this.ctx.fill(),this.ctx.translate(-g,-h)},d.prototype.renderBackgroundGradient=function(a,b){if(a instanceof g){var c=this.ctx.createLinearGradient(b.left+b.width*a.x0,b.top+b.height*a.y0,b.left+b.width*a.x1,b.top+b.height*a.y1);a.colorStops.forEach(function(a){c.addColorStop(a.stop,a.color.toString())}),this.rectangle(b.left,b.top,b.width,b.height,c)}},d.prototype.resizeImage=function(a,b){var c=a.image;if(c.width===b.width&&c.height===b.height)return c;var d,e=document.createElement("canvas");return e.width=b.width,e.height=b.height,d=e.getContext("2d"),d.drawImage(c,0,0,c.width,c.height,0,0,b.width,b.height),e},b.exports=d},{"../lineargradientcontainer":12,"../log":13,"../renderer":19}],21:[function(a,b,c){function d(a,b,c,d){e.call(this,c,d),this.ownStacking=a,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*b}var e=a("./nodecontainer");d.prototype=Object.create(e.prototype),d.prototype.getParentStack=function(a){var b=this.parent?this.parent.stack:null;return b?b.ownStacking?b:b.getParentStack(a):a.stack},b.exports=d},{"./nodecontainer":14}],22:[function(a,b,c){function d(a){this.rangeBounds=this.testRangeBounds(a),this.cors=this.testCORS(),this.svg=this.testSVG()}d.prototype.testRangeBounds=function(a){var b,c,d,e,f=!1;return a.createRange&&(b=a.createRange(),b.getBoundingClientRect&&(c=a.createElement("boundtest"),c.style.height="123px",c.style.display="block",a.body.appendChild(c),b.selectNode(c),d=b.getBoundingClientRect(),e=d.height,123===e&&(f=!0),a.body.removeChild(c))),f},d.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},d.prototype.testSVG=function(){var a=new Image,b=document.createElement("canvas"),c=b.getContext("2d");a.src="data:image/svg+xml,";try{c.drawImage(a,0,0),b.toDataURL()}catch(d){return!1}return!0},b.exports=d},{}],23:[function(a,b,c){function d(a){this.src=a,this.image=null;var b=this;this.promise=this.hasFabric().then(function(){return b.isInline(a)?Promise.resolve(b.inlineFormatting(a)):e(a)}).then(function(a){return new Promise(function(c){window.html2canvas.svg.fabric.loadSVGFromString(a,b.createCanvas.call(b,c))})})}var e=a("./xhr"),f=a("./utils").decode64;d.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},d.prototype.inlineFormatting=function(a){return/^data:image\/svg\+xml;base64,/.test(a)?this.decode64(this.removeContentType(a)):this.removeContentType(a)},d.prototype.removeContentType=function(a){return a.replace(/^data:image\/svg\+xml(;base64)?,/,"")},d.prototype.isInline=function(a){return/^data:image\/svg\+xml/i.test(a)},d.prototype.createCanvas=function(a){var b=this;return function(c,d){var e=new window.html2canvas.svg.fabric.StaticCanvas("c");b.image=e.lowerCanvasEl,e.setWidth(d.width).setHeight(d.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(c,d)).renderAll(),a(e.lowerCanvasEl)}},d.prototype.decode64=function(a){return"function"==typeof window.atob?window.atob(a):f(a)},b.exports=d},{"./utils":26,"./xhr":28}],24:[function(a,b,c){function d(a,b){this.src=a,this.image=null;var c=this;this.promise=b?new Promise(function(b,d){c.image=new Image,c.image.onload=b,c.image.onerror=d,c.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(a),c.image.complete===!0&&b(c.image)}):this.hasFabric().then(function(){return new Promise(function(b){window.html2canvas.svg.fabric.parseSVGDocument(a,c.createCanvas.call(c,b))})})}var e=a("./svgcontainer");d.prototype=Object.create(e.prototype),b.exports=d},{"./svgcontainer":23}],25:[function(a,b,c){function d(a,b){f.call(this,a,b)}function e(a,b,c){return a.length>0?b+c.toUpperCase():void 0}var f=a("./nodecontainer");d.prototype=Object.create(f.prototype),d.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},d.prototype.transform=function(a){var b=this.node.data;switch(a){case"lowercase":return b.toLowerCase();case"capitalize":return b.replace(/(^|\s|:|-|\(|\))([a-z])/g,e);case"uppercase":return b.toUpperCase();default:return b}},b.exports=d},{"./nodecontainer":14}],26:[function(a,b,c){c.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},c.bind=function(a,b){return function(){return a.apply(b,arguments)}},c.decode64=function(a){var b,c,d,e,f,g,h,i,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=a.length,l="";for(b=0;k>b;b+=4)c=j.indexOf(a[b]),d=j.indexOf(a[b+1]),e=j.indexOf(a[b+2]),f=j.indexOf(a[b+3]),g=c<<2|d>>4,h=(15&d)<<4|e>>2,i=(3&e)<<6|f,l+=64===e?String.fromCharCode(g):64===f||-1===f?String.fromCharCode(g,h):String.fromCharCode(g,h,i);return l},c.getBounds=function(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c=null==a.offsetWidth?b.width:a.offsetWidth;return{top:b.top,bottom:b.bottom||b.top+b.height,right:b.left+c,left:b.left,width:c,height:null==a.offsetHeight?b.height:a.offsetHeight}}return{}},c.offsetBounds=function(a){var b=a.offsetParent?c.offsetBounds(a.offsetParent):{top:0,left:0};return{top:a.offsetTop+b.top,bottom:a.offsetTop+a.offsetHeight+b.top,right:a.offsetLeft+b.left+a.offsetWidth,left:a.offsetLeft+b.left,width:a.offsetWidth,height:a.offsetHeight}},c.parseBackgrounds=function(a){var b,c,d,e,f,g,h,i=" \r\n ",j=[],k=0,l=0,m=function(){b&&('"'===c.substr(0,1)&&(c=c.substr(1,c.length-2)),c&&h.push(c),"-"===b.substr(0,1)&&(e=b.indexOf("-",1)+1)>0&&(d=b.substr(0,e),b=b.substr(e)),j.push({prefix:d,method:b.toLowerCase(),value:f,args:h,image:null})),h=[],b=d=c=f=""};return h=[],b=d=c=f="",a.split("").forEach(function(a){if(!(0===k&&i.indexOf(a)>-1)){switch(a){case'"':g?g===a&&(g=null):g=a;break;case"(":if(g)break;if(0===k)return k=1,void(f+=a);l++;break;case")":if(g)break;if(1===k){if(0===l)return k=0,f+=a,void m();l--}break;case",":if(g)break;if(0===k)return void m();if(1===k&&0===l&&!b.match(/^url$/i))return h.push(c),c="",void(f+=a)}f+=a,0===k?b+=a:c+=a}}),m(),j}},{}],27:[function(a,b,c){function d(a){e.apply(this,arguments),this.type="linear"===a.args[0]?e.TYPES.LINEAR:e.TYPES.RADIAL}var e=a("./gradientcontainer");d.prototype=Object.create(e.prototype),b.exports=d},{"./gradientcontainer":9}],28:[function(a,b,c){function d(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.onload=function(){200===d.status?b(d.responseText):c(new Error(d.statusText))},d.onerror=function(){c(new Error("Network Error"))},d.send()})}b.exports=d},{}]},{},[4])(4)}); \ No newline at end of file diff --git a/stickmanboost/icon-256.png b/stickmanboost/icon-256.png new file mode 100644 index 00000000..a6fa8ea3 Binary files /dev/null and b/stickmanboost/icon-256.png differ diff --git a/stickmanboost/images/achievementicon-sheet0.png b/stickmanboost/images/achievementicon-sheet0.png new file mode 100644 index 00000000..6c6bffa8 Binary files /dev/null and b/stickmanboost/images/achievementicon-sheet0.png differ diff --git a/stickmanboost/images/achievementpoddon-sheet0.png b/stickmanboost/images/achievementpoddon-sheet0.png new file mode 100644 index 00000000..fe6e0bb6 Binary files /dev/null and b/stickmanboost/images/achievementpoddon-sheet0.png differ diff --git a/stickmanboost/images/animationhero-sheet0.png b/stickmanboost/images/animationhero-sheet0.png new file mode 100644 index 00000000..2d17101a Binary files /dev/null and b/stickmanboost/images/animationhero-sheet0.png differ diff --git a/stickmanboost/images/animationhero-sheet1.png b/stickmanboost/images/animationhero-sheet1.png new file mode 100644 index 00000000..aa1894cb Binary files /dev/null and b/stickmanboost/images/animationhero-sheet1.png differ diff --git a/stickmanboost/images/animationhero-sheet2.png b/stickmanboost/images/animationhero-sheet2.png new file mode 100644 index 00000000..e3212bcf Binary files /dev/null and b/stickmanboost/images/animationhero-sheet2.png differ diff --git a/stickmanboost/images/arr-sheet0.png b/stickmanboost/images/arr-sheet0.png new file mode 100644 index 00000000..478199dc Binary files /dev/null and b/stickmanboost/images/arr-sheet0.png differ diff --git a/stickmanboost/images/arrow-sheet0.png b/stickmanboost/images/arrow-sheet0.png new file mode 100644 index 00000000..87740690 Binary files /dev/null and b/stickmanboost/images/arrow-sheet0.png differ diff --git a/stickmanboost/images/blacker-sheet0.png b/stickmanboost/images/blacker-sheet0.png new file mode 100644 index 00000000..32347399 Binary files /dev/null and b/stickmanboost/images/blacker-sheet0.png differ diff --git a/stickmanboost/images/boxdestroy-sheet0.png b/stickmanboost/images/boxdestroy-sheet0.png new file mode 100644 index 00000000..78a2cd10 Binary files /dev/null and b/stickmanboost/images/boxdestroy-sheet0.png differ diff --git a/stickmanboost/images/bridge1.png b/stickmanboost/images/bridge1.png new file mode 100644 index 00000000..e1672697 Binary files /dev/null and b/stickmanboost/images/bridge1.png differ diff --git a/stickmanboost/images/bridge2.png b/stickmanboost/images/bridge2.png new file mode 100644 index 00000000..9d55970c Binary files /dev/null and b/stickmanboost/images/bridge2.png differ diff --git a/stickmanboost/images/bridge3.png b/stickmanboost/images/bridge3.png new file mode 100644 index 00000000..49dbb906 Binary files /dev/null and b/stickmanboost/images/bridge3.png differ diff --git a/stickmanboost/images/buttonachievements-sheet0.png b/stickmanboost/images/buttonachievements-sheet0.png new file mode 100644 index 00000000..06587d16 Binary files /dev/null and b/stickmanboost/images/buttonachievements-sheet0.png differ diff --git a/stickmanboost/images/buttonachievementsface-sheet0.png b/stickmanboost/images/buttonachievementsface-sheet0.png new file mode 100644 index 00000000..d2dc1bb0 Binary files /dev/null and b/stickmanboost/images/buttonachievementsface-sheet0.png differ diff --git a/stickmanboost/images/buttonbackface-sheet0.png b/stickmanboost/images/buttonbackface-sheet0.png new file mode 100644 index 00000000..66611097 Binary files /dev/null and b/stickmanboost/images/buttonbackface-sheet0.png differ diff --git a/stickmanboost/images/buttonbigachievements-sheet0.png b/stickmanboost/images/buttonbigachievements-sheet0.png new file mode 100644 index 00000000..dd0de01e Binary files /dev/null and b/stickmanboost/images/buttonbigachievements-sheet0.png differ diff --git a/stickmanboost/images/buttonbigachievementsface-sheet0.png b/stickmanboost/images/buttonbigachievementsface-sheet0.png new file mode 100644 index 00000000..2b32db1f Binary files /dev/null and b/stickmanboost/images/buttonbigachievementsface-sheet0.png differ diff --git a/stickmanboost/images/buttonbigmoregames-sheet0.png b/stickmanboost/images/buttonbigmoregames-sheet0.png new file mode 100644 index 00000000..7b7e4665 Binary files /dev/null and b/stickmanboost/images/buttonbigmoregames-sheet0.png differ diff --git a/stickmanboost/images/buttonbigmoregamesface-sheet0.png b/stickmanboost/images/buttonbigmoregamesface-sheet0.png new file mode 100644 index 00000000..ea5d12ac Binary files /dev/null and b/stickmanboost/images/buttonbigmoregamesface-sheet0.png differ diff --git a/stickmanboost/images/buttonbigoptions-sheet0.png b/stickmanboost/images/buttonbigoptions-sheet0.png new file mode 100644 index 00000000..fd80e129 Binary files /dev/null and b/stickmanboost/images/buttonbigoptions-sheet0.png differ diff --git a/stickmanboost/images/buttonbigoptionsface-sheet0.png b/stickmanboost/images/buttonbigoptionsface-sheet0.png new file mode 100644 index 00000000..d9666ed4 Binary files /dev/null and b/stickmanboost/images/buttonbigoptionsface-sheet0.png differ diff --git a/stickmanboost/images/buttonbigscoreboard-sheet0.png b/stickmanboost/images/buttonbigscoreboard-sheet0.png new file mode 100644 index 00000000..828fbd51 Binary files /dev/null and b/stickmanboost/images/buttonbigscoreboard-sheet0.png differ diff --git a/stickmanboost/images/buttonbigscoreboardface-sheet0.png b/stickmanboost/images/buttonbigscoreboardface-sheet0.png new file mode 100644 index 00000000..5ab93f61 Binary files /dev/null and b/stickmanboost/images/buttonbigscoreboardface-sheet0.png differ diff --git a/stickmanboost/images/buttonbigstatistics-sheet0.png b/stickmanboost/images/buttonbigstatistics-sheet0.png new file mode 100644 index 00000000..45a23250 Binary files /dev/null and b/stickmanboost/images/buttonbigstatistics-sheet0.png differ diff --git a/stickmanboost/images/buttonbigstatisticsface-sheet0.png b/stickmanboost/images/buttonbigstatisticsface-sheet0.png new file mode 100644 index 00000000..75b698d5 Binary files /dev/null and b/stickmanboost/images/buttonbigstatisticsface-sheet0.png differ diff --git a/stickmanboost/images/buttonclear-sheet0.png b/stickmanboost/images/buttonclear-sheet0.png new file mode 100644 index 00000000..dca5a7e9 Binary files /dev/null and b/stickmanboost/images/buttonclear-sheet0.png differ diff --git a/stickmanboost/images/buttonclose-sheet0.png b/stickmanboost/images/buttonclose-sheet0.png new file mode 100644 index 00000000..beb2529d Binary files /dev/null and b/stickmanboost/images/buttonclose-sheet0.png differ diff --git a/stickmanboost/images/buttonidnet-sheet0.png b/stickmanboost/images/buttonidnet-sheet0.png new file mode 100644 index 00000000..d87c5e9e Binary files /dev/null and b/stickmanboost/images/buttonidnet-sheet0.png differ diff --git a/stickmanboost/images/buttoningamemainmenu-sheet0.png b/stickmanboost/images/buttoningamemainmenu-sheet0.png new file mode 100644 index 00000000..494e3833 Binary files /dev/null and b/stickmanboost/images/buttoningamemainmenu-sheet0.png differ diff --git a/stickmanboost/images/buttoningamenext-sheet0.png b/stickmanboost/images/buttoningamenext-sheet0.png new file mode 100644 index 00000000..5d586dbe Binary files /dev/null and b/stickmanboost/images/buttoningamenext-sheet0.png differ diff --git a/stickmanboost/images/buttoningamerestart-sheet0.png b/stickmanboost/images/buttoningamerestart-sheet0.png new file mode 100644 index 00000000..a0c11de6 Binary files /dev/null and b/stickmanboost/images/buttoningamerestart-sheet0.png differ diff --git a/stickmanboost/images/buttoningamescore-sheet0.png b/stickmanboost/images/buttoningamescore-sheet0.png new file mode 100644 index 00000000..5110c9f6 Binary files /dev/null and b/stickmanboost/images/buttoningamescore-sheet0.png differ diff --git a/stickmanboost/images/buttonleave-sheet0.png b/stickmanboost/images/buttonleave-sheet0.png new file mode 100644 index 00000000..9d90fa8b Binary files /dev/null and b/stickmanboost/images/buttonleave-sheet0.png differ diff --git a/stickmanboost/images/buttonmenuface-sheet0.png b/stickmanboost/images/buttonmenuface-sheet0.png new file mode 100644 index 00000000..460b6429 Binary files /dev/null and b/stickmanboost/images/buttonmenuface-sheet0.png differ diff --git a/stickmanboost/images/buttonnextlevelpage-sheet0.png b/stickmanboost/images/buttonnextlevelpage-sheet0.png new file mode 100644 index 00000000..5c7b1aa4 Binary files /dev/null and b/stickmanboost/images/buttonnextlevelpage-sheet0.png differ diff --git a/stickmanboost/images/buttonplayglobal-sheet0.png b/stickmanboost/images/buttonplayglobal-sheet0.png new file mode 100644 index 00000000..c777a718 Binary files /dev/null and b/stickmanboost/images/buttonplayglobal-sheet0.png differ diff --git a/stickmanboost/images/buttonplaylevel-sheet0.png b/stickmanboost/images/buttonplaylevel-sheet0.png new file mode 100644 index 00000000..9775f5cd Binary files /dev/null and b/stickmanboost/images/buttonplaylevel-sheet0.png differ diff --git a/stickmanboost/images/buttonplaylocal-sheet0.png b/stickmanboost/images/buttonplaylocal-sheet0.png new file mode 100644 index 00000000..447b2153 Binary files /dev/null and b/stickmanboost/images/buttonplaylocal-sheet0.png differ diff --git a/stickmanboost/images/buttonplayonline-sheet0.png b/stickmanboost/images/buttonplayonline-sheet0.png new file mode 100644 index 00000000..03d94356 Binary files /dev/null and b/stickmanboost/images/buttonplayonline-sheet0.png differ diff --git a/stickmanboost/images/buttonplayresume-sheet0.png b/stickmanboost/images/buttonplayresume-sheet0.png new file mode 100644 index 00000000..6c95e307 Binary files /dev/null and b/stickmanboost/images/buttonplayresume-sheet0.png differ diff --git a/stickmanboost/images/buttonprevlevelpage-sheet0.png b/stickmanboost/images/buttonprevlevelpage-sheet0.png new file mode 100644 index 00000000..238bd901 Binary files /dev/null and b/stickmanboost/images/buttonprevlevelpage-sheet0.png differ diff --git a/stickmanboost/images/buttonrestartface-sheet0.png b/stickmanboost/images/buttonrestartface-sheet0.png new file mode 100644 index 00000000..b074f08c Binary files /dev/null and b/stickmanboost/images/buttonrestartface-sheet0.png differ diff --git a/stickmanboost/images/buttonresume-sheet0.png b/stickmanboost/images/buttonresume-sheet0.png new file mode 100644 index 00000000..f9c9ac4b Binary files /dev/null and b/stickmanboost/images/buttonresume-sheet0.png differ diff --git a/stickmanboost/images/buttonscoreboardface-sheet0.png b/stickmanboost/images/buttonscoreboardface-sheet0.png new file mode 100644 index 00000000..7230c4a7 Binary files /dev/null and b/stickmanboost/images/buttonscoreboardface-sheet0.png differ diff --git a/stickmanboost/images/buttonsettingsface-sheet0.png b/stickmanboost/images/buttonsettingsface-sheet0.png new file mode 100644 index 00000000..4d449c5f Binary files /dev/null and b/stickmanboost/images/buttonsettingsface-sheet0.png differ diff --git a/stickmanboost/images/buttonstatisticface-sheet0.png b/stickmanboost/images/buttonstatisticface-sheet0.png new file mode 100644 index 00000000..949d7e76 Binary files /dev/null and b/stickmanboost/images/buttonstatisticface-sheet0.png differ diff --git a/stickmanboost/images/buttonswiftermusic-sheet0.png b/stickmanboost/images/buttonswiftermusic-sheet0.png new file mode 100644 index 00000000..11e706e0 Binary files /dev/null and b/stickmanboost/images/buttonswiftermusic-sheet0.png differ diff --git a/stickmanboost/images/buttony8-sheet0.png b/stickmanboost/images/buttony8-sheet0.png new file mode 100644 index 00000000..31f584d5 Binary files /dev/null and b/stickmanboost/images/buttony8-sheet0.png differ diff --git a/stickmanboost/images/coin-sheet0.png b/stickmanboost/images/coin-sheet0.png new file mode 100644 index 00000000..7b60b6f2 Binary files /dev/null and b/stickmanboost/images/coin-sheet0.png differ diff --git a/stickmanboost/images/coin-sheet1.png b/stickmanboost/images/coin-sheet1.png new file mode 100644 index 00000000..800f02aa Binary files /dev/null and b/stickmanboost/images/coin-sheet1.png differ diff --git a/stickmanboost/images/coin-sheet2.png b/stickmanboost/images/coin-sheet2.png new file mode 100644 index 00000000..c1477af2 Binary files /dev/null and b/stickmanboost/images/coin-sheet2.png differ diff --git a/stickmanboost/images/conveercover-sheet0.png b/stickmanboost/images/conveercover-sheet0.png new file mode 100644 index 00000000..51fa3838 Binary files /dev/null and b/stickmanboost/images/conveercover-sheet0.png differ diff --git a/stickmanboost/images/conveerlenta-sheet0.png b/stickmanboost/images/conveerlenta-sheet0.png new file mode 100644 index 00000000..a901f19a Binary files /dev/null and b/stickmanboost/images/conveerlenta-sheet0.png differ diff --git a/stickmanboost/images/conveerruchka-sheet0.png b/stickmanboost/images/conveerruchka-sheet0.png new file mode 100644 index 00000000..775aeec7 Binary files /dev/null and b/stickmanboost/images/conveerruchka-sheet0.png differ diff --git a/stickmanboost/images/core-sheet0.png b/stickmanboost/images/core-sheet0.png new file mode 100644 index 00000000..f3f27994 Binary files /dev/null and b/stickmanboost/images/core-sheet0.png differ diff --git a/stickmanboost/images/effectboxparticles-sheet0.png b/stickmanboost/images/effectboxparticles-sheet0.png new file mode 100644 index 00000000..59522570 Binary files /dev/null and b/stickmanboost/images/effectboxparticles-sheet0.png differ diff --git a/stickmanboost/images/effectboxparticles-sheet1.png b/stickmanboost/images/effectboxparticles-sheet1.png new file mode 100644 index 00000000..84e4f0c7 Binary files /dev/null and b/stickmanboost/images/effectboxparticles-sheet1.png differ diff --git a/stickmanboost/images/effectboxparticles-sheet2.png b/stickmanboost/images/effectboxparticles-sheet2.png new file mode 100644 index 00000000..26d7a554 Binary files /dev/null and b/stickmanboost/images/effectboxparticles-sheet2.png differ diff --git a/stickmanboost/images/effectcoin-sheet0.png b/stickmanboost/images/effectcoin-sheet0.png new file mode 100644 index 00000000..d4f97aa6 Binary files /dev/null and b/stickmanboost/images/effectcoin-sheet0.png differ diff --git a/stickmanboost/images/effectcoin-sheet1.png b/stickmanboost/images/effectcoin-sheet1.png new file mode 100644 index 00000000..36759194 Binary files /dev/null and b/stickmanboost/images/effectcoin-sheet1.png differ diff --git a/stickmanboost/images/effectcore-sheet0.png b/stickmanboost/images/effectcore-sheet0.png new file mode 100644 index 00000000..35644802 Binary files /dev/null and b/stickmanboost/images/effectcore-sheet0.png differ diff --git a/stickmanboost/images/effectexplosion-sheet0.png b/stickmanboost/images/effectexplosion-sheet0.png new file mode 100644 index 00000000..87168842 Binary files /dev/null and b/stickmanboost/images/effectexplosion-sheet0.png differ diff --git a/stickmanboost/images/effectexplosion-sheet1.png b/stickmanboost/images/effectexplosion-sheet1.png new file mode 100644 index 00000000..7fede851 Binary files /dev/null and b/stickmanboost/images/effectexplosion-sheet1.png differ diff --git a/stickmanboost/images/effectexplosion-sheet2.png b/stickmanboost/images/effectexplosion-sheet2.png new file mode 100644 index 00000000..43a65ede Binary files /dev/null and b/stickmanboost/images/effectexplosion-sheet2.png differ diff --git a/stickmanboost/images/effectsmoke-sheet0.png b/stickmanboost/images/effectsmoke-sheet0.png new file mode 100644 index 00000000..ee7b1949 Binary files /dev/null and b/stickmanboost/images/effectsmoke-sheet0.png differ diff --git a/stickmanboost/images/effectsmoke-sheet1.png b/stickmanboost/images/effectsmoke-sheet1.png new file mode 100644 index 00000000..c991292d Binary files /dev/null and b/stickmanboost/images/effectsmoke-sheet1.png differ diff --git a/stickmanboost/images/effectsmoke-sheet2.png b/stickmanboost/images/effectsmoke-sheet2.png new file mode 100644 index 00000000..c7096c76 Binary files /dev/null and b/stickmanboost/images/effectsmoke-sheet2.png differ diff --git a/stickmanboost/images/effectstain-sheet0.png b/stickmanboost/images/effectstain-sheet0.png new file mode 100644 index 00000000..4dcc4a59 Binary files /dev/null and b/stickmanboost/images/effectstain-sheet0.png differ diff --git a/stickmanboost/images/finish-sheet0.png b/stickmanboost/images/finish-sheet0.png new file mode 100644 index 00000000..f05a7f18 Binary files /dev/null and b/stickmanboost/images/finish-sheet0.png differ diff --git a/stickmanboost/images/fun-sheet0.png b/stickmanboost/images/fun-sheet0.png new file mode 100644 index 00000000..238ca074 Binary files /dev/null and b/stickmanboost/images/fun-sheet0.png differ diff --git a/stickmanboost/images/fun-sheet1.png b/stickmanboost/images/fun-sheet1.png new file mode 100644 index 00000000..1a0701c5 Binary files /dev/null and b/stickmanboost/images/fun-sheet1.png differ diff --git a/stickmanboost/images/funair-sheet0.png b/stickmanboost/images/funair-sheet0.png new file mode 100644 index 00000000..6fb53cbd Binary files /dev/null and b/stickmanboost/images/funair-sheet0.png differ diff --git a/stickmanboost/images/guigold-sheet0.png b/stickmanboost/images/guigold-sheet0.png new file mode 100644 index 00000000..db796120 Binary files /dev/null and b/stickmanboost/images/guigold-sheet0.png differ diff --git a/stickmanboost/images/guigold-sheet1.png b/stickmanboost/images/guigold-sheet1.png new file mode 100644 index 00000000..ed098320 Binary files /dev/null and b/stickmanboost/images/guigold-sheet1.png differ diff --git a/stickmanboost/images/guigold-sheet2.png b/stickmanboost/images/guigold-sheet2.png new file mode 100644 index 00000000..fd017d5a Binary files /dev/null and b/stickmanboost/images/guigold-sheet2.png differ diff --git a/stickmanboost/images/guileftdown-sheet0.png b/stickmanboost/images/guileftdown-sheet0.png new file mode 100644 index 00000000..540dce2a Binary files /dev/null and b/stickmanboost/images/guileftdown-sheet0.png differ diff --git a/stickmanboost/images/guileftup-sheet0.png b/stickmanboost/images/guileftup-sheet0.png new file mode 100644 index 00000000..c21854dd Binary files /dev/null and b/stickmanboost/images/guileftup-sheet0.png differ diff --git a/stickmanboost/images/guimedal-sheet0.png b/stickmanboost/images/guimedal-sheet0.png new file mode 100644 index 00000000..cf741c92 Binary files /dev/null and b/stickmanboost/images/guimedal-sheet0.png differ diff --git a/stickmanboost/images/guiperfect-sheet0.png b/stickmanboost/images/guiperfect-sheet0.png new file mode 100644 index 00000000..1dbaae04 Binary files /dev/null and b/stickmanboost/images/guiperfect-sheet0.png differ diff --git a/stickmanboost/images/guirightdown-sheet0.png b/stickmanboost/images/guirightdown-sheet0.png new file mode 100644 index 00000000..bbae5801 Binary files /dev/null and b/stickmanboost/images/guirightdown-sheet0.png differ diff --git a/stickmanboost/images/guirightup-sheet0.png b/stickmanboost/images/guirightup-sheet0.png new file mode 100644 index 00000000..1f083ab4 Binary files /dev/null and b/stickmanboost/images/guirightup-sheet0.png differ diff --git a/stickmanboost/images/guiskull-sheet0.png b/stickmanboost/images/guiskull-sheet0.png new file mode 100644 index 00000000..6a18ba26 Binary files /dev/null and b/stickmanboost/images/guiskull-sheet0.png differ diff --git a/stickmanboost/images/guistar-sheet0.png b/stickmanboost/images/guistar-sheet0.png new file mode 100644 index 00000000..07b6f59e Binary files /dev/null and b/stickmanboost/images/guistar-sheet0.png differ diff --git a/stickmanboost/images/gun-sheet0.png b/stickmanboost/images/gun-sheet0.png new file mode 100644 index 00000000..049549ff Binary files /dev/null and b/stickmanboost/images/gun-sheet0.png differ diff --git a/stickmanboost/images/gun-sheet1.png b/stickmanboost/images/gun-sheet1.png new file mode 100644 index 00000000..ca2e7424 Binary files /dev/null and b/stickmanboost/images/gun-sheet1.png differ diff --git a/stickmanboost/images/herospawner-sheet0.png b/stickmanboost/images/herospawner-sheet0.png new file mode 100644 index 00000000..3ce1172c Binary files /dev/null and b/stickmanboost/images/herospawner-sheet0.png differ diff --git a/stickmanboost/images/jetpack-sheet0.png b/stickmanboost/images/jetpack-sheet0.png new file mode 100644 index 00000000..65fed7f9 Binary files /dev/null and b/stickmanboost/images/jetpack-sheet0.png differ diff --git a/stickmanboost/images/joint-sheet0.png b/stickmanboost/images/joint-sheet0.png new file mode 100644 index 00000000..d71d27f9 Binary files /dev/null and b/stickmanboost/images/joint-sheet0.png differ diff --git a/stickmanboost/images/jointstick-sheet0.png b/stickmanboost/images/jointstick-sheet0.png new file mode 100644 index 00000000..cde17091 Binary files /dev/null and b/stickmanboost/images/jointstick-sheet0.png differ diff --git a/stickmanboost/images/jumpplatform-sheet0.png b/stickmanboost/images/jumpplatform-sheet0.png new file mode 100644 index 00000000..85c6a43a Binary files /dev/null and b/stickmanboost/images/jumpplatform-sheet0.png differ diff --git a/stickmanboost/images/labelbonusstage-sheet0.png b/stickmanboost/images/labelbonusstage-sheet0.png new file mode 100644 index 00000000..8ed5863a Binary files /dev/null and b/stickmanboost/images/labelbonusstage-sheet0.png differ diff --git a/stickmanboost/images/labellavelbonus-sheet0.png b/stickmanboost/images/labellavelbonus-sheet0.png new file mode 100644 index 00000000..ad1099d8 Binary files /dev/null and b/stickmanboost/images/labellavelbonus-sheet0.png differ diff --git a/stickmanboost/images/land1.png b/stickmanboost/images/land1.png new file mode 100644 index 00000000..5d9b679d Binary files /dev/null and b/stickmanboost/images/land1.png differ diff --git a/stickmanboost/images/land2.png b/stickmanboost/images/land2.png new file mode 100644 index 00000000..99d5424b Binary files /dev/null and b/stickmanboost/images/land2.png differ diff --git a/stickmanboost/images/loaderbarback-sheet0.png b/stickmanboost/images/loaderbarback-sheet0.png new file mode 100644 index 00000000..be3a3441 Binary files /dev/null and b/stickmanboost/images/loaderbarback-sheet0.png differ diff --git a/stickmanboost/images/loadungprogressbar.png b/stickmanboost/images/loadungprogressbar.png new file mode 100644 index 00000000..87fbada0 Binary files /dev/null and b/stickmanboost/images/loadungprogressbar.png differ diff --git a/stickmanboost/images/logogame-sheet0.png b/stickmanboost/images/logogame-sheet0.png new file mode 100644 index 00000000..88907ac9 Binary files /dev/null and b/stickmanboost/images/logogame-sheet0.png differ diff --git a/stickmanboost/images/mainbackground.png b/stickmanboost/images/mainbackground.png new file mode 100644 index 00000000..be59dd09 Binary files /dev/null and b/stickmanboost/images/mainbackground.png differ diff --git a/stickmanboost/images/mine-sheet0.png b/stickmanboost/images/mine-sheet0.png new file mode 100644 index 00000000..c3def577 Binary files /dev/null and b/stickmanboost/images/mine-sheet0.png differ diff --git a/stickmanboost/images/moveplatformh-sheet0.png b/stickmanboost/images/moveplatformh-sheet0.png new file mode 100644 index 00000000..3b204012 Binary files /dev/null and b/stickmanboost/images/moveplatformh-sheet0.png differ diff --git a/stickmanboost/images/moveplatformv-sheet0.png b/stickmanboost/images/moveplatformv-sheet0.png new file mode 100644 index 00000000..360fb90c Binary files /dev/null and b/stickmanboost/images/moveplatformv-sheet0.png differ diff --git a/stickmanboost/images/movespecialplatformh.png b/stickmanboost/images/movespecialplatformh.png new file mode 100644 index 00000000..3b204012 Binary files /dev/null and b/stickmanboost/images/movespecialplatformh.png differ diff --git a/stickmanboost/images/movespecialplatformv.png b/stickmanboost/images/movespecialplatformv.png new file mode 100644 index 00000000..360fb90c Binary files /dev/null and b/stickmanboost/images/movespecialplatformv.png differ diff --git a/stickmanboost/images/onlineonline-sheet0.png b/stickmanboost/images/onlineonline-sheet0.png new file mode 100644 index 00000000..943ff714 Binary files /dev/null and b/stickmanboost/images/onlineonline-sheet0.png differ diff --git a/stickmanboost/images/onlineonline-sheet1.png b/stickmanboost/images/onlineonline-sheet1.png new file mode 100644 index 00000000..0189b4ed Binary files /dev/null and b/stickmanboost/images/onlineonline-sheet1.png differ diff --git a/stickmanboost/images/particles.png b/stickmanboost/images/particles.png new file mode 100644 index 00000000..8c3a85f6 Binary files /dev/null and b/stickmanboost/images/particles.png differ diff --git a/stickmanboost/images/particles2.png b/stickmanboost/images/particles2.png new file mode 100644 index 00000000..84a62753 Binary files /dev/null and b/stickmanboost/images/particles2.png differ diff --git a/stickmanboost/images/particlesfire.png b/stickmanboost/images/particlesfire.png new file mode 100644 index 00000000..63a75ffa Binary files /dev/null and b/stickmanboost/images/particlesfire.png differ diff --git a/stickmanboost/images/particlesninjatrail-sheet0.png b/stickmanboost/images/particlesninjatrail-sheet0.png new file mode 100644 index 00000000..f3edff1a Binary files /dev/null and b/stickmanboost/images/particlesninjatrail-sheet0.png differ diff --git a/stickmanboost/images/particlessmoke.png b/stickmanboost/images/particlessmoke.png new file mode 100644 index 00000000..1210e57b Binary files /dev/null and b/stickmanboost/images/particlessmoke.png differ diff --git a/stickmanboost/images/particleswater.png b/stickmanboost/images/particleswater.png new file mode 100644 index 00000000..61dc8655 Binary files /dev/null and b/stickmanboost/images/particleswater.png differ diff --git a/stickmanboost/images/polosa-sheet0.png b/stickmanboost/images/polosa-sheet0.png new file mode 100644 index 00000000..412bb439 Binary files /dev/null and b/stickmanboost/images/polosa-sheet0.png differ diff --git a/stickmanboost/images/polosa-sheet1.png b/stickmanboost/images/polosa-sheet1.png new file mode 100644 index 00000000..9e4b1bf2 Binary files /dev/null and b/stickmanboost/images/polosa-sheet1.png differ diff --git a/stickmanboost/images/polosa2-sheet0.png b/stickmanboost/images/polosa2-sheet0.png new file mode 100644 index 00000000..74e02e8c Binary files /dev/null and b/stickmanboost/images/polosa2-sheet0.png differ diff --git a/stickmanboost/images/polosa2-sheet1.png b/stickmanboost/images/polosa2-sheet1.png new file mode 100644 index 00000000..97626f25 Binary files /dev/null and b/stickmanboost/images/polosa2-sheet1.png differ diff --git a/stickmanboost/images/polosasmall-sheet0.png b/stickmanboost/images/polosasmall-sheet0.png new file mode 100644 index 00000000..154b3dab Binary files /dev/null and b/stickmanboost/images/polosasmall-sheet0.png differ diff --git a/stickmanboost/images/press-sheet0.png b/stickmanboost/images/press-sheet0.png new file mode 100644 index 00000000..37479abb Binary files /dev/null and b/stickmanboost/images/press-sheet0.png differ diff --git a/stickmanboost/images/pressstick-sheet0.png b/stickmanboost/images/pressstick-sheet0.png new file mode 100644 index 00000000..3d5af8f5 Binary files /dev/null and b/stickmanboost/images/pressstick-sheet0.png differ diff --git a/stickmanboost/images/progressdesriptin-sheet0.png b/stickmanboost/images/progressdesriptin-sheet0.png new file mode 100644 index 00000000..cf796d77 Binary files /dev/null and b/stickmanboost/images/progressdesriptin-sheet0.png differ diff --git a/stickmanboost/images/rollroadleft-sheet0.png b/stickmanboost/images/rollroadleft-sheet0.png new file mode 100644 index 00000000..ef05c9aa Binary files /dev/null and b/stickmanboost/images/rollroadleft-sheet0.png differ diff --git a/stickmanboost/images/rollroadright-sheet0.png b/stickmanboost/images/rollroadright-sheet0.png new file mode 100644 index 00000000..906684f4 Binary files /dev/null and b/stickmanboost/images/rollroadright-sheet0.png differ diff --git a/stickmanboost/images/rotatetrap1-sheet0.png b/stickmanboost/images/rotatetrap1-sheet0.png new file mode 100644 index 00000000..7ab52755 Binary files /dev/null and b/stickmanboost/images/rotatetrap1-sheet0.png differ diff --git a/stickmanboost/images/rotatetrap2-sheet0.png b/stickmanboost/images/rotatetrap2-sheet0.png new file mode 100644 index 00000000..55699e5f Binary files /dev/null and b/stickmanboost/images/rotatetrap2-sheet0.png differ diff --git a/stickmanboost/images/savepanel-sheet0.png b/stickmanboost/images/savepanel-sheet0.png new file mode 100644 index 00000000..1f9d6948 Binary files /dev/null and b/stickmanboost/images/savepanel-sheet0.png differ diff --git a/stickmanboost/images/savepanel-sheet1.png b/stickmanboost/images/savepanel-sheet1.png new file mode 100644 index 00000000..18d2c3f6 Binary files /dev/null and b/stickmanboost/images/savepanel-sheet1.png differ diff --git a/stickmanboost/images/saw-sheet0.png b/stickmanboost/images/saw-sheet0.png new file mode 100644 index 00000000..fb18b92c Binary files /dev/null and b/stickmanboost/images/saw-sheet0.png differ diff --git a/stickmanboost/images/saw-sheet1.png b/stickmanboost/images/saw-sheet1.png new file mode 100644 index 00000000..a208d0a4 Binary files /dev/null and b/stickmanboost/images/saw-sheet1.png differ diff --git a/stickmanboost/images/saw2-sheet0.png b/stickmanboost/images/saw2-sheet0.png new file mode 100644 index 00000000..3f361ec8 Binary files /dev/null and b/stickmanboost/images/saw2-sheet0.png differ diff --git a/stickmanboost/images/sawpng-sheet0.png b/stickmanboost/images/sawpng-sheet0.png new file mode 100644 index 00000000..ae43e547 Binary files /dev/null and b/stickmanboost/images/sawpng-sheet0.png differ diff --git a/stickmanboost/images/sawstick1-sheet0.png b/stickmanboost/images/sawstick1-sheet0.png new file mode 100644 index 00000000..636330d1 Binary files /dev/null and b/stickmanboost/images/sawstick1-sheet0.png differ diff --git a/stickmanboost/images/sawstick2-sheet0.png b/stickmanboost/images/sawstick2-sheet0.png new file mode 100644 index 00000000..9000c868 Binary files /dev/null and b/stickmanboost/images/sawstick2-sheet0.png differ diff --git a/stickmanboost/images/scaletimebackground-sheet0.png b/stickmanboost/images/scaletimebackground-sheet0.png new file mode 100644 index 00000000..0d591e9c Binary files /dev/null and b/stickmanboost/images/scaletimebackground-sheet0.png differ diff --git a/stickmanboost/images/sensorbuttondown-sheet0.png b/stickmanboost/images/sensorbuttondown-sheet0.png new file mode 100644 index 00000000..fcdaec0e Binary files /dev/null and b/stickmanboost/images/sensorbuttondown-sheet0.png differ diff --git a/stickmanboost/images/sensorbuttonleft-sheet0.png b/stickmanboost/images/sensorbuttonleft-sheet0.png new file mode 100644 index 00000000..7d00b5a6 Binary files /dev/null and b/stickmanboost/images/sensorbuttonleft-sheet0.png differ diff --git a/stickmanboost/images/sensorbuttonright-sheet0.png b/stickmanboost/images/sensorbuttonright-sheet0.png new file mode 100644 index 00000000..704b82ac Binary files /dev/null and b/stickmanboost/images/sensorbuttonright-sheet0.png differ diff --git a/stickmanboost/images/sensorbuttonup-sheet0.png b/stickmanboost/images/sensorbuttonup-sheet0.png new file mode 100644 index 00000000..a2d6e68a Binary files /dev/null and b/stickmanboost/images/sensorbuttonup-sheet0.png differ diff --git a/stickmanboost/images/sensordropjetpack-sheet0.png b/stickmanboost/images/sensordropjetpack-sheet0.png new file mode 100644 index 00000000..d0cca037 Binary files /dev/null and b/stickmanboost/images/sensordropjetpack-sheet0.png differ diff --git a/stickmanboost/images/sensorseat-sheet0.png b/stickmanboost/images/sensorseat-sheet0.png new file mode 100644 index 00000000..d9433092 Binary files /dev/null and b/stickmanboost/images/sensorseat-sheet0.png differ diff --git a/stickmanboost/images/spikes-sheet0.png b/stickmanboost/images/spikes-sheet0.png new file mode 100644 index 00000000..ef528f99 Binary files /dev/null and b/stickmanboost/images/spikes-sheet0.png differ diff --git a/stickmanboost/images/spikescover-sheet0.png b/stickmanboost/images/spikescover-sheet0.png new file mode 100644 index 00000000..7330e86a Binary files /dev/null and b/stickmanboost/images/spikescover-sheet0.png differ diff --git a/stickmanboost/images/spritefontstatistics.png b/stickmanboost/images/spritefontstatistics.png new file mode 100644 index 00000000..63a7b755 Binary files /dev/null and b/stickmanboost/images/spritefontstatistics.png differ diff --git a/stickmanboost/images/star-sheet0.png b/stickmanboost/images/star-sheet0.png new file mode 100644 index 00000000..60011bf0 Binary files /dev/null and b/stickmanboost/images/star-sheet0.png differ diff --git a/stickmanboost/images/statistics-sheet0.png b/stickmanboost/images/statistics-sheet0.png new file mode 100644 index 00000000..6af724de Binary files /dev/null and b/stickmanboost/images/statistics-sheet0.png differ diff --git a/stickmanboost/images/statistics2-sheet0.png b/stickmanboost/images/statistics2-sheet0.png new file mode 100644 index 00000000..1eac8002 Binary files /dev/null and b/stickmanboost/images/statistics2-sheet0.png differ diff --git a/stickmanboost/images/statisticsbig-sheet0.png b/stickmanboost/images/statisticsbig-sheet0.png new file mode 100644 index 00000000..74560279 Binary files /dev/null and b/stickmanboost/images/statisticsbig-sheet0.png differ diff --git a/stickmanboost/images/statisticsbigface-sheet0.png b/stickmanboost/images/statisticsbigface-sheet0.png new file mode 100644 index 00000000..c84affab Binary files /dev/null and b/stickmanboost/images/statisticsbigface-sheet0.png differ diff --git a/stickmanboost/images/statisticsbigface2-sheet0.png b/stickmanboost/images/statisticsbigface2-sheet0.png new file mode 100644 index 00000000..737aaeea Binary files /dev/null and b/stickmanboost/images/statisticsbigface2-sheet0.png differ diff --git a/stickmanboost/images/textsome.png b/stickmanboost/images/textsome.png new file mode 100644 index 00000000..9bd15a57 Binary files /dev/null and b/stickmanboost/images/textsome.png differ diff --git a/stickmanboost/images/textwhiteachievements.png b/stickmanboost/images/textwhiteachievements.png new file mode 100644 index 00000000..85606d19 Binary files /dev/null and b/stickmanboost/images/textwhiteachievements.png differ diff --git a/stickmanboost/images/textyellowachievements.png b/stickmanboost/images/textyellowachievements.png new file mode 100644 index 00000000..af71083f Binary files /dev/null and b/stickmanboost/images/textyellowachievements.png differ diff --git a/stickmanboost/images/tilecrash-sheet0.png b/stickmanboost/images/tilecrash-sheet0.png new file mode 100644 index 00000000..505ab344 Binary files /dev/null and b/stickmanboost/images/tilecrash-sheet0.png differ diff --git a/stickmanboost/images/tiledanger-sheet0.png b/stickmanboost/images/tiledanger-sheet0.png new file mode 100644 index 00000000..59431ab6 Binary files /dev/null and b/stickmanboost/images/tiledanger-sheet0.png differ diff --git a/stickmanboost/images/tiledanger-sheet1.png b/stickmanboost/images/tiledanger-sheet1.png new file mode 100644 index 00000000..ae51ba4f Binary files /dev/null and b/stickmanboost/images/tiledanger-sheet1.png differ diff --git a/stickmanboost/images/tiledbackground.png b/stickmanboost/images/tiledbackground.png new file mode 100644 index 00000000..86d39958 Binary files /dev/null and b/stickmanboost/images/tiledbackground.png differ diff --git a/stickmanboost/images/tilefeel-sheet0.png b/stickmanboost/images/tilefeel-sheet0.png new file mode 100644 index 00000000..24a02d5f Binary files /dev/null and b/stickmanboost/images/tilefeel-sheet0.png differ diff --git a/stickmanboost/images/tilehor.png b/stickmanboost/images/tilehor.png new file mode 100644 index 00000000..f12bc23a Binary files /dev/null and b/stickmanboost/images/tilehor.png differ diff --git a/stickmanboost/images/tileskosleftbig-sheet0.png b/stickmanboost/images/tileskosleftbig-sheet0.png new file mode 100644 index 00000000..105d6a27 Binary files /dev/null and b/stickmanboost/images/tileskosleftbig-sheet0.png differ diff --git a/stickmanboost/images/tileskosleftsmall-sheet0.png b/stickmanboost/images/tileskosleftsmall-sheet0.png new file mode 100644 index 00000000..78255825 Binary files /dev/null and b/stickmanboost/images/tileskosleftsmall-sheet0.png differ diff --git a/stickmanboost/images/tileskosrightbig-sheet0.png b/stickmanboost/images/tileskosrightbig-sheet0.png new file mode 100644 index 00000000..afdeb73a Binary files /dev/null and b/stickmanboost/images/tileskosrightbig-sheet0.png differ diff --git a/stickmanboost/images/tileskosrightsmall-sheet0.png b/stickmanboost/images/tileskosrightsmall-sheet0.png new file mode 100644 index 00000000..e8dde84e Binary files /dev/null and b/stickmanboost/images/tileskosrightsmall-sheet0.png differ diff --git a/stickmanboost/images/tilespecialfeel.png b/stickmanboost/images/tilespecialfeel.png new file mode 100644 index 00000000..68e666b9 Binary files /dev/null and b/stickmanboost/images/tilespecialfeel.png differ diff --git a/stickmanboost/images/tilevert.png b/stickmanboost/images/tilevert.png new file mode 100644 index 00000000..9c28fbe0 Binary files /dev/null and b/stickmanboost/images/tilevert.png differ diff --git a/stickmanboost/images/tip-sheet0.png b/stickmanboost/images/tip-sheet0.png new file mode 100644 index 00000000..51f5b597 Binary files /dev/null and b/stickmanboost/images/tip-sheet0.png differ diff --git a/stickmanboost/images/titleboost-sheet0.png b/stickmanboost/images/titleboost-sheet0.png new file mode 100644 index 00000000..664204d8 Binary files /dev/null and b/stickmanboost/images/titleboost-sheet0.png differ diff --git a/stickmanboost/images/titlesnames-sheet0.png b/stickmanboost/images/titlesnames-sheet0.png new file mode 100644 index 00000000..d94ece84 Binary files /dev/null and b/stickmanboost/images/titlesnames-sheet0.png differ diff --git a/stickmanboost/images/titlesuperimport-sheet0.png b/stickmanboost/images/titlesuperimport-sheet0.png new file mode 100644 index 00000000..7c03459f Binary files /dev/null and b/stickmanboost/images/titlesuperimport-sheet0.png differ diff --git a/stickmanboost/images/titlethanks-sheet0.png b/stickmanboost/images/titlethanks-sheet0.png new file mode 100644 index 00000000..7f2de870 Binary files /dev/null and b/stickmanboost/images/titlethanks-sheet0.png differ diff --git a/stickmanboost/images/water.png b/stickmanboost/images/water.png new file mode 100644 index 00000000..bbc1ce15 Binary files /dev/null and b/stickmanboost/images/water.png differ diff --git a/stickmanboost/images/welcomefield-sheet0.png b/stickmanboost/images/welcomefield-sheet0.png new file mode 100644 index 00000000..2cc5f8ad Binary files /dev/null and b/stickmanboost/images/welcomefield-sheet0.png differ diff --git a/stickmanboost/images/windowaudion-sheet0.png b/stickmanboost/images/windowaudion-sheet0.png new file mode 100644 index 00000000..ca1820da Binary files /dev/null and b/stickmanboost/images/windowaudion-sheet0.png differ diff --git a/stickmanboost/images/windowcleardata-sheet0.png b/stickmanboost/images/windowcleardata-sheet0.png new file mode 100644 index 00000000..4e18cb2e Binary files /dev/null and b/stickmanboost/images/windowcleardata-sheet0.png differ diff --git a/stickmanboost/images/windowfinishlevel-sheet0.png b/stickmanboost/images/windowfinishlevel-sheet0.png new file mode 100644 index 00000000..8170693b Binary files /dev/null and b/stickmanboost/images/windowfinishlevel-sheet0.png differ diff --git a/stickmanboost/images/windowfinishlevelface-sheet0.png b/stickmanboost/images/windowfinishlevelface-sheet0.png new file mode 100644 index 00000000..21b61411 Binary files /dev/null and b/stickmanboost/images/windowfinishlevelface-sheet0.png differ diff --git a/stickmanboost/images/windowlevelssmall-sheet0.png b/stickmanboost/images/windowlevelssmall-sheet0.png new file mode 100644 index 00000000..f323e86d Binary files /dev/null and b/stickmanboost/images/windowlevelssmall-sheet0.png differ diff --git a/stickmanboost/images/windowlocal-sheet0.png b/stickmanboost/images/windowlocal-sheet0.png new file mode 100644 index 00000000..5d886160 Binary files /dev/null and b/stickmanboost/images/windowlocal-sheet0.png differ diff --git a/stickmanboost/images/windowonline-sheet0.png b/stickmanboost/images/windowonline-sheet0.png new file mode 100644 index 00000000..a34383ef Binary files /dev/null and b/stickmanboost/images/windowonline-sheet0.png differ diff --git a/stickmanboost/images/windowoptionface-sheet0.png b/stickmanboost/images/windowoptionface-sheet0.png new file mode 100644 index 00000000..52d4df31 Binary files /dev/null and b/stickmanboost/images/windowoptionface-sheet0.png differ diff --git a/stickmanboost/images/windowoptions-sheet0.png b/stickmanboost/images/windowoptions-sheet0.png new file mode 100644 index 00000000..3e4e8e07 Binary files /dev/null and b/stickmanboost/images/windowoptions-sheet0.png differ diff --git a/stickmanboost/images/windowpause-sheet0.png b/stickmanboost/images/windowpause-sheet0.png new file mode 100644 index 00000000..5beef00d Binary files /dev/null and b/stickmanboost/images/windowpause-sheet0.png differ diff --git a/stickmanboost/images/windowpauseface-sheet0.png b/stickmanboost/images/windowpauseface-sheet0.png new file mode 100644 index 00000000..a78c7466 Binary files /dev/null and b/stickmanboost/images/windowpauseface-sheet0.png differ diff --git a/stickmanboost/images/windowquality-sheet0.png b/stickmanboost/images/windowquality-sheet0.png new file mode 100644 index 00000000..b282fee5 Binary files /dev/null and b/stickmanboost/images/windowquality-sheet0.png differ diff --git a/stickmanboost/images/windowslevelbig-sheet0.png b/stickmanboost/images/windowslevelbig-sheet0.png new file mode 100644 index 00000000..f2e7a508 Binary files /dev/null and b/stickmanboost/images/windowslevelbig-sheet0.png differ diff --git a/stickmanboost/images/windowslevelbigface-sheet0.png b/stickmanboost/images/windowslevelbigface-sheet0.png new file mode 100644 index 00000000..864376e7 Binary files /dev/null and b/stickmanboost/images/windowslevelbigface-sheet0.png differ diff --git a/stickmanboost/images/windowslevelsmallface-sheet0.png b/stickmanboost/images/windowslevelsmallface-sheet0.png new file mode 100644 index 00000000..00f51e02 Binary files /dev/null and b/stickmanboost/images/windowslevelsmallface-sheet0.png differ diff --git a/stickmanboost/images/znakclock-sheet0.png b/stickmanboost/images/znakclock-sheet0.png new file mode 100644 index 00000000..56898e9f Binary files /dev/null and b/stickmanboost/images/znakclock-sheet0.png differ diff --git a/stickmanboost/images/znakjetpack-sheet0.png b/stickmanboost/images/znakjetpack-sheet0.png new file mode 100644 index 00000000..ded82eac Binary files /dev/null and b/stickmanboost/images/znakjetpack-sheet0.png differ diff --git a/stickmanboost/images/znakmoto-sheet0.png b/stickmanboost/images/znakmoto-sheet0.png new file mode 100644 index 00000000..6fdf86c8 Binary files /dev/null and b/stickmanboost/images/znakmoto-sheet0.png differ diff --git a/stickmanboost/images/znakrocket-sheet0.png b/stickmanboost/images/znakrocket-sheet0.png new file mode 100644 index 00000000..715d7273 Binary files /dev/null and b/stickmanboost/images/znakrocket-sheet0.png differ diff --git a/stickmanboost/images/znaksubmorine-sheet0.png b/stickmanboost/images/znaksubmorine-sheet0.png new file mode 100644 index 00000000..4f41b833 Binary files /dev/null and b/stickmanboost/images/znaksubmorine-sheet0.png differ diff --git a/stickmanboost/images/znaksubmorineoff-sheet0.png b/stickmanboost/images/znaksubmorineoff-sheet0.png new file mode 100644 index 00000000..23d2d7ec Binary files /dev/null and b/stickmanboost/images/znaksubmorineoff-sheet0.png differ diff --git a/stickmanboost/index.html b/stickmanboost/index.html new file mode 100644 index 00000000..324b641a --- /dev/null +++ b/stickmanboost/index.html @@ -0,0 +1,63 @@ + + + + + + Stickman Boost + + + + + + + + + + + + + +
      + +
      + + + + + + + diff --git a/stickmanboost/jquery-2.1.1.min.js b/stickmanboost/jquery-2.1.1.min.js new file mode 100644 index 00000000..9ed2acc6 --- /dev/null +++ b/stickmanboost/jquery-2.1.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
      ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) +},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
      "],col:[2,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("